natively 2.26.8 → 2.27.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 CHANGED
@@ -40,6 +40,123 @@ notifications.getOneSignalId(playerId_callback);
40
40
  window.natively.shareText("Hello world!");
41
41
  ```
42
42
 
43
+ ### Quick actions
44
+
45
+ Quick actions are available as a module export and are not registered on `window`.
46
+
47
+ ```javascript
48
+ import { NativelyQuickActions } from 'natively';
49
+
50
+ const quickActions = new NativelyQuickActions();
51
+
52
+ quickActions.setActions(
53
+ [
54
+ {
55
+ type: 'open_docs',
56
+ title: 'Docs',
57
+ subtitle: 'Open docs',
58
+ url: 'https://example.com/docs',
59
+ isEnabled: true,
60
+ },
61
+ ],
62
+ (resp) => {
63
+ console.log(resp.status);
64
+ console.log(resp.actions);
65
+ },
66
+ );
67
+
68
+ quickActions.clear((resp) => {
69
+ console.log(resp.actions); // []
70
+ });
71
+ ```
72
+
73
+ API:
74
+
75
+ ```javascript
76
+ const quickActions = new NativelyQuickActions();
77
+
78
+ quickActions.setActions(actions, callback);
79
+ quickActions.clear(callback);
80
+ ```
81
+
82
+ `setActions(actions, callback)`
83
+
84
+ - Sends the `quick_actions` runtime event.
85
+ - Replaces the full configured quick action set.
86
+ - Accepts an array of actions.
87
+ - Invokes `callback(response)` when native returns a result.
88
+
89
+ `clear(callback)`
90
+
91
+ - Sends the `clear_quick_actions` runtime event.
92
+ - Removes all active quick actions.
93
+ - Invokes `callback(response)` with an empty `actions` array on success.
94
+
95
+ Action fields:
96
+
97
+ - `type: string` is required.
98
+ - `url: string` is required.
99
+ - `title?: string` is optional. Native defaults it to `type` if omitted.
100
+ - `subtitle?: string` is optional.
101
+ - `isEnabled?: boolean` is optional. This is normalized to `is_enabled` before sending.
102
+ - `is_enabled?: boolean` is also accepted if you prefer snake_case.
103
+ - `icon?: string` is optional.
104
+ - `iosIcon?: string` or `ios_icon?: string` is optional.
105
+ - `androidIcon?: string` or `android_icon?: string` is optional.
106
+
107
+ Example payload sent by the SDK:
108
+
109
+ ```json
110
+ {
111
+ "actions": [
112
+ {
113
+ "type": "open_docs",
114
+ "title": "Docs",
115
+ "subtitle": "Open docs",
116
+ "url": "https://example.com/docs",
117
+ "is_enabled": true
118
+ }
119
+ ]
120
+ }
121
+ ```
122
+
123
+ Example response:
124
+
125
+ ```json
126
+ {
127
+ "status": "SUCCESS",
128
+ "actions": [
129
+ {
130
+ "type": "open_docs",
131
+ "url": "https://example.com/docs",
132
+ "title": "Docs",
133
+ "subtitle": "Open docs",
134
+ "is_enabled": true,
135
+ "ios_icon": "natively_quick_action_2",
136
+ "android_icon": "natively_quick_action_2"
137
+ }
138
+ ]
139
+ }
140
+ ```
141
+
142
+ Runtime behavior:
143
+
144
+ - `setActions()` replaces the full configured set. If you send only one action, the app keeps only that one action.
145
+ - Native stores all configured actions, including disabled ones.
146
+ - Only actions with `is_enabled: true` are initially registered with the OS.
147
+ - If you update an existing action with the same `type`, native can reuse previously known icon assets even when the runtime payload omits icon fields.
148
+ - Icon reuse is keyed by `type`. A different `type` does not reuse another action's icons.
149
+ - The recommended contract is to define icon URLs in app config and usually omit runtime icon fields.
150
+ - When a quick action is tapped, native matches it by `type` and opens its `url` through the app's existing navigation flow.
151
+ - If the URL matches a configured tab URL, the app switches tabs. Otherwise it loads the URL in the main webview.
152
+ - Cold-start quick action taps are queued until launch services are ready.
153
+
154
+ Build-time config notes:
155
+
156
+ - App config should use `ICON_URL`, `IOS_ICON_URL`, and `ANDROID_ICON_URL`.
157
+ - Static native resource names such as `ICON`, `IOS_ICON`, and `ANDROID_ICON` are not the intended source-config contract.
158
+ - iOS quick action icons are template-style assets, so simple glyph-style transparent icons work best for `IOS_ICON_URL`.
159
+
43
160
  ## 🛠 React/NextJS (min version 2.15.0)
44
161
 
45
162
  ### Installation:
@@ -8,15 +8,15 @@ export class NativelyLiveUpdates {
8
8
  _defineProperty(this, "id", generateID());
9
9
  }
10
10
  requestPermission(callback) {
11
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "live_update_permission", {});
11
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 45, callback, "live_update_permission", {});
12
12
  }
13
13
  start(payload, callback) {
14
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "live_update_setup", payload);
14
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 45, callback, "live_update_setup", payload);
15
15
  }
16
16
  update(payload, callback) {
17
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "live_update_update", payload);
17
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 45, callback, "live_update_update", payload);
18
18
  }
19
19
  end(payload, callback) {
20
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "live_update_end", payload);
20
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 45, callback, "live_update_end", payload);
21
21
  }
22
22
  }
@@ -0,0 +1,33 @@
1
+ export interface NativelyQuickActionPayload {
2
+ type: string;
3
+ url: string;
4
+ title?: string;
5
+ subtitle?: string;
6
+ isEnabled?: boolean;
7
+ is_enabled?: boolean;
8
+ icon?: string;
9
+ iosIcon?: string;
10
+ ios_icon?: string;
11
+ androidIcon?: string;
12
+ android_icon?: string;
13
+ }
14
+ export interface NativelyQuickActionState {
15
+ type: string;
16
+ url: string;
17
+ title: string;
18
+ subtitle?: string;
19
+ is_enabled: boolean;
20
+ icon?: string;
21
+ ios_icon?: string;
22
+ android_icon?: string;
23
+ }
24
+ export interface NativelyQuickActionsResponse {
25
+ status: string;
26
+ actions: NativelyQuickActionState[];
27
+ }
28
+ export declare class NativelyQuickActions {
29
+ private readonly id;
30
+ setActions(actions: NativelyQuickActionPayload[], callback?: (response: NativelyQuickActionsResponse) => void): void;
31
+ clear(callback?: (response: NativelyQuickActionsResponse) => void): void;
32
+ private normalizeAction;
33
+ }
@@ -0,0 +1,46 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID.js";
5
+ import globalContext from "../utils/globalThis.js";
6
+ export class NativelyQuickActions {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ setActions(actions, callback) {
11
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 46, callback, "quick_actions", {
12
+ actions: actions.map(action => this.normalizeAction(action))
13
+ });
14
+ }
15
+ clear(callback) {
16
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 46, callback, "clear_quick_actions", {});
17
+ }
18
+ normalizeAction(action) {
19
+ var normalizedAction = {
20
+ type: action.type,
21
+ url: action.url
22
+ };
23
+ if (typeof action.title !== "undefined") {
24
+ normalizedAction.title = action.title;
25
+ }
26
+ if (typeof action.subtitle !== "undefined") {
27
+ normalizedAction.subtitle = action.subtitle;
28
+ }
29
+ var isEnabled = typeof action.isEnabled !== "undefined" ? action.isEnabled : action.is_enabled;
30
+ if (typeof isEnabled !== "undefined") {
31
+ normalizedAction.is_enabled = isEnabled;
32
+ }
33
+ if (typeof action.icon !== "undefined") {
34
+ normalizedAction.icon = action.icon;
35
+ }
36
+ var iosIcon = typeof action.iosIcon !== "undefined" ? action.iosIcon : action.ios_icon;
37
+ if (typeof iosIcon !== "undefined") {
38
+ normalizedAction.ios_icon = iosIcon;
39
+ }
40
+ var androidIcon = typeof action.androidIcon !== "undefined" ? action.androidIcon : action.android_icon;
41
+ if (typeof androidIcon !== "undefined") {
42
+ normalizedAction.android_icon = androidIcon;
43
+ }
44
+ return normalizedAction;
45
+ }
46
+ }
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotific
24
24
  export { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications';
25
25
  export { NativelyCalendar } from "./classes/NativelyCalendar";
26
26
  export { NativelyLiveUpdates } from "./classes/NativelyLiveUpdates";
27
+ export { NativelyQuickActions } from "./classes/NativelyQuickActions";
27
28
  export { useNatively } from './hooks/useNatively';
28
29
  export { generateID } from "./utils/generateID";
29
30
  import "./types.js";
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotific
25
25
  export { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications.js';
26
26
  export { NativelyCalendar } from "./classes/NativelyCalendar.js";
27
27
  export { NativelyLiveUpdates } from "./classes/NativelyLiveUpdates.js";
28
+ export { NativelyQuickActions } from "./classes/NativelyQuickActions.js";
28
29
 
29
30
  // Hooks
30
31
  export { useNatively } from './hooks/useNatively.js';
@@ -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:()=>a,NativelyAdmobBanner:()=>S,NativelyAdmobInterstitial:()=>k,NativelyAppleSignInService:()=>r,NativelyAudioPlayer:()=>A,NativelyAudioRecorder:()=>N,NativelyBiometrics:()=>y,NativelyCalendar:()=>D,NativelyCamera:()=>h,NativelyClipboard:()=>s,NativelyContacts:()=>f,NativelyDatePicker:()=>p,NativelyFirebaseNotifications:()=>I,NativelyGeolocation:()=>u,NativelyHealth:()=>_,NativelyInfo:()=>o,NativelyKlaviyoNotifications:()=>P,NativelyLiveUpdates:()=>C,NativelyLocation:()=>v,NativelyMediaPicker:()=>w,NativelyMessage:()=>g,NativelyNFCService:()=>T,NativelyNotifications:()=>d,NativelyPurchases:()=>m,NativelyScanner:()=>b,NativelyStorage:()=>c,generateID:()=>n,useNatively:()=>M});const i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:null,l="2.26.5";class a{constructor(){var e,t,a,n;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.sdkVersion=l,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===(a=null==i?void 0:i.navigator)||void 0===a?void 0:a.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,a,n){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?a+"_response_"+e:a+"_response",i&&(i[t]=function(a,n){null==i||i.$agent.response(),n.message&&r?alert(`[ERROR] Error message: ${n.message}`):(r&&console.log(`[DEBUG] Callback method: ${t}, 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==i||i.$agent.trigger(a,n)}else null==i||i.natively.addObserver((()=>{null==i||i.natively.trigger(e,t,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==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)}analyticsSetUserId(e){const t={id:e.id};null==i||i.natively.trigger(void 0,37,void 0,"analytics_set_user_id",t)}analyticsSetUserProperty(e){const t={key:e.key,value:e.value};null==i||i.natively.trigger(void 0,37,void 0,"analytics_set_user_property",t)}requestAppReview(){null==i||i.natively.trigger(void 0,0,void 0,"request_review")}attShowPopup(e){null==i||i.natively.trigger(void 0,41,e,"att_show_popup")}attGetStatus(e){null==i||i.natively.trigger(void 0,41,e,"att_get_status")}getInsets(e){null==i||i.natively.trigger(void 0,36,e,"get_insets")}getLocales(e){null==i||i.natively.trigger(void 0,40,e,"get_locales")}setLocale(e,t){null==i||i.natively.trigger(void 0,40,t,"set_locale",{locale:e})}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")}getBatteryInfo(e){null==i||i.natively.trigger(void 0,43,e,"battery_info")}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})}}const n=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class r{constructor(){this.id=n()}signin(e){null==i||i.natively.trigger(this.id,16,e,"apple_signin",{})}}class s{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 o{constructor(){this.id=n()}browserInfo(){var e,t,l,a;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===(a=null===(l=null==i?void 0:i.navigator)||void 0===l?void 0:l.userAgent)||void 0===a?void 0:a.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 d{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 u{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 v{constructor(){this.id=n()}current(e,t,l,a,n=!0){null==i||i.natively.trigger(this.id,12,a,"location_current",{minAccuracy:e,accuracyType:t,priority:l,fallbackToSettings:n})}permission(e){null==i||i.natively.trigger(this.id,6,e,"location_permission")}start(e,t,l,a,n,r=!0){null==i||i.natively.trigger(this.id,12,n,"location_start",{minAccuracy:t,accuracyType:l,priority:a,fallbackToSettings:r,interval:e})}stop(){null==i||i.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,t,l,a,n,r,s=!0){const o={identifier:null!=n?n:"empty",interval:null!=e?e:6e4,minAccuracy:null!=t?t:50,accuracyType:null!=l?l:"Best",priority:null!=a?a:"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 g{constructor(){this.id=n()}sendSMS(e,t,l){const a={body:null!=e?e:"",recipient:null!=t?t:""};null==i||i.natively.trigger(this.id,0,l,"send_sms",a)}sendEmail(e,t,l,a){const n={subject:null!=e?e:"",body:null!=t?t:"",recipient:null!=l?l:""};null==i||i.natively.trigger(this.id,0,a,"send_email",n)}}class c{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 y{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 p{constructor(){this.id=n()}showDatePicker(e,t,l,a,n){const r={type:null!=l?l:"DATE",style:null!=a?a:"LIGHT",title:null!=e?e:"",description:null!=t?t:""};null==i||i.natively.trigger(this.id,0,n,"datepicker",r)}}class h{constructor(){this.id=n()}showCamera(e,t,l,a){const n={type:null!=e?e:"photo",quality:null!=t?t:"high",camera:null!=l?l:"BACK"};null==i||i.natively.trigger(this.id,2,a,"open_camera",n)}}class _{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,a,n){const r={data_type:e,interval:t};l&&(r.start_date=l.getTime()),a&&(r.end_date=a.getTime()),null==i||i.natively.trigger(this.id,10,n,"health_get_statistic_quantity",r)}getDailySleepAnalysis(e,t,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),t&&(n.end_date=t.getTime()),null==i||i.natively.trigger(this.id,10,a,"health_get_daily_sleep_analysis",n)}getWorkouts(e,t,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),t&&(n.end_date=t.getTime()),null==i||i.natively.trigger(this.id,21,a,"health_get_workouts",n)}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 a={};e&&(a.start_date=e.getTime()),t&&(a.end_date=t.getTime()),null==i||i.natively.trigger(this.id,10,l,"health_get_activity_summary",a)}}class b{constructor(){this.id=n()}showScanner(e){null==i||i.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,t,l,a,n,r,s,o,d,u,v,g,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),t&&(y.foregroundColor=t),l&&(y.backgroundColor=l),r&&(y.defaultFlashMode=r),s&&(y.defaultScanOrientation=s),v&&(y.defaultFilter=v),g&&(y.availableFilters=g),d&&(y.ocrConfiguration={languages:[d]}),null==i||i.natively.trigger(this.id,21,c,"open_document_scanner",y)}}class m{constructor(){this.id=n()}login(e,t,l){const a=null!=t?t:"";null==i||i.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:a})}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 a={offeringId:t,shouldShowCloseButton:e};null==i||i.natively.trigger(this.id,38,l,"purchases_show_paywall",a)}showPaywallIfNeeded(e,t,l,a){const n={offeringName:l,entitlementId:e,shouldShowCloseButton:t};null==i||i.natively.trigger(this.id,38,a,"purchases_show_paywall_if_needed",n)}purchasePackage(e,t,l,a){null==i||i.natively.trigger(this.id,3,t,"purchases_package",{packageId:e,oldProductId:null!=l?l:null,prorationMode:null!=a?a:null})}packagePrice(e,t){null==i||i.natively.trigger(this.id,8,t,"purchases_price",{packageId:e})}showCustomerCenter(e){null==i||i.natively.trigger(this.id,42,e,"purchases_show_customer_center",{})}}class f{constructor(){this.id=n()}getAllContacts(e){null==i||i.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,t,l,a,n){const r={firstName:e,lastName:null!=t?t:"",email:null!=l?l:"",phone:null!=a?a:""};null==i||i.natively.trigger(this.id,3,n,"contacts_save",r)}}class w{constructor(){this.id=n()}showMediaPicker(e){null==i||i.natively.trigger(this.id,8,e,"mediapicker",{})}}class N{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 A{constructor(){this.id=n()}buildMetadata(e){const t={};return e?(void 0!==e.id&&(t.id=e.id),void 0!==e.title&&(t.title=e.title),void 0!==e.artist&&(t.artist=e.artist),void 0!==e.album&&(t.album=e.album),void 0!==e.genre&&(t.genre=e.genre),void 0!==e.artwork&&(t.artwork=e.artwork),null!=e.duration&&(t.duration=e.duration),void 0!==e.extras&&(t.extras=e.extras),t):t}play(e,t,l){var a,n;const r=Object.assign({source:e,is_stream:null!==(a=null==t?void 0:t.is_stream)&&void 0!==a&&a,autoplay:null===(n=null==t?void 0:t.autoplay)||void 0===n||n},this.buildMetadata(t));void 0!==(null==t?void 0:t.headers)&&(r.headers=t.headers),null!=(null==t?void 0:t.start_position)&&(r.start_position=t.start_position),null!=(null==t?void 0:t.volume)&&(r.volume=t.volume),null!=(null==t?void 0:t.speed)&&(r.speed=t.speed),null==i||i.natively.trigger(this.id,39,l,"audio_play",r)}pause(e){null==i||i.natively.trigger(this.id,39,e,"audio_pause",{})}stop(e){null==i||i.natively.trigger(this.id,39,e,"audio_stop",{})}seek(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_seek",{position:e})}queueAdd(e,t,l){var a,n;const r=Object.assign({source:e,play_now:null!==(a=null==t?void 0:t.play_now)&&void 0!==a&&a,is_stream:null!==(n=null==t?void 0:t.is_stream)&&void 0!==n&&n},this.buildMetadata(t));void 0!==(null==t?void 0:t.headers)&&(r.headers=t.headers),null==i||i.natively.trigger(this.id,39,l,"audio_queue_add",r)}queueGet(e){null==i||i.natively.trigger(this.id,39,e,"audio_queue_get",{})}queueRemove(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_queue_remove",{index:e})}setMetadata(e,t){const l=this.buildMetadata(e);null==i||i.natively.trigger(this.id,39,t,"audio_set_metadata",l)}setVolume(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_set_volume",{volume:e})}setSpeed(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_set_speed",{speed:e})}}class S{constructor(e,t,l=!1,a,r=!1,s){var o,d,u,v,g,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!==(u=e.position)&&void 0!==u?u:"BOTTOM",y.sizeType=null!==(v=e.sizeType)&&void 0!==v?v:"AUTO",y.width=null!==(g=e.custom_width)&&void 0!==g?g: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 k{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 T{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 a={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",a)}write(e,t,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!=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,a,"nfc_write",s)}available(e){null==i||i.natively.trigger(this.id,15,e,"nfc_available",{})}}class I{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 P{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 D{constructor(){this.id=n()}createCalendarEvent(e,t,l,a,n,r,s){const o={title:e,timezone:a,calendarId:n,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",{})}}class C{constructor(){this.id=n()}requestPermission(e){null==i||i.natively.trigger(this.id,0,e,"live_update_permission",{})}start(e,t){null==i||i.natively.trigger(this.id,0,t,"live_update_setup",e)}update(e,t){null==i||i.natively.trigger(this.id,0,t,"live_update_update",e)}end(e,t){null==i||i.natively.trigger(this.id,0,t,"live_update_end",e)}}const M=()=>null==i?void 0:i.natively,O=e=>{var t,i,a,n,r;if(e.__nativelyNavigationProgressInstalled)return;e.__nativelyNavigationProgressInstalled=!0;let s=null,o=null,d=null,u=!1;const v=(t,i)=>{var l,a;null===(l=e.natively)||void 0===l||l.trigger(void 0,0,void 0,"web_navigation_progress",{phase:t,reason:i,href:null===(a=e.location)||void 0===a?void 0:a.href})},g=()=>{s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null)},c=()=>{null==d||d.disconnect(),d=null},y=t=>{g(),c(),(t=>{var i,a;u||(u=!0,null===(i=e.natively)||void 0===i||i.trigger(void 0,0,void 0,"web_sdk_version",{version:l,reason:t,href:null===(a=e.location)||void 0===a?void 0:a.href}))})(t),v("done",t)},p=()=>{s&&clearTimeout(s),s=setTimeout((()=>y("settled")),250)},h=(t,i=3e3)=>{g(),v("start",t),(()=>{var t;c();const i=null===(t=e.document)||void 0===t?void 0:t.documentElement;if(!i||"function"!=typeof e.MutationObserver)return void p();const l=new e.MutationObserver((()=>p()));l.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),d=l,p()})(),o=setTimeout((()=>y("timeout")),i)},_=t=>{var i;const l=null===(i=e.history)||void 0===i?void 0:i[t];"function"==typeof l&&(e.history[t]=function(...e){return h(t,1500),l.apply(this,e)})};_("pushState"),_("replaceState"),null===(t=e.addEventListener)||void 0===t||t.call(e,"popstate",(()=>h("popstate",1500))),null===(i=e.addEventListener)||void 0===i||i.call(e,"hashchange",(()=>h("hashchange",800))),null===(a=e.document)||void 0===a||a.addEventListener("click",(e=>{const t=e.target;if(!t||"function"!=typeof t.closest)return;const i=t.closest("a[href]");if(!i)return;const l=i.getAttribute("href")||"";if(!l||l.startsWith("#")||l.startsWith("javascript:"))return;const a=i.getAttribute("target");a&&"_self"!==a||h("anchor",4e3)}),!0),"complete"===(null===(n=e.document)||void 0===n?void 0:n.readyState)?y("ready"):null===(r=e.addEventListener)||void 0===r||r.call(e,"load",(()=>y("load")),{once:!0})};if(i){const e=(e=>{var t,i;if("function"==typeof(null===(t=e.$agent)||void 0===t?void 0:t.trigger))return!0;const l=(e=>{try{return e.self!==e.top}catch(e){return!0}})(e),a="function"==typeof(null===(i=e.flutter_inappwebview)||void 0===i?void 0:i.callHandler);if(!l&&!a)return!1;const n={__nativelyAgent:!0,trigger(t,i){var a,n;const r=JSON.stringify({trigger:{name:t,data:i}});"function"!=typeof(null===(a=e.flutter_inappwebview)||void 0===a?void 0:a.callHandler)?l&&"function"==typeof(null===(n=e.parent)||void 0===n?void 0:n.postMessage)&&e.parent.postMessage({source:"natively-webview",handlerName:"💙",args:[r]},"*"):e.flutter_inappwebview.callHandler("💙",r)},response(){},natively_logger(){this.trigger("natively_logger")}};return e.$agent=n,e.natively=e.natively||n,l&&"function"==typeof e.addEventListener&&e.addEventListener("message",(t=>{const i=t.data||{};"natively-flutter"===i.source&&"evaluate"===i.type&&"string"==typeof i.script&&e.eval(i.script)})),!0})(i);i.natively&&!i.natively.__nativelyAgent||(i.natively=new a),i.natively.injected=e,e&&!i.natively.app_version&&(i.natively.app_version=Number.MAX_SAFE_INTEGER),i.natively.sdkVersion=l,e&&O(i),i.NativelyAdmobBanner=S,i.NativelyAdmobInterstitial=k,i.NativelyAppleSignInService=r,i.NativelyAudioRecorder=N,i.NativelyAudioPlayer=A,i.NativelyBiometrics=y,i.NativelyCamera=h,i.NativelyClipboard=s,i.NativelyContacts=f,i.NativelyDatePicker=p,i.NativelyGeolocation=u,i.NativelyHealth=_,i.NativelyInfo=o,i.NativelyLocation=v,i.NativelyMediaPicker=w,i.NativelyMessage=g,i.NativelyNFCService=T,i.NativelyNotifications=d,i.NativelyPurchases=m,i.NativelyScanner=b,i.NativelyStorage=c,i.NativelyCalendar=D,i.NativelyFirebaseNotifications=I,i.NativelyKlaviyoNotifications=P,i.NativelyLiveUpdates=C}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:(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:()=>a,NativelyAdmobBanner:()=>k,NativelyAdmobInterstitial:()=>S,NativelyAppleSignInService:()=>r,NativelyAudioPlayer:()=>A,NativelyAudioRecorder:()=>N,NativelyBiometrics:()=>y,NativelyCalendar:()=>D,NativelyCamera:()=>h,NativelyClipboard:()=>s,NativelyContacts:()=>f,NativelyDatePicker:()=>p,NativelyFirebaseNotifications:()=>T,NativelyGeolocation:()=>u,NativelyHealth:()=>_,NativelyInfo:()=>o,NativelyKlaviyoNotifications:()=>P,NativelyLiveUpdates:()=>C,NativelyLocation:()=>v,NativelyMediaPicker:()=>w,NativelyMessage:()=>g,NativelyNFCService:()=>I,NativelyNotifications:()=>d,NativelyPurchases:()=>m,NativelyQuickActions:()=>M,NativelyScanner:()=>b,NativelyStorage:()=>c,generateID:()=>n,useNatively:()=>O});const i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:null,l="2.26.5";class a{constructor(){var e,t,a,n;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.sdkVersion=l,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===(a=null==i?void 0:i.navigator)||void 0===a?void 0:a.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,a,n){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?a+"_response_"+e:a+"_response",i&&(i[t]=function(a,n){null==i||i.$agent.response(),n.message&&r?alert(`[ERROR] Error message: ${n.message}`):(r&&console.log(`[DEBUG] Callback method: ${t}, 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==i||i.$agent.trigger(a,n)}else null==i||i.natively.addObserver((()=>{null==i||i.natively.trigger(e,t,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==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)}analyticsSetUserId(e){const t={id:e.id};null==i||i.natively.trigger(void 0,37,void 0,"analytics_set_user_id",t)}analyticsSetUserProperty(e){const t={key:e.key,value:e.value};null==i||i.natively.trigger(void 0,37,void 0,"analytics_set_user_property",t)}requestAppReview(){null==i||i.natively.trigger(void 0,0,void 0,"request_review")}attShowPopup(e){null==i||i.natively.trigger(void 0,41,e,"att_show_popup")}attGetStatus(e){null==i||i.natively.trigger(void 0,41,e,"att_get_status")}getInsets(e){null==i||i.natively.trigger(void 0,36,e,"get_insets")}getLocales(e){null==i||i.natively.trigger(void 0,40,e,"get_locales")}setLocale(e,t){null==i||i.natively.trigger(void 0,40,t,"set_locale",{locale:e})}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")}getBatteryInfo(e){null==i||i.natively.trigger(void 0,43,e,"battery_info")}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})}}const n=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class r{constructor(){this.id=n()}signin(e){null==i||i.natively.trigger(this.id,16,e,"apple_signin",{})}}class s{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 o{constructor(){this.id=n()}browserInfo(){var e,t,l,a;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===(a=null===(l=null==i?void 0:i.navigator)||void 0===l?void 0:l.userAgent)||void 0===a?void 0:a.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 d{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 u{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 v{constructor(){this.id=n()}current(e,t,l,a,n=!0){null==i||i.natively.trigger(this.id,12,a,"location_current",{minAccuracy:e,accuracyType:t,priority:l,fallbackToSettings:n})}permission(e){null==i||i.natively.trigger(this.id,6,e,"location_permission")}start(e,t,l,a,n,r=!0){null==i||i.natively.trigger(this.id,12,n,"location_start",{minAccuracy:t,accuracyType:l,priority:a,fallbackToSettings:r,interval:e})}stop(){null==i||i.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,t,l,a,n,r,s=!0){const o={identifier:null!=n?n:"empty",interval:null!=e?e:6e4,minAccuracy:null!=t?t:50,accuracyType:null!=l?l:"Best",priority:null!=a?a:"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 g{constructor(){this.id=n()}sendSMS(e,t,l){const a={body:null!=e?e:"",recipient:null!=t?t:""};null==i||i.natively.trigger(this.id,0,l,"send_sms",a)}sendEmail(e,t,l,a){const n={subject:null!=e?e:"",body:null!=t?t:"",recipient:null!=l?l:""};null==i||i.natively.trigger(this.id,0,a,"send_email",n)}}class c{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 y{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 p{constructor(){this.id=n()}showDatePicker(e,t,l,a,n){const r={type:null!=l?l:"DATE",style:null!=a?a:"LIGHT",title:null!=e?e:"",description:null!=t?t:""};null==i||i.natively.trigger(this.id,0,n,"datepicker",r)}}class h{constructor(){this.id=n()}showCamera(e,t,l,a){const n={type:null!=e?e:"photo",quality:null!=t?t:"high",camera:null!=l?l:"BACK"};null==i||i.natively.trigger(this.id,2,a,"open_camera",n)}}class _{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,a,n){const r={data_type:e,interval:t};l&&(r.start_date=l.getTime()),a&&(r.end_date=a.getTime()),null==i||i.natively.trigger(this.id,10,n,"health_get_statistic_quantity",r)}getDailySleepAnalysis(e,t,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),t&&(n.end_date=t.getTime()),null==i||i.natively.trigger(this.id,10,a,"health_get_daily_sleep_analysis",n)}getWorkouts(e,t,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),t&&(n.end_date=t.getTime()),null==i||i.natively.trigger(this.id,21,a,"health_get_workouts",n)}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 a={};e&&(a.start_date=e.getTime()),t&&(a.end_date=t.getTime()),null==i||i.natively.trigger(this.id,10,l,"health_get_activity_summary",a)}}class b{constructor(){this.id=n()}showScanner(e){null==i||i.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,t,l,a,n,r,s,o,d,u,v,g,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),t&&(y.foregroundColor=t),l&&(y.backgroundColor=l),r&&(y.defaultFlashMode=r),s&&(y.defaultScanOrientation=s),v&&(y.defaultFilter=v),g&&(y.availableFilters=g),d&&(y.ocrConfiguration={languages:[d]}),null==i||i.natively.trigger(this.id,21,c,"open_document_scanner",y)}}class m{constructor(){this.id=n()}login(e,t,l){const a=null!=t?t:"";null==i||i.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:a})}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 a={offeringId:t,shouldShowCloseButton:e};null==i||i.natively.trigger(this.id,38,l,"purchases_show_paywall",a)}showPaywallIfNeeded(e,t,l,a){const n={offeringName:l,entitlementId:e,shouldShowCloseButton:t};null==i||i.natively.trigger(this.id,38,a,"purchases_show_paywall_if_needed",n)}purchasePackage(e,t,l,a){null==i||i.natively.trigger(this.id,3,t,"purchases_package",{packageId:e,oldProductId:null!=l?l:null,prorationMode:null!=a?a:null})}packagePrice(e,t){null==i||i.natively.trigger(this.id,8,t,"purchases_price",{packageId:e})}showCustomerCenter(e){null==i||i.natively.trigger(this.id,42,e,"purchases_show_customer_center",{})}}class f{constructor(){this.id=n()}getAllContacts(e){null==i||i.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,t,l,a,n){const r={firstName:e,lastName:null!=t?t:"",email:null!=l?l:"",phone:null!=a?a:""};null==i||i.natively.trigger(this.id,3,n,"contacts_save",r)}}class w{constructor(){this.id=n()}showMediaPicker(e){null==i||i.natively.trigger(this.id,8,e,"mediapicker",{})}}class N{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 A{constructor(){this.id=n()}buildMetadata(e){const t={};return e?(void 0!==e.id&&(t.id=e.id),void 0!==e.title&&(t.title=e.title),void 0!==e.artist&&(t.artist=e.artist),void 0!==e.album&&(t.album=e.album),void 0!==e.genre&&(t.genre=e.genre),void 0!==e.artwork&&(t.artwork=e.artwork),null!=e.duration&&(t.duration=e.duration),void 0!==e.extras&&(t.extras=e.extras),t):t}play(e,t,l){var a,n;const r=Object.assign({source:e,is_stream:null!==(a=null==t?void 0:t.is_stream)&&void 0!==a&&a,autoplay:null===(n=null==t?void 0:t.autoplay)||void 0===n||n},this.buildMetadata(t));void 0!==(null==t?void 0:t.headers)&&(r.headers=t.headers),null!=(null==t?void 0:t.start_position)&&(r.start_position=t.start_position),null!=(null==t?void 0:t.volume)&&(r.volume=t.volume),null!=(null==t?void 0:t.speed)&&(r.speed=t.speed),null==i||i.natively.trigger(this.id,39,l,"audio_play",r)}pause(e){null==i||i.natively.trigger(this.id,39,e,"audio_pause",{})}stop(e){null==i||i.natively.trigger(this.id,39,e,"audio_stop",{})}seek(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_seek",{position:e})}queueAdd(e,t,l){var a,n;const r=Object.assign({source:e,play_now:null!==(a=null==t?void 0:t.play_now)&&void 0!==a&&a,is_stream:null!==(n=null==t?void 0:t.is_stream)&&void 0!==n&&n},this.buildMetadata(t));void 0!==(null==t?void 0:t.headers)&&(r.headers=t.headers),null==i||i.natively.trigger(this.id,39,l,"audio_queue_add",r)}queueGet(e){null==i||i.natively.trigger(this.id,39,e,"audio_queue_get",{})}queueRemove(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_queue_remove",{index:e})}setMetadata(e,t){const l=this.buildMetadata(e);null==i||i.natively.trigger(this.id,39,t,"audio_set_metadata",l)}setVolume(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_set_volume",{volume:e})}setSpeed(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_set_speed",{speed:e})}}class k{constructor(e,t,l=!1,a,r=!1,s){var o,d,u,v,g,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!==(u=e.position)&&void 0!==u?u:"BOTTOM",y.sizeType=null!==(v=e.sizeType)&&void 0!==v?v:"AUTO",y.width=null!==(g=e.custom_width)&&void 0!==g?g: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 S{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 I{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 a={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",a)}write(e,t,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!=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,a,"nfc_write",s)}available(e){null==i||i.natively.trigger(this.id,15,e,"nfc_available",{})}}class T{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 P{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 D{constructor(){this.id=n()}createCalendarEvent(e,t,l,a,n,r,s){const o={title:e,timezone:a,calendarId:n,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",{})}}class C{constructor(){this.id=n()}requestPermission(e){null==i||i.natively.trigger(this.id,45,e,"live_update_permission",{})}start(e,t){null==i||i.natively.trigger(this.id,45,t,"live_update_setup",e)}update(e,t){null==i||i.natively.trigger(this.id,45,t,"live_update_update",e)}end(e,t){null==i||i.natively.trigger(this.id,45,t,"live_update_end",e)}}class M{constructor(){this.id=n()}setActions(e,t){null==i||i.natively.trigger(this.id,46,t,"quick_actions",{actions:e.map((e=>this.normalizeAction(e)))})}clear(e){null==i||i.natively.trigger(this.id,46,e,"clear_quick_actions",{})}normalizeAction(e){const t={type:e.type,url:e.url};void 0!==e.title&&(t.title=e.title),void 0!==e.subtitle&&(t.subtitle=e.subtitle);const i=void 0!==e.isEnabled?e.isEnabled:e.is_enabled;void 0!==i&&(t.is_enabled=i),void 0!==e.icon&&(t.icon=e.icon);const l=void 0!==e.iosIcon?e.iosIcon:e.ios_icon;void 0!==l&&(t.ios_icon=l);const a=void 0!==e.androidIcon?e.androidIcon:e.android_icon;return void 0!==a&&(t.android_icon=a),t}}const O=()=>null==i?void 0:i.natively,E=e=>{var t,i,a,n,r;if(e.__nativelyNavigationProgressInstalled)return;e.__nativelyNavigationProgressInstalled=!0;let s=null,o=null,d=null,u=!1;const v=(t,i)=>{var l,a;null===(l=e.natively)||void 0===l||l.trigger(void 0,0,void 0,"web_navigation_progress",{phase:t,reason:i,href:null===(a=e.location)||void 0===a?void 0:a.href})},g=()=>{s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null)},c=()=>{null==d||d.disconnect(),d=null},y=t=>{g(),c(),(t=>{var i,a;u||(u=!0,null===(i=e.natively)||void 0===i||i.trigger(void 0,0,void 0,"web_sdk_version",{version:l,reason:t,href:null===(a=e.location)||void 0===a?void 0:a.href}))})(t),v("done",t)},p=()=>{s&&clearTimeout(s),s=setTimeout((()=>y("settled")),250)},h=(t,i=3e3)=>{g(),v("start",t),(()=>{var t;c();const i=null===(t=e.document)||void 0===t?void 0:t.documentElement;if(!i||"function"!=typeof e.MutationObserver)return void p();const l=new e.MutationObserver((()=>p()));l.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),d=l,p()})(),o=setTimeout((()=>y("timeout")),i)},_=t=>{var i;const l=null===(i=e.history)||void 0===i?void 0:i[t];"function"==typeof l&&(e.history[t]=function(...e){return h(t,1500),l.apply(this,e)})};_("pushState"),_("replaceState"),null===(t=e.addEventListener)||void 0===t||t.call(e,"popstate",(()=>h("popstate",1500))),null===(i=e.addEventListener)||void 0===i||i.call(e,"hashchange",(()=>h("hashchange",800))),null===(a=e.document)||void 0===a||a.addEventListener("click",(e=>{const t=e.target;if(!t||"function"!=typeof t.closest)return;const i=t.closest("a[href]");if(!i)return;const l=i.getAttribute("href")||"";if(!l||l.startsWith("#")||l.startsWith("javascript:"))return;const a=i.getAttribute("target");a&&"_self"!==a||h("anchor",4e3)}),!0),"complete"===(null===(n=e.document)||void 0===n?void 0:n.readyState)?y("ready"):null===(r=e.addEventListener)||void 0===r||r.call(e,"load",(()=>y("load")),{once:!0})};if(i){const e=(e=>{var t,i;if("function"==typeof(null===(t=e.$agent)||void 0===t?void 0:t.trigger))return!0;const l=(e=>{try{return e.self!==e.top}catch(e){return!0}})(e),a="function"==typeof(null===(i=e.flutter_inappwebview)||void 0===i?void 0:i.callHandler);if(!l&&!a)return!1;const n={__nativelyAgent:!0,trigger(t,i){var a,n;const r=JSON.stringify({trigger:{name:t,data:i}});"function"!=typeof(null===(a=e.flutter_inappwebview)||void 0===a?void 0:a.callHandler)?l&&"function"==typeof(null===(n=e.parent)||void 0===n?void 0:n.postMessage)&&e.parent.postMessage({source:"natively-webview",handlerName:"💙",args:[r]},"*"):e.flutter_inappwebview.callHandler("💙",r)},response(){},natively_logger(){this.trigger("natively_logger")}};return e.$agent=n,e.natively=e.natively||n,l&&"function"==typeof e.addEventListener&&e.addEventListener("message",(t=>{const i=t.data||{};"natively-flutter"===i.source&&"evaluate"===i.type&&"string"==typeof i.script&&e.eval(i.script)})),!0})(i);i.natively&&!i.natively.__nativelyAgent||(i.natively=new a),i.natively.injected=e,e&&!i.natively.app_version&&(i.natively.app_version=Number.MAX_SAFE_INTEGER),i.natively.sdkVersion=l,e&&E(i),i.NativelyAdmobBanner=k,i.NativelyAdmobInterstitial=S,i.NativelyAppleSignInService=r,i.NativelyAudioRecorder=N,i.NativelyAudioPlayer=A,i.NativelyBiometrics=y,i.NativelyCamera=h,i.NativelyClipboard=s,i.NativelyContacts=f,i.NativelyDatePicker=p,i.NativelyGeolocation=u,i.NativelyHealth=_,i.NativelyInfo=o,i.NativelyLocation=v,i.NativelyMediaPicker=w,i.NativelyMessage=g,i.NativelyNFCService=I,i.NativelyNotifications=d,i.NativelyPurchases=m,i.NativelyScanner=b,i.NativelyStorage=c,i.NativelyCalendar=D,i.NativelyFirebaseNotifications=T,i.NativelyKlaviyoNotifications=P,i.NativelyLiveUpdates=C}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",{})))})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natively",
3
- "version": "2.26.8",
3
+ "version": "2.27.0",
4
4
  "description": "Natively SDK for building native-like web applications",
5
5
  "type": "module",
6
6
  "exports": {