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

@consent-manager/core

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@consent-manager/core - npm Package Compare versions

Comparing version 0.0.1-next.8 to 0.0.1-next.9

6

CHANGELOG.md
# @consent-manager/core
## 0.0.1-next.9
### Patch Changes
- New design
## 0.0.1-next.8

@@ -4,0 +10,0 @@

2

dist/config.d.ts

@@ -16,3 +16,3 @@ /// <reference types="react" />

description: string;
category: 'statistics' | 'social';
category: string;
color?: string;

@@ -19,0 +19,0 @@ contrastColor?: string;

@@ -506,2 +506,3 @@ 'use strict';

exports.useDecision = useDecision;
exports.useDecisions = useDecisions;
exports.useEnabledIntegrations = useEnabledIntegrations;

@@ -508,0 +509,0 @@ exports.useFallbackComponent = useFallbackComponent;

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),t=e(n),r=e(require("react-use/esm/useSet")),o=require("wcag-contrast");function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function a(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(o[t]=e[t]);return o}function u(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function l(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return u(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var c=n.createContext({fallbackComponent:function(){return null},config:{integrations:[]},store:[{decisions:{}},function(){}]});function f(){return n.useContext(c).store}function s(){return n.useContext(c).config.integrations}function d(){var e=f(),t=s();return n.useMemo((function(){return function(e,n){for(var t,r,o=n[0],i=null!=(t=null==o?void 0:o.decisions)?t:{},a={},u=[],c=l(e);!(r=c()).done;){var f=r.value,s=i[f.id],d=s||void 0===s&&f.enabledByDefault;void 0===d&&u.push(f.id),a[f.id]=Boolean(d)}return{decisions:a,pending:u}}(t,e)}),[t,e])}function m(){var e=d().decisions,t=n.useState(e),r=t[0],o=t[1],a=f()[1];n.useEffect((function(){r!==e&&o((function(){return e}))}),[e,r,o,a]);var u=n.useCallback((function(e){var n="function"==typeof e?e(r):e;a((function(e){return i({},e,{decisions:n})}))}),[r,a]);return[r,u]}var p=function(e){var r=e.config,o=e.children,i=m()[0],a=n.useState(!1),u=a[0],l=a[1];n.useEffect((function(){return l(!0)}),[l]);var c=n.useMemo((function(){return u?r.integrations.filter((function(e){return!0===i[e.id]})).filter((function(e){return Boolean(e.WrapperComponent)})).map((function(e){return t.createElement(e.WrapperComponent,{key:e.id})})):null}),[r,i,u]);return t.createElement(t.Fragment,null,o,c)},g=function(e){var r=e.integrationId,o=e.fallbackUrl,i=a(e,["integrationId","fallbackUrl"]),u=b(r),l=h(r)[1],c=n.useCallback((function(){l(!0)}),[l]);if(!u)throw new Error('No integration found for "'+r+'"');var f=u.title,s=u.privacyPolicyUrl,d=u.Icon,m=u.description,p=u.color;return t.createElement("section",Object.assign({style:{backgroundColor:"#ddd",padding:"1rem 2rem",border:"4px solid #222"}},i),t.createElement("h1",{style:{display:"flex",alignItems:"center"}},d&&t.createElement(d,{"aria-hidden":"true",color:p,style:{width:"2rem",marginRight:"1rem"}}),f),m&&t.createElement("p",null,m),s&&t.createElement("p",null,t.createElement("a",{href:s,target:"_blank",rel:"noreferrer"},"Privacy policy of ",f)),t.createElement("button",{onClick:function(){return c()},style:{display:"block",margin:"0 auto"}},"Enable ",u.title),o&&t.createElement("p",null,"Alternative:",t.createElement("br",null),"Visit"," ",t.createElement("a",{href:o,target:"_blank",rel:"noreferrer"},o)))};function v(){var e=s(),t=m(),r=t[0],o=t[1],i=n.useMemo((function(){return e.filter((function(e){return Boolean(r[e.id])})).map((function(e){return e.id}))}),[e,r]),a=n.useCallback((function(n){for(var t,r="function"==typeof n?n(i):n,a={},u=l(e);!(t=u()).done;){var c=t.value,f=r.includes(c.id);a[c.id]=f}o(a)}),[i,e,o]);return[i,a]}function b(e){return s().find((function(n){return n.id===e}))}var y=function(e){var o=e.integrations,i=e.onSubmit,a=r(new Set(e.initialValues.enabled)),u=a[0],l=a[1],c=l.toggle,f=l.has,s=n.useCallback((function(e){c(e.target.value)}),[c]),d=n.useCallback((function(e){e.preventDefault();var n=Array.from(u.values());i({enabled:n})}),[u,i]);return t.createElement("form",{onSubmit:d},o.map((function(e){var n=e.id,r=e.title;return t.createElement("label",{key:n},t.createElement("input",{name:"enabled",type:"checkbox",value:n,onChange:s,checked:f(n)})," ",r)})),t.createElement("button",{type:"submit"},"Submit"))};function h(e){var n,t=m(),r=t[1],o=null!=(n=t[0][e])&&n;return[o,function(n){var t="function"==typeof n?n(o):n;r((function(n){var r;return i({},n,((r={})[e]=t,r))}))}]}function E(){return n.useContext(c).fallbackComponent||function(){return null}}exports.ConsentManager=function(e){var n=e.config,r=e.fallbackComponent;return t.createElement(c.Provider,{value:{fallbackComponent:void 0===r?g:r,config:n,store:e.store}},t.createElement(p,{config:n},e.children))},exports.ConsentManagerForm=function(e){var r=e.formComponent,o=a(e,["formComponent"]),i=v(),u=i[0],l=i[1],f=n.useContext(c).config.integrations,s=r||y,d=n.useCallback((function(e){l((function(){return e.enabled}))}),[l]);return t.createElement(s,Object.assign({integrations:f,initialValues:{enabled:u},onSubmit:d},o))},exports.PrivacyShield=function(e){var n=e.id,r=e.children,o=a(e,["id","children"]),i=h(n)[0],u=E();return i?t.createElement(t.Fragment,null,r):t.createElement(u,Object.assign({integrationId:n},o))},exports.createIconComponentFromSimpleIconsSvgPath=function(e,n){return function(r){var o=r.color,i=void 0===o?"currentColor":o,u=a(r,["color"]);return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:i,viewBox:"0 0 24 24",height:"100%",width:"100%"},u),t.createElement("title",null,e),t.createElement("path",{d:n}))}},exports.getForegroundColor=function(e){return o.hex(e,"#000")>=7?"#000":"#fff"},exports.useConsentFormVisible=function(){return 0!==(e=d().pending,null!=e?e:[]).length;var e},exports.useDecision=h,exports.useEnabledIntegrations=v,exports.useFallbackComponent=E,exports.useIntegration=b,exports.useIntegrations=s,exports.usePageViewEventTrigger=function(e){var t=h(e)[0],r=n.useContext(c).config.integrations.find((function(n){return n.id===e}));return t&&r&&"function"==typeof r.pageViewEventHandler?r.pageViewEventHandler:function(){}};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),t=e(n),r=e(require("react-use/esm/useSet")),o=require("wcag-contrast");function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function a(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(o[t]=e[t]);return o}function u(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function l(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return u(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var c=n.createContext({fallbackComponent:function(){return null},config:{integrations:[]},store:[{decisions:{}},function(){}]});function f(){return n.useContext(c).store}function s(){return n.useContext(c).config.integrations}function d(){var e=f(),t=s();return n.useMemo((function(){return function(e,n){for(var t,r,o=n[0],i=null!=(t=null==o?void 0:o.decisions)?t:{},a={},u=[],c=l(e);!(r=c()).done;){var f=r.value,s=i[f.id],d=s||void 0===s&&f.enabledByDefault;void 0===d&&u.push(f.id),a[f.id]=Boolean(d)}return{decisions:a,pending:u}}(t,e)}),[t,e])}function m(){var e=d().decisions,t=n.useState(e),r=t[0],o=t[1],a=f()[1];n.useEffect((function(){r!==e&&o((function(){return e}))}),[e,r,o,a]);var u=n.useCallback((function(e){var n="function"==typeof e?e(r):e;a((function(e){return i({},e,{decisions:n})}))}),[r,a]);return[r,u]}var p=function(e){var r=e.config,o=e.children,i=m()[0],a=n.useState(!1),u=a[0],l=a[1];n.useEffect((function(){return l(!0)}),[l]);var c=n.useMemo((function(){return u?r.integrations.filter((function(e){return!0===i[e.id]})).filter((function(e){return Boolean(e.WrapperComponent)})).map((function(e){return t.createElement(e.WrapperComponent,{key:e.id})})):null}),[r,i,u]);return t.createElement(t.Fragment,null,o,c)},g=function(e){var r=e.integrationId,o=e.fallbackUrl,i=a(e,["integrationId","fallbackUrl"]),u=b(r),l=h(r)[1],c=n.useCallback((function(){l(!0)}),[l]);if(!u)throw new Error('No integration found for "'+r+'"');var f=u.title,s=u.privacyPolicyUrl,d=u.Icon,m=u.description,p=u.color;return t.createElement("section",Object.assign({style:{backgroundColor:"#ddd",padding:"1rem 2rem",border:"4px solid #222"}},i),t.createElement("h1",{style:{display:"flex",alignItems:"center"}},d&&t.createElement(d,{"aria-hidden":"true",color:p,style:{width:"2rem",marginRight:"1rem"}}),f),m&&t.createElement("p",null,m),s&&t.createElement("p",null,t.createElement("a",{href:s,target:"_blank",rel:"noreferrer"},"Privacy policy of ",f)),t.createElement("button",{onClick:function(){return c()},style:{display:"block",margin:"0 auto"}},"Enable ",u.title),o&&t.createElement("p",null,"Alternative:",t.createElement("br",null),"Visit"," ",t.createElement("a",{href:o,target:"_blank",rel:"noreferrer"},o)))};function v(){var e=s(),t=m(),r=t[0],o=t[1],i=n.useMemo((function(){return e.filter((function(e){return Boolean(r[e.id])})).map((function(e){return e.id}))}),[e,r]),a=n.useCallback((function(n){for(var t,r="function"==typeof n?n(i):n,a={},u=l(e);!(t=u()).done;){var c=t.value,f=r.includes(c.id);a[c.id]=f}o(a)}),[i,e,o]);return[i,a]}function b(e){return s().find((function(n){return n.id===e}))}var y=function(e){var o=e.integrations,i=e.onSubmit,a=r(new Set(e.initialValues.enabled)),u=a[0],l=a[1],c=l.toggle,f=l.has,s=n.useCallback((function(e){c(e.target.value)}),[c]),d=n.useCallback((function(e){e.preventDefault();var n=Array.from(u.values());i({enabled:n})}),[u,i]);return t.createElement("form",{onSubmit:d},o.map((function(e){var n=e.id,r=e.title;return t.createElement("label",{key:n},t.createElement("input",{name:"enabled",type:"checkbox",value:n,onChange:s,checked:f(n)})," ",r)})),t.createElement("button",{type:"submit"},"Submit"))};function h(e){var n,t=m(),r=t[1],o=null!=(n=t[0][e])&&n;return[o,function(n){var t="function"==typeof n?n(o):n;r((function(n){var r;return i({},n,((r={})[e]=t,r))}))}]}function E(){return n.useContext(c).fallbackComponent||function(){return null}}exports.ConsentManager=function(e){var n=e.config,r=e.fallbackComponent;return t.createElement(c.Provider,{value:{fallbackComponent:void 0===r?g:r,config:n,store:e.store}},t.createElement(p,{config:n},e.children))},exports.ConsentManagerForm=function(e){var r=e.formComponent,o=a(e,["formComponent"]),i=v(),u=i[0],l=i[1],f=n.useContext(c).config.integrations,s=r||y,d=n.useCallback((function(e){l((function(){return e.enabled}))}),[l]);return t.createElement(s,Object.assign({integrations:f,initialValues:{enabled:u},onSubmit:d},o))},exports.PrivacyShield=function(e){var n=e.id,r=e.children,o=a(e,["id","children"]),i=h(n)[0],u=E();return i?t.createElement(t.Fragment,null,r):t.createElement(u,Object.assign({integrationId:n},o))},exports.createIconComponentFromSimpleIconsSvgPath=function(e,n){return function(r){var o=r.color,i=void 0===o?"currentColor":o,u=a(r,["color"]);return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:i,viewBox:"0 0 24 24",height:"100%",width:"100%"},u),t.createElement("title",null,e),t.createElement("path",{d:n}))}},exports.getForegroundColor=function(e){return o.hex(e,"#000")>=7?"#000":"#fff"},exports.useConsentFormVisible=function(){return 0!==(e=d().pending,null!=e?e:[]).length;var e},exports.useDecision=h,exports.useDecisions=m,exports.useEnabledIntegrations=v,exports.useFallbackComponent=E,exports.useIntegration=b,exports.useIntegrations=s,exports.usePageViewEventTrigger=function(e){var t=h(e)[0],r=n.useContext(c).config.integrations.find((function(n){return n.id===e}));return t&&r&&"function"==typeof r.pageViewEventHandler?r.pageViewEventHandler:function(){}};
//# sourceMappingURL=core.cjs.production.min.js.map

