Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gdpr-guard

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gdpr-guard - npm Package Compare versions

Comparing version 2.2.8 to 2.3.0

.idea/jsLibraryMappings.xml

96

dist/builders/GdprGroupBuilder.d.ts

@@ -5,2 +5,8 @@ import { GdprStorage } from "../GdprStorage";

import { GdprGuardBuilder } from "./GdprGuardBuilder";
/**
* Builder for a gdpr group
* @class GdprGroupBuilder
* @extends {GdprManagerBuilder}
* @export
*/
declare class GdprGroupBuilder extends GdprManagerBuilder {

@@ -13,19 +19,109 @@ protected parent: GdprManagerBuilder;

guards: GdprGuard[];
/**
* @ignore
* @protected
*/
protected constructor(parent: GdprManagerBuilder, name: string, description: string, storage: GdprStorage, enable: boolean, require: boolean);
/**
* Factory for a group builder
* @static
* @param {GdprManagerBuilder} mb The parent manager builder
* @param {string} name The name of the group
* @param {string} [description] The description of the group
* @param {?GdprStorage} [storage] The storage of the group
* @param {boolean} [enabled=true] Whether or not the group should be enabled
* @param {boolean} [required=true] Whether or not the group should be required
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
static create(mb: GdprManagerBuilder, name: string, description?: string, storage?: GdprStorage | null, enabled?: boolean, required?: boolean): GdprGroupBuilder;
startGroup(storage?: GdprStorage | null, name?: string, description?: string): GdprGroupBuilder;
startRequiredGroup(storage?: GdprStorage | null, name?: string, description?: string): GdprGroupBuilder;
/**
* End the group using the current builder state
* @returns {GdprManagerBuilder}
* @memberof GdprGroupBuilder
*/
endGroup(): GdprManagerBuilder;
/**
* Set the name of the group
* @param {string} name The new name for the group
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
withName(name: string): GdprGroupBuilder;
/**
* Set the description of the group
* @param {string} description The new description for the group
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
withDescription(description: string): GdprGroupBuilder;
/**
* Set the storage of the group
* @param {GdprStorage} storage The new storage for the group
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
storedIn(storage: GdprStorage): GdprGroupBuilder;
/**
* Mark as enabled
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
enabled(): GdprGroupBuilder;
/**
* Mark as disabled
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
disabled(): GdprGroupBuilder;
/**
* Mark as required
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
required(): GdprGroupBuilder;
/**
* Start adding a guard
* @param {?GdprStorage} [storage] The storage for the guard (by default it uses the group's storage)
* @returns {GdprGuardBuilder}
* @memberof GdprGroupBuilder
*/
startGuard(storage?: GdprStorage | null): GdprGuardBuilder;
/**
* Start adding a required guard
* @param {?GdprStorage} [storage] The storage for the guard (by default it uses the group's storage)
* @returns {GdprGuardBuilder}
* @memberof GdprGroupBuilder
*/
startRequiredGuard(storage: GdprStorage | null): GdprGuardBuilder;
/**
* Add an enabled guard
* @param {string} name The name of the guard
* @param {string} [description] The description of the guard
* @param {?GdprStorage} [storage] The storage of the guard
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
withEnabledGuard(name: string, description?: string, storage?: GdprStorage | null): GdprGroupBuilder;
/**
* Add a disabled guard
* @param {string} name The name of the guard
* @param {string} [description] The description of the guard
* @param {?GdprStorage} [storage] The storage of the guard
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
withDisabledGuard(name: string, description?: string, storage?: GdprStorage | null): GdprGroupBuilder;
/**
* Edit the builder state
* @ignore
* @protected
* @param {(builder: GdprGroupBuilder) => any} cb
* @returns {GdprGroupBuilder}
* @memberof GdprGroupBuilder
*/
protected edit(cb: (builder: GdprGroupBuilder) => any): GdprGroupBuilder;
}
export { GdprGroupBuilder, };
import { GdprGroupBuilder } from "./builders";
import { GdprStorage } from "../GdprStorage";
/**
* Builder for a gdpr guard
* @class GdprGuardBuilder
* @export
*/
declare class GdprGuardBuilder {

@@ -10,13 +15,79 @@ protected parent: GdprGroupBuilder;

protected description: string;
/**
* Creates an instance of GdprGuardBuilder.
* @ignore
* @protected
* @param {GdprGroupBuilder} parent
* @param {GdprStorage} storage
* @param {boolean} enable
* @param {boolean} require
* @memberof GdprGuardBuilder
*/
protected constructor(parent: GdprGroupBuilder, storage: GdprStorage, enable: boolean, require: boolean);
/**
* Factory for creating a guard builder
* @static
* @param {GdprGroupBuilder} gb The parent group builder
* @param {GdprStorage} [storage=GdprStorage.Cookie] The guard's storage
* @param {boolean} [enabled=false] Whether or not the guard should be enabled
* @param {boolean} [required=false] Whether or not the guard should be required
* @returns {GdprGuardBuilder}
* @memberof GdprGuardBuilder
*/
static create(gb: GdprGroupBuilder, storage?: GdprStorage, enabled?: boolean, required?: boolean): GdprGuardBuilder;
/**
* End the guard creation with the current builder state
* @returns {GdprGroupBuilder}
* @memberof GdprGuardBuilder
*/
endGuard(): GdprGroupBuilder;
/**
* Set the name of the guard
* @param {string} name The new name for the guard
* @returns {GdprGuardBuilder}
* @memberof GdprGuardBuilder
*/
withName(name: string): GdprGuardBuilder;
/**
* Set the description of the guard
* @param {string} description The new description for the guard
* @returns {GdprGuardBuilder}
* @memberof GdprGuardBuilder
*/
withDescription(description: string): GdprGuardBuilder;
/**
* Mark as enabled
* @returns {GdprGuardBuilder}
* @memberof GdprGuardBuilder
*/
enabled(): GdprGuardBuilder;
/**
* Mark as disabled
* @returns {GdprGuardBuilder}
* @memberof GdprGuardBuilder
*/
disabled(): GdprGuardBuilder;
/**
* Set the storage of the guard
* @param {GdprStorage} storage The new storage for the guard
* @returns {GdprGuardBuilder}
* @memberof GdprGuardBuilder
*/
storedIn(storage: GdprStorage): GdprGuardBuilder;
/**
* Mark as required
* @returns {GdprGuardBuilder}
* @memberof GdprGuardBuilder
*/
required(): GdprGuardBuilder;
/**
* Edit the builder's state
* @ignore
* @protected
* @param {(builder: GdprGuardBuilder) => any} edit
* @returns {GdprGuardBuilder}
* @memberof GdprGuardBuilder
*/
protected edit(edit: (builder: GdprGuardBuilder) => any): GdprGuardBuilder;
}
export { GdprGuardBuilder, };

