New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@schibsted/account-sdk-browser

Package Overview
Dependencies
Maintainers
7
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@schibsted/account-sdk-browser - npm Package Compare versions

Comparing version 3.0.0-beta.7 to 3.0.0-rc.0

19

CHANGELOG.md
# Changelog
## v3.0.0-rc.0 (2018-04-10)
### Breaking changes
* The function `Identity.getUserUuidId` is renamed to `Identity.getUserUuid`. This was a typo in the
previous function name that was not detected until now :-/
* The function `Identity.getSpId` now returns `string|null` instead of `string|undefined`.
### Fixes
* The Identity class now clears its internal cache if `enableVarnishCookie()` is called. Previously,
calling `hasSession` after calling `enableVarnishCookie` would re-use any cached value and thus
skip setting the varnish cookie.
### Changes
* The function `Identity.getVisitorId` is now marked `async` in the codebase. It always returned a
Promise, so functionally it does the same as before. Syntax has just been modernised.
## v3.0.0-beta.7 (2018-04-03)

@@ -4,0 +23,0 @@

2

es5/global.js

@@ -1,2 +0,2 @@

!function(t,e){for(var r in e)t[r]=e[r]}(window,function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=20)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1);function o(t){return"string"==typeof t}function s(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new i(e)},isObject:s,isNonEmptyObj:function(t){return s(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!o(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return o(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:o,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var s=["boolean","number","string"],u=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o(Error)),i(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&s.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=u},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(0),o=i.assert,s=i.isNonEmptyString,u=i.isUrl,a=i.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(u(t,"hostname"))return t;o(s(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),o(a(e),"urlMap must be an object");var r=e[t];return o(u(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=r(0),s=o.assert,u=o.isObject,a=o.isNonEmptyObj,c=r(1);function l(t){return s("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new c("No objects to clone");return r.forEach(function(e){s(u(e)),a(e)&&Object.entries(e).forEach(function(e){var r=i(e,2),n=r[0],o=r[1];void 0!==o&&(t[n]=u(o)?l(o):o)})}),t},cloneDeep:l}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),i(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(1),o=r(4).cloneDefined,s=r(3).urlMapper,u=r(0),a=u.assert,c=u.isObject,l=u.isFunction,f=u.isStr,h=u.isNonEmptyString,p=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return c(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function d(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var v=window.fetch,y=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,i=e.envDic,o=e.fetch,u=void 0===o?v:o,f=e.log,h=e.defaultParams,p=void 0===h?{}:h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),a(c(p),"defaultParams should be a non-null object"),this.url=new URL(s(n,i)),this.defaultParams=p,void 0!==f&&(a(l(f),"log must be a function but it is "+f),this.log=f),void 0!==u&&(a(l(u),"Fetch should be a function"),this.fetch=u)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,s,u,d=e.method,v=e.headers,y=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,_=e.fetchOptions,S=void 0===_?{method:d,credentials:"include"}:_;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a(l(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),a(h(d),'Method must be a non empty string but it is "'+d+'"'),a(h(y),'Pathname must be string but it is "'+y+'"'),a(c(b),"data must be a non-null object"),S.headers=c(v)?o(v):{},r=this.makeUrl(y,b,w),p(this.log,"Request:",S.method.toUpperCase(),r),p(this.log,"Request Headers:",S.headers),p(this.log,"Request Body:",S.body),t.prev=9,t.next=12,this.fetch(r,S);case 12:if(n=t.sent,p(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new i(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return s=t.sent,p(this.log,"Response Parsed:",s),t.abrupt("return",s);case 23:throw t.prev=23,t.t0=t.catch(9),u=f(t.t0)?t.t0:"Unknown RESTClient error",c(t.t0)&&f(t.t0.message)&&(u=t.t0.message),new i("Failed to '"+d+"' '"+r+"': '"+u+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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(e,this.url);return i.search=t.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?o(r,t):o(t);return Object.keys(n).map(function(t){return d(t)+"="+d(n[t])}).join("&")}}]),t}();t.exports=y},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(4).cloneDefined,o=r(6),s=r(2),u=r(15),a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,i({fetch:u},t)));return r.timeout=void 0===t.timeout?s.JSONP.TIMEOUT:Number(t.timeout),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=a},function(t,e,r){"use strict";var n=r(0),i=n.assert,o=n.isObject,s=n.isUrl,u=r(4).cloneDefined;var a={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"};t.exports={open:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments[3];i(o(t),"window was supposed to be an object but it is "+t),i(s(e),"Invalid URL for popup");var c=t.screen,l=c.height,f=c.width,h=u(a,n);Number.isFinite(h.width)&&(h.left=(f-h.width)/2),Number.isFinite(h.height)&&(h.top=(l-h.height)/2);var p,d=(i(o(p=h),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(t){return t+"="+p[t]}).join(","));return t.open(e,r,d)}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=r(1);var s=function t(e){var r=this;i(this,t),this.store=e,this.get=function(t){return r.store.getItem(t)},this.set=function(t,e){return r.store.setItem(t,e)},this.delete=function(t){return r.store.removeItem(t)}},u=function t(){var e=this;i(this,t),this.store={},this.get=function(t){return e.store[t]},this.set=function(t,r){return e.store[t]=r},this.delete=function(t){return delete e.store[t]}},a=function(){function t(e){i(this,t),!function(t){if(!t)return!1;try{var e="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(e,"TEST-VALUE");var r=t.getItem(e);return t.removeItem(e),"TEST-VALUE"===r}catch(t){return!1}}(e)?(this.cache=new u,this.type="ObjectLiteralStorage"):(this.cache=new s(e),this.type="WebStorage")}return n(t,[{key:"get",value:function(t){try{var e=this.cache.get(t),r=e?JSON.parse(e):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(t),null)}catch(t){throw new o(t)}}},{key:"set",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(t,JSON.stringify({expiresOn:i,value:e})),setTimeout(function(){return r.delete(t)},n)}catch(t){throw new o(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new o(t)}}}]),t}();t.exports=a},function(t,e,r){"use strict";function n(){}n.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function i(){n.off(t,i),e.apply(r,arguments)}return i._=e,this.on(t,i,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],i=[];if(n&&e)for(var o=0,s=n.length;o<s;o++)n[o].fn!==e&&n[o].fn._!==e&&i.push(n[o]);return i.length?r[t]=i:delete r[t],this}},t.exports=n},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(0),o=i.assert,s=i.isNonEmptyString,u=i.isUrl,a=i.isStr,c=r(3).urlMapper,l=r(2).ENDPOINTS,f=r(7),h=r(8),p=r(6),d=r(5),v=window,y=function(){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,u=void 0===i?"PRE":i,a=e.window,c=void 0===a?v:a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),d.emulate(c),o(s(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=c,this._setSpidServerUrl(u),this._setBffServerUrl(u)}return n(t,[{key:"_setSpidServerUrl",value:function(t){o(a(t),"url parameter is invalid: "+t),this._spid=new f({serverUrl:c(t,l.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){o(a(t),"url parameter is invalid: "+t),this._bff=new p({serverUrl:c(t,l.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(t){var e=t.paylink,r=t.preferPopup,n=t.redirectUri,i=void 0===n?this.redirectUri:n;o(u(i),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(e,i);return r&&(this.popup=h.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return o(u(t),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:t})}},{key:"redeemUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:t})}},{key:"purchasePaylinkUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:t,redirect_uri:e})}},{key:"purchaseProductFlowUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:t,redirect_uri:e})}},{key:"purchaseCampaignFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return o(u(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:t,product_id:e,voucher_code:r,redirect_uri:n})}}]),t}();t.exports=y},function(t,e,r){"use strict";t.exports=r(11)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var o=r(0),s=o.assert,u=o.isStr,a=o.isNonEmptyString,c=o.isUrl,l=r(3).urlMapper,f=r(2).ENDPOINTS,h=r(10),p=r(7),d=r(9),v=r(5),y=window,m=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,o=void 0===i?"PRE":i,u=t.window,c=void 0===u?y:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var l=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return v.emulate(c),s(a(r),"clientId parameter is required"),l.cache=new d(c&&c.sessionStorage),l.clientId=r,l.redirectUri=n,l._setSpidServerUrl(o),l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,h),n(e,[{key:"_setSpidServerUrl",value:function(t){s(u(t),"url parameter is invalid: "+t),this._spid=new p({serverUrl:l(t,f.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var t=i(regeneratorRuntime.mark(function t(e,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="prd_"+e,!(i=this.cache.get(n))){t.next=4;break}return t.abrupt("return",i);case 4:return o={product_id:e},void 0!==r&&(o.sp_id=r),t.next=8,this._spid.get("ajax/hasproduct.js",o);case 8:if((s=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||0),this.cache.set(n,s,u),this.emit("hasProduct",{productId:e,data:s}),t.abrupt("return",s);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var t=i(regeneratorRuntime.mark(function t(e,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="sub_"+e,!(i=this.cache.get(n))){t.next=4;break}return t.abrupt("return",i);case 4:return o={product_id:e},void 0!==r&&(o.sp_id=r),t.next=8,this._spid.get("ajax/hassubscription.js",o);case 8:if((s=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||0),this.cache.set(n,s,u),this.emit("hasSubscription",{subscriptionId:e,data:s}),t.abrupt("return",s);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return s(c(t),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:t})}},{key:"productsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return s(c(t),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:t})}}]),e}();t.exports=m},function(t,e,r){"use strict";t.exports=r(13)},function(t,e,r){"use strict";var n,i,o;i=[e,t],void 0===(o="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function i(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=t,s=e.timeout||r.timeout,u=e.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+u+"="+l),e.charset&&h.setAttribute("charset",e.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+t+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+t+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(e,i):n)||(t.exports=o)},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var u=r(0),a=u.assert,c=u.isStr,l=u.isNonEmptyString,f=u.isObject,h=u.isUrl,p=u.isStrIn,d=r(4).cloneDeep,v=r(3).urlMapper,y=r(2).ENDPOINTS,m=r(10),b=r(7),g=r(9),w=r(8),_=r(6),S=r(1),k=r(5),U=window;var x=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,o=void 0===i?"PRE":i,s=t.log,u=t.window,c=void 0===u?U:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var p=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return a(l(r),"clientId parameter is required"),a(f(c),"The reference to window is missing"),a(!n||h(n),"redirectUri parameter is invalid"),k.emulate(c),p._sessionInitiatedSent=!1,p.window=c,p.clientId=r,p.cache=new g(c&&c.localStorage),p.redirectUri=n,p.log=s,p._enableSessionCaching=!0,p._session={},p._setSpidServerUrl(o),p._setBffServerUrl(o),p._setOauthServerUrl(o),p._setHasSessionServerUrl(o),p}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,m),i(e,[{key:"_setSpidServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._spid=new b({serverUrl:v(t,y.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._oauthService=new _({serverUrl:v(t,y.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._bffService=new _({serverUrl:v(t,y.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._hasSession=new b({serverUrl:v(t,y.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(t,e){e.visitor&&this.emit("visitor",e.visitor),e.userId&&this.emit("login",e),t.userId&&!e.userId&&this.emit("logout",e),t.userId&&e.userId&&t.userId!==e.userId&&this.emit("userChange",e),t.userId||e.userId?this.emit("sessionChange",e):this.emit("notLoggedin",e),e.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",e)),t.userStatus!==e.userStatus&&this.emit("statusChange",e)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0}},{key:"_maybeSetVarnishCookie",value:function(t){if(this.setVarnishCookie){var e=new Date;"number"==typeof t.expiresIn&&t.expiresIn>0?e.setTime(e.getTime()+1e3*t.expiresIn):e.setTime(0),"string"!=typeof t.baseDomain&&(t.baseDomain=document.domain);var r=["SP_ID="+t.sp_id,"expires="+e.toUTCString(),"path=/","domain=."+t.baseDomain].join("; ");document.cookie=r}}},{key:"hasSession",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e,r,i,s,u,a,c=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"==typeof c){t.next=3;break}throw e=null===(l=c)?[void 0===l?"undefined":o(l),""+l]:[l.constructor.name,l.valueOf()],r=n(e,2),i=r[0],s=r[1],new S("Parameter 'autologin' must be boolean, was: \""+i+":"+s+'"');case 3:if(!this._enableSessionCaching){t.next=7;break}if(!(u=this.cache.get("hasSession-cache"))){t.next=7;break}return t.abrupt("return",u);case 7:return t.prev=7,t.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:c?1:0});case 10:if(a=t.sent,!f(a.error)||"LoginException"!==a.error.type){t.next=15;break}return t.next=14,this._spid.get("ajax/hasSession.js",{autologin:c?1:0});case 14:a=t.sent;case 15:if(a.result&&this.cache.set("hasSession-cache",a,1e3*a.expiresIn),!a.error){t.next=18;break}throw new S("HasSession endpoint returned an error",a.error);case 18:return this._maybeSetVarnishCookie(a),this._emitSessionEvent(this._session,a),this._session=a,t.abrupt("return",a);case 24:throw t.prev=24,t.t0=t.catch(7),this.emit("error",t.t0),new S("HasSession failed",t.t0);case 28:case"end":return t.stop()}var l},t,this,[[7,24]])}));return function(){return t.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return","result"in e);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"isConnected",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",!!e.result);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"getUser",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,f(e)){t.next=5;break}throw new S("Could not get the user. Maybe not logged in to Schibsted?");case 5:if(e.result){t.next=7;break}throw new S("The user is not connected to this merchant");case 7:return t.abrupt("return",d(e));case 8:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,!f(e)){t.next=5;break}return t.abrupt("return",e.userId);case 5:throw new S("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserUuidId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,!f(e)){t.next=5;break}return t.abrupt("return",e.uuid);case 5:throw new S("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){return this.hasSession().then(function(t){return t.visitor.uid}).catch(function(t){if(t.response&&t.response.visitor)return t.response.visitor.uid;throw t.error})}},{key:"getSpId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",e.sp_id);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",void 0);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"login",value:function(t){var e=t.acrValues,r=t.state,n=t.scope,i=void 0===n?"openid":n,o=t.redirectUri,s=void 0===o?this.redirectUri:o,u=t.preferPopup,a=void 0!==u&&u,c=t.newFlow,l=void 0===c||c,f=t.loginHint,h=void 0===f?"":f;this._closePopup();var p=this.loginUrl(r,e,i,s,l,h);return a&&(this.popup=w.open(this.window,p,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=p,null)}},{key:"logout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;a(h(e),"logout(): redirectUri must be a valid url but is "+e);var r=function(t){return t.then(function(){return!0},function(){return!1})};return Promise.all([r(this._spid.get("ajax/logout.js",{redirect_uri:e})),r(this._bffService.get("api/identity/logout"))]).then(function(e){var r=n(e,2),i=r[0],o=r[1];if(!i&&!o){var s=new S("Could not log out from any endpoint");throw t.emit("error",s),s}t.cache.delete("hasSession-cache"),t.emit("logout")})}},{key:"loginUrl",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"openid",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";return a(!e||p(e,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+e),a(h(n),"loginUrl(): redirectUri must be a valid url but is "+n),a(l(t),"the state parameter should be a non empty string but it is "+t),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:t,acr_values:e,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:t,email:o})}},{key:"logoutUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:t})}},{key:"accountUrl",value:function(){return this._spid.makeUrl("account/summary")}},{key:"phonesUrl",value:function(){return this._spid.makeUrl("account/phones")}},{key:"agreementUrl",value:function(){return this._spid.makeUrl("ajax/acceptAgreement.js")}},{key:"authFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:t})}},{key:"signupFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:t})}},{key:"signinFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:t})}}]),e}();t.exports=x},function(t,e,r){"use strict";t.exports=r(16)},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===e(t),f=r.regeneratorRuntime;if(f)l&&(t.exports=f);else{(f=r.regeneratorRuntime=l?t.exports:{}).wrap=_;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={},m={};m[u]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,u)&&(m=g);var w=x.prototype=k.prototype=Object.create(m);U.prototype=w.constructor=x,x.constructor=U,x[c]=U.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===U||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},O(P.prototype),P.prototype[a]=function(){return this},f.AsyncIterator=P,f.async=function(t,e,r,n){var i=new P(_(t,e,r,n));return f.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,T.prototype={constructor:T,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return u.type="throw",u.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(a&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(t,e,r,n){var i=e&&e.prototype instanceof k?e:k,o=Object.create(i.prototype),s=new T(n||[]);return o._invoke=function(t,e,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return N()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var u=j(s,r);if(u){if(u===y)continue;return u}}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=d;var a=S(t,e,r);if("normal"===a.type){if(n=r.done?v:p,a.arg===y)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n=v,r.method="throw",r.arg=a.arg)}}}(t,r,s),o}function S(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function k(){}function U(){}function x(){}function O(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function P(t){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,u){var a=S(t[n],t,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":e(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,s,u)},function(t){r("throw",t,s,u)}):Promise.resolve(l).then(function(t){c.value=t,s(c)},u)}u(a.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function j(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,j(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,y;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,y):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(o.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return i.next=i}}return{next:N}}function N(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(18)(t))},function(t,e,r){"use strict";r(19);var n=r(17),i=r(14),o=r(12);window.Identity=n,window.Monetization=i,window.Payment=o}]));
!function(t,e){for(var r in e)t[r]=e[r]}(window,function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=20)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1);function o(t){return"string"==typeof t}function s(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new i(e)},isObject:s,isNonEmptyObj:function(t){return s(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!o(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return o(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:o,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var s=["boolean","number","string"],u=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o(Error)),i(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&s.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=u},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(0),o=i.assert,s=i.isNonEmptyString,u=i.isUrl,a=i.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(u(t,"hostname"))return t;o(s(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),o(a(e),"urlMap must be an object");var r=e[t];return o(u(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=r(0),s=o.assert,u=o.isObject,a=o.isNonEmptyObj,c=r(1);function l(t){return s("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new c("No objects to clone");return r.forEach(function(e){s(u(e)),a(e)&&Object.entries(e).forEach(function(e){var r=i(e,2),n=r[0],o=r[1];void 0!==o&&(t[n]=u(o)?l(o):o)})}),t},cloneDeep:l}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),i(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(1),o=r(4).cloneDefined,s=r(3).urlMapper,u=r(0),a=u.assert,c=u.isObject,l=u.isFunction,f=u.isStr,h=u.isNonEmptyString,p=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return c(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function d(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var v=window.fetch,y=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,i=e.envDic,o=e.fetch,u=void 0===o?v:o,f=e.log,h=e.defaultParams,p=void 0===h?{}:h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),a(c(p),"defaultParams should be a non-null object"),this.url=new URL(s(n,i)),this.defaultParams=p,f&&(a(l(f),"log must be a function but it is "+f),this.log=f),u&&(a(l(u),"Fetch should be a function"),this.fetch=u)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,s,u,d=e.method,v=e.headers,y=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,_=e.fetchOptions,S=void 0===_?{method:d,credentials:"include"}:_;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a(l(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),a(h(d),'Method must be a non empty string but it is "'+d+'"'),a(h(y),'Pathname must be string but it is "'+y+'"'),a(c(b),"data must be a non-null object"),S.headers=c(v)?o(v):{},r=this.makeUrl(y,b,w),p(this.log,"Request:",S.method.toUpperCase(),r),p(this.log,"Request Headers:",S.headers),p(this.log,"Request Body:",S.body),t.prev=9,t.next=12,this.fetch(r,S);case 12:if(n=t.sent,p(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new i(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return s=t.sent,p(this.log,"Response Parsed:",s),t.abrupt("return",s);case 23:throw t.prev=23,t.t0=t.catch(9),u=f(t.t0)?t.t0:"Unknown RESTClient error",c(t.t0)&&f(t.t0.message)&&(u=t.t0.message),new i("Failed to '"+d+"' '"+r+"': '"+u+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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(e,this.url);return i.search=t.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?o(r,t):o(t);return Object.keys(n).map(function(t){return d(t)+"="+d(n[t])}).join("&")}}]),t}();t.exports=y},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(4).cloneDefined,o=r(6),s=r(2),u=r(15),a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,i({fetch:u},t)));return r.timeout=t.timeout?Number(t.timeout):s.JSONP.TIMEOUT,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=a},function(t,e,r){"use strict";var n=r(0),i=n.assert,o=n.isObject,s=n.isUrl,u=r(4).cloneDefined;var a={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"};t.exports={open:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments[3];i(o(t),"window was supposed to be an object but it is "+t),i(s(e),"Invalid URL for popup");var c=t.screen,l=c.height,f=c.width,h=u(a,n);Number.isFinite(h.width)&&Number.isFinite(f)&&(h.left=(f-h.width)/2),Number.isFinite(h.height)&&Number.isFinite(l)&&(h.top=(l-h.height)/2);var p,d=(i(o(p=h),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(t){return t+"="+p[t]}).join(","));return t.open(e,r,d)}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=r(1);var s=function t(e){var r=this;i(this,t),this.store=e,this.get=function(t){return r.store.getItem(t)},this.set=function(t,e){return r.store.setItem(t,e)},this.delete=function(t){return r.store.removeItem(t)}},u=function t(){var e=this;i(this,t),this.store={},this.get=function(t){return e.store[t]},this.set=function(t,r){return e.store[t]=r},this.delete=function(t){return delete e.store[t]}},a=function(){function t(e){i(this,t),!function(t){if(!t)return!1;try{var e="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(e,"TEST-VALUE");var r=t.getItem(e);return t.removeItem(e),"TEST-VALUE"===r}catch(t){return!1}}(e)?(this.cache=new u,this.type="ObjectLiteralStorage"):(this.cache=new s(e),this.type="WebStorage")}return n(t,[{key:"get",value:function(t){try{var e=this.cache.get(t),r=e?JSON.parse(e):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(t),null)}catch(t){throw new o(t)}}},{key:"set",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(t,JSON.stringify({expiresOn:i,value:e})),setTimeout(function(){return r.delete(t)},n)}catch(t){throw new o(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new o(t)}}}]),t}();t.exports=a},function(t,e,r){"use strict";function n(){}n.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function i(){n.off(t,i),e.apply(r,arguments)}return i._=e,this.on(t,i,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],i=[];if(n&&e)for(var o=0,s=n.length;o<s;o++)n[o].fn!==e&&n[o].fn._!==e&&i.push(n[o]);return i.length?r[t]=i:delete r[t],this}},t.exports=n},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(0),o=i.assert,s=i.isNonEmptyString,u=i.isUrl,a=i.isStr,c=r(3).urlMapper,l=r(2).ENDPOINTS,f=r(7),h=r(8),p=r(6),d=r(5),v=window,y=function(){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,u=void 0===i?"PRE":i,a=e.window,c=void 0===a?v:a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),d.emulate(c),o(s(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=c,this._setSpidServerUrl(u),this._setBffServerUrl(u)}return n(t,[{key:"_setSpidServerUrl",value:function(t){o(a(t),"url parameter is invalid: "+t),this._spid=new f({serverUrl:c(t,l.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){o(a(t),"url parameter is invalid: "+t),this._bff=new p({serverUrl:c(t,l.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(t){var e=t.paylink,r=t.preferPopup,n=t.redirectUri,i=void 0===n?this.redirectUri:n;o(u(i),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(e,i);return r&&(this.popup=h.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return o(u(t),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:t})}},{key:"redeemUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:t})}},{key:"purchasePaylinkUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:t,redirect_uri:e})}},{key:"purchaseProductFlowUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:t,redirect_uri:e})}},{key:"purchaseCampaignFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return o(u(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:t,product_id:e,voucher_code:r,redirect_uri:n})}}]),t}();t.exports=y},function(t,e,r){"use strict";t.exports=r(11)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var o=r(0),s=o.assert,u=o.isStr,a=o.isNonEmptyString,c=o.isUrl,l=r(3).urlMapper,f=r(2).ENDPOINTS,h=r(10),p=r(7),d=r(9),v=r(5),y=window,m=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,o=void 0===i?"PRE":i,u=t.window,c=void 0===u?y:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var l=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return v.emulate(c),s(a(r),"clientId parameter is required"),l.cache=new d(c&&c.sessionStorage),l.clientId=r,l.redirectUri=n,l._setSpidServerUrl(o),l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,h),n(e,[{key:"_setSpidServerUrl",value:function(t){s(u(t),"url parameter is invalid: "+t),this._spid=new p({serverUrl:l(t,f.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var t=i(regeneratorRuntime.mark(function t(e,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="prd_"+e+"_"+r,!(i=this.cache.get(n))){t.next=4;break}return t.abrupt("return",i);case 4:return o={product_id:e},r&&(o.sp_id=r),t.next=8,this._spid.get("ajax/hasproduct.js",o);case 8:if((s=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||30),this.cache.set(n,s,u),this.emit("hasProduct",{productId:e,data:s}),t.abrupt("return",s);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var t=i(regeneratorRuntime.mark(function t(e,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="sub_"+e+"_"+r,!(i=this.cache.get(n))){t.next=4;break}return t.abrupt("return",i);case 4:return o={product_id:e},r&&(o.sp_id=r),t.next=8,this._spid.get("ajax/hassubscription.js",o);case 8:if((s=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||30),this.cache.set(n,s,u),this.emit("hasSubscription",{subscriptionId:e,data:s}),t.abrupt("return",s);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return s(c(t),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:t})}},{key:"productsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return s(c(t),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:t})}}]),e}();t.exports=m},function(t,e,r){"use strict";t.exports=r(13)},function(t,e,r){"use strict";var n,i,o;i=[e,t],void 0===(o="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function i(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=t,s=e.timeout||r.timeout,u=e.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+u+"="+l),e.charset&&h.setAttribute("charset",e.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+t+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+t+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(e,i):n)||(t.exports=o)},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var u=r(0),a=u.assert,c=u.isStr,l=u.isNonEmptyString,f=u.isObject,h=u.isUrl,p=u.isStrIn,d=r(4).cloneDeep,v=r(3).urlMapper,y=r(2).ENDPOINTS,m=r(10),b=r(7),g=r(9),w=r(8),_=r(6),S=r(1),k=r(5),U=window;var x=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,o=void 0===i?"PRE":i,s=t.log,u=t.window,c=void 0===u?U:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var p=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return a(l(r),"clientId parameter is required"),a(f(c),"The reference to window is missing"),a(!n||h(n),"redirectUri parameter is invalid"),k.emulate(c),p._sessionInitiatedSent=!1,p.window=c,p.clientId=r,p._initCache(),p.redirectUri=n,p.log=s,p._enableSessionCaching=!0,p._session={},p._setSpidServerUrl(o),p._setBffServerUrl(o),p._setOauthServerUrl(o),p._setHasSessionServerUrl(o),p}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,m),i(e,[{key:"_setSpidServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._spid=new b({serverUrl:v(t,y.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._oauthService=new _({serverUrl:v(t,y.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._bffService=new _({serverUrl:v(t,y.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._hasSession=new b({serverUrl:v(t,y.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(t,e){e.visitor&&this.emit("visitor",e.visitor),e.userId&&this.emit("login",e),t.userId&&!e.userId&&this.emit("logout",e),t.userId&&e.userId&&t.userId!==e.userId&&this.emit("userChange",e),t.userId||e.userId?this.emit("sessionChange",e):this.emit("notLoggedin",e),e.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",e)),t.userStatus!==e.userStatus&&this.emit("statusChange",e)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new g(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(t){if(this.setVarnishCookie){var e=new Date;"number"==typeof t.expiresIn&&t.expiresIn>0?e.setTime(e.getTime()+1e3*t.expiresIn):e.setTime(0);var r="string"==typeof t.baseDomain?t.baseDomain:document.domain||"",n=["SP_ID="+t.sp_id,"expires="+e.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e,r,i,s,u,a,c=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"==typeof c){t.next=3;break}throw e=null===(l=c)?[void 0===l?"undefined":o(l),""+l]:[l.constructor.name,l.valueOf()],r=n(e,2),i=r[0],s=r[1],new S("Parameter 'autologin' must be boolean, was: \""+i+":"+s+'"');case 3:if(!this._enableSessionCaching){t.next=7;break}if(!(u=this.cache.get("hasSession-cache"))){t.next=7;break}return t.abrupt("return",u);case 7:return t.prev=7,t.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:c?1:0});case 10:if(a=t.sent,!f(a.error)||"LoginException"!==a.error.type){t.next=15;break}return t.next=14,this._spid.get("ajax/hasSession.js",{autologin:c?1:0});case 14:a=t.sent;case 15:if(a.result&&this.cache.set("hasSession-cache",a,1e3*a.expiresIn),!a.error){t.next=18;break}throw new S("HasSession endpoint returned an error",a.error);case 18:return this._maybeSetVarnishCookie(a),this._emitSessionEvent(this._session,a),this._session=a,t.abrupt("return",a);case 24:throw t.prev=24,t.t0=t.catch(7),this.emit("error",t.t0),new S("HasSession failed",t.t0);case 28:case"end":return t.stop()}var l},t,this,[[7,24]])}));return function(){return t.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return","result"in e);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"isConnected",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",!!e.result);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"getUser",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if((e=t.sent).result){t.next=5;break}throw new S("The user is not connected to this merchant");case 5:return t.abrupt("return",d(e));case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).userId){t.next=5;break}return t.abrupt("return",e.userId);case 5:throw new S("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).uuid){t.next=5;break}return t.abrupt("return",e.uuid);case 5:throw new S("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).visitor||!e.visitor.uid){t.next=5;break}return t.abrupt("return",e.visitor.uid);case 5:throw new S("No visitor id available for this user");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getSpId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",e.sp_id||null);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",null);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"login",value:function(t){var e=t.acrValues,r=t.state,n=t.scope,i=void 0===n?"openid":n,o=t.redirectUri,s=void 0===o?this.redirectUri:o,u=t.preferPopup,a=void 0!==u&&u,c=t.newFlow,l=void 0===c||c,f=t.loginHint,h=void 0===f?"":f;this._closePopup();var p=this.loginUrl(r,e,i,s,l,h);return a&&(this.popup=w.open(this.window,p,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=p,null)}},{key:"logout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;a(h(e),"logout(): redirectUri must be a valid url but is "+e);var r=function(t){return t.then(function(){return!0},function(){return!1})};return Promise.all([r(this._spid.get("ajax/logout.js",{redirect_uri:e})),r(this._bffService.get("api/identity/logout"))]).then(function(e){var r=n(e,2),i=r[0],o=r[1];if(!i&&!o){var s=new S("Could not log out from any endpoint");throw t.emit("error",s),s}t.cache.delete("hasSession-cache"),t.emit("logout")})}},{key:"loginUrl",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"openid",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";return a(!e||p(e,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+e),a(h(n),"loginUrl(): redirectUri must be a valid url but is "+n),a(l(t),"the state parameter should be a non empty string but it is "+t),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:t,acr_values:e,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:t,email:o})}},{key:"logoutUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:t})}},{key:"accountUrl",value:function(){return this._spid.makeUrl("account/summary")}},{key:"phonesUrl",value:function(){return this._spid.makeUrl("account/phones")}},{key:"agreementUrl",value:function(){return this._spid.makeUrl("ajax/acceptAgreement.js")}},{key:"authFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:t})}},{key:"signupFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:t})}},{key:"signinFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:t})}}]),e}();t.exports=x},function(t,e,r){"use strict";t.exports=r(16)},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===e(t),f=r.regeneratorRuntime;if(f)l&&(t.exports=f);else{(f=r.regeneratorRuntime=l?t.exports:{}).wrap=_;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={},m={};m[u]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,u)&&(m=g);var w=x.prototype=k.prototype=Object.create(m);U.prototype=w.constructor=x,x.constructor=U,x[c]=U.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===U||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},O(P.prototype),P.prototype[a]=function(){return this},f.AsyncIterator=P,f.async=function(t,e,r,n){var i=new P(_(t,e,r,n));return f.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,T.prototype={constructor:T,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return u.type="throw",u.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(a&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(t,e,r,n){var i=e&&e.prototype instanceof k?e:k,o=Object.create(i.prototype),s=new T(n||[]);return o._invoke=function(t,e,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return N()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var u=j(s,r);if(u){if(u===y)continue;return u}}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=d;var a=S(t,e,r);if("normal"===a.type){if(n=r.done?v:p,a.arg===y)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n=v,r.method="throw",r.arg=a.arg)}}}(t,r,s),o}function S(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function k(){}function U(){}function x(){}function O(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function P(t){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,u){var a=S(t[n],t,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":e(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,s,u)},function(t){r("throw",t,s,u)}):Promise.resolve(l).then(function(t){c.value=t,s(c)},u)}u(a.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function j(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,j(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,y;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,y):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(o.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return i.next=i}}return{next:N}}function N(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(18)(t))},function(t,e,r){"use strict";r(19);var n=r(17),i=r(14),o=r(12);window.Identity=n,window.Monetization=i,window.Payment=o}]));
//# sourceMappingURL=global.js.map

