@schibsted/account-sdk-browser
Advanced tools
Comparing version 3.1.0-rc to 3.1.0
# Changelog | ||
## v3.1.0 (2020-02-06) | ||
## Changes | ||
* Enable siteSpecificLogout by default | ||
## v3.0.7 (2019-11-12) | ||
### Fixes | ||
* Refactor hasSession to fix ie11 bug | ||
## v3.1.0-rc (2019-10-02) | ||
@@ -4,0 +14,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){for(var r in t)e[r]=t[r]}(window,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=20)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new i.default(t)},t.isStr=o,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=s,t.isNonEmptyObj=function(e){return s(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!o(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return o(t)&&e.toUpperCase()===t.toUpperCase()})};var i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e){return"string"==typeof e}function s(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(i.name="SDKError","object"===(void 0===r?"undefined":n(r)))try{Object.assign(i,r)}catch(e){}return i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1)),o=r(5),s=r(4),a=r(0);var u=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,a.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function c(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var l=function(){return window.fetch&&window.fetch.bind(window)},f=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,u=void 0===o?l():o,c=t.log,f=t.defaultParams,d=void 0===f?{}:f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,a.assert)((0,a.isObject)(d),"defaultParams should be a non-null object"),this.url=new URL((0,s.urlMapper)(n,i)),this.defaultParams=d,c&&((0,a.assert)((0,a.isFunction)(c),"log must be a function but it is "+c),this.log=c),u&&((0,a.assert)((0,a.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return n(e,[{key:"go",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}(regeneratorRuntime.mark(function e(t){var r,n,s,c,l=t.method,f=t.headers,d=t.pathname,h=t.data,p=void 0===h?{}:h,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:l,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,a.assert)((0,a.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,a.assert)((0,a.isNonEmptyString)(l),'Method must be a non empty string but it is "'+l+'"'),(0,a.assert)((0,a.isNonEmptyString)(d),'Pathname must be string but it is "'+d+'"'),(0,a.assert)((0,a.isObject)(p),"data must be a non-null object"),b.headers=(0,a.isObject)(f)?(0,o.cloneDefined)(f):{},r=this.makeUrl(d,p,y),u(this.log,"Request:",b.method.toUpperCase(),r),u(this.log,"Request Headers:",b.headers),u(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,u(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new i.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return s=e.sent,u(this.log,"Response Parsed:",s),e.abrupt("return",s);case 23:throw e.prev=23,e.t0=e.catch(9),c=(0,a.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,a.isObject)(e.t0)&&(0,a.isStr)(e.t0.message)&&(c=e.t0.message),new i.default("Failed to '"+l+"' '"+r+"': '"+c+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}));return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,o.cloneDefined)(r,e):(0,o.cloneDefined)(e);return Object.keys(n).filter(function(e){return""!==n[e]}).map(function(e){return c(e)+"="+c(n[e])}).join("&")}}]),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"},SESSION_SERVICE:{LOCAL:"http://session-service.id.localhost",DEV:"https://session-service.identity-dev.schibsted.com",PRE:"https://session-service.identity-pre.schibsted.com",PRO:"https://session-service.login.schibsted.com",PRO_NO:"https://session-service.payment.schibsted.no"}},JSONP:{TIMEOUT:7e3},NAMESPACE:{LOCAL:"id.localhost",DEV:"schibsted.com",PRE:"schibsted.com",PRO:"schibsted.com",PRO_NO:"spid.no"}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP,t.NAMESPACE=n.NAMESPACE},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new s.default("No objects to clone");return r.forEach(function(t){(0,o.assert)((0,o.isObject)(t)),(0,o.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],s=r[1];void 0!==s&&(e[n]=(0,o.isObject)(s)?a(s):s)})}),e},t.cloneDeep=a;var o=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function a(e){return(0,o.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(5),o=u(r(2)),s=u(r(3)),a=u(r(14));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:a.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isObject)(e.screen),"window should be a valid Window object but it lacks a 'screen' property"),(0,n.assert)((0,n.isFunction)(e.open),"window should be a valid Window object but it lacks an 'open' function"),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var a=e.screen,u=a.height,c=a.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(u)&&(l.top=(u-l.height)/2);var f=function(e){return(0,n.assert)((0,n.isObject)(e),"Object must be an object but it is '"+e+"'"),Object.keys(e).map(function(t){return t+"="+e[t]}).join(",")}(l);return e.open(t,r,f)};var n=r(0),i=r(5);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function e(t){var r=this;o(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},a=function e(){var t=this;o(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},u=Math.pow(2,31)-1,c=function(){function e(t){o(this,e),!function(e){if(!e)return!1;try{var t=e(),r="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(r,"TEST-VALUE");var n=t.getItem(r);return t.removeItem(r),"TEST-VALUE"===n}catch(e){return!1}}(t)?(this.cache=new a,this.type="ObjectLiteralStorage"):(this.cache=new s(t()),this.type="WebStorage")}return n(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new i.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0)){n=Math.min(u,n);try{var o=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:o,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new i.default(e)}}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new i.default(e)}}}]),e}();t.default=c},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(4),s=r(3),a=d(r(7)),u=f(r(8)),c=d(r(2)),l=f(r(6));function f(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function d(e){return e&&e.__esModule?e:{default:e}}var h=function(){return window},p=t.Payment=function(){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,s=void 0===o?"PRE":o,a=t.publisher,u=t.window,c=void 0===u?h():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.emulate(c),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=c,this.publisher=a,this._setSpidServerUrl(s),this._setBffServerUrl(s)}return n(e,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new a.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._bff=new c.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(e){var t=e.paylink,r=e.preferPopup,n=e.redirectUri,o=void 0===n?this.redirectUri:n;(0,i.assert)((0,i.isUrl)(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(t,o);return r&&(this.popup=u.open(this.window,s,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=s,null)}},{key:"purchaseHistoryUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:e})}},{key:"redeemUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:e})}},{key:"purchasePaylinkUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchasePaylinkUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchasePaylinkUrl(): paylinkId is required"),this._bff.makeUrl("payment/purchase",{paylink:e,redirect_uri:t})}},{key:"purchaseProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchaseProductUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchaseProductFlowUrl(): productId is required"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:e,redirect_uri:t})}},{key:"purchaseCampaignFlowUrl",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(n),"purchaseCampaignFlowUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchaseCampaignFlowUrl(): campaignId is required"),(0,i.assert)((0,i.isNonEmptyString)(t),"purchaseCampaignFlowUrl(): productId is required"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:e,product_id:t,voucher_code:r,redirect_uri:n})}},{key:"purchasePromoCodeProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(r),"purchasePromoCodeProductFlowUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchasePromoCodeProductFlowUrl(): code is required"),(0,i.assert)((0,i.isNonEmptyString)(this.publisher),"purchasePromoCodeProductFlowUrl(): publisher is required in the constructor"),this._bff.makeUrl("payment/purchase/code",{code:e,publisher:this.publisher,state:t,redirect_uri:r})}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(4),s=r(3),a=d(r(10)),u=d(r(7)),c=d(r(2)),l=d(r(9)),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(6));function d(e){return e&&e.__esModule?e:{default:e}}function h(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var p=function(){return window},v=t.Monetization=function(e){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,s=void 0===o?"PRE":o,a=e.sessionDomain,u=e.window,c=void 0===u?p():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var d=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return f.emulate(c),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),d.cache=new l.default(function(){return c&&c.sessionStorage}),d.clientId=r,d.env=s,d.redirectUri=n,d._setSpidServerUrl(s),a&&((0,i.assert)((0,i.isUrl)(a),"sessionDomain parameter is not a valid URL"),d._setSessionServiceUrl(a)),d}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),n(t,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new u.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+s.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new c.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="prd_"+t+"_"+r,i=this.cache.get(n),o=!i,i||!this._sessionService){e.next=15;break}return e.prev=4,e.next=7,this._sessionService.get("/hasProduct/"+t);case 7:i=e.sent,e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(4),400===e.t0.code){e.next=14;break}throw e.t0;case 14:i=null;case 15:if(i){e.next=21;break}return s={product_id:t},r&&(s.sp_id=r),e.next=20,this._spid.get("ajax/hasproduct.js",s);case 20:i=e.sent;case 21:if(o&&(a=i.result?3600:10,this.cache.set(n,i,1e3*a)),i.result){e.next=24;break}return e.abrupt("return",null);case 24:return this.emit("hasProduct",{productId:t,data:i}),e.abrupt("return",i);case 26:case"end":return e.stop()}},e,this,[[4,10]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="sub_"+t+"_"+r,i=this.cache.get(n),o=!i,i||!this._sessionService){e.next=15;break}return e.prev=4,e.next=7,this._sessionService.get("/hasSubscription/"+t);case 7:i=e.sent,e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(4),400===e.t0.code){e.next=14;break}throw e.t0;case 14:i=null;case 15:if(i){e.next=21;break}return s={product_id:t},r&&(s.sp_id=r),e.next=20,this._spid.get("ajax/hassubscription.js",s);case 20:i=e.sent;case 21:if(o&&(a=i.result?3600:10,this.cache.set(n,i,1e3*a)),i.result){e.next=24;break}return e.abrupt("return",null);case 24:return this.emit("hasSubscription",{subscriptionId:t,data:i}),e.abrupt("return",i);case 26:case"end":return e.stop()}},e,this,[[4,10]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:e})}},{key:"productsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:e})}}]),t}();t.default=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.eventValidatorFunc=i;function i(e,t){return e._iframeUrl.startsWith(t.origin)&&t.data}var o=function(){function e(t,r,n,o){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._iframeUrl=t.makeUrl("/authn/itp",{environment:o,client_id:r,redirect_uri:n}),this.isValidEvent=s}return n(e,[{key:"show",value:function(){var e=this;return new Promise(function(t,r){e._preventBodyScrolling();var n=e._buildModalElement();document.body.appendChild(n);var i=function(){n.style.opacity=0,window.removeEventListener("message",o),setTimeout(function(){document.body.removeChild(n),e._restoreBodyScrolling()},500)},o=function(n){if(e.isValidEvent(e,n)){if(i(),n.data.sessionData)return void t(n.data.sessionData);r(n.data.error)}};window.addEventListener("message",o),n.onclick=function(){i(),r("cancel")},setTimeout(function(){n.style.opacity=1},0)})}},{key:"_buildModalElement",value:function(){var e=document.createElement("div");e.style=this._buildStyleString({position:"fixed",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",top:0,right:0,bottom:0,left:0,"background-color":"rgba(0, 0, 0, .7)",transition:"opacity 500ms",opacity:0,"z-index":1e4});var t=document.createElement("iframe");return t.sandbox="allow-storage-access-by-user-activation allow-same-origin allow-scripts",t.style=this._buildStyleString({width:"368px",height:"400px","background-color":"#ffffff"}),t.src=this._iframeUrl,e.appendChild(t),e}},{key:"_buildStyleString",value:function(e){return Object.keys(e).reduce(function(t,r){return t+" "+r+": "+e[r]+";"},"")}},{key:"_preventBodyScrolling",value:function(){this._originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden"}},{key:"_restoreBodyScrolling",value:function(){document.body.style.overflow=this._originalBodyOverflow}}]),e}();t.default=o},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,a=t.jsonpCallback||r.jsonpCallback,u=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=a+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),u&&clearTimeout(u),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var d=document.createElement("script");d.setAttribute("src",""+o+a+"="+l),t.charset&&d.setAttribute("charset",t.charset),d.id=f,document.getElementsByTagName("head")[0].appendChild(d),u=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),d.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),u&&clearTimeout(u)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),a=r(5),u=r(4),c=r(3),l=g(r(10)),f=g(r(7)),d=g(r(9)),h=b(r(8)),p=g(r(13)),v=g(r(2)),y=g(r(1)),m=b(r(6));function b(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function g(e){return e&&e.__esModule?e:{default:e}}function w(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var _=function(){return window};function S(e){return null===e?[void 0===e?"undefined":o(e),""+e]:[e.constructor.name,e.valueOf()]}var U=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.sessionDomain,o=e.env,a=void 0===o?"PRE":o,u=e.siteSpecificLogout,c=void 0===u||u,l=e.log,f=e.window,h=void 0===f?_():f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(h),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),m.emulate(h),p._sessionInitiatedSent=!1,p.window=h,p.clientId=r,p.cache=new d.default(function(){return p.window&&p.window.localStorage}),p.redirectUri=n,p.env=a,p.siteSpecificLogout=c,p.log=l,i&&((0,s.assert)((0,s.isUrl)(i),"sessionDomain parameter is not a valid URL"),p._setSessionServiceUrl(i)),p._enableSessionCaching=!0,p._itpMode=!1,p._session={},p._setSpidServerUrl(a),p._setBffServerUrl(a),p._setOauthServerUrl(a),p._setHasSessionServerUrl(a),p._setGlobalSessionServiceUrl(a),p}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new v.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"_setGlobalSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._globalSessionService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SESSION_SERVICE),log:this.log,defaultParams:{client_sdrn:t}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(e){var t=0,r=void 0;if(Number.isInteger(e))t=e;else if("object"==(void 0===e?"undefined":o(e))){var n=e.expiresIn;t=void 0===n?t:n;var i=e.domain;r=void 0===i?r:i}(0,s.assert)(Number.isInteger(t),"'expiresIn' must be an integer"),(0,s.assert)(t>=0,"'expiresIn' cannot be negative"),this.setVarnishCookie=!0,this.varnishExpiresIn=t,this.varnishCookieDomain=r}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;if(this.varnishExpiresIn||"number"==typeof e.expiresIn&&e.expiresIn>0){var r=this.varnishExpiresIn||e.expiresIn;t.setTime(t.getTime()+1e3*r)}else t.setTime(0);var n=this.varnishCookieDomain||("string"==typeof e.baseDomain?e.baseDomain:document.domain)||"",i=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+n].join("; ");document.cookie=i}}},{key:"_maybeClearVarnishCookie",value:function(){this.setVarnishCookie&&this._clearVarnishCookie()}},{key:"_clearVarnishCookie",value:function(){var e=this.varnishCookieDomain||(this._session&&"string"==typeof this._session.baseDomain?this._session.baseDomain:document.domain)||"";document.cookie="SP_ID=nothing; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=."+e}},{key:"_itpModalRequired",value:function(){if(!document.requestStorageAccess||this._sessionService)return!1;var e=navigator.userAgent.match(/Version\/(\d+)\./);return!(!e||e.length<2)&&parseInt(e[1],10)>=12}},{key:"hasSession",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._hasSessionInProgress)return this._hasSessionInProgress;var r=function(){var r=w(regeneratorRuntime.mark(function r(i,o){var a,u,c,l,f,d,h,v,m,b;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a=function(t){if(t.error)return e.emit("error",t.error),o(new y.default("HasSession failed",t.error));e._maybeSetVarnishCookie(t),e._emitSessionEvent(e._session,t)},"boolean"==typeof t){r.next=4;break}return u=S(t),c=n(u,2),l=c[0],f=c[1],r.abrupt("return",o(new y.default("Parameter 'autologin' must be boolean, was: \""+l+":"+f+'"')));case 4:if(r.prev=4,!e._enableSessionCaching){r.next=10;break}if(!(d=e.cache.get("hasSession-cache"))){r.next=10;break}return a(d),r.abrupt("return",i(d));case 10:if(h=null,!e._sessionService){r.next=26;break}return r.prev=12,r.next=15,e._sessionService.get("/session");case 15:h=r.sent,r.next=26;break;case 18:if(r.prev=18,r.t0=r.catch(12),!e.siteSpecificLogout){r.next=22;break}throw r.t0;case 22:if(400===r.t0.code){r.next=25;break}return e.emit("error",r.t0),r.abrupt("return",o(new y.default("HasSession failed",r.t0)));case 25:h=null;case 26:if(v=t?1:0,h||e._itpMode){r.next=31;break}return r.next=30,e._hasSession.get("rpc/hasSession.js",{autologin:v});case 30:h=r.sent;case 31:if(!(e._itpMode||(0,s.isObject)(h.error)&&"LoginException"===h.error.type)){r.next=35;break}return r.next=34,e._spid.get("ajax/hasSession.js",{autologin:v});case 34:h=r.sent;case 35:if(!(e._itpModalRequired()&&!e._itpMode&&(0,s.isObject)(h.error)&&"UserException"===h.error.type&&null!==e.cache.get("loginInProgress-cache"))){r.next=42;break}return e.cache.delete("loginInProgress-cache"),m=new p.default(e._spid,e.clientId,e.redirectUri,e.env),r.next=41,m.show();case 41:h=r.sent;case 42:e._enableSessionCaching&&(b=1e3*(h.expiresIn||300),e.cache.set("hasSession-cache",h,b)),a(h),e._session=h,i(h),r.next=52;break;case 48:r.prev=48,r.t1=r.catch(4),e.emit("error",r.t1),o(new y.default("HasSession failed",r.t1));case 52:case"end":return r.stop()}},r,e,[[4,48],[12,18]])}));return function(e,t){return r.apply(this,arguments)}}(),i=new Promise(r);return this._hasSessionInProgress=i.then(function(t){return e._hasSessionInProgress=null,t},function(t){throw e._hasSessionInProgress=null,t}),this._hasSessionInProgress}},{key:"isLoggedIn",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new y.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,a.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId||!t.result){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid||!t.result){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserContextData",value:function(){var e=w(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._globalSessionService.get("/user-context");case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),e.abrupt("return",null);case 9:case"end":return e.stop()}},e,this,[[0,6]])}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,a=e.preferPopup,u=void 0!==a&&a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,d=void 0===f?"":f,p=e.tag,v=void 0===p?"":p,y=e.teaser,m=void 0===y?"":y,b=e.maxAge,g=void 0===b?"":b,w=e.locale,_=void 0===w?"":w,S=e.oneStepLogin,U=void 0!==S&&S;this._closePopup(),this.cache.delete("hasSession-cache");var k=this.loginUrl({state:r,acrValues:t,scope:i,redirectUri:s,newFlow:l,loginHint:d,tag:v,teaser:m,maxAge:g,locale:_,oneStepLogin:U});return this.showItpModalUponReturning(),u&&(this.popup=h.open(this.window,k,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=k,null)}},{key:"logout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;this.cache.delete("hasSession-cache"),this._maybeClearVarnishCookie(),this.emit("logout"),this.window.location.href=this.logoutUrl(e)}},{key:"loginUrl",value:function(e){var t=e.state,r=e.acrValues,n=e.scope,i=void 0===n?"openid":n,a=e.redirectUri,u=void 0===a?this.redirectUri:a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,d=void 0===f?"":f,h=e.tag,p=void 0===h?"":h,v=e.teaser,y=void 0===v?"":v,m=e.maxAge,b=void 0===m?"":m,g=e.locale,w=void 0===g?"":g,_=e.oneStepLogin,S=void 0!==_&&_;return"object"!==o(arguments[0])&&(t=arguments[0],r=arguments[1],i=arguments[2]||i,u=arguments[3]||u,l="boolean"==typeof arguments[4]?arguments[4]:l,d=arguments[5]||d,p=arguments[6]||p,y=arguments[7]||y,b=isNaN(arguments[8])?b:arguments[8]),(0,s.assert)(!r||(0,s.isStrIn)(r,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+r),(0,s.assert)((0,s.isUrl)(u),"loginUrl(): redirectUri must be a valid url but is "+u),(0,s.assert)((0,s.isNonEmptyString)(t),"the state parameter should be a non empty string but it is "+t),l?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:u,scope:i,state:t,acr_values:r,login_hint:d,tag:p,teaser:y,max_age:b,locale:w,one_step_login:S||"",prompt:this.siteSpecificLogout?"select_account":""}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:u,scope:i,state:t,email:d,tag:p,teaser:y,locale:w})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid");var t={redirect_uri:e};return this._sessionService&&this.siteSpecificLogout?this._sessionService.makeUrl("logout",t):this._spid.makeUrl("logout",Object.assign({response_type:"code"},t))}},{key:"accountUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/summary",{response_type:"code",redirect_uri:e})}},{key:"phonesUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/phones",{response_type:"code",redirect_uri:e})}},{key:"authFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}},{key:"showItpModalUponReturning",value:function(){this._itpModalRequired()&&this.cache.set("loginInProgress-cache",{},9e5)}},{key:"suppressItpModal",value:function(){this.cache.delete("loginInProgress-cache")}}]),t}();t.default=U},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=_;var d="suspendedStart",h="suspendedYield",p="executing",v="completed",y={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,a)&&(m=g);var w=P.prototype=U.prototype=Object.create(m);k.prototype=w.constructor=P,P.constructor=k,P[c]=k.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,P):(e.__proto__=P,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},O(x.prototype),x.prototype[u]=function(){return this},f.AsyncIterator=x,f.async=function(e,t,r,n){var i=new x(_(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},O(w),w[c]="Generator",w[a]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return a.type="throw",a.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(e,t,r,n){var i=t&&t.prototype instanceof U?t:U,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=d;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return M()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=j(s,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=S(e,t,r);if("normal"===u.type){if(n=r.done?v:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(e,r,s),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function U(){}function k(){}function P(){}function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function x(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,a){var u=S(e[n],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,a)},function(e){r("throw",e,s,a)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},function(e){return r("throw",e,s,a)})}a(u.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function j(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,j(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:M}}function M(){return{value:n,done:!0}}}(function(){return this||"object"===("undefined"==typeof self?"undefined":t(self))&&self}()||Function("return this")())}).call(this,r(16)(e))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return this||"object"===("undefined"==typeof self?"undefined":n(self))&&self}()||Function("return this")(),o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,s=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=r(17),o)i.regeneratorRuntime=s;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},function(e,t,r){"use strict";window.regeneratorRuntime=r(18);var n=r(15).Identity,i=r(12).Monetization,o=r(11).Payment;e.exports={Identity:n,Monetization:i,Payment:o}},function(e,t,r){"use strict";var n=r(19),i=n.Identity,o=n.Monetization,s=n.Payment;Object.assign(window,{Identity:i,Monetization:o,Payment:s})}])); | ||
!function(e,t){for(var r in t)e[r]=t[r]}(window,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=20)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new i.default(t)},t.isStr=o,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=s,t.isNonEmptyObj=function(e){return s(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!o(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return o(t)&&e.toUpperCase()===t.toUpperCase()})};var i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e){return"string"==typeof e}function s(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(i.name="SDKError","object"===(void 0===r?"undefined":n(r)))try{Object.assign(i,r)}catch(e){}return i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1)),o=r(5),s=r(4),a=r(0);var u=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,a.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function c(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var l=function(){return window.fetch&&window.fetch.bind(window)},f=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,u=void 0===o?l():o,c=t.log,f=t.defaultParams,d=void 0===f?{}:f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,a.assert)((0,a.isObject)(d),"defaultParams should be a non-null object"),this.url=new URL((0,s.urlMapper)(n,i)),this.defaultParams=d,c&&((0,a.assert)((0,a.isFunction)(c),"log must be a function but it is "+c),this.log=c),u&&((0,a.assert)((0,a.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return n(e,[{key:"go",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}(regeneratorRuntime.mark(function e(t){var r,n,s,c,l=t.method,f=t.headers,d=t.pathname,h=t.data,p=void 0===h?{}:h,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:l,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,a.assert)((0,a.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,a.assert)((0,a.isNonEmptyString)(l),'Method must be a non empty string but it is "'+l+'"'),(0,a.assert)((0,a.isNonEmptyString)(d),'Pathname must be string but it is "'+d+'"'),(0,a.assert)((0,a.isObject)(p),"data must be a non-null object"),b.headers=(0,a.isObject)(f)?(0,o.cloneDefined)(f):{},r=this.makeUrl(d,p,y),u(this.log,"Request:",b.method.toUpperCase(),r),u(this.log,"Request Headers:",b.headers),u(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,u(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new i.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return s=e.sent,u(this.log,"Response Parsed:",s),e.abrupt("return",s);case 23:throw e.prev=23,e.t0=e.catch(9),c=(0,a.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,a.isObject)(e.t0)&&(0,a.isStr)(e.t0.message)&&(c=e.t0.message),new i.default("Failed to '"+l+"' '"+r+"': '"+c+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}));return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,o.cloneDefined)(r,e):(0,o.cloneDefined)(e);return Object.keys(n).filter(function(e){return""!==n[e]}).map(function(e){return c(e)+"="+c(n[e])}).join("&")}}]),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"},SESSION_SERVICE:{LOCAL:"http://session-service.id.localhost",DEV:"https://session-service.identity-dev.schibsted.com",PRE:"https://session-service.identity-pre.schibsted.com",PRO:"https://session-service.login.schibsted.com",PRO_NO:"https://session-service.payment.schibsted.no"}},JSONP:{TIMEOUT:7e3},NAMESPACE:{LOCAL:"id.localhost",DEV:"schibsted.com",PRE:"schibsted.com",PRO:"schibsted.com",PRO_NO:"spid.no"}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP,t.NAMESPACE=n.NAMESPACE},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new s.default("No objects to clone");return r.forEach(function(t){(0,o.assert)((0,o.isObject)(t)),(0,o.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],s=r[1];void 0!==s&&(e[n]=(0,o.isObject)(s)?a(s):s)})}),e},t.cloneDeep=a;var o=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function a(e){return(0,o.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(5),o=u(r(2)),s=u(r(3)),a=u(r(14));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:a.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isObject)(e.screen),"window should be a valid Window object but it lacks a 'screen' property"),(0,n.assert)((0,n.isFunction)(e.open),"window should be a valid Window object but it lacks an 'open' function"),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var a=e.screen,u=a.height,c=a.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(u)&&(l.top=(u-l.height)/2);var f=function(e){return(0,n.assert)((0,n.isObject)(e),"Object must be an object but it is '"+e+"'"),Object.keys(e).map(function(t){return t+"="+e[t]}).join(",")}(l);return e.open(t,r,f)};var n=r(0),i=r(5);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function e(t){var r=this;o(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},a=function e(){var t=this;o(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},u=Math.pow(2,31)-1,c=function(){function e(t){o(this,e),!function(e){if(!e)return!1;try{var t=e(),r="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(r,"TEST-VALUE");var n=t.getItem(r);return t.removeItem(r),"TEST-VALUE"===n}catch(e){return!1}}(t)?(this.cache=new a,this.type="ObjectLiteralStorage"):(this.cache=new s(t()),this.type="WebStorage")}return n(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new i.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0)){n=Math.min(u,n);try{var o=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:o,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new i.default(e)}}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new i.default(e)}}}]),e}();t.default=c},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(4),s=r(3),a=d(r(7)),u=f(r(8)),c=d(r(2)),l=f(r(6));function f(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function d(e){return e&&e.__esModule?e:{default:e}}var h=function(){return window},p=t.Payment=function(){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,s=void 0===o?"PRE":o,a=t.publisher,u=t.window,c=void 0===u?h():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.emulate(c),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=c,this.publisher=a,this._setSpidServerUrl(s),this._setBffServerUrl(s)}return n(e,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new a.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._bff=new c.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(e){var t=e.paylink,r=e.preferPopup,n=e.redirectUri,o=void 0===n?this.redirectUri:n;(0,i.assert)((0,i.isUrl)(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(t,o);return r&&(this.popup=u.open(this.window,s,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=s,null)}},{key:"purchaseHistoryUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:e})}},{key:"redeemUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:e})}},{key:"purchasePaylinkUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchasePaylinkUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchasePaylinkUrl(): paylinkId is required"),this._bff.makeUrl("payment/purchase",{paylink:e,redirect_uri:t})}},{key:"purchaseProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchaseProductUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchaseProductFlowUrl(): productId is required"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:e,redirect_uri:t})}},{key:"purchaseCampaignFlowUrl",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(n),"purchaseCampaignFlowUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchaseCampaignFlowUrl(): campaignId is required"),(0,i.assert)((0,i.isNonEmptyString)(t),"purchaseCampaignFlowUrl(): productId is required"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:e,product_id:t,voucher_code:r,redirect_uri:n})}},{key:"purchasePromoCodeProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(r),"purchasePromoCodeProductFlowUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchasePromoCodeProductFlowUrl(): code is required"),(0,i.assert)((0,i.isNonEmptyString)(this.publisher),"purchasePromoCodeProductFlowUrl(): publisher is required in the constructor"),this._bff.makeUrl("payment/purchase/code",{code:e,publisher:this.publisher,state:t,redirect_uri:r})}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(4),s=r(3),a=d(r(10)),u=d(r(7)),c=d(r(2)),l=d(r(9)),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(6));function d(e){return e&&e.__esModule?e:{default:e}}function h(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var p=function(){return window},v=t.Monetization=function(e){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,s=void 0===o?"PRE":o,a=e.sessionDomain,u=e.window,c=void 0===u?p():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var d=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return f.emulate(c),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),d.cache=new l.default(function(){return c&&c.sessionStorage}),d.clientId=r,d.env=s,d.redirectUri=n,d._setSpidServerUrl(s),a&&((0,i.assert)((0,i.isUrl)(a),"sessionDomain parameter is not a valid URL"),d._setSessionServiceUrl(a)),d}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),n(t,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new u.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+s.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new c.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="prd_"+t+"_"+r,i=this.cache.get(n),o=!i,i||!this._sessionService){e.next=15;break}return e.prev=4,e.next=7,this._sessionService.get("/hasProduct/"+t);case 7:i=e.sent,e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(4),400===e.t0.code){e.next=14;break}throw e.t0;case 14:i=null;case 15:if(i){e.next=21;break}return s={product_id:t},r&&(s.sp_id=r),e.next=20,this._spid.get("ajax/hasproduct.js",s);case 20:i=e.sent;case 21:if(o&&(a=i.result?3600:10,this.cache.set(n,i,1e3*a)),i.result){e.next=24;break}return e.abrupt("return",null);case 24:return this.emit("hasProduct",{productId:t,data:i}),e.abrupt("return",i);case 26:case"end":return e.stop()}},e,this,[[4,10]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="sub_"+t+"_"+r,i=this.cache.get(n),o=!i,i||!this._sessionService){e.next=15;break}return e.prev=4,e.next=7,this._sessionService.get("/hasSubscription/"+t);case 7:i=e.sent,e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(4),400===e.t0.code){e.next=14;break}throw e.t0;case 14:i=null;case 15:if(i){e.next=21;break}return s={product_id:t},r&&(s.sp_id=r),e.next=20,this._spid.get("ajax/hassubscription.js",s);case 20:i=e.sent;case 21:if(o&&(a=i.result?3600:10,this.cache.set(n,i,1e3*a)),i.result){e.next=24;break}return e.abrupt("return",null);case 24:return this.emit("hasSubscription",{subscriptionId:t,data:i}),e.abrupt("return",i);case 26:case"end":return e.stop()}},e,this,[[4,10]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:e})}},{key:"productsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:e})}}]),t}();t.default=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.eventValidatorFunc=i;function i(e,t){return e._iframeUrl.startsWith(t.origin)&&t.data}var o=function(){function e(t,r,n,o){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._iframeUrl=t.makeUrl("/authn/itp",{environment:o,client_id:r,redirect_uri:n}),this.isValidEvent=s}return n(e,[{key:"show",value:function(){var e=this;return new Promise(function(t,r){e._preventBodyScrolling();var n=e._buildModalElement();document.body.appendChild(n);var i=function(){n.style.opacity=0,window.removeEventListener("message",o),setTimeout(function(){document.body.removeChild(n),e._restoreBodyScrolling()},500)},o=function(n){if(e.isValidEvent(e,n)){if(i(),n.data.sessionData)return void t(n.data.sessionData);r(n.data.error)}};window.addEventListener("message",o),n.onclick=function(){i(),r("cancel")},setTimeout(function(){n.style.opacity=1},0)})}},{key:"_buildModalElement",value:function(){var e=document.createElement("div");e.style=this._buildStyleString({position:"fixed",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",top:0,right:0,bottom:0,left:0,"background-color":"rgba(0, 0, 0, .7)",transition:"opacity 500ms",opacity:0,"z-index":1e4});var t=document.createElement("iframe");return t.sandbox="allow-storage-access-by-user-activation allow-same-origin allow-scripts",t.style=this._buildStyleString({width:"368px",height:"400px","background-color":"#ffffff"}),t.src=this._iframeUrl,e.appendChild(t),e}},{key:"_buildStyleString",value:function(e){return Object.keys(e).reduce(function(t,r){return t+" "+r+": "+e[r]+";"},"")}},{key:"_preventBodyScrolling",value:function(){this._originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden"}},{key:"_restoreBodyScrolling",value:function(){document.body.style.overflow=this._originalBodyOverflow}}]),e}();t.default=o},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,a=t.jsonpCallback||r.jsonpCallback,u=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=a+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),u&&clearTimeout(u),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var d=document.createElement("script");d.setAttribute("src",""+o+a+"="+l),t.charset&&d.setAttribute("charset",t.charset),d.id=f,document.getElementsByTagName("head")[0].appendChild(d),u=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),d.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),u&&clearTimeout(u)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),a=r(5),u=r(4),c=r(3),l=g(r(10)),f=g(r(7)),d=g(r(9)),h=b(r(8)),p=g(r(13)),v=g(r(2)),y=g(r(1)),m=b(r(6));function b(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function g(e){return e&&e.__esModule?e:{default:e}}function w(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var _=function(){return window};var S=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.sessionDomain,o=e.env,a=void 0===o?"PRE":o,u=e.siteSpecificLogout,c=void 0===u||u,l=e.log,f=e.window,h=void 0===f?_():f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(h),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),m.emulate(h),p._sessionInitiatedSent=!1,p.window=h,p.clientId=r,p.cache=new d.default(function(){return p.window&&p.window.localStorage}),p.redirectUri=n,p.env=a,p.siteSpecificLogout=c,p.log=l,i&&((0,s.assert)((0,s.isUrl)(i),"sessionDomain parameter is not a valid URL"),p._setSessionServiceUrl(i)),p._enableSessionCaching=!0,p._itpMode=!1,p._session={},p._setSpidServerUrl(a),p._setBffServerUrl(a),p._setOauthServerUrl(a),p._setHasSessionServerUrl(a),p._setGlobalSessionServiceUrl(a),p}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new v.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"_setGlobalSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._globalSessionService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SESSION_SERVICE),log:this.log,defaultParams:{client_sdrn:t}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(e){var t=0,r=void 0;if(Number.isInteger(e))t=e;else if("object"==(void 0===e?"undefined":o(e))){var n=e.expiresIn;t=void 0===n?t:n;var i=e.domain;r=void 0===i?r:i}(0,s.assert)(Number.isInteger(t),"'expiresIn' must be an integer"),(0,s.assert)(t>=0,"'expiresIn' cannot be negative"),this.setVarnishCookie=!0,this.varnishExpiresIn=t,this.varnishCookieDomain=r}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;if(this.varnishExpiresIn||"number"==typeof e.expiresIn&&e.expiresIn>0){var r=this.varnishExpiresIn||e.expiresIn;t.setTime(t.getTime()+1e3*r)}else t.setTime(0);var n=this.varnishCookieDomain||("string"==typeof e.baseDomain?e.baseDomain:document.domain)||"",i=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+n].join("; ");document.cookie=i}}},{key:"_maybeClearVarnishCookie",value:function(){this.setVarnishCookie&&this._clearVarnishCookie()}},{key:"_clearVarnishCookie",value:function(){var e=this.varnishCookieDomain||(this._session&&"string"==typeof this._session.baseDomain?this._session.baseDomain:document.domain)||"";document.cookie="SP_ID=nothing; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=."+e}},{key:"_itpModalRequired",value:function(){if(!document.requestStorageAccess||this._sessionService)return!1;var e=navigator.userAgent.match(/Version\/(\d+)\./);return!(!e||e.length<2)&&parseInt(e[1],10)>=12}},{key:"hasSession",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._hasSessionInProgress)return this._hasSessionInProgress;if("boolean"!=typeof t){var r=function(e){return null===e?[void 0===e?"undefined":o(e),""+e]:[e.constructor.name,e.valueOf()]}(t),i=n(r,2),a=i[0],u=i[1];return Promise.reject(new y.default("Parameter 'autologin' must be boolean, was: \""+a+":"+u+'"'))}var c=function(t){if(t.error)throw new y.default("HasSession failed",t.error);return e._maybeSetVarnishCookie(t),e._emitSessionEvent(e._session,t),e._session=t,t},l=function(){var r=w(regeneratorRuntime.mark(function r(){var n,i,o,a,u;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!e._enableSessionCaching){r.next=4;break}if(!(n=e.cache.get("hasSession-cache"))){r.next=4;break}return r.abrupt("return",c(n));case 4:if(i=null,!e._sessionService){r.next=18;break}return r.prev=6,r.next=9,e._sessionService.get("/session");case 9:i=r.sent,r.next=18;break;case 12:if(r.prev=12,r.t0=r.catch(6),!e.siteSpecificLogout){r.next=16;break}throw r.t0;case 16:if(400===r.t0.code){r.next=18;break}throw r.t0;case 18:if(o=t?1:0,i||e._itpMode){r.next=23;break}return r.next=22,e._hasSession.get("rpc/hasSession.js",{autologin:o});case 22:i=r.sent;case 23:if(!(e._itpMode||i&&(0,s.isObject)(i.error)&&"LoginException"===i.error.type)){r.next=27;break}return r.next=26,e._spid.get("ajax/hasSession.js",{autologin:o});case 26:i=r.sent;case 27:if(!(e._itpModalRequired()&&!e._itpMode&&i&&(0,s.isObject)(i.error)&&"UserException"===i.error.type&&null!==e.cache.get("loginInProgress-cache"))){r.next=34;break}return e.cache.delete("loginInProgress-cache"),a=new p.default(e._spid,e.clientId,e.redirectUri,e.env),r.next=33,a.show();case 33:i=r.sent;case 34:return i&&e._enableSessionCaching&&(u=1e3*(i.expiresIn||300),e.cache.set("hasSession-cache",i,u)),r.abrupt("return",c(i));case 36:case"end":return r.stop()}},r,e,[[6,12]])}));return function(){return r.apply(this,arguments)}}();return this._hasSessionInProgress=l().then(function(t){return e._hasSessionInProgress=!1,t},function(t){throw e.emit("error",t),e._hasSessionInProgress=!1,new y.default("HasSession failed",t)}),this._hasSessionInProgress}},{key:"isLoggedIn",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new y.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,a.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId||!t.result){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid||!t.result){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserContextData",value:function(){var e=w(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._globalSessionService.get("/user-context");case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),e.abrupt("return",null);case 9:case"end":return e.stop()}},e,this,[[0,6]])}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,a=e.preferPopup,u=void 0!==a&&a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,d=void 0===f?"":f,p=e.tag,v=void 0===p?"":p,y=e.teaser,m=void 0===y?"":y,b=e.maxAge,g=void 0===b?"":b,w=e.locale,_=void 0===w?"":w,S=e.oneStepLogin,U=void 0!==S&&S;this._closePopup(),this.cache.delete("hasSession-cache");var k=this.loginUrl({state:r,acrValues:t,scope:i,redirectUri:s,newFlow:l,loginHint:d,tag:v,teaser:m,maxAge:g,locale:_,oneStepLogin:U});return this.showItpModalUponReturning(),u&&(this.popup=h.open(this.window,k,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=k,null)}},{key:"logout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;this.cache.delete("hasSession-cache"),this._maybeClearVarnishCookie(),this.emit("logout"),this.window.location.href=this.logoutUrl(e)}},{key:"loginUrl",value:function(e){var t=e.state,r=e.acrValues,n=e.scope,i=void 0===n?"openid":n,a=e.redirectUri,u=void 0===a?this.redirectUri:a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,d=void 0===f?"":f,h=e.tag,p=void 0===h?"":h,v=e.teaser,y=void 0===v?"":v,m=e.maxAge,b=void 0===m?"":m,g=e.locale,w=void 0===g?"":g,_=e.oneStepLogin,S=void 0!==_&&_;return"object"!==o(arguments[0])&&(t=arguments[0],r=arguments[1],i=arguments[2]||i,u=arguments[3]||u,l="boolean"==typeof arguments[4]?arguments[4]:l,d=arguments[5]||d,p=arguments[6]||p,y=arguments[7]||y,b=isNaN(arguments[8])?b:arguments[8]),(0,s.assert)(!r||(0,s.isStrIn)(r,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+r),(0,s.assert)((0,s.isUrl)(u),"loginUrl(): redirectUri must be a valid url but is "+u),(0,s.assert)((0,s.isNonEmptyString)(t),"the state parameter should be a non empty string but it is "+t),l?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:u,scope:i,state:t,acr_values:r,login_hint:d,tag:p,teaser:y,max_age:b,locale:w,one_step_login:S||"",prompt:this.siteSpecificLogout?"select_account":""}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:u,scope:i,state:t,email:d,tag:p,teaser:y,locale:w})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid");var t={redirect_uri:e};return this._sessionService&&this.siteSpecificLogout?this._sessionService.makeUrl("logout",t):this._spid.makeUrl("logout",Object.assign({response_type:"code"},t))}},{key:"accountUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/summary",{response_type:"code",redirect_uri:e})}},{key:"phonesUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/phones",{response_type:"code",redirect_uri:e})}},{key:"authFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}},{key:"showItpModalUponReturning",value:function(){this._itpModalRequired()&&this.cache.set("loginInProgress-cache",{},9e5)}},{key:"suppressItpModal",value:function(){this.cache.delete("loginInProgress-cache")}}]),t}();t.default=S},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=_;var d="suspendedStart",h="suspendedYield",p="executing",v="completed",y={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,a)&&(m=g);var w=P.prototype=U.prototype=Object.create(m);k.prototype=w.constructor=P,P.constructor=k,P[c]=k.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,P):(e.__proto__=P,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},O(x.prototype),x.prototype[u]=function(){return this},f.AsyncIterator=x,f.async=function(e,t,r,n){var i=new x(_(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},O(w),w[c]="Generator",w[a]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return a.type="throw",a.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(e,t,r,n){var i=t&&t.prototype instanceof U?t:U,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=d;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return M()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=j(s,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=S(e,t,r);if("normal"===u.type){if(n=r.done?v:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(e,r,s),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function U(){}function k(){}function P(){}function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function x(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,a){var u=S(e[n],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,a)},function(e){r("throw",e,s,a)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},function(e){return r("throw",e,s,a)})}a(u.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function j(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,j(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:M}}function M(){return{value:n,done:!0}}}(function(){return this||"object"===("undefined"==typeof self?"undefined":t(self))&&self}()||Function("return this")())}).call(this,r(16)(e))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return this||"object"===("undefined"==typeof self?"undefined":n(self))&&self}()||Function("return this")(),o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,s=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=r(17),o)i.regeneratorRuntime=s;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},function(e,t,r){"use strict";window.regeneratorRuntime=r(18);var n=r(15).Identity,i=r(12).Monetization,o=r(11).Payment;e.exports={Identity:n,Monetization:i,Payment:o}},function(e,t,r){"use strict";var n=r(19),i=n.Identity,o=n.Monetization,s=n.Payment;Object.assign(window,{Identity:i,Monetization:o,Payment:s})}])); | ||
//# sourceMappingURL=global.min.js.map |
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new i.default(t)},t.isStr=o,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=s,t.isNonEmptyObj=function(e){return s(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!o(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return o(t)&&e.toUpperCase()===t.toUpperCase()})};var i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e){return"string"==typeof e}function s(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(i.name="SDKError","object"===(void 0===r?"undefined":n(r)))try{Object.assign(i,r)}catch(e){}return i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new s.default("No objects to clone");return r.forEach(function(t){(0,o.assert)((0,o.isObject)(t)),(0,o.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],s=r[1];void 0!==s&&(e[n]=(0,o.isObject)(s)?a(s):s)})}),e},t.cloneDeep=a;var o=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function a(e){return(0,o.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1)),o=r(2),s=r(5),a=r(0);var u=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,a.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function c(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var l=function(){return window.fetch&&window.fetch.bind(window)},f=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,u=void 0===o?l():o,c=t.log,f=t.defaultParams,h=void 0===f?{}:f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,a.assert)((0,a.isObject)(h),"defaultParams should be a non-null object"),this.url=new URL((0,s.urlMapper)(n,i)),this.defaultParams=h,c&&((0,a.assert)((0,a.isFunction)(c),"log must be a function but it is "+c),this.log=c),u&&((0,a.assert)((0,a.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return n(e,[{key:"go",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}(regeneratorRuntime.mark(function e(t){var r,n,s,c,l=t.method,f=t.headers,h=t.pathname,d=t.data,p=void 0===d?{}:d,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:l,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,a.assert)((0,a.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,a.assert)((0,a.isNonEmptyString)(l),'Method must be a non empty string but it is "'+l+'"'),(0,a.assert)((0,a.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,a.assert)((0,a.isObject)(p),"data must be a non-null object"),b.headers=(0,a.isObject)(f)?(0,o.cloneDefined)(f):{},r=this.makeUrl(h,p,y),u(this.log,"Request:",b.method.toUpperCase(),r),u(this.log,"Request Headers:",b.headers),u(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,u(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new i.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return s=e.sent,u(this.log,"Response Parsed:",s),e.abrupt("return",s);case 23:throw e.prev=23,e.t0=e.catch(9),c=(0,a.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,a.isObject)(e.t0)&&(0,a.isStr)(e.t0.message)&&(c=e.t0.message),new i.default("Failed to '"+l+"' '"+r+"': '"+c+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}));return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,o.cloneDefined)(r,e):(0,o.cloneDefined)(e);return Object.keys(n).filter(function(e){return""!==n[e]}).map(function(e){return c(e)+"="+c(n[e])}).join("&")}}]),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"},SESSION_SERVICE:{LOCAL:"http://session-service.id.localhost",DEV:"https://session-service.identity-dev.schibsted.com",PRE:"https://session-service.identity-pre.schibsted.com",PRO:"https://session-service.login.schibsted.com",PRO_NO:"https://session-service.payment.schibsted.no"}},JSONP:{TIMEOUT:7e3},NAMESPACE:{LOCAL:"id.localhost",DEV:"schibsted.com",PRE:"schibsted.com",PRO:"schibsted.com",PRO_NO:"spid.no"}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP,t.NAMESPACE=n.NAMESPACE},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.eventValidatorFunc=i;function i(e,t){return e._iframeUrl.startsWith(t.origin)&&t.data}var o=function(){function e(t,r,n,o){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._iframeUrl=t.makeUrl("/authn/itp",{environment:o,client_id:r,redirect_uri:n}),this.isValidEvent=s}return n(e,[{key:"show",value:function(){var e=this;return new Promise(function(t,r){e._preventBodyScrolling();var n=e._buildModalElement();document.body.appendChild(n);var i=function(){n.style.opacity=0,window.removeEventListener("message",o),setTimeout(function(){document.body.removeChild(n),e._restoreBodyScrolling()},500)},o=function(n){if(e.isValidEvent(e,n)){if(i(),n.data.sessionData)return void t(n.data.sessionData);r(n.data.error)}};window.addEventListener("message",o),n.onclick=function(){i(),r("cancel")},setTimeout(function(){n.style.opacity=1},0)})}},{key:"_buildModalElement",value:function(){var e=document.createElement("div");e.style=this._buildStyleString({position:"fixed",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",top:0,right:0,bottom:0,left:0,"background-color":"rgba(0, 0, 0, .7)",transition:"opacity 500ms",opacity:0,"z-index":1e4});var t=document.createElement("iframe");return t.sandbox="allow-storage-access-by-user-activation allow-same-origin allow-scripts",t.style=this._buildStyleString({width:"368px",height:"400px","background-color":"#ffffff"}),t.src=this._iframeUrl,e.appendChild(t),e}},{key:"_buildStyleString",value:function(e){return Object.keys(e).reduce(function(t,r){return t+" "+r+": "+e[r]+";"},"")}},{key:"_preventBodyScrolling",value:function(){this._originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden"}},{key:"_restoreBodyScrolling",value:function(){document.body.style.overflow=this._originalBodyOverflow}}]),e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isObject)(e.screen),"window should be a valid Window object but it lacks a 'screen' property"),(0,n.assert)((0,n.isFunction)(e.open),"window should be a valid Window object but it lacks an 'open' function"),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var a=e.screen,u=a.height,c=a.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(u)&&(l.top=(u-l.height)/2);var f=function(e){return(0,n.assert)((0,n.isObject)(e),"Object must be an object but it is '"+e+"'"),Object.keys(e).map(function(t){return t+"="+e[t]}).join(",")}(l);return e.open(t,r,f)};var n=r(0),i=r(2);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function e(t){var r=this;o(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},a=function e(){var t=this;o(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},u=Math.pow(2,31)-1,c=function(){function e(t){o(this,e),!function(e){if(!e)return!1;try{var t=e(),r="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(r,"TEST-VALUE");var n=t.getItem(r);return t.removeItem(r),"TEST-VALUE"===n}catch(e){return!1}}(t)?(this.cache=new a,this.type="ObjectLiteralStorage"):(this.cache=new s(t()),this.type="WebStorage")}return n(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new i.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0)){n=Math.min(u,n);try{var o=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:o,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new i.default(e)}}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new i.default(e)}}}]),e}();t.default=c},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,a=t.jsonpCallback||r.jsonpCallback,u=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=a+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),u&&clearTimeout(u),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+a+"="+l),t.charset&&h.setAttribute("charset",t.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),u=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),u&&clearTimeout(u)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(2),o=u(r(3)),s=u(r(4)),a=u(r(10));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:a.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),a=r(2),u=r(5),c=r(4),l=g(r(12)),f=g(r(11)),h=g(r(9)),d=b(r(8)),p=g(r(7)),v=g(r(3)),y=g(r(1)),m=b(r(6));function b(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function g(e){return e&&e.__esModule?e:{default:e}}function w(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var S=function(){return window};function _(e){return null===e?[void 0===e?"undefined":o(e),""+e]:[e.constructor.name,e.valueOf()]}var O=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.sessionDomain,o=e.env,a=void 0===o?"PRE":o,u=e.siteSpecificLogout,c=void 0===u||u,l=e.log,f=e.window,d=void 0===f?S():f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(d),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),m.emulate(d),p._sessionInitiatedSent=!1,p.window=d,p.clientId=r,p.cache=new h.default(function(){return p.window&&p.window.localStorage}),p.redirectUri=n,p.env=a,p.siteSpecificLogout=c,p.log=l,i&&((0,s.assert)((0,s.isUrl)(i),"sessionDomain parameter is not a valid URL"),p._setSessionServiceUrl(i)),p._enableSessionCaching=!0,p._itpMode=!1,p._session={},p._setSpidServerUrl(a),p._setBffServerUrl(a),p._setOauthServerUrl(a),p._setHasSessionServerUrl(a),p._setGlobalSessionServiceUrl(a),p}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new v.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"_setGlobalSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._globalSessionService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SESSION_SERVICE),log:this.log,defaultParams:{client_sdrn:t}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(e){var t=0,r=void 0;if(Number.isInteger(e))t=e;else if("object"==(void 0===e?"undefined":o(e))){var n=e.expiresIn;t=void 0===n?t:n;var i=e.domain;r=void 0===i?r:i}(0,s.assert)(Number.isInteger(t),"'expiresIn' must be an integer"),(0,s.assert)(t>=0,"'expiresIn' cannot be negative"),this.setVarnishCookie=!0,this.varnishExpiresIn=t,this.varnishCookieDomain=r}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;if(this.varnishExpiresIn||"number"==typeof e.expiresIn&&e.expiresIn>0){var r=this.varnishExpiresIn||e.expiresIn;t.setTime(t.getTime()+1e3*r)}else t.setTime(0);var n=this.varnishCookieDomain||("string"==typeof e.baseDomain?e.baseDomain:document.domain)||"",i=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+n].join("; ");document.cookie=i}}},{key:"_maybeClearVarnishCookie",value:function(){this.setVarnishCookie&&this._clearVarnishCookie()}},{key:"_clearVarnishCookie",value:function(){var e=this.varnishCookieDomain||(this._session&&"string"==typeof this._session.baseDomain?this._session.baseDomain:document.domain)||"";document.cookie="SP_ID=nothing; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=."+e}},{key:"_itpModalRequired",value:function(){if(!document.requestStorageAccess||this._sessionService)return!1;var e=navigator.userAgent.match(/Version\/(\d+)\./);return!(!e||e.length<2)&&parseInt(e[1],10)>=12}},{key:"hasSession",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._hasSessionInProgress)return this._hasSessionInProgress;var r=function(){var r=w(regeneratorRuntime.mark(function r(i,o){var a,u,c,l,f,h,d,v,m,b;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a=function(t){if(t.error)return e.emit("error",t.error),o(new y.default("HasSession failed",t.error));e._maybeSetVarnishCookie(t),e._emitSessionEvent(e._session,t)},"boolean"==typeof t){r.next=4;break}return u=_(t),c=n(u,2),l=c[0],f=c[1],r.abrupt("return",o(new y.default("Parameter 'autologin' must be boolean, was: \""+l+":"+f+'"')));case 4:if(r.prev=4,!e._enableSessionCaching){r.next=10;break}if(!(h=e.cache.get("hasSession-cache"))){r.next=10;break}return a(h),r.abrupt("return",i(h));case 10:if(d=null,!e._sessionService){r.next=26;break}return r.prev=12,r.next=15,e._sessionService.get("/session");case 15:d=r.sent,r.next=26;break;case 18:if(r.prev=18,r.t0=r.catch(12),!e.siteSpecificLogout){r.next=22;break}throw r.t0;case 22:if(400===r.t0.code){r.next=25;break}return e.emit("error",r.t0),r.abrupt("return",o(new y.default("HasSession failed",r.t0)));case 25:d=null;case 26:if(v=t?1:0,d||e._itpMode){r.next=31;break}return r.next=30,e._hasSession.get("rpc/hasSession.js",{autologin:v});case 30:d=r.sent;case 31:if(!(e._itpMode||(0,s.isObject)(d.error)&&"LoginException"===d.error.type)){r.next=35;break}return r.next=34,e._spid.get("ajax/hasSession.js",{autologin:v});case 34:d=r.sent;case 35:if(!(e._itpModalRequired()&&!e._itpMode&&(0,s.isObject)(d.error)&&"UserException"===d.error.type&&null!==e.cache.get("loginInProgress-cache"))){r.next=42;break}return e.cache.delete("loginInProgress-cache"),m=new p.default(e._spid,e.clientId,e.redirectUri,e.env),r.next=41,m.show();case 41:d=r.sent;case 42:e._enableSessionCaching&&(b=1e3*(d.expiresIn||300),e.cache.set("hasSession-cache",d,b)),a(d),e._session=d,i(d),r.next=52;break;case 48:r.prev=48,r.t1=r.catch(4),e.emit("error",r.t1),o(new y.default("HasSession failed",r.t1));case 52:case"end":return r.stop()}},r,e,[[4,48],[12,18]])}));return function(e,t){return r.apply(this,arguments)}}(),i=new Promise(r);return this._hasSessionInProgress=i.then(function(t){return e._hasSessionInProgress=null,t},function(t){throw e._hasSessionInProgress=null,t}),this._hasSessionInProgress}},{key:"isLoggedIn",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new y.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,a.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId||!t.result){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid||!t.result){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserContextData",value:function(){var e=w(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._globalSessionService.get("/user-context");case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),e.abrupt("return",null);case 9:case"end":return e.stop()}},e,this,[[0,6]])}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,a=e.preferPopup,u=void 0!==a&&a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f,p=e.tag,v=void 0===p?"":p,y=e.teaser,m=void 0===y?"":y,b=e.maxAge,g=void 0===b?"":b,w=e.locale,S=void 0===w?"":w,_=e.oneStepLogin,O=void 0!==_&&_;this._closePopup(),this.cache.delete("hasSession-cache");var k=this.loginUrl({state:r,acrValues:t,scope:i,redirectUri:s,newFlow:l,loginHint:h,tag:v,teaser:m,maxAge:g,locale:S,oneStepLogin:O});return this.showItpModalUponReturning(),u&&(this.popup=d.open(this.window,k,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=k,null)}},{key:"logout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;this.cache.delete("hasSession-cache"),this._maybeClearVarnishCookie(),this.emit("logout"),this.window.location.href=this.logoutUrl(e)}},{key:"loginUrl",value:function(e){var t=e.state,r=e.acrValues,n=e.scope,i=void 0===n?"openid":n,a=e.redirectUri,u=void 0===a?this.redirectUri:a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f,d=e.tag,p=void 0===d?"":d,v=e.teaser,y=void 0===v?"":v,m=e.maxAge,b=void 0===m?"":m,g=e.locale,w=void 0===g?"":g,S=e.oneStepLogin,_=void 0!==S&&S;return"object"!==o(arguments[0])&&(t=arguments[0],r=arguments[1],i=arguments[2]||i,u=arguments[3]||u,l="boolean"==typeof arguments[4]?arguments[4]:l,h=arguments[5]||h,p=arguments[6]||p,y=arguments[7]||y,b=isNaN(arguments[8])?b:arguments[8]),(0,s.assert)(!r||(0,s.isStrIn)(r,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+r),(0,s.assert)((0,s.isUrl)(u),"loginUrl(): redirectUri must be a valid url but is "+u),(0,s.assert)((0,s.isNonEmptyString)(t),"the state parameter should be a non empty string but it is "+t),l?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:u,scope:i,state:t,acr_values:r,login_hint:h,tag:p,teaser:y,max_age:b,locale:w,one_step_login:_||"",prompt:this.siteSpecificLogout?"select_account":""}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:u,scope:i,state:t,email:h,tag:p,teaser:y,locale:w})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid");var t={redirect_uri:e};return this._sessionService&&this.siteSpecificLogout?this._sessionService.makeUrl("logout",t):this._spid.makeUrl("logout",Object.assign({response_type:"code"},t))}},{key:"accountUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/summary",{response_type:"code",redirect_uri:e})}},{key:"phonesUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/phones",{response_type:"code",redirect_uri:e})}},{key:"authFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}},{key:"showItpModalUponReturning",value:function(){this._itpModalRequired()&&this.cache.set("loginInProgress-cache",{},9e5)}},{key:"suppressItpModal",value:function(){this.cache.delete("loginInProgress-cache")}}]),t}();t.default=O},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=S;var h="suspendedStart",d="suspendedYield",p="executing",v="completed",y={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,a)&&(m=g);var w=P.prototype=O.prototype=Object.create(m);k.prototype=w.constructor=P,P.constructor=k,P[c]=k.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,P):(e.__proto__=P,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},x(j.prototype),j.prototype[u]=function(){return this},f.AsyncIterator=j,f.async=function(e,t,r,n){var i=new j(S(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},x(w),w[c]="Generator",w[a]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return a.type="throw",a.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function S(e,t,r,n){var i=t&&t.prototype instanceof O?t:O,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return T()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=E(s,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=_(e,t,r);if("normal"===u.type){if(n=r.done?v:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(e,r,s),o}function _(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function k(){}function P(){}function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function j(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,a){var u=_(e[n],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,a)},function(e){r("throw",e,s,a)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},function(e){return r("throw",e,s,a)})}a(u.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function E(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,E(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=_(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function U(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(U,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:n,done:!0}}}(function(){return this||"object"===("undefined"==typeof self?"undefined":t(self))&&self}()||Function("return this")())}).call(this,r(14)(e))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return this||"object"===("undefined"==typeof self?"undefined":n(self))&&self}()||Function("return this")(),o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,s=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=r(15),o)i.regeneratorRuntime=s;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},function(e,t,r){"use strict";window.regeneratorRuntime=r(16);var n=r(13).Identity;e.exports={Identity:n}}]); | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new i.default(t)},t.isStr=o,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=s,t.isNonEmptyObj=function(e){return s(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!o(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return o(t)&&e.toUpperCase()===t.toUpperCase()})};var i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e){return"string"==typeof e}function s(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(i.name="SDKError","object"===(void 0===r?"undefined":n(r)))try{Object.assign(i,r)}catch(e){}return i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new s.default("No objects to clone");return r.forEach(function(t){(0,o.assert)((0,o.isObject)(t)),(0,o.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],s=r[1];void 0!==s&&(e[n]=(0,o.isObject)(s)?a(s):s)})}),e},t.cloneDeep=a;var o=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function a(e){return(0,o.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1)),o=r(2),s=r(5),a=r(0);var u=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,a.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function c(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var l=function(){return window.fetch&&window.fetch.bind(window)},f=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,u=void 0===o?l():o,c=t.log,f=t.defaultParams,h=void 0===f?{}:f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,a.assert)((0,a.isObject)(h),"defaultParams should be a non-null object"),this.url=new URL((0,s.urlMapper)(n,i)),this.defaultParams=h,c&&((0,a.assert)((0,a.isFunction)(c),"log must be a function but it is "+c),this.log=c),u&&((0,a.assert)((0,a.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return n(e,[{key:"go",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}(regeneratorRuntime.mark(function e(t){var r,n,s,c,l=t.method,f=t.headers,h=t.pathname,d=t.data,p=void 0===d?{}:d,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:l,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,a.assert)((0,a.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,a.assert)((0,a.isNonEmptyString)(l),'Method must be a non empty string but it is "'+l+'"'),(0,a.assert)((0,a.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,a.assert)((0,a.isObject)(p),"data must be a non-null object"),b.headers=(0,a.isObject)(f)?(0,o.cloneDefined)(f):{},r=this.makeUrl(h,p,y),u(this.log,"Request:",b.method.toUpperCase(),r),u(this.log,"Request Headers:",b.headers),u(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,u(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new i.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return s=e.sent,u(this.log,"Response Parsed:",s),e.abrupt("return",s);case 23:throw e.prev=23,e.t0=e.catch(9),c=(0,a.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,a.isObject)(e.t0)&&(0,a.isStr)(e.t0.message)&&(c=e.t0.message),new i.default("Failed to '"+l+"' '"+r+"': '"+c+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}));return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,o.cloneDefined)(r,e):(0,o.cloneDefined)(e);return Object.keys(n).filter(function(e){return""!==n[e]}).map(function(e){return c(e)+"="+c(n[e])}).join("&")}}]),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"},SESSION_SERVICE:{LOCAL:"http://session-service.id.localhost",DEV:"https://session-service.identity-dev.schibsted.com",PRE:"https://session-service.identity-pre.schibsted.com",PRO:"https://session-service.login.schibsted.com",PRO_NO:"https://session-service.payment.schibsted.no"}},JSONP:{TIMEOUT:7e3},NAMESPACE:{LOCAL:"id.localhost",DEV:"schibsted.com",PRE:"schibsted.com",PRO:"schibsted.com",PRO_NO:"spid.no"}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP,t.NAMESPACE=n.NAMESPACE},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.eventValidatorFunc=i;function i(e,t){return e._iframeUrl.startsWith(t.origin)&&t.data}var o=function(){function e(t,r,n,o){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._iframeUrl=t.makeUrl("/authn/itp",{environment:o,client_id:r,redirect_uri:n}),this.isValidEvent=s}return n(e,[{key:"show",value:function(){var e=this;return new Promise(function(t,r){e._preventBodyScrolling();var n=e._buildModalElement();document.body.appendChild(n);var i=function(){n.style.opacity=0,window.removeEventListener("message",o),setTimeout(function(){document.body.removeChild(n),e._restoreBodyScrolling()},500)},o=function(n){if(e.isValidEvent(e,n)){if(i(),n.data.sessionData)return void t(n.data.sessionData);r(n.data.error)}};window.addEventListener("message",o),n.onclick=function(){i(),r("cancel")},setTimeout(function(){n.style.opacity=1},0)})}},{key:"_buildModalElement",value:function(){var e=document.createElement("div");e.style=this._buildStyleString({position:"fixed",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",top:0,right:0,bottom:0,left:0,"background-color":"rgba(0, 0, 0, .7)",transition:"opacity 500ms",opacity:0,"z-index":1e4});var t=document.createElement("iframe");return t.sandbox="allow-storage-access-by-user-activation allow-same-origin allow-scripts",t.style=this._buildStyleString({width:"368px",height:"400px","background-color":"#ffffff"}),t.src=this._iframeUrl,e.appendChild(t),e}},{key:"_buildStyleString",value:function(e){return Object.keys(e).reduce(function(t,r){return t+" "+r+": "+e[r]+";"},"")}},{key:"_preventBodyScrolling",value:function(){this._originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden"}},{key:"_restoreBodyScrolling",value:function(){document.body.style.overflow=this._originalBodyOverflow}}]),e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isObject)(e.screen),"window should be a valid Window object but it lacks a 'screen' property"),(0,n.assert)((0,n.isFunction)(e.open),"window should be a valid Window object but it lacks an 'open' function"),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var a=e.screen,u=a.height,c=a.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(u)&&(l.top=(u-l.height)/2);var f=function(e){return(0,n.assert)((0,n.isObject)(e),"Object must be an object but it is '"+e+"'"),Object.keys(e).map(function(t){return t+"="+e[t]}).join(",")}(l);return e.open(t,r,f)};var n=r(0),i=r(2);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function e(t){var r=this;o(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},a=function e(){var t=this;o(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},u=Math.pow(2,31)-1,c=function(){function e(t){o(this,e),!function(e){if(!e)return!1;try{var t=e(),r="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(r,"TEST-VALUE");var n=t.getItem(r);return t.removeItem(r),"TEST-VALUE"===n}catch(e){return!1}}(t)?(this.cache=new a,this.type="ObjectLiteralStorage"):(this.cache=new s(t()),this.type="WebStorage")}return n(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new i.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0)){n=Math.min(u,n);try{var o=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:o,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new i.default(e)}}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new i.default(e)}}}]),e}();t.default=c},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,a=t.jsonpCallback||r.jsonpCallback,u=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=a+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),u&&clearTimeout(u),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+a+"="+l),t.charset&&h.setAttribute("charset",t.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),u=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),u&&clearTimeout(u)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(2),o=u(r(3)),s=u(r(4)),a=u(r(10));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:a.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),a=r(2),u=r(5),c=r(4),l=g(r(12)),f=g(r(11)),h=g(r(9)),d=b(r(8)),p=g(r(7)),v=g(r(3)),y=g(r(1)),m=b(r(6));function b(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function g(e){return e&&e.__esModule?e:{default:e}}function w(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var S=function(){return window};var _=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.sessionDomain,o=e.env,a=void 0===o?"PRE":o,u=e.siteSpecificLogout,c=void 0===u||u,l=e.log,f=e.window,d=void 0===f?S():f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(d),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),m.emulate(d),p._sessionInitiatedSent=!1,p.window=d,p.clientId=r,p.cache=new h.default(function(){return p.window&&p.window.localStorage}),p.redirectUri=n,p.env=a,p.siteSpecificLogout=c,p.log=l,i&&((0,s.assert)((0,s.isUrl)(i),"sessionDomain parameter is not a valid URL"),p._setSessionServiceUrl(i)),p._enableSessionCaching=!0,p._itpMode=!1,p._session={},p._setSpidServerUrl(a),p._setBffServerUrl(a),p._setOauthServerUrl(a),p._setHasSessionServerUrl(a),p._setGlobalSessionServiceUrl(a),p}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new v.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"_setGlobalSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._globalSessionService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SESSION_SERVICE),log:this.log,defaultParams:{client_sdrn:t}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(e){var t=0,r=void 0;if(Number.isInteger(e))t=e;else if("object"==(void 0===e?"undefined":o(e))){var n=e.expiresIn;t=void 0===n?t:n;var i=e.domain;r=void 0===i?r:i}(0,s.assert)(Number.isInteger(t),"'expiresIn' must be an integer"),(0,s.assert)(t>=0,"'expiresIn' cannot be negative"),this.setVarnishCookie=!0,this.varnishExpiresIn=t,this.varnishCookieDomain=r}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;if(this.varnishExpiresIn||"number"==typeof e.expiresIn&&e.expiresIn>0){var r=this.varnishExpiresIn||e.expiresIn;t.setTime(t.getTime()+1e3*r)}else t.setTime(0);var n=this.varnishCookieDomain||("string"==typeof e.baseDomain?e.baseDomain:document.domain)||"",i=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+n].join("; ");document.cookie=i}}},{key:"_maybeClearVarnishCookie",value:function(){this.setVarnishCookie&&this._clearVarnishCookie()}},{key:"_clearVarnishCookie",value:function(){var e=this.varnishCookieDomain||(this._session&&"string"==typeof this._session.baseDomain?this._session.baseDomain:document.domain)||"";document.cookie="SP_ID=nothing; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=."+e}},{key:"_itpModalRequired",value:function(){if(!document.requestStorageAccess||this._sessionService)return!1;var e=navigator.userAgent.match(/Version\/(\d+)\./);return!(!e||e.length<2)&&parseInt(e[1],10)>=12}},{key:"hasSession",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._hasSessionInProgress)return this._hasSessionInProgress;if("boolean"!=typeof t){var r=function(e){return null===e?[void 0===e?"undefined":o(e),""+e]:[e.constructor.name,e.valueOf()]}(t),i=n(r,2),a=i[0],u=i[1];return Promise.reject(new y.default("Parameter 'autologin' must be boolean, was: \""+a+":"+u+'"'))}var c=function(t){if(t.error)throw new y.default("HasSession failed",t.error);return e._maybeSetVarnishCookie(t),e._emitSessionEvent(e._session,t),e._session=t,t},l=function(){var r=w(regeneratorRuntime.mark(function r(){var n,i,o,a,u;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!e._enableSessionCaching){r.next=4;break}if(!(n=e.cache.get("hasSession-cache"))){r.next=4;break}return r.abrupt("return",c(n));case 4:if(i=null,!e._sessionService){r.next=18;break}return r.prev=6,r.next=9,e._sessionService.get("/session");case 9:i=r.sent,r.next=18;break;case 12:if(r.prev=12,r.t0=r.catch(6),!e.siteSpecificLogout){r.next=16;break}throw r.t0;case 16:if(400===r.t0.code){r.next=18;break}throw r.t0;case 18:if(o=t?1:0,i||e._itpMode){r.next=23;break}return r.next=22,e._hasSession.get("rpc/hasSession.js",{autologin:o});case 22:i=r.sent;case 23:if(!(e._itpMode||i&&(0,s.isObject)(i.error)&&"LoginException"===i.error.type)){r.next=27;break}return r.next=26,e._spid.get("ajax/hasSession.js",{autologin:o});case 26:i=r.sent;case 27:if(!(e._itpModalRequired()&&!e._itpMode&&i&&(0,s.isObject)(i.error)&&"UserException"===i.error.type&&null!==e.cache.get("loginInProgress-cache"))){r.next=34;break}return e.cache.delete("loginInProgress-cache"),a=new p.default(e._spid,e.clientId,e.redirectUri,e.env),r.next=33,a.show();case 33:i=r.sent;case 34:return i&&e._enableSessionCaching&&(u=1e3*(i.expiresIn||300),e.cache.set("hasSession-cache",i,u)),r.abrupt("return",c(i));case 36:case"end":return r.stop()}},r,e,[[6,12]])}));return function(){return r.apply(this,arguments)}}();return this._hasSessionInProgress=l().then(function(t){return e._hasSessionInProgress=!1,t},function(t){throw e.emit("error",t),e._hasSessionInProgress=!1,new y.default("HasSession failed",t)}),this._hasSessionInProgress}},{key:"isLoggedIn",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new y.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,a.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId||!t.result){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid||!t.result){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserContextData",value:function(){var e=w(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._globalSessionService.get("/user-context");case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),e.abrupt("return",null);case 9:case"end":return e.stop()}},e,this,[[0,6]])}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=w(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,a=e.preferPopup,u=void 0!==a&&a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f,p=e.tag,v=void 0===p?"":p,y=e.teaser,m=void 0===y?"":y,b=e.maxAge,g=void 0===b?"":b,w=e.locale,S=void 0===w?"":w,_=e.oneStepLogin,O=void 0!==_&&_;this._closePopup(),this.cache.delete("hasSession-cache");var k=this.loginUrl({state:r,acrValues:t,scope:i,redirectUri:s,newFlow:l,loginHint:h,tag:v,teaser:m,maxAge:g,locale:S,oneStepLogin:O});return this.showItpModalUponReturning(),u&&(this.popup=d.open(this.window,k,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=k,null)}},{key:"logout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;this.cache.delete("hasSession-cache"),this._maybeClearVarnishCookie(),this.emit("logout"),this.window.location.href=this.logoutUrl(e)}},{key:"loginUrl",value:function(e){var t=e.state,r=e.acrValues,n=e.scope,i=void 0===n?"openid":n,a=e.redirectUri,u=void 0===a?this.redirectUri:a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f,d=e.tag,p=void 0===d?"":d,v=e.teaser,y=void 0===v?"":v,m=e.maxAge,b=void 0===m?"":m,g=e.locale,w=void 0===g?"":g,S=e.oneStepLogin,_=void 0!==S&&S;return"object"!==o(arguments[0])&&(t=arguments[0],r=arguments[1],i=arguments[2]||i,u=arguments[3]||u,l="boolean"==typeof arguments[4]?arguments[4]:l,h=arguments[5]||h,p=arguments[6]||p,y=arguments[7]||y,b=isNaN(arguments[8])?b:arguments[8]),(0,s.assert)(!r||(0,s.isStrIn)(r,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+r),(0,s.assert)((0,s.isUrl)(u),"loginUrl(): redirectUri must be a valid url but is "+u),(0,s.assert)((0,s.isNonEmptyString)(t),"the state parameter should be a non empty string but it is "+t),l?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:u,scope:i,state:t,acr_values:r,login_hint:h,tag:p,teaser:y,max_age:b,locale:w,one_step_login:_||"",prompt:this.siteSpecificLogout?"select_account":""}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:u,scope:i,state:t,email:h,tag:p,teaser:y,locale:w})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid");var t={redirect_uri:e};return this._sessionService&&this.siteSpecificLogout?this._sessionService.makeUrl("logout",t):this._spid.makeUrl("logout",Object.assign({response_type:"code"},t))}},{key:"accountUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/summary",{response_type:"code",redirect_uri:e})}},{key:"phonesUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/phones",{response_type:"code",redirect_uri:e})}},{key:"authFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}},{key:"showItpModalUponReturning",value:function(){this._itpModalRequired()&&this.cache.set("loginInProgress-cache",{},9e5)}},{key:"suppressItpModal",value:function(){this.cache.delete("loginInProgress-cache")}}]),t}();t.default=_},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=S;var h="suspendedStart",d="suspendedYield",p="executing",v="completed",y={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,a)&&(m=g);var w=P.prototype=O.prototype=Object.create(m);k.prototype=w.constructor=P,P.constructor=k,P[c]=k.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,P):(e.__proto__=P,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},x(j.prototype),j.prototype[u]=function(){return this},f.AsyncIterator=j,f.async=function(e,t,r,n){var i=new j(S(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},x(w),w[c]="Generator",w[a]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return a.type="throw",a.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function S(e,t,r,n){var i=t&&t.prototype instanceof O?t:O,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return T()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=E(s,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=_(e,t,r);if("normal"===u.type){if(n=r.done?v:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(e,r,s),o}function _(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function k(){}function P(){}function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function j(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,a){var u=_(e[n],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,a)},function(e){r("throw",e,s,a)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},function(e){return r("throw",e,s,a)})}a(u.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function E(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,E(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=_(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function U(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(U,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:n,done:!0}}}(function(){return this||"object"===("undefined"==typeof self?"undefined":t(self))&&self}()||Function("return this")())}).call(this,r(14)(e))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return this||"object"===("undefined"==typeof self?"undefined":n(self))&&self}()||Function("return this")(),o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,s=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=r(15),o)i.regeneratorRuntime=s;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},function(e,t,r){"use strict";window.regeneratorRuntime=r(16);var n=r(13).Identity;e.exports={Identity:n}}]); | ||
//# sourceMappingURL=identity.min.js.map |
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=19)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new i.default(t)},t.isStr=o,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=s,t.isNonEmptyObj=function(e){return s(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!o(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return o(t)&&e.toUpperCase()===t.toUpperCase()})};var i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e){return"string"==typeof e}function s(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(i.name="SDKError","object"===(void 0===r?"undefined":n(r)))try{Object.assign(i,r)}catch(e){}return i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1)),o=r(5),s=r(4),a=r(0);var u=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,a.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function c(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var l=function(){return window.fetch&&window.fetch.bind(window)},f=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,u=void 0===o?l():o,c=t.log,f=t.defaultParams,d=void 0===f?{}:f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,a.assert)((0,a.isObject)(d),"defaultParams should be a non-null object"),this.url=new URL((0,s.urlMapper)(n,i)),this.defaultParams=d,c&&((0,a.assert)((0,a.isFunction)(c),"log must be a function but it is "+c),this.log=c),u&&((0,a.assert)((0,a.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return n(e,[{key:"go",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}(regeneratorRuntime.mark(function e(t){var r,n,s,c,l=t.method,f=t.headers,d=t.pathname,h=t.data,p=void 0===h?{}:h,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:l,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,a.assert)((0,a.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,a.assert)((0,a.isNonEmptyString)(l),'Method must be a non empty string but it is "'+l+'"'),(0,a.assert)((0,a.isNonEmptyString)(d),'Pathname must be string but it is "'+d+'"'),(0,a.assert)((0,a.isObject)(p),"data must be a non-null object"),b.headers=(0,a.isObject)(f)?(0,o.cloneDefined)(f):{},r=this.makeUrl(d,p,y),u(this.log,"Request:",b.method.toUpperCase(),r),u(this.log,"Request Headers:",b.headers),u(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,u(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new i.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return s=e.sent,u(this.log,"Response Parsed:",s),e.abrupt("return",s);case 23:throw e.prev=23,e.t0=e.catch(9),c=(0,a.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,a.isObject)(e.t0)&&(0,a.isStr)(e.t0.message)&&(c=e.t0.message),new i.default("Failed to '"+l+"' '"+r+"': '"+c+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}));return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,o.cloneDefined)(r,e):(0,o.cloneDefined)(e);return Object.keys(n).filter(function(e){return""!==n[e]}).map(function(e){return c(e)+"="+c(n[e])}).join("&")}}]),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"},SESSION_SERVICE:{LOCAL:"http://session-service.id.localhost",DEV:"https://session-service.identity-dev.schibsted.com",PRE:"https://session-service.identity-pre.schibsted.com",PRO:"https://session-service.login.schibsted.com",PRO_NO:"https://session-service.payment.schibsted.no"}},JSONP:{TIMEOUT:7e3},NAMESPACE:{LOCAL:"id.localhost",DEV:"schibsted.com",PRE:"schibsted.com",PRO:"schibsted.com",PRO_NO:"spid.no"}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP,t.NAMESPACE=n.NAMESPACE},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new s.default("No objects to clone");return r.forEach(function(t){(0,o.assert)((0,o.isObject)(t)),(0,o.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],s=r[1];void 0!==s&&(e[n]=(0,o.isObject)(s)?a(s):s)})}),e},t.cloneDeep=a;var o=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function a(e){return(0,o.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(5),o=u(r(2)),s=u(r(3)),a=u(r(14));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:a.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isObject)(e.screen),"window should be a valid Window object but it lacks a 'screen' property"),(0,n.assert)((0,n.isFunction)(e.open),"window should be a valid Window object but it lacks an 'open' function"),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var a=e.screen,u=a.height,c=a.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(u)&&(l.top=(u-l.height)/2);var f=function(e){return(0,n.assert)((0,n.isObject)(e),"Object must be an object but it is '"+e+"'"),Object.keys(e).map(function(t){return t+"="+e[t]}).join(",")}(l);return e.open(t,r,f)};var n=r(0),i=r(5);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function e(t){var r=this;o(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},a=function e(){var t=this;o(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},u=Math.pow(2,31)-1,c=function(){function e(t){o(this,e),!function(e){if(!e)return!1;try{var t=e(),r="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(r,"TEST-VALUE");var n=t.getItem(r);return t.removeItem(r),"TEST-VALUE"===n}catch(e){return!1}}(t)?(this.cache=new a,this.type="ObjectLiteralStorage"):(this.cache=new s(t()),this.type="WebStorage")}return n(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new i.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0)){n=Math.min(u,n);try{var o=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:o,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new i.default(e)}}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new i.default(e)}}}]),e}();t.default=c},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(4),s=r(3),a=d(r(7)),u=f(r(8)),c=d(r(2)),l=f(r(6));function f(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function d(e){return e&&e.__esModule?e:{default:e}}var h=function(){return window},p=t.Payment=function(){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,s=void 0===o?"PRE":o,a=t.publisher,u=t.window,c=void 0===u?h():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.emulate(c),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=c,this.publisher=a,this._setSpidServerUrl(s),this._setBffServerUrl(s)}return n(e,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new a.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._bff=new c.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(e){var t=e.paylink,r=e.preferPopup,n=e.redirectUri,o=void 0===n?this.redirectUri:n;(0,i.assert)((0,i.isUrl)(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(t,o);return r&&(this.popup=u.open(this.window,s,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=s,null)}},{key:"purchaseHistoryUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:e})}},{key:"redeemUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:e})}},{key:"purchasePaylinkUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchasePaylinkUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchasePaylinkUrl(): paylinkId is required"),this._bff.makeUrl("payment/purchase",{paylink:e,redirect_uri:t})}},{key:"purchaseProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchaseProductUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchaseProductFlowUrl(): productId is required"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:e,redirect_uri:t})}},{key:"purchaseCampaignFlowUrl",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(n),"purchaseCampaignFlowUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchaseCampaignFlowUrl(): campaignId is required"),(0,i.assert)((0,i.isNonEmptyString)(t),"purchaseCampaignFlowUrl(): productId is required"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:e,product_id:t,voucher_code:r,redirect_uri:n})}},{key:"purchasePromoCodeProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(r),"purchasePromoCodeProductFlowUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchasePromoCodeProductFlowUrl(): code is required"),(0,i.assert)((0,i.isNonEmptyString)(this.publisher),"purchasePromoCodeProductFlowUrl(): publisher is required in the constructor"),this._bff.makeUrl("payment/purchase/code",{code:e,publisher:this.publisher,state:t,redirect_uri:r})}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(4),s=r(3),a=d(r(10)),u=d(r(7)),c=d(r(2)),l=d(r(9)),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(6));function d(e){return e&&e.__esModule?e:{default:e}}function h(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var p=function(){return window},v=t.Monetization=function(e){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,s=void 0===o?"PRE":o,a=e.sessionDomain,u=e.window,c=void 0===u?p():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var d=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return f.emulate(c),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),d.cache=new l.default(function(){return c&&c.sessionStorage}),d.clientId=r,d.env=s,d.redirectUri=n,d._setSpidServerUrl(s),a&&((0,i.assert)((0,i.isUrl)(a),"sessionDomain parameter is not a valid URL"),d._setSessionServiceUrl(a)),d}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),n(t,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new u.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+s.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new c.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="prd_"+t+"_"+r,i=this.cache.get(n),o=!i,i||!this._sessionService){e.next=15;break}return e.prev=4,e.next=7,this._sessionService.get("/hasProduct/"+t);case 7:i=e.sent,e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(4),400===e.t0.code){e.next=14;break}throw e.t0;case 14:i=null;case 15:if(i){e.next=21;break}return s={product_id:t},r&&(s.sp_id=r),e.next=20,this._spid.get("ajax/hasproduct.js",s);case 20:i=e.sent;case 21:if(o&&(a=i.result?3600:10,this.cache.set(n,i,1e3*a)),i.result){e.next=24;break}return e.abrupt("return",null);case 24:return this.emit("hasProduct",{productId:t,data:i}),e.abrupt("return",i);case 26:case"end":return e.stop()}},e,this,[[4,10]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="sub_"+t+"_"+r,i=this.cache.get(n),o=!i,i||!this._sessionService){e.next=15;break}return e.prev=4,e.next=7,this._sessionService.get("/hasSubscription/"+t);case 7:i=e.sent,e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(4),400===e.t0.code){e.next=14;break}throw e.t0;case 14:i=null;case 15:if(i){e.next=21;break}return s={product_id:t},r&&(s.sp_id=r),e.next=20,this._spid.get("ajax/hassubscription.js",s);case 20:i=e.sent;case 21:if(o&&(a=i.result?3600:10,this.cache.set(n,i,1e3*a)),i.result){e.next=24;break}return e.abrupt("return",null);case 24:return this.emit("hasSubscription",{subscriptionId:t,data:i}),e.abrupt("return",i);case 26:case"end":return e.stop()}},e,this,[[4,10]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:e})}},{key:"productsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:e})}}]),t}();t.default=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.eventValidatorFunc=i;function i(e,t){return e._iframeUrl.startsWith(t.origin)&&t.data}var o=function(){function e(t,r,n,o){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._iframeUrl=t.makeUrl("/authn/itp",{environment:o,client_id:r,redirect_uri:n}),this.isValidEvent=s}return n(e,[{key:"show",value:function(){var e=this;return new Promise(function(t,r){e._preventBodyScrolling();var n=e._buildModalElement();document.body.appendChild(n);var i=function(){n.style.opacity=0,window.removeEventListener("message",o),setTimeout(function(){document.body.removeChild(n),e._restoreBodyScrolling()},500)},o=function(n){if(e.isValidEvent(e,n)){if(i(),n.data.sessionData)return void t(n.data.sessionData);r(n.data.error)}};window.addEventListener("message",o),n.onclick=function(){i(),r("cancel")},setTimeout(function(){n.style.opacity=1},0)})}},{key:"_buildModalElement",value:function(){var e=document.createElement("div");e.style=this._buildStyleString({position:"fixed",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",top:0,right:0,bottom:0,left:0,"background-color":"rgba(0, 0, 0, .7)",transition:"opacity 500ms",opacity:0,"z-index":1e4});var t=document.createElement("iframe");return t.sandbox="allow-storage-access-by-user-activation allow-same-origin allow-scripts",t.style=this._buildStyleString({width:"368px",height:"400px","background-color":"#ffffff"}),t.src=this._iframeUrl,e.appendChild(t),e}},{key:"_buildStyleString",value:function(e){return Object.keys(e).reduce(function(t,r){return t+" "+r+": "+e[r]+";"},"")}},{key:"_preventBodyScrolling",value:function(){this._originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden"}},{key:"_restoreBodyScrolling",value:function(){document.body.style.overflow=this._originalBodyOverflow}}]),e}();t.default=o},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,a=t.jsonpCallback||r.jsonpCallback,u=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=a+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),u&&clearTimeout(u),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var d=document.createElement("script");d.setAttribute("src",""+o+a+"="+l),t.charset&&d.setAttribute("charset",t.charset),d.id=f,document.getElementsByTagName("head")[0].appendChild(d),u=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),d.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),u&&clearTimeout(u)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),a=r(5),u=r(4),c=r(3),l=g(r(10)),f=g(r(7)),d=g(r(9)),h=b(r(8)),p=g(r(13)),v=g(r(2)),y=g(r(1)),m=b(r(6));function b(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function g(e){return e&&e.__esModule?e:{default:e}}function _(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var w=function(){return window};function S(e){return null===e?[void 0===e?"undefined":o(e),""+e]:[e.constructor.name,e.valueOf()]}var U=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.sessionDomain,o=e.env,a=void 0===o?"PRE":o,u=e.siteSpecificLogout,c=void 0===u||u,l=e.log,f=e.window,h=void 0===f?w():f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(h),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),m.emulate(h),p._sessionInitiatedSent=!1,p.window=h,p.clientId=r,p.cache=new d.default(function(){return p.window&&p.window.localStorage}),p.redirectUri=n,p.env=a,p.siteSpecificLogout=c,p.log=l,i&&((0,s.assert)((0,s.isUrl)(i),"sessionDomain parameter is not a valid URL"),p._setSessionServiceUrl(i)),p._enableSessionCaching=!0,p._itpMode=!1,p._session={},p._setSpidServerUrl(a),p._setBffServerUrl(a),p._setOauthServerUrl(a),p._setHasSessionServerUrl(a),p._setGlobalSessionServiceUrl(a),p}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new v.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"_setGlobalSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._globalSessionService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SESSION_SERVICE),log:this.log,defaultParams:{client_sdrn:t}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(e){var t=0,r=void 0;if(Number.isInteger(e))t=e;else if("object"==(void 0===e?"undefined":o(e))){var n=e.expiresIn;t=void 0===n?t:n;var i=e.domain;r=void 0===i?r:i}(0,s.assert)(Number.isInteger(t),"'expiresIn' must be an integer"),(0,s.assert)(t>=0,"'expiresIn' cannot be negative"),this.setVarnishCookie=!0,this.varnishExpiresIn=t,this.varnishCookieDomain=r}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;if(this.varnishExpiresIn||"number"==typeof e.expiresIn&&e.expiresIn>0){var r=this.varnishExpiresIn||e.expiresIn;t.setTime(t.getTime()+1e3*r)}else t.setTime(0);var n=this.varnishCookieDomain||("string"==typeof e.baseDomain?e.baseDomain:document.domain)||"",i=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+n].join("; ");document.cookie=i}}},{key:"_maybeClearVarnishCookie",value:function(){this.setVarnishCookie&&this._clearVarnishCookie()}},{key:"_clearVarnishCookie",value:function(){var e=this.varnishCookieDomain||(this._session&&"string"==typeof this._session.baseDomain?this._session.baseDomain:document.domain)||"";document.cookie="SP_ID=nothing; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=."+e}},{key:"_itpModalRequired",value:function(){if(!document.requestStorageAccess||this._sessionService)return!1;var e=navigator.userAgent.match(/Version\/(\d+)\./);return!(!e||e.length<2)&&parseInt(e[1],10)>=12}},{key:"hasSession",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._hasSessionInProgress)return this._hasSessionInProgress;var r=function(){var r=_(regeneratorRuntime.mark(function r(i,o){var a,u,c,l,f,d,h,v,m,b;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a=function(t){if(t.error)return e.emit("error",t.error),o(new y.default("HasSession failed",t.error));e._maybeSetVarnishCookie(t),e._emitSessionEvent(e._session,t)},"boolean"==typeof t){r.next=4;break}return u=S(t),c=n(u,2),l=c[0],f=c[1],r.abrupt("return",o(new y.default("Parameter 'autologin' must be boolean, was: \""+l+":"+f+'"')));case 4:if(r.prev=4,!e._enableSessionCaching){r.next=10;break}if(!(d=e.cache.get("hasSession-cache"))){r.next=10;break}return a(d),r.abrupt("return",i(d));case 10:if(h=null,!e._sessionService){r.next=26;break}return r.prev=12,r.next=15,e._sessionService.get("/session");case 15:h=r.sent,r.next=26;break;case 18:if(r.prev=18,r.t0=r.catch(12),!e.siteSpecificLogout){r.next=22;break}throw r.t0;case 22:if(400===r.t0.code){r.next=25;break}return e.emit("error",r.t0),r.abrupt("return",o(new y.default("HasSession failed",r.t0)));case 25:h=null;case 26:if(v=t?1:0,h||e._itpMode){r.next=31;break}return r.next=30,e._hasSession.get("rpc/hasSession.js",{autologin:v});case 30:h=r.sent;case 31:if(!(e._itpMode||(0,s.isObject)(h.error)&&"LoginException"===h.error.type)){r.next=35;break}return r.next=34,e._spid.get("ajax/hasSession.js",{autologin:v});case 34:h=r.sent;case 35:if(!(e._itpModalRequired()&&!e._itpMode&&(0,s.isObject)(h.error)&&"UserException"===h.error.type&&null!==e.cache.get("loginInProgress-cache"))){r.next=42;break}return e.cache.delete("loginInProgress-cache"),m=new p.default(e._spid,e.clientId,e.redirectUri,e.env),r.next=41,m.show();case 41:h=r.sent;case 42:e._enableSessionCaching&&(b=1e3*(h.expiresIn||300),e.cache.set("hasSession-cache",h,b)),a(h),e._session=h,i(h),r.next=52;break;case 48:r.prev=48,r.t1=r.catch(4),e.emit("error",r.t1),o(new y.default("HasSession failed",r.t1));case 52:case"end":return r.stop()}},r,e,[[4,48],[12,18]])}));return function(e,t){return r.apply(this,arguments)}}(),i=new Promise(r);return this._hasSessionInProgress=i.then(function(t){return e._hasSessionInProgress=null,t},function(t){throw e._hasSessionInProgress=null,t}),this._hasSessionInProgress}},{key:"isLoggedIn",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new y.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,a.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId||!t.result){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid||!t.result){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserContextData",value:function(){var e=_(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._globalSessionService.get("/user-context");case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),e.abrupt("return",null);case 9:case"end":return e.stop()}},e,this,[[0,6]])}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,a=e.preferPopup,u=void 0!==a&&a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,d=void 0===f?"":f,p=e.tag,v=void 0===p?"":p,y=e.teaser,m=void 0===y?"":y,b=e.maxAge,g=void 0===b?"":b,_=e.locale,w=void 0===_?"":_,S=e.oneStepLogin,U=void 0!==S&&S;this._closePopup(),this.cache.delete("hasSession-cache");var k=this.loginUrl({state:r,acrValues:t,scope:i,redirectUri:s,newFlow:l,loginHint:d,tag:v,teaser:m,maxAge:g,locale:w,oneStepLogin:U});return this.showItpModalUponReturning(),u&&(this.popup=h.open(this.window,k,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=k,null)}},{key:"logout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;this.cache.delete("hasSession-cache"),this._maybeClearVarnishCookie(),this.emit("logout"),this.window.location.href=this.logoutUrl(e)}},{key:"loginUrl",value:function(e){var t=e.state,r=e.acrValues,n=e.scope,i=void 0===n?"openid":n,a=e.redirectUri,u=void 0===a?this.redirectUri:a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,d=void 0===f?"":f,h=e.tag,p=void 0===h?"":h,v=e.teaser,y=void 0===v?"":v,m=e.maxAge,b=void 0===m?"":m,g=e.locale,_=void 0===g?"":g,w=e.oneStepLogin,S=void 0!==w&&w;return"object"!==o(arguments[0])&&(t=arguments[0],r=arguments[1],i=arguments[2]||i,u=arguments[3]||u,l="boolean"==typeof arguments[4]?arguments[4]:l,d=arguments[5]||d,p=arguments[6]||p,y=arguments[7]||y,b=isNaN(arguments[8])?b:arguments[8]),(0,s.assert)(!r||(0,s.isStrIn)(r,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+r),(0,s.assert)((0,s.isUrl)(u),"loginUrl(): redirectUri must be a valid url but is "+u),(0,s.assert)((0,s.isNonEmptyString)(t),"the state parameter should be a non empty string but it is "+t),l?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:u,scope:i,state:t,acr_values:r,login_hint:d,tag:p,teaser:y,max_age:b,locale:_,one_step_login:S||"",prompt:this.siteSpecificLogout?"select_account":""}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:u,scope:i,state:t,email:d,tag:p,teaser:y,locale:_})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid");var t={redirect_uri:e};return this._sessionService&&this.siteSpecificLogout?this._sessionService.makeUrl("logout",t):this._spid.makeUrl("logout",Object.assign({response_type:"code"},t))}},{key:"accountUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/summary",{response_type:"code",redirect_uri:e})}},{key:"phonesUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/phones",{response_type:"code",redirect_uri:e})}},{key:"authFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}},{key:"showItpModalUponReturning",value:function(){this._itpModalRequired()&&this.cache.set("loginInProgress-cache",{},9e5)}},{key:"suppressItpModal",value:function(){this.cache.delete("loginInProgress-cache")}}]),t}();t.default=U},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=w;var d="suspendedStart",h="suspendedYield",p="executing",v="completed",y={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,a)&&(m=g);var _=P.prototype=U.prototype=Object.create(m);k.prototype=_.constructor=P,P.constructor=k,P[c]=k.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,P):(e.__proto__=P,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(_),e},f.awrap=function(e){return{__await:e}},O(x.prototype),x.prototype[u]=function(){return this},f.AsyncIterator=x,f.async=function(e,t,r,n){var i=new x(w(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},O(_),_[c]="Generator",_[a]=function(){return this},_.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return a.type="throw",a.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function w(e,t,r,n){var i=t&&t.prototype instanceof U?t:U,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=d;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=j(s,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=S(e,t,r);if("normal"===u.type){if(n=r.done?v:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(e,r,s),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function U(){}function k(){}function P(){}function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function x(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,a){var u=S(e[n],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,a)},function(e){r("throw",e,s,a)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},function(e){return r("throw",e,s,a)})}a(u.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function j(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,j(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:n,done:!0}}}(function(){return this||"object"===("undefined"==typeof self?"undefined":t(self))&&self}()||Function("return this")())}).call(this,r(16)(e))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return this||"object"===("undefined"==typeof self?"undefined":n(self))&&self}()||Function("return this")(),o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,s=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=r(17),o)i.regeneratorRuntime=s;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},function(e,t,r){"use strict";window.regeneratorRuntime=r(18);var n=r(15).Identity,i=r(12).Monetization,o=r(11).Payment;e.exports={Identity:n,Monetization:i,Payment:o}}]); | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=19)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new i.default(t)},t.isStr=o,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=s,t.isNonEmptyObj=function(e){return s(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!o(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return o(t)&&e.toUpperCase()===t.toUpperCase()})};var i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e){return"string"==typeof e}function s(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(i.name="SDKError","object"===(void 0===r?"undefined":n(r)))try{Object.assign(i,r)}catch(e){}return i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1)),o=r(5),s=r(4),a=r(0);var u=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,a.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function c(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var l=function(){return window.fetch&&window.fetch.bind(window)},f=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,u=void 0===o?l():o,c=t.log,f=t.defaultParams,d=void 0===f?{}:f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,a.assert)((0,a.isObject)(d),"defaultParams should be a non-null object"),this.url=new URL((0,s.urlMapper)(n,i)),this.defaultParams=d,c&&((0,a.assert)((0,a.isFunction)(c),"log must be a function but it is "+c),this.log=c),u&&((0,a.assert)((0,a.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return n(e,[{key:"go",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}(regeneratorRuntime.mark(function e(t){var r,n,s,c,l=t.method,f=t.headers,d=t.pathname,h=t.data,p=void 0===h?{}:h,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:l,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,a.assert)((0,a.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,a.assert)((0,a.isNonEmptyString)(l),'Method must be a non empty string but it is "'+l+'"'),(0,a.assert)((0,a.isNonEmptyString)(d),'Pathname must be string but it is "'+d+'"'),(0,a.assert)((0,a.isObject)(p),"data must be a non-null object"),b.headers=(0,a.isObject)(f)?(0,o.cloneDefined)(f):{},r=this.makeUrl(d,p,y),u(this.log,"Request:",b.method.toUpperCase(),r),u(this.log,"Request Headers:",b.headers),u(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,u(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new i.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return s=e.sent,u(this.log,"Response Parsed:",s),e.abrupt("return",s);case 23:throw e.prev=23,e.t0=e.catch(9),c=(0,a.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,a.isObject)(e.t0)&&(0,a.isStr)(e.t0.message)&&(c=e.t0.message),new i.default("Failed to '"+l+"' '"+r+"': '"+c+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}));return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,o.cloneDefined)(r,e):(0,o.cloneDefined)(e);return Object.keys(n).filter(function(e){return""!==n[e]}).map(function(e){return c(e)+"="+c(n[e])}).join("&")}}]),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"},SESSION_SERVICE:{LOCAL:"http://session-service.id.localhost",DEV:"https://session-service.identity-dev.schibsted.com",PRE:"https://session-service.identity-pre.schibsted.com",PRO:"https://session-service.login.schibsted.com",PRO_NO:"https://session-service.payment.schibsted.no"}},JSONP:{TIMEOUT:7e3},NAMESPACE:{LOCAL:"id.localhost",DEV:"schibsted.com",PRE:"schibsted.com",PRO:"schibsted.com",PRO_NO:"spid.no"}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP,t.NAMESPACE=n.NAMESPACE},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new s.default("No objects to clone");return r.forEach(function(t){(0,o.assert)((0,o.isObject)(t)),(0,o.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],s=r[1];void 0!==s&&(e[n]=(0,o.isObject)(s)?a(s):s)})}),e},t.cloneDeep=a;var o=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function a(e){return(0,o.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(5),o=u(r(2)),s=u(r(3)),a=u(r(14));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:a.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isObject)(e.screen),"window should be a valid Window object but it lacks a 'screen' property"),(0,n.assert)((0,n.isFunction)(e.open),"window should be a valid Window object but it lacks an 'open' function"),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var a=e.screen,u=a.height,c=a.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(u)&&(l.top=(u-l.height)/2);var f=function(e){return(0,n.assert)((0,n.isObject)(e),"Object must be an object but it is '"+e+"'"),Object.keys(e).map(function(t){return t+"="+e[t]}).join(",")}(l);return e.open(t,r,f)};var n=r(0),i=r(5);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){return e&&e.__esModule?e:{default:e}}(r(1));function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function e(t){var r=this;o(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},a=function e(){var t=this;o(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},u=Math.pow(2,31)-1,c=function(){function e(t){o(this,e),!function(e){if(!e)return!1;try{var t=e(),r="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(r,"TEST-VALUE");var n=t.getItem(r);return t.removeItem(r),"TEST-VALUE"===n}catch(e){return!1}}(t)?(this.cache=new a,this.type="ObjectLiteralStorage"):(this.cache=new s(t()),this.type="WebStorage")}return n(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new i.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0)){n=Math.min(u,n);try{var o=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:o,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new i.default(e)}}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new i.default(e)}}}]),e}();t.default=c},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(4),s=r(3),a=d(r(7)),u=f(r(8)),c=d(r(2)),l=f(r(6));function f(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function d(e){return e&&e.__esModule?e:{default:e}}var h=function(){return window},p=t.Payment=function(){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,s=void 0===o?"PRE":o,a=t.publisher,u=t.window,c=void 0===u?h():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.emulate(c),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=c,this.publisher=a,this._setSpidServerUrl(s),this._setBffServerUrl(s)}return n(e,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new a.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._bff=new c.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(e){var t=e.paylink,r=e.preferPopup,n=e.redirectUri,o=void 0===n?this.redirectUri:n;(0,i.assert)((0,i.isUrl)(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(t,o);return r&&(this.popup=u.open(this.window,s,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=s,null)}},{key:"purchaseHistoryUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:e})}},{key:"redeemUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:e})}},{key:"purchasePaylinkUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchasePaylinkUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchasePaylinkUrl(): paylinkId is required"),this._bff.makeUrl("payment/purchase",{paylink:e,redirect_uri:t})}},{key:"purchaseProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchaseProductUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchaseProductFlowUrl(): productId is required"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:e,redirect_uri:t})}},{key:"purchaseCampaignFlowUrl",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(n),"purchaseCampaignFlowUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchaseCampaignFlowUrl(): campaignId is required"),(0,i.assert)((0,i.isNonEmptyString)(t),"purchaseCampaignFlowUrl(): productId is required"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:e,product_id:t,voucher_code:r,redirect_uri:n})}},{key:"purchasePromoCodeProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(r),"purchasePromoCodeProductFlowUrl(): redirectUri is invalid"),(0,i.assert)((0,i.isNonEmptyString)(e),"purchasePromoCodeProductFlowUrl(): code is required"),(0,i.assert)((0,i.isNonEmptyString)(this.publisher),"purchasePromoCodeProductFlowUrl(): publisher is required in the constructor"),this._bff.makeUrl("payment/purchase/code",{code:e,publisher:this.publisher,state:t,redirect_uri:r})}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(4),s=r(3),a=d(r(10)),u=d(r(7)),c=d(r(2)),l=d(r(9)),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(6));function d(e){return e&&e.__esModule?e:{default:e}}function h(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var p=function(){return window},v=t.Monetization=function(e){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,s=void 0===o?"PRE":o,a=e.sessionDomain,u=e.window,c=void 0===u?p():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var d=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return f.emulate(c),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),d.cache=new l.default(function(){return c&&c.sessionStorage}),d.clientId=r,d.env=s,d.redirectUri=n,d._setSpidServerUrl(s),a&&((0,i.assert)((0,i.isUrl)(a),"sessionDomain parameter is not a valid URL"),d._setSessionServiceUrl(a)),d}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),n(t,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new u.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+s.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new c.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="prd_"+t+"_"+r,i=this.cache.get(n),o=!i,i||!this._sessionService){e.next=15;break}return e.prev=4,e.next=7,this._sessionService.get("/hasProduct/"+t);case 7:i=e.sent,e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(4),400===e.t0.code){e.next=14;break}throw e.t0;case 14:i=null;case 15:if(i){e.next=21;break}return s={product_id:t},r&&(s.sp_id=r),e.next=20,this._spid.get("ajax/hasproduct.js",s);case 20:i=e.sent;case 21:if(o&&(a=i.result?3600:10,this.cache.set(n,i,1e3*a)),i.result){e.next=24;break}return e.abrupt("return",null);case 24:return this.emit("hasProduct",{productId:t,data:i}),e.abrupt("return",i);case 26:case"end":return e.stop()}},e,this,[[4,10]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="sub_"+t+"_"+r,i=this.cache.get(n),o=!i,i||!this._sessionService){e.next=15;break}return e.prev=4,e.next=7,this._sessionService.get("/hasSubscription/"+t);case 7:i=e.sent,e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(4),400===e.t0.code){e.next=14;break}throw e.t0;case 14:i=null;case 15:if(i){e.next=21;break}return s={product_id:t},r&&(s.sp_id=r),e.next=20,this._spid.get("ajax/hassubscription.js",s);case 20:i=e.sent;case 21:if(o&&(a=i.result?3600:10,this.cache.set(n,i,1e3*a)),i.result){e.next=24;break}return e.abrupt("return",null);case 24:return this.emit("hasSubscription",{subscriptionId:t,data:i}),e.abrupt("return",i);case 26:case"end":return e.stop()}},e,this,[[4,10]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:e})}},{key:"productsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:e})}}]),t}();t.default=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.eventValidatorFunc=i;function i(e,t){return e._iframeUrl.startsWith(t.origin)&&t.data}var o=function(){function e(t,r,n,o){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._iframeUrl=t.makeUrl("/authn/itp",{environment:o,client_id:r,redirect_uri:n}),this.isValidEvent=s}return n(e,[{key:"show",value:function(){var e=this;return new Promise(function(t,r){e._preventBodyScrolling();var n=e._buildModalElement();document.body.appendChild(n);var i=function(){n.style.opacity=0,window.removeEventListener("message",o),setTimeout(function(){document.body.removeChild(n),e._restoreBodyScrolling()},500)},o=function(n){if(e.isValidEvent(e,n)){if(i(),n.data.sessionData)return void t(n.data.sessionData);r(n.data.error)}};window.addEventListener("message",o),n.onclick=function(){i(),r("cancel")},setTimeout(function(){n.style.opacity=1},0)})}},{key:"_buildModalElement",value:function(){var e=document.createElement("div");e.style=this._buildStyleString({position:"fixed",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",top:0,right:0,bottom:0,left:0,"background-color":"rgba(0, 0, 0, .7)",transition:"opacity 500ms",opacity:0,"z-index":1e4});var t=document.createElement("iframe");return t.sandbox="allow-storage-access-by-user-activation allow-same-origin allow-scripts",t.style=this._buildStyleString({width:"368px",height:"400px","background-color":"#ffffff"}),t.src=this._iframeUrl,e.appendChild(t),e}},{key:"_buildStyleString",value:function(e){return Object.keys(e).reduce(function(t,r){return t+" "+r+": "+e[r]+";"},"")}},{key:"_preventBodyScrolling",value:function(){this._originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden"}},{key:"_restoreBodyScrolling",value:function(){document.body.style.overflow=this._originalBodyOverflow}}]),e}();t.default=o},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,a=t.jsonpCallback||r.jsonpCallback,u=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=a+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),u&&clearTimeout(u),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var d=document.createElement("script");d.setAttribute("src",""+o+a+"="+l),t.charset&&d.setAttribute("charset",t.charset),d.id=f,document.getElementsByTagName("head")[0].appendChild(d),u=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),d.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),u&&clearTimeout(u)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),a=r(5),u=r(4),c=r(3),l=g(r(10)),f=g(r(7)),d=g(r(9)),h=b(r(8)),p=g(r(13)),v=g(r(2)),y=g(r(1)),m=b(r(6));function b(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function g(e){return e&&e.__esModule?e:{default:e}}function _(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),a=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(a).then(function(e){n("next",e)},function(e){n("throw",e)});e(a)}("next")})}}var w=function(){return window};var S=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.sessionDomain,o=e.env,a=void 0===o?"PRE":o,u=e.siteSpecificLogout,c=void 0===u||u,l=e.log,f=e.window,h=void 0===f?w():f;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(h),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),m.emulate(h),p._sessionInitiatedSent=!1,p.window=h,p.clientId=r,p.cache=new d.default(function(){return p.window&&p.window.localStorage}),p.redirectUri=n,p.env=a,p.siteSpecificLogout=c,p.log=l,i&&((0,s.assert)((0,s.isUrl)(i),"sessionDomain parameter is not a valid URL"),p._setSessionServiceUrl(i)),p._enableSessionCaching=!0,p._itpMode=!1,p._session={},p._setSpidServerUrl(a),p._setBffServerUrl(a),p._setOauthServerUrl(a),p._setHasSessionServerUrl(a),p._setGlobalSessionServiceUrl(a),p}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"domain parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._sessionService=new v.default({serverUrl:e,log:this.log,defaultParams:{client_sdrn:t,redirect_uri:this.redirectUri}})}},{key:"_setGlobalSessionServiceUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e);var t="sdrn:"+c.NAMESPACE[this.env]+":client:"+this.clientId;this._globalSessionService=new v.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.SESSION_SERVICE),log:this.log,defaultParams:{client_sdrn:t}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,u.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(e){var t=0,r=void 0;if(Number.isInteger(e))t=e;else if("object"==(void 0===e?"undefined":o(e))){var n=e.expiresIn;t=void 0===n?t:n;var i=e.domain;r=void 0===i?r:i}(0,s.assert)(Number.isInteger(t),"'expiresIn' must be an integer"),(0,s.assert)(t>=0,"'expiresIn' cannot be negative"),this.setVarnishCookie=!0,this.varnishExpiresIn=t,this.varnishCookieDomain=r}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;if(this.varnishExpiresIn||"number"==typeof e.expiresIn&&e.expiresIn>0){var r=this.varnishExpiresIn||e.expiresIn;t.setTime(t.getTime()+1e3*r)}else t.setTime(0);var n=this.varnishCookieDomain||("string"==typeof e.baseDomain?e.baseDomain:document.domain)||"",i=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+n].join("; ");document.cookie=i}}},{key:"_maybeClearVarnishCookie",value:function(){this.setVarnishCookie&&this._clearVarnishCookie()}},{key:"_clearVarnishCookie",value:function(){var e=this.varnishCookieDomain||(this._session&&"string"==typeof this._session.baseDomain?this._session.baseDomain:document.domain)||"";document.cookie="SP_ID=nothing; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=."+e}},{key:"_itpModalRequired",value:function(){if(!document.requestStorageAccess||this._sessionService)return!1;var e=navigator.userAgent.match(/Version\/(\d+)\./);return!(!e||e.length<2)&&parseInt(e[1],10)>=12}},{key:"hasSession",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._hasSessionInProgress)return this._hasSessionInProgress;if("boolean"!=typeof t){var r=function(e){return null===e?[void 0===e?"undefined":o(e),""+e]:[e.constructor.name,e.valueOf()]}(t),i=n(r,2),a=i[0],u=i[1];return Promise.reject(new y.default("Parameter 'autologin' must be boolean, was: \""+a+":"+u+'"'))}var c=function(t){if(t.error)throw new y.default("HasSession failed",t.error);return e._maybeSetVarnishCookie(t),e._emitSessionEvent(e._session,t),e._session=t,t},l=function(){var r=_(regeneratorRuntime.mark(function r(){var n,i,o,a,u;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!e._enableSessionCaching){r.next=4;break}if(!(n=e.cache.get("hasSession-cache"))){r.next=4;break}return r.abrupt("return",c(n));case 4:if(i=null,!e._sessionService){r.next=18;break}return r.prev=6,r.next=9,e._sessionService.get("/session");case 9:i=r.sent,r.next=18;break;case 12:if(r.prev=12,r.t0=r.catch(6),!e.siteSpecificLogout){r.next=16;break}throw r.t0;case 16:if(400===r.t0.code){r.next=18;break}throw r.t0;case 18:if(o=t?1:0,i||e._itpMode){r.next=23;break}return r.next=22,e._hasSession.get("rpc/hasSession.js",{autologin:o});case 22:i=r.sent;case 23:if(!(e._itpMode||i&&(0,s.isObject)(i.error)&&"LoginException"===i.error.type)){r.next=27;break}return r.next=26,e._spid.get("ajax/hasSession.js",{autologin:o});case 26:i=r.sent;case 27:if(!(e._itpModalRequired()&&!e._itpMode&&i&&(0,s.isObject)(i.error)&&"UserException"===i.error.type&&null!==e.cache.get("loginInProgress-cache"))){r.next=34;break}return e.cache.delete("loginInProgress-cache"),a=new p.default(e._spid,e.clientId,e.redirectUri,e.env),r.next=33,a.show();case 33:i=r.sent;case 34:return i&&e._enableSessionCaching&&(u=1e3*(i.expiresIn||300),e.cache.set("hasSession-cache",i,u)),r.abrupt("return",c(i));case 36:case"end":return r.stop()}},r,e,[[6,12]])}));return function(){return r.apply(this,arguments)}}();return this._hasSessionInProgress=l().then(function(t){return e._hasSessionInProgress=!1,t},function(t){throw e.emit("error",t),e._hasSessionInProgress=!1,new y.default("HasSession failed",t)}),this._hasSessionInProgress}},{key:"isLoggedIn",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new y.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,a.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId||!t.result){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid||!t.result){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserContextData",value:function(){var e=_(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._globalSessionService.get("/user-context");case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),e.abrupt("return",null);case 9:case"end":return e.stop()}},e,this,[[0,6]])}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=_(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,a=e.preferPopup,u=void 0!==a&&a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,d=void 0===f?"":f,p=e.tag,v=void 0===p?"":p,y=e.teaser,m=void 0===y?"":y,b=e.maxAge,g=void 0===b?"":b,_=e.locale,w=void 0===_?"":_,S=e.oneStepLogin,U=void 0!==S&&S;this._closePopup(),this.cache.delete("hasSession-cache");var k=this.loginUrl({state:r,acrValues:t,scope:i,redirectUri:s,newFlow:l,loginHint:d,tag:v,teaser:m,maxAge:g,locale:w,oneStepLogin:U});return this.showItpModalUponReturning(),u&&(this.popup=h.open(this.window,k,"Schibsted account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=k,null)}},{key:"logout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;this.cache.delete("hasSession-cache"),this._maybeClearVarnishCookie(),this.emit("logout"),this.window.location.href=this.logoutUrl(e)}},{key:"loginUrl",value:function(e){var t=e.state,r=e.acrValues,n=e.scope,i=void 0===n?"openid":n,a=e.redirectUri,u=void 0===a?this.redirectUri:a,c=e.newFlow,l=void 0===c||c,f=e.loginHint,d=void 0===f?"":f,h=e.tag,p=void 0===h?"":h,v=e.teaser,y=void 0===v?"":v,m=e.maxAge,b=void 0===m?"":m,g=e.locale,_=void 0===g?"":g,w=e.oneStepLogin,S=void 0!==w&&w;return"object"!==o(arguments[0])&&(t=arguments[0],r=arguments[1],i=arguments[2]||i,u=arguments[3]||u,l="boolean"==typeof arguments[4]?arguments[4]:l,d=arguments[5]||d,p=arguments[6]||p,y=arguments[7]||y,b=isNaN(arguments[8])?b:arguments[8]),(0,s.assert)(!r||(0,s.isStrIn)(r,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+r),(0,s.assert)((0,s.isUrl)(u),"loginUrl(): redirectUri must be a valid url but is "+u),(0,s.assert)((0,s.isNonEmptyString)(t),"the state parameter should be a non empty string but it is "+t),l?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:u,scope:i,state:t,acr_values:r,login_hint:d,tag:p,teaser:y,max_age:b,locale:_,one_step_login:S||"",prompt:this.siteSpecificLogout?"select_account":""}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:u,scope:i,state:t,email:d,tag:p,teaser:y,locale:_})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid");var t={redirect_uri:e};return this._sessionService&&this.siteSpecificLogout?this._sessionService.makeUrl("logout",t):this._spid.makeUrl("logout",Object.assign({response_type:"code"},t))}},{key:"accountUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/summary",{response_type:"code",redirect_uri:e})}},{key:"phonesUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return this._spid.makeUrl("account/phones",{response_type:"code",redirect_uri:e})}},{key:"authFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}},{key:"showItpModalUponReturning",value:function(){this._itpModalRequired()&&this.cache.set("loginInProgress-cache",{},9e5)}},{key:"suppressItpModal",value:function(){this.cache.delete("loginInProgress-cache")}}]),t}();t.default=S},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=w;var d="suspendedStart",h="suspendedYield",p="executing",v="completed",y={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,a)&&(m=g);var _=P.prototype=U.prototype=Object.create(m);k.prototype=_.constructor=P,P.constructor=k,P[c]=k.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,P):(e.__proto__=P,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(_),e},f.awrap=function(e){return{__await:e}},O(x.prototype),x.prototype[u]=function(){return this},f.AsyncIterator=x,f.async=function(e,t,r,n){var i=new x(w(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},O(_),_[c]="Generator",_[a]=function(){return this},_.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return a.type="throw",a.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function w(e,t,r,n){var i=t&&t.prototype instanceof U?t:U,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=d;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=j(s,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=S(e,t,r);if("normal"===u.type){if(n=r.done?v:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(e,r,s),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function U(){}function k(){}function P(){}function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function x(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,a){var u=S(e[n],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,a)},function(e){r("throw",e,s,a)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},function(e){return r("throw",e,s,a)})}a(u.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function j(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,j(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:n,done:!0}}}(function(){return this||"object"===("undefined"==typeof self?"undefined":t(self))&&self}()||Function("return this")())}).call(this,r(16)(e))},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return this||"object"===("undefined"==typeof self?"undefined":n(self))&&self}()||Function("return this")(),o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,s=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=r(17),o)i.regeneratorRuntime=s;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},function(e,t,r){"use strict";window.regeneratorRuntime=r(18);var n=r(15).Identity,i=r(12).Monetization,o=r(11).Payment;e.exports={Identity:n,Monetization:i,Payment:o}}]); | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@schibsted/account-sdk-browser", | ||
"version": "3.1.0-rc", | ||
"version": "3.1.0", | ||
"description": "Schibsted account SDK for browsers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -98,3 +98,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
* @param {string} [options.env='PRE'] - Schibsted account environment: `PRE`, `PRO` or `PRO_NO` | ||
* @param {boolean} [options.siteSpecificLogout] - Whether site-specific logout should be used | ||
* @param {boolean} [options.siteSpecificLogout=true] - Whether site-specific logout should be used | ||
* @param {function} [options.log] - A function that receives debug log information. If not set, | ||
@@ -443,86 +443,78 @@ * no logging will be done | ||
} | ||
const promiseFn = async (resolve, reject) => { | ||
const postProcess = (sessionData) => { | ||
if (sessionData.error) { | ||
this.emit('error', sessionData.error); | ||
return reject(new SDKError('HasSession failed', sessionData.error)); | ||
if (typeof autologin !== 'boolean') { | ||
const [type, value] = inspect(autologin); | ||
return Promise.reject(new SDKError(`Parameter 'autologin' must be boolean, was: "${type}:${value}"`)); | ||
} | ||
const _postProcess = (sessionData) => { | ||
if (sessionData.error) { | ||
throw new SDKError('HasSession failed', sessionData.error); | ||
} | ||
this._maybeSetVarnishCookie(sessionData); | ||
this._emitSessionEvent(this._session, sessionData); | ||
this._session = sessionData; | ||
return sessionData; | ||
}; | ||
const _getSession = async () => { | ||
if (this._enableSessionCaching) { | ||
// Try to resolve from cache (it has a TTL) | ||
let cachedSession = this.cache.get(HAS_SESSION_CACHE_KEY); | ||
if (cachedSession) { | ||
return _postProcess(cachedSession); | ||
} | ||
this._maybeSetVarnishCookie(sessionData); | ||
this._emitSessionEvent(this._session, sessionData); | ||
}; | ||
if (typeof autologin !== 'boolean') { | ||
const [type, value] = inspect(autologin); | ||
return reject(new SDKError(`Parameter 'autologin' must be boolean, was: "${type}:${value}"`)); | ||
} | ||
try { | ||
if (this._enableSessionCaching) { | ||
// Try to resolve from cache (it has a TTL) | ||
const cachedData = this.cache.get(HAS_SESSION_CACHE_KEY); | ||
if (cachedData) { | ||
postProcess(cachedData); | ||
return resolve(cachedData); | ||
let sessionData = null; | ||
if (this._sessionService) { | ||
try { | ||
sessionData = await this._sessionService.get('/session'); | ||
} catch (err) { | ||
if (this.siteSpecificLogout) { | ||
// Don't fallback to other sources for user session lookup | ||
throw err; | ||
} | ||
} | ||
let data = null; | ||
if (this._sessionService) { | ||
try { | ||
data = await this._sessionService.get('/session'); | ||
} catch (err) { | ||
if (this.siteSpecificLogout) { | ||
// Don't fallback to other sources for user session lookup | ||
throw err; | ||
} | ||
// The session-service returns 400 if no session-cookie is sent in the | ||
// request. This will be the case if the user hasn't logged in since the | ||
// site switched to using the session-service. If the request contains a | ||
// session-cookie but no session is found (return code will be 404), then we | ||
// *should* throw an exception and *not* fall through to spid-hassession | ||
if (err.code !== 400) { | ||
this.emit('error', err); | ||
return reject(new SDKError('HasSession failed', err)); | ||
} | ||
data = null; | ||
// The session-service returns 400 if no session-cookie is sent in the | ||
// request. This will be the case if the user hasn't logged in since the | ||
// site switched to using the session-service. If the request contains a | ||
// session-cookie but no session is found (return code will be 404), then we | ||
// *should* throw an exception and *not* fall through to spid-hassession | ||
if (err.code !== 400) { | ||
throw err; | ||
} | ||
} | ||
const autoLoginConverted = autologin ? 1 : 0; | ||
} | ||
if (!data && !this._itpMode) { | ||
data = await this._hasSession.get('rpc/hasSession.js', { autologin: autoLoginConverted }); | ||
} | ||
if (this._itpMode || (isObject(data.error) && data.error.type === 'LoginException')) { | ||
data = await this._spid.get('ajax/hasSession.js', { autologin: autoLoginConverted }); | ||
} | ||
const autoLoginConverted = autologin ? 1 : 0; | ||
if (!sessionData && !this._itpMode) { | ||
sessionData = await this._hasSession.get('rpc/hasSession.js', { autologin: autoLoginConverted }); | ||
} | ||
if (this._itpMode || (sessionData && isObject(sessionData.error) && sessionData.error.type === 'LoginException')) { | ||
sessionData = await this._spid.get('ajax/hasSession.js', { autologin: autoLoginConverted }); | ||
} | ||
const shouldShowItpModal = this._itpModalRequired() && !this._itpMode && | ||
isObject(data.error) && data.error.type === 'UserException' && | ||
this.cache.get(LOGIN_IN_PROGRESS_KEY) !== null; | ||
if (shouldShowItpModal) { | ||
this.cache.delete(LOGIN_IN_PROGRESS_KEY); | ||
const modal = new ItpModal(this._spid, this.clientId, this.redirectUri, this.env); | ||
data = await modal.show(); | ||
} | ||
if (this._enableSessionCaching) { | ||
const expiresIn = 1000 * (data.expiresIn || 300); | ||
this.cache.set(HAS_SESSION_CACHE_KEY, data, expiresIn); | ||
} | ||
postProcess(data); | ||
this._session = data; | ||
resolve(data); | ||
} catch (err) { | ||
this.emit('error', err); | ||
reject(new SDKError('HasSession failed', err)); | ||
const shouldShowItpModal = this._itpModalRequired() && !this._itpMode && sessionData && isObject(sessionData.error) | ||
&& sessionData.error.type === 'UserException' && this.cache.get(LOGIN_IN_PROGRESS_KEY) !== null; | ||
if (shouldShowItpModal) { | ||
this.cache.delete(LOGIN_IN_PROGRESS_KEY); | ||
const modal = new ItpModal(this._spid, this.clientId, this.redirectUri, this.env); | ||
sessionData = await modal.show() | ||
} | ||
if (sessionData && this._enableSessionCaching) { | ||
const expiresIn = 1000 * (sessionData.expiresIn || 300); | ||
this.cache.set(HAS_SESSION_CACHE_KEY, sessionData, expiresIn); | ||
} | ||
return _postProcess(sessionData); | ||
}; | ||
const promise = new Promise(promiseFn); | ||
this._hasSessionInProgress = promise.then(v => { | ||
this._hasSessionInProgress = null; | ||
return v; | ||
}, e => { | ||
this._hasSessionInProgress = null; | ||
throw e; | ||
}); | ||
this._hasSessionInProgress = _getSession() | ||
.then( | ||
sessionData => { | ||
this._hasSessionInProgress = false; | ||
return sessionData; | ||
}, | ||
err => { | ||
this.emit('error', err); | ||
this._hasSessionInProgress = false; | ||
throw new SDKError('HasSession failed', err); | ||
} | ||
); | ||
return this._hasSessionInProgress; | ||
@@ -529,0 +521,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
2497897
18109