PageSourceSearch

https://temptation.bd.nl/temptation.js?v=20220407

js bd.nl collected 2026-09-24 17:34:13 UTC 11,569 bytes, 1 lines download raw bytes

1!function(){"use strict";const t=new class{debug(t,...e){this.isDebugEnabled()&&console.debug("[Temptation.js]",t,...e)}error(t,...e){console.error("[Temptation.js]",t,...e)}info(t,...e){console.log("[Temptation.js]",t,...e)}warn(t,...e){console.warn("[Temptation.js]",t,...e)}isDebugEnabled(){if("undefined"!=typeof window){return new URLSearchParams(window.location.search).has("temptation_debug")}return process&&"true"===process.env.DEBUG}};function e(t,e,o){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var i=o.call(t,e);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var o="object"==typeof global&&global&&global.Object===Object&&global,i="object"==typeof self&&self&&self.Object===Object&&self,n=(o||i||Function("return this")()).Symbol,r=Object.prototype,a=r.hasOwnProperty,s=r.toString,l=n?n.toStringTag:void 0;var c=Object.prototype.toString;var d=n?n.toStringTag:void 0;function h(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":d&&d in Object(t)?function(t){var e=a.call(t,l),o=t[l];try{t[l]=void 0;var i=!0}catch(t){}var n=s.call(t);return i&&(e?t[l]=o:delete t[l]),n}(t):function(t){return c.call(t)}(t)}function p(t){return null!=t&&"object"==typeof t}var u=Array.isArray;function m(t){return"string"==typeof t||!u(t)&&p(t)&&"[object String]"==h(t)}class f extends Error{constructor(t,...e){super(t,...e),Error.captureStackTrace&&Error.captureStackTrace(this,f),this.name="BadRequestError"}}const g={templates:[],dataLayerEntries:[],reduced:!1,sessionData:null,tracking:{id:""}};class w{baseURL;apiKey;zone;timeout;abortController;constructor(e,o,i=1500,n){t.debug(`initialized TemptationModule for zone ${o} with args: ${JSON.stringify({baseURL:e,apiKey:n,zone:o})}`),this.baseURL=e,this.apiKey=n,this.zone=o,this.timeout=i}getBaseURL(t){return new URL(`${this.baseURL}/rest/zones/${this.zone}/${t}`)}abort(){this.abortController?.abort()}async fetchWithHandling(e){const o=new Headers;o.append("Accept","application/json"),void 0!==this.apiKey&&o.append("x-api-key",this.apiKey);try{this.abortController=new AbortController;const t=await fetch(e.toString(),{headers:o,credentials:"include",signal:AbortSignal.any([this.abortController.signal,AbortSignal.timeout(this.timeout)]),cache:"no-store"});return await this.handleResponse(t)}catch(o){if(o instanceof f)throw o;return o instanceof DOMException?"AbortError"===o.name?t.info("Fetch call aborted by client",o):"TimeoutError"===o.name?t.warn(`Fetch call aborted because it took more than ${this.timeout}ms`,o):t.error("Fetch call aborted because of DOMException",o):o instanceof Error?t.error(`Fetch call failed: "${o.message}" for url "${e.toString()}"`):t.error(`Fetch call produced unknown error for url "${e.toString()}"`),g}}async handleResponse(e){if(!e.ok){if(e.status>=400&&e.status<500)throw new f(`BAD_REQUEST, fetch call returned 4XX error: "${e.status} ${e.statusText}" with message: "${await e.text()}" for url "${e.url}"`);return t.error(`REQUEST_ERROR, fetch call returned non-2XX error: "${e.status} ${e.statusText}" with message: "${await e.text()}" for url "${e.url}"`),g}return e.json()}appendOptionalStringParam(t,e,o){m(o)&&t.searchParams.append(e,o)}appendOptionalAndNotBlankStringParam(t,e,o){m(o)&&""!==o.trim()&&t.searchParams.append(e,o)}appendOptionalBooleanParam(t,e,o){(function(t){return!0===t||!1===t||p(t)&&"[object Boolean]"==h(t)})(o)&&t.searchParams.append(e,o?"true":"false")}appendParam(t,e,o){t.searchParams.append(e,o)}appendOptionalFreeParams(e,o){if(o)for(const[i,n]of Object.entries(o))i.startsWith("fp_")?e.searchParams.append(i,n):t.warn(`free parameter "${i}" is ignored because it doesn't meet the requirements, it should start with "fp_"`)}}class v extends w{trackingIdCookieName;jwtTokenCookieNames;constructor(t){super(t.baseURL,t.zone,t.timeout),this.trackingIdCookieName=this.validateNonEmptyString(t.trackingIdCookieName,"trackingIdCookieName"),this.jwtTokenCookieNames=this.validateNonEmptyJwtTokenCookieNames(t.jwtTokenCookieNames)}async resolve(t){const e=this.getBaseURL("_resolve_from_website_alb_internal");return this.addBaseResolveParameters(e,t),this.fetchWithHandling(e)}async resolveTemplates(t){const e=this.getBaseURL("_resolve_templates_from_website");return this.addBaseResolveParameters(e,t),this.appendOptionalAndNotBlankStringParam(e,"authorizationRequestId",t.authorizationRequestId),this.appendOptionalAndNotBlankStringParam(e,"authorizationRequestBody",t.authorizationRequestBody),this.fetchWithHandling(e)}addBaseResolveParameters(t,e){this.appendParam(t,"trackingIdCookieName",this.trackingIdCookieName),this.appendParam(t,"jwtTokenCookieNames",this.getJwtTokenCookieNamesAsString()),this.appendParam(t,"contentUrl",e.contentUrl),this.appendOptionalAndNotBlankStringParam(t,"contentUrn",e.contentUrn),this.appendOptionalAndNotBlankStringParam(t,"contentId",e.contentId),this.appendOptionalAndNotBlankStringParam(t,"contentType",e.contentType),this.appendOptionalAndNotBlankStringParam(t,"accessLevel",e.accessLevel),this.appendOptionalBooleanParam(t,"paid",e.paid),this.appendOptionalBooleanParam(t,"login",e.login),this.appendOptionalAndNotBlankStringParam(t,"source",e.source),this.appendOptionalAndNotBlankStringParam(t,"referer",e.referer),this.appendOptionalAndNotBlankStringParam(t,"referrer",e.referrer),this.appendOptionalStringParam(t,"sessionData",e.sessionData),this.appendOptionalFreeParams(t,e.freeParams)}getJwtTokenCookieNamesAsString(){return this.jwtTokenCookieNames.join(",")}validateNonEmptyString(t,e){if("string"!=typeof t||0===t.length)throw new Error(`${e} is a required property`);return t}validateNonEmptyJwtTokenCookieNames(t){if(!Array.isArray(t)||0===t.length)throw new Error("jwtTokenCookieNames is a required property");if(!t.every(t=>"string"==typeof t&&t.length>0))throw new Error("jwtTokenCookieNames should only have string values");return t}}class b{constructor(t){if(e(this,"temptationAPIKey",void 0),e(this,"temptationBaseURL",void 0),e(this,"waitForMissingPositions",void 0),e(this,"zone",void 0),e(this,"trackingIdCookieName",void 0),e(this,"jwtTokenCookieNames",void 0),void 0===t)throw new Error("a minimum of config is necessary to show some temptation");this.temptationAPIKey=this.validateString(t.temptationAPIKey,"temptationAPIKey"),this.temptationBaseURL=this.validateString(t.temptationBaseURL,"temptationBaseURL"),this.zone=this.validateString(t.zone,"zone"),this.waitForMissingPositions=this.optionalBoolean(t.waitForMissingPositions,!0),this.trackingIdCookieName=this.validateString(t.trackingIdCookieName,"trackingIdCookieName"),this.jwtTokenCookieNames=this.validateJwtCookieNames(t.jwtTokenCookieName,t.jwtTokenCookieNames)}validateString(t,e){if("string"!=typeof t)throw new Error("".concat(e," is a required property"));return t}optionalBoolean(t,e){return"boolean"!=typeof t?e:t}validateJwtCookieNames(t,e){if(void 0!==e&&Array.isArray(e)&&void 0!==e[0])return e;if("string"==typeof t)return[t];throw new Error("window.temptationConfig.jwtTokenCookieName OR window.temptationConfig.jwtTokenCookieNames is required")}}class k{constructor(t){e(this,"callback",void 0),this.callback=t}emit(t){this.callback&&this.callback(t)}}class y{constructor(t){e(this,"error",void 0),e(this,"success",void 0),this.error=new k(null==t?void 0:t.error),this.success=new k(null==t?void 0:t.success)}}class P{constructor(o){if(e(this,"element",void 0),e(this,"name",void 0),!o.hasAttribute(P.ATTRIBUTE_NAME))throw new Error("the element is not a valid position placeholder");this.element=o,this.name=o.getAttribute(P.ATTRIBUTE_NAME),t.debug("create position ".concat(this.name))}fill(e){t.debug("fill position ".concat(this.name)),this.element.innerHTML=e,this.element.querySelectorAll("script").forEach(e
1=>{try{window.Function('"use strict"; '.concat(e.textContent?e.textContent:e.innerText))()}catch(e){t.error("could not execute the javascript from template in position ".concat(this.name),e)}})}}e(P,"ATTRIBUTE_NAME","data-temptation-position");class T{constructor(t){e(this,"placeholders",void 0),this.placeholders=new Map,this.findPlaceholders(t)}hasPlaceholders(){return this.placeholders.size>0}findPlaceholders(t){if(t&&t.hasAttribute(P.ATTRIBUTE_NAME))return this.addPlaceholder(t);(t||window.document).querySelectorAll("[".concat(P.ATTRIBUTE_NAME,"]")).forEach(t=>this.addPlaceholder(t))}getPlaceholders(t){const e=this.placeholders.get(t);return void 0===e?null:e}addPlaceholder(t){const e=new P(t),o=this.placeholders.get(e.name)||[];this.placeholders.set(e.name,[...o,e])}}class N{constructor(o,i){e(this,"api",void 0),e(this,"observers",void 0),e(this,"positions",void 0),e(this,"waitForMissingPositions",void 0),this.api=new v({baseURL:o.temptationBaseURL,apiKey:o.temptationAPIKey,zone:o.zone,trackingIdCookieName:o.trackingIdCookieName,jwtTokenCookieNames:o.jwtTokenCookieNames}),this.observers=[],this.waitForMissingPositions=o.waitForMissingPositions,this.positions=new T(i),this.waitForMissingPositions||this.positions.hasPlaceholders()||t.warn("no positions, no temptation")}abort(){this.api.abort(),this.observers.forEach(t=>t.disconnect())}async resolve(e,o){return this.waitForMissingPositions||this.positions.hasPlaceholders()?this.api.resolve(e).then(e=>{t.debug("temptation resolve response result",e),e.dataLayerEntries.forEach(t=>
1this.pushToDataLayer(t)),e.templates.forEach(e=>this.hasPlaceholders(e)?this.fillPosition(e):this.waitForMissingPositions?this.observe(e):void t.warn("a template for position ".concat(e.position," is provided, but the position does not exist within the page"))),o.emit(e)}):Promise.resolve()}observe(e){t.debug("a template for position ".concat(e.position," is provided, but the position does not exist within the page, we'll start observing if the position shows up later"));const o=new MutationObserver((t,o)=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t instanceof Element&&this.positions.findPlaceholders(t)})}),this.hasPlaceholders(e)&&(o.disconnect(),this.fillPosition(e))});o.observe(document,{childList:!0,subtree:!0}),this.observers.push(o)}fillPosition(e){const o=this.findPlaceholders(e);null!==o?o.forEach(t=>t.fill(e.html)):t.error("we expect position ".concat(e.position," to exist at this point"))}findPlaceholders(t){return this.positions.getPlaceholders(t.position)}hasPlaceholders(t){const e=this.findPlaceholders(t);return null!==e&&e.length>0}pushToDataLayer(t){window.dataLayer=window.dataLayer||[],window.dataLayer.push(t)}}window.Temptation={run:function(e,o){t.debug("start temptation");const i=new y(e);function n(e){e instanceof Error?(t.error(e.message),i.error.emit(e)):(t.error(e),i.error.emit(new Error("string"==typeof e?e:"unknown error")))}try{const t=new b(e),r={contentUrl:window.location.href,contentUrn:null==e?void 0:e.contentUrn,contentId:null==e?void 0:e.contentId,contentType:null==e?void 0:e.contentType,paid:void 0!==(null==e?void 0:e.paid)&&e.paid,login:null==e?void 0:e.login,source:null==e?void 0:e.source,referer:document.referrer,freeParams:null==e?void 0:e.freeParams},a=new N(t,o),s=a.resolve(r,i.success).catch(n);return{abort:()=>a.abort(),done:()=>s}}catch(t){n(t)}return{abort:()=>{},done:()=>Promise.resolve()}}},window.temptationConfig&&(t.debug("found temptation configuration, run automatically"),window.Temptation.run(window.temptationConfig))}();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.