@adv-ui/vendor-by-consents-loader
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -43,3 +43,2 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
vendorConfig = _ref4[1]; | ||
console.log(vendorName, vendorConfig); | ||
var script = vendorConfig.script; | ||
@@ -46,0 +45,0 @@ loadScript(script).then(function () { |
{ | ||
"name": "@adv-ui/vendor-by-consents-loader", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Load vendors according to the allowed user's consents", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,1 +0,1 @@ | ||
!function(n){var e={};function o(t){if(e[t])return e[t].exports;var r=e[t]={i:t,l:!1,exports:{}};return n[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=n,o.c=e,o.d=function(n,e,t){o.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},o.r=function(n){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},o.t=function(n,e){if(1&e&&(n=o(n)),8&e)return n;if(4&e&&"object"===typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(o.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var r in n)o.d(t,r,function(e){return n[e]}.bind(null,r));return t},o.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return o.d(e,"a",e),e},o.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},o.p="true",o(o.s="phIc")}({phIc:function(n,e,o){"use strict";o.r(e);var t=function(n){return new Promise((function(e){var o=document.createElement("script");o.src=n,o.defer=!0,document.head.appendChild(o),o.addEventListener("load",e)}))},r=function(){return"undefined"!==typeof window},i={VENDOR_LOADED:"__mpi_vendor_loaded"};function d(n){var e=n.vendor;!function(n){var e,o=n.eventName,t=n.detail,r=void 0===t?{}:t;window.CustomEvent&&"function"===typeof window.CustomEvent?e=new window.CustomEvent(o,{detail:r}):(e=document.createEvent("CustomEvent")).initCustomEvent(o,!0,!0,r),window.document.dispatchEvent(e)}({eventName:i.VENDOR_LOADED,detail:{vendor:e}})}var s="loading",u={LOADED:"tcloaded",USER_ACTION_COMPLETE:"useractioncomplete",UI_SHOWN:"cmpuishown"},c=[u.USER_ACTION_COMPLETE,u.LOADED],a=function(){var n=r()&&!!window.__tcfapi;return!n&&console.warn("window.__tcfapi is not available"),n},v=function(n){var e=n.userConsents;return n.neededConsentsIds.every((function(n){return!0===e[n]}))},f=function(n){var e=void 0===n?{}:n,o=e.allowInconclusiveConsents,t=void 0!==o&&o,r=e.once,i=void 0!==r&&r;return function(n){var e;e=function(e,o){if(s!==e.cmpStatus){var r=e.eventStatus,d=e.listenerId,v=e.purpose.consents,f=t?Object.values(u):c;o&&f.includes(r)&&(n({purposeConsents:v}),i&&function(n){a()&&window.__tcfapi("removeEventListener",2,!1,n)}(d))}},a()&&window.__tcfapi("addEventListener",2,e)}},l=function(n){r()&&f()((function(e){var o=e.purposeConsents;n.map((function(n){var e=n.vendorConfig,t=n.vendorName;return function(n){var e=n.purposeConsents,o=n.vendorConfig,t=n.vendorName,r=o.consents.purposes;return v({userConsents:e,neededConsentsIds:void 0===r?[]:r})?[t,o]:[]}({purposeConsents:o,vendorConfig:e,vendorName:t})})).filter((function(n){return n.length})).forEach((function(n){var e=n[0],o=n[1];console.log(e,o);var r=o.script;t(r).then((function(){return d({vendor:e})}))}))}))};function p(){return(p=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(n[t]=o[t])}return n}).apply(this,arguments)}var m={c1:"2",cs_ucfr:"1"},w=[1,7,9,10],C=window;C.sui=C.sui||{},C.sui.vendors=C.sui.vendors||{addVendorLoadedEventListener:function(n,e){var o=(void 0===e?{}:e).once,t=void 0!==o&&o;if(r)return window.document.addEventListener(i.VENDOR_LOADED,d),s;function d(e){n(e.detail),t&&s()}function s(){window.document.removeEventListener(i.VENDOR_LOADED,d)}console.warn("Tried to call addVendorLoadedEventListener but you are not on the client")},initVendorConsentsLoader:function(n){var e,o,t=(void 0===n?{}:n).vendors;if(r()){if(t=t||(null==(e=window.__mpi)||null==(o=e.vendorByConsentsLoader)?void 0:o.vendors)){var i=Object.entries(t).map((function(n){var e=n[0];return{vendorConfig:n[1],vendorName:e}}));return l(i)}console.error("vendorByConsentsLoader not provided. Pass it by parameter or use window.__mpi config with vendorByConsentsLoader property.")}},loadComscore:function(n){var e=n.comscoreClientId;r?f({once:!0})((function(n){var o=n.purposeConsents;if(v({userConsents:o,neededConsentsIds:w}))return window._comscore=[p({},m,{c2:e})],t("https://sb.scorecardresearch.com/beacon.js").then((function(){return d({vendor:"comscore"}),!0}))})):console.warn("[vendor-by-consents-loader]: You can't loadComscore from the server")}}}}); | ||
!function(n){var e={};function o(t){if(e[t])return e[t].exports;var r=e[t]={i:t,l:!1,exports:{}};return n[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=n,o.c=e,o.d=function(n,e,t){o.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},o.r=function(n){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},o.t=function(n,e){if(1&e&&(n=o(n)),8&e)return n;if(4&e&&"object"===typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(o.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var r in n)o.d(t,r,function(e){return n[e]}.bind(null,r));return t},o.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return o.d(e,"a",e),e},o.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},o.p="true",o(o.s="phIc")}({phIc:function(n,e,o){"use strict";o.r(e);var t=function(n){return new Promise((function(e){var o=document.createElement("script");o.src=n,o.defer=!0,document.head.appendChild(o),o.addEventListener("load",e)}))},r=function(){return"undefined"!==typeof window},i={VENDOR_LOADED:"__mpi_vendor_loaded"};function d(n){var e=n.vendor;!function(n){var e,o=n.eventName,t=n.detail,r=void 0===t?{}:t;window.CustomEvent&&"function"===typeof window.CustomEvent?e=new window.CustomEvent(o,{detail:r}):(e=document.createEvent("CustomEvent")).initCustomEvent(o,!0,!0,r),window.document.dispatchEvent(e)}({eventName:i.VENDOR_LOADED,detail:{vendor:e}})}var u="loading",s={LOADED:"tcloaded",USER_ACTION_COMPLETE:"useractioncomplete",UI_SHOWN:"cmpuishown"},c=[s.USER_ACTION_COMPLETE,s.LOADED],a=function(){var n=r()&&!!window.__tcfapi;return!n&&console.warn("window.__tcfapi is not available"),n},v=function(n){var e=n.userConsents;return n.neededConsentsIds.every((function(n){return!0===e[n]}))},f=function(n){var e=void 0===n?{}:n,o=e.allowInconclusiveConsents,t=void 0!==o&&o,r=e.once,i=void 0!==r&&r;return function(n){var e;e=function(e,o){if(u!==e.cmpStatus){var r=e.eventStatus,d=e.listenerId,v=e.purpose.consents,f=t?Object.values(s):c;o&&f.includes(r)&&(n({purposeConsents:v}),i&&function(n){a()&&window.__tcfapi("removeEventListener",2,!1,n)}(d))}},a()&&window.__tcfapi("addEventListener",2,e)}},l=function(n){r()&&f()((function(e){var o=e.purposeConsents;n.map((function(n){var e=n.vendorConfig,t=n.vendorName;return function(n){var e=n.purposeConsents,o=n.vendorConfig,t=n.vendorName,r=o.consents.purposes;return v({userConsents:e,neededConsentsIds:void 0===r?[]:r})?[t,o]:[]}({purposeConsents:o,vendorConfig:e,vendorName:t})})).filter((function(n){return n.length})).forEach((function(n){var e=n[0],o=n[1].script;t(o).then((function(){return d({vendor:e})}))}))}))};function p(){return(p=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(n[t]=o[t])}return n}).apply(this,arguments)}var m={c1:"2",cs_ucfr:"1"},w=[1,7,9,10],C=window;C.sui=C.sui||{},C.sui.vendors=C.sui.vendors||{addVendorLoadedEventListener:function(n,e){var o=(void 0===e?{}:e).once,t=void 0!==o&&o;if(r)return window.document.addEventListener(i.VENDOR_LOADED,d),u;function d(e){n(e.detail),t&&u()}function u(){window.document.removeEventListener(i.VENDOR_LOADED,d)}console.warn("Tried to call addVendorLoadedEventListener but you are not on the client")},initVendorConsentsLoader:function(n){var e,o,t=(void 0===n?{}:n).vendors;if(r()){if(t=t||(null==(e=window.__mpi)||null==(o=e.vendorByConsentsLoader)?void 0:o.vendors)){var i=Object.entries(t).map((function(n){var e=n[0];return{vendorConfig:n[1],vendorName:e}}));return l(i)}console.error("vendorByConsentsLoader not provided. Pass it by parameter or use window.__mpi config with vendorByConsentsLoader property.")}},loadComscore:function(n){var e=n.comscoreClientId;r?f({once:!0})((function(n){var o=n.purposeConsents;if(v({userConsents:o,neededConsentsIds:w}))return window._comscore=[p({},m,{c2:e})],t("https://sb.scorecardresearch.com/beacon.js").then((function(){return d({vendor:"comscore"}),!0}))})):console.warn("[vendor-by-consents-loader]: You can't loadComscore from the server")}}}}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21859
294