natively 2.8.2 → 2.9.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.
@@ -4,6 +4,8 @@ window.natively = {
4
4
  app_version: 0,
5
5
  injected: false,
6
6
  observers: [],
7
+ isIOSApp: window.navigator.userAgent.includes("Natively/iOS"),
8
+ isAndroidApp: window.navigator.userAgent.includes("Natively/Android"),
7
9
 
8
10
  setDebug: function (isDebug) {
9
11
  window.natively.isDebug = isDebug;
@@ -731,6 +733,114 @@ class NativelyAudioRecorder {
731
733
  }
732
734
  }
733
735
 
736
+ // 2.9.0
737
+ // Can be only one instance of NativelyAdmobBanner per page
738
+ // Make sure to use this an not reload page a lot
739
+ class NativelyAdmobBanner {
740
+ constructor(
741
+ config = {
742
+ iOSUnitId: "ca-app-pub-3940256099942544/2934735716",
743
+ androidUnitId: "ca-app-pub-3940256099942544/6300978111",
744
+ position: "BOTTOM",
745
+ sizeType: "AUTO",
746
+ custom_width: 320,
747
+ custom_height: 50
748
+ },
749
+ setup_callback = undefined, // function(resp) { console.log(resp) }
750
+ preload_ad = false, // Load ad on init
751
+ preload_callback = undefined, // function(resp) { console.log(resp) }
752
+ show_ad = false, // Show ad on init
753
+ show_callback = undefined, // function(resp) { console.log(resp) }
754
+ ) {
755
+ const id = generateID();
756
+ const params = {};
757
+ if (window.natively.isAndroidApp) {
758
+ params.unitId = (typeof config.androidUnitId === "undefined") ? "ca-app-pub-3940256099942544/6300978111" : config.androidUnitId;
759
+ } else if (window.natively.isIOSApp) {
760
+ params.unitId = (typeof config.iOSUnitId === "undefined") ? "ca-app-pub-3940256099942544/2934735716" : config.iOSUnitId;
761
+ }
762
+
763
+ params.position = (typeof config.position === "undefined") ? "BOTTOM" : config.position;
764
+ params.sizeType = (typeof config.sizeType === "undefined") ? "AUTO" : config.sizeType;
765
+ params.width = (typeof config.custom_width === "undefined") ? 320 : config.width;
766
+ params.height = (typeof config.custom_height === "undefined") ? 50 : config.height;
767
+ window.natively.trigger(id, 14, function(resp) {
768
+ if (typeof setup_callback !== "undefined") {
769
+ setup_callback(resp);
770
+ }
771
+ if (preload_ad) {
772
+ window.natively.trigger(id, 14, function(resp) {
773
+ if (typeof preload_callback !== "undefined") {
774
+ preload_callback(resp);
775
+ }
776
+ if (show_ad) {
777
+ window.natively.trigger(id, 14, show_callback, "bannerad_show", {});
778
+ }
779
+ }, "bannerad_load", {});
780
+ }
781
+ }, "bannerad_setup", params);
782
+
783
+ this.loadAd = function (callback) {
784
+ window.natively.trigger(id, 14, callback, "bannerad_load", {});
785
+ };
786
+ this.showBanner = function (callback) {
787
+ window.natively.trigger(id, 14, callback, "bannerad_show", {});
788
+ };
789
+ this.hideBanner = function (callback) {
790
+ window.natively.trigger(id, 14, callback, "bannerad_hide", {});
791
+ };
792
+ this.bannerIsReady = function (callback) {
793
+ window.natively.trigger(id, 14, callback, "bannerad_ready", {});
794
+ };
795
+ this.bannerIsVisible = function (callback) {
796
+ window.natively.trigger(id, 14, callback, "bannerad_visible", {});
797
+ };
798
+ }
799
+ }
800
+
801
+ // 2.9.0
802
+ // Can be only one instance of NativelyAdmobInterstitial per page
803
+ // Make sure to use this an not reload page a lot
804
+ class NativelyAdmobInterstitial {
805
+ constructor(
806
+ iOSUnitId = "ca-app-pub-3940256099942544/4411468910",
807
+ androidUnitId = "ca-app-pub-3940256099942544/1033173712",
808
+ setup_callback = undefined, // function(resp) { console.log(resp) }
809
+ auto_ad_reload = false, // Reload ad after showing
810
+ auto_ad_reload_callback = undefined, // function(resp) { console.log(resp) }
811
+ ) {
812
+ const id = generateID();
813
+ let unitId;
814
+ if (window.natively.isAndroidApp) {
815
+ unitId = (typeof androidUnitId === "undefined") ? "ca-app-pub-3940256099942544/1033173712" : androidUnitId;
816
+ } else if (window.natively.isIOSApp) {
817
+ unitId = (typeof iOSUnitId === "undefined") ? "ca-app-pub-3940256099942544/4411468910" : iOSUnitId;
818
+ }
819
+
820
+ this.loadAd = function (callback) {
821
+ const params = {};
822
+ params.unitId = (typeof unitId === "undefined") ? "ca-app-pub-3940256099942544/4411468910" : unitId;
823
+ window.natively.trigger(id, 14, callback, "interstitialad_setup", params);
824
+ };
825
+ this.showInterstitialAd = function (callback) {
826
+ window.natively.trigger(id, 14, function(resp) {
827
+ callback(resp);
828
+ if (resp.event === "DID_DISMISS_AD" && auto_ad_reload) {
829
+ const params = {};
830
+ params.unitId = unitId;
831
+ setTimeout(() => {
832
+ window.natively.trigger(id, 14, auto_ad_reload_callback, "interstitialad_setup", params);
833
+ }, 500);
834
+ }
835
+ }, "interstitialad_show", {});
836
+ };
837
+ this.interstitialIsReady = function (callback) {
838
+ window.natively.trigger(id, 14, callback, "interstitialad_ready", {});
839
+ };
840
+ this.loadAd(setup_callback);
841
+ }
842
+ }
843
+
734
844
  function generateID() {
735
845
  return Date.now().toString(36) + Math.random().toString(36).substring(2);
736
846
  }
@@ -1 +1 @@
1
- function generateID(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}window.natively={isDebug:!1,min_app_version:0,app_version:0,injected:!1,observers:[],setDebug:function(t){window.natively.isDebug=t},notify:function(t,i){window.natively.injected=!0,t&&(window.natively.min_app_version=t),i&&(window.natively.app_version=i);const e=window.natively.observers;for(natively.isDebug&&console.log("[INFO] Notify observers: ",e.length);e.length>0;){const t=e.shift();t()}},addObserver:function(t){window.natively.injected?t():(window.natively.isDebug&&console.log(`[DEBUG] addObserver: ${t}`),window.natively.observers.push(t))},trigger:function(t,i,e,n,o){const r=window.natively.isDebug;if(window.natively.injected)if(i>window.natively.app_version)r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${window.natively.app_version}, feature version: ${i}`);else{if(e){let i;i=t?n+"_response_"+t:n+"_response",window[i]=function(n,o){$agent.response(),o.message&&r?alert(`[ERROR] Error message: ${o.message}`):(r&&console.log(`[DEBUG] Callback method: ${i}, body: ${JSON.stringify(n)}, respId: ${t}`),e(n))},o?o.response_id=t:o={response_id:t}}r&&console.log(`[DEBUG] Trigger method: ${n}, body: ${JSON.stringify(o)}`),$agent.trigger(n,o)}else window.natively.addObserver(()=>{window.natively.trigger(t,i,e,n,o)})},openLogger:function(){$agent.natively_logger()},closeApp:function(){window.natively.trigger(void 0,11,void 0,"app_close")},showProgress:function(t){window.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:t})},shareImage(t){window.natively.trigger(void 0,0,void 0,"share_image",{url:t})},shareText(t){window.natively.trigger(void 0,0,void 0,"share_text",{text:t})},shareTextAndImage(t,i){window.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:i,text:t})},shareFile(t){window.natively.trigger(void 0,2,void 0,"share_file",{url:t})},openExternalURL(t){window.natively.trigger(void 0,0,void 0,"open_link",{url:t})},openExternalAppIOS(t){window.natively.trigger(void 0,0,void 0,"open_app",{url:t})},openAppSettings(){window.natively.trigger(void 0,0,void 0,"open_appsettings")},hapticPatternIOS(t,i){window.natively.trigger(void 0,7,void 0,"haptic_pattern",{pattern:t,delay:i})},hapticImpactIOS(t){window.natively.trigger(void 0,7,void 0,"haptic_impact",{type:t})},hapticNotificationIOS(t){window.natively.trigger(void 0,7,void 0,"haptic_notification",{type:t})},showAppToast(t,i){const e={};e.text=void 0===i?"":i,e.type=void 0===t?"DEFAULT":t,window.natively.trigger(void 0,0,void 0,"show_toast",e)},showAppBanner(t,i,e){const n={};n.type=void 0===t?"INFO":t,n.title=void 0===i?"":i,n.description=void 0===e?"":e,window.natively.trigger(void 0,0,void 0,"show_banner",n)},requestAppReview(){window.natively.trigger(void 0,0,void 0,"request_review")},setAppBackgroundColor(t){const i={color:t};window.natively.trigger(void 0,1,void 0,"app_background",i)},setAppProgressColor(t){const i={color:t};window.natively.trigger(void 0,1,void 0,"app_progress",i)},setAppSwipeNavigationIOS(t){const i={toggle:t};window.natively.trigger(void 0,1,void 0,"app_navigation",i)},setAppPullToRefresh(t){const i={toggle:t};window.natively.trigger(void 0,1,void 0,"app_pull",i)},setAppOrientation(t){const i={orientation:t};window.natively.trigger(void 0,3,void 0,"app_orientation",i)},setAppStatusBarStyleIOS(t){const i={style:t};window.natively.trigger(void 0,2,void 0,"status_bar_style",i)},async sendPushNotification(t,i,e,n){const o=e.filter(t=>t.length>0),r=[...new Set(o)];let a={app_id:n?"be83022a-1d08-45d0-a07a-0c3655666e17":t,include_player_ids:r};i.template_id?a.template_id=i.template_id:(a.headings={},a.headings.en=i.title||"Empty Title",a.contents={},a.contents.en=i.message||"Empty Message",i.subtitle&&(a.subtitle={},a.subtitle.en=i.subtitle),i.redirect_url&&(a.url=i.redirect_url));const s={method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify(a)};return await fetch("https://onesignal.com/api/v1/notifications",s)}},window.natively.addObserver(()=>window.natively.trigger(void 0,0,t=>{window.natively.min_app_version=t.minSDKVersion,window.natively.app_version=t.sdkVersion},"app_info",{}));class NativelyInfo{constructor(){const t=generateID();this.browserInfo=function(){const t="undefined"!=typeof $agent,i=window.navigator.userAgent.includes("Natively/iOS"),e=window.navigator.userAgent.includes("Natively/Android");return{isNativeApp:t,isIOSApp:i,isAndroidApp:e}},this.getAppInfo=function(i){window.natively.trigger(t,0,i,"app_info")},this.connectivity=function(t){window.natively.trigger(void 0,0,t,"connectivity")}}}class NativelyClipboard{constructor(){const t=generateID();this.copy=function(t){window.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:t})},this.paste=function(i){window.natively.trigger(t,11,i,"clipboard_paste")}}}class NativelyPagesCache{constructor(){const t=generateID();this.currentPageCached=function(i){window.natively.trigger(t,4,i,"current_page_cached")},this.storeCurrentPage=function(i){window.natively.trigger(t,4,i,"store_current_page")},this.resetCurrentPage=function(i){window.natively.trigger(t,4,i,"reset_current_page")},this.resetAll=function(i){window.natively.trigger(t,4,i,"reset_all")}}}class NativelyNotifications{constructor(){const t=generateID();this.getOneSignalId=function(i){window.natively.trigger(t,0,i,"onesignal_playerid")},this.requestPermission=function(i,e){window.natively.trigger(t,0,e,"push_register",{fallbackToSettings:i})},this.getPermissionStatus=function(i){window.natively.trigger(t,0,i,"push_permission")}}}class NativelyGeolocation{constructor(){const t=generateID();this.getUserGeolocation=function(i,e){window.natively.trigger(t,0,e,"geolocation",{distance:i})},this.requestPermission=function(i){window.natively.trigger(t,0,i,"geo_register")},this.getPermissionStatus=function(i){window.natively.trigger(t,0,i,"geo_permission")}}}class NativelyLocation{constructor(){const t=generateID();this.current=function(i,e,n,o){window.natively.trigger(t,12,o,"location_current",{minAccuracy:i,accuracyType:e,priority:n})},this.permission=function(i){window.natively.trigger(t,6,i,"location_permission")},this.start=function(i,e,n,o,r){window.natively.trigger(t,12,r,"location_start",{minAccuracy:e,accuracyType:n,priority:o,interval:i})},this.stop=function(){window.natively.trigger(t,3,void 0,"location_stop",{})},this.startBackground=function(i,e,n,o,r,a){const s={};s.identifier=void 0===r?"empty":r,s.interval=void 0===i?6e4:i,s.minAccuracy=void 0===e?50:e,s.accuracyType=void 0===n?"Best":n,s.priority=void 0===o?"BALANCED":o,window.natively.trigger(t,12,a,"location_start_bg",s)},this.stopBackground=function(i){window.natively.trigger(t,4,i,"location_stop_bg",{})}}}class NativelyMessage{constructor(){const t=generateID();this.sendSMS=function(i,e,n){const o={};o.body=void 0===i?"":i,o.recipient=void 0===e?"":e,window.natively.trigger(t,0,n,"send_sms",o)},this.sendEmail=function(i,e,n,o){const r={};r.subject=void 0===i?"":i,r.body=void 0===e?"":e,r.recipient=void 0===n?"":n,window.natively.trigger(t,0,o,"send_email",r)}}}class NativelyStorage{constructor(){const t=generateID();this.setStorageValue=function(i,e){window.natively.trigger(t,0,void 0,"set_storage_value",{key:i,value:e})},this.getStorageValue=function(i,e){window.natively.trigger(t,0,e,"get_storage_value",{key:i})},this.removeStorageValue=function(i){window.natively.trigger(t,0,void 0,"remove_storage_value",{key:i})},this.resetStorage=function(){window.natively.trigger(t,0,void 0,"reset_storage")}}}class NativelyBiometrics{constructor(t){this.allowPass=t;const i=generateID();this.checkBiometricsSupport=function(e){window.natively.trigger(i,0,e,"biometrics_support",{allowPass:t})},this.checkCredentials=function(t){window.natively.trigger(i,0,t,"biometrics_has_credentials")},this.verifyUserIdentify=function(e){window.natively.trigger(i,0,e,"biometrics_verify",{allowPass:t})},this.getUserCredentials=function(e){window.natively.trigger(i,0,e,"biometrics_auth",{allowPass:t})},this.removeUserCredentials=function(t){window.natively.trigger(i,0,t,"biometrics_remove_credentials")},this.saveUserCredentials=function(e,n,o){window.natively.trigger(i,0,o,"biometrics_auth",{allowPass:t,login:e,password:n})}}}class NativelyDatePicker{constructor(){const t=generateID();this.showDatePicker=function(i,e,n,o,r){let a={};a.type=void 0===n?"DATE":n,a.style=void 0===o?"LIGHT":o,a.title=void 0===i?"":i,a.description=void 0===e?"":e,window.natively.trigger(t,0,r,"datepicker",a)}}}class NativelyCamera{constructor(){const t=generateID();this.showCamera=function(i,e,n,o){let r={};r.type=void 0===i?"photo":i,r.quality=void 0===e?"high":e,r.camera=void 0===n?"BACK":n,window.natively.trigger(t,2,o,"open_camera",r)}}}class NativelyHealth{constructor(){const t=generateID();this.available=function(i){window.natively.trigger(t,10,i,"health_available",{})},this.requestAuthorization=function(i,e,n){window.natively.trigger(t,10,n,"health_register",{write_data_types:i,read_data_types:e})},this.permissionStatus=function(i,e){window.natively.trigger(t,10,e,"health_permission",{data_type:i})},this.getAllCharacteristics=function(i){window.natively.trigger(t,10,i,"health_get_all_characteristics",{})},this.getStatisticQuantity=function(i,e,n,o,r){const a={data_type:i,interval:e};void 0!==n&&(a.start_date=n.getTime()),void 0!==o&&(a.end_date=o.getTime()),window.natively.trigger(t,10,r,"health_get_statistic_quantity",a)},this.getDailySleepAnalysis=function(i,e,n,o){const r={limit:n||100};void 0!==i&&(r.start_date=i.getTime()),void 0!==e&&(r.end_date=e.getTime()),window.natively.trigger(t,10,o,"health_get_daily_sleep_analysis",r)},this.getActivitySummary=function(i,e,n){const o={};void 0!==i&&(o.start_date=i.getTime()),void 0!==e&&(o.end_date=e.getTime()),window.natively.trigger(t,10,n,"health_get_activity_summary",o)}}}class NativelyScanner{constructor(){const t=generateID();this.showScanner=function(i){window.natively.trigger(t,2,i,"open_scanner",{})}}}class NativelyPurchases{constructor(){const t=generateID();this.login=function(i,e,n){const o=void 0===e?"":e;window.natively.trigger(t,3,n,"purchases_login",{login:i,email:o})},this.logout=function(i){window.natively.trigger(t,3,i,"purchases_logout",{})},this.customerId=function(i){window.natively.trigger(t,3,i,"purchases_customerid",{})},this.restore=function(i){window.natively.trigger(t,10,i,"purchases_restore",{})},this.purchasePackage=function(i,e){window.natively.trigger(t,3,e,"purchases_package",{packageId:i})},this.packagePrice=function(i,e){window.natively.trigger(t,8,e,"purchases_price",{packageId:i})}}}class NativelyContacts{constructor(){const t=generateID();this.getAllContacts=function(i){window.natively.trigger(t,3,i,"contacts_all",{})},this.createContact=function(i,e,n,o,r){let a={firstName:i};a.lastName=void 0===e?"":e,a.email=void 0===n?"":n,a.phone=void 0===o?"":o,window.natively.trigger(t,3,r,"contacts_save",a)}}}class NativelyMediaPicker{constructor(){const t=generateID();this.showMediaPicker=function(i){window.natively.trigger(t,8,i,"mediapicker",{})}}}class NativelyAudioRecorder{constructor(){const t=generateID();this.showRecorder=function(i,e){let n={};n.max_duration=void 0===i?0:i,window.natively.trigger(t,13,e,"record_start",n)}}}
1
+ function generateID(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}window.natively={isDebug:!1,min_app_version:0,app_version:0,injected:!1,observers:[],isIOSApp:window.navigator.userAgent.includes("Natively/iOS"),isAndroidApp:window.navigator.userAgent.includes("Natively/Android"),setDebug:function(i){window.natively.isDebug=i},notify:function(i,t){window.natively.injected=!0,i&&(window.natively.min_app_version=i),t&&(window.natively.app_version=t);const e=window.natively.observers;for(natively.isDebug&&console.log("[INFO] Notify observers: ",e.length);e.length>0;){const i=e.shift();i()}},addObserver:function(i){window.natively.injected?i():(window.natively.isDebug&&console.log(`[DEBUG] addObserver: ${i}`),window.natively.observers.push(i))},trigger:function(i,t,e,n,o){const r=window.natively.isDebug;if(window.natively.injected)if(t>window.natively.app_version)r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${window.natively.app_version}, feature version: ${t}`);else{if(e){let t;t=i?n+"_response_"+i:n+"_response",window[t]=function(n,o){$agent.response(),o.message&&r?alert(`[ERROR] Error message: ${o.message}`):(r&&console.log(`[DEBUG] Callback method: ${t}, body: ${JSON.stringify(n)}, respId: ${i}`),e(n))},o?o.response_id=i:o={response_id:i}}r&&console.log(`[DEBUG] Trigger method: ${n}, body: ${JSON.stringify(o)}`),$agent.trigger(n,o)}else window.natively.addObserver(()=>{window.natively.trigger(i,t,e,n,o)})},openLogger:function(){$agent.natively_logger()},closeApp:function(){window.natively.trigger(void 0,11,void 0,"app_close")},showProgress:function(i){window.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:i})},shareImage(i){window.natively.trigger(void 0,0,void 0,"share_image",{url:i})},shareText(i){window.natively.trigger(void 0,0,void 0,"share_text",{text:i})},shareTextAndImage(i,t){window.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:t,text:i})},shareFile(i){window.natively.trigger(void 0,2,void 0,"share_file",{url:i})},openExternalURL(i){window.natively.trigger(void 0,0,void 0,"open_link",{url:i})},openExternalAppIOS(i){window.natively.trigger(void 0,0,void 0,"open_app",{url:i})},openAppSettings(){window.natively.trigger(void 0,0,void 0,"open_appsettings")},hapticPatternIOS(i,t){window.natively.trigger(void 0,7,void 0,"haptic_pattern",{pattern:i,delay:t})},hapticImpactIOS(i){window.natively.trigger(void 0,7,void 0,"haptic_impact",{type:i})},hapticNotificationIOS(i){window.natively.trigger(void 0,7,void 0,"haptic_notification",{type:i})},showAppToast(i,t){const e={};e.text=void 0===t?"":t,e.type=void 0===i?"DEFAULT":i,window.natively.trigger(void 0,0,void 0,"show_toast",e)},showAppBanner(i,t,e){const n={};n.type=void 0===i?"INFO":i,n.title=void 0===t?"":t,n.description=void 0===e?"":e,window.natively.trigger(void 0,0,void 0,"show_banner",n)},requestAppReview(){window.natively.trigger(void 0,0,void 0,"request_review")},setAppBackgroundColor(i){const t={color:i};window.natively.trigger(void 0,1,void 0,"app_background",t)},setAppProgressColor(i){const t={color:i};window.natively.trigger(void 0,1,void 0,"app_progress",t)},setAppSwipeNavigationIOS(i){const t={toggle:i};window.natively.trigger(void 0,1,void 0,"app_navigation",t)},setAppPullToRefresh(i){const t={toggle:i};window.natively.trigger(void 0,1,void 0,"app_pull",t)},setAppOrientation(i){const t={orientation:i};window.natively.trigger(void 0,3,void 0,"app_orientation",t)},setAppStatusBarStyleIOS(i){const t={style:i};window.natively.trigger(void 0,2,void 0,"status_bar_style",t)},async sendPushNotification(i,t,e,n){const o=e.filter(i=>i.length>0),r=[...new Set(o)];let a={app_id:n?"be83022a-1d08-45d0-a07a-0c3655666e17":i,include_player_ids:r};t.template_id?a.template_id=t.template_id:(a.headings={},a.headings.en=t.title||"Empty Title",a.contents={},a.contents.en=t.message||"Empty Message",t.subtitle&&(a.subtitle={},a.subtitle.en=t.subtitle),t.redirect_url&&(a.url=t.redirect_url));const s={method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify(a)};return await fetch("https://onesignal.com/api/v1/notifications",s)}},window.natively.addObserver(()=>window.natively.trigger(void 0,0,i=>{window.natively.min_app_version=i.minSDKVersion,window.natively.app_version=i.sdkVersion},"app_info",{}));class NativelyInfo{constructor(){const i=generateID();this.browserInfo=function(){const i="undefined"!=typeof $agent,t=window.navigator.userAgent.includes("Natively/iOS"),e=window.navigator.userAgent.includes("Natively/Android");return{isNativeApp:i,isIOSApp:t,isAndroidApp:e}},this.getAppInfo=function(t){window.natively.trigger(i,0,t,"app_info")},this.connectivity=function(i){window.natively.trigger(void 0,0,i,"connectivity")}}}class NativelyClipboard{constructor(){const i=generateID();this.copy=function(i){window.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:i})},this.paste=function(t){window.natively.trigger(i,11,t,"clipboard_paste")}}}class NativelyPagesCache{constructor(){const i=generateID();this.currentPageCached=function(t){window.natively.trigger(i,4,t,"current_page_cached")},this.storeCurrentPage=function(t){window.natively.trigger(i,4,t,"store_current_page")},this.resetCurrentPage=function(t){window.natively.trigger(i,4,t,"reset_current_page")},this.resetAll=function(t){window.natively.trigger(i,4,t,"reset_all")}}}class NativelyNotifications{constructor(){const i=generateID();this.getOneSignalId=function(t){window.natively.trigger(i,0,t,"onesignal_playerid")},this.requestPermission=function(t,e){window.natively.trigger(i,0,e,"push_register",{fallbackToSettings:t})},this.getPermissionStatus=function(t){window.natively.trigger(i,0,t,"push_permission")}}}class NativelyGeolocation{constructor(){const i=generateID();this.getUserGeolocation=function(t,e){window.natively.trigger(i,0,e,"geolocation",{distance:t})},this.requestPermission=function(t){window.natively.trigger(i,0,t,"geo_register")},this.getPermissionStatus=function(t){window.natively.trigger(i,0,t,"geo_permission")}}}class NativelyLocation{constructor(){const i=generateID();this.current=function(t,e,n,o){window.natively.trigger(i,12,o,"location_current",{minAccuracy:t,accuracyType:e,priority:n})},this.permission=function(t){window.natively.trigger(i,6,t,"location_permission")},this.start=function(t,e,n,o,r){window.natively.trigger(i,12,r,"location_start",{minAccuracy:e,accuracyType:n,priority:o,interval:t})},this.stop=function(){window.natively.trigger(i,3,void 0,"location_stop",{})},this.startBackground=function(t,e,n,o,r,a){const s={};s.identifier=void 0===r?"empty":r,s.interval=void 0===t?6e4:t,s.minAccuracy=void 0===e?50:e,s.accuracyType=void 0===n?"Best":n,s.priority=void 0===o?"BALANCED":o,window.natively.trigger(i,12,a,"location_start_bg",s)},this.stopBackground=function(t){window.natively.trigger(i,4,t,"location_stop_bg",{})}}}class NativelyMessage{constructor(){const i=generateID();this.sendSMS=function(t,e,n){const o={};o.body=void 0===t?"":t,o.recipient=void 0===e?"":e,window.natively.trigger(i,0,n,"send_sms",o)},this.sendEmail=function(t,e,n,o){const r={};r.subject=void 0===t?"":t,r.body=void 0===e?"":e,r.recipient=void 0===n?"":n,window.natively.trigger(i,0,o,"send_email",r)}}}class NativelyStorage{constructor(){const i=generateID();this.setStorageValue=function(t,e){window.natively.trigger(i,0,void 0,"set_storage_value",{key:t,value:e})},this.getStorageValue=function(t,e){window.natively.trigger(i,0,e,"get_storage_value",{key:t})},this.removeStorageValue=function(t){window.natively.trigger(i,0,void 0,"remove_storage_value",{key:t})},this.resetStorage=function(){window.natively.trigger(i,0,void 0,"reset_storage")}}}class NativelyBiometrics{constructor(i){this.allowPass=i;const t=generateID();this.checkBiometricsSupport=function(e){window.natively.trigger(t,0,e,"biometrics_support",{allowPass:i})},this.checkCredentials=function(i){window.natively.trigger(t,0,i,"biometrics_has_credentials")},this.verifyUserIdentify=function(e){window.natively.trigger(t,0,e,"biometrics_verify",{allowPass:i})},this.getUserCredentials=function(e){window.natively.trigger(t,0,e,"biometrics_auth",{allowPass:i})},this.removeUserCredentials=function(i){window.natively.trigger(t,0,i,"biometrics_remove_credentials")},this.saveUserCredentials=function(e,n,o){window.natively.trigger(t,0,o,"biometrics_auth",{allowPass:i,login:e,password:n})}}}class NativelyDatePicker{constructor(){const i=generateID();this.showDatePicker=function(t,e,n,o,r){let a={};a.type=void 0===n?"DATE":n,a.style=void 0===o?"LIGHT":o,a.title=void 0===t?"":t,a.description=void 0===e?"":e,window.natively.trigger(i,0,r,"datepicker",a)}}}class NativelyCamera{constructor(){const i=generateID();this.showCamera=function(t,e,n,o){let r={};r.type=void 0===t?"photo":t,r.quality=void 0===e?"high":e,r.camera=void 0===n?"BACK":n,window.natively.trigger(i,2,o,"open_camera",r)}}}class NativelyHealth{constructor(){const i=generateID();this.available=function(t){window.natively.trigger(i,10,t,"health_available",{})},this.requestAuthorization=function(t,e,n){window.natively.trigger(i,10,n,"health_register",{write_data_types:t,read_data_types:e})},this.permissionStatus=function(t,e){window.natively.trigger(i,10,e,"health_permission",{data_type:t})},this.getAllCharacteristics=function(t){window.natively.trigger(i,10,t,"health_get_all_characteristics",{})},this.getStatisticQuantity=function(t,e,n,o,r){const a={data_type:t,interval:e};void 0!==n&&(a.start_date=n.getTime()),void 0!==o&&(a.end_date=o.getTime()),window.natively.trigger(i,10,r,"health_get_statistic_quantity",a)},this.getDailySleepAnalysis=function(t,e,n,o){const r={limit:n||100};void 0!==t&&(r.start_date=t.getTime()),void 0!==e&&(r.end_date=e.getTime()),window.natively.trigger(i,10,o,"health_get_daily_sleep_analysis",r)},this.getActivitySummary=function(t,e,n){const o={};void 0!==t&&(o.start_date=t.getTime()),void 0!==e&&(o.end_date=e.getTime()),window.natively.trigger(i,10,n,"health_get_activity_summary",o)}}}class NativelyScanner{constructor(){const i=generateID();this.showScanner=function(t){window.natively.trigger(i,2,t,"open_scanner",{})}}}class NativelyPurchases{constructor(){const i=generateID();this.login=function(t,e,n){const o=void 0===e?"":e;window.natively.trigger(i,3,n,"purchases_login",{login:t,email:o})},this.logout=function(t){window.natively.trigger(i,3,t,"purchases_logout",{})},this.customerId=function(t){window.natively.trigger(i,3,t,"purchases_customerid",{})},this.restore=function(t){window.natively.trigger(i,10,t,"purchases_restore",{})},this.purchasePackage=function(t,e){window.natively.trigger(i,3,e,"purchases_package",{packageId:t})},this.packagePrice=function(t,e){window.natively.trigger(i,8,e,"purchases_price",{packageId:t})}}}class NativelyContacts{constructor(){const i=generateID();this.getAllContacts=function(t){window.natively.trigger(i,3,t,"contacts_all",{})},this.createContact=function(t,e,n,o,r){let a={firstName:t};a.lastName=void 0===e?"":e,a.email=void 0===n?"":n,a.phone=void 0===o?"":o,window.natively.trigger(i,3,r,"contacts_save",a)}}}class NativelyMediaPicker{constructor(){const i=generateID();this.showMediaPicker=function(t){window.natively.trigger(i,8,t,"mediapicker",{})}}}class NativelyAudioRecorder{constructor(){const i=generateID();this.showRecorder=function(t,e){let n={};n.max_duration=void 0===t?0:t,window.natively.trigger(i,13,e,"record_start",n)}}}class NativelyAdmobBanner{constructor(i={iOSUnitId:"ca-app-pub-3940256099942544/2934735716",androidUnitId:"ca-app-pub-3940256099942544/6300978111",position:"BOTTOM",sizeType:"AUTO",custom_width:320,custom_height:50},t,e=!1,n,o=!1,r){const a=generateID(),s={};window.natively.isAndroidApp?s.unitId=void 0===i.androidUnitId?"ca-app-pub-3940256099942544/6300978111":i.androidUnitId:window.natively.isIOSApp&&(s.unitId=void 0===i.iOSUnitId?"ca-app-pub-3940256099942544/2934735716":i.iOSUnitId),s.position=void 0===i.position?"BOTTOM":i.position,s.sizeType=void 0===i.sizeType?"AUTO":i.sizeType,s.width=void 0===i.custom_width?320:i.width,s.height=void 0===i.custom_height?50:i.height,window.natively.trigger(a,14,function(i){void 0!==t&&t(i),e&&window.natively.trigger(a,14,function(i){void 0!==n&&n(i),o&&window.natively.trigger(a,14,r,"bannerad_show",{})},"bannerad_load",{})},"bannerad_setup",s),this.loadAd=function(i){window.natively.trigger(a,14,i,"bannerad_load",{})},this.showBanner=function(i){window.natively.trigger(a,14,i,"bannerad_show",{})},this.hideBanner=function(i){window.natively.trigger(a,14,i,"bannerad_hide",{})},this.bannerIsReady=function(i){window.natively.trigger(a,14,i,"bannerad_ready",{})},this.bannerIsVisible=function(i){window.natively.trigger(a,14,i,"bannerad_visible",{})}}}class NativelyAdmobInterstitial{constructor(i="ca-app-pub-3940256099942544/4411468910",t="ca-app-pub-3940256099942544/1033173712",e,n=!1,o){const r=generateID();let a;window.natively.isAndroidApp?a=void 0===t?"ca-app-pub-3940256099942544/1033173712":t:window.natively.isIOSApp&&(a=void 0===i?"ca-app-pub-3940256099942544/4411468910":i),this.loadAd=function(i){const t={};t.unitId=void 0===a?"ca-app-pub-3940256099942544/4411468910":a,window.natively.trigger(r,14,i,"interstitialad_setup",t)},this.showInterstitialAd=function(i){window.natively.trigger(r,14,function(t){if(i(t),"DID_DISMISS_AD"===t.event&&n){const i={};i.unitId=a,setTimeout(()=>{window.natively.trigger(r,14,o,"interstitialad_setup",i)},500)}},"interstitialad_show",{})},this.interstitialIsReady=function(i){window.natively.trigger(r,14,i,"interstitialad_ready",{})},this.loadAd(e)}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natively",
3
- "version": "2.8.2",
3
+ "version": "2.9.0",
4
4
  "description": "",
5
5
  "main": "natively-frontend.min.js",
6
6
  "scripts": {