@@ -5,2 +5,7 @@ import { GdprGuardGroup } from "../GdprGuardGroup";

import { GdprGroupBuilder } from "./builders";
/**
* Builder for a GdprManager
* @class GdprManagerBuilder
* @export
*/
declare class GdprManagerBuilder {

@@ -10,11 +15,60 @@ storage: GdprStorage;

bannerWasShown: boolean;
/**
* Factory for a builder
* @static
* @returns {GdprManagerBuilder}
* @memberof GdprManagerBuilder
*/
static make(): GdprManagerBuilder;
withBannerShown(wasShown?: boolean): void;
/**
* Start a new group
* @param {?GdprStorage} [storage] The storage type of the group
* @param {string} [name] The name of the group
* @param {string} [description] The description of the group
* @param {boolean} [enabled=true] Whether or not the group is enabled
* @returns {GdprGroupBuilder}
* @memberof GdprManagerBuilder
*/
startGroup(storage?: GdprStorage | null, name?: string, description?: string, enabled?: boolean): GdprGroupBuilder;
/**
* Start a new group as required
* @param {?GdprStorage} [storage] The storage type of the group
* @param {string} [name] The name of the group
* @param {string} [description] The description of the group
* @returns {GdprGroupBuilder}
* @memberof GdprManagerBuilder
*/
startRequiredGroup(storage?: GdprStorage | null, name?: string, description?: string): GdprGroupBuilder;
/**
* Start a new enabled group
* @param {?GdprStorage} [storage] The storage type of the group
* @param {string} [name] The name of the group
* @param {string} [description] The description of the group
* @returns {GdprGroupBuilder}
* @memberof GdprManagerBuilder
*/
startEnabledGroup(storage?: GdprStorage | null, name?: string, description?: string): GdprGroupBuilder;
/**
* Start a new disabled group
* @param {?GdprStorage} [storage] The storage type of the group
* @param {string} [name] The name of the group
* @param {string} [description] The description of the group
* @returns {GdprGroupBuilder}
* @memberof GdprManagerBuilder
*/
startDisabledGroup(storage?: GdprStorage | null, name?: string, description?: string): GdprGroupBuilder;
/**
* Build the manager from the current builder state
* @returns {GdprManager}
* @memberof GdprManagerBuilder
*/
build(): GdprManager;
/**
* End this group's creation (no-op for manager builders)
* @returns {GdprManagerBuilder}
* @memberof GdprManagerBuilder
*/
endGroup(): GdprManagerBuilder;
}
export { GdprManagerBuilder, };

