{"version":3,"file":"utpl-cookies.mjs","sources":["../../../projects/utpl-cookies/src/lib/utpl-cookies.service.ts","../../../projects/utpl-cookies/src/lib/utpl-cookies.component.ts","../../../projects/utpl-cookies/src/lib/utpl-cookies.component.html","../../../projects/utpl-cookies/src/lib/utpl-cookies.module.ts","../../../projects/utpl-cookies/src/public-api.ts","../../../projects/utpl-cookies/src/utpl-cookies.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class UtplCookiesService {\n\n  constructor() { }\n}\n","import { Component, OnInit } from '@angular/core';\n\n@Component({\n  selector: 'utpl-cookies',\n  templateUrl: './utpl-cookies.component.html',\n  styles: [\n  ]\n})\nexport class UtplCookiesComponent implements OnInit {\n  \n  /**\n  * @author fdquinones\n  * @classdesc Al momento de inicializar el componente se cargan las librerias necesarias para trabajar\n  */\n  ngOnInit() {\n    this.loadInit();\n    this.loadExternalScript(\"https://cdn.jsdelivr.net/gh/jfeltkamp/cookiesjsr@1/dist/cookiesjsr.min.js\");\n\n  }\n\n  /**\n  * @author fdquinones\n  * @param scriptUrl\n  * @classdesc Obtiene un script externo, en este caso la libreria de @jfeltkamp/cookiesjsr.\n  */\n  private loadExternalScript(scriptUrl: string) {\n    return new Promise((resolve, reject) => {\n      const scriptElement = document.createElement('script');\n      scriptElement.src = scriptUrl;\n      scriptElement.textContent = \"\";\n      scriptElement.type = 'text/javascript';\n      scriptElement.onload = resolve;\n      document.body.appendChild(scriptElement);\n    });\n  }\n\n  /**\n     * @author fdquinones\n     * @classdesc Configura por defecto el componente de @jfeltkamp/cookiesjsr\n     */\n  private loadInit() {\n    return new Promise((resolve, reject) => {\n      const scriptElement = document.createElement('script');\n      scriptElement.textContent = `// Base configuration\n        document.cookiesjsr = {\n          apiUrl: '',\n          configQuery: 'https://unpkg.com/utpl-cookies@0.0.12/assets/cookiesjsr/cookiesjsr-config.json'\n        }\n        var dispatcher = {\n          matomo: {\n             activate: function() {\n                // Do stuff to enable Matomo. See best practices below.\n             },\n             fallback: function() {\n                // Do stuff to fallback. E.g. display layer where the benefits are explained,\n                // when Matomo is enabled.\n             }\n          },\n          analytics: {\n             activate: function() {\n                // Do stuff to enable Google Analytics. See best practices below.\n             },\n             fallback: function() {\n                // Do stuff to fallback. E.g. display layer where the benefits are explained,\n                // when Google Analytics is enabled.\n             }\n          }\n       }\n       \n       /**\n        * Entry to your custom code:\n        * Catch the Event 'cookiesjsrUserConsent' that comes with an object services inside the\n        * event object called with event.detail.services. It contains the current user decisions.\n        *\n        * This event is fired when DOM is loaded or user updates his settings.\n        */\n       document.addEventListener('cookiesjsrUserConsent', function(event) {\n          var services = (typeof event.detail.services === 'object') ? event.detail.services : {};\n          for (var sid in services) {\n             if(typeof dispatcher[sid] === 'object') {\n                if(services[sid] === true && typeof dispatcher[sid].activate === 'function') {\n                   dispatcher[sid].activate();\n                } else if(typeof dispatcher[sid].fallback === 'function') {\n                   dispatcher[sid].fallback();\n                }\n             }\n          }\n       });`;\n      scriptElement.type = 'text/javascript';\n      scriptElement.onload = resolve;\n      document.body.appendChild(scriptElement);\n    });\n  }\n}\n","<!-- The Place where cookiesjsr can live in. -->\n<div id=\"cookiesjsr\"></div>","import { NgModule } from '@angular/core';\nimport { UtplCookiesComponent } from './utpl-cookies.component';\n\n\n\n@NgModule({\n  declarations: [\n    UtplCookiesComponent\n  ],\n  imports: [\n  ],\n  exports: [\n    UtplCookiesComponent\n  ]\n})\nexport class UtplCookiesModule { }\n","/*\n * Public API Surface of utpl-cookies\n */\n\nexport * from './lib/utpl-cookies.service';\nexport * from './lib/utpl-cookies.component';\nexport * from './lib/utpl-cookies.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAKa,kBAAkB,CAAA;AAE7B,IAAA,WAAA,GAAA,GAAiB;;+GAFN,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,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