{"_id":"@adv-mt/motor-universal-consents-cookies-widget","_rev":"22-3090e4b49e97c5401d3a42e9bf12404e","name":"@adv-mt/motor-universal-consents-cookies-widget","dist-tags":{"latest":"1.9.0"},"versions":{"1.8.0":{"name":"@adv-mt/motor-universal-consents-cookies-widget","version":"1.8.0","keywords":[],"author":"","license":"ISC","_id":"@adv-mt/motor-universal-consents-cookies-widget@1.8.0","maintainers":[{"name":"francisco.ruiz.lloret","email":"francisco.ruiz@adevinta.com"},{"name":"pablo.rey-adevinta","email":"pablo.rey@adevinta.com"},{"name":"serena.mejias","email":"serena.mejias@adevinta.com"},{"name":"jordi.munoz","email":"jordi.munoz@adevinta.com"},{"name":"alex.castells","email":"alex.castells@adevinta.com"},{"name":"victor.perez.adevinta","email":"victor.perez@adevinta.com"},{"name":"luis-garrido","email":"luis.garrido@adevinta.com"},{"name":"ivanmlaborda","email":"ivan.martinez@adevinta.com"},{"name":"hpintos_adevinta","email":"hernan.pintos@adevinta.com"},{"name":"cristhianb","email":"cristhian.benitez@adevinta.com"},{"name":"adevinta-motor-frontend","email":"gp.es.dev.front.motor.scmspain.com@adevinta.com"},{"name":"davidmartin2108","email":"david.martin@adevinta.com"},{"name":"emiliovz","email":"emilio.villuendas@adevinta.com"},{"name":"ignacio_navarro","email":"ignacio.navarro@adevinta.com"},{"name":"nacho_torrella","email":"ignacio.torrella@adevinta.com"},{"name":"david.nieto","email":"david.nieto@adevinta.com"},{"name":"andresin87.adevinta","email":"andres.lucas@adevinta.com"},{"name":"xavi.murcia","email":"xavi.murcia@adevinta.com"},{"name":"nhowleyad","email":"natalie.howley.ext@adevinta.com"}],"dist":{"shasum":"6589adfc8b377826b22c07b9fb5b10e5ffd8485c","tarball":"https://registry.npmjs.org/@adv-mt/motor-universal-consents-cookies-widget/-/motor-universal-consents-cookies-widget-1.8.0.tgz","fileCount":21,"integrity":"sha512-n0iRE9woiWgoI5CdgDtk19n7/w/0IiHZjqUPDhg7MNK2D2lSInlhb+7sQvn30cx7CbEZj/5GIloGb7ofAeHb/A==","signatures":[{"sig":"MEUCIQD44aULTX+B9GDrG/slec6X4wbfZKitAymQ2m0R8O4HsQIgOxYM1RLcu3NyhzSlSFLURpQDZUBWc1TiEyEamsEzfak=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":741095},"main":"lib/app.js","config":{"sui-mono":{"access":"public"}},"gitHead":"c59295548fe457f48b07ad37c9914e2c79fa5508","scripts":{"ci":"npm ci --prefer-offline --no-audit --no-fund --production=false --ignore-scripts","co":"sui-mono commit","dev":"sui-bundler dev","lib":"npm run lib:js && npm run lib:scss","umd":"rm -rf umd && npm run umd:segment && npm run umd:withoutsegment","lint":"sui-lint js","test":"echo \"no test specified\"","build":"sui-bundler build","lib:js":"rm -rf ./lib && sui-js-compiler","fixlock":"npm install --package-lock-only --legacy-peer-deps --no-audit --no-fund --ignore-scripts --production=false","umd:dev":"NODE_ENV=development sui-bundler lib src-umd/index.js -o umd/ -p / --root --chunk-css","lib:scss":"node scripts/copy-scss-to-umd.js","updatelock":"npm update --package-lock-only --legacy-peer-deps --no-audit --no-fund --ignore-scripts --production=false","umd:segment":"NODE_ENV=production sui-bundler lib src-umd/index.js -o umd/ -p https://unpkg.com/@adv-ui/universal-consents-cookies-widget@latest/umd/ --root --chunk-css","prepublishOnly":"rm -rf ./public && npm run build && npm run umd && npm run lib","security-checks":"vulcan-local -c vulcan.yaml","umd:withoutsegment":"NODE_ENV=production sui-bundler lib src-umd/without-segment.js -o umd/without-segment -p https://unpkg.com/@adv-ui/universal-consents-cookies-widget@latest/umd/ --root --chunk-css"},"_npmUser":{"name":"adevinta-motor-frontend","email":"gp.es.dev.front.motor.scmspain.com@adevinta.com"},"prettier":"./node_modules/@s-ui/lint/.prettierrc.js","stylelint":{"extends":"./node_modules/@s-ui/lint/stylelint.config.js"},"repository":{"url":"git@github.mpi-internal.com:adevinta-motor/frontend-common--consents-cookies-widget-pack.git","type":"git"},"_npmVersion":"10.2.3","description":"## How to use?","directories":{},"_nodeVersion":"20.10.0","dependencies":{"react":"17","react-dom":"17","@s-ui/theme":"8","@didomi/react":"1.8.4","@adv-mt/mt-theme":"5","@adv-ui/ma-theme":"4","@s-ui/react-context":"1","@s-ui/react-atom-tag":"2","@s-ui/segment-wrapper":"3","@s-ui/react-atom-button":"1","@adv-mt/motor-vendor-by-consents-loader":"1"},"eslintConfig":{"extends":["./node_modules/@s-ui/lint/eslintrc.js"]},"_hasShrinkwrap":false,"devDependencies":{"glob":"10.3.10","@s-ui/lint":"4","@s-ui/mono":"2","@s-ui/bundler":"9","@s-ui/precommit":"2","@s-ui/js-compiler":"1"},"_npmOperationalInternal":{"tmp":"tmp/motor-universal-consents-cookies-widget_1.8.0_1738940676166_0.6795237421116562","host":"s3://npm-registry-packages-npm-production"}},"1.9.0":{"name":"@adv-mt/motor-universal-consents-cookies-widget","version":"1.9.0","keywords":[],"author":"","license":"ISC","_id":"@adv-mt/motor-universal-consents-cookies-widget@1.9.0","maintainers":[{"name":"francisco.ruiz.lloret","email":"francisco.ruiz@adevinta.com"},{"name":"pablo.rey-adevinta","email":"pablo.rey@adevinta.com"},{"name":"serena.mejias","email":"serena.mejias@adevinta.com"},{"name":"jordi.munoz","email":"jordi.munoz@adevinta.com"},{"name":"alex.castells","email":"alex.castells@adevinta.com"},{"name":"victor.perez.adevinta","email":"victor.perez@adevinta.com"},{"name":"luis-garrido","email":"luis.garrido@adevinta.com"},{"name":"ivanmlaborda","email":"ivan.martinez@adevinta.com"},{"name":"hpintos_adevinta","email":"hernan.pintos@adevinta.com"},{"name":"cristhianb","email":"cristhian.benitez@adevinta.com"},{"name":"adevinta-motor-frontend","email":"gp.es.dev.front.motor.scmspain.com@adevinta.com"},{"name":"davidmartin2108","email":"david.martin@adevinta.com"},{"name":"emiliovz","email":"emilio.villuendas@adevinta.com"},{"name":"ignacio_navarro","email":"ignacio.navarro@adevinta.com"},{"name":"nacho_torrella","email":"ignacio.torrella@adevinta.com"},{"name":"david.nieto","email":"david.nieto@adevinta.com"},{"name":"andresin87.adevinta","email":"andres.lucas@adevinta.com"},{"name":"xavi.murcia","email":"xavi.murcia@adevinta.com"},{"name":"nhowleyad","email":"natalie.howley.ext@adevinta.com"},{"name":"stivali.serna","email":"stivali.serna@adevinta.com"},{"name":"javiauso","email":"javier.auso@adevinta.com"},{"name":"lolaruf","email":"lola.rufino@adevinta.com"},{"name":"sabri-castelli","email":"sabrina.castelli@adevinta.com"},{"name":"tomasadevinta","email":"tomas.madariaga@adevinta.com"},{"name":"denis_z","email":"denis.zharenko.ext@adevinta.com"},{"name":"crotundu.adevinta","email":"cristian.rotundu.ext@adevinta.com"},{"name":"manuel.ochoa","email":"manuel.ochoa@adevinta.com"},{"name":"anya_ok","email":"anna.kholodenko.ext@adevinta.com"}],"dist":{"shasum":"585013d4e6614559600eb9589952a25c9f7c43fe","tarball":"https://registry.npmjs.org/@adv-mt/motor-universal-consents-cookies-widget/-/motor-universal-consents-cookies-widget-1.9.0.tgz","fileCount":21,"integrity":"sha512-hzlcBgGpCNQ2uWxF/J+RYWzLWqdOdPnXCPs/p4tDSb9rptWhdUeqIUGoznOYhB0nnj+0zX6LPYJ9H924FM6VRQ==","signatures":[{"sig":"MEUCIFA0Tf0Sb32nYAlYbW6Ygz4S/vjVGDuYx7aB1KBMN1T5AiEAwm3fPuxjFgxYYufqI23CDwwRE1yU8BZWowQ6j4H6X3o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":741119},"main":"lib/app.js","config":{"sui-mono":{"access":"public"}},"gitHead":"6a083d75782b735a5acf4e71215cf4346161f15e","scripts":{"ci":"npm ci --prefer-offline --no-audit --no-fund --production=false --ignore-scripts","co":"sui-mono commit","dev":"sui-bundler dev","lib":"npm run lib:js && npm run lib:scss","umd":"rm -rf umd && npm run umd:segment && npm run umd:withoutsegment","lint":"sui-lint js","test":"echo \"no test specified\"","build":"sui-bundler build","lib:js":"rm -rf ./lib && sui-js-compiler","fixlock":"npm install --package-lock-only --legacy-peer-deps --no-audit --no-fund --ignore-scripts --production=false","umd:dev":"NODE_ENV=development sui-bundler lib src-umd/index.js -o umd/ -p / --root --chunk-css","lib:scss":"node scripts/copy-scss-to-umd.js","updatelock":"npm update --package-lock-only --legacy-peer-deps --no-audit --no-fund --ignore-scripts --production=false","umd:segment":"NODE_ENV=production sui-bundler lib src-umd/index.js -o umd/ -p https://unpkg.com/@adv-mt/motor-universal-consents-cookies-widget@latest/umd/ --root --chunk-css","prepublishOnly":"rm -rf ./public && npm run build && npm run umd && npm run lib","security-checks":"vulcan-local -c vulcan.yaml","umd:withoutsegment":"NODE_ENV=production sui-bundler lib src-umd/without-segment.js -o umd/without-segment -p https://unpkg.com/@adv-mt/motor-universal-consents-cookies-widget@latest/umd/ --root --chunk-css"},"_npmUser":{"name":"adevinta-motor-frontend","email":"gp.es.dev.front.motor.scmspain.com@adevinta.com"},"prettier":"./node_modules/@s-ui/lint/.prettierrc.js","stylelint":{"extends":"./node_modules/@s-ui/lint/stylelint.config.js"},"repository":{"url":"git@github.mpi-internal.com:adevinta-motor/frontend-common--consents-cookies-widget-pack.git","type":"git"},"_npmVersion":"10.9.2","description":"## How to use?","directories":{},"_nodeVersion":"22.13.0","dependencies":{"react":"17","react-dom":"17","@s-ui/theme":"8","@didomi/react":"1.8.4","@adv-mt/mt-theme":"5","@adv-ui/ma-theme":"4","@s-ui/react-context":"1","@s-ui/react-atom-tag":"2","@s-ui/segment-wrapper":"3","@s-ui/react-atom-button":"1","@adv-mt/motor-vendor-by-consents-loader":"1"},"eslintConfig":{"extends":["./node_modules/@s-ui/lint/eslintrc.js"]},"_hasShrinkwrap":false,"devDependencies":{"glob":"10.3.10","@s-ui/lint":"4","@s-ui/mono":"2","@s-ui/bundler":"9","@s-ui/precommit":"2","@s-ui/js-compiler":"1"},"_npmOperationalInternal":{"tmp":"tmp/motor-universal-consents-cookies-widget_1.9.0_1741880315963_0.8592460294959872","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-02-07T15:04:36.084Z","modified":"2026-06-05T12:50:27.962Z","1.8.0":"2025-02-07T15:04:36.420Z","1.9.0":"2025-03-13T15:38:36.188Z"},"license":"ISC","keywords":[],"repository":{"url":"git@github.mpi-internal.com:adevinta-motor/frontend-common--consents-cookies-widget-pack.git","type":"git"},"description":"## How to use?","maintainers":[{"email":"francisco.ruiz@adevinta.com","name":"francisco.ruiz.lloret"},{"email":"daniel.cruz@adevinta.com","name":"dcross87"},{"email":"javier.lopezblasco@adevinta.com","name":"javier-lopezblasco_adevinta"},{"email":"manuel.pancorbo@adevinta.com","name":"manuel.pancorbo"},{"email":"javi.casado@adevinta.com","name":"javi-casado"},{"email":"maider.hernandorena@adevinta.com","name":"maider-hernandorena-adevinta"},{"email":"pablo.rey@adevinta.com","name":"pablo.rey-adevinta"},{"email":"serena.mejias@adevinta.com","name":"serena.mejias"},{"email":"jordi.munoz@adevinta.com","name":"jordi.munoz"},{"email":"alex.castells@adevinta.com","name":"alex.castells"},{"email":"victor.perez@adevinta.com","name":"victor.perez.adevinta"},{"email":"luis.garrido@adevinta.com","name":"luis-garrido"},{"email":"ivan.martinez@adevinta.com","name":"ivanmlaborda"},{"email":"hernan.pintos@adevinta.com","name":"hpintos_adevinta"},{"email":"cristhian.benitez@adevinta.com","name":"cristhianb"},{"email":"gp.es.dev.front.motor.scmspain.com@adevinta.com","name":"adevinta-motor-frontend"},{"email":"david.martin@adevinta.com","name":"davidmartin2108"},{"email":"emilio.villuendas@adevinta.com","name":"emiliovz"},{"email":"ignacio.navarro@adevinta.com","name":"ignacio_navarro"},{"email":"ignacio.torrella@adevinta.com","name":"nacho_torrella"},{"email":"david.nieto@adevinta.com","name":"david.nieto"},{"email":"andres.lucas@adevinta.com","name":"andresin87.adevinta"},{"email":"xavi.murcia@adevinta.com","name":"xavi.murcia"},{"email":"kirian.angles@adevinta.com","name":"kirian.motor"},{"email":"natalie.howley.ext@adevinta.com","name":"nhowleyad"},{"email":"stivali.serna@adevinta.com","name":"stivali.serna"},{"email":"javier.auso@adevinta.com","name":"javiauso"},{"email":"lola.rufino@adevinta.com","name":"lolaruf"},{"email":"sabrina.castelli@adevinta.com","name":"sabri-castelli"},{"email":"tomas.madariaga@adevinta.com","name":"tomasadevinta"},{"email":"denis.zharenko.ext@adevinta.com","name":"denis_z"},{"email":"cristian.rotundu.ext@adevinta.com","name":"crotundu.adevinta"},{"email":"manuel.ochoa@adevinta.com","name":"manuel.ochoa"},{"email":"anna.kholodenko.ext@adevinta.com","name":"anya_ok"},{"email":"rodrigo.mahamud.ext@adevinta.com","name":"rmg-adevinta"},{"email":"jorge.castro+npm_motor@adevinta.com","name":"jorge_castro_adevinta_npm_motor"},{"email":"hector.prieto.ext@adevinta.com","name":"hector-prieto-moreno"},{"email":"daniel.mellado@adevinta.com","name":"daniel.mellado"},{"email":"mario.gonzalez@adevinta.com","name":"mario.gonzalez.adevinta"}],"readme":"# @adv-mt/motor-universal-consents-cookies-widget\n\n## How to use?\n\nAdd the next code on the `<head>` of your website in order to show the Consent Cookies Widget in case it's needed for the user.\n\n```html\n<script type=\"text/javascript\">\n  ;(function () {\n    function i(e) {\n      if (!window.frames[e]) {\n        if (document.body && document.body.firstChild) {\n          var t = document.body\n          var n = document.createElement('iframe')\n          n.style.display = 'none'\n          n.name = e\n          n.title = e\n          t.insertBefore(n, t.firstChild)\n        } else {\n          setTimeout(function () {\n            i(e)\n          }, 5)\n        }\n      }\n    }\n    function e(n, o, r, f, s) {\n      function e(e, t, n, i) {\n        if (typeof n !== 'function') {\n          return\n        }\n        if (!window[o]) {\n          window[o] = []\n        }\n        var a = false\n        if (s) {\n          a = s(e, i, n)\n        }\n        if (!a) {\n          window[o].push({command: e, version: t, callback: n, parameter: i})\n        }\n      }\n      e.stub = true\n      e.stubVersion = 2\n      function t(i) {\n        if (!window[n] || window[n].stub !== true) {\n          return\n        }\n        if (!i.data) {\n          return\n        }\n        var a = typeof i.data === 'string'\n        var e\n        try {\n          e = a ? JSON.parse(i.data) : i.data\n        } catch (t) {\n          return\n        }\n        if (e[r]) {\n          var o = e[r]\n          window[n](\n            o.command,\n            o.version,\n            function (e, t) {\n              var n = {}\n              n[f] = {returnValue: e, success: t, callId: o.callId}\n              if (i.source) {\n                i.source.postMessage(a ? JSON.stringify(n) : n, '*')\n              }\n            },\n            o.parameter\n          )\n        }\n      }\n      if (typeof window[n] !== 'function') {\n        window[n] = e\n        if (window.addEventListener) {\n          window.addEventListener('message', t, false)\n        } else {\n          window.attachEvent('onmessage', t)\n        }\n      }\n    }\n    e('__tcfapi', '__tcfapiBuffer', '__tcfapiCall', '__tcfapiReturn')\n    i('__tcfapiLocator')\n  })()\n</script>\n<script defer src=\"https://unpkg.com/@adv-mt/motor-universal-consents-cookies-widget/umd/index.js\"></script>\n<link rel=\"stylesheet\" href=\"https://unpkg.com/@adv-mt/motor-universal-consents-cookies-widget/umd/styles.css\" />\n```\n\n‼️ Do not duplicate the first line(stub) several times. It's only needed once.\n\nAlso, you need to have a `div` element with the needed `id` where the widget will be rendered. Please, try to keep this div on the root level of your `body` in order to avoid problems with the modal.\n\n```html\n<div id=\"adevinta_consents_cookies_universal_widget\"></div>\n```\n\nWhen the user accepts or rejects it, the modal will disappear.\n\nCheck a working demo: https://codesandbox.io/s/long-star-62xc9?file=/index.html\n\n### Adding a link to open manually Consents Cookies Widget\n\nYou must offer to the user the possibility to open the widget to change the consents anytime. For that, you could add this HTML in order to give this feature to the user.\n\n```html\n<a href=\"#\" alt=\"Gestionar consentimientos de cookies\" onclick=\"window.__callUniversalConsentsCookiesWidget()\"\n  >Gestionar consentimientos de cookies</a\n>\n```\n\n## Configuration\n\nYou could config some aspects of the widget by using a window object called `universalConsentsCookiesWidget`.\n\n**Important:** Config should be placed BEFORE loading the widget.\n\n```html\n<script>\n  window.__mpi.universalConsentsCookiesWidget = {\n    cookiePolicyUrl: 'https://your-domain.com/cookie-policy?disable-cmp', // normally you don`t need it - it is configured in Didomi console\n    logo: 'https://your-domain.com/your-awesome-logo.png', // normally you don`t need it - it is configured in Didomi console\n    site: 'milanuncios'\n  }\n</script>\n<script defer src=\"https://unpkg.com/@adv-mt/motor-universal-consents-cookies-widget/umd/index.js\"></script>\n```\n\n**site**\nThe allowed sites are a map to resolve the notice id. Check [here](./src/settings.js)\n\nIf you consider that you need to add a new site(because some configuration is different than the vertical main site), please, contact with Advertising IT team on Slack channel `#es-advertising-it-help`.\n\n**cookiePolicyUrl**\n\n🚧 This is not working properly now. The cookie policy is set in the notice on the Didomi console.\n\n- if set, will add a link to the cookie policy page, openend in a new tab\n- use the `disable-cmp` query param to disable the CMP if it's included in the cookie policy page\n\n## Using Segment Wrapper\n\n**The widget comes with Segment Wrapper.** You only need to add the needed snippet for Segment SDK with the expected write key in order to use it. **This needs to be done before loading the widget.**\n\nAfter that, you could safely use the `window.sui.analytics` method in order to track with Segment Wrapper and it will send the correct tracking with the consents well informed.\n\nThis snippet should be placed **BEFORE** the one mentioned before.\n\n```html\n<script>\n  !(function () {\n    var analytics = (window.analytics = window.analytics || [])\n    if (!analytics.initialize)\n      if (analytics.invoked) window.console && console.error && console.error('Segment snippet included twice.')\n      else {\n        analytics.invoked = !0\n        analytics.methods = [\n          'trackSubmit',\n          'trackClick',\n          'trackLink',\n          'trackForm',\n          'pageview',\n          'identify',\n          'reset',\n          'group',\n          'track',\n          'ready',\n          'alias',\n          'debug',\n          'page',\n          'once',\n          'off',\n          'on'\n        ]\n        analytics.factory = function (t) {\n          return function () {\n            var e = Array.prototype.slice.call(arguments)\n            e.unshift(t)\n            analytics.push(e)\n            return analytics\n          }\n        }\n        for (var t = 0; t < analytics.methods.length; t++) {\n          var e = analytics.methods[t]\n          analytics[e] = analytics.factory(e)\n        }\n        analytics.load = function (t, e) {\n          var n = document.createElement('script')\n          n.type = 'text/javascript'\n          n.async = !0\n          n.src = 'https://cdn.segment.com/analytics.js/v1/' + t + '/analytics.min.js'\n          var a = document.getElementsByTagName('script')[0]\n          a.parentNode.insertBefore(n, a)\n          analytics._loadOptions = e\n        }\n        analytics.SNIPPET_VERSION = '4.1.0'\n\n        analytics.load('YOUR_WRITE_KEY') // your write key must be set here\n      }\n  })()\n</script>\n\n<script>\n  window.onload = () => {\n    window.sui.analytics.identify('your user id', {})\n    window.sui.analytics.track('Your Event', {})\n    window.sui.analytics.reset()\n  }\n</script>\n```\n\nYou could then use the config from Segment Wrapper. This should be placed before loading the widget.\n\n```\n<script>\n  window.__mpi = {\n    segmentWrapper: {\n      googleAdsPixelId: '1054970353',\n      facebookPixelId: '448176625351232',\n      importAdobeVisitorId: true,\n      defaultProperties: {\n        site: 'infojobs'\n      }\n    }\n  }\n</script>\n```\n\n## Load scripts for some consents\n\nOnce you have the consents widget implemented in your site, you'll be able to listen when the user has consented some purposes in order to load some specific tags.\n\nFor example, for adding loading tealium after user is giving consents you should do:\n\n```html\n<script>\n  // init vendors loader by consents\n  window.onload = () => {\n    window.sui.vendors.initVendorConsentsLoader({\n      vendors: {\n        tealium: {\n          // script to load\n          script: 'https://frtassets.fotocasa.es/external-scripts/utag-pro.js',\n          // consents needed for this script\n          consents: {\n            purposes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n            specialFeatureOptins: [1]\n          }\n        },\n        addThis: {\n          // script to load\n          script: 'https://www.addthis.com/script.js',\n          // consents needed for this script\n          consents: {\n            purposes: [1], // example of a script with a single purpose\n            specialFeatureOptins: [1]\n          }\n        }\n      }\n    })\n  }\n</script>\n```\n\nPlease, **keep in mind that if the user doesn't provide needed consents the script won't be loaded.**\n\n[Check list of purposes by ID.](https://github.mpi-internal.com/scmspain/frontend-all--vendor-by-consents-loader#list-of-purposes).\n","readmeFilename":"README.md"}