@postnord/pn-marketweb-components 1.0.7 → 1.0.8

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.
Files changed (81) hide show
  1. package/cjs/loader.cjs.js +1 -1
  2. package/cjs/pn-choice-button_2.cjs.entry.js +2 -2
  3. package/cjs/{pn-find-service-and-price-store-7ced0e29.js → pn-find-service-and-price-store-56d8b760.js} +3 -1
  4. package/cjs/pn-find-service-and-price.cjs.entry.js +37 -20
  5. package/cjs/pn-market-web-components.cjs.js +1 -1
  6. package/cjs/pn-product-pricelist-result.cjs.entry.js +13 -2
  7. package/cjs/{pn-product-pricelist-store-ffd73312.js → pn-product-pricelist-store-e4f8503b.js} +5 -1
  8. package/cjs/pn-product-pricelist.cjs.entry.js +114 -5
  9. package/cjs/pn-product-tile_3.cjs.entry.js +4 -4
  10. package/collection/components/widgets/pn-find-service-and-price/find-service-and-price.stories.js +1 -1
  11. package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.js +4 -4
  12. package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-store.js +3 -1
  13. package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-translations.js +10 -0
  14. package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.css +5 -1
  15. package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.js +25 -18
  16. package/collection/components/widgets/pn-product-pricelist/data.js +17 -15
  17. package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-result.js +22 -7
  18. package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-store.js +5 -1
  19. package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-translations.js +20 -0
  20. package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.css +50 -1
  21. package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.js +76 -2
  22. package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.stories.js +1 -1
  23. package/collection/components/widgets/pn-product-tile/pn-product-tile-price.css +5 -3
  24. package/collection/components/widgets/pn-product-tile/pn-product-tile-price.js +6 -11
  25. package/collection/components/widgets/pn-product-tile/pn-product-tile.css +4 -4
  26. package/collection/components/widgets/pn-product-tile/pn-product-tile.js +3 -3
  27. package/custom-elements/index.js +184 -41
  28. package/esm/loader.js +1 -1
  29. package/esm/pn-choice-button_2.entry.js +2 -2
  30. package/esm/{pn-find-service-and-price-store-0c7083bd.js → pn-find-service-and-price-store-d02cbfe1.js} +3 -1
  31. package/esm/pn-find-service-and-price.entry.js +37 -20
  32. package/esm/pn-market-web-components.js +1 -1
  33. package/esm/pn-product-pricelist-result.entry.js +13 -2
  34. package/esm/{pn-product-pricelist-store-82211c4a.js → pn-product-pricelist-store-6259b354.js} +5 -1
  35. package/esm/pn-product-pricelist.entry.js +114 -5
  36. package/esm/pn-product-tile_3.entry.js +4 -4
  37. package/esm-es5/loader.js +1 -1
  38. package/esm-es5/pn-choice-button_2.entry.js +1 -1
  39. package/esm-es5/{pn-find-service-and-price-store-0c7083bd.js → pn-find-service-and-price-store-d02cbfe1.js} +1 -1
  40. package/esm-es5/pn-find-service-and-price.entry.js +1 -1
  41. package/esm-es5/pn-market-web-components.js +1 -1
  42. package/esm-es5/pn-product-pricelist-result.entry.js +1 -1
  43. package/esm-es5/pn-product-pricelist-store-6259b354.js +1 -0
  44. package/esm-es5/pn-product-pricelist.entry.js +1 -1
  45. package/esm-es5/pn-product-tile_3.entry.js +1 -1
  46. package/package.json +1 -1
  47. package/pn-market-web-components/p-3ae134bf.system.entry.js +1 -0
  48. package/pn-market-web-components/{p-d0e7e65c.system.js → p-43bb8707.system.js} +1 -1
  49. package/pn-market-web-components/p-4b4ee8d5.system.entry.js +1 -0
  50. package/pn-market-web-components/p-57a1db89.system.entry.js +1 -0
  51. package/pn-market-web-components/p-62700d6e.system.js +1 -1
  52. package/pn-market-web-components/{p-f37be6ee.system.entry.js → p-80fd4dd9.system.entry.js} +1 -1
  53. package/pn-market-web-components/p-926fc962.js +1 -0
  54. package/pn-market-web-components/p-a04d0ba4.entry.js +1 -0
  55. package/pn-market-web-components/{p-64a6c2fb.js → p-af861bb5.js} +1 -1
  56. package/pn-market-web-components/p-b129cc27.system.js +1 -0
  57. package/pn-market-web-components/p-b4904bdb.system.entry.js +1 -0
  58. package/pn-market-web-components/p-ba704cbf.entry.js +1 -0
  59. package/pn-market-web-components/p-ba8e9dfe.entry.js +1 -0
  60. package/pn-market-web-components/{p-dc5ff15f.entry.js → p-d3590589.entry.js} +1 -1
  61. package/pn-market-web-components/p-e377410f.entry.js +1 -0
  62. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  63. package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-store.d.ts +4 -0
  64. package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-translations.d.ts +10 -0
  65. package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-types.d.ts +2 -0
  66. package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-result.d.ts +2 -0
  67. package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-store.d.ts +8 -0
  68. package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-translations.d.ts +20 -0
  69. package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-types.d.ts +9 -0
  70. package/types/components/widgets/pn-product-pricelist/pn-product-pricelist.d.ts +4 -0
  71. package/esm-es5/pn-product-pricelist-store-82211c4a.js +0 -1
  72. package/pn-market-web-components/p-1905c548.entry.js +0 -1
  73. package/pn-market-web-components/p-1fe6de09.entry.js +0 -1
  74. package/pn-market-web-components/p-23743bec.system.entry.js +0 -1
  75. package/pn-market-web-components/p-23d34c82.system.entry.js +0 -1
  76. package/pn-market-web-components/p-2fa246f1.system.js +0 -1
  77. package/pn-market-web-components/p-44f74289.system.entry.js +0 -1
  78. package/pn-market-web-components/p-4f283190.js +0 -1
  79. package/pn-market-web-components/p-c06b37c7.entry.js +0 -1
  80. package/pn-market-web-components/p-c9af6ced.entry.js +0 -1
  81. package/pn-market-web-components/p-ea9afb95.system.entry.js +0 -1
