@postnord/pn-marketweb-components 2.0.8-beta2 → 2.0.9

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.
@@ -6,7 +6,7 @@ const index = require('./index-e3e27c79.js');
6
6
 
7
7
  const translations = {
8
8
  'sv': {
9
- "heading": "Beräkna pris med PEX Bud",
9
+ "heading": "Prisindikation med PEX Bud",
10
10
  "labelFrom": "Från postkod",
11
11
  "labelTo": "Till postkod",
12
12
  "zipPlaceholder": "Ex. 12831",
@@ -1,6 +1,6 @@
1
1
  export const translations = {
2
2
  'sv': {
3
- "heading": "Beräkna pris med PEX Bud",
3
+ "heading": "Prisindikation med PEX Bud",
4
4
  "labelFrom": "Från postkod",
5
5
  "labelTo": "Till postkod",
6
6
  "zipPlaceholder": "Ex. 12831",
@@ -4688,7 +4688,7 @@ let PnMarketwebSiteheaderSearch$1 = class extends HTMLElement {
4688
4688
 
4689
4689
  const translations$3 = {
4690
4690
  'sv': {
4691
- "heading": "Beräkna pris med PEX Bud",
4691
+ "heading": "Prisindikation med PEX Bud",
4692
4692
  "labelFrom": "Från postkod",
4693
4693
  "labelTo": "Till postkod",
4694
4694
  "zipPlaceholder": "Ex. 12831",
@@ -2,7 +2,7 @@ import { r as registerInstance, h, a as Host, g as getElement } from './index-53
2
2
 
3
3
  const translations = {
4
4
  'sv': {
5
- "heading": "Beräkna pris med PEX Bud",
5
+ "heading": "Prisindikation med PEX Bud",
6
6
  "labelFrom": "Från postkod",
7
7
  "labelTo": "Till postkod",
8
8
  "zipPlaceholder": "Ex. 12831",
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function l(e){try{s(n.next(e))}catch(t){o(t)}}function a(e){try{s(n["throw"](e))}catch(t){o(t)}}function s(e){e.done?i(e.value):r(e.value).then(l,a)}s((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return s([e,t])}}function s(l){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=l[0]&2?r["return"]:l[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;if(r=0,o)l=[l[0]&2,o.value];switch(l[0]){case 0:case 1:o=l;break;case 4:i.label++;return{value:l[1],done:false};case 5:i.label++;r=l[1];l=[0];continue;case 7:l=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(l[0]===6&&i.label<o[1]){i.label=o[1];o=l;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(l);break}if(o[2])i.ops.pop();i.trys.pop();continue}l=t.call(e,i)}catch(a){l=[6,a];r=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};import{r as registerInstance,h,a as Host,g as getElement}from"./index-5397620b.js";var translations={sv:{heading:"Beräkna pris med PEX Bud",labelFrom:"Från postkod",labelTo:"Till postkod",zipPlaceholder:"Ex. 12831",labelWeight:"Vikt (i kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"När",submitButtonText:"Beräkna pris"},en:{heading:"Calculate price with PEX Bud",labelFrom:"From zip",labelTo:"To zip",zipPlaceholder:"Ex. 12831",labelWeight:"Weight (in kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"When",submitButtonText:"Calculate price"}};var pnPexPricefinderCss=".pex-pricefinder-top{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.pex-pricefinder-top pn-illustration{width:5.5rem;height:5.5rem;margin-right:1.6rem}.pex-pricefinder-form{margin:1.6rem 0 0 0;padding:0;border:0}.pex-pricefinder-form fieldset{margin:0;padding:0;border:0}.pex-pricefinder-form fieldset+fieldset{margin-top:1.6rem}.pex-pricefinder-form fieldset>div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:1em}.pex-pricefinder-form fieldset>div>*{-ms-flex-positive:1;flex-grow:1;width:100%}.pex-pricefinder-form pn-button{-ms-flex-item-align:end;align-self:end;margin-left:auto}.pex-pricefinder-form .datepicker{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.pex-pricefinder-form .datepicker label{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end;cursor:pointer;-webkit-transition:color 0.2s;transition:color 0.2s}.pex-pricefinder-form .datepicker pn-date-picker{width:100%}.pex-pricefinder-response{margin-top:2.4rem;text-align:center;font-size:2.4em}";var PnPexPricefinder=function(){function e(e){registerInstance(this,e);this.language="sv";this.currency="Kr";this.apiUrl="/api/pex/order";this.i18n=translations.sv;this.fromzip=null;this.tozip=null;this.weight=1;this.when="";this.response=null}e.prototype.componentWillLoad=function(){this.init()};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.setInitialTime();this.checkParameters();this.setLanguage();return[2]}))}))};e.prototype.setInitialTime=function(){var e=new Date;e.setHours(e.getHours()+1);e.setMinutes(0);var t=e.toLocaleString("sv",{timeZoneName:"short"}).split(" ");this.when="".concat(t[0],"T").concat(t[1].substring(0,5))};e.prototype.checkParameters=function(){var e=this;var t=new URLSearchParams(window.location.href);if(!t){return}var i=["fromzip","tozip","weight","when"];i.forEach((function(i){if(t.get(i)){e[i]=t.get(i)}}))};e.prototype.setLanguage=function(){if(translations[this.language]){this.i18n=translations[this.language]}};e.prototype.onSubmit=function(e){e.preventDefault();var t=new FormData(e.target);var i=this.compileRequestQuery(t);this.fetchResult(i)};e.prototype.compileRequestQuery=function(e){var t={from:e.get("fromzip"),to:e.get("tozip"),weight:e.get("weight"),when:e.get("when")};if(!t.when){t.when=this.hostElement.querySelector("input.date-input").value}if(!e.get("fromzip")||!e.get("tozip")||!e.get("weight")){console.error("Form data is not compliant");return}return t};e.prototype.fetchResult=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n;return __generator(this,(function(r){switch(r.label){case 0:this.response=null;t=new URLSearchParams(e);return[4,fetch("".concat(this.apiUrl,"?").concat(t.toString()),{method:"get",headers:{"Content-Type":"application/json"}}).catch(this.onFetchError.bind(this))];case 1:i=r.sent();return[4,i.json().catch(this.onFetchError.bind(this))];case 2:n=r.sent();if(!!n)return[3,5];return[4,import("./mockresponse-e2c08e66.js")];case 3:return[4,r.sent().default];case 4:n=r.sent();r.label=5;case 5:if(n){this.response=n}return[2]}}))}))};e.prototype.onFetchError=function(e){console.error("onFetchError(error",e)};e.prototype.render=function(){return h(Host,null,h("div",{class:"pex-pricefinder-top"},h("pn-illustration",{illustration:"PEX-truck"}),h("h2",null,this.i18n.heading)),h("form",{method:"get",action:"",class:"pex-pricefinder-form",onSubmit:this.onSubmit.bind(this)},h("fieldset",null,h("div",null,h("pn-input",{type:"number",label:this.i18n.labelFrom,inputid:"fromzip",name:"fromzip",placeholder:this.i18n.zipPlaceholder,required:true,value:this.fromzip}),h("pn-input",{type:"number",label:this.i18n.labelTo,inputid:"tozip",name:"tozip",placeholder:this.i18n.zipPlaceholder,required:true,value:this.tozip}))),h("fieldset",null,h("div",null,h("pn-input",{type:"number",label:this.i18n.labelWeight,inputid:"weight",name:"weight",placeholder:this.i18n.weightPlaceholder,required:true,value:this.weight}),h("div",{class:"datepicker"},h("label",{htmlFor:"when"},this.i18n.labelWhen),h("pn-marketweb-input",{inputid:"when",name:"when",type:"datetime-local",min:(new Date).toISOString().split("T")[0],value:this.when})))),h("fieldset",null,h("div",null,h("pn-button",{type:"submit"},this.i18n.submitButtonText)))),this.response?h("div",{class:"pex-pricefinder-response"},h("strong",null,this.response.data.value," ",this.currency)):null)};Object.defineProperty(e.prototype,"hostElement",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();PnPexPricefinder.style=pnPexPricefinderCss;export{PnPexPricefinder as pn_pex_pricefinder};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function l(e){try{s(n.next(e))}catch(t){o(t)}}function a(e){try{s(n["throw"](e))}catch(t){o(t)}}function s(e){e.done?i(e.value):r(e.value).then(l,a)}s((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return s([e,t])}}function s(l){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=l[0]&2?r["return"]:l[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;if(r=0,o)l=[l[0]&2,o.value];switch(l[0]){case 0:case 1:o=l;break;case 4:i.label++;return{value:l[1],done:false};case 5:i.label++;r=l[1];l=[0];continue;case 7:l=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(l[0]===6&&i.label<o[1]){i.label=o[1];o=l;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(l);break}if(o[2])i.ops.pop();i.trys.pop();continue}l=t.call(e,i)}catch(a){l=[6,a];r=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};import{r as registerInstance,h,a as Host,g as getElement}from"./index-5397620b.js";var translations={sv:{heading:"Prisindikation med PEX Bud",labelFrom:"Från postkod",labelTo:"Till postkod",zipPlaceholder:"Ex. 12831",labelWeight:"Vikt (i kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"När",submitButtonText:"Beräkna pris"},en:{heading:"Calculate price with PEX Bud",labelFrom:"From zip",labelTo:"To zip",zipPlaceholder:"Ex. 12831",labelWeight:"Weight (in kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"When",submitButtonText:"Calculate price"}};var pnPexPricefinderCss=".pex-pricefinder-top{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.pex-pricefinder-top pn-illustration{width:5.5rem;height:5.5rem;margin-right:1.6rem}.pex-pricefinder-form{margin:1.6rem 0 0 0;padding:0;border:0}.pex-pricefinder-form fieldset{margin:0;padding:0;border:0}.pex-pricefinder-form fieldset+fieldset{margin-top:1.6rem}.pex-pricefinder-form fieldset>div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:1em}.pex-pricefinder-form fieldset>div>*{-ms-flex-positive:1;flex-grow:1;width:100%}.pex-pricefinder-form pn-button{-ms-flex-item-align:end;align-self:end;margin-left:auto}.pex-pricefinder-form .datepicker{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.pex-pricefinder-form .datepicker label{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end;cursor:pointer;-webkit-transition:color 0.2s;transition:color 0.2s}.pex-pricefinder-form .datepicker pn-date-picker{width:100%}.pex-pricefinder-response{margin-top:2.4rem;text-align:center;font-size:2.4em}";var PnPexPricefinder=function(){function e(e){registerInstance(this,e);this.language="sv";this.currency="Kr";this.apiUrl="/api/pex/order";this.i18n=translations.sv;this.fromzip=null;this.tozip=null;this.weight=1;this.when="";this.response=null}e.prototype.componentWillLoad=function(){this.init()};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.setInitialTime();this.checkParameters();this.setLanguage();return[2]}))}))};e.prototype.setInitialTime=function(){var e=new Date;e.setHours(e.getHours()+1);e.setMinutes(0);var t=e.toLocaleString("sv",{timeZoneName:"short"}).split(" ");this.when="".concat(t[0],"T").concat(t[1].substring(0,5))};e.prototype.checkParameters=function(){var e=this;var t=new URLSearchParams(window.location.href);if(!t){return}var i=["fromzip","tozip","weight","when"];i.forEach((function(i){if(t.get(i)){e[i]=t.get(i)}}))};e.prototype.setLanguage=function(){if(translations[this.language]){this.i18n=translations[this.language]}};e.prototype.onSubmit=function(e){e.preventDefault();var t=new FormData(e.target);var i=this.compileRequestQuery(t);this.fetchResult(i)};e.prototype.compileRequestQuery=function(e){var t={from:e.get("fromzip"),to:e.get("tozip"),weight:e.get("weight"),when:e.get("when")};if(!t.when){t.when=this.hostElement.querySelector("input.date-input").value}if(!e.get("fromzip")||!e.get("tozip")||!e.get("weight")){console.error("Form data is not compliant");return}return t};e.prototype.fetchResult=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n;return __generator(this,(function(r){switch(r.label){case 0:this.response=null;t=new URLSearchParams(e);return[4,fetch("".concat(this.apiUrl,"?").concat(t.toString()),{method:"get",headers:{"Content-Type":"application/json"}}).catch(this.onFetchError.bind(this))];case 1:i=r.sent();return[4,i.json().catch(this.onFetchError.bind(this))];case 2:n=r.sent();if(!!n)return[3,5];return[4,import("./mockresponse-e2c08e66.js")];case 3:return[4,r.sent().default];case 4:n=r.sent();r.label=5;case 5:if(n){this.response=n}return[2]}}))}))};e.prototype.onFetchError=function(e){console.error("onFetchError(error",e)};e.prototype.render=function(){return h(Host,null,h("div",{class:"pex-pricefinder-top"},h("pn-illustration",{illustration:"PEX-truck"}),h("h2",null,this.i18n.heading)),h("form",{method:"get",action:"",class:"pex-pricefinder-form",onSubmit:this.onSubmit.bind(this)},h("fieldset",null,h("div",null,h("pn-input",{type:"number",label:this.i18n.labelFrom,inputid:"fromzip",name:"fromzip",placeholder:this.i18n.zipPlaceholder,required:true,value:this.fromzip}),h("pn-input",{type:"number",label:this.i18n.labelTo,inputid:"tozip",name:"tozip",placeholder:this.i18n.zipPlaceholder,required:true,value:this.tozip}))),h("fieldset",null,h("div",null,h("pn-input",{type:"number",label:this.i18n.labelWeight,inputid:"weight",name:"weight",placeholder:this.i18n.weightPlaceholder,required:true,value:this.weight}),h("div",{class:"datepicker"},h("label",{htmlFor:"when"},this.i18n.labelWhen),h("pn-marketweb-input",{inputid:"when",name:"when",type:"datetime-local",min:(new Date).toISOString().split("T")[0],value:this.when})))),h("fieldset",null,h("div",null,h("pn-button",{type:"submit"},this.i18n.submitButtonText)))),this.response?h("div",{class:"pex-pricefinder-response"},h("strong",null,this.response.data.value," ",this.currency)):null)};Object.defineProperty(e.prototype,"hostElement",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();PnPexPricefinder.style=pnPexPricefinderCss;export{PnPexPricefinder as pn_pex_pricefinder};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postnord/pn-marketweb-components",
3
- "version": "2.0.8-beta2",
3
+ "version": "2.0.9",
4
4
  "description": "PostNord Market Websites Components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function l(e){try{s(n.next(e))}catch(t){o(t)}}function a(e){try{s(n["throw"](e))}catch(t){o(t)}}function s(e){e.done?i(e.value):r(e.value).then(l,a)}s((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return s([e,t])}}function s(l){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=l[0]&2?r["return"]:l[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;if(r=0,o)l=[l[0]&2,o.value];switch(l[0]){case 0:case 1:o=l;break;case 4:i.label++;return{value:l[1],done:false};case 5:i.label++;r=l[1];l=[0];continue;case 7:l=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(l[0]===6&&i.label<o[1]){i.label=o[1];o=l;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(l);break}if(o[2])i.ops.pop();i.trys.pop();continue}l=t.call(e,i)}catch(a){l=[6,a];r=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-36654f2a.system.js"],(function(e,t){"use strict";var i,n,r,o;return{setters:[function(e){i=e.r;n=e.h;r=e.a;o=e.g}],execute:function(){var l={sv:{heading:"Prisindikation med PEX Bud",labelFrom:"Från postkod",labelTo:"Till postkod",zipPlaceholder:"Ex. 12831",labelWeight:"Vikt (i kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"När",submitButtonText:"Beräkna pris"},en:{heading:"Calculate price with PEX Bud",labelFrom:"From zip",labelTo:"To zip",zipPlaceholder:"Ex. 12831",labelWeight:"Weight (in kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"When",submitButtonText:"Calculate price"}};var a=".pex-pricefinder-top{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.pex-pricefinder-top pn-illustration{width:5.5rem;height:5.5rem;margin-right:1.6rem}.pex-pricefinder-form{margin:1.6rem 0 0 0;padding:0;border:0}.pex-pricefinder-form fieldset{margin:0;padding:0;border:0}.pex-pricefinder-form fieldset+fieldset{margin-top:1.6rem}.pex-pricefinder-form fieldset>div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:1em}.pex-pricefinder-form fieldset>div>*{-ms-flex-positive:1;flex-grow:1;width:100%}.pex-pricefinder-form pn-button{-ms-flex-item-align:end;align-self:end;margin-left:auto}.pex-pricefinder-form .datepicker{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.pex-pricefinder-form .datepicker label{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end;cursor:pointer;-webkit-transition:color 0.2s;transition:color 0.2s}.pex-pricefinder-form .datepicker pn-date-picker{width:100%}.pex-pricefinder-response{margin-top:2.4rem;text-align:center;font-size:2.4em}";var s=e("pn_pex_pricefinder",function(){function e(e){i(this,e);this.language="sv";this.currency="Kr";this.apiUrl="/api/pex/order";this.i18n=l.sv;this.fromzip=null;this.tozip=null;this.weight=1;this.when="";this.response=null}e.prototype.componentWillLoad=function(){this.init()};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.setInitialTime();this.checkParameters();this.setLanguage();return[2]}))}))};e.prototype.setInitialTime=function(){var e=new Date;e.setHours(e.getHours()+1);e.setMinutes(0);var t=e.toLocaleString("sv",{timeZoneName:"short"}).split(" ");this.when="".concat(t[0],"T").concat(t[1].substring(0,5))};e.prototype.checkParameters=function(){var e=this;var t=new URLSearchParams(window.location.href);if(!t){return}var i=["fromzip","tozip","weight","when"];i.forEach((function(i){if(t.get(i)){e[i]=t.get(i)}}))};e.prototype.setLanguage=function(){if(l[this.language]){this.i18n=l[this.language]}};e.prototype.onSubmit=function(e){e.preventDefault();var t=new FormData(e.target);var i=this.compileRequestQuery(t);this.fetchResult(i)};e.prototype.compileRequestQuery=function(e){var t={from:e.get("fromzip"),to:e.get("tozip"),weight:e.get("weight"),when:e.get("when")};if(!t.when){t.when=this.hostElement.querySelector("input.date-input").value}if(!e.get("fromzip")||!e.get("tozip")||!e.get("weight")){console.error("Form data is not compliant");return}return t};e.prototype.fetchResult=function(e){return __awaiter(this,void 0,void 0,(function(){var i,n,r;return __generator(this,(function(o){switch(o.label){case 0:this.response=null;i=new URLSearchParams(e);return[4,fetch("".concat(this.apiUrl,"?").concat(i.toString()),{method:"get",headers:{"Content-Type":"application/json"}}).catch(this.onFetchError.bind(this))];case 1:n=o.sent();return[4,n.json().catch(this.onFetchError.bind(this))];case 2:r=o.sent();if(!!r)return[3,5];return[4,t.import("./p-84d9f552.system.js")];case 3:return[4,o.sent().default];case 4:r=o.sent();o.label=5;case 5:if(r){this.response=r}return[2]}}))}))};e.prototype.onFetchError=function(e){console.error("onFetchError(error",e)};e.prototype.render=function(){return n(r,null,n("div",{class:"pex-pricefinder-top"},n("pn-illustration",{illustration:"PEX-truck"}),n("h2",null,this.i18n.heading)),n("form",{method:"get",action:"",class:"pex-pricefinder-form",onSubmit:this.onSubmit.bind(this)},n("fieldset",null,n("div",null,n("pn-input",{type:"number",label:this.i18n.labelFrom,inputid:"fromzip",name:"fromzip",placeholder:this.i18n.zipPlaceholder,required:true,value:this.fromzip}),n("pn-input",{type:"number",label:this.i18n.labelTo,inputid:"tozip",name:"tozip",placeholder:this.i18n.zipPlaceholder,required:true,value:this.tozip}))),n("fieldset",null,n("div",null,n("pn-input",{type:"number",label:this.i18n.labelWeight,inputid:"weight",name:"weight",placeholder:this.i18n.weightPlaceholder,required:true,value:this.weight}),n("div",{class:"datepicker"},n("label",{htmlFor:"when"},this.i18n.labelWhen),n("pn-marketweb-input",{inputid:"when",name:"when",type:"datetime-local",min:(new Date).toISOString().split("T")[0],value:this.when})))),n("fieldset",null,n("div",null,n("pn-button",{type:"submit"},this.i18n.submitButtonText)))),this.response?n("div",{class:"pex-pricefinder-response"},n("strong",null,this.response.data.value," ",this.currency)):null)};Object.defineProperty(e.prototype,"hostElement",{get:function(){return o(this)},enumerable:false,configurable:true});return e}());s.style=a}}}));
