@luizleon/sf.prefeiturasp.vuecomponents 0.0.34 → 0.0.35

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.
package/dist/lib.umd.js CHANGED
@@ -76,5 +76,5 @@ If you think this parameter should be updatable, request it here: https://github
76
76
  - It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).
77
77
  - It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).
78
78
 
79
- For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`),c.enable=!1,e.silentCheckSsoFallback&&(e.silentCheckSsoRedirectUri=!1)),document.body.removeChild(a),window.removeEventListener("message",f),r.setSuccess()))};window.addEventListener("message",f,!1)}else r.setSuccess();return v(r.promise,e.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function X(r){if(!r||r=="default")return{login:function(g){return window.location.assign(e.createLoginUrl(g)),_().promise},logout:function(g){return window.location.replace(e.createLogoutUrl(g)),_().promise},register:function(g){return window.location.assign(e.createRegisterUrl(g)),_().promise},accountManagement:function(){var g=e.createAccountUrl();if(typeof g<"u")window.location.href=g;else throw"Not supported by the OIDC server";return _().promise},redirectUri:function(g,y){return g&&g.redirectUri?g.redirectUri:e.redirectUri?e.redirectUri:location.href}};if(r=="cordova"){c.enable=!1;var a=function(g,y,T){return window.cordova&&window.cordova.InAppBrowser?window.cordova.InAppBrowser.open(g,y,T):window.open(g,y,T)},f=function(g){return g&&g.cordovaOptions?Object.keys(g.cordovaOptions).reduce(function(y,T){return y[T]=g.cordovaOptions[T],y},{}):{}},b=function(g){return Object.keys(g).reduce(function(y,T){return y.push(T+"="+g[T]),y},[]).join(",")},p=function(g){var y=f(g);return y.location="no",g&&g.prompt=="none"&&(y.hidden="yes"),b(y)},E=function(){return e.redirectUri||"http://localhost"};return{login:function(g){var y=_(),T=p(g),x=e.createLoginUrl(g),R=a(x,"_blank",T),H=!1,me=!1,ue=function(){me=!0,R.close()};return R.addEventListener("loadstart",function(te){if(te.url.indexOf(E())==0){var Pe=A(te.url);he(Pe,y),ue(),H=!0}}),R.addEventListener("loaderror",function(te){if(!H)if(te.url.indexOf(E())==0){var Pe=A(te.url);he(Pe,y),ue(),H=!0}else y.setError(),ue()}),R.addEventListener("exit",function(te){me||y.setError({reason:"closed_by_user"})}),y.promise},logout:function(g){var y=_(),T=e.createLogoutUrl(g),x=a(T,"_blank","location=no,hidden=yes,clearcache=yes"),R;return x.addEventListener("loadstart",function(H){H.url.indexOf(E())==0&&x.close()}),x.addEventListener("loaderror",function(H){H.url.indexOf(E())==0||(R=!0),x.close()}),x.addEventListener("exit",function(H){R?y.setError():(e.clearToken(),y.setSuccess())}),y.promise},register:function(g){var y=_(),T=e.createRegisterUrl(),x=p(g),R=a(T,"_blank",x);return R.addEventListener("loadstart",function(H){if(H.url.indexOf(E())==0){R.close();var me=A(H.url);he(me,y)}}),y.promise},accountManagement:function(){var g=e.createAccountUrl();if(typeof g<"u"){var y=a(g,"_blank","location=no");y.addEventListener("loadstart",function(T){T.url.indexOf(E())==0&&y.close()})}else throw"Not supported by the OIDC server"},redirectUri:function(g){return E()}}}if(r=="cordova-native")return c.enable=!1,{login:function(g){var y=_(),T=e.createLoginUrl(g);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var R=A(x.url);he(R,y)}),window.cordova.plugins.browsertab.openUrl(T),y.promise},logout:function(g){var y=_(),T=e.createLogoutUrl(g);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close(),e.clearToken(),y.setSuccess()}),window.cordova.plugins.browsertab.openUrl(T),y.promise},register:function(g){var y=_(),T=e.createRegisterUrl(g);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var R=A(x.url);he(R,y)}),window.cordova.plugins.browsertab.openUrl(T),y.promise},accountManagement:function(){var g=e.createAccountUrl();if(typeof g<"u")window.cordova.plugins.browsertab.openUrl(g);else throw"Not supported by the OIDC server"},redirectUri:function(g){return g&&g.redirectUri?g.redirectUri:e.redirectUri?e.redirectUri:"http://localhost"}};throw"invalid adapter type: "+r}var Y=function(){if(!(this instanceof Y))return new Y;localStorage.setItem("kc-test","test"),localStorage.removeItem("kc-test");var r=this;function a(){for(var f=new Date().getTime(),b=0;b<localStorage.length;b++){var p=localStorage.key(b);if(p&&p.indexOf("kc-callback-")==0){var E=localStorage.getItem(p);if(E)try{var g=JSON.parse(E).expires;(!g||g<f)&&localStorage.removeItem(p)}catch{localStorage.removeItem(p)}}}}r.get=function(f){if(f){var b="kc-callback-"+f,p=localStorage.getItem(b);return p&&(localStorage.removeItem(b),p=JSON.parse(p)),a(),p}},r.add=function(f){a();var b="kc-callback-"+f.state;f.expires=new Date().getTime()+60*60*1e3,localStorage.setItem(b,JSON.stringify(f))}},ce=function(){if(!(this instanceof ce))return new ce;var r=this;r.get=function(p){if(p){var E=f("kc-callback-"+p);if(b("kc-callback-"+p,"",a(-100)),E)return JSON.parse(E)}},r.add=function(p){b("kc-callback-"+p.state,JSON.stringify(p),a(60))},r.removeItem=function(p){b(p,"",a(-100))};var a=function(p){var E=new Date;return E.setTime(E.getTime()+p*60*1e3),E},f=function(p){for(var E=p+"=",g=document.cookie.split(";"),y=0;y<g.length;y++){for(var T=g[y];T.charAt(0)==" ";)T=T.substring(1);if(T.indexOf(E)==0)return T.substring(E.length,T.length)}return""},b=function(p,E,g){var y=p+"="+E+"; expires="+g.toUTCString()+"; ";document.cookie=y}};function B(){try{return new Y}catch{}return new ce}function pe(r){return function(){e.enableLogging&&r.apply(console,Array.prototype.slice.call(arguments))}}}async function fl(){const t="silent-login.html",e=await fetch(location.origin+"/"+t).then(n=>n.status===200).catch(()=>!1);return e||(console.warn(`Arquivo ${t} não localizado no projeto!`),document.body.innerHTML=`<div style="padding: 3rem; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; font-size: 1.5rem;">O arquivo '${t}' não foi encontrado.</div>`),e}function hl(t){const e=new No(t),n={},o=async(k={},L)=>{if(await fl())return e.init(k).then(async F=>{F&&await s(),L&&typeof L=="function"&&L()}).catch(F=>{console.error(F),document.body.innerHTML='<div style="padding: 3rem; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; font-size: 1.5rem;">Não foi possível conectar no servidor de autenticação.</div>'})},s=async()=>{const k=await e.loadUserInfo();n.email=k.email??"",n.emailVerified=k.email_verified===!0,n.firstName=k.given_name??"",n.lastName=k.family_name??"",n.name=k.name??"",n.sub=k.sub??"",n.username=k.preferred_username??"",n.roles=[...k.role??[]],n.groups=[...k.group??[]],n.IsInRole=L=>n.roles.includes(L),sessionStorage.setItem("name",n.name)};return{Instance:e,User:n,Init:o,Logout:()=>{e.logout({redirectUri:location.origin}).then(()=>{sessionStorage.removeItem("name")})}}}const pl=t=>hl(t);class ml{constructor(e=null){ct(this,"errors",[]);ct(this,"_value",null);ct(this,"_httpStatusCode");this._value=e,this._httpStatusCode=200}get value(){return this._value}set value(e){this._value=e}get hasSuccess(){return!this.hasError}get hasError(){return this.errors.length>0}get httpStatusCode(){return this._httpStatusCode}set httpStatusCode(e){this._httpStatusCode=e}WithError(e){this.errors.push(e),this._httpStatusCode===200&&(this._httpStatusCode=400)}WithErrors(e){e.forEach(n=>this.WithError(n))}}const Ol="",Fl="";(()=>{function t(){l.nextTick(()=>{setTimeout(()=>{var n;const e=document.querySelector(":root");e&&e.style.setProperty("--window-height",`${((n=window.visualViewport)==null?void 0:n.height)??window.innerHeight}px`)},1)})}t(),window.addEventListener("resize",t)})(),yn.SetInitialTheme(),G.AppResult=ml,G.Cor=zt,G.SfButton=Ja,G.SfContent=Ha,G.SfIcon=ut,G.SfLayout=Ma,G.SfNavMenuLink=Ua,G.SfTabNavigation=Ka,G.Tamanho=qe,G.UseAuthService=pl,G.UseDialogService=Ro,G.UseNavMenuService=jt,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
79
+ For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`),c.enable=!1,e.silentCheckSsoFallback&&(e.silentCheckSsoRedirectUri=!1)),document.body.removeChild(a),window.removeEventListener("message",f),r.setSuccess()))};window.addEventListener("message",f,!1)}else r.setSuccess();return v(r.promise,e.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function X(r){if(!r||r=="default")return{login:function(g){return window.location.assign(e.createLoginUrl(g)),_().promise},logout:function(g){return window.location.replace(e.createLogoutUrl(g)),_().promise},register:function(g){return window.location.assign(e.createRegisterUrl(g)),_().promise},accountManagement:function(){var g=e.createAccountUrl();if(typeof g<"u")window.location.href=g;else throw"Not supported by the OIDC server";return _().promise},redirectUri:function(g,y){return g&&g.redirectUri?g.redirectUri:e.redirectUri?e.redirectUri:location.href}};if(r=="cordova"){c.enable=!1;var a=function(g,y,T){return window.cordova&&window.cordova.InAppBrowser?window.cordova.InAppBrowser.open(g,y,T):window.open(g,y,T)},f=function(g){return g&&g.cordovaOptions?Object.keys(g.cordovaOptions).reduce(function(y,T){return y[T]=g.cordovaOptions[T],y},{}):{}},b=function(g){return Object.keys(g).reduce(function(y,T){return y.push(T+"="+g[T]),y},[]).join(",")},p=function(g){var y=f(g);return y.location="no",g&&g.prompt=="none"&&(y.hidden="yes"),b(y)},E=function(){return e.redirectUri||"http://localhost"};return{login:function(g){var y=_(),T=p(g),x=e.createLoginUrl(g),R=a(x,"_blank",T),H=!1,me=!1,ue=function(){me=!0,R.close()};return R.addEventListener("loadstart",function(te){if(te.url.indexOf(E())==0){var Pe=A(te.url);he(Pe,y),ue(),H=!0}}),R.addEventListener("loaderror",function(te){if(!H)if(te.url.indexOf(E())==0){var Pe=A(te.url);he(Pe,y),ue(),H=!0}else y.setError(),ue()}),R.addEventListener("exit",function(te){me||y.setError({reason:"closed_by_user"})}),y.promise},logout:function(g){var y=_(),T=e.createLogoutUrl(g),x=a(T,"_blank","location=no,hidden=yes,clearcache=yes"),R;return x.addEventListener("loadstart",function(H){H.url.indexOf(E())==0&&x.close()}),x.addEventListener("loaderror",function(H){H.url.indexOf(E())==0||(R=!0),x.close()}),x.addEventListener("exit",function(H){R?y.setError():(e.clearToken(),y.setSuccess())}),y.promise},register:function(g){var y=_(),T=e.createRegisterUrl(),x=p(g),R=a(T,"_blank",x);return R.addEventListener("loadstart",function(H){if(H.url.indexOf(E())==0){R.close();var me=A(H.url);he(me,y)}}),y.promise},accountManagement:function(){var g=e.createAccountUrl();if(typeof g<"u"){var y=a(g,"_blank","location=no");y.addEventListener("loadstart",function(T){T.url.indexOf(E())==0&&y.close()})}else throw"Not supported by the OIDC server"},redirectUri:function(g){return E()}}}if(r=="cordova-native")return c.enable=!1,{login:function(g){var y=_(),T=e.createLoginUrl(g);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var R=A(x.url);he(R,y)}),window.cordova.plugins.browsertab.openUrl(T),y.promise},logout:function(g){var y=_(),T=e.createLogoutUrl(g);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close(),e.clearToken(),y.setSuccess()}),window.cordova.plugins.browsertab.openUrl(T),y.promise},register:function(g){var y=_(),T=e.createRegisterUrl(g);return universalLinks.subscribe("keycloak",function(x){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var R=A(x.url);he(R,y)}),window.cordova.plugins.browsertab.openUrl(T),y.promise},accountManagement:function(){var g=e.createAccountUrl();if(typeof g<"u")window.cordova.plugins.browsertab.openUrl(g);else throw"Not supported by the OIDC server"},redirectUri:function(g){return g&&g.redirectUri?g.redirectUri:e.redirectUri?e.redirectUri:"http://localhost"}};throw"invalid adapter type: "+r}var Y=function(){if(!(this instanceof Y))return new Y;localStorage.setItem("kc-test","test"),localStorage.removeItem("kc-test");var r=this;function a(){for(var f=new Date().getTime(),b=0;b<localStorage.length;b++){var p=localStorage.key(b);if(p&&p.indexOf("kc-callback-")==0){var E=localStorage.getItem(p);if(E)try{var g=JSON.parse(E).expires;(!g||g<f)&&localStorage.removeItem(p)}catch{localStorage.removeItem(p)}}}}r.get=function(f){if(f){var b="kc-callback-"+f,p=localStorage.getItem(b);return p&&(localStorage.removeItem(b),p=JSON.parse(p)),a(),p}},r.add=function(f){a();var b="kc-callback-"+f.state;f.expires=new Date().getTime()+60*60*1e3,localStorage.setItem(b,JSON.stringify(f))}},ce=function(){if(!(this instanceof ce))return new ce;var r=this;r.get=function(p){if(p){var E=f("kc-callback-"+p);if(b("kc-callback-"+p,"",a(-100)),E)return JSON.parse(E)}},r.add=function(p){b("kc-callback-"+p.state,JSON.stringify(p),a(60))},r.removeItem=function(p){b(p,"",a(-100))};var a=function(p){var E=new Date;return E.setTime(E.getTime()+p*60*1e3),E},f=function(p){for(var E=p+"=",g=document.cookie.split(";"),y=0;y<g.length;y++){for(var T=g[y];T.charAt(0)==" ";)T=T.substring(1);if(T.indexOf(E)==0)return T.substring(E.length,T.length)}return""},b=function(p,E,g){var y=p+"="+E+"; expires="+g.toUTCString()+"; ";document.cookie=y}};function B(){try{return new Y}catch{}return new ce}function pe(r){return function(){e.enableLogging&&r.apply(console,Array.prototype.slice.call(arguments))}}}async function fl(){const t="silent-login.html",e=await fetch(location.origin+"/"+t).then(async n=>n.status!==200?!1:(await n.text()).includes("silent-login-iframe-result")).catch(()=>!1);return e||(console.warn(`Arquivo ${t} não localizado no projeto ou não possui o conteúdo correto!`),document.body.innerHTML=`<div style="padding: 3rem; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; font-size: 1.5rem;">O arquivo '${t}' não foi encontrado.</div>`),e}function hl(t){const e=new No(t),n={},o=async(k={},L)=>{if(await fl())return e.init(k).then(async F=>{F&&await s(),L&&typeof L=="function"&&L()}).catch(F=>{console.error(F),document.body.innerHTML='<div style="padding: 3rem; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; font-size: 1.5rem;">Não foi possível conectar no servidor de autenticação.</div>'})},s=async()=>{const k=await e.loadUserInfo();n.email=k.email??"",n.emailVerified=k.email_verified===!0,n.firstName=k.given_name??"",n.lastName=k.family_name??"",n.name=k.name??"",n.sub=k.sub??"",n.username=k.preferred_username??"",n.roles=[...k.role??[]],n.groups=[...k.group??[]],n.IsInRole=L=>n.roles.includes(L),sessionStorage.setItem("name",n.name)};return{Instance:e,User:n,Init:o,Logout:()=>{e.logout({redirectUri:location.origin}).then(()=>{sessionStorage.removeItem("name")})}}}const pl=t=>hl(t);class ml{constructor(e=null){ct(this,"errors",[]);ct(this,"_value",null);ct(this,"_httpStatusCode");this._value=e,this._httpStatusCode=200}get value(){return this._value}set value(e){this._value=e}get hasSuccess(){return!this.hasError}get hasError(){return this.errors.length>0}get httpStatusCode(){return this._httpStatusCode}set httpStatusCode(e){this._httpStatusCode=e}WithError(e){this.errors.push(e),this._httpStatusCode===200&&(this._httpStatusCode=400)}WithErrors(e){e.forEach(n=>this.WithError(n))}}const Ol="",Fl="";(()=>{function t(){l.nextTick(()=>{setTimeout(()=>{var n;const e=document.querySelector(":root");e&&e.style.setProperty("--window-height",`${((n=window.visualViewport)==null?void 0:n.height)??window.innerHeight}px`)},1)})}t(),window.addEventListener("resize",t)})(),yn.SetInitialTheme(),G.AppResult=ml,G.Cor=zt,G.SfButton=Ja,G.SfContent=Ha,G.SfIcon=ut,G.SfLayout=Ma,G.SfNavMenuLink=Ua,G.SfTabNavigation=Ka,G.Tamanho=qe,G.UseAuthService=pl,G.UseDialogService=Ro,G.UseNavMenuService=jt,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
80
80
  //# sourceMappingURL=lib.umd.js.map