starti.app 1.0.39 → 1.0.41-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ export declare enum Integrations {
2
+ PushNotification = "PushNotificationIntegration",
3
+ QrScanner = "QrScannerIntegration",
4
+ Device = "DeviceIntegration",
5
+ App = "AppIntegration",
6
+ Biometric = "BiometricIntegration",
7
+ Calendar = "CalendarIntegration",
8
+ NFC = "NFCIntegration"
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Integrations = void 0;
4
+ var Integrations;
5
+ (function (Integrations) {
6
+ Integrations["PushNotification"] = "PushNotificationIntegration";
7
+ Integrations["QrScanner"] = "QrScannerIntegration";
8
+ Integrations["Device"] = "DeviceIntegration";
9
+ Integrations["App"] = "AppIntegration";
10
+ Integrations["Biometric"] = "BiometricIntegration";
11
+ Integrations["Calendar"] = "CalendarIntegration";
12
+ Integrations["NFC"] = "NFCIntegration";
13
+ })(Integrations = exports.Integrations || (exports.Integrations = {}));
package/dist/app.js CHANGED
@@ -1,7 +1,15 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.App = void 0;
4
- exports.App = new class extends EventTarget {
10
+ const types_exported_1 = require("./@types/types.exported");
11
+ const RequireIntegration_1 = require("./decorators/RequireIntegration");
12
+ let AppClass = class AppClass extends EventTarget {
5
13
  constructor() {
6
14
  super(...arguments);
7
15
  this.startiappIsLoaded = false;
@@ -18,9 +26,6 @@ exports.App = new class extends EventTarget {
18
26
  resetAppUrl() {
19
27
  AppIntegration.resetAppUrl();
20
28
  }
21
- appInForegroundEventRecievedEvent() {
22
- this.dispatchEvent(new CustomEvent('appInForeground'));
23
- }
24
29
  openExternalBrowser(url) {
25
30
  AppIntegration.openBrowser(url);
26
31
  }
@@ -78,6 +83,9 @@ exports.App = new class extends EventTarget {
78
83
  enableScreenRotation() {
79
84
  AppIntegration.enableScreenRotation();
80
85
  }
86
+ appInForegroundEventRecievedEvent() {
87
+ this.dispatchEvent(new CustomEvent('appInForeground'));
88
+ }
81
89
  brandIdResult(result) {
82
90
  this.resolveBrandId(result);
83
91
  }
@@ -97,3 +105,14 @@ exports.App = new class extends EventTarget {
97
105
  this.resolveGetInternalDomains(result);
98
106
  }
99
107
  };
108
+ __decorate([
109
+ RequireIntegration_1.ExemptFromRequiredIntegrations
110
+ ], AppClass.prototype, "setStartiappIsLoaded", null);
111
+ __decorate([
112
+ RequireIntegration_1.ExemptFromRequiredIntegrations
113
+ ], AppClass.prototype, "isStartiappLoaded", null);
114
+ AppClass = __decorate([
115
+ (0, RequireIntegration_1.RequireIntegration)(types_exported_1.Integrations.App)
116
+ ], AppClass);
117
+ ;
118
+ exports.App = new AppClass();
@@ -1,8 +1,8 @@
1
- export declare const Biometrics: IBiometrics;
2
1
  declare type BiometricsEvents = "";
2
+ export declare const Biometrics: IBiometrics;
3
3
  export interface IBiometrics {
4
4
  /** Start scanning for biometrics */
5
- scan(title: string, reason: string): Promise<boolean>;
5
+ scan(title?: string, reason?: string): Promise<boolean>;
6
6
  /** Get the type of biometrics used */
7
7
  getAuthenticationType(): Promise<string>;
8
8
  /** Set the content to be secured */
@@ -1,25 +1,26 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.Biometrics = void 0;
4
- exports.Biometrics = new class extends EventTarget {
10
+ const types_exported_1 = require("./@types/types.exported");
11
+ const RequireIntegration_1 = require("./decorators/RequireIntegration");
12
+ let BiometricsClass = class BiometricsClass extends EventTarget {
5
13
  constructor() {
6
14
  super(...arguments);
7
15
  this.SECURED_CONTENT_KEY = "STARTI_APP_BIOMETRIC_CONTENT";
8
16
  this.SECURED_LOGIN_KEY = "STARTI_APP_BIOMETRIC_LOGIN_CONTENT";
9
17
  this.defaultScanTitle = "Prove you have fingers!";
10
18
  this.defaultScanReason = "Can't let you in if you don't.";
11
- /**
12
- * Username and password secured storage
13
- * */
14
19
  }
15
20
  scan(title = this.defaultScanTitle, reason = this.defaultScanReason) {
16
21
  const promise = new Promise((resolve, reject) => {
17
22
  this.resolveScan = resolve;
18
23
  try {
19
- if (!BiometricIntegration) {
20
- reject('Biometrics virker kun i starti.app');
21
- return;
22
- }
23
24
  BiometricIntegration.startScanning(title, reason);
24
25
  }
25
26
  catch (e) {
@@ -28,17 +29,10 @@ exports.Biometrics = new class extends EventTarget {
28
29
  });
29
30
  return promise;
30
31
  }
31
- startScanningResult(result) {
32
- this.resolveScan(result);
33
- }
34
32
  getAuthenticationType() {
35
33
  const promise = new Promise((resolve, reject) => {
36
34
  this.resolveAuthType = resolve;
37
35
  try {
38
- if (!BiometricIntegration) {
39
- reject('Biometrics virker kun i starti.app');
40
- return;
41
- }
42
36
  BiometricIntegration.getAuthenticationType();
43
37
  }
44
38
  catch (e) {
@@ -47,22 +41,13 @@ exports.Biometrics = new class extends EventTarget {
47
41
  });
48
42
  return promise;
49
43
  }
50
- getAuthenticationTypeResult(result) {
51
- this.resolveAuthType(result);
52
- }
53
44
  setSecuredContent(content) {
54
- if (!BiometricIntegration)
55
- throw new Error('Biometrics virker kun i starti.app');
56
45
  BiometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY, JSON.stringify(content));
57
46
  }
58
47
  getSecuredContent(title = this.defaultScanTitle, reason = this.defaultScanReason) {
59
48
  const promise = new Promise((resolve, reject) => {
60
49
  this.resolveGetContent = resolve;
61
50
  try {
62
- if (!BiometricIntegration) {
63
- reject('Biometrics virker kun i starti.app');
64
- return;
65
- }
66
51
  BiometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY, title, reason);
67
52
  }
68
53
  catch (e) {
@@ -71,26 +56,9 @@ exports.Biometrics = new class extends EventTarget {
71
56
  });
72
57
  return promise;
73
58
  }
74
- getSecuredContentResult(result) {
75
- try {
76
- const parsed = JSON.parse(result);
77
- if (parsed.key === this.SECURED_LOGIN_KEY) {
78
- this.handleResolveGetUsernamePassword(parsed);
79
- return;
80
- }
81
- this.resolveGetContent(parsed.content);
82
- }
83
- catch (error) {
84
- this.resolveGetContent(null);
85
- }
86
- }
87
59
  hasSecuredContent() {
88
60
  const promise = new Promise((resolve, reject) => {
89
61
  try {
90
- if (!BiometricIntegration) {
91
- reject('Biometrics virker kun i starti.app');
92
- return;
93
- }
94
62
  this.resolveHasSecureContent = resolve;
95
63
  BiometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY);
96
64
  }
@@ -100,53 +68,18 @@ exports.Biometrics = new class extends EventTarget {
100
68
  });
101
69
  return promise;
102
70
  }
103
- hasSecuredContentResult(result) {
104
- try {
105
- const parsed = JSON.parse(result);
106
- if (parsed.key === this.SECURED_LOGIN_KEY) {
107
- this.resolveHasUsernameAndPassword(parsed.result);
108
- return;
109
- }
110
- this.resolveHasSecureContent(parsed.result);
111
- }
112
- catch (error) {
113
- this.resolveHasSecureContent(false);
114
- }
115
- }
116
71
  removeSecuredContent() {
117
- if (!BiometricIntegration)
118
- throw new Error('Biometrics virker kun i starti.app');
119
72
  BiometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY);
120
73
  }
121
- /**
122
- * Username and password secured storage
123
- * */
124
- handleResolveGetUsernamePassword(result) {
125
- try {
126
- const parsed = JSON.parse(result.content);
127
- this.resolveGetUsernamePassword(parsed);
128
- }
129
- catch (error) {
130
- this.resolveGetUsernamePassword(null);
131
- }
132
- }
133
74
  setUsernameAndPassword(username, password) {
134
- if (!BiometricIntegration)
135
- throw new Error('Biometrics virker kun i starti.app');
136
75
  BiometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY, JSON.stringify({ username, password }));
137
76
  }
138
77
  removeUsernameAndPassword() {
139
- if (!BiometricIntegration)
140
- throw new Error('Biometrics virker kun i starti.app');
141
78
  BiometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY);
142
79
  }
143
80
  hasUsernameAndPassword() {
144
81
  const promise = new Promise((resolve, reject) => {
145
82
  try {
146
- if (!BiometricIntegration) {
147
- reject('Biometrics virker kun i starti.app');
148
- return;
149
- }
150
83
  this.resolveHasUsernameAndPassword = resolve;
151
84
  BiometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY);
152
85
  }
@@ -159,10 +92,6 @@ exports.Biometrics = new class extends EventTarget {
159
92
  getUsernameAndPassword(scanTitle = this.defaultScanTitle, scanReason = this.defaultScanReason) {
160
93
  const promise = new Promise((resolve, reject) => {
161
94
  try {
162
- if (!BiometricIntegration) {
163
- reject('Biometrics virker kun i starti.app');
164
- return;
165
- }
166
95
  this.resolveGetUsernamePassword = resolve;
167
96
  BiometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY, scanTitle, scanReason);
168
97
  }
@@ -172,4 +101,53 @@ exports.Biometrics = new class extends EventTarget {
172
101
  });
173
102
  return promise;
174
103
  }
104
+ /**
105
+ * Username and password secured storage
106
+ * */
107
+ handleResolveGetUsernamePassword(result) {
108
+ try {
109
+ const parsed = JSON.parse(result.content);
110
+ this.resolveGetUsernamePassword(parsed);
111
+ }
112
+ catch (error) {
113
+ this.resolveGetUsernamePassword(null);
114
+ }
115
+ }
116
+ hasSecuredContentResult(result) {
117
+ try {
118
+ const parsed = JSON.parse(result);
119
+ if (parsed.key === this.SECURED_LOGIN_KEY) {
120
+ this.resolveHasUsernameAndPassword(parsed.result);
121
+ return;
122
+ }
123
+ this.resolveHasSecureContent(parsed.result);
124
+ }
125
+ catch (error) {
126
+ this.resolveHasSecureContent(false);
127
+ }
128
+ }
129
+ getAuthenticationTypeResult(result) {
130
+ this.resolveAuthType(result);
131
+ }
132
+ startScanningResult(result) {
133
+ this.resolveScan(result);
134
+ }
135
+ getSecuredContentResult(result) {
136
+ try {
137
+ const parsed = JSON.parse(result);
138
+ if (parsed.key === this.SECURED_LOGIN_KEY) {
139
+ this.handleResolveGetUsernamePassword(parsed);
140
+ return;
141
+ }
142
+ this.resolveGetContent(parsed.content);
143
+ }
144
+ catch (error) {
145
+ this.resolveGetContent(null);
146
+ }
147
+ }
175
148
  };
149
+ BiometricsClass = __decorate([
150
+ (0, RequireIntegration_1.RequireIntegration)(types_exported_1.Integrations.Biometric)
151
+ ], BiometricsClass);
152
+ ;
153
+ exports.Biometrics = new BiometricsClass();
@@ -20,7 +20,7 @@ exports.ClientUser = new class extends EventTarget {
20
20
  const fcmToken = yield index_1.default.PushNotification.getToken();
21
21
  if (!fcmToken || fcmToken.length === 0) {
22
22
  console.warn('Failed to register logged in client user', clientUserId, 'No FCM token');
23
- return;
23
+ throw new Error(`Failed to register logged in client user ${clientUserId}: No FCM token`);
24
24
  }
25
25
  const params = {
26
26
  brandId: brandId,
@@ -35,6 +35,7 @@ exports.ClientUser = new class extends EventTarget {
35
35
  });
36
36
  if (!response.ok) {
37
37
  console.warn('Failed to register logged in client user', clientUserId, params);
38
+ throw new Error(`Failed to register logged in client user ${clientUserId}: Firebase returned statuscode ${response.status}`);
38
39
  }
39
40
  });
40
41
  }
package/dist/config.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export declare const baseUrl = "https://europe-west3-startiapp-admin-test-e56ab.cloudfunctions.net";
2
+ export declare const styleTagId = "startiapp-styling";
package/dist/config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.baseUrl = void 0;
3
+ exports.styleTagId = exports.baseUrl = void 0;
4
4
  exports.baseUrl = 'https://europe-west3-startiapp-admin-test-e56ab.cloudfunctions.net';
5
+ exports.styleTagId = 'startiapp-styling';
@@ -0,0 +1,7 @@
1
+ import { Integrations } from "../@types/types.exported";
2
+ export declare function RequireIntegration(...integrations: Integrations[]): (constructorOrTarget: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
3
+ /**
4
+ * Marks method in class as exempt from required integrations.
5
+ * Using metadata to mark method as exempt.
6
+ */
7
+ export declare function ExemptFromRequiredIntegrations(target: any, propertyKey: string, descriptor: PropertyDescriptor): void;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExemptFromRequiredIntegrations = exports.RequireIntegration = void 0;
4
+ const reflection_1 = require("@abraham/reflection");
5
+ function isClassDecorator(propertyKey, descriptor) {
6
+ return typeof propertyKey === 'undefined' && typeof descriptor === 'undefined';
7
+ }
8
+ function RequireIntegration(...integrations) {
9
+ return function (constructorOrTarget, propertyKey, descriptor) {
10
+ if (isClassDecorator(propertyKey, descriptor)) {
11
+ let methods = Object.getOwnPropertyNames(constructorOrTarget.prototype)
12
+ .filter(method => method !== 'constructor')
13
+ .filter(method => !method.endsWith("Result"))
14
+ .filter(method => !method.startsWith("resolve"))
15
+ .filter(method => !method.endsWith("Event"));
16
+ for (const method of methods) {
17
+ const descriptor = Object.getOwnPropertyDescriptor(constructorOrTarget.prototype, method);
18
+ if (descriptor.value instanceof Function) {
19
+ const exempt = reflection_1.Reflection.getMetadata('exempt', constructorOrTarget.prototype, method);
20
+ if (exempt)
21
+ continue;
22
+ descriptor.value = function (...args) {
23
+ const unavailableIntegrations = integrations.filter(integration => typeof window[integration] === 'undefined');
24
+ if (unavailableIntegrations.length > 0)
25
+ throw new Error(`Integration(s) ${unavailableIntegrations.join(', ')} not available`);
26
+ return descriptor.value.apply(this, args);
27
+ };
28
+ }
29
+ }
30
+ }
31
+ else {
32
+ const descriptor = Object.getOwnPropertyDescriptor(constructorOrTarget, propertyKey);
33
+ if (descriptor.value instanceof Function) {
34
+ const exempt = reflection_1.Reflection.getMetadata('exempt', constructorOrTarget, propertyKey);
35
+ if (exempt)
36
+ return;
37
+ descriptor.value = function (...args) {
38
+ const unavailableIntegrations = integrations.filter(integration => typeof window[integration] === 'undefined');
39
+ if (unavailableIntegrations.length > 0) {
40
+ throw new Error(`Integration(s) ${unavailableIntegrations.join(', ')} not available`);
41
+ }
42
+ return descriptor.value.apply(this, args);
43
+ };
44
+ }
45
+ }
46
+ };
47
+ }
48
+ exports.RequireIntegration = RequireIntegration;
49
+ /**
50
+ * Marks method in class as exempt from required integrations.
51
+ * Using metadata to mark method as exempt.
52
+ */
53
+ function ExemptFromRequiredIntegrations(target, propertyKey, descriptor) {
54
+ reflection_1.Reflection.defineMetadata('exempt', true, target, propertyKey);
55
+ }
56
+ exports.ExemptFromRequiredIntegrations = ExemptFromRequiredIntegrations;
@@ -0,0 +1,17 @@
1
+ export declare const Device: IDevice;
2
+ declare type DeviceEvents = "shake";
3
+ export interface IDevice {
4
+ /** Listen for events */
5
+ addEventListener(type: DeviceEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
6
+ /** Remove event listener */
7
+ removeEventListener(type: DeviceEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
8
+ /**
9
+ * Start accelerometer
10
+ *
11
+ * this is required to detect shake events
12
+ * */
13
+ startAccelerometer(): void;
14
+ /** Stop accelerometer */
15
+ stopAccelerometer(): void;
16
+ }
17
+ export {};
package/dist/device.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Device = void 0;
10
+ const types_exported_1 = require("./@types/types.exported");
11
+ const RequireIntegration_1 = require("./decorators/RequireIntegration");
12
+ let DeviceClass = class DeviceClass extends EventTarget {
13
+ startAccelerometer() {
14
+ DeviceIntegration.startAccelerometer();
15
+ }
16
+ stopAccelerometer() {
17
+ DeviceIntegration.stopAccelerometer();
18
+ }
19
+ };
20
+ DeviceClass = __decorate([
21
+ (0, RequireIntegration_1.RequireIntegration)(types_exported_1.Integrations.Device)
22
+ ], DeviceClass);
23
+ exports.Device = new DeviceClass();
package/dist/index.d.ts CHANGED
@@ -1,23 +1,26 @@
1
- declare const startiapp: {
1
+ import '@abraham/reflection';
2
+ declare class StartiappClass extends EventTarget {
2
3
  /** Basic calls to the app. */
3
4
  App: import("./app").IApp;
5
+ /** Access to device functionality. */
6
+ Device: import("./device").IDevice;
4
7
  /** The biometric functionality. */
5
8
  Biometrics: import("./biometrics").IBiometrics;
6
9
  /** Access to client user functionality. */
7
10
  User: import("./clientUser").IClientUser;
8
11
  /** The NFC scanning functionality. */
9
- NfcScanner: import("./nfc").INFC;
12
+ Nfc: import("./nfc").INFC;
10
13
  /** Access to push notifications using Firebase. */
11
14
  PushNotification: import("./pushnotification").IPushNotification;
12
15
  /** The QR- and barcode scanning functionality. */
13
16
  QrScanner: import("./qrscanner").IQrScanner;
14
17
  /** Call this method to initialize the starti.app API integration. This method should be called AFTER all integrations are ready (see onIntegrationsAreReady). */
15
- initialize(): void;
18
+ initialize(options?: InitializeParams): void;
16
19
  /** Call this method to check if the app is running in the starti.app app. */
17
20
  isRunningInApp(): boolean;
18
21
  addEventListener(type: StartiappEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
19
22
  removeEventListener(type: StartiappEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
20
- dispatchEvent(event: Event): boolean;
21
- };
23
+ }
24
+ declare const startiapp: StartiappClass;
22
25
  declare type StartiappEvents = "ready" | "error";
23
26
  export default startiapp;
package/dist/index.js CHANGED
@@ -1,18 +1,28 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  const app_1 = require("./app");
4
10
  const biometrics_1 = require("./biometrics");
5
11
  const clientUser_1 = require("./clientUser");
12
+ const device_1 = require("./device");
6
13
  const nfc_1 = require("./nfc");
7
14
  const pushnotification_1 = require("./pushnotification");
8
15
  const qrscanner_1 = require("./qrscanner");
16
+ const ui_service_1 = require("./services/ui-service");
17
+ require("@abraham/reflection");
18
+ const RequireIntegration_1 = require("./decorators/RequireIntegration");
19
+ const types_exported_1 = require("./@types/types.exported");
9
20
  const untypedWindow = window;
10
21
  untypedWindow.appIntegrationsAreReady = () => {
11
22
  app_1.App.setStartiappIsLoaded();
12
- if (document.body)
13
- document.body.setAttribute('startiapp', 'true');
14
23
  startiapp.dispatchEvent(new CustomEvent('ready'));
15
24
  };
25
+ untypedWindow.startiappDevice = device_1.Device;
16
26
  untypedWindow.startiappApp = app_1.App;
17
27
  untypedWindow.startiappUser = clientUser_1.ClientUser;
18
28
  untypedWindow.startiappQrScanner = qrscanner_1.QrScanner;
@@ -22,28 +32,32 @@ untypedWindow.startiappBiometric = biometrics_1.Biometrics;
22
32
  untypedWindow.appErrorEvent = (data) => {
23
33
  startiapp.dispatchEvent(new CustomEvent('error', { detail: data }));
24
34
  };
25
- const startiapp = new class extends EventTarget {
35
+ class StartiappClass extends EventTarget {
26
36
  constructor() {
27
37
  super(...arguments);
28
38
  /** Basic calls to the app. */
29
39
  this.App = app_1.App;
40
+ /** Access to device functionality. */
41
+ this.Device = device_1.Device;
30
42
  /** The biometric functionality. */
31
43
  this.Biometrics = biometrics_1.Biometrics;
32
44
  /** Access to client user functionality. */
33
45
  this.User = clientUser_1.ClientUser;
34
46
  /** The NFC scanning functionality. */
35
- this.NfcScanner = nfc_1.NFC;
47
+ this.Nfc = nfc_1.NFC;
36
48
  /** Access to push notifications using Firebase. */
37
49
  this.PushNotification = pushnotification_1.PushNotification;
38
50
  /** The QR- and barcode scanning functionality. */
39
51
  this.QrScanner = qrscanner_1.QrScanner;
40
52
  }
41
53
  /** Call this method to initialize the starti.app API integration. This method should be called AFTER all integrations are ready (see onIntegrationsAreReady). */
42
- initialize() {
43
- if (AppIntegration === undefined)
54
+ initialize(options) {
55
+ if (typeof AppIntegration === 'undefined')
44
56
  throw new Error('The starti.app API integration is not available.');
45
- if (app_1.App.isStartiappLoaded())
57
+ if (app_1.App.isStartiappLoaded()) {
58
+ ui_service_1.AppUI.setOptions(options);
46
59
  AppIntegration.webAppIsReady();
60
+ }
47
61
  }
48
62
  /** Call this method to check if the app is running in the starti.app app. */
49
63
  isRunningInApp() {
@@ -58,6 +72,20 @@ const startiapp = new class extends EventTarget {
58
72
  removeEventListener(type, callback, options) {
59
73
  super.removeEventListener(type, callback, options);
60
74
  }
61
- };
75
+ }
76
+ __decorate([
77
+ (0, RequireIntegration_1.RequireIntegration)(types_exported_1.Integrations.App)
78
+ ], StartiappClass.prototype, "initialize", null);
79
+ ;
80
+ const startiapp = new StartiappClass();
81
+ if (startiapp.isRunningInApp()) {
82
+ if (document.body)
83
+ document.body.setAttribute('startiapp', 'true');
84
+ else {
85
+ document.addEventListener('DOMContentLoaded', () => {
86
+ document.body.setAttribute('startiapp', 'true');
87
+ });
88
+ }
89
+ }
62
90
  exports.default = startiapp;
63
91
  untypedWindow.startiapp = startiapp;
package/dist/nfc.js CHANGED
@@ -1,58 +1,33 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.NFC = void 0;
4
- exports.NFC = new class extends EventTarget {
10
+ const types_exported_1 = require("./@types/types.exported");
11
+ const RequireIntegration_1 = require("./decorators/RequireIntegration");
12
+ let NfcClass = class NfcClass extends EventTarget {
5
13
  isNFCSupported() {
6
14
  const promise = new Promise((resolve, reject) => {
7
15
  this.resolveNFCSupported = resolve;
8
- try {
9
- if (!NFCIntegration) {
10
- reject('NFC virker kun i starti.app');
11
- return;
12
- }
13
- NFCIntegration.isNFCSupported();
14
- }
15
- catch (e) {
16
- reject(e);
17
- }
16
+ NFCIntegration.isNFCSupported();
18
17
  });
19
18
  return promise;
20
19
  }
21
- isNFCSupportedResult(result) {
22
- this.resolveNFCSupported(result);
23
- }
24
20
  startNFCReader() {
25
21
  const promise = new Promise((resolve, reject) => {
26
22
  this.resolveStartNFCReader = resolve;
27
- try {
28
- if (!NFCIntegration) {
29
- reject('NFC virker kun i starti.app');
30
- return;
31
- }
32
- NFCIntegration.initNFC();
33
- }
34
- catch (e) {
35
- reject(e);
36
- }
23
+ NFCIntegration.initNFC();
37
24
  });
38
25
  return promise;
39
26
  }
40
- startNFCReaderResult(result) {
41
- this.resolveStartNFCReader(result);
42
- }
43
27
  stopNFCReader() {
44
28
  const promise = new Promise((resolve, reject) => {
45
29
  this.resolveStopNFCReader = resolve;
46
- try {
47
- if (!NFCIntegration) {
48
- reject('NFC virker kun i starti.app');
49
- return;
50
- }
51
- NFCIntegration.stopListening();
52
- }
53
- catch (e) {
54
- reject(e);
55
- }
30
+ NFCIntegration.stopListening();
56
31
  });
57
32
  return promise;
58
33
  }
@@ -65,4 +40,15 @@ exports.NFC = new class extends EventTarget {
65
40
  });
66
41
  this.dispatchEvent(event);
67
42
  }
43
+ isNFCSupportedResult(result) {
44
+ this.resolveNFCSupported(result);
45
+ }
46
+ startNFCReaderResult(result) {
47
+ this.resolveStartNFCReader(result);
48
+ }
68
49
  };
50
+ NfcClass = __decorate([
51
+ (0, RequireIntegration_1.RequireIntegration)(types_exported_1.Integrations.NFC)
52
+ ], NfcClass);
53
+ ;
54
+ exports.NFC = new NfcClass();
@@ -1,4 +1,10 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
9
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
10
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,9 +16,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
16
  };
11
17
  Object.defineProperty(exports, "__esModule", { value: true });
12
18
  exports.PushNotification = void 0;
19
+ const types_exported_1 = require("./@types/types.exported");
13
20
  const config_1 = require("./config");
21
+ const RequireIntegration_1 = require("./decorators/RequireIntegration");
14
22
  const index_1 = require("./index");
15
- exports.PushNotification = new class extends EventTarget {
23
+ let PushNotificationClass = class PushNotificationClass extends EventTarget {
16
24
  requestAccess() {
17
25
  return __awaiter(this, void 0, void 0, function* () {
18
26
  return new Promise((resolve, _) => {
@@ -21,24 +29,12 @@ exports.PushNotification = new class extends EventTarget {
21
29
  });
22
30
  });
23
31
  }
24
- requestAccessResult(accessGranted) {
25
- this.resolveRequestAccess(accessGranted);
26
- }
27
32
  getToken() {
28
33
  return new Promise((resolve, _) => {
29
34
  this.resolveFCMToken = resolve;
30
35
  PushNotificationIntegration.getFCMToken();
31
36
  });
32
37
  }
33
- getFCMTokenResult(token) {
34
- this.resolveFCMToken(token);
35
- }
36
- tokenReceivedEvent(token) {
37
- this.dispatchEvent(new CustomEvent('tokenRefreshed', { detail: token }));
38
- }
39
- notificationReceivedEvent(notification) {
40
- this.dispatchEvent(new CustomEvent('notificationReceived', { detail: notification }));
41
- }
42
38
  subscribeToTopics(topics) {
43
39
  return __awaiter(this, void 0, void 0, function* () {
44
40
  PushNotificationIntegration.firebasePushNotificationSubscribeToTopics(topics);
@@ -93,6 +89,18 @@ exports.PushNotification = new class extends EventTarget {
93
89
  });
94
90
  });
95
91
  }
92
+ requestAccessResult(accessGranted) {
93
+ this.resolveRequestAccess(accessGranted);
94
+ }
95
+ getFCMTokenResult(token) {
96
+ this.resolveFCMToken(token);
97
+ }
98
+ tokenReceivedEvent(token) {
99
+ this.dispatchEvent(new CustomEvent('tokenRefreshed', { detail: token }));
100
+ }
101
+ notificationReceivedEvent(notification) {
102
+ this.dispatchEvent(new CustomEvent('notificationReceived', { detail: notification }));
103
+ }
96
104
  /**
97
105
  * Always called with true from Firebase.
98
106
  */
@@ -102,3 +110,8 @@ exports.PushNotification = new class extends EventTarget {
102
110
  */
103
111
  firebasePushNotificationSubscribeToTopicsResult(result) { }
104
112
  };
113
+ PushNotificationClass = __decorate([
114
+ (0, RequireIntegration_1.RequireIntegration)(types_exported_1.Integrations.PushNotification)
115
+ ], PushNotificationClass);
116
+ ;
117
+ exports.PushNotification = new PushNotificationClass();
package/dist/qrscanner.js CHANGED
@@ -1,35 +1,29 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.QrScanner = void 0;
4
- exports.QrScanner = new class extends EventTarget {
10
+ const types_exported_1 = require("./@types/types.exported");
11
+ const RequireIntegration_1 = require("./decorators/RequireIntegration");
12
+ let QrScannerClass = class QrScannerClass extends EventTarget {
5
13
  scan() {
6
14
  return new Promise((resolve, reject) => {
7
- if (!QrScannerIntegration) {
8
- reject('QrScanner integration is not available');
9
- return;
10
- }
11
15
  this.resolveScan = resolve;
12
16
  QrScannerIntegration.startQrCodeScanner();
13
17
  });
14
18
  }
15
- qrResultRecievedEvent(message) {
16
- this.resolveScan(message);
17
- }
18
19
  isCameraAccessGranted() {
19
20
  return new Promise((resolve, reject) => {
20
- if (!QrScannerIntegration)
21
- return reject('Scanner virker kun i starti.app');
22
21
  this.resolveCameraAccessGranted = resolve;
23
22
  QrScannerIntegration.isCameraAccessGranted();
24
23
  });
25
24
  }
26
- isCameraAccessGrantedResult(result) {
27
- this.resolveCameraAccessGranted(result);
28
- }
29
25
  requestCameraAccess() {
30
26
  return new Promise((resolve, reject) => {
31
- if (!QrScannerIntegration)
32
- return reject('Scanner virker kun i starti.app');
33
27
  this.resolveRequestCameraAccess = resolve;
34
28
  QrScannerIntegration.requestCameraAccess();
35
29
  });
@@ -37,4 +31,15 @@ exports.QrScanner = new class extends EventTarget {
37
31
  requestCameraAccessResult(result) {
38
32
  this.resolveRequestCameraAccess(result);
39
33
  }
34
+ qrResultRecievedEvent(message) {
35
+ this.resolveScan(message);
36
+ }
37
+ isCameraAccessGrantedResult(result) {
38
+ this.resolveCameraAccessGranted(result);
39
+ }
40
40
  };
41
+ QrScannerClass = __decorate([
42
+ (0, RequireIntegration_1.RequireIntegration)(types_exported_1.Integrations.QrScanner)
43
+ ], QrScannerClass);
44
+ ;
45
+ exports.QrScanner = new QrScannerClass();
@@ -0,0 +1,16 @@
1
+ declare class UI implements IUI {
2
+ private options;
3
+ private styleString;
4
+ private initialViewportMetaContent;
5
+ setOptions(options?: InitializeParams): void;
6
+ getOptions(): InitializeParams;
7
+ private updateUI;
8
+ }
9
+ interface IUI {
10
+ /** set options for DOM customization and update ui. All default values are false */
11
+ setOptions(options?: InitializeParams): void;
12
+ /** get the currently set options for DOM customization */
13
+ getOptions(): InitializeParams;
14
+ }
15
+ export declare const AppUI: UI;
16
+ export {};
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppUI = void 0;
4
+ const config_1 = require("../config");
5
+ class UI {
6
+ constructor() {
7
+ this.options = { allowDrag: false, allowHighligt: false, allowZoom: false, allowScrollBounce: false };
8
+ }
9
+ setOptions(options) {
10
+ this.options = Object.assign(this.options, options);
11
+ if (document.querySelector('meta[name="viewport"]') != null && typeof (this.initialViewportMetaContent) == 'undefined') {
12
+ this.initialViewportMetaContent = document.querySelector('meta[name="viewport"]').getAttribute("content");
13
+ }
14
+ if (!this.initialViewportMetaContent.includes("viewport-fit=cover"))
15
+ this.initialViewportMetaContent += ", viewport-fit=cover";
16
+ this.updateUI();
17
+ }
18
+ getOptions() {
19
+ return this.options;
20
+ }
21
+ updateUI() {
22
+ this.styleString = "";
23
+ const prevStyleElement = document.getElementById(config_1.styleTagId);
24
+ if (prevStyleElement) {
25
+ prevStyleElement.remove();
26
+ }
27
+ const images = document.getElementsByTagName('img');
28
+ const links = document.getElementsByTagName('a');
29
+ if (!this.options.allowDrag) {
30
+ [...images, ...links].forEach(element => {
31
+ element.setAttribute('draggable', 'false');
32
+ });
33
+ }
34
+ else {
35
+ [...images, ...links].forEach(element => {
36
+ element.removeAttribute('draggable');
37
+ });
38
+ }
39
+ let viewport = document.querySelector("meta[name=viewport]");
40
+ if (!this.options.allowHighligt) {
41
+ this.styleString += `
42
+ body {
43
+ -webkit-user-select: none;
44
+ -khtml-user-select: none;
45
+ -moz-user-select: none;
46
+ -o-user-select: none;
47
+ user-select: none;
48
+ }
49
+ `;
50
+ }
51
+ if (!this.options.allowScrollBounce) {
52
+ this.styleString += `
53
+ html {
54
+ overscroll-behavior: none;
55
+ }
56
+ `;
57
+ }
58
+ if (!this.options.allowZoom) {
59
+ this.styleString += `
60
+ body {
61
+ touch-action: pan-x pan-y;
62
+ }
63
+ `;
64
+ viewport.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover');
65
+ }
66
+ else {
67
+ viewport.setAttribute('content', this.initialViewportMetaContent);
68
+ }
69
+ const styleElement = document.createElement('style');
70
+ styleElement.textContent = this.styleString;
71
+ styleElement.setAttribute('id', config_1.styleTagId);
72
+ document.body.appendChild(styleElement);
73
+ }
74
+ }
75
+ exports.AppUI = new UI();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starti.app",
3
- "version": "1.0.39",
3
+ "version": "1.0.41-alpha.0",
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",
@@ -20,5 +20,8 @@
20
20
  "build:dev": "webpack --mode=development",
21
21
  "build:prod": "webpack --mode=production --node-env=production",
22
22
  "watch": "webpack --watch"
23
+ },
24
+ "dependencies": {
25
+ "@abraham/reflection": "^0.12.0"
23
26
  }
24
27
  }
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 r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[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()}))}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,r)=>{this.resolveSetSafeAreaBackgroundColor=t,AppIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){AppIntegration.disableScreenRotation()}enableScreenRotation(){AppIntegration.enableScreenRotation()}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)}}},1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0,t.Biometrics=new class 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(((r,n)=>{this.resolveScan=r;try{if(!BiometricIntegration)return void n("Biometrics virker kun i starti.app");BiometricIntegration.startScanning(e,t)}catch(e){n(e)}}))}startScanningResult(e){this.resolveScan(e)}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e;try{if(!BiometricIntegration)return void t("Biometrics virker kun i starti.app");BiometricIntegration.getAuthenticationType()}catch(e){t(e)}}))}getAuthenticationTypeResult(e){this.resolveAuthType(e)}setSecuredContent(e){if(!BiometricIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((r,n)=>{this.resolveGetContent=r;try{if(!BiometricIntegration)return void n("Biometrics virker kun i starti.app");BiometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}catch(e){n(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)}}hasSecuredContent(){return new Promise(((e,t)=>{try{if(!BiometricIntegration)return void t("Biometrics virker kun i starti.app");this.resolveHasSecureContent=e,BiometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}catch(e){t(e)}}))}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)}}removeSecuredContent(){if(!BiometricIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.content);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}}setUsernameAndPassword(e,t){if(!BiometricIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){if(!BiometricIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{try{if(!BiometricIntegration)return void t("Biometrics virker kun i starti.app");this.resolveHasUsernameAndPassword=e,BiometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}catch(e){t(e)}}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((r,n)=>{try{if(!BiometricIntegration)return void n("Biometrics virker kun i starti.app");this.resolveGetUsernamePassword=r,BiometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}catch(e){n(e)}}))}}},495:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,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?i(e.value):(t=e.value,t instanceof r?t:new r((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 i=r(913),s=r(607);t.ClientUser=new class extends EventTarget{registerId(e){return n(this,void 0,void 0,(function*(){const t=yield s.default.App.brandId(),r=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:r,fcmToken:n};(yield fetch(i.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-admin-test-e56ab.cloudfunctions.net"},607:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(752),i=r(1),s=r(495),o=r(983),a=r(681),c=r(952),d=window;d.appIntegrationsAreReady=()=>{n.App.setStartiappIsLoaded(),document.body&&document.body.setAttribute("startiapp","true"),u.dispatchEvent(new CustomEvent("ready"))},d.startiappApp=n.App,d.startiappUser=s.ClientUser,d.startiappQrScanner=c.QrScanner,d.startiappPushNotification=a.PushNotification,d.startiappNFC=o.NFC,d.startiappBiometric=i.Biometrics,d.appErrorEvent=e=>{u.dispatchEvent(new CustomEvent("error",{detail:e}))};const u=new class extends EventTarget{constructor(){super(...arguments),this.App=n.App,this.Biometrics=i.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()}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,r){super.addEventListener(e,t,r)}removeEventListener(e,t,r){super.removeEventListener(e,t,r)}};t.default=u,d.startiapp=u},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,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,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?i(e.value):(t=e.value,t instanceof r?t:new r((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 i=r(913),s=r(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("tokenRefreshed",{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(),r=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:r,topic:e,token:t,deviceId:n},a=fetch(i.baseUrl+"/PushNotification-subscribeToTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,r)=>{t.ok||console.warn("Failed to sign up to topic",r,e[r])}))}))}unsubscribeFromTopics(e){return n(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),r=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:r,topic:e,token:t,deviceId:n},a=fetch(i.baseUrl+"/PushNotification-unSubscribeFromTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,r)=>{t.ok||console.warn("Failed to unsubscribe from topic",r,e[r])}))}))}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 r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),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 r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(()=>{return e={886:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Integrations=void 0,(n=t.Integrations||(t.Integrations={})).PushNotification="PushNotificationIntegration",n.QrScanner="QrScannerIntegration",n.Device="DeviceIntegration",n.App="AppIntegration",n.Biometric="BiometricIntegration",n.Calendar="CalendarIntegration",n.NFC="NFCIntegration"},752:function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const o=n(886),i=n(830);let s=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()}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)}};r([i.ExemptFromRequiredIntegrations],s.prototype,"setStartiappIsLoaded",null),r([i.ExemptFromRequiredIntegrations],s.prototype,"isStartiappLoaded",null),s=r([(0,i.RequireIntegration)(o.Integrations.App)],s),t.App=new s},1:function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const o=n(886),i=n(830);let s=class 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,r)=>{this.resolveScan=n;try{BiometricIntegration.startScanning(e,t)}catch(e){r(e)}}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e;try{BiometricIntegration.getAuthenticationType()}catch(e){t(e)}}))}setSecuredContent(e){BiometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetContent=n;try{BiometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}catch(e){r(e)}}))}hasSecuredContent(){return new Promise(((e,t)=>{try{this.resolveHasSecureContent=e,BiometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}catch(e){t(e)}}))}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)=>{try{this.resolveHasUsernameAndPassword=e,BiometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}catch(e){t(e)}}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{try{this.resolveGetUsernamePassword=n,BiometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}catch(e){r(e)}}))}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)}}};s=r([(0,i.RequireIntegration)(o.Integrations.Biometric)],s),t.Biometrics=new s},495:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const o=n(913),i=n(607);t.ClientUser=new class extends EventTarget{registerId(e){return r(this,void 0,void 0,(function*(){const t=yield i.default.App.brandId(),n=yield i.default.App.deviceId(),r=yield i.default.PushNotification.getToken();if(!r||0===r.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 s={brandId:t,clientUserId:e,deviceId:n,fcmToken:r},a=yield fetch(o.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,s),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}}},913:(e,t)=>{"use strict";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"},830:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExemptFromRequiredIntegrations=t.RequireIntegration=void 0;const r=n(34);t.RequireIntegration=function(...e){return function(t,n,o){if(function(e,t){return void 0===e&&void 0===t}(n,o)){let n=Object.getOwnPropertyNames(t.prototype).filter((e=>"constructor"!==e)).filter((e=>!e.endsWith("Result"))).filter((e=>!e.startsWith("resolve"))).filter((e=>!e.endsWith("Event")));for(const o of n){const n=Object.getOwnPropertyDescriptor(t.prototype,o);if(n.value instanceof Function){if(r.Reflection.getMetadata("exempt",t.prototype,o))continue;n.value=function(...t){const r=e.filter((e=>void 0===window[e]));if(r.length>0)throw new Error(`Integration(s) ${r.join(", ")} not available`);return n.value.apply(this,t)}}}}else{const o=Object.getOwnPropertyDescriptor(t,n);if(o.value instanceof Function){if(r.Reflection.getMetadata("exempt",t,n))return;o.value=function(...t){const n=e.filter((e=>void 0===window[e]));if(n.length>0)throw new Error(`Integration(s) ${n.join(", ")} not available`);return o.value.apply(this,t)}}}}},t.ExemptFromRequiredIntegrations=function(e,t,n){r.Reflection.defineMetadata("exempt",!0,e,t)}},955:function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const o=n(886),i=n(830);let s=class extends EventTarget{startAccelerometer(){DeviceIntegration.startAccelerometer()}stopAccelerometer(){DeviceIntegration.stopAccelerometer()}};s=r([(0,i.RequireIntegration)(o.Integrations.Device)],s),t.Device=new s},607:function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0});const o=n(752),i=n(1),s=n(495),a=n(955),c=n(983),u=n(681),l=n(952),d=n(716);n(34);const p=n(830),f=n(886),h=window;h.appIntegrationsAreReady=()=>{o.App.setStartiappIsLoaded(),g.dispatchEvent(new CustomEvent("ready"))},h.startiappDevice=a.Device,h.startiappApp=o.App,h.startiappUser=s.ClientUser,h.startiappQrScanner=l.QrScanner,h.startiappPushNotification=u.PushNotification,h.startiappNFC=c.NFC,h.startiappBiometric=i.Biometrics,h.appErrorEvent=e=>{g.dispatchEvent(new CustomEvent("error",{detail:e}))};class v extends EventTarget{constructor(){super(...arguments),this.App=o.App,this.Device=a.Device,this.Biometrics=i.Biometrics,this.User=s.ClientUser,this.Nfc=c.NFC,this.PushNotification=u.PushNotification,this.QrScanner=l.QrScanner}initialize(e){if("undefined"==typeof AppIntegration)throw new Error("The starti.app API integration is not available.");o.App.isStartiappLoaded()&&(d.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)}}r([(0,p.RequireIntegration)(f.Integrations.App)],v.prototype,"initialize",null);const g=new v;g.isRunningInApp()&&(document.body?document.body.setAttribute("startiapp","true"):document.addEventListener("DOMContentLoaded",(()=>{document.body.setAttribute("startiapp","true")}))),t.default=g,h.startiapp=g},983:function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const o=n(886),i=n(830);let s=class 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)}startNFCReaderResult(e){this.resolveStartNFCReader(e)}};s=r([(0,i.RequireIntegration)(o.Integrations.NFC)],s),t.NFC=new s},681:function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=void 0;const i=n(886),s=n(913),a=n(830),c=n(607);let u=class extends EventTarget{requestAccess(){return o(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 o(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),n=yield c.default.App.brandId(),r=yield c.default.App.deviceId(),o=[];e.forEach((e=>{const i={brand:n,topic:e,token:t,deviceId:r},a=fetch(s.baseUrl+"/PushNotification-subscribeToTopic",{body:JSON.stringify(i)});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 o(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),n=yield c.default.App.brandId(),r=yield c.default.App.deviceId(),o=[];e.forEach((e=>{const i={brand:n,topic:e,token:t,deviceId:r},a=fetch(s.baseUrl+"/PushNotification-unSubscribeFromTopic",{body:JSON.stringify(i)});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){}};u=r([(0,a.RequireIntegration)(i.Integrations.PushNotification)],u),t.PushNotification=new u},952:function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const o=n(886),i=n(830);let s=class 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)}};s=r([(0,i.RequireIntegration)(o.Integrations.QrScanner)],s),t.QrScanner=new s},716:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const r=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(r.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 o=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?o.setAttribute("content",this.initialViewportMetaContent):(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",o.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",r.styleTagId),document.body.appendChild(i)}}},34:function(e,t){!function(e){"use strict";const t=new WeakMap;function n(e,t,n,r){if(!Array.isArray(e)||0===e.length)throw new TypeError;return void 0!==n?function(e,t,n,r){return e.reverse().forEach((e=>{r=e(t,n,r)||r})),r}(e,t,n,r):"function"==typeof t?function(e,t){return e.reverse().forEach((e=>{const n=e(t);n&&(t=n)})),t}(e,t):void 0}function r(e,n){return t.get(e)&&t.get(e).get(n)}function o(e,t,n){if(void 0===t)throw new TypeError;const o=r(t,n);return o&&o.get(e)}function i(e,n,o,i){if(i&&!["string","symbol"].includes(typeof i))throw new TypeError;(r(o,i)||function(e,n){const r=t.get(e)||new Map;t.set(e,r);const o=r.get(n)||new Map;return r.set(n,o),o}(o,i)).set(e,n)}function s(e,t,n){return o(e,t,n)?o(e,t,n):Object.getPrototypeOf(t)?s(e,Object.getPrototypeOf(t),n):void 0}function a(e,t){return function(n,r){i(e,t,n,r)}}function c(e,t,n){return s(e,t,n)}function u(e,t,n){return o(e,t,n)}function l(e,t,n){return!!o(e,t,n)}function d(e,t,n){return!!s(e,t,n)}function p(e,t,n,r){i(e,t,n,r)}const f={decorate:n,defineMetadata:p,getMetadata:c,getOwnMetadata:u,hasMetadata:d,hasOwnMetadata:l,metadata:a};Object.assign(Reflect,f),e.Reflection=f,e.decorate=n,e.defineMetadata=p,e.getMetadata=c,e.getOwnMetadata=u,e.hasMetadata=d,e.hasOwnMetadata=l,e.metadata=a}(t)}},t={},function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(607);var e,t}));