starti.app 1.2.6 → 1.2.7

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.
Files changed (30) hide show
  1. package/dist/config.d.ts +1 -0
  2. package/dist/config.js +2 -1
  3. package/dist/index.d.ts +6 -6
  4. package/dist/index.js +22 -6
  5. package/dist/initalization-steps/CheckIfVersionIsClosed.d.ts +1 -0
  6. package/dist/initalization-steps/CheckIfVersionIsClosed.js +61 -0
  7. package/dist/{biometrics.d.ts → integrations/biometrics.d.ts} +1 -1
  8. package/dist/{biometrics.js → integrations/biometrics.js} +3 -4
  9. package/dist/{device.d.ts → integrations/device.d.ts} +1 -1
  10. package/dist/{device.js → integrations/device.js} +2 -2
  11. package/dist/{nfc.d.ts → integrations/nfc.d.ts} +1 -1
  12. package/dist/{nfc.js → integrations/nfc.js} +2 -2
  13. package/dist/{pushnotification.d.ts → integrations/pushnotification.d.ts} +1 -1
  14. package/dist/{pushnotification.js → integrations/pushnotification.js} +4 -4
  15. package/dist/{qrscanner.d.ts → integrations/qrscanner.d.ts} +1 -1
  16. package/dist/{qrscanner.js → integrations/qrscanner.js} +2 -2
  17. package/dist/{share.d.ts → integrations/share.d.ts} +1 -1
  18. package/dist/{share.js → integrations/share.js} +2 -2
  19. package/dist/lib/ClosedVersionChecker.d.ts +13 -0
  20. package/dist/lib/ClosedVersionChecker.js +63 -0
  21. package/dist/lib/SemVer.d.ts +12 -0
  22. package/dist/lib/SemVer.js +53 -0
  23. package/dist/lib/SmartBanner.d.ts +1 -1
  24. package/dist/lib/SmartBanner.js +7 -3
  25. package/dist/lib/TaskStepper.d.ts +6 -0
  26. package/dist/lib/TaskStepper.js +42 -0
  27. package/dist/test/ClosedVersionChecker.spec.d.ts +2 -0
  28. package/dist/test/ClosedVersionChecker.spec.js +67 -0
  29. package/package.json +9 -2
  30. package/umd/main.js +1 -1
package/dist/config.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare const baseUrl = "https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net";
2
2
  export declare const styleTagId = "startiapp-styling";
3
+ export declare const googleStorageBucket = "startiapp-admin-1fac2.appspot.com";
package/dist/config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.styleTagId = exports.baseUrl = void 0;
3
+ exports.googleStorageBucket = exports.styleTagId = exports.baseUrl = void 0;
4
4
  // TODO: This needs to check if the app is running in production or development mode and return the correct base url, for now return production url
5
5
  exports.baseUrl = 'https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net';
6
6
  exports.styleTagId = 'startiapp-styling';
7
+ exports.googleStorageBucket = 'startiapp-admin-1fac2.appspot.com';
package/dist/index.d.ts CHANGED
@@ -29,19 +29,19 @@ declare class StartiappClass extends EventTarget {
29
29
  /** Basic calls to the app. */
30
30
  App: import("./app").IApp;
31
31
  /** Access to device functionality. */
32
- Device: import("./device").IDevice;
32
+ Device: import("./integrations/device").IDevice;
33
33
  /** The biometric functionality. */
34
- Biometrics: import("./biometrics").IBiometrics;
34
+ Biometrics: import("./integrations/biometrics").IBiometrics;
35
35
  /** Access to client user functionality. */
36
36
  User: import("./clientUser").IClientUser;
37
37
  /** The NFC scanning functionality. */
38
- NfcScanner: import("./nfc").INFC;
38
+ NfcScanner: import("./integrations/nfc").INFC;
39
39
  /** Access to push notifications using Firebase. */
40
- PushNotification: import("./pushnotification").IPushNotification;
40
+ PushNotification: import("./integrations/pushnotification").IPushNotification;
41
41
  /** The QR- and barcode scanning functionality. */
42
- QrScanner: import("./qrscanner").IQrScanner;
42
+ QrScanner: import("./integrations/qrscanner").IQrScanner;
43
43
  /** The share functionality. */
44
- Share: import("./share").IShare;
44
+ Share: import("./integrations/share").IShare;
45
45
  /** Call this method to initialize the starti.app API integration. This method should be called AFTER all integrations are ready (see onIntegrationsAreReady). */
46
46
  initialize(options?: InitializeParams): void;
47
47
  /** Call this method to check if the app is running in the starti.app app. */
package/dist/index.js CHANGED
@@ -1,17 +1,28 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const app_1 = require("./app");
4
- const biometrics_1 = require("./biometrics");
5
13
  const clientUser_1 = require("./clientUser");
6
- const device_1 = require("./device");
7
14
  const getIntegration_1 = require("./getIntegration");
15
+ const CheckIfVersionIsClosed_1 = require("./initalization-steps/CheckIfVersionIsClosed");
16
+ const biometrics_1 = require("./integrations/biometrics");
17
+ const device_1 = require("./integrations/device");
18
+ const nfc_1 = require("./integrations/nfc");
19
+ const pushnotification_1 = require("./integrations/pushnotification");
20
+ const qrscanner_1 = require("./integrations/qrscanner");
21
+ const share_1 = require("./integrations/share");
8
22
  const SmartBanner_1 = require("./lib/SmartBanner");
23
+ const TaskStepper_1 = require("./lib/TaskStepper");
9
24
  const ViewportMetatag_1 = require("./lib/ViewportMetatag");
10
- const nfc_1 = require("./nfc");
11
- const pushnotification_1 = require("./pushnotification");
12
- const qrscanner_1 = require("./qrscanner");
13
25
  const ui_service_1 = require("./services/ui-service");
14
- const share_1 = require("./share");
15
26
  const untypedWindow = window;
16
27
  untypedWindow.appIntegrationsAreReady = () => {
17
28
  app_1.App.setStartiappIsLoaded();
@@ -128,3 +139,8 @@ function documentBodyExists(observer) {
128
139
  }
129
140
  exports.default = startiapp;
130
141
  untypedWindow.startiapp = startiapp;
142
+ const initalizationStepper = new TaskStepper_1.TaskStepper();
143
+ initalizationStepper.addTask(CheckIfVersionIsClosed_1.checkIfAppVersionIsClosed);
144
+ startiapp.addEventListener("ready", () => __awaiter(void 0, void 0, void 0, function* () {
145
+ yield initalizationStepper.start();
146
+ }));
@@ -0,0 +1 @@
1
+ export declare function checkIfAppVersionIsClosed(next: Function): Promise<any>;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.checkIfAppVersionIsClosed = void 0;
13
+ const app_1 = require("../app");
14
+ const getIntegration_1 = require("../getIntegration");
15
+ const ClosedVersionChecker_1 = require("../lib/ClosedVersionChecker");
16
+ const closedVersionChecker = new ClosedVersionChecker_1.ClosedVersionChecker();
17
+ function checkIfAppVersionIsClosed(next) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const isClosed = yield closedVersionChecker.isCurrentVersionClosed();
20
+ if (!isClosed)
21
+ return next();
22
+ yield replaceBodyWithUpdateScreen();
23
+ });
24
+ }
25
+ exports.checkIfAppVersionIsClosed = checkIfAppVersionIsClosed;
26
+ function upgradeApp() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const versionDocument = yield closedVersionChecker.getAvailableVersionsDocument();
29
+ if (navigator.userAgent.indexOf("Apple") > -1)
30
+ window.location.href =
31
+ "https://apps.apple.com/lt/app/" + versionDocument.iosStoreId;
32
+ else
33
+ app_1.App.openExternalBrowser("https://play.google.com/store/apps/details?id=" +
34
+ versionDocument.androidStoreId);
35
+ });
36
+ }
37
+ function createUpdateScreen() {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const updateScreen = document.createElement("div");
40
+ updateScreen.style.margin = "10px";
41
+ const title = document.createElement("h1");
42
+ title.innerText =
43
+ "Der er kommet en opgradering til appen, som er nødvendig for at fortsætte.";
44
+ updateScreen.appendChild(title);
45
+ const center = document.createElement("center");
46
+ const updateButton = document.createElement("button");
47
+ updateButton.innerText = "Opgrader appen";
48
+ updateButton.onclick = upgradeApp;
49
+ center.appendChild(updateButton);
50
+ updateScreen.appendChild(center);
51
+ return updateScreen;
52
+ });
53
+ }
54
+ function replaceBodyWithUpdateScreen() {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const updateScreen = yield createUpdateScreen();
57
+ document.body.innerHTML = "";
58
+ document.body.appendChild(updateScreen);
59
+ (0, getIntegration_1.getIntegration)("AppIntegration").webAppIsReady();
60
+ });
61
+ }
@@ -1,4 +1,4 @@
1
- import { EventTargetMethods } from './@types/EventHandlerWithTypes';
1
+ import { EventTargetMethods } from "../@types/EventHandlerWithTypes";
2
2
  declare type BiometricsEvents = {};
3
3
  export declare const Biometrics: IBiometrics;
4
4
  export interface IBiometrics extends EventTargetMethods<BiometricsEvents> {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Biometrics = void 0;
4
- const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
5
- const getIntegration_1 = require("./getIntegration");
4
+ const EventHandlerWithTypes_1 = require("../@types/EventHandlerWithTypes");
5
+ const getIntegration_1 = require("../getIntegration");
6
6
  class BiometricsClass extends EventHandlerWithTypes_1.EventTargetWithType {
7
7
  constructor() {
8
8
  super(...arguments);
@@ -12,7 +12,7 @@ class BiometricsClass extends EventHandlerWithTypes_1.EventTargetWithType {
12
12
  this.defaultScanReason = "Can't let you in if you don't.";
13
13
  }
14
14
  get biometricIntegration() {
15
- return (0, getIntegration_1.getIntegration)('BiometricIntegration');
15
+ return (0, getIntegration_1.getIntegration)("BiometricIntegration");
16
16
  }
17
17
  scan(title = this.defaultScanTitle, reason = this.defaultScanReason) {
18
18
  const promise = new Promise((resolve, reject) => {
@@ -113,5 +113,4 @@ class BiometricsClass extends EventHandlerWithTypes_1.EventTargetWithType {
113
113
  this.resolveGetContent = null;
114
114
  }
115
115
  }
116
- ;
117
116
  exports.Biometrics = new BiometricsClass();
@@ -1,4 +1,4 @@
1
- import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
1
+ import { EventTargetMethods } from "../@types/EventHandlerWithTypes";
2
2
  export declare const Device: IDevice;
3
3
  declare type DeviceEvents = {
4
4
  shake: CustomEvent<never>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Device = void 0;
4
- const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
5
- const getIntegration_1 = require("./getIntegration");
4
+ const EventHandlerWithTypes_1 = require("../@types/EventHandlerWithTypes");
5
+ const getIntegration_1 = require("../getIntegration");
6
6
  class DeviceClass extends EventHandlerWithTypes_1.EventTargetWithType {
7
7
  get deviceIntegration() {
8
8
  return (0, getIntegration_1.getIntegration)('DeviceIntegration');
@@ -1,4 +1,4 @@
1
- import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
1
+ import { EventTargetMethods } from "../@types/EventHandlerWithTypes";
2
2
  export declare const NFC: INFC;
3
3
  declare type NfcTagResultRecived = Array<{
4
4
  mimeType: string;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NFC = void 0;
4
- const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
5
- const getIntegration_1 = require("./getIntegration");
4
+ const EventHandlerWithTypes_1 = require("../@types/EventHandlerWithTypes");
5
+ const getIntegration_1 = require("../getIntegration");
6
6
  class NfcClass extends EventHandlerWithTypes_1.EventTargetWithType {
7
7
  get NFCIntegration() {
8
8
  return (0, getIntegration_1.getIntegration)('NFCIntegration');
@@ -1,4 +1,4 @@
1
- import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
1
+ import { EventTargetMethods } from "../@types/EventHandlerWithTypes";
2
2
  export declare class Topic {
3
3
  topic: string;
4
4
  name: string;
@@ -11,10 +11,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PushNotification = exports.Topic = void 0;
13
13
  const mustache_1 = require("mustache");
14
- const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
15
- const config_1 = require("./config");
16
- const getIntegration_1 = require("./getIntegration");
17
- const index_1 = require("./index");
14
+ const EventHandlerWithTypes_1 = require("../@types/EventHandlerWithTypes");
15
+ const config_1 = require("../config");
16
+ const getIntegration_1 = require("../getIntegration");
17
+ const index_1 = require("../index");
18
18
  class PushNotificationClass extends EventHandlerWithTypes_1.EventTargetWithType {
19
19
  get pushNotificationIntegration() {
20
20
  return (0, getIntegration_1.getIntegration)("PushNotificationIntegration");
@@ -1,4 +1,4 @@
1
- import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
1
+ import { EventTargetMethods } from "../@types/EventHandlerWithTypes";
2
2
  export declare const QrScanner: IQrScanner;
3
3
  declare type QrScannerEvents = {};
4
4
  export interface IQrScanner extends EventTargetMethods<QrScannerEvents> {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QrScanner = void 0;
4
- const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
5
- const getIntegration_1 = require("./getIntegration");
4
+ const EventHandlerWithTypes_1 = require("../@types/EventHandlerWithTypes");
5
+ const getIntegration_1 = require("../getIntegration");
6
6
  class QrScannerClass extends EventHandlerWithTypes_1.EventTargetWithType {
7
7
  get qrScannerIntegration() {
8
8
  return (0, getIntegration_1.getIntegration)('QrScannerIntegration');
@@ -1,4 +1,4 @@
1
- import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
1
+ import { EventTargetMethods } from "../@types/EventHandlerWithTypes";
2
2
  export declare const Share: IShare;
3
3
  declare type ShareEvents = {};
4
4
  export interface IShare extends EventTargetMethods<ShareEvents> {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Share = void 0;
4
- const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
5
- const getIntegration_1 = require("./getIntegration");
4
+ const EventHandlerWithTypes_1 = require("../@types/EventHandlerWithTypes");
5
+ const getIntegration_1 = require("../getIntegration");
6
6
  class ShareClass extends EventHandlerWithTypes_1.EventTargetWithType {
7
7
  get shareIntegration() {
8
8
  return (0, getIntegration_1.getIntegration)('ShareIntegration');
@@ -0,0 +1,13 @@
1
+ export declare type AvailableVersionsDocument = {
2
+ versions: string[];
3
+ androidStoreId: string;
4
+ iosStoreId: string;
5
+ };
6
+ export declare class ClosedVersionChecker {
7
+ private documentData;
8
+ private getAvailableVersionsUrl;
9
+ getAvailableVersionsDocument(): Promise<AvailableVersionsDocument>;
10
+ private getCurrentVersionSemver;
11
+ private getLatestVersionSemvar;
12
+ isCurrentVersionClosed(): Promise<boolean>;
13
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ClosedVersionChecker = void 0;
13
+ const app_1 = require("../app");
14
+ const config_1 = require("../config");
15
+ const SemVer_1 = require("./SemVer");
16
+ class ClosedVersionChecker {
17
+ constructor() {
18
+ this.documentData = null;
19
+ }
20
+ getAvailableVersionsUrl() {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const brandId = yield app_1.App.brandId();
23
+ return `https://storage.googleapis.com/${config_1.googleStorageBucket}/availableVersions/${encodeURIComponent(brandId)}.json`;
24
+ });
25
+ }
26
+ getAvailableVersionsDocument() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ if (this.documentData != null)
29
+ return this.documentData;
30
+ const documentUrl = yield this.getAvailableVersionsUrl();
31
+ const result = yield fetch(documentUrl);
32
+ const data = yield result.json();
33
+ this.documentData = data;
34
+ return data;
35
+ });
36
+ }
37
+ getCurrentVersionSemver() {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const versionRaw = yield app_1.App.version();
40
+ return new SemVer_1.SemVer(versionRaw);
41
+ });
42
+ }
43
+ getLatestVersionSemvar(availableVersions) {
44
+ return availableVersions.reduce((prev, curr) => {
45
+ if (curr.isGreaterThan(prev))
46
+ return curr;
47
+ return prev;
48
+ }, new SemVer_1.SemVer("0.0.0"));
49
+ }
50
+ isCurrentVersionClosed() {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const version = yield this.getCurrentVersionSemver();
53
+ const availableVersions = yield this.getAvailableVersionsDocument();
54
+ const isInAvailableVersions = availableVersions.versions.includes(version.toString());
55
+ if (isInAvailableVersions)
56
+ return false;
57
+ const semverAvailableVersions = availableVersions.versions.map((v) => new SemVer_1.SemVer(v));
58
+ const latestVersion = this.getLatestVersionSemvar(semverAvailableVersions);
59
+ return !version.isGreaterThanOrEqualTo(latestVersion);
60
+ });
61
+ }
62
+ }
63
+ exports.ClosedVersionChecker = ClosedVersionChecker;
@@ -0,0 +1,12 @@
1
+ export declare class SemVer {
2
+ private version;
3
+ private major;
4
+ private minor;
5
+ private patch;
6
+ constructor(version: string);
7
+ private isValidVersion;
8
+ isGreaterThan(other: SemVer): boolean;
9
+ isGreaterThanOrEqualTo(other: SemVer): boolean;
10
+ isEqualTo(other: SemVer): boolean;
11
+ toString(): string;
12
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SemVer = void 0;
4
+ class SemVer {
5
+ constructor(version) {
6
+ this.version = version;
7
+ if (!this.isValidVersion(version))
8
+ throw new Error(`Invalid version: ${version}`);
9
+ const parts = version.split(".");
10
+ this.major = parseInt(parts[0]);
11
+ this.minor = parseInt(parts[1]);
12
+ this.patch = parseInt(parts[2]);
13
+ }
14
+ isValidVersion(version) {
15
+ const parts = version.split(".");
16
+ if (parts.length < 3)
17
+ return false;
18
+ if (isNaN(parseInt(parts[0])))
19
+ return false;
20
+ if (isNaN(parseInt(parts[1])))
21
+ return false;
22
+ if (isNaN(parseInt(parts[2])))
23
+ return false;
24
+ return true;
25
+ }
26
+ isGreaterThan(other) {
27
+ if (this.major > other.major)
28
+ return true;
29
+ if (this.major < other.major)
30
+ return false;
31
+ if (this.minor > other.minor)
32
+ return true;
33
+ if (this.minor < other.minor)
34
+ return false;
35
+ if (this.patch > other.patch)
36
+ return true;
37
+ if (this.patch < other.patch)
38
+ return false;
39
+ return false;
40
+ }
41
+ isGreaterThanOrEqualTo(other) {
42
+ return this.isGreaterThan(other) || this.isEqualTo(other);
43
+ }
44
+ isEqualTo(other) {
45
+ return (this.major === other.major &&
46
+ this.minor === other.minor &&
47
+ this.patch === other.patch);
48
+ }
49
+ toString() {
50
+ return this.version;
51
+ }
52
+ }
53
+ exports.SemVer = SemVer;
@@ -1,7 +1,7 @@
1
1
  export declare class SmartBanner {
2
2
  constructor();
3
- private _storageBucket;
4
3
  private marginTop;
4
+ private getHostDomain;
5
5
  private getSmartBannerDataUrl;
6
6
  private getSmartBannerData;
7
7
  private getSmartBannerClosed;
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SmartBanner = void 0;
13
13
  const __1 = require("..");
14
+ const config_1 = require("../config");
14
15
  const getMobileOS = () => {
15
16
  const ua = navigator.userAgent;
16
17
  if (/android/i.test(ua)) {
@@ -23,14 +24,17 @@ const getMobileOS = () => {
23
24
  };
24
25
  class SmartBanner {
25
26
  constructor() {
26
- this._storageBucket = "startiapp-admin-1fac2.appspot.com";
27
27
  this.marginTop = "72px";
28
28
  }
29
- getSmartBannerDataUrl() {
29
+ getHostDomain() {
30
30
  const host = window.location.host;
31
31
  const parts = host.split(".");
32
32
  const domain = parts.slice(parts.length - 2).join(".");
33
- return `https://storage.googleapis.com/${this._storageBucket}/smartbanner/${encodeURIComponent(domain)}.json`;
33
+ return domain;
34
+ }
35
+ getSmartBannerDataUrl() {
36
+ const domain = this.getHostDomain();
37
+ return `https://storage.googleapis.com/${config_1.googleStorageBucket}/smartbanner/${encodeURIComponent(domain)}.json`;
34
38
  }
35
39
  getSmartBannerData() {
36
40
  return __awaiter(this, void 0, void 0, function* () {
@@ -0,0 +1,6 @@
1
+ export declare class TaskStepper {
2
+ private tasks;
3
+ addTask(task: (next: Function) => Promise<void> | void): void;
4
+ start(): Promise<void>;
5
+ private runTasks;
6
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TaskStepper = void 0;
13
+ class TaskStepper {
14
+ constructor() {
15
+ this.tasks = [];
16
+ }
17
+ addTask(task) {
18
+ this.tasks.push(task);
19
+ }
20
+ start() {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const tasks = [...this.tasks];
23
+ yield this.runTasks(tasks);
24
+ });
25
+ }
26
+ runTasks(tasks) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ if (tasks.length === 0)
29
+ return;
30
+ const task = tasks.shift();
31
+ if (task == undefined)
32
+ return;
33
+ try {
34
+ yield task(() => this.runTasks(tasks));
35
+ }
36
+ catch (error) {
37
+ this.runTasks(tasks);
38
+ }
39
+ });
40
+ }
41
+ }
42
+ exports.TaskStepper = TaskStepper;
@@ -0,0 +1,2 @@
1
+ import "isomorphic-fetch";
2
+ import "jest";
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ require("isomorphic-fetch");
13
+ require("jest");
14
+ const app_1 = require("../app");
15
+ const ClosedVersionChecker_1 = require("../lib/ClosedVersionChecker");
16
+ let appVersionMock = "1.0.0";
17
+ function getMockedClosedVersionChecker(availableVersionsDocument) {
18
+ const closedVersionChecker = new ClosedVersionChecker_1.ClosedVersionChecker();
19
+ jest.spyOn(closedVersionChecker,
20
+ // Using any because the method is private, and is therefore not included in the spyOn parameter type.
21
+ "getAvailableVersionsDocument").mockImplementation(() => __awaiter(this, void 0, void 0, function* () {
22
+ return availableVersionsDocument;
23
+ }));
24
+ return closedVersionChecker;
25
+ }
26
+ function setAppVersionMock(version) {
27
+ appVersionMock = version;
28
+ }
29
+ describe("ClosedVersionChecker", () => {
30
+ beforeAll(() => {
31
+ window.startiappApp = app_1.App;
32
+ window.AppIntegration = {
33
+ brandId: () => window.startiappApp.brandIdResult("UNUSED"),
34
+ version: () => window.startiappApp.versionResult(appVersionMock),
35
+ };
36
+ });
37
+ it("should not be closed if the version is included in the available versions", () => __awaiter(void 0, void 0, void 0, function* () {
38
+ setAppVersionMock("2.0.0");
39
+ const closedVersionChecker = getMockedClosedVersionChecker({
40
+ versions: ["2.0.0", "2.0.4"],
41
+ androidStoreId: "UNUSED",
42
+ iosStoreId: "UNUSED",
43
+ });
44
+ const isCurrentVersionClosed = yield closedVersionChecker.isCurrentVersionClosed();
45
+ expect(isCurrentVersionClosed).toBe(false);
46
+ }));
47
+ it("should not be closed if the app is newer than available versions", () => __awaiter(void 0, void 0, void 0, function* () {
48
+ setAppVersionMock("2.0.562");
49
+ const closedVersionChecker = getMockedClosedVersionChecker({
50
+ versions: ["2.0.0", "2.0.4"],
51
+ androidStoreId: "UNUSED",
52
+ iosStoreId: "UNUSED",
53
+ });
54
+ const isCurrentVersionClosed = yield closedVersionChecker.isCurrentVersionClosed();
55
+ expect(isCurrentVersionClosed).toBe(false);
56
+ }));
57
+ it("should be closed if the app is older than available versions", () => __awaiter(void 0, void 0, void 0, function* () {
58
+ setAppVersionMock("1.9.8");
59
+ const closedVersionChecker = getMockedClosedVersionChecker({
60
+ versions: ["2.0.0", "2.9.9"],
61
+ androidStoreId: "UNUSED",
62
+ iosStoreId: "UNUSED",
63
+ });
64
+ const isCurrentVersionClosed = yield closedVersionChecker.isCurrentVersionClosed();
65
+ expect(isCurrentVersionClosed).toBe(true);
66
+ }));
67
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starti.app",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
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",
@@ -9,9 +9,15 @@
9
9
  "/umd"
10
10
  ],
11
11
  "devDependencies": {
12
+ "@types/jest": "^29.5.4",
12
13
  "@types/mustache": "^4.2.2",
13
14
  "@webpack-cli/generators": "^2.5.0",
15
+ "isomorphic-fetch": "^3.0.0",
16
+ "jest": "^29.6.4",
17
+ "jest-environment-jsdom": "^29.6.4",
18
+ "ts-jest": "^29.1.1",
14
19
  "ts-loader": "^9.4.1",
20
+ "ts-node": "^10.9.1",
15
21
  "typescript": "^4.8.4",
16
22
  "webpack": "^5.74.0",
17
23
  "webpack-cli": "^4.10.0",
@@ -23,7 +29,8 @@
23
29
  "build:dev": "webpack --mode=development",
24
30
  "build:prod": "webpack --mode=production --node-env=production",
25
31
  "watch": "webpack --watch",
26
- "prerelease": "npm version prerelease --preid=alpha"
32
+ "prerelease": "npm version prerelease --preid=alpha",
33
+ "test": "jest"
27
34
  },
28
35
  "dependencies": {
29
36
  "mustache": "^4.2.0"
package/umd/main.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see main.js.LICENSE.txt */
2
- !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={466:function(e){e.exports=function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function n(e){return"function"==typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function s(e,t){return null!=e&&"object"==typeof e&&t in e}var i=RegExp.prototype.test;var o=/\S/;function a(e){return!function(e,t){return i.call(e,t)}(o,e)}var p={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};var l=/\s*/,c=/\s+/,d=/\s*=/,u=/\s*\}/,h=/#|\^|\/|>|\{|&|=|!/;function g(e){this.string=e,this.tail=e,this.pos=0}function m(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function v(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}g.prototype.eos=function(){return""===this.tail},g.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},g.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},m.prototype.push=function(e){return new m(e,this)},m.prototype.lookup=function(e){var t,r,i,o=this.cache;if(o.hasOwnProperty(e))t=o[e];else{for(var a,p,l,c=this,d=!1;c;){if(e.indexOf(".")>0)for(a=c.view,p=e.split("."),l=0;null!=a&&l<p.length;)l===p.length-1&&(d=s(a,p[l])||(r=a,i=p[l],null!=r&&"object"!=typeof r&&r.hasOwnProperty&&r.hasOwnProperty(i))),a=a[p[l++]];else a=c.view[e],d=s(c.view,e);if(d){t=a;break}c=c.parent}o[e]=t}return n(t)&&(t=t.call(this.view)),t},v.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},v.prototype.parse=function(e,n){var s=this.templateCache,i=e+":"+(n||f.tags).join(":"),o=void 0!==s,p=o?s.get(i):void 0;return null==p&&(p=function(e,n){if(!e)return[];var s,i,o,p=!1,m=[],v=[],y=[],w=!1,S=!1,b="",I=0;function C(){if(w&&!S)for(;y.length;)delete v[y.pop()];else y=[];w=!1,S=!1}function E(e){if("string"==typeof e&&(e=e.split(c,2)),!t(e)||2!==e.length)throw new Error("Invalid tags: "+e);s=new RegExp(r(e[0])+"\\s*"),i=new RegExp("\\s*"+r(e[1])),o=new RegExp("\\s*"+r("}"+e[1]))}E(n||f.tags);for(var P,T,A,N,x,R,_=new g(e);!_.eos();){if(P=_.pos,A=_.scanUntil(s))for(var k=0,O=A.length;k<O;++k)a(N=A.charAt(k))?(y.push(v.length),b+=N):(S=!0,p=!0,b+=" "),v.push(["text",N,P,P+1]),P+=1,"\n"===N&&(C(),b="",I=0,p=!1);if(!_.scan(s))break;if(w=!0,T=_.scan(h)||"name",_.scan(l),"="===T?(A=_.scanUntil(d),_.scan(d),_.scanUntil(i)):"{"===T?(A=_.scanUntil(o),_.scan(u),_.scanUntil(i),T="&"):A=_.scanUntil(i),!_.scan(i))throw new Error("Unclosed tag at "+_.pos);if(x=">"==T?[T,A,P,_.pos,b,I,p]:[T,A,P,_.pos],I++,v.push(x),"#"===T||"^"===T)m.push(x);else if("/"===T){if(!(R=m.pop()))throw new Error('Unopened section "'+A+'" at '+P);if(R[1]!==A)throw new Error('Unclosed section "'+R[1]+'" at '+P)}else"name"===T||"{"===T||"&"===T?S=!0:"="===T&&E(A)}if(C(),R=m.pop())throw new Error('Unclosed section "'+R[1]+'" at '+_.pos);return function(e){for(var t,n=[],r=n,s=[],i=0,o=e.length;i<o;++i)switch((t=e[i])[0]){case"#":case"^":r.push(t),s.push(t),r=t[4]=[];break;case"/":s.pop()[5]=t[2],r=s.length>0?s[s.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],s=0,i=e.length;s<i;++s)(t=e[s])&&("text"===t[0]&&n&&"text"===n[0]?(n[1]+=t[1],n[3]=t[3]):(r.push(t),n=t));return r}(v))}(e,n),o&&s.set(i,p)),p},v.prototype.render=function(e,t,n,r){var s=this.getConfigTags(r),i=this.parse(e,s),o=t instanceof m?t:new m(t,void 0);return this.renderTokens(i,o,n,e,r)},v.prototype.renderTokens=function(e,t,n,r,s){for(var i,o,a,p="",l=0,c=e.length;l<c;++l)a=void 0,"#"===(o=(i=e[l])[0])?a=this.renderSection(i,t,n,r,s):"^"===o?a=this.renderInverted(i,t,n,r,s):">"===o?a=this.renderPartial(i,t,n,s):"&"===o?a=this.unescapedValue(i,t):"name"===o?a=this.escapedValue(i,t,s):"text"===o&&(a=this.rawValue(i)),void 0!==a&&(p+=a);return p},v.prototype.renderSection=function(e,r,s,i,o){var a=this,p="",l=r.lookup(e[1]);if(l){if(t(l))for(var c=0,d=l.length;c<d;++c)p+=this.renderTokens(e[4],r.push(l[c]),s,i,o);else if("object"==typeof l||"string"==typeof l||"number"==typeof l)p+=this.renderTokens(e[4],r.push(l),s,i,o);else if(n(l)){if("string"!=typeof i)throw new Error("Cannot use higher-order sections without the original template");null!=(l=l.call(r.view,i.slice(e[3],e[5]),(function(e){return a.render(e,r,s,o)})))&&(p+=l)}else p+=this.renderTokens(e[4],r,s,i,o);return p}},v.prototype.renderInverted=function(e,n,r,s,i){var o=n.lookup(e[1]);if(!o||t(o)&&0===o.length)return this.renderTokens(e[4],n,r,s,i)},v.prototype.indentPartial=function(e,t,n){for(var r=t.replace(/[^ \t]/g,""),s=e.split("\n"),i=0;i<s.length;i++)s[i].length&&(i>0||!n)&&(s[i]=r+s[i]);return s.join("\n")},v.prototype.renderPartial=function(e,t,r,s){if(r){var i=this.getConfigTags(s),o=n(r)?r(e[1]):r[e[1]];if(null!=o){var a=e[6],p=e[5],l=e[4],c=o;0==p&&l&&(c=this.indentPartial(o,l,a));var d=this.parse(c,i);return this.renderTokens(d,t,r,c,s)}}},v.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},v.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||f.escape,s=t.lookup(e[1]);if(null!=s)return"number"==typeof s&&r===f.escape?String(s):r(s)},v.prototype.rawValue=function(e){return e[1]},v.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},v.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var f={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){y.templateCache=e},get templateCache(){return y.templateCache}},y=new v;return f.clearCache=function(){return y.clearCache()},f.parse=function(e,t){return y.parse(e,t)},f.render=function(e,n,r,s){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+((t(i=e)?"array":typeof i)+'" was given as the first argument for mustache#render(template, view, partials)'));var i;return y.render(e,n,r,s)},f.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return p[e]}))},f.Scanner=g,f.Context=m,f.Writer=v,f}()},715:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetWithType=void 0;class n extends EventTarget{addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}t.EventTargetWithType=n},752:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{constructor(){super(...arguments),this.startiappIsLoaded=!1}get appIntegration(){return(0,s.getIntegration)("AppIntegration")}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){this.appIntegration.setAppUrl(e)}resetAppUrl(){this.appIntegration.resetAppUrl()}openExternalBrowser(e){this.appIntegration.openBrowser(e)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,this.appIntegration.brandId()}))}requestReview(){this.appIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,this.appIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,this.appIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,this.appIntegration.getInternalDomains()}))}addInternalDomain(e){this.appIntegration.addInternalDomain(e)}removeInternalDomain(e){this.appIntegration.removeInternalDomain(e)}showStatusBar(){if(void 0===this.appIntegration.showStatusBar)return console.warn("showStatusBar not implemented, please update your app to the latest version");this.appIntegration.showStatusBar()}hideStatusBar(){if(void 0===this.appIntegration.hideStatusBar)return console.warn("hideStatusBar not implemented, please update your app to the latest version");this.appIntegration.hideStatusBar()}setStatusBar(e){if(void 0===this.appIntegration.setStatusBar)return console.warn("setStatusBar not implemented, please update your app to the latest version");this.appIntegration.setStatusBar(e)}setSpinner(e){if(void 0===this.appIntegration.setNavigationSpinner)return console.warn("setNavigationSpinner not implemented, please update your app to the latest version");this.appIntegration.setNavigationSpinner({color:e.color,delay:e.afterMilliseconds,show:e.show})}hideSpinner(){if(!this.appIntegration.hideNavigationSpinner)return console.warn("hideNavigationSpinner not implemented, please update your app to the latest version");this.appIntegration.hideNavigationSpinner()}showSpinner(e){if(!this.appIntegration.showNavigationSpinner)return console.warn("showNavigationSpinner not implemented, please update your app to the latest version");this.appIntegration.showNavigationSpinner({color:null==e?void 0:e.color,delay:null==e?void 0:e.afterMilliseconds,show:null==e?void 0:e.show})}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,this.appIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){this.appIntegration.disableScreenRotation()}enableScreenRotation(){this.appIntegration.enableScreenRotation()}addExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.addExternalDomains(t)}removeExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.removeExternalDomains(t)}getExternalDomains(){return new Promise(((e,t)=>{this.resolveExternalDomains=e,this.appIntegration.getExternalDomains()}))}getExternalDomainsResult(e){this.resolveExternalDomains(e),this.resolveExternalDomains=null}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e),this.resolveBrandId=null}versionResult(e){this.resolveVersion(e),this.resolveVersion=null}deviceIdResult(e){this.resolveDeviceId(e),this.resolveDeviceId=null}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e),this.resolveSetSafeAreaBackgroundColor=null}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e),this.resolveGetInternalDomains=null}}t.App=new i},1:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{constructor(){super(...arguments),this.SECURED_CONTENT_KEY="STARTI_APP_BIOMETRIC_CONTENT",this.SECURED_LOGIN_KEY="STARTI_APP_BIOMETRIC_LOGIN_CONTENT",this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}get biometricIntegration(){return(0,s.getIntegration)("BiometricIntegration")}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveScan=n,this.biometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,this.biometricIntegration.getAuthenticationType()}))}setSecuredContent(e){this.biometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetContent=n,this.biometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,this.biometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){this.biometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){this.biometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){this.biometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,this.biometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetUsernamePassword=n,this.biometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.result);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}this.resolveGetUsernamePassword=null}hasSecuredContentResult({result:e,key:t}){if(t===this.SECURED_LOGIN_KEY)return this.resolveHasUsernameAndPassword(e),void(this.resolveHasUsernameAndPassword=null);this.resolveHasSecureContent(e),this.resolveHasSecureContent=null}getAuthenticationTypeResult(e){this.resolveAuthType(e),this.resolveAuthType=null}startScanningResult(e){this.resolveScan(e),this.resolveScan=null}getSecuredContentResult(e){if(e.key!==this.SECURED_LOGIN_KEY){try{const t=JSON.parse(e.result);this.resolveGetContent(t)}catch(t){this.resolveGetContent(e.result)}this.resolveGetContent=null}else this.handleResolveGetUsernamePassword(e)}}t.Biometrics=new i},495:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{p(r.next(e))}catch(e){i(e)}}function a(e){try{p(r.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}p((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const s=n(715),i=n(913),o=n(607);class a extends s.EventTargetWithType{registerId(e){return r(this,void 0,void 0,(function*(){const t=yield o.default.App.brandId(),n=yield o.default.App.deviceId(),r=yield o.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(i.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}`)}))}unregisterId(){return r(this,void 0,void 0,(function*(){const e={brandId:yield o.default.App.brandId(),deviceId:yield o.default.App.deviceId()},t=yield fetch(i.baseUrl+"/ClientUser-unregisterId",{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok)throw console.warn("Failed to unregister logged in client user",e),new Error(`Failed to unregister logged in client user: Firebase returned statuscode ${t.status}`)}))}}t.ClientUser=new a},913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net",t.styleTagId="startiapp-styling"},955:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get deviceIntegration(){return(0,s.getIntegration)("DeviceIntegration")}startAccelerometer(){this.deviceIntegration.startAccelerometer()}stopAccelerometer(){this.deviceIntegration.stopAccelerometer()}isAccelerometerStarted(){return new Promise(((e,t)=>{this.deviceIntegration.isAccelerometerStarted(),this.resolveIsAccelerometerStarted=e}))}isAccelerometerStartedResult(e){this.resolveIsAccelerometerStarted(e),this.resolveIsAccelerometerStarted=null}onShakeEvent(){this.dispatchEvent(new CustomEvent("shake"))}}t.Device=new i},900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIntegration=void 0;let n={};t.getIntegration=function(e){if(n[e])return n[e];let t=window[e],r=0;for(;!t&&r<5;)t=window.parent[e],r++;if(!t)throw new Error(`Could not find integration ${e}`);return n[e]=t,t}},607:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(752),s=n(1),i=n(495),o=n(955),a=n(900),p=n(666),l=n(240),c=n(983),d=n(681),u=n(952),h=n(716),g=n(634),m=window;m.appIntegrationsAreReady=()=>{r.App.setStartiappIsLoaded(),f.dispatchEvent(new CustomEvent("ready"))},m.startiappDevice=o.Device,m.startiappApp=r.App,m.startiappUser=i.ClientUser,m.startiappQrScanner=u.QrScanner,m.startiappPushNotification=d.PushNotification,m.startiappNFC=c.NFC,m.startiappShare=g.Share,m.startiappBiometric=s.Biometrics,m.appErrorEvent=e=>{f.dispatchEvent(new CustomEvent("error",{detail:e}))};class v extends EventTarget{constructor(){super(...arguments),this.App=r.App,this.Device=o.Device,this.Biometrics=s.Biometrics,this.User=i.ClientUser,this.NfcScanner=c.NFC,this.PushNotification=d.PushNotification,this.QrScanner=u.QrScanner,this.Share=g.Share}get appIntegration(){return(0,a.getIntegration)("AppIntegration")}initialize(e){this.isRunningInApp()&&("function"==typeof gtag&&gtag("set","user_properties",{startiapp:"true"}),h.AppUI.setOptions(e),this.appIntegration.webAppIsReady())}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){if("ready"==e&&r.App.isStartiappLoaded()){const e=new CustomEvent("ready");"handleEvent"in t?t.handleEvent(e):t(e)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}const f=new v;if(document.body)y();else{const e=new MutationObserver((()=>y(e)));e.observe(document.documentElement,{childList:!0})}function y(e){if(!document.body)return;if((new p.SmartBanner).initialize(),f.isRunningInApp()?document.body.setAttribute("startiapp",""):document.body.removeAttribute("startiapp"),!document.head)return;const t=document.createElement("style");if(t.innerHTML="body:not([startiapp]) .startiapp-hide-in-browser,body:not([startiapp]) .startiapp-show-in-app,body[startiapp] .startiapp-hide-in-app,body[startiapp] .startiapp-show-in-browser{display:none!important}",document.head.appendChild(t),f.isRunningInApp()){const e={width:"device-width","viewport-fit":"cover"},t=document.querySelector("meta[name=viewport]");if(t){const n=(0,l.parseViewportMeta)(t.content);t.content=(0,l.serializeViewportMeta)(Object.assign(Object.assign({},n),e))}else{const t=document.createElement("meta");t.name="viewport",t.content=(0,l.serializeViewportMeta)(e),document.head.appendChild(t)}}e&&e.disconnect()}t.default=f,m.startiapp=f},666:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{p(r.next(e))}catch(e){i(e)}}function a(e){try{p(r.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}p((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SmartBanner=void 0;const s=n(607);t.SmartBanner=class{constructor(){this._storageBucket="startiapp-admin-1fac2.appspot.com",this.marginTop="72px"}getSmartBannerDataUrl(){const e=window.location.host.split("."),t=e.slice(e.length-2).join(".");return`https://storage.googleapis.com/${this._storageBucket}/smartbanner/${encodeURIComponent(t)}.json`}getSmartBannerData(){return r(this,void 0,void 0,(function*(){try{const e=yield fetch(this.getSmartBannerDataUrl());return yield e.json()}catch(e){return e instanceof SyntaxError||console.error("SmartBanner error",e),{enabled:!1,appName:"",appIcon:"",appleAppId:"",googlePlayAppId:""}}}))}getSmartBannerClosed(){const e=localStorage.getItem("startiapp-smart-banner-closed-at");return!!(e&&Date.now()-parseInt(e)<6048e5)}setSmartBannerClosed(e=!1){localStorage.setItem("startiapp-smart-banner-closed-at",e?Date.now()+2592e6+"":Date.now().toString())}initialize(){return r(this,void 0,void 0,(function*(){if(s.default.isRunningInApp())return;const e=(()=>{const e=navigator.userAgent;return/android/i.test(e)?"Android":/iPad|iPhone|iPod/.test(e)?"iOS":"Other"})();if("Other"===e)return;const t=document.querySelector("html");if(!t)return;if(this.getSmartBannerClosed())return;const n=yield this.getSmartBannerData();if(!n.enabled)return;t.style.setProperty("margin-top",this.marginTop,"important");const r=document.createElement("div");switch(r.id="startiapp-smart-banner-wrapper",r.style.setProperty("position","fixed","important"),r.style.setProperty("top","0","important"),r.style.setProperty("left","0","important"),r.style.setProperty("right","0","important"),r.style.setProperty("height",this.marginTop,"important"),r.style.setProperty("width","100%","important"),r.style.setProperty("background-color","#f2f1f6","important"),r.style.setProperty("z-index","999999999","important"),r.style.setProperty("border-bottom","1px solid #dadade","important"),e){case"iOS":yield this.createIosBannerContent(n,r);break;case"Android":yield this.createAndroidBannerContent(n,r);break;default:return void console.warn("Unknown platform",e)}document.body.appendChild(r)}))}createIosBannerContent(e,t){return r(this,void 0,void 0,(function*(){this.createContent(e.appName,e.appIcon,`https://apps.apple.com/us/app/id${e.appleAppId}`,"App Store",t,e.appDetails)}))}createAndroidBannerContent(e,t){return r(this,void 0,void 0,(function*(){this.createContent(e.appName,e.appIcon,`market://details?id=${e.googlePlayAppId}`,"Play Store",t,e.appDetails)}))}createContent(e,t,n,s,i,o){return r(this,void 0,void 0,(function*(){0===(null==o?void 0:o.length)&&(o=void 0);const r=document.createElement("div");r.style.setProperty("display","grid","important"),r.id="startiapp-smart-banner-grid",r.style.setProperty("grid-template-columns","30px auto auto","important"),r.style.setProperty("height","100%","important"),r.style.setProperty("width","100%","important"),r.style.setProperty("font-family","sans-serif","important");const a=document.createElement("div");a.id="startiapp-smart-banner-close-button",a.style.setProperty("grid-column","1"),a.style.setProperty("grid-row","1"),a.style.setProperty("height","100%"),a.style.setProperty("width","100%"),a.style.setProperty("display","flex"),a.style.setProperty("justify-content","center"),a.style.setProperty("align-items","center"),a.onclick=()=>{var e,t;i.remove(),null===(e=document.querySelector("html"))||void 0===e||e.style.setProperty("transition","margin-top 0.3s ease-in-out"),null===(t=document.querySelector("html"))||void 0===t||t.style.removeProperty("margin-top"),this.setSmartBannerClosed()};const p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.setAttribute("id","close-smart-banner"),p.setAttribute("style","height: 16px; width: 16px;"),p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("fill","none"),p.setAttribute("xmlns","http://www.w3.org/2000/svg"),p.innerHTML='\n\t\t\t<path d="M18 6L6 18" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t<path d="M6 6L18 18" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t',a.appendChild(p);const l=document.createElement("div");l.id="startiapp-smart-banner-image",l.style.setProperty("grid-column","2"),l.style.setProperty("grid-row","1"),l.style.setProperty("height","100%"),l.style.setProperty("width","100%"),l.style.setProperty("display","flex"),l.style.setProperty("justify-content","start"),l.style.setProperty("align-items","center");const c=document.createElement("img");c.id="startiapp-smart-banner-app-icon",c.src=t,c.style.setProperty("height","54px"),c.style.setProperty("width","54px"),c.style.setProperty("object-fit","scale-down");const d=document.createElement("div");d.id="startiapp-smart-banner-app-name-container",d.style.setProperty("display","flex"),d.style.setProperty("flex-direction","column");const u=document.createElement("span");u.id="startiapp-smart-banner-app-name",u.style.setProperty("margin-left","8px"),u.style.setProperty("font-size","16px"),u.style.setProperty("font-weight","500"),u.textContent=e;const h=document.createElement("span");h.id="startiapp-smart-banner-app-details",h.style.setProperty("margin-left","8px"),h.style.setProperty("font-size","16px"),h.style.setProperty("font-weight","500"),h.textContent=null!=o?o:`GET — on the ${s}`,d.appendChild(u),d.appendChild(h),l.appendChild(c),l.appendChild(d);const g=document.createElement("div");g.style.setProperty("grid-column","3"),g.style.setProperty("grid-row","1"),g.style.setProperty("height","100%"),g.style.setProperty("width","100%"),g.style.setProperty("display","flex"),g.style.setProperty("justify-content","center"),g.style.setProperty("align-items","center");const m=document.createElement("a");m.href=n,m.target="_blank",m.textContent="Vis",m.style.setProperty("text-decoration","none"),m.style.setProperty("color","#000"),m.style.setProperty("font-size","16px"),m.style.setProperty("font-weight","500"),g.appendChild(m),r.appendChild(a),r.appendChild(l),r.appendChild(g),i.appendChild(r)}))}}},240:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serializeViewportMeta=t.parseViewportMeta=void 0,t.parseViewportMeta=function(e){const t={},n=e.split(",");for(const e of n){const[n,r]=e.trim().split("=");switch(n.trim()){case"width":case"height":case"initial-scale":case"minimum-scale":case"maximum-scale":case"user-scalable":case"viewport-fit":t[n.trim()]=r.trim()}}return t},t.serializeViewportMeta=function(e){const t=[];for(const[n,r]of Object.entries(e))r&&t.push(`${n}=${r}`);return t.join(", ")}},983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get NFCIntegration(){return(0,s.getIntegration)("NFCIntegration")}isNfcSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,this.NFCIntegration.isNFCSupported()}))}startNfcScanner(){return new Promise((e=>{this.resolveStartNFCReader=e,this.NFCIntegration.startListening()}))}stopNfcScanner(){return new Promise((e=>{this.resolveStopNFCReader=e,this.NFCIntegration.stopListening()}))}nfcTagScannedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}stopListeningResult(e){this.resolveStopNFCReader(e),this.resolveStopNFCReader=null}isNFCSupportedResult(e){this.resolveNFCSupported(e),this.resolveNFCSupported=null}startListeningResult(e){this.resolveStartNFCReader(e),this.resolveStartNFCReader=null}}t.NFC=new i},681:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{p(r.next(e))}catch(e){i(e)}}function a(e){try{p(r.throw(e))}catch(e){i(e)}}function p(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}p((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=t.Topic=void 0;const s=n(466),i=n(715),o=n(913),a=n(900),p=n(607);class l extends i.EventTargetWithType{get pushNotificationIntegration(){return(0,a.getIntegration)("PushNotificationIntegration")}requestAccess(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,this.pushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,this.pushNotificationIntegration.getFCMToken()}))}getTopics(){return r(this,void 0,void 0,(function*(){const e={brand:yield p.default.App.brandId()},t=yield fetch(o.baseUrl+"/Topics-getTopics",{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to get topics");const n=yield t.json(),r=this.getSubscribedTopics();return n.map((({name:e,topic:t})=>new c(t,e,r.includes(t))))}))}renderTopics(){return r(this,void 0,void 0,(function*(){const e=yield this.getTopics(),t=document.getElementById("startiapp-topics-template");if(!t||"SCRIPT"!==t.tagName)throw new Error("Template element not found");if("x-tmpl-mustache"!==t.type)throw new Error('Template element must have type="x-tmpl-mustache"');const n=document.getElementById("startiapp-topics-target");if(!n||"DIV"!==n.tagName)throw new Error("Template target element not found");const i=t.innerHTML,o=(0,s.render)(i,{topics:e});n.innerHTML=o,n.querySelectorAll('input[type="checkbox"]').forEach((e=>{e.dataset.startiappTopic&&e.addEventListener("change",(t=>r(this,void 0,void 0,(function*(){if(!(yield this.requestAccess()))return t.target.checked=!1,void t.preventDefault();e.checked?this.subscribeToTopics([e.dataset.startiappTopic]):this.unsubscribeFromTopics([e.dataset.startiappTopic])}))))}))}))}subscribeToTopics(e){return r(this,void 0,void 0,(function*(){if(!(yield p.default.PushNotification.requestAccess()))throw console.warn("Push notification permissions denied"),new Error("Push notification permissions denied");const[t,n,r]=yield Promise.all([p.default.PushNotification.getToken(),p.default.App.brandId(),p.default.App.deviceId()]),s=[];e.forEach((e=>{const i={brandId:n,topic:e,fcmToken:t,deviceId:r},a=fetch(o.baseUrl+"/Topics-subscribeToTopic",{body:JSON.stringify(i),method:"POST",headers:{"Content-Type":"application/json"}});s.push(a)})),(yield Promise.all(s)).forEach(((t,n)=>{t.ok?this.updateSubscribedTopics(e[n],!0):console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return r(this,void 0,void 0,(function*(){const[t,n,r]=yield Promise.all([p.default.PushNotification.getToken(),p.default.App.brandId(),p.default.App.deviceId()]),s=[];e.forEach((e=>{const i={brandId:n,topic:e,fcmToken:t,deviceId:r},a=fetch(o.baseUrl+"/Topics-unsubscribeFromTopic",{body:JSON.stringify(i),method:"POST",headers:{"Content-Type":"application/json"}});s.push(a)})),(yield Promise.all(s)).forEach(((t,n)=>{t.ok?this.updateSubscribedTopics(e[n],!1):console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e),this.resolveRequestAccess=null}getFCMTokenResult(e){this.resolveFCMToken(e),this.resolveFCMToken=null}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}updateSubscribedTopics(e,t){const n=localStorage.getItem("startiapp-subscribed-topics")?JSON.parse(localStorage.getItem("startiapp-subscribed-topics")):[];t?n.includes(e)||n.push(e):n.includes(e)&&n.splice(n.indexOf(e),1),localStorage.setItem("startiapp-subscribed-topics",JSON.stringify(n))}getSubscribedTopics(){return localStorage.getItem("startiapp-subscribed-topics")?JSON.parse(localStorage.getItem("startiapp-subscribed-topics")):[]}}class c{constructor(e,t,n=!1){this.topic=e,this.name=t,this.subscribed=n}toJSON(){return{topic:this.topic,name:this.name,subscribed:this.subscribed}}subscribe(){t.PushNotification.subscribeToTopics([this.topic])}unsubscribe(){t.PushNotification.unsubscribeFromTopics([this.topic])}}t.Topic=c,t.PushNotification=new l},952:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get qrScannerIntegration(){return(0,s.getIntegration)("QrScannerIntegration")}scan(){return new Promise(((e,t)=>{this.resolveScan=e,this.qrScannerIntegration.startQrCodeScanner()}))}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e,this.qrScannerIntegration.isCameraAccessGranted()}))}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e,this.qrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e),this.resolveRequestCameraAccess=null}startQrCodeScannerResult(e){this.resolveScan(e),this.resolveScan=null}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e),this.resolveCameraAccessGranted=null}}t.QrScanner=new i},716:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const r=n(607),s=n(913),i=n(240);t.AppUI=new class{constructor(){this.options={allowDrag:!1,allowHighligt:!1,allowZoom:!1,allowScrollBounce:!1,allowRotation:!1,spinner:{show:!1},statusBar:{removeSafeArea:!0,hideText:!1,safeAreaBackgroundColor:"#000000",darkContent:!1}}}setOptions(e){this.options=Object.assign(Object.assign({},this.options),e),this.updateUI()}getOptions(){return this.options}updateViewportMeta(e){const t=document.querySelector("meta[name=viewport]");if(t){const n=(0,i.parseViewportMeta)(t.content);t.content=(0,i.serializeViewportMeta)(Object.assign(Object.assign({},n),e))}else{const t=document.createElement("meta");t.setAttribute("name","viewport"),t.setAttribute("content",(0,i.serializeViewportMeta)(e)),document.head.appendChild(t)}}updateUI(){this.styleString="";const e=document.getElementById(s.styleTagId);e&&e.remove();const t=Array.from(document.getElementsByTagName("img")),n=Array.from(document.getElementsByTagName("a"));this.options.allowDrag?[...t,...n].forEach((e=>{e.removeAttribute("draggable")})):[...t,...n].forEach((e=>{e.setAttribute("draggable","false")})),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||(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",this.updateViewportMeta({"user-scalable":"no"}));const i=document.createElement("style");i.textContent=this.styleString,i.setAttribute("id",s.styleTagId),document.body.appendChild(i),r.default.App.setStatusBar(this.options.statusBar),r.default.App.setSpinner(this.options.spinner),this.options.allowRotation?r.default.App.enableScreenRotation():r.default.App.disableScreenRotation()}}},634:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Share=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get shareIntegration(){return(0,s.getIntegration)("ShareIntegration")}shareFile(e,t){return new Promise(((n,r)=>{this.resolveShareFile=n,this.shareIntegration.shareFile(e,t)}))}shareText(e){return new Promise(((t,n)=>{this.resolveShareText=t,this.shareIntegration.shareText(e)}))}downloadFile(e,t){return new Promise(((n,r)=>{this.resolveDownloadText=n,this.shareIntegration.downloadFile(e,t)}))}shareFileResult(e){this.resolveShareFile(e),this.resolveShareFile=null}shareTextResult(e){this.resolveShareText(e),this.resolveShareText=null}downloadFileResult(e){this.resolveDownloadText(e),this.resolveDownloadText=null}}t.Share=new i}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(607);var e,t}));
2
+ !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={466:function(e){e.exports=function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function n(e){return"function"==typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function i(e,t){return null!=e&&"object"==typeof e&&t in e}var s=RegExp.prototype.test;var o=/\S/;function a(e){return!function(e,t){return s.call(e,t)}(o,e)}var c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};var l=/\s*/,p=/\s+/,u=/\s*=/,d=/\s*\}/,h=/#|\^|\/|>|\{|&|=|!/;function g(e){this.string=e,this.tail=e,this.pos=0}function v(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function m(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}g.prototype.eos=function(){return""===this.tail},g.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},g.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},v.prototype.push=function(e){return new v(e,this)},v.prototype.lookup=function(e){var t,r,s,o=this.cache;if(o.hasOwnProperty(e))t=o[e];else{for(var a,c,l,p=this,u=!1;p;){if(e.indexOf(".")>0)for(a=p.view,c=e.split("."),l=0;null!=a&&l<c.length;)l===c.length-1&&(u=i(a,c[l])||(r=a,s=c[l],null!=r&&"object"!=typeof r&&r.hasOwnProperty&&r.hasOwnProperty(s))),a=a[c[l++]];else a=p.view[e],u=i(p.view,e);if(u){t=a;break}p=p.parent}o[e]=t}return n(t)&&(t=t.call(this.view)),t},m.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},m.prototype.parse=function(e,n){var i=this.templateCache,s=e+":"+(n||f.tags).join(":"),o=void 0!==i,c=o?i.get(s):void 0;return null==c&&(c=function(e,n){if(!e)return[];var i,s,o,c=!1,v=[],m=[],y=[],w=!1,S=!1,b="",I=0;function C(){if(w&&!S)for(;y.length;)delete m[y.pop()];else y=[];w=!1,S=!1}function T(e){if("string"==typeof e&&(e=e.split(p,2)),!t(e)||2!==e.length)throw new Error("Invalid tags: "+e);i=new RegExp(r(e[0])+"\\s*"),s=new RegExp("\\s*"+r(e[1])),o=new RegExp("\\s*"+r("}"+e[1]))}T(n||f.tags);for(var E,P,A,x,N,k,_=new g(e);!_.eos();){if(E=_.pos,A=_.scanUntil(i))for(var R=0,O=A.length;R<O;++R)a(x=A.charAt(R))?(y.push(m.length),b+=x):(S=!0,c=!0,b+=" "),m.push(["text",x,E,E+1]),E+=1,"\n"===x&&(C(),b="",I=0,c=!1);if(!_.scan(i))break;if(w=!0,P=_.scan(h)||"name",_.scan(l),"="===P?(A=_.scanUntil(u),_.scan(u),_.scanUntil(s)):"{"===P?(A=_.scanUntil(o),_.scan(d),_.scanUntil(s),P="&"):A=_.scanUntil(s),!_.scan(s))throw new Error("Unclosed tag at "+_.pos);if(N=">"==P?[P,A,E,_.pos,b,I,c]:[P,A,E,_.pos],I++,m.push(N),"#"===P||"^"===P)v.push(N);else if("/"===P){if(!(k=v.pop()))throw new Error('Unopened section "'+A+'" at '+E);if(k[1]!==A)throw new Error('Unclosed section "'+k[1]+'" at '+E)}else"name"===P||"{"===P||"&"===P?S=!0:"="===P&&T(A)}if(C(),k=v.pop())throw new Error('Unclosed section "'+k[1]+'" at '+_.pos);return function(e){for(var t,n=[],r=n,i=[],s=0,o=e.length;s<o;++s)switch((t=e[s])[0]){case"#":case"^":r.push(t),i.push(t),r=t[4]=[];break;case"/":i.pop()[5]=t[2],r=i.length>0?i[i.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],i=0,s=e.length;i<s;++i)(t=e[i])&&("text"===t[0]&&n&&"text"===n[0]?(n[1]+=t[1],n[3]=t[3]):(r.push(t),n=t));return r}(m))}(e,n),o&&i.set(s,c)),c},m.prototype.render=function(e,t,n,r){var i=this.getConfigTags(r),s=this.parse(e,i),o=t instanceof v?t:new v(t,void 0);return this.renderTokens(s,o,n,e,r)},m.prototype.renderTokens=function(e,t,n,r,i){for(var s,o,a,c="",l=0,p=e.length;l<p;++l)a=void 0,"#"===(o=(s=e[l])[0])?a=this.renderSection(s,t,n,r,i):"^"===o?a=this.renderInverted(s,t,n,r,i):">"===o?a=this.renderPartial(s,t,n,i):"&"===o?a=this.unescapedValue(s,t):"name"===o?a=this.escapedValue(s,t,i):"text"===o&&(a=this.rawValue(s)),void 0!==a&&(c+=a);return c},m.prototype.renderSection=function(e,r,i,s,o){var a=this,c="",l=r.lookup(e[1]);if(l){if(t(l))for(var p=0,u=l.length;p<u;++p)c+=this.renderTokens(e[4],r.push(l[p]),i,s,o);else if("object"==typeof l||"string"==typeof l||"number"==typeof l)c+=this.renderTokens(e[4],r.push(l),i,s,o);else if(n(l)){if("string"!=typeof s)throw new Error("Cannot use higher-order sections without the original template");null!=(l=l.call(r.view,s.slice(e[3],e[5]),(function(e){return a.render(e,r,i,o)})))&&(c+=l)}else c+=this.renderTokens(e[4],r,i,s,o);return c}},m.prototype.renderInverted=function(e,n,r,i,s){var o=n.lookup(e[1]);if(!o||t(o)&&0===o.length)return this.renderTokens(e[4],n,r,i,s)},m.prototype.indentPartial=function(e,t,n){for(var r=t.replace(/[^ \t]/g,""),i=e.split("\n"),s=0;s<i.length;s++)i[s].length&&(s>0||!n)&&(i[s]=r+i[s]);return i.join("\n")},m.prototype.renderPartial=function(e,t,r,i){if(r){var s=this.getConfigTags(i),o=n(r)?r(e[1]):r[e[1]];if(null!=o){var a=e[6],c=e[5],l=e[4],p=o;0==c&&l&&(p=this.indentPartial(o,l,a));var u=this.parse(p,s);return this.renderTokens(u,t,r,p,i)}}},m.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},m.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||f.escape,i=t.lookup(e[1]);if(null!=i)return"number"==typeof i&&r===f.escape?String(i):r(i)},m.prototype.rawValue=function(e){return e[1]},m.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},m.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var f={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){y.templateCache=e},get templateCache(){return y.templateCache}},y=new m;return f.clearCache=function(){return y.clearCache()},f.parse=function(e,t){return y.parse(e,t)},f.render=function(e,n,r,i){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+((t(s=e)?"array":typeof s)+'" was given as the first argument for mustache#render(template, view, partials)'));var s;return y.render(e,n,r,i)},f.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return c[e]}))},f.Scanner=g,f.Context=v,f.Writer=m,f}()},715:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetWithType=void 0;class n extends EventTarget{addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}t.EventTargetWithType=n},752:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const r=n(715),i=n(900);class s extends r.EventTargetWithType{constructor(){super(...arguments),this.startiappIsLoaded=!1}get appIntegration(){return(0,i.getIntegration)("AppIntegration")}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){this.appIntegration.setAppUrl(e)}resetAppUrl(){this.appIntegration.resetAppUrl()}openExternalBrowser(e){this.appIntegration.openBrowser(e)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,this.appIntegration.brandId()}))}requestReview(){this.appIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,this.appIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,this.appIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,this.appIntegration.getInternalDomains()}))}addInternalDomain(e){this.appIntegration.addInternalDomain(e)}removeInternalDomain(e){this.appIntegration.removeInternalDomain(e)}showStatusBar(){if(void 0===this.appIntegration.showStatusBar)return console.warn("showStatusBar not implemented, please update your app to the latest version");this.appIntegration.showStatusBar()}hideStatusBar(){if(void 0===this.appIntegration.hideStatusBar)return console.warn("hideStatusBar not implemented, please update your app to the latest version");this.appIntegration.hideStatusBar()}setStatusBar(e){if(void 0===this.appIntegration.setStatusBar)return console.warn("setStatusBar not implemented, please update your app to the latest version");this.appIntegration.setStatusBar(e)}setSpinner(e){if(void 0===this.appIntegration.setNavigationSpinner)return console.warn("setNavigationSpinner not implemented, please update your app to the latest version");this.appIntegration.setNavigationSpinner({color:e.color,delay:e.afterMilliseconds,show:e.show})}hideSpinner(){if(!this.appIntegration.hideNavigationSpinner)return console.warn("hideNavigationSpinner not implemented, please update your app to the latest version");this.appIntegration.hideNavigationSpinner()}showSpinner(e){if(!this.appIntegration.showNavigationSpinner)return console.warn("showNavigationSpinner not implemented, please update your app to the latest version");this.appIntegration.showNavigationSpinner({color:null==e?void 0:e.color,delay:null==e?void 0:e.afterMilliseconds,show:null==e?void 0:e.show})}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,this.appIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){this.appIntegration.disableScreenRotation()}enableScreenRotation(){this.appIntegration.enableScreenRotation()}addExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.addExternalDomains(t)}removeExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.removeExternalDomains(t)}getExternalDomains(){return new Promise(((e,t)=>{this.resolveExternalDomains=e,this.appIntegration.getExternalDomains()}))}getExternalDomainsResult(e){this.resolveExternalDomains(e),this.resolveExternalDomains=null}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e),this.resolveBrandId=null}versionResult(e){this.resolveVersion(e),this.resolveVersion=null}deviceIdResult(e){this.resolveDeviceId(e),this.resolveDeviceId=null}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e),this.resolveSetSafeAreaBackgroundColor=null}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e),this.resolveGetInternalDomains=null}}t.App=new s},495:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const i=n(715),s=n(913),o=n(607);class a extends i.EventTargetWithType{registerId(e){return r(this,void 0,void 0,(function*(){const t=yield o.default.App.brandId(),n=yield o.default.App.deviceId(),r=yield o.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 i={brandId:t,clientUserId:e,deviceId:n,fcmToken:r},a=yield fetch(s.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(i),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,i),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}unregisterId(){return r(this,void 0,void 0,(function*(){const e={brandId:yield o.default.App.brandId(),deviceId:yield o.default.App.deviceId()},t=yield fetch(s.baseUrl+"/ClientUser-unregisterId",{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok)throw console.warn("Failed to unregister logged in client user",e),new Error(`Failed to unregister logged in client user: Firebase returned statuscode ${t.status}`)}))}}t.ClientUser=new a},913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.googleStorageBucket=t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net",t.styleTagId="startiapp-styling",t.googleStorageBucket="startiapp-admin-1fac2.appspot.com"},900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIntegration=void 0;let n={};t.getIntegration=function(e){if(n[e])return n[e];let t=window[e],r=0;for(;!t&&r<5;)t=window.parent[e],r++;if(!t)throw new Error(`Could not find integration ${e}`);return n[e]=t,t}},607:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(752),s=n(495),o=n(900),a=n(154),c=n(807),l=n(725),p=n(720),u=n(133),d=n(415),h=n(803),g=n(666),v=n(236),m=n(240),f=n(716),y=window;y.appIntegrationsAreReady=()=>{i.App.setStartiappIsLoaded(),S.dispatchEvent(new CustomEvent("ready"))},y.startiappDevice=l.Device,y.startiappApp=i.App,y.startiappUser=s.ClientUser,y.startiappQrScanner=d.QrScanner,y.startiappPushNotification=u.PushNotification,y.startiappNFC=p.NFC,y.startiappShare=h.Share,y.startiappBiometric=c.Biometrics,y.appErrorEvent=e=>{S.dispatchEvent(new CustomEvent("error",{detail:e}))};class w extends EventTarget{constructor(){super(...arguments),this.App=i.App,this.Device=l.Device,this.Biometrics=c.Biometrics,this.User=s.ClientUser,this.NfcScanner=p.NFC,this.PushNotification=u.PushNotification,this.QrScanner=d.QrScanner,this.Share=h.Share}get appIntegration(){return(0,o.getIntegration)("AppIntegration")}initialize(e){this.isRunningInApp()&&("function"==typeof gtag&&gtag("set","user_properties",{startiapp:"true"}),f.AppUI.setOptions(e),this.appIntegration.webAppIsReady())}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){if("ready"==e&&i.App.isStartiappLoaded()){const e=new CustomEvent("ready");"handleEvent"in t?t.handleEvent(e):t(e)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}const S=new w;if(document.body)b();else{const e=new MutationObserver((()=>b(e)));e.observe(document.documentElement,{childList:!0})}function b(e){if(!document.body)return;if((new g.SmartBanner).initialize(),S.isRunningInApp()?document.body.setAttribute("startiapp",""):document.body.removeAttribute("startiapp"),!document.head)return;const t=document.createElement("style");if(t.innerHTML="body:not([startiapp]) .startiapp-hide-in-browser,body:not([startiapp]) .startiapp-show-in-app,body[startiapp] .startiapp-hide-in-app,body[startiapp] .startiapp-show-in-browser{display:none!important}",document.head.appendChild(t),S.isRunningInApp()){const e={width:"device-width","viewport-fit":"cover"},t=document.querySelector("meta[name=viewport]");if(t){const n=(0,m.parseViewportMeta)(t.content);t.content=(0,m.serializeViewportMeta)(Object.assign(Object.assign({},n),e))}else{const t=document.createElement("meta");t.name="viewport",t.content=(0,m.serializeViewportMeta)(e),document.head.appendChild(t)}}e&&e.disconnect()}t.default=S,y.startiapp=S;const I=new v.TaskStepper;I.addTask(a.checkIfAppVersionIsClosed),S.addEventListener("ready",(()=>r(void 0,void 0,void 0,(function*(){yield I.start()}))))},154:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.checkIfAppVersionIsClosed=void 0;const i=n(752),s=n(900),o=new(n(718).ClosedVersionChecker);function a(){return r(this,void 0,void 0,(function*(){const e=yield o.getAvailableVersionsDocument();navigator.userAgent.indexOf("Apple")>-1?window.location.href="https://apps.apple.com/lt/app/"+e.iosStoreId:i.App.openExternalBrowser("https://play.google.com/store/apps/details?id="+e.androidStoreId)}))}t.checkIfAppVersionIsClosed=function(e){return r(this,void 0,void 0,(function*(){if(!(yield o.isCurrentVersionClosed()))return e();yield function(){return r(this,void 0,void 0,(function*(){const e=yield function(){return r(this,void 0,void 0,(function*(){const e=document.createElement("div");e.style.margin="10px";const t=document.createElement("h1");t.innerText="Der er kommet en opgradering til appen, som er nødvendig for at fortsætte.",e.appendChild(t);const n=document.createElement("center"),r=document.createElement("button");return r.innerText="Opgrader appen",r.onclick=a,n.appendChild(r),e.appendChild(n),e}))}();document.body.innerHTML="",document.body.appendChild(e),(0,s.getIntegration)("AppIntegration").webAppIsReady()}))}()}))}},807:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const r=n(715),i=n(900);class s extends r.EventTargetWithType{constructor(){super(...arguments),this.SECURED_CONTENT_KEY="STARTI_APP_BIOMETRIC_CONTENT",this.SECURED_LOGIN_KEY="STARTI_APP_BIOMETRIC_LOGIN_CONTENT",this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}get biometricIntegration(){return(0,i.getIntegration)("BiometricIntegration")}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveScan=n,this.biometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,this.biometricIntegration.getAuthenticationType()}))}setSecuredContent(e){this.biometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetContent=n,this.biometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,this.biometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){this.biometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){this.biometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){this.biometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,this.biometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetUsernamePassword=n,this.biometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.result);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}this.resolveGetUsernamePassword=null}hasSecuredContentResult({result:e,key:t}){if(t===this.SECURED_LOGIN_KEY)return this.resolveHasUsernameAndPassword(e),void(this.resolveHasUsernameAndPassword=null);this.resolveHasSecureContent(e),this.resolveHasSecureContent=null}getAuthenticationTypeResult(e){this.resolveAuthType(e),this.resolveAuthType=null}startScanningResult(e){this.resolveScan(e),this.resolveScan=null}getSecuredContentResult(e){if(e.key!==this.SECURED_LOGIN_KEY){try{const t=JSON.parse(e.result);this.resolveGetContent(t)}catch(t){this.resolveGetContent(e.result)}this.resolveGetContent=null}else this.handleResolveGetUsernamePassword(e)}}t.Biometrics=new s},725:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const r=n(715),i=n(900);class s extends r.EventTargetWithType{get deviceIntegration(){return(0,i.getIntegration)("DeviceIntegration")}startAccelerometer(){this.deviceIntegration.startAccelerometer()}stopAccelerometer(){this.deviceIntegration.stopAccelerometer()}isAccelerometerStarted(){return new Promise(((e,t)=>{this.deviceIntegration.isAccelerometerStarted(),this.resolveIsAccelerometerStarted=e}))}isAccelerometerStartedResult(e){this.resolveIsAccelerometerStarted(e),this.resolveIsAccelerometerStarted=null}onShakeEvent(){this.dispatchEvent(new CustomEvent("shake"))}}t.Device=new s},720:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const r=n(715),i=n(900);class s extends r.EventTargetWithType{get NFCIntegration(){return(0,i.getIntegration)("NFCIntegration")}isNfcSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,this.NFCIntegration.isNFCSupported()}))}startNfcScanner(){return new Promise((e=>{this.resolveStartNFCReader=e,this.NFCIntegration.startListening()}))}stopNfcScanner(){return new Promise((e=>{this.resolveStopNFCReader=e,this.NFCIntegration.stopListening()}))}nfcTagScannedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}stopListeningResult(e){this.resolveStopNFCReader(e),this.resolveStopNFCReader=null}isNFCSupportedResult(e){this.resolveNFCSupported(e),this.resolveNFCSupported=null}startListeningResult(e){this.resolveStartNFCReader(e),this.resolveStartNFCReader=null}}t.NFC=new s},133:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=t.Topic=void 0;const i=n(466),s=n(715),o=n(913),a=n(900),c=n(607);class l extends s.EventTargetWithType{get pushNotificationIntegration(){return(0,a.getIntegration)("PushNotificationIntegration")}requestAccess(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,this.pushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,this.pushNotificationIntegration.getFCMToken()}))}getTopics(){return r(this,void 0,void 0,(function*(){const e={brand:yield c.default.App.brandId()},t=yield fetch(o.baseUrl+"/Topics-getTopics",{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to get topics");const n=yield t.json(),r=this.getSubscribedTopics();return n.map((({name:e,topic:t})=>new p(t,e,r.includes(t))))}))}renderTopics(){return r(this,void 0,void 0,(function*(){const e=yield this.getTopics(),t=document.getElementById("startiapp-topics-template");if(!t||"SCRIPT"!==t.tagName)throw new Error("Template element not found");if("x-tmpl-mustache"!==t.type)throw new Error('Template element must have type="x-tmpl-mustache"');const n=document.getElementById("startiapp-topics-target");if(!n||"DIV"!==n.tagName)throw new Error("Template target element not found");const s=t.innerHTML,o=(0,i.render)(s,{topics:e});n.innerHTML=o,n.querySelectorAll('input[type="checkbox"]').forEach((e=>{e.dataset.startiappTopic&&e.addEventListener("change",(t=>r(this,void 0,void 0,(function*(){if(!(yield this.requestAccess()))return t.target.checked=!1,void t.preventDefault();e.checked?this.subscribeToTopics([e.dataset.startiappTopic]):this.unsubscribeFromTopics([e.dataset.startiappTopic])}))))}))}))}subscribeToTopics(e){return r(this,void 0,void 0,(function*(){if(!(yield c.default.PushNotification.requestAccess()))throw console.warn("Push notification permissions denied"),new Error("Push notification permissions denied");const[t,n,r]=yield Promise.all([c.default.PushNotification.getToken(),c.default.App.brandId(),c.default.App.deviceId()]),i=[];e.forEach((e=>{const s={brandId:n,topic:e,fcmToken:t,deviceId:r},a=fetch(o.baseUrl+"/Topics-subscribeToTopic",{body:JSON.stringify(s),method:"POST",headers:{"Content-Type":"application/json"}});i.push(a)})),(yield Promise.all(i)).forEach(((t,n)=>{t.ok?this.updateSubscribedTopics(e[n],!0):console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return r(this,void 0,void 0,(function*(){const[t,n,r]=yield Promise.all([c.default.PushNotification.getToken(),c.default.App.brandId(),c.default.App.deviceId()]),i=[];e.forEach((e=>{const s={brandId:n,topic:e,fcmToken:t,deviceId:r},a=fetch(o.baseUrl+"/Topics-unsubscribeFromTopic",{body:JSON.stringify(s),method:"POST",headers:{"Content-Type":"application/json"}});i.push(a)})),(yield Promise.all(i)).forEach(((t,n)=>{t.ok?this.updateSubscribedTopics(e[n],!1):console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e),this.resolveRequestAccess=null}getFCMTokenResult(e){this.resolveFCMToken(e),this.resolveFCMToken=null}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}updateSubscribedTopics(e,t){const n=localStorage.getItem("startiapp-subscribed-topics")?JSON.parse(localStorage.getItem("startiapp-subscribed-topics")):[];t?n.includes(e)||n.push(e):n.includes(e)&&n.splice(n.indexOf(e),1),localStorage.setItem("startiapp-subscribed-topics",JSON.stringify(n))}getSubscribedTopics(){return localStorage.getItem("startiapp-subscribed-topics")?JSON.parse(localStorage.getItem("startiapp-subscribed-topics")):[]}}class p{constructor(e,t,n=!1){this.topic=e,this.name=t,this.subscribed=n}toJSON(){return{topic:this.topic,name:this.name,subscribed:this.subscribed}}subscribe(){t.PushNotification.subscribeToTopics([this.topic])}unsubscribe(){t.PushNotification.unsubscribeFromTopics([this.topic])}}t.Topic=p,t.PushNotification=new l},415:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const r=n(715),i=n(900);class s extends r.EventTargetWithType{get qrScannerIntegration(){return(0,i.getIntegration)("QrScannerIntegration")}scan(){return new Promise(((e,t)=>{this.resolveScan=e,this.qrScannerIntegration.startQrCodeScanner()}))}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e,this.qrScannerIntegration.isCameraAccessGranted()}))}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e,this.qrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e),this.resolveRequestCameraAccess=null}startQrCodeScannerResult(e){this.resolveScan(e),this.resolveScan=null}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e),this.resolveCameraAccessGranted=null}}t.QrScanner=new s},803:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Share=void 0;const r=n(715),i=n(900);class s extends r.EventTargetWithType{get shareIntegration(){return(0,i.getIntegration)("ShareIntegration")}shareFile(e,t){return new Promise(((n,r)=>{this.resolveShareFile=n,this.shareIntegration.shareFile(e,t)}))}shareText(e){return new Promise(((t,n)=>{this.resolveShareText=t,this.shareIntegration.shareText(e)}))}downloadFile(e,t){return new Promise(((n,r)=>{this.resolveDownloadText=n,this.shareIntegration.downloadFile(e,t)}))}shareFileResult(e){this.resolveShareFile(e),this.resolveShareFile=null}shareTextResult(e){this.resolveShareText(e),this.resolveShareText=null}downloadFileResult(e){this.resolveDownloadText(e),this.resolveDownloadText=null}}t.Share=new s},718:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClosedVersionChecker=void 0;const i=n(752),s=n(913),o=n(703);t.ClosedVersionChecker=class{constructor(){this.documentData=null}getAvailableVersionsUrl(){return r(this,void 0,void 0,(function*(){const e=yield i.App.brandId();return`https://storage.googleapis.com/${s.googleStorageBucket}/availableVersions/${encodeURIComponent(e)}.json`}))}getAvailableVersionsDocument(){return r(this,void 0,void 0,(function*(){if(null!=this.documentData)return this.documentData;const e=yield this.getAvailableVersionsUrl(),t=yield fetch(e),n=yield t.json();return this.documentData=n,n}))}getCurrentVersionSemver(){return r(this,void 0,void 0,(function*(){const e=yield i.App.version();return new o.SemVer(e)}))}getLatestVersionSemvar(e){return e.reduce(((e,t)=>t.isGreaterThan(e)?t:e),new o.SemVer("0.0.0"))}isCurrentVersionClosed(){return r(this,void 0,void 0,(function*(){const e=yield this.getCurrentVersionSemver(),t=yield this.getAvailableVersionsDocument();if(t.versions.includes(e.toString()))return!1;const n=t.versions.map((e=>new o.SemVer(e))),r=this.getLatestVersionSemvar(n);return!e.isGreaterThanOrEqualTo(r)}))}}},703:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SemVer=void 0,t.SemVer=class{constructor(e){if(this.version=e,!this.isValidVersion(e))throw new Error(`Invalid version: ${e}`);const t=e.split(".");this.major=parseInt(t[0]),this.minor=parseInt(t[1]),this.patch=parseInt(t[2])}isValidVersion(e){const t=e.split(".");return!(t.length<3||isNaN(parseInt(t[0]))||isNaN(parseInt(t[1]))||isNaN(parseInt(t[2])))}isGreaterThan(e){return this.major>e.major||!(this.major<e.major)&&(this.minor>e.minor||!(this.minor<e.minor)&&(this.patch>e.patch||(this.patch,e.patch,!1)))}isGreaterThanOrEqualTo(e){return this.isGreaterThan(e)||this.isEqualTo(e)}isEqualTo(e){return this.major===e.major&&this.minor===e.minor&&this.patch===e.patch}toString(){return this.version}}},666:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SmartBanner=void 0;const i=n(607),s=n(913);t.SmartBanner=class{constructor(){this.marginTop="72px"}getHostDomain(){const e=window.location.host.split(".");return e.slice(e.length-2).join(".")}getSmartBannerDataUrl(){const e=this.getHostDomain();return`https://storage.googleapis.com/${s.googleStorageBucket}/smartbanner/${encodeURIComponent(e)}.json`}getSmartBannerData(){return r(this,void 0,void 0,(function*(){try{const e=yield fetch(this.getSmartBannerDataUrl());return yield e.json()}catch(e){return e instanceof SyntaxError||console.error("SmartBanner error",e),{enabled:!1,appName:"",appIcon:"",appleAppId:"",googlePlayAppId:""}}}))}getSmartBannerClosed(){const e=localStorage.getItem("startiapp-smart-banner-closed-at");return!!(e&&Date.now()-parseInt(e)<6048e5)}setSmartBannerClosed(e=!1){localStorage.setItem("startiapp-smart-banner-closed-at",e?Date.now()+2592e6+"":Date.now().toString())}initialize(){return r(this,void 0,void 0,(function*(){if(i.default.isRunningInApp())return;const e=(()=>{const e=navigator.userAgent;return/android/i.test(e)?"Android":/iPad|iPhone|iPod/.test(e)?"iOS":"Other"})();if("Other"===e)return;const t=document.querySelector("html");if(!t)return;if(this.getSmartBannerClosed())return;const n=yield this.getSmartBannerData();if(!n.enabled)return;t.style.setProperty("margin-top",this.marginTop,"important");const r=document.createElement("div");switch(r.id="startiapp-smart-banner-wrapper",r.style.setProperty("position","fixed","important"),r.style.setProperty("top","0","important"),r.style.setProperty("left","0","important"),r.style.setProperty("right","0","important"),r.style.setProperty("height",this.marginTop,"important"),r.style.setProperty("width","100%","important"),r.style.setProperty("background-color","#f2f1f6","important"),r.style.setProperty("z-index","999999999","important"),r.style.setProperty("border-bottom","1px solid #dadade","important"),e){case"iOS":yield this.createIosBannerContent(n,r);break;case"Android":yield this.createAndroidBannerContent(n,r);break;default:return void console.warn("Unknown platform",e)}document.body.appendChild(r)}))}createIosBannerContent(e,t){return r(this,void 0,void 0,(function*(){this.createContent(e.appName,e.appIcon,`https://apps.apple.com/us/app/id${e.appleAppId}`,"App Store",t,e.appDetails)}))}createAndroidBannerContent(e,t){return r(this,void 0,void 0,(function*(){this.createContent(e.appName,e.appIcon,`market://details?id=${e.googlePlayAppId}`,"Play Store",t,e.appDetails)}))}createContent(e,t,n,i,s,o){return r(this,void 0,void 0,(function*(){0===(null==o?void 0:o.length)&&(o=void 0);const r=document.createElement("div");r.style.setProperty("display","grid","important"),r.id="startiapp-smart-banner-grid",r.style.setProperty("grid-template-columns","30px auto auto","important"),r.style.setProperty("height","100%","important"),r.style.setProperty("width","100%","important"),r.style.setProperty("font-family","sans-serif","important");const a=document.createElement("div");a.id="startiapp-smart-banner-close-button",a.style.setProperty("grid-column","1"),a.style.setProperty("grid-row","1"),a.style.setProperty("height","100%"),a.style.setProperty("width","100%"),a.style.setProperty("display","flex"),a.style.setProperty("justify-content","center"),a.style.setProperty("align-items","center"),a.onclick=()=>{var e,t;s.remove(),null===(e=document.querySelector("html"))||void 0===e||e.style.setProperty("transition","margin-top 0.3s ease-in-out"),null===(t=document.querySelector("html"))||void 0===t||t.style.removeProperty("margin-top"),this.setSmartBannerClosed()};const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("id","close-smart-banner"),c.setAttribute("style","height: 16px; width: 16px;"),c.setAttribute("viewBox","0 0 24 24"),c.setAttribute("fill","none"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.innerHTML='\n\t\t\t<path d="M18 6L6 18" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t<path d="M6 6L18 18" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t',a.appendChild(c);const l=document.createElement("div");l.id="startiapp-smart-banner-image",l.style.setProperty("grid-column","2"),l.style.setProperty("grid-row","1"),l.style.setProperty("height","100%"),l.style.setProperty("width","100%"),l.style.setProperty("display","flex"),l.style.setProperty("justify-content","start"),l.style.setProperty("align-items","center");const p=document.createElement("img");p.id="startiapp-smart-banner-app-icon",p.src=t,p.style.setProperty("height","54px"),p.style.setProperty("width","54px"),p.style.setProperty("object-fit","scale-down");const u=document.createElement("div");u.id="startiapp-smart-banner-app-name-container",u.style.setProperty("display","flex"),u.style.setProperty("flex-direction","column");const d=document.createElement("span");d.id="startiapp-smart-banner-app-name",d.style.setProperty("margin-left","8px"),d.style.setProperty("font-size","16px"),d.style.setProperty("font-weight","500"),d.textContent=e;const h=document.createElement("span");h.id="startiapp-smart-banner-app-details",h.style.setProperty("margin-left","8px"),h.style.setProperty("font-size","16px"),h.style.setProperty("font-weight","500"),h.textContent=null!=o?o:`GET — on the ${i}`,u.appendChild(d),u.appendChild(h),l.appendChild(p),l.appendChild(u);const g=document.createElement("div");g.style.setProperty("grid-column","3"),g.style.setProperty("grid-row","1"),g.style.setProperty("height","100%"),g.style.setProperty("width","100%"),g.style.setProperty("display","flex"),g.style.setProperty("justify-content","center"),g.style.setProperty("align-items","center");const v=document.createElement("a");v.href=n,v.target="_blank",v.textContent="Vis",v.style.setProperty("text-decoration","none"),v.style.setProperty("color","#000"),v.style.setProperty("font-size","16px"),v.style.setProperty("font-weight","500"),g.appendChild(v),r.appendChild(a),r.appendChild(l),r.appendChild(g),s.appendChild(r)}))}}},236:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TaskStepper=void 0,t.TaskStepper=class{constructor(){this.tasks=[]}addTask(e){this.tasks.push(e)}start(){return n(this,void 0,void 0,(function*(){const e=[...this.tasks];yield this.runTasks(e)}))}runTasks(e){return n(this,void 0,void 0,(function*(){if(0===e.length)return;const t=e.shift();if(null!=t)try{yield t((()=>this.runTasks(e)))}catch(t){this.runTasks(e)}}))}}},240:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serializeViewportMeta=t.parseViewportMeta=void 0,t.parseViewportMeta=function(e){const t={},n=e.split(",");for(const e of n){const[n,r]=e.trim().split("=");switch(n.trim()){case"width":case"height":case"initial-scale":case"minimum-scale":case"maximum-scale":case"user-scalable":case"viewport-fit":t[n.trim()]=r.trim()}}return t},t.serializeViewportMeta=function(e){const t=[];for(const[n,r]of Object.entries(e))r&&t.push(`${n}=${r}`);return t.join(", ")}},716:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const r=n(607),i=n(913),s=n(240);t.AppUI=new class{constructor(){this.options={allowDrag:!1,allowHighligt:!1,allowZoom:!1,allowScrollBounce:!1,allowRotation:!1,spinner:{show:!1},statusBar:{removeSafeArea:!0,hideText:!1,safeAreaBackgroundColor:"#000000",darkContent:!1}}}setOptions(e){this.options=Object.assign(Object.assign({},this.options),e),this.updateUI()}getOptions(){return this.options}updateViewportMeta(e){const t=document.querySelector("meta[name=viewport]");if(t){const n=(0,s.parseViewportMeta)(t.content);t.content=(0,s.serializeViewportMeta)(Object.assign(Object.assign({},n),e))}else{const t=document.createElement("meta");t.setAttribute("name","viewport"),t.setAttribute("content",(0,s.serializeViewportMeta)(e)),document.head.appendChild(t)}}updateUI(){this.styleString="";const e=document.getElementById(i.styleTagId);e&&e.remove();const t=Array.from(document.getElementsByTagName("img")),n=Array.from(document.getElementsByTagName("a"));this.options.allowDrag?[...t,...n].forEach((e=>{e.removeAttribute("draggable")})):[...t,...n].forEach((e=>{e.setAttribute("draggable","false")})),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||(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",this.updateViewportMeta({"user-scalable":"no"}));const s=document.createElement("style");s.textContent=this.styleString,s.setAttribute("id",i.styleTagId),document.body.appendChild(s),r.default.App.setStatusBar(this.options.statusBar),r.default.App.setSpinner(this.options.spinner),this.options.allowRotation?r.default.App.enableScreenRotation():r.default.App.disableScreenRotation()}}}},t={},function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}(607);var e,t}));