1

dist/gdpr_guard.d.ts

@@ -8,3 +8,4 @@ export * from "./GdprGuard";

export * from "./builders/builders";
export * from "./serde/GdprSerializer";
export * from "./serde/GdprDeserializer";
export * from "./serde/GdprSavior";

3

dist/gdpr_guard.js

@@ -1,1 +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.storage!=r||this.required||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:[]};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,function(r){r[r.None=1]="None",r[r.Cookie=2]="Cookie",r[r.LocalStorage=4]="LocalStorage",r[r.SessionStorage=8]="SessionStorage",r[r.IndexedDb=16]="IndexedDb",r[r.FileSystem=16]="FileSystem",r[r.ServerStorage=16]="ServerStorage",r[r.All=30]="All"}(e||(e={})),t.GdprStorage=e},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),l=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=l},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(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.length?(e.forEach((function(r){return o.addGroup(r)})),o):null},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)}(e))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.length?(o.forEach((function(r){return n.addGuard(r)})),n):null},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(){var r=this;return n(this,(function(t){switch(t.label){case 0:return[4,Promise.resolve()];case 1:return t.sent(),setTimeout((function(){r.exists(!0)}),100),[2]}}))}))},r}();t.GdprSaviorAdapter=o},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,l=void 0===c?function(){}:c,p=i.onEach,f=void 0===p?function(){}:p,h={onManager:a,onGroup:d,onGuard:l,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)}))):(l(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.storage!=r||this.required||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,function(r){r[r.None=1]="None",r[r.Cookie=2]="Cookie",r[r.LocalStorage=4]="LocalStorage",r[r.SessionStorage=8]="SessionStorage",r[r.IndexedDb=16]="IndexedDb",r[r.FileSystem=16]="FileSystem",r[r.ServerStorage=16]="ServerStorage",r[r.All=30]="All"}(e||(e={})),t.GdprStorage=e},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)})()));
//# sourceMappingURL=gdpr_guard.js.map
import { GdprStorage } from "./GdprStorage";
export interface GdprRawInto<RawRepr> {
raw(): RawRepr | object;
/**
* Raw/simple representation of this guard
*/
raw(): RawRepr;
}
/**
* Raw representation of a guard
*/
export interface GdprGuardRaw {

@@ -12,18 +18,86 @@ name: string;

}
/**
* Generic type representing a guard
*/
export interface GdprGuard extends GdprRawInto<GdprGuardRaw> {
/**
* Unique name of this guard
*/
readonly name: string;
/**
* Whether the guard is currently enabled
*/
enabled: boolean;
/**
* A description of what this guard does
*/
readonly description: string;
/**
* Where this guard is stored
*/
readonly storage: GdprStorage;
/**
* Whether this guard is required
*/
required: boolean;
/**
* Determine whether or not a guard is enabled
* @param name The name of the guard to look for
* @memberof GdprGuard
*/
isEnabled(name: string): boolean;
/**
* Enable this guard
* @returns this guard
* @memberof GdprGuard
*/
enable(): GdprGuard;
/**
* Disable this guard
* @returns this guard
* @memberof GdprGuard
*/
disable(): GdprGuard;
/**
* Toggle the enabled state of this guard
* @returns this guard
* @memberof GdprGuard
*/
toggle(): GdprGuard;
/**
* Make this guard required
* @returns this guard
* @memberof GdprGuard
*/
makeRequired(): GdprGuard;
/**
* Enable guards of the given type (this guard and sub-guards)
* @param type The storage type to enable all guards for
* @returns this guard
* @memberof GdprGuard
*/
enableForStorage(type: GdprStorage): GdprGuard;
/**
* Disable guards of the given type (this guard and sub-guards)
* @param type The storage type to enable all guards for
* @returns this guard
* @memberof GdprGuard
*/
disableForStorage(type: GdprStorage): GdprGuard;
/**
* Toggle guards of the given type (this guard and sub-guards)
* @param type The storage type to enable all guards for
* @returns this guard
* @memberof GdprGuard
*/
toggleForStorage(type: GdprStorage): GdprGuard;
raw(): object | GdprGuardRaw;
}
/**
* Factory for creating a guard
* @param name The unique name/identifier for this guard
* @param description The description of the guard
* @param storage Where the data will be stored
* @param required Whether or not it is a required guard
* @param enabled Whether or not it is currently enabled
*/
export declare function makeGuard(name: string, description: string, storage?: GdprStorage, required?: boolean, enabled?: boolean | null): GdprGuard;
import { GdprGuard } from "./GdprGuard";
/**
* An interface representing a collecion of guards
*/
export interface GdprGuardCollection extends GdprGuard {
/**
* Determine whether or not the collection has a given guard
* @param name The name of the guard to look for
* @returns TRUE if it is in its hierarchy, FALSE otherwise
* @memberof GdprGuardCollection
*/
hasGuard(name: string): boolean;
/**
* Retrieve a guard from the collection
* @param name being the name of the guard to retrieve
* @memberof GdprGuardCollection
*/
getGuard(name: string): GdprGuard | null;
}
import { GdprGuard, GdprGuardRaw, GdprRawInto } from "./GdprGuard";
import { GdprStorage } from "./GdprStorage";
import { GdprGuardCollection } from "./GdprGuardCollection";
/**
* Raw representation of a guard group
*/
export interface GdprGuardGroupRaw extends GdprGuardRaw {
guards: GdprGuardRaw[];
}
/**
* A group of guards
*/
export declare class GdprGuardGroup implements GdprGuardCollection, GdprRawInto<GdprGuardGroupRaw> {

@@ -13,21 +19,128 @@ name: string;

readonly storage: GdprStorage;
/**
* Binding from guard name to guard
* @protected
*/
protected bindings: Map<string, GdprGuard>;
/**
* Creates an instance of GdprGuardGroup.
* @ignore
* @param name
* @param [description]
* @param [enabled]
* @param [required]
* @memberof GdprGuardGroup
*/
constructor(name: string, description?: string, enabled?: boolean, required?: boolean);
/**
* Factory for creating a groupe
* @static
* @param name The name of the group
* @param [description] The description of the group
* @param [enabled=false] Whether or not the group is enabled by default
* @param [required=false] Whether or not the entire group is required
* @returns {GdprGuardGroup}
* @memberof GdprGuardGroup
*/
static for(name: string, description?: string, enabled?: boolean, required?: boolean): GdprGuardGroup;
/**
* Add a guard to this group
* @param {GdprGuard} guard
* @returns {GdprGuardGroup}
* @memberof GdprGuardGroup
*/
addGuard(guard: GdprGuard): GdprGuardGroup;
/**
* @inheritDoc
* @memberof GdprGuardGroup
*/
hasGuard(name: string): boolean;
/**
* @inheritDoc
* @memberof GdprGuardGroup
*/
getGuard(name: string): GdprGuard | null;
/**
* @inheritDoc
* @memberof GdprGuardGroup
*/
isEnabled(name: string): boolean;
/**
* @inheritDoc
* @override
* @memberof GdprGuardGroup
* @returns {GdprGuardGroup}
*/
enable(): GdprGuardGroup;
/**
* @inheritDoc
* @override
* @memberof GdprGuardGroup
* @returns {GdprGuardGroup}
*/
disable(): GdprGuardGroup;
/**
* @inheritDoc
* @override
* @memberof GdprGuardGroup
* @returns {GdprGuardGroup}
*/
toggle(): GdprGuardGroup;
/**
* @inheritDoc
* @override
* @memberof GdprGuardGroup
* @returns {GdprGuardGroup}
*/
makeRequired(): GdprGuardGroup;
/**
* @inheritDoc
* @override
* @memberof GdprGuardGroup
*/
enableForStorage(type: GdprStorage): GdprGuardGroup;
/**
* @inheritDoc
* @override
* @memberof GdprGuardGroup
*/
disableForStorage(type: GdprStorage): GdprGuardGroup;
/**
* @inheritDoc
* @override
* @memberof GdprGuardGroup
*/
toggleForStorage(type: GdprStorage): GdprGuardGroup;
/**
* @inheritDoc
* @override
* @memberof GdprGuardGroup
*/
raw(): GdprGuardGroupRaw;
/**
* Execute a callback on each guard of this group
* @ignore
* @protected
* @param cb
* @memberof GdprGuardGroup
*/
protected doForEachGuard(cb: (guard: GdprGuard) => any): GdprGuardGroup;
/**
* Shortcircuit on predicate
* @ignore
* @protected
* @param {(group: GdprGuardCollection) => boolean} pred
* @returns {boolean}
* @memberof GdprManager
*/
protected reduceSubGroupsPred(pred: (guard: GdprGuardGroup) => boolean): boolean;
/**
* Shortcircuit on finding a matching guard
* @ignore
* @protected
* @param extractor
* @memberof GdprManager
*/
protected reduceSubGroups(extractor: (guard: GdprGuardCollection & GdprGuard) => GdprGuard | null): GdprGuard | null;
getGuards(): GdprGuard[];
}

