{"_id":"@adv-mt/motor-vendor-by-consents-loader","_rev":"22-cbde4ab4b7bf3ab7e88de0df4e6a43e8","name":"@adv-mt/motor-vendor-by-consents-loader","dist-tags":{"latest":"1.2.0"},"versions":{"1.1.0":{"name":"@adv-mt/motor-vendor-by-consents-loader","version":"1.1.0","keywords":[],"author":"","license":"ISC","_id":"@adv-mt/motor-vendor-by-consents-loader@1.1.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":"5404cb55d535c52ef643f6f38ca2f7076ca2398f","tarball":"https://registry.npmjs.org/@adv-mt/motor-vendor-by-consents-loader/-/motor-vendor-by-consents-loader-1.1.0.tgz","fileCount":16,"integrity":"sha512-194l4WPU0xPxaGjDEwYZRYh3tQ9LmD6uPb4EfPylfEhSi6XufKgtD4+ufX8gXMpNvbWhXtK+ZExnb2Np/H5heQ==","signatures":[{"sig":"MEUCICRnwn1WsY6sLumT6bjAkjOJ7jjdT+MzhZKSBu4MXr/6AiEAlkUwwni9TP4Tp87z4CT53W32xNoUq9Ldq9l1QhJjpq0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20425},"main":"lib/index.js","types":"types/index.d.ts","config":{"sui-mono":{"access":"public"}},"gitHead":"ea295d11706a1852e65054d9c71cf5ecf2faaec2","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","umd":"rm -rf umd && NODE_ENV=production sui-bundler lib src-umd/index.js -o umd -p https://unpkg.com/@adv-mt/motor-vendor-by-consents-loader@latest/umd/ --root","lint":"sui-lint js","test":"echo \"no test specified\"","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","updatelock":"npm update --package-lock-only --legacy-peer-deps --no-audit --no-fund --ignore-scripts --production=false","prepublishOnly":"npm run umd && npm run lib","security-checks":"vulcan-local -c vulcan.yaml"},"_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-motor--vendor-by-consents-loader.git","type":"git"},"_npmVersion":"10.9.2","description":"Load vendors according to the allowed user's consents","directories":{},"sideEffects":false,"_nodeVersion":"22.13.0","dependencies":{"@s-ui/js":"2"},"eslintConfig":{"extends":["./node_modules/@s-ui/lint/eslintrc.js"]},"_hasShrinkwrap":false,"devDependencies":{"@s-ui/lint":"4","@s-ui/mono":"2","typescript":"^5.7.3","@s-ui/bundler":"9","@s-ui/js-compiler":"1"},"_npmOperationalInternal":{"tmp":"tmp/motor-vendor-by-consents-loader_1.1.0_1738757715075_0.0545772122639816","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@adv-mt/motor-vendor-by-consents-loader","version":"1.2.0","keywords":[],"author":"","license":"ISC","_id":"@adv-mt/motor-vendor-by-consents-loader@1.2.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":"64ce1d7075fc0049f8ecf7c3b8282547b5e58467","tarball":"https://registry.npmjs.org/@adv-mt/motor-vendor-by-consents-loader/-/motor-vendor-by-consents-loader-1.2.0.tgz","fileCount":16,"integrity":"sha512-9mVIZhfnXlQZASHmILR7r6yQ+KKw6/ODZByc1HJiii17by1kv6XBGA84H0s+ldDWqXg3m8ZFL2n3hC1N29P33Q==","signatures":[{"sig":"MEUCIQDzAvt5XaYbzv1CN+ePVKxfWONusGcwghmwOb8hcYwgZAIgIdAsO6FnUtz75rU2pyyHW9C2AfLggYT5uOrRLetD6Tc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20633},"main":"lib/index.js","types":"types/index.d.ts","config":{"sui-mono":{"access":"public"}},"gitHead":"87022674c4e65394387e93874414bf5cd7b3721c","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","umd":"rm -rf umd && NODE_ENV=production sui-bundler lib src-umd/index.js -o umd -p https://unpkg.com/@adv-mt/motor-vendor-by-consents-loader@latest/umd/ --root","lint":"sui-lint js","test":"echo \"no test specified\"","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","updatelock":"npm update --package-lock-only --legacy-peer-deps --no-audit --no-fund --ignore-scripts --production=false","prepublishOnly":"npm run umd && npm run lib","security-checks":"vulcan-local -c vulcan.yaml"},"_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-motor--vendor-by-consents-loader.git","type":"git"},"_npmVersion":"10.9.2","description":"Load vendors according to the allowed user's consents","directories":{},"sideEffects":false,"_nodeVersion":"22.13.0","dependencies":{"@s-ui/js":"2"},"eslintConfig":{"extends":["./node_modules/@s-ui/lint/eslintrc.js"]},"_hasShrinkwrap":false,"devDependencies":{"@s-ui/lint":"4","@s-ui/mono":"2","typescript":"^5.7.3","@s-ui/bundler":"9","@s-ui/js-compiler":"1"},"_npmOperationalInternal":{"tmp":"tmp/motor-vendor-by-consents-loader_1.2.0_1738757751638_0.034781167919185174","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-02-05T12:15:15.006Z","modified":"2026-06-05T12:50:29.121Z","1.1.0":"2025-02-05T12:15:15.234Z","1.2.0":"2025-02-05T12:15:51.797Z"},"license":"ISC","keywords":[],"repository":{"url":"git@github.mpi-internal.com:adevinta-motor/frontend-motor--vendor-by-consents-loader.git","type":"git"},"description":"Load vendors according to the allowed user's consents","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":"# Vendor by Consents Loader\n\nSet of utilities to load vendors scripts according to user consents.\n\nYou only need to define `purposes` and `specialFeatureOptins` as they're the only configurable consents on the `tfc`.\n\n**🔴 IMPORTANT:** Before following the README, be sure you're loading the [Stub from Boros TCF](https://github.mpi-internal.com/scmspain/frontend-adit--uilib-boros-tcf/blob/master/components/stub/core/SCRIPT.md) as it's required.\n\n## Loading list of vendors\n\n```js\nimport {\n  initVendorConsentsLoader,\n  addVendorLoadedEventListener\n} from '@adv-mt/motor-vendor-by-consents-loader'\n\nconst OPTIMIZELY_KEY = 'optimizely'\n\ninitVendorConsentsLoader({\n  vendors: {\n    tealium: {\n      script: 'https://frtassets.fotocasa.es/external-scripts/utag-pro.js',\n      consents: {\n        purposes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n        specialFeatureOptins: [1]\n      }\n    },\n    [OPTIMIZELY_KEY]: {\n      script: 'https://frtassets.fotocasa.es/external-scripts/optimizely.js',\n      consents: {\n        purposes: [1, 2]\n      }\n    }\n  }\n})\n\naddVendorLoadedEventListener(({vendor}) => {\n  vendor === OPTIMIZELY_KEY && console.log('Optimizely has been loaded')\n})\n```\n\n## Loading a single vendor\n\nIn some cases you might want to load a single vendor later in your code:\n\n```js\nimport {\n  loadSingleVendorByConsent,\n  addVendorLoadedEventListener\n} from '@adv-mt/motor-vendor-by-consents-loader'\n\nconst GOOGLE_ADSENSE_KEY = 'google_adsense'\n\nloadSingleVendorByConsent({\n  name: GOOGLE_ADSENSE_KEY,\n  script: 'https://google.com/ads.js',\n  consents: {\n    purposes: [5, 6]\n  }\n})\n\naddVendorLoadedEventListener(({vendor}) => {\n  vendor === GOOGLE_ADSENSE_KEY && console.log('Google has been loaded')\n})\n```\n\nYou can also set a vendor configuration without an specific `script` in case the vendor doesn't require it to work:\n\n```js\nimport {\n  loadSingleVendorByConsent,\n  addVendorLoadedEventListener\n} from '@adv-mt/motor-vendor-by-consents-loader'\n\nconst RTB_HOUSE_KEY = 'rtb_house'\n\nloadSingleVendorByConsent({\n  name: RTB_HOUSE_KEY,\n  consents: {\n    purposes: [2, 6]\n  }\n})\n\naddVendorLoadedEventListener(({vendor}) => {\n  vendor === RTB_HOUSE_KEY && console.log('RTB House is ready')\n})\n```\n\n## Loading specific vendors\n\nSome vendors are used across all Adevinta Spain products and, for sake of convenience, they've their own script to load them.\n\n### Comscore\n\n```js\nimport {\n  addVendorLoadedEventListener,\n  loadComscore\n} from '@adv-mt/motor-vendor-by-consents-loader'\n\nloadComscore({comscoreClientId: '7109919'})\n\naddVendorLoadedEventListener(({vendor}) => {\n  vendor === 'comscore' && console.log('Comscore has been loaded')\n})\n```\n\n## Using it in Monolithic apps\n\n```html\n// First load the UMD module.\n<script src=\"https://unpkg.com/@adv-mt/motor-vendor-by-consents-loader/umd/index.js\"></script>\n<script>\n  // load comscore\n  window.sui.vendors.loadComscore({comscoreClientId: '7109919'})\n  // init vendors loader by consents\n  window.sui.vendors.initVendorConsentsLoader({\n    vendors: {\n      tealium: {\n        script: 'https://frtassets.fotocasa.es/external-scripts/utag-pro.js',\n        consents: {\n          purposes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n          specialFeatureOptins: [1]\n        }\n      }\n    }\n  })\n  // load a single vendor by consents\n  window.sui.vendors.loadSingleVendorByConsent({\n    name: 'google_adsense',\n    script: 'https://google.com/ads.js',\n    consents: {\n      purposes: [5, 6]\n    }\n  })\n  // add evento for listening comscore load\n  window.sui.vendors.addVendorLoadedEventListener(({vendor}) => {\n    vendor === 'comscore' && console.log('Comscore has been loaded')\n    vendor === 'tealium' && window._utag.init()\n    vendor === 'google_adsense' && window.gads.startAds()\n  })\n  //\n</script>\n```\n\n## List of Purposes\n\n**Purposes**:\n\n- 1 - Store and/or access information on a device\n- 2 - Select basic ads\n- 3 - Create a personalised ads profile\n- 4 - Select personalised ads\n- 5 - Create a personalised content profile\n- 6 - Select personalised content\n- 7 - Measure ad performance\n- 8 - Measure content performance\n- 9 - Apply market research to generate audience insights\n- 10 - Develop and improve products\n\n**Special Purposes**\n\n- SP1 - Ensure security, prevent fraud, and debug\n- SP2 - Technically deliver ads or content\n\n**Features**\n\n- F1 - Match and combine offline data sources\n- F2 - Link different devices\n- F3 - Receive and use automatically-sent device characteristics for identification\n\n**Special Features**\n\n- SF1 - Use precise geolocation data\n- SF2 - Actively scan device characteristics for identification\n","readmeFilename":"README.md"}