@gataca/qr 2.0.3 → 2.0.5

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/cjs/gataca-autoqr.cjs.entry.js +105 -0
  2. package/dist/cjs/gataca-qr_2.cjs.entry.js +230 -0
  3. package/dist/cjs/gataca-qrws.cjs.entry.js +176 -0
  4. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +129 -0
  5. package/dist/cjs/gatacaqr.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/logo_gataca-f3dc6840.js +14 -0
  8. package/dist/{esm/gataca-autoqr_6.entry.js → cjs/qr-code-styling-412bbc7a.js} +2 -603
  9. package/dist/collection/components/gataca-qr/gataca-qr.css +11 -2
  10. package/dist/collection/components/gataca-qr/gataca-qr.js +110 -10
  11. package/dist/components/gataca-qr2.js +26 -10
  12. package/dist/esm/gataca-autoqr.entry.js +101 -0
  13. package/dist/esm/gataca-qr_2.entry.js +225 -0
  14. package/dist/esm/gataca-qrws.entry.js +172 -0
  15. package/dist/esm/gataca-ssibutton_2.entry.js +124 -0
  16. package/dist/esm/gatacaqr.js +1 -1
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/logo_gataca-57ad0363.js +9 -0
  19. package/dist/{cjs/gataca-autoqr_6.cjs.entry.js → esm/qr-code-styling-0eeb38d5.js} +1 -613
  20. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  21. package/dist/gatacaqr/p-0be4566d.js +1 -0
  22. package/dist/gatacaqr/p-35b616ba.entry.js +1 -0
  23. package/dist/gatacaqr/p-5eb106c0.entry.js +1 -0
  24. package/dist/gatacaqr/p-66ad21ac.entry.js +1 -0
  25. package/dist/gatacaqr/p-6adc6933.js +1 -0
  26. package/dist/gatacaqr/p-b834ef88.entry.js +1 -0
  27. package/dist/types/components/gataca-qr/gataca-qr.d.ts +27 -2
  28. package/dist/types/components.d.ts +42 -2
  29. package/package.json +40 -38
  30. package/dist/gatacaqr/p-b37057bb.entry.js +0 -1
