@schibsted/account-sdk-browser
Advanced tools
Comparing version 3.0.0-rc.3 to 3.0.0-rc.4
# Changelog | ||
## v3.0.0-rc.4 (2018-05-29) | ||
### Fixes | ||
* [#37](https://github.com/schibsted/account-sdk-browser/issues/37) — The files in the `es5` | ||
directory have been rewritten to CommonJS syntax (yes, like in the good 'ol days). I still don't | ||
fully understand what was happening here, but at least now it seems like it works for people | ||
* [#40](https://github.com/schibsted/account-sdk-browser/issues/40) — Events are now emitted from | ||
Identity when a call to `hasSession()` used a cached value | ||
* [#41](https://github.com/schibsted/account-sdk-browser/issues/41) — References to the global | ||
`window` have all been wrapped in functions, so that it can be loaded in Server-side rendering | ||
contexts | ||
* The caching could fail if the cache time in milliseconds were greater than `2^31 - 1` (just under | ||
25 days). This has been fixed by capping the cache time to that maximum value | ||
### Changes | ||
* Documentation for the `Identity` class has been updated | ||
## v3.0.0-rc.3 (2018-05-14) | ||
@@ -4,0 +23,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){for(var r in t)e[r]=t[r]}(window,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=20)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new u.default(t)},t.isStr=s,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=a,t.isNonEmptyObj=function(e){return a(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!s(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return s(t)&&e.toUpperCase()===t.toUpperCase()})};var i,o=r(1),u=(i=o)&&i.__esModule?i:{default:i};function s(e){return"string"==typeof e}function a(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],u=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"}},JSONP:{TIMEOUT:7e3}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var u,s=e[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new a.default("No objects to clone");return r.forEach(function(t){(0,u.assert)((0,u.isObject)(t)),(0,u.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];void 0!==o&&(e[n]=(0,u.isObject)(o)?c(o):o)})}),e},t.cloneDeep=c;var o,u=r(0),s=r(1),a=(o=s)&&o.__esModule?o:{default:o};function c(e){return(0,u.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),u=(n=o)&&n.__esModule?n:{default:n},s=r(4),a=r(3),c=r(0);var l=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,c.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function f(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var h=window.fetch&&window.fetch.bind(window),p=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,u=void 0===o?h:o,s=t.log,l=t.defaultParams,f=void 0===l?{}:l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,c.assert)((0,c.isObject)(f),"defaultParams should be a non-null object"),this.url=new URL((0,a.urlMapper)(n,i)),this.defaultParams=f,s&&((0,c.assert)((0,c.isFunction)(s),"log must be a function but it is "+s),this.log=s),u&&((0,c.assert)((0,c.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return i(e,[{key:"go",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t){var r,n,i,o,a=t.method,f=t.headers,h=t.pathname,p=t.data,d=void 0===p?{}:p,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:a,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,c.assert)((0,c.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,c.assert)((0,c.isNonEmptyString)(a),'Method must be a non empty string but it is "'+a+'"'),(0,c.assert)((0,c.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,c.assert)((0,c.isObject)(d),"data must be a non-null object"),b.headers=(0,c.isObject)(f)?(0,s.cloneDefined)(f):{},r=this.makeUrl(h,d,y),l(this.log,"Request:",b.method.toUpperCase(),r),l(this.log,"Request Headers:",b.headers),l(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,l(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new u.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return i=e.sent,l(this.log,"Response Parsed:",i),e.abrupt("return",i);case 23:throw e.prev=23,e.t0=e.catch(9),o=(0,c.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,c.isObject)(e.t0)&&(0,c.isStr)(e.t0.message)&&(o=e.t0.message),new u.default("Failed to '"+a+"' '"+r+"': '"+o+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}),function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var u=t[i](o),s=u.value}catch(e){return void r(e)}if(!u.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})});return function(e){return t.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,s.cloneDefined)(r,e):(0,s.cloneDefined)(e);return Object.keys(n).map(function(e){return f(e)+"="+f(n[e])}).join("&")}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(4),o=a(r(6)),u=a(r(2)),s=a(r(15));function a(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:s.default},e)));return r.timeout=e.timeout?Number(e.timeout):u.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var u=i.get;return void 0!==u?u.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",u=arguments[3];(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var s=e.screen,a=s.height,c=s.width,l=(0,i.cloneDefined)(o,u);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(a)&&(l.top=(a-l.height)/2);var f=(h=l,(0,n.assert)((0,n.isObject)(h),"Object must be an object but it is '"+h+"'"),Object.keys(h).map(function(e){return e+"="+h[e]}).join(","));var h;return e.open(t,r,f)};var n=r(0),i=r(4);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),u=(n=o)&&n.__esModule?n:{default:n};function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function e(t){var r=this;s(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},c=function e(){var t=this;s(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},l=function(){function e(t){s(this,e),!function(e){if(!e)return!1;try{var t="x-x-x-x".replace(/x/g,function(){return Math.random()});e.setItem(t,"TEST-VALUE");var r=e.getItem(t);return e.removeItem(t),"TEST-VALUE"===r}catch(e){return!1}}(t)?(this.cache=new c,this.type="ObjectLiteralStorage"):(this.cache=new a(t),this.type="WebStorage")}return i(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new u.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:i,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new u.default(e)}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new u.default(e)}}}]),e}();t.default=l},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,u=n.length;o<u;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(3),u=r(2),s=h(r(7)),a=f(r(8)),c=h(r(6)),l=f(r(5));function f(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function h(e){return e&&e.__esModule?e:{default:e}}var p=window,d=t.Payment=function(){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,u=void 0===o?"PRE":o,s=t.window,a=void 0===s?p:s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.emulate(a),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=a,this._setSpidServerUrl(u),this._setBffServerUrl(u)}return n(e,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new s.default({serverUrl:(0,o.urlMapper)(e,u.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._bff=new c.default({serverUrl:(0,o.urlMapper)(e,u.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(e){var t=e.paylink,r=e.preferPopup,n=e.redirectUri,o=void 0===n?this.redirectUri:n;(0,i.assert)((0,i.isUrl)(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var u=this.purchasePaylinkUrl(t,o);return r&&(this.popup=a.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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:e})}},{key:"redeemUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:e})}},{key:"purchasePaylinkUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:e,redirect_uri:t})}},{key:"purchaseProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:e,redirect_uri:t})}},{key:"purchaseCampaignFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=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(0,i.assert)((0,i.isUrl)(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:e,product_id:t,voucher_code:r,redirect_uri:n})}}]),e}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(11);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return(e=n,e&&e.__esModule?e:{default:e}).default;var e}}),Object.defineProperty(t,"Payment",{enumerable:!0,get:function(){return n.Payment}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(3),u=r(2),s=f(r(10)),a=f(r(7)),c=f(r(9)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(5));function f(e){return e&&e.__esModule?e:{default:e}}function h(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var u=t[i](o),s=u.value}catch(e){return void r(e)}if(!u.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})}}var p=window,d=t.Monetization=function(e){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,u=void 0===o?"PRE":o,s=e.window,a=void 0===s?p:s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var f=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return l.emulate(a),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),f.cache=new c.default(a&&a.sessionStorage),f.clientId=r,f.redirectUri=n,f._setSpidServerUrl(u),f}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),n(t,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new a.default({serverUrl:(0,o.urlMapper)(e,u.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="prd_"+t+"_"+r,!(i=this.cache.get(n))){e.next=4;break}return e.abrupt("return",i);case 4:return o={product_id:t},r&&(o.sp_id=r),e.next=8,this._spid.get("ajax/hasproduct.js",o);case 8:if((u=e.sent).result){e.next=11;break}return e.abrupt("return",null);case 11:return s=1e3*(u.expiresIn||30),this.cache.set(n,u,s),this.emit("hasProduct",{productId:t,data:u}),e.abrupt("return",u);case 15:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="sub_"+t+"_"+r,!(i=this.cache.get(n))){e.next=4;break}return e.abrupt("return",i);case 4:return o={product_id:t},r&&(o.sp_id=r),e.next=8,this._spid.get("ajax/hassubscription.js",o);case 8:if((u=e.sent).result){e.next=11;break}return e.abrupt("return",null);case 11:return s=1e3*(u.expiresIn||30),this.cache.set(n,u,s),this.emit("hasSubscription",{subscriptionId:t,data:u}),e.abrupt("return",u);case 15:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:e})}},{key:"productsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:e})}}]),t}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return(e=n,e&&e.__esModule?e:{default:e}).default;var e}}),Object.defineProperty(t,"Monetization",{enumerable:!0,get:function(){return n.Monetization}})},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,u=t.timeout||r.timeout,s=t.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=s+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+s+"="+l),t.charset&&h.setAttribute("charset",t.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},u),h.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var u,s=e[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=r(0),s=r(4),a=r(3),c=r(2),l=b(r(10)),f=b(r(7)),h=b(r(9)),p=m(r(8)),d=b(r(6)),v=b(r(1)),y=m(r(5));function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function b(e){return e&&e.__esModule?e:{default:e}}function g(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var u=t[i](o),s=u.value}catch(e){return void r(e)}if(!u.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})}}var w=window;var _=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,o=void 0===i?"PRE":i,s=e.log,a=e.window,c=void 0===a?w:a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,u.assert)((0,u.isNonEmptyString)(r),"clientId parameter is required"),(0,u.assert)((0,u.isObject)(c),"The reference to window is missing"),(0,u.assert)(!n||(0,u.isUrl)(n),"redirectUri parameter is invalid"),y.emulate(c),l._sessionInitiatedSent=!1,l.window=c,l.clientId=r,l._initCache(),l.redirectUri=n,l.log=s,l._enableSessionCaching=!0,l._session={},l._setSpidServerUrl(o),l._setBffServerUrl(o),l._setOauthServerUrl(o),l._setHasSessionServerUrl(o),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,u.assert)((0,u.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,u.assert)((0,u.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,u.assert)((0,u.isStr)(e),"url parameter is invalid: "+e),this._bffService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,u.assert)((0,u.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.visitor&&this.emit("visitor",t.visitor),t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new h.default(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;"number"==typeof e.expiresIn&&e.expiresIn>0?t.setTime(t.getTime()+1e3*e.expiresIn):t.setTime(0);var r="string"==typeof e.baseDomain?e.baseDomain:document.domain||"",n=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,s,a,c,l=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("boolean"==typeof l){e.next=3;break}throw t=null===(f=l)?[void 0===f?"undefined":o(f),""+f]:[f.constructor.name,f.valueOf()],r=n(t,2),i=r[0],s=r[1],new v.default("Parameter 'autologin' must be boolean, was: \""+i+":"+s+'"');case 3:if(!this._enableSessionCaching){e.next=7;break}if(!(a=this.cache.get("hasSession-cache"))){e.next=7;break}return e.abrupt("return",a);case 7:return e.prev=7,e.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:l?1:0});case 10:if(c=e.sent,!(0,u.isObject)(c.error)||"LoginException"!==c.error.type){e.next=15;break}return e.next=14,this._spid.get("ajax/hasSession.js",{autologin:l?1:0});case 14:c=e.sent;case 15:if(c.result&&this.cache.set("hasSession-cache",c,1e3*c.expiresIn),!c.error){e.next=18;break}throw new v.default("HasSession endpoint returned an error",c.error);case 18:return this._maybeSetVarnishCookie(c),this._emitSessionEvent(this._session,c),this._session=c,e.abrupt("return",c);case 24:throw e.prev=24,e.t0=e.catch(7),this.emit("error",e.t0),new v.default("HasSession failed",e.t0);case 28:case"end":return e.stop()}var f},e,this,[[7,24]])}));return function(){return e.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new v.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,s.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new v.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new v.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).visitor||!t.visitor.uid){e.next=5;break}return e.abrupt("return",t.visitor.uid);case 5:throw new v.default("No visitor id available for this user");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,u=void 0===o?this.redirectUri:o,s=e.preferPopup,a=void 0!==s&&s,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f;this._closePopup();var d=this.loginUrl(r,t,i,u,l,h);return a&&(this.popup=p.open(this.window,d,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=d,null)}},{key:"logout",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,o,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(e){return e.then(function(){return!0},function(){return!1})},e.next=3,Promise.all([t(this._spid.get("ajax/logout.js")),t(this._bffService.get("api/identity/logout"))]);case 3:if(r=e.sent,i=n(r,2),o=i[0],u=i[1],!o&&!u){e.next=12;break}this.cache.delete("hasSession-cache"),this.emit("logout"),e.next=15;break;case 12:throw s=new v.default("Could not log out from any endpoint"),this.emit("error",s),s;case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"loginUrl",value:function(e,t){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(0,u.assert)(!t||(0,u.isStrIn)(t,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+t),(0,u.assert)((0,u.isUrl)(n),"loginUrl(): redirectUri must be a valid url but is "+n),(0,u.assert)((0,u.isNonEmptyString)(e),"the state parameter should be a non empty string but it is "+e),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:e,acr_values:t,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:e,email:o})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,u.assert)((0,u.isUrl)(e),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:e})}},{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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,u.assert)((0,u.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,u.assert)((0,u.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,u.assert)((0,u.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}}]),t}();t.default=_},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(16);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return(e=n,e&&e.__esModule?e:{default:e}).default;var e}}),Object.defineProperty(t,"Identity",{enumerable:!0,get:function(){return n.Identity}})},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",a=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=_;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={},m={};m[s]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(T([])));g&&g!==i&&o.call(g,s)&&(m=g);var w=U.prototype=O.prototype=Object.create(m);P.prototype=w.constructor=U,U.constructor=P,U[c]=P.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===P||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,U):(e.__proto__=U,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},k(j.prototype),j.prototype[a]=function(){return this},f.AsyncIterator=j,f.async=function(e,t,r,n){var i=new j(_(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},k(w),w[c]="Generator",w[s]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return s.type="throw",s.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],s=u.completion;if("root"===u.tryLoc)return r("end");if(u.tryLoc<=this.prev){var a=o.call(u,"catchLoc"),c=o.call(u,"finallyLoc");if(a&&c){if(this.prev<u.catchLoc)return r(u.catchLoc,!0);if(this.prev<u.finallyLoc)return r(u.finallyLoc)}else if(a){if(this.prev<u.catchLoc)return r(u.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return r(u.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(e,t,r,n){var i=t&&t.prototype instanceof O?t:O,o=Object.create(i.prototype),u=new N(n||[]);return o._invoke=function(e,t,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 R()}for(r.method=i,r.arg=o;;){var u=r.delegate;if(u){var s=x(u,r);if(s){if(s===y)continue;return s}}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(e,t,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)}}}(e,r,u),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function P(){}function U(){}function k(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function j(e){var r;this._invoke=function(n,i){function u(){return new Promise(function(r,u){!function r(n,i,u,s){var a=S(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,u,s)},function(e){r("throw",e,u,s)}):Promise.resolve(l).then(function(e){c.value=e,u(c)},s)}s(a.arg)}(n,i,r,u)})}return r=r?r.then(u,u):u()}}function x(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,x(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function T(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(18)(e))},function(e,t,r){"use strict";r(19);var n=u(r(17)),i=u(r(14)),o=u(r(12));function u(e){return e&&e.__esModule?e:{default:e}}Object.assign(window,{Identity:n.default,Monetization:i.default,Payment:o.default})}])); | ||
!function(e,t){for(var r in t)e[r]=t[r]}(window,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=18)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new s.default(t)},t.isStr=u,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=a,t.isNonEmptyObj=function(e){return a(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!u(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return u(t)&&e.toUpperCase()===t.toUpperCase()})};var i,o=r(1),s=(i=o)&&i.__esModule?i:{default:i};function u(e){return"string"==typeof e}function a(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={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}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new a.default("No objects to clone");return r.forEach(function(t){(0,s.assert)((0,s.isObject)(t)),(0,s.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];void 0!==o&&(e[n]=(0,s.isObject)(o)?c(o):o)})}),e},t.cloneDeep=c;var o,s=r(0),u=r(1),a=(o=u)&&o.__esModule?o:{default:o};function c(e){return(0,s.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),s=(n=o)&&n.__esModule?n:{default:n},u=r(4),a=r(3),c=r(0);var l=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,c.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function f(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var h=function(){return window.fetch&&window.fetch.bind(window)},p=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,s=void 0===o?h():o,u=t.log,l=t.defaultParams,f=void 0===l?{}:l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,c.assert)((0,c.isObject)(f),"defaultParams should be a non-null object"),this.url=new URL((0,a.urlMapper)(n,i)),this.defaultParams=f,u&&((0,c.assert)((0,c.isFunction)(u),"log must be a function but it is "+u),this.log=u),s&&((0,c.assert)((0,c.isFunction)(s),"Fetch should be a function"),this.fetch=s)}return i(e,[{key:"go",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t){var r,n,i,o,a=t.method,f=t.headers,h=t.pathname,p=t.data,d=void 0===p?{}:p,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:a,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,c.assert)((0,c.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,c.assert)((0,c.isNonEmptyString)(a),'Method must be a non empty string but it is "'+a+'"'),(0,c.assert)((0,c.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,c.assert)((0,c.isObject)(d),"data must be a non-null object"),b.headers=(0,c.isObject)(f)?(0,u.cloneDefined)(f):{},r=this.makeUrl(h,d,y),l(this.log,"Request:",b.method.toUpperCase(),r),l(this.log,"Request Headers:",b.headers),l(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,l(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new s.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return i=e.sent,l(this.log,"Response Parsed:",i),e.abrupt("return",i);case 23:throw e.prev=23,e.t0=e.catch(9),o=(0,c.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,c.isObject)(e.t0)&&(0,c.isStr)(e.t0.message)&&(o=e.t0.message),new s.default("Failed to '"+a+"' '"+r+"': '"+o+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}),function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})});return function(e){return t.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,u.cloneDefined)(r,e):(0,u.cloneDefined)(e);return Object.keys(n).map(function(e){return f(e)+"="+f(n[e])}).join("&")}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(4),o=a(r(6)),s=a(r(2)),u=a(r(13));function a(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:u.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments[3];(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var u=e.screen,a=u.height,c=u.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(a)&&(l.top=(a-l.height)/2);var f=(h=l,(0,n.assert)((0,n.isObject)(h),"Object must be an object but it is '"+h+"'"),Object.keys(h).map(function(e){return e+"="+h[e]}).join(","));var h;return e.open(t,r,f)};var n=r(0),i=r(4);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),s=(n=o)&&n.__esModule?n:{default:n};function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function e(t){var r=this;u(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},c=function e(){var t=this;u(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},l=function(){function e(t){u(this,e),!function(e){if(!e)return!1;try{var t="x-x-x-x".replace(/x/g,function(){return Math.random()});e.setItem(t,"TEST-VALUE");var r=e.getItem(t);return e.removeItem(t),"TEST-VALUE"===r}catch(e){return!1}}(t)?(this.cache=new c,this.type="ObjectLiteralStorage"):(this.cache=new a(t),this.type="WebStorage")}return i(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new s.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:i,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new s.default(e)}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new s.default(e)}}}]),e}();t.default=l},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(3),s=r(2),u=h(r(7)),a=f(r(8)),c=h(r(6)),l=f(r(5));function f(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function h(e){return e&&e.__esModule?e:{default:e}}var p=function(){return window},d=t.Payment=function(){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,s=void 0===o?"PRE":o,u=t.window,a=void 0===u?p():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.emulate(a),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=a,this._setSpidServerUrl(s),this._setBffServerUrl(s)}return n(e,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new u.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._bff=new c.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(e){var t=e.paylink,r=e.preferPopup,n=e.redirectUri,o=void 0===n?this.redirectUri:n;(0,i.assert)((0,i.isUrl)(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(t,o);return r&&(this.popup=a.open(this.window,s,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=s,null)}},{key:"purchaseHistoryUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:e})}},{key:"redeemUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:e})}},{key:"purchasePaylinkUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:e,redirect_uri:t})}},{key:"purchaseProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:e,redirect_uri:t})}},{key:"purchaseCampaignFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=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(0,i.assert)((0,i.isUrl)(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:e,product_id:t,voucher_code:r,redirect_uri:n})}}]),e}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(3),s=r(2),u=f(r(10)),a=f(r(7)),c=f(r(9)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(5));function f(e){return e&&e.__esModule?e:{default:e}}function h(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})}}var p=function(){return window},d=t.Monetization=function(e){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,s=void 0===o?"PRE":o,u=e.window,a=void 0===u?p():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var f=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return l.emulate(a),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),f.cache=new c.default(a&&a.sessionStorage),f.clientId=r,f.redirectUri=n,f._setSpidServerUrl(s),f}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.default),n(t,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new a.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="prd_"+t+"_"+r,!(i=this.cache.get(n))){e.next=4;break}return e.abrupt("return",i);case 4:return o={product_id:t},r&&(o.sp_id=r),e.next=8,this._spid.get("ajax/hasproduct.js",o);case 8:if((s=e.sent).result){e.next=11;break}return e.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||30),this.cache.set(n,s,u),this.emit("hasProduct",{productId:t,data:s}),e.abrupt("return",s);case 15:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="sub_"+t+"_"+r,!(i=this.cache.get(n))){e.next=4;break}return e.abrupt("return",i);case 4:return o={product_id:t},r&&(o.sp_id=r),e.next=8,this._spid.get("ajax/hassubscription.js",o);case 8:if((s=e.sent).result){e.next=11;break}return e.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||30),this.cache.set(n,s,u),this.emit("hasSubscription",{subscriptionId:t,data:s}),e.abrupt("return",s);case 15:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:e})}},{key:"productsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:e})}}]),t}();t.default=d},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,u=t.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+u+"="+l),t.charset&&h.setAttribute("charset",t.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),u=r(4),a=r(3),c=r(2),l=b(r(10)),f=b(r(7)),h=b(r(9)),p=m(r(8)),d=b(r(6)),v=b(r(1)),y=m(r(5));function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function b(e){return e&&e.__esModule?e:{default:e}}function g(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})}}var w=function(){return window};var _=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,o=void 0===i?"PRE":i,u=e.log,a=e.window,c=void 0===a?w():a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(c),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),y.emulate(c),l._sessionInitiatedSent=!1,l.window=c,l.clientId=r,l._initCache(),l.redirectUri=n,l.log=u,l._enableSessionCaching=!0,l._session={},l._setSpidServerUrl(o),l._setBffServerUrl(o),l._setOauthServerUrl(o),l._setHasSessionServerUrl(o),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.visitor&&this.emit("visitor",t.visitor),t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new h.default(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;"number"==typeof e.expiresIn&&e.expiresIn>0?t.setTime(t.getTime()+1e3*e.expiresIn):t.setTime(0);var r="string"==typeof e.baseDomain?e.baseDomain:document.domain||"",n=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,u,a,c,l=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("boolean"==typeof l){e.next=3;break}throw t=null===(f=l)?[void 0===f?"undefined":o(f),""+f]:[f.constructor.name,f.valueOf()],r=n(t,2),i=r[0],u=r[1],new v.default("Parameter 'autologin' must be boolean, was: \""+i+":"+u+'"');case 3:if(!this._enableSessionCaching){e.next=7;break}if(!(a=this.cache.get("hasSession-cache"))){e.next=7;break}return e.abrupt("return",a);case 7:return e.prev=7,e.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:l?1:0});case 10:if(c=e.sent,!(0,s.isObject)(c.error)||"LoginException"!==c.error.type){e.next=15;break}return e.next=14,this._spid.get("ajax/hasSession.js",{autologin:l?1:0});case 14:c=e.sent;case 15:if(c.result&&this.cache.set("hasSession-cache",c,1e3*c.expiresIn),!c.error){e.next=18;break}throw new v.default("HasSession endpoint returned an error",c.error);case 18:return this._maybeSetVarnishCookie(c),this._emitSessionEvent(this._session,c),this._session=c,e.abrupt("return",c);case 24:throw e.prev=24,e.t0=e.catch(7),this.emit("error",e.t0),new v.default("HasSession failed",e.t0);case 28:case"end":return e.stop()}var f},e,this,[[7,24]])}));return function(){return e.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new v.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,u.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new v.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new v.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).visitor||!t.visitor.uid){e.next=5;break}return e.abrupt("return",t.visitor.uid);case 5:throw new v.default("No visitor id available for this user");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,u=e.preferPopup,a=void 0!==u&&u,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f;this._closePopup();var d=this.loginUrl(r,t,i,s,l,h);return a&&(this.popup=p.open(this.window,d,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=d,null)}},{key:"logout",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,o,s,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(e){return e.then(function(){return!0},function(){return!1})},e.next=3,Promise.all([t(this._spid.get("ajax/logout.js")),t(this._bffService.get("api/identity/logout"))]);case 3:if(r=e.sent,i=n(r,2),o=i[0],s=i[1],!o&&!s){e.next=12;break}this.cache.delete("hasSession-cache"),this.emit("logout"),e.next=15;break;case 12:throw u=new v.default("Could not log out from any endpoint"),this.emit("error",u),u;case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"loginUrl",value:function(e,t){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(0,s.assert)(!t||(0,s.isStrIn)(t,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+t),(0,s.assert)((0,s.isUrl)(n),"loginUrl(): redirectUri must be a valid url but is "+n),(0,s.assert)((0,s.isNonEmptyString)(e),"the state parameter should be a non empty string but it is "+e),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:e,acr_values:t,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:e,email:o})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:e})}},{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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}}]),t}();t.default=_},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=_;var 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=k.prototype=O.prototype=Object.create(m);U.prototype=w.constructor=k,k.constructor=U,k[c]=U.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===U||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},P(j.prototype),j.prototype[a]=function(){return this},f.AsyncIterator=j,f.async=function(e,t,r,n){var i=new j(_(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},P(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return u.type="throw",u.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],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(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(e,t,r,n){var i=t&&t.prototype instanceof O?t:O,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return T()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var u=x(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(e,t,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)}}}(e,r,s),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function U(){}function k(){}function P(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function j(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,u){var a=S(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,u)},function(e){r("throw",e,s,u)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},u)}u(a.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function x(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,x(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(15)(e))},function(e,t,r){"use strict";var n=function(){return this}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,o=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,e.exports=r(16),i)n.regeneratorRuntime=o;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},function(e,t,r){"use strict";var n=r(17),i=r(14).Identity,o=r(12).Monetization,s=r(11).Payment;e.exports={Identity:i,Monetization:o,Payment:s},Object.assign(window,{Identity:i,Monetization:o,Payment:s,regeneratorRuntime:n})}])); | ||
//# sourceMappingURL=global.js.map |
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new s.default(t)},t.isStr=u,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=a,t.isNonEmptyObj=function(e){return a(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!u(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return u(t)&&e.toUpperCase()===t.toUpperCase()})};var i,o=r(1),s=(i=o)&&i.__esModule?i:{default:i};function u(e){return"string"==typeof e}function a(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new a.default("No objects to clone");return r.forEach(function(t){(0,s.assert)((0,s.isObject)(t)),(0,s.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];void 0!==o&&(e[n]=(0,s.isObject)(o)?c(o):o)})}),e},t.cloneDeep=c;var o,s=r(0),u=r(1),a=(o=u)&&o.__esModule?o:{default:o};function c(e){return(0,s.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),s=(n=o)&&n.__esModule?n:{default:n},u=r(2),a=r(5),c=r(0);var l=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,c.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function f(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var h=window.fetch&&window.fetch.bind(window),p=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,s=void 0===o?h:o,u=t.log,l=t.defaultParams,f=void 0===l?{}:l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,c.assert)((0,c.isObject)(f),"defaultParams should be a non-null object"),this.url=new URL((0,a.urlMapper)(n,i)),this.defaultParams=f,u&&((0,c.assert)((0,c.isFunction)(u),"log must be a function but it is "+u),this.log=u),s&&((0,c.assert)((0,c.isFunction)(s),"Fetch should be a function"),this.fetch=s)}return i(e,[{key:"go",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t){var r,n,i,o,a=t.method,f=t.headers,h=t.pathname,p=t.data,d=void 0===p?{}:p,y=t.useDefaultParams,v=void 0===y||y,m=t.fetchOptions,b=void 0===m?{method:a,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,c.assert)((0,c.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,c.assert)((0,c.isNonEmptyString)(a),'Method must be a non empty string but it is "'+a+'"'),(0,c.assert)((0,c.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,c.assert)((0,c.isObject)(d),"data must be a non-null object"),b.headers=(0,c.isObject)(f)?(0,u.cloneDefined)(f):{},r=this.makeUrl(h,d,v),l(this.log,"Request:",b.method.toUpperCase(),r),l(this.log,"Request Headers:",b.headers),l(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,l(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new s.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return i=e.sent,l(this.log,"Response Parsed:",i),e.abrupt("return",i);case 23:throw e.prev=23,e.t0=e.catch(9),o=(0,c.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,c.isObject)(e.t0)&&(0,c.isStr)(e.t0.message)&&(o=e.t0.message),new s.default("Failed to '"+a+"' '"+r+"': '"+o+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}),function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})});return function(e){return t.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,u.cloneDefined)(r,e):(0,u.cloneDefined)(e);return Object.keys(n).map(function(e){return f(e)+"="+f(n[e])}).join("&")}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"}},JSONP:{TIMEOUT:7e3}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=_;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={},m={};m[u]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(T([])));g&&g!==i&&o.call(g,u)&&(m=g);var w=k.prototype=O.prototype=Object.create(m);j.prototype=w.constructor=k,k.constructor=j,k[c]=j.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===j||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},x(P.prototype),P.prototype[a]=function(){return this},f.AsyncIterator=P,f.async=function(e,t,r,n){var i=new P(_(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},x(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return u.type="throw",u.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],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(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function _(e,t,r,n){var i=t&&t.prototype instanceof O?t:O,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===y){if("throw"===i)throw o;return R()}for(r.method=i,r.arg=o;;){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=S(e,t,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)}}}(e,r,s),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function j(){}function k(){}function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function P(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,u){var a=S(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,u)},function(e){r("throw",e,s,u)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},u)}u(a.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function U(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,U(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,v;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,v):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function T(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(6)(e))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments[3];(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var u=e.screen,a=u.height,c=u.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(a)&&(l.top=(a-l.height)/2);var f=(h=l,(0,n.assert)((0,n.isObject)(h),"Object must be an object but it is '"+h+"'"),Object.keys(h).map(function(e){return e+"="+h[e]}).join(","));var h;return e.open(t,r,f)};var n=r(0),i=r(2);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),s=(n=o)&&n.__esModule?n:{default:n};function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function e(t){var r=this;u(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},c=function e(){var t=this;u(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},l=function(){function e(t){u(this,e),!function(e){if(!e)return!1;try{var t="x-x-x-x".replace(/x/g,function(){return Math.random()});e.setItem(t,"TEST-VALUE");var r=e.getItem(t);return e.removeItem(t),"TEST-VALUE"===r}catch(e){return!1}}(t)?(this.cache=new c,this.type="ObjectLiteralStorage"):(this.cache=new a(t),this.type="WebStorage")}return i(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new s.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:i,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new s.default(e)}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new s.default(e)}}}]),e}();t.default=l},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,u=t.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+u+"="+l),t.charset&&h.setAttribute("charset",t.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(2),o=a(r(3)),s=a(r(4)),u=a(r(11));function a(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:u.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),u=r(2),a=r(5),c=r(4),l=b(r(13)),f=b(r(12)),h=b(r(10)),p=m(r(9)),d=b(r(3)),y=b(r(1)),v=m(r(8));function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function b(e){return e&&e.__esModule?e:{default:e}}function g(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})}}var w=window;var _=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,o=void 0===i?"PRE":i,u=e.log,a=e.window,c=void 0===a?w:a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(c),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),v.emulate(c),l._sessionInitiatedSent=!1,l.window=c,l.clientId=r,l._initCache(),l.redirectUri=n,l.log=u,l._enableSessionCaching=!0,l._session={},l._setSpidServerUrl(o),l._setBffServerUrl(o),l._setOauthServerUrl(o),l._setHasSessionServerUrl(o),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.visitor&&this.emit("visitor",t.visitor),t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new h.default(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;"number"==typeof e.expiresIn&&e.expiresIn>0?t.setTime(t.getTime()+1e3*e.expiresIn):t.setTime(0);var r="string"==typeof e.baseDomain?e.baseDomain:document.domain||"",n=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,u,a,c,l=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("boolean"==typeof l){e.next=3;break}throw t=null===(f=l)?[void 0===f?"undefined":o(f),""+f]:[f.constructor.name,f.valueOf()],r=n(t,2),i=r[0],u=r[1],new y.default("Parameter 'autologin' must be boolean, was: \""+i+":"+u+'"');case 3:if(!this._enableSessionCaching){e.next=7;break}if(!(a=this.cache.get("hasSession-cache"))){e.next=7;break}return e.abrupt("return",a);case 7:return e.prev=7,e.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:l?1:0});case 10:if(c=e.sent,!(0,s.isObject)(c.error)||"LoginException"!==c.error.type){e.next=15;break}return e.next=14,this._spid.get("ajax/hasSession.js",{autologin:l?1:0});case 14:c=e.sent;case 15:if(c.result&&this.cache.set("hasSession-cache",c,1e3*c.expiresIn),!c.error){e.next=18;break}throw new y.default("HasSession endpoint returned an error",c.error);case 18:return this._maybeSetVarnishCookie(c),this._emitSessionEvent(this._session,c),this._session=c,e.abrupt("return",c);case 24:throw e.prev=24,e.t0=e.catch(7),this.emit("error",e.t0),new y.default("HasSession failed",e.t0);case 28:case"end":return e.stop()}var f},e,this,[[7,24]])}));return function(){return e.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new y.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,u.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).visitor||!t.visitor.uid){e.next=5;break}return e.abrupt("return",t.visitor.uid);case 5:throw new y.default("No visitor id available for this user");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,u=e.preferPopup,a=void 0!==u&&u,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f;this._closePopup();var d=this.loginUrl(r,t,i,s,l,h);return a&&(this.popup=p.open(this.window,d,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=d,null)}},{key:"logout",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,o,s,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(e){return e.then(function(){return!0},function(){return!1})},e.next=3,Promise.all([t(this._spid.get("ajax/logout.js")),t(this._bffService.get("api/identity/logout"))]);case 3:if(r=e.sent,i=n(r,2),o=i[0],s=i[1],!o&&!s){e.next=12;break}this.cache.delete("hasSession-cache"),this.emit("logout"),e.next=15;break;case 12:throw u=new y.default("Could not log out from any endpoint"),this.emit("error",u),u;case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"loginUrl",value:function(e,t){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(0,s.assert)(!t||(0,s.isStrIn)(t,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+t),(0,s.assert)((0,s.isUrl)(n),"loginUrl(): redirectUri must be a valid url but is "+n),(0,s.assert)((0,s.isNonEmptyString)(e),"the state parameter should be a non empty string but it is "+e),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:e,acr_values:t,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:e,email:o})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:e})}},{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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}}]),t}();t.default=_},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=r(14);Object.defineProperty(t,"Identity",{enumerable:!0,get:function(){return n.Identity}}),r(7)}]); | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=16)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new s.default(t)},t.isStr=u,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=a,t.isNonEmptyObj=function(e){return a(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!u(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return u(t)&&e.toUpperCase()===t.toUpperCase()})};var i,o=r(1),s=(i=o)&&i.__esModule?i:{default:i};function u(e){return"string"==typeof e}function a(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new a.default("No objects to clone");return r.forEach(function(t){(0,s.assert)((0,s.isObject)(t)),(0,s.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];void 0!==o&&(e[n]=(0,s.isObject)(o)?c(o):o)})}),e},t.cloneDeep=c;var o,s=r(0),u=r(1),a=(o=u)&&o.__esModule?o:{default:o};function c(e){return(0,s.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),s=(n=o)&&n.__esModule?n:{default:n},u=r(2),a=r(5),c=r(0);var l=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,c.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function f(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var h=function(){return window.fetch&&window.fetch.bind(window)},p=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,s=void 0===o?h():o,u=t.log,l=t.defaultParams,f=void 0===l?{}:l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,c.assert)((0,c.isObject)(f),"defaultParams should be a non-null object"),this.url=new URL((0,a.urlMapper)(n,i)),this.defaultParams=f,u&&((0,c.assert)((0,c.isFunction)(u),"log must be a function but it is "+u),this.log=u),s&&((0,c.assert)((0,c.isFunction)(s),"Fetch should be a function"),this.fetch=s)}return i(e,[{key:"go",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t){var r,n,i,o,a=t.method,f=t.headers,h=t.pathname,p=t.data,d=void 0===p?{}:p,y=t.useDefaultParams,v=void 0===y||y,m=t.fetchOptions,b=void 0===m?{method:a,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,c.assert)((0,c.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,c.assert)((0,c.isNonEmptyString)(a),'Method must be a non empty string but it is "'+a+'"'),(0,c.assert)((0,c.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,c.assert)((0,c.isObject)(d),"data must be a non-null object"),b.headers=(0,c.isObject)(f)?(0,u.cloneDefined)(f):{},r=this.makeUrl(h,d,v),l(this.log,"Request:",b.method.toUpperCase(),r),l(this.log,"Request Headers:",b.headers),l(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,l(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new s.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return i=e.sent,l(this.log,"Response Parsed:",i),e.abrupt("return",i);case 23:throw e.prev=23,e.t0=e.catch(9),o=(0,c.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,c.isObject)(e.t0)&&(0,c.isStr)(e.t0.message)&&(o=e.t0.message),new s.default("Failed to '"+a+"' '"+r+"': '"+o+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}),function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})});return function(e){return t.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,u.cloneDefined)(r,e):(0,u.cloneDefined)(e);return Object.keys(n).map(function(e){return f(e)+"="+f(n[e])}).join("&")}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"}},JSONP:{TIMEOUT:7e3}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments[3];(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var u=e.screen,a=u.height,c=u.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(a)&&(l.top=(a-l.height)/2);var f=(h=l,(0,n.assert)((0,n.isObject)(h),"Object must be an object but it is '"+h+"'"),Object.keys(h).map(function(e){return e+"="+h[e]}).join(","));var h;return e.open(t,r,f)};var n=r(0),i=r(2);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),s=(n=o)&&n.__esModule?n:{default:n};function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function e(t){var r=this;u(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},c=function e(){var t=this;u(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},l=function(){function e(t){u(this,e),!function(e){if(!e)return!1;try{var t="x-x-x-x".replace(/x/g,function(){return Math.random()});e.setItem(t,"TEST-VALUE");var r=e.getItem(t);return e.removeItem(t),"TEST-VALUE"===r}catch(e){return!1}}(t)?(this.cache=new c,this.type="ObjectLiteralStorage"):(this.cache=new a(t),this.type="WebStorage")}return i(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new s.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:i,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new s.default(e)}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new s.default(e)}}}]),e}();t.default=l},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,u=t.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+u+"="+l),t.charset&&h.setAttribute("charset",t.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(2),o=a(r(3)),s=a(r(4)),u=a(r(9));function a(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:u.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),u=r(2),a=r(5),c=r(4),l=b(r(11)),f=b(r(10)),h=b(r(8)),p=m(r(7)),d=b(r(3)),y=b(r(1)),v=m(r(6));function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function b(e){return e&&e.__esModule?e:{default:e}}function g(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})}}var w=function(){return window};var _=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,o=void 0===i?"PRE":i,u=e.log,a=e.window,c=void 0===a?w():a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(c),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),v.emulate(c),l._sessionInitiatedSent=!1,l.window=c,l.clientId=r,l._initCache(),l.redirectUri=n,l.log=u,l._enableSessionCaching=!0,l._session={},l._setSpidServerUrl(o),l._setBffServerUrl(o),l._setOauthServerUrl(o),l._setHasSessionServerUrl(o),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.visitor&&this.emit("visitor",t.visitor),t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new h.default(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;"number"==typeof e.expiresIn&&e.expiresIn>0?t.setTime(t.getTime()+1e3*e.expiresIn):t.setTime(0);var r="string"==typeof e.baseDomain?e.baseDomain:document.domain||"",n=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,u,a,c,l=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("boolean"==typeof l){e.next=3;break}throw t=null===(f=l)?[void 0===f?"undefined":o(f),""+f]:[f.constructor.name,f.valueOf()],r=n(t,2),i=r[0],u=r[1],new y.default("Parameter 'autologin' must be boolean, was: \""+i+":"+u+'"');case 3:if(!this._enableSessionCaching){e.next=7;break}if(!(a=this.cache.get("hasSession-cache"))){e.next=7;break}return e.abrupt("return",a);case 7:return e.prev=7,e.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:l?1:0});case 10:if(c=e.sent,!(0,s.isObject)(c.error)||"LoginException"!==c.error.type){e.next=15;break}return e.next=14,this._spid.get("ajax/hasSession.js",{autologin:l?1:0});case 14:c=e.sent;case 15:if(c.result&&this.cache.set("hasSession-cache",c,1e3*c.expiresIn),!c.error){e.next=18;break}throw new y.default("HasSession endpoint returned an error",c.error);case 18:return this._maybeSetVarnishCookie(c),this._emitSessionEvent(this._session,c),this._session=c,e.abrupt("return",c);case 24:throw e.prev=24,e.t0=e.catch(7),this.emit("error",e.t0),new y.default("HasSession failed",e.t0);case 28:case"end":return e.stop()}var f},e,this,[[7,24]])}));return function(){return e.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new y.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,u.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new y.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).visitor||!t.visitor.uid){e.next=5;break}return e.abrupt("return",t.visitor.uid);case 5:throw new y.default("No visitor id available for this user");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,u=e.preferPopup,a=void 0!==u&&u,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f;this._closePopup();var d=this.loginUrl(r,t,i,s,l,h);return a&&(this.popup=p.open(this.window,d,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=d,null)}},{key:"logout",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,o,s,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(e){return e.then(function(){return!0},function(){return!1})},e.next=3,Promise.all([t(this._spid.get("ajax/logout.js")),t(this._bffService.get("api/identity/logout"))]);case 3:if(r=e.sent,i=n(r,2),o=i[0],s=i[1],!o&&!s){e.next=12;break}this.cache.delete("hasSession-cache"),this.emit("logout"),e.next=15;break;case 12:throw u=new y.default("Could not log out from any endpoint"),this.emit("error",u),u;case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"loginUrl",value:function(e,t){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(0,s.assert)(!t||(0,s.isStrIn)(t,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+t),(0,s.assert)((0,s.isUrl)(n),"loginUrl(): redirectUri must be a valid url but is "+n),(0,s.assert)((0,s.isNonEmptyString)(e),"the state parameter should be a non empty string but it is "+e),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:e,acr_values:t,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:e,email:o})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:e})}},{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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}}]),t}();t.default=_},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=_;var 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!==i&&o.call(g,u)&&(m=g);var w=k.prototype=O.prototype=Object.create(m);j.prototype=w.constructor=k,k.constructor=j,k[c]=j.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===j||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},x(P.prototype),P.prototype[a]=function(){return this},f.AsyncIterator=P,f.async=function(e,t,r,n){var i=new P(_(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},x(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return u.type="throw",u.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],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(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function _(e,t,r,n){var i=t&&t.prototype instanceof O?t:O,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===y){if("throw"===i)throw o;return T()}for(r.method=i,r.arg=o;;){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=S(e,t,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)}}}(e,r,s),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function j(){}function k(){}function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function P(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,u){var a=S(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,u)},function(e){r("throw",e,s,u)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},u)}u(a.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function U(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,U(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,v;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,v):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(13)(e))},function(e,t,r){"use strict";var n=function(){return this}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,o=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,e.exports=r(14),i)n.regeneratorRuntime=o;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},function(e,t,r){"use strict";window.regeneratorRuntime=r(15);var n=r(12).Identity;e.exports={Identity:n}}]); | ||
//# sourceMappingURL=identity.js.map |
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=20)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new u.default(t)},t.isStr=s,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=a,t.isNonEmptyObj=function(e){return a(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!s(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return s(t)&&e.toUpperCase()===t.toUpperCase()})};var i,o=r(1),u=(i=o)&&i.__esModule?i:{default:i};function s(e){return"string"==typeof e}function a(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],u=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"}},JSONP:{TIMEOUT:7e3}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var u,s=e[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new a.default("No objects to clone");return r.forEach(function(t){(0,u.assert)((0,u.isObject)(t)),(0,u.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];void 0!==o&&(e[n]=(0,u.isObject)(o)?c(o):o)})}),e},t.cloneDeep=c;var o,u=r(0),s=r(1),a=(o=s)&&o.__esModule?o:{default:o};function c(e){return(0,u.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),u=(n=o)&&n.__esModule?n:{default:n},s=r(4),a=r(3),c=r(0);var l=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,c.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function f(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var p=window.fetch&&window.fetch.bind(window),h=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,u=void 0===o?p:o,s=t.log,l=t.defaultParams,f=void 0===l?{}:l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,c.assert)((0,c.isObject)(f),"defaultParams should be a non-null object"),this.url=new URL((0,a.urlMapper)(n,i)),this.defaultParams=f,s&&((0,c.assert)((0,c.isFunction)(s),"log must be a function but it is "+s),this.log=s),u&&((0,c.assert)((0,c.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return i(e,[{key:"go",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t){var r,n,i,o,a=t.method,f=t.headers,p=t.pathname,h=t.data,d=void 0===h?{}:h,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:a,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,c.assert)((0,c.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,c.assert)((0,c.isNonEmptyString)(a),'Method must be a non empty string but it is "'+a+'"'),(0,c.assert)((0,c.isNonEmptyString)(p),'Pathname must be string but it is "'+p+'"'),(0,c.assert)((0,c.isObject)(d),"data must be a non-null object"),b.headers=(0,c.isObject)(f)?(0,s.cloneDefined)(f):{},r=this.makeUrl(p,d,y),l(this.log,"Request:",b.method.toUpperCase(),r),l(this.log,"Request Headers:",b.headers),l(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,l(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new u.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return i=e.sent,l(this.log,"Response Parsed:",i),e.abrupt("return",i);case 23:throw e.prev=23,e.t0=e.catch(9),o=(0,c.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,c.isObject)(e.t0)&&(0,c.isStr)(e.t0.message)&&(o=e.t0.message),new u.default("Failed to '"+a+"' '"+r+"': '"+o+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}),function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var u=t[i](o),s=u.value}catch(e){return void r(e)}if(!u.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})});return function(e){return t.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,s.cloneDefined)(r,e):(0,s.cloneDefined)(e);return Object.keys(n).map(function(e){return f(e)+"="+f(n[e])}).join("&")}}]),e}();t.default=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(4),o=a(r(6)),u=a(r(2)),s=a(r(17));function a(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:s.default},e)));return r.timeout=e.timeout?Number(e.timeout):u.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var u=i.get;return void 0!==u?u.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",u=arguments[3];(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var s=e.screen,a=s.height,c=s.width,l=(0,i.cloneDefined)(o,u);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(a)&&(l.top=(a-l.height)/2);var f=(p=l,(0,n.assert)((0,n.isObject)(p),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(e){return e+"="+p[e]}).join(","));var p;return e.open(t,r,f)};var n=r(0),i=r(4);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),u=(n=o)&&n.__esModule?n:{default:n};function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function e(t){var r=this;s(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},c=function e(){var t=this;s(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},l=function(){function e(t){s(this,e),!function(e){if(!e)return!1;try{var t="x-x-x-x".replace(/x/g,function(){return Math.random()});e.setItem(t,"TEST-VALUE");var r=e.getItem(t);return e.removeItem(t),"TEST-VALUE"===r}catch(e){return!1}}(t)?(this.cache=new c,this.type="ObjectLiteralStorage"):(this.cache=new a(t),this.type="WebStorage")}return i(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new u.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:i,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new u.default(e)}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new u.default(e)}}}]),e}();t.default=l},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,u=n.length;o<u;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",a=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=_;var p="suspendedStart",h="suspendedYield",d="executing",v="completed",y={},m={};m[s]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(T([])));g&&g!==i&&o.call(g,s)&&(m=g);var w=U.prototype=O.prototype=Object.create(m);P.prototype=w.constructor=U,U.constructor=P,U[c]=P.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===P||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,U):(e.__proto__=U,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},k(j.prototype),j.prototype[a]=function(){return this},f.AsyncIterator=j,f.async=function(e,t,r,n){var i=new j(_(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},k(w),w[c]="Generator",w[s]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=T,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return s.type="throw",s.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],s=u.completion;if("root"===u.tryLoc)return r("end");if(u.tryLoc<=this.prev){var a=o.call(u,"catchLoc"),c=o.call(u,"finallyLoc");if(a&&c){if(this.prev<u.catchLoc)return r(u.catchLoc,!0);if(this.prev<u.finallyLoc)return r(u.finallyLoc)}else if(a){if(this.prev<u.catchLoc)return r(u.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return r(u.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(e,t,r,n){var i=t&&t.prototype instanceof O?t:O,o=Object.create(i.prototype),u=new N(n||[]);return o._invoke=function(e,t,r){var n=p;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return R()}for(r.method=i,r.arg=o;;){var u=r.delegate;if(u){var s=x(u,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var a=S(e,t,r);if("normal"===a.type){if(n=r.done?v:h,a.arg===y)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n=v,r.method="throw",r.arg=a.arg)}}}(e,r,u),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function P(){}function U(){}function k(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function j(e){var r;this._invoke=function(n,i){function u(){return new Promise(function(r,u){!function r(n,i,u,s){var a=S(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,u,s)},function(e){r("throw",e,u,s)}):Promise.resolve(l).then(function(e){c.value=e,u(c)},s)}s(a.arg)}(n,i,r,u)})}return r=r?r.then(u,u):u()}}function x(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,x(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function T(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(11)(e))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(3),u=r(2),s=p(r(7)),a=f(r(8)),c=p(r(6)),l=f(r(5));function f(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function p(e){return e&&e.__esModule?e:{default:e}}var h=window,d=t.Payment=function(){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,u=void 0===o?"PRE":o,s=t.window,a=void 0===s?h:s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.emulate(a),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=a,this._setSpidServerUrl(u),this._setBffServerUrl(u)}return n(e,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new s.default({serverUrl:(0,o.urlMapper)(e,u.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._bff=new c.default({serverUrl:(0,o.urlMapper)(e,u.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(e){var t=e.paylink,r=e.preferPopup,n=e.redirectUri,o=void 0===n?this.redirectUri:n;(0,i.assert)((0,i.isUrl)(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var u=this.purchasePaylinkUrl(t,o);return r&&(this.popup=a.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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:e})}},{key:"redeemUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:e})}},{key:"purchasePaylinkUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:e,redirect_uri:t})}},{key:"purchaseProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:e,redirect_uri:t})}},{key:"purchaseCampaignFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=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(0,i.assert)((0,i.isUrl)(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:e,product_id:t,voucher_code:r,redirect_uri:n})}}]),e}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return(e=n,e&&e.__esModule?e:{default:e}).default;var e}}),Object.defineProperty(t,"Payment",{enumerable:!0,get:function(){return n.Payment}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(3),u=r(2),s=f(r(10)),a=f(r(7)),c=f(r(9)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(5));function f(e){return e&&e.__esModule?e:{default:e}}function p(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var u=t[i](o),s=u.value}catch(e){return void r(e)}if(!u.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})}}var h=window,d=t.Monetization=function(e){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,u=void 0===o?"PRE":o,s=e.window,a=void 0===s?h:s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var f=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return l.emulate(a),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),f.cache=new c.default(a&&a.sessionStorage),f.clientId=r,f.redirectUri=n,f._setSpidServerUrl(u),f}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),n(t,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new a.default({serverUrl:(0,o.urlMapper)(e,u.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var e=p(regeneratorRuntime.mark(function e(t,r){var n,i,o,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="prd_"+t+"_"+r,!(i=this.cache.get(n))){e.next=4;break}return e.abrupt("return",i);case 4:return o={product_id:t},r&&(o.sp_id=r),e.next=8,this._spid.get("ajax/hasproduct.js",o);case 8:if((u=e.sent).result){e.next=11;break}return e.abrupt("return",null);case 11:return s=1e3*(u.expiresIn||30),this.cache.set(n,u,s),this.emit("hasProduct",{productId:t,data:u}),e.abrupt("return",u);case 15:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var e=p(regeneratorRuntime.mark(function e(t,r){var n,i,o,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="sub_"+t+"_"+r,!(i=this.cache.get(n))){e.next=4;break}return e.abrupt("return",i);case 4:return o={product_id:t},r&&(o.sp_id=r),e.next=8,this._spid.get("ajax/hassubscription.js",o);case 8:if((u=e.sent).result){e.next=11;break}return e.abrupt("return",null);case 11:return s=1e3*(u.expiresIn||30),this.cache.set(n,u,s),this.emit("hasSubscription",{subscriptionId:t,data:u}),e.abrupt("return",u);case 15:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:e})}},{key:"productsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:e})}}]),t}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(15);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return(e=n,e&&e.__esModule?e:{default:e}).default;var e}}),Object.defineProperty(t,"Monetization",{enumerable:!0,get:function(){return n.Monetization}})},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,u=t.timeout||r.timeout,s=t.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=s+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var p=document.createElement("script");p.setAttribute("src",""+o+s+"="+l),t.charset&&p.setAttribute("charset",t.charset),p.id=f,document.getElementsByTagName("head")[0].appendChild(p),a=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},u),p.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var u,s=e[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=r(0),s=r(4),a=r(3),c=r(2),l=b(r(10)),f=b(r(7)),p=b(r(9)),h=m(r(8)),d=b(r(6)),v=b(r(1)),y=m(r(5));function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function b(e){return e&&e.__esModule?e:{default:e}}function g(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var u=t[i](o),s=u.value}catch(e){return void r(e)}if(!u.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}("next")})}}var w=window;var _=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,o=void 0===i?"PRE":i,s=e.log,a=e.window,c=void 0===a?w:a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,u.assert)((0,u.isNonEmptyString)(r),"clientId parameter is required"),(0,u.assert)((0,u.isObject)(c),"The reference to window is missing"),(0,u.assert)(!n||(0,u.isUrl)(n),"redirectUri parameter is invalid"),y.emulate(c),l._sessionInitiatedSent=!1,l.window=c,l.clientId=r,l._initCache(),l.redirectUri=n,l.log=s,l._enableSessionCaching=!0,l._session={},l._setSpidServerUrl(o),l._setBffServerUrl(o),l._setOauthServerUrl(o),l._setHasSessionServerUrl(o),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,u.assert)((0,u.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,u.assert)((0,u.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,u.assert)((0,u.isStr)(e),"url parameter is invalid: "+e),this._bffService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,u.assert)((0,u.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.visitor&&this.emit("visitor",t.visitor),t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new p.default(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;"number"==typeof e.expiresIn&&e.expiresIn>0?t.setTime(t.getTime()+1e3*e.expiresIn):t.setTime(0);var r="string"==typeof e.baseDomain?e.baseDomain:document.domain||"",n=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,s,a,c,l=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("boolean"==typeof l){e.next=3;break}throw t=null===(f=l)?[void 0===f?"undefined":o(f),""+f]:[f.constructor.name,f.valueOf()],r=n(t,2),i=r[0],s=r[1],new v.default("Parameter 'autologin' must be boolean, was: \""+i+":"+s+'"');case 3:if(!this._enableSessionCaching){e.next=7;break}if(!(a=this.cache.get("hasSession-cache"))){e.next=7;break}return e.abrupt("return",a);case 7:return e.prev=7,e.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:l?1:0});case 10:if(c=e.sent,!(0,u.isObject)(c.error)||"LoginException"!==c.error.type){e.next=15;break}return e.next=14,this._spid.get("ajax/hasSession.js",{autologin:l?1:0});case 14:c=e.sent;case 15:if(c.result&&this.cache.set("hasSession-cache",c,1e3*c.expiresIn),!c.error){e.next=18;break}throw new v.default("HasSession endpoint returned an error",c.error);case 18:return this._maybeSetVarnishCookie(c),this._emitSessionEvent(this._session,c),this._session=c,e.abrupt("return",c);case 24:throw e.prev=24,e.t0=e.catch(7),this.emit("error",e.t0),new v.default("HasSession failed",e.t0);case 28:case"end":return e.stop()}var f},e,this,[[7,24]])}));return function(){return e.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new v.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,s.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new v.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new v.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).visitor||!t.visitor.uid){e.next=5;break}return e.abrupt("return",t.visitor.uid);case 5:throw new v.default("No visitor id available for this user");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,u=void 0===o?this.redirectUri:o,s=e.preferPopup,a=void 0!==s&&s,c=e.newFlow,l=void 0===c||c,f=e.loginHint,p=void 0===f?"":f;this._closePopup();var d=this.loginUrl(r,t,i,u,l,p);return a&&(this.popup=h.open(this.window,d,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=d,null)}},{key:"logout",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,o,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(e){return e.then(function(){return!0},function(){return!1})},e.next=3,Promise.all([t(this._spid.get("ajax/logout.js")),t(this._bffService.get("api/identity/logout"))]);case 3:if(r=e.sent,i=n(r,2),o=i[0],u=i[1],!o&&!u){e.next=12;break}this.cache.delete("hasSession-cache"),this.emit("logout"),e.next=15;break;case 12:throw s=new v.default("Could not log out from any endpoint"),this.emit("error",s),s;case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"loginUrl",value:function(e,t){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(0,u.assert)(!t||(0,u.isStrIn)(t,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+t),(0,u.assert)((0,u.isUrl)(n),"loginUrl(): redirectUri must be a valid url but is "+n),(0,u.assert)((0,u.isNonEmptyString)(e),"the state parameter should be a non empty string but it is "+e),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:e,acr_values:t,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:e,email:o})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,u.assert)((0,u.isUrl)(e),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:e})}},{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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,u.assert)((0,u.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,u.assert)((0,u.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,u.assert)((0,u.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}}]),t}();t.default=_},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(18);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return(e=n,e&&e.__esModule?e:{default:e}).default;var e}}),Object.defineProperty(t,"Identity",{enumerable:!0,get:function(){return n.Identity}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=t.Monetization=t.Identity=void 0;var n=r(19);Object.defineProperty(t,"Identity",{enumerable:!0,get:function(){return n.Identity}});var i=r(16);Object.defineProperty(t,"Monetization",{enumerable:!0,get:function(){return i.Monetization}});var o=r(14);Object.defineProperty(t,"Payment",{enumerable:!0,get:function(){return o.Payment}}),r(12)}]); | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=18)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assert=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!e)throw new s.default(t)},t.isStr=u,t.isNonEmptyString=function(e){return"string"==typeof e&&e.length>0},t.isObject=a,t.isNonEmptyObj=function(e){return a(e)&&Object.keys(e).length>0},t.isUrl=function(e){try{for(var t=new URL(e),r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.every(function(e){return t[e]})}catch(e){return!1}},t.isFunction=function(e){return"function"==typeof e},t.isStrIn=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!u(e)||!Array.isArray(t))return!1;if(r)return-1!==t.indexOf(e);return t.some(function(t){return u(t)&&e.toUpperCase()===t.toUpperCase()})};var i,o=r(1),s=(i=o)&&i.__esModule?i:{default:i};function u(e){return"string"==typeof e}function a(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=["boolean","number","string"],s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return i.name="SDKError","object"===(void 0===r?"undefined":n(r))&&Object.assign(i,r),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){var e=this,t=this.name+": "+this.message,r=Object.keys(this).filter(function(t){return"name"!==t&&o.includes(n(e[t]))}).map(function(t){return" "+t+": "+e[t]}).join("\n");return r?t+"\n"+r:t}}]),t}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={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}};t.default=n;t.ENDPOINTS=n.ENDPOINTS,t.JSONP=n.JSONP},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.urlMapper=function(e,t){if((0,i.assert)((0,i.isNonEmptyString)(e),'"url" param must be a non empty string: '+(void 0===e?"undefined":n(e))),(0,i.isNonEmptyObj)(t)&&(0,i.isUrl)(t[e]))return t[e];return(0,i.assert)((0,i.isUrl)(e,"hostname"),"Bad URL given: '"+e+"'"),e};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.cloneDefined=function(){for(var e={},t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r||!r.length)throw new a.default("No objects to clone");return r.forEach(function(t){(0,s.assert)((0,s.isObject)(t)),(0,s.isNonEmptyObj)(t)&&Object.entries(t).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];void 0!==o&&(e[n]=(0,s.isObject)(o)?c(o):o)})}),e},t.cloneDeep=c;var o,s=r(0),u=r(1),a=(o=u)&&o.__esModule?o:{default:o};function c(e){return(0,s.assert)("object"===(void 0===e?"undefined":n(e)),"obj should be an object (even null) but it is "+e),JSON.parse(JSON.stringify(e))||e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.emulate=function(e){null!==e.SPiD&&"object"===n(e.SPiD)||(e.SPiD={});null!==e.SPiD.Talk&&"object"===n(e.SPiD.Talk)||(e.SPiD.Talk={});(0,i.isFunction)(e.SPiD.Talk.response)||(e.SPiD.Talk.response=function(t,r){return e[t](r)})};var i=r(0)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=void 0;var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),s=(n=o)&&n.__esModule?n:{default:n},u=r(4),a=r(3),c=r(0);var l=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e&&e(function(e){return e.map(function(e){return(0,c.isObject)(e)?JSON.stringify(e,null,2):e}).join(" ")}(r))};function f(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}var h=function(){return window.fetch&&window.fetch.bind(window)},p=t.RESTClient=function(){function e(t){var r=t.serverUrl,n=void 0===r?"PRE":r,i=t.envDic,o=t.fetch,s=void 0===o?h():o,u=t.log,l=t.defaultParams,f=void 0===l?{}:l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,c.assert)((0,c.isObject)(f),"defaultParams should be a non-null object"),this.url=new URL((0,a.urlMapper)(n,i)),this.defaultParams=f,u&&((0,c.assert)((0,c.isFunction)(u),"log must be a function but it is "+u),this.log=u),s&&((0,c.assert)((0,c.isFunction)(s),"Fetch should be a function"),this.fetch=s)}return i(e,[{key:"go",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t){var r,n,i,o,a=t.method,f=t.headers,h=t.pathname,p=t.data,d=void 0===p?{}:p,v=t.useDefaultParams,y=void 0===v||v,m=t.fetchOptions,b=void 0===m?{method:a,credentials:"include"}:m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(0,c.assert)((0,c.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,c.assert)((0,c.isNonEmptyString)(a),'Method must be a non empty string but it is "'+a+'"'),(0,c.assert)((0,c.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,c.assert)((0,c.isObject)(d),"data must be a non-null object"),b.headers=(0,c.isObject)(f)?(0,u.cloneDefined)(f):{},r=this.makeUrl(h,d,y),l(this.log,"Request:",b.method.toUpperCase(),r),l(this.log,"Request Headers:",b.headers),l(this.log,"Request Body:",b.body),e.prev=9,e.next=12,this.fetch(r,b);case 12:if(n=e.sent,l(this.log,"Response Code:",n.status,n.statusText),n.ok){e.next=16;break}throw new s.default(n.statusText,{code:n.status});case 16:return e.next=18,n.json();case 18:return i=e.sent,l(this.log,"Response Parsed:",i),e.abrupt("return",i);case 23:throw e.prev=23,e.t0=e.catch(9),o=(0,c.isStr)(e.t0)?e.t0:"Unknown RESTClient error",(0,c.isObject)(e.t0)&&(0,c.isStr)(e.t0.message)&&(o=e.t0.message),new s.default("Failed to '"+a+"' '"+r+"': '"+o+"'",e.t0);case 28:case"end":return e.stop()}},e,this,[[9,23]])}),function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})});return function(e){return t.apply(this,arguments)}}()},{key:"makeUrl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new URL(t,this.url);return i.search=e.search(r,n,this.defaultParams),i.href}},{key:"get",value:function(e,t){return this.go({method:"get",pathname:e,data:t})}}],[{key:"search",value:function(e,t,r){var n=t?(0,u.cloneDefined)(r,e):(0,u.cloneDefined)(e);return Object.keys(n).map(function(e){return f(e)+"="+f(n[e])}).join("&")}}]),e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(4),o=a(r(6)),s=a(r(2)),u=a(r(13));function a(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,i.cloneDefined)({fetch:u.default},e)));return r.timeout=e.timeout?Number(e.timeout):s.default.JSONP.TIMEOUT,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),n(t,[{key:"go",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{method:"get",pathname:"/"},r={method:e.method,credentials:"include",timeout:this.timeout};return function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"go",this).call(this,Object.assign({fetchOptions:r},e))}}]),t}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.open=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments[3];(0,n.assert)((0,n.isObject)(e),"window was supposed to be an object but it is "+e),(0,n.assert)((0,n.isUrl)(t),"Invalid URL for popup");var u=e.screen,a=u.height,c=u.width,l=(0,i.cloneDefined)(o,s);Number.isFinite(l.width)&&Number.isFinite(c)&&(l.left=(c-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(a)&&(l.top=(a-l.height)/2);var f=(h=l,(0,n.assert)((0,n.isObject)(h),"Object must be an object but it is '"+h+"'"),Object.keys(h).map(function(e){return e+"="+h[e]}).join(","));var h;return e.open(t,r,f)};var n=r(0),i=r(4);var o={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(1),s=(n=o)&&n.__esModule?n:{default:n};function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function e(t){var r=this;u(this,e),this.store=t,this.get=function(e){return r.store.getItem(e)},this.set=function(e,t){return r.store.setItem(e,t)},this.delete=function(e){return r.store.removeItem(e)}},c=function e(){var t=this;u(this,e),this.store={},this.get=function(e){return t.store[e]},this.set=function(e,r){return t.store[e]=r},this.delete=function(e){return delete t.store[e]}},l=function(){function e(t){u(this,e),!function(e){if(!e)return!1;try{var t="x-x-x-x".replace(/x/g,function(){return Math.random()});e.setItem(t,"TEST-VALUE");var r=e.getItem(t);return e.removeItem(t),"TEST-VALUE"===r}catch(e){return!1}}(t)?(this.cache=new c,this.type="ObjectLiteralStorage"):(this.cache=new a(t),this.type="WebStorage")}return i(e,[{key:"get",value:function(e){try{var t=this.cache.get(e),r=t?JSON.parse(t):null;return r&&Number.isInteger(r.expiresOn)&&r.expiresOn>Date.now()?r.value:(this.delete(e),null)}catch(e){throw new s.default(e)}}},{key:"set",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(n<=0))try{var i=Math.floor(Date.now()+n);this.cache.set(e,JSON.stringify({expiresOn:i,value:t})),setTimeout(function(){return r.delete(e)},n)}catch(e){throw new s.default(e)}}},{key:"delete",value:function(e){try{this.cache.delete(e)}catch(e){throw new s.default(e)}}}]),e}();t.default=l},function(e,t,r){"use strict";function n(){}n.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,s=n.length;o<s;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Payment=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(3),s=r(2),u=h(r(7)),a=f(r(8)),c=h(r(6)),l=f(r(5));function f(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function h(e){return e&&e.__esModule?e:{default:e}}var p=function(){return window},d=t.Payment=function(){function e(t){var r=t.clientId,n=t.redirectUri,o=t.env,s=void 0===o?"PRE":o,u=t.window,a=void 0===u?p():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.emulate(a),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),this.clientId=r,this.redirectUri=n,this.window=a,this._setSpidServerUrl(s),this._setBffServerUrl(s)}return n(e,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new u.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._bff=new c.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(e){var t=e.paylink,r=e.preferPopup,n=e.redirectUri,o=void 0===n?this.redirectUri:n;(0,i.assert)((0,i.isUrl)(o),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var s=this.purchasePaylinkUrl(t,o);return r&&(this.popup=a.open(this.window,s,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=s,null)}},{key:"purchaseHistoryUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"purchaseHistoryUrl(): redirectUri is invalid"),this._spid.makeUrl("account/purchasehistory",{redirect_uri:e})}},{key:"redeemUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"redeemUrl(): redirectUri is invalid"),this._spid.makeUrl("account/redeem",{voucher_code:e})}},{key:"purchasePaylinkUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchasePaylinkUrl(): redirectUri is invalid"),this._bff.makeUrl("payment/purchase",{paylink:e,redirect_uri:t})}},{key:"purchaseProductFlowUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(t),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",product_id:e,redirect_uri:t})}},{key:"purchaseCampaignFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=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(0,i.assert)((0,i.isUrl)(n),"purchaseProductUrl(): redirectUri is invalid"),this._bff.makeUrl("flow/checkout",{response_type:"code",flow:"payment",campaign_id:e,product_id:t,voucher_code:r,redirect_uri:n})}}]),e}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Monetization=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(0),o=r(3),s=r(2),u=f(r(10)),a=f(r(7)),c=f(r(9)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(5));function f(e){return e&&e.__esModule?e:{default:e}}function h(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})}}var p=function(){return window},d=t.Monetization=function(e){function t(e){var r=e.clientId,n=e.redirectUri,o=e.env,s=void 0===o?"PRE":o,u=e.window,a=void 0===u?p():u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var f=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return l.emulate(a),(0,i.assert)((0,i.isNonEmptyString)(r),"clientId parameter is required"),f.cache=new c.default(a&&a.sessionStorage),f.clientId=r,f.redirectUri=n,f._setSpidServerUrl(s),f}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.default),n(t,[{key:"_setSpidServerUrl",value:function(e){(0,i.assert)((0,i.isStr)(e),"url parameter is invalid: "+e),this._spid=new a.default({serverUrl:(0,o.urlMapper)(e,s.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="prd_"+t+"_"+r,!(i=this.cache.get(n))){e.next=4;break}return e.abrupt("return",i);case 4:return o={product_id:t},r&&(o.sp_id=r),e.next=8,this._spid.get("ajax/hasproduct.js",o);case 8:if((s=e.sent).result){e.next=11;break}return e.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||30),this.cache.set(n,s,u),this.emit("hasProduct",{productId:t,data:s}),e.abrupt("return",s);case 15:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"hasSubscription",value:function(){var e=h(regeneratorRuntime.mark(function e(t,r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n="sub_"+t+"_"+r,!(i=this.cache.get(n))){e.next=4;break}return e.abrupt("return",i);case 4:return o={product_id:t},r&&(o.sp_id=r),e.next=8,this._spid.get("ajax/hassubscription.js",o);case 8:if((s=e.sent).result){e.next=11;break}return e.abrupt("return",null);case 11:return u=1e3*(s.expiresIn||30),this.cache.set(n,s,u),this.emit("hasSubscription",{subscriptionId:t,data:s}),e.abrupt("return",s);case 15:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"subscriptionsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"subscriptionsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/subscriptions",{redirect_uri:e})}},{key:"productsUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,i.assert)((0,i.isUrl)(e),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:e})}}]),t}();t.default=d},function(e,t,r){"use strict";var n,i,o;i=[t,e],void 0===(o="function"==typeof(n=function(e,t){var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(e){try{delete window[e]}catch(t){window[e]=void 0}}function i(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e,s=t.timeout||r.timeout,u=t.jsonpCallback||r.jsonpCallback,a=void 0;return new Promise(function(r,c){var l=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=u+"_"+l;window[l]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),a&&clearTimeout(a),i(f),n(l)},o+=-1===o.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+o+u+"="+l),t.charset&&h.setAttribute("charset",t.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),a=setTimeout(function(){c(new Error("JSONP request to "+e+" timed out")),n(l),i(f),window[l]=function(){n(l)}},s),h.onerror=function(){c(new Error("JSONP request to "+e+" failed")),n(l),i(f),a&&clearTimeout(a)}})}})?n.apply(t,i):n)||(e.exports=o)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=void 0;var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=r(0),u=r(4),a=r(3),c=r(2),l=b(r(10)),f=b(r(7)),h=b(r(9)),p=m(r(8)),d=b(r(6)),v=b(r(1)),y=m(r(5));function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function b(e){return e&&e.__esModule?e:{default:e}}function g(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(i,o){try{var s=t[i](o),u=s.value}catch(e){return void r(e)}if(!s.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})}}var w=function(){return window};var _=t.Identity=function(e){function t(e){var r=e.clientId,n=e.redirectUri,i=e.env,o=void 0===i?"PRE":i,u=e.log,a=e.window,c=void 0===a?w():a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return(0,s.assert)((0,s.isNonEmptyString)(r),"clientId parameter is required"),(0,s.assert)((0,s.isObject)(c),"The reference to window is missing"),(0,s.assert)(!n||(0,s.isUrl)(n),"redirectUri parameter is invalid"),y.emulate(c),l._sessionInitiatedSent=!1,l.window=c,l.clientId=r,l._initCache(),l.redirectUri=n,l.log=u,l._enableSessionCaching=!0,l._session={},l._setSpidServerUrl(o),l._setBffServerUrl(o),l._setOauthServerUrl(o),l._setHasSessionServerUrl(o),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),i(t,[{key:"_setSpidServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._spid=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setOauthServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._oauthService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.SPiD),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._bffService=new d.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.BFF),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setHasSessionServerUrl",value:function(e){(0,s.assert)((0,s.isStr)(e),"url parameter is invalid: "+e),this._hasSession=new f.default({serverUrl:(0,a.urlMapper)(e,c.ENDPOINTS.HAS_SESSION),log:this.log,defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_emitSessionEvent",value:function(e,t){t.visitor&&this.emit("visitor",t.visitor),t.userId&&this.emit("login",t),e.userId&&!t.userId&&this.emit("logout",t),e.userId&&t.userId&&e.userId!==t.userId&&this.emit("userChange",t),e.userId||t.userId?this.emit("sessionChange",t):this.emit("notLoggedin",t),t.userId&&!this._sessionInitiatedSent&&(this._sessionInitiatedSent=!0,this.emit("sessionInit",t)),e.userStatus!==t.userStatus&&this.emit("statusChange",t)}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"_initCache",value:function(){this.cache=new h.default(this.window&&this.window.localStorage)}},{key:"enableVarnishCookie",value:function(){this.setVarnishCookie=!0,this._initCache()}},{key:"_maybeSetVarnishCookie",value:function(e){if(this.setVarnishCookie){var t=new Date;"number"==typeof e.expiresIn&&e.expiresIn>0?t.setTime(t.getTime()+1e3*e.expiresIn):t.setTime(0);var r="string"==typeof e.baseDomain?e.baseDomain:document.domain||"",n=["SP_ID="+e.sp_id,"expires="+t.toUTCString(),"path=/","domain=."+r].join("; ");document.cookie=n}}},{key:"hasSession",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,u,a,c,l=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("boolean"==typeof l){e.next=3;break}throw t=null===(f=l)?[void 0===f?"undefined":o(f),""+f]:[f.constructor.name,f.valueOf()],r=n(t,2),i=r[0],u=r[1],new v.default("Parameter 'autologin' must be boolean, was: \""+i+":"+u+'"');case 3:if(!this._enableSessionCaching){e.next=7;break}if(!(a=this.cache.get("hasSession-cache"))){e.next=7;break}return e.abrupt("return",a);case 7:return e.prev=7,e.next=10,this._hasSession.get("rpc/hasSession.js",{autologin:l?1:0});case 10:if(c=e.sent,!(0,s.isObject)(c.error)||"LoginException"!==c.error.type){e.next=15;break}return e.next=14,this._spid.get("ajax/hasSession.js",{autologin:l?1:0});case 14:c=e.sent;case 15:if(c.result&&this.cache.set("hasSession-cache",c,1e3*c.expiresIn),!c.error){e.next=18;break}throw new v.default("HasSession endpoint returned an error",c.error);case 18:return this._maybeSetVarnishCookie(c),this._emitSessionEvent(this._session,c),this._session=c,e.abrupt("return",c);case 24:throw e.prev=24,e.t0=e.catch(7),this.emit("error",e.t0),new v.default("HasSession failed",e.t0);case 28:case"end":return e.stop()}var f},e,this,[[7,24]])}));return function(){return e.apply(this,arguments)}}()},{key:"isLoggedIn",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return","result"in t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isConnected",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",!!t.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if((t=e.sent).result){e.next=5;break}throw new v.default("The user is not connected to this merchant");case 5:return e.abrupt("return",(0,u.cloneDeep)(t));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).userId){e.next=5;break}return e.abrupt("return",t.userId);case 5:throw new v.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getUserUuid",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).uuid){e.next=5;break}return e.abrupt("return",t.uuid);case 5:throw new v.default("The user is not connected to this merchant");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getVisitorId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.hasSession();case 2:if(!(t=e.sent).visitor||!t.visitor.uid){e.next=5;break}return e.abrupt("return",t.visitor.uid);case 5:throw new v.default("No visitor id available for this user");case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getSpId",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.hasSession();case 3:return t=e.sent,e.abrupt("return",t.sp_id||null);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"login",value:function(e){var t=e.acrValues,r=e.state,n=e.scope,i=void 0===n?"openid":n,o=e.redirectUri,s=void 0===o?this.redirectUri:o,u=e.preferPopup,a=void 0!==u&&u,c=e.newFlow,l=void 0===c||c,f=e.loginHint,h=void 0===f?"":f;this._closePopup();var d=this.loginUrl(r,t,i,s,l,h);return a&&(this.popup=p.open(this.window,d,"Schibsted Account",{width:360,height:570}),this.popup)?this.popup:(this.window.location.href=d,null)}},{key:"logout",value:function(){var e=g(regeneratorRuntime.mark(function e(){var t,r,i,o,s,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(e){return e.then(function(){return!0},function(){return!1})},e.next=3,Promise.all([t(this._spid.get("ajax/logout.js")),t(this._bffService.get("api/identity/logout"))]);case 3:if(r=e.sent,i=n(r,2),o=i[0],s=i[1],!o&&!s){e.next=12;break}this.cache.delete("hasSession-cache"),this.emit("logout"),e.next=15;break;case 12:throw u=new v.default("Could not log out from any endpoint"),this.emit("error",u),u;case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"loginUrl",value:function(e,t){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(0,s.assert)(!t||(0,s.isStrIn)(t,["","otp-email","otp-sms"],!0),"The acrValues parameter is not acceptable: "+t),(0,s.assert)((0,s.isUrl)(n),"loginUrl(): redirectUri must be a valid url but is "+n),(0,s.assert)((0,s.isNonEmptyString)(e),"the state parameter should be a non empty string but it is "+e),i?this._oauthService.makeUrl("oauth/authorize",{response_type:"code","new-flow":!0,redirect_uri:n,scope:r,state:e,acr_values:t,login_hint:o}):this._spid.makeUrl("flow/login",{response_type:"code",redirect_uri:n,scope:r,state:e,email:o})}},{key:"logoutUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"logoutUrl(): redirectUri is invalid"),this._spid.makeUrl("logout",{response_type:"code",redirect_uri:e})}},{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 e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"authFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/auth",{response_type:"code",redirect_uri:e})}},{key:"signupFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signupFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signup",{response_type:"code",redirect_uri:e})}},{key:"signinFlowUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.redirectUri;return(0,s.assert)((0,s.isUrl)(e),"signinFlowUrl(): redirectUri is invalid"),this._spid.makeUrl("flow/signin",{response_type:"code",redirect_uri:e})}}]),t}();t.default=_},function(e,t,r){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(r){var n,i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"===t(e),f=r.regeneratorRuntime;if(f)l&&(e.exports=f);else{(f=r.regeneratorRuntime=l?e.exports:{}).wrap=_;var 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=k.prototype=O.prototype=Object.create(m);U.prototype=w.constructor=k,k.constructor=U,k[c]=U.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===U||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(w),e},f.awrap=function(e){return{__await:e}},P(j.prototype),j.prototype[a]=function(){return this},f.AsyncIterator=j,f.async=function(e,t,r,n){var i=new j(_(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},P(w),w[c]="Generator",w[u]=function(){return this},w.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=R,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return u.type="throw",u.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],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(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(e,t,r,n){var i=t&&t.prototype instanceof O?t:O,o=Object.create(i.prototype),s=new N(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw o;return T()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var u=x(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(e,t,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)}}}(e,r,s),o}function S(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function U(){}function k(){}function P(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function j(e){var r;this._invoke=function(n,i){function s(){return new Promise(function(r,s){!function r(n,i,s,u){var a=S(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"===(void 0===l?"undefined":t(l))&&o.call(l,"__await")?Promise.resolve(l.__await).then(function(e){r("next",e,s,u)},function(e){r("throw",e,s,u)}):Promise.resolve(l).then(function(e){c.value=e,s(c)},u)}u(a.arg)}(n,i,r,s)})}return r=r?r.then(s,s):s()}}function x(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,x(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=S(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,y;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(15)(e))},function(e,t,r){"use strict";var n=function(){return this}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,o=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,e.exports=r(16),i)n.regeneratorRuntime=o;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},function(e,t,r){"use strict";window.regeneratorRuntime=r(17);var n=r(14).Identity,i=r(12).Monetization,o=r(11).Payment;e.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=15)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.assert=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new u.default(e)},e.isStr=a,e.isNonEmptyString=function(t){return"string"==typeof t&&t.length>0},e.isObject=c,e.isNonEmptyObj=function(t){return c(t)&&Object.keys(t).length>0},e.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}},e.isFunction=function(t){return"function"==typeof t},e.isStrIn=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!a(t)||!Array.isArray(e))return!1;if(r)return-1!==e.indexOf(t);return e.some(function(e){return a(e)&&t.toUpperCase()===e.toUpperCase()})};var o,i=r(1),u=(o=i)&&o.__esModule?o:{default:o};function a(t){return"string"==typeof t}function c(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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}}();var i=["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,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&&i.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();e.default=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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")}}();e.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.default("No objects to clone");return r.forEach(function(e){(0,u.assert)((0,u.isObject)(e)),(0,u.isNonEmptyObj)(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=(0,u.isObject)(i)?s(i):i)})}),t},e.cloneDeep=s;var i,u=r(0),a=r(1),c=(i=a)&&i.__esModule?i:{default:i};function s(t){return(0,u.assert)("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"}},JSONP:{TIMEOUT:7e3}};e.default=n;e.ENDPOINTS=n.ENDPOINTS,e.JSONP=n.JSONP},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.urlMapper=function(t,e){if((0,o.assert)((0,o.isNonEmptyString)(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),(0,o.isNonEmptyObj)(e)&&(0,o.isUrl)(e[t]))return e[t];return(0,o.assert)((0,o.isUrl)(t,"hostname"),"Bad URL given: '"+t+"'"),t};var o=r(0)},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",d="executing",y="completed",v={},b={};b[a]=function(){return this};var m=Object.getPrototypeOf,g=m&&m(m(M([])));g&&g!==o&&i.call(g,a)&&(b=g);var w=P.prototype=j.prototype=Object.create(b);S.prototype=w.constructor=P,P.constructor=S,P[s]=S.displayName="GeneratorFunction",l.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"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}},x(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()})},x(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=M,L.prototype={constructor:L,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:M(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),v}}}function O(t,e,r,n){var o=e&&e.prototype instanceof j?e:j,i=Object.create(o.prototype),u=new L(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 U()}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=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=_(t,e,r);if("normal"===c.type){if(n=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function _(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function j(){}function S(){}function P(){}function x(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=_(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=_(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 N(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 L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function M(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:U}}function U(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(5)(t))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.emulate=function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={});null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={});(0,o.isFunction)(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})};var o=r(0)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,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=r(1),u=(n=i)&&n.__esModule?n:{default:n};function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var c=function t(e){var r=this;a(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)}},s=function t(){var e=this;a(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]}},f=function(){function t(e){a(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 s,this.type="ObjectLiteralStorage"):(this.cache=new c(e),this.type="WebStorage")}return o(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 u.default(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 u.default(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new u.default(t)}}}]),t}();e.default=f},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";Object.defineProperty(e,"__esModule",{value:!0}),e.RESTClient=void 0;var n,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=r(1),u=(n=i)&&n.__esModule?n:{default:n},a=r(2),c=r(4),s=r(0);var f=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(0,s.isObject)(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function l(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var h=window.fetch&&window.fetch.bind(window),p=e.RESTClient=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,u=void 0===i?h:i,a=e.log,f=e.defaultParams,l=void 0===f?{}:f;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(0,s.assert)((0,s.isObject)(l),"defaultParams should be a non-null object"),this.url=new URL((0,c.urlMapper)(n,o)),this.defaultParams=l,a&&((0,s.assert)((0,s.isFunction)(a),"log must be a function but it is "+a),this.log=a),u&&((0,s.assert)((0,s.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return o(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,o,i,c=e.method,l=e.headers,h=e.pathname,p=e.data,d=void 0===p?{}:p,y=e.useDefaultParams,v=void 0===y||y,b=e.fetchOptions,m=void 0===b?{method:c,credentials:"include"}:b;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(0,s.assert)((0,s.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,s.assert)((0,s.isNonEmptyString)(c),'Method must be a non empty string but it is "'+c+'"'),(0,s.assert)((0,s.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,s.assert)((0,s.isObject)(d),"data must be a non-null object"),m.headers=(0,s.isObject)(l)?(0,a.cloneDefined)(l):{},r=this.makeUrl(h,d,v),f(this.log,"Request:",m.method.toUpperCase(),r),f(this.log,"Request Headers:",m.headers),f(this.log,"Request Body:",m.body),t.prev=9,t.next=12,this.fetch(r,m);case 12:if(n=t.sent,f(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new u.default(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return o=t.sent,f(this.log,"Response Parsed:",o),t.abrupt("return",o);case 23:throw t.prev=23,t.t0=t.catch(9),i=(0,s.isStr)(t.t0)?t.t0:"Unknown RESTClient error",(0,s.isObject)(t.t0)&&(0,s.isStr)(t.t0.message)&&(i=t.t0.message),new u.default("Failed to '"+c+"' '"+r+"': '"+i+"'",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?(0,a.cloneDefined)(r,t):(0,a.cloneDefined)(t);return Object.keys(n).map(function(t){return l(t)+"="+l(n[t])}).join("&")}}]),t}();e.default=p},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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}}(),o=r(2),i=c(r(10)),u=c(r(3)),a=c(r(9));function c(t){return t&&t.__esModule?t:{default:t}}var s=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,(0,o.cloneDefined)({fetch:a.default},t)));return r.timeout=t.timeout?Number(t.timeout):u.default.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.default),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}();e.default=s},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";Object.defineProperty(e,"__esModule",{value:!0}),e.Monetization=void 0;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}}(),o=r(0),i=r(4),u=r(3),a=l(r(12)),c=l(r(11)),s=l(r(8)),f=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}(r(7));function l(t){return t&&t.__esModule?t:{default:t}}function h(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 p=window,d=e.Monetization=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,u=void 0===i?"PRE":i,a=t.window,c=void 0===a?p:a;!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 f.emulate(c),(0,o.assert)((0,o.isNonEmptyString)(r),"clientId parameter is required"),l.cache=new s.default(c&&c.sessionStorage),l.clientId=r,l.redirectUri=n,l._setSpidServerUrl(u),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,a.default),n(e,[{key:"_setSpidServerUrl",value:function(t){(0,o.assert)((0,o.isStr)(t),"url parameter is invalid: "+t),this._spid=new c.default({serverUrl:(0,i.urlMapper)(t,u.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var t=h(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=h(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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(t),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:t})}}]),e}();e.default=d},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(13);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return(t=n,t&&t.__esModule?t:{default:t}).default;var t}}),Object.defineProperty(e,"Monetization",{enumerable:!0,get:function(){return n.Monetization}})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Monetization=void 0;var n=r(14);Object.defineProperty(e,"Monetization",{enumerable:!0,get:function(){return n.Monetization}}),r(6)}]); | ||
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";Object.defineProperty(e,"__esModule",{value:!0});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};e.assert=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new u.default(e)},e.isStr=a,e.isNonEmptyString=function(t){return"string"==typeof t&&t.length>0},e.isObject=c,e.isNonEmptyObj=function(t){return c(t)&&Object.keys(t).length>0},e.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}},e.isFunction=function(t){return"function"==typeof t},e.isStrIn=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!a(t)||!Array.isArray(e))return!1;if(r)return-1!==e.indexOf(t);return e.some(function(e){return a(e)&&t.toUpperCase()===e.toUpperCase()})};var o,i=r(1),u=(o=i)&&o.__esModule?o:{default:o};function a(t){return"string"==typeof t}function c(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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}}();var i=["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,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&&i.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();e.default=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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")}}();e.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.default("No objects to clone");return r.forEach(function(e){(0,u.assert)((0,u.isObject)(e)),(0,u.isNonEmptyObj)(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=(0,u.isObject)(i)?s(i):i)})}),t},e.cloneDeep=s;var i,u=r(0),a=r(1),c=(i=a)&&i.__esModule?i:{default:i};function s(t){return(0,u.assert)("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"}},JSONP:{TIMEOUT:7e3}};e.default=n;e.ENDPOINTS=n.ENDPOINTS,e.JSONP=n.JSONP},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.urlMapper=function(t,e){if((0,o.assert)((0,o.isNonEmptyString)(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),(0,o.isNonEmptyObj)(e)&&(0,o.isUrl)(e[t]))return e[t];return(0,o.assert)((0,o.isUrl)(t,"hostname"),"Bad URL given: '"+t+"'"),t};var o=r(0)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.emulate=function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={});null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={});(0,o.isFunction)(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})};var o=r(0)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,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=r(1),u=(n=i)&&n.__esModule?n:{default:n};function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var c=function t(e){var r=this;a(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)}},s=function t(){var e=this;a(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]}},f=function(){function t(e){a(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 s,this.type="ObjectLiteralStorage"):(this.cache=new c(e),this.type="WebStorage")}return o(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 u.default(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 u.default(t)}}},{key:"delete",value:function(t){try{this.cache.delete(t)}catch(t){throw new u.default(t)}}}]),t}();e.default=f},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";Object.defineProperty(e,"__esModule",{value:!0}),e.RESTClient=void 0;var n,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=r(1),u=(n=i)&&n.__esModule?n:{default:n},a=r(2),c=r(4),s=r(0);var f=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(0,s.isObject)(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function l(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var h=function(){return window.fetch&&window.fetch.bind(window)},p=e.RESTClient=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,u=void 0===i?h():i,a=e.log,f=e.defaultParams,l=void 0===f?{}:f;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(0,s.assert)((0,s.isObject)(l),"defaultParams should be a non-null object"),this.url=new URL((0,c.urlMapper)(n,o)),this.defaultParams=l,a&&((0,s.assert)((0,s.isFunction)(a),"log must be a function but it is "+a),this.log=a),u&&((0,s.assert)((0,s.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return o(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,o,i,c=e.method,l=e.headers,h=e.pathname,p=e.data,d=void 0===p?{}:p,y=e.useDefaultParams,v=void 0===y||y,m=e.fetchOptions,b=void 0===m?{method:c,credentials:"include"}:m;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(0,s.assert)((0,s.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,s.assert)((0,s.isNonEmptyString)(c),'Method must be a non empty string but it is "'+c+'"'),(0,s.assert)((0,s.isNonEmptyString)(h),'Pathname must be string but it is "'+h+'"'),(0,s.assert)((0,s.isObject)(d),"data must be a non-null object"),b.headers=(0,s.isObject)(l)?(0,a.cloneDefined)(l):{},r=this.makeUrl(h,d,v),f(this.log,"Request:",b.method.toUpperCase(),r),f(this.log,"Request Headers:",b.headers),f(this.log,"Request Body:",b.body),t.prev=9,t.next=12,this.fetch(r,b);case 12:if(n=t.sent,f(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new u.default(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return o=t.sent,f(this.log,"Response Parsed:",o),t.abrupt("return",o);case 23:throw t.prev=23,t.t0=t.catch(9),i=(0,s.isStr)(t.t0)?t.t0:"Unknown RESTClient error",(0,s.isObject)(t.t0)&&(0,s.isStr)(t.t0.message)&&(i=t.t0.message),new u.default("Failed to '"+c+"' '"+r+"': '"+i+"'",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?(0,a.cloneDefined)(r,t):(0,a.cloneDefined)(t);return Object.keys(n).map(function(t){return l(t)+"="+l(n[t])}).join("&")}}]),t}();e.default=p},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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}}(),o=r(2),i=c(r(8)),u=c(r(3)),a=c(r(7));function c(t){return t&&t.__esModule?t:{default:t}}var s=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,(0,o.cloneDefined)({fetch:a.default},t)));return r.timeout=t.timeout?Number(t.timeout):u.default.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.default),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}();e.default=s},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";Object.defineProperty(e,"__esModule",{value:!0}),e.Monetization=void 0;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}}(),o=r(0),i=r(4),u=r(3),a=l(r(10)),c=l(r(9)),s=l(r(6)),f=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}(r(5));function l(t){return t&&t.__esModule?t:{default:t}}function h(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 p=function(){return window},d=e.Monetization=function(t){function e(t){var r=t.clientId,n=t.redirectUri,i=t.env,u=void 0===i?"PRE":i,a=t.window,c=void 0===a?p():a;!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 f.emulate(c),(0,o.assert)((0,o.isNonEmptyString)(r),"clientId parameter is required"),l.cache=new s.default(c&&c.sessionStorage),l.clientId=r,l.redirectUri=n,l._setSpidServerUrl(u),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,a.default),n(e,[{key:"_setSpidServerUrl",value:function(t){(0,o.assert)((0,o.isStr)(t),"url parameter is invalid: "+t),this._spid=new c.default({serverUrl:(0,i.urlMapper)(t,u.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"hasProduct",value:function(){var t=h(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=h(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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(t),"productsUrl(): redirectUri is invalid"),this._spid.makeUrl("account/products",{redirect_uri:t})}}]),e}();e.default=d},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",d="executing",y="completed",v={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(L([])));g&&g!==o&&i.call(g,a)&&(m=g);var w=P.prototype=S.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}},x(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()})},x(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=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(R),!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),R(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;R(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 O(t,e,r,n){var o=e&&e.prototype instanceof S?e:S,i=Object.create(o.prototype),u=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 U()}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=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=_(t,e,r);if("normal"===c.type){if(n=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function _(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function S(){}function j(){}function P(){}function x(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=_(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=_(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 N(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 R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function L(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:U}}function U(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(12)(t))},function(t,e,r){"use strict";var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=r(13),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e,r){"use strict";window.regeneratorRuntime=r(14);var n=r(11).Monetization;t.exports={Monetization:n}}]); | ||
//# 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=14)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.assert=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new u.default(e)},e.isStr=a,e.isNonEmptyString=function(t){return"string"==typeof t&&t.length>0},e.isObject=c,e.isNonEmptyObj=function(t){return c(t)&&Object.keys(t).length>0},e.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}},e.isFunction=function(t){return"function"==typeof t},e.isStrIn=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!a(t)||!Array.isArray(e))return!1;if(r)return-1!==e.indexOf(t);return e.some(function(e){return a(e)&&t.toUpperCase()===e.toUpperCase()})};var o,i=r(2),u=(o=i)&&o.__esModule?o:{default:o};function a(t){return"string"==typeof t}function c(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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")}}();e.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.default("No objects to clone");return r.forEach(function(e){(0,u.assert)((0,u.isObject)(e)),(0,u.isNonEmptyObj)(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=(0,u.isObject)(i)?s(i):i)})}),t},e.cloneDeep=s;var i,u=r(0),a=r(2),c=(i=a)&&i.__esModule?i:{default:i};function s(t){return(0,u.assert)("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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}}();var i=["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,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&&i.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();e.default=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RESTClient=void 0;var n,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=r(2),u=(n=i)&&n.__esModule?n:{default:n},a=r(1),c=r(5),s=r(0);var l=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(0,s.isObject)(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function f(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var p=window.fetch&&window.fetch.bind(window),h=e.RESTClient=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,u=void 0===i?p:i,a=e.log,l=e.defaultParams,f=void 0===l?{}:l;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(0,s.assert)((0,s.isObject)(f),"defaultParams should be a non-null object"),this.url=new URL((0,c.urlMapper)(n,o)),this.defaultParams=f,a&&((0,s.assert)((0,s.isFunction)(a),"log must be a function but it is "+a),this.log=a),u&&((0,s.assert)((0,s.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return o(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,o,i,c=e.method,f=e.headers,p=e.pathname,h=e.data,d=void 0===h?{}:h,y=e.useDefaultParams,v=void 0===y||y,m=e.fetchOptions,b=void 0===m?{method:c,credentials:"include"}:m;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(0,s.assert)((0,s.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,s.assert)((0,s.isNonEmptyString)(c),'Method must be a non empty string but it is "'+c+'"'),(0,s.assert)((0,s.isNonEmptyString)(p),'Pathname must be string but it is "'+p+'"'),(0,s.assert)((0,s.isObject)(d),"data must be a non-null object"),b.headers=(0,s.isObject)(f)?(0,a.cloneDefined)(f):{},r=this.makeUrl(p,d,v),l(this.log,"Request:",b.method.toUpperCase(),r),l(this.log,"Request Headers:",b.headers),l(this.log,"Request Body:",b.body),t.prev=9,t.next=12,this.fetch(r,b);case 12:if(n=t.sent,l(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new u.default(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return o=t.sent,l(this.log,"Response Parsed:",o),t.abrupt("return",o);case 23:throw t.prev=23,t.t0=t.catch(9),i=(0,s.isStr)(t.t0)?t.t0:"Unknown RESTClient error",(0,s.isObject)(t.t0)&&(0,s.isStr)(t.t0.message)&&(i=t.t0.message),new u.default("Failed to '"+c+"' '"+r+"': '"+i+"'",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?(0,a.cloneDefined)(r,t):(0,a.cloneDefined)(t);return Object.keys(n).map(function(t){return f(t)+"="+f(n[t])}).join("&")}}]),t}();e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"}},JSONP:{TIMEOUT:7e3}};e.default=n;e.ENDPOINTS=n.ENDPOINTS,e.JSONP=n.JSONP},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.urlMapper=function(t,e){if((0,o.assert)((0,o.isNonEmptyString)(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),(0,o.isNonEmptyObj)(e)&&(0,o.isUrl)(e[t]))return e[t];return(0,o.assert)((0,o.isUrl)(t,"hostname"),"Bad URL given: '"+t+"'"),t};var o=r(0)},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",d="executing",y="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=S.prototype=P.prototype=Object.create(m);j.prototype=w.constructor=S,S.constructor=j,S[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,S):(t.__proto__=S,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},E(k.prototype),k.prototype[c]=function(){return this},f.AsyncIterator=k,f.async=function(t,e,r,n){var o=new k(O(t,e,r,n));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},E(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,L.prototype={constructor:L,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(N),!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),N(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;N(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 P?e:P,i=Object.create(o.prototype),u=new L(n||[]);return i._invoke=function(t,e,r){var n=p;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 u=r.delegate;if(u){var a=U(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=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=_(t,e,r);if("normal"===c.type){if(n=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function _(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function P(){}function j(){}function S(){}function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function k(t){var r;this._invoke=function(n,o){function u(){return new Promise(function(r,u){!function r(n,o,u,a){var c=_(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 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 x(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 N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,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(6)(t))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.emulate=function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={});null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={});(0,o.isFunction)(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})};var o=r(0)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.open=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",u=arguments[3];(0,n.assert)((0,n.isObject)(t),"window was supposed to be an object but it is "+t),(0,n.assert)((0,n.isUrl)(e),"Invalid URL for popup");var a=t.screen,c=a.height,s=a.width,l=(0,o.cloneDefined)(i,u);Number.isFinite(l.width)&&Number.isFinite(s)&&(l.left=(s-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(c)&&(l.top=(c-l.height)/2);var f=(p=l,(0,n.assert)((0,n.isObject)(p),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(t){return t+"="+p[t]}).join(","));var p;return t.open(e,r,f)};var n=r(0),o=r(1);var i={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},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";Object.defineProperty(e,"__esModule",{value:!0});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}}(),o=r(1),i=c(r(3)),u=c(r(4)),a=c(r(10));function c(t){return t&&t.__esModule?t:{default:t}}var s=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,(0,o.cloneDefined)({fetch:a.default},t)));return r.timeout=t.timeout?Number(t.timeout):u.default.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.default),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}();e.default=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Payment=void 0;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}}(),o=r(0),i=r(5),u=r(4),a=p(r(11)),c=f(r(9)),s=p(r(3)),l=f(r(8));function f(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function p(t){return t&&t.__esModule?t:{default:t}}var h=window,d=e.Payment=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?h:a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),l.emulate(c),(0,o.assert)((0,o.isNonEmptyString)(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){(0,o.assert)((0,o.isStr)(t),"url parameter is invalid: "+t),this._spid=new a.default({serverUrl:(0,i.urlMapper)(t,u.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){(0,o.assert)((0,o.isStr)(t),"url parameter is invalid: "+t),this._bff=new s.default({serverUrl:(0,i.urlMapper)(t,u.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(t){var e=t.paylink,r=t.preferPopup,n=t.redirectUri,i=void 0===n?this.redirectUri:n;(0,o.assert)((0,o.isUrl)(i),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var u=this.purchasePaylinkUrl(e,i);return r&&(this.popup=c.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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(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}();e.default=d},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(12);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return(t=n,t&&t.__esModule?t:{default:t}).default;var t}}),Object.defineProperty(e,"Payment",{enumerable:!0,get:function(){return n.Payment}})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Payment=void 0;var n=r(13);Object.defineProperty(e,"Payment",{enumerable:!0,get:function(){return n.Payment}}),r(7)}]); | ||
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";Object.defineProperty(e,"__esModule",{value:!0});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};e.assert=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Assertion failed";if(!t)throw new u.default(e)},e.isStr=a,e.isNonEmptyString=function(t){return"string"==typeof t&&t.length>0},e.isObject=c,e.isNonEmptyObj=function(t){return c(t)&&Object.keys(t).length>0},e.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}},e.isFunction=function(t){return"function"==typeof t},e.isStrIn=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!a(t)||!Array.isArray(e))return!1;if(r)return-1!==e.indexOf(t);return e.some(function(e){return a(e)&&t.toUpperCase()===e.toUpperCase()})};var o,i=r(2),u=(o=i)&&o.__esModule?o:{default:o};function a(t){return"string"==typeof t}function c(t){return"object"===(void 0===t?"undefined":n(t))&&null!==t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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")}}();e.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.default("No objects to clone");return r.forEach(function(e){(0,u.assert)((0,u.isObject)(e)),(0,u.isNonEmptyObj)(e)&&Object.entries(e).forEach(function(e){var r=o(e,2),n=r[0],i=r[1];void 0!==i&&(t[n]=(0,u.isObject)(i)?s(i):i)})}),t},e.cloneDeep=s;var i,u=r(0),a=r(2),c=(i=a)&&i.__esModule?i:{default:i};function s(t){return(0,u.assert)("object"===(void 0===t?"undefined":n(t)),"obj should be an object (even null) but it is "+t),JSON.parse(JSON.stringify(t))||t}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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}}();var i=["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,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&&i.includes(n(t[e]))}).map(function(e){return" "+e+": "+t[e]}).join("\n");return r?e+"\n"+r:e}}]),e}();e.default=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RESTClient=void 0;var n,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=r(2),u=(n=i)&&n.__esModule?n:{default:n},a=r(1),c=r(5),s=r(0);var l=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(0,s.isObject)(t)?JSON.stringify(t,null,2):t}).join(" ")}(r))};function f(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}var p=function(){return window.fetch&&window.fetch.bind(window)},h=e.RESTClient=function(){function t(e){var r=e.serverUrl,n=void 0===r?"PRE":r,o=e.envDic,i=e.fetch,u=void 0===i?p():i,a=e.log,l=e.defaultParams,f=void 0===l?{}:l;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(0,s.assert)((0,s.isObject)(f),"defaultParams should be a non-null object"),this.url=new URL((0,c.urlMapper)(n,o)),this.defaultParams=f,a&&((0,s.assert)((0,s.isFunction)(a),"log must be a function but it is "+a),this.log=a),u&&((0,s.assert)((0,s.isFunction)(u),"Fetch should be a function"),this.fetch=u)}return o(t,[{key:"go",value:function(){var t,e=(t=regeneratorRuntime.mark(function t(e){var r,n,o,i,c=e.method,f=e.headers,p=e.pathname,h=e.data,d=void 0===h?{}:h,y=e.useDefaultParams,v=void 0===y||y,m=e.fetchOptions,b=void 0===m?{method:c,credentials:"include"}:m;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(0,s.assert)((0,s.isFunction)(this.fetch),"Can't make a call. The reference to fetch is missing or not a function."),(0,s.assert)((0,s.isNonEmptyString)(c),'Method must be a non empty string but it is "'+c+'"'),(0,s.assert)((0,s.isNonEmptyString)(p),'Pathname must be string but it is "'+p+'"'),(0,s.assert)((0,s.isObject)(d),"data must be a non-null object"),b.headers=(0,s.isObject)(f)?(0,a.cloneDefined)(f):{},r=this.makeUrl(p,d,v),l(this.log,"Request:",b.method.toUpperCase(),r),l(this.log,"Request Headers:",b.headers),l(this.log,"Request Body:",b.body),t.prev=9,t.next=12,this.fetch(r,b);case 12:if(n=t.sent,l(this.log,"Response Code:",n.status,n.statusText),n.ok){t.next=16;break}throw new u.default(n.statusText,{code:n.status});case 16:return t.next=18,n.json();case 18:return o=t.sent,l(this.log,"Response Parsed:",o),t.abrupt("return",o);case 23:throw t.prev=23,t.t0=t.catch(9),i=(0,s.isStr)(t.t0)?t.t0:"Unknown RESTClient error",(0,s.isObject)(t.t0)&&(0,s.isStr)(t.t0.message)&&(i=t.t0.message),new u.default("Failed to '"+c+"' '"+r+"': '"+i+"'",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?(0,a.cloneDefined)(r,t):(0,a.cloneDefined)(t);return Object.keys(n).map(function(t){return f(t)+"="+f(n[t])}).join("&")}}]),t}();e.default=h},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={ENDPOINTS:{SPiD:{LOCAL:"http://id.localhost",DEV:"https://identity-dev.schibsted.com",PRE:"https://identity-pre.schibsted.com",PRO:"https://login.schibsted.com",PRO_NO:"https://payment.schibsted.no"},HAS_SESSION:{LOCAL:"http://session.id.localhost",DEV:"https://session.identity-dev.schibsted.com",PRE:"https://session.identity-pre.schibsted.com",PRO:"https://session.login.schibsted.com",PRO_NO:"https://session.payment.schibsted.no"},BFF:{LOCAL:"http://id.localhost/authn/",DEV:"https://identity-dev.schibsted.com/authn/",PRE:"https://identity-pre.schibsted.com/authn/",PRO:"https://login.schibsted.com/authn/",PRO_NO:"https://payment.schibsted.no/authn/"}},JSONP:{TIMEOUT:7e3}};e.default=n;e.ENDPOINTS=n.ENDPOINTS,e.JSONP=n.JSONP},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.urlMapper=function(t,e){if((0,o.assert)((0,o.isNonEmptyString)(t),'"url" param must be a non empty string: '+(void 0===t?"undefined":n(t))),(0,o.isNonEmptyObj)(e)&&(0,o.isUrl)(e[t]))return e[t];return(0,o.assert)((0,o.isUrl)(t,"hostname"),"Bad URL given: '"+t+"'"),t};var o=r(0)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});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};e.emulate=function(t){null!==t.SPiD&&"object"===n(t.SPiD)||(t.SPiD={});null!==t.SPiD.Talk&&"object"===n(t.SPiD.Talk)||(t.SPiD.Talk={});(0,o.isFunction)(t.SPiD.Talk.response)||(t.SPiD.Talk.response=function(e,r){return t[e](r)})};var o=r(0)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.open=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",u=arguments[3];(0,n.assert)((0,n.isObject)(t),"window was supposed to be an object but it is "+t),(0,n.assert)((0,n.isUrl)(e),"Invalid URL for popup");var a=t.screen,c=a.height,s=a.width,l=(0,o.cloneDefined)(i,u);Number.isFinite(l.width)&&Number.isFinite(s)&&(l.left=(s-l.width)/2);Number.isFinite(l.height)&&Number.isFinite(c)&&(l.top=(c-l.height)/2);var f=(p=l,(0,n.assert)((0,n.isObject)(p),"Object must be an object but it is '"+p+"'"),Object.keys(p).map(function(t){return t+"="+p[t]}).join(","));var p;return t.open(e,r,f)};var n=r(0),o=r(1);var i={scrollbars:"yes",location:"yes",status:"no",menubar:"no",toolbar:"no",resizable:"yes"}},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";Object.defineProperty(e,"__esModule",{value:!0});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}}(),o=r(1),i=c(r(3)),u=c(r(4)),a=c(r(8));function c(t){return t&&t.__esModule?t:{default:t}}var s=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,(0,o.cloneDefined)({fetch:a.default},t)));return r.timeout=t.timeout?Number(t.timeout):u.default.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.default),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}();e.default=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Payment=void 0;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}}(),o=r(0),i=r(5),u=r(4),a=p(r(9)),c=f(r(7)),s=p(r(3)),l=f(r(6));function f(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function p(t){return t&&t.__esModule?t:{default:t}}var h=function(){return window},d=e.Payment=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?h():a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),l.emulate(c),(0,o.assert)((0,o.isNonEmptyString)(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){(0,o.assert)((0,o.isStr)(t),"url parameter is invalid: "+t),this._spid=new a.default({serverUrl:(0,i.urlMapper)(t,u.ENDPOINTS.SPiD),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_setBffServerUrl",value:function(t){(0,o.assert)((0,o.isStr)(t),"url parameter is invalid: "+t),this._bff=new s.default({serverUrl:(0,i.urlMapper)(t,u.ENDPOINTS.BFF),defaultParams:{client_id:this.clientId,redirect_uri:this.redirectUri}})}},{key:"_closePopup",value:function(){this.popup&&(this.popup.closed||this.popup.close(),this.popup=null)}},{key:"payWithPaylink",value:function(t){var e=t.paylink,r=t.preferPopup,n=t.redirectUri,i=void 0===n?this.redirectUri:n;(0,o.assert)((0,o.isUrl)(i),"payWithPaylink(): redirectUri is invalid"),this._closePopup();var u=this.purchasePaylinkUrl(e,i);return r&&(this.popup=c.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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(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(0,o.assert)((0,o.isUrl)(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}();e.default=d},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",d="executing",y="completed",v={},m={};m[a]=function(){return this};var b=Object.getPrototypeOf,g=b&&b(b(R([])));g&&g!==o&&i.call(g,a)&&(m=g);var w=S.prototype=P.prototype=Object.create(m);j.prototype=w.constructor=S,S.constructor=j,S[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,S):(t.__proto__=S,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(w),t},f.awrap=function(t){return{__await:t}},E(k.prototype),k.prototype[c]=function(){return this},f.AsyncIterator=k,f.async=function(t,e,r,n){var o=new k(O(t,e,r,n));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},E(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=R,L.prototype={constructor:L,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(N),!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),N(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;N(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 O(t,e,r,n){var o=e&&e.prototype instanceof P?e:P,i=Object.create(o.prototype),u=new L(n||[]);return i._invoke=function(t,e,r){var n=p;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=U(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=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=_(t,e,r);if("normal"===c.type){if(n=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function _(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function P(){}function j(){}function S(){}function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function k(t){var r;this._invoke=function(n,o){function u(){return new Promise(function(r,u){!function r(n,o,u,a){var c=_(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 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 x(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 N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function R(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:T}}function T(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())}).call(this,r(11)(t))},function(t,e,r){"use strict";var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=r(12),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e,r){"use strict";window.regeneratorRuntime=r(13);var n=r(10).Payment;t.exports={Payment:n}}]); | ||
//# sourceMappingURL=payment.js.map |
{ | ||
"name": "@schibsted/account-sdk-browser", | ||
"version": "3.0.0-rc.3", | ||
"version": "3.0.0-rc.4", | ||
"description": "Schibsted Account SDK for browsers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -66,2 +66,4 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
const maxExpiresIn = Math.pow(2, 31) - 1; | ||
/** | ||
@@ -117,2 +119,3 @@ * Cache class that attempts WebStorage (session/local storage), and falls back to JS object literal | ||
} | ||
expiresIn = Math.min(maxExpiresIn, expiresIn); | ||
@@ -119,0 +122,0 @@ try { |
@@ -11,8 +11,9 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
import 'regenerator-runtime/runtime'; | ||
const regeneratorRuntime = require('regenerator-runtime'); | ||
const { Identity } = require('../identity'); | ||
const { Monetization } = require('../monetization'); | ||
const { Payment } = require('../payment'); | ||
import Identity from '../../identity'; | ||
import Monetization from '../../monetization'; | ||
import Payment from '../../payment'; | ||
module.exports = { Identity, Monetization, Payment }; | ||
Object.assign(window, { Identity, Monetization, Payment }); | ||
Object.assign(window, { Identity, Monetization, Payment, regeneratorRuntime }); |
@@ -7,4 +7,5 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
import 'regenerator-runtime/runtime'; | ||
window.regeneratorRuntime = require('regenerator-runtime'); | ||
const { Identity } = require('../identity'); | ||
export { Identity } from '../identity'; | ||
module.exports = { Identity }; |
@@ -7,6 +7,8 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
import 'regenerator-runtime/runtime'; | ||
window.regeneratorRuntime = require('regenerator-runtime'); | ||
export { Identity } from '../../identity'; | ||
export { Monetization } from '../../monetization'; | ||
export { Payment } from '../../payment'; | ||
const { Identity } = require('../identity'); | ||
const { Monetization } = require('../monetization'); | ||
const { Payment } = require('../payment'); | ||
module.exports = { Identity, Monetization, Payment }; |
@@ -7,4 +7,5 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
import 'regenerator-runtime/runtime'; | ||
window.regeneratorRuntime = require('regenerator-runtime'); | ||
const { Monetization } = require('../monetization'); | ||
export { Monetization } from '../../monetization'; | ||
module.exports = { Monetization }; |
@@ -7,4 +7,5 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
import 'regenerator-runtime/runtime'; | ||
window.regeneratorRuntime = require('regenerator-runtime'); | ||
const { Payment } = require('../payment'); | ||
export { Payment } from '../../payment'; | ||
module.exports = { Payment }; |
@@ -70,3 +70,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
const HAS_SESSION_CACHE_KEY = 'hasSession-cache'; | ||
const globalWindow = window; | ||
const globalWindow = () => window; | ||
@@ -99,3 +99,3 @@ /** | ||
*/ | ||
constructor({ clientId, redirectUri, env = 'PRE', log, window = globalWindow }) { | ||
constructor({ clientId, redirectUri, env = 'PRE', log, window = globalWindow() }) { | ||
super(); | ||
@@ -322,4 +322,9 @@ assert(isNonEmptyString(clientId), 'clientId parameter is required'); | ||
/** | ||
* Queries the hassession endpoint | ||
* @param {boolean} [autologin=true] - | ||
* @summary Queries the hassession endpoint and returns information about the status of the user | ||
* @description When we send a request to this endpoint, cookies sent along with the request | ||
* determines the status of the user. If the user is not currently logged in, but has a cookie | ||
* with the "Remember me" flag switched on, calling this function will attempt to automatically | ||
* perform a login on the user | ||
* @param {boolean} [autologin=true] - Set this to `false` if you do **not** want the auto-login | ||
* to happen | ||
* @throws {SDKError} - If the call to the hasSession service fails in any way (this will happen | ||
@@ -347,2 +352,3 @@ * if, say, the user is not logged in) | ||
if (cachedData) { | ||
this._emitSessionEvent(this._session, cachedData); | ||
return cachedData; | ||
@@ -374,4 +380,6 @@ } | ||
/** | ||
* Allows the client app to check if the user is logged in to Schibsted's Single Sign On (SSO) | ||
* solution (SPiD). | ||
* @summary Allows the client app to check if the user is logged in to Schibsted's Single Sign | ||
* On (SSO) solution (SPiD). | ||
* @description This function calls {@link Identity#hasSession} internally and thus has the side | ||
* effect that it might perform an auto-login on the user | ||
* @return {boolean} | ||
@@ -389,5 +397,7 @@ */ | ||
/** | ||
* Allows the caller to check if the current user is connected to the client_id in Schibsted's | ||
* Single Sign On (SSO) solution (SPiD). Being connected means that the user has agreed for | ||
* their account to be used by your web app and have accepted the required terms. | ||
* @summary Allows the caller to check if the current user is connected to the client_id in | ||
* Schibsted's Single Sign On (SSO) solution (SPiD). Being connected means that the user has | ||
* agreed for their account to be used by your web app and have accepted the required terms | ||
* @description This function calls {@link Identity#hasSession} internally and thus has the side | ||
* effect that it might perform an auto-login on the user | ||
* @summary Check if the user is connected to the client_id | ||
@@ -408,3 +418,5 @@ * @return {boolean} | ||
/** | ||
* Returns information about the user | ||
* @summary Returns information about the user | ||
* @description This function calls {@link Identity#hasSession} internally and thus has the side | ||
* effect that it might perform an auto-login on the user | ||
* @throws {SDKError} If the user isn't connected to the merchant | ||
@@ -423,8 +435,10 @@ * @throws {SDKError} If we couldn't get the user | ||
/** | ||
* 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 | ||
* @summary In Schibsted Account, there are two ways of identifying a user; the `userId` and the | ||
* `uuid`. There are reasons for them both existing. 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 | ||
* legacy reasons. The `uuid` is universally unique, and so — if we could disregard a lot of | ||
* Schibsted components depending on the numeric `userId` — it would be a good identifier to use | ||
* @description This function calls {@link Identity#hasSession} internally and thus has the side | ||
* effect that it might perform an auto-login on the user | ||
* @throws {SDKError} If the user isn't connected to the merchant | ||
@@ -442,8 +456,10 @@ * @return {string} The `userId` field (not to be confused with the `uuid`) | ||
/** | ||
* 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 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 | ||
* @summary In Schibsted Account, there are two ways of identifying a user; the `userId` and the | ||
* `uuid`. There are reasons for them both existing. 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. The `uuid` is universally unique, and so — if we could disregard a lot of | ||
* Schibsted components depending on the numeric `userId` — it would be a good identifier to use | ||
* @description This function calls {@link Identity#hasSession} internally and thus has the side | ||
* effect that it might perform an auto-login on the user | ||
* @throws {SDKError} If the user isn't connected to the merchant | ||
@@ -461,4 +477,6 @@ * @return {string} The `uuid` field (not to be confused with the `userId`) | ||
/** | ||
* This is how we identify the current visitor whether logged in or not. | ||
* The unique visitor id can be used to track the user for analytics (Mixpanel). | ||
* @summary This is how we identify the current visitor whether logged in or not. The unique | ||
* visitor id can be used to track the user for analytics (Mixpanel) | ||
* @description This function calls {@link Identity#hasSession} internally and thus has the side | ||
* effect that it might perform an auto-login on the user | ||
* @return {string} | ||
@@ -475,3 +493,5 @@ */ | ||
/** | ||
* Retrieve the sp_id (Varnish ID) | ||
* @summary Retrieve the sp_id (Varnish ID) | ||
* @description This function calls {@link Identity#hasSession} internally and thus has the side | ||
* effect that it might perform an auto-login on the user | ||
* @todo Is this an accurate description? | ||
@@ -478,0 +498,0 @@ * @return {string|null} - The sp_id string or null (if the server didn't return it) |
@@ -16,3 +16,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
const DEFAULT_CACHE_EXPIRES_IN = 30; | ||
const globalWindow = window; | ||
const globalWindow = () => window; | ||
@@ -30,3 +30,3 @@ /** | ||
*/ | ||
constructor({ clientId, redirectUri, env = 'PRE', window = globalWindow }) { | ||
constructor({ clientId, redirectUri, env = 'PRE', window = globalWindow() }) { | ||
super(); | ||
@@ -33,0 +33,0 @@ spidTalk.emulate(window); |
@@ -15,3 +15,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
const globalWindow = window; | ||
const globalWindow = () => window; | ||
@@ -29,3 +29,3 @@ /** | ||
*/ | ||
constructor({ clientId, redirectUri, env = 'PRE', window = globalWindow }) { | ||
constructor({ clientId, redirectUri, env = 'PRE', window = globalWindow() }) { | ||
spidTalk.emulate(window); | ||
@@ -32,0 +32,0 @@ assert(isNonEmptyString(clientId), 'clientId parameter is required'); |
@@ -48,3 +48,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
const globalFetch = window.fetch && window.fetch.bind(window); | ||
const globalFetch = () => window.fetch && window.fetch.bind(window); | ||
@@ -77,3 +77,3 @@ /** | ||
*/ | ||
constructor({ serverUrl = 'PRE', envDic, fetch = globalFetch, log, defaultParams = {}}) { | ||
constructor({ serverUrl = 'PRE', envDic, fetch = globalFetch(), log, defaultParams = {}}) { | ||
assert(isObject(defaultParams), `defaultParams should be a non-null object`); | ||
@@ -80,0 +80,0 @@ |
@@ -109,3 +109,3 @@ /* Copyright 2018 Schibsted Products & Technology AS. Licensed under the terms of the MIT license. | ||
export function isStrIn(value, possibilities, caseSensitive = false) { | ||
const _isSameStrCaseInsensitive = str => // eslint-disable-line require-jsdoc | ||
const _isSameStrCaseInsensitive = str => | ||
isStr(str) && value.toUpperCase() === str.toUpperCase(); | ||
@@ -112,0 +112,0 @@ if (!(isStr(value) && Array.isArray(possibilities))) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
867695
2427
5