natively 2.19.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,12 +5,15 @@ export declare class Natively {
5
5
  injected: boolean;
6
6
  observers: Function[];
7
7
  onNativeError?: Function | null;
8
+ onTabChanged?: Function | null;
8
9
  isIOSApp: boolean;
9
10
  isAndroidApp: boolean;
10
11
  setDebug(isDebug: boolean): void;
11
12
  notify(min?: number, current?: number): void;
12
13
  addObserver(fn: Function): void;
13
14
  trigger(respId: string | undefined, minVersion: number, callback: Function | undefined, method: string, body?: any): void;
15
+ setTabChangedHandler(callback: Function): void;
16
+ removeTabChangedHandler(): void;
14
17
  setErrorHandler(callback: Function): void;
15
18
  removeErrorHandler(): void;
16
19
  setErrorScreen(showError: boolean): void;
@@ -13,6 +13,7 @@ export class Natively {
13
13
  _defineProperty(this, "injected", false);
14
14
  _defineProperty(this, "observers", []);
15
15
  _defineProperty(this, "onNativeError", null);
16
+ _defineProperty(this, "onTabChanged", null);
16
17
  _defineProperty(this, "isIOSApp", (globalContext === null || globalContext === void 0 || (_globalContext$naviga = globalContext.navigator) === null || _globalContext$naviga === void 0 || (_globalContext$naviga = _globalContext$naviga.userAgent) === null || _globalContext$naviga === void 0 ? void 0 : _globalContext$naviga.includes("Natively/iOS")) || false);
17
18
  _defineProperty(this, "isAndroidApp", (globalContext === null || globalContext === void 0 || (_globalContext$naviga2 = globalContext.navigator) === null || _globalContext$naviga2 === void 0 || (_globalContext$naviga2 = _globalContext$naviga2.userAgent) === null || _globalContext$naviga2 === void 0 ? void 0 : _globalContext$naviga2.includes("Natively/Android")) || false);
18
19
  }
@@ -97,17 +98,24 @@ export class Natively {
97
98
  }
98
99
  globalContext === null || globalContext === void 0 || globalContext.$agent.trigger(method, body);
99
100
  }
101
+ setTabChangedHandler(callback) {
102
+ if (typeof callback !== 'function') {
103
+ console.warn('[Natively] Tab changed handler must be a function');
104
+ return;
105
+ }
106
+ this.onTabChanged = callback;
107
+ }
108
+ removeTabChangedHandler() {
109
+ this.onTabChanged = null;
110
+ }
100
111
  setErrorHandler(callback) {
101
112
  if (typeof callback !== 'function') {
102
- console.warn('[Natively] Error handler must be a function');
103
113
  return;
104
114
  }
105
115
  this.onNativeError = callback;
106
- console.log('[Natively] Error handler registered');
107
116
  }
108
117
  removeErrorHandler() {
109
118
  this.onNativeError = null;
110
- console.log('[Natively] Error handler removed');
111
119
  }
112
120
  setErrorScreen(showError) {
113
121
  globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 0, undefined, "error_screen", {
@@ -7,5 +7,36 @@ export declare class NativelyHealth {
7
7
  getStatisticQuantity(data_type: string, interval: string, start_date?: Date, end_date?: Date, callback?: Function): void;
8
8
  getDailySleepAnalysis(start_date?: Date, end_date?: Date, limit?: number, callback?: Function): void;
9
9
  getWorkouts(start_date?: Date, end_date?: Date, limit?: number, callback?: Function): void;
10
+ writeWorkout(workout: {
11
+ start_date?: Date;
12
+ end_date?: Date;
13
+ duration?: number;
14
+ activity_type?: string;
15
+ total_energy_burned?: number;
16
+ total_energy_burned_unit?: string;
17
+ total_distance?: number;
18
+ total_distance_unit?: string;
19
+ total_swimming_stroke_count?: number;
20
+ total_swimming_stroke_count_unit?: string;
21
+ total_flights_climbed?: number;
22
+ total_flights_climbed_unit?: string;
23
+ metadata?: any;
24
+ events?: any[];
25
+ uuid?: string;
26
+ identifier?: string;
27
+ }, callback?: Function): void;
28
+ writeNutrition(nutrition: {
29
+ items?: Array<{
30
+ start_date?: Date;
31
+ end_date?: Date;
32
+ [key: string]: any;
33
+ }>;
34
+ start_date?: Date;
35
+ end_date?: Date;
36
+ identifier?: string;
37
+ value?: number;
38
+ unit?: string;
39
+ [key: string]: any;
40
+ }, callback?: Function): void;
10
41
  getActivitySummary(start_date?: Date, end_date?: Date, callback?: Function): void;
11
42
  }
@@ -1,3 +1,5 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
3
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -61,6 +63,38 @@ export class NativelyHealth {
61
63
  }
62
64
  globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 21, callback, "health_get_workouts", obj);
63
65
  }