@@ -1,111 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-80311733.js';
2
- import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './utils-05ba6c9f.js';
3
-
4
- 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}";
5
-
6
- const DEFAULT_REPOSITORY = "https://studio.gataca.io/api/v1/qrconfigs";
7
- const fixFunctions = (data) => {
8
- var _a, _b, _c, _d, _e, _f;
9
- data.errorCallback = deserializeFunction((_a = data.errorCallback) === null || _a === void 0 ? void 0 : _a.toString());
10
- data.successCallback = deserializeFunction((_b = data.successCallback) === null || _b === void 0 ? void 0 : _b.toString());
11
- data.wsOnMessage = deserializeFunction((_c = data.wsOnMessage) === null || _c === void 0 ? void 0 : _c.toString());
12
- data.wsOnOpen = deserializeFunction((_d = data.wsOnOpen) === null || _d === void 0 ? void 0 : _d.toString());
13
- data.checkStatus = deserializeFunction((_e = data.checkStatus) === null || _e === void 0 ? void 0 : _e.toString());
14
- data.createSession = deserializeFunction((_f = data.createSession) === null || _f === void 0 ? void 0 : _f.toString());
15
- return data;
16
- };
17
- const deserializeFunction = (data) => {
18
- if (data) {
19
- return new Function("return " + data)();
20
- }
21
- return undefined;
22
- };
23
- const GatacaAutoQR = class {
24
- constructor(hostRef) {
25
- registerInstance(this, hostRef);
26
- this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
27
- this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
28
- this.configId = undefined;
29
- this.configRepository = DEFAULT_REPOSITORY;
30
- this.successCallback = undefined;
31
- this.errorCallback = undefined;
32
- this.checkStatus = undefined;
33
- this.createSession = undefined;
34
- this.wsOnOpen = undefined;
35
- this.wsOnMessage = undefined;
36
- this.config = undefined;
37
- this.loading = undefined;
38
- this.loading = true;
39
- fetch(this.configRepository + "/" + this.configId, {
40
- method: "GET",
41
- headers: {
42
- "Content-Type": "application/json",
43
- },
44
- })
45
- .then((response) => {
46
- response
47
- .json()
48
- .then((data) => {
49
- data = fixFunctions(data);
50
- this.config = data;
51
- this.loading = false;
52
- })
53
- .catch((err) => {
54
- console.log("Cannot retrieve selected config", err);
55
- this.loading = false;
56
- });
57
- })
58
- .catch((err) => {
59
- console.log("Cannot retrieve selected config", err);
60
- this.loading = false;
61
- });
62
- }
63
- /**
64
- * Retrieve manually the session data on a successful login
65
- */
66
- async getSessionData() {
67
- return this.qr.getSessionData();
68
- }
69
- selectQR() {
70
- if (this.config.useButton) {
71
- if (this.config.useWs) {
72
- this.qr = (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 }));
73
- }
74
- else {
75
- this.qr = (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 }));
76
- }
77
- }
78
- else {
79
- if (this.config.useWs) {
80
- this.qr = (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 }));
81
- }
82
- else {
83
- this.qr = (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 }));
84
- }
85
- }
86
- }
87
- render() {
88
- if (this.loading) {
89
- //TODO: Improve loading message
90
- return h("div", null, "Loading...");
91
- }
92
- if (this.config) {
93
- this.selectQR();
94
- return this.qr;
95
- }
96
- //TODO: Improve error message
97
- return h("div", null, "Error loading your config...");
98
- }
99
- };
100
- GatacaAutoQR.style = gatacaAutoqrCss;
101
-
102
- const gatIconAlertSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEwLjI5MDggMy44NjAyTDEuODIwNzUgMTguMDAwMkMxLjY0NjEyIDE4LjMwMjYgMS41NTM3MiAxOC42NDU1IDEuNTUyNzQgMTguOTk0N0MxLjU1MTc2IDE5LjM0MzkgMS42NDIyNCAxOS42ODczIDEuODE1MTggMTkuOTkwN0MxLjk4ODEyIDIwLjI5NDEgMi4yMzc0OCAyMC41NDcg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NzksNTQuMTNsNTcuMDQtNDcuODZsMC4wNS0wLjA5bC0xMTUuODYtNjYuODdjNC41LTMuODgsOS4yOS03LjM1LDE0LjMxLTEwLjM4CgkJYzEuMjMtMC43NCwyLjQ2LTEuNDYsMy43Mi0yLjE1YzMxLjU2LTE3LjM3LDcxLjE4LTE4LjI0LDEwNC42MSwxLjIxYzE2Ljg5LDkuODIsMzAuMDksMjMuNzMsMzkuMDYsMzkuNzgKCQlDNTY4LjQ1LDM5OS43Niw1NzAuMTIsNDM4LjI2LDU1Mi40OSw0NzEuMTV6Ii8+CjwvZz4KPC9zdmc+Cg==';
1
+ 'use strict';
109
2
 
