@schibsted/advertory 2.59.0 → 2.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/core/aftenposten/es/index.css +1 -1
  2. package/core/aftenposten/es/index.d.ts +0 -6
  3. package/core/aftenposten/es/index.js +1 -1
  4. package/core/aftenposten/index.d.ts +0 -6
  5. package/core/aftenposten/index.js +1 -1
  6. package/core/aftonbladet/es/index.d.ts +0 -6
  7. package/core/aftonbladet/es/index.js +1 -1
  8. package/core/aftonbladet/index.d.ts +0 -6
  9. package/core/aftonbladet/index.js +1 -1
  10. package/core/aftonbladetv2/es/index.css +1 -1
  11. package/core/aftonbladetv2/es/index.d.ts +0 -6
  12. package/core/aftonbladetv2/es/index.js +1 -1
  13. package/core/bt/es/index.css +1 -1
  14. package/core/bt/es/index.d.ts +0 -6
  15. package/core/bt/es/index.js +1 -1
  16. package/core/bt/index.d.ts +0 -6
  17. package/core/bt/index.js +1 -1
  18. package/core/e24/es/index.css +1 -1
  19. package/core/e24/es/index.d.ts +0 -6
  20. package/core/e24/es/index.js +1 -1
  21. package/core/e24/index.d.ts +0 -6
  22. package/core/e24/index.js +1 -1
  23. package/core/e24v2/es/index.css +1 -1
  24. package/core/e24v2/es/index.d.ts +0 -6
  25. package/core/e24v2/es/index.js +1 -1
  26. package/core/fotbollskanalen/es/index.css +1 -1
  27. package/core/fotbollskanalen/es/index.d.ts +0 -6
  28. package/core/fotbollskanalen/es/index.js +1 -1
  29. package/core/fotbollskanalen/index.d.ts +0 -6
  30. package/core/fotbollskanalen/index.js +1 -1
  31. package/core/godare/index.d.ts +0 -6
  32. package/core/godare/index.js +1 -1
  33. package/core/godt/index.d.ts +0 -6
  34. package/core/godt/index.js +1 -1
  35. package/core/klart/index.d.ts +0 -6
  36. package/core/klart/index.js +1 -1
  37. package/core/koket/es/index.css +1 -1
  38. package/core/koket/es/index.d.ts +0 -6
  39. package/core/koket/es/index.js +1 -1
  40. package/core/koket/index.d.ts +0 -6
  41. package/core/koket/index.js +1 -1
  42. package/core/kompakt/index.d.ts +0 -6
  43. package/core/kompakt/index.js +1 -1
  44. package/core/minmote/index.d.ts +0 -6
  45. package/core/minmote/index.js +1 -1
  46. package/core/pent/index.d.ts +0 -6
  47. package/core/pent/index.js +1 -1
  48. package/core/sa/es/index.css +1 -1
  49. package/core/sa/es/index.d.ts +0 -6
  50. package/core/sa/es/index.js +1 -1
  51. package/core/sa/index.d.ts +0 -6
  52. package/core/sa/index.js +1 -1
  53. package/core/svd/es/index.css +1 -1
  54. package/core/svd/es/index.d.ts +0 -6
  55. package/core/svd/es/index.js +1 -1
  56. package/core/svd/index.d.ts +0 -6
  57. package/core/svd/index.js +1 -1
  58. package/core/svdv2/es/index.css +1 -1
  59. package/core/svdv2/es/index.d.ts +0 -6
  60. package/core/svdv2/es/index.js +1 -1
  61. package/core/tek/index.d.ts +0 -6
  62. package/core/tek/index.js +1 -1
  63. package/core/tv4/es/index.d.ts +0 -6
  64. package/core/tv4/es/index.js +1 -1
  65. package/core/tv4/index.d.ts +0 -6
  66. package/core/tv4/index.js +1 -1
  67. package/core/tvnu/index.d.ts +0 -6
  68. package/core/tvnu/index.js +1 -1
  69. package/core/vg/es/index.css +1 -1
  70. package/core/vg/es/index.d.ts +0 -6
  71. package/core/vg/es/index.js +1 -1
  72. package/core/vg/index.d.ts +0 -6
  73. package/core/vg/index.js +1 -1
  74. package/core/vgv2/es/index.css +1 -1
  75. package/core/vgv2/es/index.d.ts +0 -6
  76. package/core/vgv2/es/index.js +1 -1
  77. package/features/ad-native/index.d.ts +0 -6
  78. package/features/brandmetrics/index.js +1 -1
  79. package/features/dr-edition/es/index.d.ts +1 -6
  80. package/features/dr-edition/es/index.js +1 -1
  81. package/features/dr-edition/index.d.ts +1 -6
  82. package/features/dr-edition/index.js +1 -1
  83. package/features/glimr/index.js +1 -1
  84. package/features/tracker/index.d.ts +0 -6
  85. package/features/tracker/index.js +1 -1
  86. package/package.json +1 -1
  87. package/sites/aftenposten/es/index.css +1 -1
  88. package/sites/aftonbladet/es/index.css +1 -1
  89. package/sites/aftonbladetv2/es/index.css +1 -1
  90. package/sites/bt/es/index.css +1 -1
  91. package/sites/e24/es/index.css +1 -1
  92. package/sites/e24v2/es/index.css +1 -1
  93. package/sites/fotbollskanalen/es/index.css +1 -1
  94. package/sites/sa/es/index.css +1 -1
  95. package/sites/svd/es/index.css +1 -1
  96. package/sites/svdv2/es/index.css +1 -1
  97. package/sites/tv4/es/index.css +1 -1
  98. package/sites/vg/es/index.css +1 -1
  99. package/sites/vgv2/es/index.css +1 -1
  100. package/types/core/handlers/tcf/consent.d.ts +2 -1
  101. package/types/core/handlers/tcf/index.d.ts +2 -1
  102. package/types/core/interface/config.d.ts +0 -6
  103. package/types/features/dr-edition/composition.d.ts +1 -1
  104. package/types/features/dr-edition/dr-edition-service.d.ts +1 -1
  105. package/types/features/dr-edition/observer.d.ts +1 -1
  106. package/types/features/dr-edition/types.d.ts +1 -0
  107. package/types/tests/types.d.ts +1 -2
  108. package/types/features/interface/privacy-broker.d.ts +0 -16
  109. package/types/features/privacy-broker/constants.d.ts +0 -2
  110. package/types/features/privacy-broker/fetch-permissions.d.ts +0 -3
  111. package/types/features/privacy-broker/fetch-permissions.test.d.ts +0 -1
  112. package/types/features/privacy-broker/index.d.ts +0 -2
  113. package/types/features/privacy-broker/permissions.d.ts +0 -3
  114. package/types/features/privacy-broker/permissions.test.d.ts +0 -1
  115. package/types/features/privacy-broker/session-storage.d.ts +0 -7
  116. package/types/features/privacy-broker/session-storage.test.d.ts +0 -1
  117. /package/types/features/{privacy-broker → identity}/get-identity-object.d.ts +0 -0
  118. /package/types/features/{privacy-broker → identity}/identity-facade.d.ts +0 -0
  119. /package/types/features/{privacy-broker → identity}/identity-facade.test.d.ts +0 -0
@@ -248,7 +248,6 @@ interface SiteConfig {
248
248
  norstat?: NorstatConfig;
249
249
  siteSpecificConfig?: SiteSpecificConfig;
250
250
  sponsorstripe?: SponsorstripeConfig;
251
- privacyBroker?: PrivacyBrokerConfig;
252
251
  drEdition?: DrEditionConfig;
253
252
  kilkaya?: KilkayaConfig;
254
253
  forwardExternalImpId?: boolean;
@@ -466,11 +465,6 @@ interface RightColumnSplitConfig {
466
465
  adSelector: string;
467
466
  trackSelector?: string;
468
467
  }
469
- interface PrivacyBrokerConfig {
470
- enabled: boolean;
471
- clientId: string;
472
- storageKeyPrefix: string;
473
- }
474
468
  interface KilkayaConfig {
475
469
  enabled: boolean;
476
470
  url: string;
@@ -1 +1 @@
1
- "use strict";var e,n,t=require("react/jsx-runtime");function r(e,n,t,r){return new(t||(t=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t(function(e){e(n)})).then(s,a)}c((r=r.apply(e,n||[])).next())})}function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var i=o(function(){if(n)return e;n=1;var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var n=Object.prototype.toString.call(e);return"[object RegExp]"===n||"[object Date]"===n||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,n){return!1!==n.clone&&n.isMergeableObject(e)?d((t=e,Array.isArray(t)?[]:{}),e,n):e;var t}function i(e,n,t){return e.concat(n).map(function(e){return o(e,t)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(n){return Object.propertyIsEnumerable.call(e,n)}):[]}(e))}function a(e,n){try{return n in e}catch(e){return!1}}function c(e,n,t){var r={};return t.isMergeableObject(e)&&s(e).forEach(function(n){r[n]=o(e[n],t)}),s(n).forEach(function(i){(function(e,n){return a(e,n)&&!(Object.hasOwnProperty.call(e,n)&&Object.propertyIsEnumerable.call(e,n))})(e,i)||(a(e,i)&&t.isMergeableObject(n[i])?r[i]=function(e,n){if(!n.customMerge)return d;var t=n.customMerge(e);return"function"==typeof t?t:d}(i,t)(e[i],n[i],t):r[i]=o(n[i],t))}),r}function d(e,n,r){(r=r||{}).arrayMerge=r.arrayMerge||i,r.isMergeableObject=r.isMergeableObject||t,r.cloneUnlessOtherwiseSpecified=o;var s=Array.isArray(n);return s===Array.isArray(e)?s?r.arrayMerge(e,n,r):c(e,n,r):o(n,r)}return d.all=function(e,n){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,t){return d(e,t,n)},{})},e=d}());const s=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],a={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,n)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}};class c{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const n={};for(const t of s){const r=e[t];void 0!==r&&(n[t]=r)}Object.assign(this.config,n),Object.prototype.hasOwnProperty.call(e,"pageOptions")&&void 0!==e.pageOptions&&(this.config.pageOptions=Object.assign(Object.assign({},this.config.pageOptions),e.pageOptions))}get(){if(!this.config)throw new Error("Config was accessed before it had been initialized.");return this.config}getHandlers(){if(!this.siteHandlers)throw new Error("Handlers were accessed before it had been initialized.");return this.siteHandlers}setHandlers(e){this.siteHandlers=i(c.DEFAULT_SITE_HANDLERS,e)}}c.DEFAULT_SITE_HANDLERS={siteEvents:a,initNativeAd:function(){}};const d=new c;d.modifyConfigProperties.bind(d);const l=(e,n)=>{const t="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(n?console.log(t,e,n):console.log(t,e))},u=e=>new Promise(n=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void n(!1);const t=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const n=Number(e);return l("Advertising permission value obtained synchronously: ",e),Boolean(n)})();if(null!==t)return void n(t);let r=!1;const o=e=>{r||(l("Resolving advertising permission value obtained"),r=!0,n(e))},i=setTimeout(()=>{l("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{l("On Tcf Ready called, waiting for permission"),clearTimeout(i)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(i);const n=Number(e);l("Advertising permission value obtained asynchronously: ",e),o(Boolean(n))})}),f="cmp:loaded";let v,b=!1;const m=(e,n)=>{const t=!!(null==e?void 0:e.enabled),o=(null==e?void 0:e.timeout)||3e3,i=(s="bypass_tcf",new URLSearchParams(window.location.search).get(s));var s;const a=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,n)=>e?!!n&&(l("TCF bypass param detected, returning consent: true"),!0):(l("TCF is not enabled, returning consent: true"),!0))(t,i))return!0;if(b)return null;if(!v)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const n=v.getConsentedToAllSync();return l(`TCF consented to all is: ${n}`),v.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,n)=>{if(l("Getting TCF consent manager..."),window._tcf_)return l("TCF consent manager is already available"),v=window._tcf_,void e(v);l("TCF consent manager is not available");const t=()=>{l("CMP loaded, resolving consent manager..."),r&&clearTimeout(r),window._tcf_?(v=window._tcf_,e(v)):n(new Error("CMP loaded but window._tcf_ is not defined"))},r=setTimeout(()=>{document.removeEventListener(f,t),b=!0,n(new Error("Timeout waiting for CMP to load"))},o);l("Listening for CMP loaded event..."),document.addEventListener(f,t,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>r(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return l(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));if(null==e?void 0:e.schibstedAdChoicesEnabled)return l("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield u(e);if(!(null==e?void 0:e.enabled))return!0;const n=a();return null!==n?n:yield new Promise((e,n)=>{try{if(!v)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");v.isConsentedToAll(n=>{e(n)})}catch(e){n(e)}})})}};!function(e){if("undefined"==typeof window)return;const n=document.createElement("style");n.setAttribute("type","text/css"),n.innerHTML=e,document.head.appendChild(n)}(".advertory-brandmetrics-survey{width:100%}");const y="advertory-brandmetrics-survey";exports.BrandMetricsSurvey=()=>t.jsx("div",{id:"brandmetrics-survey",className:"advertory-brandmetrics-survey"}),exports.loadBrandmetricsScript=()=>r(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:n}={},tcf:t,isMobileApp:o}=d.get(),{getConsentAsync:i}=m(t),s=yield i();if(!e||!n||!s)return;yield((e,...n)=>r(void 0,[e,...n],void 0,function*(e,{timeout:n}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((t,r)=>{const o=document.createElement("script");o.async=!0,o.src=e;const i=()=>{a(),t()},s=()=>{a(),r(new Error(`Failed to load ${e}`))},a=()=>{o.removeEventListener("load",i),o.removeEventListener("error",s),clearTimeout(c)};o.addEventListener("load",i),o.addEventListener("error",s);const c=setTimeout(()=>{a(),r(new Error(`Loading script timed out: ${e}`))},n);document.head.appendChild(o)}).catch(e=>{console.error(e)}))}))(n);if(document.querySelector(`.${y}`))return window._brandmetrics=window._brandmetrics||[],void window._brandmetrics.push({cmd:"_loadsurvey"});new MutationObserver((e,n)=>{for(const t of e){if("childList"!==t.type)return;Array.from(t.addedNodes).some(e=>{var n;return null===(n=e.outerHTML)||void 0===n?void 0:n.includes(y)})&&(n.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})});
1
+ "use strict";var e,t,n=require("react/jsx-runtime");function r(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var i=o(function(){if(t)return e;t=1;var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?d((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map(function(e){return o(e,n)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function c(e,t,n){var r={};return n.isMergeableObject(e)&&s(e).forEach(function(t){r[t]=o(e[t],n)}),s(t).forEach(function(i){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(a(e,i)&&n.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return d;var n=t.customMerge(e);return"function"==typeof n?n:d}(i,n)(e[i],t[i],n):r[i]=o(t[i],n))}),r}function d(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||i,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=o;var s=Array.isArray(t);return s===Array.isArray(e)?s?r.arrayMerge(e,t,r):c(e,t,r):o(t,r)}return d.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return d(e,n,t)},{})},e=d}());const s=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],a={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}};class c{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of s){const r=e[n];void 0!==r&&(t[n]=r)}Object.assign(this.config,t),Object.prototype.hasOwnProperty.call(e,"pageOptions")&&void 0!==e.pageOptions&&(this.config.pageOptions=Object.assign(Object.assign({},this.config.pageOptions),e.pageOptions))}get(){if(!this.config)throw new Error("Config was accessed before it had been initialized.");return this.config}getHandlers(){if(!this.siteHandlers)throw new Error("Handlers were accessed before it had been initialized.");return this.siteHandlers}setHandlers(e){this.siteHandlers=i(c.DEFAULT_SITE_HANDLERS,e)}}c.DEFAULT_SITE_HANDLERS={siteEvents:a,initNativeAd:function(){}};const d=new c;d.modifyConfigProperties.bind(d);const l=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},u=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return l("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let r=!1;const o=e=>{r||(l("Resolving advertising permission value obtained"),r=!0,t(e))},i=setTimeout(()=>{l("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{l("On Tcf Ready called, waiting for permission"),clearTimeout(i)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(i);const t=Number(e);l("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),f="no",v="se",b="cmp:loaded";let m,y=!1;const g=(e,t,n)=>{const o=!!(null==e?void 0:e.enabled),i=(null==e?void 0:e.timeout)||3e3,s=(a="bypass_tcf",new URLSearchParams(window.location.search).get(a));var a;const c=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(l("TCF bypass param detected, returning consent: true"),!0):(l("TCF is not enabled, returning consent: true"),!0))(o,s))return!0;if(y)return null;if(!m)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=m.getConsentedToAllSync();return l(`TCF consented to all is: ${t}`),m.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(l("Getting TCF consent manager..."),window._tcf_)return l("TCF consent manager is already available"),m=window._tcf_,void e(m);l("TCF consent manager is not available");const n=()=>{l("CMP loaded, resolving consent manager..."),r&&clearTimeout(r),window._tcf_?(m=window._tcf_,e(m)):t(new Error("CMP loaded but window._tcf_ is not defined"))},r=setTimeout(()=>{document.removeEventListener(b,n),y=!0,t(new Error("Timeout waiting for CMP to load"))},i);l("Listening for CMP loaded event..."),document.addEventListener(b,n,{once:!0})}):Promise.resolve(null),getConsentSync:c,getConsentAsync:()=>r(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return l(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const r=(null==e?void 0:e.schibstedAdChoicesEnabled)&&n===v,o=(null==e?void 0:e.schibstedAdChoicesEnabled)&&!t&&n===f;if(r||o)return l("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield u(e);if(!(null==e?void 0:e.enabled))return!0;const s=c();return null!==s?s:yield new Promise((e,t)=>{try{if(!m)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let t=!1;const n=n=>{t||(t=!0,e(n))},r=setTimeout(()=>{l("TCF isConsentedToAll timed out, resolving with false"),n(!1)},i);m.onTcfReady(()=>{l("On Tcf Ready called, waiting for consent"),clearTimeout(r)}),m.isConsentedToAll(t=>{clearTimeout(r),e(t)})}catch(e){t(e)}})})}};!function(e){if("undefined"==typeof window)return;const t=document.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t)}(".advertory-brandmetrics-survey{width:100%}");const w="advertory-brandmetrics-survey";exports.BrandMetricsSurvey=()=>n.jsx("div",{id:"brandmetrics-survey",className:"advertory-brandmetrics-survey"}),exports.loadBrandmetricsScript=()=>r(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n,isMobileApp:o,country:i}=d.get(),{getConsentAsync:s}=g(n,o,i),a=yield s();if(!e||!t||!a)return;yield((e,...t)=>r(void 0,[e,...t],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,r)=>{const o=document.createElement("script");o.async=!0,o.src=e;const i=()=>{a(),n()},s=()=>{a(),r(new Error(`Failed to load ${e}`))},a=()=>{o.removeEventListener("load",i),o.removeEventListener("error",s),clearTimeout(c)};o.addEventListener("load",i),o.addEventListener("error",s);const c=setTimeout(()=>{a(),r(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(o)}).catch(e=>{console.error(e)}))}))(t);if(document.querySelector(`.${w}`))return window._brandmetrics=window._brandmetrics||[],void window._brandmetrics.push({cmd:"_loadsurvey"});new MutationObserver((e,t)=>{for(const n of e){if("childList"!==n.type)return;Array.from(n.addedNodes).some(e=>{var t;return null===(t=e.outerHTML)||void 0===t?void 0:t.includes(w)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})});
@@ -251,7 +251,6 @@ interface SiteConfig {
251
251
  norstat?: NorstatConfig;
252
252
  siteSpecificConfig?: SiteSpecificConfig;
253
253
  sponsorstripe?: SponsorstripeConfig;
254
- privacyBroker?: PrivacyBrokerConfig;
255
254
  drEdition?: DrEditionConfig;
256
255
  kilkaya?: KilkayaConfig;
257
256
  forwardExternalImpId?: boolean;
@@ -469,11 +468,6 @@ interface RightColumnSplitConfig {
469
468
  adSelector: string;
470
469
  trackSelector?: string;
471
470
  }
472
- interface PrivacyBrokerConfig {
473
- enabled: boolean;
474
- clientId: string;
475
- storageKeyPrefix: string;
476
- }
477
471
  interface KilkayaConfig {
478
472
  enabled: boolean;
479
473
  url: string;
@@ -509,6 +503,7 @@ interface DrEditionParams {
509
503
  device: DeviceType;
510
504
  tcf?: TCFConfig;
511
505
  isMobileApp?: boolean;
506
+ country?: Country;
512
507
  renderAsBackfill?: boolean;
513
508
  }
514
509
  interface DrEditionObserverConfig {
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";function n(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const i={get:(e,t)=>n(void 0,void 0,void 0,function*(){const n=yield fetch(e,t);if(!n.ok)throw new Error(n.statusText);return yield n.json()}),post:(e,t,i)=>n(void 0,void 0,void 0,function*(){const n=JSON.stringify(i),r=yield fetch(e,{method:"POST",headers:t,body:n});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},r=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},o=["netboard","board"];class s{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:r}=e,o=(()=>{const e=window.location.href;return new URL(e).searchParams.get("dre_override_inv_code")||""})(),s=JSON.stringify(null!==(i=null===(n=window.advertory)||void 0===n?void 0:n.renderedDrEditionAds)&&void 0!==i?i:[]),a=new URL("https://dr-edition-teaser-server.inventory.schibsted.io/editions"),{envId:d,spid:l}=t;return a.searchParams.append("editionName",r),o&&a.searchParams.append("urlData",o),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(e){return n(this,void 0,void 0,function*(){var t,n;const o=yield this.identityFacade.getIdentityUser(),s=null!==(n=yield null===(t=this.tracker)||void 0===t?void 0:t.getEnvironmentId())&&void 0!==n?n:"",a=(null==o?void 0:o.userId)?String(o.userId):"",d=this.buildUrl(e,{envId:s,spid:a});try{r("Starting fetching DrEdition ad from URL:",d);const e={method:"GET"},t=yield i.get(d,e);return r("Fetch operation completed successfully."),t}catch(e){r("Error during fetch operation:",e)}return null})}}class a{getDrEditionUTMParams(e,t){var n;const{title:i="",clientName:r,creativeId:o}=null!==(n=null==e?void 0:e.pulseData)&&void 0!==n?n:{},{editionName:s}=t,a=i.replace(/<[^>]*>/g,"");return Object.assign({utm_source:"vgfront",utm_content:s,utm_campaign:r,utm_medium:a},o&&{utm_id:`df-${o}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),r=new URLSearchParams(decodeURIComponent(e.search)),o=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{r.has(e)||o.set(e,null!=t?t:"")}),o.toString().replace(/\+/g,"%20")}getUrlWithParams(e,t){var n;const i=null===(n=null==e?void 0:e.pulseData)||void 0===n?void 0:n.url;if(!i)return"";const r=this.getDrEditionUTMParams(e,t),o=new URL(i);return Object.entries(r).forEach(([e,t])=>{o.searchParams.has(e)||o.searchParams.set(e,null!=t?t:"")}),o.toString()}handleVideo(e,t){return n(this,void 0,void 0,function*(){const{id:n,autoplay:i,mute:r,videoLoop:o,vendor:s}=t.videoConfiguration;e.classList.add("vgtv-video-container"),Object.assign(e.dataset,{vgtvVideoId:n,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:r,vgtvLoop:!!o,vgtvNa:!0,vgtvRecommended:!1,vgtvPulseProvider:"vg",vgtvPulseProductTag:"partnerstudio"})})}getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}}const d=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&(()=>{const e=document.querySelector(".advertory-wallpaper-background");e&&e.remove()})())},l=e=>{const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("display"),n.style.removeProperty("display"))},c=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):r("Dr. Edition container does not have a parent element, cannot remove height lock.")};class u{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(e,t){return n(this,void 0,void 0,function*(){var n,i;const{drEditionConfig:{containerSelector:o},renderAsBackfill:s=!1}=t,a=e.querySelector(o);if(!a)return void r(`Container with selector "${o}" not found.`);const u=yield this.drEditionService.fetchData(t);return(null==u?void 0:u.itemId)||s?!(null==u?void 0:u.itemId)&&s?(r("No Dr. Edition ads available to render. Collapsing whole placement."),d(e.id),void c(a)):((null==u?void 0:u.itemId)&&s&&(r("Dr. Edition ad available to render as a Xandr backfill."),l(e.id)),void(u?(u.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(u.css,"style"),yield this.rendererManager.render(a,u,t),yield null===(n=this.videoManager)||void 0===n?void 0:n.handle(u,t),c(a),this.drEditionAds.push(u),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(u.itemId),this.observeAdView(e,u,t),null===(i=e.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):c(a))):(r("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(a),this.showBackfill(e),void c(a))})}observeAdView(e,t,n){this.observeCarousel(e,t,n)||((e,t,n={threshold:.5})=>{new IntersectionObserver(([e],n)=>{e.isIntersecting&&(t(),n.disconnect())},n).observe(e)})(e,()=>this.pulseManager.trackContentView(e,t,n),{threshold:.5})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";l(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let r=null;const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(r&&clearTimeout(r),r=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{o.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{o.observe(e)}),!0}}const v=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return r("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const o=e=>{i||(r("Resolving advertising permission value obtained"),i=!0,t(e))},s=setTimeout(()=>{r("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{r("On Tcf Ready called, waiting for permission"),clearTimeout(s)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(s);const t=Number(e);r("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),p="cmp:loaded";let g,h=!1;const m=(e,t)=>{const i=!!(null==e?void 0:e.enabled),o=(null==e?void 0:e.timeout)||3e3,s=(a="bypass_tcf",new URLSearchParams(window.location.search).get(a));var a;const d=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(r("TCF bypass param detected, returning consent: true"),!0):(r("TCF is not enabled, returning consent: true"),!0))(i,s))return!0;if(h)return null;if(!g)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=g.getConsentedToAllSync();return r(`TCF consented to all is: ${t}`),g.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(r("Getting TCF consent manager..."),window._tcf_)return r("TCF consent manager is already available"),g=window._tcf_,void e(g);r("TCF consent manager is not available");const n=()=>{r("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(g=window._tcf_,e(g)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(p,n),h=!0,t(new Error("Timeout waiting for CMP to load"))},o);r("Listening for CMP loaded event..."),document.addEventListener(p,n,{once:!0})}):Promise.resolve(null),getConsentSync:d,getConsentAsync:()=>n(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return r(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));if(null==e?void 0:e.schibstedAdChoicesEnabled)return r("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield v(e);if(!(null==e?void 0:e.enabled))return!0;const t=d();return null!==t?t:yield new Promise((e,t)=>{try{if(!g)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");g.isConsentedToAll(t=>{e(t)})}catch(e){t(e)}})})}},y="mobile";class f{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,t,i){return n(this,void 0,void 0,function*(){if(!(null==t?void 0:t.itemId))return;const{getConsentAsync:n}=m(i.tcf,i.isMobileApp),r=yield n(),o=i.device===y?t.mobileHTML:t.desktopHTML;const s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=s,e.querySelectorAll("a").forEach(e=>{var n,r,o;e.search=null!==(o=null===(r=(n=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(n,e,t,i))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,t,i)})})}}class w{constructor(e){this.strategy=e}handle(e,t){return n(this,void 0,void 0,function*(){const{videoConfiguration:{id:n,preview:i}={}}=e;(n||i)&&(yield this.importScript(t),yield this.createVideoElement(e,t))})}importScript(e){return n(this,void 0,void 0,function*(){const t=e.drEditionConfig.videoScriptUrl,i=document.querySelector(`script[src="${t}"]`);if(t&&!window.autoplayQueue&&!i)try{yield((e,...t)=>n(void 0,[e,...t],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.src=e;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}))(t)}catch(e){r("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(e,t){return n(this,void 0,void 0,function*(){const n=document.createElement("div"),{node:i}=e.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(e,t))return;this.strategy.handleVideo(n,e),null==r||r.appendChild(n),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const o=null==r?void 0:r.parentNode;if(!o)return;const s=o.closest("a");o.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,r;const{preview:{url:o,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!o)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}class b{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t,n,i){return{}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getTeaserElementText(e,t){if(!e)return"";const n=e.querySelector({title:".dr-edition-title",subtitle:".dr-edition-subtitle",image:"img.teaser-main-image"}[t]);if(!n)return"";if("image"===t)return n.src||"";const i=null==n?void 0:n.textContent;return i?i.trim():""}getEventTarget(e,t){const{itemId:n,pulseData:{url:i}={}}=t,r=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=r?r:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e,t,i){return n(this,void 0,void 0,function*(){var n,r,o,s,a,d,l,c;if(!this.pulse)return;const u=this.getEventInput(e,t,i,"view");(null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackLegacyViewUIElement)||void 0===o||o.call(r,u):(null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)?null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackViewUIElement)||void 0===d||d.call(a,u):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,u)})}trackContentClick(e,t,i){return n(this,void 0,void 0,function*(){var n,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,t,i,"click");this.pulse.trackLegacyClickUIElement?null===(r=(n=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(n,l):this.pulse.trackClickUIElement?null===(s=(o=this.pulse).trackClickUIElement)||void 0===s||s.call(o,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}}class E extends b{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt:creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}class P extends b{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,h=Math.floor(Date.now()/1e3),m=this.getTeaserElementText(e,"title"),y=this.getTeaserElementText(e,"subtitle"),f=this.getTeaserElementText(e,"image"),w=null!==(a=null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getUrlWithParams)||void 0===o?void 0:o.call(r,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}}const C="svd",T="vg",I="aftonbladet",S="e24",k="front",A=e=>n(void 0,void 0,void 0,function*(){var t,n;return(null===(t=null===window||void 0===window?void 0:window.SVP)||void 0===t?void 0:t.Player)?new window.SVP.Player(e):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(e):yield new Promise(t=>{window.addEventListener("onSvpPlayerReady",()=>t(new window.SVP.Player(e)))}))}),L={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return n(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return J})})}})}};class j{handleVideo(e,t){return n(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:i,autoplay:r,mute:o,vendor:s}}){yield n(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const a=["ContentMutePlugin"],d=this.createPlayerOverlay(e);var l,c;c=d,null==(l=a)||l.forEach(e=>{L[e](c)});const u={id:t,node:i,autoplay:r,mute:o,vendor:s,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},v=yield A(u);v.once("assetReady",()=>{((e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})})(v,a)}),v.once("ready",()=>{const t=e;new MutationObserver(e=>{e.forEach(({type:e,attributeName:n})=>{"attributes"===e&&"class"===n&&(t.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),t.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(t,{attributes:!0,attributeFilter:["class"]})}),v.once("PulseStats:ready",()=>n(this,void 0,void 0,function*(){const e=yield v.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===k?"sdrn:e24:frontpage:front":`sdrn:e24:article:${t}`}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];if(!n.includes("https://e24.no/annonsorinnhold/"))return[n];const{pathname:i}=new URL(n),r=i.split("/").filter(Boolean);return r.length?[...r.slice(1),n]:[n]}createPlayerOverlay(e){const t=document.createElement("div");t.classList.add("cm-custom-video-overlay"),e.parentElement&&(t.innerHTML=e.parentElement.innerHTML,e.parentElement.replaceChild(t,e));return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),t.classList.add("has-interacted")}),t}}const M="https://www.aftonbladet.se/video-player-extras/latest/";class V{handleVideo(e,t){return n(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${M}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${M}external-link.js`]:{name:"ExternalLink"}}};yield A(s),this.addEditionVideoClass(e)})}addEditionVideoClass(e){var t;(null===(t=null==e?void 0:e.parentElement)||void 0===t?void 0:t.parentElement)&&e.parentElement.parentElement.classList.add("dr-edition-video-player")}getPulseObjectId(){return""}getPulsePageId(){return""}}const _=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class N{handleVideo(e,t){return n(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:i,autoplay:r,mute:o,vendor:s}}){const a={id:t,node:i,autoplay:r,mute:o,vendor:s,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},_(e)?e:{}),{provider:Object.assign(Object.assign({},_(null==e?void 0:e.provider)?e.provider:{}),{productTag:"partnerstudio"})})},skin:{name:"svd-player",url:""},settings:{pulse:{host:"se-aftonbladet.videoplaza.tv",contentMetadata:{category:"SvD",tags:["standard-linears","pause",`video-${t}`]},requestSettings:{}}}},d=yield A(a);d.once("PulseStats:ready",()=>n(this,void 0,void 0,function*(){const e=yield d.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===k?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}class O{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}}const U="se",D=(e,t,n)=>{var i;const{publisher:r,pageType:o,country:d}=e,l={[T]:new a,[S]:new j,[I]:new V,[C]:new N}[r]||new O,c=new(d===U?E:P)(n,l,o),v=new s(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),p=new f(l,c),g=new w(l);return new u(v,p,g,c)},x=({editionName:n,fallbackTargetId:i,children:r,pulseData:o})=>{const s=(e=>{const t={};if(!e)return t;for(const[n,i]of Object.entries(e))t[`data-pulse-${n}`]=String(i);return t})(o);return e("div",Object.assign({className:"dr-edition-wrapper dr-edition-lock-height","data-edition-name":n},s,{children:[t("div",{className:"inscreen-target"}),t("div",{className:"container"}),t("div",{className:"fallback","data-fallback-target-id":i,style:{display:"none"},children:r})]}))},B=()=>n(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class R{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return n(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return r("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return n(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const $=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,r=document.querySelectorAll(i),o=new IntersectionObserver((i,r)=>((e,t,n,i,r)=>{const o=D(n,i,r);e.forEach(e=>{var i,r,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(r=a.dataset.pulseColumnname)&&void 0!==r?r:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";o.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,r,e,t,n),{rootMargin:"400% 0px"});r.forEach(e=>o.observe(e))},q=(e,t,...i)=>n(void 0,[e,t,...i],void 0,function*(e,t,n="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return r(`Schibsted Consent to Pay is not enabled, returning true for ${n}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return r(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${n}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:i}=m(e);return(yield i())?(r(`Schibsted Ad Choices consent given according to TCF consent manager for ${n}`),!0):(r(`Schibsted Ad Choices consent not given according to TCF consent manager for ${n}`),!1)}),F=[],H=(e,t)=>n(void 0,void 0,void 0,function*(){var n;const{pulse:i,tcf:s,deviceType:a,drEdition:d,publisher:l,pageType:c,country:u,isMobileApp:v}=e;if(!(yield q(s,v,"handleDrEditionBackfill")))return;const p=((e,t)=>{var n;const{deviceType:i,placements:r,drEdition:{fallbackGlobalEditionName:s}={}}=e,a=r[i]||r.desktop,d=(e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e})(t.targetId),l=a.find(e=>e.id===d),c=o.some(e=>d.startsWith(e)),u=F.includes(d),v=(null===(n=null==l?void 0:l.drEdition)||void 0===n?void 0:n.editionName)||s;return l&&c&&!u&&v?(F.push(d),Object.assign(Object.assign({},l),{drEdition:Object.assign(Object.assign({},l.drEdition),{editionName:v})})):null})(e,t);if(!p)return;if(!(null==i?void 0:i.instance))return void r("Pulse has not been passed as a prop, aborting");const g=yield B(),h=new R(g),m=D({publisher:l,pageType:c,country:u},h,null==i?void 0:i.instance),y=document.getElementById(t.targetId);if(!y||!d)return;y.classList.value="";const f=document.createElement("div");f.className=d.containerSelector.replace(/^[.#:[\]]+/,""),y.innerHTML=f.outerHTML;const w={editionName:(null===(n=null==p?void 0:p.drEdition)||void 0===n?void 0:n.editionName)||"",drEditionConfig:d,device:a,tcf:s,isMobileApp:v,renderAsBackfill:!0};yield m.fetchAndRenderAd(y,w)}),z=e=>n(void 0,void 0,void 0,function*(){var t;if(!e.drEdition)return;if(!(yield q(e.tcf,e.isMobileApp,"handleDrEdition")))return;const n=yield B(),i=new R(n);$({publisher:e.publisher,drEditionConfig:e.drEdition,device:e.deviceType,pageType:e.pageType,country:e.country},i,null===(t=e.pulse)||void 0===t?void 0:t.instance)});const W=function(e){if("undefined"==typeof window)return;const t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}("[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-slider-time{display:none}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container{padding:0 6px;height:36px}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon{margin-right:3px;height:unset;width:unset;bottom:0}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon-volume,[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon-playback{display:flex}");var J=Object.freeze({__proto__:null,default:W});export{x as DrEdition,D as getDrEditionManager,z as handleDrEdition,H as handleDrEditionBackfill};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";function n(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const i={get:(e,t)=>n(void 0,void 0,void 0,function*(){const n=yield fetch(e,t);if(!n.ok)throw new Error(n.statusText);return yield n.json()}),post:(e,t,i)=>n(void 0,void 0,void 0,function*(){const n=JSON.stringify(i),r=yield fetch(e,{method:"POST",headers:t,body:n});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},r=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},o=["netboard","board"];class s{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:r}=e,o=(()=>{const e=window.location.href;return new URL(e).searchParams.get("dre_override_inv_code")||""})(),s=JSON.stringify(null!==(i=null===(n=window.advertory)||void 0===n?void 0:n.renderedDrEditionAds)&&void 0!==i?i:[]),a=new URL("https://dr-edition-teaser-server.inventory.schibsted.io/editions"),{envId:d,spid:l}=t;return a.searchParams.append("editionName",r),o&&a.searchParams.append("urlData",o),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(e){return n(this,void 0,void 0,function*(){var t,n;const o=yield this.identityFacade.getIdentityUser(),s=null!==(n=yield null===(t=this.tracker)||void 0===t?void 0:t.getEnvironmentId())&&void 0!==n?n:"",a=(null==o?void 0:o.userId)?String(o.userId):"",d=this.buildUrl(e,{envId:s,spid:a});try{r("Starting fetching DrEdition ad from URL:",d);const e={method:"GET"},t=yield i.get(d,e);return r("Fetch operation completed successfully."),t}catch(e){r("Error during fetch operation:",e)}return null})}}class a{getDrEditionUTMParams(e,t){var n;const{title:i="",clientName:r,creativeId:o}=null!==(n=null==e?void 0:e.pulseData)&&void 0!==n?n:{},{editionName:s}=t,a=i.replace(/<[^>]*>/g,"");return Object.assign({utm_source:"vgfront",utm_content:s,utm_campaign:r,utm_medium:a},o&&{utm_id:`df-${o}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),r=new URLSearchParams(decodeURIComponent(e.search)),o=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{r.has(e)||o.set(e,null!=t?t:"")}),o.toString().replace(/\+/g,"%20")}getUrlWithParams(e,t){var n;const i=null===(n=null==e?void 0:e.pulseData)||void 0===n?void 0:n.url;if(!i)return"";const r=this.getDrEditionUTMParams(e,t),o=new URL(i);return Object.entries(r).forEach(([e,t])=>{o.searchParams.has(e)||o.searchParams.set(e,null!=t?t:"")}),o.toString()}handleVideo(e,t){return n(this,void 0,void 0,function*(){const{id:n,autoplay:i,mute:r,videoLoop:o,vendor:s}=t.videoConfiguration;e.classList.add("vgtv-video-container"),Object.assign(e.dataset,{vgtvVideoId:n,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:r,vgtvLoop:!!o,vgtvNa:!0,vgtvRecommended:!1,vgtvPulseProvider:"vg",vgtvPulseProductTag:"partnerstudio"})})}getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}}const d=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&(()=>{const e=document.querySelector(".advertory-wallpaper-background");e&&e.remove()})())},l=e=>{const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("display"),n.style.removeProperty("display"))},c=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):r("Dr. Edition container does not have a parent element, cannot remove height lock.")};class u{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(e,t){return n(this,void 0,void 0,function*(){var n,i;const{drEditionConfig:{containerSelector:o},renderAsBackfill:s=!1}=t,a=e.querySelector(o);if(!a)return void r(`Container with selector "${o}" not found.`);const u=yield this.drEditionService.fetchData(t);return(null==u?void 0:u.itemId)||s?!(null==u?void 0:u.itemId)&&s?(r("No Dr. Edition ads available to render. Collapsing whole placement."),d(e.id),void c(a)):((null==u?void 0:u.itemId)&&s&&(r("Dr. Edition ad available to render as a Xandr backfill."),l(e.id)),void(u?(u.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(u.css,"style"),yield this.rendererManager.render(a,u,t),yield null===(n=this.videoManager)||void 0===n?void 0:n.handle(u,t),c(a),this.drEditionAds.push(u),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(u.itemId),this.observeAdView(e,u,t),null===(i=e.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):c(a))):(r("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(a),this.showBackfill(e),void c(a))})}observeAdView(e,t,n){this.observeCarousel(e,t,n)||((e,t,n={threshold:.5})=>{new IntersectionObserver(([e],n)=>{e.isIntersecting&&(t(),n.disconnect())},n).observe(e)})(e,()=>this.pulseManager.trackContentView(e,t,n),{threshold:.5})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";l(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let r=null;const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(r&&clearTimeout(r),r=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{o.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{o.observe(e)}),!0}}const v=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return r("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const o=e=>{i||(r("Resolving advertising permission value obtained"),i=!0,t(e))},s=setTimeout(()=>{r("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{r("On Tcf Ready called, waiting for permission"),clearTimeout(s)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(s);const t=Number(e);r("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),p="no",g="se",h="cmp:loaded";let m,y=!1;const f=(e,t,i)=>{const o=!!(null==e?void 0:e.enabled),s=(null==e?void 0:e.timeout)||3e3,a=(d="bypass_tcf",new URLSearchParams(window.location.search).get(d));var d;const l=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(r("TCF bypass param detected, returning consent: true"),!0):(r("TCF is not enabled, returning consent: true"),!0))(o,a))return!0;if(y)return null;if(!m)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=m.getConsentedToAllSync();return r(`TCF consented to all is: ${t}`),m.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(r("Getting TCF consent manager..."),window._tcf_)return r("TCF consent manager is already available"),m=window._tcf_,void e(m);r("TCF consent manager is not available");const n=()=>{r("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(m=window._tcf_,e(m)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(h,n),y=!0,t(new Error("Timeout waiting for CMP to load"))},s);r("Listening for CMP loaded event..."),document.addEventListener(h,n,{once:!0})}):Promise.resolve(null),getConsentSync:l,getConsentAsync:()=>n(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return r(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const n=(null==e?void 0:e.schibstedAdChoicesEnabled)&&i===g,o=(null==e?void 0:e.schibstedAdChoicesEnabled)&&!t&&i===p;if(n||o)return r("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield v(e);if(!(null==e?void 0:e.enabled))return!0;const a=l();return null!==a?a:yield new Promise((e,t)=>{try{if(!m)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let t=!1;const n=n=>{t||(t=!0,e(n))},i=setTimeout(()=>{r("TCF isConsentedToAll timed out, resolving with false"),n(!1)},s);m.onTcfReady(()=>{r("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),m.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},w="mobile";class b{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,t,i){return n(this,void 0,void 0,function*(){if(!(null==t?void 0:t.itemId))return;const{getConsentAsync:n}=f(i.tcf,i.isMobileApp,i.country),r=yield n(),o=i.device===w?t.mobileHTML:t.desktopHTML;const s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=s,e.querySelectorAll("a").forEach(e=>{var n,r,o;e.search=null!==(o=null===(r=(n=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(n,e,t,i))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,t,i)})})}}class E{constructor(e){this.strategy=e}handle(e,t){return n(this,void 0,void 0,function*(){const{videoConfiguration:{id:n,preview:i}={}}=e;(n||i)&&(yield this.importScript(t),yield this.createVideoElement(e,t))})}importScript(e){return n(this,void 0,void 0,function*(){const t=e.drEditionConfig.videoScriptUrl,i=document.querySelector(`script[src="${t}"]`);if(t&&!window.autoplayQueue&&!i)try{yield((e,...t)=>n(void 0,[e,...t],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.src=e;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}))(t)}catch(e){r("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(e,t){return n(this,void 0,void 0,function*(){const n=document.createElement("div"),{node:i}=e.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(e,t))return;this.strategy.handleVideo(n,e),null==r||r.appendChild(n),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const o=null==r?void 0:r.parentNode;if(!o)return;const s=o.closest("a");o.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,r;const{preview:{url:o,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!o)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}class P{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t,n,i){return{}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getTeaserElementText(e,t){if(!e)return"";const n=e.querySelector({title:".dr-edition-title",subtitle:".dr-edition-subtitle",image:"img.teaser-main-image"}[t]);if(!n)return"";if("image"===t)return n.src||"";const i=null==n?void 0:n.textContent;return i?i.trim():""}getEventTarget(e,t){const{itemId:n,pulseData:{url:i}={}}=t,r=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=r?r:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e,t,i){return n(this,void 0,void 0,function*(){var n,r,o,s,a,d,l,c;if(!this.pulse)return;const u=this.getEventInput(e,t,i,"view");(null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackLegacyViewUIElement)||void 0===o||o.call(r,u):(null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)?null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackViewUIElement)||void 0===d||d.call(a,u):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,u)})}trackContentClick(e,t,i){return n(this,void 0,void 0,function*(){var n,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,t,i,"click");this.pulse.trackLegacyClickUIElement?null===(r=(n=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(n,l):this.pulse.trackClickUIElement?null===(s=(o=this.pulse).trackClickUIElement)||void 0===s||s.call(o,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}}class T extends P{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt:creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}class C extends P{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,h=Math.floor(Date.now()/1e3),m=this.getTeaserElementText(e,"title"),y=this.getTeaserElementText(e,"subtitle"),f=this.getTeaserElementText(e,"image"),w=null!==(a=null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getUrlWithParams)||void 0===o?void 0:o.call(r,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}}const I="svd",S="vg",k="aftonbladet",A="e24",L="front",j=e=>n(void 0,void 0,void 0,function*(){var t,n;return(null===(t=null===window||void 0===window?void 0:window.SVP)||void 0===t?void 0:t.Player)?new window.SVP.Player(e):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(e):yield new Promise(t=>{window.addEventListener("onSvpPlayerReady",()=>t(new window.SVP.Player(e)))}))}),M={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return n(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return G})})}})}};class O{handleVideo(e,t){return n(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:i,autoplay:r,mute:o,vendor:s}}){yield n(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const a=["ContentMutePlugin"],d=this.createPlayerOverlay(e);var l,c;c=d,null==(l=a)||l.forEach(e=>{M[e](c)});const u={id:t,node:i,autoplay:r,mute:o,vendor:s,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},v=yield j(u);v.once("assetReady",()=>{((e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})})(v,a)}),v.once("ready",()=>{const t=e;new MutationObserver(e=>{e.forEach(({type:e,attributeName:n})=>{"attributes"===e&&"class"===n&&(t.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),t.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(t,{attributes:!0,attributeFilter:["class"]})}),v.once("PulseStats:ready",()=>n(this,void 0,void 0,function*(){const e=yield v.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===L?"sdrn:e24:frontpage:front":`sdrn:e24:article:${t}`}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];if(!n.includes("https://e24.no/annonsorinnhold/"))return[n];const{pathname:i}=new URL(n),r=i.split("/").filter(Boolean);return r.length?[...r.slice(1),n]:[n]}createPlayerOverlay(e){const t=document.createElement("div");t.classList.add("cm-custom-video-overlay"),e.parentElement&&(t.innerHTML=e.parentElement.innerHTML,e.parentElement.replaceChild(t,e));return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),t.classList.add("has-interacted")}),t}}const V="https://www.aftonbladet.se/video-player-extras/latest/";class _{handleVideo(e,t){return n(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${V}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${V}external-link.js`]:{name:"ExternalLink"}}};yield j(s),this.addEditionVideoClass(e)})}addEditionVideoClass(e){var t;(null===(t=null==e?void 0:e.parentElement)||void 0===t?void 0:t.parentElement)&&e.parentElement.parentElement.classList.add("dr-edition-video-player")}getPulseObjectId(){return""}getPulsePageId(){return""}}const N=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class U{handleVideo(e,t){return n(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:i,autoplay:r,mute:o,vendor:s}}){const a={id:t,node:i,autoplay:r,mute:o,vendor:s,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},N(e)?e:{}),{provider:Object.assign(Object.assign({},N(null==e?void 0:e.provider)?e.provider:{}),{productTag:"partnerstudio"})})},skin:{name:"svd-player",url:""},settings:{pulse:{host:"se-aftonbladet.videoplaza.tv",contentMetadata:{category:"SvD",tags:["standard-linears","pause",`video-${t}`]},requestSettings:{}}}},d=yield j(a);d.once("PulseStats:ready",()=>n(this,void 0,void 0,function*(){const e=yield d.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===L?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}class D{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}}const x=(e,t,n)=>{var i;const{publisher:r,pageType:o,country:d}=e,l={[S]:new a,[A]:new O,[k]:new _,[I]:new U}[r]||new D,c=new(d===g?T:C)(n,l,o),v=new s(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),p=new b(l,c),h=new E(l);return new u(v,p,h,c)},B=({editionName:n,fallbackTargetId:i,children:r,pulseData:o})=>{const s=(e=>{const t={};if(!e)return t;for(const[n,i]of Object.entries(e))t[`data-pulse-${n}`]=String(i);return t})(o);return e("div",Object.assign({className:"dr-edition-wrapper dr-edition-lock-height","data-edition-name":n},s,{children:[t("div",{className:"inscreen-target"}),t("div",{className:"container"}),t("div",{className:"fallback","data-fallback-target-id":i,style:{display:"none"},children:r})]}))},R=()=>n(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class ${constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return n(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return r("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return n(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const F=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,r=document.querySelectorAll(i),o=new IntersectionObserver((i,r)=>((e,t,n,i,r)=>{const o=x(n,i,r);e.forEach(e=>{var i,r,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(r=a.dataset.pulseColumnname)&&void 0!==r?r:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";o.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,r,e,t,n),{rootMargin:"400% 0px"});r.forEach(e=>o.observe(e))},q=(e,t,i,...o)=>n(void 0,[e,t,i,...o],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return r(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return r(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${i}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:o}=f(e,t,n);return(yield o())?(r(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(r(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),H=[],z=(e,t)=>n(void 0,void 0,void 0,function*(){var n;const{pulse:i,tcf:s,deviceType:a,drEdition:d,publisher:l,pageType:c,country:u,isMobileApp:v}=e;if(!(yield q(s,v,u,"handleDrEditionBackfill")))return;const p=((e,t)=>{var n;const{deviceType:i,placements:r,drEdition:{fallbackGlobalEditionName:s}={}}=e,a=r[i]||r.desktop,d=(e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e})(t.targetId),l=a.find(e=>e.id===d),c=o.some(e=>d.startsWith(e)),u=H.includes(d),v=(null===(n=null==l?void 0:l.drEdition)||void 0===n?void 0:n.editionName)||s;return l&&c&&!u&&v?(H.push(d),Object.assign(Object.assign({},l),{drEdition:Object.assign(Object.assign({},l.drEdition),{editionName:v})})):null})(e,t);if(!p)return;if(!(null==i?void 0:i.instance))return void r("Pulse has not been passed as a prop, aborting");const g=yield R(),h=new $(g),m=x({publisher:l,pageType:c,country:u},h,null==i?void 0:i.instance),y=document.getElementById(t.targetId);if(!y||!d)return;y.classList.value="";const f=document.createElement("div");f.className=d.containerSelector.replace(/^[.#:[\]]+/,""),y.innerHTML=f.outerHTML;const w={editionName:(null===(n=null==p?void 0:p.drEdition)||void 0===n?void 0:n.editionName)||"",drEditionConfig:d,device:a,tcf:s,isMobileApp:v,country:u,renderAsBackfill:!0};yield m.fetchAndRenderAd(y,w)}),W=e=>n(void 0,void 0,void 0,function*(){var t;if(!e.drEdition)return;if(!(yield q(e.tcf,e.isMobileApp,e.country,"handleDrEdition")))return;const n=yield R(),i=new $(n);F({publisher:e.publisher,drEditionConfig:e.drEdition,device:e.deviceType,pageType:e.pageType,country:e.country},i,null===(t=e.pulse)||void 0===t?void 0:t.instance)});const J=function(e){if("undefined"==typeof window)return;const t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}("[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-slider-time{display:none}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container{padding:0 6px;height:36px}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon{margin-right:3px;height:unset;width:unset;bottom:0}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon-volume,[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon-playback{display:flex}");var G=Object.freeze({__proto__:null,default:J});export{B as DrEdition,x as getDrEditionManager,W as handleDrEdition,z as handleDrEditionBackfill};
@@ -251,7 +251,6 @@ interface SiteConfig {
251
251
  norstat?: NorstatConfig;
252
252
  siteSpecificConfig?: SiteSpecificConfig;
253
253
  sponsorstripe?: SponsorstripeConfig;
254
- privacyBroker?: PrivacyBrokerConfig;
255
254
  drEdition?: DrEditionConfig;
256
255
  kilkaya?: KilkayaConfig;
257
256
  forwardExternalImpId?: boolean;
@@ -469,11 +468,6 @@ interface RightColumnSplitConfig {
469
468
  adSelector: string;
470
469
  trackSelector?: string;
471
470
  }
472
- interface PrivacyBrokerConfig {
473
- enabled: boolean;
474
- clientId: string;
475
- storageKeyPrefix: string;
476
- }
477
471
  interface KilkayaConfig {
478
472
  enabled: boolean;
479
473
  url: string;
@@ -509,6 +503,7 @@ interface DrEditionParams {
509
503
  device: DeviceType;
510
504
  tcf?: TCFConfig;
511
505
  isMobileApp?: boolean;
506
+ country?: Country;
512
507
  renderAsBackfill?: boolean;
513
508
  }
514
509
  interface DrEditionObserverConfig {
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime");function t(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const n={get:(e,n)=>t(void 0,void 0,void 0,function*(){const t=yield fetch(e,n);if(!t.ok)throw new Error(t.statusText);return yield t.json()}),post:(e,n,i)=>t(void 0,void 0,void 0,function*(){const t=JSON.stringify(i),r=yield fetch(e,{method:"POST",headers:n,body:t});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},i=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},r=["netboard","board"];class o{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:r}=e,o=(()=>{const e=window.location.href;return new URL(e).searchParams.get("dre_override_inv_code")||""})(),s=JSON.stringify(null!==(i=null===(n=window.advertory)||void 0===n?void 0:n.renderedDrEditionAds)&&void 0!==i?i:[]),a=new URL("https://dr-edition-teaser-server.inventory.schibsted.io/editions"),{envId:d,spid:l}=t;return a.searchParams.append("editionName",r),o&&a.searchParams.append("urlData",o),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(e){return t(this,void 0,void 0,function*(){var t,r;const o=yield this.identityFacade.getIdentityUser(),s=null!==(r=yield null===(t=this.tracker)||void 0===t?void 0:t.getEnvironmentId())&&void 0!==r?r:"",a=(null==o?void 0:o.userId)?String(o.userId):"",d=this.buildUrl(e,{envId:s,spid:a});try{i("Starting fetching DrEdition ad from URL:",d);const e={method:"GET"},t=yield n.get(d,e);return i("Fetch operation completed successfully."),t}catch(e){i("Error during fetch operation:",e)}return null})}}class s{getDrEditionUTMParams(e,t){var n;const{title:i="",clientName:r,creativeId:o}=null!==(n=null==e?void 0:e.pulseData)&&void 0!==n?n:{},{editionName:s}=t,a=i.replace(/<[^>]*>/g,"");return Object.assign({utm_source:"vgfront",utm_content:s,utm_campaign:r,utm_medium:a},o&&{utm_id:`df-${o}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),r=new URLSearchParams(decodeURIComponent(e.search)),o=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{r.has(e)||o.set(e,null!=t?t:"")}),o.toString().replace(/\+/g,"%20")}getUrlWithParams(e,t){var n;const i=null===(n=null==e?void 0:e.pulseData)||void 0===n?void 0:n.url;if(!i)return"";const r=this.getDrEditionUTMParams(e,t),o=new URL(i);return Object.entries(r).forEach(([e,t])=>{o.searchParams.has(e)||o.searchParams.set(e,null!=t?t:"")}),o.toString()}handleVideo(e,n){return t(this,void 0,void 0,function*(){const{id:t,autoplay:i,mute:r,videoLoop:o,vendor:s}=n.videoConfiguration;e.classList.add("vgtv-video-container"),Object.assign(e.dataset,{vgtvVideoId:t,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:r,vgtvLoop:!!o,vgtvNa:!0,vgtvRecommended:!1,vgtvPulseProvider:"vg",vgtvPulseProductTag:"partnerstudio"})})}getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}}const a=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&(()=>{const e=document.querySelector(".advertory-wallpaper-background");e&&e.remove()})())},d=e=>{const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("display"),n.style.removeProperty("display"))},l=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):i("Dr. Edition container does not have a parent element, cannot remove height lock.")};class c{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(e,n){return t(this,void 0,void 0,function*(){var t,r;const{drEditionConfig:{containerSelector:o},renderAsBackfill:s=!1}=n,c=e.querySelector(o);if(!c)return void i(`Container with selector "${o}" not found.`);const u=yield this.drEditionService.fetchData(n);return(null==u?void 0:u.itemId)||s?!(null==u?void 0:u.itemId)&&s?(i("No Dr. Edition ads available to render. Collapsing whole placement."),a(e.id),void l(c)):((null==u?void 0:u.itemId)&&s&&(i("Dr. Edition ad available to render as a Xandr backfill."),d(e.id)),void(u?(u.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(u.css,"style"),yield this.rendererManager.render(c,u,n),yield null===(t=this.videoManager)||void 0===t?void 0:t.handle(u,n),l(c),this.drEditionAds.push(u),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(u.itemId),this.observeAdView(e,u,n),null===(r=e.querySelector("a"))||void 0===r||r.addEventListener("pointerup",()=>null)):l(c))):(i("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(c),this.showBackfill(e),void l(c))})}observeAdView(e,t,n){this.observeCarousel(e,t,n)||((e,t,n={threshold:.5})=>{new IntersectionObserver(([e],n)=>{e.isIntersecting&&(t(),n.disconnect())},n).observe(e)})(e,()=>this.pulseManager.trackContentView(e,t,n),{threshold:.5})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";d(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let r=null;const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(r&&clearTimeout(r),r=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{o.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{o.observe(e)}),!0}}const u=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return i("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let r=!1;const o=e=>{r||(i("Resolving advertising permission value obtained"),r=!0,t(e))},s=setTimeout(()=>{i("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{i("On Tcf Ready called, waiting for permission"),clearTimeout(s)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(s);const t=Number(e);i("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),v="cmp:loaded";let p,g=!1;const h=(e,n)=>{const r=!!(null==e?void 0:e.enabled),o=(null==e?void 0:e.timeout)||3e3,s=(a="bypass_tcf",new URLSearchParams(window.location.search).get(a));var a;const d=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(i("TCF bypass param detected, returning consent: true"),!0):(i("TCF is not enabled, returning consent: true"),!0))(r,s))return!0;if(g)return null;if(!p)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=p.getConsentedToAllSync();return i(`TCF consented to all is: ${t}`),p.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(i("Getting TCF consent manager..."),window._tcf_)return i("TCF consent manager is already available"),p=window._tcf_,void e(p);i("TCF consent manager is not available");const n=()=>{i("CMP loaded, resolving consent manager..."),r&&clearTimeout(r),window._tcf_?(p=window._tcf_,e(p)):t(new Error("CMP loaded but window._tcf_ is not defined"))},r=setTimeout(()=>{document.removeEventListener(v,n),g=!0,t(new Error("Timeout waiting for CMP to load"))},o);i("Listening for CMP loaded event..."),document.addEventListener(v,n,{once:!0})}):Promise.resolve(null),getConsentSync:d,getConsentAsync:()=>t(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return i(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));if(null==e?void 0:e.schibstedAdChoicesEnabled)return i("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield u(e);if(!(null==e?void 0:e.enabled))return!0;const t=d();return null!==t?t:yield new Promise((e,t)=>{try{if(!p)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");p.isConsentedToAll(t=>{e(t)})}catch(e){t(e)}})})}},m="mobile";class y{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,n,i){return t(this,void 0,void 0,function*(){if(!(null==n?void 0:n.itemId))return;const{getConsentAsync:t}=h(i.tcf,i.isMobileApp),r=yield t(),o=i.device===m?n.mobileHTML:n.desktopHTML;const s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=s,e.querySelectorAll("a").forEach(e=>{var t,r,o;e.search=null!==(o=null===(r=(t=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(t,e,n,i))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,n,i)})})}}class f{constructor(e){this.strategy=e}handle(e,n){return t(this,void 0,void 0,function*(){const{videoConfiguration:{id:t,preview:i}={}}=e;(t||i)&&(yield this.importScript(n),yield this.createVideoElement(e,n))})}importScript(e){return t(this,void 0,void 0,function*(){const n=e.drEditionConfig.videoScriptUrl,r=document.querySelector(`script[src="${n}"]`);if(n&&!window.autoplayQueue&&!r)try{yield((e,...n)=>t(void 0,[e,...n],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.src=e;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}))(n)}catch(e){i("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(e,n){return t(this,void 0,void 0,function*(){const t=document.createElement("div"),{node:i}=e.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(e,n))return;this.strategy.handleVideo(t,e),null==r||r.appendChild(t),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const o=null==r?void 0:r.parentNode;if(!o)return;const s=o.closest("a");o.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,r;const{preview:{url:o,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!o)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}class w{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t,n,i){return{}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getTeaserElementText(e,t){if(!e)return"";const n=e.querySelector({title:".dr-edition-title",subtitle:".dr-edition-subtitle",image:"img.teaser-main-image"}[t]);if(!n)return"";if("image"===t)return n.src||"";const i=null==n?void 0:n.textContent;return i?i.trim():""}getEventTarget(e,t){const{itemId:n,pulseData:{url:i}={}}=t,r=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=r?r:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e,n,i){return t(this,void 0,void 0,function*(){var t,r,o,s,a,d,l,c;if(!this.pulse)return;const u=this.getEventInput(e,n,i,"view");(null===(t=this.pulse)||void 0===t?void 0:t.trackLegacyViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackLegacyViewUIElement)||void 0===o||o.call(r,u):(null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)?null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackViewUIElement)||void 0===d||d.call(a,u):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,u)})}trackContentClick(e,n,i){return t(this,void 0,void 0,function*(){var t,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,n,i,"click");this.pulse.trackLegacyClickUIElement?null===(r=(t=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(t,l):this.pulse.trackClickUIElement?null===(s=(o=this.pulse).trackClickUIElement)||void 0===s||s.call(o,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}}class b extends w{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt:creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}class E extends w{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,h=Math.floor(Date.now()/1e3),m=this.getTeaserElementText(e,"title"),y=this.getTeaserElementText(e,"subtitle"),f=this.getTeaserElementText(e,"image"),w=null!==(a=null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getUrlWithParams)||void 0===o?void 0:o.call(r,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}}const P="svd",C="vg",T="aftonbladet",I="e24",S="front",k=e=>t(void 0,void 0,void 0,function*(){var t,n;return(null===(t=null===window||void 0===window?void 0:window.SVP)||void 0===t?void 0:t.Player)?new window.SVP.Player(e):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(e):yield new Promise(t=>{window.addEventListener("onSvpPlayerReady",()=>t(new window.SVP.Player(e)))}))}),A={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return t(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return F})})}})}};class L{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){yield t(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const a=["ContentMutePlugin"],d=this.createPlayerOverlay(e);var l,c;c=d,null==(l=a)||l.forEach(e=>{A[e](c)});const u={id:n,node:i,autoplay:r,mute:o,vendor:s,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},v=yield k(u);v.once("assetReady",()=>{((e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})})(v,a)}),v.once("ready",()=>{const t=e;new MutationObserver(e=>{e.forEach(({type:e,attributeName:n})=>{"attributes"===e&&"class"===n&&(t.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),t.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(t,{attributes:!0,attributeFilter:["class"]})}),v.once("PulseStats:ready",()=>t(this,void 0,void 0,function*(){const e=yield v.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===S?"sdrn:e24:frontpage:front":`sdrn:e24:article:${t}`}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];if(!n.includes("https://e24.no/annonsorinnhold/"))return[n];const{pathname:i}=new URL(n),r=i.split("/").filter(Boolean);return r.length?[...r.slice(1),n]:[n]}createPlayerOverlay(e){const t=document.createElement("div");t.classList.add("cm-custom-video-overlay"),e.parentElement&&(t.innerHTML=e.parentElement.innerHTML,e.parentElement.replaceChild(t,e));return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),t.classList.add("has-interacted")}),t}}const j="https://www.aftonbladet.se/video-player-extras/latest/";class M{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${j}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${j}external-link.js`]:{name:"ExternalLink"}}};yield k(s),this.addEditionVideoClass(e)})}addEditionVideoClass(e){var t;(null===(t=null==e?void 0:e.parentElement)||void 0===t?void 0:t.parentElement)&&e.parentElement.parentElement.classList.add("dr-edition-video-player")}getPulseObjectId(){return""}getPulsePageId(){return""}}const D=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class V{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){const a={id:n,node:i,autoplay:r,mute:o,vendor:s,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},D(e)?e:{}),{provider:Object.assign(Object.assign({},D(null==e?void 0:e.provider)?e.provider:{}),{productTag:"partnerstudio"})})},skin:{name:"svd-player",url:""},settings:{pulse:{host:"se-aftonbladet.videoplaza.tv",contentMetadata:{category:"SvD",tags:["standard-linears","pause",`video-${n}`]},requestSettings:{}}}},d=yield k(a);d.once("PulseStats:ready",()=>t(this,void 0,void 0,function*(){const e=yield d.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===S?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}class _{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}}const N="se",O=(e,t,n)=>{var i;const{publisher:r,pageType:a,country:d}=e,l={[C]:new s,[I]:new L,[T]:new M,[P]:new V}[r]||new _,u=new(d===N?b:E)(n,l,a),v=new o(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),p=new y(l,u),g=new f(l);return new c(v,p,g,u)},U=()=>t(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class x{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return t(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return i("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return t(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const B=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,r=document.querySelectorAll(i),o=new IntersectionObserver((i,r)=>((e,t,n,i,r)=>{const o=O(n,i,r);e.forEach(e=>{var i,r,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(r=a.dataset.pulseColumnname)&&void 0!==r?r:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";o.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,r,e,t,n),{rootMargin:"400% 0px"});r.forEach(e=>o.observe(e))},R=(e,n,...r)=>t(void 0,[e,n,...r],void 0,function*(e,t,n="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return i(`Schibsted Consent to Pay is not enabled, returning true for ${n}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return i(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${n}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:r}=h(e);return(yield r())?(i(`Schibsted Ad Choices consent given according to TCF consent manager for ${n}`),!0):(i(`Schibsted Ad Choices consent not given according to TCF consent manager for ${n}`),!1)}),$=[];const q=function(e){if("undefined"==typeof window)return;const t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}("[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-slider-time{display:none}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container{padding:0 6px;height:36px}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon{margin-right:3px;height:unset;width:unset;bottom:0}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon-volume,[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon-playback{display:flex}");var F=Object.freeze({__proto__:null,default:q});exports.DrEdition=({editionName:t,fallbackTargetId:n,children:i,pulseData:r})=>{const o=(e=>{const t={};if(!e)return t;for(const[n,i]of Object.entries(e))t[`data-pulse-${n}`]=String(i);return t})(r);return e.jsxs("div",Object.assign({className:"dr-edition-wrapper dr-edition-lock-height","data-edition-name":t},o,{children:[e.jsx("div",{className:"inscreen-target"}),e.jsx("div",{className:"container"}),e.jsx("div",{className:"fallback","data-fallback-target-id":n,style:{display:"none"},children:i})]}))},exports.getDrEditionManager=O,exports.handleDrEdition=e=>t(void 0,void 0,void 0,function*(){var t;if(!e.drEdition)return;if(!(yield R(e.tcf,e.isMobileApp,"handleDrEdition")))return;const n=yield U(),i=new x(n);B({publisher:e.publisher,drEditionConfig:e.drEdition,device:e.deviceType,pageType:e.pageType,country:e.country},i,null===(t=e.pulse)||void 0===t?void 0:t.instance)}),exports.handleDrEditionBackfill=(e,n)=>t(void 0,void 0,void 0,function*(){var t;const{pulse:o,tcf:s,deviceType:a,drEdition:d,publisher:l,pageType:c,country:u,isMobileApp:v}=e;if(!(yield R(s,v,"handleDrEditionBackfill")))return;const p=((e,t)=>{var n;const{deviceType:i,placements:o,drEdition:{fallbackGlobalEditionName:s}={}}=e,a=o[i]||o.desktop,d=(e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e})(t.targetId),l=a.find(e=>e.id===d),c=r.some(e=>d.startsWith(e)),u=$.includes(d),v=(null===(n=null==l?void 0:l.drEdition)||void 0===n?void 0:n.editionName)||s;return l&&c&&!u&&v?($.push(d),Object.assign(Object.assign({},l),{drEdition:Object.assign(Object.assign({},l.drEdition),{editionName:v})})):null})(e,n);if(!p)return;if(!(null==o?void 0:o.instance))return void i("Pulse has not been passed as a prop, aborting");const g=yield U(),h=new x(g),m=O({publisher:l,pageType:c,country:u},h,null==o?void 0:o.instance),y=document.getElementById(n.targetId);if(!y||!d)return;y.classList.value="";const f=document.createElement("div");f.className=d.containerSelector.replace(/^[.#:[\]]+/,""),y.innerHTML=f.outerHTML;const w={editionName:(null===(t=null==p?void 0:p.drEdition)||void 0===t?void 0:t.editionName)||"",drEditionConfig:d,device:a,tcf:s,isMobileApp:v,renderAsBackfill:!0};yield m.fetchAndRenderAd(y,w)});
1
+ "use strict";var e=require("react/jsx-runtime");function t(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const n={get:(e,n)=>t(void 0,void 0,void 0,function*(){const t=yield fetch(e,n);if(!t.ok)throw new Error(t.statusText);return yield t.json()}),post:(e,n,i)=>t(void 0,void 0,void 0,function*(){const t=JSON.stringify(i),r=yield fetch(e,{method:"POST",headers:n,body:t});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},i=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},r=["netboard","board"];class o{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:r}=e,o=(()=>{const e=window.location.href;return new URL(e).searchParams.get("dre_override_inv_code")||""})(),s=JSON.stringify(null!==(i=null===(n=window.advertory)||void 0===n?void 0:n.renderedDrEditionAds)&&void 0!==i?i:[]),a=new URL("https://dr-edition-teaser-server.inventory.schibsted.io/editions"),{envId:d,spid:l}=t;return a.searchParams.append("editionName",r),o&&a.searchParams.append("urlData",o),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(e){return t(this,void 0,void 0,function*(){var t,r;const o=yield this.identityFacade.getIdentityUser(),s=null!==(r=yield null===(t=this.tracker)||void 0===t?void 0:t.getEnvironmentId())&&void 0!==r?r:"",a=(null==o?void 0:o.userId)?String(o.userId):"",d=this.buildUrl(e,{envId:s,spid:a});try{i("Starting fetching DrEdition ad from URL:",d);const e={method:"GET"},t=yield n.get(d,e);return i("Fetch operation completed successfully."),t}catch(e){i("Error during fetch operation:",e)}return null})}}class s{getDrEditionUTMParams(e,t){var n;const{title:i="",clientName:r,creativeId:o}=null!==(n=null==e?void 0:e.pulseData)&&void 0!==n?n:{},{editionName:s}=t,a=i.replace(/<[^>]*>/g,"");return Object.assign({utm_source:"vgfront",utm_content:s,utm_campaign:r,utm_medium:a},o&&{utm_id:`df-${o}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),r=new URLSearchParams(decodeURIComponent(e.search)),o=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{r.has(e)||o.set(e,null!=t?t:"")}),o.toString().replace(/\+/g,"%20")}getUrlWithParams(e,t){var n;const i=null===(n=null==e?void 0:e.pulseData)||void 0===n?void 0:n.url;if(!i)return"";const r=this.getDrEditionUTMParams(e,t),o=new URL(i);return Object.entries(r).forEach(([e,t])=>{o.searchParams.has(e)||o.searchParams.set(e,null!=t?t:"")}),o.toString()}handleVideo(e,n){return t(this,void 0,void 0,function*(){const{id:t,autoplay:i,mute:r,videoLoop:o,vendor:s}=n.videoConfiguration;e.classList.add("vgtv-video-container"),Object.assign(e.dataset,{vgtvVideoId:t,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:r,vgtvLoop:!!o,vgtvNa:!0,vgtvRecommended:!1,vgtvPulseProvider:"vg",vgtvPulseProductTag:"partnerstudio"})})}getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}}const a=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&(()=>{const e=document.querySelector(".advertory-wallpaper-background");e&&e.remove()})())},d=e=>{const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("display"),n.style.removeProperty("display"))},l=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):i("Dr. Edition container does not have a parent element, cannot remove height lock.")};class c{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(e,n){return t(this,void 0,void 0,function*(){var t,r;const{drEditionConfig:{containerSelector:o},renderAsBackfill:s=!1}=n,c=e.querySelector(o);if(!c)return void i(`Container with selector "${o}" not found.`);const u=yield this.drEditionService.fetchData(n);return(null==u?void 0:u.itemId)||s?!(null==u?void 0:u.itemId)&&s?(i("No Dr. Edition ads available to render. Collapsing whole placement."),a(e.id),void l(c)):((null==u?void 0:u.itemId)&&s&&(i("Dr. Edition ad available to render as a Xandr backfill."),d(e.id)),void(u?(u.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(u.css,"style"),yield this.rendererManager.render(c,u,n),yield null===(t=this.videoManager)||void 0===t?void 0:t.handle(u,n),l(c),this.drEditionAds.push(u),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(u.itemId),this.observeAdView(e,u,n),null===(r=e.querySelector("a"))||void 0===r||r.addEventListener("pointerup",()=>null)):l(c))):(i("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(c),this.showBackfill(e),void l(c))})}observeAdView(e,t,n){this.observeCarousel(e,t,n)||((e,t,n={threshold:.5})=>{new IntersectionObserver(([e],n)=>{e.isIntersecting&&(t(),n.disconnect())},n).observe(e)})(e,()=>this.pulseManager.trackContentView(e,t,n),{threshold:.5})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";d(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let r=null;const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(r&&clearTimeout(r),r=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{o.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{o.observe(e)}),!0}}const u=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return i("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let r=!1;const o=e=>{r||(i("Resolving advertising permission value obtained"),r=!0,t(e))},s=setTimeout(()=>{i("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{i("On Tcf Ready called, waiting for permission"),clearTimeout(s)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(s);const t=Number(e);i("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),v="no",p="se",g="cmp:loaded";let h,m=!1;const y=(e,n,r)=>{const o=!!(null==e?void 0:e.enabled),s=(null==e?void 0:e.timeout)||3e3,a=(d="bypass_tcf",new URLSearchParams(window.location.search).get(d));var d;const l=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(i("TCF bypass param detected, returning consent: true"),!0):(i("TCF is not enabled, returning consent: true"),!0))(o,a))return!0;if(m)return null;if(!h)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=h.getConsentedToAllSync();return i(`TCF consented to all is: ${t}`),h.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(i("Getting TCF consent manager..."),window._tcf_)return i("TCF consent manager is already available"),h=window._tcf_,void e(h);i("TCF consent manager is not available");const n=()=>{i("CMP loaded, resolving consent manager..."),r&&clearTimeout(r),window._tcf_?(h=window._tcf_,e(h)):t(new Error("CMP loaded but window._tcf_ is not defined"))},r=setTimeout(()=>{document.removeEventListener(g,n),m=!0,t(new Error("Timeout waiting for CMP to load"))},s);i("Listening for CMP loaded event..."),document.addEventListener(g,n,{once:!0})}):Promise.resolve(null),getConsentSync:l,getConsentAsync:()=>t(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return i(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const t=(null==e?void 0:e.schibstedAdChoicesEnabled)&&r===p,o=(null==e?void 0:e.schibstedAdChoicesEnabled)&&!n&&r===v;if(t||o)return i("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield u(e);if(!(null==e?void 0:e.enabled))return!0;const a=l();return null!==a?a:yield new Promise((e,t)=>{try{if(!h)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let t=!1;const n=n=>{t||(t=!0,e(n))},r=setTimeout(()=>{i("TCF isConsentedToAll timed out, resolving with false"),n(!1)},s);h.onTcfReady(()=>{i("On Tcf Ready called, waiting for consent"),clearTimeout(r)}),h.isConsentedToAll(t=>{clearTimeout(r),e(t)})}catch(e){t(e)}})})}},f="mobile";class w{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,n,i){return t(this,void 0,void 0,function*(){if(!(null==n?void 0:n.itemId))return;const{getConsentAsync:t}=y(i.tcf,i.isMobileApp,i.country),r=yield t(),o=i.device===f?n.mobileHTML:n.desktopHTML;const s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=s,e.querySelectorAll("a").forEach(e=>{var t,r,o;e.search=null!==(o=null===(r=(t=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(t,e,n,i))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,n,i)})})}}class b{constructor(e){this.strategy=e}handle(e,n){return t(this,void 0,void 0,function*(){const{videoConfiguration:{id:t,preview:i}={}}=e;(t||i)&&(yield this.importScript(n),yield this.createVideoElement(e,n))})}importScript(e){return t(this,void 0,void 0,function*(){const n=e.drEditionConfig.videoScriptUrl,r=document.querySelector(`script[src="${n}"]`);if(n&&!window.autoplayQueue&&!r)try{yield((e,...n)=>t(void 0,[e,...n],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.src=e;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}))(n)}catch(e){i("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(e,n){return t(this,void 0,void 0,function*(){const t=document.createElement("div"),{node:i}=e.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(e,n))return;this.strategy.handleVideo(t,e),null==r||r.appendChild(t),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const o=null==r?void 0:r.parentNode;if(!o)return;const s=o.closest("a");o.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,r;const{preview:{url:o,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!o)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}class E{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t,n,i){return{}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getTeaserElementText(e,t){if(!e)return"";const n=e.querySelector({title:".dr-edition-title",subtitle:".dr-edition-subtitle",image:"img.teaser-main-image"}[t]);if(!n)return"";if("image"===t)return n.src||"";const i=null==n?void 0:n.textContent;return i?i.trim():""}getEventTarget(e,t){const{itemId:n,pulseData:{url:i}={}}=t,r=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=r?r:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e,n,i){return t(this,void 0,void 0,function*(){var t,r,o,s,a,d,l,c;if(!this.pulse)return;const u=this.getEventInput(e,n,i,"view");(null===(t=this.pulse)||void 0===t?void 0:t.trackLegacyViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackLegacyViewUIElement)||void 0===o||o.call(r,u):(null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)?null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackViewUIElement)||void 0===d||d.call(a,u):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,u)})}trackContentClick(e,n,i){return t(this,void 0,void 0,function*(){var t,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,n,i,"click");this.pulse.trackLegacyClickUIElement?null===(r=(t=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(t,l):this.pulse.trackClickUIElement?null===(s=(o=this.pulse).trackClickUIElement)||void 0===s||s.call(o,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}}class P extends E{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt:creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}class T extends E{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,h=Math.floor(Date.now()/1e3),m=this.getTeaserElementText(e,"title"),y=this.getTeaserElementText(e,"subtitle"),f=this.getTeaserElementText(e,"image"),w=null!==(a=null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getUrlWithParams)||void 0===o?void 0:o.call(r,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}}const C="svd",I="vg",S="aftonbladet",k="e24",A="front",L=e=>t(void 0,void 0,void 0,function*(){var t,n;return(null===(t=null===window||void 0===window?void 0:window.SVP)||void 0===t?void 0:t.Player)?new window.SVP.Player(e):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(e):yield new Promise(t=>{window.addEventListener("onSvpPlayerReady",()=>t(new window.SVP.Player(e)))}))}),j={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return t(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return H})})}})}};class M{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){yield t(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const a=["ContentMutePlugin"],d=this.createPlayerOverlay(e);var l,c;c=d,null==(l=a)||l.forEach(e=>{j[e](c)});const u={id:n,node:i,autoplay:r,mute:o,vendor:s,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},v=yield L(u);v.once("assetReady",()=>{((e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})})(v,a)}),v.once("ready",()=>{const t=e;new MutationObserver(e=>{e.forEach(({type:e,attributeName:n})=>{"attributes"===e&&"class"===n&&(t.classList.contains("jw-state-playing")?d.classList.add("is-playing"):d.classList.remove("is-playing"),t.classList.contains("jw-flag-user-inactive")?d.classList.add("is-inactive"):d.classList.remove("is-inactive"))})}).observe(t,{attributes:!0,attributeFilter:["class"]})}),v.once("PulseStats:ready",()=>t(this,void 0,void 0,function*(){const e=yield v.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===A?"sdrn:e24:frontpage:front":`sdrn:e24:article:${t}`}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];if(!n.includes("https://e24.no/annonsorinnhold/"))return[n];const{pathname:i}=new URL(n),r=i.split("/").filter(Boolean);return r.length?[...r.slice(1),n]:[n]}createPlayerOverlay(e){const t=document.createElement("div");t.classList.add("cm-custom-video-overlay"),e.parentElement&&(t.innerHTML=e.parentElement.innerHTML,e.parentElement.replaceChild(t,e));return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),t.classList.add("has-interacted")}),t}}const D="https://www.aftonbladet.se/video-player-extras/latest/";class O{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${D}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${D}external-link.js`]:{name:"ExternalLink"}}};yield L(s),this.addEditionVideoClass(e)})}addEditionVideoClass(e){var t;(null===(t=null==e?void 0:e.parentElement)||void 0===t?void 0:t.parentElement)&&e.parentElement.parentElement.classList.add("dr-edition-video-player")}getPulseObjectId(){return""}getPulsePageId(){return""}}const V=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class _{handleVideo(e,n){return t(this,arguments,void 0,function*(e,{videoConfiguration:{id:n,node:i,autoplay:r,mute:o,vendor:s}}){const a={id:n,node:i,autoplay:r,mute:o,vendor:s,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},V(e)?e:{}),{provider:Object.assign(Object.assign({},V(null==e?void 0:e.provider)?e.provider:{}),{productTag:"partnerstudio"})})},skin:{name:"svd-player",url:""},settings:{pulse:{host:"se-aftonbladet.videoplaza.tv",contentMetadata:{category:"SvD",tags:["standard-linears","pause",`video-${n}`]},requestSettings:{}}}},d=yield L(a);d.once("PulseStats:ready",()=>t(this,void 0,void 0,function*(){const e=yield d.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===A?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}class N{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}}const U=(e,t,n)=>{var i;const{publisher:r,pageType:a,country:d}=e,l={[I]:new s,[k]:new M,[S]:new O,[C]:new _}[r]||new N,u=new(d===p?P:T)(n,l,a),v=new o(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),g=new w(l,u),h=new b(l);return new c(v,g,h,u)},x=()=>t(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class B{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return t(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return i("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return t(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const R=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,r=document.querySelectorAll(i),o=new IntersectionObserver((i,r)=>((e,t,n,i,r)=>{const o=U(n,i,r);e.forEach(e=>{var i,r,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(r=a.dataset.pulseColumnname)&&void 0!==r?r:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";o.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,r,e,t,n),{rootMargin:"400% 0px"});r.forEach(e=>o.observe(e))},$=(e,n,r,...o)=>t(void 0,[e,n,r,...o],void 0,function*(e,t,n,r="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return i(`Schibsted Consent to Pay is not enabled, returning true for ${r}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return i(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${r}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:o}=y(e,t,n);return(yield o())?(i(`Schibsted Ad Choices consent given according to TCF consent manager for ${r}`),!0):(i(`Schibsted Ad Choices consent not given according to TCF consent manager for ${r}`),!1)}),q=[];const F=function(e){if("undefined"==typeof window)return;const t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}("[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-slider-time{display:none}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container{padding:0 6px;height:36px}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon{margin-right:3px;height:unset;width:unset;bottom:0}[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon-volume,[id^=integration_godt-menu]>article .jw-controls>.jw-controlbar .jw-button-container .jw-icon-playback{display:flex}");var H=Object.freeze({__proto__:null,default:F});exports.DrEdition=({editionName:t,fallbackTargetId:n,children:i,pulseData:r})=>{const o=(e=>{const t={};if(!e)return t;for(const[n,i]of Object.entries(e))t[`data-pulse-${n}`]=String(i);return t})(r);return e.jsxs("div",Object.assign({className:"dr-edition-wrapper dr-edition-lock-height","data-edition-name":t},o,{children:[e.jsx("div",{className:"inscreen-target"}),e.jsx("div",{className:"container"}),e.jsx("div",{className:"fallback","data-fallback-target-id":n,style:{display:"none"},children:i})]}))},exports.getDrEditionManager=U,exports.handleDrEdition=e=>t(void 0,void 0,void 0,function*(){var t;if(!e.drEdition)return;if(!(yield $(e.tcf,e.isMobileApp,e.country,"handleDrEdition")))return;const n=yield x(),i=new B(n);R({publisher:e.publisher,drEditionConfig:e.drEdition,device:e.deviceType,pageType:e.pageType,country:e.country},i,null===(t=e.pulse)||void 0===t?void 0:t.instance)}),exports.handleDrEditionBackfill=(e,n)=>t(void 0,void 0,void 0,function*(){var t;const{pulse:o,tcf:s,deviceType:a,drEdition:d,publisher:l,pageType:c,country:u,isMobileApp:v}=e;if(!(yield $(s,v,u,"handleDrEditionBackfill")))return;const p=((e,t)=>{var n;const{deviceType:i,placements:o,drEdition:{fallbackGlobalEditionName:s}={}}=e,a=o[i]||o.desktop,d=(e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e})(t.targetId),l=a.find(e=>e.id===d),c=r.some(e=>d.startsWith(e)),u=q.includes(d),v=(null===(n=null==l?void 0:l.drEdition)||void 0===n?void 0:n.editionName)||s;return l&&c&&!u&&v?(q.push(d),Object.assign(Object.assign({},l),{drEdition:Object.assign(Object.assign({},l.drEdition),{editionName:v})})):null})(e,n);if(!p)return;if(!(null==o?void 0:o.instance))return void i("Pulse has not been passed as a prop, aborting");const g=yield x(),h=new B(g),m=U({publisher:l,pageType:c,country:u},h,null==o?void 0:o.instance),y=document.getElementById(n.targetId);if(!y||!d)return;y.classList.value="";const f=document.createElement("div");f.className=d.containerSelector.replace(/^[.#:[\]]+/,""),y.innerHTML=f.outerHTML;const w={editionName:(null===(t=null==p?void 0:p.drEdition)||void 0===t?void 0:t.editionName)||"",drEditionConfig:d,device:a,tcf:s,isMobileApp:v,country:u,renderAsBackfill:!0};yield m.fetchAndRenderAd(y,w)});
@@ -1 +1 @@
1
- "use strict";var e,t,n=require("./glimr-sdk-mS8sOhxy.js");function i(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;var r=function(){if(t)return e;t=1;var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i}(e)}(e)},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function d(e,t,n){var i={};return n.isMergeableObject(e)&&s(e).forEach(function(t){i[t]=r(e[t],n)}),s(t).forEach(function(o){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(a(e,o)&&n.isMergeableObject(t[o])?i[o]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(o,n)(e[o],t[o],n):i[o]=r(t[o],n))}),i}function l(e,t,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||n,i.cloneUnlessOtherwiseSpecified=r;var s=Array.isArray(t);return s===Array.isArray(e)?s?i.arrayMerge(e,t,i):d(e,t,i):r(t,i)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},e=l}(),o=n.getDefaultExportFromCjs(r);const s=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],a={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}};class d{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of s){const i=e[n];void 0!==i&&(t[n]=i)}Object.assign(this.config,t),Object.prototype.hasOwnProperty.call(e,"pageOptions")&&void 0!==e.pageOptions&&(this.config.pageOptions=Object.assign(Object.assign({},this.config.pageOptions),e.pageOptions))}get(){if(!this.config)throw new Error("Config was accessed before it had been initialized.");return this.config}getHandlers(){if(!this.siteHandlers)throw new Error("Handlers were accessed before it had been initialized.");return this.siteHandlers}setHandlers(e){this.siteHandlers=o(d.DEFAULT_SITE_HANDLERS,e)}}d.DEFAULT_SITE_HANDLERS={siteEvents:a,initNativeAd:function(){}};const l=new d;l.modifyConfigProperties.bind(l);const c=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},u=864e5,g=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return c("Error with parsing localStorage data"),null}},t=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t))};return{get:e,set:t,setWithTimestamp:(e,n,i=u)=>{const r={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(r))},getByTimestamp:(t,n=u)=>{const i=e(t);if(!i)return null;if(!n)return i;try{const{expirationTime:e,data:t}=JSON.parse(i);return(new Date).getTime()<=e?t:null}catch(e){return c("Error with parsing localStorage data"),null}}}})(),f={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return c(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,t)=>{try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){c(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){c(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},v="no",y="se",h={[y]:"sdrn:schibsted.com:user",[v]:"sdrn:spid.no:user"};class m{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return i(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return c("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return i(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const b="advertory-session",p=()=>i(void 0,void 0,void 0,function*(){var e,t;const{country:n,tracker:{instance:r}={}}=l.get(),o=yield i(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});if(!r||!o)return c("[Privacy Broker] No tracker found."),null;const s=new m(o),a=yield s.isUserLoggedIn(),d=null!==(e=yield((e,t)=>i(void 0,void 0,void 0,function*(){const n=yield e.getUserId();return n?`${h[t]}:${n}`:null}))(r,n))&&void 0!==e?e:"",u=null!==(t=yield(e=>i(void 0,void 0,void 0,function*(){const t=yield e.getEnvironmentId();return t?`sdrn:schibsted:environment:${t}`:null}))(r))&&void 0!==t?t:"",g=(e=>{const{privacyBroker:{storageKeyPrefix:t=b}={}}=l.get();return t+"-"+e})(a?d:u),v=f.get(g);return v||null}),w="glimrTags",T=["glwe_","glwet_"],C={geofenceTags:[],geoTags:[],weatherTags:[]},S=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return c("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const r=e=>{i||(c("Resolving advertising permission value obtained"),i=!0,t(e))},o=setTimeout(()=>{c("Advertising permission timed out, resolving with false"),r(!1)},3e3);window._tcf_.onTcfReady(()=>{c("On Tcf Ready called, waiting for permission"),clearTimeout(o)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(o);const t=Number(e);c("Advertising permission value obtained asynchronously: ",e),r(Boolean(t))})}),A="cmp:loaded";let E,O=!1;const P=(e,t)=>{const n=!!(null==e?void 0:e.enabled),r=(null==e?void 0:e.timeout)||3e3,o=(s="bypass_tcf",new URLSearchParams(window.location.search).get(s));var s;const a=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(c("TCF bypass param detected, returning consent: true"),!0):(c("TCF is not enabled, returning consent: true"),!0))(n,o))return!0;if(O)return null;if(!E)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=E.getConsentedToAllSync();return c(`TCF consented to all is: ${t}`),E.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(c("Getting TCF consent manager..."),window._tcf_)return c("TCF consent manager is already available"),E=window._tcf_,void e(E);c("TCF consent manager is not available");const n=()=>{c("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(E=window._tcf_,e(E)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(A,n),O=!0,t(new Error("Timeout waiting for CMP to load"))},r);c("Listening for CMP loaded event..."),document.addEventListener(A,n,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>i(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return c(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));if(null==e?void 0:e.schibstedAdChoicesEnabled)return c("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield S(e);if(!(null==e?void 0:e.enabled))return!0;const t=a();return null!==t?t:yield new Promise((e,t)=>{try{if(!E)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");E.isConsentedToAll(t=>{e(t)})}catch(e){t(e)}})})}},_=()=>i(void 0,void 0,void 0,function*(){const{privacyBroker:e,tcf:t,isMobileApp:n}=l.get();if(null==t?void 0:t.schibstedAdChoicesEnabled){const e=yield((e,t,...n)=>i(void 0,[e,t,...n],void 0,function*(e,t,n="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return c(`Schibsted Consent to Pay is not enabled, returning true for ${n}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return c(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${n}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:i}=P(e);return(yield i())?(c(`Schibsted Ad Choices consent given according to TCF consent manager for ${n}`),!0):(c(`Schibsted Ad Choices consent not given according to TCF consent manager for ${n}`),!1)}))(t,n,"glimr");return e}if(null==e?void 0:e.enabled){const e=(e=>{const t=null==e?void 0:e.find(e=>e.purpose.includes("targeted_advertising"));if(c("targeted_advertising permissions",t),!(null==t?void 0:t.data)||!Array.isArray(null==t?void 0:t.data))return!1;const n=null==t?void 0:t.data.find(e=>e.includes("geolocation"));return c("geolocation permission",n),!!n})(yield p());return e}return!0}),I={svd:"svd",vg:"vg",godare:"godare",aftenposten:"no-aftenposten",sa:"no-stavangeraftenblad",bt:"no-bergenstidende",aftonbladet:"aftonbladet",e24:"e24",minmote:"minmote",pent:"pent",godt:"godt",tek:"no-tek"},M=e=>T.some(t=>e.startsWith(t)),j=e=>e.startsWith("glgc_"),L=e=>!M(e)&&!j(e),N=e=>{const t=$();if(!t)return C;const n=((e=[])=>e.filter(M))(t),i=((e=[])=>e.filter(j))(t),r=((e=[],t)=>{const n=e.filter(L);if(t){const{publisher:e}=l.get(),t=I[e]||e;n.push(t)}return n})(t,e);return{geoTags:r,geofenceTags:i,weatherTags:n}},$=()=>{const e=g.getByTimestamp(w);return e&&"string"!=typeof e?null==e?void 0:e.tags:null};exports.getGlimrKeywords=e=>i(void 0,void 0,void 0,function*(){const{glimr:t}=l.get(),{addPublisherToGeo:n}=e||{},i=yield _();if(!(null==t?void 0:t.enabled)||!i)return c("No consent for getting glimr tags."),{};const r=(()=>{const{country:e}=l.get();return e===v?"no-sno":"se-generic"})(),o=N(n);return{[`${r}-geo`]:o.geoTags,[`${r}-weather`]:o.weatherTags,[`${r}-geofence`]:o.geofenceTags}}),exports.updateGlimr=()=>i(void 0,void 0,void 0,function*(){const{glimr:e}=l.get();if(!(yield _())||!(null==e?void 0:e.enabled))return void c("No consent for glimr data fetching.");const t=yield(n=500,i(void 0,void 0,void 0,function*(){return yield Promise.race([i(void 0,void 0,void 0,function*(){const e=yield Promise.resolve().then(function(){return require("./glimr-BIcFSFRk.js")}).then(function(e){return e.glimr});return e.default||e}),new Promise(e=>setTimeout(()=>e(!1),n))])}));var n;if(t)try{t.setTagCacheTimeInSeconds(300),yield new Promise(n=>{t.getTags(e.clientId,(e,t)=>{g.setWithTimestamp(w,{tags:e,tagMappings:t}),n(!0)})})}catch(e){c(`Error during getting glimr data: ${e}`)}else c("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:t})});
1
+ "use strict";var e,t,n=require("./glimr-sdk-mS8sOhxy.js");function r(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;var o=function(){if(t)return e;t=1;var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map(function(e){return o(e,n)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function c(e,t,n){var r={};return n.isMergeableObject(e)&&s(e).forEach(function(t){r[t]=o(e[t],n)}),s(t).forEach(function(i){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(a(e,i)&&n.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(i,n)(e[i],t[i],n):r[i]=o(t[i],n))}),r}function l(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||i,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=o;var s=Array.isArray(t);return s===Array.isArray(e)?s?r.arrayMerge(e,t,r):c(e,t,r):o(t,r)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},e=l}(),i=n.getDefaultExportFromCjs(o);const s=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],a={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}};class c{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of s){const r=e[n];void 0!==r&&(t[n]=r)}Object.assign(this.config,t),Object.prototype.hasOwnProperty.call(e,"pageOptions")&&void 0!==e.pageOptions&&(this.config.pageOptions=Object.assign(Object.assign({},this.config.pageOptions),e.pageOptions))}get(){if(!this.config)throw new Error("Config was accessed before it had been initialized.");return this.config}getHandlers(){if(!this.siteHandlers)throw new Error("Handlers were accessed before it had been initialized.");return this.siteHandlers}setHandlers(e){this.siteHandlers=i(c.DEFAULT_SITE_HANDLERS,e)}}c.DEFAULT_SITE_HANDLERS={siteEvents:a,initNativeAd:function(){}};const l=new c;l.modifyConfigProperties.bind(l);const d=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},u=864e5,g=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return d("Error with parsing localStorage data"),null}},t=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t))};return{get:e,set:t,setWithTimestamp:(e,n,r=u)=>{const o={data:n,expirationTime:(new Date).getTime()+r};t(e,JSON.stringify(o))},getByTimestamp:(t,n=u)=>{const r=e(t);if(!r)return null;if(!n)return r;try{const{expirationTime:e,data:t}=JSON.parse(r);return(new Date).getTime()<=e?t:null}catch(e){return d("Error with parsing localStorage data"),null}}}})(),f="glimrTags",v=["glwe_","glwet_"],m={geofenceTags:[],geoTags:[],weatherTags:[]},b=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return d("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let r=!1;const o=e=>{r||(d("Resolving advertising permission value obtained"),r=!0,t(e))},i=setTimeout(()=>{d("Advertising permission timed out, resolving with false"),o(!1)},3e3);window._tcf_.onTcfReady(()=>{d("On Tcf Ready called, waiting for permission"),clearTimeout(i)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(i);const t=Number(e);d("Advertising permission value obtained asynchronously: ",e),o(Boolean(t))})}),h="no",y="se",p="cmp:loaded";let w,T=!1;const C=(e,t,n)=>{const o=!!(null==e?void 0:e.enabled),i=(null==e?void 0:e.timeout)||3e3,s=(a="bypass_tcf",new URLSearchParams(window.location.search).get(a));var a;const c=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(d("TCF bypass param detected, returning consent: true"),!0):(d("TCF is not enabled, returning consent: true"),!0))(o,s))return!0;if(T)return null;if(!w)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=w.getConsentedToAllSync();return d(`TCF consented to all is: ${t}`),w.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(d("Getting TCF consent manager..."),window._tcf_)return d("TCF consent manager is already available"),w=window._tcf_,void e(w);d("TCF consent manager is not available");const n=()=>{d("CMP loaded, resolving consent manager..."),r&&clearTimeout(r),window._tcf_?(w=window._tcf_,e(w)):t(new Error("CMP loaded but window._tcf_ is not defined"))},r=setTimeout(()=>{document.removeEventListener(p,n),T=!0,t(new Error("Timeout waiting for CMP to load"))},i);d("Listening for CMP loaded event..."),document.addEventListener(p,n,{once:!0})}):Promise.resolve(null),getConsentSync:c,getConsentAsync:()=>r(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return d(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const r=(null==e?void 0:e.schibstedAdChoicesEnabled)&&n===y,o=(null==e?void 0:e.schibstedAdChoicesEnabled)&&!t&&n===h;if(r||o)return d("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield b(e);if(!(null==e?void 0:e.enabled))return!0;const s=c();return null!==s?s:yield new Promise((e,t)=>{try{if(!w)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let t=!1;const n=n=>{t||(t=!0,e(n))},r=setTimeout(()=>{d("TCF isConsentedToAll timed out, resolving with false"),n(!1)},i);w.onTcfReady(()=>{d("On Tcf Ready called, waiting for consent"),clearTimeout(r)}),w.isConsentedToAll(t=>{clearTimeout(r),e(t)})}catch(e){t(e)}})})}},A=()=>r(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=l.get();if(null==e?void 0:e.schibstedConsentToPayEnabled){const o=yield((e,t,n,...o)=>r(void 0,[e,t,n,...o],void 0,function*(e,t,n,r="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return d(`Schibsted Consent to Pay is not enabled, returning true for ${r}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return d(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${r}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:o}=C(e,t,n);return(yield o())?(d(`Schibsted Ad Choices consent given according to TCF consent manager for ${r}`),!0):(d(`Schibsted Ad Choices consent not given according to TCF consent manager for ${r}`),!1)}))(e,t,n,"glimr");return o}const{getConsentAsync:o}=C(e,t,n);return yield o()}),O={svd:"svd",vg:"vg",godare:"godare",aftenposten:"no-aftenposten",sa:"no-stavangeraftenblad",bt:"no-bergenstidende",aftonbladet:"aftonbladet",e24:"e24",minmote:"minmote",pent:"pent",godt:"godt",tek:"no-tek"},E=e=>v.some(t=>e.startsWith(t)),S=e=>e.startsWith("glgc_"),P=e=>!E(e)&&!S(e),_=e=>{const t=M();if(!t)return m;const n=((e=[])=>e.filter(E))(t),r=((e=[])=>e.filter(S))(t),o=((e=[],t)=>{const n=e.filter(P);if(t){const{publisher:e}=l.get(),t=O[e]||e;n.push(t)}return n})(t,e);return{geoTags:o,geofenceTags:r,weatherTags:n}},M=()=>{const e=g.getByTimestamp(f);return e&&"string"!=typeof e?null==e?void 0:e.tags:null};exports.getGlimrKeywords=e=>r(void 0,void 0,void 0,function*(){const{glimr:t}=l.get(),{addPublisherToGeo:n}=e||{},r=yield A();if(!(null==t?void 0:t.enabled)||!r)return d("No consent for getting glimr tags."),{};const o=(()=>{const{country:e}=l.get();return e===h?"no-sno":"se-generic"})(),i=_(n);return{[`${o}-geo`]:i.geoTags,[`${o}-weather`]:i.weatherTags,[`${o}-geofence`]:i.geofenceTags}}),exports.updateGlimr=()=>r(void 0,void 0,void 0,function*(){const{glimr:e}=l.get();if(!(yield A())||!(null==e?void 0:e.enabled))return void d("No consent for glimr data fetching.");const t=yield(n=500,r(void 0,void 0,void 0,function*(){return yield Promise.race([r(void 0,void 0,void 0,function*(){const e=yield Promise.resolve().then(function(){return require("./glimr-BIcFSFRk.js")}).then(function(e){return e.glimr});return e.default||e}),new Promise(e=>setTimeout(()=>e(!1),n))])}));var n;if(t)try{t.setTagCacheTimeInSeconds(300),yield new Promise(n=>{t.getTags(e.clientId,(e,t)=>{g.setWithTimestamp(f,{tags:e,tagMappings:t}),n(!0)})})}catch(e){d(`Error during getting glimr data: ${e}`)}else d("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:t})});
@@ -196,7 +196,6 @@ interface SiteConfig {
196
196
  norstat?: NorstatConfig;
197
197
  siteSpecificConfig?: SiteSpecificConfig;
198
198
  sponsorstripe?: SponsorstripeConfig;
199
- privacyBroker?: PrivacyBrokerConfig;
200
199
  drEdition?: DrEditionConfig;
201
200
  kilkaya?: KilkayaConfig;
202
201
  forwardExternalImpId?: boolean;
@@ -414,11 +413,6 @@ interface RightColumnSplitConfig {
414
413
  adSelector: string;
415
414
  trackSelector?: string;
416
415
  }
417
- interface PrivacyBrokerConfig {
418
- enabled: boolean;
419
- clientId: string;
420
- storageKeyPrefix: string;
421
- }
422
416
  interface KilkayaConfig {
423
417
  enabled: boolean;
424
418
  url: string;
@@ -1 +1 @@
1
- "use strict";function e(e,i,n,t){return new(n||(n=Promise))(function(s,d){function r(e){try{a(t.next(e))}catch(e){d(e)}}function o(e){try{a(t.throw(e))}catch(e){d(e)}}function a(e){var i;e.done?s(e.value):(i=e.value,i instanceof n?i:new n(function(e){e(i)})).then(r,o)}a((t=t.apply(e,i||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const i={get:(i,n)=>e(void 0,void 0,void 0,function*(){const e=yield fetch(i,n);if(!e.ok)throw new Error(e.statusText);return yield e.json()}),post:(i,n,t)=>e(void 0,void 0,void 0,function*(){const e=JSON.stringify(t),s=yield fetch(i,{method:"POST",headers:n,body:e});if(!s.ok)throw new Error(s.statusText);return yield s.json()})},n=(e,i)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(i?console.log(n,e,i):console.log(n,e))},t=864e5,s=(()=>{const e=e=>{const i=window.localStorage.getItem(e);if(!i)return null;try{return JSON.parse(i)}catch(e){return n("Error with parsing localStorage data"),null}},i=(e,i)=>{window.localStorage.setItem(e,JSON.stringify(i))};return{get:e,set:i,setWithTimestamp:(e,n,s=t)=>{const d={data:n,expirationTime:(new Date).getTime()+s};i(e,JSON.stringify(d))},getByTimestamp:(i,s=t)=>{const d=e(i);if(!d)return null;if(!s)return d;try{const{expirationTime:e,data:i}=JSON.parse(d);return(new Date).getTime()<=e?i:null}catch(e){return n("Error with parsing localStorage data"),null}}}})(),d={NO:"no",SE:"se"},r="advertory:ppids-cache",o={[d.SE]:`SCH${d.SE.toUpperCase()}-EnvHash`,[d.NO]:`SCH${d.NO.toUpperCase()}-EnvHash`},a={[d.SE]:`SCH${d.SE.toUpperCase()}-UserHash`,[d.NO]:`SCH${d.NO.toUpperCase()}-UserHash`},l={[d.SE]:`sch${d.SE}-envhash-v3`,[d.NO]:`sch${d.NO}-envhash-v3`},c={[d.SE]:`sch${d.SE}-userhash-v3`,[d.NO]:`sch${d.NO}-userhash-v3`},u={[d.SE]:`'sch${d.SE}-iosid-v3'`,[d.NO]:`'sch${d.NO}-iosid-v3'`},p={[d.SE]:`sch${d.SE}-androidid-v3`,[d.NO]:`sch${d.NO}-androidid-v3`},v={[d.SE]:"sdrn:schibsted.com:user",[d.NO]:"sdrn:spid.no:user"};class h{constructor(){this.eids=[]}add(e,i){return e&&this.eids.push({id:e,source:i}),this}buildRyEids(){return this.eids.map(({id:e,source:i})=>({source:i,uids:[{id:e,atype:1,ext:{stype:"ppuid"}}]}))}buildEids(){return[...this.eids]}buildVideoEids(){return this.eids.map(({id:e,source:i})=>`${i},${e}`).join("|")}buildNorstatPath(){const e=this.eids[0];return e?`${e.source}-${e.id}`:""}buildNorstatQuery(e){const i=new URLSearchParams;return this.eids.slice(1).forEach(({id:n,source:t})=>{i.append(e,`${t}-${n}`)}),i}}const P=e=>new Promise(i=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void i(!1);const t=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const i=Number(e);return n("Advertising permission value obtained synchronously: ",e),Boolean(i)})();if(null!==t)return void i(t);let s=!1;const d=e=>{s||(n("Resolving advertising permission value obtained"),s=!0,i(e))},r=setTimeout(()=>{n("Advertising permission timed out, resolving with false"),d(!1)},3e3);window._tcf_.onTcfReady(()=>{n("On Tcf Ready called, waiting for permission"),clearTimeout(r)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(r);const i=Number(e);n("Advertising permission value obtained asynchronously: ",e),d(Boolean(i))})}),f="cmp:loaded";let g,I=!1;const y=(i,t)=>{const s=!!(null==i?void 0:i.enabled),d=(null==i?void 0:i.timeout)||3e3,r=(o="bypass_tcf",new URLSearchParams(window.location.search).get(o));var o;const a=()=>{if(!(null==i?void 0:i.enabled))return!0;if(((e,i)=>e?!!i&&(n("TCF bypass param detected, returning consent: true"),!0):(n("TCF is not enabled, returning consent: true"),!0))(s,r))return!0;if(I)return null;if(!g)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=g.getConsentedToAllSync();return n(`TCF consented to all is: ${e}`),g.getConsentedToAllSync()};return{initConsentManager:()=>(null==i?void 0:i.enabled)?new Promise((e,i)=>{if(n("Getting TCF consent manager..."),window._tcf_)return n("TCF consent manager is already available"),g=window._tcf_,void e(g);n("TCF consent manager is not available");const t=()=>{n("CMP loaded, resolving consent manager..."),s&&clearTimeout(s),window._tcf_?(g=window._tcf_,e(g)):i(new Error("CMP loaded but window._tcf_ is not defined"))},s=setTimeout(()=>{document.removeEventListener(f,t),I=!0,i(new Error("Timeout waiting for CMP to load"))},d);n("Listening for CMP loaded event..."),document.addEventListener(f,t,{once:!0})}):Promise.resolve(null),getConsentSync:a,getConsentAsync:()=>e(void 0,void 0,void 0,function*(){if(null==i?void 0:i.schibstedAdChoicesOverrideValue)return n(`Schibsted Ad Choices override value is set, returning override value: ${i.schibstedAdChoicesOverrideValue}`),Boolean(Number(i.schibstedAdChoicesOverrideValue));if(null==i?void 0:i.schibstedAdChoicesEnabled)return n("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield P(i);if(!(null==i?void 0:i.enabled))return!0;const e=a();return null!==e?e:yield new Promise((e,i)=>{try{if(!g)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");g.isConsentedToAll(i=>{e(i)})}catch(e){i(e)}})})}},m=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(i){return e(this,arguments,void 0,function*(e,i=1e4){var n,t;const s=yield Promise.race([new Promise(e=>{setTimeout(()=>e({xandr:{ppId1:"",ppId2:""}}),i)}),e.instance.getAdvertisingIdentifiers()]);this.setPPIDs(null===(n=s.xandr)||void 0===n?void 0:n.ppId1,null===(t=s.xandr)||void 0===t?void 0:t.ppId2)})}getPPIDs(){var e,i;return null!==this.ppid1&&null!==this.ppid2||n("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(i=this.ppid2)&&void 0!==i?i:""}}setPPIDs(e,i){this.ppid1=null!=e?e:"",this.ppid2=null!=i?i:""}},w=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(i,n){return e(this,void 0,void 0,function*(){var e,t,d,o,a,l,c,u,p,v,h;const P=s.get(r),f=yield this.getNewPPIDs(i,n);if(this.shouldHash(P,f)){const n=null!==(e=i.hasherUrl)&&void 0!==e?e:"https://hasher.schibsted.com/api/v1/hash",s=this.createHasherPayload(f),r=yield this.hashPPIDs(s,n);return r?(this.cachePPIDs(s,r,null===(t=f.idfv)||void 0===t?void 0:t.plain,null===(d=f.anId)||void 0===d?void 0:d.plain),void this.setPPIDs(null!==(o=r.userId)&&void 0!==o?o:"",null!==(a=r.environmentId)&&void 0!==a?a:"",null===(l=f.idfv)||void 0===l?void 0:l.plain,null===(c=f.anId)||void 0===c?void 0:c.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(u=null==P?void 0:P.userId.hashed)&&void 0!==u?u:"",null!==(p=null==P?void 0:P.environmentId.hashed)&&void 0!==p?p:"",null===(v=null==f?void 0:f.idfv)||void 0===v?void 0:v.plain,null===(h=null==f?void 0:f.anId)||void 0===h?void 0:h.plain)})}getPPIDs(){var e,i;return null!==this.ppid1&&null!==this.ppid2||n("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(i=this.ppid2)&&void 0!==i?i:"",idfv:this.idfv,anId:this.anId}}setPPIDs(e,i,n,t){this.ppid1=null!=e?e:"",this.ppid2=null!=i?i:"",this.idfv=null!=n?n:null,this.anId=null!=t?t:null}shouldHash(e,i){var n,t;if(!e)return!0;for(const s in e){if((null===(n=e[s])||void 0===n?void 0:n.plain)!==(null===(t=i[s])||void 0===t?void 0:t.plain))return!0}return!1}cachePPIDs(e,i,n,t){const d=Object.assign(Object.assign({clientId:{plain:e.clientId},userId:{plain:e.userId,hashed:i.userId},environmentId:{plain:e.environmentId,hashed:i.environmentId},trackerType:{plain:e.trackerType},trackerVersion:{plain:e.trackerVersion}},n?{idfv:{plain:n}}:{}),t?{anId:{plain:t}}:{});s.set(r,d)}hashPPIDs(t,s){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield i.post(s,e,t)}catch(e){return n("Error with hashing PPIDs",e),null}})}getNewPPIDs(i,n){return e(this,arguments,void 0,function*({clientId:i,instance:n},t){const s=yield((i,n)=>e(void 0,void 0,void 0,function*(){const e=yield i.getUserId();return e?`${v[n]}:${e}`:null}))(n,t),d=yield(i=>e(void 0,void 0,void 0,function*(){const e=yield i.getEnvironmentId();return e?`sdrn:schibsted:environment:${e}`:null}))(n),r=window.advertory_idfv,o=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:i},userId:{plain:s},environmentId:{plain:d},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},r?{idfv:{plain:r}}:{}),o?{anId:{plain:o}}:{})})}createHasherPayload({clientId:e,trackerType:i,trackerVersion:n,userId:t,environmentId:s}){return{clientId:e.plain,trackerType:i.plain,trackerVersion:n.plain,userId:t.plain,environmentId:s.plain}}};exports.getPPIDLoggedInStatus=()=>{const{ppid1:e,ppid2:i}=m.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":i?"1":"0"}},exports.getPPIDNorstatString=e=>{const{ppid1:i,ppid2:n}=m.getPPIDs(),{ppid1:t,ppid2:s}=w.getPPIDs(),d=(new h).add(n,o[e]).add(i,a[e]).add(s,l[e]).add(t,c[e]);return`${d.buildNorstatPath()}?${d.buildNorstatQuery("alias").toString()}`},exports.getPPIDRelevantYieldConfig=e=>{const{ppid1:i,ppid2:n}=m.getPPIDs(),{ppid1:t,ppid2:s,idfv:d,anId:r}=w.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new h).add(n,o[e]).add(i,a[e]).add(s,l[e]).add(t,c[e]).add(d,u[e]).add(r,p[e]).buildRyEids()}}]}}},exports.getUserIdsObject=e=>{const{ppid1:i,ppid2:n}=m.getPPIDs(),{ppid1:t,ppid2:s,idfv:d,anId:r}=w.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new h).add(n,o[e]).add(i,a[e]).add(s,l[e]).add(t,c[e]).add(d,u[e]).add(r,p[e]).buildEids()}]}},exports.getVideoPPIDs=i=>e(void 0,void 0,void 0,function*(){const{ppid1:e,ppid2:n}=m.getPPIDs(),{ppid1:t,ppid2:s}=w.getPPIDs(),d=(new h).add(n,o[i]).add(e,a[i]).add(s,l[i]).add(t,c[i]);return yield new Promise(e=>{e(d.buildVideoEids())})}),exports.setXandrPPIDs=i=>e(void 0,void 0,void 0,function*(){const{tracker:t,tcf:s,country:d,isMobileApp:r}=i,o=yield((i,t,...s)=>e(void 0,[i,t,...s],void 0,function*(e,i,t="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return n(`Schibsted Consent to Pay is not enabled, returning true for ${t}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return n(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${t}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:s}=y(e);return(yield s())?(n(`Schibsted Ad Choices consent given according to TCF consent manager for ${t}`),!0):(n(`Schibsted Ad Choices consent not given according to TCF consent manager for ${t}`),!1)}))(s,r,"setXandrPPIDs");if(!o)return;if(!t)return;(yield Promise.allSettled([m.processPPIDs(t,null==s?void 0:s.timeout),w.processPPIDs(t,d)])).forEach((e,i)=>{if("rejected"===e.status){n(`Cannot fetch PPIDs v${i+2}`,e.reason)}})});
1
+ "use strict";function e(e,i,n,t){return new(n||(n=Promise))(function(s,d){function r(e){try{a(t.next(e))}catch(e){d(e)}}function o(e){try{a(t.throw(e))}catch(e){d(e)}}function a(e){var i;e.done?s(e.value):(i=e.value,i instanceof n?i:new n(function(e){e(i)})).then(r,o)}a((t=t.apply(e,i||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const i={get:(i,n)=>e(void 0,void 0,void 0,function*(){const e=yield fetch(i,n);if(!e.ok)throw new Error(e.statusText);return yield e.json()}),post:(i,n,t)=>e(void 0,void 0,void 0,function*(){const e=JSON.stringify(t),s=yield fetch(i,{method:"POST",headers:n,body:e});if(!s.ok)throw new Error(s.statusText);return yield s.json()})},n=(e,i)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(i?console.log(n,e,i):console.log(n,e))},t=864e5,s=(()=>{const e=e=>{const i=window.localStorage.getItem(e);if(!i)return null;try{return JSON.parse(i)}catch(e){return n("Error with parsing localStorage data"),null}},i=(e,i)=>{window.localStorage.setItem(e,JSON.stringify(i))};return{get:e,set:i,setWithTimestamp:(e,n,s=t)=>{const d={data:n,expirationTime:(new Date).getTime()+s};i(e,JSON.stringify(d))},getByTimestamp:(i,s=t)=>{const d=e(i);if(!d)return null;if(!s)return d;try{const{expirationTime:e,data:i}=JSON.parse(d);return(new Date).getTime()<=e?i:null}catch(e){return n("Error with parsing localStorage data"),null}}}})(),d={NO:"no",SE:"se"},r="advertory:ppids-cache",o={[d.SE]:`SCH${d.SE.toUpperCase()}-EnvHash`,[d.NO]:`SCH${d.NO.toUpperCase()}-EnvHash`},a={[d.SE]:`SCH${d.SE.toUpperCase()}-UserHash`,[d.NO]:`SCH${d.NO.toUpperCase()}-UserHash`},l={[d.SE]:`sch${d.SE}-envhash-v3`,[d.NO]:`sch${d.NO}-envhash-v3`},c={[d.SE]:`sch${d.SE}-userhash-v3`,[d.NO]:`sch${d.NO}-userhash-v3`},u={[d.SE]:`'sch${d.SE}-iosid-v3'`,[d.NO]:`'sch${d.NO}-iosid-v3'`},p={[d.SE]:`sch${d.SE}-androidid-v3`,[d.NO]:`sch${d.NO}-androidid-v3`},v={[d.SE]:"sdrn:schibsted.com:user",[d.NO]:"sdrn:spid.no:user"};class h{constructor(){this.eids=[]}add(e,i){return e&&this.eids.push({id:e,source:i}),this}buildRyEids(){return this.eids.map(({id:e,source:i})=>({source:i,uids:[{id:e,atype:1,ext:{stype:"ppuid"}}]}))}buildEids(){return[...this.eids]}buildVideoEids(){return this.eids.map(({id:e,source:i})=>`${i},${e}`).join("|")}buildNorstatPath(){const e=this.eids[0];return e?`${e.source}-${e.id}`:""}buildNorstatQuery(e){const i=new URLSearchParams;return this.eids.slice(1).forEach(({id:n,source:t})=>{i.append(e,`${t}-${n}`)}),i}}const f=e=>new Promise(i=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void i(!1);const t=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const i=Number(e);return n("Advertising permission value obtained synchronously: ",e),Boolean(i)})();if(null!==t)return void i(t);let s=!1;const d=e=>{s||(n("Resolving advertising permission value obtained"),s=!0,i(e))},r=setTimeout(()=>{n("Advertising permission timed out, resolving with false"),d(!1)},3e3);window._tcf_.onTcfReady(()=>{n("On Tcf Ready called, waiting for permission"),clearTimeout(r)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(r);const i=Number(e);n("Advertising permission value obtained asynchronously: ",e),d(Boolean(i))})}),P="cmp:loaded";let g,I=!1;const y=(i,t,s)=>{const r=!!(null==i?void 0:i.enabled),o=(null==i?void 0:i.timeout)||3e3,a=(l="bypass_tcf",new URLSearchParams(window.location.search).get(l));var l;const c=()=>{if(!(null==i?void 0:i.enabled))return!0;if(((e,i)=>e?!!i&&(n("TCF bypass param detected, returning consent: true"),!0):(n("TCF is not enabled, returning consent: true"),!0))(r,a))return!0;if(I)return null;if(!g)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=g.getConsentedToAllSync();return n(`TCF consented to all is: ${e}`),g.getConsentedToAllSync()};return{initConsentManager:()=>(null==i?void 0:i.enabled)?new Promise((e,i)=>{if(n("Getting TCF consent manager..."),window._tcf_)return n("TCF consent manager is already available"),g=window._tcf_,void e(g);n("TCF consent manager is not available");const t=()=>{n("CMP loaded, resolving consent manager..."),s&&clearTimeout(s),window._tcf_?(g=window._tcf_,e(g)):i(new Error("CMP loaded but window._tcf_ is not defined"))},s=setTimeout(()=>{document.removeEventListener(P,t),I=!0,i(new Error("Timeout waiting for CMP to load"))},o);n("Listening for CMP loaded event..."),document.addEventListener(P,t,{once:!0})}):Promise.resolve(null),getConsentSync:c,getConsentAsync:()=>e(void 0,void 0,void 0,function*(){if(null==i?void 0:i.schibstedAdChoicesOverrideValue)return n(`Schibsted Ad Choices override value is set, returning override value: ${i.schibstedAdChoicesOverrideValue}`),Boolean(Number(i.schibstedAdChoicesOverrideValue));const e=(null==i?void 0:i.schibstedAdChoicesEnabled)&&s===d.SE,r=(null==i?void 0:i.schibstedAdChoicesEnabled)&&!t&&s===d.NO;if(e||r)return n("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield f(i);if(!(null==i?void 0:i.enabled))return!0;const a=c();return null!==a?a:yield new Promise((e,i)=>{try{if(!g)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let i=!1;const t=n=>{i||(i=!0,e(n))},s=setTimeout(()=>{n("TCF isConsentedToAll timed out, resolving with false"),t(!1)},o);g.onTcfReady(()=>{n("On Tcf Ready called, waiting for consent"),clearTimeout(s)}),g.isConsentedToAll(i=>{clearTimeout(s),e(i)})}catch(e){i(e)}})})}},m=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(i){return e(this,arguments,void 0,function*(e,i=1e4){var n,t;const s=yield Promise.race([new Promise(e=>{setTimeout(()=>e({xandr:{ppId1:"",ppId2:""}}),i)}),e.instance.getAdvertisingIdentifiers()]);this.setPPIDs(null===(n=s.xandr)||void 0===n?void 0:n.ppId1,null===(t=s.xandr)||void 0===t?void 0:t.ppId2)})}getPPIDs(){var e,i;return null!==this.ppid1&&null!==this.ppid2||n("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(i=this.ppid2)&&void 0!==i?i:""}}setPPIDs(e,i){this.ppid1=null!=e?e:"",this.ppid2=null!=i?i:""}},w=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(i,n){return e(this,void 0,void 0,function*(){var e,t,d,o,a,l,c,u,p,v,h;const f=s.get(r),P=yield this.getNewPPIDs(i,n);if(this.shouldHash(f,P)){const n=null!==(e=i.hasherUrl)&&void 0!==e?e:"https://hasher.schibsted.com/api/v1/hash",s=this.createHasherPayload(P),r=yield this.hashPPIDs(s,n);return r?(this.cachePPIDs(s,r,null===(t=P.idfv)||void 0===t?void 0:t.plain,null===(d=P.anId)||void 0===d?void 0:d.plain),void this.setPPIDs(null!==(o=r.userId)&&void 0!==o?o:"",null!==(a=r.environmentId)&&void 0!==a?a:"",null===(l=P.idfv)||void 0===l?void 0:l.plain,null===(c=P.anId)||void 0===c?void 0:c.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(u=null==f?void 0:f.userId.hashed)&&void 0!==u?u:"",null!==(p=null==f?void 0:f.environmentId.hashed)&&void 0!==p?p:"",null===(v=null==P?void 0:P.idfv)||void 0===v?void 0:v.plain,null===(h=null==P?void 0:P.anId)||void 0===h?void 0:h.plain)})}getPPIDs(){var e,i;return null!==this.ppid1&&null!==this.ppid2||n("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(i=this.ppid2)&&void 0!==i?i:"",idfv:this.idfv,anId:this.anId}}setPPIDs(e,i,n,t){this.ppid1=null!=e?e:"",this.ppid2=null!=i?i:"",this.idfv=null!=n?n:null,this.anId=null!=t?t:null}shouldHash(e,i){var n,t;if(!e)return!0;for(const s in e){if((null===(n=e[s])||void 0===n?void 0:n.plain)!==(null===(t=i[s])||void 0===t?void 0:t.plain))return!0}return!1}cachePPIDs(e,i,n,t){const d=Object.assign(Object.assign({clientId:{plain:e.clientId},userId:{plain:e.userId,hashed:i.userId},environmentId:{plain:e.environmentId,hashed:i.environmentId},trackerType:{plain:e.trackerType},trackerVersion:{plain:e.trackerVersion}},n?{idfv:{plain:n}}:{}),t?{anId:{plain:t}}:{});s.set(r,d)}hashPPIDs(t,s){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield i.post(s,e,t)}catch(e){return n("Error with hashing PPIDs",e),null}})}getNewPPIDs(i,n){return e(this,arguments,void 0,function*({clientId:i,instance:n},t){const s=yield((i,n)=>e(void 0,void 0,void 0,function*(){const e=yield i.getUserId();return e?`${v[n]}:${e}`:null}))(n,t),d=yield(i=>e(void 0,void 0,void 0,function*(){const e=yield i.getEnvironmentId();return e?`sdrn:schibsted:environment:${e}`:null}))(n),r=window.advertory_idfv,o=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:i},userId:{plain:s},environmentId:{plain:d},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},r?{idfv:{plain:r}}:{}),o?{anId:{plain:o}}:{})})}createHasherPayload({clientId:e,trackerType:i,trackerVersion:n,userId:t,environmentId:s}){return{clientId:e.plain,trackerType:i.plain,trackerVersion:n.plain,userId:t.plain,environmentId:s.plain}}};exports.getPPIDLoggedInStatus=()=>{const{ppid1:e,ppid2:i}=m.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":i?"1":"0"}},exports.getPPIDNorstatString=e=>{const{ppid1:i,ppid2:n}=m.getPPIDs(),{ppid1:t,ppid2:s}=w.getPPIDs(),d=(new h).add(n,o[e]).add(i,a[e]).add(s,l[e]).add(t,c[e]);return`${d.buildNorstatPath()}?${d.buildNorstatQuery("alias").toString()}`},exports.getPPIDRelevantYieldConfig=e=>{const{ppid1:i,ppid2:n}=m.getPPIDs(),{ppid1:t,ppid2:s,idfv:d,anId:r}=w.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new h).add(n,o[e]).add(i,a[e]).add(s,l[e]).add(t,c[e]).add(d,u[e]).add(r,p[e]).buildRyEids()}}]}}},exports.getUserIdsObject=e=>{const{ppid1:i,ppid2:n}=m.getPPIDs(),{ppid1:t,ppid2:s,idfv:d,anId:r}=w.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new h).add(n,o[e]).add(i,a[e]).add(s,l[e]).add(t,c[e]).add(d,u[e]).add(r,p[e]).buildEids()}]}},exports.getVideoPPIDs=i=>e(void 0,void 0,void 0,function*(){const{ppid1:e,ppid2:n}=m.getPPIDs(),{ppid1:t,ppid2:s}=w.getPPIDs(),d=(new h).add(n,o[i]).add(e,a[i]).add(s,l[i]).add(t,c[i]);return yield new Promise(e=>{e(d.buildVideoEids())})}),exports.setXandrPPIDs=i=>e(void 0,void 0,void 0,function*(){const{tracker:t,tcf:s,country:d,isMobileApp:r}=i,o=yield((i,t,s,...d)=>e(void 0,[i,t,s,...d],void 0,function*(e,i,t,s="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return n(`Schibsted Consent to Pay is not enabled, returning true for ${s}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return n(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${s}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:d}=y(e,i,t);return(yield d())?(n(`Schibsted Ad Choices consent given according to TCF consent manager for ${s}`),!0):(n(`Schibsted Ad Choices consent not given according to TCF consent manager for ${s}`),!1)}))(s,r,d,"setXandrPPIDs");if(!o)return;if(!t)return;(yield Promise.allSettled([m.processPPIDs(t,null==s?void 0:s.timeout),w.processPPIDs(t,d)])).forEach((e,i)=>{if("rejected"===e.status){n(`Cannot fetch PPIDs v${i+2}`,e.reason)}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schibsted/advertory",
3
- "version": "2.59.0",
3
+ "version": "2.60.0",
4
4
  "scripts": {
5
5
  "build": "node node_modules/rollup/dist/bin/rollup -c rollup-config/default.mjs && npm run post:build",
6
6
  "build:dev": "MODE=dev NODE_OPTIONS=--max-old-space-size=131072 npm run build",