@@ -1,2 +0,2 @@

module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=15)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(1);function i(t){return"string"==typeof t}function s(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new o(e)},isObject:s,isNonEmptyObj:function(t){return s(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!i(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return i(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:i,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var s=["boolean","number","string"],u=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(o,r),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i(Error)),o(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&s.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=u},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),s=i.assert,u=i.isObject,a=i.isNonEmptyObj,c=r(1);function l(t){return s("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new c("No objects to clone");return r.forEach(function(e){s(u(e)),a(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=u(i)?l(i):i)})}),t},cloneDeep:l}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(1),i=r(2).cloneDefined,s=r(5).urlMapper,u=r(0),a=u.assert,c=u.isObject,l=u.isFunction,f=u.isStr,h=u.isNonEmptyString,p=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return c(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function d(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var y=window.fetch,v=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,u=void 0===i?y:i,f=e.log,h=e.defaultParams,p=void 0===h?{}:h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),a(c(p),"defaultParams should be a non-null object"),this.url=new URL(s(n,o)),this.defaultParams=p,void 0!==f&&(a(l(f),"log must be a function but it is "+f),this.log=f),void 0!==u&&(a(l(u),"Fetch should be a function"),this.fetch=u)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,s,u,d=e.method,y=e.headers,v=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,S=e.fetchOptions,_=void 0===S?{method:d,credentials:"include"}:S;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a(l(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),a(h(d),'Method must be a non empty string but it is "'+d+'"'),a(h(v),'Pathname must be string but it is "'+v+'"'),a(c(b),"data must be a non-null object"),_.headers=c(y)?i(y):{},r=this.makeUrl(v,b,w),p(this.log,"Request:",_.method.toUpperCase(),r),p(this.log,"Request Headers:",_.headers),p(this.log,"Request Body:",_.body),t.prev=9,t.next=12,this.fetch(r,_);case 12:if(n=t.sent,p(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new o(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return s=t.sent,p(this.log,"Response Parsed:",s),t.abrupt("return",s);case 23:throw t.prev=23,t.t0=t.catch(9),u=f(t.t0)?t.t0:"Unknown RESTClient error",c(t.t0)&&f(t.t0.message)&&(u=t.t0.message),new o("Failed to '"+d+"' '"+r+"': '"+u+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var s=e[o](i),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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],o=new URL(e,this.url);return o.search=t.search(r,n,this.defaultParams),o.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?i(r,t):i(t);return Object.keys(n).map(function(t){return d(t)+"="+d(n[t])}).join("&")}}]),t}();t.exports=v},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0),i=o.assert,s=o.isNonEmptyString,u=o.isUrl,a=o.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(u(t,"hostname"))return t;i(s(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),i(a(e),"urlMap must be an object");var r=e[t];return i(u(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),o(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=r(0),o=n.assert,i=n.isObject,s=n.isUrl,u=r(2).cloneDefined;var a={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"};t.exports={open:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments[3];o(i(t),"window was supposed to be an object but it is "+t),o(s(e),"Invalid URL for popup");var c=t.screen,l=c.height,f=c.width,h=u(a,n);Number.isFinite(h.width)&&(h.left=(f-h.width)/2),Number.isFinite(h.height)&&(h.top=(l-h.height)/2);var p,d=(o(i(p=h),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(t){return t+"="+p[t]}).join(","));return t.open(e,r,d)}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(1);var s=function t(e){var r=this;o(this,t),this.store=e,this.get=function(t){return r.store.getItem(t)},this.set=function(t,e){return r.store.setItem(t,e)},this.delete=function(t){return r.store.removeItem(t)}},u=function t(){var e=this;o(this,t),this.store={},this.get=function(t){return e.store[t]},this.set=function(t,r){return e.store[t]=r},this.delete=function(t){return delete e.store[t]}},a=function(){function t(e){o(this,t),!function(t){if(!t)return!1;try{var e="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(e,"TEST-VALUE");var r=t.getItem(e);return t.removeItem(e),"TEST-VALUE"===r}catch(t){return!1}}(e)?(this.cache=new u,this.type="ObjectLiteralStorage"):(this.cache=new s(e),this.type="WebStorage")}return n(t,[{key:"get",value:function(t){try{var e=this.cache.get(t),r=e?JSON.parse(e):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(t),null)}catch(t){throw new i(t)}}},{key:"set",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var o=Math.floor(Date.now()+n);this.cache.set(t,JSON.stringify({expiresOn:o,value:e})),setTimeout(function(){return r.delete(t)},n)}catch(t){throw new i(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new i(t)}}}]),t}();t.exports=a},function(t,e,r){"use strict";var n,o,i;o=[e,t],void 0===(i="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t,s=e.timeout||r.timeout,u=e.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),a&&clearTimeout(a),o(f),n(l)},i+=-1===i.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+i+u+"="+l),e.charset&&h.setAttribute("charset",e.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+t+" timed out")),n(l),o(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+t+" failed")),n(l),o(f),a&&clearTimeout(a)}})}})?n.apply(e,o):n)||(t.exports=i)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(2).cloneDefined,i=r(3),s=r(4),u=r(9),a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,o({fetch:u},t)));return r.timeout=void 0===t.timeout?s.JSONP.TIMEOUT:Number(t.timeout),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var s=o.get;return void 0!==s?s.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=a},function(t,e,r){"use strict";function n(){}n.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function o(){n.off(t,o),e.apply(r,arguments)}return o._=e,this.on(t,o,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,o=r.length;n<o;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],o=[];if(n&&e)for(var i=0,s=n.length;i<s;i++)n[i].fn!==e&&n[i].fn._!==e&&o.push(n[i]);return o.length?r[t]=o:delete r[t],this}},t.exports=n},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var s=e[o](i),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var u=r(0),a=u.assert,c=u.isStr,l=u.isNonEmptyString,f=u.isObject,h=u.isUrl,p=u.isStrIn,d=r(2).cloneDeep,y=r(5).urlMapper,v=r(4).ENDPOINTS,m=r(11),b=r(10),g=r(8),w=r(7),S=r(3),_=r(1),O=r(6),x=window;var k=function(t){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,i=void 0===o?"PRE":o,s=t.log,u=t.window,c=void 0===u?x:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var p=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return a(l(r),"clientId parameter is required"),a(f(c),"The reference to window is missing"),a(!n||h(n),"redirectUri parameter is invalid"),O.emulate(c),p._sessionInitiatedSent=!1,p.window=c,p.clientId=r,p.cache=new g(c&&c.localStorage),p.redirectUri=n,p.log=s,p._enableSessionCaching=!0,p._session={},p._setSpidServerUrl(i),p._setBffServerUrl(i),p._setOauthServerUrl(i),p._setHasSessionServerUrl(i),p}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,m),o(e,[{key:"_setSpidServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._spid=new b({serverUrl:y(t,v.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._oauthService=new S({serverUrl:y(t,v.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._bffService=new S({serverUrl:y(t,v.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._hasSession=new b({serverUrl:y(t,v.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(t,e){e.visitor&&this.emit("visitor",e.visitor),e.userId&&this.emit("login",e),t.userId&&!e.userId&&this.emit("logout",e),t.userId&&e.userId&&t.userId!==e.userId&&this.emit("userChange",e),t.userId||e.userId?this.emit("sessionChange",e):this.emit("notLoggedin",e),e.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",e)),t.userStatus!==e.userStatus&&this.emit("statusChange",e)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0}},{key:"_maybeSetVarnishCookie",value:function(t){if(this.setVarnishCookie){var e=new Date;"number"==typeof t.expiresIn&&t.expiresIn>0?e.setTime(e.getTime()+1e3*t.expiresIn):e.setTime(0),"string"!=typeof t.baseDomain&&(t.baseDomain=document.domain);var r=["SP_ID="+t.sp_id,"expires="+e.toUTCString(),"path=/","domain=."+t.baseDomain].join("; ");document.cookie=r}}},{key:"hasSession",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e,r,o,s,u,a,c=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"==typeof c){t.next=3;break}throw e=null===(l=c)?[void 0===l?"undefined":i(l),""+l]:[l.constructor.name,l.valueOf()],r=n(e,2),o=r[0],s=r[1],new _("Parameter 'autologin' must be boolean, was: \""+o+":"+s+'"');case 3:if(!this._enableSessionCaching){t.next=7;break}if(!(u=this.cache.get("hasSession-cache"))){t.next=7;break}return t.abrupt("return",u);case 7:return t.prev=7,t.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:c?1:0});case 10:if(a=t.sent,!f(a.error)||"LoginException"!==a.error.type){t.next=15;break}return t.next=14,this._spid.get("ajax/hasSession.js",{autologin:c?1:0});case 14:a=t.sent;case 15:if(a.result&&this.cache.set("hasSession-cache",a,1e3*a.expiresIn),!a.error){t.next=18;break}throw new _("HasSession endpoint returned an error",a.error);case 18:return this._maybeSetVarnishCookie(a),this._emitSessionEvent(this._session,a),this._session=a,t.abrupt("return",a);case 24:throw t.prev=24,t.t0=t.catch(7),this.emit("error",t.t0),new _("HasSession failed",t.t0);case 28:case"end":return t.stop()}var l},t,this,[[7,24]])}));return function(){return t.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return","result"in e);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"isConnected",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",!!e.result);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"getUser",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,f(e)){t.next=5;break}throw new _("Could not get the user. Maybe not logged in to Schibsted?");case 5:if(e.result){t.next=7;break}throw new _("The user is not connected to this merchant");case 7:return t.abrupt("return",d(e));case 8:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,!f(e)){t.next=5;break}return t.abrupt("return",e.userId);case 5:throw new _("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserUuidId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,!f(e)){t.next=5;break}return t.abrupt("return",e.uuid);case 5:throw new _("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){return this.hasSession().then(function(t){return t.visitor.uid}).catch(function(t){if(t.response&&t.response.visitor)return t.response.visitor.uid;throw t.error})}},{key:"getSpId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",e.sp_id);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",void 0);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"login",value:function(t){var e=t.acrValues,r=t.state,n=t.scope,o=void 0===n?"openid":n,i=t.redirectUri,s=void 0===i?this.redirectUri:i,u=t.preferPopup,a=void 0!==u&&u,c=t.newFlow,l=void 0===c||c,f=t.loginHint,h=void 0===f?"":f;this._closePopup();var p=this.loginUrl(r,e,o,s,l,h);return a&&(this.popup=w.open(this.window,p,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=p,null)}},{key:"logout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;a(h(e),"logout(): redirectUri must be a valid url but is "+e);var r=function(t){return t.then(function(){return!0},function(){return!1})};return Promise.all([r(this._spid.get("ajax/logout.js",{redirect_uri:e})),r(this._bffService.get("api/identity/logout"))]).then(function(e){var r=n(e,2),o=r[0],i=r[1];if(!o&&!i){var s=new _("Could not log out from any endpoint");throw t.emit("error",s),s}t.cache.delete("hasSession-cache"),t.emit("logout")})}},{key:"loginUrl",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"openid",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";return a(!e||p(e,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+e),a(h(n),"loginUrl(): redirectUri must be a valid url but is "+n),a(l(t),"the state parameter should be a non empty string but it is "+t),o?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:t,acr_values:e,login_hint:i}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:t,email:i})}},{key:"logoutUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:t})}},{key:"accountUrl",value:function(){return this._spid.makeUrl("account/summary")}},{key:"phonesUrl",value:function(){return this._spid.makeUrl("account/phones")}},{key:"agreementUrl",value:function(){return this._spid.makeUrl("ajax/acceptAgreement.js")}},{key:"authFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:t})}},{key:"signupFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:t})}},{key:"signinFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:t})}}]),e}();t.exports=k},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,o=Object.prototype,i=o.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===e(t),f=r.regeneratorRuntime;if(f)l&&(t.exports=f);else{(f=r.regeneratorRuntime=l?t.exports:{}).wrap=S;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={},m={};m[u]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(L([])));g&&g!==o&&i.call(g,u)&&(m=g);var w=k.prototype=O.prototype=Object.create(m);x.prototype=w.constructor=k,k.constructor=x,k[c]=x.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},j(P.prototype),P.prototype[a]=function(){return this},f.AsyncIterator=P,f.async=function(t,e,r,n){var o=new P(S(t,e,r,n));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},j(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=L,T.prototype={constructor:T,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,o){return u.type="throw",u.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=i.call(s,"catchLoc"),c=i.call(s,"finallyLoc");if(a&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){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(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function S(t,e,r,n){var o=e&&e.prototype instanceof O?e:O,i=Object.create(o.prototype),s=new T(n||[]);return i._invoke=function(t,e,r){var n=h;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var u=U(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var a=_(t,e,r);if("normal"===a.type){if(n=r.done?y:p,a.arg===v)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n=y,r.method="throw",r.arg=a.arg)}}}(t,r,s),i}function _(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function O(){}function x(){}function k(){}function j(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function P(t){var r;this._invoke=function(n,o){function s(){return new Promise(function(r,s){!function r(n,o,s,u){var a=_(t[n],t,o);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":e(l))&&i.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,s,u)},function(t){r("throw",t,s,u)}):Promise.resolve(l).then(function(t){c.value=t,s(c)},u)}u(a.arg)}(n,o,r,s)})}return r=r?r.then(s,s):s()}}function U(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,U(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=_(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function L(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(13)(t))},function(t,e,r){"use strict";r(14),t.exports=r(12)}]);
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=15)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(1);function i(t){return"string"==typeof t}function s(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new o(e)},isObject:s,isNonEmptyObj:function(t){return s(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!i(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return i(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:i,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var s=["boolean","number","string"],u=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(o,r),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i(Error)),o(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&s.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=u},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),s=i.assert,u=i.isObject,a=i.isNonEmptyObj,c=r(1);function l(t){return s("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new c("No objects to clone");return r.forEach(function(e){s(u(e)),a(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=u(i)?l(i):i)})}),t},cloneDeep:l}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(1),i=r(2).cloneDefined,s=r(5).urlMapper,u=r(0),a=u.assert,c=u.isObject,l=u.isFunction,f=u.isStr,h=u.isNonEmptyString,p=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return c(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function d(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var y=window.fetch,v=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,u=void 0===i?y:i,f=e.log,h=e.defaultParams,p=void 0===h?{}:h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),a(c(p),"defaultParams should be a non-null object"),this.url=new URL(s(n,o)),this.defaultParams=p,f&&(a(l(f),"log must be a function but it is "+f),this.log=f),u&&(a(l(u),"Fetch should be a function"),this.fetch=u)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,s,u,d=e.method,y=e.headers,v=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,S=e.fetchOptions,_=void 0===S?{method:d,credentials:"include"}:S;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a(l(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),a(h(d),'Method must be a non empty string but it is "'+d+'"'),a(h(v),'Pathname must be string but it is "'+v+'"'),a(c(b),"data must be a non-null object"),_.headers=c(y)?i(y):{},r=this.makeUrl(v,b,w),p(this.log,"Request:",_.method.toUpperCase(),r),p(this.log,"Request Headers:",_.headers),p(this.log,"Request Body:",_.body),t.prev=9,t.next=12,this.fetch(r,_);case 12:if(n=t.sent,p(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new o(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return s=t.sent,p(this.log,"Response Parsed:",s),t.abrupt("return",s);case 23:throw t.prev=23,t.t0=t.catch(9),u=f(t.t0)?t.t0:"Unknown RESTClient error",c(t.t0)&&f(t.t0.message)&&(u=t.t0.message),new o("Failed to '"+d+"' '"+r+"': '"+u+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var s=e[o](i),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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],o=new URL(e,this.url);return o.search=t.search(r,n,this.defaultParams),o.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?i(r,t):i(t);return Object.keys(n).map(function(t){return d(t)+"="+d(n[t])}).join("&")}}]),t}();t.exports=v},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0),i=o.assert,s=o.isNonEmptyString,u=o.isUrl,a=o.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(u(t,"hostname"))return t;i(s(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),i(a(e),"urlMap must be an object");var r=e[t];return i(u(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),o(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=r(0),o=n.assert,i=n.isObject,s=n.isUrl,u=r(2).cloneDefined;var a={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"};t.exports={open:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments[3];o(i(t),"window was supposed to be an object but it is "+t),o(s(e),"Invalid URL for popup");var c=t.screen,l=c.height,f=c.width,h=u(a,n);Number.isFinite(h.width)&&Number.isFinite(f)&&(h.left=(f-h.width)/2),Number.isFinite(h.height)&&Number.isFinite(l)&&(h.top=(l-h.height)/2);var p,d=(o(i(p=h),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(t){return t+"="+p[t]}).join(","));return t.open(e,r,d)}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(1);var s=function t(e){var r=this;o(this,t),this.store=e,this.get=function(t){return r.store.getItem(t)},this.set=function(t,e){return r.store.setItem(t,e)},this.delete=function(t){return r.store.removeItem(t)}},u=function t(){var e=this;o(this,t),this.store={},this.get=function(t){return e.store[t]},this.set=function(t,r){return e.store[t]=r},this.delete=function(t){return delete e.store[t]}},a=function(){function t(e){o(this,t),!function(t){if(!t)return!1;try{var e="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(e,"TEST-VALUE");var r=t.getItem(e);return t.removeItem(e),"TEST-VALUE"===r}catch(t){return!1}}(e)?(this.cache=new u,this.type="ObjectLiteralStorage"):(this.cache=new s(e),this.type="WebStorage")}return n(t,[{key:"get",value:function(t){try{var e=this.cache.get(t),r=e?JSON.parse(e):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(t),null)}catch(t){throw new i(t)}}},{key:"set",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var o=Math.floor(Date.now()+n);this.cache.set(t,JSON.stringify({expiresOn:o,value:e})),setTimeout(function(){return r.delete(t)},n)}catch(t){throw new i(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new i(t)}}}]),t}();t.exports=a},function(t,e,r){"use strict";var n,o,i;o=[e,t],void 0===(i="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t,s=e.timeout||r.timeout,u=e.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),a&&clearTimeout(a),o(f),n(l)},i+=-1===i.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+i+u+"="+l),e.charset&&h.setAttribute("charset",e.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+t+" timed out")),n(l),o(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+t+" failed")),n(l),o(f),a&&clearTimeout(a)}})}})?n.apply(e,o):n)||(t.exports=i)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(2).cloneDefined,i=r(3),s=r(4),u=r(9),a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,o({fetch:u},t)));return r.timeout=t.timeout?Number(t.timeout):s.JSONP.TIMEOUT,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var s=o.get;return void 0!==s?s.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=a},function(t,e,r){"use strict";function n(){}n.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function o(){n.off(t,o),e.apply(r,arguments)}return o._=e,this.on(t,o,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,o=r.length;n<o;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],o=[];if(n&&e)for(var i=0,s=n.length;i<s;i++)n[i].fn!==e&&n[i].fn._!==e&&o.push(n[i]);return o.length?r[t]=o:delete r[t],this}},t.exports=n},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var s=e[o](i),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var u=r(0),a=u.assert,c=u.isStr,l=u.isNonEmptyString,f=u.isObject,h=u.isUrl,p=u.isStrIn,d=r(2).cloneDeep,y=r(5).urlMapper,v=r(4).ENDPOINTS,m=r(11),b=r(10),g=r(8),w=r(7),S=r(3),_=r(1),O=r(6),x=window;var k=function(t){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,i=void 0===o?"PRE":o,s=t.log,u=t.window,c=void 0===u?x:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var p=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return a(l(r),"clientId parameter is required"),a(f(c),"The reference to window is missing"),a(!n||h(n),"redirectUri parameter is invalid"),O.emulate(c),p._sessionInitiatedSent=!1,p.window=c,p.clientId=r,p._initCache(),p.redirectUri=n,p.log=s,p._enableSessionCaching=!0,p._session={},p._setSpidServerUrl(i),p._setBffServerUrl(i),p._setOauthServerUrl(i),p._setHasSessionServerUrl(i),p}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,m),o(e,[{key:"_setSpidServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._spid=new b({serverUrl:y(t,v.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._oauthService=new S({serverUrl:y(t,v.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._bffService=new S({serverUrl:y(t,v.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._hasSession=new b({serverUrl:y(t,v.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(t,e){e.visitor&&this.emit("visitor",e.visitor),e.userId&&this.emit("login",e),t.userId&&!e.userId&&this.emit("logout",e),t.userId&&e.userId&&t.userId!==e.userId&&this.emit("userChange",e),t.userId||e.userId?this.emit("sessionChange",e):this.emit("notLoggedin",e),e.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",e)),t.userStatus!==e.userStatus&&this.emit("statusChange",e)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new g(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(t){if(this.setVarnishCookie){var e=new Date;"number"==typeof t.expiresIn&&t.expiresIn>0?e.setTime(e.getTime()+1e3*t.expiresIn):e.setTime(0);var r="string"==typeof t.baseDomain?t.baseDomain:document.domain||"",n=["SP_ID="+t.sp_id,"expires="+e.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e,r,o,s,u,a,c=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"==typeof c){t.next=3;break}throw e=null===(l=c)?[void 0===l?"undefined":i(l),""+l]:[l.constructor.name,l.valueOf()],r=n(e,2),o=r[0],s=r[1],new _("Parameter 'autologin' must be boolean, was: \""+o+":"+s+'"');case 3:if(!this._enableSessionCaching){t.next=7;break}if(!(u=this.cache.get("hasSession-cache"))){t.next=7;break}return t.abrupt("return",u);case 7:return t.prev=7,t.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:c?1:0});case 10:if(a=t.sent,!f(a.error)||"LoginException"!==a.error.type){t.next=15;break}return t.next=14,this._spid.get("ajax/hasSession.js",{autologin:c?1:0});case 14:a=t.sent;case 15:if(a.result&&this.cache.set("hasSession-cache",a,1e3*a.expiresIn),!a.error){t.next=18;break}throw new _("HasSession endpoint returned an error",a.error);case 18:return this._maybeSetVarnishCookie(a),this._emitSessionEvent(this._session,a),this._session=a,t.abrupt("return",a);case 24:throw t.prev=24,t.t0=t.catch(7),this.emit("error",t.t0),new _("HasSession failed",t.t0);case 28:case"end":return t.stop()}var l},t,this,[[7,24]])}));return function(){return t.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return","result"in e);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"isConnected",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",!!e.result);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"getUser",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if((e=t.sent).result){t.next=5;break}throw new _("The user is not connected to this merchant");case 5:return t.abrupt("return",d(e));case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).userId){t.next=5;break}return t.abrupt("return",e.userId);case 5:throw new _("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).uuid){t.next=5;break}return t.abrupt("return",e.uuid);case 5:throw new _("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).visitor||!e.visitor.uid){t.next=5;break}return t.abrupt("return",e.visitor.uid);case 5:throw new _("No visitor id available for this user");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getSpId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",e.sp_id||null);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",null);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"login",value:function(t){var e=t.acrValues,r=t.state,n=t.scope,o=void 0===n?"openid":n,i=t.redirectUri,s=void 0===i?this.redirectUri:i,u=t.preferPopup,a=void 0!==u&&u,c=t.newFlow,l=void 0===c||c,f=t.loginHint,h=void 0===f?"":f;this._closePopup();var p=this.loginUrl(r,e,o,s,l,h);return a&&(this.popup=w.open(this.window,p,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=p,null)}},{key:"logout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;a(h(e),"logout(): redirectUri must be a valid url but is "+e);var r=function(t){return t.then(function(){return!0},function(){return!1})};return Promise.all([r(this._spid.get("ajax/logout.js",{redirect_uri:e})),r(this._bffService.get("api/identity/logout"))]).then(function(e){var r=n(e,2),o=r[0],i=r[1];if(!o&&!i){var s=new _("Could not log out from any endpoint");throw t.emit("error",s),s}t.cache.delete("hasSession-cache"),t.emit("logout")})}},{key:"loginUrl",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"openid",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";return a(!e||p(e,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+e),a(h(n),"loginUrl(): redirectUri must be a valid url but is "+n),a(l(t),"the state parameter should be a non empty string but it is "+t),o?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:t,acr_values:e,login_hint:i}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:t,email:i})}},{key:"logoutUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:t})}},{key:"accountUrl",value:function(){return this._spid.makeUrl("account/summary")}},{key:"phonesUrl",value:function(){return this._spid.makeUrl("account/phones")}},{key:"agreementUrl",value:function(){return this._spid.makeUrl("ajax/acceptAgreement.js")}},{key:"authFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:t})}},{key:"signupFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:t})}},{key:"signinFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:t})}}]),e}();t.exports=k},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,o=Object.prototype,i=o.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===e(t),f=r.regeneratorRuntime;if(f)l&&(t.exports=f);else{(f=r.regeneratorRuntime=l?t.exports:{}).wrap=S;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={},m={};m[u]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==o&&i.call(g,u)&&(m=g);var w=k.prototype=O.prototype=Object.create(m);x.prototype=w.constructor=k,k.constructor=x,k[c]=x.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},j(P.prototype),P.prototype[a]=function(){return this},f.AsyncIterator=P,f.async=function(t,e,r,n){var o=new P(S(t,e,r,n));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},j(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,T.prototype={constructor:T,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,o){return u.type="throw",u.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=i.call(s,"catchLoc"),c=i.call(s,"finallyLoc");if(a&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){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(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function S(t,e,r,n){var o=e&&e.prototype instanceof O?e:O,i=Object.create(o.prototype),s=new T(n||[]);return i._invoke=function(t,e,r){var n=h;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var u=U(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var a=_(t,e,r);if("normal"===a.type){if(n=r.done?y:p,a.arg===v)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n=y,r.method="throw",r.arg=a.arg)}}}(t,r,s),i}function _(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function O(){}function x(){}function k(){}function j(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function P(t){var r;this._invoke=function(n,o){function s(){return new Promise(function(r,s){!function r(n,o,s,u){var a=_(t[n],t,o);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":e(l))&&i.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,s,u)},function(t){r("throw",t,s,u)}):Promise.resolve(l).then(function(t){c.value=t,s(c)},u)}u(a.arg)}(n,o,r,s)})}return r=r?r.then(s,s):s()}}function U(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,U(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=_(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(13)(t))},function(t,e,r){"use strict";r(14),t.exports=r(12)}]);
//# sourceMappingURL=identity.js.map

