@postnord/pn-marketweb-components 2.0.12 → 2.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/{FetchHelper-33d3c535.js → FetchHelper-c6cee722.js} +44 -3
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +1 -1
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +2 -2
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +3 -2
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +32 -4
- package/collection/globals/MarketWebContextService.js +44 -3
- package/custom-elements/index.js +45 -4
- package/esm/{FetchHelper-aa15fc6b.js → FetchHelper-1dfe8514.js} +44 -3
- package/esm/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm/pn-marketweb-siteheader.entry.js +2 -2
- package/esm-es5/FetchHelper-1dfe8514.js +1 -0
- package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/{p-2cdede77.system.entry.js → p-32dce26f.system.entry.js} +1 -1
- package/pn-market-web-components/{p-0351965d.system.entry.js → p-3a4b70d1.system.entry.js} +1 -1
- package/pn-market-web-components/p-6174a610.system.js +1 -0
- package/pn-market-web-components/p-67887512.system.js +1 -1
- package/pn-market-web-components/p-ea39d576.entry.js +1 -0
- package/pn-market-web-components/p-f0f58646.js +1 -0
- package/pn-market-web-components/{p-45735570.entry.js → p-f18674eb.entry.js} +1 -1
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/globals/MarketWebContextService.d.ts +31 -0
- package/umd/pn-marketweb-salesforce.js +1 -1
- package/esm-es5/FetchHelper-aa15fc6b.js +0 -1
- package/pn-market-web-components/p-2a624d21.entry.js +0 -1
- package/pn-market-web-components/p-2a695f6f.js +0 -1
- package/pn-market-web-components/p-d437da74.system.js +0 -1
|
@@ -11,21 +11,52 @@ declare class MarketWebContextService {
|
|
|
11
11
|
markets: {
|
|
12
12
|
se: {
|
|
13
13
|
fallbackLanguage: string;
|
|
14
|
+
integration: string;
|
|
15
|
+
preproduction: string;
|
|
16
|
+
production: string;
|
|
17
|
+
live: string;
|
|
14
18
|
};
|
|
15
19
|
dk: {
|
|
16
20
|
fallbackLanguage: string;
|
|
21
|
+
integration: string;
|
|
22
|
+
preproduction: string;
|
|
23
|
+
production: string;
|
|
24
|
+
live: string;
|
|
17
25
|
};
|
|
18
26
|
fi: {
|
|
19
27
|
fallbackLanguage: string;
|
|
28
|
+
integration: string;
|
|
29
|
+
preproduction: string;
|
|
30
|
+
production: string;
|
|
31
|
+
live: string;
|
|
20
32
|
};
|
|
21
33
|
no: {
|
|
22
34
|
fallbackLanguage: string;
|
|
35
|
+
integration: string;
|
|
36
|
+
preproduction: string;
|
|
37
|
+
production: string;
|
|
38
|
+
live: string;
|
|
23
39
|
};
|
|
24
40
|
com: {
|
|
25
41
|
fallbackLanguage: string;
|
|
42
|
+
integration: string;
|
|
43
|
+
preproduction: string;
|
|
44
|
+
production: string;
|
|
45
|
+
live: string;
|
|
46
|
+
};
|
|
47
|
+
de: {
|
|
48
|
+
fallbackLanguage: string;
|
|
49
|
+
integration: string;
|
|
50
|
+
preproduction: string;
|
|
51
|
+
production: string;
|
|
52
|
+
live: string;
|
|
26
53
|
};
|
|
27
54
|
tpl: {
|
|
28
55
|
fallbackLanguage: string;
|
|
56
|
+
integration: string;
|
|
57
|
+
preproduction: string;
|
|
58
|
+
production: string;
|
|
59
|
+
live: string;
|
|
29
60
|
};
|
|
30
61
|
};
|
|
31
62
|
environmentTypes: string[];
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
const s = document.createElement('script');
|
|
20
20
|
s.setAttribute("type", "module");
|
|
21
|
-
s.setAttribute("src", "https://unpkg.com/@postnord/pn-marketweb-components@2.0.
|
|
21
|
+
s.setAttribute("src", "https://unpkg.com/@postnord/pn-marketweb-components@2.0.14/umd/standalone-loader-salesforce.js");
|
|
22
22
|
document.querySelector("head").appendChild(s);
|
|
23
23
|
|
|
24
24
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,o){function a(t){try{u(r.next(t))}catch(e){o(e)}}function s(t){try{u(r["throw"](t))}catch(e){o(e)}}function u(t){t.done?n(t.value):i(t.value).then(a,s)}u((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return u([t,e])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=e.call(t,n)}catch(s){a=[6,s];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var MarketWebContextService=function(){function t(t){if(t===void 0){t=window.location.href}this.href="";this.market="";this.language="";this.environment="";this.url=null;this.allowedLanguages=["sv","da","fi","no","en"];this.allowedMarkets=["se","dk","fi","no","com","tpl"];this.wwwMarkets=["se","dk","fi","no","com"];this.developmentDomains=["localhost",".local","local.",".dev","dev."];this.markets={se:{fallbackLanguage:"sv"},dk:{fallbackLanguage:"da"},fi:{fallbackLanguage:"fi"},no:{fallbackLanguage:"no"},com:{fallbackLanguage:"en"},tpl:{fallbackLanguage:"sv"}};this.environmentTypes=["integration","preproduction","production"];this.environments={production:{name:"production",url:"https://www.postnord.xx/"},preproduction:{name:"preproduction",url:"https://com-preproduction.postnord.com/"},integration:{name:"integration",url:"https://com-integration.postnord.com/"}};this.href=t;this.url=new URL(this.href)}t.prototype.getLanguage=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(this.language){return[2,this.language]}return[4,this.resolveLanguage()];case 1:t.sent();return[2,this.language]}}))}))};t.prototype.getMarket=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(this.market){return[2,this.market]}return[4,this.resolveMarket()];case 1:t.sent();return[2,this.market]}}))}))};t.prototype.getEndpoint=function(t,e){if(e===void 0){e=""}return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){n=this.environments.production.url;if(this.environments[t]){n=this.environments[t].url;if(t===this.environments.production.name){if(this.wwwMarkets.indexOf(e)!==-1){n=n.replace(".xx","."+e)}else{n=n.replace(".xx",".com");n=n.replace("www.",e+".")}}}return[2,n]}))}))};t.prototype.getEnvironmentName=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(n){t=this.environmentTypes.filter((function(t){return e.url.hostname.indexOf("-"+t)!==-1}))[0];if(t){this.environment=t;return[2,this.environment]}if(this.url.hostname.indexOf("www.")!==-1){this.environment=this.environments.production.name;return[2,this.environment]}this.environment=this.environments.integration.name;return[2,this.environment]}))}))};t.prototype.isDevEnvironment=function(){var t=this;var e=this.developmentDomains.filter((function(e){return t.url.hostname.indexOf(e)!==-1}))[0];return e.length>0};t.prototype.resolveMarket=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,r,i,o,a,s,u,l;var f=this;return __generator(this,(function(c){if(this.href.indexOf("//www.")!==-1){t=this.url.hostname.substring(this.url.hostname.lastIndexOf(".")+1,this.url.hostname.length);if(t&&this.markets[t]){this.market=t}else{console.warn("Unable to define market from www. domain",this.href)}}e=this.environmentTypes.filter((function(t){return f.url.hostname.indexOf("-"+t)!==-1}));if(!this.market&&e&&e.length>0){n=e[0];r=this.url.hostname.substring(0,this.url.hostname.indexOf("-"+n));if(r&&this.markets[r]){this.market=r}else{console.warn("Unable to define market from preset environment names",this.href)}}if(!this.market){if(this.url.hostname.indexOf("www")===-1&&this.url.hostname.indexOf(".postnord.")>0){i=this.url.hostname.indexOf(".")!==this.url.hostname.indexOf(".postnord")?this.url.hostname.indexOf("."):0;o=this.url.hostname.substring(i,this.url.hostname.indexOf(".postnord."));if(this.allowedMarkets.indexOf(o)!==-1){this.market=o;return[2]}}}if(!this.market){a=this.developmentDomains.filter((function(t){return f.url.hostname.indexOf(t)!==-1}))[0];if(!a){this.market=this.allowedMarkets[0];return[2]}s=this.href.replace(a,"");u=this.allowedMarkets.filter((function(t){var e=["."+t,t+".","/"+t+"/"];var n=e.filter((function(t){return s.indexOf(t)!==-1}));return n.length>0}))[0];if(u){this.market=u}else{l=Object.entries(this.markets).filter((function(t){var e=["."+t[1].fallbackLanguage,t[1].fallbackLanguage+".","/"+t[1].fallbackLanguage+"/"];var n=e.filter((function(t){return s.indexOf(t)!==-1}));return n.length>0}))[0];if(l&&l[0]){this.market=l[0]}}}if(!this.market){console.info("Was unable to detect market, used fallback");this.market=this.allowedMarkets[0]}return[2]}))}))};t.prototype.resolveLanguage=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,r,i;var o=this;return __generator(this,(function(a){if(this.language){return[2]}i=[(t=document.querySelector("html[lang]"))===null||t===void 0?void 0:t.getAttribute("lang"),(e=document.querySelector('[http-equiv="content-language"][content]'))===null||e===void 0?void 0:e.getAttribute("content"),(n=document.querySelector('[property="og:locale"][content]'))===null||n===void 0?void 0:n.getAttribute("content"),(r=document.querySelector("[lang]"))===null||r===void 0?void 0:r.getAttribute("lang")];i.filter((function(t){return t})).forEach((function(t){if(o.allowedLanguages.indexOf(t)){o.language=t;return}}));if(!this.language&&this.market){this.language=this.markets[this.market].fallbackLanguage}return[2]}))}))};return t}();var FetchHelper=function(){function t(t){var e=this;if(t===void 0){t=""}this.storagePrefix="";this.store={get:function(t,n){if(n===void 0){n=false}var r=n?window.localStorage:window.sessionStorage;var i=n?window.sessionStorage:window.localStorage;var o=r.getItem("".concat(e.storagePrefix,"-").concat(t));if(!o){o=i.getItem("".concat(e.storagePrefix,"-").concat(t))}if(!o){return o}if(o.indexOf("{")===0){try{return JSON.parse(o)}catch(a){}}if(o.indexOf(",")!==-1){return o.split(",")}return o},set:function(t,n,r){if(r===void 0){r=false}var i=r?window.localStorage:window.sessionStorage;if(typeof n==="object"&&typeof n.length==="undefined"){i.setItem("".concat(e.storagePrefix,"-").concat(t),JSON.stringify(n));return}i.setItem("".concat(e.storagePrefix,"-").concat(t),n)},remove:function(t){window.sessionStorage.removeItem("".concat(e.storagePrefix,"-").concat(t))}};this.storagePrefix=t}t.prototype.fetchJson=function(t,e,n,r){if(e===void 0){e={}}if(n===void 0){n=false}if(r===void 0){r=null}return __awaiter(this,void 0,void 0,(function(){var i;var o=this;return __generator(this,(function(a){i=new Promise((function(i){return __awaiter(o,void 0,void 0,(function(){var o,a,s,u,l,f;return __generator(this,(function(c){switch(c.label){case 0:o=true;a=typeof t==="string"?t:t.url;s=a;u=null;l=null;if(n){l=this.store.get(s);if(l&&!l.permanent){o=false}if(l&&l.data){u=l.data;i(u)}}if(!o)return[3,3];return[4,window.fetch(t,e)];case 1:f=c.sent();return[4,f.json()];case 2:u=c.sent();i(u);if(n){if(typeof r==="function"&&l!=null){r(u)}this.store.set(s,this.wrapJson(u,true),true);this.store.set(s,this.wrapJson(u,false),false)}c.label=3;case 3:return[2]}}))}))}));return[2,i]}))}))};t.prototype.wrapJson=function(t,e){if(e===void 0){e=false}var n=new Date;return{timestamp:n.getTime(),time:n.toISOString(),data:t,permanent:e}};return t}();export{FetchHelper as F,MarketWebContextService as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,e as t,h as i,a as n,g as a}from"./p-58e8d7d5.js";import{F as s,M as r}from"./p-2a695f6f.js";import{M as o}from"./p-424fac62.js";const h={sv:{searchlabel:"Sök",searchplaceholder:"Vad letar du efter?",searchbuttontext:"Sök",menuHomeButton:"Hem",menuGoBackButton:"Gå tillbaka",mainMenuButton:"Meny",menuStartButton:"Start"},en:{searchlabel:"Search",searchplaceholder:"Search",searchbuttontext:"Search",menuHomeButton:"Home",menuGoBackButton:"Go back",mainMenuButton:"Menu",menuStartButton:"Start"},da:{searchlabel:"Søg",searchplaceholder:"Søg",searchbuttontext:"Søg",menuHomeButton:"Hjem",menuGoBackButton:"Gå tilbage",mainMenuButton:"Menu",menuStartButton:"Start"},no:{searchlabel:"Søk",searchplaceholder:"Søk",searchbuttontext:"Søk",menuHomeButton:"Hjem",menuGoBackButton:"Gå tilbake",mainMenuButton:"Meny",menuStartButton:"Start"},fi:{searchlabel:"Hae",searchplaceholder:"Hae",searchbuttontext:"Hae",menuHomeButton:"Koti",menuGoBackButton:"Mene takaisin",mainMenuButton:"Valikko",menuStartButton:"Alkaa"}};let l=class{constructor(i){e(this,i),this.changeLanguage=t(this,"changeLanguage",7),this.changeMarket=t(this,"changeMarket",7),this.endpointPath="/api/navigation/header",this.market=null,this.language=null,this.environment=null,this.userToken="",this.userFullname="",this.userLoggedin=!1,this.endpoint=null,this.hideSiteSelector=!1,this.hideLanguageSelector=!1,this.hideSearch=!1,this.hideLogin=!1,this.AutocompleteEndpoint="",this.sessionForward=!1,this.cache=!1,this.spaMode=!1,this.gotData=!1,this.fetchingData=!1,this.homePageLink="/",this.menuItems=[],this.search={AutocompleteEndpoint:this.AutocompleteEndpoint},this.siteSelector=null,this.languageSelector=null,this.languageOptions=[],this.loginDialog=null,this.minimizeSearch=!1,this.loggedIn=!1,this.fetchHelper=new s("siteheader"),this.loginManager=null}componentWillLoad(){this.loginManager=new o({eventTarget:this.hostElement}),this.setInitialValues().then((()=>{this.init()}))}async setInitialValues(e=window.location.href){var t;const i=new r(e);if(!this.market){const e=await i.getMarket();this.market=e}if(!this.language){const e=await i.getLanguage();this.language=e}this.environment||(this.environment=await i.getEnvironmentName()),this.endpoint||-1!==(null===(t=this.environment)||void 0===t?void 0:t.indexOf("local"))||(this.endpoint=await i.getEndpoint(this.environment,this.market)),this.endpoint||(this.endpoint="")}async init(){this.setTranslations(),await this.fetchData(),window.setTimeout((()=>{this.checkMenuOverflow()}),50)}setTranslations(){this.language&&h[this.language]&&(this.i18n=h[this.language])}onLanguageSelectorChange(e){this.language=e.detail,window.dispatchEvent(new CustomEvent("marketweb-languagechange",{detail:this.language}))}onLanguageChange(){this.setTranslations(),this.changeLanguage.emit(this.language),this.fetchData()}onMarketChange(){this.changeMarket.emit(this.market),this.fetchData()}async fetchData(){if(null===this.endpoint||!this.market||!this.language)return;this.fetchingData=!0;const e=`${this.endpoint.lastIndexOf("/")===this.endpoint.length-1?this.endpoint.substring(0,this.endpoint.length-1):this.endpoint}${this.endpointPath}?market=${this.market}&language=${this.language}`,t=await this.fetchHelper.fetchJson(e,{mode:"cors"},this.cache,this.onFetchRefreshed.bind(this));await this.setStateFromData(t)}onFetchRefreshed(e){this.setStateFromData(e)}getLanguageVersionUrl(e){if(this.spaMode)return null;const t=document.querySelector(`link[rel="alternate"][hreflang="${e.twoLetterISOLanguageName}"]`);if(t)return t.getAttribute("href");const i=this.siteDefinition.url;return i+(i.lastIndexOf("/")!==i.length-1?"/":"")+e.twoLetterISOLanguageName}async setStateFromData(e){var t,i,n;"object"!=typeof e&&console.warn("Data was not valid",e),this.siteDefinition=e.sitedefinition,this.menuItems=e.mainMenu.menuItems,this.menuItems[0]&&(null===(t=this.menuItems[0])||void 0===t?void 0:t.name)===this.i18n.menuHomeButton||this.menuItems.unshift({href:this.siteDefinition.url,name:this.i18n.menuHomeButton,id:"homelink",open:!1,selected:!1,children:[]}),this.search=Object.assign(Object.assign({},e.search),{AutocompleteEndpoint:this.AutocompleteEndpoint}),this.siteSelector=e.siteSelectorViewModel,this.languageSelector=e.languageSelectorViewModel,this.setLanguageOptions(),this.loginDialog=e.loginViewModel,await this.spaModeAdjustments(),this.gotData=!0,this.fetchingData=!0,this.homePageLink=null!==(n=null===(i=this.siteDefinition)||void 0===i?void 0:i.url)&&void 0!==n?n:document.location.hostname,window.setTimeout((()=>{this.checkMenuOverflow()}),100)}setLanguageOptions(){var e;if(!this.languageSelector||!this.languageSelector.languages)return;const t=(null!==(e=Array.prototype.slice.call(document.querySelectorAll('link[rel="alternate"][hreflang]')))&&void 0!==e?e:[]).map((e=>e.getAttribute("hreflang")));let i=[];this.languageSelector.languages.map((e=>{t&&t.length>0?t.includes(e.twoLetterISOLanguageName)&&i.push(e):i.push(e)})),this.languageOptions=i}async spaModeAdjustments(){}onLoginStateChange(e){var t,i,n;(null===(t=e.detail)||void 0===t?void 0:t.loggedIn)&&(null===(i=e.detail)||void 0===i?void 0:i.token)&&(this.loggedIn=!0===(null===(n=e.detail)||void 0===n?void 0:n.loggedIn))}promotedItemId(e){return"promo-"+e.linkText.replace(/[^A-Za-z0-9.\\\/]/gim,"")}handleResize(){requestAnimationFrame((()=>{this.checkMenuOverflow()}))}checkMenuOverflow(){const e=this.hostElement.querySelectorAll(".siteheader-row")[1];if(!e)return;const t=e.querySelector("pn-mainnav-level");if(!t)return;const i=t.parentElement;"nav"===i.tagName.toLocaleLowerCase()&&i.scrollWidth<t.clientWidth&&!1===this.minimizeSearch&&(this.minimizeSearch=!0)}adjustSiteSelectorUrl(e){return this.loggedIn?0===["portal.postnord.com"].filter((t=>-1!==e.indexOf(t))).length?e:this.loginManager.getLoginUrl(e):e}render(){var e,t,a,s,r,o;return i(n,{language:this.language,market:this.market,environment:this.environment},i("header",null,i("div",{class:"siteheader-row"},i("div",{class:"siteheader-topleft"},i("slot",{name:"topleft"}),this.gotData&&this.siteSelector&&!this.hideSiteSelector&&i("pn-site-selector",{language:this.language,buttontext:null!==(t=null===(e=this.siteSelector)||void 0===e?void 0:e.currentSiteTitle)&&void 0!==t?t:"postnord"},this.gotData&&(null===(a=this.siteSelector)||void 0===a?void 0:a.currentSiteTitle)&&i("pn-site-selector-item",{heading:this.siteSelector.currentSiteTitle+" ",description:this.siteSelector.currentSiteDescription}),this.gotData&&(null===(s=this.siteSelector)||void 0===s?void 0:s.siteSelections)&&this.siteSelector.siteSelections.map((e=>i("pn-site-selector-item",{heading:e.linkText+" ",description:e.linkDescription,url:this.adjustSiteSelectorUrl(e.href),newwindow:e.openInNewWindow}))))),i("div",{class:"siteheader-logocontainer"},i("a",{href:this.homePageLink,title:"Home",class:"siteheader-logolink"},i("svg",{class:"siteheader-logo",xmlns:"http://www.w3.org/2000/svg",width:"12.7rem",height:"2.4rem",viewBox:"0 0 141.73 26.65"},i("path",{d:"M108.84,13.35c0,6.34-5.17,9-10,9S89,19.76,89,13.63c0-6.28,5.08-9,10-9S108.84,7.25,108.84,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.29,3.29,0,0,0,3.42,3.41A3.24,3.24,0,0,0,102.28,13.54Zm-83,0c0,4.83-3.32,8.82-8.49,8.82a6.54,6.54,0,0,1-4.65-1.57v5.86H0V5.16H6.17V6.8a6.43,6.43,0,0,1,5.11-2.18C16.41,4.62,19.31,8.58,19.31,13.54Zm-6.53,0A3.27,3.27,0,0,0,9.4,10,3.28,3.28,0,0,0,6,13.54,3.29,3.29,0,0,0,9.4,16.95,3.24,3.24,0,0,0,12.78,13.54Zm103.69,0.27c0-2.54,1.54-3.32,3.6-3.32a6.56,6.56,0,0,1,2.08.3L122.3,5.1a3.92,3.92,0,0,0-1.45-.18c-3.45,0-4.38,2.18-4.38,2.18V5.16H110.3V21.84h6.17v-8ZM141.73,0V21.84h-6.16V20.21a6.43,6.43,0,0,1-5.11,2.18c-5.14,0-8-4-8-8.91s3.32-8.82,8.49-8.82a6.54,6.54,0,0,1,4.65,1.57v-5Zm-6,13.48a3.28,3.28,0,0,0-3.41-3.41A3.24,3.24,0,0,0,129,13.47,3.4,3.4,0,1,0,135.75,13.47ZM81.35,4.62c-3.6,0-4.9,2.18-4.9,2.18V5.16H70.29V21.84h6.16V13.29c0-2.11.79-3.08,2.69-3.08s2.18,1.57,2.18,3.57v8.07h6.22V11.6C87.55,7,85.34,4.62,81.35,4.62ZM64.07,1.42H57.9V21.84h6.16V10.36H67l2.81-5.2H64.07V1.42ZM50.26,11.21c-2-.3-2.87-0.3-2.87-1.09s0.81-.94,2.42-0.94a16.15,16.15,0,0,1,5.11.91L56,5.41a24.56,24.56,0,0,0-6.13-.75c-5.89,0-9,2.27-9,5.89,0,2.81,1.66,4.47,6.53,5.11,2.06,0.27,2.81.39,2.81,1.15s-0.82,1-2.24,1a16.67,16.67,0,0,1-6-1.3L40.77,21.3a22.14,22.14,0,0,0,6.68,1c6.35,0,9.28-2.24,9.28-5.89C56.72,13.54,55.15,12,50.26,11.21ZM40.19,13.35c0,6.34-5.17,9-10,9s-9.82-2.6-9.82-8.73c0-6.28,5.08-9,10-9S40.19,7.25,40.19,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.28,3.28,0,0,0,3.41,3.41A3.24,3.24,0,0,0,33.63,13.54Z",fill:"#00A0D6",transform:"translate(0 0)"})))),i("div",{class:"siteheader-topright"},i("slot",{name:"toprightstart"}),this.gotData&&this.loginDialog&&!this.hideLogin&&i("pn-marketweb-siteheader-login",{token:this.userToken,fullname:this.userFullname,loggedin:this.userLoggedin,loginDialog:this.loginDialog,endpoint:this.endpoint,i18n:this.i18n}),this.gotData&&this.languageOptions&&this.languageOptions.length&&!this.hideLanguageSelector&&i("pn-language-selector",{value:this.language},this.languageOptions.map((e=>i("pn-language-selector-option",{name:e.nativeName,code:e.twoLetterISOLanguageName,selected:e.isCurrent,url:this.getLanguageVersionUrl(e)})))),i("slot",{name:"toprightend"}))),i("div",{class:"siteheader-row"},i("div",{class:"siteheader-menu"},this.gotData&&this.menuItems&&i("pn-mainnav",{market:this.market,language:this.language,onMenuOpenChange:e=>{document.body.setAttribute("data-siteheader-menuopen",e.detail+"")}},i("pn-mainnav-level",null,i("pn-mainnav-list",null,this.menuItems.map((e=>{var t,n;return i("pn-mainnav-link",{name:e.name,href:e.href,itemid:e.id,target:null!==(t=e.linkTarget)&&void 0!==t?t:"_self",linkid:e.trackingId},(e.promotedMenuItems&&e.promotedMenuItems.length>0||e.children&&e.children.length>0)&&i("pn-mainnav-level",null,e.children.length>0&&i("pn-mainnav-list",{heading:null!==(n=e.navigationHeading)&&void 0!==n?n:""},e.children.map((e=>{var t;return i("pn-mainnav-link",{name:e.name,href:e.href,target:null!==(t=e.linkTarget)&&void 0!==t?t:"_self",linkid:e.trackingId})}))),e.promotedMenuItems&&e.promotedMenuItems.length>0&&i("pn-mainnav-list",{heading:e.promotedMenuItemsHeader},e.promotedMenuItems.map((t=>i("pn-mainnav-link",{href:t.href,name:t.linkText,target:t.openInNewWindow?"_blank":"_self",linkid:this.promotedItemId(t)+e.id}))))))}))),i("div",{slot:"footer",class:"siteheader-menu-footer"},this.gotData&&this.loginDialog&&!this.hideLogin&&i("pn-marketweb-siteheader-login",{emitEvents:!1,loginDialog:this.loginDialog,endpoint:this.endpoint,fullname:this.userFullname,loggedin:this.userLoggedin,i18n:this.i18n}),this.gotData&&this.languageOptions&&this.languageOptions.length&&!this.hideLanguageSelector&&i("pn-language-selector",{value:this.language},this.languageOptions.map((e=>i("pn-language-selector-option",{name:e.nativeName,code:e.twoLetterISOLanguageName,selected:e.isCurrent,url:this.getLanguageVersionUrl(e)})))),!this.hideSiteSelector&&i("pn-site-selector",{language:this.language},this.gotData&&(null===(r=this.siteSelector)||void 0===r?void 0:r.currentSiteTitle)&&i("pn-site-selector-item",{heading:this.siteSelector.currentSiteTitle,description:this.siteSelector.currentSiteDescription}),this.gotData&&(null===(o=this.siteSelector)||void 0===o?void 0:o.siteSelections)&&this.siteSelector.siteSelections.map((e=>i("pn-site-selector-item",{heading:e.linkText,description:e.linkDescription,url:e.pageLink,newwindow:e.openInNewWindow}))))),i("div",{slot:"top",class:"siteheader-menu-top"},i("pn-marketweb-siteheader-search",{language:this.language,search:this.search,"hide-search":this.hideSearch,i18n:this.i18n}))))),i("pn-marketweb-siteheader-search",{language:this.language,primary:!0,search:this.search,"hide-search":this.hideSearch,"show-only-link":this.minimizeSearch,i18n:this.i18n}))))}get hostElement(){return a(this)}static get watchers(){return{language:["onLanguageChange"],market:["onMarketChange"]}}};l.style="body[data-siteheader-menuopen=true]{max-height:100vh;overflow:hidden}@media screen and (min-width: 60em){body[data-siteheader-menuopen=true]{max-height:initial;overflow:initial}}pn-marketweb-siteheader{display:block;background:#FFFFFF}pn-marketweb-siteheader header{position:relative;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;-webkit-box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between}@media screen and (min-width: 48em){pn-marketweb-siteheader header{-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:initial;justify-content:initial}}pn-marketweb-siteheader .siteheader-row{display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;-ms-flex-align:center;align-items:center;width:100%;padding:0 1.6rem;min-height:2em}pn-marketweb-siteheader .siteheader-row:not(:last-child){border-bottom:0.1rem solid #F3F2F2}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-row{-ms-flex-pack:justify;justify-content:space-between;min-height:3.2em}}pn-marketweb-siteheader .siteheader-topright{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}pn-marketweb-siteheader .siteheader-logocontainer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:relative;min-height:3em;background:#FFFFFF;z-index:1}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-logocontainer{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}}pn-marketweb-siteheader .siteheader-logolink{height:100%;max-height:6.4rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}pn-marketweb-siteheader .siteheader-logolink:hover,pn-marketweb-siteheader .siteheader-logolink:focus,pn-marketweb-siteheader .siteheader-logolink:active{-webkit-box-shadow:none;box-shadow:none}pn-marketweb-siteheader .siteheader-row>pn-marketweb-siteheader-search{display:none}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-row>pn-marketweb-siteheader-search{display:block}}pn-marketweb-siteheader pn-spinner{display:none}pn-marketweb-siteheader pn-nav-dropdown:not(.hydrated) .nav-dropdown-content-container{display:none}.siteheader-topleft pn-site-selector{padding:1rem 0;display:none}@media screen and (min-width: 48em){.siteheader-topleft pn-site-selector{display:block}}@media screen and (min-width: 60em){.siteheader-topleft pn-site-selector{margin-left:1.3rem}}.siteheader-topleft pn-site-selector .pn-nav-dropdown-label,.siteheader-topleft pn-site-selector:is(a){font-size:0}.siteheader-topleft pn-site-selector .pn-nav-dropdown-label pn-icon,.siteheader-topleft pn-site-selector:is(a) pn-icon{font-size:initial;margin-left:0}@media screen and (min-width: 60em){.siteheader-topleft pn-site-selector .pn-nav-dropdown-label,.siteheader-topleft pn-site-selector:is(a){font-size:initial}.siteheader-topleft pn-site-selector .pn-nav-dropdown-label pn-icon,.siteheader-topleft pn-site-selector:is(a) pn-icon{margin-left:0.4em}}@media screen and (min-width: 60em){.siteheader-topright{margin-right:1.6rem}}.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{padding:1rem 0;display:none;-ms-flex-item-align:center;align-self:center}@media screen and (min-width: 48em){.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{display:block;margin-left:1rem}}@media screen and (min-width: 60em){.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{margin-left:1.6rem}}.siteheader-topright>pn-language-selector .pn-nav-dropdown-label,.siteheader-topright>pn-language-selector:is(a),.siteheader-topright>pn-marketweb-siteheader-login .pn-nav-dropdown-label,.siteheader-topright>pn-marketweb-siteheader-login:is(a),.siteheader-topright>a .pn-nav-dropdown-label,.siteheader-topright>a:is(a){font-size:0}.siteheader-topright>pn-language-selector .pn-nav-dropdown-label pn-icon,.siteheader-topright>pn-language-selector:is(a) pn-icon,.siteheader-topright>pn-marketweb-siteheader-login .pn-nav-dropdown-label pn-icon,.siteheader-topright>pn-marketweb-siteheader-login:is(a) pn-icon,.siteheader-topright>a .pn-nav-dropdown-label pn-icon,.siteheader-topright>a:is(a) pn-icon{font-size:initial;margin-left:0}@media screen and (min-width: 60em){.siteheader-topright>pn-language-selector .pn-nav-dropdown-label,.siteheader-topright>pn-language-selector:is(a),.siteheader-topright>pn-marketweb-siteheader-login .pn-nav-dropdown-label,.siteheader-topright>pn-marketweb-siteheader-login:is(a),.siteheader-topright>a .pn-nav-dropdown-label,.siteheader-topright>a:is(a){font-size:initial}.siteheader-topright>pn-language-selector .pn-nav-dropdown-label pn-icon,.siteheader-topright>pn-language-selector:is(a) pn-icon,.siteheader-topright>pn-marketweb-siteheader-login .pn-nav-dropdown-label pn-icon,.siteheader-topright>pn-marketweb-siteheader-login:is(a) pn-icon,.siteheader-topright>a .pn-nav-dropdown-label pn-icon,.siteheader-topright>a:is(a) pn-icon{margin-left:0.4em}}.siteheader-menu{max-width:100%;width:100%;overflow:visible;overflow-x:clip}@media screen and (min-width: 60em){.siteheader-menu{margin-top:auto;overflow:visible}}.siteheader-menu pn-mainnav-link a[target]::after{content:none}.siteheader-menu pn-marketweb-siteheader-search{padding:0.3rem 1.6rem;width:100%}.siteheader-menu [slot=top] pn-search-field{width:100%}.siteheader-menu-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center}.siteheader-menu-footer>*{margin:1.6rem}";export{l as pn_marketweb_siteheader}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class t{constructor(t=window.location.href){this.href="",this.market="",this.language="",this.environment="",this.url=null,this.allowedLanguages=["sv","da","fi","no","en"],this.allowedMarkets=["se","dk","fi","no","com","tpl"],this.wwwMarkets=["se","dk","fi","no","com"],this.developmentDomains=["localhost",".local","local.",".dev","dev."],this.markets={se:{fallbackLanguage:"sv"},dk:{fallbackLanguage:"da"},fi:{fallbackLanguage:"fi"},no:{fallbackLanguage:"no"},com:{fallbackLanguage:"en"},tpl:{fallbackLanguage:"sv"}},this.environmentTypes=["integration","preproduction","production"],this.environments={production:{name:"production",url:"https://www.postnord.xx/"},preproduction:{name:"preproduction",url:"https://com-preproduction.postnord.com/"},integration:{name:"integration",url:"https://com-integration.postnord.com/"}},this.href=t,this.url=new URL(this.href)}async getLanguage(){return this.language||await this.resolveLanguage(),this.language}async getMarket(){return this.market||await this.resolveMarket(),this.market}async getEndpoint(t,i=""){let s=this.environments.production.url;return this.environments[t]&&(s=this.environments[t].url,t===this.environments.production.name&&(-1!==this.wwwMarkets.indexOf(i)?s=s.replace(".xx","."+i):(s=s.replace(".xx",".com"),s=s.replace("www.",i+".")))),s}async getEnvironmentName(){const t=this.environmentTypes.filter((t=>-1!==this.url.hostname.indexOf("-"+t)))[0];return t?(this.environment=t,this.environment):-1!==this.url.hostname.indexOf("www.")?(this.environment=this.environments.production.name,this.environment):(this.environment=this.environments.integration.name,this.environment)}isDevEnvironment(){return this.developmentDomains.filter((t=>-1!==this.url.hostname.indexOf(t)))[0].length>0}async resolveMarket(){if(-1!==this.href.indexOf("//www.")){const t=this.url.hostname.substring(this.url.hostname.lastIndexOf(".")+1,this.url.hostname.length);t&&this.markets[t]?this.market=t:console.warn("Unable to define market from www. domain",this.href)}const t=this.environmentTypes.filter((t=>-1!==this.url.hostname.indexOf("-"+t)));if(!this.market&&t&&t.length>0){const i=this.url.hostname.substring(0,this.url.hostname.indexOf("-"+t[0]));i&&this.markets[i]?this.market=i:console.warn("Unable to define market from preset environment names",this.href)}if(!this.market&&-1===this.url.hostname.indexOf("www")&&this.url.hostname.indexOf(".postnord.")>0){const t=this.url.hostname.indexOf(".")!==this.url.hostname.indexOf(".postnord")?this.url.hostname.indexOf("."):0,i=this.url.hostname.substring(t,this.url.hostname.indexOf(".postnord."));if(-1!==this.allowedMarkets.indexOf(i))return void(this.market=i)}if(!this.market){const t=this.developmentDomains.filter((t=>-1!==this.url.hostname.indexOf(t)))[0];if(!t)return void(this.market=this.allowedMarkets[0]);const i=this.href.replace(t,"");let s=this.allowedMarkets.filter((t=>["."+t,t+".","/"+t+"/"].filter((t=>-1!==i.indexOf(t))).length>0))[0];if(s)this.market=s;else{let t=Object.entries(this.markets).filter((t=>["."+t[1].fallbackLanguage,t[1].fallbackLanguage+".","/"+t[1].fallbackLanguage+"/"].filter((t=>-1!==i.indexOf(t))).length>0))[0];t&&t[0]&&(this.market=t[0])}}this.market||(console.info("Was unable to detect market, used fallback"),this.market=this.allowedMarkets[0])}async resolveLanguage(){var t,i,s,n;this.language||([null===(t=document.querySelector("html[lang]"))||void 0===t?void 0:t.getAttribute("lang"),null===(i=document.querySelector('[http-equiv="content-language"][content]'))||void 0===i?void 0:i.getAttribute("content"),null===(s=document.querySelector('[property="og:locale"][content]'))||void 0===s?void 0:s.getAttribute("content"),null===(n=document.querySelector("[lang]"))||void 0===n?void 0:n.getAttribute("lang")].filter((t=>t)).forEach((t=>{this.allowedLanguages.indexOf(t)&&(this.language=t)})),!this.language&&this.market&&(this.language=this.markets[this.market].fallbackLanguage))}}class i{constructor(t=""){this.storagePrefix="",this.store={get:(t,i=!1)=>{const s=i?window.localStorage:window.sessionStorage,n=i?window.sessionStorage:window.localStorage;let o=s.getItem(`${this.storagePrefix}-${t}`);if(o||(o=n.getItem(`${this.storagePrefix}-${t}`)),!o)return o;if(0===o.indexOf("{"))try{return JSON.parse(o)}catch(e){}return-1!==o.indexOf(",")?o.split(","):o},set:(t,i,s=!1)=>{(s?window.localStorage:window.sessionStorage).setItem(`${this.storagePrefix}-${t}`,"object"!=typeof i||void 0!==i.length?i:JSON.stringify(i))},remove:t=>{window.sessionStorage.removeItem(`${this.storagePrefix}-${t}`)}},this.storagePrefix=t}async fetchJson(t,i={},s=!1,n=null){return new Promise((async o=>{let e=!0;const h="string"==typeof t?t:t.url;let a=null,r=null;if(s&&(r=this.store.get(h),r&&!r.permanent&&(e=!1),r&&r.data&&(a=r.data,o(a))),e){const e=await window.fetch(t,i);a=await e.json(),o(a),s&&("function"==typeof n&&null!=r&&n(a),this.store.set(h,this.wrapJson(a,!0),!0),this.store.set(h,this.wrapJson(a,!1),!1))}}))}wrapJson(t,i=!1){const s=new Date;return{timestamp:s.getTime(),time:s.toISOString(),data:t,permanent:i}}}export{i as F,t as M}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,o){function a(t){try{u(r.next(t))}catch(e){o(e)}}function s(t){try{u(r["throw"](t))}catch(e){o(e)}}function u(t){t.done?n(t.value):i(t.value).then(a,s)}u((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return u([t,e])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=e.call(t,n)}catch(s){a=[6,s];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register([],(function(t){"use strict";return{execute:function(){var e=function(){function t(t){if(t===void 0){t=window.location.href}this.href="";this.market="";this.language="";this.environment="";this.url=null;this.allowedLanguages=["sv","da","fi","no","en"];this.allowedMarkets=["se","dk","fi","no","com","tpl"];this.wwwMarkets=["se","dk","fi","no","com"];this.developmentDomains=["localhost",".local","local.",".dev","dev."];this.markets={se:{fallbackLanguage:"sv"},dk:{fallbackLanguage:"da"},fi:{fallbackLanguage:"fi"},no:{fallbackLanguage:"no"},com:{fallbackLanguage:"en"},tpl:{fallbackLanguage:"sv"}};this.environmentTypes=["integration","preproduction","production"];this.environments={production:{name:"production",url:"https://www.postnord.xx/"},preproduction:{name:"preproduction",url:"https://com-preproduction.postnord.com/"},integration:{name:"integration",url:"https://com-integration.postnord.com/"}};this.href=t;this.url=new URL(this.href)}t.prototype.getLanguage=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(this.language){return[2,this.language]}return[4,this.resolveLanguage()];case 1:t.sent();return[2,this.language]}}))}))};t.prototype.getMarket=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(this.market){return[2,this.market]}return[4,this.resolveMarket()];case 1:t.sent();return[2,this.market]}}))}))};t.prototype.getEndpoint=function(t,e){if(e===void 0){e=""}return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){n=this.environments.production.url;if(this.environments[t]){n=this.environments[t].url;if(t===this.environments.production.name){if(this.wwwMarkets.indexOf(e)!==-1){n=n.replace(".xx","."+e)}else{n=n.replace(".xx",".com");n=n.replace("www.",e+".")}}}return[2,n]}))}))};t.prototype.getEnvironmentName=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(n){t=this.environmentTypes.filter((function(t){return e.url.hostname.indexOf("-"+t)!==-1}))[0];if(t){this.environment=t;return[2,this.environment]}if(this.url.hostname.indexOf("www.")!==-1){this.environment=this.environments.production.name;return[2,this.environment]}this.environment=this.environments.integration.name;return[2,this.environment]}))}))};t.prototype.isDevEnvironment=function(){var t=this;var e=this.developmentDomains.filter((function(e){return t.url.hostname.indexOf(e)!==-1}))[0];return e.length>0};t.prototype.resolveMarket=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,r,i,o,a,s,u,l;var f=this;return __generator(this,(function(c){if(this.href.indexOf("//www.")!==-1){t=this.url.hostname.substring(this.url.hostname.lastIndexOf(".")+1,this.url.hostname.length);if(t&&this.markets[t]){this.market=t}else{console.warn("Unable to define market from www. domain",this.href)}}e=this.environmentTypes.filter((function(t){return f.url.hostname.indexOf("-"+t)!==-1}));if(!this.market&&e&&e.length>0){n=e[0];r=this.url.hostname.substring(0,this.url.hostname.indexOf("-"+n));if(r&&this.markets[r]){this.market=r}else{console.warn("Unable to define market from preset environment names",this.href)}}if(!this.market){if(this.url.hostname.indexOf("www")===-1&&this.url.hostname.indexOf(".postnord.")>0){i=this.url.hostname.indexOf(".")!==this.url.hostname.indexOf(".postnord")?this.url.hostname.indexOf("."):0;o=this.url.hostname.substring(i,this.url.hostname.indexOf(".postnord."));if(this.allowedMarkets.indexOf(o)!==-1){this.market=o;return[2]}}}if(!this.market){a=this.developmentDomains.filter((function(t){return f.url.hostname.indexOf(t)!==-1}))[0];if(!a){this.market=this.allowedMarkets[0];return[2]}s=this.href.replace(a,"");u=this.allowedMarkets.filter((function(t){var e=["."+t,t+".","/"+t+"/"];var n=e.filter((function(t){return s.indexOf(t)!==-1}));return n.length>0}))[0];if(u){this.market=u}else{l=Object.entries(this.markets).filter((function(t){var e=["."+t[1].fallbackLanguage,t[1].fallbackLanguage+".","/"+t[1].fallbackLanguage+"/"];var n=e.filter((function(t){return s.indexOf(t)!==-1}));return n.length>0}))[0];if(l&&l[0]){this.market=l[0]}}}if(!this.market){console.info("Was unable to detect market, used fallback");this.market=this.allowedMarkets[0]}return[2]}))}))};t.prototype.resolveLanguage=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,r,i;var o=this;return __generator(this,(function(a){if(this.language){return[2]}i=[(t=document.querySelector("html[lang]"))===null||t===void 0?void 0:t.getAttribute("lang"),(e=document.querySelector('[http-equiv="content-language"][content]'))===null||e===void 0?void 0:e.getAttribute("content"),(n=document.querySelector('[property="og:locale"][content]'))===null||n===void 0?void 0:n.getAttribute("content"),(r=document.querySelector("[lang]"))===null||r===void 0?void 0:r.getAttribute("lang")];i.filter((function(t){return t})).forEach((function(t){if(o.allowedLanguages.indexOf(t)){o.language=t;return}}));if(!this.language&&this.market){this.language=this.markets[this.market].fallbackLanguage}return[2]}))}))};return t}();t("M",e);var n=function(){function t(t){var e=this;if(t===void 0){t=""}this.storagePrefix="";this.store={get:function(t,n){if(n===void 0){n=false}var r=n?window.localStorage:window.sessionStorage;var i=n?window.sessionStorage:window.localStorage;var o=r.getItem("".concat(e.storagePrefix,"-").concat(t));if(!o){o=i.getItem("".concat(e.storagePrefix,"-").concat(t))}if(!o){return o}if(o.indexOf("{")===0){try{return JSON.parse(o)}catch(a){}}if(o.indexOf(",")!==-1){return o.split(",")}return o},set:function(t,n,r){if(r===void 0){r=false}var i=r?window.localStorage:window.sessionStorage;if(typeof n==="object"&&typeof n.length==="undefined"){i.setItem("".concat(e.storagePrefix,"-").concat(t),JSON.stringify(n));return}i.setItem("".concat(e.storagePrefix,"-").concat(t),n)},remove:function(t){window.sessionStorage.removeItem("".concat(e.storagePrefix,"-").concat(t))}};this.storagePrefix=t}t.prototype.fetchJson=function(t,e,n,r){if(e===void 0){e={}}if(n===void 0){n=false}if(r===void 0){r=null}return __awaiter(this,void 0,void 0,(function(){var i;var o=this;return __generator(this,(function(a){i=new Promise((function(i){return __awaiter(o,void 0,void 0,(function(){var o,a,s,u,l,f;return __generator(this,(function(c){switch(c.label){case 0:o=true;a=typeof t==="string"?t:t.url;s=a;u=null;l=null;if(n){l=this.store.get(s);if(l&&!l.permanent){o=false}if(l&&l.data){u=l.data;i(u)}}if(!o)return[3,3];return[4,window.fetch(t,e)];case 1:f=c.sent();return[4,f.json()];case 2:u=c.sent();i(u);if(n){if(typeof r==="function"&&l!=null){r(u)}this.store.set(s,this.wrapJson(u,true),true);this.store.set(s,this.wrapJson(u,false),false)}c.label=3;case 3:return[2]}}))}))}));return[2,i]}))}))};t.prototype.wrapJson=function(t,e){if(e===void 0){e=false}var n=new Date;return{timestamp:n.getTime(),time:n.toISOString(),data:t,permanent:e}};return t}();t("F",n)}}}));
|