@gataca/qr 2.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.
- package/LICENSE +21 -0
- package/dist/cjs/gat-icon-refresh-751505ff.js +14 -0
- package/dist/cjs/gataca-autoqr.cjs.entry.js +88 -0
- package/dist/cjs/gataca-qr.cjs.entry.js +175 -0
- package/dist/cjs/gataca-qrdisplay_2.cjs.entry.js +219 -0
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +114 -0
- package/dist/cjs/gatacaqr.cjs.js +19 -0
- package/dist/cjs/index-0b7a1532.js +1410 -0
- package/dist/cjs/index.cjs.js +16 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/qr-code-styling-412bbc7a.js +28 -0
- package/dist/cjs/utils-383ee834.js +26 -0
- package/dist/collection/assets/icons/gat-icon-alert.svg +5 -0
- package/dist/collection/assets/icons/gat-icon-check.svg +5 -0
- package/dist/collection/assets/icons/gat-icon-refresh.svg +4 -0
- package/dist/collection/assets/images/logo_gataca.svg +26 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/gataca-autoqr/gataca-autoqr.css +116 -0
- package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +306 -0
- package/dist/collection/components/gataca-qr/gataca-qr.css +249 -0
- package/dist/collection/components/gataca-qr/gataca-qr.js +557 -0
- package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +154 -0
- package/dist/collection/components/gataca-qrws/gataca-qrws.css +249 -0
- package/dist/collection/components/gataca-qrws/gataca-qrws.js +566 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.css +116 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +395 -0
- package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.css +116 -0
- package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +410 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/collection/utils/utils.js +21 -0
- package/dist/components/gat-icon-refresh.js +29 -0
- package/dist/components/gataca-autoqr.d.ts +11 -0
- package/dist/components/gataca-autoqr.js +144 -0
- package/dist/components/gataca-qr.d.ts +11 -0
- package/dist/components/gataca-qr.js +6 -0
- package/dist/components/gataca-qr2.js +211 -0
- package/dist/components/gataca-qrdisplay.d.ts +11 -0
- package/dist/components/gataca-qrdisplay.js +6 -0
- package/dist/components/gataca-qrdisplay2.js +93 -0
- package/dist/components/gataca-qrws.d.ts +11 -0
- package/dist/components/gataca-qrws.js +6 -0
- package/dist/components/gataca-qrws2.js +212 -0
- package/dist/components/gataca-ssibutton.d.ts +11 -0
- package/dist/components/gataca-ssibutton.js +6 -0
- package/dist/components/gataca-ssibutton2.js +100 -0
- package/dist/components/gataca-ssibuttonws.d.ts +11 -0
- package/dist/components/gataca-ssibuttonws.js +6 -0
- package/dist/components/gataca-ssibuttonws2.js +102 -0
- package/dist/components/index.d.ts +27 -0
- package/dist/components/index.js +8 -0
- package/dist/esm/gat-icon-refresh-179ea123.js +9 -0
- package/dist/esm/gataca-autoqr.entry.js +84 -0
- package/dist/esm/gataca-qr.entry.js +171 -0
- package/dist/esm/gataca-qrdisplay_2.entry.js +214 -0
- package/dist/esm/gataca-ssibutton_2.entry.js +109 -0
- package/dist/esm/gatacaqr.js +17 -0
- package/dist/esm/index-19eef502.js +1384 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/qr-code-styling-0eeb38d5.js +26 -0
- package/dist/esm/utils-05ba6c9f.js +23 -0
- package/dist/gatacaqr/gatacaqr.esm.js +1 -0
- package/dist/gatacaqr/index.esm.js +1 -0
- package/dist/gatacaqr/p-0905677f.entry.js +1 -0
- package/dist/gatacaqr/p-0be4566d.js +1 -0
- package/dist/gatacaqr/p-1d35273f.entry.js +1 -0
- package/dist/gatacaqr/p-2f22c7fc.js +1 -0
- package/dist/gatacaqr/p-4139a068.entry.js +1 -0
- package/dist/gatacaqr/p-a6f85341.js +2 -0
- package/dist/gatacaqr/p-b8ba109f.js +1 -0
- package/dist/gatacaqr/p-f85d7e76.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/gataca-autoqr/gataca-autoqr.d.ts +85 -0
- package/dist/types/components/gataca-qr/gataca-qr.d.ts +131 -0
- package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +35 -0
- package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +124 -0
- package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +114 -0
- package/dist/types/components/gataca-ssibuttonws/gataca-ssibuttonws.d.ts +110 -0
- package/dist/types/components.d.ts +830 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1581 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +56 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +40 -0
- package/readme.md +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const logoGatacaSvg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI2LjUuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA2MzUuMyA1OTcuNDciIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDYzNS4zIDU5Ny40NzsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC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5MTE2QzE1LjE5OTkgMy4zNjUyIDE2Ljk5MDUgNC4yNTk3NSAxOC4zNjk5IDUuNjQwMDFMMjIuOTk5OSAxMCIgc3Ryb2tlPSIjOEI4QjhCIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
|
|
10
|
+
|
|
11
|
+
exports.gatIconAlertSvg = gatIconAlertSvg;
|
|
12
|
+
exports.gatIconCheckSvg = gatIconCheckSvg;
|
|
13
|
+
exports.gatIconRefreshSvg = gatIconRefreshSvg;
|
|
14
|
+
exports.logoGatacaSvg = logoGatacaSvg;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-0b7a1532.js');
|
|
6
|
+
|
|
7
|
+
const gatacaAutoqrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:\"Work Sans\", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:\"Helvetica Neue\", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}";
|
|
8
|
+
|
|
9
|
+
const DEFAULT_REPOSITORY = "https://studio.gataca.io/api/v1/qrs";
|
|
10
|
+
const GatacaAutoQR = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
|
|
14
|
+
this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
|
|
15
|
+
this.configId = undefined;
|
|
16
|
+
this.configRepository = DEFAULT_REPOSITORY;
|
|
17
|
+
this.successCallback = undefined;
|
|
18
|
+
this.errorCallback = undefined;
|
|
19
|
+
this.checkStatus = undefined;
|
|
20
|
+
this.createSession = undefined;
|
|
21
|
+
this.wsOnOpen = undefined;
|
|
22
|
+
this.wsOnMessage = undefined;
|
|
23
|
+
this.config = undefined;
|
|
24
|
+
this.loading = undefined;
|
|
25
|
+
this.loading = true;
|
|
26
|
+
fetch(this.configRepository + "/" + this.configId, {
|
|
27
|
+
method: "GET",
|
|
28
|
+
headers: {
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
.then((response) => {
|
|
33
|
+
response
|
|
34
|
+
.json()
|
|
35
|
+
.then((data) => {
|
|
36
|
+
this.config = data;
|
|
37
|
+
this.loading = false;
|
|
38
|
+
})
|
|
39
|
+
.catch((err) => {
|
|
40
|
+
console.log("Cannot retrieve selected config", err);
|
|
41
|
+
this.loading = false;
|
|
42
|
+
});
|
|
43
|
+
})
|
|
44
|
+
.catch((err) => {
|
|
45
|
+
console.log("Cannot retrieve selected config", err);
|
|
46
|
+
this.loading = false;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Retrieve manually the session data on a successful login
|
|
51
|
+
*/
|
|
52
|
+
async getSessionData() {
|
|
53
|
+
return this.qr.getSessionData();
|
|
54
|
+
}
|
|
55
|
+
selectQR() {
|
|
56
|
+
if (this.config.useButton) {
|
|
57
|
+
if (this.config.useWs) {
|
|
58
|
+
this.qr = (index.h("gataca-ssibuttonws", { buttonText: this.config.buttonText, wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, socketEndpoint: this.config.socketEndpoint, autostart: true, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.qr = (index.h("gataca-ssibutton", { buttonText: this.config.buttonText, checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, pollingFrequency: this.config.pollingFrequency, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
if (this.config.useWs) {
|
|
66
|
+
this.qr = (index.h("gataca-qrws", { wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, socketEndpoint: this.config.socketEndpoint, autostart: this.config.autostart, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.qr = (index.h("gataca-qr", { checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, pollingFrequency: this.config.pollingFrequency, autostart: this.config.autostart, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
if (this.loading) {
|
|
75
|
+
//TODO: Improve loading message
|
|
76
|
+
return index.h("div", null, "Loading...");
|
|
77
|
+
}
|
|
78
|
+
if (this.config) {
|
|
79
|
+
this.selectQR();
|
|
80
|
+
return this.qr;
|
|
81
|
+
}
|
|
82
|
+
//TODO: Improve error message
|
|
83
|
+
return index.h("div", null, "Error loading your config...");
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
GatacaAutoQR.style = gatacaAutoqrCss;
|
|
87
|
+
|
|
88
|
+
exports.gataca_autoqr = GatacaAutoQR;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-0b7a1532.js');
|
|
6
|
+
const gatIconRefresh = require('./gat-icon-refresh-751505ff.js');
|
|
7
|
+
require('./qr-code-styling-412bbc7a.js');
|
|
8
|
+
const utils = require('./utils-383ee834.js');
|
|
9
|
+
|
|
10
|
+
const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .modal-window{position:relative;border-radius:6px;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;width:300px;min-height:408px;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window p{font-family:\"Work Sans\", \"Helvetica Neue\", sans-serif;font-weight:normal;font-size:12px;letter-spacing:1px;color:#181B5E}.popUpContainer .modal-window .qrTitleContainer{padding:24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .success .successMsg{margin-top:20px;font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
|
|
11
|
+
|
|
12
|
+
const DEEP_LINK_PREFIX = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
|
|
13
|
+
//Default values
|
|
14
|
+
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
15
|
+
const DEFAULT_POLLING_FREQ = 3;
|
|
16
|
+
const QR_ROLE_CONNECT = "connect";
|
|
17
|
+
const FUNCTION_ROLES = {
|
|
18
|
+
connect: "scan",
|
|
19
|
+
certify: "credential",
|
|
20
|
+
};
|
|
21
|
+
const GatacaQR = class {
|
|
22
|
+
constructor(hostRef) { index.registerInstance(this, hostRef); this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; this.qrModalTitle = "Quick Access"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideBrandTitle = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = utils.RESULT_STATUS.NOT_STARTED; }
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
this.stop();
|
|
25
|
+
}
|
|
26
|
+
async componentDidLoad() {
|
|
27
|
+
if (this.autostart) {
|
|
28
|
+
await this.display();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Force manually the display of a QR
|
|
33
|
+
*/
|
|
34
|
+
async display() {
|
|
35
|
+
await this.getSessionId();
|
|
36
|
+
this.result = utils.RESULT_STATUS.ONGOING;
|
|
37
|
+
this.poll()
|
|
38
|
+
.then((data) => {
|
|
39
|
+
this.result = utils.RESULT_STATUS.SUCCESS;
|
|
40
|
+
this.sessionData = data;
|
|
41
|
+
this.gatacaLoginCompleted.emit(data);
|
|
42
|
+
this.successCallback(data);
|
|
43
|
+
})
|
|
44
|
+
.catch((err) => {
|
|
45
|
+
this.clean();
|
|
46
|
+
let expired = err === utils.RESULT_STATUS.EXPIRED;
|
|
47
|
+
if (expired && this.autorefresh) {
|
|
48
|
+
this.display();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
if (err !== utils.RESULT_STATUS.NOT_STARTED) {
|
|
52
|
+
let error = expired
|
|
53
|
+
? new Error("User did not scan the QR in the alloted time")
|
|
54
|
+
: new Error("Provided user credentials couldn't be validated");
|
|
55
|
+
this.result = err;
|
|
56
|
+
this.gatacaLoginFailed.emit(error);
|
|
57
|
+
this.errorCallback(error);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
if (utils.checkMobile() && this.dynamicLink) {
|
|
62
|
+
window.location.href = this.getLink();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Stop manually an ongoing session
|
|
67
|
+
*/
|
|
68
|
+
async stop() {
|
|
69
|
+
this.clean();
|
|
70
|
+
if (this.result === utils.RESULT_STATUS.ONGOING) {
|
|
71
|
+
this.result = utils.RESULT_STATUS.NOT_STARTED;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
clean() {
|
|
75
|
+
this.sessionData = undefined;
|
|
76
|
+
this.sessionId = undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Retrieve manually the session data on a successful login
|
|
80
|
+
*/
|
|
81
|
+
async getSessionData() {
|
|
82
|
+
return this.sessionData
|
|
83
|
+
? Promise.resolve(this.sessionData)
|
|
84
|
+
: Promise.reject(new Error("No successful login"));
|
|
85
|
+
}
|
|
86
|
+
async getSessionId() {
|
|
87
|
+
if (this.sessionId) {
|
|
88
|
+
return this.sessionId;
|
|
89
|
+
}
|
|
90
|
+
let { sessionId, authenticationRequest } = await this.createSession();
|
|
91
|
+
this.sessionId = sessionId;
|
|
92
|
+
this.authenticationRequest = authenticationRequest;
|
|
93
|
+
return this.sessionId;
|
|
94
|
+
}
|
|
95
|
+
getLink() {
|
|
96
|
+
if (this.v2 && this.qrRole == QR_ROLE_CONNECT) {
|
|
97
|
+
return this.authenticationRequest;
|
|
98
|
+
}
|
|
99
|
+
let op = FUNCTION_ROLES[this.qrRole];
|
|
100
|
+
let link = "https://gataca.page.link/" + op + "?";
|
|
101
|
+
link +=
|
|
102
|
+
this.qrRole === QR_ROLE_CONNECT
|
|
103
|
+
? "session=" + this.sessionId
|
|
104
|
+
: "process=" + this.sessionId;
|
|
105
|
+
link +=
|
|
106
|
+
"&callback=" + utils.base64UrlEncode(encodeURIComponent(this.callbackServer));
|
|
107
|
+
link = encodeURIComponent(link);
|
|
108
|
+
return this.dynamicLink ? DEEP_LINK_PREFIX + link : link;
|
|
109
|
+
}
|
|
110
|
+
async poll() {
|
|
111
|
+
let endTime = new Date().getTime() +
|
|
112
|
+
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
113
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
114
|
+
let checkFunc = async (component) => {
|
|
115
|
+
if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
|
|
116
|
+
return { result: utils.RESULT_STATUS.NOT_STARTED };
|
|
117
|
+
}
|
|
118
|
+
let id = await component.getSessionId();
|
|
119
|
+
return component.checkStatus(id);
|
|
120
|
+
};
|
|
121
|
+
let component = this;
|
|
122
|
+
let checkCondition = async function (resolve, reject) {
|
|
123
|
+
// If the condition is met, we're done!
|
|
124
|
+
let { result, data } = await checkFunc(component);
|
|
125
|
+
switch (result) {
|
|
126
|
+
case utils.RESULT_STATUS.SUCCESS:
|
|
127
|
+
resolve(data);
|
|
128
|
+
break;
|
|
129
|
+
case utils.RESULT_STATUS.ONGOING:
|
|
130
|
+
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
131
|
+
setTimeout(checkCondition, interval, resolve, reject);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
reject(utils.RESULT_STATUS.EXPIRED);
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
default:
|
|
138
|
+
reject(result);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
return new Promise(checkCondition);
|
|
143
|
+
}
|
|
144
|
+
renderQRSection() {
|
|
145
|
+
switch (this.result) {
|
|
146
|
+
case utils.RESULT_STATUS.NOT_STARTED:
|
|
147
|
+
return this.renderRetryButton();
|
|
148
|
+
case utils.RESULT_STATUS.ONGOING:
|
|
149
|
+
return this.renderQR(this.getLink(), 300, true);
|
|
150
|
+
case utils.RESULT_STATUS.EXPIRED:
|
|
151
|
+
return this.renderRetryButton("QR Code expired");
|
|
152
|
+
case utils.RESULT_STATUS.FAILED:
|
|
153
|
+
return this.renderRetryButton("User credentials not validated");
|
|
154
|
+
case utils.RESULT_STATUS.SUCCESS:
|
|
155
|
+
return this.renderSuccess();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
renderSuccess() {
|
|
159
|
+
return (index.h("div", { class: "success" }, index.h("img", { src: gatIconRefresh.gatIconCheckSvg, height: 52, width: 52 }), index.h("p", { class: "successMsg" }, "Successful Connection!")));
|
|
160
|
+
}
|
|
161
|
+
renderRetryButton(errorMessage) {
|
|
162
|
+
return (index.h("div", { class: "reload" }, index.h("div", { id: "notify", onClick: () => this.display() }, index.h("img", { src: gatIconRefresh.gatIconRefreshSvg, height: 24, width: 24 }), index.h("p", { class: "qrDescription" }, "Click inside the box to "), errorMessage ? (index.h("p", { class: "qrDescription bold" }, "Refresh QR Code")) : (index.h("p", { class: "qrDescription bold" }, "Scan QR Code")), errorMessage && (index.h("div", { class: "alert" }, index.h("img", { src: gatIconRefresh.gatIconAlertSvg, height: 24, width: 24 }), index.h("p", null, errorMessage)))), index.h("div", { id: "qrwait" }, this.renderQR("waiting to start a session", 250))));
|
|
163
|
+
}
|
|
164
|
+
renderQR(value, size, useLogo) {
|
|
165
|
+
return (index.h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0 }));
|
|
166
|
+
}
|
|
167
|
+
render() {
|
|
168
|
+
return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: "modal-window is-visible", onClick: (event) => {
|
|
169
|
+
event.stopPropagation();
|
|
170
|
+
} }, index.h("div", { class: "modal-window__content" }, index.h("div", { class: "qrTitleContainer" }, index.h("p", { class: "qrTitle" }, this.qrModalTitle), !this.hideBrandTitle && (index.h("p", { class: "qrBrand" }, "by Gataca", " ", index.h("span", null, index.h("img", { src: gatIconRefresh.logoGatacaSvg })))), this.result !== utils.RESULT_STATUS.SUCCESS && (index.h("p", { class: "qrDescription" }, this.qrModalDescription))), index.h("div", { class: "qrSection" }, this.renderQRSection())))));
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
GatacaQR.style = gatacaQrCss;
|
|
174
|
+
|
|
175
|
+
exports.gataca_qr = GatacaQR;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-0b7a1532.js');
|
|
6
|
+
const qrCodeStyling = require('./qr-code-styling-412bbc7a.js');
|
|
7
|
+
const gatIconRefresh = require('./gat-icon-refresh-751505ff.js');
|
|
8
|
+
const utils = require('./utils-383ee834.js');
|
|
9
|
+
|
|
10
|
+
const GatacaQRDisplay = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.qrData = undefined;
|
|
14
|
+
this.size = 256;
|
|
15
|
+
this.logoSize = 0;
|
|
16
|
+
this.logoSrc = undefined;
|
|
17
|
+
this.qrColor = "#181B5E";
|
|
18
|
+
this.rounded = true;
|
|
19
|
+
}
|
|
20
|
+
componentDidLoad() {
|
|
21
|
+
const qrCode = new qrCodeStyling.QRCodeStyling({
|
|
22
|
+
data: this.qrData,
|
|
23
|
+
width: this.size,
|
|
24
|
+
height: this.size,
|
|
25
|
+
image: this.logoSize > 0 ? this.logoSrc || gatIconRefresh.logoGatacaSvg : undefined,
|
|
26
|
+
margin: 10,
|
|
27
|
+
type: "svg",
|
|
28
|
+
dotsOptions: {
|
|
29
|
+
color: this.qrColor,
|
|
30
|
+
type: this.rounded ? "dots" : "square",
|
|
31
|
+
},
|
|
32
|
+
cornersSquareOptions: {
|
|
33
|
+
type: this.rounded ? "extra-rounded" : "square",
|
|
34
|
+
},
|
|
35
|
+
cornersDotOptions: {
|
|
36
|
+
type: this.rounded ? "dot" : "square",
|
|
37
|
+
},
|
|
38
|
+
imageOptions: {
|
|
39
|
+
margin: 2,
|
|
40
|
+
imageSize: this.logoSize,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
qrCode.append(this.qr);
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return (index.h("div", { ref: (el) => {
|
|
47
|
+
this.qr = el;
|
|
48
|
+
} }));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const gatacaQrwsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .modal-window{position:relative;border-radius:6px;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;width:300px;min-height:408px;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window p{font-family:\"Work Sans\", \"Helvetica Neue\", sans-serif;font-weight:normal;font-size:12px;letter-spacing:1px;color:#181B5E}.popUpContainer .modal-window .qrTitleContainer{padding:24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .success .successMsg{margin-top:20px;font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
|
|
53
|
+
|
|
54
|
+
const DEEP_LINK_PREFIX = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
|
|
55
|
+
const DEFAULT_SESSION_TIMEOUT = 300;
|
|
56
|
+
const QR_ROLE_CONNECT = "connect";
|
|
57
|
+
const FUNCTION_ROLES = {
|
|
58
|
+
connect: "scan",
|
|
59
|
+
certify: "credential",
|
|
60
|
+
};
|
|
61
|
+
const GatacaQRWS = class {
|
|
62
|
+
constructor(hostRef) { index.registerInstance(this, hostRef); this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7); this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.socketEndpoint = undefined; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.wsOnOpen = undefined; this.wsOnMessage = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; this.qrModalTitle = "Quick Access"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideBrandTitle = false; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = utils.RESULT_STATUS.NOT_STARTED; }
|
|
63
|
+
disconnectedCallback() {
|
|
64
|
+
this.stop();
|
|
65
|
+
}
|
|
66
|
+
async componentDidLoad() {
|
|
67
|
+
if (this.autostart) {
|
|
68
|
+
await this.display();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Force manually the display of a QR
|
|
73
|
+
*/
|
|
74
|
+
async display() {
|
|
75
|
+
let socket = new WebSocket(this.socketEndpoint);
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
this.socket.close(1000, "");
|
|
78
|
+
}, 1000 * this.sessionTimeout);
|
|
79
|
+
this.socket = socket;
|
|
80
|
+
socket.onopen = () => {
|
|
81
|
+
if (this.wsOnOpen)
|
|
82
|
+
this.wsOnOpen(this.socket);
|
|
83
|
+
};
|
|
84
|
+
socket.onmessage = (msg) => {
|
|
85
|
+
if (this.wsOnMessage) {
|
|
86
|
+
this.wsOnMessage(this.socket, msg);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
let wsresp = JSON.parse(msg.data);
|
|
90
|
+
if (!!wsresp.sessionId) {
|
|
91
|
+
this.handleWSResponse(wsresp);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
socket.onerror = () => {
|
|
96
|
+
let error = new Error("Error connecting with server");
|
|
97
|
+
this.result = utils.RESULT_STATUS.FAILED;
|
|
98
|
+
this.gatacaLoginFailed.emit(error);
|
|
99
|
+
this.errorCallback(error);
|
|
100
|
+
socket.close(1000, "");
|
|
101
|
+
};
|
|
102
|
+
socket.onclose = () => {
|
|
103
|
+
if (this.result === utils.RESULT_STATUS.ONGOING) {
|
|
104
|
+
this.result = utils.RESULT_STATUS.EXPIRED;
|
|
105
|
+
}
|
|
106
|
+
if (this.result === utils.RESULT_STATUS.EXPIRED) {
|
|
107
|
+
if (this.autorefresh) {
|
|
108
|
+
this.display();
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
let error = new Error("User did not scan the QR in the alloted time");
|
|
112
|
+
this.gatacaLoginFailed.emit(error);
|
|
113
|
+
this.errorCallback(error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
if (utils.checkMobile() && this.dynamicLink) {
|
|
118
|
+
window.location.href = this.getLink();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
sessionMsgReceived(event) {
|
|
122
|
+
let wsresp = event.detail;
|
|
123
|
+
this.handleWSResponse(wsresp);
|
|
124
|
+
}
|
|
125
|
+
handleWSResponse(wsresp) {
|
|
126
|
+
this.result = wsresp.result;
|
|
127
|
+
switch (wsresp.result) {
|
|
128
|
+
case utils.RESULT_STATUS.ONGOING:
|
|
129
|
+
this.sessionId = wsresp.sessionId;
|
|
130
|
+
this.authenticationRequest = wsresp.authenticationRequest;
|
|
131
|
+
break;
|
|
132
|
+
case utils.RESULT_STATUS.SUCCESS:
|
|
133
|
+
this.sessionData = wsresp.authenticatedUserData;
|
|
134
|
+
this.gatacaLoginCompleted.emit(wsresp.authenticatedUserData);
|
|
135
|
+
this.successCallback(wsresp.authenticatedUserData);
|
|
136
|
+
this.socket.close(1000, "");
|
|
137
|
+
break;
|
|
138
|
+
case utils.RESULT_STATUS.FAILED:
|
|
139
|
+
this.socket.close();
|
|
140
|
+
let error = new Error("Provided user credentials couldn't be validated");
|
|
141
|
+
this.gatacaLoginFailed.emit(error);
|
|
142
|
+
this.errorCallback(error);
|
|
143
|
+
break;
|
|
144
|
+
case utils.RESULT_STATUS.EXPIRED:
|
|
145
|
+
this.socket.close();
|
|
146
|
+
if (this.autorefresh) {
|
|
147
|
+
this.display();
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
let error = new Error("User did not scan the QR in the alloted time");
|
|
151
|
+
this.gatacaLoginFailed.emit(error);
|
|
152
|
+
this.errorCallback(error);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Stop manually an ongoing session
|
|
158
|
+
*/
|
|
159
|
+
async stop() {
|
|
160
|
+
this.sessionData = undefined;
|
|
161
|
+
this.sessionId = undefined;
|
|
162
|
+
this.socket.close(1000, "Client stopped the connection");
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Retrieve manually the session data on a successful login
|
|
166
|
+
*/
|
|
167
|
+
async getSessionData() {
|
|
168
|
+
return this.sessionData
|
|
169
|
+
? Promise.resolve(this.sessionData)
|
|
170
|
+
: Promise.reject(new Error("No successful login"));
|
|
171
|
+
}
|
|
172
|
+
getLink() {
|
|
173
|
+
if (this.v2 && this.qrRole == QR_ROLE_CONNECT) {
|
|
174
|
+
return this.authenticationRequest;
|
|
175
|
+
}
|
|
176
|
+
let op = FUNCTION_ROLES[this.qrRole];
|
|
177
|
+
let link = "https://gataca.page.link/" + op + "?";
|
|
178
|
+
link +=
|
|
179
|
+
this.qrRole === QR_ROLE_CONNECT
|
|
180
|
+
? "session=" + this.sessionId
|
|
181
|
+
: "process=" + this.sessionId;
|
|
182
|
+
link +=
|
|
183
|
+
"&callback=" + utils.base64UrlEncode(encodeURIComponent(this.callbackServer));
|
|
184
|
+
link = encodeURIComponent(link);
|
|
185
|
+
return this.dynamicLink ? DEEP_LINK_PREFIX + link : link;
|
|
186
|
+
}
|
|
187
|
+
renderQRSection() {
|
|
188
|
+
switch (this.result) {
|
|
189
|
+
case utils.RESULT_STATUS.NOT_STARTED:
|
|
190
|
+
return this.renderRetryButton();
|
|
191
|
+
case utils.RESULT_STATUS.ONGOING:
|
|
192
|
+
return this.renderQR(this.getLink(), 300, true);
|
|
193
|
+
case utils.RESULT_STATUS.EXPIRED:
|
|
194
|
+
return this.renderRetryButton("QR Code expired");
|
|
195
|
+
case utils.RESULT_STATUS.FAILED:
|
|
196
|
+
return this.renderRetryButton("User credentials not validated");
|
|
197
|
+
case utils.RESULT_STATUS.SUCCESS:
|
|
198
|
+
return this.renderSuccess();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
renderSuccess() {
|
|
202
|
+
return (index.h("div", { class: "success" }, index.h("img", { src: gatIconRefresh.gatIconCheckSvg, height: 52, width: 52 }), index.h("p", { class: "successMsg" }, "Successful Connection!")));
|
|
203
|
+
}
|
|
204
|
+
renderRetryButton(errorMessage) {
|
|
205
|
+
return (index.h("div", { class: "reload" }, index.h("div", { id: "notify", onClick: () => this.display() }, index.h("img", { src: gatIconRefresh.gatIconRefreshSvg, height: 24, width: 24 }), index.h("p", { class: "qrDescription" }, "Click inside the box to "), errorMessage ? (index.h("p", { class: "qrDescription bold" }, "Refresh QR Code")) : (index.h("p", { class: "qrDescription bold" }, "Scan QR Code")), errorMessage && (index.h("div", { class: "alert" }, index.h("img", { src: gatIconRefresh.gatIconAlertSvg, height: 24, width: 24 }), index.h("p", null, errorMessage)))), index.h("div", { id: "qrwait" }, this.renderQR("waiting to start a session", 250))));
|
|
206
|
+
}
|
|
207
|
+
renderQR(value, size, useLogo) {
|
|
208
|
+
return (index.h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0 }));
|
|
209
|
+
}
|
|
210
|
+
render() {
|
|
211
|
+
return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: "modal-window is-visible", onClick: (event) => {
|
|
212
|
+
event.stopPropagation();
|
|
213
|
+
} }, index.h("div", { class: "modal-window__content" }, index.h("div", { class: "qrTitleContainer" }, index.h("p", { class: "qrTitle" }, this.qrModalTitle), !this.hideBrandTitle && (index.h("p", { class: "qrBrand" }, "by Gataca", " ", index.h("span", null, index.h("img", { src: gatIconRefresh.logoGatacaSvg })))), this.result !== utils.RESULT_STATUS.SUCCESS && (index.h("p", { class: "qrDescription" }, this.qrModalDescription))), index.h("div", { class: "qrSection" }, this.renderQRSection())))));
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
GatacaQRWS.style = gatacaQrwsCss;
|
|
217
|
+
|
|
218
|
+
exports.gataca_qrdisplay = GatacaQRDisplay;
|
|
219
|
+
exports.gataca_qrws = GatacaQRWS;
|