@@ -1 +0,0 @@
1
- System.register(["./p-46018354.system.js"],(function(e){"use strict";var t;return{setters:[function(e){t=e.c}],execute:function(){var n=t({i18n:{maxweightlabel:"",maxmeasurementlabel:""},market:{currency:""}}),r=n.state,s=n.onChange;e("s",r)}}}));
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,a){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function l(e){try{s(a.next(e))}catch(t){r(t)}}function o(e){try{s(a["throw"](e))}catch(t){r(t)}}function s(e){e.done?i(e.value):n(e.value).then(l,o)}s((a=a.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},a,n,r,l;return l={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function o(e){return function(t){return s([e,t])}}function s(l){if(a)throw new TypeError("Generator is already executing.");while(i)try{if(a=1,n&&(r=l[0]&2?n["return"]:l[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,l[1])).done)return r;if(n=0,r)l=[l[0]&2,r.value];switch(l[0]){case 0:case 1:r=l;break;case 4:i.label++;return{value:l[1],done:false};case 5:i.label++;n=l[1];l=[0];continue;case 7:l=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]<r[3])){i.label=l[1];break}if(l[0]===6&&i.label<r[1]){i.label=r[1];r=l;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(l);break}if(r[2])i.ops.pop();i.trys.pop();continue}l=t.call(e,i)}catch(o){l=[6,o];n=0}finally{a=r=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t){for(var i=0,a=t.length,n=e.length;i<a;i++,n++)e[n]=t[i];return e};System.register(["./p-7331d3bb.system.js","./p-91624bd5.system.js","./p-d0e7e65c.system.js","./p-46018354.system.js"],(function(e){"use strict";var t,i,a,n;return{setters:[function(e){t=e.r;i=e.h},function(e){a=e.c},function(e){n=e.s},function(){}],execute:function(){var r={sv:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Hit eller dit?",sizeheading:"Hur mycket väger det?",resultlistheading:"Några utvalda val",weightlabel:"Vikt",maxweightlabel:"Maxvikt",maxmeasurementlabel:"Maxvolym"},en:{componentheading:"What do you want to send?",deliveryscopeheading:"Here or there?",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Weight",maxweightlabel:"Max weight",maxmeasurementlabel:"Maximum measurement"},da:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Here or there?",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Vægt",maxweightlabel:"Max vægt",maxmeasurementlabel:"Maks. Volumen"},no:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Here or there?",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Vekt",maxweightlabel:"Maks vekt",maxmeasurementlabel:"Maks volum"},fi:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Here or there?",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Paino",maxweightlabel:"Max paino",maxmeasurementlabel:"Max äänenvoimakkuus"}};var l={se:{currency:"kr"},dk:{currency:"dk"},fi:{currency:" €"},no:{currency:"kr"}};var o=[{name:"Brev",value:"letter",illustration:"letterbox-reply-letter-plants"},{name:"Paket",value:"parcel",illustration:"tracking"}];var s={letter:[{name:"Sweden",value:"sweden",illustration:"letterboxes"},{name:"Abroad",value:"abroad",illustration:"character-box-letters-globe"}],parcel:[{name:"Sweden",value:"sweden",illustration:"letterboxes"},{name:"Within Europe",value:"withineurope",illustration:"character-box-letters-globe"},{name:"Outside Europe",value:"outsideeurope",illustration:"discover"}]};var u={letter:[{name:"50g",abbreviation:"g",value:50},{name:"100g",abbreviation:"g",value:100},{name:"250g",abbreviation:"g",value:250},{name:"500g",abbreviation:"g",value:500},{name:"1kg",abbreviation:"kg",value:1},{name:"2kg",abbreviation:"kg",value:2}],parcel:[{name:"1kg",abbreviation:"kg",value:1},{name:"2kg",abbreviation:"kg",value:2},{name:"3kg",abbreviation:"kg",value:3},{name:"4kg",abbreviation:"kg",value:4},{name:"5kg",abbreviation:"kg",value:5},{name:"6kg",abbreviation:"kg",value:6},{name:"7Kg",abbreviation:"kg",value:7},{name:"8kg",abbreviation:"kg",value:8},{name:"9kg",abbreviation:"kg",value:9},{name:"10kg",abbreviation:"kg",value:10},{name:"11kg",abbreviation:"kg",value:11},{name:"12kg",abbreviation:"kg",value:12},{name:"13kg",abbreviation:"kg",value:13},{name:"14kg",abbreviation:"kg",value:14},{name:"15kg",abbreviation:"kg",value:15},{name:"16kg",abbreviation:"kg",value:16},{name:"17kg",abbreviation:"kg",value:17},{name:"18kg",abbreviation:"kg",value:18},{name:"20kg",abbreviation:"kg",value:20}]};var g="pn-find-service-and-price h2,pn-find-service-and-price .heading{text-align:center;font-size:1.5em;line-height:1.1;font-weight:bold;margin-bottom:1rem}pn-find-service-and-price .postagetypes,pn-find-service-and-price .deliveryscope{text-align:center;margin-bottom:3rem}pn-find-service-and-price .weightoption{display:-ms-flexbox;display:flex;gap:1em}pn-find-service-and-price .weightoption-input{width:5em;position:relative}pn-find-service-and-price .weightoption-input input::-webkit-outer-spin-button,pn-find-service-and-price .weightoption-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}pn-find-service-and-price .weightoption-input-abbreviation{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:1.2em;margin-top:0.75em;font-weight:500}pn-find-service-and-price .weightoption-range{-ms-flex-positive:1;flex-grow:1;-ms-flex-item-align:end;align-self:flex-end;position:relative;top:0.5em}pn-find-service-and-price .weightoption-range input{width:calc(100% - 1.5em)}pn-find-service-and-price .weightoption-range datalist{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75em}pn-find-service-and-price .resultlist{margin:3em 0}";var v=e("pn_find_service_and_price",function(){function e(e){t(this,e);this.source="https://com-integration.postnord.com/globalassets/global/prices/sv-se-findprice.xlsx";this.language="sv";this.market="se";this.filteredItems=[];this.postagetype={value:"",name:"",icon:""};this.weight={value:0,name:""};this.weightvalue=0;this.deliveryscope={value:"",name:"",icon:""};this.sourceData={types:[],data:[]}}e.prototype.componentWillLoad=function(){var e=this;this.setState();this.getDataSource();window.setTimeout((function(){e.postagetype=o[1];e.deliveryscope=s[e.postagetype.value][0];e.weight=u[e.postagetype.value][0];e.weightvalue=e.weight.value}),500)};e.prototype.getDataSource=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n;return __generator(this,(function(r){switch(r.label){case 0:return[4,fetch(this.source)];case 1:e=r.sent();return[4,e.blob()];case 2:t=r.sent();r.label=3;case 3:r.trys.push([3,5,,6]);return[4,a(t)];case 4:i=r.sent();this.sourceData=i;return[3,6];case 5:n=r.sent();console.log("Unable to parse data");return[3,6];case 6:return[2]}}))}))};e.prototype.setState=function(){if(this.market){n.market=l[this.market]}if(this.language&&r[this.language]){n.i18n=r[this.language]}};e.prototype.filterItems=function(){var e=this;var t;if(!((t=this.sourceData)===null||t===void 0?void 0:t.data)){console.log("Data has not yet been loaded");return}if(!this.postagetype){return}var i=this.sourceData.data.filter((function(t){return t.what===e.postagetype.value}));if(!this.deliveryscope){return}var a=i.filter((function(t){return t.deliveryscope===e.deliveryscope.value}));if(!this.weight||!this.weight.value){return}var n=this.weight.abbreviation.toLocaleLowerCase()==="kg"&&this.postagetype.value==="letter"?this.weight.value*1e3:this.weight.value;var r=a.filter((function(e){return e.maxweight===n}));if(r.length===0){r=a.filter((function(e){return e.maxweight>=n}));if(r.length>0){var l=__spreadArray([],new Map(r.reverse().map((function(e){return[e["id"],e]}))).values());if(l.length>0){r=l}}}this.filteredItems=r};e.prototype.render=function(){var e=this;return i("div",null,i("div",{class:"form"},n.i18n.componentheading?i("h2",null,n.i18n.componentheading):null,i("div",{class:"postagetypes"},o.map((function(t){return i("pn-choice-button",{choiceid:t.value,value:t.value,name:"postagetype",type:"radio",checked:t.value===e.postagetype.value,onChange:function(){e.postagetype=o.filter((function(e){return e.value===t.value}))[0];e.weight=u[e.postagetype.value][0];e.weightvalue=e.weight.value}},i("pn-illustration",{illustration:t.illustration})," ",t.name)}))),this.postagetype.value&&s[this.postagetype.value]?i("div",null,n.i18n.deliveryscopeheading?i("div",{class:"heading"},n.i18n.deliveryscopeheading):null,i("div",{class:"deliveryscope"},s[this.postagetype.value].map((function(t){return i("pn-choice-button",{choiceid:e.postagetype.value+t.value,value:t.value,name:"deliveryscope",type:"radio",checked:t.value===e.deliveryscope.value,onChange:function(){e.deliveryscope=s[e.postagetype.value].filter((function(e){return e.value===t.value}))[0]}},i("pn-illustration",{illustration:t.illustration})," ",t.name)})))):null,this.postagetype.value&&u[this.postagetype.value]&&this.deliveryscope.value?i("div",null,n.i18n.sizeheading?i("div",{class:"heading"},n.i18n.sizeheading):null,i("div",{class:"weightoption"},i("div",{class:"weightoption-input"},i("pn-input",{inputid:"weightvalue",name:"weightvalue",type:"number",label:n.i18n.weightlabel,value:this.weightvalue,onChange:function(t){if(t&&t.target&&t.target.value){var i=parseInt(t.target.value,10);if(!isNaN(i)){var a=u[e.postagetype.value].filter((function(e){var t=e.abbreviation==="kg"?e.value*1e3:e.value;return t>=i}));if(a&&a.length>0){e.weight=a[0];e.weightvalue=e.weight.value}}}}}),i("span",{class:"weightoption-input-abbreviation"},this.weight.abbreviation)),i("div",{class:"weightoption-range"},i("input",{type:"range",id:"weightrange",name:"weightrange",list:"weightlist",value:!this.weight.value?0:u[this.postagetype.value].findIndex((function(t){return t.value===e.weightvalue})),onChange:function(t){var i=t.target.value;e.weight=u[e.postagetype.value][i];e.weightvalue=e.weight.value},min:"0",max:u[this.postagetype.value].length-1}),i("datalist",{id:"weightlist"},u[this.postagetype.value].map((function(t,a){var n=t.name;if(u[e.postagetype.value].length>6){n=a%5===0||a===0||a===u[e.postagetype.value].length-1?t.name:""}return i("option",Object.assign({value:a},n?{label:n}:{}))})))))):null),this.filteredItems?i("div",{class:"resultlist"},n.i18n.resultlistheading?i("div",{class:"heading"},n.i18n.resultlistheading):null,this.filteredItems.map((function(e){return i("div",null,i("pn-find-service-and-price-result",{item:e}))}))):null)};Object.defineProperty(e,"watchers",{get:function(){return{market:["setState"],language:["setState"],postagetype:["filterItems"],deliveryscope:["filterItems"],weightvalue:["filterItems"]}},enumerable:false,configurable:true});return e}());v.style=g}}}));
@@ -1 +0,0 @@
1
- import{c as e}from"./p-ce136600.js";const{state:a}=e({i18n:{maxweightlabel:"",maxmeasurementlabel:""},market:{currency:""}});export{a as s}
@@ -1 +0,0 @@
1
- import{r as l,h as e,a as t}from"./p-bfc523fc.js";const n=class{constructor(e){l(this,e)}render(){return e(t,null,e("slot",{name:"illustration"}),e("div",{class:"tilecontent"},e("slot",{name:"content"}),e("div",{class:"details"},e("div",{class:"info"},e("slot",null)),e("slot",{name:"price"})),e("slot",{name:"note"})))}};n.style="pn-product-tile{margin-bottom:1em;border:0.1rem solid #D3CECB;outline:none;background:white;-webkit-box-shadow:0px 0.6px 1.8px rgba(0, 0, 0, 0.1), 0px 3.2px 7.2px rgba(0, 0, 0, 0.13);box-shadow:0px 0.6px 1.8px rgba(0, 0, 0, 0.1), 0px 3.2px 7.2px rgba(0, 0, 0, 0.13);display:-ms-flexbox;display:flex;padding:1.5em;word-break:break-word;text-decoration:none;border-radius:0.8rem}pn-product-tile [slot=content] h3{display:-ms-flexbox;display:flex;width:100%;-ms-flex-pack:justify;justify-content:space-between;margin-bottom:0.5em}pn-product-tile>pn-illustration{min-width:8rem;width:8rem;height:8rem;margin-right:3rem;-ms-flex-item-align:center;align-self:center}pn-product-tile .tilecontent{-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center}pn-product-tile .details{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;width:100%;-ms-flex-align:center;align-items:center}pn-product-tile .info{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-positive:1;flex-grow:1;max-width:calc((100% / 3) * 2);-ms-flex-flow:wrap;flex-flow:wrap}pn-product-tile .info>*{min-width:6em;margin:0.2em 1em 0.2em 0}";const i=class{constructor(e){l(this,e)}render(){return e(t,null,this.label?e("p",null,e("small",null,this.label)):null,this.text?e("h3",null,this.text):null)}};e("pn-icon",{symbol:"align-center",small:"false",color:"black"}),i.style="pn-product-tile-info{-ms-flex-item-align:center;align-self:center}";const s=class{constructor(e){l(this,e)}render(){if(this.amount)return this.url?e(t,null,e("a",{href:this.url},this.label?e("p",null,e("small",null,this.label,e("pn-icon",{symbol:"open-in-new",small:"true",color:"blue700"}))):null,e("h3",null,this.amount?e("span",{class:"pn-2xl"},this.amount):null,this.currency?e("span",null,this.currency):null))):e(t,null,this.label?e("p",null,e("small",null,this.label)):null,e("h3",null,this.amount?e("span",{class:"pn-2xl"},this.amount):null,this.currency?e("span",null,this.currency):null))}};s.style="pn-product-tile-price span:last-child{display:inline-block;margin-left:0.2em}pn-product-tile-price+pn-product-tile-price{margin-left:1.5em}pn-product-tile-price small{display:-ms-flexbox;display:flex}pn-product-tile-price pn-icon{display:inline-block;-ms-flex-item-align:center;align-self:center}pn-product-tile-price a{text-decoration:none;color:#005D92}pn-product-tile-price a h3{text-decoration:underline}";export{n as pn_product_tile,i as pn_product_tile_info,s as pn_product_tile_price}
@@ -1 +0,0 @@
1
- import{r as e,h as i}from"./p-bfc523fc.js";import{c as t}from"./p-21e0e386.js";import{s as a}from"./p-64a6c2fb.js";import"./p-ce136600.js";const n={sv:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Hit eller dit?",sizeheading:"Hur mycket väger det?",resultlistheading:"Några utvalda val",weightlabel:"Vikt",maxweightlabel:"Maxvikt",maxmeasurementlabel:"Maxvolym"},en:{componentheading:"What do you want to send?",deliveryscopeheading:"Here or there?",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Weight",maxweightlabel:"Max weight",maxmeasurementlabel:"Maximum measurement"},da:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Here or there?",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Vægt",maxweightlabel:"Max vægt",maxmeasurementlabel:"Maks. Volumen"},no:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Here or there?",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Vekt",maxweightlabel:"Maks vekt",maxmeasurementlabel:"Maks volum"},fi:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Here or there?",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Paino",maxweightlabel:"Max paino",maxmeasurementlabel:"Max äänenvoimakkuus"}},s={se:{currency:"kr"},dk:{currency:"dk"},fi:{currency:" €"},no:{currency:"kr"}},l=[{name:"Brev",value:"letter",illustration:"letterbox-reply-letter-plants"},{name:"Paket",value:"parcel",illustration:"tracking"}],o={letter:[{name:"Sweden",value:"sweden",illustration:"letterboxes"},{name:"Abroad",value:"abroad",illustration:"character-box-letters-globe"}],parcel:[{name:"Sweden",value:"sweden",illustration:"letterboxes"},{name:"Within Europe",value:"withineurope",illustration:"character-box-letters-globe"},{name:"Outside Europe",value:"outsideeurope",illustration:"discover"}]},r={letter:[{name:"50g",abbreviation:"g",value:50},{name:"100g",abbreviation:"g",value:100},{name:"250g",abbreviation:"g",value:250},{name:"500g",abbreviation:"g",value:500},{name:"1kg",abbreviation:"kg",value:1},{name:"2kg",abbreviation:"kg",value:2}],parcel:[{name:"1kg",abbreviation:"kg",value:1},{name:"2kg",abbreviation:"kg",value:2},{name:"3kg",abbreviation:"kg",value:3},{name:"4kg",abbreviation:"kg",value:4},{name:"5kg",abbreviation:"kg",value:5},{name:"6kg",abbreviation:"kg",value:6},{name:"7Kg",abbreviation:"kg",value:7},{name:"8kg",abbreviation:"kg",value:8},{name:"9kg",abbreviation:"kg",value:9},{name:"10kg",abbreviation:"kg",value:10},{name:"11kg",abbreviation:"kg",value:11},{name:"12kg",abbreviation:"kg",value:12},{name:"13kg",abbreviation:"kg",value:13},{name:"14kg",abbreviation:"kg",value:14},{name:"15kg",abbreviation:"kg",value:15},{name:"16kg",abbreviation:"kg",value:16},{name:"17kg",abbreviation:"kg",value:17},{name:"18kg",abbreviation:"kg",value:18},{name:"20kg",abbreviation:"kg",value:20}]},h=class{constructor(i){e(this,i),this.source="https://com-integration.postnord.com/globalassets/global/prices/sv-se-findprice.xlsx",this.language="sv",this.market="se",this.filteredItems=[],this.postagetype={value:"",name:"",icon:""},this.weight={value:0,name:""},this.weightvalue=0,this.deliveryscope={value:"",name:"",icon:""},this.sourceData={types:[],data:[]}}componentWillLoad(){this.setState(),this.getDataSource(),window.setTimeout((()=>{this.postagetype=l[1],this.deliveryscope=o[this.postagetype.value][0],this.weight=r[this.postagetype.value][0],this.weightvalue=this.weight.value}),500)}async getDataSource(){const e=await fetch(this.source),i=await e.blob();try{const e=await t(i);this.sourceData=e}catch(a){console.log("Unable to parse data")}}setState(){this.market&&(a.market=s[this.market]),this.language&&n[this.language]&&(a.i18n=n[this.language])}filterItems(){var e;if(!(null===(e=this.sourceData)||void 0===e?void 0:e.data))return void console.log("Data has not yet been loaded");if(!this.postagetype)return;const i=this.sourceData.data.filter((e=>e.what===this.postagetype.value));if(!this.deliveryscope)return;const t=i.filter((e=>e.deliveryscope===this.deliveryscope.value));if(!this.weight||!this.weight.value)return;const a="kg"===this.weight.abbreviation.toLocaleLowerCase()&&"letter"===this.postagetype.value?1e3*this.weight.value:this.weight.value;let n=t.filter((e=>e.maxweight===a));if(0===n.length&&(n=t.filter((e=>e.maxweight>=a)),n.length>0)){const e=[...new Map(n.reverse().map((e=>[e.id,e]))).values()];e.length>0&&(n=e)}this.filteredItems=n}render(){return i("div",null,i("div",{class:"form"},a.i18n.componentheading?i("h2",null,a.i18n.componentheading):null,i("div",{class:"postagetypes"},l.map((e=>i("pn-choice-button",{choiceid:e.value,value:e.value,name:"postagetype",type:"radio",checked:e.value===this.postagetype.value,onChange:()=>{this.postagetype=l.filter((i=>i.value===e.value))[0],this.weight=r[this.postagetype.value][0],this.weightvalue=this.weight.value}},i("pn-illustration",{illustration:e.illustration})," ",e.name)))),this.postagetype.value&&o[this.postagetype.value]?i("div",null,a.i18n.deliveryscopeheading?i("div",{class:"heading"},a.i18n.deliveryscopeheading):null,i("div",{class:"deliveryscope"},o[this.postagetype.value].map((e=>i("pn-choice-button",{choiceid:this.postagetype.value+e.value,value:e.value,name:"deliveryscope",type:"radio",checked:e.value===this.deliveryscope.value,onChange:()=>{this.deliveryscope=o[this.postagetype.value].filter((i=>i.value===e.value))[0]}},i("pn-illustration",{illustration:e.illustration})," ",e.name))))):null,this.postagetype.value&&r[this.postagetype.value]&&this.deliveryscope.value?i("div",null,a.i18n.sizeheading?i("div",{class:"heading"},a.i18n.sizeheading):null,i("div",{class:"weightoption"},i("div",{class:"weightoption-input"},i("pn-input",{inputid:"weightvalue",name:"weightvalue",type:"number",label:a.i18n.weightlabel,value:this.weightvalue,onChange:e=>{if(e&&e.target&&e.target.value){const i=parseInt(e.target.value,10);if(!isNaN(i)){let e=r[this.postagetype.value].filter((e=>("kg"===e.abbreviation?1e3*e.value:e.value)>=i));e&&e.length>0&&(this.weight=e[0],this.weightvalue=this.weight.value)}}}}),i("span",{class:"weightoption-input-abbreviation"},this.weight.abbreviation)),i("div",{class:"weightoption-range"},i("input",{type:"range",id:"weightrange",name:"weightrange",list:"weightlist",value:this.weight.value?r[this.postagetype.value].findIndex((e=>e.value===this.weightvalue)):0,onChange:e=>{this.weight=r[this.postagetype.value][e.target.value],this.weightvalue=this.weight.value},min:"0",max:r[this.postagetype.value].length-1}),i("datalist",{id:"weightlist"},r[this.postagetype.value].map(((e,t)=>{let a=e.name;return r[this.postagetype.value].length>6&&(a=t%5==0||0===t||t===r[this.postagetype.value].length-1?e.name:""),i("option",Object.assign({value:t},a?{label:a}:{}))})))))):null),this.filteredItems?i("div",{class:"resultlist"},a.i18n.resultlistheading?i("div",{class:"heading"},a.i18n.resultlistheading):null,this.filteredItems.map((e=>i("div",null,i("pn-find-service-and-price-result",{item:e}))))):null)}static get watchers(){return{market:["setState"],language:["setState"],postagetype:["filterItems"],deliveryscope:["filterItems"],weightvalue:["filterItems"]}}};h.style="pn-find-service-and-price h2,pn-find-service-and-price .heading{text-align:center;font-size:1.5em;line-height:1.1;font-weight:bold;margin-bottom:1rem}pn-find-service-and-price .postagetypes,pn-find-service-and-price .deliveryscope{text-align:center;margin-bottom:3rem}pn-find-service-and-price .weightoption{display:-ms-flexbox;display:flex;gap:1em}pn-find-service-and-price .weightoption-input{width:5em;position:relative}pn-find-service-and-price .weightoption-input input::-webkit-outer-spin-button,pn-find-service-and-price .weightoption-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}pn-find-service-and-price .weightoption-input-abbreviation{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:1.2em;margin-top:0.75em;font-weight:500}pn-find-service-and-price .weightoption-range{-ms-flex-positive:1;flex-grow:1;-ms-flex-item-align:end;align-self:flex-end;position:relative;top:0.5em}pn-find-service-and-price .weightoption-range input{width:calc(100% - 1.5em)}pn-find-service-and-price .weightoption-range datalist{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75em}pn-find-service-and-price .resultlist{margin:3em 0}";export{h as pn_find_service_and_price}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,n,r){function a(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,i){function s(t){try{l(r.next(t))}catch(e){i(e)}}function o(t){try{l(r["throw"](t))}catch(e){i(e)}}function l(t){t.done?n(t.value):a(t.value).then(s,o)}l((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,a,i,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(e){return l([t,e])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,a&&(i=s[0]&2?a["return"]:s[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;if(a=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;a=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=e.call(t,n)}catch(o){s=[6,o];a=0}finally{r=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-7331d3bb.system.js","./p-91624bd5.system.js","./p-2fa246f1.system.js","./p-46018354.system.js"],(function(t){"use strict";var e,n,r,a,i;return{setters:[function(t){e=t.r;n=t.h;r=t.a},function(t){a=t.c},function(t){i=t.s},function(){}],execute:function(){var s={sv:{maxweightlabel:"Maxvikt",maxmeasurementlabel:"Maxvolym"},en:{maxweightlabel:"Max weight",maxmeasurementlabel:"Maximum measurement"},da:{maxweightlabel:"Max vægt",maxmeasurementlabel:"Maks. Volumen"},no:{maxweightlabel:"Maks vekt",maxmeasurementlabel:"Maks volum"},fi:{maxweightlabel:"Max paino",maxmeasurementlabel:"Max äänenvoimakkuus"}};var o={se:{currency:"kr"},dk:{currency:"dk"},fi:{currency:" €"},no:{currency:"kr"}};var l='pn-product-pricelist pn-spinner{margin:1em auto}pn-product-pricelist .resultlist:not([data-list-count="0"]){margin-top:1.5em}';var u=t("pn_product_pricelist",function(){function t(t){e(this,t);this.source="https://com-integration.postnord.com/globalassets/global/prices/sv-se-findprice.xlsx";this.language="sv";this.market="se";this.productid="";this.filteredItems=[];this.sourceData={types:[],data:[]};this.gotData=false;this.loading=false}t.prototype.componentWillLoad=function(){this.setState();this.getDataSource().then((function(){}))};t.prototype.setState=function(){if(this.market){i.market=o[this.market]}if(this.language&&s[this.language]){i.i18n=s[this.language]}};t.prototype.getDataSource=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,r;return __generator(this,(function(i){switch(i.label){case 0:if(!this.productid){return[2]}this.loading=true;return[4,fetch(this.source)];case 1:t=i.sent();return[4,t.blob()];case 2:e=i.sent();i.label=3;case 3:i.trys.push([3,5,,6]);return[4,a(e)];case 4:n=i.sent();this.sourceData=n;this.filterItems();return[3,6];case 5:r=i.sent();this.loading=false;console.warn("Unable to parse data");return[3,6];case 6:return[2]}}))}))};t.prototype.filterItems=function(){var t=this;var e;if(!((e=this.sourceData)===null||e===void 0?void 0:e.data)){console.info("Data has not yet been loaded");return}this.loading=false;this.filteredItems=this.sourceData.data.filter((function(e){return e.id===t.productid}));this.gotData=this.filteredItems.length>0};t.prototype.render=function(){return n(r,null,n("div",{class:"content"},n("slot",null)),this.loading?n("pn-spinner",null):null,n("div",{class:"resultlist","data-list-count":this.filteredItems.length},this.filteredItems.map((function(t){return n("div",null,n("pn-product-pricelist-result",{item:t}))}))))};Object.defineProperty(t,"watchers",{get:function(){return{market:["setState"],language:["setState"]}},enumerable:false,configurable:true});return t}());u.style=l}}}));