starti.app 1.0.51 → 1.0.52-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/EventHandlerWithTypes.d.ts +1 -1
- package/dist/app.d.ts +10 -6
- package/dist/app.js +2 -1
- package/dist/biometrics.d.ts +3 -2
- package/dist/biometrics.js +2 -1
- package/dist/clientUser.d.ts +0 -6
- package/dist/clientUser.js +5 -2
- package/dist/device.d.ts +5 -6
- package/dist/device.js +2 -1
- package/dist/nfc.d.ts +2 -2
- package/dist/pushnotification.d.ts +18 -6
- package/dist/pushnotification.js +34 -4
- package/dist/qrscanner.d.ts +3 -6
- package/dist/qrscanner.js +2 -1
- package/package.json +1 -1
- package/umd/main.js +1 -1
|
@@ -2,4 +2,4 @@ export declare class EventTargetWithType<T extends Record<any, Event>> extends E
|
|
|
2
2
|
addEventListener<K extends keyof T>(type: K, callback: EventListenerOrEventListenerObjectWithType<T[K]>, options?: boolean | AddEventListenerOptions): void;
|
|
3
3
|
removeEventListener<K extends keyof T>(type: K, callback: EventListenerOrEventListenerObjectWithType<T[K]>, options?: boolean | EventListenerOptions): void;
|
|
4
4
|
}
|
|
5
|
-
export declare type EventTargetMethods<T extends
|
|
5
|
+
export declare type EventTargetMethods<T extends Record<any, Event>> = Pick<EventTargetWithType<T>, 'addEventListener' | 'removeEventListener'>;
|
package/dist/app.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
|
|
1
2
|
export declare const App: IApp;
|
|
2
|
-
declare type
|
|
3
|
-
|
|
3
|
+
declare type NavigatingPageEvent = {
|
|
4
|
+
url: string;
|
|
5
|
+
opensExternalbrowser: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare type AppEvents = {
|
|
8
|
+
appInForeground: CustomEvent<never>;
|
|
9
|
+
navigatingPage: CustomEvent<NavigatingPageEvent>;
|
|
10
|
+
};
|
|
11
|
+
export interface IApp extends EventTargetMethods<AppEvents> {
|
|
4
12
|
/** Request the user reviews the app. */
|
|
5
13
|
requestReview: () => void;
|
|
6
14
|
/** Downloads the given file. */
|
|
@@ -29,10 +37,6 @@ export interface IApp {
|
|
|
29
37
|
disableScreenRotation(): void;
|
|
30
38
|
/** Enable screen rotation */
|
|
31
39
|
enableScreenRotation(): void;
|
|
32
|
-
/** Listen for events */
|
|
33
|
-
addEventListener(type: AppEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
34
|
-
/** Remove event listener */
|
|
35
|
-
removeEventListener(type: AppEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
36
40
|
/** Get internal domains */
|
|
37
41
|
getInternalDomains(): Promise<string[]>;
|
|
38
42
|
/** Add internal domain */
|
package/dist/app.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.App = void 0;
|
|
4
|
+
const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
|
|
4
5
|
const getIntegration_1 = require("./getIntegration");
|
|
5
|
-
class AppClass extends
|
|
6
|
+
class AppClass extends EventHandlerWithTypes_1.EventTargetWithType {
|
|
6
7
|
constructor() {
|
|
7
8
|
super(...arguments);
|
|
8
9
|
this.startiappIsLoaded = false;
|
package/dist/biometrics.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { EventTargetMethods } from './@types/EventHandlerWithTypes';
|
|
2
|
+
declare type BiometricsEvents = {};
|
|
2
3
|
export declare const Biometrics: IBiometrics;
|
|
3
|
-
export interface IBiometrics {
|
|
4
|
+
export interface IBiometrics extends EventTargetMethods<BiometricsEvents> {
|
|
4
5
|
/** Start scanning for biometrics */
|
|
5
6
|
scan(title?: string, reason?: string): Promise<boolean>;
|
|
6
7
|
/** Get the type of biometrics used */
|
package/dist/biometrics.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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");
|
|
4
5
|
const getIntegration_1 = require("./getIntegration");
|
|
5
|
-
class BiometricsClass extends
|
|
6
|
+
class BiometricsClass extends EventHandlerWithTypes_1.EventTargetWithType {
|
|
6
7
|
constructor() {
|
|
7
8
|
super(...arguments);
|
|
8
9
|
this.SECURED_CONTENT_KEY = "STARTI_APP_BIOMETRIC_CONTENT";
|
package/dist/clientUser.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
export declare const ClientUser: IClientUser;
|
|
2
|
-
declare type ClientUserEvents = "";
|
|
3
2
|
export interface IClientUser {
|
|
4
|
-
/** Listen for events */
|
|
5
|
-
addEventListener(type: ClientUserEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
6
|
-
/** Remove event listener */
|
|
7
|
-
removeEventListener(type: ClientUserEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
8
3
|
/** Register the ID of a logged in client user (end user) */
|
|
9
4
|
registerId(clientUserId: string): Promise<void>;
|
|
10
5
|
}
|
|
11
|
-
export {};
|
package/dist/clientUser.js
CHANGED
|
@@ -10,9 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ClientUser = void 0;
|
|
13
|
+
const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
|
|
13
14
|
const config_1 = require("./config");
|
|
14
15
|
const index_1 = require("./index");
|
|
15
|
-
|
|
16
|
+
class ClientUserClass extends EventHandlerWithTypes_1.EventTargetWithType {
|
|
16
17
|
registerId(clientUserId) {
|
|
17
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
19
|
const brandId = yield index_1.default.App.brandId();
|
|
@@ -39,4 +40,6 @@ exports.ClientUser = new class extends EventTarget {
|
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
}
|
|
43
|
+
}
|
|
44
|
+
;
|
|
45
|
+
exports.ClientUser = new ClientUserClass();
|
package/dist/device.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
|
|
1
2
|
export declare const Device: IDevice;
|
|
2
|
-
declare type DeviceEvents =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** Remove event listener */
|
|
7
|
-
removeEventListener(type: DeviceEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
3
|
+
declare type DeviceEvents = {
|
|
4
|
+
shake: CustomEvent<never>;
|
|
5
|
+
};
|
|
6
|
+
export interface IDevice extends EventTargetMethods<DeviceEvents> {
|
|
8
7
|
/**
|
|
9
8
|
* Start accelerometer
|
|
10
9
|
*
|
package/dist/device.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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");
|
|
4
5
|
const getIntegration_1 = require("./getIntegration");
|
|
5
|
-
class DeviceClass extends
|
|
6
|
+
class DeviceClass extends EventHandlerWithTypes_1.EventTargetWithType {
|
|
6
7
|
get deviceIntegration() {
|
|
7
8
|
return (0, getIntegration_1.getIntegration)('DeviceIntegration');
|
|
8
9
|
}
|
package/dist/nfc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventTargetMethods
|
|
1
|
+
import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
|
|
2
2
|
export declare const NFC: INFC;
|
|
3
3
|
declare type NfcTagResultRecived = Array<{
|
|
4
4
|
mimeType: string;
|
|
@@ -8,7 +8,7 @@ declare type NfcTagResultRecived = Array<{
|
|
|
8
8
|
declare type NFCEvents = {
|
|
9
9
|
nfcTagScanned: CustomEvent<NfcTagResultRecived>;
|
|
10
10
|
};
|
|
11
|
-
export interface INFC extends EventTargetMethods<
|
|
11
|
+
export interface INFC extends EventTargetMethods<NFCEvents> {
|
|
12
12
|
/** Check if the device supports NFC */
|
|
13
13
|
isNfcSupported(): Promise<boolean>;
|
|
14
14
|
/** Start scanning for NFC tags */
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
|
|
2
|
+
export declare class Topic {
|
|
3
|
+
topic: string;
|
|
4
|
+
name: string;
|
|
5
|
+
constructor(topic: string, name: string);
|
|
6
|
+
subscribe(): void;
|
|
7
|
+
unsubscribe(): void;
|
|
8
|
+
}
|
|
1
9
|
export declare const PushNotification: IPushNotification;
|
|
2
|
-
declare type PushNotificationEvents =
|
|
3
|
-
|
|
10
|
+
declare type PushNotificationEvents = {
|
|
11
|
+
tokenRefreshed: CustomEvent<string>;
|
|
12
|
+
notificationReceived: CustomEvent<{
|
|
13
|
+
title: string;
|
|
14
|
+
body: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
export interface IPushNotification extends EventTargetMethods<PushNotificationEvents> {
|
|
4
18
|
/** This method requests the user for permissions to use push notifications */
|
|
5
19
|
requestAccess(): Promise<boolean>;
|
|
6
20
|
/** This method returns the token which should be used to send push notifications. */
|
|
7
21
|
getToken(): Promise<string>;
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/** Remove event listener */
|
|
11
|
-
removeEventListener(type: PushNotificationEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
22
|
+
/** This method returns the topics which are available for the current brand. */
|
|
23
|
+
getTopics(): Promise<Topic[]>;
|
|
12
24
|
/** Subscribe to firebase topic */
|
|
13
25
|
subscribeToTopics(topics: string[]): void;
|
|
14
26
|
/** Unsubscribe from firebase topic */
|
package/dist/pushnotification.js
CHANGED
|
@@ -9,11 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PushNotification = void 0;
|
|
12
|
+
exports.PushNotification = exports.Topic = void 0;
|
|
13
|
+
const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
|
|
13
14
|
const config_1 = require("./config");
|
|
14
15
|
const getIntegration_1 = require("./getIntegration");
|
|
15
16
|
const index_1 = require("./index");
|
|
16
|
-
class PushNotificationClass extends
|
|
17
|
+
class PushNotificationClass extends EventHandlerWithTypes_1.EventTargetWithType {
|
|
17
18
|
get pushNotificationIntegration() {
|
|
18
19
|
return (0, getIntegration_1.getIntegration)('PushNotificationIntegration');
|
|
19
20
|
}
|
|
@@ -31,6 +32,22 @@ class PushNotificationClass extends EventTarget {
|
|
|
31
32
|
this.pushNotificationIntegration.getFCMToken();
|
|
32
33
|
});
|
|
33
34
|
}
|
|
35
|
+
getTopics() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const brandId = yield index_1.default.App.brandId();
|
|
38
|
+
const params = {
|
|
39
|
+
brand: brandId
|
|
40
|
+
};
|
|
41
|
+
const response = yield fetch(config_1.baseUrl + '/Newsletter-getTopics', {
|
|
42
|
+
body: JSON.stringify(params)
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
throw new Error('Failed to get topics');
|
|
46
|
+
}
|
|
47
|
+
const topics = yield response.json();
|
|
48
|
+
return topics.map(({ name, topic }) => new Topic(topic, name));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
34
51
|
subscribeToTopics(topics) {
|
|
35
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
53
|
this.pushNotificationIntegration.firebasePushNotificationSubscribeToTopics(topics);
|
|
@@ -45,7 +62,7 @@ class PushNotificationClass extends EventTarget {
|
|
|
45
62
|
token: token,
|
|
46
63
|
deviceId: deviceId
|
|
47
64
|
};
|
|
48
|
-
const fetchPromise = fetch(config_1.baseUrl + '/
|
|
65
|
+
const fetchPromise = fetch(config_1.baseUrl + '/Newsletter-subscribeToTopic', {
|
|
49
66
|
body: JSON.stringify(params)
|
|
50
67
|
});
|
|
51
68
|
fetchPromises.push(fetchPromise);
|
|
@@ -72,7 +89,7 @@ class PushNotificationClass extends EventTarget {
|
|
|
72
89
|
token: token,
|
|
73
90
|
deviceId: deviceId
|
|
74
91
|
};
|
|
75
|
-
const fetchPromise = fetch(config_1.baseUrl + '/
|
|
92
|
+
const fetchPromise = fetch(config_1.baseUrl + '/Newsletter-unSubscribeFromTopic', {
|
|
76
93
|
body: JSON.stringify(params)
|
|
77
94
|
});
|
|
78
95
|
fetchPromises.push(fetchPromise);
|
|
@@ -109,4 +126,17 @@ class PushNotificationClass extends EventTarget {
|
|
|
109
126
|
firebasePushNotificationSubscribeToTopicsResult(result) { }
|
|
110
127
|
}
|
|
111
128
|
;
|
|
129
|
+
class Topic {
|
|
130
|
+
constructor(topic, name) {
|
|
131
|
+
this.topic = topic;
|
|
132
|
+
this.name = name;
|
|
133
|
+
}
|
|
134
|
+
subscribe() {
|
|
135
|
+
exports.PushNotification.subscribeToTopics([this.topic]);
|
|
136
|
+
}
|
|
137
|
+
unsubscribe() {
|
|
138
|
+
exports.PushNotification.unsubscribeFromTopics([this.topic]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.Topic = Topic;
|
|
112
142
|
exports.PushNotification = new PushNotificationClass();
|
package/dist/qrscanner.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { EventTargetMethods } from "./@types/EventHandlerWithTypes";
|
|
1
2
|
export declare const QrScanner: IQrScanner;
|
|
2
|
-
declare type QrScannerEvents =
|
|
3
|
-
export interface IQrScanner {
|
|
3
|
+
declare type QrScannerEvents = {};
|
|
4
|
+
export interface IQrScanner extends EventTargetMethods<QrScannerEvents> {
|
|
4
5
|
/** Opens the camera on the phone og starts scanning after QR- and barcodes.
|
|
5
6
|
* When the camera has scanned a code the camera will be closed and the client user will be back on the website.*/
|
|
6
7
|
scan(): Promise<string>;
|
|
7
|
-
/** Listen for events */
|
|
8
|
-
addEventListener(type: QrScannerEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
9
|
-
/** Remove event listener */
|
|
10
|
-
removeEventListener(type: QrScannerEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
11
8
|
/** Checks if the phone has granted access to camera */
|
|
12
9
|
isCameraAccessGranted(): Promise<boolean>;
|
|
13
10
|
/** Requests access to the phone camera */
|
package/dist/qrscanner.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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");
|
|
4
5
|
const getIntegration_1 = require("./getIntegration");
|
|
5
|
-
class QrScannerClass extends
|
|
6
|
+
class QrScannerClass extends EventHandlerWithTypes_1.EventTargetWithType {
|
|
6
7
|
get qrScannerIntegration() {
|
|
7
8
|
return (0, getIntegration_1.getIntegration)('QrScannerIntegration');
|
|
8
9
|
}
|
package/package.json
CHANGED
package/umd/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var s in n)("object"==typeof exports?exports:e)[s]=n[s]}}(self,(()=>(()=>{"use strict";var e={715:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetWithType=void 0;class n extends EventTarget{addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}t.EventTargetWithType=n},752:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const s=n(900);class r extends EventTarget{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)}downloadFile(e,t){this.appIntegration.download(e,t)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,this.appIntegration.brandId()}))}requestReview(){this.appIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,this.appIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,this.appIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,this.appIntegration.getInternalDomains()}))}addInternalDomain(e){this.appIntegration.addInternalDomain(e)}removeInternalDomain(e){this.appIntegration.removeInternalDomain(e)}showStatusBar(){this.appIntegration.showStatusBar()}hideStatusBar(){this.appIntegration.hideStatusBar()}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,this.appIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){this.appIntegration.disableScreenRotation()}enableScreenRotation(){this.appIntegration.enableScreenRotation()}addExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.addExternalDomains(t)}removeExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.removeExternalDomains(t)}getExternalDomains(){return new Promise(((e,t)=>{this.resolveExternalDomains=e,this.appIntegration.getExternalDomains()}))}getExternalDomainsResult(e){this.resolveExternalDomains(e),this.resolveExternalDomains=null}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e),this.resolveBrandId=null}versionResult(e){this.resolveVersion(e),this.resolveVersion=null}deviceIdResult(e){this.resolveDeviceId(e),this.resolveDeviceId=null}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e),this.resolveSetSafeAreaBackgroundColor=null}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e),this.resolveGetInternalDomains=null}}t.App=new r},1:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const s=n(900);class r extends EventTarget{constructor(){super(...arguments),this.SECURED_CONTENT_KEY="STARTI_APP_BIOMETRIC_CONTENT",this.SECURED_LOGIN_KEY="STARTI_APP_BIOMETRIC_LOGIN_CONTENT",this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}get biometricIntegration(){return(0,s.getIntegration)("BiometricIntegration")}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveScan=n,this.biometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,this.biometricIntegration.getAuthenticationType()}))}setSecuredContent(e){this.biometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetContent=n,this.biometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,this.biometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){this.biometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){this.biometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){this.biometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,this.biometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetUsernamePassword=n,this.biometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.result);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}this.resolveGetUsernamePassword=null}hasSecuredContentResult({result:e,key:t}){if(t===this.SECURED_LOGIN_KEY)return this.resolveHasUsernameAndPassword(e),void(this.resolveHasUsernameAndPassword=null);this.resolveHasSecureContent(e),this.resolveHasSecureContent=null}getAuthenticationTypeResult(e){this.resolveAuthType(e),this.resolveAuthType=null}startScanningResult(e){this.resolveScan(e),this.resolveScan=null}getSecuredContentResult(e){if(e.key!==this.SECURED_LOGIN_KEY){try{const t=JSON.parse(e.result);this.resolveGetContent(t)}catch(t){this.resolveGetContent(e.result)}this.resolveGetContent=null}else this.handleResolveGetUsernamePassword(e)}}t.Biometrics=new r},495:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const r=n(913),i=n(607);t.ClientUser=new class extends EventTarget{registerId(e){return s(this,void 0,void 0,(function*(){const t=yield i.default.App.brandId(),n=yield i.default.App.deviceId(),s=yield i.default.PushNotification.getToken();if(!s||0===s.length)throw console.warn("Failed to register logged in client user",e,"No FCM token"),new Error(`Failed to register logged in client user ${e}: No FCM token`);const o={brandId:t,clientUserId:e,deviceId:n,fcmToken:s},a=yield fetch(r.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,o),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}}},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net",t.styleTagId="startiapp-styling"},955:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const s=n(900);class r extends EventTarget{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 r},900:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getIntegration=void 0;let n={};t.getIntegration=function(e){if(n[e])return n[e];let t=window[e],s=0;for(;!t&&s<5;)t=window.parent[e],s++;if(!t)throw new Error(`Could not find integration ${e}`);return n[e]=t,t}},607:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=n(752),r=n(1),i=n(495),o=n(955),a=n(900),c=n(983),l=n(681),d=n(952),u=n(716),p=window;p.appIntegrationsAreReady=()=>{s.App.setStartiappIsLoaded(),v.dispatchEvent(new CustomEvent("ready"))},p.startiappDevice=o.Device,p.startiappApp=s.App,p.startiappUser=i.ClientUser,p.startiappQrScanner=d.QrScanner,p.startiappPushNotification=l.PushNotification,p.startiappNFC=c.NFC,p.startiappBiometric=r.Biometrics,p.appErrorEvent=e=>{v.dispatchEvent(new CustomEvent("error",{detail:e}))};class h extends EventTarget{constructor(){super(...arguments),this.App=s.App,this.Device=o.Device,this.Biometrics=r.Biometrics,this.User=i.ClientUser,this.NfcScanner=c.NFC,this.PushNotification=l.PushNotification,this.QrScanner=d.QrScanner}get appIntegration(){return(0,a.getIntegration)("AppIntegration")}initialize(e){u.AppUI.setOptions(e),this.appIntegration.webAppIsReady()}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}const v=new h;if(v.isRunningInApp())if(document.body)document.body.setAttribute("startiapp","true");else{const e=new MutationObserver((()=>{document.body&&(document.body.setAttribute("startiapp","true"),e.disconnect())}));e.observe(document.documentElement,{childList:!0})}t.default=v,p.startiapp=v},983:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const s=n(715),r=n(900);class i extends s.EventTargetWithType{get NFCIntegration(){return(0,r.getIntegration)("NFCIntegration")}isNfcSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,this.NFCIntegration.isNFCSupported()}))}startNfcScanner(){return new Promise((e=>{this.resolveStartNFCReader=e,this.NFCIntegration.startListening()}))}stopNfcScanner(){return new Promise((e=>{this.resolveStopNFCReader=e,this.NFCIntegration.stopListening()}))}nfcTagScannedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}stopListeningResult(e){this.resolveStopNFCReader(e),this.resolveStopNFCReader=null}isNFCSupportedResult(e){this.resolveNFCSupported(e),this.resolveNFCSupported=null}startListeningResult(e){this.resolveStartNFCReader(e),this.resolveStartNFCReader=null}}t.NFC=new i},681:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=void 0;const r=n(913),i=n(900),o=n(607);class a extends EventTarget{get pushNotificationIntegration(){return(0,i.getIntegration)("PushNotificationIntegration")}requestAccess(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,this.pushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,this.pushNotificationIntegration.getFCMToken()}))}subscribeToTopics(e){return s(this,void 0,void 0,(function*(){this.pushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),n=yield o.default.App.brandId(),s=yield o.default.App.deviceId(),i=[];e.forEach((e=>{const o={brand:n,topic:e,token:t,deviceId:s},a=fetch(r.baseUrl+"/PushNotification-subscribeToTopic",{body:JSON.stringify(o)});i.push(a)})),(yield Promise.all(i)).forEach(((t,n)=>{t.ok||console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return s(this,void 0,void 0,(function*(){this.pushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),n=yield o.default.App.brandId(),s=yield o.default.App.deviceId(),i=[];e.forEach((e=>{const o={brand:n,topic:e,token:t,deviceId:s},a=fetch(r.baseUrl+"/PushNotification-unSubscribeFromTopic",{body:JSON.stringify(o)});i.push(a)})),(yield Promise.all(i)).forEach(((t,n)=>{t.ok||console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e),this.resolveRequestAccess=null}getFCMTokenResult(e){this.resolveFCMToken(e),this.resolveFCMToken=null}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}}t.PushNotification=new a},952:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const s=n(900);class r extends EventTarget{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 r},716:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const s=n(913);t.AppUI=new class{constructor(){this.options={allowDrag:!1,allowHighligt:!1,allowZoom:!1,allowScrollBounce:!1}}setOptions(e){this.options=Object.assign(this.options,e),null!=document.querySelector('meta[name="viewport"]')&&void 0===this.initialViewportMetaContent&&(this.initialViewportMetaContent=document.querySelector('meta[name="viewport"]').getAttribute("content")),this.initialViewportMetaContent.includes("viewport-fit=cover")||(this.initialViewportMetaContent+=", viewport-fit=cover"),this.updateUI()}getOptions(){return this.options}updateUI(){this.styleString="";const e=document.getElementById(s.styleTagId);e&&e.remove();const t=document.getElementsByTagName("img"),n=document.getElementsByTagName("a");this.options.allowDrag?[...t,...n].forEach((e=>{e.removeAttribute("draggable")})):[...t,...n].forEach((e=>{e.setAttribute("draggable","false")}));let r=document.querySelector("meta[name=viewport]");this.options.allowHighligt||(this.styleString+="\n body {\n -webkit-user-select: none; \n -khtml-user-select: none; \n -moz-user-select: none; \n -o-user-select: none; \n user-select: none;\n }\n "),this.options.allowScrollBounce||(this.styleString+="\n html {\n overscroll-behavior: none;\n }\n "),this.options.allowZoom?r.setAttribute("content",this.initialViewportMetaContent):(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",r.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover"));const i=document.createElement("style");i.textContent=this.styleString,i.setAttribute("id",s.styleTagId),document.body.appendChild(i)}}}},t={};return function n(s){var r=t[s];if(void 0!==r)return r.exports;var i=t[s]={exports:{}};return e[s].call(i.exports,i,i.exports,n),i.exports}(607)})()));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var s in n)("object"==typeof exports?exports:e)[s]=n[s]}}(self,(()=>(()=>{"use strict";var e={715:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetWithType=void 0;class n extends EventTarget{addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}t.EventTargetWithType=n},752:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const s=n(715),i=n(900);class r extends s.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)}downloadFile(e,t){this.appIntegration.download(e,t)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,this.appIntegration.brandId()}))}requestReview(){this.appIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,this.appIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,this.appIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,this.appIntegration.getInternalDomains()}))}addInternalDomain(e){this.appIntegration.addInternalDomain(e)}removeInternalDomain(e){this.appIntegration.removeInternalDomain(e)}showStatusBar(){this.appIntegration.showStatusBar()}hideStatusBar(){this.appIntegration.hideStatusBar()}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,this.appIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){this.appIntegration.disableScreenRotation()}enableScreenRotation(){this.appIntegration.enableScreenRotation()}addExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.addExternalDomains(t)}removeExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.removeExternalDomains(t)}getExternalDomains(){return new Promise(((e,t)=>{this.resolveExternalDomains=e,this.appIntegration.getExternalDomains()}))}getExternalDomainsResult(e){this.resolveExternalDomains(e),this.resolveExternalDomains=null}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e),this.resolveBrandId=null}versionResult(e){this.resolveVersion(e),this.resolveVersion=null}deviceIdResult(e){this.resolveDeviceId(e),this.resolveDeviceId=null}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e),this.resolveSetSafeAreaBackgroundColor=null}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e),this.resolveGetInternalDomains=null}}t.App=new r},1:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const s=n(715),i=n(900);class r extends s.EventTargetWithType{constructor(){super(...arguments),this.SECURED_CONTENT_KEY="STARTI_APP_BIOMETRIC_CONTENT",this.SECURED_LOGIN_KEY="STARTI_APP_BIOMETRIC_LOGIN_CONTENT",this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}get biometricIntegration(){return(0,i.getIntegration)("BiometricIntegration")}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveScan=n,this.biometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,this.biometricIntegration.getAuthenticationType()}))}setSecuredContent(e){this.biometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetContent=n,this.biometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,this.biometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){this.biometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){this.biometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){this.biometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,this.biometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,s)=>{this.resolveGetUsernamePassword=n,this.biometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.result);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}this.resolveGetUsernamePassword=null}hasSecuredContentResult({result:e,key:t}){if(t===this.SECURED_LOGIN_KEY)return this.resolveHasUsernameAndPassword(e),void(this.resolveHasUsernameAndPassword=null);this.resolveHasSecureContent(e),this.resolveHasSecureContent=null}getAuthenticationTypeResult(e){this.resolveAuthType(e),this.resolveAuthType=null}startScanningResult(e){this.resolveScan(e),this.resolveScan=null}getSecuredContentResult(e){if(e.key!==this.SECURED_LOGIN_KEY){try{const t=JSON.parse(e.result);this.resolveGetContent(t)}catch(t){this.resolveGetContent(e.result)}this.resolveGetContent=null}else this.handleResolveGetUsernamePassword(e)}}t.Biometrics=new r},495:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(i,r){function o(e){try{c(s.next(e))}catch(e){r(e)}}function a(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const i=n(715),r=n(913),o=n(607);class a extends i.EventTargetWithType{registerId(e){return s(this,void 0,void 0,(function*(){const t=yield o.default.App.brandId(),n=yield o.default.App.deviceId(),s=yield o.default.PushNotification.getToken();if(!s||0===s.length)throw console.warn("Failed to register logged in client user",e,"No FCM token"),new Error(`Failed to register logged in client user ${e}: No FCM token`);const i={brandId:t,clientUserId:e,deviceId:n,fcmToken:s},a=yield fetch(r.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}`)}))}}t.ClientUser=new a},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net",t.styleTagId="startiapp-styling"},955:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const s=n(715),i=n(900);class r extends s.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 r},900:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getIntegration=void 0;let n={};t.getIntegration=function(e){if(n[e])return n[e];let t=window[e],s=0;for(;!t&&s<5;)t=window.parent[e],s++;if(!t)throw new Error(`Could not find integration ${e}`);return n[e]=t,t}},607:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=n(752),i=n(1),r=n(495),o=n(955),a=n(900),c=n(983),l=n(681),d=n(952),u=n(716),p=window;p.appIntegrationsAreReady=()=>{s.App.setStartiappIsLoaded(),v.dispatchEvent(new CustomEvent("ready"))},p.startiappDevice=o.Device,p.startiappApp=s.App,p.startiappUser=r.ClientUser,p.startiappQrScanner=d.QrScanner,p.startiappPushNotification=l.PushNotification,p.startiappNFC=c.NFC,p.startiappBiometric=i.Biometrics,p.appErrorEvent=e=>{v.dispatchEvent(new CustomEvent("error",{detail:e}))};class h extends EventTarget{constructor(){super(...arguments),this.App=s.App,this.Device=o.Device,this.Biometrics=i.Biometrics,this.User=r.ClientUser,this.NfcScanner=c.NFC,this.PushNotification=l.PushNotification,this.QrScanner=d.QrScanner}get appIntegration(){return(0,a.getIntegration)("AppIntegration")}initialize(e){u.AppUI.setOptions(e),this.appIntegration.webAppIsReady()}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}const v=new h;if(v.isRunningInApp())if(document.body)document.body.setAttribute("startiapp","true");else{const e=new MutationObserver((()=>{document.body&&(document.body.setAttribute("startiapp","true"),e.disconnect())}));e.observe(document.documentElement,{childList:!0})}t.default=v,p.startiapp=v},983:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const s=n(715),i=n(900);class r extends s.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 r},681:function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))((function(i,r){function o(e){try{c(s.next(e))}catch(e){r(e)}}function a(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=t.Topic=void 0;const i=n(715),r=n(913),o=n(900),a=n(607);class c extends i.EventTargetWithType{get pushNotificationIntegration(){return(0,o.getIntegration)("PushNotificationIntegration")}requestAccess(){return s(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,this.pushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,this.pushNotificationIntegration.getFCMToken()}))}getTopics(){return s(this,void 0,void 0,(function*(){const e={brand:yield a.default.App.brandId()},t=yield fetch(r.baseUrl+"/Newsletter-getTopics",{body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to get topics");return(yield t.json()).map((({name:e,topic:t})=>new l(t,e)))}))}subscribeToTopics(e){return s(this,void 0,void 0,(function*(){this.pushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),n=yield a.default.App.brandId(),s=yield a.default.App.deviceId(),i=[];e.forEach((e=>{const o={brand:n,topic:e,token:t,deviceId:s},a=fetch(r.baseUrl+"/Newsletter-subscribeToTopic",{body:JSON.stringify(o)});i.push(a)})),(yield Promise.all(i)).forEach(((t,n)=>{t.ok||console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return s(this,void 0,void 0,(function*(){this.pushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),n=yield a.default.App.brandId(),s=yield a.default.App.deviceId(),i=[];e.forEach((e=>{const o={brand:n,topic:e,token:t,deviceId:s},a=fetch(r.baseUrl+"/Newsletter-unSubscribeFromTopic",{body:JSON.stringify(o)});i.push(a)})),(yield Promise.all(i)).forEach(((t,n)=>{t.ok||console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e),this.resolveRequestAccess=null}getFCMTokenResult(e){this.resolveFCMToken(e),this.resolveFCMToken=null}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}}class l{constructor(e,t){this.topic=e,this.name=t}subscribe(){t.PushNotification.subscribeToTopics([this.topic])}unsubscribe(){t.PushNotification.unsubscribeFromTopics([this.topic])}}t.Topic=l,t.PushNotification=new c},952:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const s=n(715),i=n(900);class r extends s.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 r},716:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const s=n(913);t.AppUI=new class{constructor(){this.options={allowDrag:!1,allowHighligt:!1,allowZoom:!1,allowScrollBounce:!1}}setOptions(e){this.options=Object.assign(this.options,e),null!=document.querySelector('meta[name="viewport"]')&&void 0===this.initialViewportMetaContent&&(this.initialViewportMetaContent=document.querySelector('meta[name="viewport"]').getAttribute("content")),this.initialViewportMetaContent.includes("viewport-fit=cover")||(this.initialViewportMetaContent+=", viewport-fit=cover"),this.updateUI()}getOptions(){return this.options}updateUI(){this.styleString="";const e=document.getElementById(s.styleTagId);e&&e.remove();const t=document.getElementsByTagName("img"),n=document.getElementsByTagName("a");this.options.allowDrag?[...t,...n].forEach((e=>{e.removeAttribute("draggable")})):[...t,...n].forEach((e=>{e.setAttribute("draggable","false")}));let i=document.querySelector("meta[name=viewport]");this.options.allowHighligt||(this.styleString+="\n body {\n -webkit-user-select: none; \n -khtml-user-select: none; \n -moz-user-select: none; \n -o-user-select: none; \n user-select: none;\n }\n "),this.options.allowScrollBounce||(this.styleString+="\n html {\n overscroll-behavior: none;\n }\n "),this.options.allowZoom?i.setAttribute("content",this.initialViewportMetaContent):(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",i.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover"));const r=document.createElement("style");r.textContent=this.styleString,r.setAttribute("id",s.styleTagId),document.body.appendChild(r)}}}},t={};return function n(s){var i=t[s];if(void 0!==i)return i.exports;var r=t[s]={exports:{}};return e[s].call(r.exports,r,r.exports,n),r.exports}(607)})()));
|