@@ -1,2 +0,2 @@

module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=20)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1);function o(t){return"string"==typeof t}function s(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new i(e)},isObject:s,isNonEmptyObj:function(t){return s(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!o(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return o(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:o,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var s=["boolean","number","string"],u=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o(Error)),i(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&s.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=u},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(0),o=i.assert,s=i.isNonEmptyString,u=i.isUrl,a=i.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(u(t,"hostname"))return t;o(s(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),o(a(e),"urlMap must be an object");var r=e[t];return o(u(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=r(0),s=o.assert,u=o.isObject,a=o.isNonEmptyObj,c=r(1);function l(t){return s("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new c("No objects to clone");return r.forEach(function(e){s(u(e)),a(e)&&Object.entries(e).forEach(function(e){var r=i(e,2),n=r[0],o=r[1];void 0!==o&&(t[n]=u(o)?l(o):o)})}),t},cloneDeep:l}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),i(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(1),o=r(4).cloneDefined,s=r(3).urlMapper,u=r(0),a=u.assert,c=u.isObject,l=u.isFunction,f=u.isStr,h=u.isNonEmptyString,p=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return c(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function d(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var v=window.fetch,y=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,i=e.envDic,o=e.fetch,u=void 0===o?v:o,f=e.log,h=e.defaultParams,p=void 0===h?{}:h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),a(c(p),"defaultParams should be a non-null object"),this.url=new URL(s(n,i)),this.defaultParams=p,void 0!==f&&(a(l(f),"log must be a function but it is "+f),this.log=f),void 0!==u&&(a(l(u),"Fetch should be a function"),this.fetch=u)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,s,u,d=e.method,v=e.headers,y=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,_=e.fetchOptions,S=void 0===_?{method:d,credentials:"include"}:_;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a(l(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),a(h(d),'Method must be a non empty string but it is "'+d+'"'),a(h(y),'Pathname must be string but it is "'+y+'"'),a(c(b),"data must be a non-null object"),S.headers=c(v)?o(v):{},r=this.makeUrl(y,b,w),p(this.log,"Request:",S.method.toUpperCase(),r),p(this.log,"Request Headers:",S.headers),p(this.log,"Request Body:",S.body),t.prev=9,t.next=12,this.fetch(r,S);case 12:if(n=t.sent,p(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new i(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return s=t.sent,p(this.log,"Response Parsed:",s),t.abrupt("return",s);case 23:throw t.prev=23,t.t0=t.catch(9),u=f(t.t0)?t.t0:"Unknown RESTClient error",c(t.t0)&&f(t.t0.message)&&(u=t.t0.message),new i("Failed to '"+d+"' '"+r+"': '"+u+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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(e,this.url);return i.search=t.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?o(r,t):o(t);return Object.keys(n).map(function(t){return d(t)+"="+d(n[t])}).join("&")}}]),t}();t.exports=y},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(4).cloneDefined,o=r(6),s=r(2),u=r(15),a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,i({fetch:u},t)));return r.timeout=void 0===t.timeout?s.JSONP.TIMEOUT:Number(t.timeout),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=a},function(t,e,r){"use strict";var n=r(0),i=n.assert,o=n.isObject,s=n.isUrl,u=r(4).cloneDefined;var a={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"};t.exports={open:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments[3];i(o(t),"window was supposed to be an object but it is "+t),i(s(e),"Invalid URL for popup");var c=t.screen,l=c.height,f=c.width,h=u(a,n);Number.isFinite(h.width)&&(h.left=(f-h.width)/2),Number.isFinite(h.height)&&(h.top=(l-h.height)/2);var p,d=(i(o(p=h),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(t){return t+"="+p[t]}).join(","));return t.open(e,r,d)}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=r(1);var s=function t(e){var r=this;i(this,t),this.store=e,this.get=function(t){return r.store.getItem(t)},this.set=function(t,e){return r.store.setItem(t,e)},this.delete=function(t){return r.store.removeItem(t)}},u=function t(){var e=this;i(this,t),this.store={},this.get=function(t){return e.store[t]},this.set=function(t,r){return e.store[t]=r},this.delete=function(t){return delete e.store[t]}},a=function(){function t(e){i(this,t),!function(t){if(!t)return!1;try{var e="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(e,"TEST-VALUE");var r=t.getItem(e);return t.removeItem(e),"TEST-VALUE"===r}catch(t){return!1}}(e)?(this.cache=new u,this.type="ObjectLiteralStorage"):(this.cache=new s(e),this.type="WebStorage")}return n(t,[{key:"get",value:function(t){try{var e=this.cache.get(t),r=e?JSON.parse(e):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(t),null)}catch(t){throw new o(t)}}},{key:"set",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(t,JSON.stringify({expiresOn:i,value:e})),setTimeout(function(){return r.delete(t)},n)}catch(t){throw new o(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new o(t)}}}]),t}();t.exports=a},function(t,e,r){"use strict";function n(){}n.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function i(){n.off(t,i),e.apply(r,arguments)}return i._=e,this.on(t,i,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],i=[];if(n&&e)for(var o=0,s=n.length;o<s;o++)n[o].fn!==e&&n[o].fn._!==e&&i.push(n[o]);return i.length?r[t]=i:delete r[t],this}},t.exports=n},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(0),o=i.assert,s=i.isNonEmptyString,u=i.isUrl,a=i.isStr,c=r(3).urlMapper,l=r(2).ENDPOINTS,f=r(7),h=r(8),p=r(6),d=r(5),v=window,y=function(){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,u=void 0===i?"PRE":i,a=e.window,c=void 0===a?v:a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),d.emulate(c),o(s(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=c,this._setSpidServerUrl(u),this._setBffServerUrl(u)}return n(t,[{key:"_setSpidServerUrl",value:function(t){o(a(t),"url parameter is invalid: "+t),this._spid=new f({serverUrl:c(t,l.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){o(a(t),"url parameter is invalid: "+t),this._bff=new p({serverUrl:c(t,l.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(t){var e=t.paylink,r=t.preferPopup,n=t.redirectUri,i=void 0===n?this.redirectUri:n;o(u(i),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(e,i);return r&&(this.popup=h.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return o(u(t),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:t})}},{key:"redeemUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:t})}},{key:"purchasePaylinkUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:t,redirect_uri:e})}},{key:"purchaseProductFlowUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:t,redirect_uri:e})}},{key:"purchaseCampaignFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return o(u(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:t,product_id:e,voucher_code:r,redirect_uri:n})}}]),t}();t.exports=y},function(t,e,r){"use strict";t.exports=r(11)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var o=r(0),s=o.assert,u=o.isStr,a=o.isNonEmptyString,c=o.isUrl,l=r(3).urlMapper,f=r(2).ENDPOINTS,h=r(10),p=r(7),d=r(9),v=r(5),y=window,m=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,o=void 0===i?"PRE":i,u=t.window,c=void 0===u?y:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var l=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return v.emulate(c),s(a(r),"clientId parameter is required"),l.cache=new d(c&&c.sessionStorage),l.clientId=r,l.redirectUri=n,l._setSpidServerUrl(o),l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,h),n(e,[{key:"_setSpidServerUrl",value:function(t){s(u(t),"url parameter is invalid: "+t),this._spid=new p({serverUrl:l(t,f.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var t=i(regeneratorRuntime.mark(function t(e,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="prd_"+e,!(i=this.cache.get(n))){t.next=4;break}return t.abrupt("return",i);case 4:return o={product_id:e},void 0!==r&&(o.sp_id=r),t.next=8,this._spid.get("ajax/hasproduct.js",o);case 8:if((s=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||0),this.cache.set(n,s,u),this.emit("hasProduct",{productId:e,data:s}),t.abrupt("return",s);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var t=i(regeneratorRuntime.mark(function t(e,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="sub_"+e,!(i=this.cache.get(n))){t.next=4;break}return t.abrupt("return",i);case 4:return o={product_id:e},void 0!==r&&(o.sp_id=r),t.next=8,this._spid.get("ajax/hassubscription.js",o);case 8:if((s=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||0),this.cache.set(n,s,u),this.emit("hasSubscription",{subscriptionId:e,data:s}),t.abrupt("return",s);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return s(c(t),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:t})}},{key:"productsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return s(c(t),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:t})}}]),e}();t.exports=m},function(t,e,r){"use strict";t.exports=r(13)},function(t,e,r){"use strict";var n,i,o;i=[e,t],void 0===(o="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function i(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=t,s=e.timeout||r.timeout,u=e.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+u+"="+l),e.charset&&h.setAttribute("charset",e.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+t+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+t+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(e,i):n)||(t.exports=o)},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var u=r(0),a=u.assert,c=u.isStr,l=u.isNonEmptyString,f=u.isObject,h=u.isUrl,p=u.isStrIn,d=r(4).cloneDeep,v=r(3).urlMapper,y=r(2).ENDPOINTS,m=r(10),b=r(7),g=r(9),w=r(8),_=r(6),S=r(1),k=r(5),U=window;var x=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,o=void 0===i?"PRE":i,s=t.log,u=t.window,c=void 0===u?U:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var p=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return a(l(r),"clientId parameter is required"),a(f(c),"The reference to window is missing"),a(!n||h(n),"redirectUri parameter is invalid"),k.emulate(c),p._sessionInitiatedSent=!1,p.window=c,p.clientId=r,p.cache=new g(c&&c.localStorage),p.redirectUri=n,p.log=s,p._enableSessionCaching=!0,p._session={},p._setSpidServerUrl(o),p._setBffServerUrl(o),p._setOauthServerUrl(o),p._setHasSessionServerUrl(o),p}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,m),i(e,[{key:"_setSpidServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._spid=new b({serverUrl:v(t,y.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._oauthService=new _({serverUrl:v(t,y.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._bffService=new _({serverUrl:v(t,y.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._hasSession=new b({serverUrl:v(t,y.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(t,e){e.visitor&&this.emit("visitor",e.visitor),e.userId&&this.emit("login",e),t.userId&&!e.userId&&this.emit("logout",e),t.userId&&e.userId&&t.userId!==e.userId&&this.emit("userChange",e),t.userId||e.userId?this.emit("sessionChange",e):this.emit("notLoggedin",e),e.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",e)),t.userStatus!==e.userStatus&&this.emit("statusChange",e)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0}},{key:"_maybeSetVarnishCookie",value:function(t){if(this.setVarnishCookie){var e=new Date;"number"==typeof t.expiresIn&&t.expiresIn>0?e.setTime(e.getTime()+1e3*t.expiresIn):e.setTime(0),"string"!=typeof t.baseDomain&&(t.baseDomain=document.domain);var r=["SP_ID="+t.sp_id,"expires="+e.toUTCString(),"path=/","domain=."+t.baseDomain].join("; ");document.cookie=r}}},{key:"hasSession",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e,r,i,s,u,a,c=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"==typeof c){t.next=3;break}throw e=null===(l=c)?[void 0===l?"undefined":o(l),""+l]:[l.constructor.name,l.valueOf()],r=n(e,2),i=r[0],s=r[1],new S("Parameter 'autologin' must be boolean, was: \""+i+":"+s+'"');case 3:if(!this._enableSessionCaching){t.next=7;break}if(!(u=this.cache.get("hasSession-cache"))){t.next=7;break}return t.abrupt("return",u);case 7:return t.prev=7,t.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:c?1:0});case 10:if(a=t.sent,!f(a.error)||"LoginException"!==a.error.type){t.next=15;break}return t.next=14,this._spid.get("ajax/hasSession.js",{autologin:c?1:0});case 14:a=t.sent;case 15:if(a.result&&this.cache.set("hasSession-cache",a,1e3*a.expiresIn),!a.error){t.next=18;break}throw new S("HasSession endpoint returned an error",a.error);case 18:return this._maybeSetVarnishCookie(a),this._emitSessionEvent(this._session,a),this._session=a,t.abrupt("return",a);case 24:throw t.prev=24,t.t0=t.catch(7),this.emit("error",t.t0),new S("HasSession failed",t.t0);case 28:case"end":return t.stop()}var l},t,this,[[7,24]])}));return function(){return t.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return","result"in e);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"isConnected",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",!!e.result);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"getUser",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,f(e)){t.next=5;break}throw new S("Could not get the user. Maybe not logged in to Schibsted?");case 5:if(e.result){t.next=7;break}throw new S("The user is not connected to this merchant");case 7:return t.abrupt("return",d(e));case 8:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,!f(e)){t.next=5;break}return t.abrupt("return",e.userId);case 5:throw new S("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserUuidId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(e=t.sent,!f(e)){t.next=5;break}return t.abrupt("return",e.uuid);case 5:throw new S("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){return this.hasSession().then(function(t){return t.visitor.uid}).catch(function(t){if(t.response&&t.response.visitor)return t.response.visitor.uid;throw t.error})}},{key:"getSpId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",e.sp_id);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",void 0);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"login",value:function(t){var e=t.acrValues,r=t.state,n=t.scope,i=void 0===n?"openid":n,o=t.redirectUri,s=void 0===o?this.redirectUri:o,u=t.preferPopup,a=void 0!==u&&u,c=t.newFlow,l=void 0===c||c,f=t.loginHint,h=void 0===f?"":f;this._closePopup();var p=this.loginUrl(r,e,i,s,l,h);return a&&(this.popup=w.open(this.window,p,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=p,null)}},{key:"logout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;a(h(e),"logout(): redirectUri must be a valid url but is "+e);var r=function(t){return t.then(function(){return!0},function(){return!1})};return Promise.all([r(this._spid.get("ajax/logout.js",{redirect_uri:e})),r(this._bffService.get("api/identity/logout"))]).then(function(e){var r=n(e,2),i=r[0],o=r[1];if(!i&&!o){var s=new S("Could not log out from any endpoint");throw t.emit("error",s),s}t.cache.delete("hasSession-cache"),t.emit("logout")})}},{key:"loginUrl",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"openid",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";return a(!e||p(e,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+e),a(h(n),"loginUrl(): redirectUri must be a valid url but is "+n),a(l(t),"the state parameter should be a non empty string but it is "+t),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:t,acr_values:e,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:t,email:o})}},{key:"logoutUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:t})}},{key:"accountUrl",value:function(){return this._spid.makeUrl("account/summary")}},{key:"phonesUrl",value:function(){return this._spid.makeUrl("account/phones")}},{key:"agreementUrl",value:function(){return this._spid.makeUrl("ajax/acceptAgreement.js")}},{key:"authFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:t})}},{key:"signupFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:t})}},{key:"signinFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:t})}}]),e}();t.exports=x},function(t,e,r){"use strict";t.exports=r(16)},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===e(t),f=r.regeneratorRuntime;if(f)l&&(t.exports=f);else{(f=r.regeneratorRuntime=l?t.exports:{}).wrap=_;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={},m={};m[u]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,u)&&(m=g);var w=x.prototype=k.prototype=Object.create(m);U.prototype=w.constructor=x,x.constructor=U,x[c]=U.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===U||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},O(P.prototype),P.prototype[a]=function(){return this},f.AsyncIterator=P,f.async=function(t,e,r,n){var i=new P(_(t,e,r,n));return f.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,T.prototype={constructor:T,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return u.type="throw",u.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(a&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(t,e,r,n){var i=e&&e.prototype instanceof k?e:k,o=Object.create(i.prototype),s=new T(n||[]);return o._invoke=function(t,e,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return N()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var u=j(s,r);if(u){if(u===y)continue;return u}}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=d;var a=S(t,e,r);if("normal"===a.type){if(n=r.done?v:p,a.arg===y)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n=v,r.method="throw",r.arg=a.arg)}}}(t,r,s),o}function S(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function k(){}function U(){}function x(){}function O(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function P(t){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,u){var a=S(t[n],t,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":e(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,s,u)},function(t){r("throw",t,s,u)}):Promise.resolve(l).then(function(t){c.value=t,s(c)},u)}u(a.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function j(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,j(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,y;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,y):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(o.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return i.next=i}}return{next:N}}function N(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(18)(t))},function(t,e,r){"use strict";r(19);var n=r(17),i=r(14),o=r(12);t.exports={Identity:n,Monetization:i,Payment:o}}]);
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=20)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1);function o(t){return"string"==typeof t}function s(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new i(e)},isObject:s,isNonEmptyObj:function(t){return s(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!o(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return o(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:o,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var s=["boolean","number","string"],u=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o(Error)),i(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&s.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=u},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(0),o=i.assert,s=i.isNonEmptyString,u=i.isUrl,a=i.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(u(t,"hostname"))return t;o(s(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),o(a(e),"urlMap must be an object");var r=e[t];return o(u(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=r(0),s=o.assert,u=o.isObject,a=o.isNonEmptyObj,c=r(1);function l(t){return s("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new c("No objects to clone");return r.forEach(function(e){s(u(e)),a(e)&&Object.entries(e).forEach(function(e){var r=i(e,2),n=r[0],o=r[1];void 0!==o&&(t[n]=u(o)?l(o):o)})}),t},cloneDeep:l}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),i(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(1),o=r(4).cloneDefined,s=r(3).urlMapper,u=r(0),a=u.assert,c=u.isObject,l=u.isFunction,f=u.isStr,h=u.isNonEmptyString,p=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return c(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function d(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var v=window.fetch,y=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,i=e.envDic,o=e.fetch,u=void 0===o?v:o,f=e.log,h=e.defaultParams,p=void 0===h?{}:h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),a(c(p),"defaultParams should be a non-null object"),this.url=new URL(s(n,i)),this.defaultParams=p,f&&(a(l(f),"log must be a function but it is "+f),this.log=f),u&&(a(l(u),"Fetch should be a function"),this.fetch=u)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,s,u,d=e.method,v=e.headers,y=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,_=e.fetchOptions,S=void 0===_?{method:d,credentials:"include"}:_;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a(l(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),a(h(d),'Method must be a non empty string but it is "'+d+'"'),a(h(y),'Pathname must be string but it is "'+y+'"'),a(c(b),"data must be a non-null object"),S.headers=c(v)?o(v):{},r=this.makeUrl(y,b,w),p(this.log,"Request:",S.method.toUpperCase(),r),p(this.log,"Request Headers:",S.headers),p(this.log,"Request Body:",S.body),t.prev=9,t.next=12,this.fetch(r,S);case 12:if(n=t.sent,p(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new i(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return s=t.sent,p(this.log,"Response Parsed:",s),t.abrupt("return",s);case 23:throw t.prev=23,t.t0=t.catch(9),u=f(t.t0)?t.t0:"Unknown RESTClient error",c(t.t0)&&f(t.t0.message)&&(u=t.t0.message),new i("Failed to '"+d+"' '"+r+"': '"+u+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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(e,this.url);return i.search=t.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?o(r,t):o(t);return Object.keys(n).map(function(t){return d(t)+"="+d(n[t])}).join("&")}}]),t}();t.exports=y},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(4).cloneDefined,o=r(6),s=r(2),u=r(15),a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,i({fetch:u},t)));return r.timeout=t.timeout?Number(t.timeout):s.JSONP.TIMEOUT,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,o),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=a},function(t,e,r){"use strict";var n=r(0),i=n.assert,o=n.isObject,s=n.isUrl,u=r(4).cloneDefined;var a={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"};t.exports={open:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments[3];i(o(t),"window was supposed to be an object but it is "+t),i(s(e),"Invalid URL for popup");var c=t.screen,l=c.height,f=c.width,h=u(a,n);Number.isFinite(h.width)&&Number.isFinite(f)&&(h.left=(f-h.width)/2),Number.isFinite(h.height)&&Number.isFinite(l)&&(h.top=(l-h.height)/2);var p,d=(i(o(p=h),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(t){return t+"="+p[t]}).join(","));return t.open(e,r,d)}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=r(1);var s=function t(e){var r=this;i(this,t),this.store=e,this.get=function(t){return r.store.getItem(t)},this.set=function(t,e){return r.store.setItem(t,e)},this.delete=function(t){return r.store.removeItem(t)}},u=function t(){var e=this;i(this,t),this.store={},this.get=function(t){return e.store[t]},this.set=function(t,r){return e.store[t]=r},this.delete=function(t){return delete e.store[t]}},a=function(){function t(e){i(this,t),!function(t){if(!t)return!1;try{var e="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(e,"TEST-VALUE");var r=t.getItem(e);return t.removeItem(e),"TEST-VALUE"===r}catch(t){return!1}}(e)?(this.cache=new u,this.type="ObjectLiteralStorage"):(this.cache=new s(e),this.type="WebStorage")}return n(t,[{key:"get",value:function(t){try{var e=this.cache.get(t),r=e?JSON.parse(e):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(t),null)}catch(t){throw new o(t)}}},{key:"set",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(t,JSON.stringify({expiresOn:i,value:e})),setTimeout(function(){return r.delete(t)},n)}catch(t){throw new o(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new o(t)}}}]),t}();t.exports=a},function(t,e,r){"use strict";function n(){}n.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function i(){n.off(t,i),e.apply(r,arguments)}return i._=e,this.on(t,i,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],i=[];if(n&&e)for(var o=0,s=n.length;o<s;o++)n[o].fn!==e&&n[o].fn._!==e&&i.push(n[o]);return i.length?r[t]=i:delete r[t],this}},t.exports=n},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i=r(0),o=i.assert,s=i.isNonEmptyString,u=i.isUrl,a=i.isStr,c=r(3).urlMapper,l=r(2).ENDPOINTS,f=r(7),h=r(8),p=r(6),d=r(5),v=window,y=function(){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,u=void 0===i?"PRE":i,a=e.window,c=void 0===a?v:a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),d.emulate(c),o(s(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=c,this._setSpidServerUrl(u),this._setBffServerUrl(u)}return n(t,[{key:"_setSpidServerUrl",value:function(t){o(a(t),"url parameter is invalid: "+t),this._spid=new f({serverUrl:c(t,l.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){o(a(t),"url parameter is invalid: "+t),this._bff=new p({serverUrl:c(t,l.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(t){var e=t.paylink,r=t.preferPopup,n=t.redirectUri,i=void 0===n?this.redirectUri:n;o(u(i),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(e,i);return r&&(this.popup=h.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return o(u(t),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:t})}},{key:"redeemUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:t})}},{key:"purchasePaylinkUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:t,redirect_uri:e})}},{key:"purchaseProductFlowUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return o(u(e),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:t,redirect_uri:e})}},{key:"purchaseCampaignFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return o(u(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:t,product_id:e,voucher_code:r,redirect_uri:n})}}]),t}();t.exports=y},function(t,e,r){"use strict";t.exports=r(11)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var o=r(0),s=o.assert,u=o.isStr,a=o.isNonEmptyString,c=o.isUrl,l=r(3).urlMapper,f=r(2).ENDPOINTS,h=r(10),p=r(7),d=r(9),v=r(5),y=window,m=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,o=void 0===i?"PRE":i,u=t.window,c=void 0===u?y:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var l=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return v.emulate(c),s(a(r),"clientId parameter is required"),l.cache=new d(c&&c.sessionStorage),l.clientId=r,l.redirectUri=n,l._setSpidServerUrl(o),l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,h),n(e,[{key:"_setSpidServerUrl",value:function(t){s(u(t),"url parameter is invalid: "+t),this._spid=new p({serverUrl:l(t,f.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var t=i(regeneratorRuntime.mark(function t(e,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="prd_"+e+"_"+r,!(i=this.cache.get(n))){t.next=4;break}return t.abrupt("return",i);case 4:return o={product_id:e},r&&(o.sp_id=r),t.next=8,this._spid.get("ajax/hasproduct.js",o);case 8:if((s=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||30),this.cache.set(n,s,u),this.emit("hasProduct",{productId:e,data:s}),t.abrupt("return",s);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var t=i(regeneratorRuntime.mark(function t(e,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="sub_"+e+"_"+r,!(i=this.cache.get(n))){t.next=4;break}return t.abrupt("return",i);case 4:return o={product_id:e},r&&(o.sp_id=r),t.next=8,this._spid.get("ajax/hassubscription.js",o);case 8:if((s=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||30),this.cache.set(n,s,u),this.emit("hasSubscription",{subscriptionId:e,data:s}),t.abrupt("return",s);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return s(c(t),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:t})}},{key:"productsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return s(c(t),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:t})}}]),e}();t.exports=m},function(t,e,r){"use strict";t.exports=r(13)},function(t,e,r){"use strict";var n,i,o;i=[e,t],void 0===(o="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function i(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=t,s=e.timeout||r.timeout,u=e.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+u+"="+l),e.charset&&h.setAttribute("charset",e.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+t+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+t+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(e,i):n)||(t.exports=o)},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var s=e[i](o),u=s.value}catch(t){return void r(t)}if(!s.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}("next")})}}var u=r(0),a=u.assert,c=u.isStr,l=u.isNonEmptyString,f=u.isObject,h=u.isUrl,p=u.isStrIn,d=r(4).cloneDeep,v=r(3).urlMapper,y=r(2).ENDPOINTS,m=r(10),b=r(7),g=r(9),w=r(8),_=r(6),S=r(1),k=r(5),U=window;var x=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,o=void 0===i?"PRE":i,s=t.log,u=t.window,c=void 0===u?U:u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var p=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return a(l(r),"clientId parameter is required"),a(f(c),"The reference to window is missing"),a(!n||h(n),"redirectUri parameter is invalid"),k.emulate(c),p._sessionInitiatedSent=!1,p.window=c,p.clientId=r,p._initCache(),p.redirectUri=n,p.log=s,p._enableSessionCaching=!0,p._session={},p._setSpidServerUrl(o),p._setBffServerUrl(o),p._setOauthServerUrl(o),p._setHasSessionServerUrl(o),p}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,m),i(e,[{key:"_setSpidServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._spid=new b({serverUrl:v(t,y.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._oauthService=new _({serverUrl:v(t,y.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._bffService=new _({serverUrl:v(t,y.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(t){a(c(t),"url parameter is invalid: "+t),this._hasSession=new b({serverUrl:v(t,y.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(t,e){e.visitor&&this.emit("visitor",e.visitor),e.userId&&this.emit("login",e),t.userId&&!e.userId&&this.emit("logout",e),t.userId&&e.userId&&t.userId!==e.userId&&this.emit("userChange",e),t.userId||e.userId?this.emit("sessionChange",e):this.emit("notLoggedin",e),e.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",e)),t.userStatus!==e.userStatus&&this.emit("statusChange",e)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new g(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(t){if(this.setVarnishCookie){var e=new Date;"number"==typeof t.expiresIn&&t.expiresIn>0?e.setTime(e.getTime()+1e3*t.expiresIn):e.setTime(0);var r="string"==typeof t.baseDomain?t.baseDomain:document.domain||"",n=["SP_ID="+t.sp_id,"expires="+e.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e,r,i,s,u,a,c=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"==typeof c){t.next=3;break}throw e=null===(l=c)?[void 0===l?"undefined":o(l),""+l]:[l.constructor.name,l.valueOf()],r=n(e,2),i=r[0],s=r[1],new S("Parameter 'autologin' must be boolean, was: \""+i+":"+s+'"');case 3:if(!this._enableSessionCaching){t.next=7;break}if(!(u=this.cache.get("hasSession-cache"))){t.next=7;break}return t.abrupt("return",u);case 7:return t.prev=7,t.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:c?1:0});case 10:if(a=t.sent,!f(a.error)||"LoginException"!==a.error.type){t.next=15;break}return t.next=14,this._spid.get("ajax/hasSession.js",{autologin:c?1:0});case 14:a=t.sent;case 15:if(a.result&&this.cache.set("hasSession-cache",a,1e3*a.expiresIn),!a.error){t.next=18;break}throw new S("HasSession endpoint returned an error",a.error);case 18:return this._maybeSetVarnishCookie(a),this._emitSessionEvent(this._session,a),this._session=a,t.abrupt("return",a);case 24:throw t.prev=24,t.t0=t.catch(7),this.emit("error",t.t0),new S("HasSession failed",t.t0);case 28:case"end":return t.stop()}var l},t,this,[[7,24]])}));return function(){return t.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return","result"in e);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"isConnected",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",!!e.result);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"getUser",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if((e=t.sent).result){t.next=5;break}throw new S("The user is not connected to this merchant");case 5:return t.abrupt("return",d(e));case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).userId){t.next=5;break}return t.abrupt("return",e.userId);case 5:throw new S("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).uuid){t.next=5;break}return t.abrupt("return",e.uuid);case 5:throw new S("The user is not connected to this merchant");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.hasSession();case 2:if(!(e=t.sent).visitor||!e.visitor.uid){t.next=5;break}return t.abrupt("return",e.visitor.uid);case 5:throw new S("No visitor id available for this user");case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"getSpId",value:function(){var t=s(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.hasSession();case 3:return e=t.sent,t.abrupt("return",e.sp_id||null);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",null);case 10:case"end":return t.stop()}},t,this,[[0,7]])}));return function(){return t.apply(this,arguments)}}()},{key:"login",value:function(t){var e=t.acrValues,r=t.state,n=t.scope,i=void 0===n?"openid":n,o=t.redirectUri,s=void 0===o?this.redirectUri:o,u=t.preferPopup,a=void 0!==u&&u,c=t.newFlow,l=void 0===c||c,f=t.loginHint,h=void 0===f?"":f;this._closePopup();var p=this.loginUrl(r,e,i,s,l,h);return a&&(this.popup=w.open(this.window,p,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=p,null)}},{key:"logout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;a(h(e),"logout(): redirectUri must be a valid url but is "+e);var r=function(t){return t.then(function(){return!0},function(){return!1})};return Promise.all([r(this._spid.get("ajax/logout.js",{redirect_uri:e})),r(this._bffService.get("api/identity/logout"))]).then(function(e){var r=n(e,2),i=r[0],o=r[1];if(!i&&!o){var s=new S("Could not log out from any endpoint");throw t.emit("error",s),s}t.cache.delete("hasSession-cache"),t.emit("logout")})}},{key:"loginUrl",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"openid",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";return a(!e||p(e,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+e),a(h(n),"loginUrl(): redirectUri must be a valid url but is "+n),a(l(t),"the state parameter should be a non empty string but it is "+t),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:t,acr_values:e,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:t,email:o})}},{key:"logoutUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:t})}},{key:"accountUrl",value:function(){return this._spid.makeUrl("account/summary")}},{key:"phonesUrl",value:function(){return this._spid.makeUrl("account/phones")}},{key:"agreementUrl",value:function(){return this._spid.makeUrl("ajax/acceptAgreement.js")}},{key:"authFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:t})}},{key:"signupFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:t})}},{key:"signinFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return a(h(t),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:t})}}]),e}();t.exports=x},function(t,e,r){"use strict";t.exports=r(16)},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===e(t),f=r.regeneratorRuntime;if(f)l&&(t.exports=f);else{(f=r.regeneratorRuntime=l?t.exports:{}).wrap=_;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={},m={};m[u]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==i&&o.call(g,u)&&(m=g);var w=x.prototype=k.prototype=Object.create(m);U.prototype=w.constructor=x,x.constructor=U,x[c]=U.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===U||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},O(P.prototype),P.prototype[a]=function(){return this},f.AsyncIterator=P,f.async=function(t,e,r,n){var i=new P(_(t,e,r,n));return f.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},O(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,T.prototype={constructor:T,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return u.type="throw",u.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],u=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(a&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(t,e,r,n){var i=e&&e.prototype instanceof k?e:k,o=Object.create(i.prototype),s=new T(n||[]);return o._invoke=function(t,e,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return N()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var u=j(s,r);if(u){if(u===y)continue;return u}}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=d;var a=S(t,e,r);if("normal"===a.type){if(n=r.done?v:p,a.arg===y)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n=v,r.method="throw",r.arg=a.arg)}}}(t,r,s),o}function S(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function k(){}function U(){}function x(){}function O(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function P(t){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,u){var a=S(t[n],t,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":e(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,s,u)},function(t){r("throw",t,s,u)}):Promise.resolve(l).then(function(t){c.value=t,s(c)},u)}u(a.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function j(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,j(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,y;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,y):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(o.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return i.next=i}}return{next:N}}function N(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(18)(t))},function(t,e,r){"use strict";r(19);var n=r(17),i=r(14),o=r(12);t.exports={Identity:n,Monetization:i,Payment:o}}]);
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=14)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(1);function i(t){return"string"==typeof t}function u(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new o(e)},isObject:u,isNonEmptyObj:function(t){return u(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!i(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return i(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:i,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var u=["boolean","number","string"],a=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(o,r),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i(Error)),o(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&u.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=a},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),u=i.assert,a=i.isObject,c=i.isNonEmptyObj,s=r(1);function f(t){return u("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new s("No objects to clone");return r.forEach(function(e){u(a(e)),c(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=a(i)?f(i):i)})}),t},cloneDeep:f}},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0),i=o.assert,u=o.isNonEmptyString,a=o.isUrl,c=o.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(a(t,"hostname"))return t;i(u(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),i(c(e),"urlMap must be an object");var r=e[t];return i(a(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),o(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(1);var u=function t(e){var r=this;o(this,t),this.store=e,this.get=function(t){return r.store.getItem(t)},this.set=function(t,e){return r.store.setItem(t,e)},this.delete=function(t){return r.store.removeItem(t)}},a=function t(){var e=this;o(this,t),this.store={},this.get=function(t){return e.store[t]},this.set=function(t,r){return e.store[t]=r},this.delete=function(t){return delete e.store[t]}},c=function(){function t(e){o(this,t),!function(t){if(!t)return!1;try{var e="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(e,"TEST-VALUE");var r=t.getItem(e);return t.removeItem(e),"TEST-VALUE"===r}catch(t){return!1}}(e)?(this.cache=new a,this.type="ObjectLiteralStorage"):(this.cache=new u(e),this.type="WebStorage")}return n(t,[{key:"get",value:function(t){try{var e=this.cache.get(t),r=e?JSON.parse(e):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(t),null)}catch(t){throw new i(t)}}},{key:"set",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var o=Math.floor(Date.now()+n);this.cache.set(t,JSON.stringify({expiresOn:o,value:e})),setTimeout(function(){return r.delete(t)},n)}catch(t){throw new i(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new i(t)}}}]),t}();t.exports=c},function(t,e,r){"use strict";var n,o,i;o=[e,t],void 0===(i="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t,u=e.timeout||r.timeout,a=e.jsonpCallback||r.jsonpCallback,c=void 0;return new Promise(function(r,s){var f=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),l=a+"_"+f;window[f]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),c&&clearTimeout(c),o(l),n(f)},i+=-1===i.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+i+a+"="+f),e.charset&&h.setAttribute("charset",e.charset),h.id=l,document.getElementsByTagName("head")[0].appendChild(h),c=setTimeout(function(){s(new Error("JSONP request to "+t+" timed out")),n(f),o(l),window[f]=function(){n(f)}},u),h.onerror=function(){s(new Error("JSONP request to "+t+" failed")),n(f),o(l),c&&clearTimeout(c)}})}})?n.apply(e,o):n)||(t.exports=i)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(1),i=r(2).cloneDefined,u=r(4).urlMapper,a=r(0),c=a.assert,s=a.isObject,f=a.isFunction,l=a.isStr,h=a.isNonEmptyString,p=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return s(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function y(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var d=window.fetch,v=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,a=void 0===i?d:i,l=e.log,h=e.defaultParams,p=void 0===h?{}:h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),c(s(p),"defaultParams should be a non-null object"),this.url=new URL(u(n,o)),this.defaultParams=p,void 0!==l&&(c(f(l),"log must be a function but it is "+l),this.log=l),void 0!==a&&(c(f(a),"Fetch should be a function"),this.fetch=a)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,u,a,y=e.method,d=e.headers,v=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,O=e.fetchOptions,S=void 0===O?{method:y,credentials:"include"}:O;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return c(f(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),c(h(y),'Method must be a non empty string but it is "'+y+'"'),c(h(v),'Pathname must be string but it is "'+v+'"'),c(s(b),"data must be a non-null object"),S.headers=s(d)?i(d):{},r=this.makeUrl(v,b,w),p(this.log,"Request:",S.method.toUpperCase(),r),p(this.log,"Request Headers:",S.headers),p(this.log,"Request Body:",S.body),t.prev=9,t.next=12,this.fetch(r,S);case 12:if(n=t.sent,p(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new o(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return u=t.sent,p(this.log,"Response Parsed:",u),t.abrupt("return",u);case 23:throw t.prev=23,t.t0=t.catch(9),a=l(t.t0)?t.t0:"Unknown RESTClient error",s(t.t0)&&l(t.t0.message)&&(a=t.t0.message),new o("Failed to '"+y+"' '"+r+"': '"+a+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var u=e[o](i),a=u.value}catch(t){return void r(t)}if(!u.done)return Promise.resolve(a).then(function(t){n("next",t)},function(t){n("throw",t)});t(a)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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],o=new URL(e,this.url);return o.search=t.search(r,n,this.defaultParams),o.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?i(r,t):i(t);return Object.keys(n).map(function(t){return y(t)+"="+y(n[t])}).join("&")}}]),t}();t.exports=v},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(2).cloneDefined,i=r(8),u=r(3),a=r(7),c=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,o({fetch:a},t)));return r.timeout=void 0===t.timeout?u.JSONP.TIMEOUT:Number(t.timeout),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var u=o.get;return void 0!==u?u.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=c},function(t,e,r){"use strict";function n(){}n.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function o(){n.off(t,o),e.apply(r,arguments)}return o._=e,this.on(t,o,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,o=r.length;n<o;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],o=[];if(n&&e)for(var i=0,u=n.length;i<u;i++)n[i].fn!==e&&n[i].fn._!==e&&o.push(n[i]);return o.length?r[t]=o:delete r[t],this}},t.exports=n},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var u=e[o](i),a=u.value}catch(t){return void r(t)}if(!u.done)return Promise.resolve(a).then(function(t){n("next",t)},function(t){n("throw",t)});t(a)}("next")})}}var i=r(0),u=i.assert,a=i.isStr,c=i.isNonEmptyString,s=i.isUrl,f=r(4).urlMapper,l=r(3).ENDPOINTS,h=r(10),p=r(9),y=r(6),d=r(5),v=window,m=function(t){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,i=void 0===o?"PRE":o,a=t.window,s=void 0===a?v:a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var f=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return d.emulate(s),u(c(r),"clientId parameter is required"),f.cache=new y(s&&s.sessionStorage),f.clientId=r,f.redirectUri=n,f._setSpidServerUrl(i),f}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,h),n(e,[{key:"_setSpidServerUrl",value:function(t){u(a(t),"url parameter is invalid: "+t),this._spid=new p({serverUrl:f(t,l.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var t=o(regeneratorRuntime.mark(function t(e,r){var n,o,i,u,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="prd_"+e,!(o=this.cache.get(n))){t.next=4;break}return t.abrupt("return",o);case 4:return i={product_id:e},void 0!==r&&(i.sp_id=r),t.next=8,this._spid.get("ajax/hasproduct.js",i);case 8:if((u=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return a=1e3*(u.expiresIn||0),this.cache.set(n,u,a),this.emit("hasProduct",{productId:e,data:u}),t.abrupt("return",u);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var t=o(regeneratorRuntime.mark(function t(e,r){var n,o,i,u,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="sub_"+e,!(o=this.cache.get(n))){t.next=4;break}return t.abrupt("return",o);case 4:return i={product_id:e},void 0!==r&&(i.sp_id=r),t.next=8,this._spid.get("ajax/hassubscription.js",i);case 8:if((u=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return a=1e3*(u.expiresIn||0),this.cache.set(n,u,a),this.emit("hasSubscription",{subscriptionId:e,data:u}),t.abrupt("return",u);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return u(s(t),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:t})}},{key:"productsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return u(s(t),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:t})}}]),e}();t.exports=m},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,o=Object.prototype,i=o.hasOwnProperty,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag",f="object"===e(t),l=r.regeneratorRuntime;if(l)f&&(t.exports=l);else{(l=r.regeneratorRuntime=f?t.exports:{}).wrap=O;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(U([])));g&&g!==o&&i.call(g,a)&&(m=g);var w=P.prototype=x.prototype=Object.create(m);j.prototype=w.constructor=P,P.constructor=j,P[s]=j.displayName="GeneratorFunction",l.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===j||"GeneratorFunction"===(e.displayName||e.name))},l.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,P):(t.__proto__=P,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(w),t},l.awrap=function(t){return{__await:t}},_(E.prototype),E.prototype[c]=function(){return this},l.AsyncIterator=E,l.async=function(t,e,r,n){var o=new E(O(t,e,r,n));return l.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},_(w),w[s]="Generator",w[a]=function(){return this},w.toString=function(){return"[object Generator]"},l.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},l.values=U,N.prototype={constructor:N,reset:function(t){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(T),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,o){return a.type="throw",a.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var u=this.tryEntries[o],a=u.completion;if("root"===u.tryLoc)return r("end");if(u.tryLoc<=this.prev){var c=i.call(u,"catchLoc"),s=i.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc)return r(u.catchLoc,!0);if(this.prev<u.finallyLoc)return r(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return r(u.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return r(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:U(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function O(t,e,r,n){var o=e&&e.prototype instanceof x?e:x,i=Object.create(o.prototype),u=new N(n||[]);return i._invoke=function(t,e,r){var n=h;return function(o,i){if(n===y)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=k(u,r);if(a){if(a===v)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=y;var c=S(t,e,r);if("normal"===c.type){if(n=r.done?d:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=d,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function S(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function x(){}function j(){}function P(){}function _(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function E(t){var r;this._invoke=function(n,o){function u(){return new Promise(function(r,u){!function r(n,o,u,a){var c=S(t[n],t,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"===(void 0===f?"undefined":e(f))&&i.call(f,"__await")?Promise.resolve(f.__await).then(function(t){r("next",t,u,a)},function(t){r("throw",t,u,a)}):Promise.resolve(f).then(function(t){s.value=t,u(s)},a)}a(c.arg)}(n,o,r,u)})}return r=r?r.then(u,u):u()}}function k(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,k(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=S(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function U(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(12)(t))},function(t,e,r){"use strict";r(13),t.exports=r(11)}]);
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=14)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(1);function i(t){return"string"==typeof t}function u(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new o(e)},isObject:u,isNonEmptyObj:function(t){return u(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!i(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return i(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:i,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var u=["boolean","number","string"],a=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(o,r),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i(Error)),o(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&u.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=a},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),u=i.assert,a=i.isObject,c=i.isNonEmptyObj,s=r(1);function f(t){return u("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new s("No objects to clone");return r.forEach(function(e){u(a(e)),c(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=a(i)?f(i):i)})}),t},cloneDeep:f}},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0),i=o.assert,u=o.isNonEmptyString,a=o.isUrl,c=o.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(a(t,"hostname"))return t;i(u(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),i(c(e),"urlMap must be an object");var r=e[t];return i(a(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),o(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r(1);var u=function t(e){var r=this;o(this,t),this.store=e,this.get=function(t){return r.store.getItem(t)},this.set=function(t,e){return r.store.setItem(t,e)},this.delete=function(t){return r.store.removeItem(t)}},a=function t(){var e=this;o(this,t),this.store={},this.get=function(t){return e.store[t]},this.set=function(t,r){return e.store[t]=r},this.delete=function(t){return delete e.store[t]}},c=function(){function t(e){o(this,t),!function(t){if(!t)return!1;try{var e="x-x-x-x".replace(/x/g,function(){return Math.random()});t.setItem(e,"TEST-VALUE");var r=t.getItem(e);return t.removeItem(e),"TEST-VALUE"===r}catch(t){return!1}}(e)?(this.cache=new a,this.type="ObjectLiteralStorage"):(this.cache=new u(e),this.type="WebStorage")}return n(t,[{key:"get",value:function(t){try{var e=this.cache.get(t),r=e?JSON.parse(e):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(t),null)}catch(t){throw new i(t)}}},{key:"set",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var o=Math.floor(Date.now()+n);this.cache.set(t,JSON.stringify({expiresOn:o,value:e})),setTimeout(function(){return r.delete(t)},n)}catch(t){throw new i(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new i(t)}}}]),t}();t.exports=c},function(t,e,r){"use strict";var n,o,i;o=[e,t],void 0===(i="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t,u=e.timeout||r.timeout,a=e.jsonpCallback||r.jsonpCallback,c=void 0;return new Promise(function(r,s){var f=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),l=a+"_"+f;window[f]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),c&&clearTimeout(c),o(l),n(f)},i+=-1===i.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+i+a+"="+f),e.charset&&h.setAttribute("charset",e.charset),h.id=l,document.getElementsByTagName("head")[0].appendChild(h),c=setTimeout(function(){s(new Error("JSONP request to "+t+" timed out")),n(f),o(l),window[f]=function(){n(f)}},u),h.onerror=function(){s(new Error("JSONP request to "+t+" failed")),n(f),o(l),c&&clearTimeout(c)}})}})?n.apply(e,o):n)||(t.exports=i)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(1),i=r(2).cloneDefined,u=r(4).urlMapper,a=r(0),c=a.assert,s=a.isObject,f=a.isFunction,l=a.isStr,h=a.isNonEmptyString,p=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return s(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function y(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var d=window.fetch,v=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,a=void 0===i?d:i,l=e.log,h=e.defaultParams,p=void 0===h?{}:h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),c(s(p),"defaultParams should be a non-null object"),this.url=new URL(u(n,o)),this.defaultParams=p,l&&(c(f(l),"log must be a function but it is "+l),this.log=l),a&&(c(f(a),"Fetch should be a function"),this.fetch=a)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,u,a,y=e.method,d=e.headers,v=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,O=e.fetchOptions,S=void 0===O?{method:y,credentials:"include"}:O;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return c(f(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),c(h(y),'Method must be a non empty string but it is "'+y+'"'),c(h(v),'Pathname must be string but it is "'+v+'"'),c(s(b),"data must be a non-null object"),S.headers=s(d)?i(d):{},r=this.makeUrl(v,b,w),p(this.log,"Request:",S.method.toUpperCase(),r),p(this.log,"Request Headers:",S.headers),p(this.log,"Request Body:",S.body),t.prev=9,t.next=12,this.fetch(r,S);case 12:if(n=t.sent,p(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new o(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return u=t.sent,p(this.log,"Response Parsed:",u),t.abrupt("return",u);case 23:throw t.prev=23,t.t0=t.catch(9),a=l(t.t0)?t.t0:"Unknown RESTClient error",s(t.t0)&&l(t.t0.message)&&(a=t.t0.message),new o("Failed to '"+y+"' '"+r+"': '"+a+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var u=e[o](i),a=u.value}catch(t){return void r(t)}if(!u.done)return Promise.resolve(a).then(function(t){n("next",t)},function(t){n("throw",t)});t(a)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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],o=new URL(e,this.url);return o.search=t.search(r,n,this.defaultParams),o.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?i(r,t):i(t);return Object.keys(n).map(function(t){return y(t)+"="+y(n[t])}).join("&")}}]),t}();t.exports=v},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(2).cloneDefined,i=r(8),u=r(3),a=r(7),c=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,o({fetch:a},t)));return r.timeout=t.timeout?Number(t.timeout):u.JSONP.TIMEOUT,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var u=o.get;return void 0!==u?u.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=c},function(t,e,r){"use strict";function n(){}n.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function o(){n.off(t,o),e.apply(r,arguments)}return o._=e,this.on(t,o,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,o=r.length;n<o;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],o=[];if(n&&e)for(var i=0,u=n.length;i<u;i++)n[i].fn!==e&&n[i].fn._!==e&&o.push(n[i]);return o.length?r[t]=o:delete r[t],this}},t.exports=n},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function o(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var u=e[o](i),a=u.value}catch(t){return void r(t)}if(!u.done)return Promise.resolve(a).then(function(t){n("next",t)},function(t){n("throw",t)});t(a)}("next")})}}var i=r(0),u=i.assert,a=i.isStr,c=i.isNonEmptyString,s=i.isUrl,f=r(4).urlMapper,l=r(3).ENDPOINTS,h=r(10),p=r(9),y=r(6),d=r(5),v=window,m=function(t){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,i=void 0===o?"PRE":o,a=t.window,s=void 0===a?v:a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var f=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return d.emulate(s),u(c(r),"clientId parameter is required"),f.cache=new y(s&&s.sessionStorage),f.clientId=r,f.redirectUri=n,f._setSpidServerUrl(i),f}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,h),n(e,[{key:"_setSpidServerUrl",value:function(t){u(a(t),"url parameter is invalid: "+t),this._spid=new p({serverUrl:f(t,l.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var t=o(regeneratorRuntime.mark(function t(e,r){var n,o,i,u,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="prd_"+e+"_"+r,!(o=this.cache.get(n))){t.next=4;break}return t.abrupt("return",o);case 4:return i={product_id:e},r&&(i.sp_id=r),t.next=8,this._spid.get("ajax/hasproduct.js",i);case 8:if((u=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return a=1e3*(u.expiresIn||30),this.cache.set(n,u,a),this.emit("hasProduct",{productId:e,data:u}),t.abrupt("return",u);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var t=o(regeneratorRuntime.mark(function t(e,r){var n,o,i,u,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n="sub_"+e+"_"+r,!(o=this.cache.get(n))){t.next=4;break}return t.abrupt("return",o);case 4:return i={product_id:e},r&&(i.sp_id=r),t.next=8,this._spid.get("ajax/hassubscription.js",i);case 8:if((u=t.sent).result){t.next=11;break}return t.abrupt("return",null);case 11:return a=1e3*(u.expiresIn||30),this.cache.set(n,u,a),this.emit("hasSubscription",{subscriptionId:e,data:u}),t.abrupt("return",u);case 15:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return u(s(t),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:t})}},{key:"productsUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return u(s(t),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:t})}}]),e}();t.exports=m},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,o=Object.prototype,i=o.hasOwnProperty,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag",f="object"===e(t),l=r.regeneratorRuntime;if(l)f&&(t.exports=l);else{(l=r.regeneratorRuntime=f?t.exports:{}).wrap=O;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(U([])));g&&g!==o&&i.call(g,a)&&(m=g);var w=_.prototype=x.prototype=Object.create(m);j.prototype=w.constructor=_,_.constructor=j,_[s]=j.displayName="GeneratorFunction",l.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===j||"GeneratorFunction"===(e.displayName||e.name))},l.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(w),t},l.awrap=function(t){return{__await:t}},P(E.prototype),E.prototype[c]=function(){return this},l.AsyncIterator=E,l.async=function(t,e,r,n){var o=new E(O(t,e,r,n));return l.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},P(w),w[s]="Generator",w[a]=function(){return this},w.toString=function(){return"[object Generator]"},l.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},l.values=U,N.prototype={constructor:N,reset:function(t){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(T),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,o){return a.type="throw",a.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var u=this.tryEntries[o],a=u.completion;if("root"===u.tryLoc)return r("end");if(u.tryLoc<=this.prev){var c=i.call(u,"catchLoc"),s=i.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc)return r(u.catchLoc,!0);if(this.prev<u.finallyLoc)return r(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return r(u.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return r(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:U(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function O(t,e,r,n){var o=e&&e.prototype instanceof x?e:x,i=Object.create(o.prototype),u=new N(n||[]);return i._invoke=function(t,e,r){var n=h;return function(o,i){if(n===y)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=k(u,r);if(a){if(a===v)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=y;var c=S(t,e,r);if("normal"===c.type){if(n=r.done?d:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=d,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function S(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function x(){}function j(){}function _(){}function P(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function E(t){var r;this._invoke=function(n,o){function u(){return new Promise(function(r,u){!function r(n,o,u,a){var c=S(t[n],t,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"===(void 0===f?"undefined":e(f))&&i.call(f,"__await")?Promise.resolve(f.__await).then(function(t){r("next",t,u,a)},function(t){r("throw",t,u,a)}):Promise.resolve(f).then(function(t){s.value=t,u(s)},a)}a(c.arg)}(n,o,r,u)})}return r=r?r.then(u,u):u()}}function k(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,k(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=S(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function U(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(12)(t))},function(t,e,r){"use strict";r(13),t.exports=r(11)}]);
//# sourceMappingURL=monetization.js.map

@@ -1,2 +0,2 @@

module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=13)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(2);function i(t){return"string"==typeof t}function u(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new o(e)},isObject:u,isNonEmptyObj:function(t){return u(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!i(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return i(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:i,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),u=i.assert,a=i.isObject,c=i.isNonEmptyObj,s=r(2);function l(t){return u("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new s("No objects to clone");return r.forEach(function(e){u(a(e)),c(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=a(i)?l(i):i)})}),t},cloneDeep:l}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var u=["boolean","number","string"],a=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(o,r),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i(Error)),o(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&u.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=a},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(2),i=r(1).cloneDefined,u=r(5).urlMapper,a=r(0),c=a.assert,s=a.isObject,l=a.isFunction,f=a.isStr,p=a.isNonEmptyString,h=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return s(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function y(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var d=window.fetch,v=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,a=void 0===i?d:i,f=e.log,p=e.defaultParams,h=void 0===p?{}:p;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),c(s(h),"defaultParams should be a non-null object"),this.url=new URL(u(n,o)),this.defaultParams=h,void 0!==f&&(c(l(f),"log must be a function but it is "+f),this.log=f),void 0!==a&&(c(l(a),"Fetch should be a function"),this.fetch=a)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,u,a,y=e.method,d=e.headers,v=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,O=e.fetchOptions,P=void 0===O?{method:y,credentials:"include"}:O;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return c(l(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),c(p(y),'Method must be a non empty string but it is "'+y+'"'),c(p(v),'Pathname must be string but it is "'+v+'"'),c(s(b),"data must be a non-null object"),P.headers=s(d)?i(d):{},r=this.makeUrl(v,b,w),h(this.log,"Request:",P.method.toUpperCase(),r),h(this.log,"Request Headers:",P.headers),h(this.log,"Request Body:",P.body),t.prev=9,t.next=12,this.fetch(r,P);case 12:if(n=t.sent,h(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new o(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return u=t.sent,h(this.log,"Response Parsed:",u),t.abrupt("return",u);case 23:throw t.prev=23,t.t0=t.catch(9),a=f(t.t0)?t.t0:"Unknown RESTClient error",s(t.t0)&&f(t.t0.message)&&(a=t.t0.message),new o("Failed to '"+y+"' '"+r+"': '"+a+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var u=e[o](i),a=u.value}catch(t){return void r(t)}if(!u.done)return Promise.resolve(a).then(function(t){n("next",t)},function(t){n("throw",t)});t(a)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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],o=new URL(e,this.url);return o.search=t.search(r,n,this.defaultParams),o.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?i(r,t):i(t);return Object.keys(n).map(function(t){return y(t)+"="+y(n[t])}).join("&")}}]),t}();t.exports=v},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0),i=o.assert,u=o.isNonEmptyString,a=o.isUrl,c=o.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(a(t,"hostname"))return t;i(u(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),i(c(e),"urlMap must be an object");var r=e[t];return i(a(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),o(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=r(0),o=n.assert,i=n.isObject,u=n.isUrl,a=r(1).cloneDefined;var c={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"};t.exports={open:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments[3];o(i(t),"window was supposed to be an object but it is "+t),o(u(e),"Invalid URL for popup");var s=t.screen,l=s.height,f=s.width,p=a(c,n);Number.isFinite(p.width)&&(p.left=(f-p.width)/2),Number.isFinite(p.height)&&(p.top=(l-p.height)/2);var h,y=(o(i(h=p),"Object must be an object but it is '"+h+"'"),Object.keys(h).map(function(t){return t+"="+h[t]}).join(","));return t.open(e,r,y)}}},function(t,e,r){"use strict";var n,o,i;o=[e,t],void 0===(i="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t,u=e.timeout||r.timeout,a=e.jsonpCallback||r.jsonpCallback,c=void 0;return new Promise(function(r,s){var l=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=a+"_"+l;window[l]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),c&&clearTimeout(c),o(f),n(l)},i+=-1===i.indexOf("?")?"?":"&";var p=document.createElement("script");p.setAttribute("src",""+i+a+"="+l),e.charset&&p.setAttribute("charset",e.charset),p.id=f,document.getElementsByTagName("head")[0].appendChild(p),c=setTimeout(function(){s(new Error("JSONP request to "+t+" timed out")),n(l),o(f),window[l]=function(){n(l)}},u),p.onerror=function(){s(new Error("JSONP request to "+t+" failed")),n(l),o(f),c&&clearTimeout(c)}})}})?n.apply(e,o):n)||(t.exports=i)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(1).cloneDefined,i=r(3),u=r(4),a=r(8),c=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,o({fetch:a},t)));return r.timeout=void 0===t.timeout?u.JSONP.TIMEOUT:Number(t.timeout),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var u=o.get;return void 0!==u?u.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=c},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(0),i=o.assert,u=o.isNonEmptyString,a=o.isUrl,c=o.isStr,s=r(5).urlMapper,l=r(4).ENDPOINTS,f=r(9),p=r(7),h=r(3),y=r(6),d=window,v=function(){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,a=void 0===o?"PRE":o,c=e.window,s=void 0===c?d:c;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),y.emulate(s),i(u(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=s,this._setSpidServerUrl(a),this._setBffServerUrl(a)}return n(t,[{key:"_setSpidServerUrl",value:function(t){i(c(t),"url parameter is invalid: "+t),this._spid=new f({serverUrl:s(t,l.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){i(c(t),"url parameter is invalid: "+t),this._bff=new h({serverUrl:s(t,l.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(t){var e=t.paylink,r=t.preferPopup,n=t.redirectUri,o=void 0===n?this.redirectUri:n;i(a(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var u=this.purchasePaylinkUrl(e,o);return r&&(this.popup=p.open(this.window,u,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=u,null)}},{key:"purchaseHistoryUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return i(a(t),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:t})}},{key:"redeemUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return i(a(e),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:t})}},{key:"purchasePaylinkUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return i(a(e),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:t,redirect_uri:e})}},{key:"purchaseProductFlowUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return i(a(e),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:t,redirect_uri:e})}},{key:"purchaseCampaignFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return i(a(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:t,product_id:e,voucher_code:r,redirect_uri:n})}}]),t}();t.exports=v},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,o=Object.prototype,i=o.hasOwnProperty,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag",l="object"===e(t),f=r.regeneratorRuntime;if(f)l&&(t.exports=f);else{(f=r.regeneratorRuntime=l?t.exports:{}).wrap=O;var p="suspendedStart",h="suspendedYield",y="executing",d="completed",v={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(T([])));g&&g!==o&&i.call(g,a)&&(m=g);var w=_.prototype=S.prototype=Object.create(m);j.prototype=w.constructor=_,_.constructor=j,_[s]=j.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===j||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},k(E.prototype),E.prototype[c]=function(){return this},f.AsyncIterator=E,f.async=function(t,e,r,n){var o=new E(O(t,e,r,n));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},k(w),w[s]="Generator",w[a]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=T,N.prototype={constructor:N,reset:function(t){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(L),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,o){return a.type="throw",a.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var u=this.tryEntries[o],a=u.completion;if("root"===u.tryLoc)return r("end");if(u.tryLoc<=this.prev){var c=i.call(u,"catchLoc"),s=i.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc)return r(u.catchLoc,!0);if(this.prev<u.finallyLoc)return r(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return r(u.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return r(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function O(t,e,r,n){var o=e&&e.prototype instanceof S?e:S,i=Object.create(o.prototype),u=new N(n||[]);return i._invoke=function(t,e,r){var n=p;return function(o,i){if(n===y)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=x(u,r);if(a){if(a===v)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=y;var c=P(t,e,r);if("normal"===c.type){if(n=r.done?d:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=d,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function P(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function S(){}function j(){}function _(){}function k(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function E(t){var r;this._invoke=function(n,o){function u(){return new Promise(function(r,u){!function r(n,o,u,a){var c=P(t[n],t,o);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"===(void 0===l?"undefined":e(l))&&i.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,u,a)},function(t){r("throw",t,u,a)}):Promise.resolve(l).then(function(t){s.value=t,u(s)},a)}a(c.arg)}(n,o,r,u)})}return r=r?r.then(u,u):u()}}function x(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,x(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=P(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function U(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(U,this),this.reset(!0)}function T(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(11)(t))},function(t,e,r){"use strict";r(12),t.exports=r(10)}]);
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=13)}([function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(2);function i(t){return"string"==typeof t}function u(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}t.exports={assert:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new o(e)},isObject:u,isNonEmptyObj:function(t){return u(t)&&Object.keys(t).length>0},isUrl:function(t){try{for(var e=new URL(t),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.every(function(t){return e[t]})}catch(t){return!1}},isFunction:function(t){return"function"==typeof t},isStrIn:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!i(t)||!Array.isArray(e))&&(r?-1!==e.indexOf(t):e.some(function(e){return i(e)&&t.toUpperCase()===e.toUpperCase()}))},isStr:i,isNonEmptyString:function(t){return"string"==typeof t&&t.length>0}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),u=i.assert,a=i.isObject,c=i.isNonEmptyObj,s=r(2);function l(t){return u("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}t.exports={cloneDefined:function(){for(var t={},e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r||!r.length)throw new s("No objects to clone");return r.forEach(function(e){u(a(e)),c(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=a(i)?l(i):i)})}),t},cloneDeep:l}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function i(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var u=["boolean","number","string"],a=function(t){function e(t,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(o,r),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i(Error)),o(e,[{key:"toString",value:function(){var t=this,e=this.name+": "+this.message,r=Object.keys(this).filter(function(e){return"name"!==e&&u.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();t.exports=a},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(2),i=r(1).cloneDefined,u=r(5).urlMapper,a=r(0),c=a.assert,s=a.isObject,l=a.isFunction,f=a.isStr,p=a.isNonEmptyString,h=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return"function"==typeof t&&t(function(t){return t.map(function(t){return s(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function y(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var d=window.fetch,v=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,a=void 0===i?d:i,f=e.log,p=e.defaultParams,h=void 0===p?{}:p;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),c(s(h),"defaultParams should be a non-null object"),this.url=new URL(u(n,o)),this.defaultParams=h,f&&(c(l(f),"log must be a function but it is "+f),this.log=f),a&&(c(l(a),"Fetch should be a function"),this.fetch=a)}return n(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,u,a,y=e.method,d=e.headers,v=e.pathname,m=e.data,b=void 0===m?{}:m,g=e.useDefaultParams,w=void 0===g||g,O=e.fetchOptions,P=void 0===O?{method:y,credentials:"include"}:O;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return c(l(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),c(p(y),'Method must be a non empty string but it is "'+y+'"'),c(p(v),'Pathname must be string but it is "'+v+'"'),c(s(b),"data must be a non-null object"),P.headers=s(d)?i(d):{},r=this.makeUrl(v,b,w),h(this.log,"Request:",P.method.toUpperCase(),r),h(this.log,"Request Headers:",P.headers),h(this.log,"Request Body:",P.body),t.prev=9,t.next=12,this.fetch(r,P);case 12:if(n=t.sent,h(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new o(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return u=t.sent,h(this.log,"Response Parsed:",u),t.abrupt("return",u);case 23:throw t.prev=23,t.t0=t.catch(9),a=f(t.t0)?t.t0:"Unknown RESTClient error",s(t.t0)&&f(t.t0.message)&&(a=t.t0.message),new o("Failed to '"+y+"' '"+r+"': '"+a+"'",t.t0);case 28:case"end":return t.stop()}},t,this,[[9,23]])}),function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(o,i){try{var u=e[o](i),a=u.value}catch(t){return void r(t)}if(!u.done)return Promise.resolve(a).then(function(t){n("next",t)},function(t){n("throw",t)});t(a)}("next")})});return function(t){return e.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var e=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],o=new URL(e,this.url);return o.search=t.search(r,n,this.defaultParams),o.href}},{key:"get",value:function(t,e){return this.go({method:"get",pathname:t,data:e})}}],[{key:"search",value:function(t,e,r){var n=e?i(r,t):i(t);return Object.keys(n).map(function(t){return y(t)+"="+y(n[t])}).join("&")}}]),t}();t.exports=v},function(t,e,r){"use strict";t.exports={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/"}},JSONP:{TIMEOUT:7e3}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0),i=o.assert,u=o.isNonEmptyString,a=o.isUrl,c=o.isNonEmptyObj;t.exports={urlMapper:function(t,e){if(a(t,"hostname"))return t;i(u(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),i(c(e),"urlMap must be an object");var r=e[t];return i(a(r,"hostname"),"The urlMap object does not have a url for "+t),r}}},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(0).isFunction;t.exports={emulate:function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={}),null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={}),o(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})}}},function(t,e,r){"use strict";var n=r(0),o=n.assert,i=n.isObject,u=n.isUrl,a=r(1).cloneDefined;var c={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"};t.exports={open:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments[3];o(i(t),"window was supposed to be an object but it is "+t),o(u(e),"Invalid URL for popup");var s=t.screen,l=s.height,f=s.width,p=a(c,n);Number.isFinite(p.width)&&Number.isFinite(f)&&(p.left=(f-p.width)/2),Number.isFinite(p.height)&&Number.isFinite(l)&&(p.top=(l-p.height)/2);var h,y=(o(i(h=p),"Object must be an object but it is '"+h+"'"),Object.keys(h).map(function(t){return t+"="+h[t]}).join(","));return t.open(e,r,y)}}},function(t,e,r){"use strict";var n,o,i;o=[e,t],void 0===(i="function"==typeof(n=function(t,e){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t,u=e.timeout||r.timeout,a=e.jsonpCallback||r.jsonpCallback,c=void 0;return new Promise(function(r,s){var l=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=a+"_"+l;window[l]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),c&&clearTimeout(c),o(f),n(l)},i+=-1===i.indexOf("?")?"?":"&";var p=document.createElement("script");p.setAttribute("src",""+i+a+"="+l),e.charset&&p.setAttribute("charset",e.charset),p.id=f,document.getElementsByTagName("head")[0].appendChild(p),c=setTimeout(function(){s(new Error("JSONP request to "+t+" timed out")),n(l),o(f),window[l]=function(){n(l)}},u),p.onerror=function(){s(new Error("JSONP request to "+t+" failed")),n(l),o(f),c&&clearTimeout(c)}})}})?n.apply(e,o):n)||(t.exports=i)},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(1).cloneDefined,i=r(3),u=r(4),a=r(8),c=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,o({fetch:a},t)));return r.timeout=t.timeout?Number(t.timeout):u.JSONP.TIMEOUT,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i),n(e,[{key:"go",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:t.method,credentials:"include",timeout:this.timeout};return function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var u=o.get;return void 0!==u?u.call(n):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"go",this).call(this,Object.assign({fetchOptions:r},t))}}]),e}();t.exports=c},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var o=r(0),i=o.assert,u=o.isNonEmptyString,a=o.isUrl,c=o.isStr,s=r(5).urlMapper,l=r(4).ENDPOINTS,f=r(9),p=r(7),h=r(3),y=r(6),d=window,v=function(){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,a=void 0===o?"PRE":o,c=e.window,s=void 0===c?d:c;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),y.emulate(s),i(u(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=s,this._setSpidServerUrl(a),this._setBffServerUrl(a)}return n(t,[{key:"_setSpidServerUrl",value:function(t){i(c(t),"url parameter is invalid: "+t),this._spid=new f({serverUrl:s(t,l.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){i(c(t),"url parameter is invalid: "+t),this._bff=new h({serverUrl:s(t,l.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(t){var e=t.paylink,r=t.preferPopup,n=t.redirectUri,o=void 0===n?this.redirectUri:n;i(a(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var u=this.purchasePaylinkUrl(e,o);return r&&(this.popup=p.open(this.window,u,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=u,null)}},{key:"purchaseHistoryUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return i(a(t),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:t})}},{key:"redeemUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return i(a(e),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:t})}},{key:"purchasePaylinkUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return i(a(e),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:t,redirect_uri:e})}},{key:"purchaseProductFlowUrl",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return i(a(e),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:t,redirect_uri:e})}},{key:"purchaseCampaignFlowUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.redirectUri;return i(a(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:t,product_id:e,voucher_code:r,redirect_uri:n})}}]),t}();t.exports=v},function(t,e,r){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(r){var n,o=Object.prototype,i=o.hasOwnProperty,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag",l="object"===e(t),f=r.regeneratorRuntime;if(f)l&&(t.exports=f);else{(f=r.regeneratorRuntime=l?t.exports:{}).wrap=O;var p="suspendedStart",h="suspendedYield",y="executing",d="completed",v={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(T([])));g&&g!==o&&i.call(g,a)&&(m=g);var w=_.prototype=S.prototype=Object.create(m);j.prototype=w.constructor=_,_.constructor=j,_[s]=j.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===j||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},k(E.prototype),E.prototype[c]=function(){return this},f.AsyncIterator=E,f.async=function(t,e,r,n){var o=new E(O(t,e,r,n));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},k(w),w[s]="Generator",w[a]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=T,N.prototype={constructor:N,reset:function(t){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(L),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,o){return a.type="throw",a.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var u=this.tryEntries[o],a=u.completion;if("root"===u.tryLoc)return r("end");if(u.tryLoc<=this.prev){var c=i.call(u,"catchLoc"),s=i.call(u,"finallyLoc");if(c&&s){if(this.prev<u.catchLoc)return r(u.catchLoc,!0);if(this.prev<u.finallyLoc)return r(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return r(u.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return r(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function O(t,e,r,n){var o=e&&e.prototype instanceof S?e:S,i=Object.create(o.prototype),u=new N(n||[]);return i._invoke=function(t,e,r){var n=p;return function(o,i){if(n===y)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=x(u,r);if(a){if(a===v)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=y;var c=P(t,e,r);if("normal"===c.type){if(n=r.done?d:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=d,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function P(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function S(){}function j(){}function _(){}function k(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function E(t){var r;this._invoke=function(n,o){function u(){return new Promise(function(r,u){!function r(n,o,u,a){var c=P(t[n],t,o);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"===(void 0===l?"undefined":e(l))&&i.call(l,"__await")?Promise.resolve(l.__await).then(function(t){r("next",t,u,a)},function(t){r("throw",t,u,a)}):Promise.resolve(l).then(function(t){s.value=t,u(s)},a)}a(c.arg)}(n,o,r,u)})}return r=r?r.then(u,u):u()}}function x(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,x(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=P(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function U(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(U,this),this.reset(!0)}function T(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(11)(t))},function(t,e,r){"use strict";r(12),t.exports=r(10)}]);
//# sourceMappingURL=payment.js.map
{
"name": "@schibsted/account-sdk-browser",
"version": "3.0.0-beta.7",
"version": "3.0.0-rc.0",
"description": "Schibsted Account SDK for browsers",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -108,3 +108,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.

this.clientId = clientId;
this.cache = new Cache(window && window.localStorage);
this._initCache();
this.redirectUri = redirectUri;

@@ -273,2 +273,11 @@ this.log = log;

/**
* Create a fresh cache for this instance
* @private
* @returns {void}
*/
_initCache() {
this.cache = new Cache(this.window && this.window.localStorage);
}
/**
* Set the Varnish cookie (`SP_ID`) when hasSession() is called.

@@ -279,2 +288,3 @@ * @returns {void}

this.setVarnishCookie = true;
this._initCache();
}

@@ -292,3 +302,3 @@

}
var date = new Date();
const date = new Date();
if (typeof sessionData.expiresIn === 'number' && sessionData.expiresIn > 0) {

@@ -300,10 +310,10 @@ date.setTime(date.getTime() + (sessionData.expiresIn * 1000));

// If the domain is missing or of the wrong type, we'll use document.domain
if (typeof sessionData.baseDomain !== 'string') {
sessionData.baseDomain = document.domain;
}
var cookie = [
const domain = (typeof sessionData.baseDomain === 'string')
? sessionData.baseDomain
: (document.domain || '');
const cookie = [
`SP_ID=${sessionData.sp_id}`,
`expires=${date.toUTCString()}`,
`path=/`,
`domain=.${sessionData.baseDomain}`
`domain=.${domain}`
].join('; ');

@@ -403,5 +413,2 @@ document.cookie = cookie;

const user = await this.hasSession();
if (!isObject(user)) {
throw new SDKError('Could not get the user. Maybe not logged in to Schibsted?');
}
if (!user.result) {

@@ -425,3 +432,3 @@ throw new SDKError('The user is not connected to this merchant');

const user = await this.hasSession();
if (isObject(user)) {
if (user.userId) {
return user.userId;

@@ -434,13 +441,13 @@ }

* In Schibsted Account, there are two ways of identifying a user; the `userId` and the `uuid`.
* There are reasons for them both existing. The `uuid` is universally unique, and we recommend
* that you use that whenever that works for you. The `userId` is a numeric identifier, but
* since Schibsted Account is deployed separately in Norway and Sweden, there are a lot of
* duplicates. The `userId` was introduced early, so many sites still need to use them for
* legacy reasons
* There are reasons for them both existing. The `uuid` is universally unique, and might be
* recommended for all use at a future time. The `userId` is a numeric identifier, but since
* Schibsted Account is deployed separately in Norway and Sweden, there are a lot of duplicates
* in these two environments. The `userId` was introduced early, so many sites still need to use
* them for legacy reasons
* @throws {SDKError} If the user isn't connected to the merchant
* @return {string} The `uuid` field (not to be confused with the `userId`)
*/
async getUserUuidId() {
async getUserUuid() {
const user = await this.hasSession();
if (isObject(user)) {
if (user.uuid) {
return user.uuid;

@@ -454,13 +461,10 @@ }

* The unique visitor id can be used to track the user for analytics (Mixpanel).
* @return {Promise}
* @return {string}
*/
getVisitorId() {
return this.hasSession()
.then(user => user.visitor.uid)
.catch(data => {
if (data.response && data.response.visitor) {
return data.response.visitor.uid;
}
throw data.error;
});
async getVisitorId() {
const user = await this.hasSession()
if (user.visitor && user.visitor.uid) {
return user.visitor.uid;
}
throw new SDKError('No visitor id available for this user');
}

@@ -471,3 +475,3 @@

* @todo Is this an accurate description?
* @return {string|undefined} - The sp_id string or undefined (if the server didn't return it)
* @return {string|null} - The sp_id string or null (if the server didn't return it)
*/

@@ -477,5 +481,5 @@ async getSpId() {

const user = await this.hasSession();
return user.sp_id;
return user.sp_id || null;
} catch (_) {
return undefined;
return null;
}

@@ -482,0 +486,0 @@ }

@@ -25,6 +25,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.

super(cloneDefined({ fetch }, options));
// Set minimum refresh timeout
this.timeout = options.timeout === undefined ?
config.JSONP.TIMEOUT : Number(options.timeout);
this.timeout = options.timeout ? Number(options.timeout) : config.JSONP.TIMEOUT;
}

@@ -31,0 +28,0 @@

@@ -15,3 +15,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.

const DEFAULT_CACHE_EXPIRES_IN = 0;
const DEFAULT_CACHE_EXPIRES_IN = 30;
const globalWindow = window;

@@ -63,3 +63,3 @@

async hasProduct(productId, spId) {
const cacheKey = `prd_${productId}`;
const cacheKey = `prd_${productId}_${spId}`;
const cachedVal = this.cache.get(cacheKey);

@@ -70,3 +70,3 @@ if (cachedVal) {

const params = { product_id: productId }
if (spId !== undefined) {
if (spId) {
params.sp_id = spId;

@@ -91,3 +91,3 @@ }

async hasSubscription(subscriptionId, spId) {
const cacheKey = `sub_${subscriptionId}`;
const cacheKey = `sub_${subscriptionId}_${spId}`;
const cachedVal = this.cache.get(cacheKey);

@@ -98,3 +98,3 @@ if (cachedVal) {

const params = { product_id: subscriptionId }
if (spId !== undefined) {
if (spId) {
params.sp_id = spId;

@@ -101,0 +101,0 @@ }

@@ -39,3 +39,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.

Object.entries(src).forEach(([key, val]) => {
if (val !== undefined ) {
if (val !== undefined ) { // eslint-disable-line no-undefined
dest[key] = isObject(val) ? cloneDeep(val) : val;

@@ -42,0 +42,0 @@ }

@@ -47,6 +47,6 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.

let mergedFeatures = cloneDefined(defaultWindowFeatures, windowFeatures);
if (Number.isFinite(mergedFeatures.width)) {
if (Number.isFinite(mergedFeatures.width) && Number.isFinite(width)) {
mergedFeatures.left = (width - mergedFeatures.width) / 2;
}
if (Number.isFinite(mergedFeatures.height)) {
if (Number.isFinite(mergedFeatures.height) && Number.isFinite(height)) {
mergedFeatures.top = (height - mergedFeatures.height) / 2;

@@ -53,0 +53,0 @@ }

@@ -83,3 +83,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.

if (log !== undefined) {
if (log) {
assert(isFunction(log), `log must be a function but it is ${log}`);

@@ -89,3 +89,3 @@ this.log = log;

if (fetch !== undefined) {
if (fetch) {
assert(isFunction(fetch), 'Fetch should be a function');

@@ -92,0 +92,0 @@ this.fetch = fetch;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc