starti.app 1.0.52 → 1.0.54

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/app.d.ts CHANGED
@@ -11,8 +11,6 @@ declare type AppEvents = {
11
11
  export interface IApp extends EventTargetMethods<AppEvents> {
12
12
  /** Request the user reviews the app. */
13
13
  requestReview: () => void;
14
- /** Downloads the given file. */
15
- downloadFile: (url: string, fileName: string) => void;
16
14
  /** Are the site running inside starti.app? Returns false if the site is loaded in a normal browser. */
17
15
  isStartiappLoaded(): boolean;
18
16
  /** Use this method to control which URL the app load when it is initialized. */
package/dist/app.js CHANGED
@@ -26,9 +26,6 @@ class AppClass extends EventHandlerWithTypes_1.EventTargetWithType {
26
26
  openExternalBrowser(url) {
27
27
  this.appIntegration.openBrowser(url);
28
28
  }
29
- downloadFile(url, fileName) {
30
- this.appIntegration.download(url, fileName);
31
- }
32
29
  brandId() {
33
30
  return new Promise((resolve, reject) => {
34
31
  this.resolveBrandId = resolve;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starti.app",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "description": "Use this package for easy communication with the starti.app API.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/umd/main.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var s in n)("object"==typeof exports?exports:e)[s]=n[s]}}(self,(()=>(()=>{"use strict";var e={715:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetWithType=void 0;class n extends EventTarget{addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}t.EventTargetWithType=n},752:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{constructor(){super(...arguments),this.startiappIsLoaded=!1}get appIntegration(){return(0,r.getIntegration)("AppIntegration")}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){this.appIntegration.setAppUrl(e)}resetAppUrl(){this.appIntegration.resetAppUrl()}openExternalBrowser(e){this.appIntegration.openBrowser(e)}downloadFile(e,t){this.appIntegration.download(e,t)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,this.appIntegration.brandId()}))}requestReview(){this.appIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,this.appIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,this.appIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,this.appIntegration.getInternalDomains()}))}addInternalDomain(e){this.appIntegration.addInternalDomain(e)}removeInternalDomain(e){this.appIntegration.removeInternalDomain(e)}showStatusBar(){this.appIntegration.showStatusBar()}hideStatusBar(){this.appIntegration.hideStatusBar()}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,this.appIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){this.appIntegration.disableScreenRotation()}enableScreenRotation(){this.appIntegration.enableScreenRotation()}addExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.addExternalDomains(t)}removeExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.removeExternalDomains(t)}getExternalDomains(){return new Promise(((e,t)=>{this.resolveExternalDomains=e,this.appIntegration.getExternalDomains()}))}getExternalDomainsResult(e){this.resolveExternalDomains(e),this.resolveExternalDomains=null}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e),this.resolveBrandId=null}versionResult(e){this.resolveVersion(e),this.resolveVersion=null}deviceIdResult(e){this.resolveDeviceId(e),this.resolveDeviceId=null}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e),this.resolveSetSafeAreaBackgroundColor=null}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e),this.resolveGetInternalDomains=null}}t.App=new i},1:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{constructor(){super(...arguments),this.SECURED_CONTENT_KEY="STARTI_APP_BIOMETRIC_CONTENT",this.SECURED_LOGIN_KEY="STARTI_APP_BIOMETRIC_LOGIN_CONTENT",this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}get biometricIntegration(){return(0,r.getIntegration)("BiometricIntegration")}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveScan=n,this.biometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,this.biometricIntegration.getAuthenticationType()}))}setSecuredContent(e){this.biometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetContent=n,this.biometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,this.biometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){this.biometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){this.biometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){this.biometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,this.biometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetUsernamePassword=n,this.biometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.result);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}this.resolveGetUsernamePassword=null}hasSecuredContentResult({result:e,key:t}){if(t===this.SECURED_LOGIN_KEY)return this.resolveHasUsernameAndPassword(e),void(this.resolveHasUsernameAndPassword=null);this.resolveHasSecureContent(e),this.resolveHasSecureContent=null}getAuthenticationTypeResult(e){this.resolveAuthType(e),this.resolveAuthType=null}startScanningResult(e){this.resolveScan(e),this.resolveScan=null}getSecuredContentResult(e){if(e.key!==this.SECURED_LOGIN_KEY){try{const t=JSON.parse(e.result);this.resolveGetContent(t)}catch(t){this.resolveGetContent(e.result)}this.resolveGetContent=null}else this.handleResolveGetUsernamePassword(e)}}t.Biometrics=new i},495:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const r=n(715),i=n(913),o=n(607);class a extends r.EventTargetWithType{registerId(e){return s(this,void 0,void 0,(function*(){const t=yield o.default.App.brandId(),n=yield o.default.App.deviceId(),s=yield o.default.PushNotification.getToken();if(!s||0===s.length)throw console.warn("Failed to register logged in client user",e,"No FCM token"),new Error(`Failed to register logged in client user ${e}: No FCM token`);const r={brandId:t,clientUserId:e,deviceId:n,fcmToken:s},a=yield fetch(i.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(r),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,r),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}}t.ClientUser=new a},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net",t.styleTagId="startiapp-styling"},955:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get deviceIntegration(){return(0,r.getIntegration)("DeviceIntegration")}startAccelerometer(){this.deviceIntegration.startAccelerometer()}stopAccelerometer(){this.deviceIntegration.stopAccelerometer()}isAccelerometerStarted(){return new Promise(((e,t)=>{this.deviceIntegration.isAccelerometerStarted(),this.resolveIsAccelerometerStarted=e}))}isAccelerometerStartedResult(e){this.resolveIsAccelerometerStarted(e),this.resolveIsAccelerometerStarted=null}onShakeEvent(){this.dispatchEvent(new CustomEvent("shake"))}}t.Device=new i},900:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getIntegration=void 0;let n={};t.getIntegration=function(e){if(n[e])return n[e];let t=window[e],s=0;for(;!t&&s<5;)t=window.parent[e],s++;if(!t)throw new Error(`Could not find integration ${e}`);return n[e]=t,t}},607:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=n(752),r=n(1),i=n(495),o=n(955),a=n(900),l=n(983),c=n(681),d=n(952),u=n(716),h=n(634),p=window;p.appIntegrationsAreReady=()=>{s.App.setStartiappIsLoaded(),g.dispatchEvent(new CustomEvent("ready"))},p.startiappDevice=o.Device,p.startiappApp=s.App,p.startiappUser=i.ClientUser,p.startiappQrScanner=d.QrScanner,p.startiappPushNotification=c.PushNotification,p.startiappNFC=l.NFC,p.startiappShare=h.Share,p.startiappBiometric=r.Biometrics,p.appErrorEvent=e=>{g.dispatchEvent(new CustomEvent("error",{detail:e}))};class v extends EventTarget{constructor(){super(...arguments),this.App=s.App,this.Device=o.Device,this.Biometrics=r.Biometrics,this.User=i.ClientUser,this.NfcScanner=l.NFC,this.PushNotification=c.PushNotification,this.QrScanner=d.QrScanner,this.Share=h.Share}get appIntegration(){return(0,a.getIntegration)("AppIntegration")}initialize(e){u.AppUI.setOptions(e),this.appIntegration.webAppIsReady()}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}const g=new v;if(g.isRunningInApp())if(document.body)document.body.setAttribute("startiapp","true");else{const e=new MutationObserver((()=>{document.body&&(document.body.setAttribute("startiapp","true"),e.disconnect())}));e.observe(document.documentElement,{childList:!0})}t.default=g,p.startiapp=g},983:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get NFCIntegration(){return(0,r.getIntegration)("NFCIntegration")}isNfcSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,this.NFCIntegration.isNFCSupported()}))}startNfcScanner(){return new Promise((e=>{this.resolveStartNFCReader=e,this.NFCIntegration.startListening()}))}stopNfcScanner(){return new Promise((e=>{this.resolveStopNFCReader=e,this.NFCIntegration.stopListening()}))}nfcTagScannedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}stopListeningResult(e){this.resolveStopNFCReader(e),this.resolveStopNFCReader=null}isNFCSupportedResult(e){this.resolveNFCSupported(e),this.resolveNFCSupported=null}startListeningResult(e){this.resolveStartNFCReader(e),this.resolveStartNFCReader=null}}t.NFC=new i},681:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=t.Topic=void 0;const r=n(715),i=n(913),o=n(900),a=n(607);class l extends r.EventTargetWithType{get pushNotificationIntegration(){return(0,o.getIntegration)("PushNotificationIntegration")}requestAccess(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,this.pushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,this.pushNotificationIntegration.getFCMToken()}))}getTopics(){return s(this,void 0,void 0,(function*(){const e={brand:yield a.default.App.brandId()},t=yield fetch(i.baseUrl+"/Newsletter-getTopics?"+new URLSearchParams(Object.assign({},e)));if(!t.ok)throw new Error("Failed to get topics");return(yield t.json()).map((({name:e,topic:t})=>new c(t,e)))}))}subscribeToTopics(e){return s(this,void 0,void 0,(function*(){this.pushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),n=yield a.default.App.brandId(),s=yield a.default.App.deviceId(),r=[];e.forEach((e=>{const o={brand:n,topic:e,token:t,deviceId:s},a=fetch(i.baseUrl+"/Newsletter-subscribeToTopic",{body:JSON.stringify(o)});r.push(a)})),(yield Promise.all(r)).forEach(((t,n)=>{t.ok||console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return s(this,void 0,void 0,(function*(){this.pushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),n=yield a.default.App.brandId(),s=yield a.default.App.deviceId(),r=[];e.forEach((e=>{const o={brand:n,topic:e,token:t,deviceId:s},a=fetch(i.baseUrl+"/Newsletter-unSubscribeFromTopic",{body:JSON.stringify(o)});r.push(a)})),(yield Promise.all(r)).forEach(((t,n)=>{t.ok||console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e),this.resolveRequestAccess=null}getFCMTokenResult(e){this.resolveFCMToken(e),this.resolveFCMToken=null}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}}class c{constructor(e,t){this.topic=e,this.name=t}toJSON(){return{topic:this.topic,name:this.name}}subscribe(){t.PushNotification.subscribeToTopics([this.topic])}unsubscribe(){t.PushNotification.unsubscribeFromTopics([this.topic])}}t.Topic=c,t.PushNotification=new l},952:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get qrScannerIntegration(){return(0,r.getIntegration)("QrScannerIntegration")}scan(){return new Promise(((e,t)=>{this.resolveScan=e,this.qrScannerIntegration.startQrCodeScanner()}))}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e,this.qrScannerIntegration.isCameraAccessGranted()}))}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e,this.qrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e),this.resolveRequestCameraAccess=null}startQrCodeScannerResult(e){this.resolveScan(e),this.resolveScan=null}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e),this.resolveCameraAccessGranted=null}}t.QrScanner=new i},716:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const s=n(913);t.AppUI=new class{constructor(){this.options={allowDrag:!1,allowHighligt:!1,allowZoom:!1,allowScrollBounce:!1}}setOptions(e){this.options=Object.assign(this.options,e),null!=document.querySelector('meta[name="viewport"]')&&void 0===this.initialViewportMetaContent&&(this.initialViewportMetaContent=document.querySelector('meta[name="viewport"]').getAttribute("content")),this.initialViewportMetaContent.includes("viewport-fit=cover")||(this.initialViewportMetaContent+=", viewport-fit=cover"),this.updateUI()}getOptions(){return this.options}updateUI(){this.styleString="";const e=document.getElementById(s.styleTagId);e&&e.remove();const t=document.getElementsByTagName("img"),n=document.getElementsByTagName("a");this.options.allowDrag?[...t,...n].forEach((e=>{e.removeAttribute("draggable")})):[...t,...n].forEach((e=>{e.setAttribute("draggable","false")}));let r=document.querySelector("meta[name=viewport]");this.options.allowHighligt||(this.styleString+="\n body {\n -webkit-user-select: none; \n -khtml-user-select: none; \n -moz-user-select: none; \n -o-user-select: none; \n user-select: none;\n }\n "),this.options.allowScrollBounce||(this.styleString+="\n html {\n overscroll-behavior: none;\n }\n "),this.options.allowZoom?r.setAttribute("content",this.initialViewportMetaContent):(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",r.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover"));const i=document.createElement("style");i.textContent=this.styleString,i.setAttribute("id",s.styleTagId),document.body.appendChild(i)}}},634:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Share=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get shareIntegration(){return(0,r.getIntegration)("ShareIntegration")}shareFile(e,t){return new Promise(((n,s)=>{this.resolveShareFile=n,this.shareIntegration.shareFile(e,t)}))}shareText(e){return new Promise(((t,n)=>{this.resolveShareText=t,this.shareIntegration.shareText(e)}))}downloadFile(e,t){return new Promise(((n,s)=>{this.resolveDownloadText=n,this.shareIntegration.downloadFile(e,t)}))}shareFileResult(e){this.resolveShareFile(e),this.resolveShareFile=null}shareTextResult(e){this.resolveShareText(e),this.resolveShareText=null}downloadFileResult(e){this.resolveDownloadText(e),this.resolveDownloadText=null}}t.Share=new i}},t={};return function n(s){var r=t[s];if(void 0!==r)return r.exports;var i=t[s]={exports:{}};return e[s].call(i.exports,i,i.exports,n),i.exports}(607)})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var s in n)("object"==typeof exports?exports:e)[s]=n[s]}}(self,(()=>(()=>{"use strict";var e={715:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetWithType=void 0;class n extends EventTarget{addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}t.EventTargetWithType=n},752:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{constructor(){super(...arguments),this.startiappIsLoaded=!1}get appIntegration(){return(0,r.getIntegration)("AppIntegration")}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){this.appIntegration.setAppUrl(e)}resetAppUrl(){this.appIntegration.resetAppUrl()}openExternalBrowser(e){this.appIntegration.openBrowser(e)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,this.appIntegration.brandId()}))}requestReview(){this.appIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,this.appIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,this.appIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,this.appIntegration.getInternalDomains()}))}addInternalDomain(e){this.appIntegration.addInternalDomain(e)}removeInternalDomain(e){this.appIntegration.removeInternalDomain(e)}showStatusBar(){this.appIntegration.showStatusBar()}hideStatusBar(){this.appIntegration.hideStatusBar()}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,this.appIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){this.appIntegration.disableScreenRotation()}enableScreenRotation(){this.appIntegration.enableScreenRotation()}addExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.addExternalDomains(t)}removeExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.removeExternalDomains(t)}getExternalDomains(){return new Promise(((e,t)=>{this.resolveExternalDomains=e,this.appIntegration.getExternalDomains()}))}getExternalDomainsResult(e){this.resolveExternalDomains(e),this.resolveExternalDomains=null}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e),this.resolveBrandId=null}versionResult(e){this.resolveVersion(e),this.resolveVersion=null}deviceIdResult(e){this.resolveDeviceId(e),this.resolveDeviceId=null}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e),this.resolveSetSafeAreaBackgroundColor=null}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e),this.resolveGetInternalDomains=null}}t.App=new i},1:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{constructor(){super(...arguments),this.SECURED_CONTENT_KEY="STARTI_APP_BIOMETRIC_CONTENT",this.SECURED_LOGIN_KEY="STARTI_APP_BIOMETRIC_LOGIN_CONTENT",this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}get biometricIntegration(){return(0,r.getIntegration)("BiometricIntegration")}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveScan=n,this.biometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,this.biometricIntegration.getAuthenticationType()}))}setSecuredContent(e){this.biometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetContent=n,this.biometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,this.biometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){this.biometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){this.biometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){this.biometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,this.biometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetUsernamePassword=n,this.biometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.result);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}this.resolveGetUsernamePassword=null}hasSecuredContentResult({result:e,key:t}){if(t===this.SECURED_LOGIN_KEY)return this.resolveHasUsernameAndPassword(e),void(this.resolveHasUsernameAndPassword=null);this.resolveHasSecureContent(e),this.resolveHasSecureContent=null}getAuthenticationTypeResult(e){this.resolveAuthType(e),this.resolveAuthType=null}startScanningResult(e){this.resolveScan(e),this.resolveScan=null}getSecuredContentResult(e){if(e.key!==this.SECURED_LOGIN_KEY){try{const t=JSON.parse(e.result);this.resolveGetContent(t)}catch(t){this.resolveGetContent(e.result)}this.resolveGetContent=null}else this.handleResolveGetUsernamePassword(e)}}t.Biometrics=new i},495:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const r=n(715),i=n(913),o=n(607);class a extends r.EventTargetWithType{registerId(e){return s(this,void 0,void 0,(function*(){const t=yield o.default.App.brandId(),n=yield o.default.App.deviceId(),s=yield o.default.PushNotification.getToken();if(!s||0===s.length)throw console.warn("Failed to register logged in client user",e,"No FCM token"),new Error(`Failed to register logged in client user ${e}: No FCM token`);const r={brandId:t,clientUserId:e,deviceId:n,fcmToken:s},a=yield fetch(i.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(r),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,r),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}}t.ClientUser=new a},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net",t.styleTagId="startiapp-styling"},955:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get deviceIntegration(){return(0,r.getIntegration)("DeviceIntegration")}startAccelerometer(){this.deviceIntegration.startAccelerometer()}stopAccelerometer(){this.deviceIntegration.stopAccelerometer()}isAccelerometerStarted(){return new Promise(((e,t)=>{this.deviceIntegration.isAccelerometerStarted(),this.resolveIsAccelerometerStarted=e}))}isAccelerometerStartedResult(e){this.resolveIsAccelerometerStarted(e),this.resolveIsAccelerometerStarted=null}onShakeEvent(){this.dispatchEvent(new CustomEvent("shake"))}}t.Device=new i},900:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getIntegration=void 0;let n={};t.getIntegration=function(e){if(n[e])return n[e];let t=window[e],s=0;for(;!t&&s<5;)t=window.parent[e],s++;if(!t)throw new Error(`Could not find integration ${e}`);return n[e]=t,t}},607:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=n(752),r=n(1),i=n(495),o=n(955),a=n(900),l=n(983),c=n(681),d=n(952),u=n(716),h=n(634),p=window;p.appIntegrationsAreReady=()=>{s.App.setStartiappIsLoaded(),g.dispatchEvent(new CustomEvent("ready"))},p.startiappDevice=o.Device,p.startiappApp=s.App,p.startiappUser=i.ClientUser,p.startiappQrScanner=d.QrScanner,p.startiappPushNotification=c.PushNotification,p.startiappNFC=l.NFC,p.startiappShare=h.Share,p.startiappBiometric=r.Biometrics,p.appErrorEvent=e=>{g.dispatchEvent(new CustomEvent("error",{detail:e}))};class v extends EventTarget{constructor(){super(...arguments),this.App=s.App,this.Device=o.Device,this.Biometrics=r.Biometrics,this.User=i.ClientUser,this.NfcScanner=l.NFC,this.PushNotification=c.PushNotification,this.QrScanner=d.QrScanner,this.Share=h.Share}get appIntegration(){return(0,a.getIntegration)("AppIntegration")}initialize(e){u.AppUI.setOptions(e),this.appIntegration.webAppIsReady()}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}const g=new v;if(g.isRunningInApp())if(document.body)document.body.setAttribute("startiapp","true");else{const e=new MutationObserver((()=>{document.body&&(document.body.setAttribute("startiapp","true"),e.disconnect())}));e.observe(document.documentElement,{childList:!0})}t.default=g,p.startiapp=g},983:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get NFCIntegration(){return(0,r.getIntegration)("NFCIntegration")}isNfcSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,this.NFCIntegration.isNFCSupported()}))}startNfcScanner(){return new Promise((e=>{this.resolveStartNFCReader=e,this.NFCIntegration.startListening()}))}stopNfcScanner(){return new Promise((e=>{this.resolveStopNFCReader=e,this.NFCIntegration.stopListening()}))}nfcTagScannedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}stopListeningResult(e){this.resolveStopNFCReader(e),this.resolveStopNFCReader=null}isNFCSupportedResult(e){this.resolveNFCSupported(e),this.resolveNFCSupported=null}startListeningResult(e){this.resolveStartNFCReader(e),this.resolveStartNFCReader=null}}t.NFC=new i},681:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=t.Topic=void 0;const r=n(715),i=n(913),o=n(900),a=n(607);class l extends r.EventTargetWithType{get pushNotificationIntegration(){return(0,o.getIntegration)("PushNotificationIntegration")}requestAccess(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,this.pushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,this.pushNotificationIntegration.getFCMToken()}))}getTopics(){return s(this,void 0,void 0,(function*(){const e={brand:yield a.default.App.brandId()},t=yield fetch(i.baseUrl+"/Newsletter-getTopics?"+new URLSearchParams(Object.assign({},e)));if(!t.ok)throw new Error("Failed to get topics");return(yield t.json()).map((({name:e,topic:t})=>new c(t,e)))}))}subscribeToTopics(e){return s(this,void 0,void 0,(function*(){this.pushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),n=yield a.default.App.brandId(),s=yield a.default.App.deviceId(),r=[];e.forEach((e=>{const o={brand:n,topic:e,token:t,deviceId:s},a=fetch(i.baseUrl+"/Newsletter-subscribeToTopic",{body:JSON.stringify(o)});r.push(a)})),(yield Promise.all(r)).forEach(((t,n)=>{t.ok||console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return s(this,void 0,void 0,(function*(){this.pushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),n=yield a.default.App.brandId(),s=yield a.default.App.deviceId(),r=[];e.forEach((e=>{const o={brand:n,topic:e,token:t,deviceId:s},a=fetch(i.baseUrl+"/Newsletter-unSubscribeFromTopic",{body:JSON.stringify(o)});r.push(a)})),(yield Promise.all(r)).forEach(((t,n)=>{t.ok||console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e),this.resolveRequestAccess=null}getFCMTokenResult(e){this.resolveFCMToken(e),this.resolveFCMToken=null}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}}class c{constructor(e,t){this.topic=e,this.name=t}toJSON(){return{topic:this.topic,name:this.name}}subscribe(){t.PushNotification.subscribeToTopics([this.topic])}unsubscribe(){t.PushNotification.unsubscribeFromTopics([this.topic])}}t.Topic=c,t.PushNotification=new l},952:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get qrScannerIntegration(){return(0,r.getIntegration)("QrScannerIntegration")}scan(){return new Promise(((e,t)=>{this.resolveScan=e,this.qrScannerIntegration.startQrCodeScanner()}))}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e,this.qrScannerIntegration.isCameraAccessGranted()}))}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e,this.qrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e),this.resolveRequestCameraAccess=null}startQrCodeScannerResult(e){this.resolveScan(e),this.resolveScan=null}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e),this.resolveCameraAccessGranted=null}}t.QrScanner=new i},716:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const s=n(913);t.AppUI=new class{constructor(){this.options={allowDrag:!1,allowHighligt:!1,allowZoom:!1,allowScrollBounce:!1}}setOptions(e){this.options=Object.assign(this.options,e),null!=document.querySelector('meta[name="viewport"]')&&void 0===this.initialViewportMetaContent&&(this.initialViewportMetaContent=document.querySelector('meta[name="viewport"]').getAttribute("content")),this.initialViewportMetaContent.includes("viewport-fit=cover")||(this.initialViewportMetaContent+=", viewport-fit=cover"),this.updateUI()}getOptions(){return this.options}updateUI(){this.styleString="";const e=document.getElementById(s.styleTagId);e&&e.remove();const t=document.getElementsByTagName("img"),n=document.getElementsByTagName("a");this.options.allowDrag?[...t,...n].forEach((e=>{e.removeAttribute("draggable")})):[...t,...n].forEach((e=>{e.setAttribute("draggable","false")}));let r=document.querySelector("meta[name=viewport]");this.options.allowHighligt||(this.styleString+="\n body {\n -webkit-user-select: none; \n -khtml-user-select: none; \n -moz-user-select: none; \n -o-user-select: none; \n user-select: none;\n }\n "),this.options.allowScrollBounce||(this.styleString+="\n html {\n overscroll-behavior: none;\n }\n "),this.options.allowZoom?r.setAttribute("content",this.initialViewportMetaContent):(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",r.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover"));const i=document.createElement("style");i.textContent=this.styleString,i.setAttribute("id",s.styleTagId),document.body.appendChild(i)}}},634:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Share=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get shareIntegration(){return(0,r.getIntegration)("ShareIntegration")}shareFile(e,t){return new Promise(((n,s)=>{this.resolveShareFile=n,this.shareIntegration.shareFile(e,t)}))}shareText(e){return new Promise(((t,n)=>{this.resolveShareText=t,this.shareIntegration.shareText(e)}))}downloadFile(e,t){return new Promise(((n,s)=>{this.resolveDownloadText=n,this.shareIntegration.downloadFile(e,t)}))}shareFileResult(e){this.resolveShareFile(e),this.resolveShareFile=null}shareTextResult(e){this.resolveShareText(e),this.resolveShareText=null}downloadFileResult(e){this.resolveDownloadText(e),this.resolveDownloadText=null}}t.Share=new i}},t={};return function n(s){var r=t[s];if(void 0!==r)return r.exports;var i=t[s]={exports:{}};return e[s].call(i.exports,i,i.exports,n),i.exports}(607)})()));