@usercentrics/cmp-browser-sdk
Advanced tools
Comparing version 0.3.4 to 0.3.6
@@ -11,5 +11,22 @@ # Changelog | ||
- Better documentation | ||
- Fill out CHANGELOG for versions 0.1.0 and 0.2.0 | ||
- Remove lodash as a dependency | ||
- Fill out `CHANGELOG` for versions 0.1.0 and 0.2.0 | ||
- Remove `lodash` as a dependency | ||
## [0.3.6] - 2020-03-11 | ||
### Changed | ||
- Include `regenerator-runtime` in the bundle, so it's never missing in consumer projects | ||
- Modify `IE11 Compatibility` section in `README` | ||
## [0.3.5] - 2020-03-11 | ||
### Added | ||
- Add section `IE11 Compatibility` in `README` | ||
### Changed | ||
- Include `ky` in the bundle, so that everything's truly ES5 compatible | ||
## [0.3.4] - 2020-03-10 | ||
@@ -16,0 +33,0 @@ |
@@ -1,1 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,n,s,i,r=t(require("ky")),o=require("uuid"),a=t(require("lodash/sortBy")),c=t(require("lodash/uniqWith")),u=function(){return(u=Object.assign||function(t){for(var e,n=1,s=arguments.length;n<s;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function l(t,e,n,s){return new(n||(n=Promise))((function(i,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function a(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((s=s.apply(t,e||[])).next())}))}function g(t,e){var n,s,i,r,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,s&&(i=2&r[0]?s.return:r[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,r[1])).done)return i;switch(s=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,s=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===r[0]||2===r[0])){o=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){o.label=r[1];break}if(6===r[0]&&o.label<i[1]){o.label=i[1],i=r;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(r);break}i[2]&&o.ops.pop(),o.trys.pop();continue}r=e.call(t,o)}catch(t){r=[6,t],s=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}}function h(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var s=Array(t),i=0;for(e=0;e<n;e++)for(var r=arguments[e],o=0,a=r.length;o<a;o++,i++)s[i]=r[o];return s}(e=exports.CONSENT_ACTION||(exports.CONSENT_ACTION={})).ACCEPT_ALL_SERVICES="onAcceptAllServices",e.DENY_ALL_SERVICES="onDenyAllServices",e.ESSENTIAL_CHANGE="onEssentialChange",e.INITIAL_PAGE_LOAD="onInitialPageLoad",e.NON_EU_REGION="onNonEURegion",e.UPDATE_SERVICES="onUpdateServices",(n=exports.CONSENT_TYPE||(exports.CONSENT_TYPE={})).EXPLICIT="explicit",n.IMPLICIT="implicit",function(t){t.AVAILABLE_LANGUAGES_NOT_FOUND="Unable to find available languages using given settingsId and version.",t.FETCH_AVAILABLE_LANGUAGES="Something went wrong while fetching the available languages.",t.FETCH_DATA_PROCESSING_SERVICES="Something went wrong while fetching the data processing services.",t.FETCH_SETTINGS="Something went wrong while fetching the settings.",t.FETCH_USER_COUNTRY="Something went wrong while fetching the user's country.",t.GENERATE_DATA_PROCESSING_SERVICES="Something went wrong while generating the data processing services.",t.SAVE_CONSENTS="Something went wrong while saving user consents.",t.SETTINGS_NOT_FOUND="Unable to find settings using given settingsId and version."}(s||(s={})),function(t){t.AGGREGATOR="https://consent-templates-batch-generation.usercentrics.eu",t.CDN="https://api.usercentrics.eu",t.GRAPHQL="https://graphql.usercentrics.eu/graphql"}(i||(i={}));var p,d,f,v,I,S,y,E={limit:3,statusCodes:[408,413,429,500,502,503,504]},C=function(t,e){return l(void 0,void 0,void 0,(function(){var n,s,i;return g(this,(function(o){switch(o.label){case 0:n={retry:E},o.label=1;case 1:return o.trys.push([1,4,,5]),[4,r.get(t,n)];case 2:return s=o.sent(),[4,A(s)];case 3:return[2,o.sent()];case 4:throw i=o.sent(),N(i,e);case 5:return[2]}}))}))},T=function(t,e,n,s){return l(void 0,void 0,void 0,(function(){var i,o,a;return g(this,(function(c){switch(c.label){case 0:i=u({json:e,retry:E},s),c.label=1;case 1:return c.trys.push([1,4,,5]),[4,r.post(t,i)];case 2:return o=c.sent(),[4,A(o)];case 3:return[2,c.sent()];case 4:throw a=c.sent(),N(a,n);case 5:return[2]}}))}))},A=function(t){return l(void 0,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return[4,b(t)];case 1:return[2,{data:e.sent(),statusCode:t.status}]}}))}))},N=function(t,e){return{errorMessage:e,statusCode:t.response.status}},b=function(t){return l(void 0,void 0,void 0,(function(){var e,n;return g(this,(function(s){switch(s.label){case 0:return[4,t.json()];case 1:return e=s.sent(),[2,null!==(n=e.data)&&void 0!==n?n:e]}}))}))},_=function(t,e){return-1!==t.indexOf(e)},m=function(t){return Array.isArray(t)&&t.length>0},L=function(t){return"object"==typeof t&&null!==t&&Object.keys(t).length>0},O=function(){function t(){this.jsonFileLanguage="",this.jsonFileVersion="latest",this.settingsId=""}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.resetInstance=function(){t.instance.jsonFileLanguage="",t.instance.jsonFileVersion="latest",t.instance.settingsId=""},t.prototype.getJsonFileLanguage=function(){return this.jsonFileLanguage},t.prototype.getJsonFileVersion=function(){return this.jsonFileVersion},t.prototype.getSettingsId=function(){return this.settingsId},t.prototype.setJsonFileLanguage=function(t){this.jsonFileLanguage=t},t.prototype.setJsonFileVersion=function(t){this.jsonFileVersion=t},t.prototype.setSettingsId=function(t){this.settingsId=t},t.prototype.fetchAvailableLanguages=function(){return l(this,void 0,void 0,(function(){var t,e;return g(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this.createLanguagesJsonUrl(),[4,C(t,s.FETCH_AVAILABLE_LANGUAGES)];case 1:return[2,n.sent().data.languagesAvailable];case 2:throw 403===(e=n.sent()).statusCode&&(e.errorMessage=s.AVAILABLE_LANGUAGES_NOT_FOUND),e;case 3:return[2]}}))}))},t.prototype.fetchServicesJson=function(t){return l(this,void 0,void 0,(function(){var e;return g(this,(function(n){switch(n.label){case 0:return e=this.createServicesJsonUrl(t),[4,C(e,s.FETCH_DATA_PROCESSING_SERVICES)];case 1:return[2,n.sent().data]}}))}))},t.prototype.fetchSettingsJson=function(){return l(this,void 0,void 0,(function(){var t,e;return g(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this.createSettingsJsonUrl(),[4,C(t,s.FETCH_SETTINGS)];case 1:return[2,n.sent().data];case 2:throw 403===(e=n.sent()).statusCode&&(e.errorMessage=s.SETTINGS_NOT_FOUND),e;case 3:return[2]}}))}))},t.prototype.fetchUserCountry=function(){return l(this,void 0,void 0,(function(){var t,e;return g(this,(function(n){switch(n.label){case 0:return t=w(),e=P(),[4,T(i.GRAPHQL,t,s.FETCH_USER_COUNTRY,e)];case 1:return[2,n.sent().data.clientLocation]}}))}))},t.prototype.generateServicesJson=function(t){return l(this,void 0,void 0,(function(){var e;return g(this,(function(n){switch(n.label){case 0:return e={request:t},[4,T(i.AGGREGATOR,e,s.GENERATE_DATA_PROCESSING_SERVICES)];case 1:return[2,n.sent().data.fileName]}}))}))},t.prototype.saveConsents=function(t){return l(this,void 0,void 0,(function(){var e,n;return g(this,(function(r){switch(r.label){case 0:return e=R(t),n=P(),[4,T(i.GRAPHQL,e,s.SAVE_CONSENTS,n)];case 1:return[2,r.sent().data.saveConsents.data]}}))}))},t.prototype.createLanguagesJsonUrl=function(){return i.CDN+"/settings/"+this.settingsId+"/"+this.jsonFileVersion+"/languages.json"},t.prototype.createServicesJsonUrl=function(t){return i.CDN+"/consent-templates/"+t+".json"},t.prototype.createSettingsJsonUrl=function(){return i.CDN+"/settings/"+this.settingsId+"/"+this.jsonFileVersion+"/"+this.jsonFileLanguage+".json"},t}(),w=function(){return{operationName:"clientLocation",query:"query clientLocation { clientLocation { countryCode countryName } }"}},P=function(){return{credentials:"omit",headers:{Accept:"application/json","Access-Control-Allow-Origin":"*","X-Request-ID":o.v4()},mode:"cors"}},R=function(t){return{operationName:"saveConsents",query:"mutation saveConsents($consents: [NewCreateConsentInput]) { saveConsents(consents: $consents) { data { consentId } } }",variables:{consents:U(t)}}},U=function(t){return t.map((function(t){return{action:t.consent.action,appVersion:"SDK-0.3.4",consentStatus:t.consent.status?"1":"0",consentTemplateId:t.service.id,consentTemplateVersion:t.service.version,controllerId:t.settings.controllerId,language:t.settings.language,processorId:t.service.processorId,settingsId:t.settings.id,settingsVersion:t.settings.version,updatedBy:t.consent.type}}))};!function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE"}(p||(p={})),function(t){t[t.DATA_LAYER=0]="DATA_LAYER",t[t.WINDOW_EVENT=1]="WINDOW_EVENT"}(d||(d={})),function(t){t[t.MAJOR=0]="MAJOR",t[t.MINOR=1]="MINOR",t[t.PATCH=2]="PATCH"}(f||(f={})),function(t){t[t.FIRST_LAYER=1]="FIRST_LAYER",t[t.SECOND_LAYER=3]="SECOND_LAYER"}(v||(v={})),function(t){t[t.DATA_LAYER=1]="DATA_LAYER",t[t.WINDOW_EVENT=4]="WINDOW_EVENT"}(I||(I={})),function(t){t.DATA_COLLECTED_LIST="dataCollectedList",t.DATA_PURPOSES_LIST="dataPurposesList",t.DATA_RECIPIENTS_LIST="dataRecipientsList",t.TECHNOLOGY_USED="technologyUsed"}(S||(S={})),function(t){t.MAJOR="major",t.MINOR="minor",t.PATCH="patch"}(y||(y={}));var D,F=function(){function t(){this.dataLayerNames=[],this.windowEventNames=[]}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.resetInstance=function(){t.instance.dataLayerNames=[],t.instance.windowEventNames=[]},t.prototype.init=function(t){var e=this;t.forEach((function(t){var n,s;t.type===d.DATA_LAYER?e.dataLayerNames=null!==(n=t.names)&&void 0!==n?n:[]:t.type===d.WINDOW_EVENT&&(e.windowEventNames=null!==(s=t.names)&&void 0!==s?s:[])}))},t.prototype.dispatch=function(t){this.pushEventsToDataLayer(t),this.dispatchWindowEvents(t)},t.prototype.pushEventsToDataLayer=function(t){if(m(this.dataLayerNames)){var e=x(t);this.dataLayerNames.forEach((function(t){var n;window[t]=null!==(n=window[t])&&void 0!==n?n:[],window[t].push(e)}))}},t.prototype.dispatchWindowEvents=function(t){if(m(this.windowEventNames)){var e=x(t);this.windowEventNames.forEach((function(t){var n=new window.CustomEvent(t,{detail:e});window.dispatchEvent(n)}))}},t}(),x=function(t){var e={event:"consent_status"};return t.forEach((function(t){var n;e=u(u({},e),((n={})[t.service.name]=t.consent.status,n))})),e};!function(t){t.TEXT_JAVASCRIPT="text/javascript",t.TEXT_PLAIN="text/plain"}(D||(D={}));var V=function(){function t(){}return t.enableScriptsForServicesWithConsent=function(e){var n=t.getDisabledScripts();Array.prototype.forEach.call(n,(function(n){t.disabledScriptHasConsent(e,n)&&t.enableScript(n)}))},t.getDisabledScripts=function(){return document.querySelectorAll('script[data-usercentrics][type="'+D.TEXT_PLAIN+'"]')},t.disabledScriptHasConsent=function(t,e){return t.some((function(t){return t.name===e.getAttribute("data-usercentrics")}))},t.enableScript=function(e){var n,s,i,r=e.src?t.createSrcScriptTag(e):t.createInlineScriptTag(e);s=r,(i=(n=e).parentNode)&&i.replaceChild(s,n)},t.createSrcScriptTag=function(t){return u(u({},t),{type:D.TEXT_JAVASCRIPT})},t.createInlineScriptTag=function(t){var e=document.createElement("script"),n=document.createTextNode(t.text);return e.appendChild(n),e.type=D.TEXT_JAVASCRIPT,e},t}();"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function B(t,e){return t(e={exports:{}},e.exports),e.exports}var G,H=B((function(t,e){var n;t.exports=(n=n||function(t,e){var n=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),s={},i=s.lib={},r=i.Base={extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=r.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,n=t.words,s=this.sigBytes,i=t.sigBytes;if(this.clamp(),s%4)for(var r=0;r<i;r++){var o=n[r>>>2]>>>24-r%4*8&255;e[s+r>>>2]|=o<<24-(s+r)%4*8}else for(r=0;r<i;r+=4)e[s+r>>>2]=n[r>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=r.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,s=[],i=function(e){e=e;var n=987654321,s=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&s)<<16)+(e=18e3*(65535&e)+(e>>16)&s)&s;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}},r=0;r<e;r+=4){var a=i(4294967296*(n||t.random()));n=987654071*a(),s.push(4294967296*a()|0)}return new o.init(s,e)}}),a=s.enc={},c=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s+=2)n[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new o.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s++)n[s>>>2]|=(255&t.charCodeAt(s))<<24-s%4*8;return new o.init(n,e)}},l=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},g=i.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,s=n.words,i=n.sigBytes,r=this.blockSize,a=i/(4*r),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*r,u=t.min(4*c,i);if(c){for(var l=0;l<c;l+=r)this._doProcessBlock(s,l);var g=s.splice(0,c);n.sigBytes-=u}return new o.init(g,u)},clone:function(){var t=r.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),h=(i.Hasher=g.extend({cfg:r.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new h.HMAC.init(t,n).finalize(e)}}}),s.algo={});return s}(Math),n)})),J=B((function(t,e){var n;t.exports=(n=H,function(t){var e=n,s=e.lib,i=s.WordArray,r=s.Hasher,o=e.algo,a=[],c=[];!function(){function e(e){for(var n=t.sqrt(e),s=2;s<=n;s++)if(!(e%s))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var s=2,i=0;i<64;)e(s)&&(i<8&&(a[i]=n(t.pow(s,.5))),c[i]=n(t.pow(s,1/3)),i++),s++}();var u=[],l=o.SHA256=r.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],g=n[6],h=n[7],p=0;p<64;p++){if(p<16)u[p]=0|t[e+p];else{var d=u[p-15],f=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,v=u[p-2],I=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[p]=f+u[p-7]+I+u[p-16]}var S=s&i^s&r^i&r,y=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),E=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&g)+c[p]+u[p];h=g,g=l,l=a,a=o+E|0,o=r,r=i,i=s,s=E+(y+S)|0}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+o|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+g|0,n[7]=n[7]+h|0},_doFinalize:function(){var e=this._data,n=e.words,s=8*this._nDataBytes,i=8*e.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=t.floor(s/4294967296),n[15+(i+64>>>9<<4)]=s,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=r._createHelper(l),e.HmacSHA256=r._createHmacHelper(l)}(Math),n.SHA256)})),W=function(t,e){return{id:t.templateId,version:t.version,language:e.language}},M=function(){return""+J(o.v4())},Y=function(t,e,n){var s={categorySlug:"none",description:"",isEssential:!1,isHidden:!0,label:""};return Array.prototype.concat(t.categories.map((function(s){return{description:s.description,isEssential:s.isEssential,isHidden:s.isHidden,label:s.label,services:j(t,e,s,n),slug:s.categorySlug}})),[u(u({},s),{services:j(t,e,s,n),slug:"none"})])},j=function(t,e,n,s){return t.consentTemplates.reduce((function(i,r){return r.categorySlug===n.categorySlug&&i.push(k(r,e,t,n,s)),i}),[])},k=function(t,e,n,s,i){var r=M(),o=q(t,s);return u(u({},$(t,e)),{categorySlug:t.categorySlug,consent:{consentId:z(n.settingsId,i,r),history:[],status:o},isEssential:s.isEssential,isHidden:X(t,s),processorId:r,subServices:K(t.subConsents,e)})},q=function(t,e){return!!e.isEssential||t.defaultConsentStatus},X=function(t,e){return!!e.isHidden||t.isHidden},z=function(t,e,n){return""+J(t+"_"+JSON.stringify([e])+"_"+JSON.stringify([n]))},K=function(t,e){return t.reduce((function(t,n){return t.push($(n,e)),t}),[])},$=function(t,e){var n=Q(t,e);return{dataCollected:Z(n,S.DATA_COLLECTED_LIST),dataDistribution:{processingLocation:n.locationOfProcessing,thirdPartyCountries:n.thirdCountryTransfer},dataPurposes:tt(n),dataRecipients:Z(n,S.DATA_RECIPIENTS_LIST),description:et(t,n),id:t.templateId,language:{available:n.languagesAvailable,selected:n.language},legalBasis:nt(n),name:st(n),processingCompany:{address:n.addressOfProcessingCompany,dataProtectionOfficer:n.dataProtectionOfficer,name:it(n)},retentionPeriodDescription:rt(n),technologiesUsed:Z(n,S.TECHNOLOGY_USED),urls:{cookiePolicy:n.cookiePolicyURL,dataProcessingAgreement:n.linkToDpa,optOut:n.optOutUrl,privacyPolicy:ot(n)},version:t.version}},Q=function(t,e){return e.find((function(e){return t.templateId===e.templateId&&t.version===e.version}))},Z=function(t,e){var n;return m(t[e])?t[e]:(null===(n=t[e])||void 0===n?void 0:n.length)>0?[t[e]]:[]},tt=function(t){var e=Z(t,S.DATA_PURPOSES_LIST);return m(e)?e:t.dataPurposes},et=function(t,e){return t.description||e.descriptionOfService||e.description},nt=function(t){return m(t.legalBasisList)?t.legalBasisList:[t.legalGround]},st=function(t){return t.dataProcessor||t.dataProcessors[0]},it=function(t){return t.nameOfProcessingCompany||t.processingCompany},rt=function(t){return t.retentionPeriodDescription||t.retentionPeriodList[0]},ot=function(t){return t.privacyPolicyURL||t.policyOfProcessorUrl},at=function(t){return t.reduce((function(t,e){return e.type===I.DATA_LAYER?t.push({names:e.names,type:d.DATA_LAYER}):e.type===I.WINDOW_EVENT&&t.push({names:e.names,type:d.WINDOW_EVENT}),t}),[])},ct=function(t){return t.map((function(t){switch(t){case y.MAJOR:return f.MAJOR;case y.MINOR:return f.MINOR;case y.PATCH:return f.PATCH}}))},ut=function(t){var e=t.consentTemplates.find((function(t){return"HJI5SmLm7"===t.templateId})),n=t.backgroundOverlay.find((function(t){return t.target[0]===v.FIRST_LAYER})),s=t.backgroundOverlay.find((function(t){return t.target[0]===v.SECOND_LAYER}));return{buttons:{acceptAll:{label:t.labels.btnAccept},denyAll:{isEnabled:t.btnDenyIsVisible,label:t.labels.btnDeny},save:{label:t.labels.btnSave},showSecondLayer:{isEnabled:t.btnMoreInfoIsVisible,label:t.labels.btnMoreInfo,url:t.moreInfoButtonUrl||null}},firstLayer:{description:{default:e.description,short:t.bannerMobileDescriptionIsActive?t.bannerMobileDescription:null},isOverlayEnabled:n.darken>0,title:t.labels.titleCenterSecondary},labels:{general:{consentGiven:"Consent given",consentId:"Consent ID",consentNotGiven:"Consent not given",consentType:"Consent type",controllerId:"Controller ID",copy:t.labels.copy,date:t.labels.date,decision:"Decision",explicit:"Explicit",implicit:"Implicit",processorId:"Processor ID",showMore:"Show more"},service:{dataCollected:{description:t.labels.dataCollectedInfo,title:t.labels.dataCollectedList},dataDistribution:{processingLocationTitle:t.labels.locationOfProcessing,thirdPartyCountriesTitle:t.labels.transferToThirdCountries},dataPurposes:{description:t.labels.dataPurposesInfo,title:t.labels.dataPurposes},dataRecipientsTitle:t.labels.dataRecipientsList,descriptionTitle:t.labels.descriptionOfService,history:{description:null,title:t.labels.history},legalBasis:{description:t.labels.legalBasisInfo,title:t.labels.legalBasisList},processingCompanyTitle:t.labels.processingCompanyTitle,retentionPeriodTitle:t.labels.retentionPeriod,technologiesUsed:{description:t.labels.technologiesUsedInfo,title:t.labels.technologiesUsed},urls:{cookiePolicyTitle:t.labels.cookiePolicyInfo,dataProcessingAgreementTitle:t.labels.linkToDpaInfo,optOutTitle:t.labels.furtherInformationOptOut,privacyPolicyTitle:t.labels.policyOf}}},language:{available:t.languagesAvailable,isSelectorEnabled:t.showLanguageDropdown,selected:t.language},links:{cookiePolicy:{label:"",url:null},imprint:{label:t.labels.imprintLinkText,url:t.imprintUrl||null},privacyPolicy:{label:t.labels.privacyPolicyLinkText,url:t.privacyPolicyUrl||null}},poweredBy:{isEnabled:t.enablePoweredBy,label:"Powered by",partnerUrl:t.partnerPoweredByUrl||null,partnerUrlLabel:t.labels.partnerPoweredByLinkText||null,url:"https://www.usercentrics.com/",urlLabel:"Usercentrics Consent Management"},privacyButton:{isEnabled:t.privacyButtonIsVisible},secondLayer:{description:t.labels.headerCenterSecondary,isOverlayEnabled:s.darken>0,tabs:{categories:{isEnabled:!0,label:t.labels.categories},services:{isEnabled:!0,label:"Services"}},title:t.labels.titleCenterSecondary}}},lt=["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK"],gt=function(){function t(){this.apiInstance=O.getInstance(),this.userCountry={}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.resetInstance=function(){t.instance.userCountry={}},t.prototype.getUserCountry=function(){return l(this,void 0,void 0,(function(){var t;return g(this,(function(e){switch(e.label){case 0:return L(this.userCountry)?[3,2]:[4,this.apiInstance.fetchUserCountry()];case 1:t=e.sent(),this.userCountry=ht(t),e.label=2;case 2:return[2,this.userCountry]}}))}))},t.prototype.getIsUserInEU=function(){return l(this,void 0,void 0,(function(){var t;return g(this,(function(e){switch(e.label){case 0:return[4,this.getUserCountry()];case 1:return t=e.sent(),[2,_(lt,t.code.toUpperCase())]}}))}))},t}(),ht=function(t){return{code:t.countryCode,name:t.countryName}},pt=function(){function t(){this.apiInstance=O.getInstance(),this.locationInstance=gt.getInstance(),this.settings={}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.resetInstance=function(){t.instance.settings={}},t.prototype.getBaseSettings=function(){return{controllerId:this.settings.controllerId,id:this.settings.id,ui:this.settings.ui,version:this.settings.version}},t.prototype.getCategories=function(){return this.settings.categories},t.prototype.getCategoryBySlug=function(t){return this.getCategories().find((function(e){return e.slug===t}))},t.prototype.getDataExchangeSettings=function(){return this.settings.dataExchangeSettings},t.prototype.getEssentialCategories=function(){return this.getCategories().reduce((function(t,e){return e.isEssential&&t.push(e),t}),[])},t.prototype.getNonEssentialCategories=function(){return this.getCategories().reduce((function(t,e){return e.isEssential||t.push(e),t}),[])},t.prototype.getServices=function(){return this.getServicesFromCategories(this.getCategories())},t.prototype.getServicesByIds=function(t){return this.getServicesFromCategories(this.removeNoneCategory(this.getCategories())).reduce((function(e,n){return t.some((function(t){return t===n.id}))&&e.push(n),e}),[])},t.prototype.getServicesFromCategories=function(t){return t.reduce((function(t,e){return t.concat(e.services)}),[])},t.prototype.getServicesWithConsent=function(){return this.getServices().reduce((function(t,e){return e.consent.status&&t.push(e),t}),[])},t.prototype.getSettings=function(){return this.settings},t.prototype.setCategories=function(t){this.settings.categories=t},t.prototype.setSettings=function(t){this.settings=t},t.prototype.initSettings=function(){return l(this,void 0,void 0,(function(){var t,e;return g(this,(function(n){switch(n.label){case 0:return[4,this.apiInstance.fetchSettingsJson()];case 1:return t=n.sent(),t=u(u({},s=t),{consentTemplates:s.consentTemplates.reduce((function(t,e){return e.isDeactivated||t.push(e),t}),[])}),[4,this.fetchServices(t)];case 2:return e=n.sent(),this.setSettings(function(t,e){var n=M();return{acceptAllImplicitlyOutsideEU:t.displayOnlyForEU,categories:Y(t,e,n),controllerId:n,dataExchangeSettings:at(t.dataExchangeOnPage),id:t.settingsId,showFirstLayerOnVersionChange:ct(t.showInitialViewForVersionChange),ui:ut(t),version:t.version}}(t,e)),[2]}var s}))}))},t.prototype.removeNoneCategory=function(t){return t.reduce((function(t,e){return"none"!==e.slug&&t.push(e),t}),[])},t.prototype.shouldAcceptAllImplicitlyOnInit=function(){return l(this,void 0,void 0,(function(){return g(this,(function(t){return this.settings.acceptAllImplicitlyOutsideEU?[2,!this.locationInstance.getIsUserInEU()]:[2,!1]}))}))},t.prototype.shouldShowFirstLayerOnVersionChange=function(t){if(m(this.settings.showFirstLayerOnVersionChange)){var e=this.settings.version.split("."),n=t.split(".");return _(this.settings.showFirstLayerOnVersionChange,f.MAJOR)&&e[0]!==n[0]||_(this.settings.showFirstLayerOnVersionChange,f.MINOR)&&e[1]!==n[1]||_(this.settings.showFirstLayerOnVersionChange,f.PATCH)&&e[2]!==n[2]}return!1},t.prototype.updateServicesWithConsent=function(t,e){return t.map((function(t){return t.isEssential?t:u(u({},t),{consent:u(u({},t.consent),{status:1===e})})}))},t.prototype.updateServicesWithConsents=function(t,e){return t.reduce((function(t,n){var s;if(!n.isEssential){var i=e.find((function(t){return t.serviceId===n.id}));s=u(u({},n),{consent:u(u({},n.consent),{status:i.status})})}return t.push(null!=s?s:n),t}),[])},t.prototype.fetchServices=function(t){return l(this,void 0,void 0,(function(){var e,n,s;return g(this,(function(i){switch(i.label){case 0:o=[],(r=t).consentTemplates.forEach((function(t){o.push(W(t,r)),t.subConsents.forEach((function(t){o.push(W(t,r))}))})),e=a(c(o,(function(t,e){return t.id===e.id&&t.version===e.version})),"id"),n=function(t){return""+J(JSON.stringify(t))}(e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.apiInstance.fetchServicesJson(n)];case 2:return[2,i.sent()];case 3:return i.sent(),[3,4];case 4:return[4,this.apiInstance.generateServicesJson(e)];case 5:return s=i.sent(),[2,this.apiInstance.fetchServicesJson(s)]}var r,o}))}))},t}();!function(t){t.SETTINGS="uc_settings",t.USER_INTERACTION="uc_user_interaction"}(G||(G={}));var dt,ft=function(){function t(){}return t.clearOnNewSettingsId=function(e){e!==t.fetchSettingsId()&&t.clear()},t.fetchLanguage=function(){return t.fetchSettings().language},t.fetchSettings=function(){var t=localStorage.getItem(G.SETTINGS);return JSON.parse(null!=t?t:"{}")},t.fetchSettingsId=function(){return t.fetchSettings().id},t.fetchSettingsVersion=function(){return t.fetchSettings().version},t.fetchUserActionPerformed=function(){return null!==localStorage.getItem(G.USER_INTERACTION)},t.saveSettings=function(t){localStorage.setItem(G.SETTINGS,JSON.stringify(t))},t.settingsExist=function(){return L(t.fetchSettings())},t.setUserActionPerformed=function(){localStorage.setItem(G.USER_INTERACTION,JSON.stringify(!0))},t.clear=function(){localStorage.removeItem(G.SETTINGS),localStorage.removeItem(G.USER_INTERACTION)},t}(),vt=function(){function t(){this.apiInstance=O.getInstance(),this.eventDispatcherInstance=F.getInstance(),this.settingsInstance=pt.getInstance()}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.getStorageMappedSettings=function(){return yt(this.settingsInstance.getSettings(),this.settingsInstance.getServices())},t.prototype.execute=function(t,e,n){return l(this,void 0,void 0,(function(){var s,i;return g(this,(function(r){switch(r.label){case 0:return s=this.mapDataTransferObjects(t,e,n),i=It(t,s),[4,this.apiInstance.saveConsents(s)];case 1:return r.sent(),this.settingsInstance.setCategories(this.mergeServicesIntoExistingCategories(i)),ft.saveSettings(this.getStorageMappedSettings()),V.enableScriptsForServicesWithConsent(this.settingsInstance.getServicesWithConsent()),this.eventDispatcherInstance.dispatch(s),[2]}}))}))},t.prototype.mergeSettingsFromStorage=function(){return l(this,void 0,void 0,(function(){var t,e,n,s,i,r,o,a,c,l,h,p,d;return g(this,(function(g){switch(g.label){case 0:return t=this.settingsInstance.getEssentialCategories(),e=this.settingsInstance.getServicesFromCategories(t),n=this.settingsInstance.getNonEssentialCategories(),s=this.settingsInstance.getServicesFromCategories(n),i=ft.fetchSettings(),r=[],o=e.map((function(t){var e=i.services.find((function(e){return e.id===t.id}));if(e){if(e.status)return u(u({},t),{consent:u(u({},t.consent),{consentId:e.consentId,history:e.history,status:e.status}),processorId:e.processorId});var n=u(u({},t),{consent:u(u({},t.consent),{consentId:e.consentId,history:e.history,status:!0}),processorId:e.processorId});return r.push(n),n}return t})),a=s.map((function(t){var e=i.services.find((function(e){return e.id===t.id}));return e?u(u({},t),{consent:u(u({},t.consent),{history:e.history,status:e.status}),processorId:e.processorId}):t})),c=o.concat(a),l=u(u({},this.settingsInstance.getSettings()),{controllerId:i.controllerId}),m(r)?(h=this.mapDataTransferObjects(r,exports.CONSENT_TYPE.IMPLICIT,exports.CONSENT_ACTION.ESSENTIAL_CHANGE,l),p=It(c,h),[4,this.apiInstance.saveConsents(h)]):[3,2];case 1:return g.sent(),this.settingsInstance.setSettings(u(u({},l),{categories:this.mergeServicesIntoExistingCategories(p)})),[3,3];case 2:this.settingsInstance.setSettings(u(u({},l),{categories:this.mergeServicesIntoExistingCategories(c)})),g.label=3;case 3:return d=this.mapDataTransferObjects(c,exports.CONSENT_TYPE.IMPLICIT,exports.CONSENT_ACTION.INITIAL_PAGE_LOAD),ft.saveSettings(this.getStorageMappedSettings()),V.enableScriptsForServicesWithConsent(this.settingsInstance.getServicesWithConsent()),this.eventDispatcherInstance.dispatch(d),[2]}}))}))},t.prototype.mapDataTransferObjects=function(t,e,n,s){var i=this;return t.map((function(t){var r,o,a,c;return{consent:{action:n,status:t.consent.status,type:e},service:{id:t.id,name:t.name,processorId:t.processorId,version:t.version},settings:{controllerId:null!==(r=null==s?void 0:s.controllerId)&&void 0!==r?r:i.settingsInstance.getSettings().controllerId,id:null!==(o=null==s?void 0:s.id)&&void 0!==o?o:i.settingsInstance.getSettings().id,language:null!==(a=null==s?void 0:s.ui.language.selected)&&void 0!==a?a:i.settingsInstance.getSettings().ui.language.selected,version:null!==(c=null==s?void 0:s.version)&&void 0!==c?c:i.settingsInstance.getSettings().version}}}))},t.prototype.mergeServicesIntoExistingCategories=function(t){return this.settingsInstance.getCategories().map((function(e){var n=e.services.map((function(e){var n=t.find((function(t){return t.id===e.id}));return null!=n?n:e}));return u(u({},e),{services:n})}))},t}(),It=function(t,e){var n=(new Date).valueOf();return t.map((function(t){var s=e.find((function(e){return e.service.id===t.id}));return s?u(u({},t),{consent:u(u({},t.consent),{history:h(t.consent.history,[St(t,s,"SDK-0.3.4",n)])})}):t}))},St=function(t,e,n,s){return{action:e.consent.action,language:e.settings.language,status:e.consent.status,timestamp:s,type:e.consent.type,versions:{application:n,service:t.version,settings:e.settings.version}}},yt=function(t,e){return{controllerId:t.controllerId,id:t.id,language:t.ui.language.selected,services:Et(e),version:t.version}},Et=function(t){return t.map((function(t){return{consentId:t.consent.consentId,history:t.consent.history,id:t.id,processorId:t.processorId,status:t.consent.status}}))};!function(t){t.DEFAULT_BROWSER_LANGUAGE="Usercentrics: The language has been defaulted to the browser language.",t.DEFAULT_FIRST_AVAILABLE_LANGUAGE="Usercentrics: The language has been defaulted to the first available language."}(dt||(dt={}));var Ct,Tt=function(){function t(){this.apiInstance=O.getInstance()}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.resolveLanguage=function(){return l(this,void 0,void 0,(function(){var t,e,n;return g(this,(function(s){switch(s.label){case 0:return[4,this.apiInstance.fetchAvailableLanguages()];case 1:return t=s.sent(),e=ft.fetchLanguage(),_(t,e)&&this.apiInstance.setJsonFileLanguage(e),_(t,this.apiInstance.getJsonFileLanguage())?[2]:((n=At(t))?(console.warn(dt.DEFAULT_BROWSER_LANGUAGE),this.apiInstance.setJsonFileLanguage(n)):(console.warn(dt.DEFAULT_FIRST_AVAILABLE_LANGUAGE),this.apiInstance.setJsonFileLanguage(t[0])),[2])}}))}))},t}(),At=function(t){var e,n=window.navigator;if(m(n.languages))for(var s=0;s<n.languages.length;s+=1){var i=n.languages[s].slice(0,2);if(_(t,i))return i}var r=(null!==(e=n.language)&&void 0!==e?e:n.userLanguage).slice(0,2);return _(t,r)?r:null};(Ct=exports.INITIAL_VIEW||(exports.INITIAL_VIEW={}))[Ct.FIRST_LAYER=0]="FIRST_LAYER",Ct[Ct.NONE=1]="NONE",Ct[Ct.PRIVACY_BUTTON=2]="PRIVACY_BUTTON";var Nt=function(){function t(t,e){this.apiInstance=O.getInstance(),this.dataFacadeInstance=vt.getInstance(),this.eventDispatcherInstance=F.getInstance(),this.languageInstance=Tt.getInstance(),this.locationInstance=gt.getInstance(),this.settingsInstance=pt.getInstance(),this.apiInstance.setSettingsId(t),(null==e?void 0:e.language)&&this.apiInstance.setJsonFileLanguage(e.language),(null==e?void 0:e.version)&&this.apiInstance.setJsonFileVersion(e.version)}return t.prototype.init=function(){return l(this,void 0,void 0,(function(){var t,e;return g(this,(function(n){switch(n.label){case 0:return ft.clearOnNewSettingsId(this.apiInstance.getSettingsId()),[4,this.languageInstance.resolveLanguage()];case 1:return n.sent(),[4,this.settingsInstance.initSettings()];case 2:return n.sent(),this.eventDispatcherInstance.init(this.settingsInstance.getDataExchangeSettings()),t=!ft.settingsExist(),[4,this.settingsInstance.shouldAcceptAllImplicitlyOnInit()];case 3:return e=n.sent(),t?e?[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(this.settingsInstance.getServices(),1),exports.CONSENT_TYPE.IMPLICIT,exports.CONSENT_ACTION.NON_EU_REGION)]:[3,5]:[3,8];case 4:return n.sent(),[3,7];case 5:return[4,this.dataFacadeInstance.execute(this.settingsInstance.getServices(),exports.CONSENT_TYPE.IMPLICIT,exports.CONSENT_ACTION.INITIAL_PAGE_LOAD)];case 6:n.sent(),n.label=7;case 7:return[3,10];case 8:return[4,this.dataFacadeInstance.mergeSettingsFromStorage()];case 9:n.sent(),n.label=10;case 10:return[2,this.resolveInitialView(e,t)]}}))}))},t.prototype.acceptAllServices=function(t){return void 0===t&&(t=exports.CONSENT_TYPE.EXPLICIT),l(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(this.settingsInstance.getServices(),1),t,exports.CONSENT_ACTION.ACCEPT_ALL_SERVICES)];case 1:return e.sent(),ft.setUserActionPerformed(),[2]}}))}))},t.prototype.acceptAllServicesInCategory=function(t,e){return void 0===e&&(e=exports.CONSENT_TYPE.EXPLICIT),l(this,void 0,void 0,(function(){var n;return g(this,(function(s){switch(s.label){case 0:return(n=this.settingsInstance.getCategoryBySlug(t))?[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(n.services,1),e,exports.CONSENT_ACTION.UPDATE_SERVICES)]:[3,2];case 1:s.sent(),ft.setUserActionPerformed(),s.label=2;case 2:return[2]}}))}))},t.prototype.changeLanguage=function(t){return l(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return this.shouldChangeLanguage(t)?(this.apiInstance.setJsonFileLanguage(t),[4,this.settingsInstance.initSettings()]):[3,2];case 1:e.sent(),ft.saveSettings(this.dataFacadeInstance.getStorageMappedSettings()),e.label=2;case 2:return[2]}}))}))},t.prototype.denyAllServices=function(t){return void 0===t&&(t=exports.CONSENT_TYPE.EXPLICIT),l(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(this.settingsInstance.getServices(),0),t,exports.CONSENT_ACTION.DENY_ALL_SERVICES)];case 1:return e.sent(),ft.setUserActionPerformed(),[2]}}))}))},t.prototype.denyAllServicesInCategory=function(t,e){return void 0===e&&(e=exports.CONSENT_TYPE.EXPLICIT),l(this,void 0,void 0,(function(){var n;return g(this,(function(s){switch(s.label){case 0:return(n=this.settingsInstance.getCategoryBySlug(t))?[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(n.services,0),e,exports.CONSENT_ACTION.UPDATE_SERVICES)]:[3,2];case 1:s.sent(),ft.setUserActionPerformed(),s.label=2;case 2:return[2]}}))}))},t.prototype.fetchIsUserInEU=function(){return l(this,void 0,void 0,(function(){return g(this,(function(t){return[2,this.locationInstance.getIsUserInEU()]}))}))},t.prototype.fetchUserCountry=function(){return l(this,void 0,void 0,(function(){return g(this,(function(t){return[2,this.locationInstance.getUserCountry()]}))}))},t.prototype.getCategories=function(){return this.settingsInstance.removeNoneCategory(this.settingsInstance.getCategories())},t.prototype.getEssentialCategories=function(){return this.settingsInstance.removeNoneCategory(this.settingsInstance.getEssentialCategories())},t.prototype.getEssentialServices=function(){return this.settingsInstance.getServicesFromCategories(this.getEssentialCategories())},t.prototype.getNonEssentialCategories=function(){return this.settingsInstance.removeNoneCategory(this.settingsInstance.getNonEssentialCategories())},t.prototype.getNonEssentialServices=function(){return this.settingsInstance.getServicesFromCategories(this.getNonEssentialCategories())},t.prototype.getServices=function(){return this.settingsInstance.getServicesFromCategories(this.getCategories())},t.prototype.getSettings=function(){return this.settingsInstance.getBaseSettings()},t.prototype.updateServices=function(t,e){return void 0===e&&(e=exports.CONSENT_TYPE.EXPLICIT),l(this,void 0,void 0,(function(){var n,s;return g(this,(function(i){switch(i.label){case 0:return n=this.settingsInstance.getServicesByIds(t.map((function(t){return t.serviceId}))),s=this.settingsInstance.updateServicesWithConsents(n,t),m(s)?[4,this.dataFacadeInstance.execute(s,e,exports.CONSENT_ACTION.UPDATE_SERVICES)]:[3,2];case 1:i.sent(),ft.setUserActionPerformed(),i.label=2;case 2:return[2]}}))}))},t.prototype.resolveInitialView=function(t,e){return t?1:e||!ft.fetchUserActionPerformed()||this.settingsInstance.shouldShowFirstLayerOnVersionChange(ft.fetchSettingsVersion())?0:this.settingsInstance.getBaseSettings().ui.privacyButton.isEnabled?2:1},t.prototype.shouldChangeLanguage=function(t){return t!==this.apiInstance.getJsonFileLanguage()&&this.settingsInstance.getBaseSettings().ui.language.available.some((function(e){return t===e}))},t}();exports.default=Nt; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,n,r,i,s=require("uuid"),o=t(require("lodash/sortBy")),a=t(require("lodash/uniqWith")),c=function(){return(c=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function u(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))}function l(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function f(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)r[i]=s[o];return r}(e=exports.CONSENT_ACTION||(exports.CONSENT_ACTION={})).ACCEPT_ALL_SERVICES="onAcceptAllServices",e.DENY_ALL_SERVICES="onDenyAllServices",e.ESSENTIAL_CHANGE="onEssentialChange",e.INITIAL_PAGE_LOAD="onInitialPageLoad",e.NON_EU_REGION="onNonEURegion",e.UPDATE_SERVICES="onUpdateServices",(n=exports.CONSENT_TYPE||(exports.CONSENT_TYPE={})).EXPLICIT="explicit",n.IMPLICIT="implicit",function(t){t.AVAILABLE_LANGUAGES_NOT_FOUND="Unable to find available languages using given settingsId and version.",t.FETCH_AVAILABLE_LANGUAGES="Something went wrong while fetching the available languages.",t.FETCH_DATA_PROCESSING_SERVICES="Something went wrong while fetching the data processing services.",t.FETCH_SETTINGS="Something went wrong while fetching the settings.",t.FETCH_USER_COUNTRY="Something went wrong while fetching the user's country.",t.GENERATE_DATA_PROCESSING_SERVICES="Something went wrong while generating the data processing services.",t.SAVE_CONSENTS="Something went wrong while saving user consents.",t.SETTINGS_NOT_FOUND="Unable to find settings using given settingsId and version."}(r||(r={})),function(t){t.AGGREGATOR="https://consent-templates-batch-generation.usercentrics.eu",t.CDN="https://api.usercentrics.eu",t.GRAPHQL="https://graphql.usercentrics.eu/graphql"}(i||(i={}));"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function h(t,e){return t(e={exports:{}},e.exports),e.exports}h((function(t){var e=function(t){var e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function a(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,s=Object.create(i.prototype),o=new m(r||[]);return s._invoke=function(t,e,n){var r="suspendedStart";return function(i,s){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw s;return C()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=S(o,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(t,e,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(t,n,o),s}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var u={};function l(){}function f(){}function h(){}var p={};p[i]=function(){return this};var g=Object.getPrototypeOf,d=g&&g(g(w([])));d&&d!==e&&n.call(d,i)&&(p=d);var v=h.prototype=l.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function I(t){var e;this._invoke=function(r,i){function s(){return new Promise((function(e,s){!function e(r,i,s,o){var a=c(t[r],t,i);if("throw"!==a.type){var u=a.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(t){e("next",t,s,o)}),(function(t){e("throw",t,s,o)})):Promise.resolve(l).then((function(t){u.value=t,s(u)}),(function(t){return e("throw",t,s,o)}))}o(a.arg)}(r,i,e,s)}))}return e=e?e.then(s,s):s()}}function S(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,u;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function m(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function w(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,s=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return s.next=s}}return{next:C}}function C(){return{value:void 0,done:!0}}return f.prototype=v.constructor=h,h.constructor=f,h[o]=f.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,o in t||(t[o]="GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},y(I.prototype),I.prototype[s]=function(){return this},t.AsyncIterator=I,t.async=function(e,n,r,i){var s=new I(a(e,n,r,i));return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},y(v),v[o]="Generator",v[i]=function(){return this},v.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=w,m.prototype={constructor:m,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=n.call(s,"catchLoc"),c=n.call(s,"finallyLoc");if(a&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,u):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),u},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:w(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));var p={limit:3,statusCodes:[408,413,429,500,502,503,504]};function g(t){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e,n,r,i,s,o){try{var a=t[s](o),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function v(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var s=t.apply(e,n);function o(t){d(s,r,i,o,a,"next",t)}function a(t){d(s,r,i,o,a,"throw",t)}o(void 0)}))}}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function I(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function S(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function b(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function E(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?b(Object(n),!0).forEach((function(e){S(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function m(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&C(t,e)}function w(t){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function C(t,e){return(C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function T(t,e,n){return(T=_()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&C(i,n.prototype),i}).apply(null,arguments)}function A(t){var e="function"==typeof Map?new Map:void 0;return(A=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return T(t,arguments,w(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),C(r,t)})(t)}function N(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,s=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")} | ||
/*! MIT License © Sindre Sorhus */()}function L(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}for(var x={},R=function(){var t=U[P];Object.defineProperty(x,t,{get:function(){var e=function(t){return"undefined"!=typeof self&&self&&t in self?self:"undefined"!=typeof window&&window&&t in window?window:"undefined"!=typeof global&&global&&t in global?global:"undefined"!=typeof globalThis&&globalThis?globalThis:void 0}(t),n=e&&e[t];return"function"==typeof n?n.bind(e):n}})},P=0,U=["Headers","Request","Response","ReadableStream","fetch","AbortController","FormData"];P<U.length;P++)R();var D,F,j,k,B,V,G,H=function(t){return null!==t&&"object"===g(t)},q="function"==typeof x.AbortController,J="function"==typeof x.ReadableStream,M="function"==typeof x.FormData,W=function t(){for(var e={},n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var s=0,o=r;s<o.length;s++){var a=o[s];if(Array.isArray(a))Array.isArray(e)||(e=[]),e=[].concat(L(e),L(a));else if(H(a))for(var c=0,u=Object.entries(a);c<u.length;c++){var l=O(u[c],2),f=l[0],h=l[1];H(h)&&Reflect.has(e,f)&&(h=t(e[f],h)),e=E({},e,S({},f,h))}}return e},Y=["get","post","put","patch","head","delete"],X={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},z=[413,429,503],K=Symbol("stop"),$=function(t){function e(t){var n;return y(this,e),(n=N(this,w(e).call(this,t.statusText))).name="HTTPError",n.response=t,n}return m(e,A(Error)),e}(),Q=function(t){function e(){var t;return y(this,e),(t=N(this,w(e).call(this,"Request timed out"))).name="TimeoutError",t}return m(e,A(Error)),e}(),Z=function(t){return new Promise((function(e){return setTimeout(e,t)}))},tt=function(t,e,n){return new Promise((function(r,i){var s=setTimeout((function(){n&&n.abort(),i(new Q)}),e);t.then(r).catch(i).then((function(){clearTimeout(s)}))}))},et=function(t){return Y.includes(t)?t.toUpperCase():t},nt={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:z},rt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("number"==typeof t)return E({},nt,{limit:t});if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");return E({},nt,{},t,{afterStatusCodes:z})},it=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(y(this,t),this._retryCount=0,this._input=e,this._options=E({credentials:this._input.credentials||"same-origin"},r,{hooks:W({beforeRequest:[],beforeRetry:[],afterResponse:[]},r.hooks),method:et(r.method||this._input.method),prefixUrl:String(r.prefixUrl||""),retry:rt(r.retry),throwHttpErrors:!1!==r.throwHttpErrors,timeout:void 0===r.timeout?1e4:r.timeout}),"string"!=typeof this._input&&!(this._input instanceof URL||this._input instanceof x.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&"string"==typeof this._input){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(q&&(this.abortController=new x.AbortController,this._options.signal&&this._options.signal.addEventListener("abort",(function(){n.abortController.abort()})),this._options.signal=this.abortController.signal),this.request=new x.Request(this._input,this._options),this._options.searchParams){var i=new URL(this.request.url);i.search=new URLSearchParams(this._options.searchParams),!(M&&this._options.body instanceof x.FormData||this._options.body instanceof URLSearchParams)||this._options.headers&&this._options.headers["content-type"]||this.request.headers.delete("content-type"),this.request=new x.Request(new x.Request(i,this.request),this._options)}void 0!==this._options.json&&(this._options.body=JSON.stringify(this._options.json),this.request.headers.set("content-type","application/json"),this.request=new x.Request(this.request,{body:this._options.body}));for(var s=function(){var t=v(regeneratorRuntime.mark((function t(){var e,r,i,s,o,a,c,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n._options.timeout>2147483647)){t.next=2;break}throw new RangeError("The `timeout` option cannot be greater than ".concat(2147483647));case 2:return t.next=4,Z(1);case 4:return t.next=6,n._fetch();case 6:e=t.sent,r=!0,i=!1,s=void 0,t.prev=10,o=n._options.hooks.afterResponse[Symbol.iterator]();case 12:if(r=(a=o.next()).done){t.next=21;break}return c=a.value,t.next=16,c(n.request,n._options,e.clone());case 16:(u=t.sent)instanceof x.Response&&(e=u);case 18:r=!0,t.next=12;break;case 21:t.next=27;break;case 23:t.prev=23,t.t0=t.catch(10),i=!0,s=t.t0;case 27:t.prev=27,t.prev=28,r||null==o.return||o.return();case 30:if(t.prev=30,!i){t.next=33;break}throw s;case 33:return t.finish(30);case 34:return t.finish(27);case 35:if(e.ok||!n._options.throwHttpErrors){t.next=37;break}throw new $(e);case 37:if(!n._options.onDownloadProgress){t.next=43;break}if("function"==typeof n._options.onDownloadProgress){t.next=40;break}throw new TypeError("The `onDownloadProgress` option must be a function");case 40:if(J){t.next=42;break}throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");case 42:return t.abrupt("return",n._stream(e.clone(),n._options.onDownloadProgress));case 43:return t.abrupt("return",e);case 44:case"end":return t.stop()}}),t,null,[[10,23,27,35],[28,,30,34]])})));return function(){return t.apply(this,arguments)}}(),o=this._options.retry.methods.includes(this.request.method.toLowerCase()),a=o?this._retry(s):s(),c=function(){var t=O(l[u],2),e=t[0],r=t[1];a[e]=v(regeneratorRuntime.mark((function t(){var i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.request.headers.set("accept",n.request.headers.get("accept")||r),t.next=3,a;case 3:return i=t.sent.clone(),t.abrupt("return","json"===e&&204===i.status?"":i[e]());case 5:case"end":return t.stop()}}),t)})))},u=0,l=Object.entries(X);u<l.length;u++)c();return a}var e,n,r,i,s;return e=t,(n=[{key:"_calculateRetryDelay",value:function(t){if(this._retryCount++,this._retryCount<this._options.retry.limit&&!(t instanceof Q)){if(t instanceof $){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;var e=t.response.headers.get("Retry-After");if(e&&this._options.retry.afterStatusCodes.includes(t.response.status)){var n=Number(e);return Number.isNaN(n)?n=Date.parse(e)-Date.now():n*=1e3,void 0!==this._options.retry.maxRetryAfter&&n>this._options.retry.maxRetryAfter?0:n}if(413===t.response.status)return 0}return.3*Math.pow(2,this._retryCount-1)*1e3}return 0}},{key:"_retry",value:(s=v(regeneratorRuntime.mark((function t(e){var n,r,i,s,o,a,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e();case 3:return t.abrupt("return",t.sent);case 6:if(t.prev=6,t.t0=t.catch(0),!(0!==(n=Math.min(this._calculateRetryDelay(t.t0),2147483647))&&this._retryCount>0)){t.next=42;break}return t.next=12,Z(n);case 12:r=!0,i=!1,s=void 0,t.prev=15,o=this._options.hooks.beforeRetry[Symbol.iterator]();case 17:if(r=(a=o.next()).done){t.next=27;break}return c=a.value,t.next=21,c({request:this.request,options:this._options,error:t.t0,response:t.t0.response.clone(),retryCount:this._retryCount});case 21:if(t.sent!==K){t.next=24;break}return t.abrupt("return");case 24:r=!0,t.next=17;break;case 27:t.next=33;break;case 29:t.prev=29,t.t1=t.catch(15),i=!0,s=t.t1;case 33:t.prev=33,t.prev=34,r||null==o.return||o.return();case 36:if(t.prev=36,!i){t.next=39;break}throw s;case 39:return t.finish(36);case 40:return t.finish(33);case 41:return t.abrupt("return",this._retry(e));case 42:if(!this._options.throwHttpErrors){t.next=44;break}throw t.t0;case 44:case"end":return t.stop()}}),t,this,[[0,6],[15,29,33,41],[34,,36,40]])}))),function(t){return s.apply(this,arguments)})},{key:"_fetch",value:(i=v(regeneratorRuntime.mark((function t(){var e,n,r,i,s,o,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,r=void 0,t.prev=3,i=this._options.hooks.beforeRequest[Symbol.iterator]();case 5:if(e=(s=i.next()).done){t.next=18;break}return o=s.value,t.next=9,o(this.request,this._options);case 9:if(!((a=t.sent)instanceof Request)){t.next=13;break}return this.request=a,t.abrupt("break",18);case 13:if(!(a instanceof Response)){t.next=15;break}return t.abrupt("return",a);case 15:e=!0,t.next=5;break;case 18:t.next=24;break;case 20:t.prev=20,t.t0=t.catch(3),n=!0,r=t.t0;case 24:t.prev=24,t.prev=25,e||null==i.return||i.return();case 27:if(t.prev=27,!n){t.next=30;break}throw r;case 30:return t.finish(27);case 31:return t.finish(24);case 32:if(!1!==this._options.timeout){t.next=34;break}return t.abrupt("return",x.fetch(this.request.clone()));case 34:return t.abrupt("return",tt(x.fetch(this.request.clone()),this._options.timeout,this.abortController));case 35:case"end":return t.stop()}}),t,this,[[3,20,24,32],[25,,27,31]])}))),function(){return i.apply(this,arguments)})},{key:"_stream",value:function(t,e){var n=Number(t.headers.get("content-length"))||0,r=0;return new x.Response(new x.ReadableStream({start:function(i){var s=t.body.getReader();function o(){return a.apply(this,arguments)}function a(){return(a=v(regeneratorRuntime.mark((function t(){var a,c,u;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.read();case 2:if(a=t.sent,c=a.done,u=a.value,!c){t.next=8;break}return i.close(),t.abrupt("return");case 8:e&&(r+=u.byteLength,e({percent:0===n?0:r/n,transferredBytes:r,totalBytes:n},u)),i.enqueue(u),o();case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}e&&e({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array),o()}}))}}])&&I(e.prototype,n),r&&I(e,r),t}(),st=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(var r=0,i=e;r<i.length;r++){var s=i[r];if((!H(s)||Array.isArray(s))&&void 0!==s)throw new TypeError("The `options` argument must be an object")}return W.apply(void 0,[{}].concat(e))},ot=function t(e){var n=function(t,n){return new it(t,st(e,n))},r=!0,i=!1,s=void 0;try{for(var o,a=function(){var t=o.value;n[t]=function(n,r){return new it(n,st(e,r,{method:t}))}},c=Y[Symbol.iterator]();!(r=(o=c.next()).done);r=!0)a()}catch(t){i=!0,s=t}finally{try{r||null==c.return||c.return()}finally{if(i)throw s}}return n.HTTPError=$,n.TimeoutError=Q,n.create=function(e){return t(st(e))},n.extend=function(n){return t(st(e,n))},n.stop=K,n}(),at=function(t,e){return u(void 0,void 0,void 0,(function(){var n,r,i;return l(this,(function(s){switch(s.label){case 0:n={retry:p},s.label=1;case 1:return s.trys.push([1,4,,5]),[4,ot.get(t,n)];case 2:return r=s.sent(),[4,ut(r)];case 3:return[2,s.sent()];case 4:throw i=s.sent(),lt(i,e);case 5:return[2]}}))}))},ct=function(t,e,n,r){return u(void 0,void 0,void 0,(function(){var i,s,o;return l(this,(function(a){switch(a.label){case 0:i=c({json:e,retry:p},r),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,ot.post(t,i)];case 2:return s=a.sent(),[4,ut(s)];case 3:return[2,a.sent()];case 4:throw o=a.sent(),lt(o,n);case 5:return[2]}}))}))},ut=function(t){return u(void 0,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,ft(t)];case 1:return[2,{data:e.sent(),statusCode:t.status}]}}))}))},lt=function(t,e){return{errorMessage:e,statusCode:t.response.status}},ft=function(t){return u(void 0,void 0,void 0,(function(){var e,n;return l(this,(function(r){switch(r.label){case 0:return[4,t.json()];case 1:return e=r.sent(),[2,null!==(n=e.data)&&void 0!==n?n:e]}}))}))},ht=function(t,e){return-1!==t.indexOf(e)},pt=function(t){return Array.isArray(t)&&t.length>0},gt=function(t){return"object"===g(t)&&null!==t&&Object.keys(t).length>0},dt=function(){function t(){this.jsonFileLanguage="",this.jsonFileVersion="latest",this.settingsId=""}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.resetInstance=function(){t.instance.jsonFileLanguage="",t.instance.jsonFileVersion="latest",t.instance.settingsId=""},t.prototype.getJsonFileLanguage=function(){return this.jsonFileLanguage},t.prototype.getJsonFileVersion=function(){return this.jsonFileVersion},t.prototype.getSettingsId=function(){return this.settingsId},t.prototype.setJsonFileLanguage=function(t){this.jsonFileLanguage=t},t.prototype.setJsonFileVersion=function(t){this.jsonFileVersion=t},t.prototype.setSettingsId=function(t){this.settingsId=t},t.prototype.fetchAvailableLanguages=function(){return u(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this.createLanguagesJsonUrl(),[4,at(t,r.FETCH_AVAILABLE_LANGUAGES)];case 1:return[2,n.sent().data.languagesAvailable];case 2:throw 403===(e=n.sent()).statusCode&&(e.errorMessage=r.AVAILABLE_LANGUAGES_NOT_FOUND),e;case 3:return[2]}}))}))},t.prototype.fetchServicesJson=function(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return e=this.createServicesJsonUrl(t),[4,at(e,r.FETCH_DATA_PROCESSING_SERVICES)];case 1:return[2,n.sent().data]}}))}))},t.prototype.fetchSettingsJson=function(){return u(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this.createSettingsJsonUrl(),[4,at(t,r.FETCH_SETTINGS)];case 1:return[2,n.sent().data];case 2:throw 403===(e=n.sent()).statusCode&&(e.errorMessage=r.SETTINGS_NOT_FOUND),e;case 3:return[2]}}))}))},t.prototype.fetchUserCountry=function(){return u(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){switch(n.label){case 0:return t=vt(),e=yt(),[4,ct(i.GRAPHQL,t,r.FETCH_USER_COUNTRY,e)];case 1:return[2,n.sent().data.clientLocation]}}))}))},t.prototype.generateServicesJson=function(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return e={request:t},[4,ct(i.AGGREGATOR,e,r.GENERATE_DATA_PROCESSING_SERVICES)];case 1:return[2,n.sent().data.fileName]}}))}))},t.prototype.saveConsents=function(t){return u(this,void 0,void 0,(function(){var e,n;return l(this,(function(s){switch(s.label){case 0:return e=It(t),n=yt(),[4,ct(i.GRAPHQL,e,r.SAVE_CONSENTS,n)];case 1:return[2,s.sent().data.saveConsents.data]}}))}))},t.prototype.createLanguagesJsonUrl=function(){return i.CDN+"/settings/"+this.settingsId+"/"+this.jsonFileVersion+"/languages.json"},t.prototype.createServicesJsonUrl=function(t){return i.CDN+"/consent-templates/"+t+".json"},t.prototype.createSettingsJsonUrl=function(){return i.CDN+"/settings/"+this.settingsId+"/"+this.jsonFileVersion+"/"+this.jsonFileLanguage+".json"},t}(),vt=function(){return{operationName:"clientLocation",query:"query clientLocation { clientLocation { countryCode countryName } }"}},yt=function(){return{credentials:"omit",headers:{Accept:"application/json","Access-Control-Allow-Origin":"*","X-Request-ID":s.v4()},mode:"cors"}},It=function(t){return{operationName:"saveConsents",query:"mutation saveConsents($consents: [NewCreateConsentInput]) { saveConsents(consents: $consents) { data { consentId } } }",variables:{consents:St(t)}}},St=function(t){return t.map((function(t){return{action:t.consent.action,appVersion:"SDK-0.3.6",consentStatus:t.consent.status?"1":"0",consentTemplateId:t.service.id,consentTemplateVersion:t.service.version,controllerId:t.settings.controllerId,language:t.settings.language,processorId:t.service.processorId,settingsId:t.settings.id,settingsVersion:t.settings.version,updatedBy:t.consent.type}}))};!function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE"}(D||(D={})),function(t){t[t.DATA_LAYER=0]="DATA_LAYER",t[t.WINDOW_EVENT=1]="WINDOW_EVENT"}(F||(F={})),function(t){t[t.MAJOR=0]="MAJOR",t[t.MINOR=1]="MINOR",t[t.PATCH=2]="PATCH"}(j||(j={})),function(t){t[t.FIRST_LAYER=1]="FIRST_LAYER",t[t.SECOND_LAYER=3]="SECOND_LAYER"}(k||(k={})),function(t){t[t.DATA_LAYER=1]="DATA_LAYER",t[t.WINDOW_EVENT=4]="WINDOW_EVENT"}(B||(B={})),function(t){t.DATA_COLLECTED_LIST="dataCollectedList",t.DATA_PURPOSES_LIST="dataPurposesList",t.DATA_RECIPIENTS_LIST="dataRecipientsList",t.TECHNOLOGY_USED="technologyUsed"}(V||(V={})),function(t){t.MAJOR="major",t.MINOR="minor",t.PATCH="patch"}(G||(G={}));var bt,Et=function(){function t(){this.dataLayerNames=[],this.windowEventNames=[]}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.resetInstance=function(){t.instance.dataLayerNames=[],t.instance.windowEventNames=[]},t.prototype.init=function(t){var e=this;t.forEach((function(t){var n,r;t.type===F.DATA_LAYER?e.dataLayerNames=null!==(n=t.names)&&void 0!==n?n:[]:t.type===F.WINDOW_EVENT&&(e.windowEventNames=null!==(r=t.names)&&void 0!==r?r:[])}))},t.prototype.dispatch=function(t){this.pushEventsToDataLayer(t),this.dispatchWindowEvents(t)},t.prototype.pushEventsToDataLayer=function(t){if(pt(this.dataLayerNames)){var e=mt(t);this.dataLayerNames.forEach((function(t){var n;window[t]=null!==(n=window[t])&&void 0!==n?n:[],window[t].push(e)}))}},t.prototype.dispatchWindowEvents=function(t){if(pt(this.windowEventNames)){var e=mt(t);this.windowEventNames.forEach((function(t){var n=new window.CustomEvent(t,{detail:e});window.dispatchEvent(n)}))}},t}(),mt=function(t){var e={event:"consent_status"};return t.forEach((function(t){var n;e=c(c({},e),((n={})[t.service.name]=t.consent.status,n))})),e};!function(t){t.TEXT_JAVASCRIPT="text/javascript",t.TEXT_PLAIN="text/plain"}(bt||(bt={}));var wt,Ct=function(){function t(){}return t.enableScriptsForServicesWithConsent=function(e){var n=t.getDisabledScripts();Array.prototype.forEach.call(n,(function(n){t.disabledScriptHasConsent(e,n)&&t.enableScript(n)}))},t.getDisabledScripts=function(){return document.querySelectorAll('script[data-usercentrics][type="'+bt.TEXT_PLAIN+'"]')},t.disabledScriptHasConsent=function(t,e){return t.some((function(t){return t.name===e.getAttribute("data-usercentrics")}))},t.enableScript=function(e){var n,r,i,s=e.src?t.createSrcScriptTag(e):t.createInlineScriptTag(e);r=s,(i=(n=e).parentNode)&&i.replaceChild(r,n)},t.createSrcScriptTag=function(t){return c(c({},t),{type:bt.TEXT_JAVASCRIPT})},t.createInlineScriptTag=function(t){var e=document.createElement("script"),n=document.createTextNode(t.text);return e.appendChild(n),e.type=bt.TEXT_JAVASCRIPT,e},t}(),_t=h((function(t,e){var n;t.exports=(n=n||function(t,e){var n=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},i=r.lib={},s=i.Base={extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=s.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var s=0;s<i;s++){var o=n[s>>>2]>>>24-s%4*8&255;e[r+s>>>2]|=o<<24-(r+s)%4*8}else for(s=0;s<i;s+=4)e[r+s>>>2]=n[s>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=s.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],i=function(e){e=e;var n=987654321,r=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}},s=0;s<e;s+=4){var a=i(4294967296*(n||t.random()));n=987654071*a(),r.push(4294967296*a()|0)}return new o.init(r,e)}}),a=r.enc={},c=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var s=e[i>>>2]>>>24-i%4*8&255;r.push((s>>>4).toString(16)),r.push((15&s).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new o.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var s=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(s))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new o.init(n,e)}},l=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},f=i.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,i=n.sigBytes,s=this.blockSize,a=i/(4*s),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,u=t.min(4*c,i);if(c){for(var l=0;l<c;l+=s)this._doProcessBlock(r,l);var f=r.splice(0,c);n.sigBytes-=u}return new o.init(f,u)},clone:function(){var t=s.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),h=(i.Hasher=f.extend({cfg:s.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new h.HMAC.init(t,n).finalize(e)}}}),r.algo={});return r}(Math),n)})),Tt=h((function(t,e){var n;t.exports=(n=_t,function(t){var e=n,r=e.lib,i=r.WordArray,s=r.Hasher,o=e.algo,a=[],c=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var r=2,i=0;i<64;)e(r)&&(i<8&&(a[i]=n(t.pow(r,.5))),c[i]=n(t.pow(r,1/3)),i++),r++}();var u=[],l=o.SHA256=s.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],l=n[5],f=n[6],h=n[7],p=0;p<64;p++){if(p<16)u[p]=0|t[e+p];else{var g=u[p-15],d=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,v=u[p-2],y=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[p]=d+u[p-7]+y+u[p-16]}var I=r&i^r&s^i&s,S=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+c[p]+u[p];h=f,f=l,l=a,a=o+b|0,o=s,s=i,i=r,r=b+(S+I)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+h|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=t.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=s.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=s._createHelper(l),e.HmacSHA256=s._createHmacHelper(l)}(Math),n.SHA256)})),At=function(t,e){return{id:t.templateId,version:t.version,language:e.language}},Nt=function(){return""+Tt(s.v4())},Ot=function(t,e,n){var r={categorySlug:"none",description:"",isEssential:!1,isHidden:!0,label:""};return Array.prototype.concat(t.categories.map((function(r){return{description:r.description,isEssential:r.isEssential,isHidden:r.isHidden,label:r.label,services:Lt(t,e,r,n),slug:r.categorySlug}})),[c(c({},r),{services:Lt(t,e,r,n),slug:"none"})])},Lt=function(t,e,n,r){return t.consentTemplates.reduce((function(i,s){return s.categorySlug===n.categorySlug&&i.push(xt(s,e,t,n,r)),i}),[])},xt=function(t,e,n,r,i){var s=Nt(),o=Rt(t,r);return c(c({},Ft(t,e)),{categorySlug:t.categorySlug,consent:{consentId:Ut(n.settingsId,i,s),history:[],status:o},isEssential:r.isEssential,isHidden:Pt(t,r),processorId:s,subServices:Dt(t.subConsents,e)})},Rt=function(t,e){return!!e.isEssential||t.defaultConsentStatus},Pt=function(t,e){return!!e.isHidden||t.isHidden},Ut=function(t,e,n){return""+Tt(t+"_"+JSON.stringify([e])+"_"+JSON.stringify([n]))},Dt=function(t,e){return t.reduce((function(t,n){return t.push(Ft(n,e)),t}),[])},Ft=function(t,e){var n=jt(t,e);return{dataCollected:kt(n,V.DATA_COLLECTED_LIST),dataDistribution:{processingLocation:n.locationOfProcessing,thirdPartyCountries:n.thirdCountryTransfer},dataPurposes:Bt(n),dataRecipients:kt(n,V.DATA_RECIPIENTS_LIST),description:Vt(t,n),id:t.templateId,language:{available:n.languagesAvailable,selected:n.language},legalBasis:Gt(n),name:Ht(n),processingCompany:{address:n.addressOfProcessingCompany,dataProtectionOfficer:n.dataProtectionOfficer,name:qt(n)},retentionPeriodDescription:Jt(n),technologiesUsed:kt(n,V.TECHNOLOGY_USED),urls:{cookiePolicy:n.cookiePolicyURL,dataProcessingAgreement:n.linkToDpa,optOut:n.optOutUrl,privacyPolicy:Mt(n)},version:t.version}},jt=function(t,e){return e.find((function(e){return t.templateId===e.templateId&&t.version===e.version}))},kt=function(t,e){var n;return pt(t[e])?t[e]:(null===(n=t[e])||void 0===n?void 0:n.length)>0?[t[e]]:[]},Bt=function(t){var e=kt(t,V.DATA_PURPOSES_LIST);return pt(e)?e:t.dataPurposes},Vt=function(t,e){return t.description||e.descriptionOfService||e.description},Gt=function(t){return pt(t.legalBasisList)?t.legalBasisList:[t.legalGround]},Ht=function(t){return t.dataProcessor||t.dataProcessors[0]},qt=function(t){return t.nameOfProcessingCompany||t.processingCompany},Jt=function(t){return t.retentionPeriodDescription||t.retentionPeriodList[0]},Mt=function(t){return t.privacyPolicyURL||t.policyOfProcessorUrl},Wt=function(t){return t.reduce((function(t,e){return e.type===B.DATA_LAYER?t.push({names:e.names,type:F.DATA_LAYER}):e.type===B.WINDOW_EVENT&&t.push({names:e.names,type:F.WINDOW_EVENT}),t}),[])},Yt=function(t){return t.map((function(t){switch(t){case G.MAJOR:return j.MAJOR;case G.MINOR:return j.MINOR;case G.PATCH:return j.PATCH}}))},Xt=function(t){var e=t.consentTemplates.find((function(t){return"HJI5SmLm7"===t.templateId})),n=t.backgroundOverlay.find((function(t){return t.target[0]===k.FIRST_LAYER})),r=t.backgroundOverlay.find((function(t){return t.target[0]===k.SECOND_LAYER}));return{buttons:{acceptAll:{label:t.labels.btnAccept},denyAll:{isEnabled:t.btnDenyIsVisible,label:t.labels.btnDeny},save:{label:t.labels.btnSave},showSecondLayer:{isEnabled:t.btnMoreInfoIsVisible,label:t.labels.btnMoreInfo,url:t.moreInfoButtonUrl||null}},firstLayer:{description:{default:e.description,short:t.bannerMobileDescriptionIsActive?t.bannerMobileDescription:null},isOverlayEnabled:n.darken>0,title:t.labels.titleCenterSecondary},labels:{general:{consentGiven:"Consent given",consentId:"Consent ID",consentNotGiven:"Consent not given",consentType:"Consent type",controllerId:"Controller ID",copy:t.labels.copy,date:t.labels.date,decision:"Decision",explicit:"Explicit",implicit:"Implicit",processorId:"Processor ID",showMore:"Show more"},service:{dataCollected:{description:t.labels.dataCollectedInfo,title:t.labels.dataCollectedList},dataDistribution:{processingLocationTitle:t.labels.locationOfProcessing,thirdPartyCountriesTitle:t.labels.transferToThirdCountries},dataPurposes:{description:t.labels.dataPurposesInfo,title:t.labels.dataPurposes},dataRecipientsTitle:t.labels.dataRecipientsList,descriptionTitle:t.labels.descriptionOfService,history:{description:null,title:t.labels.history},legalBasis:{description:t.labels.legalBasisInfo,title:t.labels.legalBasisList},processingCompanyTitle:t.labels.processingCompanyTitle,retentionPeriodTitle:t.labels.retentionPeriod,technologiesUsed:{description:t.labels.technologiesUsedInfo,title:t.labels.technologiesUsed},urls:{cookiePolicyTitle:t.labels.cookiePolicyInfo,dataProcessingAgreementTitle:t.labels.linkToDpaInfo,optOutTitle:t.labels.furtherInformationOptOut,privacyPolicyTitle:t.labels.policyOf}}},language:{available:t.languagesAvailable,isSelectorEnabled:t.showLanguageDropdown,selected:t.language},links:{cookiePolicy:{label:"",url:null},imprint:{label:t.labels.imprintLinkText,url:t.imprintUrl||null},privacyPolicy:{label:t.labels.privacyPolicyLinkText,url:t.privacyPolicyUrl||null}},poweredBy:{isEnabled:t.enablePoweredBy,label:"Powered by",partnerUrl:t.partnerPoweredByUrl||null,partnerUrlLabel:t.labels.partnerPoweredByLinkText||null,url:"https://www.usercentrics.com/",urlLabel:"Usercentrics Consent Management"},privacyButton:{isEnabled:t.privacyButtonIsVisible},secondLayer:{description:t.labels.headerCenterSecondary,isOverlayEnabled:r.darken>0,tabs:{categories:{isEnabled:!0,label:t.labels.categories},services:{isEnabled:!0,label:"Services"}},title:t.labels.titleCenterSecondary}}},zt=["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK"],Kt=function(){function t(){this.apiInstance=dt.getInstance(),this.userCountry={}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.resetInstance=function(){t.instance.userCountry={}},t.prototype.getUserCountry=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(e){switch(e.label){case 0:return gt(this.userCountry)?[3,2]:[4,this.apiInstance.fetchUserCountry()];case 1:t=e.sent(),this.userCountry=$t(t),e.label=2;case 2:return[2,this.userCountry]}}))}))},t.prototype.getIsUserInEU=function(){return u(this,void 0,void 0,(function(){var t;return l(this,(function(e){switch(e.label){case 0:return[4,this.getUserCountry()];case 1:return t=e.sent(),[2,ht(zt,t.code.toUpperCase())]}}))}))},t}(),$t=function(t){return{code:t.countryCode,name:t.countryName}},Qt=function(){function t(){this.apiInstance=dt.getInstance(),this.locationInstance=Kt.getInstance(),this.settings={}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.resetInstance=function(){t.instance.settings={}},t.prototype.getBaseSettings=function(){return{controllerId:this.settings.controllerId,id:this.settings.id,ui:this.settings.ui,version:this.settings.version}},t.prototype.getCategories=function(){return this.settings.categories},t.prototype.getCategoryBySlug=function(t){return this.getCategories().find((function(e){return e.slug===t}))},t.prototype.getDataExchangeSettings=function(){return this.settings.dataExchangeSettings},t.prototype.getEssentialCategories=function(){return this.getCategories().reduce((function(t,e){return e.isEssential&&t.push(e),t}),[])},t.prototype.getNonEssentialCategories=function(){return this.getCategories().reduce((function(t,e){return e.isEssential||t.push(e),t}),[])},t.prototype.getServices=function(){return this.getServicesFromCategories(this.getCategories())},t.prototype.getServicesByIds=function(t){return this.getServicesFromCategories(this.removeNoneCategory(this.getCategories())).reduce((function(e,n){return t.some((function(t){return t===n.id}))&&e.push(n),e}),[])},t.prototype.getServicesFromCategories=function(t){return t.reduce((function(t,e){return t.concat(e.services)}),[])},t.prototype.getServicesWithConsent=function(){return this.getServices().reduce((function(t,e){return e.consent.status&&t.push(e),t}),[])},t.prototype.getSettings=function(){return this.settings},t.prototype.setCategories=function(t){this.settings.categories=t},t.prototype.setSettings=function(t){this.settings=t},t.prototype.initSettings=function(){return u(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){switch(n.label){case 0:return[4,this.apiInstance.fetchSettingsJson()];case 1:return t=n.sent(),t=c(c({},r=t),{consentTemplates:r.consentTemplates.reduce((function(t,e){return e.isDeactivated||t.push(e),t}),[])}),[4,this.fetchServices(t)];case 2:return e=n.sent(),this.setSettings(function(t,e){var n=Nt();return{acceptAllImplicitlyOutsideEU:t.displayOnlyForEU,categories:Ot(t,e,n),controllerId:n,dataExchangeSettings:Wt(t.dataExchangeOnPage),id:t.settingsId,showFirstLayerOnVersionChange:Yt(t.showInitialViewForVersionChange),ui:Xt(t),version:t.version}}(t,e)),[2]}var r}))}))},t.prototype.removeNoneCategory=function(t){return t.reduce((function(t,e){return"none"!==e.slug&&t.push(e),t}),[])},t.prototype.shouldAcceptAllImplicitlyOnInit=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return this.settings.acceptAllImplicitlyOutsideEU?[2,!this.locationInstance.getIsUserInEU()]:[2,!1]}))}))},t.prototype.shouldShowFirstLayerOnVersionChange=function(t){if(pt(this.settings.showFirstLayerOnVersionChange)){var e=this.settings.version.split("."),n=t.split(".");return ht(this.settings.showFirstLayerOnVersionChange,j.MAJOR)&&e[0]!==n[0]||ht(this.settings.showFirstLayerOnVersionChange,j.MINOR)&&e[1]!==n[1]||ht(this.settings.showFirstLayerOnVersionChange,j.PATCH)&&e[2]!==n[2]}return!1},t.prototype.updateServicesWithConsent=function(t,e){return t.map((function(t){return t.isEssential?t:c(c({},t),{consent:c(c({},t.consent),{status:1===e})})}))},t.prototype.updateServicesWithConsents=function(t,e){return t.reduce((function(t,n){var r;if(!n.isEssential){var i=e.find((function(t){return t.serviceId===n.id}));r=c(c({},n),{consent:c(c({},n.consent),{status:i.status})})}return t.push(null!=r?r:n),t}),[])},t.prototype.fetchServices=function(t){return u(this,void 0,void 0,(function(){var e,n,r;return l(this,(function(i){switch(i.label){case 0:c=[],(s=t).consentTemplates.forEach((function(t){c.push(At(t,s)),t.subConsents.forEach((function(t){c.push(At(t,s))}))})),e=o(a(c,(function(t,e){return t.id===e.id&&t.version===e.version})),"id"),n=function(t){return""+Tt(JSON.stringify(t))}(e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.apiInstance.fetchServicesJson(n)];case 2:return[2,i.sent()];case 3:return i.sent(),[3,4];case 4:return[4,this.apiInstance.generateServicesJson(e)];case 5:return r=i.sent(),[2,this.apiInstance.fetchServicesJson(r)]}var s,c}))}))},t}();!function(t){t.SETTINGS="uc_settings",t.USER_INTERACTION="uc_user_interaction"}(wt||(wt={}));var Zt,te=function(){function t(){}return t.clearOnNewSettingsId=function(e){e!==t.fetchSettingsId()&&t.clear()},t.fetchLanguage=function(){return t.fetchSettings().language},t.fetchSettings=function(){var t=localStorage.getItem(wt.SETTINGS);return JSON.parse(null!=t?t:"{}")},t.fetchSettingsId=function(){return t.fetchSettings().id},t.fetchSettingsVersion=function(){return t.fetchSettings().version},t.fetchUserActionPerformed=function(){return null!==localStorage.getItem(wt.USER_INTERACTION)},t.saveSettings=function(t){localStorage.setItem(wt.SETTINGS,JSON.stringify(t))},t.settingsExist=function(){return gt(t.fetchSettings())},t.setUserActionPerformed=function(){localStorage.setItem(wt.USER_INTERACTION,JSON.stringify(!0))},t.clear=function(){localStorage.removeItem(wt.SETTINGS),localStorage.removeItem(wt.USER_INTERACTION)},t}(),ee=function(){function t(){this.apiInstance=dt.getInstance(),this.eventDispatcherInstance=Et.getInstance(),this.settingsInstance=Qt.getInstance()}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.getStorageMappedSettings=function(){return ie(this.settingsInstance.getSettings(),this.settingsInstance.getServices())},t.prototype.execute=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i;return l(this,(function(s){switch(s.label){case 0:return r=this.mapDataTransferObjects(t,e,n),i=ne(t,r),[4,this.apiInstance.saveConsents(r)];case 1:return s.sent(),this.settingsInstance.setCategories(this.mergeServicesIntoExistingCategories(i)),te.saveSettings(this.getStorageMappedSettings()),Ct.enableScriptsForServicesWithConsent(this.settingsInstance.getServicesWithConsent()),this.eventDispatcherInstance.dispatch(r),[2]}}))}))},t.prototype.mergeSettingsFromStorage=function(){return u(this,void 0,void 0,(function(){var t,e,n,r,i,s,o,a,u,f,h,p,g;return l(this,(function(l){switch(l.label){case 0:return t=this.settingsInstance.getEssentialCategories(),e=this.settingsInstance.getServicesFromCategories(t),n=this.settingsInstance.getNonEssentialCategories(),r=this.settingsInstance.getServicesFromCategories(n),i=te.fetchSettings(),s=[],o=e.map((function(t){var e=i.services.find((function(e){return e.id===t.id}));if(e){if(e.status)return c(c({},t),{consent:c(c({},t.consent),{consentId:e.consentId,history:e.history,status:e.status}),processorId:e.processorId});var n=c(c({},t),{consent:c(c({},t.consent),{consentId:e.consentId,history:e.history,status:!0}),processorId:e.processorId});return s.push(n),n}return t})),a=r.map((function(t){var e=i.services.find((function(e){return e.id===t.id}));return e?c(c({},t),{consent:c(c({},t.consent),{history:e.history,status:e.status}),processorId:e.processorId}):t})),u=o.concat(a),f=c(c({},this.settingsInstance.getSettings()),{controllerId:i.controllerId}),pt(s)?(h=this.mapDataTransferObjects(s,exports.CONSENT_TYPE.IMPLICIT,exports.CONSENT_ACTION.ESSENTIAL_CHANGE,f),p=ne(u,h),[4,this.apiInstance.saveConsents(h)]):[3,2];case 1:return l.sent(),this.settingsInstance.setSettings(c(c({},f),{categories:this.mergeServicesIntoExistingCategories(p)})),[3,3];case 2:this.settingsInstance.setSettings(c(c({},f),{categories:this.mergeServicesIntoExistingCategories(u)})),l.label=3;case 3:return g=this.mapDataTransferObjects(u,exports.CONSENT_TYPE.IMPLICIT,exports.CONSENT_ACTION.INITIAL_PAGE_LOAD),te.saveSettings(this.getStorageMappedSettings()),Ct.enableScriptsForServicesWithConsent(this.settingsInstance.getServicesWithConsent()),this.eventDispatcherInstance.dispatch(g),[2]}}))}))},t.prototype.mapDataTransferObjects=function(t,e,n,r){var i=this;return t.map((function(t){var s,o,a,c;return{consent:{action:n,status:t.consent.status,type:e},service:{id:t.id,name:t.name,processorId:t.processorId,version:t.version},settings:{controllerId:null!==(s=null==r?void 0:r.controllerId)&&void 0!==s?s:i.settingsInstance.getSettings().controllerId,id:null!==(o=null==r?void 0:r.id)&&void 0!==o?o:i.settingsInstance.getSettings().id,language:null!==(a=null==r?void 0:r.ui.language.selected)&&void 0!==a?a:i.settingsInstance.getSettings().ui.language.selected,version:null!==(c=null==r?void 0:r.version)&&void 0!==c?c:i.settingsInstance.getSettings().version}}}))},t.prototype.mergeServicesIntoExistingCategories=function(t){return this.settingsInstance.getCategories().map((function(e){var n=e.services.map((function(e){var n=t.find((function(t){return t.id===e.id}));return null!=n?n:e}));return c(c({},e),{services:n})}))},t}(),ne=function(t,e){var n=(new Date).valueOf();return t.map((function(t){var r=e.find((function(e){return e.service.id===t.id}));return r?c(c({},t),{consent:c(c({},t.consent),{history:f(t.consent.history,[re(t,r,"SDK-0.3.6",n)])})}):t}))},re=function(t,e,n,r){return{action:e.consent.action,language:e.settings.language,status:e.consent.status,timestamp:r,type:e.consent.type,versions:{application:n,service:t.version,settings:e.settings.version}}},ie=function(t,e){return{controllerId:t.controllerId,id:t.id,language:t.ui.language.selected,services:se(e),version:t.version}},se=function(t){return t.map((function(t){return{consentId:t.consent.consentId,history:t.consent.history,id:t.id,processorId:t.processorId,status:t.consent.status}}))};!function(t){t.DEFAULT_BROWSER_LANGUAGE="Usercentrics: The language has been defaulted to the browser language.",t.DEFAULT_FIRST_AVAILABLE_LANGUAGE="Usercentrics: The language has been defaulted to the first available language."}(Zt||(Zt={}));var oe,ae=function(){function t(){this.apiInstance=dt.getInstance()}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.resolveLanguage=function(){return u(this,void 0,void 0,(function(){var t,e,n;return l(this,(function(r){switch(r.label){case 0:return[4,this.apiInstance.fetchAvailableLanguages()];case 1:return t=r.sent(),e=te.fetchLanguage(),ht(t,e)&&this.apiInstance.setJsonFileLanguage(e),ht(t,this.apiInstance.getJsonFileLanguage())?[2]:((n=ce(t))?(console.warn(Zt.DEFAULT_BROWSER_LANGUAGE),this.apiInstance.setJsonFileLanguage(n)):(console.warn(Zt.DEFAULT_FIRST_AVAILABLE_LANGUAGE),this.apiInstance.setJsonFileLanguage(t[0])),[2])}}))}))},t}(),ce=function(t){var e,n=window.navigator;if(pt(n.languages))for(var r=0;r<n.languages.length;r+=1){var i=n.languages[r].slice(0,2);if(ht(t,i))return i}var s=(null!==(e=n.language)&&void 0!==e?e:n.userLanguage).slice(0,2);return ht(t,s)?s:null};(oe=exports.INITIAL_VIEW||(exports.INITIAL_VIEW={}))[oe.FIRST_LAYER=0]="FIRST_LAYER",oe[oe.NONE=1]="NONE",oe[oe.PRIVACY_BUTTON=2]="PRIVACY_BUTTON";var ue=function(){function t(t,e){this.apiInstance=dt.getInstance(),this.dataFacadeInstance=ee.getInstance(),this.eventDispatcherInstance=Et.getInstance(),this.languageInstance=ae.getInstance(),this.locationInstance=Kt.getInstance(),this.settingsInstance=Qt.getInstance(),this.apiInstance.setSettingsId(t),(null==e?void 0:e.language)&&this.apiInstance.setJsonFileLanguage(e.language),(null==e?void 0:e.version)&&this.apiInstance.setJsonFileVersion(e.version)}return t.prototype.init=function(){return u(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){switch(n.label){case 0:return te.clearOnNewSettingsId(this.apiInstance.getSettingsId()),[4,this.languageInstance.resolveLanguage()];case 1:return n.sent(),[4,this.settingsInstance.initSettings()];case 2:return n.sent(),this.eventDispatcherInstance.init(this.settingsInstance.getDataExchangeSettings()),t=!te.settingsExist(),[4,this.settingsInstance.shouldAcceptAllImplicitlyOnInit()];case 3:return e=n.sent(),t?e?[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(this.settingsInstance.getServices(),1),exports.CONSENT_TYPE.IMPLICIT,exports.CONSENT_ACTION.NON_EU_REGION)]:[3,5]:[3,8];case 4:return n.sent(),[3,7];case 5:return[4,this.dataFacadeInstance.execute(this.settingsInstance.getServices(),exports.CONSENT_TYPE.IMPLICIT,exports.CONSENT_ACTION.INITIAL_PAGE_LOAD)];case 6:n.sent(),n.label=7;case 7:return[3,10];case 8:return[4,this.dataFacadeInstance.mergeSettingsFromStorage()];case 9:n.sent(),n.label=10;case 10:return[2,this.resolveInitialView(e,t)]}}))}))},t.prototype.acceptAllServices=function(t){return void 0===t&&(t=exports.CONSENT_TYPE.EXPLICIT),u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(this.settingsInstance.getServices(),1),t,exports.CONSENT_ACTION.ACCEPT_ALL_SERVICES)];case 1:return e.sent(),te.setUserActionPerformed(),[2]}}))}))},t.prototype.acceptAllServicesInCategory=function(t,e){return void 0===e&&(e=exports.CONSENT_TYPE.EXPLICIT),u(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return(n=this.settingsInstance.getCategoryBySlug(t))?[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(n.services,1),e,exports.CONSENT_ACTION.UPDATE_SERVICES)]:[3,2];case 1:r.sent(),te.setUserActionPerformed(),r.label=2;case 2:return[2]}}))}))},t.prototype.changeLanguage=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.shouldChangeLanguage(t)?(this.apiInstance.setJsonFileLanguage(t),[4,this.settingsInstance.initSettings()]):[3,2];case 1:e.sent(),te.saveSettings(this.dataFacadeInstance.getStorageMappedSettings()),e.label=2;case 2:return[2]}}))}))},t.prototype.denyAllServices=function(t){return void 0===t&&(t=exports.CONSENT_TYPE.EXPLICIT),u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(this.settingsInstance.getServices(),0),t,exports.CONSENT_ACTION.DENY_ALL_SERVICES)];case 1:return e.sent(),te.setUserActionPerformed(),[2]}}))}))},t.prototype.denyAllServicesInCategory=function(t,e){return void 0===e&&(e=exports.CONSENT_TYPE.EXPLICIT),u(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return(n=this.settingsInstance.getCategoryBySlug(t))?[4,this.dataFacadeInstance.execute(this.settingsInstance.updateServicesWithConsent(n.services,0),e,exports.CONSENT_ACTION.UPDATE_SERVICES)]:[3,2];case 1:r.sent(),te.setUserActionPerformed(),r.label=2;case 2:return[2]}}))}))},t.prototype.fetchIsUserInEU=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this.locationInstance.getIsUserInEU()]}))}))},t.prototype.fetchUserCountry=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this.locationInstance.getUserCountry()]}))}))},t.prototype.getCategories=function(){return this.settingsInstance.removeNoneCategory(this.settingsInstance.getCategories())},t.prototype.getEssentialCategories=function(){return this.settingsInstance.removeNoneCategory(this.settingsInstance.getEssentialCategories())},t.prototype.getEssentialServices=function(){return this.settingsInstance.getServicesFromCategories(this.getEssentialCategories())},t.prototype.getNonEssentialCategories=function(){return this.settingsInstance.removeNoneCategory(this.settingsInstance.getNonEssentialCategories())},t.prototype.getNonEssentialServices=function(){return this.settingsInstance.getServicesFromCategories(this.getNonEssentialCategories())},t.prototype.getServices=function(){return this.settingsInstance.getServicesFromCategories(this.getCategories())},t.prototype.getSettings=function(){return this.settingsInstance.getBaseSettings()},t.prototype.updateServices=function(t,e){return void 0===e&&(e=exports.CONSENT_TYPE.EXPLICIT),u(this,void 0,void 0,(function(){var n,r;return l(this,(function(i){switch(i.label){case 0:return n=this.settingsInstance.getServicesByIds(t.map((function(t){return t.serviceId}))),r=this.settingsInstance.updateServicesWithConsents(n,t),pt(r)?[4,this.dataFacadeInstance.execute(r,e,exports.CONSENT_ACTION.UPDATE_SERVICES)]:[3,2];case 1:i.sent(),te.setUserActionPerformed(),i.label=2;case 2:return[2]}}))}))},t.prototype.resolveInitialView=function(t,e){return t?1:e||!te.fetchUserActionPerformed()||this.settingsInstance.shouldShowFirstLayerOnVersionChange(te.fetchSettingsVersion())?0:this.settingsInstance.getBaseSettings().ui.privacyButton.isEnabled?2:1},t.prototype.shouldChangeLanguage=function(t){return t!==this.apiInstance.getJsonFileLanguage()&&this.settingsInstance.getBaseSettings().ui.language.available.some((function(e){return t===e}))},t}();exports.default=ue; |
{ | ||
"name": "@usercentrics/cmp-browser-sdk", | ||
"version": "0.3.4", | ||
"version": "0.3.6", | ||
"author": "Usercentrics GmbH", | ||
@@ -33,5 +33,10 @@ "description": "Usercentrics CMP Browser SDK", | ||
"lodash": "^4.17.15", | ||
"regenerator-runtime": "^0.13.3", | ||
"uuid": "^7.0.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.7", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.8.3", | ||
"@babel/preset-env": "^7.8.7", | ||
"@rollup/plugin-commonjs": "^11.0.2", | ||
@@ -59,2 +64,3 @@ "@rollup/plugin-json": "^4.0.2", | ||
"rollup": "^2.0.3", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-filesize": "^6.2.1", | ||
@@ -61,0 +67,0 @@ "rollup-plugin-terser": "^5.3.0", |
@@ -23,19 +23,19 @@ # Usercentrics CMP Browser SDK | ||
UC.init().then(initialView => { | ||
// getCategories() returns all categories' and data processing services' information | ||
const categories = UC.getCategories(); | ||
// getSettings() returns all Usercentrics settings you need for your custom solution | ||
const settings = UC.getSettings(); | ||
// getCategories() returns all categories' and data processing services' information | ||
const categories = UC.getCategories(); | ||
// getSettings() returns all Usercentrics settings you need for your custom solution | ||
const settings = UC.getSettings(); | ||
switch (initialView) { | ||
case INITIAL_VIEW.FIRST_LAYER: | ||
// Show first layer (i.e. privacy banner) | ||
return; | ||
case INITIAL_VIEW.PRIVACY_BUTTON: | ||
// Show privacy button | ||
return; | ||
case INITIAL_VIEW.NONE: | ||
default: | ||
// Show nothing | ||
return; | ||
} | ||
switch (initialView) { | ||
case INITIAL_VIEW.FIRST_LAYER: | ||
// Show first layer (i.e. privacy banner) | ||
return; | ||
case INITIAL_VIEW.PRIVACY_BUTTON: | ||
// Show privacy button | ||
return; | ||
case INITIAL_VIEW.NONE: | ||
default: | ||
// Show nothing | ||
return; | ||
} | ||
}); | ||
@@ -54,16 +54,27 @@ ``` | ||
UC.init().then(initialView => { | ||
/** | ||
* ... | ||
*/ | ||
/** | ||
* ... | ||
*/ | ||
UC.changeLanguage('NEW_LANGUAGE').then(() => { | ||
// Remember to fetch new categories and settings | ||
const categories = UC.getCategories(); | ||
const settings = UC.getSettings(); | ||
}); | ||
UC.changeLanguage('NEW_LANGUAGE').then(() => { | ||
// Remember to fetch new categories and settings | ||
const categories = UC.getCategories(); | ||
const settings = UC.getSettings(); | ||
}); | ||
}); | ||
``` | ||
## IE11 Compatibility | ||
If your Consent Solution should work with IE11 (or other legacy browsers), then there's a few extra steps you need to do: | ||
- Include a `CustomEvent` polyfill | ||
- https://www.npmjs.com/package/custom-event-polyfill | ||
- Include a `fetch` polyfill | ||
- https://www.npmjs.com/package/whatwg-fetch | ||
Also you'll have to have `Babel` (or similar) in your build setup to make sure, that `Array.prototype.find` etc. get polyfilled. | ||
## Documentation | ||
Documentation can be found on our [documentation website](https://docs.usercentrics.com/cmp_browser_sdk/globals.html). |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
85934
782
79
8
34
1
+ Addedregenerator-runtime@^0.13.3
+ Addedregenerator-runtime@0.13.11(transitive)