@gataca/qr 0.0.10 → 0.0.12

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 (39) hide show
  1. package/dist/{esm/qr-code-styling-0eeb38d5.js → cjs/gat-icon-alert-6127161a.js} +15 -1
  2. package/dist/cjs/{gataca-qr_2.cjs.entry.js → gataca-qr_3.cjs.entry.js} +281 -17
  3. package/dist/cjs/gataca-qrws.cjs.entry.js +1 -2
  4. package/dist/cjs/gataca-ssibuttonws.cjs.entry.js +60 -0
  5. package/dist/cjs/gatacaqr.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/components/gataca-qr/components/qr/QR.js +2 -2
  8. package/dist/collection/components/gataca-qr/gataca-qr.js +25 -6
  9. package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +24 -2
  10. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +23 -1
  11. package/dist/components/gataca-qr2.js +11 -8
  12. package/dist/components/gataca-qrdisplay2.js +8 -2
  13. package/dist/components/gataca-ssibutton2.js +7 -1
  14. package/dist/{cjs/qr-code-styling-412bbc7a.js → esm/gat-icon-alert-c9761842.js} +8 -2
  15. package/dist/esm/{gataca-qr_2.entry.js → gataca-qr_3.entry.js} +280 -17
  16. package/dist/esm/gataca-qrws.entry.js +1 -2
  17. package/dist/esm/gataca-ssibuttonws.entry.js +56 -0
  18. package/dist/esm/gatacaqr.js +1 -1
  19. package/dist/esm/loader.js +1 -1
  20. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  21. package/dist/gatacaqr/p-8464955a.entry.js +1 -0
  22. package/dist/gatacaqr/p-bdd385ad.entry.js +1 -0
  23. package/dist/gatacaqr/p-d79c8f74.js +1 -0
  24. package/dist/gatacaqr/p-e956c420.entry.js +1 -0
  25. package/dist/types/components/gataca-qr/components/qr/QR.d.ts +1 -0
  26. package/dist/types/components/gataca-qr/gataca-qr.d.ts +5 -0
  27. package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +5 -0
  28. package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +5 -0
  29. package/dist/types/components.d.ts +24 -0
  30. package/package.json +1 -1
  31. package/dist/cjs/gat-icon-alert-0ad19b26.js +0 -14
  32. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +0 -315
  33. package/dist/esm/gat-icon-alert-7b06ef3a.js +0 -9
  34. package/dist/esm/gataca-ssibutton_2.entry.js +0 -310
  35. package/dist/gatacaqr/p-0be4566d.js +0 -1
  36. package/dist/gatacaqr/p-16298cb4.entry.js +0 -1
  37. package/dist/gatacaqr/p-328d4254.entry.js +0 -1
  38. package/dist/gatacaqr/p-9e9af27e.entry.js +0 -1
  39. package/dist/gatacaqr/p-ea783014.js +0 -1
