starti.app 1.0.26 → 1.0.28

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.
@@ -6,6 +6,6 @@ export interface IClientUser {
6
6
  /** Remove event listener */
7
7
  removeEventListener(type: ClientUserEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
8
8
  /** Register the ID of a logged in client user (end user) */
9
- registerId(clientUserId: string): void;
9
+ registerId(clientUserId: string): Promise<void>;
10
10
  }
11
11
  export {};
package/dist/index.d.ts CHANGED
@@ -17,5 +17,5 @@ declare const startiapp: {
17
17
  removeEventListener(type: StartiappEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
18
18
  dispatchEvent(event: Event): boolean;
19
19
  };
20
- declare type StartiappEvents = "integrationsAreReady" | "appError";
20
+ declare type StartiappEvents = "ready" | "appError";
21
21
  export default startiapp;
package/dist/index.js CHANGED
@@ -9,14 +9,14 @@ const qrscanner_1 = require("./qrscanner");
9
9
  const untypedWindow = window;
10
10
  untypedWindow.appIntegrationsAreReady = () => {
11
11
  app_1.App.setStartiappIsLoaded();
12
- startiapp.dispatchEvent(new CustomEvent('integrationsAreReady'));
12
+ startiapp.dispatchEvent(new CustomEvent('ready'));
13
13
  };
14
- untypedWindow.App = app_1.App;
15
- untypedWindow.User = clientUser_1.ClientUser;
16
- untypedWindow.QrScanner = qrscanner_1.QrScanner;
17
- untypedWindow.PushNotification = pushnotification_1.PushNotification;
18
- untypedWindow.NFC = nfc_1.NFC;
19
- untypedWindow.Biometrics = biometrics_1.Biometrics;
14
+ untypedWindow.startiappApp = app_1.App;
15
+ untypedWindow.startiappUser = clientUser_1.ClientUser;
16
+ untypedWindow.startiappQrScanner = qrscanner_1.QrScanner;
17
+ untypedWindow.startiappPushNotification = pushnotification_1.PushNotification;
18
+ untypedWindow.startiappNFC = nfc_1.NFC;
19
+ untypedWindow.startiappBiometrics = biometrics_1.Biometrics;
20
20
  untypedWindow.appErrorEvent = (data) => {
21
21
  startiapp.dispatchEvent(new CustomEvent('appError', { detail: data }));
22
22
  };
@@ -1,8 +1,6 @@
1
1
  export declare const PushNotification: IPushNotification;
2
2
  declare type PushNotificationEvents = "tokenReceived" | "notificationReceived";
3
3
  export interface IPushNotification {
4
- /** This method should be called when the client user want’s to receive push notifications. */
5
- initialize(): Promise<boolean>;
6
4
  /** This method requests the user for permissions to use push notifications */
7
5
  requestAccess(): Promise<boolean>;
8
6
  /** This method returns the token which should be used to send push notifications. */
@@ -24,17 +24,6 @@ exports.PushNotification = new class extends EventTarget {
24
24
  requestAccessResult(accessGranted) {
25
25
  this.resolveRequestAccess(accessGranted);
26
26
  }
27
- initialize() {
28
- if (!PushNotificationIntegration)
29
- throw new Error('PushNotificationIntegration is not available');
30
- return new Promise((resolve, _) => {
31
- this.resolveInitialize = resolve;
32
- PushNotificationIntegration.initialize();
33
- });
34
- }
35
- initializeResult(result) {
36
- this.resolveInitialize(result);
37
- }
38
27
  getToken() {
39
28
  return new Promise((resolve, _) => {
40
29
  this.resolveFCMToken = resolve;
@@ -113,4 +102,3 @@ exports.PushNotification = new class extends EventTarget {
113
102
  */
114
103
  firebasePushNotificationSubscribeToTopicsResult(result) { }
115
104
  };
116
- exports.PushNotification.addEventListener("tokenReceived", (e) => { });
package/dist/qrscanner.js CHANGED
@@ -3,58 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QrScanner = void 0;
4
4
  exports.QrScanner = new class extends EventTarget {
5
5
  scan() {
6
- const promise = new Promise((resolve, reject) => {
7
- this.resolveScan = resolve;
8
- try {
9
- if (!QrScannerIntegration) {
10
- resolve('Scanner virker kun i starti.app');
11
- return;
12
- }
13
- QrScannerIntegration.startQrCodeScanner();
14
- }
15
- catch (e) {
16
- reject(e);
6
+ return new Promise((resolve, reject) => {
7
+ if (!QrScannerIntegration) {
8
+ reject('QrScanner integration is not available');
9
+ return;
17
10
  }
11
+ this.resolveScan = resolve;
12
+ QrScannerIntegration.startQrCodeScanner();
18
13
  });
19
- return promise;
20
14
  }
21
15
  qrResultRecievedEvent(message) {
22
16
  this.resolveScan(message);
23
17
  }
24
18
  isCameraAccessGranted() {
25
- const promise = new Promise((resolve, reject) => {
19
+ return new Promise((resolve, reject) => {
20
+ if (!QrScannerIntegration)
21
+ return reject('Scanner virker kun i starti.app');
26
22
  this.resolveCameraAccessGranted = resolve;
27
- try {
28
- if (!QrScannerIntegration) {
29
- reject('Scanner virker kun i starti.app');
30
- return;
31
- }
32
- QrScannerIntegration.isCameraAccessGranted();
33
- }
34
- catch (e) {
35
- reject(e);
36
- }
23
+ QrScannerIntegration.isCameraAccessGranted();
37
24
  });
38
- return promise;
39
25
  }
40
26
  isCameraAccessGrantedResult(result) {
41
27
  this.resolveCameraAccessGranted(result);
42
28
  }
43
29
  requestCameraAccess() {
44
- const promise = new Promise((resolve, reject) => {
30
+ return new Promise((resolve, reject) => {
31
+ if (!QrScannerIntegration)
32
+ return reject('Scanner virker kun i starti.app');
45
33
  this.resolveRequestCameraAccess = resolve;
46
- try {
47
- if (!QrScannerIntegration) {
48
- reject('Scanner virker kun i starti.app');
49
- return;
50
- }
51
- QrScannerIntegration.requestCameraAccess();
52
- }
53
- catch (e) {
54
- reject(e);
55
- }
34
+ QrScannerIntegration.requestCameraAccess();
56
35
  });
57
- return promise;
58
36
  }
59
37
  requestCameraAccessResult(result) {
60
38
  this.resolveRequestCameraAccess(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starti.app",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
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 i=t();for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(self,(()=>(()=>{"use strict";var e={752:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0,t.App=new class extends EventTarget{constructor(){super(...arguments),this.startiappIsLoaded=!1}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){AppIntegration.setAppUrl(e)}resetAppUrl(){AppIntegration.resetAppUrl()}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}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()}))}showStatusBar(){AppIntegration.showStatusBar()}hideStatusBar(){AppIntegration.hideStatusBar()}disableScreenRotation(){AppIntegration.disableScreenRotation()}enableScreenRotation(){AppIntegration.enableScreenRotation()}brandIdResult(e){this.resolveBrandId(e)}versionResult(e){this.resolveVersion(e)}deviceIdResult(e){this.resolveDeviceId(e)}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}}},1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0,t.Biometrics=new class extends EventTarget{constructor(){super(...arguments),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(((i,n)=>{this.resolveScan=i;try{if(!BiometricsIntegration)return void n("Biometrics virker kun i starti.app");BiometricsIntegration.startScanning(e,t)}catch(e){n(e)}}))}startScanningResult(e){this.resolveScan(e)}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e;try{if(!BiometricsIntegration)return void t("Biometrics virker kun i starti.app");BiometricsIntegration.getAuthenticationType()}catch(e){t(e)}}))}getAuthenticationTypeResult(e){this.resolveAuthType(e)}setSecuredContent(e){if(!BiometricsIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricsIntegration.setSecuredContent(JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((i,n)=>{this.resolveGetContent=i;try{if(!BiometricsIntegration)return void n("Biometrics virker kun i starti.app");BiometricsIntegration.getSecuredContent(e,t)}catch(e){n(e)}}))}getSecuredContentResult(e){this.resolveGetContent(JSON.parse(e))}hasSecureContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e;try{if(!BiometricsIntegration)return void t("Biometrics virker kun i starti.app");BiometricsIntegration.hasSecuredContent()}catch(e){t(e)}}))}hasSecureContentResult(e){this.resolveHasSecureContent(e)}removeSecuredContent(){if(!BiometricsIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricsIntegration.removeSecuredContent()}}},495:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const r=i(913),s=i(607);t.ClientUser=new class extends EventTarget{registerId(e){return n(this,void 0,void 0,(function*(){const t=yield s.default.App.brandId(),i=yield s.default.App.deviceId(),n=yield s.default.PushNotification.getToken();if(!n||0===n.length)return void console.warn("Failed to register logged in client user",e,"No FCM token");const o={brandId:t,clientUserId:e,deviceId:i,fcmToken:n};(yield fetch(r.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"})).ok||console.warn("Failed to register logged in client user",e,o)}))}}},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-test.cloudfunctions.net"},607:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=i(752),r=i(1),s=i(495),o=i(983),a=i(681),c=i(952),u=window;u.appIntegrationsAreReady=()=>{n.App.setStartiappIsLoaded(),d.dispatchEvent(new CustomEvent("integrationsAreReady"))},u.App=n.App,u.User=s.ClientUser,u.QrScanner=c.QrScanner,u.PushNotification=a.PushNotification,u.NFC=o.NFC,u.Biometrics=r.Biometrics,u.appErrorEvent=e=>{d.dispatchEvent(new CustomEvent("appError",{detail:e}))};const d=new class extends EventTarget{constructor(){super(...arguments),this.App=n.App,this.Biometrics=r.Biometrics,this.User=s.ClientUser,this.NfcScanner=o.NFC,this.PushNotification=a.PushNotification,this.QrScanner=c.QrScanner}initialize(){if(void 0===AppIntegration)throw new Error("The starti.app API integration is not available.");n.App.isStartiappLoaded()&&AppIntegration.webAppIsReady()}addEventListener(e,t,i){super.addEventListener(e,t,i)}removeEventListener(e,t,i){super.removeEventListener(e,t,i)}};t.default=d,u.startiapp=d},983:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0,t.NFC=new class extends EventTarget{isNFCSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.isNFCSupported()}catch(e){t(e)}}))}isNFCSupportedResult(e){this.resolveNFCSupported(e)}startNFCReader(){return new Promise(((e,t)=>{this.resolveStartNFCReader=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.initNFC()}catch(e){t(e)}}))}startNFCReaderResult(e){this.resolveStartNFCReader(e)}stopNFCReader(){return new Promise(((e,t)=>{this.resolveStopNFCReader=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.stopListening()}catch(e){t(e)}}))}stopListeningResult(e){this.resolveStopNFCReader(e)}nfcTagResultRecievedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}}},681:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=void 0;const r=i(913),s=i(607);t.PushNotification=new class extends EventTarget{requestAccess(){return n(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,PushNotificationIntegration.requestAccess()}))}))}requestAccessResult(e){this.resolveRequestAccess(e)}initialize(){if(!PushNotificationIntegration)throw new Error("PushNotificationIntegration is not available");return new Promise(((e,t)=>{this.resolveInitialize=e,PushNotificationIntegration.initialize()}))}initializeResult(e){this.resolveInitialize(e)}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,PushNotificationIntegration.getFCMToken()}))}getFCMTokenResult(e){this.resolveFCMToken(e)}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenReceived",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}subscribeToTopics(e){return n(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),i=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:i,topic:e,token:t,deviceId:n},a=fetch(r.baseUrl+"/PushNotification-subscribeToTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,i)=>{t.ok||console.warn("Failed to sign up to topic",i,e[i])}))}))}unsubscribeFromTopics(e){return n(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),i=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:i,topic:e,token:t,deviceId:n},a=fetch(r.baseUrl+"/PushNotification-unSubscribeFromTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,i)=>{t.ok||console.warn("Failed to unsubscribe from topic",i,e[i])}))}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}},t.PushNotification.addEventListener("tokenReceived",(e=>{}))},952:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0,t.QrScanner=new class extends EventTarget{scan(){return new Promise(((e,t)=>{this.resolveScan=e;try{if(!QrScannerIntegration)return void e("Scanner virker kun i starti.app");QrScannerIntegration.startQrCodeScanner()}catch(e){t(e)}}))}qrResultRecievedEvent(e){this.resolveScan(e)}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e;try{if(!QrScannerIntegration)return void t("Scanner virker kun i starti.app");QrScannerIntegration.isCameraAccessGranted()}catch(e){t(e)}}))}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e)}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e;try{if(!QrScannerIntegration)return void t("Scanner virker kun i starti.app");QrScannerIntegration.requestCameraAccess()}catch(e){t(e)}}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e)}}}},t={};return function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),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 i=t();for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(self,(()=>(()=>{"use strict";var e={752:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0,t.App=new class extends EventTarget{constructor(){super(...arguments),this.startiappIsLoaded=!1}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){AppIntegration.setAppUrl(e)}resetAppUrl(){AppIntegration.resetAppUrl()}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}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()}))}showStatusBar(){AppIntegration.showStatusBar()}hideStatusBar(){AppIntegration.hideStatusBar()}disableScreenRotation(){AppIntegration.disableScreenRotation()}enableScreenRotation(){AppIntegration.enableScreenRotation()}brandIdResult(e){this.resolveBrandId(e)}versionResult(e){this.resolveVersion(e)}deviceIdResult(e){this.resolveDeviceId(e)}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}}},1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0,t.Biometrics=new class extends EventTarget{constructor(){super(...arguments),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(((i,n)=>{this.resolveScan=i;try{if(!BiometricsIntegration)return void n("Biometrics virker kun i starti.app");BiometricsIntegration.startScanning(e,t)}catch(e){n(e)}}))}startScanningResult(e){this.resolveScan(e)}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e;try{if(!BiometricsIntegration)return void t("Biometrics virker kun i starti.app");BiometricsIntegration.getAuthenticationType()}catch(e){t(e)}}))}getAuthenticationTypeResult(e){this.resolveAuthType(e)}setSecuredContent(e){if(!BiometricsIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricsIntegration.setSecuredContent(JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((i,n)=>{this.resolveGetContent=i;try{if(!BiometricsIntegration)return void n("Biometrics virker kun i starti.app");BiometricsIntegration.getSecuredContent(e,t)}catch(e){n(e)}}))}getSecuredContentResult(e){this.resolveGetContent(JSON.parse(e))}hasSecureContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e;try{if(!BiometricsIntegration)return void t("Biometrics virker kun i starti.app");BiometricsIntegration.hasSecuredContent()}catch(e){t(e)}}))}hasSecureContentResult(e){this.resolveHasSecureContent(e)}removeSecuredContent(){if(!BiometricsIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricsIntegration.removeSecuredContent()}}},495:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const r=i(913),s=i(607);t.ClientUser=new class extends EventTarget{registerId(e){return n(this,void 0,void 0,(function*(){const t=yield s.default.App.brandId(),i=yield s.default.App.deviceId(),n=yield s.default.PushNotification.getToken();if(!n||0===n.length)return void console.warn("Failed to register logged in client user",e,"No FCM token");const o={brandId:t,clientUserId:e,deviceId:i,fcmToken:n};(yield fetch(r.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"})).ok||console.warn("Failed to register logged in client user",e,o)}))}}},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-test.cloudfunctions.net"},607:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=i(752),r=i(1),s=i(495),o=i(983),a=i(681),c=i(952),u=window;u.appIntegrationsAreReady=()=>{n.App.setStartiappIsLoaded(),d.dispatchEvent(new CustomEvent("ready"))},u.startiappApp=n.App,u.startiappUser=s.ClientUser,u.startiappQrScanner=c.QrScanner,u.startiappPushNotification=a.PushNotification,u.startiappNFC=o.NFC,u.startiappBiometrics=r.Biometrics,u.appErrorEvent=e=>{d.dispatchEvent(new CustomEvent("appError",{detail:e}))};const d=new class extends EventTarget{constructor(){super(...arguments),this.App=n.App,this.Biometrics=r.Biometrics,this.User=s.ClientUser,this.NfcScanner=o.NFC,this.PushNotification=a.PushNotification,this.QrScanner=c.QrScanner}initialize(){if(void 0===AppIntegration)throw new Error("The starti.app API integration is not available.");n.App.isStartiappLoaded()&&AppIntegration.webAppIsReady()}addEventListener(e,t,i){super.addEventListener(e,t,i)}removeEventListener(e,t,i){super.removeEventListener(e,t,i)}};t.default=d,u.startiapp=d},983:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0,t.NFC=new class extends EventTarget{isNFCSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.isNFCSupported()}catch(e){t(e)}}))}isNFCSupportedResult(e){this.resolveNFCSupported(e)}startNFCReader(){return new Promise(((e,t)=>{this.resolveStartNFCReader=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.initNFC()}catch(e){t(e)}}))}startNFCReaderResult(e){this.resolveStartNFCReader(e)}stopNFCReader(){return new Promise(((e,t)=>{this.resolveStopNFCReader=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.stopListening()}catch(e){t(e)}}))}stopListeningResult(e){this.resolveStopNFCReader(e)}nfcTagResultRecievedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}}},681:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=void 0;const r=i(913),s=i(607);t.PushNotification=new class extends EventTarget{requestAccess(){return n(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,PushNotificationIntegration.requestAccess()}))}))}requestAccessResult(e){this.resolveRequestAccess(e)}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,PushNotificationIntegration.getFCMToken()}))}getFCMTokenResult(e){this.resolveFCMToken(e)}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenReceived",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}subscribeToTopics(e){return n(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),i=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:i,topic:e,token:t,deviceId:n},a=fetch(r.baseUrl+"/PushNotification-subscribeToTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,i)=>{t.ok||console.warn("Failed to sign up to topic",i,e[i])}))}))}unsubscribeFromTopics(e){return n(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),i=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:i,topic:e,token:t,deviceId:n},a=fetch(r.baseUrl+"/PushNotification-unSubscribeFromTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,i)=>{t.ok||console.warn("Failed to unsubscribe from topic",i,e[i])}))}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}}},952:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0,t.QrScanner=new class extends EventTarget{scan(){return new Promise(((e,t)=>{QrScannerIntegration?(this.resolveScan=e,QrScannerIntegration.startQrCodeScanner()):t("QrScanner integration is not available")}))}qrResultRecievedEvent(e){this.resolveScan(e)}isCameraAccessGranted(){return new Promise(((e,t)=>{if(!QrScannerIntegration)return t("Scanner virker kun i starti.app");this.resolveCameraAccessGranted=e,QrScannerIntegration.isCameraAccessGranted()}))}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e)}requestCameraAccess(){return new Promise(((e,t)=>{if(!QrScannerIntegration)return t("Scanner virker kun i starti.app");this.resolveRequestCameraAccess=e,QrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e)}}}},t={};return function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}(607)})()));