@@ -492,3 +492,3 @@ import React, { useContext, createContext, useState, useEffect, useCallback, useMemo } from 'react';

export { ConsentManager, ConsentManagerForm, PrivacyShield, createIconComponentFromSimpleIconsSvgPath, getForegroundColor, useConsentFormVisible, useDecision, useEnabledIntegrations, useFallbackComponent, useIntegration, useIntegrations, usePageViewEventTrigger };
export { ConsentManager, ConsentManagerForm, PrivacyShield, createIconComponentFromSimpleIconsSvgPath, getForegroundColor, useConsentFormVisible, useDecision, useDecisions, useEnabledIntegrations, useFallbackComponent, useIntegration, useIntegrations, usePageViewEventTrigger };
//# sourceMappingURL=core.esm.js.map

@@ -20,3 +20,3 @@ import React, { Dispatch, SetStateAction } from 'react';

export { ConsentManagerConfig, ConsentManagerDecisions };
export { useConsentFormVisible } from './decisions';
export { useConsentFormVisible, useDecisions } from './decisions';
export { ConsentManagerStorageState, ConsentManagerStateHook } from './storage';

@@ -23,0 +23,0 @@ export { ConsentManagerForm } from './components/ConsentManagerForm';

{
"name": "@consent-manager/core",
"version": "0.0.1-next.8",
"version": "0.0.1-next.9",
"description": "Get proper consent before tracking and processing data of your visitors via consent-manager. Supports you to get your website GDPR and CCPA compliant.",

@@ -61,3 +61,2 @@ "license": "MIT",

"react-use": "^15.3.4",
"tslib": "^2.0.0",
"wcag-contrast": "^3.0.0"

@@ -64,0 +63,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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