@gataca/qr 2.0.9 → 2.0.11

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 (28) hide show
  1. package/dist/cjs/gataca-qr_2.cjs.entry.js +2 -3
  2. package/dist/cjs/gataca-qrws.cjs.entry.js +61 -11
  3. package/dist/cjs/gatacaqr.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/collection/components/gataca-qr/gataca-qr.css +28 -110
  6. package/dist/collection/components/gataca-qr/gataca-qr.js +1 -2
  7. package/dist/collection/components/gataca-qrws/components/qr/QR.js +5 -0
  8. package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +13 -0
  9. package/dist/collection/components/gataca-qrws/components/success/Success.js +8 -0
  10. package/dist/collection/components/gataca-qrws/gataca-qrws.css +98 -73
  11. package/dist/collection/components/gataca-qrws/gataca-qrws.js +387 -13
  12. package/dist/components/gataca-qr2.js +2 -3
  13. package/dist/components/gataca-qrws2.js +83 -13
  14. package/dist/esm/gataca-qr_2.entry.js +2 -3
  15. package/dist/esm/gataca-qrws.entry.js +62 -12
  16. package/dist/esm/gatacaqr.js +1 -1
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  19. package/dist/gatacaqr/p-272337d9.entry.js +1 -0
  20. package/dist/gatacaqr/p-d7877349.entry.js +1 -0
  21. package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +9 -0
  22. package/dist/types/components/gataca-qrws/components/retryButton/RetryButton.d.ts +13 -0
  23. package/dist/types/components/gataca-qrws/components/success/Success.d.ts +7 -0
  24. package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +102 -1
  25. package/dist/types/components.d.ts +160 -0
  26. package/package.json +1 -1
  27. package/dist/gatacaqr/p-23197d75.entry.js +0 -1
  28. package/dist/gatacaqr/p-c134f057.entry.js +0 -1