@@ -0,0 +1 @@
1
+ import{r as e,h as i,a as t,g as n}from"./p-58e8d7d5.js";const r={sv:{heading:"Prisindikation med PEX Bud",labelFrom:"Från postkod",labelTo:"Till postkod",zipPlaceholder:"Ex. 12831",labelWeight:"Vikt (i kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"När",submitButtonText:"Beräkna pris"},en:{heading:"Calculate price with PEX Bud",labelFrom:"From zip",labelTo:"To zip",zipPlaceholder:"Ex. 12831",labelWeight:"Weight (in kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"When",submitButtonText:"Calculate price"}};let l=class{constructor(i){e(this,i),this.language="sv",this.currency="Kr",this.apiUrl="/api/pex/order",this.i18n=r.sv,this.fromzip=null,this.tozip=null,this.weight=1,this.when="",this.response=null}componentWillLoad(){this.init()}async init(){this.setInitialTime(),this.checkParameters(),this.setLanguage()}setInitialTime(){const e=new Date;e.setHours(e.getHours()+1),e.setMinutes(0);const i=e.toLocaleString("sv",{timeZoneName:"short"}).split(" ");this.when=`${i[0]}T${i[1].substring(0,5)}`}checkParameters(){const e=new URLSearchParams(window.location.href);e&&["fromzip","tozip","weight","when"].forEach((i=>{e.get(i)&&(this[i]=e.get(i))}))}setLanguage(){r[this.language]&&(this.i18n=r[this.language])}onSubmit(e){e.preventDefault();const i=new FormData(e.target),t=this.compileRequestQuery(i);this.fetchResult(t)}compileRequestQuery(e){let i={from:e.get("fromzip"),to:e.get("tozip"),weight:e.get("weight"),when:e.get("when")};if(i.when||(i.when=this.hostElement.querySelector("input.date-input").value),e.get("fromzip")&&e.get("tozip")&&e.get("weight"))return i;console.error("Form data is not compliant")}async fetchResult(e){this.response=null;const i=new URLSearchParams(e),t=await fetch(`${this.apiUrl}?${i.toString()}`,{method:"get",headers:{"Content-Type":"application/json"}}).catch(this.onFetchError.bind(this));let n=await t.json().catch(this.onFetchError.bind(this));n||(n=await(await import("./p-c25ada49.js")).default),n&&(this.response=n)}onFetchError(e){console.error("onFetchError(error",e)}render(){return i(t,null,i("div",{class:"pex-pricefinder-top"},i("pn-illustration",{illustration:"PEX-truck"}),i("h2",null,this.i18n.heading)),i("form",{method:"get",action:"",class:"pex-pricefinder-form",onSubmit:this.onSubmit.bind(this)},i("fieldset",null,i("div",null,i("pn-input",{type:"number",label:this.i18n.labelFrom,inputid:"fromzip",name:"fromzip",placeholder:this.i18n.zipPlaceholder,required:!0,value:this.fromzip}),i("pn-input",{type:"number",label:this.i18n.labelTo,inputid:"tozip",name:"tozip",placeholder:this.i18n.zipPlaceholder,required:!0,value:this.tozip}))),i("fieldset",null,i("div",null,i("pn-input",{type:"number",label:this.i18n.labelWeight,inputid:"weight",name:"weight",placeholder:this.i18n.weightPlaceholder,required:!0,value:this.weight}),i("div",{class:"datepicker"},i("label",{htmlFor:"when"},this.i18n.labelWhen),i("pn-marketweb-input",{inputid:"when",name:"when",type:"datetime-local",min:(new Date).toISOString().split("T")[0],value:this.when})))),i("fieldset",null,i("div",null,i("pn-button",{type:"submit"},this.i18n.submitButtonText)))),this.response?i("div",{class:"pex-pricefinder-response"},i("strong",null,this.response.data.value," ",this.currency)):null)}get hostElement(){return n(this)}};l.style=".pex-pricefinder-top{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.pex-pricefinder-top pn-illustration{width:5.5rem;height:5.5rem;margin-right:1.6rem}.pex-pricefinder-form{margin:1.6rem 0 0 0;padding:0;border:0}.pex-pricefinder-form fieldset{margin:0;padding:0;border:0}.pex-pricefinder-form fieldset+fieldset{margin-top:1.6rem}.pex-pricefinder-form fieldset>div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:1em}.pex-pricefinder-form fieldset>div>*{-ms-flex-positive:1;flex-grow:1;width:100%}.pex-pricefinder-form pn-button{-ms-flex-item-align:end;align-self:end;margin-left:auto}.pex-pricefinder-form .datepicker{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.pex-pricefinder-form .datepicker label{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end;cursor:pointer;-webkit-transition:color 0.2s;transition:color 0.2s}.pex-pricefinder-form .datepicker pn-date-picker{width:100%}.pex-pricefinder-response{margin-top:2.4rem;text-align:center;font-size:2.4em}";export{l as pn_pex_pricefinder}
@@ -1 +1 @@
1
- System.register(["./p-36654f2a.system.js"],(function(){"use strict";var e,n,t,a,i,r;return{setters:[function(s){e=s.d;n=s.N;t=s.w;a=s.p;i=s.H;r=s.b}],execute:function(){var s=function(){{l(i.prototype)}var r=Array.from(e.querySelectorAll("script")).find((function(e){return new RegExp("/".concat(n,"(\\.esm)?\\.js($|\\?|#)")).test(e.src)||e.getAttribute("data-stencil-namespace")===n}));var s={};if("onbeforeload"in r&&!history.scrollRestoration){return{then:function(){}}}{s.resourcesUrl=new URL(".",new URL(r.getAttribute("data-resources-url")||r.src,t.location.href)).href}return a(s)};var l=function(e){var n=e.cloneNode;e.cloneNode=function(e){if(this.nodeName==="TEMPLATE"){return n.call(this,e)}var t=n.call(this,false);var a=this.childNodes;if(e){for(var i=0;i<a.length;i++){if(a[i].nodeType!==2){t.appendChild(a[i].cloneNode(true))}}}return t}};s().then((function(e){return r([["p-0351965d.system",[[4,"pn-marketweb-siteheader",{market:[1537],language:[1537],environment:[1537],userToken:[1,"user-token"],userFullname:[1,"user-fullname"],userLoggedin:[4,"user-loggedin"],endpoint:[1],hideSiteSelector:[1540,"hide-site-selector"],hideLanguageSelector:[1540,"hide-language-selector"],hideSearch:[1540,"hide-search"],hideLogin:[1540,"hide-login"],AutocompleteEndpoint:[1,"autocomplete-endpoint"],sessionForward:[4,"session-forward"],cache:[4],spaMode:[4,"spa-mode"],i18n:[32],gotData:[32],fetchingData:[32],homePageLink:[32],menuItems:[32],siteDefinition:[32],search:[32],siteSelector:[32],languageSelector:[32],languageOptions:[32],loginDialog:[32],minimizeSearch:[32],loggedIn:[32],loginManager:[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]]],["p-285c6c82.system",[[0,"pn-find-price",{source:[1],language:[1025],market:[1025],filteredItems:[32],weight:[32],weightvalue:[32],sourceData:[32],sizecategory:[32]}]]],["p-8144bcbc.system",[[0,"pn-find-service-and-price",{source:[1],language:[1025],market:[1025],filteredItems:[32],postagetype:[32],weight:[32],weightvalue:[32],deliveryscope:[32],sourceData:[32]}]]],["p-1c11b615.system",[[4,"pn-product-pricelist",{source:[1],language:[1025],market:[1025],productid:[1],filteredItems:[32],sourceData:[32],gotData:[32],loading:[32],postagetype:[32],weight:[32],weightvalue:[32]}]]],["p-6f556e76.system",[[0,"pn-product-pricelist-result",{item:[1040],description:[16],shownitems:[16],showMeasurement:[4,"show-measurement"],weightText:[32]}]]],["p-c418bb48.system",[[0,"pn-marketweb-sitefooter",{market:[1537],language:[1537],environment:[1537],endpoint:[1],cache:[4],siteDefinition:[32],footerContent:[32],i18n:[32],gotData:[32],fetchingData:[32]}]]],["p-d7776336.system",[[4,"pn-bonus-progressbar",{icon:[1],heading:[1],theme:[513],bonuspercentage:[1],currency:[513],value:[1538],min:[1538],max:[1538],valuepercentage:[32],progresspercentage:[32],levelValues:[32],currentLevelAdjustedValue:[32]}]]],["p-ec4eed81.system",[[0,"pn-pex-pricefinder",{language:[1],currency:[1],apiUrl:[1,"api-url"],i18n:[32],fromzip:[32],tozip:[32],weight:[32],when:[32],response:[32]},[[0,"language","setLanguage"]]]]],["p-2718b89a.system",[[1,"pn-filter-checkbox",{value:[520],name:[1],checkboxid:[1],disabled:[4],checked:[4],indeterminate:[1028]},[[0,"change","handlechange"]]]]],["p-80dce81e.system",[[1,"pn-marketweb-search",{disabled:[4],placeholder:[1],inputid:[1],name:[1],autocomplete:[1],list:[1],value:[1],label:[1],loading:[4],button:[1],light:[4],suggestionObserver:[32],hasClonedInput:[32],listSuggestion:[32]},[[0,"input","inputHandler"]]]]],["p-290d5824.system",[[4,"pn-product-tile"]]],["p-57cc0679.system",[[4,"pn-profile-selector",{language:[1537],returnUrl:[1,"return-url"],i18n:[32],isLoading:[32],numberOfProfiles:[32]}]]],["p-401b57b1.system",[[0,"pn-profile-selector-option",{name:[1],identifier:[1],url:[1]}]]],["p-2870b0c5.system",[[4,"pn-sidenav",{language:[1],navLabel:[1,"nav-label"],i18n:[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["p-885bc8d7.system",[[4,"pn-sidenav-level",{level:[32],levelId:[32],isOpen:[32],parentName:[32],parentHref:[32],parentLinkId:[32],alignment:[32]}]]],["p-625fb7fb.system",[[4,"pn-sidenav-link",{name:[1],href:[1],target:[1],linkid:[1],icon:[1],current:[4],levelId:[32],open:[32],hasChildren:[32]}]]],["p-e7f8da0b.system",[[0,"pn-product-card-info",{rulle:[1],paket:[1],label:[1],text:[1]}],[0,"pn-product-card-price",{label:[1],amount:[1],currency:[1],note:[1],url:[1],service:[1],linkid:[1]}],[4,"pn-product-card"]]],["p-8117b79e.system",[[0,"pn-find-service-and-price-result",{item:[1040],shownitems:[16],weightText:[32]}]]],["p-f7b013a7.system",[[0,"pn-bonus-progressbar-level",{current:[516],value:[1538],bonuspercentage:[1537],visualpercentage:[1538],percentage:[32],max:[32],min:[32],currency:[32]}]]],["p-9edaf6b6.system",[[0,"pn-marketweb-input",{disabled:[4],error:[1],invalid:[4],helpertext:[1],label:[1],placeholder:[1],inputid:[1],name:[1],required:[4],type:[1025],autocomplete:[1],valid:[4],value:[1],maxlength:[1],min:[1],max:[1],step:[1],pattern:[1],showText:[32]}]]],["p-ae775ba5.system",[[0,"pn-find-price-result",{item:[1040],shownitems:[16],Usp1:[1,"usp-1"],Usp2:[1,"usp-2"],Usp3:[1,"usp-3"],description:[16],showMeasurement:[4,"show-measurement"],usp:[16],weightText:[32],linkId:[32]}]]],["p-01fbbbbc.system",[[4,"pn-site-footer",{url:[1],linktitle:[1]}],[4,"pn-site-footer-col"]]],["p-1ce871c5.system",[[4,"pn-choice-button",{value:[520],name:[1],choiceid:[1],type:[1],disabled:[4],checked:[4],indeterminate:[1028]},[[0,"change","handlechange"]]]]],["p-fc1083d2.system",[[4,"pn-mainnav-link",{name:[1],href:[1],target:[1],linkid:[1],levelId:[32],open:[32],hasChildren:[32]}]]],["p-a921d3fd.system",[[0,"pn-product-tile-info",{label:[1],text:[1],icon:[1]}],[0,"pn-product-tile-price",{label:[1],amount:[1],currency:[1],url:[1]}]]],["p-4a71cd20.system",[[4,"pn-mainnav-level",{level:[32],levelId:[32],isOpen:[32],parentName:[32],parentHref:[32],parentLinkId:[32],listCount:[32],alignment:[32]}],[4,"pn-language-selector",{value:[1537],selectedLanguageName:[32],options:[32],i18n:[32]}],[0,"pn-language-selector-option",{name:[1],code:[1],url:[1],selected:[4],currentLanguage:[1,"current-language"]}],[4,"pn-mainnav",{market:[1],language:[1],navigationId:[1,"navigation-id"],openMenu:[1028,"open-menu"],navLabel:[1,"nav-label"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopenstate","setMenuOpenState"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{heading:[1],linkCount:[32]}],[0,"pn-marketweb-siteheader-login",{endpoint:[1],token:[1],i18n:[8,"i-1-8n"],emitEvents:[4,"emit-events"],loginDialog:[1040],fullname:[1],loggedin:[4],loginManager:[32],toggleButtonText:[32],username:[32]}],[0,"pn-marketweb-siteheader-search",{i18n:[8,"i-1-8n"],showOnlyLink:[1028,"show-only-link"],hideSearch:[1028,"hide-search"],language:[1537],search:[1040],primary:[4],autoCompleteOptions:[32]}],[4,"pn-site-selector",{buttontext:[1537],heading:[1537],language:[1537],i18n:[32]}],[0,"pn-site-selector-item",{url:[1],heading:[1],description:[1],newwindow:[4]}]]]],e)}))}}}));
1
+ System.register(["./p-36654f2a.system.js"],(function(){"use strict";var e,n,t,a,i,r;return{setters:[function(s){e=s.d;n=s.N;t=s.w;a=s.p;i=s.H;r=s.b}],execute:function(){var s=function(){{l(i.prototype)}var r=Array.from(e.querySelectorAll("script")).find((function(e){return new RegExp("/".concat(n,"(\\.esm)?\\.js($|\\?|#)")).test(e.src)||e.getAttribute("data-stencil-namespace")===n}));var s={};if("onbeforeload"in r&&!history.scrollRestoration){return{then:function(){}}}{s.resourcesUrl=new URL(".",new URL(r.getAttribute("data-resources-url")||r.src,t.location.href)).href}return a(s)};var l=function(e){var n=e.cloneNode;e.cloneNode=function(e){if(this.nodeName==="TEMPLATE"){return n.call(this,e)}var t=n.call(this,false);var a=this.childNodes;if(e){for(var i=0;i<a.length;i++){if(a[i].nodeType!==2){t.appendChild(a[i].cloneNode(true))}}}return t}};s().then((function(e){return r([["p-0351965d.system",[[4,"pn-marketweb-siteheader",{market:[1537],language:[1537],environment:[1537],userToken:[1,"user-token"],userFullname:[1,"user-fullname"],userLoggedin:[4,"user-loggedin"],endpoint:[1],hideSiteSelector:[1540,"hide-site-selector"],hideLanguageSelector:[1540,"hide-language-selector"],hideSearch:[1540,"hide-search"],hideLogin:[1540,"hide-login"],AutocompleteEndpoint:[1,"autocomplete-endpoint"],sessionForward:[4,"session-forward"],cache:[4],spaMode:[4,"spa-mode"],i18n:[32],gotData:[32],fetchingData:[32],homePageLink:[32],menuItems:[32],siteDefinition:[32],search:[32],siteSelector:[32],languageSelector:[32],languageOptions:[32],loginDialog:[32],minimizeSearch:[32],loggedIn:[32],loginManager:[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]]],["p-285c6c82.system",[[0,"pn-find-price",{source:[1],language:[1025],market:[1025],filteredItems:[32],weight:[32],weightvalue:[32],sourceData:[32],sizecategory:[32]}]]],["p-8144bcbc.system",[[0,"pn-find-service-and-price",{source:[1],language:[1025],market:[1025],filteredItems:[32],postagetype:[32],weight:[32],weightvalue:[32],deliveryscope:[32],sourceData:[32]}]]],["p-1c11b615.system",[[4,"pn-product-pricelist",{source:[1],language:[1025],market:[1025],productid:[1],filteredItems:[32],sourceData:[32],gotData:[32],loading:[32],postagetype:[32],weight:[32],weightvalue:[32]}]]],["p-6f556e76.system",[[0,"pn-product-pricelist-result",{item:[1040],description:[16],shownitems:[16],showMeasurement:[4,"show-measurement"],weightText:[32]}]]],["p-c418bb48.system",[[0,"pn-marketweb-sitefooter",{market:[1537],language:[1537],environment:[1537],endpoint:[1],cache:[4],siteDefinition:[32],footerContent:[32],i18n:[32],gotData:[32],fetchingData:[32]}]]],["p-d7776336.system",[[4,"pn-bonus-progressbar",{icon:[1],heading:[1],theme:[513],bonuspercentage:[1],currency:[513],value:[1538],min:[1538],max:[1538],valuepercentage:[32],progresspercentage:[32],levelValues:[32],currentLevelAdjustedValue:[32]}]]],["p-2da8e5e8.system",[[0,"pn-pex-pricefinder",{language:[1],currency:[1],apiUrl:[1,"api-url"],i18n:[32],fromzip:[32],tozip:[32],weight:[32],when:[32],response:[32]},[[0,"language","setLanguage"]]]]],["p-2718b89a.system",[[1,"pn-filter-checkbox",{value:[520],name:[1],checkboxid:[1],disabled:[4],checked:[4],indeterminate:[1028]},[[0,"change","handlechange"]]]]],["p-80dce81e.system",[[1,"pn-marketweb-search",{disabled:[4],placeholder:[1],inputid:[1],name:[1],autocomplete:[1],list:[1],value:[1],label:[1],loading:[4],button:[1],light:[4],suggestionObserver:[32],hasClonedInput:[32],listSuggestion:[32]},[[0,"input","inputHandler"]]]]],["p-290d5824.system",[[4,"pn-product-tile"]]],["p-57cc0679.system",[[4,"pn-profile-selector",{language:[1537],returnUrl:[1,"return-url"],i18n:[32],isLoading:[32],numberOfProfiles:[32]}]]],["p-401b57b1.system",[[0,"pn-profile-selector-option",{name:[1],identifier:[1],url:[1]}]]],["p-2870b0c5.system",[[4,"pn-sidenav",{language:[1],navLabel:[1,"nav-label"],i18n:[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["p-885bc8d7.system",[[4,"pn-sidenav-level",{level:[32],levelId:[32],isOpen:[32],parentName:[32],parentHref:[32],parentLinkId:[32],alignment:[32]}]]],["p-625fb7fb.system",[[4,"pn-sidenav-link",{name:[1],href:[1],target:[1],linkid:[1],icon:[1],current:[4],levelId:[32],open:[32],hasChildren:[32]}]]],["p-e7f8da0b.system",[[0,"pn-product-card-info",{rulle:[1],paket:[1],label:[1],text:[1]}],[0,"pn-product-card-price",{label:[1],amount:[1],currency:[1],note:[1],url:[1],service:[1],linkid:[1]}],[4,"pn-product-card"]]],["p-8117b79e.system",[[0,"pn-find-service-and-price-result",{item:[1040],shownitems:[16],weightText:[32]}]]],["p-f7b013a7.system",[[0,"pn-bonus-progressbar-level",{current:[516],value:[1538],bonuspercentage:[1537],visualpercentage:[1538],percentage:[32],max:[32],min:[32],currency:[32]}]]],["p-9edaf6b6.system",[[0,"pn-marketweb-input",{disabled:[4],error:[1],invalid:[4],helpertext:[1],label:[1],placeholder:[1],inputid:[1],name:[1],required:[4],type:[1025],autocomplete:[1],valid:[4],value:[1],maxlength:[1],min:[1],max:[1],step:[1],pattern:[1],showText:[32]}]]],["p-ae775ba5.system",[[0,"pn-find-price-result",{item:[1040],shownitems:[16],Usp1:[1,"usp-1"],Usp2:[1,"usp-2"],Usp3:[1,"usp-3"],description:[16],showMeasurement:[4,"show-measurement"],usp:[16],weightText:[32],linkId:[32]}]]],["p-01fbbbbc.system",[[4,"pn-site-footer",{url:[1],linktitle:[1]}],[4,"pn-site-footer-col"]]],["p-1ce871c5.system",[[4,"pn-choice-button",{value:[520],name:[1],choiceid:[1],type:[1],disabled:[4],checked:[4],indeterminate:[1028]},[[0,"change","handlechange"]]]]],["p-fc1083d2.system",[[4,"pn-mainnav-link",{name:[1],href:[1],target:[1],linkid:[1],levelId:[32],open:[32],hasChildren:[32]}]]],["p-a921d3fd.system",[[0,"pn-product-tile-info",{label:[1],text:[1],icon:[1]}],[0,"pn-product-tile-price",{label:[1],amount:[1],currency:[1],url:[1]}]]],["p-4a71cd20.system",[[4,"pn-mainnav-level",{level:[32],levelId:[32],isOpen:[32],parentName:[32],parentHref:[32],parentLinkId:[32],listCount:[32],alignment:[32]}],[4,"pn-language-selector",{value:[1537],selectedLanguageName:[32],options:[32],i18n:[32]}],[0,"pn-language-selector-option",{name:[1],code:[1],url:[1],selected:[4],currentLanguage:[1,"current-language"]}],[4,"pn-mainnav",{market:[1],language:[1],navigationId:[1,"navigation-id"],openMenu:[1028,"open-menu"],navLabel:[1,"nav-label"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopenstate","setMenuOpenState"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{heading:[1],linkCount:[32]}],[0,"pn-marketweb-siteheader-login",{endpoint:[1],token:[1],i18n:[8,"i-1-8n"],emitEvents:[4,"emit-events"],loginDialog:[1040],fullname:[1],loggedin:[4],loginManager:[32],toggleButtonText:[32],username:[32]}],[0,"pn-marketweb-siteheader-search",{i18n:[8,"i-1-8n"],showOnlyLink:[1028,"show-only-link"],hideSearch:[1028,"hide-search"],language:[1537],search:[1040],primary:[4],autoCompleteOptions:[32]}],[4,"pn-site-selector",{buttontext:[1537],heading:[1537],language:[1537],i18n:[32]}],[0,"pn-site-selector-item",{url:[1],heading:[1],description:[1],newwindow:[4]}]]]],e)}))}}}));
@@ -1 +1 @@
1
- import{d as e,N as n,w as a,p as t,H as i,b as r}from"./p-58e8d7d5.js";const l=e=>{const n=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return n.call(this,e);const a=n.call(this,!1),t=this.childNodes;if(e)for(let n=0;n<t.length;n++)2!==t[n].nodeType&&a.appendChild(t[n].cloneNode(!0));return a}};(()=>{l(i.prototype);const r=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${n}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===n)),o={};return"onbeforeload"in r&&!history.scrollRestoration?{then(){}}:(o.resourcesUrl=new URL(".",new URL(r.getAttribute("data-resources-url")||r.src,a.location.href)).href,t(o))})().then((e=>r([["p-2a624d21",[[4,"pn-marketweb-siteheader",{market:[1537],language:[1537],environment:[1537],userToken:[1,"user-token"],userFullname:[1,"user-fullname"],userLoggedin:[4,"user-loggedin"],endpoint:[1],hideSiteSelector:[1540,"hide-site-selector"],hideLanguageSelector:[1540,"hide-language-selector"],hideSearch:[1540,"hide-search"],hideLogin:[1540,"hide-login"],AutocompleteEndpoint:[1,"autocomplete-endpoint"],sessionForward:[4,"session-forward"],cache:[4],spaMode:[4,"spa-mode"],i18n:[32],gotData:[32],fetchingData:[32],homePageLink:[32],menuItems:[32],siteDefinition:[32],search:[32],siteSelector:[32],languageSelector:[32],languageOptions:[32],loginDialog:[32],minimizeSearch:[32],loggedIn:[32],loginManager:[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]]],["p-82daf429",[[0,"pn-find-price",{source:[1],language:[1025],market:[1025],filteredItems:[32],weight:[32],weightvalue:[32],sourceData:[32],sizecategory:[32]}]]],["p-774b7a9f",[[0,"pn-find-service-and-price",{source:[1],language:[1025],market:[1025],filteredItems:[32],postagetype:[32],weight:[32],weightvalue:[32],deliveryscope:[32],sourceData:[32]}]]],["p-c1c3777d",[[4,"pn-product-pricelist",{source:[1],language:[1025],market:[1025],productid:[1],filteredItems:[32],sourceData:[32],gotData:[32],loading:[32],postagetype:[32],weight:[32],weightvalue:[32]}]]],["p-1ecf47ed",[[0,"pn-product-pricelist-result",{item:[1040],description:[16],shownitems:[16],showMeasurement:[4,"show-measurement"],weightText:[32]}]]],["p-40264b65",[[0,"pn-marketweb-sitefooter",{market:[1537],language:[1537],environment:[1537],endpoint:[1],cache:[4],siteDefinition:[32],footerContent:[32],i18n:[32],gotData:[32],fetchingData:[32]}]]],["p-51df9292",[[4,"pn-bonus-progressbar",{icon:[1],heading:[1],theme:[513],bonuspercentage:[1],currency:[513],value:[1538],min:[1538],max:[1538],valuepercentage:[32],progresspercentage:[32],levelValues:[32],currentLevelAdjustedValue:[32]}]]],["p-7665f7ee",[[0,"pn-pex-pricefinder",{language:[1],currency:[1],apiUrl:[1,"api-url"],i18n:[32],fromzip:[32],tozip:[32],weight:[32],when:[32],response:[32]},[[0,"language","setLanguage"]]]]],["p-81d764a0",[[1,"pn-filter-checkbox",{value:[520],name:[1],checkboxid:[1],disabled:[4],checked:[4],indeterminate:[1028]},[[0,"change","handlechange"]]]]],["p-e9fe5c54",[[1,"pn-marketweb-search",{disabled:[4],placeholder:[1],inputid:[1],name:[1],autocomplete:[1],list:[1],value:[1],label:[1],loading:[4],button:[1],light:[4],suggestionObserver:[32],hasClonedInput:[32],listSuggestion:[32]},[[0,"input","inputHandler"]]]]],["p-d0155ddf",[[4,"pn-product-tile"]]],["p-b4f0228c",[[4,"pn-profile-selector",{language:[1537],returnUrl:[1,"return-url"],i18n:[32],isLoading:[32],numberOfProfiles:[32]}]]],["p-5c41acb2",[[0,"pn-profile-selector-option",{name:[1],identifier:[1],url:[1]}]]],["p-7d75ea68",[[4,"pn-sidenav",{language:[1],navLabel:[1,"nav-label"],i18n:[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["p-227e1d46",[[4,"pn-sidenav-level",{level:[32],levelId:[32],isOpen:[32],parentName:[32],parentHref:[32],parentLinkId:[32],alignment:[32]}]]],["p-f774e2cc",[[4,"pn-sidenav-link",{name:[1],href:[1],target:[1],linkid:[1],icon:[1],current:[4],levelId:[32],open:[32],hasChildren:[32]}]]],["p-b2840380",[[0,"pn-product-card-info",{rulle:[1],paket:[1],label:[1],text:[1]}],[0,"pn-product-card-price",{label:[1],amount:[1],currency:[1],note:[1],url:[1],service:[1],linkid:[1]}],[4,"pn-product-card"]]],["p-61dbe832",[[0,"pn-find-service-and-price-result",{item:[1040],shownitems:[16],weightText:[32]}]]],["p-c240b614",[[0,"pn-bonus-progressbar-level",{current:[516],value:[1538],bonuspercentage:[1537],visualpercentage:[1538],percentage:[32],max:[32],min:[32],currency:[32]}]]],["p-996d8a6a",[[0,"pn-marketweb-input",{disabled:[4],error:[1],invalid:[4],helpertext:[1],label:[1],placeholder:[1],inputid:[1],name:[1],required:[4],type:[1025],autocomplete:[1],valid:[4],value:[1],maxlength:[1],min:[1],max:[1],step:[1],pattern:[1],showText:[32]}]]],["p-c2fada23",[[0,"pn-find-price-result",{item:[1040],shownitems:[16],Usp1:[1,"usp-1"],Usp2:[1,"usp-2"],Usp3:[1,"usp-3"],description:[16],showMeasurement:[4,"show-measurement"],usp:[16],weightText:[32],linkId:[32]}]]],["p-adc639c8",[[4,"pn-site-footer",{url:[1],linktitle:[1]}],[4,"pn-site-footer-col"]]],["p-15112837",[[4,"pn-choice-button",{value:[520],name:[1],choiceid:[1],type:[1],disabled:[4],checked:[4],indeterminate:[1028]},[[0,"change","handlechange"]]]]],["p-715d1ef7",[[4,"pn-mainnav-link",{name:[1],href:[1],target:[1],linkid:[1],levelId:[32],open:[32],hasChildren:[32]}]]],["p-8e146205",[[0,"pn-product-tile-info",{label:[1],text:[1],icon:[1]}],[0,"pn-product-tile-price",{label:[1],amount:[1],currency:[1],url:[1]}]]],["p-6c75474c",[[4,"pn-mainnav-level",{level:[32],levelId:[32],isOpen:[32],parentName:[32],parentHref:[32],parentLinkId:[32],listCount:[32],alignment:[32]}],[4,"pn-language-selector",{value:[1537],selectedLanguageName:[32],options:[32],i18n:[32]}],[0,"pn-language-selector-option",{name:[1],code:[1],url:[1],selected:[4],currentLanguage:[1,"current-language"]}],[4,"pn-mainnav",{market:[1],language:[1],navigationId:[1,"navigation-id"],openMenu:[1028,"open-menu"],navLabel:[1,"nav-label"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopenstate","setMenuOpenState"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{heading:[1],linkCount:[32]}],[0,"pn-marketweb-siteheader-login",{endpoint:[1],token:[1],i18n:[8,"i-1-8n"],emitEvents:[4,"emit-events"],loginDialog:[1040],fullname:[1],loggedin:[4],loginManager:[32],toggleButtonText:[32],username:[32]}],[0,"pn-marketweb-siteheader-search",{i18n:[8,"i-1-8n"],showOnlyLink:[1028,"show-only-link"],hideSearch:[1028,"hide-search"],language:[1537],search:[1040],primary:[4],autoCompleteOptions:[32]}],[4,"pn-site-selector",{buttontext:[1537],heading:[1537],language:[1537],i18n:[32]}],[0,"pn-site-selector-item",{url:[1],heading:[1],description:[1],newwindow:[4]}]]]],e)));
1
+ import{d as e,N as n,w as a,p as t,H as i,b as r}from"./p-58e8d7d5.js";const l=e=>{const n=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return n.call(this,e);const a=n.call(this,!1),t=this.childNodes;if(e)for(let n=0;n<t.length;n++)2!==t[n].nodeType&&a.appendChild(t[n].cloneNode(!0));return a}};(()=>{l(i.prototype);const r=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${n}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===n)),o={};return"onbeforeload"in r&&!history.scrollRestoration?{then(){}}:(o.resourcesUrl=new URL(".",new URL(r.getAttribute("data-resources-url")||r.src,a.location.href)).href,t(o))})().then((e=>r([["p-2a624d21",[[4,"pn-marketweb-siteheader",{market:[1537],language:[1537],environment:[1537],userToken:[1,"user-token"],userFullname:[1,"user-fullname"],userLoggedin:[4,"user-loggedin"],endpoint:[1],hideSiteSelector:[1540,"hide-site-selector"],hideLanguageSelector:[1540,"hide-language-selector"],hideSearch:[1540,"hide-search"],hideLogin:[1540,"hide-login"],AutocompleteEndpoint:[1,"autocomplete-endpoint"],sessionForward:[4,"session-forward"],cache:[4],spaMode:[4,"spa-mode"],i18n:[32],gotData:[32],fetchingData:[32],homePageLink:[32],menuItems:[32],siteDefinition:[32],search:[32],siteSelector:[32],languageSelector:[32],languageOptions:[32],loginDialog:[32],minimizeSearch:[32],loggedIn:[32],loginManager:[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]]],["p-82daf429",[[0,"pn-find-price",{source:[1],language:[1025],market:[1025],filteredItems:[32],weight:[32],weightvalue:[32],sourceData:[32],sizecategory:[32]}]]],["p-774b7a9f",[[0,"pn-find-service-and-price",{source:[1],language:[1025],market:[1025],filteredItems:[32],postagetype:[32],weight:[32],weightvalue:[32],deliveryscope:[32],sourceData:[32]}]]],["p-c1c3777d",[[4,"pn-product-pricelist",{source:[1],language:[1025],market:[1025],productid:[1],filteredItems:[32],sourceData:[32],gotData:[32],loading:[32],postagetype:[32],weight:[32],weightvalue:[32]}]]],["p-1ecf47ed",[[0,"pn-product-pricelist-result",{item:[1040],description:[16],shownitems:[16],showMeasurement:[4,"show-measurement"],weightText:[32]}]]],["p-40264b65",[[0,"pn-marketweb-sitefooter",{market:[1537],language:[1537],environment:[1537],endpoint:[1],cache:[4],siteDefinition:[32],footerContent:[32],i18n:[32],gotData:[32],fetchingData:[32]}]]],["p-51df9292",[[4,"pn-bonus-progressbar",{icon:[1],heading:[1],theme:[513],bonuspercentage:[1],currency:[513],value:[1538],min:[1538],max:[1538],valuepercentage:[32],progresspercentage:[32],levelValues:[32],currentLevelAdjustedValue:[32]}]]],["p-381b3ec0",[[0,"pn-pex-pricefinder",{language:[1],currency:[1],apiUrl:[1,"api-url"],i18n:[32],fromzip:[32],tozip:[32],weight:[32],when:[32],response:[32]},[[0,"language","setLanguage"]]]]],["p-81d764a0",[[1,"pn-filter-checkbox",{value:[520],name:[1],checkboxid:[1],disabled:[4],checked:[4],indeterminate:[1028]},[[0,"change","handlechange"]]]]],["p-e9fe5c54",[[1,"pn-marketweb-search",{disabled:[4],placeholder:[1],inputid:[1],name:[1],autocomplete:[1],list:[1],value:[1],label:[1],loading:[4],button:[1],light:[4],suggestionObserver:[32],hasClonedInput:[32],listSuggestion:[32]},[[0,"input","inputHandler"]]]]],["p-d0155ddf",[[4,"pn-product-tile"]]],["p-b4f0228c",[[4,"pn-profile-selector",{language:[1537],returnUrl:[1,"return-url"],i18n:[32],isLoading:[32],numberOfProfiles:[32]}]]],["p-5c41acb2",[[0,"pn-profile-selector-option",{name:[1],identifier:[1],url:[1]}]]],["p-7d75ea68",[[4,"pn-sidenav",{language:[1],navLabel:[1,"nav-label"],i18n:[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["p-227e1d46",[[4,"pn-sidenav-level",{level:[32],levelId:[32],isOpen:[32],parentName:[32],parentHref:[32],parentLinkId:[32],alignment:[32]}]]],["p-f774e2cc",[[4,"pn-sidenav-link",{name:[1],href:[1],target:[1],linkid:[1],icon:[1],current:[4],levelId:[32],open:[32],hasChildren:[32]}]]],["p-b2840380",[[0,"pn-product-card-info",{rulle:[1],paket:[1],label:[1],text:[1]}],[0,"pn-product-card-price",{label:[1],amount:[1],currency:[1],note:[1],url:[1],service:[1],linkid:[1]}],[4,"pn-product-card"]]],["p-61dbe832",[[0,"pn-find-service-and-price-result",{item:[1040],shownitems:[16],weightText:[32]}]]],["p-c240b614",[[0,"pn-bonus-progressbar-level",{current:[516],value:[1538],bonuspercentage:[1537],visualpercentage:[1538],percentage:[32],max:[32],min:[32],currency:[32]}]]],["p-996d8a6a",[[0,"pn-marketweb-input",{disabled:[4],error:[1],invalid:[4],helpertext:[1],label:[1],placeholder:[1],inputid:[1],name:[1],required:[4],type:[1025],autocomplete:[1],valid:[4],value:[1],maxlength:[1],min:[1],max:[1],step:[1],pattern:[1],showText:[32]}]]],["p-c2fada23",[[0,"pn-find-price-result",{item:[1040],shownitems:[16],Usp1:[1,"usp-1"],Usp2:[1,"usp-2"],Usp3:[1,"usp-3"],description:[16],showMeasurement:[4,"show-measurement"],usp:[16],weightText:[32],linkId:[32]}]]],["p-adc639c8",[[4,"pn-site-footer",{url:[1],linktitle:[1]}],[4,"pn-site-footer-col"]]],["p-15112837",[[4,"pn-choice-button",{value:[520],name:[1],choiceid:[1],type:[1],disabled:[4],checked:[4],indeterminate:[1028]},[[0,"change","handlechange"]]]]],["p-715d1ef7",[[4,"pn-mainnav-link",{name:[1],href:[1],target:[1],linkid:[1],levelId:[32],open:[32],hasChildren:[32]}]]],["p-8e146205",[[0,"pn-product-tile-info",{label:[1],text:[1],icon:[1]}],[0,"pn-product-tile-price",{label:[1],amount:[1],currency:[1],url:[1]}]]],["p-6c75474c",[[4,"pn-mainnav-level",{level:[32],levelId:[32],isOpen:[32],parentName:[32],parentHref:[32],parentLinkId:[32],listCount:[32],alignment:[32]}],[4,"pn-language-selector",{value:[1537],selectedLanguageName:[32],options:[32],i18n:[32]}],[0,"pn-language-selector-option",{name:[1],code:[1],url:[1],selected:[4],currentLanguage:[1,"current-language"]}],[4,"pn-mainnav",{market:[1],language:[1],navigationId:[1,"navigation-id"],openMenu:[1028,"open-menu"],navLabel:[1,"nav-label"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopenstate","setMenuOpenState"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{heading:[1],linkCount:[32]}],[0,"pn-marketweb-siteheader-login",{endpoint:[1],token:[1],i18n:[8,"i-1-8n"],emitEvents:[4,"emit-events"],loginDialog:[1040],fullname:[1],loggedin:[4],loginManager:[32],toggleButtonText:[32],username:[32]}],[0,"pn-marketweb-siteheader-search",{i18n:[8,"i-1-8n"],showOnlyLink:[1028,"show-only-link"],hideSearch:[1028,"hide-search"],language:[1537],search:[1040],primary:[4],autoCompleteOptions:[32]}],[4,"pn-site-selector",{buttontext:[1537],heading:[1537],language:[1537],i18n:[32]}],[0,"pn-site-selector-item",{url:[1],heading:[1],description:[1],newwindow:[4]}]]]],e)));
@@ -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.8-beta2/umd/standalone-loader-salesforce.js");
21
+ s.setAttribute("src", "https://unpkg.com/@postnord/pn-marketweb-components@2.0.9/umd/standalone-loader-salesforce.js");
22
22
  document.querySelector("head").appendChild(s);
23
23
 
24
24
 
@@ -1 +0,0 @@
1
- import{r as e,h as i,a as t,g as n}from"./p-58e8d7d5.js";const r={sv:{heading:"Beräkna pris med PEX Bud",labelFrom:"Från postkod",labelTo:"Till postkod",zipPlaceholder:"Ex. 12831",labelWeight:"Vikt (i kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"När",submitButtonText:"Beräkna pris"},en:{heading:"Calculate price with PEX Bud",labelFrom:"From zip",labelTo:"To zip",zipPlaceholder:"Ex. 12831",labelWeight:"Weight (in kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"When",submitButtonText:"Calculate price"}};let l=class{constructor(i){e(this,i),this.language="sv",this.currency="Kr",this.apiUrl="/api/pex/order",this.i18n=r.sv,this.fromzip=null,this.tozip=null,this.weight=1,this.when="",this.response=null}componentWillLoad(){this.init()}async init(){this.setInitialTime(),this.checkParameters(),this.setLanguage()}setInitialTime(){const e=new Date;e.setHours(e.getHours()+1),e.setMinutes(0);const i=e.toLocaleString("sv",{timeZoneName:"short"}).split(" ");this.when=`${i[0]}T${i[1].substring(0,5)}`}checkParameters(){const e=new URLSearchParams(window.location.href);e&&["fromzip","tozip","weight","when"].forEach((i=>{e.get(i)&&(this[i]=e.get(i))}))}setLanguage(){r[this.language]&&(this.i18n=r[this.language])}onSubmit(e){e.preventDefault();const i=new FormData(e.target),t=this.compileRequestQuery(i);this.fetchResult(t)}compileRequestQuery(e){let i={from:e.get("fromzip"),to:e.get("tozip"),weight:e.get("weight"),when:e.get("when")};if(i.when||(i.when=this.hostElement.querySelector("input.date-input").value),e.get("fromzip")&&e.get("tozip")&&e.get("weight"))return i;console.error("Form data is not compliant")}async fetchResult(e){this.response=null;const i=new URLSearchParams(e),t=await fetch(`${this.apiUrl}?${i.toString()}`,{method:"get",headers:{"Content-Type":"application/json"}}).catch(this.onFetchError.bind(this));let n=await t.json().catch(this.onFetchError.bind(this));n||(n=await(await import("./p-c25ada49.js")).default),n&&(this.response=n)}onFetchError(e){console.error("onFetchError(error",e)}render(){return i(t,null,i("div",{class:"pex-pricefinder-top"},i("pn-illustration",{illustration:"PEX-truck"}),i("h2",null,this.i18n.heading)),i("form",{method:"get",action:"",class:"pex-pricefinder-form",onSubmit:this.onSubmit.bind(this)},i("fieldset",null,i("div",null,i("pn-input",{type:"number",label:this.i18n.labelFrom,inputid:"fromzip",name:"fromzip",placeholder:this.i18n.zipPlaceholder,required:!0,value:this.fromzip}),i("pn-input",{type:"number",label:this.i18n.labelTo,inputid:"tozip",name:"tozip",placeholder:this.i18n.zipPlaceholder,required:!0,value:this.tozip}))),i("fieldset",null,i("div",null,i("pn-input",{type:"number",label:this.i18n.labelWeight,inputid:"weight",name:"weight",placeholder:this.i18n.weightPlaceholder,required:!0,value:this.weight}),i("div",{class:"datepicker"},i("label",{htmlFor:"when"},this.i18n.labelWhen),i("pn-marketweb-input",{inputid:"when",name:"when",type:"datetime-local",min:(new Date).toISOString().split("T")[0],value:this.when})))),i("fieldset",null,i("div",null,i("pn-button",{type:"submit"},this.i18n.submitButtonText)))),this.response?i("div",{class:"pex-pricefinder-response"},i("strong",null,this.response.data.value," ",this.currency)):null)}get hostElement(){return n(this)}};l.style=".pex-pricefinder-top{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.pex-pricefinder-top pn-illustration{width:5.5rem;height:5.5rem;margin-right:1.6rem}.pex-pricefinder-form{margin:1.6rem 0 0 0;padding:0;border:0}.pex-pricefinder-form fieldset{margin:0;padding:0;border:0}.pex-pricefinder-form fieldset+fieldset{margin-top:1.6rem}.pex-pricefinder-form fieldset>div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:1em}.pex-pricefinder-form fieldset>div>*{-ms-flex-positive:1;flex-grow:1;width:100%}.pex-pricefinder-form pn-button{-ms-flex-item-align:end;align-self:end;margin-left:auto}.pex-pricefinder-form .datepicker{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.pex-pricefinder-form .datepicker label{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end;cursor:pointer;-webkit-transition:color 0.2s;transition:color 0.2s}.pex-pricefinder-form .datepicker pn-date-picker{width:100%}.pex-pricefinder-response{margin-top:2.4rem;text-align:center;font-size:2.4em}";export{l as pn_pex_pricefinder}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function l(e){try{s(n.next(e))}catch(t){o(t)}}function a(e){try{s(n["throw"](e))}catch(t){o(t)}}function s(e){e.done?i(e.value):r(e.value).then(l,a)}s((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return s([e,t])}}function s(l){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=l[0]&2?r["return"]:l[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;if(r=0,o)l=[l[0]&2,o.value];switch(l[0]){case 0:case 1:o=l;break;case 4:i.label++;return{value:l[1],done:false};case 5:i.label++;r=l[1];l=[0];continue;case 7:l=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(l[0]===6&&i.label<o[1]){i.label=o[1];o=l;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(l);break}if(o[2])i.ops.pop();i.trys.pop();continue}l=t.call(e,i)}catch(a){l=[6,a];r=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-36654f2a.system.js"],(function(e,t){"use strict";var i,n,r,o;return{setters:[function(e){i=e.r;n=e.h;r=e.a;o=e.g}],execute:function(){var l={sv:{heading:"Beräkna pris med PEX Bud",labelFrom:"Från postkod",labelTo:"Till postkod",zipPlaceholder:"Ex. 12831",labelWeight:"Vikt (i kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"När",submitButtonText:"Beräkna pris"},en:{heading:"Calculate price with PEX Bud",labelFrom:"From zip",labelTo:"To zip",zipPlaceholder:"Ex. 12831",labelWeight:"Weight (in kilo)",weightPlaceholder:"Ex. 1000",labelWhen:"When",submitButtonText:"Calculate price"}};var a=".pex-pricefinder-top{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.pex-pricefinder-top pn-illustration{width:5.5rem;height:5.5rem;margin-right:1.6rem}.pex-pricefinder-form{margin:1.6rem 0 0 0;padding:0;border:0}.pex-pricefinder-form fieldset{margin:0;padding:0;border:0}.pex-pricefinder-form fieldset+fieldset{margin-top:1.6rem}.pex-pricefinder-form fieldset>div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:1em}.pex-pricefinder-form fieldset>div>*{-ms-flex-positive:1;flex-grow:1;width:100%}.pex-pricefinder-form pn-button{-ms-flex-item-align:end;align-self:end;margin-left:auto}.pex-pricefinder-form .datepicker{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.pex-pricefinder-form .datepicker label{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end;cursor:pointer;-webkit-transition:color 0.2s;transition:color 0.2s}.pex-pricefinder-form .datepicker pn-date-picker{width:100%}.pex-pricefinder-response{margin-top:2.4rem;text-align:center;font-size:2.4em}";var s=e("pn_pex_pricefinder",function(){function e(e){i(this,e);this.language="sv";this.currency="Kr";this.apiUrl="/api/pex/order";this.i18n=l.sv;this.fromzip=null;this.tozip=null;this.weight=1;this.when="";this.response=null}e.prototype.componentWillLoad=function(){this.init()};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.setInitialTime();this.checkParameters();this.setLanguage();return[2]}))}))};e.prototype.setInitialTime=function(){var e=new Date;e.setHours(e.getHours()+1);e.setMinutes(0);var t=e.toLocaleString("sv",{timeZoneName:"short"}).split(" ");this.when="".concat(t[0],"T").concat(t[1].substring(0,5))};e.prototype.checkParameters=function(){var e=this;var t=new URLSearchParams(window.location.href);if(!t){return}var i=["fromzip","tozip","weight","when"];i.forEach((function(i){if(t.get(i)){e[i]=t.get(i)}}))};e.prototype.setLanguage=function(){if(l[this.language]){this.i18n=l[this.language]}};e.prototype.onSubmit=function(e){e.preventDefault();var t=new FormData(e.target);var i=this.compileRequestQuery(t);this.fetchResult(i)};e.prototype.compileRequestQuery=function(e){var t={from:e.get("fromzip"),to:e.get("tozip"),weight:e.get("weight"),when:e.get("when")};if(!t.when){t.when=this.hostElement.querySelector("input.date-input").value}if(!e.get("fromzip")||!e.get("tozip")||!e.get("weight")){console.error("Form data is not compliant");return}return t};e.prototype.fetchResult=function(e){return __awaiter(this,void 0,void 0,(function(){var i,n,r;return __generator(this,(function(o){switch(o.label){case 0:this.response=null;i=new URLSearchParams(e);return[4,fetch("".concat(this.apiUrl,"?").concat(i.toString()),{method:"get",headers:{"Content-Type":"application/json"}}).catch(this.onFetchError.bind(this))];case 1:n=o.sent();return[4,n.json().catch(this.onFetchError.bind(this))];case 2:r=o.sent();if(!!r)return[3,5];return[4,t.import("./p-84d9f552.system.js")];case 3:return[4,o.sent().default];case 4:r=o.sent();o.label=5;case 5:if(r){this.response=r}return[2]}}))}))};e.prototype.onFetchError=function(e){console.error("onFetchError(error",e)};e.prototype.render=function(){return n(r,null,n("div",{class:"pex-pricefinder-top"},n("pn-illustration",{illustration:"PEX-truck"}),n("h2",null,this.i18n.heading)),n("form",{method:"get",action:"",class:"pex-pricefinder-form",onSubmit:this.onSubmit.bind(this)},n("fieldset",null,n("div",null,n("pn-input",{type:"number",label:this.i18n.labelFrom,inputid:"fromzip",name:"fromzip",placeholder:this.i18n.zipPlaceholder,required:true,value:this.fromzip}),n("pn-input",{type:"number",label:this.i18n.labelTo,inputid:"tozip",name:"tozip",placeholder:this.i18n.zipPlaceholder,required:true,value:this.tozip}))),n("fieldset",null,n("div",null,n("pn-input",{type:"number",label:this.i18n.labelWeight,inputid:"weight",name:"weight",placeholder:this.i18n.weightPlaceholder,required:true,value:this.weight}),n("div",{class:"datepicker"},n("label",{htmlFor:"when"},this.i18n.labelWhen),n("pn-marketweb-input",{inputid:"when",name:"when",type:"datetime-local",min:(new Date).toISOString().split("T")[0],value:this.when})))),n("fieldset",null,n("div",null,n("pn-button",{type:"submit"},this.i18n.submitButtonText)))),this.response?n("div",{class:"pex-pricefinder-response"},n("strong",null,this.response.data.value," ",this.currency)):null)};Object.defineProperty(e.prototype,"hostElement",{get:function(){return o(this)},enumerable:false,configurable:true});return e}());s.style=a}}}));