natively 2.26.3 → 2.26.5

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/dist/inject.js CHANGED
@@ -25,6 +25,7 @@ import { NativelyFirebaseNotifications } from "./classes/NativelyFirebaseNotific
25
25
  import { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications.js';
26
26
  import { NativelyCalendar } from "./classes/NativelyCalendar.js";
27
27
  var HANDLER_NAME = "💙";
28
+ var WEB_NAVIGATION_PROGRESS_EVENT = "web_navigation_progress";
28
29
  var isIframe = context => {
29
30
  try {
30
31
  return context.self !== context.top;
@@ -33,21 +34,22 @@ var isIframe = context => {
33
34
  }
34
35
  };
35
36
  var installAgent = context => {
36
- var _context$$agent;
37
- if ((_context$$agent = context.$agent) !== null && _context$$agent !== void 0 && _context$$agent.__nativelyAgent) return true;
37
+ var _context$$agent, _context$flutter_inap;
38
+ if (typeof ((_context$$agent = context.$agent) === null || _context$$agent === void 0 ? void 0 : _context$$agent.trigger) === "function") return true;
38
39
  var runningInIframe = isIframe(context);
39
- if (!runningInIframe) return false;
40
+ var hasNativeHandler = typeof ((_context$flutter_inap = context.flutter_inappwebview) === null || _context$flutter_inap === void 0 ? void 0 : _context$flutter_inap.callHandler) === "function";
41
+ if (!runningInIframe && !hasNativeHandler) return false;
40
42
  var agent = {
41
43
  __nativelyAgent: true,
42
44
  trigger(eventName, eventData) {
43
- var _context$flutter_inap, _context$parent;
45
+ var _context$flutter_inap2, _context$parent;
44
46
  var serializedArgs = JSON.stringify({
45
47
  trigger: {
46
48
  name: eventName,
47
49
  data: eventData
48
50
  }
49
51
  });
50
- if (typeof ((_context$flutter_inap = context.flutter_inappwebview) === null || _context$flutter_inap === void 0 ? void 0 : _context$flutter_inap.callHandler) === "function") {
52
+ if (typeof ((_context$flutter_inap2 = context.flutter_inappwebview) === null || _context$flutter_inap2 === void 0 ? void 0 : _context$flutter_inap2.callHandler) === "function") {
51
53
  context.flutter_inappwebview.callHandler(HANDLER_NAME, serializedArgs);
52
54
  return;
53
55
  }
@@ -77,6 +79,108 @@ var installAgent = context => {
77
79
  }
78
80
  return true;
79
81
  };
82
+ var installNavigationProgressTracking = context => {
83
+ var _context$addEventList, _context$addEventList2, _context$document2, _context$document3;
84
+ if (context.__nativelyNavigationProgressInstalled) return;
85
+ context.__nativelyNavigationProgressInstalled = true;
86
+ var completionTimer = null;
87
+ var maxTimer = null;
88
+ var observer = null;
89
+ var emit = (phase, reason) => {
90
+ var _context$natively, _context$location;
91
+ (_context$natively = context.natively) === null || _context$natively === void 0 || _context$natively.trigger(undefined, 0, undefined, WEB_NAVIGATION_PROGRESS_EVENT, {
92
+ phase,
93
+ reason,
94
+ href: (_context$location = context.location) === null || _context$location === void 0 ? void 0 : _context$location.href
95
+ });
96
+ };
97
+ var cancelTimers = () => {
98
+ if (completionTimer) {
99
+ clearTimeout(completionTimer);
100
+ completionTimer = null;
101
+ }
102
+ if (maxTimer) {
103
+ clearTimeout(maxTimer);
104
+ maxTimer = null;
105
+ }
106
+ };
107
+ var disconnectObserver = () => {
108
+ var _observer;
109
+ (_observer = observer) === null || _observer === void 0 || _observer.disconnect();
110
+ observer = null;
111
+ };
112
+ var finish = reason => {
113
+ cancelTimers();
114
+ disconnectObserver();
115
+ emit("done", reason);
116
+ };
117
+ var scheduleSettle = () => {
118
+ if (completionTimer) {
119
+ clearTimeout(completionTimer);
120
+ }
121
+ completionTimer = setTimeout(() => finish("settled"), 250);
122
+ };
123
+ var observeDom = () => {
124
+ var _context$document;
125
+ disconnectObserver();
126
+ var root = (_context$document = context.document) === null || _context$document === void 0 ? void 0 : _context$document.documentElement;
127
+ if (!root || typeof context.MutationObserver !== "function") {
128
+ scheduleSettle();
129
+ return;
130
+ }
131
+ var mutationObserver = new context.MutationObserver(() => scheduleSettle());
132
+ mutationObserver.observe(root, {
133
+ subtree: true,
134
+ childList: true,
135
+ attributes: true,
136
+ characterData: true
137
+ });
138
+ observer = mutationObserver;
139
+ scheduleSettle();
140
+ };
141
+ var start = function start(reason) {
142
+ var maxDuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3000;
143
+ cancelTimers();
144
+ emit("start", reason);
145
+ observeDom();
146
+ maxTimer = setTimeout(() => finish("timeout"), maxDuration);
147
+ };
148
+ var wrapHistoryMethod = methodName => {
149
+ var _context$history;
150
+ var original = (_context$history = context.history) === null || _context$history === void 0 ? void 0 : _context$history[methodName];
151
+ if (typeof original !== "function") return;
152
+ context.history[methodName] = function () {
153
+ start(methodName, 1500);
154
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
155
+ args[_key] = arguments[_key];
156
+ }
157
+ return original.apply(this, args);
158
+ };
159
+ };
160
+ wrapHistoryMethod("pushState");
161
+ wrapHistoryMethod("replaceState");
162
+ (_context$addEventList = context.addEventListener) === null || _context$addEventList === void 0 || _context$addEventList.call(context, "popstate", () => start("popstate", 1500));
163
+ (_context$addEventList2 = context.addEventListener) === null || _context$addEventList2 === void 0 || _context$addEventList2.call(context, "hashchange", () => start("hashchange", 800));
164
+ (_context$document2 = context.document) === null || _context$document2 === void 0 || _context$document2.addEventListener("click", event => {
165
+ var target = event.target;
166
+ if (!target || typeof target.closest !== "function") return;
167
+ var anchor = target.closest("a[href]");
168
+ if (!anchor) return;
169
+ var href = anchor.getAttribute("href") || "";
170
+ if (!href || href.startsWith("#") || href.startsWith("javascript:")) return;
171
+ var targetAttr = anchor.getAttribute("target");
172
+ if (targetAttr && targetAttr !== "_self") return;
173
+ start("anchor", 4000);
174
+ }, true);
175
+ if (((_context$document3 = context.document) === null || _context$document3 === void 0 ? void 0 : _context$document3.readyState) === "complete") {
176
+ finish("ready");
177
+ } else {
178
+ var _context$addEventList3;
179
+ (_context$addEventList3 = context.addEventListener) === null || _context$addEventList3 === void 0 || _context$addEventList3.call(context, "load", () => finish("load"), {
180
+ once: true
181
+ });
182
+ }
183
+ };
80
184
 
81
185
  // Assign natively to the global object
82
186
  if (globalContext) {
@@ -88,6 +192,9 @@ if (globalContext) {
88
192
  if (agentInstalled && !globalContext.natively.app_version) {
89
193
  globalContext.natively.app_version = Number.MAX_SAFE_INTEGER;
90
194
  }
195
+ if (agentInstalled) {
196
+ installNavigationProgressTracking(globalContext);
197
+ }
91
198
 
92
199
  // All other classes must be global to make a possibility to create any number of their instances
93
200
  globalContext.NativelyAdmobBanner = NativelyAdmobBanner;
@@ -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:()=>A,NativelyAdmobInterstitial:()=>S,NativelyAppleSignInService:()=>n,NativelyAudioPlayer:()=>N,NativelyAudioRecorder:()=>w,NativelyBiometrics:()=>c,NativelyCalendar:()=>D,NativelyCamera:()=>p,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>I,NativelyGeolocation:()=>d,NativelyHealth:()=>h,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>T,NativelyLocation:()=>g,NativelyMediaPicker:()=>f,NativelyMessage:()=>v,NativelyNFCService:()=>k,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>_,NativelyStorage:()=>u,generateID:()=>a,useNatively:()=>P});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,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===(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===(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}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 a=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class n{constructor(){this.id=a()}signin(e){null==i||i.natively.trigger(this.id,16,e,"apple_signin",{})}}class r{constructor(){this.id=a()}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=a()}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 o{constructor(){this.id=a()}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=a()}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=a()}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 v{constructor(){this.id=a()}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 u{constructor(){this.id=a()}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=a(),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=a()}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 p{constructor(){this.id=a()}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 h{constructor(){this.id=a()}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 _{constructor(){this.id=a()}showScanner(e){null==i||i.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,t,l,a,n,r,s,o,d,g,v,u,c){const y={};o&&(y.source=o),n&&(y.menuColor=n),g&&(y.pageMode=g),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),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=a()}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 m{constructor(){this.id=a()}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 f{constructor(){this.id=a()}showMediaPicker(e){null==i||i.natively.trigger(this.id,8,e,"mediapicker",{})}}class w{constructor(){this.id=a()}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(){this.id=a()}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 A{constructor(e,t,l=!1,n,r=!1,s){var o,d,g,v,u,c;this.id=a();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==n||n(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,n=!1,r){this.id=a(),(null==i?void 0:i.natively.isAndroidApp)?this.unitId=t:(null==i?void 0:i.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=n,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 k{constructor(e,t,i,l){this.id=a(),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=a()}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=a()}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=a()}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",{})}}const P=()=>null==i?void 0:i.natively;if(i){const e=(e=>{var t;if(null===(t=e.$agent)||void 0===t?void 0:t.__nativelyAgent)return!0;const i=(e=>{try{return e.self!==e.top}catch(e){return!0}})(e);if(!i)return!1;const l={__nativelyAgent:!0,trigger(t,l){var a,n;const r=JSON.stringify({trigger:{name:t,data:l}});"function"!=typeof(null===(a=e.flutter_inappwebview)||void 0===a?void 0:a.callHandler)?i&&"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=l,e.natively=e.natively||l,i&&"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 l),i.natively.injected=e,e&&!i.natively.app_version&&(i.natively.app_version=Number.MAX_SAFE_INTEGER),i.NativelyAdmobBanner=A,i.NativelyAdmobInterstitial=S,i.NativelyAppleSignInService=n,i.NativelyAudioRecorder=w,i.NativelyAudioPlayer=N,i.NativelyBiometrics=c,i.NativelyCamera=p,i.NativelyClipboard=r,i.NativelyContacts=m,i.NativelyDatePicker=y,i.NativelyGeolocation=d,i.NativelyHealth=h,i.NativelyInfo=s,i.NativelyLocation=g,i.NativelyMediaPicker=f,i.NativelyMessage=v,i.NativelyNFCService=k,i.NativelyNotifications=o,i.NativelyPurchases=b,i.NativelyScanner=_,i.NativelyStorage=u,i.NativelyCalendar=D,i.NativelyFirebaseNotifications=I,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:(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:()=>A,NativelyAdmobInterstitial:()=>S,NativelyAppleSignInService:()=>n,NativelyAudioPlayer:()=>N,NativelyAudioRecorder:()=>w,NativelyBiometrics:()=>c,NativelyCalendar:()=>D,NativelyCamera:()=>p,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>T,NativelyGeolocation:()=>d,NativelyHealth:()=>h,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>I,NativelyLocation:()=>u,NativelyMediaPicker:()=>f,NativelyMessage:()=>v,NativelyNFCService:()=>k,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>_,NativelyStorage:()=>g,generateID:()=>a,useNatively:()=>P});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,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===(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===(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}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 a=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class n{constructor(){this.id=a()}signin(e){null==i||i.natively.trigger(this.id,16,e,"apple_signin",{})}}class r{constructor(){this.id=a()}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=a()}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 o{constructor(){this.id=a()}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=a()}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 u{constructor(){this.id=a()}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 v{constructor(){this.id=a()}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 g{constructor(){this.id=a()}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=a(),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=a()}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 p{constructor(){this.id=a()}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 h{constructor(){this.id=a()}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 _{constructor(){this.id=a()}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 b{constructor(){this.id=a()}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 m{constructor(){this.id=a()}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 f{constructor(){this.id=a()}showMediaPicker(e){null==i||i.natively.trigger(this.id,8,e,"mediapicker",{})}}class w{constructor(){this.id=a()}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(){this.id=a()}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 A{constructor(e,t,l=!1,n,r=!1,s){var o,d,u,v,g,c;this.id=a();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==n||n(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,n=!1,r){this.id=a(),(null==i?void 0:i.natively.isAndroidApp)?this.unitId=t:(null==i?void 0:i.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=n,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 k{constructor(e,t,i,l){this.id=a(),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=a()}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 I{constructor(){this.id=a()}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=a()}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",{})}}const P=()=>null==i?void 0:i.natively,C=e=>{var t,i,l,a,n;if(e.__nativelyNavigationProgressInstalled)return;e.__nativelyNavigationProgressInstalled=!0;let r=null,s=null,o=null;const d=(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})},u=()=>{r&&(clearTimeout(r),r=null),s&&(clearTimeout(s),s=null)},v=()=>{null==o||o.disconnect(),o=null},g=e=>{u(),v(),d("done",e)},c=()=>{r&&clearTimeout(r),r=setTimeout((()=>g("settled")),250)},y=(t,i=3e3)=>{u(),d("start",t),(()=>{var t;v();const i=null===(t=e.document)||void 0===t?void 0:t.documentElement;if(!i||"function"!=typeof e.MutationObserver)return void c();const l=new e.MutationObserver((()=>c()));l.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),o=l,c()})(),s=setTimeout((()=>g("timeout")),i)},p=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 y(t,1500),l.apply(this,e)})};p("pushState"),p("replaceState"),null===(t=e.addEventListener)||void 0===t||t.call(e,"popstate",(()=>y("popstate",1500))),null===(i=e.addEventListener)||void 0===i||i.call(e,"hashchange",(()=>y("hashchange",800))),null===(l=e.document)||void 0===l||l.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||y("anchor",4e3)}),!0),"complete"===(null===(a=e.document)||void 0===a?void 0:a.readyState)?g("ready"):null===(n=e.addEventListener)||void 0===n||n.call(e,"load",(()=>g("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 l),i.natively.injected=e,e&&!i.natively.app_version&&(i.natively.app_version=Number.MAX_SAFE_INTEGER),e&&C(i),i.NativelyAdmobBanner=A,i.NativelyAdmobInterstitial=S,i.NativelyAppleSignInService=n,i.NativelyAudioRecorder=w,i.NativelyAudioPlayer=N,i.NativelyBiometrics=c,i.NativelyCamera=p,i.NativelyClipboard=r,i.NativelyContacts=m,i.NativelyDatePicker=y,i.NativelyGeolocation=d,i.NativelyHealth=h,i.NativelyInfo=s,i.NativelyLocation=u,i.NativelyMediaPicker=f,i.NativelyMessage=v,i.NativelyNFCService=k,i.NativelyNotifications=o,i.NativelyPurchases=b,i.NativelyScanner=_,i.NativelyStorage=g,i.NativelyCalendar=D,i.NativelyFirebaseNotifications=T,i.NativelyKlaviyoNotifications=I}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.3",
3
+ "version": "2.26.5",
4
4
  "description": "Natively SDK for building native-like web applications",
5
5
  "type": "module",
6
6
  "exports": {