@gataca/qr 2.0.12 → 2.0.14

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 (44) hide show
  1. package/dist/cjs/gataca-qr_2.cjs.entry.js +48 -16
  2. package/dist/cjs/gataca-qrws.cjs.entry.js +47 -16
  3. package/dist/cjs/gatacaqr.cjs.js +1 -1
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/{utils-65e14ed0.js → utils-ef28b844.js} +1 -1
  7. package/dist/collection/components/gataca-qr/components/readQR/ReadQR.js +11 -0
  8. package/dist/collection/components/gataca-qr/components/readQR/components/AnimatedLoader.js +4 -0
  9. package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +2 -3
  10. package/dist/collection/components/gataca-qr/gataca-qr.css +125 -2
  11. package/dist/collection/components/gataca-qr/gataca-qr.js +22 -16
  12. package/dist/collection/components/gataca-qrws/components/readQR/ReadQR.js +11 -0
  13. package/dist/collection/components/gataca-qrws/components/readQR/components/AnimatedLoader.js +4 -0
  14. package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +2 -3
  15. package/dist/collection/components/gataca-qrws/gataca-qrws.css +126 -2
  16. package/dist/collection/components/gataca-qrws/gataca-qrws.js +21 -16
  17. package/dist/collection/utils/utils.js +1 -1
  18. package/dist/components/gat-icon-alert.js +1 -1
  19. package/dist/components/gataca-qr2.js +49 -17
  20. package/dist/components/gataca-qrws2.js +48 -17
  21. package/dist/esm/gataca-qr_2.entry.js +48 -16
  22. package/dist/esm/gataca-qrws.entry.js +47 -16
  23. package/dist/esm/gatacaqr.js +1 -1
  24. package/dist/esm/index.js +1 -1
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm/{utils-1b406699.js → utils-63e7a33b.js} +1 -1
  27. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  28. package/dist/gatacaqr/index.esm.js +1 -1
  29. package/dist/gatacaqr/{p-bceac8fa.js → p-2cd7b062.js} +1 -1
  30. package/dist/gatacaqr/p-64740141.entry.js +1 -0
  31. package/dist/gatacaqr/p-f9931de0.entry.js +1 -0
  32. package/dist/types/components/gataca-qr/components/readQR/ReadQR.d.ts +13 -0
  33. package/dist/types/components/gataca-qr/components/readQR/components/AnimatedLoader.d.ts +2 -0
  34. package/dist/types/components/gataca-qr/components/retryButton/RetryButton.d.ts +0 -4
  35. package/dist/types/components/gataca-qr/gataca-qr.d.ts +6 -5
  36. package/dist/types/components/gataca-qrws/components/readQR/ReadQR.d.ts +13 -0
  37. package/dist/types/components/gataca-qrws/components/readQR/components/AnimatedLoader.d.ts +2 -0
  38. package/dist/types/components/gataca-qrws/components/retryButton/RetryButton.d.ts +0 -4
  39. package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +6 -5
  40. package/dist/types/components.d.ts +24 -24
  41. package/dist/types/utils/utils.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/dist/gatacaqr/p-5fe70d53.entry.js +0 -1
  44. package/dist/gatacaqr/p-8b58f3b3.entry.js +0 -1
