starti.app 1.0.43-alpha.1 → 1.0.44

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/config.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const baseUrl = "https://europe-west3-startiapp-admin-test-e56ab.cloudfunctions.net";
1
+ export declare const baseUrl = "https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net";
2
2
  export declare const styleTagId = "startiapp-styling";
package/dist/config.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.styleTagId = exports.baseUrl = void 0;
4
- exports.baseUrl = 'https://europe-west3-startiapp-admin-test-e56ab.cloudfunctions.net';
4
+ // TODO: This needs to check if the app is running in production or development mode and return the correct base url, for now return production url
5
+ exports.baseUrl = 'https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net';
5
6
  exports.styleTagId = 'startiapp-styling';
package/dist/index.js CHANGED
@@ -1,28 +1,16 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  const app_1 = require("./app");
13
4
  const biometrics_1 = require("./biometrics");
14
- const SemVer_1 = require("./classes/SemVer");
15
5
  const clientUser_1 = require("./clientUser");
16
6
  const device_1 = require("./device");
17
7
  const nfc_1 = require("./nfc");
18
8
  const pushnotification_1 = require("./pushnotification");
19
9
  const qrscanner_1 = require("./qrscanner");
20
10
  const ui_service_1 = require("./services/ui-service");
21
- const MINIMUM_VERSION = new SemVer_1.SemVer('4.0.0');
22
11
  const untypedWindow = window;
23
12
  untypedWindow.appIntegrationsAreReady = () => {
24
13
  app_1.App.setStartiappIsLoaded();
25
- ensureCorrectAppVersion();
26
14
  startiapp.dispatchEvent(new CustomEvent('ready'));
27
15
  };
28
16
  untypedWindow.startiappDevice = device_1.Device;
@@ -35,16 +23,6 @@ untypedWindow.startiappBiometric = biometrics_1.Biometrics;
35
23
  untypedWindow.appErrorEvent = (data) => {
36
24
  startiapp.dispatchEvent(new CustomEvent('error', { detail: data }));
37
25
  };
