gdpr-guard
Advanced tools
Comparing version 2.3.1 to 2.4.0
@@ -1,2 +0,2 @@ | ||
!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("gdprGuard",[],t):"object"==typeof exports?exports.gdprGuard=t():r.gdprGuard=t()}("undefined"!=typeof self?self:"undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var r={315:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeGuard=void 0;var n=e(670);t.makeGuard=function(r,t,e,o,i){return void 0===e&&(e=n.GdprStorage.Cookie),void 0===o&&(o=!1),void 0===i&&(i=null),{name:r,description:t,storage:e,required:o,enabled:null===i?o:i,enable:function(){return this.enabled||this.toggle(),this},disable:function(){return this.enabled&&this.toggle(),this},toggle:function(){return this.required||(this.enabled=!this.enabled),this},makeRequired:function(){return this.required=!0,this.enabled=!0,this},isEnabled:function(r){return this.name===r&&this.enabled},enableForStorage:function(r){return this.enabled||this.toggleForStorage(r),this},disableForStorage:function(r){return this.enabled&&this.toggleForStorage(r),this},toggleForStorage:function(r){return!this.required&&this.storage&r&&this.toggle(),this},raw:function(){return JSON.parse(JSON.stringify(this))}}}},822:function(r,t,e){var n=this&&this.__read||function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,o,i=e.call(r),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},o=this&&this.__spreadArray||function(r,t,e){if(e||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return r.concat(n||Array.prototype.slice.call(t))},i=this&&this.__values||function(r){var t="function"==typeof Symbol&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&"number"==typeof r.length)return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.GdprGuardGroup=void 0;var u=e(670),a=function(){function r(r,t,e,n){void 0===t&&(t=""),void 0===e&&(e=!1),void 0===n&&(n=!1),this.name=r,this.description=t,this.enabled=e,this.required=n,this.storage=u.GdprStorage.None,this.bindings=new Map,this.required&&(this.enabled=!0)}return r.for=function(t,e,n,o){return void 0===e&&(e=""),void 0===n&&(n=!1),void 0===o&&(o=!1),new r(t,e,n,o)},r.prototype.addGuard=function(r){return this.bindings.set(r.name,r),this},r.prototype.hasGuard=function(r){return this.name===r||this.bindings.has(r)||this.reduceSubGroupsPred((function(t){return t.hasGuard(r)}))},r.prototype.getGuard=function(r){var t,e;return this.name===r?this:null!==(e=null!==(t=this.bindings.get(r))&&void 0!==t?t:this.reduceSubGroups((function(t){return t.getGuard(r)})))&&void 0!==e?e:null},r.prototype.isEnabled=function(r){if(this.hasGuard(r)){var t=this.getGuard(r);if(null!==t)return t.enabled}return!1},r.prototype.enable=function(){return this.required?this:(this.enabled=!0,this.doForEachGuard((function(r){return r.enable()})))},r.prototype.disable=function(){return this.required?this:(this.enabled=!1,this.doForEachGuard((function(r){return r.disable()})))},r.prototype.toggle=function(){return this.enabled?this.disable():this.enable()},r.prototype.makeRequired=function(){return this.required=!0,this.enabled=!0,this.doForEachGuard((function(r){return r.makeRequired()}))},r.prototype.enableForStorage=function(r){return this.required?this:this.doForEachGuard((function(t){t.enableForStorage(r)}))},r.prototype.disableForStorage=function(r){return this.required?this:this.doForEachGuard((function(t){t.disableForStorage(r)}))},r.prototype.toggleForStorage=function(r){return this.required?this:this.doForEachGuard((function(t){t.toggleForStorage(r)}))},r.prototype.raw=function(){var r={name:this.name,description:this.description,enabled:this.enabled,required:this.required,storage:this.storage,guards:[]};return r.guards=o([],n(this.bindings),!1).map((function(r){var t=n(r,2);return t[0],t[1].raw()})),r},r.prototype.doForEachGuard=function(r){return this.bindings.forEach((function(t){return r(t)})),this},r.prototype.reduceSubGroupsPred=function(t){var e,o;try{for(var u=i(this.bindings),a=u.next();!a.done;a=u.next()){var s=n(a.value,2),d=(s[0],s[1]);if(d instanceof r&&t(d))return!0}}catch(r){e={error:r}}finally{try{a&&!a.done&&(o=u.return)&&o.call(u)}finally{if(e)throw e.error}}return!1},r.prototype.reduceSubGroups=function(t){var e,o;try{for(var u=i(this.bindings),a=u.next();!a.done;a=u.next()){var s=n(a.value,2),d=(s[0],s[1]);if(d instanceof r){var c=t(d);if(c)return c}}}catch(r){e={error:r}}finally{try{a&&!a.done&&(o=u.return)&&o.call(u)}finally{if(e)throw e.error}}return null},r.prototype.getGuards=function(){return o([],n(this.bindings.values()),!1)},r}();t.GdprGuardGroup=a},777:function(r,t,e){var n=this&&this.__values||function(r){var t="function"==typeof Symbol&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&"number"==typeof r.length)return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,o,i=e.call(r),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},i=this&&this.__spreadArray||function(r,t,e){if(e||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return r.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.GdprManager=void 0;var u=e(822),a=e(670),s=e(554),d=e(779),c=function(){function r(){this.bannerWasShown=!1,this.enabled=!0,this.events=new s.GdprManagerEventHub,this.groups=new Map,this.name="manager",this.description="Manager of GDPR guard groups",this.storage=a.GdprStorage.None,this.required=!1}return r.create=function(t){void 0===t&&(t=[]);var e=new r;return t.forEach((function(r){return e.addGroup(r)})),e},r.prototype.closeBanner=function(){var r=this;this.bannerWasShown=!0,(0,d.visitGdpr)(this,{onEach:function(t){t.enabled?r.events.enable(t.name):r.events.disable(t.name)}})},r.prototype.resetAndShowBanner=function(){this.bannerWasShown=!1},r.prototype.createGroup=function(r,t){return void 0===t&&(t=""),this.addGroup(u.GdprGuardGroup.for(r,t))},r.prototype.addGroup=function(r){return this.groups.set(r.name,r),this},r.prototype.hasGuard=function(r){return this.reduceGroupsPred((function(t){return t.hasGuard(r)}))},r.prototype.getGuard=function(r){var t,e;try{for(var i=n(this.groups),u=i.next();!u.done;u=i.next()){var a=o(u.value,2),s=(a[0],a[1]);if(s.hasGuard(r))return s.getGuard(r)}}catch(r){t={error:r}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return null},r.prototype.hasGroup=function(r){return this.reduceGroupsPred((function(t){return t.name===r}))},r.prototype.getGroup=function(r){var t,e;try{for(var i=n(this.groups),u=i.next();!u.done;u=i.next()){var a=o(u.value,2),s=a[0],d=a[1];if(s===r)return d}}catch(r){t={error:r}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return null},r.prototype.isEnabled=function(r){return this.reduceGroupsPred((function(t){return t.isEnabled(r)}))},r.prototype.enable=function(){return this.enabled=!0,this.forEachGroup((function(r){return r.enable()}))},r.prototype.disable=function(){return this.enabled=!1,this.forEachGroup((function(r){return r.disable()}))},r.prototype.toggle=function(){return this.enabled?this.disable():this.enable()},r.prototype.makeRequired=function(){return this},r.prototype.enableForStorage=function(r){return this.forEachGroup((function(t){return t.enableForStorage(r)}))},r.prototype.disableForStorage=function(r){return this.forEachGroup((function(t){return t.disableForStorage(r)}))},r.prototype.toggleForStorage=function(r){return this.forEachGroup((function(t){return t.toggleForStorage(r)}))},r.prototype.raw=function(){var r={bannerWasShown:this.bannerWasShown,enabled:this.enabled,groups:[],name:this.name,description:this.description,storage:this.storage,required:this.required};return r.groups=i([],o(this.groups.values()),!1).map((function(r){return r.raw()})),r},r.prototype.reduceGroupsPred=function(r){var t,e;try{for(var i=n(this.groups),u=i.next();!u.done;u=i.next()){var a=o(u.value,2);if(a[0],r(a[1]))return!0}}catch(r){t={error:r}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return!1},r.prototype.forEachGroup=function(r){return this.groups.forEach((function(t){return r(t)})),this},r.prototype.getGroups=function(){return i([],o(this.groups.values()),!1)},r}();t.GdprManager=c},554:(r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprManagerEventHub=void 0;var e=function(){function r(){this.eventMap={}}return r.prototype.onEnable=function(r,t){return this.addListener("enable",r,t),this},r.prototype.onDisable=function(r,t){return this.addListener("disable",r,t),this},r.prototype.enable=function(r){return this.executeListeners("enable",r),this},r.prototype.disable=function(r){return this.executeListeners("disable",r),this},r.prototype.tagFor=function(r,t){return"".concat(r,"--").concat(t)},r.prototype.addListener=function(r,t,e){var n=this.tagFor(r,t);n in this.eventMap||(this.eventMap[n]=[]),this.eventMap[n].push(e)},r.prototype.executeListeners=function(r,t){var e,n=this.tagFor(r,t);null===(e=this.eventMap[n])||void 0===e||e.forEach((function(r){return r()}))},r}();t.GdprManagerEventHub=e},670:(r,t)=>{var e;Object.defineProperty(t,"__esModule",{value:!0}),t.GdprStorage=void 0,(e=t.GdprStorage||(t.GdprStorage={}))[e.None=1]="None",e[e.Cookie=2]="Cookie",e[e.LocalStorage=4]="LocalStorage",e[e.SessionStorage=8]="SessionStorage",e[e.IndexedDb=16]="IndexedDb",e[e.FileSystem=32]="FileSystem",e[e.ServerStorage=64]="ServerStorage",e[e.All=126]="All"},860:function(r,t,e){var n,o=this&&this.__extends||(n=function(r,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])},n(r,t)},function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=r}n(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),i=this&&this.__read||function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,o,i=e.call(r),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},u=this&&this.__spreadArray||function(r,t,e){if(e||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return r.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.GdprGroupBuilder=void 0;var a=e(670),s=e(237),d=e(822),c=e(890),p=function(r){function t(t,e,n,o,i,u){var a=r.call(this)||this;return a.parent=t,a.name=e,a.description=n,a.enable=i,a.require=u,a.guards=[],a.storage=o,u&&(a.enable=!0),a}return o(t,r),t.create=function(r,e,n,o,i,u){return void 0===n&&(n=""),void 0===o&&(o=null),void 0===i&&(i=!0),void 0===u&&(u=!1),new t(r,e,n,o||a.GdprStorage.Cookie,i,u)},t.prototype.startGroup=function(t,e,n){return void 0===t&&(t=null),void 0===e&&(e=""),void 0===n&&(n=""),r.prototype.startGroup.call(this,t||this.parent.storage,e,n)},t.prototype.startRequiredGroup=function(r,t,e){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),this.startGroup(r,t,e).required()},t.prototype.endGroup=function(){var r=this.require||this.enable,t=d.GdprGuardGroup.for(this.name,this.description,r,this.require);return u(u([],i(this.guards),!1),i(this.groups),!1).forEach((function(r){return t.addGuard(r)})),this.require&&t.makeRequired(),this.parent.groups.push(t),this.parent},t.prototype.withName=function(r){return this.edit((function(t){return t.name=r}))},t.prototype.withDescription=function(r){return this.edit((function(t){return t.description=r}))},t.prototype.storedIn=function(r){return this.edit((function(t){return t.storage=r}))},t.prototype.enabled=function(){return this.edit((function(r){return r.enable=!0}))},t.prototype.disabled=function(){return this.edit((function(r){return r.enable=!1}))},t.prototype.required=function(){return this.edit((function(r){return r.require=!0}))},t.prototype.startGuard=function(r){return void 0===r&&(r=null),c.GdprGuardBuilder.create(this,r||this.storage,this.enable)},t.prototype.startRequiredGuard=function(r){return this.startGuard(r).required()},t.prototype.withEnabledGuard=function(r,t,e){return void 0===t&&(t=""),void 0===e&&(e=null),this.startGuard(e).withName(r).withDescription(t).enabled().endGuard()},t.prototype.withDisabledGuard=function(r,t,e){return void 0===t&&(t=""),void 0===e&&(e=null),this.startGuard(e).withName(r).withDescription(t).disabled().endGuard()},t.prototype.edit=function(r){return r(this),this},t}(s.GdprManagerBuilder);t.GdprGroupBuilder=p},890:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprGuardBuilder=void 0;var n=e(670),o=e(315),i=function(){function r(r,t,e,n){this.parent=r,this.storage=t,this.enable=e,this.require=n,this.name="",this.description="",n&&(this.enable=!0)}return r.create=function(t,e,o,i){return void 0===e&&(e=n.GdprStorage.Cookie),void 0===o&&(o=!1),void 0===i&&(i=!1),new r(t,e,o,i)},r.prototype.endGuard=function(){var r=this.require||this.enable,t=(0,o.makeGuard)(this.name,this.description,this.storage,this.require,r);return this.require&&t.makeRequired(),this.parent.guards.push(t),this.parent},r.prototype.withName=function(r){return this.edit((function(t){return t.name=r}))},r.prototype.withDescription=function(r){return this.edit((function(t){return t.description=r}))},r.prototype.enabled=function(){return this.edit((function(r){return r.enable=!0}))},r.prototype.disabled=function(){return this.edit((function(r){return r.enable=!1}))},r.prototype.storedIn=function(r){return this.edit((function(t){return t.storage=r}))},r.prototype.required=function(){return this.edit((function(r){return r.require=!0}))},r.prototype.edit=function(r){return r(this),this},r}();t.GdprGuardBuilder=i},237:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprManagerBuilder=void 0;var n=e(670),o=e(777),i=e(171),u=function(){function r(){this.storage=n.GdprStorage.Cookie,this.groups=[],this.bannerWasShown=!1}return r.make=function(){return new r},r.prototype.withBannerShown=function(r){void 0===r&&(r=!0),this.bannerWasShown=r},r.prototype.startGroup=function(r,t,e,n){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),void 0===n&&(n=!0),i.GdprGroupBuilder.create(this,t,e,r,n,!1)},r.prototype.startRequiredGroup=function(r,t,e){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),this.startEnabledGroup(r,t,e).required()},r.prototype.startEnabledGroup=function(r,t,e){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),this.startGroup(r,t,e,!0).enabled()},r.prototype.startDisabledGroup=function(r,t,e){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),this.startGroup(r,t,e,!1).disabled()},r.prototype.build=function(){var r=o.GdprManager.create(this.groups);return r.bannerWasShown=this.bannerWasShown,r},r.prototype.endGroup=function(){return this},r}();t.GdprManagerBuilder=u},171:function(r,t,e){var n=this&&this.__createBinding||(Object.create?function(r,t,e,n){void 0===n&&(n=e);var o=Object.getOwnPropertyDescriptor(t,e);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,o)}:function(r,t,e,n){void 0===n&&(n=e),r[n]=t[e]}),o=this&&this.__exportStar||function(r,t){for(var e in r)"default"===e||Object.prototype.hasOwnProperty.call(t,e)||n(t,r,e)};Object.defineProperty(t,"__esModule",{value:!0}),o(e(890),t),o(e(237),t),o(e(860),t)},93:function(r,t,e){var n=this&&this.__createBinding||(Object.create?function(r,t,e,n){void 0===n&&(n=e);var o=Object.getOwnPropertyDescriptor(t,e);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,o)}:function(r,t,e,n){void 0===n&&(n=e),r[n]=t[e]}),o=this&&this.__exportStar||function(r,t){for(var e in r)"default"===e||Object.prototype.hasOwnProperty.call(t,e)||n(t,r,e)};Object.defineProperty(t,"__esModule",{value:!0}),o(e(315),t),o(e(822),t),o(e(777),t),o(e(670),t),o(e(554),t),o(e(779),t),o(e(171),t),o(e(891),t),o(e(562),t),o(e(344),t)},562:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprDeserializer=void 0;var n=e(777),o=e(670),i=e(822),u=e(315),a=["enabled","groups"],s=["guards"],d=["name","enabled","required","description","storage"],c=function(){function r(){}return r.manager=function(r){var t=this;if(!function(r){return a.every((function(t){return t in r}))&&"boolean"==typeof r.enabled&&Array.isArray(r.groups)}(r))return null;var e=r.groups.map((function(r){return t.group(r)})).filter((function(r){return null!==r})),o=n.GdprManager.create([]);return o.enabled=!!r.enabled,o.bannerWasShown=!!r.bannerWasShown,e.forEach((function(r){return o.addGroup(r)})),o},r.group=function(r){var t=this,e=this.guard(r);if(null===e)return null;if(!function(r){return s.every((function(t){return t in r}))&&Array.isArray(r.guards)}(r))return null;var n=i.GdprGuardGroup.for(e.name,e.description,e.enabled,e.required),o=r.guards.map((function(r){return s.every((function(t){return t in r}))?t.group(r):t.guard(r)})).filter((function(r){return null!==r}));return o.forEach((function(r){return n.addGuard(r)})),n},r.guard=function(r){return function(r){return d.every((function(t){return t in r}))&&"string"==typeof r.name&&"boolean"==typeof r.enabled&&"boolean"==typeof r.required&&"string"==typeof r.description&&"number"==typeof r.storage&&r.storage in o.GdprStorage}(r)?(0,u.makeGuard)(r.name,r.description,r.storage,!!r.required,!!r.enabled):null},r}();t.GdprDeserializer=c},344:function(r,t){var e=this&&this.__awaiter||function(r,t,e,n){return new(e||(e=Promise))((function(o,i){function u(r){try{s(n.next(r))}catch(r){i(r)}}function a(r){try{s(n.throw(r))}catch(r){i(r)}}function s(r){var t;r.done?o(r.value):(t=r.value,t instanceof e?t:new e((function(r){r(t)}))).then(u,a)}s((n=n.apply(r,t||[])).next())}))},n=this&&this.__generator||function(r,t){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(s){return function(a){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(e=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(r,u)}catch(r){a=[6,r],n=0}finally{e=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.GdprSaviorAdapter=void 0;var o=function(){function r(){}return r.prototype.exists=function(r){return void 0===r&&(r=!0),e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.restore(r)];case 1:return[2,null!==t.sent()]}}))}))},r.prototype.storeIfNotExists=function(r){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.exists()];case 1:return[2,!!t.sent()||this.store(r)]}}))}))},r.prototype.restoreOrCreate=function(r){return e(this,void 0,void 0,(function(){var t,e;return n(this,(function(n){switch(n.label){case 0:return[4,this.restore()];case 1:return(t=n.sent())?[3,3]:[4,r()];case 2:return e=n.sent(),this.updateSharedManager(e),e.bannerWasShown&&e.closeBanner(),[2,e];case 3:return t.bannerWasShown&&t.closeBanner(),[2,t]}}))}))},r.prototype.check=function(){return e(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve()];case 1:return r.sent(),[4,this.exists(!0)];case 2:return r.sent(),[2]}}))}))},r}();t.GdprSaviorAdapter=o},891:(r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprSerializer=void 0;var e=function(){function r(){}return r.serialize=function(r){return r.raw()},r}();t.GdprSerializer=e},779:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.visitGdpr=void 0;var n=e(777),o=e(822);t.visitGdpr=function(r,e){var i=void 0===e?{}:e,u=i.onManager,a=void 0===u?function(){}:u,s=i.onGroup,d=void 0===s?function(){}:s,c=i.onGuard,p=void 0===c?function(){}:c,l=i.onEach,f=void 0===l?function(){}:l,h={onManager:a,onGroup:d,onGuard:p,onEach:f};r instanceof n.GdprManager?(a(r),f(r),r.getGroups().forEach((function(r){return(0,t.visitGdpr)(r,h)}))):r instanceof o.GdprGuardGroup?(d(r),f(r),r.getGuards().forEach((function(r){return(0,t.visitGdpr)(r,h)}))):(p(r),f(r))}}},t={};return function e(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return r[n].call(i.exports,i,i.exports,e),i.exports}(93)})())); | ||
!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("gdprGuard",[],t):"object"==typeof exports?exports.gdprGuard=t():r.gdprGuard=t()}("undefined"!=typeof self?self:"undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var r={315:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeGuard=void 0;var n=e(670);t.makeGuard=function(r,t,e,o,i){return void 0===e&&(e=n.GdprStorage.Cookie),void 0===o&&(o=!1),void 0===i&&(i=null),{name:r,description:t,storage:e,required:o,enabled:null===i?o:i,enable:function(){return this.enabled||this.toggle(),this},disable:function(){return this.enabled&&this.toggle(),this},toggle:function(){return this.required||(this.enabled=!this.enabled),this},makeRequired:function(){return this.required=!0,this.enabled=!0,this},isEnabled:function(r){return this.name===r&&this.enabled},enableForStorage:function(r){return this.enabled||this.toggleForStorage(r),this},disableForStorage:function(r){return this.enabled&&this.toggleForStorage(r),this},toggleForStorage:function(r){return!this.required&&this.storage&r&&this.toggle(),this},raw:function(){return JSON.parse(JSON.stringify(this))}}}},822:function(r,t,e){var n=this&&this.__read||function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,o,i=e.call(r),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},o=this&&this.__spreadArray||function(r,t,e){if(e||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return r.concat(n||Array.prototype.slice.call(t))},i=this&&this.__values||function(r){var t="function"==typeof Symbol&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&"number"==typeof r.length)return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.GdprGuardGroup=void 0;var u=e(670),a=function(){function r(r,t,e,n){void 0===t&&(t=""),void 0===e&&(e=!1),void 0===n&&(n=!1),this.name=r,this.description=t,this.enabled=e,this.required=n,this.storage=u.GdprStorage.None,this.bindings=new Map,this.required&&(this.enabled=!0)}return r.for=function(t,e,n,o){return void 0===e&&(e=""),void 0===n&&(n=!1),void 0===o&&(o=!1),new r(t,e,n,o)},r.prototype.addGuard=function(r){return this.bindings.set(r.name,r),this},r.prototype.hasGuard=function(r){return this.name===r||this.bindings.has(r)||this.reduceSubGroupsPred((function(t){return t.hasGuard(r)}))},r.prototype.getGuard=function(r){var t,e;return this.name===r?this:null!==(e=null!==(t=this.bindings.get(r))&&void 0!==t?t:this.reduceSubGroups((function(t){return t.getGuard(r)})))&&void 0!==e?e:null},r.prototype.isEnabled=function(r){if(this.hasGuard(r)){var t=this.getGuard(r);if(null!==t)return t.enabled}return!1},r.prototype.enable=function(){return this.required?this:(this.enabled=!0,this.doForEachGuard((function(r){return r.enable()})))},r.prototype.disable=function(){return this.required?this:(this.enabled=!1,this.doForEachGuard((function(r){return r.disable()})))},r.prototype.toggle=function(){return this.enabled?this.disable():this.enable()},r.prototype.makeRequired=function(){return this.required=!0,this.enabled=!0,this.doForEachGuard((function(r){return r.makeRequired()}))},r.prototype.enableForStorage=function(r){return this.required?this:this.doForEachGuard((function(t){t.enableForStorage(r)}))},r.prototype.disableForStorage=function(r){return this.required?this:this.doForEachGuard((function(t){t.disableForStorage(r)}))},r.prototype.toggleForStorage=function(r){return this.required?this:this.doForEachGuard((function(t){t.toggleForStorage(r)}))},r.prototype.raw=function(){var r={name:this.name,description:this.description,enabled:this.enabled,required:this.required,storage:this.storage,guards:[]};return r.guards=o([],n(this.bindings),!1).map((function(r){var t=n(r,2);return t[0],t[1].raw()})),r},r.prototype.doForEachGuard=function(r){return this.bindings.forEach((function(t){return r(t)})),this},r.prototype.reduceSubGroupsPred=function(t){var e,o;try{for(var u=i(this.bindings),a=u.next();!a.done;a=u.next()){var s=n(a.value,2),d=(s[0],s[1]);if(d instanceof r&&t(d))return!0}}catch(r){e={error:r}}finally{try{a&&!a.done&&(o=u.return)&&o.call(u)}finally{if(e)throw e.error}}return!1},r.prototype.reduceSubGroups=function(t){var e,o;try{for(var u=i(this.bindings),a=u.next();!a.done;a=u.next()){var s=n(a.value,2),d=(s[0],s[1]);if(d instanceof r){var c=t(d);if(c)return c}}}catch(r){e={error:r}}finally{try{a&&!a.done&&(o=u.return)&&o.call(u)}finally{if(e)throw e.error}}return null},r.prototype.getGuards=function(){return o([],n(this.bindings.values()),!1)},r}();t.GdprGuardGroup=a},777:function(r,t,e){var n=this&&this.__values||function(r){var t="function"==typeof Symbol&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&"number"==typeof r.length)return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,o,i=e.call(r),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},i=this&&this.__spreadArray||function(r,t,e){if(e||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return r.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.GdprManager=void 0;var u=e(822),a=e(670),s=e(554),d=e(779),c=function(){function r(){this.bannerWasShown=!1,this.enabled=!0,this.events=new s.GdprManagerEventHub,this.groups=new Map,this.name="manager",this.description="Manager of GDPR guard groups",this.storage=a.GdprStorage.None,this.required=!1}return r.create=function(t){void 0===t&&(t=[]);var e=new r;return t.forEach((function(r){return e.addGroup(r)})),e},r.prototype.closeBanner=function(){var r=this;this.bannerWasShown=!0,(0,d.visitGdpr)(this,{onEach:function(t){t.enabled?r.events.enable(t.name):r.events.disable(t.name)}})},r.prototype.resetAndShowBanner=function(){this.bannerWasShown=!1},r.prototype.createGroup=function(r,t){return void 0===t&&(t=""),this.addGroup(u.GdprGuardGroup.for(r,t))},r.prototype.addGroup=function(r){return this.groups.set(r.name,r),this},r.prototype.hasGuard=function(r){return this.reduceGroupsPred((function(t){return t.hasGuard(r)}))},r.prototype.getGuard=function(r){var t,e;try{for(var i=n(this.groups),u=i.next();!u.done;u=i.next()){var a=o(u.value,2),s=(a[0],a[1]);if(s.hasGuard(r))return s.getGuard(r)}}catch(r){t={error:r}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return null},r.prototype.hasGroup=function(r){return this.reduceGroupsPred((function(t){return t.name===r}))},r.prototype.getGroup=function(r){var t,e;try{for(var i=n(this.groups),u=i.next();!u.done;u=i.next()){var a=o(u.value,2),s=a[0],d=a[1];if(s===r)return d}}catch(r){t={error:r}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return null},r.prototype.isEnabled=function(r){return this.reduceGroupsPred((function(t){return t.isEnabled(r)}))},r.prototype.enable=function(){return this.enabled=!0,this.forEachGroup((function(r){return r.enable()}))},r.prototype.disable=function(){return this.enabled=!1,this.forEachGroup((function(r){return r.disable()}))},r.prototype.toggle=function(){return this.enabled?this.disable():this.enable()},r.prototype.makeRequired=function(){return this},r.prototype.enableForStorage=function(r){return this.forEachGroup((function(t){return t.enableForStorage(r)}))},r.prototype.disableForStorage=function(r){return this.forEachGroup((function(t){return t.disableForStorage(r)}))},r.prototype.toggleForStorage=function(r){return this.forEachGroup((function(t){return t.toggleForStorage(r)}))},r.prototype.raw=function(){var r={bannerWasShown:this.bannerWasShown,enabled:this.enabled,groups:[],name:this.name,description:this.description,storage:this.storage,required:this.required};return r.groups=i([],o(this.groups.values()),!1).map((function(r){return r.raw()})),r},r.prototype.reduceGroupsPred=function(r){var t,e;try{for(var i=n(this.groups),u=i.next();!u.done;u=i.next()){var a=o(u.value,2);if(a[0],r(a[1]))return!0}}catch(r){t={error:r}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return!1},r.prototype.forEachGroup=function(r){return this.groups.forEach((function(t){return r(t)})),this},r.prototype.getGroups=function(){return i([],o(this.groups.values()),!1)},r}();t.GdprManager=c},554:(r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprManagerEventHub=void 0;var e=function(){function r(){this.eventMap={}}return r.prototype.onEnable=function(r,t){return this.addListener("enable",r,t),this},r.prototype.onDisable=function(r,t){return this.addListener("disable",r,t),this},r.prototype.enable=function(r){return this.executeListeners("enable",r),this},r.prototype.disable=function(r){return this.executeListeners("disable",r),this},r.prototype.tagFor=function(r,t){return"".concat(r,"--").concat(t)},r.prototype.addListener=function(r,t,e){var n=this.tagFor(r,t);n in this.eventMap||(this.eventMap[n]=[]),this.eventMap[n].push(e)},r.prototype.executeListeners=function(r,t){var e,n=this.tagFor(r,t);null===(e=this.eventMap[n])||void 0===e||e.forEach((function(r){return r()}))},r}();t.GdprManagerEventHub=e},670:(r,t)=>{var e;Object.defineProperty(t,"__esModule",{value:!0}),t.GdprStorage=void 0,(e=t.GdprStorage||(t.GdprStorage={}))[e.None=1]="None",e[e.Cookie=2]="Cookie",e[e.LocalStorage=4]="LocalStorage",e[e.SessionStorage=8]="SessionStorage",e[e.IndexedDb=16]="IndexedDb",e[e.FileSystem=32]="FileSystem",e[e.ServerStorage=64]="ServerStorage",e[e.All=126]="All"},860:function(r,t,e){var n,o=this&&this.__extends||(n=function(r,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])},n(r,t)},function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=r}n(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),i=this&&this.__read||function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,o,i=e.call(r),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},u=this&&this.__spreadArray||function(r,t,e){if(e||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return r.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.GdprGroupBuilder=void 0;var a=e(670),s=e(237),d=e(822),c=e(890),p=function(r){function t(t,e,n,o,i,u){var a=r.call(this)||this;return a.parent=t,a.name=e,a.description=n,a.enable=i,a.require=u,a.guards=[],a.storage=o,u&&(a.enable=!0),a}return o(t,r),t.create=function(r,e,n,o,i,u){return void 0===n&&(n=""),void 0===o&&(o=null),void 0===i&&(i=!0),void 0===u&&(u=!1),new t(r,e,n,o||a.GdprStorage.Cookie,i,u)},t.prototype.startGroup=function(t,e,n){return void 0===t&&(t=null),void 0===e&&(e=""),void 0===n&&(n=""),r.prototype.startGroup.call(this,t||this.parent.storage,e,n)},t.prototype.startRequiredGroup=function(r,t,e){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),this.startGroup(r,t,e).required()},t.prototype.endGroup=function(){var r=this.require||this.enable,t=d.GdprGuardGroup.for(this.name,this.description,r,this.require);return u(u([],i(this.guards),!1),i(this.groups),!1).forEach((function(r){return t.addGuard(r)})),this.require&&t.makeRequired(),this.parent.groups.push(t),this.parent},t.prototype.withName=function(r){return this.edit((function(t){return t.name=r}))},t.prototype.withDescription=function(r){return this.edit((function(t){return t.description=r}))},t.prototype.storedIn=function(r){return this.edit((function(t){return t.storage=r}))},t.prototype.enabled=function(){return this.edit((function(r){return r.enable=!0}))},t.prototype.disabled=function(){return this.edit((function(r){return r.enable=!1}))},t.prototype.required=function(){return this.edit((function(r){return r.require=!0}))},t.prototype.startGuard=function(r){return void 0===r&&(r=null),c.GdprGuardBuilder.create(this,r||this.storage,this.enable)},t.prototype.startRequiredGuard=function(r){return this.startGuard(r).required()},t.prototype.withEnabledGuard=function(r,t,e){return void 0===t&&(t=""),void 0===e&&(e=null),this.startGuard(e).withName(r).withDescription(t).enabled().endGuard()},t.prototype.withDisabledGuard=function(r,t,e){return void 0===t&&(t=""),void 0===e&&(e=null),this.startGuard(e).withName(r).withDescription(t).disabled().endGuard()},t.prototype.edit=function(r){return r(this),this},t}(s.GdprManagerBuilder);t.GdprGroupBuilder=p},890:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprGuardBuilder=void 0;var n=e(670),o=e(315),i=function(){function r(r,t,e,n){this.parent=r,this.storage=t,this.enable=e,this.require=n,this.name="",this.description="",n&&(this.enable=!0)}return r.create=function(t,e,o,i){return void 0===e&&(e=n.GdprStorage.Cookie),void 0===o&&(o=!1),void 0===i&&(i=!1),new r(t,e,o,i)},r.prototype.endGuard=function(){var r=this.require||this.enable,t=(0,o.makeGuard)(this.name,this.description,this.storage,this.require,r);return this.require&&t.makeRequired(),this.parent.guards.push(t),this.parent},r.prototype.withName=function(r){return this.edit((function(t){return t.name=r}))},r.prototype.withDescription=function(r){return this.edit((function(t){return t.description=r}))},r.prototype.enabled=function(){return this.edit((function(r){return r.enable=!0}))},r.prototype.disabled=function(){return this.edit((function(r){return r.enable=!1}))},r.prototype.storedIn=function(r){return this.edit((function(t){return t.storage=r}))},r.prototype.required=function(){return this.edit((function(r){return r.require=!0}))},r.prototype.edit=function(r){return r(this),this},r}();t.GdprGuardBuilder=i},237:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprManagerBuilder=void 0;var n=e(670),o=e(777),i=e(171),u=function(){function r(){this.storage=n.GdprStorage.Cookie,this.groups=[],this.bannerWasShown=!1}return r.make=function(){return new r},r.prototype.withBannerShown=function(r){void 0===r&&(r=!0),this.bannerWasShown=r},r.prototype.startGroup=function(r,t,e,n){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),void 0===n&&(n=!0),i.GdprGroupBuilder.create(this,t,e,r,n,!1)},r.prototype.startRequiredGroup=function(r,t,e){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),this.startEnabledGroup(r,t,e).required()},r.prototype.startEnabledGroup=function(r,t,e){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),this.startGroup(r,t,e,!0).enabled()},r.prototype.startDisabledGroup=function(r,t,e){return void 0===r&&(r=null),void 0===t&&(t=""),void 0===e&&(e=""),this.startGroup(r,t,e,!1).disabled()},r.prototype.build=function(){var r=o.GdprManager.create(this.groups);return r.bannerWasShown=this.bannerWasShown,r},r.prototype.endGroup=function(){return this},r}();t.GdprManagerBuilder=u},171:function(r,t,e){var n=this&&this.__createBinding||(Object.create?function(r,t,e,n){void 0===n&&(n=e);var o=Object.getOwnPropertyDescriptor(t,e);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,o)}:function(r,t,e,n){void 0===n&&(n=e),r[n]=t[e]}),o=this&&this.__exportStar||function(r,t){for(var e in r)"default"===e||Object.prototype.hasOwnProperty.call(t,e)||n(t,r,e)};Object.defineProperty(t,"__esModule",{value:!0}),o(e(890),t),o(e(237),t),o(e(860),t)},93:function(r,t,e){var n=this&&this.__createBinding||(Object.create?function(r,t,e,n){void 0===n&&(n=e);var o=Object.getOwnPropertyDescriptor(t,e);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,o)}:function(r,t,e,n){void 0===n&&(n=e),r[n]=t[e]}),o=this&&this.__exportStar||function(r,t){for(var e in r)"default"===e||Object.prototype.hasOwnProperty.call(t,e)||n(t,r,e)};Object.defineProperty(t,"__esModule",{value:!0}),o(e(315),t),o(e(822),t),o(e(777),t),o(e(670),t),o(e(554),t),o(e(779),t),o(e(171),t),o(e(891),t),o(e(562),t),o(e(344),t)},562:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprDeserializer=void 0;var n=e(777),o=e(670),i=e(822),u=e(315),a=["enabled","groups"],s=["guards"],d=["name","enabled","required","description","storage"],c=function(){function r(){}return r.manager=function(r){var t=this;if(!function(r){return a.every((function(t){return t in r}))&&"boolean"==typeof r.enabled&&Array.isArray(r.groups)}(r))return null;var e=r.groups.map((function(r){return t.group(r)})).filter((function(r){return null!==r})),o=n.GdprManager.create([]);return o.enabled=!!r.enabled,o.bannerWasShown=!!r.bannerWasShown,e.forEach((function(r){return o.addGroup(r)})),o},r.group=function(r){var t=this,e=this.guard(r);if(null===e)return null;if(!function(r){return s.every((function(t){return t in r}))&&Array.isArray(r.guards)}(r))return null;var n=i.GdprGuardGroup.for(e.name,e.description,e.enabled,e.required),o=r.guards.map((function(r){return s.every((function(t){return t in r}))?t.group(r):t.guard(r)})).filter((function(r){return null!==r}));return o.forEach((function(r){return n.addGuard(r)})),n},r.guard=function(r){return function(r){return d.every((function(t){return t in r}))&&"string"==typeof r.name&&"boolean"==typeof r.enabled&&"boolean"==typeof r.required&&"string"==typeof r.description&&"number"==typeof r.storage&&r.storage in o.GdprStorage}(r)?(0,u.makeGuard)(r.name,r.description,r.storage,!!r.required,!!r.enabled):null},r}();t.GdprDeserializer=c},344:function(r,t){var e=this&&this.__awaiter||function(r,t,e,n){return new(e||(e=Promise))((function(o,i){function u(r){try{s(n.next(r))}catch(r){i(r)}}function a(r){try{s(n.throw(r))}catch(r){i(r)}}function s(r){var t;r.done?o(r.value):(t=r.value,t instanceof e?t:new e((function(r){r(t)}))).then(u,a)}s((n=n.apply(r,t||[])).next())}))},n=this&&this.__generator||function(r,t){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(s){return function(a){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(e=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(r,u)}catch(r){a=[6,r],n=0}finally{e=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.GdprSaviorAdapter=void 0;var o=function(){function r(r){void 0===r&&(r=void 0),this.decorator=r}return r.prototype.exists=function(r){return void 0===r&&(r=!0),e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.restore(r)];case 1:return[2,null!==t.sent()]}}))}))},r.prototype.storeIfNotExists=function(r){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.exists()];case 1:return[2,!!t.sent()||this.store(r)]}}))}))},r.prototype.restoreOrCreate=function(r){return e(this,void 0,void 0,(function(){var t,e,o,i;return n(this,(function(n){switch(n.label){case 0:return[4,this.restore()];case 1:return(t=n.sent())?[3,4]:[4,r()];case 2:return e=n.sent(),o=this.decorate(e),[4,this.updateSharedManager(o)];case 3:return n.sent(),o.bannerWasShown&&o.closeBanner(),[2,o];case 4:return(i=this.decorate(t)).bannerWasShown&&i.closeBanner(),[2,i]}}))}))},r.prototype.check=function(){return e(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,Promise.resolve()];case 1:return r.sent(),[4,this.exists(!0)];case 2:return r.sent(),[2]}}))}))},r.prototype.decorate=function(r){return this.decorator?this.decorator(r):r},r}();t.GdprSaviorAdapter=o},891:(r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GdprSerializer=void 0;var e=function(){function r(){}return r.serialize=function(r){return r.raw()},r}();t.GdprSerializer=e},779:(r,t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.visitGdpr=void 0;var n=e(777),o=e(822);t.visitGdpr=function(r,e){var i=void 0===e?{}:e,u=i.onManager,a=void 0===u?function(){}:u,s=i.onGroup,d=void 0===s?function(){}:s,c=i.onGuard,p=void 0===c?function(){}:c,l=i.onEach,f=void 0===l?function(){}:l,h={onManager:a,onGroup:d,onGuard:p,onEach:f};r instanceof n.GdprManager?(a(r),f(r),r.getGroups().forEach((function(r){return(0,t.visitGdpr)(r,h)}))):r instanceof o.GdprGuardGroup?(d(r),f(r),r.getGuards().forEach((function(r){return(0,t.visitGdpr)(r,h)}))):(p(r),f(r))}}},t={};return function e(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return r[n].call(i.exports,i,i.exports,e),i.exports}(93)})())); | ||
//# sourceMappingURL=gdpr_guard.js.map |
@@ -172,1 +172,6 @@ import { GdprGuard, GdprGuardRaw, GdprRawInto } from "./GdprGuard"; | ||
} | ||
/** | ||
* A function used to decorate a {@link GdprManager} instance | ||
* @see https://en.wikipedia.org/wiki/Decorator_pattern | ||
*/ | ||
export type GdprManagerDecorator = (manager: GdprManager) => GdprManager; |
@@ -1,2 +0,2 @@ | ||
import { GdprManager, GdprManagerRaw } from "../GdprManager"; | ||
import { GdprManager, GdprManagerDecorator, GdprManagerRaw } from "../GdprManager"; | ||
/** | ||
@@ -49,4 +49,10 @@ * Factory function for a GdprManager | ||
check(): Promise<void>; | ||
/** | ||
* Decorator API: Decorate the restored/created manager and use it | ||
*/ | ||
decorate?: GdprManagerDecorator; | ||
} | ||
export declare abstract class GdprSaviorAdapter implements GdprSavior { | ||
protected decorator: GdprManagerDecorator | undefined; | ||
constructor(decorator?: GdprManagerDecorator | undefined); | ||
/** | ||
@@ -87,2 +93,7 @@ * @inheritDoc | ||
check(): Promise<void>; | ||
/** | ||
* @inheritDoc | ||
* @override | ||
*/ | ||
decorate(manager: GdprManager): GdprManager; | ||
} |
{ | ||
"name": "gdpr-guard", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"author": "Voltra <ludwig.guerin.98@gmx.fr>", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Voltra/gdpr-guard#readme", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132920
1131