starti.app 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ export default class QrScanner {
2
+ static webAppIsReady(): void;
3
+ static startQrCodeScanner(): Promise<unknown>;
4
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class QrScanner {
4
+ static webAppIsReady() {
5
+ try {
6
+ // @ts-ignore
7
+ AppIntegration.webAppIsReady();
8
+ }
9
+ catch (_a) { }
10
+ }
11
+ static startQrCodeScanner() {
12
+ const promise = new Promise((resolve, reject) => {
13
+ ;
14
+ window.QrScanner = {
15
+ qrResultRecievedEvent: (message) => {
16
+ resolve(message);
17
+ window.QrScanner = null;
18
+ },
19
+ };
20
+ try {
21
+ const qrScannerIntegration = window.QrScannerIntegration;
22
+ if (!qrScannerIntegration) {
23
+ resolve('scanner virker kun i start-i-app');
24
+ return;
25
+ }
26
+ qrScannerIntegration.startQrCodeScanner();
27
+ }
28
+ catch (e) {
29
+ reject(e);
30
+ }
31
+ });
32
+ return promise;
33
+ }
34
+ }
35
+ exports.default = QrScanner;
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "starti.app",
3
+ "version": "1.0.0",
4
+ "description": "Use this package for easy communication with the starti.app API.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "devDependencies": {
11
+ "tsc": "^2.0.4"
12
+ }
13
+ }