66
+ writeWorkout(workout, callback) {
67
+ var obj = _objectSpread({}, workout);
68
+ if ((workout === null || workout === void 0 ? void 0 : workout.start_date) instanceof Date) {
69
+ obj.start_date = workout.start_date.getTime();
70
+ }
71
+ if ((workout === null || workout === void 0 ? void 0 : workout.end_date) instanceof Date) {
72
+ obj.end_date = workout.end_date.getTime();
73
+ }
74
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, callback, "health_write_workout", obj);
75
+ }
76
+ writeNutrition(nutrition, callback) {
77
+ var obj = _objectSpread({}, nutrition);
78
+ if ((nutrition === null || nutrition === void 0 ? void 0 : nutrition.start_date) instanceof Date) {
79
+ obj.start_date = nutrition.start_date.getTime();
80
+ }
81
+ if ((nutrition === null || nutrition === void 0 ? void 0 : nutrition.end_date) instanceof Date) {
82
+ obj.end_date = nutrition.end_date.getTime();
83
+ }
84
+ if (Array.isArray(nutrition === null || nutrition === void 0 ? void 0 : nutrition.items)) {
85
+ obj.items = nutrition.items.map(item => {
86
+ var mappedItem = _objectSpread({}, item);
87
+ if ((item === null || item === void 0 ? void 0 : item.start_date) instanceof Date) {
88
+ mappedItem.start_date = item.start_date.getTime();
89
+ }
90
+ if ((item === null || item === void 0 ? void 0 : item.end_date) instanceof Date) {
91
+ mappedItem.end_date = item.end_date.getTime();
92
+ }
93
+ return mappedItem;
94
+ });
95
+ }
96
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, callback, "health_write_nutrition", obj);
97
+ }
64
98
  getActivitySummary(start_date, end_date, callback) {
65
99
  var obj = {};
66
100
  if (start_date) {
@@ -1 +1 @@
1
- (()=>{"use strict";var e={d:(i,t)=>{for(var l in t)e.o(t,l)&&!e.o(i,l)&&Object.defineProperty(i,l,{enumerable:!0,get:t[l]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};e.r(i),e.d(i,{Natively:()=>l,NativelyAdmobBanner:()=>N,NativelyAdmobInterstitial:()=>A,NativelyAppleSignInService:()=>a,NativelyAudioRecorder:()=>w,NativelyBiometrics:()=>c,NativelyCalendar:()=>T,NativelyCamera:()=>p,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>k,NativelyGeolocation:()=>d,NativelyHealth:()=>h,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>I,NativelyLocation:()=>g,NativelyMediaPicker:()=>f,NativelyMessage:()=>v,NativelyNFCService:()=>S,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>_,NativelyStorage:()=>u,generateID:()=>n,useNatively:()=>P});const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:null;class l{constructor(){var e,i,l,n;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.injected=!1,this.observers=[],this.onNativeError=null,this.isIOSApp=(null===(i=null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Natively/iOS"))||!1,this.isAndroidApp=(null===(n=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}setDebug(e){t&&(t.natively.isDebug=e)}notify(e,i){t&&(t.natively.injected=!0,e&&(t.natively.min_app_version=e),i&&(t.natively.app_version=i));const l=null==t?void 0:t.natively.observers;for((null==t?void 0:t.natively.isDebug)&&console.log("[INFO] Notify observers: ",l.length);l.length>0;){const e=l.shift();null==e||e()}}addObserver(e){(null==t?void 0:t.natively.injected)?e():((null==t?void 0:t.natively.isDebug)&&console.log(`[DEBUG] addObserver: ${e}`),null==t||t.natively.observers.push(e))}trigger(e,i,l,n,a){const r=null==t?void 0:t.natively.isDebug;if(null==t?void 0:t.natively.injected)if(i>(null==t?void 0:t.natively.app_version))r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${null==t?void 0:t.natively.app_version}, feature version: ${i}`);else{if(l){let i;i=e?n+"_response_"+e:n+"_response",t&&(t[i]=function(n,a){null==t||t.$agent.response(),a.message&&r?alert(`[ERROR] Error message: ${a.message}`):(r&&console.log(`[DEBUG] Callback method: ${i}, body: ${JSON.stringify(n)}, respId: ${e}`),l(n))}),a?a.response_id=e:a={response_id:e}}r&&console.log(`[DEBUG] Trigger method: ${n}, body: ${JSON.stringify(a)}`),null==t||t.$agent.trigger(n,a)}else null==t||t.natively.addObserver((()=>{null==t||t.natively.trigger(e,i,l,n,a)}))}setErrorHandler(e){"function"==typeof e?(this.onNativeError=e,console.log("[Natively] Error handler registered")):console.warn("[Natively] Error handler must be a function")}removeErrorHandler(){this.onNativeError=null,console.log("[Natively] Error handler removed")}setErrorScreen(e){null==t||t.natively.trigger(void 0,0,void 0,"error_screen",{show_error:e})}openLogger(){null==t||t.$agent.natively_logger()}openConsole(){null==t||t.natively.trigger(void 0,22,void 0,"app_console")}closeApp(){null==t||t.natively.trigger(void 0,11,void 0,"app_close")}showProgress(e){null==t||t.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:e})}shareImage(e){null==t||t.natively.trigger(void 0,0,void 0,"share_image",{url:e})}shareText(e){null==t||t.natively.trigger(void 0,0,void 0,"share_text",{text:e})}shareTextAndImage(e,i){null==t||t.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:i,text:e})}shareFile(e){null==t||t.natively.trigger(void 0,2,void 0,"share_file",{url:e})}openExternalURL(e,i){const l={url:void 0===e?"https://buildnatively.com":e,view:void 0!==i&&i?"external":"web"};null==t||t.natively.trigger(void 0,18,void 0,"open_link",l)}openExternalApp(e){null==t||t.natively.trigger(void 0,22,void 0,"open_app",{url:e})}showAppToast(e,i){null==t||t.natively.trigger(void 0,0,void 0,"show_toast",{text:i||"",type:e||"DEFAULT"})}showAppBanner(e,i,l){null==t||t.natively.trigger(void 0,0,void 0,"show_banner",{type:e||"INFO",title:i||"",description:l||""})}analyticsTrackEvent(e,i){const l={name:e};i&&(l.data=i),null==t||t.natively.trigger(void 0,37,void 0,"analytics_log_event",l)}requestAppReview(){null==t||t.natively.trigger(void 0,0,void 0,"request_review")}getInsets(e){null==t||t.natively.trigger(void 0,36,e,"get_insets")}setAppBackgroundColor(e){null==t||t.natively.trigger(void 0,1,void 0,"app_background",{color:e})}setAppProgressColor(e){null==t||t.natively.trigger(void 0,1,void 0,"app_progress",{color:e})}setAppSwipeNavigation(e){null==t||t.natively.trigger(void 0,22,void 0,"app_navigation",{toggle:e})}setAppPullToRefresh(e){null==t||t.natively.trigger(void 0,1,void 0,"app_pull",{toggle:e})}setAppOrientation(e){null==t||t.natively.trigger(void 0,3,void 0,"app_orientation",{orientation:e})}setAppStatusBarStyle(e){null==t||t.natively.trigger(void 0,22,void 0,"status_bar_style",{style:e})}hideLoadingScreen(){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!1,auto_hide:!0})}showLoadingScreen(e){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!0,auto_hide:e||!1})}openAppSettings(){null==t||t.natively.trigger(void 0,0,void 0,"open_appsettings")}showTabBar(){null==t||t.natively.trigger(void 0,33,void 0,"show_tab_bar")}enableWakelock(){null==t||t.natively.trigger(void 0,34,void 0,"wakelock_enable")}disableWakelock(){null==t||t.natively.trigger(void 0,34,void 0,"wakelock_disable")}hideTabBar(){null==t||t.natively.trigger(void 0,33,void 0,"hide_tab_bar")}reloadWebview(){null==t||t.natively.trigger(void 0,35,void 0,"reset_webview")}hapticPattern(e,i){null==t||t.natively.trigger(void 0,22,void 0,"haptic_pattern",{pattern:e,delay:i})}openPDF(e,i){const l={url:e.url||"",base64:e.base64||"",fileName:e.fileName||`pdf-${(new Date).getTime()}.pdf`,download:!0===e.download};null==t||t.natively.trigger(void 0,38,i,"open_pdf",l)}hapticImpact(e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_impact",{type:e})}hapticNotification(e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_notification",{type:e})}sendPushNotification(e,i,t,l){return n=this,a=void 0,s=function*(){const n=t.filter((e=>e.length>0)),a=[...new Set(n)],r={app_id:l?"be83022a-1d08-45d0-a07a-0c3655666e17":e,include_player_ids:a};i.template_id?r.template_id=i.template_id:(r.headings={en:i.title||"Empty Title"},r.contents={en:i.message||"Empty Message"},i.subtitle&&(r.subtitle={en:i.subtitle}),i.redirect_url&&(r.url=i.redirect_url));const s={method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify(r)};return yield fetch("https://onesignal.com/api/v1/notifications",s)},new((r=void 0)||(r=Promise))((function(e,i){function t(e){try{o(s.next(e))}catch(e){i(e)}}function l(e){try{o(s.throw(e))}catch(e){i(e)}}function o(i){var n;i.done?e(i.value):(n=i.value,n instanceof r?n:new r((function(e){e(n)}))).then(t,l)}o((s=s.apply(n,a||[])).next())}));var n,a,r,s}}const n=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class a{constructor(){this.id=n()}signin(e){null==t||t.natively.trigger(this.id,16,e,"apple_signin",{})}}class r{constructor(){this.id=n()}copy(e){null==t||t.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:e})}paste(e){null==t||t.natively.trigger(this.id,11,e,"clipboard_paste")}}class s{constructor(){this.id=n()}browserInfo(){var e,i,l,n;return{isNativeApp:void 0!==(null==t?void 0:t.$agent),isIOSApp:(null===(i=null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Natively/iOS"))||!1,isAndroidApp:(null===(n=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}}getAppInfo(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(this.id,0,e,"app_info"))}connectivity(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,0,e,"connectivity"))}app_state(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,19,e,"app_state"))}keyboard_visibility(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,34,e,"keyboard_visibility"))}}class o{constructor(){this.id=n()}getOneSignalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_playerid")}requestPermission(e,i){null==t||t.natively.trigger(this.id,0,i,"push_register",{fallbackToSettings:e})}getPermissionStatus(e){null==t||t.natively.trigger(this.id,0,e,"push_permission")}getExternalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_externalid")}setExternalId(e,i){null==t||t.natively.trigger(this.id,0,i,"onesignal_setexternalid",e)}removeExternalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_removeexternalid")}}class d{constructor(){this.id=n()}getUserGeolocation(e,i){null==t||t.natively.trigger(this.id,0,i,"geolocation",{distance:e})}requestPermission(e){null==t||t.natively.trigger(this.id,0,e,"geo_register")}getPermissionStatus(e){null==t||t.natively.trigger(this.id,0,e,"geo_permission")}}class g{constructor(){this.id=n()}current(e,i,l,n,a=!0){null==t||t.natively.trigger(this.id,12,n,"location_current",{minAccuracy:e,accuracyType:i,priority:l,fallbackToSettings:a})}permission(e){null==t||t.natively.trigger(this.id,6,e,"location_permission")}start(e,i,l,n,a,r=!0){null==t||t.natively.trigger(this.id,12,a,"location_start",{minAccuracy:i,accuracyType:l,priority:n,fallbackToSettings:r,interval:e})}stop(){null==t||t.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,i,l,n,a,r,s=!0){const o={identifier:null!=a?a:"empty",interval:null!=e?e:6e4,minAccuracy:null!=i?i:50,accuracyType:null!=l?l:"Best",priority:null!=n?n:"BALANCED",fallbackToSettings:s};null==t||t.natively.trigger(this.id,12,r,"location_start_bg",o)}statusBackground(e){null==t||t.natively.trigger(this.id,20,e,"location_status_bg",{})}stopBackground(e){null==t||t.natively.trigger(this.id,4,e,"location_stop_bg",{})}}class v{constructor(){this.id=n()}sendSMS(e,i,l){const n={body:null!=e?e:"",recipient:null!=i?i:""};null==t||t.natively.trigger(this.id,0,l,"send_sms",n)}sendEmail(e,i,l,n){const a={subject:null!=e?e:"",body:null!=i?i:"",recipient:null!=l?l:""};null==t||t.natively.trigger(this.id,0,n,"send_email",a)}}class u{constructor(){this.id=n()}setStorageValue(e,i){null==t||t.natively.trigger(this.id,0,void 0,"set_storage_value",{key:e,value:i})}getStorageValue(e,i){null==t||t.natively.trigger(this.id,0,i,"get_storage_value",{key:e})}removeStorageValue(e){null==t||t.natively.trigger(this.id,0,void 0,"remove_storage_value",{key:e})}resetStorage(){null==t||t.natively.trigger(this.id,0,void 0,"reset_storage")}}class c{constructor(e){this.id=n(),this.allowPass=e}checkBiometricsSupport(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_support",{allowPass:this.allowPass})}checkCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_has_credentials")}verifyUserIdentify(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_verify",{allowPass:this.allowPass})}getUserCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_auth",{allowPass:this.allowPass})}removeUserCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_remove_credentials")}saveUserCredentials(e,i,l){null==t||t.natively.trigger(this.id,0,l,"biometrics_auth",{allowPass:this.allowPass,login:e,password:i})}}class y{constructor(){this.id=n()}showDatePicker(e,i,l,n,a){const r={type:null!=l?l:"DATE",style:null!=n?n:"LIGHT",title:null!=e?e:"",description:null!=i?i:""};null==t||t.natively.trigger(this.id,0,a,"datepicker",r)}}class p{constructor(){this.id=n()}showCamera(e,i,l,n){const a={type:null!=e?e:"photo",quality:null!=i?i:"high",camera:null!=l?l:"BACK"};null==t||t.natively.trigger(this.id,2,n,"open_camera",a)}}class h{constructor(){this.id=n()}available(e){null==t||t.natively.trigger(this.id,10,e,"health_available",{})}requestAuthorization(e,i,l){null==t||t.natively.trigger(this.id,10,l,"health_register",{write_data_types:e,read_data_types:i})}permissionStatus(e,i){null==t||t.natively.trigger(this.id,10,i,"health_permission",{data_type:e})}getAllCharacteristics(e){null==t||t.natively.trigger(this.id,10,e,"health_get_all_characteristics",{})}getStatisticQuantity(e,i,l,n,a){const r={data_type:e,interval:i};l&&(r.start_date=l.getTime()),n&&(r.end_date=n.getTime()),null==t||t.natively.trigger(this.id,10,a,"health_get_statistic_quantity",r)}getDailySleepAnalysis(e,i,l,n){const a={limit:l||100};e&&(a.start_date=e.getTime()),i&&(a.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,n,"health_get_daily_sleep_analysis",a)}getWorkouts(e,i,l,n){const a={limit:l||100};e&&(a.start_date=e.getTime()),i&&(a.end_date=i.getTime()),null==t||t.natively.trigger(this.id,21,n,"health_get_workouts",a)}getActivitySummary(e,i,l){const n={};e&&(n.start_date=e.getTime()),i&&(n.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,l,"health_get_activity_summary",n)}}class _{constructor(){this.id=n()}showScanner(e){null==t||t.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,i,l,n,a,r,s,o,d,g,v,u,c){const y={};o&&(y.source=o),a&&(y.menuColor=a),g&&(y.pageMode=g),null==e||isNaN(e)||(y.jpegQuality=e),n&&(y.highlightColor=n),i&&(y.foregroundColor=i),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==t||t.natively.trigger(this.id,21,c,"open_document_scanner",y)}}class b{constructor(){this.id=n()}login(e,i,l){const n=null!=i?i:"";null==t||t.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:n})}logout(e){null==t||t.natively.trigger(this.id,3,e,"purchases_logout",{})}customerId(e){null==t||t.natively.trigger(this.id,3,e,"purchases_customerid",{})}restore(e){null==t||t.natively.trigger(this.id,10,e,"purchases_restore",{})}showPaywall(e,i,l){const n={offeringId:i,shouldShowCloseButton:e};null==t||t.natively.trigger(this.id,38,l,"purchases_show_paywall",n)}showPaywallIfNeeded(e,i,l,n){const a={offeringName:l,entitlementId:e,shouldShowCloseButton:i};null==t||t.natively.trigger(this.id,38,n,"purchases_show_paywall_if_needed",a)}purchasePackage(e,i,l){null==t||t.natively.trigger(this.id,3,i,"purchases_package",{packageId:e,oldProductId:null!=l?l:null})}packagePrice(e,i){null==t||t.natively.trigger(this.id,8,i,"purchases_price",{packageId:e})}}class m{constructor(){this.id=n()}getAllContacts(e){null==t||t.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,i,l,n,a){const r={firstName:e,lastName:null!=i?i:"",email:null!=l?l:"",phone:null!=n?n:""};null==t||t.natively.trigger(this.id,3,a,"contacts_save",r)}}class f{constructor(){this.id=n()}showMediaPicker(e){null==t||t.natively.trigger(this.id,8,e,"mediapicker",{})}}class w{constructor(){this.id=n()}showRecorder(e,i){const l={max_duration:null!=e?e:0};null==t||t.natively.trigger(this.id,13,i,"record_start",l)}}class N{constructor(e,i,l=!1,a,r=!1,s){var o,d,g,v,u,c;this.id=n();const y={};(null==t?void 0:t.natively.isAndroidApp)?y.unitId=null!==(o=e.androidUnitId)&&void 0!==o?o:"ca-app-pub-3940256099942544/6300978111":(null==t?void 0:t.natively.isIOSApp)&&(y.unitId=null!==(d=e.iOSUnitId)&&void 0!==d?d:"ca-app-pub-3940256099942544/2934735716"),y.position=null!==(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==t||t.natively.trigger(this.id,14,(e=>{null==i||i(e),l&&(null==t||t.natively.trigger(this.id,14,(e=>{null==a||a(e),r&&(null==t||t.natively.trigger(this.id,14,s,"bannerad_show",{}))}),"bannerad_load",{}))}),"bannerad_setup",y)}loadAd(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_load",{})}showBanner(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_show",{})}hideBanner(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_hide",{})}bannerIsReady(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_ready",{})}bannerIsVisible(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_visible",{})}}class A{constructor(e="ca-app-pub-3940256099942544/4411468910",i="ca-app-pub-3940256099942544/1033173712",l,a=!1,r){this.id=n(),(null==t?void 0:t.natively.isAndroidApp)?this.unitId=i:(null==t?void 0:t.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=a,this.auto_ad_reload_callback=r,this.loadAd(l)}loadAd(e){var i;const l={unitId:null!==(i=this.unitId)&&void 0!==i?i:"ca-app-pub-3940256099942544/4411468910"};null==t||t.natively.trigger(this.id,14,e,"interstitialad_setup",l)}showInterstitialAd(e){null==t||t.natively.trigger(this.id,14,(i=>{e(i),"DID_DISMISS_AD"===i.event&&this.auto_ad_reload&&setTimeout((()=>{this.loadAd(this.auto_ad_reload_callback)}),500)}),"interstitialad_show",{})}interstitialIsReady(e){null==t||t.natively.trigger(this.id,14,e,"interstitialad_ready",{})}}class S{constructor(e,i,t,l){this.id=n(),this.readAlertMessage=e,this.writeAlertMessage=i,this.readDetectedMessage=t,this.writeDetectedMessage=l}read(e){var i,l;const n={alertMessage:null!==(i=this.readAlertMessage)&&void 0!==i?i:"please set readAlertMessage",detectedMessage:null!==(l=this.readDetectedMessage)&&void 0!==l?l:"readDetectedMessage"};null==t||t.natively.trigger(this.id,15,e,"nfc_read",n)}write(e,i,l,n){var a,r;const s={alertMessage:null!==(a=this.writeAlertMessage)&&void 0!==a?a:"please set writeAlertMessage",detectedMessage:null!==(r=this.writeDetectedMessage)&&void 0!==r?r:"please set writeDetectedMessage",recordData:null!=i?i:"please set recordData",recordId:null!=e?e:"please set recordId",recordDataType:null!=l?l:"please set recordDataType"};null==t||t.natively.trigger(this.id,15,n,"nfc_write",s)}available(e){null==t||t.natively.trigger(this.id,15,e,"nfc_available",{})}}class k{constructor(){this.id=n()}firebase_get_token(e){null==t||t.natively.trigger(this.id,31,e,"firebase_get_token")}firebase_get_apns_token(e){null==t||t.natively.trigger(this.id,31,e,"firebase_get_apns_token")}firebase_request_permission(e){null==t||t.natively.trigger(this.id,31,e,"firebase_request_permission")}firebase_has_permission(e){null==t||t.natively.trigger(this.id,31,e,"firebase_has_permission")}firebase_subscribe_to_topic(e,i){null==t||t.natively.trigger(this.id,31,i,"firebase_subscribe_to_topic",{topic:e})}firebase_unsubscribe_from_topic(e,i){null==t||t.natively.trigger(this.id,31,i,"firebase_unsubscribe_from_topic",{topic:e})}}class I{constructor(){this.id=n()}setProfile(e,i){null==t||t.natively.trigger(this.id,32,i,"klaviyo_set_profile",e)}getExternalId(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_external_id")}resetProfile(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_reset_profile")}registerToken(e,i){null==t||t.natively.trigger(this.id,32,e,"klaviyo_register_token",{token:i})}pushPermission(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_push_permission")}pushRegister(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_push_register")}}class T{constructor(){this.id=n()}createCalendarEvent(e,i,l,n,a,r,s){const o={title:e,timezone:n,calendarId:a,description:r,endDate:null==i?void 0:i.toISOString(),startDate:l.toISOString()};null==t||t.natively.trigger(void 0,37,s,"calendar_event",o)}retrieveCalendars(e){null==t||t.natively.trigger(void 0,37,e,"retrieve_calendars",{})}}const P=()=>null==t?void 0:t.natively;t&&(t.natively=new l,t.NativelyAdmobBanner=N,t.NativelyAdmobInterstitial=A,t.NativelyAppleSignInService=a,t.NativelyAudioRecorder=w,t.NativelyBiometrics=c,t.NativelyCamera=p,t.NativelyClipboard=r,t.NativelyContacts=m,t.NativelyDatePicker=y,t.NativelyGeolocation=d,t.NativelyHealth=h,t.NativelyInfo=s,t.NativelyLocation=g,t.NativelyMediaPicker=f,t.NativelyMessage=v,t.NativelyNFCService=S,t.NativelyNotifications=o,t.NativelyPurchases=b,t.NativelyScanner=_,t.NativelyStorage=u,t.NativelyCalendar=T,t.NativelyFirebaseNotifications=k,t.NativelyKlaviyoNotifications=I),null==t||t.natively.addObserver((()=>null==t?void 0:t.natively.trigger(void 0,0,(e=>{t&&(t.natively.min_app_version=e.minSDKVersion,t.natively.app_version=e.sdkVersion)}),"app_info",{})))})();
1
+ (()=>{"use strict";var e={d:(i,t)=>{for(var l in t)e.o(t,l)&&!e.o(i,l)&&Object.defineProperty(i,l,{enumerable:!0,get:t[l]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};e.r(i),e.d(i,{Natively:()=>l,NativelyAdmobBanner:()=>N,NativelyAdmobInterstitial:()=>A,NativelyAppleSignInService:()=>a,NativelyAudioRecorder:()=>w,NativelyBiometrics:()=>c,NativelyCalendar:()=>T,NativelyCamera:()=>h,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>k,NativelyGeolocation:()=>d,NativelyHealth:()=>p,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>I,NativelyLocation:()=>g,NativelyMediaPicker:()=>f,NativelyMessage:()=>v,NativelyNFCService:()=>S,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>_,NativelyStorage:()=>u,generateID:()=>n,useNatively:()=>P});const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:null;class l{constructor(){var e,i,l,n;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.injected=!1,this.observers=[],this.onNativeError=null,this.onTabChanged=null,this.isIOSApp=(null===(i=null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Natively/iOS"))||!1,this.isAndroidApp=(null===(n=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}setDebug(e){t&&(t.natively.isDebug=e)}notify(e,i){t&&(t.natively.injected=!0,e&&(t.natively.min_app_version=e),i&&(t.natively.app_version=i));const l=null==t?void 0:t.natively.observers;for((null==t?void 0:t.natively.isDebug)&&console.log("[INFO] Notify observers: ",l.length);l.length>0;){const e=l.shift();null==e||e()}}addObserver(e){(null==t?void 0:t.natively.injected)?e():((null==t?void 0:t.natively.isDebug)&&console.log(`[DEBUG] addObserver: ${e}`),null==t||t.natively.observers.push(e))}trigger(e,i,l,n,a){const r=null==t?void 0:t.natively.isDebug;if(null==t?void 0:t.natively.injected)if(i>(null==t?void 0:t.natively.app_version))r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${null==t?void 0:t.natively.app_version}, feature version: ${i}`);else{if(l){let i;i=e?n+"_response_"+e:n+"_response",t&&(t[i]=function(n,a){null==t||t.$agent.response(),a.message&&r?alert(`[ERROR] Error message: ${a.message}`):(r&&console.log(`[DEBUG] Callback method: ${i}, body: ${JSON.stringify(n)}, respId: ${e}`),l(n))}),a?a.response_id=e:a={response_id:e}}r&&console.log(`[DEBUG] Trigger method: ${n}, body: ${JSON.stringify(a)}`),null==t||t.$agent.trigger(n,a)}else null==t||t.natively.addObserver((()=>{null==t||t.natively.trigger(e,i,l,n,a)}))}setTabChangedHandler(e){"function"==typeof e?this.onTabChanged=e:console.warn("[Natively] Tab changed handler must be a function")}removeTabChangedHandler(){this.onTabChanged=null}setErrorHandler(e){"function"==typeof e&&(this.onNativeError=e)}removeErrorHandler(){this.onNativeError=null}setErrorScreen(e){null==t||t.natively.trigger(void 0,0,void 0,"error_screen",{show_error:e})}openLogger(){null==t||t.$agent.natively_logger()}openConsole(){null==t||t.natively.trigger(void 0,22,void 0,"app_console")}closeApp(){null==t||t.natively.trigger(void 0,11,void 0,"app_close")}showProgress(e){null==t||t.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:e})}shareImage(e){null==t||t.natively.trigger(void 0,0,void 0,"share_image",{url:e})}shareText(e){null==t||t.natively.trigger(void 0,0,void 0,"share_text",{text:e})}shareTextAndImage(e,i){null==t||t.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:i,text:e})}shareFile(e){null==t||t.natively.trigger(void 0,2,void 0,"share_file",{url:e})}openExternalURL(e,i){const l={url:void 0===e?"https://buildnatively.com":e,view:void 0!==i&&i?"external":"web"};null==t||t.natively.trigger(void 0,18,void 0,"open_link",l)}openExternalApp(e){null==t||t.natively.trigger(void 0,22,void 0,"open_app",{url:e})}showAppToast(e,i){null==t||t.natively.trigger(void 0,0,void 0,"show_toast",{text:i||"",type:e||"DEFAULT"})}showAppBanner(e,i,l){null==t||t.natively.trigger(void 0,0,void 0,"show_banner",{type:e||"INFO",title:i||"",description:l||""})}analyticsTrackEvent(e,i){const l={name:e};i&&(l.data=i),null==t||t.natively.trigger(void 0,37,void 0,"analytics_log_event",l)}requestAppReview(){null==t||t.natively.trigger(void 0,0,void 0,"request_review")}getInsets(e){null==t||t.natively.trigger(void 0,36,e,"get_insets")}setAppBackgroundColor(e){null==t||t.natively.trigger(void 0,1,void 0,"app_background",{color:e})}setAppProgressColor(e){null==t||t.natively.trigger(void 0,1,void 0,"app_progress",{color:e})}setAppSwipeNavigation(e){null==t||t.natively.trigger(void 0,22,void 0,"app_navigation",{toggle:e})}setAppPullToRefresh(e){null==t||t.natively.trigger(void 0,1,void 0,"app_pull",{toggle:e})}setAppOrientation(e){null==t||t.natively.trigger(void 0,3,void 0,"app_orientation",{orientation:e})}setAppStatusBarStyle(e){null==t||t.natively.trigger(void 0,22,void 0,"status_bar_style",{style:e})}hideLoadingScreen(){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!1,auto_hide:!0})}showLoadingScreen(e){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!0,auto_hide:e||!1})}openAppSettings(){null==t||t.natively.trigger(void 0,0,void 0,"open_appsettings")}showTabBar(){null==t||t.natively.trigger(void 0,33,void 0,"show_tab_bar")}enableWakelock(){null==t||t.natively.trigger(void 0,34,void 0,"wakelock_enable")}disableWakelock(){null==t||t.natively.trigger(void 0,34,void 0,"wakelock_disable")}hideTabBar(){null==t||t.natively.trigger(void 0,33,void 0,"hide_tab_bar")}reloadWebview(){null==t||t.natively.trigger(void 0,35,void 0,"reset_webview")}hapticPattern(e,i){null==t||t.natively.trigger(void 0,22,void 0,"haptic_pattern",{pattern:e,delay:i})}openPDF(e,i){const l={url:e.url||"",base64:e.base64||"",fileName:e.fileName||`pdf-${(new Date).getTime()}.pdf`,download:!0===e.download};null==t||t.natively.trigger(void 0,38,i,"open_pdf",l)}hapticImpact(e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_impact",{type:e})}hapticNotification(e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_notification",{type:e})}sendPushNotification(e,i,t,l){return n=this,a=void 0,s=function*(){const n=t.filter((e=>e.length>0)),a=[...new Set(n)],r={app_id:l?"be83022a-1d08-45d0-a07a-0c3655666e17":e,include_player_ids:a};i.template_id?r.template_id=i.template_id:(r.headings={en:i.title||"Empty Title"},r.contents={en:i.message||"Empty Message"},i.subtitle&&(r.subtitle={en:i.subtitle}),i.redirect_url&&(r.url=i.redirect_url));const s={method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify(r)};return yield fetch("https://onesignal.com/api/v1/notifications",s)},new((r=void 0)||(r=Promise))((function(e,i){function t(e){try{o(s.next(e))}catch(e){i(e)}}function l(e){try{o(s.throw(e))}catch(e){i(e)}}function o(i){var n;i.done?e(i.value):(n=i.value,n instanceof r?n:new r((function(e){e(n)}))).then(t,l)}o((s=s.apply(n,a||[])).next())}));var n,a,r,s}}const n=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class a{constructor(){this.id=n()}signin(e){null==t||t.natively.trigger(this.id,16,e,"apple_signin",{})}}class r{constructor(){this.id=n()}copy(e){null==t||t.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:e})}paste(e){null==t||t.natively.trigger(this.id,11,e,"clipboard_paste")}}class s{constructor(){this.id=n()}browserInfo(){var e,i,l,n;return{isNativeApp:void 0!==(null==t?void 0:t.$agent),isIOSApp:(null===(i=null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Natively/iOS"))||!1,isAndroidApp:(null===(n=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}}getAppInfo(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(this.id,0,e,"app_info"))}connectivity(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,0,e,"connectivity"))}app_state(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,19,e,"app_state"))}keyboard_visibility(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,34,e,"keyboard_visibility"))}}class o{constructor(){this.id=n()}getOneSignalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_playerid")}requestPermission(e,i){null==t||t.natively.trigger(this.id,0,i,"push_register",{fallbackToSettings:e})}getPermissionStatus(e){null==t||t.natively.trigger(this.id,0,e,"push_permission")}getExternalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_externalid")}setExternalId(e,i){null==t||t.natively.trigger(this.id,0,i,"onesignal_setexternalid",e)}removeExternalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_removeexternalid")}}class d{constructor(){this.id=n()}getUserGeolocation(e,i){null==t||t.natively.trigger(this.id,0,i,"geolocation",{distance:e})}requestPermission(e){null==t||t.natively.trigger(this.id,0,e,"geo_register")}getPermissionStatus(e){null==t||t.natively.trigger(this.id,0,e,"geo_permission")}}class g{constructor(){this.id=n()}current(e,i,l,n,a=!0){null==t||t.natively.trigger(this.id,12,n,"location_current",{minAccuracy:e,accuracyType:i,priority:l,fallbackToSettings:a})}permission(e){null==t||t.natively.trigger(this.id,6,e,"location_permission")}start(e,i,l,n,a,r=!0){null==t||t.natively.trigger(this.id,12,a,"location_start",{minAccuracy:i,accuracyType:l,priority:n,fallbackToSettings:r,interval:e})}stop(){null==t||t.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,i,l,n,a,r,s=!0){const o={identifier:null!=a?a:"empty",interval:null!=e?e:6e4,minAccuracy:null!=i?i:50,accuracyType:null!=l?l:"Best",priority:null!=n?n:"BALANCED",fallbackToSettings:s};null==t||t.natively.trigger(this.id,12,r,"location_start_bg",o)}statusBackground(e){null==t||t.natively.trigger(this.id,20,e,"location_status_bg",{})}stopBackground(e){null==t||t.natively.trigger(this.id,4,e,"location_stop_bg",{})}}class v{constructor(){this.id=n()}sendSMS(e,i,l){const n={body:null!=e?e:"",recipient:null!=i?i:""};null==t||t.natively.trigger(this.id,0,l,"send_sms",n)}sendEmail(e,i,l,n){const a={subject:null!=e?e:"",body:null!=i?i:"",recipient:null!=l?l:""};null==t||t.natively.trigger(this.id,0,n,"send_email",a)}}class u{constructor(){this.id=n()}setStorageValue(e,i){null==t||t.natively.trigger(this.id,0,void 0,"set_storage_value",{key:e,value:i})}getStorageValue(e,i){null==t||t.natively.trigger(this.id,0,i,"get_storage_value",{key:e})}removeStorageValue(e){null==t||t.natively.trigger(this.id,0,void 0,"remove_storage_value",{key:e})}resetStorage(){null==t||t.natively.trigger(this.id,0,void 0,"reset_storage")}}class c{constructor(e){this.id=n(),this.allowPass=e}checkBiometricsSupport(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_support",{allowPass:this.allowPass})}checkCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_has_credentials")}verifyUserIdentify(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_verify",{allowPass:this.allowPass})}getUserCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_auth",{allowPass:this.allowPass})}removeUserCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_remove_credentials")}saveUserCredentials(e,i,l){null==t||t.natively.trigger(this.id,0,l,"biometrics_auth",{allowPass:this.allowPass,login:e,password:i})}}class y{constructor(){this.id=n()}showDatePicker(e,i,l,n,a){const r={type:null!=l?l:"DATE",style:null!=n?n:"LIGHT",title:null!=e?e:"",description:null!=i?i:""};null==t||t.natively.trigger(this.id,0,a,"datepicker",r)}}class h{constructor(){this.id=n()}showCamera(e,i,l,n){const a={type:null!=e?e:"photo",quality:null!=i?i:"high",camera:null!=l?l:"BACK"};null==t||t.natively.trigger(this.id,2,n,"open_camera",a)}}class p{constructor(){this.id=n()}available(e){null==t||t.natively.trigger(this.id,10,e,"health_available",{})}requestAuthorization(e,i,l){null==t||t.natively.trigger(this.id,10,l,"health_register",{write_data_types:e,read_data_types:i})}permissionStatus(e,i){null==t||t.natively.trigger(this.id,10,i,"health_permission",{data_type:e})}getAllCharacteristics(e){null==t||t.natively.trigger(this.id,10,e,"health_get_all_characteristics",{})}getStatisticQuantity(e,i,l,n,a){const r={data_type:e,interval:i};l&&(r.start_date=l.getTime()),n&&(r.end_date=n.getTime()),null==t||t.natively.trigger(this.id,10,a,"health_get_statistic_quantity",r)}getDailySleepAnalysis(e,i,l,n){const a={limit:l||100};e&&(a.start_date=e.getTime()),i&&(a.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,n,"health_get_daily_sleep_analysis",a)}getWorkouts(e,i,l,n){const a={limit:l||100};e&&(a.start_date=e.getTime()),i&&(a.end_date=i.getTime()),null==t||t.natively.trigger(this.id,21,n,"health_get_workouts",a)}getActivitySummary(e,i,l){const n={};e&&(n.start_date=e.getTime()),i&&(n.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,l,"health_get_activity_summary",n)}}class _{constructor(){this.id=n()}showScanner(e){null==t||t.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,i,l,n,a,r,s,o,d,g,v,u,c){const y={};o&&(y.source=o),a&&(y.menuColor=a),g&&(y.pageMode=g),null==e||isNaN(e)||(y.jpegQuality=e),n&&(y.highlightColor=n),i&&(y.foregroundColor=i),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==t||t.natively.trigger(this.id,21,c,"open_document_scanner",y)}}class b{constructor(){this.id=n()}login(e,i,l){const n=null!=i?i:"";null==t||t.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:n})}logout(e){null==t||t.natively.trigger(this.id,3,e,"purchases_logout",{})}customerId(e){null==t||t.natively.trigger(this.id,3,e,"purchases_customerid",{})}restore(e){null==t||t.natively.trigger(this.id,10,e,"purchases_restore",{})}showPaywall(e,i,l){const n={offeringId:i,shouldShowCloseButton:e};null==t||t.natively.trigger(this.id,38,l,"purchases_show_paywall",n)}showPaywallIfNeeded(e,i,l,n){const a={offeringName:l,entitlementId:e,shouldShowCloseButton:i};null==t||t.natively.trigger(this.id,38,n,"purchases_show_paywall_if_needed",a)}purchasePackage(e,i,l){null==t||t.natively.trigger(this.id,3,i,"purchases_package",{packageId:e,oldProductId:null!=l?l:null})}packagePrice(e,i){null==t||t.natively.trigger(this.id,8,i,"purchases_price",{packageId:e})}}class m{constructor(){this.id=n()}getAllContacts(e){null==t||t.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,i,l,n,a){const r={firstName:e,lastName:null!=i?i:"",email:null!=l?l:"",phone:null!=n?n:""};null==t||t.natively.trigger(this.id,3,a,"contacts_save",r)}}class f{constructor(){this.id=n()}showMediaPicker(e){null==t||t.natively.trigger(this.id,8,e,"mediapicker",{})}}class w{constructor(){this.id=n()}showRecorder(e,i){const l={max_duration:null!=e?e:0};null==t||t.natively.trigger(this.id,13,i,"record_start",l)}}class N{constructor(e,i,l=!1,a,r=!1,s){var o,d,g,v,u,c;this.id=n();const y={};(null==t?void 0:t.natively.isAndroidApp)?y.unitId=null!==(o=e.androidUnitId)&&void 0!==o?o:"ca-app-pub-3940256099942544/6300978111":(null==t?void 0:t.natively.isIOSApp)&&(y.unitId=null!==(d=e.iOSUnitId)&&void 0!==d?d:"ca-app-pub-3940256099942544/2934735716"),y.position=null!==(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==t||t.natively.trigger(this.id,14,(e=>{null==i||i(e),l&&(null==t||t.natively.trigger(this.id,14,(e=>{null==a||a(e),r&&(null==t||t.natively.trigger(this.id,14,s,"bannerad_show",{}))}),"bannerad_load",{}))}),"bannerad_setup",y)}loadAd(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_load",{})}showBanner(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_show",{})}hideBanner(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_hide",{})}bannerIsReady(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_ready",{})}bannerIsVisible(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_visible",{})}}class A{constructor(e="ca-app-pub-3940256099942544/4411468910",i="ca-app-pub-3940256099942544/1033173712",l,a=!1,r){this.id=n(),(null==t?void 0:t.natively.isAndroidApp)?this.unitId=i:(null==t?void 0:t.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=a,this.auto_ad_reload_callback=r,this.loadAd(l)}loadAd(e){var i;const l={unitId:null!==(i=this.unitId)&&void 0!==i?i:"ca-app-pub-3940256099942544/4411468910"};null==t||t.natively.trigger(this.id,14,e,"interstitialad_setup",l)}showInterstitialAd(e){null==t||t.natively.trigger(this.id,14,(i=>{e(i),"DID_DISMISS_AD"===i.event&&this.auto_ad_reload&&setTimeout((()=>{this.loadAd(this.auto_ad_reload_callback)}),500)}),"interstitialad_show",{})}interstitialIsReady(e){null==t||t.natively.trigger(this.id,14,e,"interstitialad_ready",{})}}class S{constructor(e,i,t,l){this.id=n(),this.readAlertMessage=e,this.writeAlertMessage=i,this.readDetectedMessage=t,this.writeDetectedMessage=l}read(e){var i,l;const n={alertMessage:null!==(i=this.readAlertMessage)&&void 0!==i?i:"please set readAlertMessage",detectedMessage:null!==(l=this.readDetectedMessage)&&void 0!==l?l:"readDetectedMessage"};null==t||t.natively.trigger(this.id,15,e,"nfc_read",n)}write(e,i,l,n){var a,r;const s={alertMessage:null!==(a=this.writeAlertMessage)&&void 0!==a?a:"please set writeAlertMessage",detectedMessage:null!==(r=this.writeDetectedMessage)&&void 0!==r?r:"please set writeDetectedMessage",recordData:null!=i?i:"please set recordData",recordId:null!=e?e:"please set recordId",recordDataType:null!=l?l:"please set recordDataType"};null==t||t.natively.trigger(this.id,15,n,"nfc_write",s)}available(e){null==t||t.natively.trigger(this.id,15,e,"nfc_available",{})}}class k{constructor(){this.id=n()}firebase_get_token(e){null==t||t.natively.trigger(this.id,31,e,"firebase_get_token")}firebase_get_apns_token(e){null==t||t.natively.trigger(this.id,31,e,"firebase_get_apns_token")}firebase_request_permission(e){null==t||t.natively.trigger(this.id,31,e,"firebase_request_permission")}firebase_has_permission(e){null==t||t.natively.trigger(this.id,31,e,"firebase_has_permission")}firebase_subscribe_to_topic(e,i){null==t||t.natively.trigger(this.id,31,i,"firebase_subscribe_to_topic",{topic:e})}firebase_unsubscribe_from_topic(e,i){null==t||t.natively.trigger(this.id,31,i,"firebase_unsubscribe_from_topic",{topic:e})}}class I{constructor(){this.id=n()}setProfile(e,i){null==t||t.natively.trigger(this.id,32,i,"klaviyo_set_profile",e)}getExternalId(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_external_id")}resetProfile(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_reset_profile")}registerToken(e,i){null==t||t.natively.trigger(this.id,32,e,"klaviyo_register_token",{token:i})}pushPermission(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_push_permission")}pushRegister(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_push_register")}}class T{constructor(){this.id=n()}createCalendarEvent(e,i,l,n,a,r,s){const o={title:e,timezone:n,calendarId:a,description:r,endDate:null==i?void 0:i.toISOString(),startDate:l.toISOString()};null==t||t.natively.trigger(void 0,37,s,"calendar_event",o)}retrieveCalendars(e){null==t||t.natively.trigger(void 0,37,e,"retrieve_calendars",{})}}const P=()=>null==t?void 0:t.natively;t&&(t.natively=new l,t.NativelyAdmobBanner=N,t.NativelyAdmobInterstitial=A,t.NativelyAppleSignInService=a,t.NativelyAudioRecorder=w,t.NativelyBiometrics=c,t.NativelyCamera=h,t.NativelyClipboard=r,t.NativelyContacts=m,t.NativelyDatePicker=y,t.NativelyGeolocation=d,t.NativelyHealth=p,t.NativelyInfo=s,t.NativelyLocation=g,t.NativelyMediaPicker=f,t.NativelyMessage=v,t.NativelyNFCService=S,t.NativelyNotifications=o,t.NativelyPurchases=b,t.NativelyScanner=_,t.NativelyStorage=u,t.NativelyCalendar=T,t.NativelyFirebaseNotifications=k,t.NativelyKlaviyoNotifications=I),null==t||t.natively.addObserver((()=>null==t?void 0:t.natively.trigger(void 0,0,(e=>{t&&(t.natively.min_app_version=e.minSDKVersion,t.natively.app_version=e.sdkVersion)}),"app_info",{})))})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natively",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "description": "Natively SDK for building native-like web applications",
5
5
  "type": "module",
6
6
  "exports": {