@gataca/qr 2.0.0 → 2.0.1

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 (31) hide show
  1. package/dist/{esm/qr-code-styling-0eeb38d5.js → cjs/gataca-autoqr_6.cjs.entry.js} +599 -1
  2. package/dist/cjs/gatacaqr.cjs.js +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +20 -1
  5. package/dist/collection/components/gataca-qr/gataca-qr.css +2 -0
  6. package/dist/collection/components/gataca-qrws/gataca-qrws.css +2 -0
  7. package/dist/components/gataca-autoqr.js +20 -1
  8. package/dist/components/gataca-qr2.js +1 -1
  9. package/dist/components/gataca-qrws2.js +1 -1
  10. package/dist/{cjs/qr-code-styling-412bbc7a.js → esm/gataca-autoqr_6.entry.js} +589 -2
  11. package/dist/esm/gatacaqr.js +1 -1
  12. package/dist/esm/loader.js +1 -1
  13. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  14. package/dist/gatacaqr/p-4807b345.entry.js +1 -0
  15. package/package.json +1 -1
  16. package/dist/cjs/gat-icon-refresh-751505ff.js +0 -14
  17. package/dist/cjs/gataca-autoqr.cjs.entry.js +0 -88
  18. package/dist/cjs/gataca-qr.cjs.entry.js +0 -175
  19. package/dist/cjs/gataca-qrdisplay_2.cjs.entry.js +0 -219
  20. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +0 -114
  21. package/dist/esm/gat-icon-refresh-179ea123.js +0 -9
  22. package/dist/esm/gataca-autoqr.entry.js +0 -84
  23. package/dist/esm/gataca-qr.entry.js +0 -171
  24. package/dist/esm/gataca-qrdisplay_2.entry.js +0 -214
  25. package/dist/esm/gataca-ssibutton_2.entry.js +0 -109
  26. package/dist/gatacaqr/p-0905677f.entry.js +0 -1
  27. package/dist/gatacaqr/p-0be4566d.js +0 -1
  28. package/dist/gatacaqr/p-1d35273f.entry.js +0 -1
  29. package/dist/gatacaqr/p-2f22c7fc.js +0 -1
  30. package/dist/gatacaqr/p-4139a068.entry.js +0 -1
  31. package/dist/gatacaqr/p-f85d7e76.entry.js +0 -1
@@ -1,3 +1,118 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-0b7a1532.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
+ console.log("Got RESPONSE", response);
51
+ response
52
+ .json()
53
+ .then((data) => {
54
+ console.log("Got DATA", data);
55
+ data = fixFunctions(data);
56
+ this.config = data;
57
+ this.loading = false;
58
+ })
59
+ .catch((err) => {
60
+ console.log("Cannot retrieve selected config", err);
61
+ this.loading = false;
62
+ });
63
+ })
64
+ .catch((err) => {
65
+ console.log("Cannot retrieve selected config", err);
66
+ this.loading = false;
67
+ });
68
+ }
69
+ /**
70
+ * Retrieve manually the session data on a successful login
71
+ */
72
+ async getSessionData() {
73
+ return this.qr.getSessionData();
74
+ }
75
+ selectQR() {
76
+ if (this.config.useButton) {
77
+ if (this.config.useWs) {
78
+ 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 }));
79
+ }
80
+ else {
81
+ 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 }));
82
+ }
83
+ }
84
+ else {
85
+ if (this.config.useWs) {
86
+ 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 }));
87
+ }
88
+ else {
89
+ 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 }));
90
+ }
91
+ }
92
+ }
93
+ render() {
94
+ if (this.loading) {
95
+ //TODO: Improve loading message
96
+ return index.h("div", null, "Loading...");
97
+ }
98
+ if (this.config) {
99
+ this.selectQR();
100
+ return this.qr;
101
+ }
102
+ //TODO: Improve error message
103
+ return index.h("div", null, "Error loading your config...");
104
+ }
105
+ };
106
+ GatacaAutoQR.style = gatacaAutoqrCss;
107
+
108
+ const gatIconAlertSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0i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0xMTUuMgoJCWMyOS4yLTUwLjU4LDkzLjc0LTY4LjAzLDE0NC40Mi0zOS4xNmMwLjQ3LDAuMjcsMC45MywwLjU0LDEuNCwwLjgxYzEuMjMsMC43LDIuNDcsMS4zOSwzLjcyLDIuMDdsMjEuODEsMTIuNTlsMzUuOCwyMC42NwoJCWw1OS44MiwzNC41M2wzLjE2LDEuODNsOTMuNzksNTQuMTNsNTcuMDQtNDcuODZsMC4wNS0wLjA5bC0xMTUuODYtNjYuODdjNC41LTMuODgsOS4yOS03LjM1LDE0LjMxLTEwLjM4CgkJYzEuMjMtMC43NCwyLjQ2LTEuNDYsMy43Mi0yLjE1YzMxLjU2LTE3LjM3LDcxLjE4LTE4LjI0LDEwNC42MSwxLjIxYzE2Ljg5LDkuODIsMzAuMDksMjMuNzMsMzkuMDYsMzkuNzgKCQlDNTY4LjQ1LDM5OS43Niw1NzAuMTIsNDM4LjI2LDU1Mi40OSw0NzEuMTV6Ii8+CjwvZz4KPC9zdmc+Cg==';
115
+
1
116
  function getDefaultExportFromCjs (x) {
2
117
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3
118
  }
