natively 2.26.6 → 2.26.7

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
@@ -88,6 +88,7 @@ var installNavigationProgressTracking = context => {
88
88
  var completionTimer = null;
89
89
  var maxTimer = null;
90
90
  var observer = null;
91
+ var didReportSdkVersion = false;
91
92
  var emit = (phase, reason) => {
92
93
  var _context$natively, _context$location;
93
94
  (_context$natively = context.natively) === null || _context$natively === void 0 || _context$natively.trigger(undefined, 0, undefined, WEB_NAVIGATION_PROGRESS_EVENT, {
@@ -96,6 +97,16 @@ var installNavigationProgressTracking = context => {
96
97
  href: (_context$location = context.location) === null || _context$location === void 0 ? void 0 : _context$location.href
97
98
  });
98
99
  };
100
+ var emitSdkVersion = reason => {
101
+ var _context$natively2, _context$location2;
102
+ if (didReportSdkVersion) return;
103
+ didReportSdkVersion = true;
104
+ (_context$natively2 = context.natively) === null || _context$natively2 === void 0 || _context$natively2.trigger(undefined, 0, undefined, WEB_SDK_VERSION_EVENT, {
105
+ version: SDK_VERSION,
106
+ reason,
107
+ href: (_context$location2 = context.location) === null || _context$location2 === void 0 ? void 0 : _context$location2.href
108
+ });
109
+ };
99
110
  var cancelTimers = () => {
100
111
  if (completionTimer) {
101
112
  clearTimeout(completionTimer);
@@ -114,6 +125,7 @@ var installNavigationProgressTracking = context => {
114
125
  var finish = reason => {
115
126
  cancelTimers();
116
127
  disconnectObserver();
128
+ emitSdkVersion(reason);
117
129
  emit("done", reason);
118
130
  };
119
131
  var scheduleSettle = () => {
@@ -196,9 +208,6 @@ if (globalContext) {
196
208
  }
197
209
  globalContext.natively.sdkVersion = SDK_VERSION;
198
210
  if (agentInstalled) {
199
- globalContext.natively.trigger(undefined, 0, undefined, WEB_SDK_VERSION_EVENT, {
200
- version: SDK_VERSION
201
- });
202
211
  installNavigationProgressTracking(globalContext);
203
212
  }
204
213
 
@@ -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:()=>P,NativelyCamera:()=>h,NativelyClipboard:()=>s,NativelyContacts:()=>f,NativelyDatePicker:()=>p,NativelyFirebaseNotifications:()=>I,NativelyGeolocation:()=>u,NativelyHealth:()=>_,NativelyInfo:()=>o,NativelyKlaviyoNotifications:()=>D,NativelyLocation:()=>v,NativelyMediaPicker:()=>w,NativelyMessage:()=>g,NativelyNFCService:()=>T,NativelyNotifications:()=>d,NativelyPurchases:()=>m,NativelyScanner:()=>b,NativelyStorage:()=>c,generateID:()=>n,useNatively:()=>C});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 D{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 P{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",{})}}const C=()=>null==i?void 0:i.natively,M=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 a),i.natively.injected=e,e&&!i.natively.app_version&&(i.natively.app_version=Number.MAX_SAFE_INTEGER),i.natively.sdkVersion=l,e&&(i.natively.trigger(void 0,0,void 0,"web_sdk_version",{version:l}),M(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=P,i.NativelyFirebaseNotifications=I,i.NativelyKlaviyoNotifications=D}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:()=>S,NativelyAdmobInterstitial:()=>k,NativelyAppleSignInService:()=>r,NativelyAudioPlayer:()=>A,NativelyAudioRecorder:()=>N,NativelyBiometrics:()=>y,NativelyCalendar:()=>P,NativelyCamera:()=>p,NativelyClipboard:()=>s,NativelyContacts:()=>f,NativelyDatePicker:()=>h,NativelyFirebaseNotifications:()=>I,NativelyGeolocation:()=>u,NativelyHealth:()=>_,NativelyInfo:()=>o,NativelyKlaviyoNotifications:()=>D,NativelyLocation:()=>v,NativelyMediaPicker:()=>w,NativelyMessage:()=>g,NativelyNFCService:()=>T,NativelyNotifications:()=>d,NativelyPurchases:()=>m,NativelyScanner:()=>b,NativelyStorage:()=>c,generateID:()=>n,useNatively:()=>C});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 h{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 p{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 D{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 P{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",{})}}const C=()=>null==i?void 0:i.natively,M=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)},h=()=>{s&&clearTimeout(s),s=setTimeout((()=>y("settled")),250)},p=(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 h();const l=new e.MutationObserver((()=>h()));l.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),d=l,h()})(),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 p(t,1500),l.apply(this,e)})};_("pushState"),_("replaceState"),null===(t=e.addEventListener)||void 0===t||t.call(e,"popstate",(()=>p("popstate",1500))),null===(i=e.addEventListener)||void 0===i||i.call(e,"hashchange",(()=>p("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||p("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&&M(i),i.NativelyAdmobBanner=S,i.NativelyAdmobInterstitial=k,i.NativelyAppleSignInService=r,i.NativelyAudioRecorder=N,i.NativelyAudioPlayer=A,i.NativelyBiometrics=y,i.NativelyCamera=p,i.NativelyClipboard=s,i.NativelyContacts=f,i.NativelyDatePicker=h,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=P,i.NativelyFirebaseNotifications=I,i.NativelyKlaviyoNotifications=D}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.6",
3
+ "version": "2.26.7",
4
4
  "description": "Natively SDK for building native-like web applications",
5
5
  "type": "module",
6
6
  "exports": {