@@ -1,315 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-93d47a75.js');
6
- require('./qr-code-styling-412bbc7a.js');
7
- const utils = require('./utils-ef28b844.js');
8
-
9
- 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}";
10
-
11
- 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=";
12
- //Default values
13
- const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
14
- const DEFAULT_POLLING_FREQ = 3;
15
- const GatacaSSIButton = class {
16
- constructor(hostRef) {
17
- index.registerInstance(this, hostRef);
18
- this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
19
- this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
20
- this.buttonText = "Easy login";
21
- this.autostart = true;
22
- this.checkStatus = undefined;
23
- this.createSession = undefined;
24
- this.successCallback = undefined;
25
- this.errorCallback = undefined;
26
- this.handleCheckAppLoading = undefined;
27
- this.checkAppTimeout = 6;
28
- this.qrRole = undefined;
29
- this.callbackServer = undefined;
30
- this.sessionTimeout = undefined;
31
- this.pollingFrequency = undefined;
32
- this.autorefresh = false;
33
- this.v = "3";
34
- this.qrModalTitle = "Quick Access";
35
- this.modalTitleColor = "#4745B7";
36
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
37
- this.hideBrandTitle = false;
38
- this.dynamicLink = true;
39
- this.logoSize = 0;
40
- this.logoSrc = undefined;
41
- this.qrCodeExpiredLabel = "QR Code expired";
42
- this.credentialsNotValidatedLabel = "User credentials not validated";
43
- this.clickInsideBoxLabel = "Click inside the box to";
44
- this.refreshQrLabel = "Refresh QR Code";
45
- this.scanQrLabel = "Scan QR Code";
46
- this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
47
- this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
48
- this.failedLoginErrorLabel = "No successful login";
49
- this.successLoginLabel = "Successful Connection!";
50
- this.byBrandLabel = "by Gataca";
51
- this.waitingStartSessionLabel = "waiting to start a session";
52
- this.hideQrModalDescription = false;
53
- this.open = false;
54
- this.sessionId = undefined;
55
- this.authenticationRequest = undefined;
56
- this.sessionData = undefined;
57
- this.result = utils.RESULT_STATUS.NOT_STARTED;
58
- this.qr = (index.h("gataca-qr", { ref: (el) => (this.qrElement = el), 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: this.autostart, autorefresh: this.autorefresh, v: this.v, 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 }));
59
- }
60
- /**
61
- * Retrieve manually the session data on a successful login
62
- */
63
- async getSessionData() {
64
- return this.qr.getSessionData();
65
- }
66
- async getSessionId() {
67
- if (this.sessionId) {
68
- return this.sessionId;
69
- }
70
- let { sessionId, authenticationRequest } = await this.createSession();
71
- this.sessionId = sessionId;
72
- this.authenticationRequest = authenticationRequest;
73
- return this.sessionId;
74
- }
75
- /**
76
- * Force manually the start polling
77
- */
78
- async startMobilePolling() {
79
- await this.getSessionId();
80
- this.result = utils.RESULT_STATUS.ONGOING;
81
- this.poll()
82
- .then((data) => {
83
- this.result = utils.RESULT_STATUS.SUCCESS;
84
- this.sessionData = data;
85
- this.gatacaLoginCompleted.emit(data);
86
- this.successCallback(data);
87
- })
88
- .catch((err) => {
89
- this.clean();
90
- let expired = err === utils.RESULT_STATUS.EXPIRED;
91
- if (expired && this.autorefresh) {
92
- this.startMobilePolling();
93
- }
94
- else {
95
- if (err !== utils.RESULT_STATUS.NOT_STARTED) {
96
- let error = expired
97
- ? new Error(this.userNotScanInTimeErrorLabel)
98
- : new Error(this.credsNotValidatedErrorLabel);
99
- this.result = err;
100
- this.gatacaLoginFailed.emit(error);
101
- this.errorCallback(error);
102
- }
103
- }
104
- });
105
- }
106
- /**
107
- * Stop manually an ongoing session
108
- */
109
- async stop() {
110
- this.clean();
111
- if (this.result === utils.RESULT_STATUS.ONGOING || utils.RESULT_STATUS.READ) {
112
- this.result = utils.RESULT_STATUS.NOT_STARTED;
113
- }
114
- }
115
- clean() {
116
- this.sessionData = undefined;
117
- this.sessionId = undefined;
118
- }
119
- renderModal() {
120
- return this.qr;
121
- }
122
- async poll() {
123
- let endTime = new Date().getTime() +
124
- (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
125
- let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
126
- let checkFunc = async (component) => {
127
- if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
128
- return { result: utils.RESULT_STATUS.NOT_STARTED };
129
- }
130
- let id = await component.getSessionId();
131
- return component.checkStatus(id);
132
- };
133
- let component = this;
134
- let checkCondition = async function (resolve, reject) {
135
- // If the condition is met, we're done!
136
- let { result, data } = await checkFunc(component);
137
- switch (result) {
138
- case utils.RESULT_STATUS.SUCCESS:
139
- resolve(data);
140
- break;
141
- case utils.RESULT_STATUS.READ:
142
- component.result = utils.RESULT_STATUS.READ;
143
- case utils.RESULT_STATUS.ONGOING:
144
- if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
145
- setTimeout(checkCondition, interval, resolve, reject);
146
- }
147
- else {
148
- reject(utils.RESULT_STATUS.EXPIRED);
149
- }
150
- break;
151
- default:
152
- reject(result);
153
- break;
154
- }
155
- };
156
- return new Promise(checkCondition);
157
- }
158
- isAppInstalled(appScheme, callback) {
159
- let timeout;
160
- let detected = false;
161
- if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
162
- window.location.href = appScheme;
163
- }
164
- const waitTimeToCheckApp = this.checkAppTimeout * 1000;
165
- timeout = setTimeout(() => {
166
- if (!detected) {
167
- callback(false);
168
- }
169
- cleanup();
170
- }, waitTimeToCheckApp);
171
- const handleVisibilityChange = () => {
172
- if (document.hidden) {
173
- detected = true;
174
- callback(true);
175
- if (!this.autostart) {
176
- this.startMobilePolling();
177
- }
178
- cleanup();
179
- }
180
- };
181
- document.addEventListener("visibilitychange", handleVisibilityChange);
182
- function cleanup() {
183
- clearTimeout(timeout);
184
- document.removeEventListener("visibilitychange", handleVisibilityChange);
185
- }
186
- }
187
- renderDesktopButton() {
188
- return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
189
- this.open = !this.open;
190
- setTimeout(() => {
191
- var _a, _b;
192
- if (this.open) {
193
- (_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
194
- }
195
- else {
196
- (_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
197
- }
198
- }, 0);
199
- } }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
200
- }
201
- async getAuthRequest() {
202
- let { authenticationRequest } = await this.createSession();
203
- return authenticationRequest;
204
- }
205
- renderMobileButton(isAndroid, isIos) {
206
- if (this.autostart) {
207
- this.startMobilePolling();
208
- }
209
- let loading = false;
210
- const handleLoading = (isLoading) => {
211
- loading = isLoading;
212
- if (this.handleCheckAppLoading) {
213
- this.handleCheckAppLoading(isLoading);
214
- }
215
- };
216
- const executeRedirection = async () => {
217
- handleLoading(true);
218
- const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
219
- const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
220
- try {
221
- const appScheme = await this.getAuthRequest();
222
- this.isAppInstalled(appScheme, (installed) => {
223
- if (!installed) {
224
- this.stop();
225
- if (isAndroid) {
226
- window.location.href = androidStoreLink;
227
- }
228
- else if (isIos) {
229
- window.location.href = iosStoreLink;
230
- }
231
- }
232
- handleLoading(false);
233
- });
234
- }
235
- catch (error) {
236
- this.stop();
237
- handleLoading(false);
238
- }
239
- };
240
- return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
241
- executeRedirection();
242
- }, disabled: loading }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
243
- }
244
- render() {
245
- const userAgent =
246
- // @ts-ignore
247
- (navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) || (navigator === null || navigator === void 0 ? void 0 : navigator.vendor) || (window === null || window === void 0 ? void 0 : window.opera);
248
- const isAndroid = /android/i.test(userAgent);
249
- const isIos =
250
- // @ts-ignore
251
- (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
252
- (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
253
- const isMobile = isAndroid || isIos;
254
- return (index.h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
255
- ? this.renderMobileButton(isAndroid, isIos)
256
- : this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
257
- }
258
- };
259
- GatacaSSIButton.style = gatacaSsibuttonCss;
260
-
261
- 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}";
262
-
263
- 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=";
264
- const GatacaSSIButtonWS = class {
265
- constructor(hostRef) {
266
- index.registerInstance(this, hostRef);
267
- this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
268
- this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
269
- this.buttonText = "Easy login";
270
- this.successCallback = undefined;
271
- this.errorCallback = undefined;
272
- this.qrRole = undefined;
273
- this.callbackServer = undefined;
274
- this.socketEndpoint = undefined;
275
- this.sessionTimeout = undefined;
276
- this.wsOnOpen = undefined;
277
- this.wsOnMessage = undefined;
278
- this.autostart = true;
279
- this.autorefresh = false;
280
- this.v = "3";
281
- this.qrModalTitle = "Quick Access";
282
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
283
- this.hideBrandTitle = false;
284
- this.dynamicLink = true;
285
- this.open = false;
286
- 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, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
287
- }
288
- /**
289
- * Retrieve manually the session data on a successful login
290
- */
291
- async getSessionData() {
292
- return this.qr.getSessionData();
293
- }
294
- renderModal() {
295
- return this.qr;
296
- }
297
- renderButton() {
298
- return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
299
- this.open = !this.open;
300
- if (this.open) {
301
- this.qr.display();
302
- }
303
- else {
304
- this.qr.stop();
305
- }
306
- } }, index.h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
307
- }
308
- render() {
309
- return (index.h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
310
- }
311
- };
312
- GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
313
-
314
- exports.gataca_ssibutton = GatacaSSIButton;
315
- exports.gataca_ssibuttonws = GatacaSSIButtonWS;
@@ -1,9 +0,0 @@
1
- const logoGatacaSvg = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDc2IDcxIiB3aWR0aD0iNzEiIGhlaWdodD0iNjYiPgoJPHRpdGxlPlZlY3RvciAoMyktc3ZnPC90aXRsZT4KCTxzdHlsZT4KCQkuczAgeyBmaWxsOiAjNDc0NWI3IH0gCgk8L3N0eWxlPgoJPHBhdGggaWQ9IkxheWVyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsYXNzPSJzMCIgZD0ibTcyLjI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WR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMiAxN0gxMi4wMSIgc3Ryb2tlPSIjQ0QyQjMxIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
8
-
9
- export { gatIconRefreshSvg as a, gatIconAlertSvg as b, gatIconCheckSvg as g, logoGatacaSvg as l };
@@ -1,310 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-2be54f32.js';
2
- import './qr-code-styling-0eeb38d5.js';
3
- import { R as RESULT_STATUS } from './utils-63e7a33b.js';
4
-
5
- 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}";
6
-
7
- 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=";
8
- //Default values
9
- const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
10
- const DEFAULT_POLLING_FREQ = 3;
11
- const GatacaSSIButton = class {
12
- constructor(hostRef) {
13
- registerInstance(this, hostRef);
14
- this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
15
- this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
16
- this.buttonText = "Easy login";
17
- this.autostart = true;
18
- this.checkStatus = undefined;
19
- this.createSession = undefined;
20
- this.successCallback = undefined;
21
- this.errorCallback = undefined;
22
- this.handleCheckAppLoading = undefined;
23
- this.checkAppTimeout = 6;
24
- this.qrRole = undefined;
25
- this.callbackServer = undefined;
26
- this.sessionTimeout = undefined;
27
- this.pollingFrequency = undefined;
28
- this.autorefresh = false;
29
- this.v = "3";
30
- this.qrModalTitle = "Quick Access";
31
- this.modalTitleColor = "#4745B7";
32
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
33
- this.hideBrandTitle = false;
34
- this.dynamicLink = true;
35
- this.logoSize = 0;
36
- this.logoSrc = undefined;
37
- this.qrCodeExpiredLabel = "QR Code expired";
38
- this.credentialsNotValidatedLabel = "User credentials not validated";
39
- this.clickInsideBoxLabel = "Click inside the box to";
40
- this.refreshQrLabel = "Refresh QR Code";
41
- this.scanQrLabel = "Scan QR Code";
42
- this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
43
- this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
44
- this.failedLoginErrorLabel = "No successful login";
45
- this.successLoginLabel = "Successful Connection!";
46
- this.byBrandLabel = "by Gataca";
47
- this.waitingStartSessionLabel = "waiting to start a session";
48
- this.hideQrModalDescription = false;
49
- this.open = false;
50
- this.sessionId = undefined;
51
- this.authenticationRequest = undefined;
52
- this.sessionData = undefined;
53
- this.result = RESULT_STATUS.NOT_STARTED;
54
- this.qr = (h("gataca-qr", { ref: (el) => (this.qrElement = el), 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: this.autostart, autorefresh: this.autorefresh, v: this.v, 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 }));
55
- }
56
- /**
57
- * Retrieve manually the session data on a successful login
58
- */
59
- async getSessionData() {
60
- return this.qr.getSessionData();
61
- }
62
- async getSessionId() {
63
- if (this.sessionId) {
64
- return this.sessionId;
65
- }
66
- let { sessionId, authenticationRequest } = await this.createSession();
67
- this.sessionId = sessionId;
68
- this.authenticationRequest = authenticationRequest;
69
- return this.sessionId;
70
- }
71
- /**
72
- * Force manually the start polling
73
- */
74
- async startMobilePolling() {
75
- await this.getSessionId();
76
- this.result = RESULT_STATUS.ONGOING;
77
- this.poll()
78
- .then((data) => {
79
- this.result = RESULT_STATUS.SUCCESS;
80
- this.sessionData = data;
81
- this.gatacaLoginCompleted.emit(data);
82
- this.successCallback(data);
83
- })
84
- .catch((err) => {
85
- this.clean();
86
- let expired = err === RESULT_STATUS.EXPIRED;
87
- if (expired && this.autorefresh) {
88
- this.startMobilePolling();
89
- }
90
- else {
91
- if (err !== RESULT_STATUS.NOT_STARTED) {
92
- let error = expired
93
- ? new Error(this.userNotScanInTimeErrorLabel)
94
- : new Error(this.credsNotValidatedErrorLabel);
95
- this.result = err;
96
- this.gatacaLoginFailed.emit(error);
97
- this.errorCallback(error);
98
- }
99
- }
100
- });
101
- }
102
- /**
103
- * Stop manually an ongoing session
104
- */
105
- async stop() {
106
- this.clean();
107
- if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
108
- this.result = RESULT_STATUS.NOT_STARTED;
109
- }
110
- }
111
- clean() {
112
- this.sessionData = undefined;
113
- this.sessionId = undefined;
114
- }
115
- renderModal() {
116
- return this.qr;
117
- }
118
- async poll() {
119
- let endTime = new Date().getTime() +
120
- (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
121
- let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
122
- let checkFunc = async (component) => {
123
- if (component.result === RESULT_STATUS.NOT_STARTED) {
124
- return { result: RESULT_STATUS.NOT_STARTED };
125
- }
126
- let id = await component.getSessionId();
127
- return component.checkStatus(id);
128
- };
129
- let component = this;
130
- let checkCondition = async function (resolve, reject) {
131
- // If the condition is met, we're done!
132
- let { result, data } = await checkFunc(component);
133
- switch (result) {
134
- case RESULT_STATUS.SUCCESS:
135
- resolve(data);
136
- break;
137
- case RESULT_STATUS.READ:
138
- component.result = RESULT_STATUS.READ;
139
- case RESULT_STATUS.ONGOING:
140
- if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
141
- setTimeout(checkCondition, interval, resolve, reject);
142
- }
143
- else {
144
- reject(RESULT_STATUS.EXPIRED);
145
- }
146
- break;
147
- default:
148
- reject(result);
149
- break;
150
- }
151
- };
152
- return new Promise(checkCondition);
153
- }
154
- isAppInstalled(appScheme, callback) {
155
- let timeout;
156
- let detected = false;
157
- if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
158
- window.location.href = appScheme;
159
- }
160
- const waitTimeToCheckApp = this.checkAppTimeout * 1000;
161
- timeout = setTimeout(() => {
162
- if (!detected) {
163
- callback(false);
164
- }
165
- cleanup();
166
- }, waitTimeToCheckApp);
167
- const handleVisibilityChange = () => {
168
- if (document.hidden) {
169
- detected = true;
170
- callback(true);
171
- if (!this.autostart) {
172
- this.startMobilePolling();
173
- }
174
- cleanup();
175
- }
176
- };
177
- document.addEventListener("visibilitychange", handleVisibilityChange);
178
- function cleanup() {
179
- clearTimeout(timeout);
180
- document.removeEventListener("visibilitychange", handleVisibilityChange);
181
- }
182
- }
183
- renderDesktopButton() {
184
- return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
185
- this.open = !this.open;
186
- setTimeout(() => {
187
- var _a, _b;
188
- if (this.open) {
189
- (_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
190
- }
191
- else {
192
- (_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
193
- }
194
- }, 0);
195
- } }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
196
- }
197
- async getAuthRequest() {
198
- let { authenticationRequest } = await this.createSession();
199
- return authenticationRequest;
200
- }
201
- renderMobileButton(isAndroid, isIos) {
202
- if (this.autostart) {
203
- this.startMobilePolling();
204
- }
205
- let loading = false;
206
- const handleLoading = (isLoading) => {
207
- loading = isLoading;
208
- if (this.handleCheckAppLoading) {
209
- this.handleCheckAppLoading(isLoading);
210
- }
211
- };
212
- const executeRedirection = async () => {
213
- handleLoading(true);
214
- const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
215
- const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
216
- try {
217
- const appScheme = await this.getAuthRequest();
218
- this.isAppInstalled(appScheme, (installed) => {
219
- if (!installed) {
220
- this.stop();
221
- if (isAndroid) {
222
- window.location.href = androidStoreLink;
223
- }
224
- else if (isIos) {
225
- window.location.href = iosStoreLink;
226
- }
227
- }
228
- handleLoading(false);
229
- });
230
- }
231
- catch (error) {
232
- this.stop();
233
- handleLoading(false);
234
- }
235
- };
236
- return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
237
- executeRedirection();
238
- }, disabled: loading }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
239
- }
240
- render() {
241
- const userAgent =
242
- // @ts-ignore
243
- (navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) || (navigator === null || navigator === void 0 ? void 0 : navigator.vendor) || (window === null || window === void 0 ? void 0 : window.opera);
244
- const isAndroid = /android/i.test(userAgent);
245
- const isIos =
246
- // @ts-ignore
247
- (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
248
- (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
249
- const isMobile = isAndroid || isIos;
250
- return (h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
251
- ? this.renderMobileButton(isAndroid, isIos)
252
- : this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
253
- }
254
- };
255
- GatacaSSIButton.style = gatacaSsibuttonCss;
256
-
257
- 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}";
258
-
259
- 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=";
260
- const GatacaSSIButtonWS = class {
261
- constructor(hostRef) {
262
- registerInstance(this, hostRef);
263
- this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
264
- this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
265
- this.buttonText = "Easy login";
266
- this.successCallback = undefined;
267
- this.errorCallback = undefined;
268
- this.qrRole = undefined;
269
- this.callbackServer = undefined;
270
- this.socketEndpoint = undefined;
271
- this.sessionTimeout = undefined;
272
- this.wsOnOpen = undefined;
273
- this.wsOnMessage = undefined;
274
- this.autostart = true;
275
- this.autorefresh = false;
276
- this.v = "3";
277
- this.qrModalTitle = "Quick Access";
278
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
279
- this.hideBrandTitle = false;
280
- this.dynamicLink = true;
281
- this.open = false;
282
- this.qr = (h("gataca-qrws", { wsOnMessage: this.wsOnMessage, wsOnOpen: this.wsOnOpen, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, socketEndpoint: this.socketEndpoint, autostart: true, autorefresh: this.autorefresh, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
283
- }
284
- /**
285
- * Retrieve manually the session data on a successful login
286
- */
287
- async getSessionData() {
288
- return this.qr.getSessionData();
289
- }
290
- renderModal() {
291
- return this.qr;
292
- }
293
- renderButton() {
294
- return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
295
- this.open = !this.open;
296
- if (this.open) {
297
- this.qr.display();
298
- }
299
- else {
300
- this.qr.stop();
301
- }
302
- } }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
303
- }
304
- render() {
305
- return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
306
- }
307
- };
308
- GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
309
-
310
- export { GatacaSSIButton as gataca_ssibutton, GatacaSSIButtonWS as gataca_ssibuttonws };