@@ -1,2 +0,2 @@

import { GdprGuard, GdprRawInto } from "./GdprGuard";
import { GdprGuard, GdprGuardRaw, GdprRawInto } from "./GdprGuard";
import { GdprGuardGroup, GdprGuardGroupRaw } from "./GdprGuardGroup";

@@ -6,3 +6,6 @@ import { GdprGuardCollection } from "./GdprGuardCollection";

import { GdprManagerEventHub } from "./GdprManagerEventHub";
export interface GdprManagerRaw {
/**
* Raw representation of a guard manager
*/
export interface GdprManagerRaw extends GdprGuardRaw {
bannerWasShown: boolean;

@@ -12,6 +15,22 @@ enabled: boolean;

}
/**
* Manage multiple guard groups
*/
export declare class GdprManager implements GdprGuardCollection, GdprRawInto<GdprManagerRaw> {
/**
* Whether the banner has already been shown to the user
*/
bannerWasShown: boolean;
/**
* Whether the whole manager is enabled
*/
enabled: boolean;
events: GdprManagerEventHub;
/**
* A hub to attach listeners to events triggered by this manager
*/
readonly events: GdprManagerEventHub;
/**
* A mapping from group name to the corresponding group
* @protected
*/
protected groups: Map<string, GdprGuardGroup>;

@@ -22,24 +41,134 @@ readonly name: string;

required: boolean;
/**
* Creates an instance of GdprManager.
* @memberof GdprManager
* @ignore
*/
protected constructor();
/**
* Factory for creating a gdpr manager
* @static
* @param {GdprGuardGroup[]} [groups=[]] The initial guard groups
* @returns {GdprManager}
* @memberof GdprManager
*/
static create(groups?: GdprGuardGroup[]): GdprManager;
/**
* Mark the GDPR banner as shown and trigger enable and disable events
*/
closeBanner(): void;
/**
* Reset the state of the GDPR banner and show it
*/
resetAndShowBanner(): void;
/**
* Create and add a group to this manager
* @param {string} name The new group's name
* @param {string} [description] The new group's description
* @returns {GdprManager}
* @memberof GdprManager
*/
createGroup(name: string, description?: string): GdprManager;
/**
* Add a group to this manager
* @param {GdprGuardGroup} category The group to add
* @returns {GdprManager}
* @memberof GdprManager
*/
addGroup(category: GdprGuardGroup): GdprManager;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
hasGuard(name: string): boolean;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
getGuard(name: string): GdprGuard | null;
/**
* @inheritDoc
* @memberof GdprManager
*/
hasGroup(name: string): boolean;
/**
* @inheritDoc
* @memberof GdprManager
*/
getGroup(name: string): GdprGuardGroup | null;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
isEnabled(name: string): boolean;
enable(): GdprManager;
disable(): GdprManager;
toggle(): GdprManager;
makeRequired(): GdprManager;
enableForStorage(type: GdprStorage): GdprManager;
disableForStorage(type: GdprStorage): GdprManager;
toggleForStorage(type: GdprStorage): GdprManager;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
enable(): GdprGuard;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
disable(): GdprGuard;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
toggle(): GdprGuard;
/**
* Does nothing for a manager
* @inheritDoc
* @override
* @memberof GdprManager
*/
makeRequired(): GdprGuard;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
enableForStorage(type: GdprStorage): GdprGuard;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
disableForStorage(type: GdprStorage): GdprGuard;
/**
* @inheritDoc
* @override
* @memberof GdprManager
*/
toggleForStorage(type: GdprStorage): GdprGuard;
/**
* @inheritDoc
* @override
* @memberof GdprManager
* @returns {GdprManagerRaw}
*/
raw(): GdprManagerRaw;
/**
* Shortcircuit on predicate
* @ignore
* @protected
* @param pred
* @memberof GdprManager
*/
protected reduceGroupsPred(pred: (group: GdprGuardGroup) => boolean): boolean;
/**
* Execute a callback on each group of this guard
* @ignore
* @protected
* @param cb
* @memberof GdprManager
*/
protected forEachGroup(cb: (group: GdprGuardGroup) => any): GdprManager;
getGroups(): GdprGuardGroup[];
}
export type GdprManagerEventHandler = () => void;
/**
* An event hub for a {@link GdprManager}'s events
*/
export declare class GdprManagerEventHub {
protected eventMap: Record<string, GdprManagerEventHandler[]>;
/**
* Attach a listener for when the given guard is enabled
* @param guardName - The name of the guard
* @param callback - The event listener
*/
onEnable(guardName: string, callback: GdprManagerEventHandler): this;
/**
* Attach a listener for when the given guard is disabled
* @param guardName - The guard's name
* @param callback - The event listener
*/
onDisable(guardName: string, callback: GdprManagerEventHandler): this;
/**
* Enable the given guard
* @param guardName - The guard's name
*/
enable(guardName: string): this;
/**
* Disable the given guard
* @param guardName - The guard's name
*/
disable(guardName: string): this;

@@ -8,0 +29,0 @@ protected tagFor(type: string, guardName: string): string;

@@ -0,11 +1,40 @@

/**
* The types of storage concerned by GDPR
* @enum {number}
* @export
*/
declare enum GdprStorage {
/**
* No storage
*/
None = 1,
/**
* Cookie-based storage
*/
Cookie = 2,
/**
* Storage in localStorage
*/
LocalStorage = 4,
/**
* Storage in sessionStorage
*/
SessionStorage = 8,
/**
* Storage in indexedDb
*/
IndexedDb = 16,
/**
* Storage on client-side filesystem
*/
FileSystem = 16,
/**
* Storage on server (session, DB, cloud, etc...)
*/
ServerStorage = 16,
/**
* All storage
*/
All = 30
}
export { GdprStorage, };

@@ -1,10 +0,35 @@

import { GdprManager } from "../GdprManager";
import { GdprGuardGroup } from "../GdprGuardGroup";
import { GdprGuard } from "../GdprGuard";
import { GdprManagerRaw } from "../../dist/GdprManager";
declare abstract class GdprDeserializer {
import { GdprManager, GdprManagerRaw } from "../GdprManager";
import { GdprGuardGroup, GdprGuardGroupRaw } from "../GdprGuardGroup";
import { GdprGuard, GdprGuardRaw } from "../GdprGuard";
/**
* Namespace-like class that allows deserialization from raw format
* @abstract
* @class GdprDeserializer
* @export
*/
export declare abstract class GdprDeserializer {
/**
* Deserialize a GdprManager from its raw representation
* @param raw The serialized manager
* @returns {?GdprManager}
* @static
* @memberof GdprDeserializer
*/
static manager(raw: GdprManagerRaw | any): GdprManager | null;
static group(raw: any): GdprGuardGroup | null;
static guard(raw: any): GdprGuard | null;
/**
* Deserialize a GdprGuardGroup from its raw representation
* @param {any} raw The serialized group
* @returns {?GdprGuardGroup}
* @static
* @memberof GdprDeserializer
*/
static group(raw: GdprGuardGroupRaw | any): GdprGuardGroup | null;
/**
* Deserialize a GdprGuard from its raw representation
* @param {any} raw The serialized guard
* @returns {?GdprGuard}
* @static
* @memberof GdprDeserializer
*/
static guard(raw: GdprGuardRaw | any): GdprGuard | null;
}
export { GdprDeserializer, };
import { GdprManager, GdprManagerRaw } from "../GdprManager";
/**
* Factory function for a GdprManager
* @typedef GdprManagerFactory
* @export
*/
export type GdprManagerFactory = () => Promise<GdprManager>;
/**
* Handle saving/restoring/checking semantics
* @interface GdprSavior
* @export
*/
export interface GdprSavior {
/**
* Restore the manager (saved state)
* @param shouldUpdate - Whether it should update its savior internals (should default to true)
*/
restore(shouldUpdate?: boolean): Promise<GdprManager | null>;
/**
* Determine whether there is already an existing manager (saved state)
* @param shouldUpdate - Whether it should update its savior internals (should default to true)
*/
exists(shouldUpdate?: boolean): Promise<boolean>;
/**
* Restore the manager or create one using the factory
* @param factory - Factory to create a manager (default manager state)
* @warning This should not store/save the manager before returning it
*/
restoreOrCreate(factory: GdprManagerFactory): Promise<GdprManager>;
/**
* Overwrite the saved state of the manager
* @param manager - The manager to store (state to save)
*/
store(manager: GdprManagerRaw): Promise<boolean>;
/**
* Store the manager state if none is already save
* @param manager - The manager to store (state to save)
*/
storeIfNotExists(manager: GdprManagerRaw): Promise<boolean>;
/**
* Handle shared state updates
* @param manager - The new manager to use
*/
updateSharedManager(manager: GdprManager): Promise<void>;
/**
* Check if there is an existing manager state (should rely on GdprSavior#exists)
*/
check(): Promise<void>;
}
export declare abstract class GdprSaviorAdapter implements GdprSavior {
/**
* @inheritDoc
* @override
*/
abstract restore(shouldUpdate?: boolean): Promise<GdprManager | null>;
/**
* @inheritDoc
* @override
*/
abstract store(manager: GdprManagerRaw): Promise<boolean>;
/**
* @inheritDoc
* @override
*/
abstract updateSharedManager(manager: GdprManager): Promise<void>;
/**
* @inheritDoc
* @override
*/
exists(shouldUpdate?: boolean): Promise<boolean>;
/**
* @inheritDoc
* @override
*/
storeIfNotExists(manager: GdprManagerRaw): Promise<boolean>;
/**
* @inheritDoc
* @override
*/
restoreOrCreate(factory: GdprManagerFactory): Promise<GdprManager>;
/**
* @inheritDoc
* @override
*/
check(): Promise<void>;
}
import { GdprGuard, GdprGuardRaw } from "../GdprGuard";
declare abstract class GdprSerializer {
/**
* A namespace-like class that allows serialization of gdpr objects
* @abstract
* @class GdprSerializer
* @export
*/
export declare class GdprSerializer {
/**
* Serialize a GdprGuard (or its subtypes) to its raw format (POD)
* @static
* @param {GdprGuard} obj The object to serialize
* @returns {(object|GdprGuardRaw)}
* @memberof GdprSerializer
*/
static serialize(obj: GdprGuard): object | GdprGuardRaw;
}
export { GdprSerializer, };

@@ -5,7 +5,28 @@ import { GdprGuard } from "./GdprGuard";

export interface GdprVisitor {
/**
* Callback for when you reach a manager in the tree
* @param manager The manager currently being visited
*/
onManager(manager: GdprManager): void;
/**
* Callback for when you reach a group in the tree
* @param group The group currently being visited
*/
onGroup(group: GdprGuardGroup): void;
/**
* Callback for when you reach a (leaf) guard in the tree
* @param guard The group currently being visited
*/
onGuard(guard: GdprGuard): void;
onEach(guard: GdprGuard): void;
/**
* Callback called on each item
* @param guard The guard currently being visited
*/
onEach(guard: GdprGuard | GdprManager): void;
}
export declare const visitGdpr: (guard: GdprGuard, { onManager, onGroup, onGuard, onEach, }?: Partial<GdprVisitor>) => void;
/**
* Visit the GDPR structure
* @param guard The root of the GDPR structure to visit
* @param {Partial<GdprVisitor>} visitor
*/
export declare const visitGdpr: (guard: GdprGuard | GdprManager, { onManager, onGroup, onGuard, onEach, }?: Partial<GdprVisitor>) => void;
{
"name": "gdpr-guard",
"version": "2.2.8",
"version": "2.3.0",
"author": "Voltra <ludwig.guerin.98@gmx.fr>",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/Voltra/gdpr-guard#readme",

@@ -120,3 +120,2 @@ # gdpr-guard

.make()
.withBannerShown(!!localStorage.getItem("gdpr_banner"))
.startRequiredGroup(GdprStorage.Cookie, "Functionalities", "Information purely used for the user's experience")

@@ -123,0 +122,0 @@ // This is a group that by default uses cookies for storage, every option and the group itself is required

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc