@schibsted/advertory 2.69.0 → 2.70.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.
- package/core/aftenposten/es/index.css +1 -1
- package/core/aftenposten/es/index.js +1 -1
- package/core/aftenposten/index.js +1 -1
- package/core/aftenpostenv2/es/index.css +1 -1
- package/core/aftenpostenv2/es/index.js +1 -1
- package/core/aftonbladet/es/index.css +1 -1
- package/core/aftonbladet/es/index.js +1 -1
- package/core/aftonbladet/index.js +1 -1
- package/core/aftonbladetv2/es/index.css +1 -1
- package/core/aftonbladetv2/es/index.d.ts +51 -1
- package/core/aftonbladetv2/es/index.js +1 -1
- package/core/bt/es/index.css +1 -1
- package/core/bt/es/index.js +1 -1
- package/core/bt/index.js +1 -1
- package/core/e24/es/index.css +1 -1
- package/core/e24/es/index.js +1 -1
- package/core/e24/index.js +1 -1
- package/core/fotbollskanalen/es/index.css +1 -1
- package/core/fotbollskanalen/es/index.js +1 -1
- package/core/fotbollskanalen/index.js +1 -1
- package/core/godare/index.js +1 -1
- package/core/godt/index.js +1 -1
- package/core/klart/index.js +1 -1
- package/core/koket/es/index.css +1 -1
- package/core/koket/es/index.js +1 -1
- package/core/koket/index.js +1 -1
- package/core/kompakt/index.js +1 -1
- package/core/minmote/index.js +1 -1
- package/core/pent/index.js +1 -1
- package/core/sa/es/index.css +1 -1
- package/core/sa/es/index.js +1 -1
- package/core/sa/index.js +1 -1
- package/core/sav2/es/index.css +1 -1
- package/core/sav2/es/index.js +1 -1
- package/core/svd/es/index.css +1 -1
- package/core/svd/es/index.js +1 -1
- package/core/svd/index.js +1 -1
- package/core/svdv2/es/index.css +1 -1
- package/core/svdv2/es/index.js +1 -1
- package/core/tek/index.js +1 -1
- package/core/tv4/es/index.css +1 -1
- package/core/tv4/es/index.js +1 -1
- package/core/tv4/index.js +1 -1
- package/core/tvnu/index.js +1 -1
- package/core/vg/es/index.css +1 -1
- package/core/vg/es/index.js +1 -1
- package/core/vg/index.js +1 -1
- package/core/vgv2/es/index.css +1 -1
- package/core/vgv2/es/index.js +1 -1
- package/features/glimr/index.js +1 -1
- package/features/video/index.js +1 -1
- package/package.json +1 -1
- package/sites/aftenposten/es/index.css +1 -1
- package/sites/aftenpostenv2/es/index.css +1 -1
- package/sites/aftonbladet/es/index.css +1 -1
- package/sites/aftonbladetv2/es/index.css +1 -1
- package/sites/bt/es/index.css +1 -1
- package/sites/e24/es/index.css +1 -1
- package/sites/fotbollskanalen/es/index.css +1 -1
- package/sites/sa/es/index.css +1 -1
- package/sites/sav2/es/index.css +1 -1
- package/sites/svd/es/index.css +1 -1
- package/sites/svdv2/es/index.css +1 -1
- package/sites/vg/es/index.css +1 -1
- package/sites/vgv2/es/index.css +1 -1
- package/types/config/aftonbladetv2.d.ts +2 -1
- package/types/core/handlers/country-prefix/index.d.ts +2 -2
- package/types/core/interface/device.d.ts +13 -0
- package/types/core/logger/index.d.ts +2 -1
- package/types/features/glimr/glimr-core-handler.d.ts +2 -1
- package/types/features/glimr/glimr-tag-filters.d.ts +2 -1
- package/types/features/glimr/glimr-tags-handler.d.ts +2 -1
- package/types/{core/handlers/user/index.d.ts → features/identity/user.d.ts} +2 -1
- package/types/features/interface/video.d.ts +97 -0
- package/types/features/video/aftonbladet.test.d.ts +1 -0
- package/types/features/video/aspect-ratios.d.ts +5 -0
- package/types/features/video/aspect-ratios.test.d.ts +1 -0
- package/types/features/video/builder.test.d.ts +1 -0
- package/types/features/video/config.d.ts +3 -0
- package/types/features/video/constants.d.ts +30 -0
- package/types/features/video/device.d.ts +5 -0
- package/types/features/video/filters.test.d.ts +1 -0
- package/types/features/video/index.d.ts +1 -0
- package/types/features/video/inv-code.d.ts +5 -0
- package/types/features/video/inv-code.test.d.ts +1 -0
- package/types/features/video/keywords/builder.d.ts +4 -0
- package/types/features/video/keywords/filters.d.ts +8 -0
- package/types/features/video/keywords/index.d.ts +2 -0
- package/types/features/video/playback.d.ts +3 -0
- package/types/features/video/playback.test.d.ts +1 -0
- package/types/features/video/pulse.d.ts +3 -0
- package/types/features/video/pulse.test.d.ts +1 -0
- package/types/features/video/registry.test.d.ts +1 -0
- package/types/features/video/sites/aftonbladet.d.ts +4 -0
- package/types/features/video/sites/index.d.ts +4 -0
- package/types/features/video/tags.d.ts +3 -0
- package/types/features/video/url.d.ts +5 -0
- package/types/features/video/url.test.d.ts +1 -0
- /package/types/{core/handlers/user/index.test.d.ts → features/identity/user.test.d.ts} +0 -0
package/features/glimr/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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)?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}(),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)),Object.prototype.hasOwnProperty.call(e,"tcf")&&void 0!==e.tcf&&(this.config.tcf=Object.assign(Object.assign({},this.config.tcf),e.tcf))}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=864e5,g=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return l("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 l("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 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))})}),h="no",y="se",p="cmp:loaded";let w="undefined"!=typeof window?window._tcf_:void 0,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&&(l("TCF bypass param detected, returning consent: true"),!0):(l("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 l(`TCF consented to all is: ${t}`),w.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"),w=window._tcf_,void e(w);l("TCF consent manager is not available");const n=()=>{l("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);l("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 l(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const t=(null==e?void 0:e.schibstedAdChoicesEnabled)&&n===y,r=(null==e?void 0:e.schibstedAdChoicesEnabled)&&n===h;if(t||r)return l("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield b(e);if(!(null==e?void 0:e.enabled))return!0;const o=c();return null!==o?o: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(()=>{l("TCF isConsentedToAll timed out, resolving with false"),n(!1)},i);w.onTcfReady(()=>{l("On Tcf Ready called, waiting for consent"),clearTimeout(r)}),w.isConsentedToAll(t=>{clearTimeout(r),e(t)})}catch(e){t(e)}})})}},O=()=>r(void 0,
|
|
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)?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}(),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)),Object.prototype.hasOwnProperty.call(e,"tcf")&&void 0!==e.tcf&&(this.config.tcf=Object.assign(Object.assign({},this.config.tcf),e.tcf))}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=864e5,g=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return l("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 l("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 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))})}),h="no",y="se",p="cmp:loaded";let w="undefined"!=typeof window?window._tcf_:void 0,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&&(l("TCF bypass param detected, returning consent: true"),!0):(l("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 l(`TCF consented to all is: ${t}`),w.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"),w=window._tcf_,void e(w);l("TCF consent manager is not available");const n=()=>{l("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);l("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 l(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const t=(null==e?void 0:e.schibstedAdChoicesEnabled)&&n===y,r=(null==e?void 0:e.schibstedAdChoicesEnabled)&&n===h;if(t||r)return l("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield b(e);if(!(null==e?void 0:e.enabled))return!0;const o=c();return null!==o?o: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(()=>{l("TCF isConsentedToAll timed out, resolving with false"),n(!1)},i);w.onTcfReady(()=>{l("On Tcf Ready called, waiting for consent"),clearTimeout(r)}),w.isConsentedToAll(t=>{clearTimeout(r),e(t)})}catch(e){t(e)}})})}},O=(...e)=>r(void 0,[...e],void 0,function*(e=d.get()){const{tcf:t,isMobileApp:n,country:o}=e;if(null==t?void 0:t.schibstedConsentToPayEnabled){const e=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 l(`Schibsted Consent to Pay is not enabled, returning true for ${r}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return l(`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,0,n);return(yield o())?(l(`Schibsted Ad Choices consent given according to TCF consent manager for ${r}`),!0):(l(`Schibsted Ad Choices consent not given according to TCF consent manager for ${r}`),!1)}))(t,n,o,"glimr");return e}const{getConsentAsync:i}=C(t,0,o);return yield i()}),A={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_"),_=e=>!E(e)&&!S(e),P=(e,t)=>{const n=j();if(!n)return m;const r=((e=[])=>e.filter(E))(n),o=((e=[])=>e.filter(S))(n),i=((e=[],t,n)=>{const r=e.filter(_);if(n&&t){const{publisher:e}=t,n=A[e]||e;r.push(n)}return r})(n,e,t);return{geoTags:i,geofenceTags:o,weatherTags:r}},j=()=>{const e=g.getByTimestamp(f);return e&&"string"!=typeof e?null==e?void 0:e.tags:null};exports.getGlimrKeywords=(e,t)=>r(void 0,void 0,void 0,function*(){const{addPublisherToGeo:n}=t||{},{glimr:r,country:o}=e,i=yield O(e);if(!(null==r?void 0:r.enabled)||!i)return l("No consent for getting glimr tags."),{};const s=(e=>e===h?"no-sno":"se-generic")(o),a=P(e,Boolean(n));return{[`${s}-geo`]:a.geoTags,[`${s}-weather`]:a.weatherTags,[`${s}-geofence`]:a.geofenceTags}}),exports.updateGlimr=()=>r(void 0,void 0,void 0,function*(){const{glimr:e}=d.get();if(!(yield O())||!(null==e?void 0:e.enabled))return void l("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){l(`Error during getting glimr data: ${e}`)}else l("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:t})});
|
package/features/video/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t,n,r){return new(n||(n=Promise))(function(o,i){function c(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(c,s)}u((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;exports.getTcfConsentKeywords=()=>e(void 0,void 0,void 0,function*(){return window.__tcfapi?{gdpr:1,gdpr_consent:yield(e=window.__tcfapi,new Promise((t,n)=>{e("addEventListener",2,(n,r)=>{var o;r||t(""),"tcloaded"!==n.eventStatus&&"useractioncomplete"!==n.eventStatus||(t(null!==(o=n.tcString)&&void 0!==o?o:""),e("removeEventListener",2,()=>{},n.listenerId))})}))}:{};var e});
|
|
1
|
+
"use strict";function e(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 t=()=>e(void 0,void 0,void 0,function*(){return window.__tcfapi?{gdpr:1,gdpr_consent:yield(e=window.__tcfapi,new Promise((t,n)=>{e("addEventListener",2,(n,i)=>{var r;i||t(""),"tcloaded"!==n.eventStatus&&"useractioncomplete"!==n.eventStatus||(t(null!==(r=n.tcString)&&void 0!==r?r:""),e("removeEventListener",2,()=>{},n.listenerId))})}))}:{};var e}),n={NO:"no",SE:"se"},i={publisher:"aftonbladet",country:n.SE,memberId:9943,sectionKeyword:"se-aftonbladet-section",frontpageInvCodeTemplate:"se-aftonbladet-{deviceType}-front-{position}",additionalFilterKeys:["se-aftonbladet-navigation","se-aftonbladet-keyword_generator","se-aftonbladet-sponsor"],tcf:{enabled:!0,schibstedAdChoicesEnabled:!0,schibstedConsentToPayEnabled:!0},glimr:{enabled:!0,clientId:"OYGH3SXYFAQR78LVPNQD"}},r={nyheter:"nyheter",sport:"sportbladet",noje:"nojesbladet",family:"family",matdryck:"matdryck",wellness:"wellness",minekonomi:"minekonomi",resa:"resa",harligthemma:"harligthemma"},o=e=>(null==e?void 0:e.parent)?[...o(e.parent),e.shortPath||"unknown"]:[],s=(e,t)=>t?"se-aftonbladet-{deviceType}-studio_{position}":`se-aftonbladet-tv-{deviceType}-${(e=>{var t;if(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.afp)return"afp";const[,n]=o(e);return r[n]||"ovrigaavdelningar"})(e)}_{position}`,a=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},d={aftonbladet:i},l={aftonbladet:(e,t)=>{if(!e)return null;return{invCode:s(e,t),videoOverlayInvCode:"se-aftonbladet-{deviceType}-other-{position}",sections:o(e).join(":")}}},c=e=>{var t;if(!d[e]){(e=>{console.warn("[Advertory WARN]: ",e)})(`[video] No config found for publisher "${e}"`)}return null!==(t=d[e])&&void 0!==t?t:i},u=e=>{switch(e){case"auto":return 1;case"silent":return 2;default:return 3}},p=new Map([[1,"autoplay"],[2,"muted-autoplay"],[3,"click-to-play"]]),v="desktop",h="web_desktop",g="web_phone",f="wde",y="wph",b="se-generic",m="aa-sch",w="kv_",O="pause",P="{deviceType}",I="{position}",_="afp_",C=new Set(Object.values({PREROLL:"preroll",BUMPER:"bumper",MIDROLL:"midroll"})),T="1-1",A="16-9",E="3-4",S="9-16",j="responsive",$={[T]:1,[A]:1.78,[S]:.56,[j]:1},k={[T]:1,[A]:1.78,[E]:1.33,[S]:.56},N=(e,t,n,i)=>{const{invCode:r="",videoOverlayInvCode:o}=null!=e?e:{},s=v===n?f:y,a=r.replace(P,s);return(e,n)=>{if(e===O)return(e=>e.replace("tv-","").replace("-afp_","-afp-").replace(I,O).replace(/-([a-z]+)_/,"-article-"))(a);if(n&&C.has(e)){return(i&&o?o:t.frontpageInvCodeTemplate).replace(P,s).replace(I,e)}return a.replace(I,e)}};function M(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var D,R;var U=M(function(){if(R)return D;R=1;var e=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===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,i){return e.concat(t).map(function(e){return n(e,i)})}function r(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 o(e,t){try{return t in e}catch(e){return!1}}function s(e,t,i){var s={};return i.isMergeableObject(e)&&r(e).forEach(function(t){s[t]=n(e[t],i)}),r(t).forEach(function(r){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,r)||(o(e,r)&&i.isMergeableObject(t[r])?s[r]=function(e,t){if(!t.customMerge)return a;var n=t.customMerge(e);return"function"==typeof n?n:a}(r,i)(e[r],t[r],i):s[r]=n(t[r],i))}),s}function a(t,r,o){(o=o||{}).arrayMerge=o.arrayMerge||i,o.isMergeableObject=o.isMergeableObject||e,o.cloneUnlessOtherwiseSpecified=n;var a=Array.isArray(r);return a===Array.isArray(t)?a?o.arrayMerge(t,r,o):s(t,r,o):n(r,o)}return a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return a(e,n,t)},{})},D=a}());const H=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],F={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}};class L{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 H){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)),Object.prototype.hasOwnProperty.call(e,"tcf")&&void 0!==e.tcf&&(this.config.tcf=Object.assign(Object.assign({},this.config.tcf),e.tcf))}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=U(L.DEFAULT_SITE_HANDLERS,e)}}L.DEFAULT_SITE_HANDLERS={siteEvents:F,initNativeAd:function(){}};const x=new L;x.modifyConfigProperties.bind(x);const V=864e5,B=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return a("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=V)=>{const r={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(r))},getByTimestamp:(t,n=V)=>{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 a("Error with parsing localStorage data"),null}}}})(),K=["glwe_","glwet_"],W={geofenceTags:[],geoTags:[],weatherTags:[]},z=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 a("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const r=e=>{i||(a("Resolving advertising permission value obtained"),i=!0,t(e))},o=setTimeout(()=>{a("Advertising permission timed out, resolving with false"),r(!1)},3e3);window._tcf_.onTcfReady(()=>{a("On Tcf Ready called, waiting for permission"),clearTimeout(o)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(o);const t=Number(e);a("Advertising permission value obtained asynchronously: ",e),r(Boolean(t))})}),J="cmp:loaded";let G="undefined"!=typeof window?window._tcf_:void 0,q=!1;const Q=(t,i,r)=>{const o=!!(null==t?void 0:t.enabled),s=(null==t?void 0:t.timeout)||3e3,d=(l="bypass_tcf",new URLSearchParams(window.location.search).get(l));var l;const c=()=>{if(!(null==t?void 0:t.enabled))return!0;if(((e,t)=>e?!!t&&(a("TCF bypass param detected, returning consent: true"),!0):(a("TCF is not enabled, returning consent: true"),!0))(o,d))return!0;if(q)return null;if(!G)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const e=G.getConsentedToAllSync();return a(`TCF consented to all is: ${e}`),G.getConsentedToAllSync()};return{initConsentManager:()=>(null==t?void 0:t.enabled)?new Promise((e,t)=>{if(a("Getting TCF consent manager..."),window._tcf_)return a("TCF consent manager is already available"),G=window._tcf_,void e(G);a("TCF consent manager is not available");const n=()=>{a("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(J,n),q=!0,t(new Error("Timeout waiting for CMP to load"))},s);a("Listening for CMP loaded event..."),document.addEventListener(J,n,{once:!0})}):Promise.resolve(null),getConsentSync:c,getConsentAsync:()=>e(void 0,void 0,void 0,function*(){if(null==t?void 0:t.schibstedAdChoicesOverrideValue)return a(`Schibsted Ad Choices override value is set, returning override value: ${t.schibstedAdChoicesOverrideValue}`),Boolean(Number(t.schibstedAdChoicesOverrideValue));const e=(null==t?void 0:t.schibstedAdChoicesEnabled)&&r===n.SE,i=(null==t?void 0:t.schibstedAdChoicesEnabled)&&r===n.NO;if(e||i)return a("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield z(t);if(!(null==t?void 0:t.enabled))return!0;const o=c();return null!==o?o:yield new Promise((e,t)=>{try{if(!G)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(()=>{a("TCF isConsentedToAll timed out, resolving with false"),n(!1)},s);G.onTcfReady(()=>{a("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),G.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},Y=(t,n,i,...r)=>e(void 0,[t,n,i,...r],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return a(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return a(`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:r}=Q(e,0,n);return(yield r())?(a(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(a(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),X={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"},Z=e=>K.some(t=>e.startsWith(t)),ee=e=>e.startsWith("glgc_"),te=e=>!Z(e)&&!ee(e),ne=(t,i)=>e(void 0,void 0,void 0,function*(){const{addPublisherToGeo:i}={},{glimr:r,country:o}=t,s=yield((...t)=>e(void 0,[...t],void 0,function*(e=x.get()){const{tcf:t,isMobileApp:n,country:i}=e;if(null==t?void 0:t.schibstedConsentToPayEnabled)return yield Y(t,n,i,"glimr");const{getConsentAsync:r}=Q(t,0,i);return yield r()}))(t);if(!(null==r?void 0:r.enabled)||!s)return a("No consent for getting glimr tags."),{};const d=(e=>e===n.NO?"no-sno":"se-generic")(o),l=ie(t,Boolean(i));return{[`${d}-geo`]:l.geoTags,[`${d}-weather`]:l.weatherTags,[`${d}-geofence`]:l.geofenceTags}}),ie=(e,t)=>{const n=re();if(!n)return W;const i=((e=[])=>e.filter(Z))(n),r=((e=[])=>e.filter(ee))(n),o=((e=[],t,n)=>{const i=e.filter(te);if(n&&t){const{publisher:e}=t,n=X[e]||e;i.push(n)}return i})(n,e,t);return{geoTags:o,geofenceTags:r,weatherTags:i}},re=()=>{const e=B.getByTimestamp("glimrTags");return e&&"string"!=typeof e?null==e?void 0:e.tags:null},oe={get:(t,n)=>e(void 0,void 0,void 0,function*(){const e=yield fetch(t,n);if(!e.ok)throw new Error(e.statusText);return yield e.json()}),post:(t,n,i)=>e(void 0,void 0,void 0,function*(){const e=JSON.stringify(i),r=yield fetch(t,{method:"POST",headers:n,body:e});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},se="advertory:ppids-cache",ae={[n.SE]:`SCH${n.SE.toUpperCase()}-EnvHash`,[n.NO]:`SCH${n.NO.toUpperCase()}-EnvHash`},de={[n.SE]:`SCH${n.SE.toUpperCase()}-UserHash`,[n.NO]:`SCH${n.NO.toUpperCase()}-UserHash`},le={[n.SE]:`sch${n.SE}-envhash-v3`,[n.NO]:`sch${n.NO}-envhash-v3`},ce={[n.SE]:`sch${n.SE}-userhash-v3`,[n.NO]:`sch${n.NO}-userhash-v3`},ue={[n.SE]:"sdrn:schibsted.com:user",[n.NO]:"sdrn:spid.no:user"};class pe{constructor(){this.eids=[]}add(e,t){return e&&this.eids.push({id:e,source:t}),this}buildRyEids(){return this.eids.map(({id:e,source:t})=>({source:t,uids:[{id:e,atype:1,ext:{stype:"ppuid"}}]}))}buildEids(){return[...this.eids]}buildVideoEids(){return this.eids.map(({id:e,source:t})=>`${t},${e}`).join("|")}buildNorstatPath(){const e=this.eids[0];return e?`${e.source}-${e.id}`:""}buildNorstatQuery(e){const t=new URLSearchParams;return this.eids.slice(1).forEach(({id:n,source:i})=>{t.append(e,`${i}-${n}`)}),t}}const ve=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(t){return e(this,arguments,void 0,function*(e,t=1e4){var n,i;const r=yield Promise.race([new Promise(e=>{setTimeout(()=>e({xandr:{ppId1:"",ppId2:""}}),t)}),e.instance.getAdvertisingIdentifiers()]);this.setPPIDs(null===(n=r.xandr)||void 0===n?void 0:n.ppId1,null===(i=r.xandr)||void 0===i?void 0:i.ppId2)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||a("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:""}}setPPIDs(e,t){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:""}},he=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(t,n){return e(this,void 0,void 0,function*(){var e,i,r,o,s,a,d,l,c,u,p;const v=B.get(se),h=yield this.getNewPPIDs(t,n);if(this.shouldHash(v,h)){const n=null!==(e=t.hasherUrl)&&void 0!==e?e:"https://hasher.schibsted.com/api/v1/hash",l=this.createHasherPayload(h),c=yield this.hashPPIDs(l,n);return c?(this.cachePPIDs(l,c,null===(i=h.idfv)||void 0===i?void 0:i.plain,null===(r=h.anId)||void 0===r?void 0:r.plain),void this.setPPIDs(null!==(o=c.userId)&&void 0!==o?o:"",null!==(s=c.environmentId)&&void 0!==s?s:"",null===(a=h.idfv)||void 0===a?void 0:a.plain,null===(d=h.anId)||void 0===d?void 0:d.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(l=null==v?void 0:v.userId.hashed)&&void 0!==l?l:"",null!==(c=null==v?void 0:v.environmentId.hashed)&&void 0!==c?c:"",null===(u=null==h?void 0:h.idfv)||void 0===u?void 0:u.plain,null===(p=null==h?void 0:h.anId)||void 0===p?void 0:p.plain)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||a("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:"",idfv:this.idfv,anId:this.anId}}setPPIDs(e,t,n,i){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:"",this.idfv=null!=n?n:null,this.anId=null!=i?i:null}shouldHash(e,t){var n,i;if(!e)return!0;for(const r in e){if((null===(n=e[r])||void 0===n?void 0:n.plain)!==(null===(i=t[r])||void 0===i?void 0:i.plain))return!0}return!1}cachePPIDs(e,t,n,i){const r=Object.assign(Object.assign({clientId:{plain:e.clientId},userId:{plain:e.userId,hashed:t.userId},environmentId:{plain:e.environmentId,hashed:t.environmentId},trackerType:{plain:e.trackerType},trackerVersion:{plain:e.trackerVersion}},n?{idfv:{plain:n}}:{}),i?{anId:{plain:i}}:{});B.set(se,r)}hashPPIDs(t,n){return e(this,void 0,void 0,function*(){try{const e=new Headers({"Content-Type":"application/json"});return yield oe.post(n,e,t)}catch(e){return a("Error with hashing PPIDs",e),null}})}getNewPPIDs(t,n){return e(this,arguments,void 0,function*({clientId:t,instance:n},i){const r=yield((t,n)=>e(void 0,void 0,void 0,function*(){const e=yield t.getUserId();return e?`${ue[n]}:${e}`:null}))(n,i),o=yield(t=>e(void 0,void 0,void 0,function*(){const e=yield t.getEnvironmentId();return e?`sdrn:schibsted:environment:${e}`:null}))(n),s=window.advertory_idfv,a=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:t},userId:{plain:r},environmentId:{plain:o},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},s?{idfv:{plain:s}}:{}),a?{anId:{plain:a}}:{})})}createHasherPayload({clientId:e,trackerType:t,trackerVersion:n,userId:i,environmentId:r}){return{clientId:e.plain,trackerType:t.plain,trackerVersion:n.plain,userId:i.plain,environmentId:r.plain}}},ge=t=>e(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:n,country:i}=t,{getConsentAsync:r}=Q(e,0,i);if(!(yield r()))return;const o=(e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null})("_pulse2data");return o?o.split(",")[9]:void 0}),fe=()=>{const e=window.navigator.userAgent.toLowerCase(),t=[["win","windows"],["macintosh","macos"],["x11","linux"],["android","android"],["ipad","ios"],["iphone","ios"]].find(([t])=>e.includes(t));return t?t[1]:"unknown"},ye=(e,t)=>{const n=Object.entries(e);return n.reduce((n,[i,r])=>{const o=Math.abs(e[n]-t);return Math.abs(r-t)<o?i:n},n[0][0])},be=()=>{var e,t;const n=jwplayer().getContainer(),i=null!==(t=null===(e=document.getElementById(n.id))||void 0===e?void 0:e.parentElement)&&void 0!==t?t:null;return i&&"number"==typeof i.offsetWidth&&"number"==typeof i.offsetHeight&&0!==i.offsetHeight?i.offsetWidth/i.offsetHeight:1},me=()=>{return(e=>{try{return decodeURIComponent(e)}catch(e){return""}})("undefined"!=typeof document&&null!==(t=null===(e=document.cookie.match("(^|;)\\s*_pulse2data\\s*=\\s*([^;]+)"))||void 0===e?void 0:e.pop())&&void 0!==t?t:"").split(",");var e,t},we=()=>{const e=null!==(t=me()[9])&&void 0!==t?t:null;var t;const n=(()=>{var e;return null!==(e=me()[2])&&void 0!==e?e:null})();return e?Number(Boolean(e))+Number(Boolean(n)):0},Oe=()=>Object.fromEntries(new URLSearchParams(window.location.search)),Pe=(n,i)=>e(void 0,void 0,void 0,function*(){const{country:r,tcf:o,publisher:s}=i,{width:a,height:d}={width:window.innerWidth,height:window.innerHeight},l=(yield Y(o,n.isApp,r,"video"))?"1":"0",c=yield t(),u=yield(t=>e(void 0,void 0,void 0,function*(){const{ppid1:e,ppid2:n}=ve.getPPIDs(),{ppid1:i,ppid2:r}=he.getPPIDs(),o=(new pe).add(n,ae[t]).add(e,de[t]).add(r,le[t]).add(i,ce[t]);return yield new Promise(e=>{e(o.buildVideoEids())})}))(r),p=yield ge({tcf:o,isMobileApp:n.isApp,country:r}),f=null!==(y=window.location.pathname.split("/").slice(-2,-1).pop())&&void 0!==y?y:"";var y;const O=((e=1)=>ye(k,Number(e.toFixed(2))))(n.instreamAspectRatio),P=(I=n.playerAspectRatio)?ye($,Number(I.toFixed(2))):j;var I,_;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[`${m}-country_code`]:r,[`${m}-publisher`]:s,[`${m}-supply_type`]:(_=n.deviceType,_===v?h:g),[`kw_${m}-page_type`]:"collection",[`${m}-page_type`]:"collection",[`${b}-appmode`]:n.isAndroidApp?"hybrid":"notinapp",[`kw_${b}-page`]:"index",[`${b}-page`]:"index",[`${b}-screenheight`]:String(window.screen.height),[`${b}-screenwidth`]:String(window.screen.width),[`${b}-viewportheight`]:String(d),[`${b}-viewportwidth`]:String(a),[`${b}-loggedin`]:n.isUserLoggedIn?"yes":"no",[`${b}-mobile-os`]:fe(),[`${b}-audience`]:void 0,[`${b}-externalid_src`]:we(),[`${b}-tags`]:n.tags,[`${b}-articleid`]:f,"article-id":f},yield ne(Object.assign(Object.assign({},i),{isMobileApp:n.isApp}))),p&&{external_uid:p}),n.isUserPresentOnFrontPage&&n.isInitialVideo&&{[`${b}-tvtags`]:"vinjett"}),n.pageAdsKeywords),Object.keys(Oe()).some(e=>e.includes(w))&&(()=>{const e=Oe(),t=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith(w)).map(([e,t])=>[e.slice(3),t]));return Object.keys(t).length>0?t:void 0})()),{[i.sectionKeyword]:n.sections.split(":"),"aa-sch-cmp_advertising":l,"kw_aa-sch-cmp_advertising":l,"aa-sch-instream_player_aspectratio":O,"aa-sch-player_aspectratio":P}),c),{eids:u})}),Ie=["se-generic-audience","se-generic-appversion","se-generic-sitemode","se-generic-pagegen","se-generic-viewportheight","se-generic-viewportwidth","se-generic-screenheight","se-generic-screenwidth","aa-sch-inventory_type"],_e=["aa-sch-publisher","se-generic-page","aa-sch-supply_type","se-generic-story","se-generic-section","se-generic-adformat","aa-sch-context_keyword","se-generic-tvtags","se-generic-test","aa-sch-cmp_advertising","aa-sch-instream_player_aspectratio","aa-sch-player_aspectratio"],Ce=["external_uid","gdpr","gdpr_consent","eids","article-id"],Te=(e,t)=>{const n=[...Ie,...t.additionalFilterKeys];return Object.fromEntries(Object.entries(e).filter(([e])=>!n.includes(e)).map(([e,t])=>[e.includes("kw")||Ce.includes(e)?e:`kw_${e}`,t]))},Ae=e=>Object.fromEntries(Object.entries(e).filter(([e])=>_e.includes(e))),Ee=(t,n)=>e(void 0,void 0,void 0,function*(){var e,i,r,o;const s=c(t.publisher),a=(e=>{var t;return null!==(t=l[e])&&void 0!==t?t:l.aftonbladet})(t.publisher)(t.assetSection,t.isLiveStudio),d="/"===window.location.pathname,p=null===(i=null===(e=n.attributes)||void 0===e?void 0:e.id)||void 0===i?void 0:i.toString(),v=t.assetId===p,h=null!==(r=Number(t.aspectRatio))&&void 0!==r?r:1,g=v?"preroll":"bumper";var f;return{siteConfig:s,siteVideoParams:a,isUserPresentOnFrontPage:d,adsKeywords:yield Pe({pageAdsKeywords:t.pageAdsKeywords,tags:(f=t.tags,f?f.filter(e=>e.slug).map(({slug:e})=>e).join(","):""),sections:null!==(o=null==a?void 0:a.sections)&&void 0!==o?o:"",isUserLoggedIn:t.isUserLoggedIn,isUserPresentOnFrontPage:d,isInitialVideo:v,instreamAspectRatio:h,playerAspectRatio:be(),isApp:t.isApp,deviceType:t.deviceType,isAndroidApp:t.isAndroidApp},s),prerollPlacementFormat:g,playbackMethod:u(t.startMode)}}),Se=(e,t)=>{const{siteConfig:n,siteVideoParams:i,isUserPresentOnFrontPage:r,adsKeywords:o,prerollPlacementFormat:s,playbackMethod:a}=e,{invCode:d}=i||{},l=N(i,n,t.deviceType,t.isUsedInOverlayVideoPlayer),c=((e="")=>t=>e.includes(_)?`${_}${t}`:t)(d),u=window.location.href;return{member:n.memberId,options:{autoplayMuted:!0,vpaidcontrols:!0},adSlots:{schedule:{preroll:{inv_code:l(s,r),"se-generic-playback-method":p.get(a),"kw_se-generic-adformat":c(s)},midroll:{inv_code:l("midroll"),"kw_se-generic-adformat":c("midroll")},postroll:{inv_code:l("postroll"),"kw_se-generic-adformat":c("postroll")}},params:Object.assign(Object.assign(Object.assign({},Te(o,n)),Ae(o)),{vskippable:"0",referrer:u,vplaybackmethod:a})},adPlacements:{schedule:{pause:{invCode:l("pause"),sizes:[[825,424],[1280,720],[2,1]]}},params:{keywords:Object.assign(Object.assign({},o),{"se-generic-adformat":c("pause")})}}}};exports.getAdsConfig=t=>n=>e(void 0,void 0,void 0,function*(){const e=yield Ee(t,n);return Se(e,t)}),exports.getTcfConsentKeywords=t;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schibsted/advertory",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.70.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",
|