38
- function ensureCorrectAppVersion() {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const semVersionRaw = yield app_1.App.version();
41
- const semVersion = new SemVer_1.SemVer(semVersionRaw);
42
- if (semVersion.isGreaterThanOrEqualTo(MINIMUM_VERSION))
43
- return;
44
- const message = `The starti.app app is out of date. Please update to version ${MINIMUM_VERSION.toString()} or higher.`;
45
- alert(message);
46
- });
47
- }
48
26
  class StartiappClass extends EventTarget {
49
27
  constructor() {
50
28
  super(...arguments);
package/dist/qrscanner.js CHANGED
@@ -23,7 +23,7 @@ class QrScannerClass extends EventTarget {
23
23
  requestCameraAccessResult(result) {
24
24
  this.resolveRequestCameraAccess(result);
25
25
  }
26
- qrResultRecievedEvent(message) {
26
+ startQrCodeScannerResult(message) {
27
27
  this.resolveScan(message);
28
28
  }
29
29
  isCameraAccessGrantedResult(result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starti.app",
3
- "version": "1.0.43-alpha.1",
3
+ "version": "1.0.44",
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 i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(self,(()=>(()=>{"use strict";var e={752:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;class n extends EventTarget{constructor(){super(...arguments),this.startiappIsLoaded=!1}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){AppIntegration.setAppUrl(e)}resetAppUrl(){AppIntegration.resetAppUrl()}openExternalBrowser(e){AppIntegration.openBrowser(e)}downloadFile(e,t){AppIntegration.download(e,t)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,AppIntegration.brandId()}))}requestReview(){AppIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,AppIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,AppIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,AppIntegration.getInternalDomains()}))}addInternalDomain(e){AppIntegration.addInternalDomain(e)}removeInternalDomain(e){AppIntegration.removeInternalDomain(e)}showStatusBar(){AppIntegration.showStatusBar()}hideStatusBar(){AppIntegration.hideStatusBar()}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,AppIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){AppIntegration.disableScreenRotation()}enableScreenRotation(){AppIntegration.enableScreenRotation()}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e)}versionResult(e){this.resolveVersion(e)}deviceIdResult(e){this.resolveDeviceId(e)}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e)}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e)}}t.App=new n},1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;class n extends EventTarget{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."}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,i)=>{this.resolveScan=n,BiometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,BiometricIntegration.getAuthenticationType()}))}setSecuredContent(e){BiometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,i)=>{this.resolveGetContent=n,BiometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,BiometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){BiometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){BiometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){BiometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,BiometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,i)=>{this.resolveGetUsernamePassword=n,BiometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.content);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}}hasSecuredContentResult(e){try{const t=JSON.parse(e);if(t.key===this.SECURED_LOGIN_KEY)return void this.resolveHasUsernameAndPassword(t.result);this.resolveHasSecureContent(t.result)}catch(e){this.resolveHasSecureContent(!1)}}getAuthenticationTypeResult(e){this.resolveAuthType(e)}startScanningResult(e){this.resolveScan(e)}getSecuredContentResult(e){try{const t=JSON.parse(e);if(t.key===this.SECURED_LOGIN_KEY)return void this.handleResolveGetUsernamePassword(t);this.resolveGetContent(t.content)}catch(e){this.resolveGetContent(null)}}}t.Biometrics=new n},245:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SemVer=void 0,t.SemVer=class{constructor(e){if(this.version=e,!this.isValidVersion(e))throw new Error(`Invalid version: ${e}`);const t=e.split(".");this.major=parseInt(t[0]),this.minor=parseInt(t[1]),this.patch=parseInt(t[2])}isValidVersion(e){const t=e.split(".");return!(t.length<3||isNaN(parseInt(t[0]))||isNaN(parseInt(t[1]))||isNaN(parseInt(t[2])))}isGreaterThan(e){return this.major>e.major||!(this.major<e.major)&&(this.minor>e.minor||!(this.minor<e.minor)&&(this.patch>e.patch||(this.patch,e.patch,!1)))}isGreaterThanOrEqualTo(e){return this.isGreaterThan(e)||this.isEqualTo(e)}isEqualTo(e){return this.major===e.major&&this.minor===e.minor&&this.patch===e.patch}toString(){return this.version}}},495:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const r=n(913),s=n(607);t.ClientUser=new class extends EventTarget{registerId(e){return i(this,void 0,void 0,(function*(){const t=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),i=yield s.default.PushNotification.getToken();if(!i||0===i.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 o={brandId:t,clientUserId:e,deviceId:n,fcmToken:i},a=yield fetch(r.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,o),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}}},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-test-e56ab.cloudfunctions.net",t.styleTagId="startiapp-styling"},955:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;class n extends EventTarget{startAccelerometer(){DeviceIntegration.startAccelerometer()}stopAccelerometer(){DeviceIntegration.stopAccelerometer()}onShakeEvent(){this.dispatchEvent(new CustomEvent("shake"))}}t.Device=new n},607:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(752),s=n(1),o=n(245),a=n(495),c=n(955),d=n(983),l=n(681),u=n(952),p=n(716),h=new o.SemVer("4.0.0"),v=window;v.appIntegrationsAreReady=()=>{r.App.setStartiappIsLoaded(),function(){i(this,void 0,void 0,(function*(){const e=yield r.App.version();if(new o.SemVer(e).isGreaterThanOrEqualTo(h))return;const t=`The starti.app app is out of date. Please update to version ${h.toString()} or higher.`;alert(t)}))}(),g.dispatchEvent(new CustomEvent("ready"))},v.startiappDevice=c.Device,v.startiappApp=r.App,v.startiappUser=a.ClientUser,v.startiappQrScanner=u.QrScanner,v.startiappPushNotification=l.PushNotification,v.startiappNFC=d.NFC,v.startiappBiometric=s.Biometrics,v.appErrorEvent=e=>{g.dispatchEvent(new CustomEvent("error",{detail:e}))};class m extends EventTarget{constructor(){super(...arguments),this.App=r.App,this.Device=c.Device,this.Biometrics=s.Biometrics,this.User=a.ClientUser,this.Nfc=d.NFC,this.PushNotification=l.PushNotification,this.QrScanner=u.QrScanner}initialize(e){if("undefined"==typeof AppIntegration)throw new Error("The starti.app API integration is not available.");r.App.isStartiappLoaded()&&(p.AppUI.setOptions(e),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 m;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,v.startiapp=g},983:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;class n extends EventTarget{isNFCSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,NFCIntegration.isNFCSupported()}))}startNFCReader(){return new Promise(((e,t)=>{this.resolveStartNFCReader=e,NFCIntegration.initNFC()}))}stopNFCReader(){return new Promise(((e,t)=>{this.resolveStopNFCReader=e,NFCIntegration.stopListening()}))}stopListeningResult(e){this.resolveStopNFCReader(e)}nfcTagResultRecievedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}isNFCSupportedResult(e){this.resolveNFCSupported(e)}initNFCResult(e){this.resolveStartNFCReader(e)}}t.NFC=new n},681:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=void 0;const r=n(913),s=n(607);class o extends EventTarget{requestAccess(){return i(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,PushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,PushNotificationIntegration.getFCMToken()}))}subscribeToTopics(e){return i(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),n=yield s.default.App.brandId(),i=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:n,topic:e,token:t,deviceId:i},a=fetch(r.baseUrl+"/PushNotification-subscribeToTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,n)=>{t.ok||console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return i(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),n=yield s.default.App.brandId(),i=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:n,topic:e,token:t,deviceId:i},a=fetch(r.baseUrl+"/PushNotification-unSubscribeFromTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,n)=>{t.ok||console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e)}getFCMTokenResult(e){this.resolveFCMToken(e)}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}}t.PushNotification=new o},952:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;class n extends EventTarget{scan(){return new Promise(((e,t)=>{this.resolveScan=e,QrScannerIntegration.startQrCodeScanner()}))}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e,QrScannerIntegration.isCameraAccessGranted()}))}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e,QrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e)}qrResultRecievedEvent(e){this.resolveScan(e)}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e)}}t.QrScanner=new n},716:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const i=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(i.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 s=document.createElement("style");s.textContent=this.styleString,s.setAttribute("id",i.styleTagId),document.body.appendChild(s)}}}},t={};return function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.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={752:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;class n extends EventTarget{constructor(){super(...arguments),this.startiappIsLoaded=!1}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){AppIntegration.setAppUrl(e)}resetAppUrl(){AppIntegration.resetAppUrl()}openExternalBrowser(e){AppIntegration.openBrowser(e)}downloadFile(e,t){AppIntegration.download(e,t)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,AppIntegration.brandId()}))}requestReview(){AppIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,AppIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,AppIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,AppIntegration.getInternalDomains()}))}addInternalDomain(e){AppIntegration.addInternalDomain(e)}removeInternalDomain(e){AppIntegration.removeInternalDomain(e)}showStatusBar(){AppIntegration.showStatusBar()}hideStatusBar(){AppIntegration.hideStatusBar()}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,AppIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){AppIntegration.disableScreenRotation()}enableScreenRotation(){AppIntegration.enableScreenRotation()}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e)}versionResult(e){this.resolveVersion(e)}deviceIdResult(e){this.resolveDeviceId(e)}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e)}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e)}}t.App=new n},1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;class n extends EventTarget{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."}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveScan=n,BiometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,BiometricIntegration.getAuthenticationType()}))}setSecuredContent(e){BiometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetContent=n,BiometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,BiometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){BiometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){BiometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){BiometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,BiometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetUsernamePassword=n,BiometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.content);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}}hasSecuredContentResult(e){try{const t=JSON.parse(e);if(t.key===this.SECURED_LOGIN_KEY)return void this.resolveHasUsernameAndPassword(t.result);this.resolveHasSecureContent(t.result)}catch(e){this.resolveHasSecureContent(!1)}}getAuthenticationTypeResult(e){this.resolveAuthType(e)}startScanningResult(e){this.resolveScan(e)}getSecuredContentResult(e){try{const t=JSON.parse(e);if(t.key===this.SECURED_LOGIN_KEY)return void this.handleResolveGetUsernamePassword(t);this.resolveGetContent(t.content)}catch(e){this.resolveGetContent(null)}}}t.Biometrics=new n},495:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(i,r){function o(e){try{c(s.next(e))}catch(e){r(e)}}function a(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const i=n(913),r=n(607);t.ClientUser=new class extends EventTarget{registerId(e){return s(this,void 0,void 0,(function*(){const t=yield r.default.App.brandId(),n=yield r.default.App.deviceId(),s=yield r.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 o={brandId:t,clientUserId:e,deviceId:n,fcmToken:s},a=yield fetch(i.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,o),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}}},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)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;class n extends EventTarget{startAccelerometer(){DeviceIntegration.startAccelerometer()}stopAccelerometer(){DeviceIntegration.stopAccelerometer()}onShakeEvent(){this.dispatchEvent(new CustomEvent("shake"))}}t.Device=new n},607:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=n(752),i=n(1),r=n(495),o=n(955),a=n(983),c=n(681),d=n(952),l=n(716),u=window;u.appIntegrationsAreReady=()=>{s.App.setStartiappIsLoaded(),h.dispatchEvent(new CustomEvent("ready"))},u.startiappDevice=o.Device,u.startiappApp=s.App,u.startiappUser=r.ClientUser,u.startiappQrScanner=d.QrScanner,u.startiappPushNotification=c.PushNotification,u.startiappNFC=a.NFC,u.startiappBiometric=i.Biometrics,u.appErrorEvent=e=>{h.dispatchEvent(new CustomEvent("error",{detail:e}))};class p extends EventTarget{constructor(){super(...arguments),this.App=s.App,this.Device=o.Device,this.Biometrics=i.Biometrics,this.User=r.ClientUser,this.Nfc=a.NFC,this.PushNotification=c.PushNotification,this.QrScanner=d.QrScanner}initialize(e){if("undefined"==typeof AppIntegration)throw new Error("The starti.app API integration is not available.");s.App.isStartiappLoaded()&&(l.AppUI.setOptions(e),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 h=new p;if(h.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=h,u.startiapp=h},983:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;class n extends EventTarget{isNFCSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,NFCIntegration.isNFCSupported()}))}startNFCReader(){return new Promise(((e,t)=>{this.resolveStartNFCReader=e,NFCIntegration.initNFC()}))}stopNFCReader(){return new Promise(((e,t)=>{this.resolveStopNFCReader=e,NFCIntegration.stopListening()}))}stopListeningResult(e){this.resolveStopNFCReader(e)}nfcTagResultRecievedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}isNFCSupportedResult(e){this.resolveNFCSupported(e)}initNFCResult(e){this.resolveStartNFCReader(e)}}t.NFC=new n},681:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(i,r){function o(e){try{c(s.next(e))}catch(e){r(e)}}function a(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=void 0;const i=n(913),r=n(607);class o extends EventTarget{requestAccess(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,PushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,PushNotificationIntegration.getFCMToken()}))}subscribeToTopics(e){return s(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),n=yield r.default.App.brandId(),s=yield r.default.App.deviceId(),o=[];e.forEach((e=>{const r={brand:n,topic:e,token:t,deviceId:s},a=fetch(i.baseUrl+"/PushNotification-subscribeToTopic",{body:JSON.stringify(r)});o.push(a)})),(yield Promise.all(o)).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*(){PushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),n=yield r.default.App.brandId(),s=yield r.default.App.deviceId(),o=[];e.forEach((e=>{const r={brand:n,topic:e,token:t,deviceId:s},a=fetch(i.baseUrl+"/PushNotification-unSubscribeFromTopic",{body:JSON.stringify(r)});o.push(a)})),(yield Promise.all(o)).forEach(((t,n)=>{t.ok||console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e)}getFCMTokenResult(e){this.resolveFCMToken(e)}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}}t.PushNotification=new o},952:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;class n extends EventTarget{scan(){return new Promise(((e,t)=>{this.resolveScan=e,QrScannerIntegration.startQrCodeScanner()}))}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e,QrScannerIntegration.isCameraAccessGranted()}))}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e,QrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e)}startQrCodeScannerResult(e){this.resolveScan(e)}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e)}}t.QrScanner=new n},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 i=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?i.setAttribute("content",this.initialViewportMetaContent):(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",i.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover"));const r=document.createElement("style");r.textContent=this.styleString,r.setAttribute("id",s.styleTagId),document.body.appendChild(r)}}}},t={};return function n(s){var i=t[s];if(void 0!==i)return i.exports;var r=t[s]={exports:{}};return e[s].call(r.exports,r,r.exports,n),r.exports}(607)})()));
@@ -1,12 +0,0 @@
1
- export declare class SemVer {
2
- private version;
3
- private major;
4
- private minor;
5
- private patch;
6
- constructor(version: string);
7
- private isValidVersion;
8
- isGreaterThan(other: SemVer): boolean;
9
- isGreaterThanOrEqualTo(other: SemVer): boolean;
10
- isEqualTo(other: SemVer): boolean;
11
- toString(): string;
12
- }
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SemVer = void 0;
4
- class SemVer {
5
- constructor(version) {
6
- this.version = version;
7
- if (!this.isValidVersion(version))
8
- throw new Error(`Invalid version: ${version}`);
9
- const parts = version.split('.');
10
- this.major = parseInt(parts[0]);
11
- this.minor = parseInt(parts[1]);
12
- this.patch = parseInt(parts[2]);
13
- }
14
- isValidVersion(version) {
15
- const parts = version.split('.');
16
- if (parts.length < 3)
17
- return false;
18
- if (isNaN(parseInt(parts[0])))
19
- return false;
20
- if (isNaN(parseInt(parts[1])))
21
- return false;
22
- if (isNaN(parseInt(parts[2])))
23
- return false;
24
- return true;
25
- }
26
- isGreaterThan(other) {
27
- if (this.major > other.major)
28
- return true;
29
- if (this.major < other.major)
30
- return false;
31
- if (this.minor > other.minor)
32
- return true;
33
- if (this.minor < other.minor)
34
- return false;
35
- if (this.patch > other.patch)
36
- return true;
37
- if (this.patch < other.patch)
38
- return false;
39
- return false;
40
- }
41
- isGreaterThanOrEqualTo(other) {
42
- return this.isGreaterThan(other) || this.isEqualTo(other);
43
- }
44
- isEqualTo(other) {
45
- return this.major === other.major && this.minor === other.minor && this.patch === other.patch;
46
- }
47
- toString() {
48
- return this.version;
49
- }
50
- }
51
- exports.SemVer = SemVer;