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