@@ -23,4 +138,487 @@ var qrCodeStyling = createCommonjsModule(function (module, exports) {
23
138
 
24
139
  const QRCodeStyling = /*@__PURE__*/getDefaultExportFromCjs(qrCodeStyling);
25
140
 
26
- export { QRCodeStyling as Q };
141
+ const GatacaQRDisplay = class {
142
+ constructor(hostRef) {
143
+ index.registerInstance(this, hostRef);
144
+ this.qrData = undefined;
145
+ this.size = 256;
146
+ this.logoSize = 0;
147
+ this.logoSrc = undefined;
148
+ this.qrColor = "#181B5E";
149
+ this.rounded = true;
150
+ }
151
+ componentDidLoad() {
152
+ const qrCode = new QRCodeStyling({
153
+ data: this.qrData,
154
+ width: this.size,
155
+ height: this.size,
156
+ image: this.logoSize > 0 ? this.logoSrc || logoGatacaSvg : undefined,
157
+ margin: 10,
158
+ type: "svg",
159
+ dotsOptions: {
160
+ color: this.qrColor,
161
+ type: this.rounded ? "dots" : "square",
162
+ },
163
+ cornersSquareOptions: {
164
+ type: this.rounded ? "extra-rounded" : "square",
165
+ },
166
+ cornersDotOptions: {
167
+ type: this.rounded ? "dot" : "square",
168
+ },
169
+ imageOptions: {
170
+ margin: 2,
171
+ imageSize: this.logoSize,
172
+ },
173
+ });
174
+ qrCode.append(this.qr);
175
+ }
176
+ render() {
177
+ return (index.h("div", { ref: (el) => {
178
+ this.qr = el;
179
+ } }));
180
+ }
181
+ };
182
+
183
+ const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .modal-window{position:relative;border-radius:6px;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;width:300px;padding:1px;background-color:white;min-height:408px;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window p{font-family:\"Work Sans\", \"Helvetica Neue\", sans-serif;font-weight:normal;font-size:12px;letter-spacing:1px;color:#181B5E}.popUpContainer .modal-window .qrTitleContainer{padding:24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .success .successMsg{margin-top:20px;font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
184
+
185
+ const DEEP_LINK_PREFIX$1 = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
186
+ //Default values
187
+ const DEFAULT_SESSION_TIMEOUT$1 = 300; //5mins as in connect
188
+ const DEFAULT_POLLING_FREQ = 3;
189
+ const QR_ROLE_CONNECT$1 = "connect";
190
+ const FUNCTION_ROLES$1 = {
191
+ connect: "scan",
192
+ certify: "credential",
193
+ };
194
+ const GatacaQR = class {
195
+ constructor(hostRef) { index.registerInstance(this, hostRef); this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; this.qrModalTitle = "Quick Access"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideBrandTitle = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT$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; }
196
+ disconnectedCallback() {
197
+ this.stop();
198
+ }
199
+ async componentDidLoad() {
200
+ if (this.autostart) {
201
+ await this.display();
202
+ }
203
+ }
204
+ /**
205
+ * Force manually the display of a QR
206
+ */
207
+ async display() {
208
+ await this.getSessionId();
209
+ this.result = utils.RESULT_STATUS.ONGOING;
210
+ this.poll()
211
+ .then((data) => {
212
+ this.result = utils.RESULT_STATUS.SUCCESS;
213
+ this.sessionData = data;
214
+ this.gatacaLoginCompleted.emit(data);
215
+ this.successCallback(data);
216
+ })
217
+ .catch((err) => {
218
+ this.clean();
219
+ let expired = err === utils.RESULT_STATUS.EXPIRED;
220
+ if (expired && this.autorefresh) {
221
+ this.display();
222
+ }
223
+ else {
224
+ if (err !== utils.RESULT_STATUS.NOT_STARTED) {
225
+ let error = expired
226
+ ? new Error("User did not scan the QR in the alloted time")
227
+ : new Error("Provided user credentials couldn't be validated");
228
+ this.result = err;
229
+ this.gatacaLoginFailed.emit(error);
230
+ this.errorCallback(error);
231
+ }
232
+ }
233
+ });
234
+ if (utils.checkMobile() && this.dynamicLink) {
235
+ window.location.href = this.getLink();
236
+ }
237
+ }
238
+ /**
239
+ * Stop manually an ongoing session
240
+ */
241
+ async stop() {
242
+ this.clean();
243
+ if (this.result === utils.RESULT_STATUS.ONGOING) {
244
+ this.result = utils.RESULT_STATUS.NOT_STARTED;
245
+ }
246
+ }
247
+ clean() {
248
+ this.sessionData = undefined;
249
+ this.sessionId = undefined;
250
+ }
251
+ /**
252
+ * Retrieve manually the session data on a successful login
253
+ */
254
+ async getSessionData() {
255
+ return this.sessionData
256
+ ? Promise.resolve(this.sessionData)
257
+ : Promise.reject(new Error("No successful login"));
258
+ }
259
+ async getSessionId() {
260
+ if (this.sessionId) {
261
+ return this.sessionId;
262
+ }
263
+ let { sessionId, authenticationRequest } = await this.createSession();
264
+ this.sessionId = sessionId;
265
+ this.authenticationRequest = authenticationRequest;
266
+ return this.sessionId;
267
+ }
268
+ getLink() {
269
+ if (this.v2 && this.qrRole == QR_ROLE_CONNECT$1) {
270
+ return this.authenticationRequest;
271
+ }
272
+ let op = FUNCTION_ROLES$1[this.qrRole];
273
+ let link = "https://gataca.page.link/" + op + "?";
274
+ link +=
275
+ this.qrRole === QR_ROLE_CONNECT$1
276
+ ? "session=" + this.sessionId
277
+ : "process=" + this.sessionId;
278
+ link +=
279
+ "&callback=" + utils.base64UrlEncode(encodeURIComponent(this.callbackServer));
280
+ link = encodeURIComponent(link);
281
+ return this.dynamicLink ? DEEP_LINK_PREFIX$1 + link : link;
282
+ }
283
+ async poll() {
284
+ let endTime = new Date().getTime() +
285
+ (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT$1) * 1000;
286
+ let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
287
+ let checkFunc = async (component) => {
288
+ if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
289
+ return { result: utils.RESULT_STATUS.NOT_STARTED };
290
+ }
291
+ let id = await component.getSessionId();
292
+ return component.checkStatus(id);
293
+ };
294
+ let component = this;
295
+ let checkCondition = async function (resolve, reject) {
296
+ // If the condition is met, we're done!
297
+ let { result, data } = await checkFunc(component);
298
+ switch (result) {
299
+ case utils.RESULT_STATUS.SUCCESS:
300
+ resolve(data);
301
+ break;
302
+ case utils.RESULT_STATUS.ONGOING:
303
+ if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
304
+ setTimeout(checkCondition, interval, resolve, reject);
305
+ }
306
+ else {
307
+ reject(utils.RESULT_STATUS.EXPIRED);
308
+ }
309
+ break;
310
+ default:
311
+ reject(result);
312
+ break;
313
+ }
314
+ };
315
+ return new Promise(checkCondition);
316
+ }
317
+ renderQRSection() {
318
+ switch (this.result) {
319
+ case utils.RESULT_STATUS.NOT_STARTED:
320
+ return this.renderRetryButton();
321
+ case utils.RESULT_STATUS.ONGOING:
322
+ return this.renderQR(this.getLink(), 300, true);
323
+ case utils.RESULT_STATUS.EXPIRED:
324
+ return this.renderRetryButton("QR Code expired");
325
+ case utils.RESULT_STATUS.FAILED:
326
+ return this.renderRetryButton("User credentials not validated");
327
+ case utils.RESULT_STATUS.SUCCESS:
328
+ return this.renderSuccess();
329
+ }
330
+ }
331
+ renderSuccess() {
332
+ return (index.h("div", { class: "success" }, index.h("img", { src: gatIconCheckSvg, height: 52, width: 52 }), index.h("p", { class: "successMsg" }, "Successful Connection!")));
333
+ }
334
+ renderRetryButton(errorMessage) {
335
+ 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))));
336
+ }
337
+ renderQR(value, size, useLogo) {
338
+ return (index.h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0 }));
339
+ }
340
+ render() {
341
+ return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: "modal-window is-visible", onClick: (event) => {
342
+ event.stopPropagation();
343
+ } }, 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())))));
344
+ }
345
+ };
346
+ GatacaQR.style = gatacaQrCss;
347
+
348
+ 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:#181B5E}.popUpContainer .modal-window .qrTitleContainer{padding:24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .success .successMsg{margin-top:20px;font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
349
+
350
+ const DEEP_LINK_PREFIX = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
351
+ const DEFAULT_SESSION_TIMEOUT = 300;
352
+ const QR_ROLE_CONNECT = "connect";
353
+ const FUNCTION_ROLES = {
354
+ connect: "scan",
355
+ certify: "credential",
356
+ };
357
+ const GatacaQRWS = class {
358
+ 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; }
359
+ disconnectedCallback() {
360
+ this.stop();
361
+ }
362
+ async componentDidLoad() {
363
+ if (this.autostart) {
364
+ await this.display();
365
+ }
366
+ }
367
+ /**
368
+ * Force manually the display of a QR
369
+ */
370
+ async display() {
371
+ let socket = new WebSocket(this.socketEndpoint);
372
+ setTimeout(() => {
373
+ this.socket.close(1000, "");
374
+ }, 1000 * this.sessionTimeout);
375
+ this.socket = socket;
376
+ socket.onopen = () => {
377
+ if (this.wsOnOpen)
378
+ this.wsOnOpen(this.socket);
379
+ };
380
+ socket.onmessage = (msg) => {
381
+ if (this.wsOnMessage) {
382
+ this.wsOnMessage(this.socket, msg);
383
+ }
384
+ else {
385
+ let wsresp = JSON.parse(msg.data);
386
+ if (!!wsresp.sessionId) {
387
+ this.handleWSResponse(wsresp);
388
+ }
389
+ }
390
+ };
391
+ socket.onerror = () => {
392
+ let error = new Error("Error connecting with server");
393
+ this.result = utils.RESULT_STATUS.FAILED;
394
+ this.gatacaLoginFailed.emit(error);
395
+ this.errorCallback(error);
396
+ socket.close(1000, "");
397
+ };
398
+ socket.onclose = () => {
399
+ if (this.result === utils.RESULT_STATUS.ONGOING) {
400
+ this.result = utils.RESULT_STATUS.EXPIRED;
401
+ }
402
+ if (this.result === utils.RESULT_STATUS.EXPIRED) {
403
+ if (this.autorefresh) {
404
+ this.display();
405
+ }
406
+ else {
407
+ let error = new Error("User did not scan the QR in the alloted time");
408
+ this.gatacaLoginFailed.emit(error);
409
+ this.errorCallback(error);
410
+ }
411
+ }
412
+ };
413
+ if (utils.checkMobile() && this.dynamicLink) {
414
+ window.location.href = this.getLink();
415
+ }
416
+ }
417
+ sessionMsgReceived(event) {
418
+ let wsresp = event.detail;
419
+ this.handleWSResponse(wsresp);
420
+ }
421
+ handleWSResponse(wsresp) {
422
+ this.result = wsresp.result;
423
+ switch (wsresp.result) {
424
+ case utils.RESULT_STATUS.ONGOING:
425
+ this.sessionId = wsresp.sessionId;
426
+ this.authenticationRequest = wsresp.authenticationRequest;
427
+ break;
428
+ case utils.RESULT_STATUS.SUCCESS:
429
+ this.sessionData = wsresp.authenticatedUserData;
430
+ this.gatacaLoginCompleted.emit(wsresp.authenticatedUserData);
431
+ this.successCallback(wsresp.authenticatedUserData);
432
+ this.socket.close(1000, "");
433
+ break;
434
+ case utils.RESULT_STATUS.FAILED:
435
+ this.socket.close();
436
+ let error = new Error("Provided user credentials couldn't be validated");
437
+ this.gatacaLoginFailed.emit(error);
438
+ this.errorCallback(error);
439
+ break;
440
+ case utils.RESULT_STATUS.EXPIRED:
441
+ this.socket.close();
442
+ if (this.autorefresh) {
443
+ this.display();
444
+ }
445
+ else {
446
+ let error = new Error("User did not scan the QR in the alloted time");
447
+ this.gatacaLoginFailed.emit(error);
448
+ this.errorCallback(error);
449
+ }
450
+ }
451
+ }
452
+ /**
453
+ * Stop manually an ongoing session
454
+ */
455
+ async stop() {
456
+ this.sessionData = undefined;
457
+ this.sessionId = undefined;
458
+ this.socket.close(1000, "Client stopped the connection");
459
+ }
460
+ /**
461
+ * Retrieve manually the session data on a successful login
462
+ */
463
+ async getSessionData() {
464
+ return this.sessionData
465
+ ? Promise.resolve(this.sessionData)
466
+ : Promise.reject(new Error("No successful login"));
467
+ }
468
+ getLink() {
469
+ if (this.v2 && this.qrRole == QR_ROLE_CONNECT) {
470
+ return this.authenticationRequest;
471
+ }
472
+ let op = FUNCTION_ROLES[this.qrRole];
473
+ let link = "https://gataca.page.link/" + op + "?";
474
+ link +=
475
+ this.qrRole === QR_ROLE_CONNECT
476
+ ? "session=" + this.sessionId
477
+ : "process=" + this.sessionId;
478
+ link +=
479
+ "&callback=" + utils.base64UrlEncode(encodeURIComponent(this.callbackServer));
480
+ link = encodeURIComponent(link);
481
+ return this.dynamicLink ? DEEP_LINK_PREFIX + link : link;
482
+ }
483
+ renderQRSection() {
484
+ switch (this.result) {
485
+ case utils.RESULT_STATUS.NOT_STARTED:
486
+ return this.renderRetryButton();
487
+ case utils.RESULT_STATUS.ONGOING:
488
+ return this.renderQR(this.getLink(), 300, true);
489
+ case utils.RESULT_STATUS.EXPIRED:
490
+ return this.renderRetryButton("QR Code expired");
491
+ case utils.RESULT_STATUS.FAILED:
492
+ return this.renderRetryButton("User credentials not validated");
493
+ case utils.RESULT_STATUS.SUCCESS:
494
+ return this.renderSuccess();
495
+ }
496
+ }
497
+ renderSuccess() {
498
+ return (index.h("div", { class: "success" }, index.h("img", { src: gatIconCheckSvg, height: 52, width: 52 }), index.h("p", { class: "successMsg" }, "Successful Connection!")));
499
+ }
500
+ renderRetryButton(errorMessage) {
501
+ 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))));
502
+ }
503
+ renderQR(value, size, useLogo) {
504
+ return (index.h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0 }));
505
+ }
506
+ render() {
507
+ return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: "modal-window is-visible", onClick: (event) => {
508
+ event.stopPropagation();
509
+ } }, 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())))));
510
+ }
511
+ };
512
+ GatacaQRWS.style = gatacaQrwsCss;
513
+
514
+ 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}";
515
+
516
+ 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=";
517
+ const GatacaSSIButton = class {
518
+ constructor(hostRef) {
519
+ index.registerInstance(this, hostRef);
520
+ this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
521
+ this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
522
+ this.buttonText = "Easy login";
523
+ this.checkStatus = undefined;
524
+ this.createSession = undefined;
525
+ this.successCallback = undefined;
526
+ this.errorCallback = undefined;
527
+ this.qrRole = undefined;
528
+ this.callbackServer = undefined;
529
+ this.sessionTimeout = undefined;
530
+ this.pollingFrequency = undefined;
531
+ this.autorefresh = false;
532
+ this.v2 = false;
533
+ this.qrModalTitle = "Quick Access";
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.open = false;
538
+ 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 }));
539
+ }
540
+ /**
541
+ * Retrieve manually the session data on a successful login
542
+ */
543
+ async getSessionData() {
544
+ return this.qr.getSessionData();
545
+ }
546
+ renderModal() {
547
+ return this.qr;
548
+ }
549
+ renderButton() {
550
+ return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
551
+ this.open = !this.open;
552
+ if (this.open) {
553
+ this.qr.display();
554
+ }
555
+ else {
556
+ this.qr.stop();
557
+ }
558
+ } }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
559
+ }
560
+ render() {
561
+ return (index.h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
562
+ }
563
+ };
564
+ GatacaSSIButton.style = gatacaSsibuttonCss;
565
+
566
+ 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}";
567
+
568
+ 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=";
569
+ const GatacaSSIButtonWS = class {
570
+ constructor(hostRef) {
571
+ index.registerInstance(this, hostRef);
572
+ this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
573
+ this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
574
+ this.buttonText = "Easy login";
575
+ this.successCallback = undefined;
576
+ this.errorCallback = undefined;
577
+ this.qrRole = undefined;
578
+ this.callbackServer = undefined;
579
+ this.socketEndpoint = undefined;
580
+ this.sessionTimeout = undefined;
581
+ this.wsOnOpen = undefined;
582
+ this.wsOnMessage = undefined;
583
+ this.autostart = true;
584
+ this.autorefresh = false;
585
+ this.v2 = false;
586
+ this.qrModalTitle = "Quick Access";
587
+ this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
588
+ this.hideBrandTitle = false;
589
+ this.dynamicLink = true;
590
+ this.open = false;
591
+ 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 }));
592
+ }
593
+ /**
594
+ * Retrieve manually the session data on a successful login
595
+ */
596
+ async getSessionData() {
597
+ return this.qr.getSessionData();
598
+ }
599
+ renderModal() {
600
+ return this.qr;
601
+ }
602
+ renderButton() {
603
+ return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
604
+ this.open = !this.open;
605
+ if (this.open) {
606
+ this.qr.display();
607
+ }
608
+ else {
609
+ this.qr.stop();
610
+ }
611
+ } }, index.h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
612
+ }
613
+ render() {
614
+ return (index.h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
615
+ }
616
+ };
617
+ GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
618
+
619
+ exports.gataca_autoqr = GatacaAutoQR;
620
+ exports.gataca_qr = GatacaQR;
621
+ exports.gataca_qrdisplay = GatacaQRDisplay;
622
+ exports.gataca_qrws = GatacaQRWS;
623
+ exports.gataca_ssibutton = GatacaSSIButton;
624
+ exports.gataca_ssibuttonws = GatacaSSIButtonWS;