@@ -78,10 +78,6 @@ export namespace Components {
78
78
  * _[Optional]_ String to show "click inside" label
79
79
  */
80
80
  "clickInsideBoxLabel"?: string;
81
- /**
82
- * _[Optional]_ String to show "click inside" label for QR already read
83
- */
84
- "clickInsideBoxReadedQrLabel"?: string;
85
81
  /**
86
82
  * ***Mandatory*** Create session function to generate a new Session Using V1, it can provide just a session Id Using V2, it must provide also the authentication request. The session Id is the id of the presentation definition
87
83
  */
@@ -178,9 +174,13 @@ export namespace Components {
178
174
  */
179
175
  "qrSize"?: number;
180
176
  /**
181
- * _[Optional]_ String to show when QR already read
177
+ * _[Optional]_ String description to show when QR already read
178
+ */
179
+ "readQrDescription"?: string;
180
+ /**
181
+ * _[Optional]_ String title to show when QR already read
182
182
  */
183
- "readedQrLabel"?: string;
183
+ "readQrTitle"?: string;
184
184
  /**
185
185
  * _[Optional]_ String to show "refresh QR" label
186
186
  */
@@ -265,10 +265,6 @@ export namespace Components {
265
265
  * _[Optional]_ String to show "click inside" label
266
266
  */
267
267
  "clickInsideBoxLabel"?: string;
268
- /**
269
- * _[Optional]_ String to show "click inside" label for QR already read
270
- */
271
- "clickInsideBoxReadedQrLabel"?: string;
272
268
  /**
273
269
  * _[Optional]_ String to show when credentials not validatedd
274
270
  */
@@ -354,9 +350,13 @@ export namespace Components {
354
350
  */
355
351
  "qrSize"?: number;
356
352
  /**
357
- * _[Optional]_ String to show when QR already read
353
+ * _[Optional]_ String description to show when QR already read
354
+ */
355
+ "readQrDescription"?: string;
356
+ /**
357
+ * _[Optional]_ String title to show when QR already read
358
358
  */
359
- "readedQrLabel"?: string;
359
+ "readQrTitle"?: string;
360
360
  /**
361
361
  * _[Optional]_ String to show "refresh QR" label
362
362
  */
@@ -749,10 +749,6 @@ declare namespace LocalJSX {
749
749
  * _[Optional]_ String to show "click inside" label
750
750
  */
751
751
  "clickInsideBoxLabel"?: string;
752
- /**
753
- * _[Optional]_ String to show "click inside" label for QR already read
754
- */
755
- "clickInsideBoxReadedQrLabel"?: string;
756
752
  /**
757
753
  * ***Mandatory*** Create session function to generate a new Session Using V1, it can provide just a session Id Using V2, it must provide also the authentication request. The session Id is the id of the presentation definition
758
754
  */
@@ -849,9 +845,13 @@ declare namespace LocalJSX {
849
845
  */
850
846
  "qrSize"?: number;
851
847
  /**
852
- * _[Optional]_ String to show when QR already read
848
+ * _[Optional]_ String description to show when QR already read
849
+ */
850
+ "readQrDescription"?: string;
851
+ /**
852
+ * _[Optional]_ String title to show when QR already read
853
853
  */
854
- "readedQrLabel"?: string;
854
+ "readQrTitle"?: string;
855
855
  /**
856
856
  * _[Optional]_ String to show "refresh QR" label
857
857
  */
@@ -932,10 +932,6 @@ declare namespace LocalJSX {
932
932
  * _[Optional]_ String to show "click inside" label
933
933
  */
934
934
  "clickInsideBoxLabel"?: string;
935
- /**
936
- * _[Optional]_ String to show "click inside" label for QR already read
937
- */
938
- "clickInsideBoxReadedQrLabel"?: string;
939
935
  /**
940
936
  * _[Optional]_ String to show when credentials not validatedd
941
937
  */
@@ -1021,9 +1017,13 @@ declare namespace LocalJSX {
1021
1017
  */
1022
1018
  "qrSize"?: number;
1023
1019
  /**
1024
- * _[Optional]_ String to show when QR already read
1020
+ * _[Optional]_ String description to show when QR already read
1021
+ */
1022
+ "readQrDescription"?: string;
1023
+ /**
1024
+ * _[Optional]_ String title to show when QR already read
1025
1025
  */
1026
- "readedQrLabel"?: string;
1026
+ "readQrTitle"?: string;
1027
1027
  /**
1028
1028
  * _[Optional]_ String to show "refresh QR" label
1029
1029
  */
@@ -6,7 +6,7 @@ export declare enum RESULT_STATUS {
6
6
  SUCCESS = 1,
7
7
  FAILED = 2,
8
8
  EXPIRED = 3,
9
- READED = 5
9
+ READ = 5
10
10
  }
11
11
  export type WSResponse = {
12
12
  sessionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gataca/qr",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
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,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-bceac8fa.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,readedQrMessages:g}=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"},g?null==g?void 0:g.title:r," "),t("p",{class:"notify-text bold"},s?l:g?null==g?void 0:g.description: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})},m={connect:"scan",certify:"credential"},f=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.readedQrLabel="QR Code already scanned.",this.clickInsideBoxReadedQrLabel="Click the box to refresh.",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/"+m[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();case l.READED:return this.renderRetryButton(null,{title:null==this?void 0:this.readedQrLabel,description:null==this?void 0:this.clickInsideBoxReadedQrLabel})}}renderSuccess(){return t(c,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel})}renderRetryButton(i,e){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:this.display.bind(this),renderRetryQR:this.renderRetryQR.bind(this),readedQrMessages:e})}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 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()))))}};f.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", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;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>img{padding-bottom:12px}.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;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>img{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.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;text-align:center}';export{f as gataca_qr,p as gataca_qrdisplay}
@@ -1 +0,0 @@
1
- import{h as i,r as t,c as e}from"./p-ec0f00a6.js";import{g as s,a as o,b as n,l as a}from"./p-ea783014.js";import"./p-0be4566d.js";import{R as r,c as l,b as h}from"./p-bceac8fa.js";const d=t=>{const{modalHeight:e,successLoginLabel:o}=t;return i("div",{class:"success",style:{height:e?(null==e?void 0:e.toString())+"px":"300px"}},i("img",{src:s,height:52,width:52}),i("p",{class:"successMsg"},o))},p=t=>{var e;const{errorMessage:s,modalWidth:a,clickInsideBoxLabel:r,refreshQrLabel:l,scanQrLabel:h,waitingStartSessionLabel:d,display:p,renderRetryQR:c,readedQrMessages:g}=t;return i("div",{class:"reload",style:{width:(a-48).toString()+"px",height:a?(null===(e=a-48)||void 0===e?void 0:e.toString())+"px":""}},i("div",{id:"notify",onClick:()=>p()},i("img",{src:o,height:24,width:24}),i("p",{class:"notify-text"},g?null==g?void 0:g.title:r," "),i("p",{class:"notify-text bold"},s?l:g?null==g?void 0:g.description:h),s&&i("div",{class:"alert",style:{width:(a-48).toString()+"px"}},i("img",{src:n,height:24,width:24}),i("p",null,s))),i("div",{id:"qrwait"},c(d)))},c=t=>{const{value:e,useLogo:s,logoSrc:o,size:n}=t;return i("gataca-qrdisplay",{qrData:e,rounded:!0,size:n,"logo-size":s?.33:0,"logo-src":o})},g="connect",u={connect:"scan",certify:"credential"},m=class{constructor(i){t(this,i),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(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.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=a,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.readedQrLabel="QR Code already scanned.",this.clickInsideBoxReadedQrLabel="Click the box to refresh.",this.hideQrModalDescription=!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)}},l()&&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==g)return this.authenticationRequest;let i="https://gataca.page.link/"+u[this.qrRole]+"?";return i+=this.qrRole===g?"session="+this.sessionId:"process="+this.sessionId,i+="&callback="+h(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(),!0);case r.EXPIRED:return this.renderRetryButton(this.qrCodeExpiredLabel);case r.FAILED:return this.renderRetryButton(this.credentialsNotValidatedLabel);case r.SUCCESS:return this.renderSuccess();case r.READED:return this.renderRetryButton(null,{title:null==this?void 0:this.readedQrLabel,description:null==this?void 0:this.clickInsideBoxReadedQrLabel})}}renderSuccess(){return i(d,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel})}renderRetryButton(t,e){return i(p,{errorMessage:t,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:this.display.bind(this),renderRetryQR:this.renderRetryQR.bind(this),readedQrMessages:e})}renderQR(t,e){return i(c,{value:t,useLogo:e,size:(null==this?void 0:this.qrSize)||void 0,logoSrc:null==this?void 0:this.logoSrc})}renderRetryQR(t,e){return i(c,{value:t,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 t,e;return i("div",{class:"popUpContainer"},i("div",{class:`is-visible modal-window ${this.hideModalTexts?"":"large-modal"} ${this.hideModalBoxShadow?"noBoxShadow":""}`,style:{width:(this.modalWidth-2).toString()+"px",height:this.modalHeight?(null===(t=this.modalHeight-2)||void 0===t?void 0:t.toString())+"px":""},onClick:i=>{i.stopPropagation()}},i("div",{class:"modal-window__content"},i("div",{class:"qrTitleContainer "+(this.hideModalTexts?"hidenText":"")},i("p",{class:"qrTitle modalText",style:{color:this.modalTitleColor||"#1e1e20"}},this.qrModalTitle),!this.hideBrandTitle&&i("p",{class:"qrBrand modalText"},this.byBrandLabel," ",i("span",null,i("img",{src:a}))),this.result!==r.SUCCESS&&!this.hideQrModalDescription&&i("p",{class:"qrDescription modalText"},this.qrModalDescription)),i("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", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;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>img{padding-bottom:12px}.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;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>img{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.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;text-align:center}';export{m as gataca_qrws}