graphdb-workbench
Version:
The web application for GraphDB APIs
1 lines • 7.49 kB
JavaScript
import{r as registerInstance,c as createEvent,h,a as Host}from"./index-I_gcXFWK.js";import{L as LoggerProvider,T as TranslationService}from"./translation.service-nljGIprK.js";import{ServiceProvider,SecurityContextService,SecurityService,CookieConsent}from"@ontotext/workbench-api";const ontoCookieConsentCss=".cookie-consent-modal{position:fixed;bottom:0;left:0;right:0;background-color:#fff;box-shadow:0 -2px 10px rgba(0, 0, 0, 0.1);padding:20px;z-index:1050;width:100%}.cookie-consent-content{display:flex;justify-content:center;align-items:center}.cookie-consent-content button{margin-left:12px}.cookie-policy-modal{padding:24px 40px;overflow-y:auto}.cookie-policy-modal .modal-dialog{width:60% !important;max-width:60% !important}.cookie-policy-modal .title{font-size:xx-large;font-weight:bolder}.cookie-policy-modal .heading{font-size:x-large;font-weight:bolder;margin-top:12px}.cookie-policy-modal .subheading{font-size:large;font-weight:bolder;margin-top:8px}.cookie-policy-modal .text{font-size:math}",OntoCookieConsent=class{constructor(e){registerInstance(this,e),this.consentGiven=createEvent(this,"consentGiven"),this.showModal=!1,this.openModal=e=>{e.preventDefault(),this.showModal=!0},this.handleConsentClick=()=>{this.consentGiven.emit()}}onDialogClose(){this.showModal=!1}render(){return h(Host,{key:"dba3fc373e9ad60ada7f86d11acbe1b1ed24a92d"},h("div",{key:"414c970a3a4b263e8f3f5d066dc8bb22b8194c48",class:"cookie-consent-modal"},h("section",{key:"6a1cccadb167b301738fb6a453b7d300e93ba18b",class:"cookie-consent-content"},h("span",{key:"aa62410b522125feeb48eaa568a78c761e6b9596"},h("translate-label",{key:"0696068c1aa8738bb3ddf0e548d9140ba12609e1",labelKey:"cookie.cookie_consent"}),h("a",{key:"efd9792a6a424b86606b3904615c53f19a2cdb6e",id:"cookie-policy-link",href:"#",onClick:this.openModal,class:"btn btn-link p-0"},h("translate-label",{key:"12e95d1446f81b47c973e285ee71da5fbfa4934f",labelKey:"cookie.cookie_policy_url_label"})),"."),h("button",{key:"a91e7d9e7eddef1b50d82570f4211a0e1e1ae7b0",id:"accept-cookie-policy",class:"onto-btn onto-btn-primary",onClick:this.handleConsentClick},h("translate-label",{key:"5ca81d4f299a7b7f13ed0f77ac7d1ceaeaad318a",labelKey:"common.button.ok"})))),this.showModal&&h("onto-cookie-policy-dialog",{key:"e54d3f134771ff5f59a288d0d6c9949c6f59567f",dialogHandler:this}))}};OntoCookieConsent.style=ontoCookieConsentCss;const ontoCookiePolicyDialogCss="section h4{font-size:x-large;font-weight:bolder;margin-top:12px}";var CookieType;!function(e){e.THIRD_PARTY="thirdParty",e.STATISTIC="statistic"}(CookieType||(CookieType={}));const OntoCookiePolicyDialog=class{constructor(e){registerInstance(this,e),this.logger=LoggerProvider.logger,this.user=ServiceProvider.get(SecurityContextService).getAuthenticatedUser(),this.securityService=ServiceProvider.get(SecurityService)}toggleChanged(e){this.setUserCookieConsent(this.updateCookieConsent(e.detail)),this.securityService.updateUserData(this.user).catch(this.logger.error)}render(){var e,o;const a={dialogTitle:TranslationService.translate("cookie.policy.title"),onClose:()=>this.dialogHandler.onDialogClose(),modalClass:"cookie-policy-modal"},t=new CookieConsent(null===(o=null===(e=this.user)||void 0===e?void 0:e.appSettings)||void 0===o?void 0:o.COOKIE_CONSENT);return h("onto-dialog",{key:"5e62d3868af4012577e84bb5c1253539a673083a",config:a},h("div",{key:"16eca81b0a06475b144605d8e59e96451629c96f",slot:"body"},h("section",{key:"e80b33838e3c8d7f98aa56279b0abda6675cae3d"},h("h4",{key:"669acb8c03e02245e73e3e633d3c65727a06f505"},h("translate-label",{key:"071e342001fea0bac249c76e71925794876a4e88",labelKey:"cookie.policy.purpose_heading"})),h("p",{key:"264d4941a7bd54d527c9b17db0d0a277af553a60"},h("translate-label",{key:"e96b4a061dc7b7f35de34b425d32983ced5379e9",labelKey:"cookie.policy.purpose_text"})),h("p",{key:"dde91eecd6bc971a6b99adf4c5dc5db20ea895cc"},h("translate-label",{key:"3d63148dd9dad889b0be3e7d6c5b11872f5a659d",labelKey:"cookie.policy.purpose_enterprise_text"}))),h("section",{key:"2c6108c24450d655a07c4a6cdedf2ffa0b68a99b"},h("h4",{key:"fd11c7d881ee183427577d335b16ccb8e09d44e0"},h("translate-label",{key:"4fc7994e04ae0a4eb934b99d933f9976e6c8440d",labelKey:"cookie.policy.privacy_commitment_heading"})),h("p",{key:"c7c8c430acb67b506732f4ffdf5138582a363f53"},h("translate-label",{key:"c7c476ec48cfbaf842331f2ce868cf1eb7e6af69",labelKey:"cookie.policy.privacy_commitment_text"})),h("ul",{key:"9762f4a7ba0cb70993daaa23fa213072b7589459"},h("li",{key:"53f038d506a52714d2ba63c90c277986fde70e84"},h("translate-label",{key:"36d36a3e084e121d40e8a2c19afea11fc7384612",labelKey:"cookie.policy.privacy_commitment_1"})),h("li",{key:"764c43f6b844dc18aa78c3b1bb6b6ff012e56bd4"},h("translate-label",{key:"222eafa3af9ce55d2fea0a796197cd355289e135",labelKey:"cookie.policy.privacy_commitment_2"})))),h("section",{key:"4e43cd6f18738a953d52e5d249e3d0185faead7c"},h("h4",{key:"9af407bdd0fa5d77293a5f1d004fa109ed2b442d"},h("translate-label",{key:"0e656ea4576feae9a7bd0996eba3fb2d9ad1d43f",labelKey:"cookie.policy.cookies_heading"})),h("p",{key:"c198b97197b54ed6d8b5342b0fb616573c3dacc8"},h("translate-label",{key:"5b92e0bf1249378314e6e0eb2b2928d26ea6335a",labelKey:"cookie.policy.cookies_text"}))),h("section",{key:"2714f502c5a75d1ed1836c59bcb13b2e478777f5"},h("h4",{key:"0f36bdda71a975d35dcb0945e319cdbff47db95f"},h("translate-label",{key:"e1c41bd8de6d78f7d57463726a47cadbf80db251",labelKey:"cookie.policy.manage_cookies_heading"})),h("onto-toggle-switch",{key:"2d3ca12f02eb1d218619642fb007fb30df7473a5",checked:null==t?void 0:t.statistic,labelKey:"cookie.policy.statistic_cookies",tooltipTranslationKey:"cookie.policy.statistic_tooltip",context:CookieType.STATISTIC}),h("p",{key:"8d4ea408a918657ba6fb173d75010dff14ab92d8"},h("translate-label",{key:"3cdf73f90f86c0c777aa6608bc027a66cf4357c4",labelKey:"cookie.policy.statistic_text"})),h("onto-toggle-switch",{key:"5496e326b60220c122d669de25da36ff580f86a3",checked:null==t?void 0:t.thirdParty,labelKey:"cookie.policy.third_party_cookies",tooltipTranslationKey:"cookie.policy.third_party_tooltip",context:CookieType.THIRD_PARTY}),h("p",{key:"6e5eb57eded1cd9039137f97792f484035fd39b4"},h("translate-label",{key:"4f46f1391784782d133d54f48b17b93acdd5e455",labelKey:"cookie.policy.third_party_cookies_text"}))),h("p",{key:"7ddab24add6d05b2cddda126adb7996dfdbac970"},h("span",{key:"3ec5b1a68c7c9bdcc4c771c83dbf39a76f1b53b5"},h("translate-label",{key:"9dedef31386432411256689eff2a087c52906740",labelKey:"cookie.policy.change_cookies"}),h("i",{key:"147b23da37def13f0da4a8afdc04b33205e087b8"}," ",h("translate-label",{key:"bba53a3b3ed74a9f1922528ed9e5d86ad40379a5",labelKey:"menu.setup.label"})," > ",h("translate-label",{key:"3689ef4f4d6d34c9ddd45c42a02387778d87bd1f",labelKey:"menu.my.settings.label"})," > ",h("translate-label",{key:"e7c73135758fd1486ee7e4a3328ba261d77aaa15",labelKey:"security.user.settings"})," > ",h("translate-label",{key:"d248fc63637f1587a672a18a7ea08a8fb1d6b16f",labelKey:"cookie.policy.change_cookies_location4"})," ")))))}updateCookieConsent(e){var o,a;const t=new CookieConsent(null===(a=null===(o=this.user)||void 0===o?void 0:o.appSettings)||void 0===a?void 0:a.COOKIE_CONSENT);return t[e.context]=e.checked,t.updatedAt=(new Date).getTime(),t}setUserCookieConsent(e){this.user.appSettings||(this.user.appSettings={}),this.user.appSettings.COOKIE_CONSENT=e}};OntoCookiePolicyDialog.style=ontoCookiePolicyDialogCss;export{OntoCookieConsent as onto_cookie_consent,OntoCookiePolicyDialog as onto_cookie_policy_dialog};