110
3
  function getDefaultExportFromCjs (x) {
111
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -132,498 +25,4 @@ var qrCodeStyling = createCommonjsModule(function (module, exports) {
132
25
 
133
26
  const QRCodeStyling = /*@__PURE__*/getDefaultExportFromCjs(qrCodeStyling);
134
27
 
135
- const GatacaQRDisplay = class {
136
- constructor(hostRef) {
137
- registerInstance(this, hostRef);
138
- this.qrData = undefined;
139
- this.size = 256;
140
- this.logoSize = 0;
141
- this.logoSrc = undefined;
142
- this.qrColor = "#1E1E20";
143
- this.rounded = true;
144
- }
145
- componentDidLoad() {
146
- const qrCode = new QRCodeStyling({
147
- data: this.qrData,
148
- width: this.size,
149
- height: this.size,
150
- image: this.logoSize > 0 ? this.logoSrc || logoGatacaSvg : undefined,
151
- margin: 10,
152
- type: "svg",
153
- dotsOptions: {
154
- color: this.qrColor,
155
- type: this.rounded ? "dots" : "square",
156
- },
157
- cornersSquareOptions: {
158
- type: this.rounded ? "extra-rounded" : "square",
159
- },
160
- cornersDotOptions: {
161
- type: this.rounded ? "dot" : "square",
162
- },
163
- imageOptions: {
164
- margin: 2,
165
- imageSize: this.logoSize,
166
- },
167
- });
168
- qrCode.append(this.qr);
169
- }
170
- render() {
171
- return (h("div", { ref: (el) => {
172
- this.qr = el;
173
- } }));
174
- }
175
- };
176
-
177
- const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap\"); @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;padding:1px;background-color:white;min-height:350px;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:\"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px;color:#1e1e20}.popUpContainer .modal-window .qrTitleContainer{padding:14px 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{line-height:23.5px;color:var(--neutral-1000, #1E1E20);text-align:center;font-family:\"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
178
-
179
- const DEEP_LINK_PREFIX$1 = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
180
- //Default values
181
- const DEFAULT_SESSION_TIMEOUT$1 = 300; //5mins as in connect
182
- const DEFAULT_POLLING_FREQ = 3;
183
- const QR_ROLE_CONNECT$1 = "connect";
184
- const FUNCTION_ROLES$1 = {
185
- connect: "scan",
186
- certify: "credential",
187
- };
188
- const GatacaQR = class {
189
- constructor(hostRef) { registerInstance(this, hostRef); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = 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.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT$1; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
190
- disconnectedCallback() {
191
- this.stop();
192
- }
193
- async componentDidLoad() {
194
- if (this.autostart) {
195
- await this.display();
196
- }
197
- }
198
- /**
199
- * Force manually the display of a QR
200
- */
201
- async display() {
202
- await this.getSessionId();
203
- this.result = RESULT_STATUS.ONGOING;
204
- this.poll()
205
- .then((data) => {
206
- this.result = RESULT_STATUS.SUCCESS;
207
- this.sessionData = data;
208
- this.gatacaLoginCompleted.emit(data);
209
- this.successCallback(data);
210
- })
211
- .catch((err) => {
212
- this.clean();
213
- let expired = err === RESULT_STATUS.EXPIRED;
214
- if (expired && this.autorefresh) {
215
- this.display();
216
- }
217
- else {
218
- if (err !== RESULT_STATUS.NOT_STARTED) {
219
- let error = expired
220
- ? new Error(this.userNotScanInTimeErrorLabel)
221
- : new Error(this.credsNotValidatedErrorLabel);
222
- this.result = err;
223
- this.gatacaLoginFailed.emit(error);
224
- this.errorCallback(error);
225
- }
226
- }
227
- });
228
- if (checkMobile() && this.dynamicLink) {
229
- window.location.href = this.getLink();
230
- }
231
- }
232
- /**
233
- * Stop manually an ongoing session
234
- */
235
- async stop() {
236
- this.clean();
237
- if (this.result === RESULT_STATUS.ONGOING) {
238
- this.result = RESULT_STATUS.NOT_STARTED;
239
- }
240
- }
241
- clean() {
242
- this.sessionData = undefined;
243
- this.sessionId = undefined;
244
- }
245
- /**
246
- * Retrieve manually the session data on a successful login
247
- */
248
- async getSessionData() {
249
- return this.sessionData
250
- ? Promise.resolve(this.sessionData)
251
- : Promise.reject(new Error(this.failedLoginErrorLabel));
252
- }
253
- async getSessionId() {
254
- if (this.sessionId) {
255
- return this.sessionId;
256
- }
257
- let { sessionId, authenticationRequest } = await this.createSession();
258
- this.sessionId = sessionId;
259
- this.authenticationRequest = authenticationRequest;
260
- return this.sessionId;
261
- }
262
- getLink() {
263
- if (this.v2 && this.qrRole == QR_ROLE_CONNECT$1) {
264
- return this.authenticationRequest;
265
- }
266
- let op = FUNCTION_ROLES$1[this.qrRole];
267
- let link = "https://gataca.page.link/" + op + "?";
268
- link +=
269
- this.qrRole === QR_ROLE_CONNECT$1
270
- ? "session=" + this.sessionId
271
- : "process=" + this.sessionId;
272
- link +=
273
- "&callback=" + base64UrlEncode(encodeURIComponent(this.callbackServer));
274
- link = encodeURIComponent(link);
275
- return this.dynamicLink ? DEEP_LINK_PREFIX$1 + link : link;
276
- }
277
- async poll() {
278
- let endTime = new Date().getTime() +
279
- (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT$1) * 1000;
280
- let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
281
- let checkFunc = async (component) => {
282
- if (component.result === RESULT_STATUS.NOT_STARTED) {
283
- return { result: RESULT_STATUS.NOT_STARTED };
284
- }
285
- let id = await component.getSessionId();
286
- return component.checkStatus(id);
287
- };
288
- let component = this;
289
- let checkCondition = async function (resolve, reject) {
290
- // If the condition is met, we're done!
291
- let { result, data } = await checkFunc(component);
292
- switch (result) {
293
- case RESULT_STATUS.SUCCESS:
294
- resolve(data);
295
- break;
296
- case RESULT_STATUS.ONGOING:
297
- if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
298
- setTimeout(checkCondition, interval, resolve, reject);
299
- }
300
- else {
301
- reject(RESULT_STATUS.EXPIRED);
302
- }
303
- break;
304
- default:
305
- reject(result);
306
- break;
307
- }
308
- };
309
- return new Promise(checkCondition);
310
- }
311
- renderQRSection() {
312
- switch (this.result) {
313
- case RESULT_STATUS.NOT_STARTED:
314
- return this.renderRetryButton();
315
- case RESULT_STATUS.ONGOING:
316
- return this.renderQR(this.getLink(), 300, true);
317
- case RESULT_STATUS.EXPIRED:
318
- return this.renderRetryButton(this.qrCodeExpiredLabel);
319
- case RESULT_STATUS.FAILED:
320
- return this.renderRetryButton(this.credentialsNotValidatedLabel);
321
- case RESULT_STATUS.SUCCESS:
322
- return this.renderSuccess();
323
- }
324
- }
325
- renderSuccess() {
326
- return (h("div", { class: "success" }, h("img", { src: gatIconCheckSvg, height: 52, width: 52 }), h("p", { class: "successMsg" }, this.successLoginLabel)));
327
- }
328
- renderRetryButton(errorMessage) {
329
- return (h("div", { class: "reload" }, h("div", { id: "notify", onClick: () => this.display() }, h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }), h("p", { class: "qrDescription" }, this.clickInsideBoxLabel, " "), errorMessage ? (h("p", { class: "qrDescription bold" }, this.refreshQrLabel)) : (h("p", { class: "qrDescription bold" }, this.scanQrLabel, "e")), errorMessage && (h("div", { class: "alert" }, h("img", { src: gatIconAlertSvg, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, this.renderQR(this.waitingStartSessionLabel, 250))));
330
- }
331
- renderQR(value, size, useLogo) {
332
- return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": this.logoSrc }));
333
- }
334
- render() {
335
- return (h("div", { class: "popUpContainer" }, h("div", { class: "modal-window is-visible", onClick: (event) => {
336
- event.stopPropagation();
337
- } }, h("div", { class: "modal-window__content" }, h("div", { class: "qrTitleContainer" }, h("p", { class: "qrTitle", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand" }, this.byBrandLabel, " ", h("span", null, h("img", { src: logoGatacaSvg })))), this.result !== RESULT_STATUS.SUCCESS &&
338
- !this.hideQrModalDescription && (h("p", { class: "qrDescription" }, this.qrModalDescription))), h("div", { class: "qrSection" }, this.renderQRSection())))));
339
- }
340
- };
341
- GatacaQR.style = gatacaQrCss;
342
-
343
- 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;padding:1px;background-color:white;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:#1e1e20}.popUpContainer .modal-window .qrTitleContainer{padding:14px 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}";
344
-
345
- const DEEP_LINK_PREFIX = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
346
- const DEFAULT_SESSION_TIMEOUT = 300;
347
- const QR_ROLE_CONNECT = "connect";
348
- const FUNCTION_ROLES = {
349
- connect: "scan",
350
- certify: "credential",
351
- };
352
- const GatacaQRWS = class {
353
- constructor(hostRef) { registerInstance(this, hostRef); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = 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 = RESULT_STATUS.NOT_STARTED; }
354
- disconnectedCallback() {
355
- this.stop();
356
- }
357
- async componentDidLoad() {
358
- if (this.autostart) {
359
- await this.display();
360
- }
361
- }
362
- /**
363
- * Force manually the display of a QR
364
- */
365
- async display() {
366
- let socket = new WebSocket(this.socketEndpoint);
367
- setTimeout(() => {
368
- this.socket.close(1000, "");
369
- }, 1000 * this.sessionTimeout);
370
- this.socket = socket;
371
- socket.onopen = () => {
372
- if (this.wsOnOpen)
373
- this.wsOnOpen(this.socket);
374
- };
375
- socket.onmessage = (msg) => {
376
- if (this.wsOnMessage) {
377
- this.wsOnMessage(this.socket, msg);
378
- }
379
- else {
380
- let wsresp = JSON.parse(msg.data);
381
- if (!!wsresp.sessionId) {
382
- this.handleWSResponse(wsresp);
383
- }
384
- }
385
- };
386
- socket.onerror = () => {
387
- let error = new Error("Error connecting with server");
388
- this.result = RESULT_STATUS.FAILED;
389
- this.gatacaLoginFailed.emit(error);
390
- this.errorCallback(error);
391
- socket.close(1000, "");
392
- };
393
- socket.onclose = () => {
394
- if (this.result === RESULT_STATUS.ONGOING) {
395
- this.result = RESULT_STATUS.EXPIRED;
396
- }
397
- if (this.result === RESULT_STATUS.EXPIRED) {
398
- if (this.autorefresh) {
399
- this.display();
400
- }
401
- else {
402
- let error = new Error("User did not scan the QR in the alloted time");
403
- this.gatacaLoginFailed.emit(error);
404
- this.errorCallback(error);
405
- }
406
- }
407
- };
408
- if (checkMobile() && this.dynamicLink) {
409
- window.location.href = this.getLink();
410
- }
411
- }
412
- sessionMsgReceived(event) {
413
- let wsresp = event.detail;
414
- this.handleWSResponse(wsresp);
415
- }
416
- handleWSResponse(wsresp) {
417
- this.result = wsresp.result;
418
- switch (wsresp.result) {
419
- case RESULT_STATUS.ONGOING:
420
- this.sessionId = wsresp.sessionId;
421
- this.authenticationRequest = wsresp.authenticationRequest;
422
- break;
423
- case RESULT_STATUS.SUCCESS:
424
- this.sessionData = wsresp.authenticatedUserData;
425
- this.gatacaLoginCompleted.emit(wsresp.authenticatedUserData);
426
- this.successCallback(wsresp.authenticatedUserData);
427
- this.socket.close(1000, "");
428
- break;
429
- case RESULT_STATUS.FAILED:
430
- this.socket.close();
431
- let error = new Error("Provided user credentials couldn't be validated");
432
- this.gatacaLoginFailed.emit(error);
433
- this.errorCallback(error);
434
- break;
435
- case RESULT_STATUS.EXPIRED:
436
- this.socket.close();
437
- if (this.autorefresh) {
438
- this.display();
439
- }
440
- else {
441
- let error = new Error("User did not scan the QR in the alloted time");
442
- this.gatacaLoginFailed.emit(error);
443
- this.errorCallback(error);
444
- }
445
- }
446
- }
447
- /**
448
- * Stop manually an ongoing session
449
- */
450
- async stop() {
451
- this.sessionData = undefined;
452
- this.sessionId = undefined;
453
- this.socket.close(1000, "Client stopped the connection");
454
- }
455
- /**
456
- * Retrieve manually the session data on a successful login
457
- */
458
- async getSessionData() {
459
- return this.sessionData
460
- ? Promise.resolve(this.sessionData)
461
- : Promise.reject(new Error("No successful login"));
462
- }
463
- getLink() {
464
- if (this.v2 && this.qrRole == QR_ROLE_CONNECT) {
465
- return this.authenticationRequest;
466
- }
467
- let op = FUNCTION_ROLES[this.qrRole];
468
- let link = "https://gataca.page.link/" + op + "?";
469
- link +=
470
- this.qrRole === QR_ROLE_CONNECT
471
- ? "session=" + this.sessionId
472
- : "process=" + this.sessionId;
473
- link +=
474
- "&callback=" + base64UrlEncode(encodeURIComponent(this.callbackServer));
475
- link = encodeURIComponent(link);
476
- return this.dynamicLink ? DEEP_LINK_PREFIX + link : link;
477
- }
478
- renderQRSection() {
479
- switch (this.result) {
480
- case RESULT_STATUS.NOT_STARTED:
481
- return this.renderRetryButton();
482
- case RESULT_STATUS.ONGOING:
483
- return this.renderQR(this.getLink(), 300, true);
484
- case RESULT_STATUS.EXPIRED:
485
- return this.renderRetryButton("QR Code expired");
486
- case RESULT_STATUS.FAILED:
487
- return this.renderRetryButton("User credentials not validated");
488
- case RESULT_STATUS.SUCCESS:
489
- return this.renderSuccess();
490
- }
491
- }
492
- renderSuccess() {
493
- return (h("div", { class: "success" }, h("img", { src: gatIconCheckSvg, height: 52, width: 52 }), h("p", { class: "successMsg" }, "Successful Connection!")));
494
- }
495
- renderRetryButton(errorMessage) {
496
- return (h("div", { class: "reload" }, h("div", { id: "notify", onClick: () => this.display() }, h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }), h("p", { class: "qrDescription" }, "Click inside the box to "), errorMessage ? (h("p", { class: "qrDescription bold" }, "Refresh QR Code")) : (h("p", { class: "qrDescription bold" }, "Scan QR Code")), errorMessage && (h("div", { class: "alert" }, h("img", { src: gatIconAlertSvg, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, this.renderQR("waiting to start a session", 250))));
497
- }
498
- renderQR(value, size, useLogo) {
499
- return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0 }));
500
- }
501
- render() {
502
- return (h("div", { class: "popUpContainer" }, h("div", { class: "modal-window is-visible", onClick: (event) => {
503
- event.stopPropagation();
504
- } }, h("div", { class: "modal-window__content" }, h("div", { class: "qrTitleContainer" }, h("p", { class: "qrTitle" }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand" }, "by Gataca", " ", h("span", null, h("img", { src: logoGatacaSvg })))), this.result !== RESULT_STATUS.SUCCESS && (h("p", { class: "qrDescription" }, this.qrModalDescription))), h("div", { class: "qrSection" }, this.renderQRSection())))));
505
- }
506
- };
507
- GatacaQRWS.style = gatacaQrwsCss;
508
-
509
- const gatacaSsibuttonCss = "@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}";
510
-
511
- const PHONE_ICON$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHvSURBVHgB3ZZPTttAFMbfe3YjL7qYLopcpZXSG7Q3CDfIsqrSJpyg5QQtJ2h7glgUdVs4AeEE5AYEQSDAgtnw357Hm0hAQDaeIRFCfFKyeKPxzzPzvc+DUKCZN80GEv1ABgWOQgSdGbOwv7u0nDueV4zjTzUIKhuAZna4vdQFR828azbI0K/TI/qodaLvjlP+tLDGDCs+IKv9Lbsi7kcv0w9541Q0EREPYcoieEQ9KiyECRXHzbpBUOcnYTfPFOOaaGVx9WsLiDrSIp0iU0wFNgIx/AQyc9I/OmOjy+Y8aBvHQcDUYebewc6/Xtk8J5htcg5efEPGhk0JtqkyBjo7DuZcnuO2sqCyKv8rUDmfTS9IBURqBAL+I6CkzBjOMOs22TLY21n8fl17KzXR3uDvb/CQk0GEdfvN07QvpnAOaGfYaRT25JzU6+rnG2tTpcWAy+Cp0m3U/URLms8HWfg/rn6RFaGSs9KQkZMpvGBWNs2Vandt46ac6YNBuc0fDLMaOU5DFybQ8039p/KJ4bq4rwPewtqoM/1gsCm/NfBXvWjgHhhuDAeLyd3qVSifHQULeZkou9EqemLhmUmav8qrZ4GEMGA7ivzjKvfeqGptFV2YdWPMPHHq0cCh3DdpVdLl/XCY9J1gVvbCiWa6N+JLocPFjCsx9cAAAAAASUVORK5CYII=";
512
- const GatacaSSIButton = class {
513
- constructor(hostRef) {
514
- registerInstance(this, hostRef);
515
- this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
516
- this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
517
- this.buttonText = "Easy login";
518
- this.checkStatus = undefined;
519
- this.createSession = undefined;
520
- this.successCallback = undefined;
521
- this.errorCallback = undefined;
522
- this.qrRole = undefined;
523
- this.callbackServer = undefined;
524
- this.sessionTimeout = undefined;
525
- this.pollingFrequency = undefined;
526
- this.autorefresh = false;
527
- this.v2 = false;
528
- this.qrModalTitle = "Quick Access";
529
- this.modalTitleColor = "#4745B7";
530
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
531
- this.hideBrandTitle = false;
532
- this.dynamicLink = true;
533
- this.logoSize = 0;
534
- this.logoSrc = undefined;
535
- this.qrCodeExpiredLabel = "QR Code expired";
536
- this.credentialsNotValidatedLabel = "User credentials not validated";
537
- this.clickInsideBoxLabel = "Click inside the box to";
538
- this.refreshQrLabel = "Refresh QR Code";
539
- this.scanQrLabel = "Scan QR Code";
540
- this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
541
- this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
542
- this.failedLoginErrorLabel = "No successful login";
543
- this.successLoginLabel = "Successful Connection!";
544
- this.byBrandLabel = "by Gataca";
545
- this.waitingStartSessionLabel = "waiting to start a session";
546
- this.hideQrModalDescription = false;
547
- this.open = false;
548
- this.qr = (h("gataca-qr", { checkStatus: this.checkStatus, createSession: this.createSession, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, pollingFrequency: this.pollingFrequency, autostart: true, autorefresh: this.autorefresh, v2: this.v2, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink, logoSize: this.logoSize, logoSrc: this.logoSrc, modalTitleColor: this.modalTitleColor, qrCodeExpiredLabel: this.qrCodeExpiredLabel, credentialsNotValidatedLabel: this.credentialsNotValidatedLabel, clickInsideBoxLabel: this.clickInsideBoxLabel, refreshQrLabel: this.refreshQrLabel, scanQrLabel: this.scanQrLabel, userNotScanInTimeErrorLabel: this.userNotScanInTimeErrorLabel, credsNotValidatedErrorLabel: this.credsNotValidatedErrorLabel, failedLoginErrorLabel: this.failedLoginErrorLabel, successLoginLabel: this.successLoginLabel, byBrandLabel: this.byBrandLabel, waitingStartSessionLabel: this.waitingStartSessionLabel, hideQrModalDescription: this.hideQrModalDescription }));
549
- }
550
- /**
551
- * Retrieve manually the session data on a successful login
552
- */
553
- async getSessionData() {
554
- return this.qr.getSessionData();
555
- }
556
- renderModal() {
557
- return this.qr;
558
- }
559
- renderButton() {
560
- return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
561
- this.open = !this.open;
562
- if (this.open) {
563
- this.qr.display();
564
- }
565
- else {
566
- this.qr.stop();
567
- }
568
- } }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
569
- }
570
- render() {
571
- return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
572
- }
573
- };
574
- GatacaSSIButton.style = gatacaSsibuttonCss;
575
-
576
- const gatacaSsibuttonwsCss = "@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}";
577
-
578
- const PHONE_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHvSURBVHgB3ZZPTttAFMbfe3YjL7qYLopcpZXSG7Q3CDfIsqrSJpyg5QQtJ2h7glgUdVs4AeEE5AYEQSDAgtnw357Hm0hAQDaeIRFCfFKyeKPxzzPzvc+DUKCZN80GEv1ABgWOQgSdGbOwv7u0nDueV4zjTzUIKhuAZna4vdQFR828azbI0K/TI/qodaLvjlP+tLDGDCs+IKv9Lbsi7kcv0w9541Q0EREPYcoieEQ9KiyECRXHzbpBUOcnYTfPFOOaaGVx9WsLiDrSIp0iU0wFNgIx/AQyc9I/OmOjy+Y8aBvHQcDUYebewc6/Xtk8J5htcg5efEPGhk0JtqkyBjo7DuZcnuO2sqCyKv8rUDmfTS9IBURqBAL+I6CkzBjOMOs22TLY21n8fl17KzXR3uDvb/CQk0GEdfvN07QvpnAOaGfYaRT25JzU6+rnG2tTpcWAy+Cp0m3U/URLms8HWfg/rn6RFaGSs9KQkZMpvGBWNs2Vandt46ac6YNBuc0fDLMaOU5DFybQ8039p/KJ4bq4rwPewtqoM/1gsCm/NfBXvWjgHhhuDAeLyd3qVSifHQULeZkou9EqemLhmUmav8qrZ4GEMGA7ivzjKvfeqGptFV2YdWPMPHHq0cCh3DdpVdLl/XCY9J1gVvbCiWa6N+JLocPFjCsx9cAAAAAASUVORK5CYII=";
579
- const GatacaSSIButtonWS = class {
580
- constructor(hostRef) {
581
- registerInstance(this, hostRef);
582
- this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
583
- this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
584
- this.buttonText = "Easy login";
585
- this.successCallback = undefined;
586
- this.errorCallback = undefined;
587
- this.qrRole = undefined;
588
- this.callbackServer = undefined;
589
- this.socketEndpoint = undefined;
590
- this.sessionTimeout = undefined;
591
- this.wsOnOpen = undefined;
592
- this.wsOnMessage = undefined;
593
- this.autostart = true;
594
- this.autorefresh = false;
595
- this.v2 = false;
596
- this.qrModalTitle = "Quick Access";
597
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
598
- this.hideBrandTitle = false;
599
- this.dynamicLink = true;
600
- this.open = false;
601
- this.qr = (h("gataca-qrws", { wsOnMessage: this.wsOnMessage, wsOnOpen: this.wsOnOpen, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, socketEndpoint: this.socketEndpoint, autostart: true, autorefresh: this.autorefresh, v2: this.v2, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
602
- }
603
- /**
604
- * Retrieve manually the session data on a successful login
605
- */
606
- async getSessionData() {
607
- return this.qr.getSessionData();
608
- }
609
- renderModal() {
610
- return this.qr;
611
- }
612
- renderButton() {
613
- return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
614
- this.open = !this.open;
615
- if (this.open) {
616
- this.qr.display();
617
- }
618
- else {
619
- this.qr.stop();
620
- }
621
- } }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
622
- }
623
- render() {
624
- return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
625
- }
626
- };
627
- GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
628
-
629
- export { GatacaAutoQR as gataca_autoqr, GatacaQR as gataca_qr, GatacaQRDisplay as gataca_qrdisplay, GatacaQRWS as gataca_qrws, GatacaSSIButton as gataca_ssibutton, GatacaSSIButtonWS as gataca_ssibuttonws };
28
+ exports.QRCodeStyling = QRCodeStyling;