@@ -72,16 +72,116 @@ export declare class GatacaQRWS {
72
72
  * Modifies the qr headline title
73
73
  */
74
74
  qrModalTitle?: string;
75
+ /**
76
+ * _[Optional]_
77
+ * String to set Modal title color
78
+ */
79
+ modalTitleColor?: string;
75
80
  /**
76
81
  * _[Optional]_
77
82
  * Modifies the Modal description
78
83
  */
79
84
  qrModalDescription?: string;
85
+ /**
86
+ * _[Optional]_
87
+ * Boolean to show or not show the modal title, brandTitle and description
88
+ */
89
+ hideModalTexts?: boolean;
90
+ /**
91
+ * _[Optional]_
92
+ * Boolean to show or not show the modal title, brandTitle and description
93
+ */
94
+ hideModalBoxShadow?: boolean;
80
95
  /**
81
96
  * _[Optional]_
82
97
  * Boolean to show or not show the gataca brand title
83
98
  */
84
99
  hideBrandTitle?: boolean;
100
+ /**
101
+ * _[Optional]_
102
+ * Size of the logo to display in percentage to the total size [0-1]. 0 means no logo will be displayed. Default is the GATACA logo. Recommended size is around 0.33
103
+ */
104
+ logoSize?: number;
105
+ /**
106
+ * _[Optional]_
107
+ * Logo to display, just if the logo size is greater than 0. No logo is the GATACA logo.
108
+ */
109
+ logoSrc?: string;
110
+ /**
111
+ * _[Optional]_
112
+ * Size of QR Displayed
113
+ */
114
+ qrSize?: number;
115
+ /**
116
+ * _[Optional]_
117
+ * Width of the modal
118
+ */
119
+ modalWidth?: number;
120
+ /**
121
+ * _[Optional]_
122
+ * Height of the modal
123
+ */
124
+ modalHeight?: number;
125
+ /**
126
+ * _[Optional]_
127
+ * String to show when qr code expired
128
+ */
129
+ qrCodeExpiredLabel?: string;
130
+ /**
131
+ * _[Optional]_
132
+ * String to show when credentials not validatedd
133
+ */
134
+ credentialsNotValidatedLabel?: string;
135
+ /**
136
+ * _[Optional]_
137
+ * String to show "click inside" label
138
+ */
139
+ clickInsideBoxLabel?: string;
140
+ /**
141
+ * _[Optional]_
142
+ * String to show "refresh QR" label
143
+ */
144
+ refreshQrLabel?: string;
145
+ /**
146
+ * _[Optional]_
147
+ * String to show "scan QR" label
148
+ */
149
+ scanQrLabel?: string;
150
+ /**
151
+ * _[Optional]_
152
+ * String to show "user not scan in time" error
153
+ */
154
+ userNotScanInTimeErrorLabel?: string;
155
+ /**
156
+ * _[Optional]_
157
+ * String to show "provided credentials not validates" error
158
+ */
159
+ credsNotValidatedErrorLabel?: string;
160
+ /**
161
+ * _[Optional]_
162
+ * String to show "failed login" error
163
+ */
164
+ failedLoginErrorLabel?: string;
165
+ /**
166
+ * _[Optional]_
167
+ * String to show "successful login" label
168
+ */
169
+ successLoginLabel?: string;
170
+ /**
171
+ * _[Optional]_
172
+ * String to show "by brand" label
173
+ */
174
+ byBrandLabel?: string;
175
+ /**
176
+ * _[Optional]_
177
+ * String to show "waiting start session" label
178
+ */
179
+ waitingStartSessionLabel?: string;
180
+ /**
181
+ * _[Optional]_
182
+ * Boolean to show or not show the QR Modal description
183
+ */
184
+ hideQrModalDescription?: boolean;
85
185
  /**
86
186
  * _[Optional]_
87
187
  * Display a link containing a dynamic link to invoke the wallet if closed
@@ -119,6 +219,7 @@ export declare class GatacaQRWS {
119
219
  renderQRSection(): any;
120
220
  renderSuccess(): any;
121
221
  renderRetryButton(errorMessage?: string): any;
122
- renderQR(value: string, size: number, useLogo?: boolean): any;
222
+ renderQR(value: string, useLogo?: boolean): any;
223
+ renderRetryQR(value: string, useLogo?: boolean): any;
123
224
  render(): any;
124
225
  }
@@ -245,10 +245,26 @@ export namespace Components {
245
245
  * _[Optional]_ Set to enable autoload when the QR is displayed. By default it is true
246
246
  */
247
247
  "autostart": boolean;
248
+ /**
249
+ * _[Optional]_ String to show "by brand" label
250
+ */
251
+ "byBrandLabel"?: string;
248
252
  /**
249
253
  * ***Mandatory just for V1*** Connect/Certify Server where the wallet will send the data
250
254
  */
251
255
  "callbackServer": string;
256
+ /**
257
+ * _[Optional]_ String to show "click inside" label
258
+ */
259
+ "clickInsideBoxLabel"?: string;
260
+ /**
261
+ * _[Optional]_ String to show when credentials not validatedd
262
+ */
263
+ "credentialsNotValidatedLabel"?: string;
264
+ /**
265
+ * _[Optional]_ String to show "provided credentials not validates" error
266
+ */
267
+ "credsNotValidatedErrorLabel"?: string;
252
268
  /**
253
269
  * Force manually the display of a QR
254
270
  */
@@ -261,6 +277,10 @@ export namespace Components {
261
277
  * ***Mandatory*** Callback fired upon session expired or invalid If not set, session error would not be handled An error containing information will be passed as parameter
262
278
  */
263
279
  "errorCallback": (error?: Error) => void;
280
+ /**
281
+ * _[Optional]_ String to show "failed login" error
282
+ */
283
+ "failedLoginErrorLabel"?: string;
264
284
  /**
265
285
  * Retrieve manually the session data on a successful login
266
286
  */
@@ -269,6 +289,42 @@ export namespace Components {
269
289
  * _[Optional]_ Boolean to show or not show the gataca brand title
270
290
  */
271
291
  "hideBrandTitle"?: boolean;
292
+ /**
293
+ * _[Optional]_ Boolean to show or not show the modal title, brandTitle and description
294
+ */
295
+ "hideModalBoxShadow"?: boolean;
296
+ /**
297
+ * _[Optional]_ Boolean to show or not show the modal title, brandTitle and description
298
+ */
299
+ "hideModalTexts"?: boolean;
300
+ /**
301
+ * _[Optional]_ Boolean to show or not show the QR Modal description
302
+ */
303
+ "hideQrModalDescription"?: boolean;
304
+ /**
305
+ * _[Optional]_ Size of the logo to display in percentage to the total size [0-1]. 0 means no logo will be displayed. Default is the GATACA logo. Recommended size is around 0.33
306
+ */
307
+ "logoSize"?: number;
308
+ /**
309
+ * _[Optional]_ Logo to display, just if the logo size is greater than 0. No logo is the GATACA logo.
310
+ */
311
+ "logoSrc"?: string;
312
+ /**
313
+ * _[Optional]_ Height of the modal
314
+ */
315
+ "modalHeight"?: number;
316
+ /**
317
+ * _[Optional]_ String to set Modal title color
318
+ */
319
+ "modalTitleColor"?: string;
320
+ /**
321
+ * _[Optional]_ Width of the modal
322
+ */
323
+ "modalWidth"?: number;
324
+ /**
325
+ * _[Optional]_ String to show when qr code expired
326
+ */
327
+ "qrCodeExpiredLabel"?: string;
272
328
  /**
273
329
  * _[Optional]_ Modifies the Modal description
274
330
  */
@@ -281,6 +337,18 @@ export namespace Components {
281
337
  * ***Mandatory*** Decide if scanning the credential as a verifier to request credentials or as an issuer too issue credentials. Options: connect | certify
282
338
  */
283
339
  "qrRole": string;
340
+ /**
341
+ * _[Optional]_ Size of QR Displayed
342
+ */
343
+ "qrSize"?: number;
344
+ /**
345
+ * _[Optional]_ String to show "refresh QR" label
346
+ */
347
+ "refreshQrLabel"?: string;
348
+ /**
349
+ * _[Optional]_ String to show "scan QR" label
350
+ */
351
+ "scanQrLabel"?: string;
284
352
  /**
285
353
  * ***Mandatory*** Maximum time window to display the session and keep the websocket connection. It's needed to ensure the socket is closed.
286
354
  */
@@ -297,10 +365,22 @@ export namespace Components {
297
365
  * ***Mandatory*** Callback fired upon session correctly verified If not set, session validation wouldn't trigger any action The session data and a possible token will be sent as parameters to the callback
298
366
  */
299
367
  "successCallback": (data?: any) => void;
368
+ /**
369
+ * _[Optional]_ String to show "successful login" label
370
+ */
371
+ "successLoginLabel"?: string;
372
+ /**
373
+ * _[Optional]_ String to show "user not scan in time" error
374
+ */
375
+ "userNotScanInTimeErrorLabel"?: string;
300
376
  /**
301
377
  * **RECOMMENDED** Set to use v2 links. The create session must be providing both an authentication request and a session Id
302
378
  */
303
379
  "v2"?: boolean;
380
+ /**
381
+ * _[Optional]_ String to show "waiting start session" label
382
+ */
383
+ "waitingStartSessionLabel"?: string;
304
384
  /**
305
385
  * **RECOMMENDED** Callback to invoke an a message has been received on the socket. It provides the socket itself and the message as parameters. If not used, the messages provided by the server on the Socket connection must conform to the WSReponse interface If used, an Event named **sessionMsg** must be triggered with a WSReponse as data
306
386
  */
@@ -816,10 +896,26 @@ declare namespace LocalJSX {
816
896
  * _[Optional]_ Set to enable autoload when the QR is displayed. By default it is true
817
897
  */
818
898
  "autostart"?: boolean;
899
+ /**
900
+ * _[Optional]_ String to show "by brand" label
901
+ */
902
+ "byBrandLabel"?: string;
819
903
  /**
820
904
  * ***Mandatory just for V1*** Connect/Certify Server where the wallet will send the data
821
905
  */
822
906
  "callbackServer"?: string;
907
+ /**
908
+ * _[Optional]_ String to show "click inside" label
909
+ */
910
+ "clickInsideBoxLabel"?: string;
911
+ /**
912
+ * _[Optional]_ String to show when credentials not validatedd
913
+ */
914
+ "credentialsNotValidatedLabel"?: string;
915
+ /**
916
+ * _[Optional]_ String to show "provided credentials not validates" error
917
+ */
918
+ "credsNotValidatedErrorLabel"?: string;
823
919
  /**
824
920
  * _[Optional]_ Display a link containing a dynamic link to invoke the wallet if closed
825
921
  */
@@ -828,10 +924,46 @@ declare namespace LocalJSX {
828
924
  * ***Mandatory*** Callback fired upon session expired or invalid If not set, session error would not be handled An error containing information will be passed as parameter
829
925
  */
830
926
  "errorCallback"?: (error?: Error) => void;
927
+ /**
928
+ * _[Optional]_ String to show "failed login" error
929
+ */
930
+ "failedLoginErrorLabel"?: string;
831
931
  /**
832
932
  * _[Optional]_ Boolean to show or not show the gataca brand title
833
933
  */
834
934
  "hideBrandTitle"?: boolean;
935
+ /**
936
+ * _[Optional]_ Boolean to show or not show the modal title, brandTitle and description
937
+ */
938
+ "hideModalBoxShadow"?: boolean;
939
+ /**
940
+ * _[Optional]_ Boolean to show or not show the modal title, brandTitle and description
941
+ */
942
+ "hideModalTexts"?: boolean;
943
+ /**
944
+ * _[Optional]_ Boolean to show or not show the QR Modal description
945
+ */
946
+ "hideQrModalDescription"?: boolean;
947
+ /**
948
+ * _[Optional]_ Size of the logo to display in percentage to the total size [0-1]. 0 means no logo will be displayed. Default is the GATACA logo. Recommended size is around 0.33
949
+ */
950
+ "logoSize"?: number;
951
+ /**
952
+ * _[Optional]_ Logo to display, just if the logo size is greater than 0. No logo is the GATACA logo.
953
+ */
954
+ "logoSrc"?: string;
955
+ /**
956
+ * _[Optional]_ Height of the modal
957
+ */
958
+ "modalHeight"?: number;
959
+ /**
960
+ * _[Optional]_ String to set Modal title color
961
+ */
962
+ "modalTitleColor"?: string;
963
+ /**
964
+ * _[Optional]_ Width of the modal
965
+ */
966
+ "modalWidth"?: number;
835
967
  /**
836
968
  * GatacaLoginCompleted event, triggered with session data upon login success
837
969
  */
@@ -840,6 +972,10 @@ declare namespace LocalJSX {
840
972
  * GatacaLoginFailed event, triggered with error upon login failure
841
973
  */
842
974
  "onGatacaLoginFailed"?: (event: GatacaQrwsCustomEvent<any>) => void;
975
+ /**
976
+ * _[Optional]_ String to show when qr code expired
977
+ */
978
+ "qrCodeExpiredLabel"?: string;
843
979
  /**
844
980
  * _[Optional]_ Modifies the Modal description
845
981
  */
@@ -852,6 +988,18 @@ declare namespace LocalJSX {
852
988
  * ***Mandatory*** Decide if scanning the credential as a verifier to request credentials or as an issuer too issue credentials. Options: connect | certify
853
989
  */
854
990
  "qrRole"?: string;
991
+ /**
992
+ * _[Optional]_ Size of QR Displayed
993
+ */
994
+ "qrSize"?: number;
995
+ /**
996
+ * _[Optional]_ String to show "refresh QR" label
997
+ */
998
+ "refreshQrLabel"?: string;
999
+ /**
1000
+ * _[Optional]_ String to show "scan QR" label
1001
+ */
1002
+ "scanQrLabel"?: string;
855
1003
  /**
856
1004
  * ***Mandatory*** Maximum time window to display the session and keep the websocket connection. It's needed to ensure the socket is closed.
857
1005
  */
@@ -864,10 +1012,22 @@ declare namespace LocalJSX {
864
1012
  * ***Mandatory*** Callback fired upon session correctly verified If not set, session validation wouldn't trigger any action The session data and a possible token will be sent as parameters to the callback
865
1013
  */
866
1014
  "successCallback"?: (data?: any) => void;
1015
+ /**
1016
+ * _[Optional]_ String to show "successful login" label
1017
+ */
1018
+ "successLoginLabel"?: string;
1019
+ /**
1020
+ * _[Optional]_ String to show "user not scan in time" error
1021
+ */
1022
+ "userNotScanInTimeErrorLabel"?: string;
867
1023
  /**
868
1024
  * **RECOMMENDED** Set to use v2 links. The create session must be providing both an authentication request and a session Id
869
1025
  */
870
1026
  "v2"?: boolean;
1027
+ /**
1028
+ * _[Optional]_ String to show "waiting start session" label
1029
+ */
1030
+ "waitingStartSessionLabel"?: string;
871
1031
  /**
872
1032
  * **RECOMMENDED** Callback to invoke an a message has been received on the socket. It provides the socket itself and the message as parameters. If not used, the messages provided by the server on the Socket connection must conform to the WSReponse interface If used, an Event named **sessionMsg** must be triggered with a WSReponse as data
873
1033
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gataca/qr",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "Gataca component to display presentation requests in QR",
5
5
  "author": "Gataca <it@gataca.io>",
6
6
  "licenses": [
@@ -1 +0,0 @@
1
- import{r as i,c as t,h as e}from"./p-ec0f00a6.js";import{g as s,a as n,b as o,l as a}from"./p-ea783014.js";import"./p-0be4566d.js";import{R as r,c as p,b as l}from"./p-b8ba109f.js";const d="connect",c={connect:"scan",certify:"credential"},h=class{constructor(e){i(this,e),this.gatacaLoginCompleted=t(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=t(this,"gatacaLoginFailed",7),this.successCallback=void 0,this.errorCallback=void 0,this.qrRole=void 0,this.callbackServer=void 0,this.socketEndpoint=void 0,this.sessionTimeout=300,this.wsOnOpen=void 0,this.wsOnMessage=void 0,this.autostart=!0,this.autorefresh=!1,this.v2=!1,this.qrModalTitle="Quick Access",this.qrModalDescription="Sign up or sign in by scanning the QR Code with the Gataca Wallet",this.hideBrandTitle=!1,this.dynamicLink=!0,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED}disconnectedCallback(){this.stop()}async componentDidLoad(){this.autostart&&await this.display()}async display(){let i=new WebSocket(this.socketEndpoint);setTimeout((()=>{this.socket.close(1e3,"")}),1e3*this.sessionTimeout),this.socket=i,i.onopen=()=>{this.wsOnOpen&&this.wsOnOpen(this.socket)},i.onmessage=i=>{if(this.wsOnMessage)this.wsOnMessage(this.socket,i);else{let t=JSON.parse(i.data);t.sessionId&&this.handleWSResponse(t)}},i.onerror=()=>{let t=new Error("Error connecting with server");this.result=r.FAILED,this.gatacaLoginFailed.emit(t),this.errorCallback(t),i.close(1e3,"")},i.onclose=()=>{if(this.result===r.ONGOING&&(this.result=r.EXPIRED),this.result===r.EXPIRED)if(this.autorefresh)this.display();else{let i=new Error("User did not scan the QR in the alloted time");this.gatacaLoginFailed.emit(i),this.errorCallback(i)}},p()&&this.dynamicLink&&(window.location.href=this.getLink())}sessionMsgReceived(i){this.handleWSResponse(i.detail)}handleWSResponse(i){switch(this.result=i.result,i.result){case r.ONGOING:this.sessionId=i.sessionId,this.authenticationRequest=i.authenticationRequest;break;case r.SUCCESS:this.sessionData=i.authenticatedUserData,this.gatacaLoginCompleted.emit(i.authenticatedUserData),this.successCallback(i.authenticatedUserData),this.socket.close(1e3,"");break;case r.FAILED:this.socket.close();let t=new Error("Provided user credentials couldn't be validated");this.gatacaLoginFailed.emit(t),this.errorCallback(t);break;case r.EXPIRED:if(this.socket.close(),this.autorefresh)this.display();else{let i=new Error("User did not scan the QR in the alloted time");this.gatacaLoginFailed.emit(i),this.errorCallback(i)}}}async stop(){this.sessionData=void 0,this.sessionId=void 0,this.socket.close(1e3,"Client stopped the connection")}async getSessionData(){return this.sessionData?Promise.resolve(this.sessionData):Promise.reject(new Error("No successful login"))}getLink(){if(this.v2&&this.qrRole==d)return this.authenticationRequest;let i="https://gataca.page.link/"+c[this.qrRole]+"?";return i+=this.qrRole===d?"session="+this.sessionId:"process="+this.sessionId,i+="&callback="+l(encodeURIComponent(this.callbackServer)),i=encodeURIComponent(i),this.dynamicLink?"https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link="+i:i}renderQRSection(){switch(this.result){case r.NOT_STARTED:return this.renderRetryButton();case r.ONGOING:return this.renderQR(this.getLink(),300,!0);case r.EXPIRED:return this.renderRetryButton("QR Code expired");case r.FAILED:return this.renderRetryButton("User credentials not validated");case r.SUCCESS:return this.renderSuccess()}}renderSuccess(){return e("div",{class:"success"},e("img",{src:s,height:52,width:52}),e("p",{class:"successMsg"},"Successful Connection!"))}renderRetryButton(i){return e("div",{class:"reload"},e("div",{id:"notify",onClick:()=>this.display()},e("img",{src:n,height:24,width:24}),e("p",{class:"qrDescription"},"Click inside the box to "),e("p",{class:"qrDescription bold"},i?"Refresh QR Code":"Scan QR Code"),i&&e("div",{class:"alert"},e("img",{src:o,height:24,width:24}),e("p",null,i))),e("div",{id:"qrwait"},this.renderQR("waiting to start a session",250)))}renderQR(i,t,s){return e("gataca-qrdisplay",{qrData:i,rounded:!0,size:t,"logo-size":s?.33:0})}render(){return e("div",{class:"popUpContainer"},e("div",{class:"modal-window is-visible",onClick:i=>{i.stopPropagation()}},e("div",{class:"modal-window__content"},e("div",{class:"qrTitleContainer"},e("p",{class:"qrTitle"},this.qrModalTitle),!this.hideBrandTitle&&e("p",{class:"qrBrand"},"by Gataca"," ",e("span",null,e("img",{src:a}))),this.result!==r.SUCCESS&&e("p",{class:"qrDescription"},this.qrModalDescription)),e("div",{class:"qrSection"},this.renderQRSection()))))}};h.style='@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}';export{h as gataca_qrws}
@@ -1 +0,0 @@
1
- import{r as i,h as t,c as e}from"./p-ec0f00a6.js";import{l as s,g as o,a as n,b as a}from"./p-ea783014.js";import{Q as r}from"./p-0be4566d.js";import{R as l,c as h,b as d}from"./p-b8ba109f.js";const p=class{constructor(t){i(this,t),this.qrData=void 0,this.size=256,this.logoSize=0,this.logoSrc=void 0,this.qrColor="#1E1E20",this.rounded=!0}componentDidLoad(){new r({data:this.qrData,width:this.size,height:this.size,image:this.logoSize>0?this.logoSrc||s:void 0,margin:10,type:"svg",dotsOptions:{color:this.qrColor,type:this.rounded?"dots":"square"},cornersSquareOptions:{type:this.rounded?"extra-rounded":"square"},cornersDotOptions:{type:this.rounded?"dot":"square"},imageOptions:{margin:2,imageSize:this.logoSize}}).append(this.qr)}render(){return t("div",{ref:i=>{this.qr=i}})}},c=i=>{const{modalHeight:e,successLoginLabel:s}=i;return t("div",{class:"success",style:{height:e?(null==e?void 0:e.toString())+"px":"300px"}},t("img",{src:o,height:52,width:52}),t("p",{class:"successMsg"},s))},g=i=>{var e;const{errorMessage:s,modalWidth:o,clickInsideBoxLabel:r,refreshQrLabel:l,scanQrLabel:h,waitingStartSessionLabel:d,display:p,renderRetryQR:c}=i;return t("div",{class:"reload",style:{width:(o-48).toString()+"px",height:o?(null===(e=o-48)||void 0===e?void 0:e.toString())+"px":""}},t("div",{id:"notify",onClick:()=>p()},t("img",{src:n,height:24,width:24}),t("p",{class:"notify-text"},r," "),t("p",{class:"notify-text bold"},s?l:h),s&&t("div",{class:"alert",style:{width:(o-48).toString()+"px"}},t("img",{src:a,height:24,width:24}),t("p",null,s))),t("div",{id:"qrwait"},c(d)))},u=i=>{const{value:e,useLogo:s,logoSrc:o,size:n}=i;return t("gataca-qrdisplay",{qrData:e,rounded:!0,size:n,"logo-size":s?.33:0,"logo-src":o})},f={connect:"scan",certify:"credential"},m=class{constructor(t){i(this,t),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.checkStatus=void 0,this.createSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.qrRole=void 0,this.callbackServer=void 0,this.autostart=!0,this.autorefresh=!1,this.v2=!1,this.qrModalTitle="Quick Access",this.modalTitleColor="#4745B7",this.qrModalDescription="Sign up or sign in by scanning the QR Code with the Gataca Wallet",this.hideModalTexts=!1,this.hideModalBoxShadow=!1,this.hideBrandTitle=!1,this.logoSize=0,this.logoSrc=s,this.qrSize=300,this.modalWidth=300,this.modalHeight=void 0,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=!1,this.sessionTimeout=300,this.pollingFrequency=3,this.dynamicLink=!0,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=l.NOT_STARTED}disconnectedCallback(){this.stop()}async componentDidLoad(){this.autostart&&await this.display()}async display(){await this.getSessionId(),this.result=l.ONGOING,this.poll().then((i=>{this.result=l.SUCCESS,this.sessionData=i,this.gatacaLoginCompleted.emit(i),this.successCallback(i)})).catch((i=>{this.clean();let t=i===l.EXPIRED;if(t&&this.autorefresh)this.display();else if(i!==l.NOT_STARTED){let e=t?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=i,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}})),h()&&this.dynamicLink&&(window.location.href=this.getLink())}async stop(){this.clean(),this.result===l.ONGOING&&(this.result=l.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0}async getSessionData(){return this.sessionData?Promise.resolve(this.sessionData):Promise.reject(new Error(this.failedLoginErrorLabel))}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:i,authenticationRequest:t}=await this.createSession();return this.sessionId=i,this.authenticationRequest=t,this.sessionId}getLink(){if(this.v2)return this.authenticationRequest;let i="https://gataca.page.link/"+f[this.qrRole]+"?";return i+="connect"===this.qrRole?"session="+this.sessionId:"process="+this.sessionId,i+="&callback="+d(encodeURIComponent(this.callbackServer)),i=encodeURIComponent(i),this.dynamicLink?"https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link="+i:i}async poll(){let i=(new Date).getTime()+1e3*(this.sessionTimeout||300),t=1e3*(this.pollingFrequency||3),e=this,s=async function(o,n){let{result:a,data:r}=await(async i=>{if(i.result===l.NOT_STARTED)return{result:l.NOT_STARTED};let t=await i.getSessionId();return i.checkStatus(t)})(e);switch(a){case l.SUCCESS:o(r);break;case l.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<i?setTimeout(s,t,o,n):n(l.EXPIRED);break;default:n(a)}};return new Promise(s)}renderQRSection(){switch(this.result){case l.NOT_STARTED:return this.renderRetryButton();case l.ONGOING:return this.renderQR(this.getLink(),!0);case l.EXPIRED:return this.renderRetryButton(this.qrCodeExpiredLabel);case l.FAILED:return this.renderRetryButton(this.credentialsNotValidatedLabel);case l.SUCCESS:return this.renderSuccess()}}renderSuccess(){return t(c,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel})}renderRetryButton(i){return t(g,{errorMessage:i,modalWidth:null==this?void 0:this.modalWidth,clickInsideBoxLabel:null==this?void 0:this.clickInsideBoxLabel,refreshQrLabel:null==this?void 0:this.refreshQrLabel,scanQrLabel:null==this?void 0:this.scanQrLabel,waitingStartSessionLabel:null==this?void 0:this.waitingStartSessionLabel,display:null==this?void 0:this.display,renderRetryQR:null==this?void 0:this.renderRetryQR})}renderQR(i,e){return t(u,{value:i,useLogo:e,size:(null==this?void 0:this.qrSize)||void 0,logoSrc:null==this?void 0:this.logoSrc})}renderRetryQR(i,e){return t(u,{value:i,useLogo:e,size:(null==this?void 0:this.qrSize)?(null==this?void 0:this.qrSize)-50:void 0,logoSrc:null==this?void 0:this.logoSrc})}render(){var i,e;return console.log("result",this.result),t("div",{class:"popUpContainer"},t("div",{class:`is-visible modal-window ${this.hideModalTexts?"":"large-modal"} ${this.hideModalBoxShadow?"noBoxShadow":""}`,style:{width:(this.modalWidth-2).toString()+"px",height:this.modalHeight?(null===(i=this.modalHeight-2)||void 0===i?void 0:i.toString())+"px":""},onClick:i=>{i.stopPropagation()}},t("div",{class:"modal-window__content"},t("div",{class:"qrTitleContainer "+(this.hideModalTexts?"hidenText":"")},t("p",{class:"qrTitle modalText",style:{color:this.modalTitleColor||"#1e1e20"}},this.qrModalTitle),!this.hideBrandTitle&&t("p",{class:"qrBrand modalText"},this.byBrandLabel," ",t("span",null,t("img",{src:s}))),this.result!==l.SUCCESS&&!this.hideQrModalDescription&&t("p",{class:"qrDescription modalText"},this.qrModalDescription)),t("div",{class:"qrSection",style:{width:this.modalWidth.toString()+"px",height:this.modalWidth?(null===(e=this.modalWidth)||void 0===e?void 0:e.toString())+"px":""}},this.renderQRSection()))))}};m.style='@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=Poppins: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 .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;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;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__content .hidenText{display:none}.popUpContainer .modal-window .modalText{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}.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-family:Poppins;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.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 .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.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}.reload{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:12px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;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.95)}#notify>img{padding-bottom:12px}.alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;display:flex;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>p{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}';export{m as gataca_qr,p as gataca_qrdisplay}