@postnord/pn-marketweb-components 1.0.44-beta1 → 1.0.44-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-find-price-result.cjs.entry.js +5 -15
- package/cjs/{pn-find-price-store-85b100ba.js → pn-find-price-store-d9aabecb.js} +1 -0
- package/cjs/pn-find-price.cjs.entry.js +48 -65
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-product-card_3.cjs.entry.js +49 -0
- package/collection/collection-manifest.json +3 -0
- package/collection/components/widgets/pn-find-price/data.js +36 -62
- package/collection/components/widgets/pn-find-price/pn-find-price-result.css +6 -0
- package/collection/components/widgets/pn-find-price/pn-find-price-result.js +18 -24
- package/collection/components/widgets/pn-find-price/pn-find-price-store.js +1 -0
- package/collection/components/widgets/pn-find-price/pn-find-price-translations.js +6 -4
- package/collection/components/widgets/pn-find-price/pn-find-price.css +1 -0
- package/collection/components/widgets/pn-find-price/pn-find-price.js +5 -0
- package/collection/components/widgets/pn-product-card/pn-product-card-info.css +30 -0
- package/collection/components/widgets/pn-product-card/pn-product-card-info.js +92 -0
- package/collection/components/widgets/pn-product-card/pn-product-card-price.css +37 -0
- package/collection/components/widgets/pn-product-card/pn-product-card-price.js +112 -0
- package/collection/components/widgets/pn-product-card/pn-product-card.css +86 -0
- package/collection/components/widgets/pn-product-card/pn-product-card.js +26 -0
- package/collection/components/widgets/pn-product-card/product-card.stories.js +50 -0
- package/custom-elements/index.d.ts +18 -0
- package/custom-elements/index.js +102 -79
- package/esm/loader.js +1 -1
- package/esm/pn-find-price-result.entry.js +5 -15
- package/esm/{pn-find-price-store-d2053b72.js → pn-find-price-store-8560f26c.js} +1 -0
- package/esm/pn-find-price.entry.js +48 -65
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-product-card_3.entry.js +43 -0
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-find-price-result.entry.js +1 -1
- package/esm-es5/{pn-find-price-store-d2053b72.js → pn-find-price-store-8560f26c.js} +1 -1
- package/esm-es5/pn-find-price.entry.js +1 -1
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-product-card_3.entry.js +1 -0
- package/package.json +7 -6
- package/pn-market-web-components/p-0fb48ff6.entry.js +1 -0
- package/pn-market-web-components/p-1051c2d9.system.entry.js +1 -0
- package/pn-market-web-components/{p-c30207e6.js → p-390d9a03.js} +1 -1
- package/pn-market-web-components/p-492e6f0d.system.js +1 -0
- package/pn-market-web-components/p-80ca78f4.entry.js +1 -0
- package/pn-market-web-components/p-a22df959.system.js +1 -1
- package/pn-market-web-components/p-a425e095.system.entry.js +1 -0
- package/pn-market-web-components/p-b42fd0cb.entry.js +1 -0
- package/pn-market-web-components/p-f2898a60.system.entry.js +1 -0
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/widgets/pn-find-price/pn-find-price-store.d.ts +2 -0
- package/types/components/widgets/pn-find-price/pn-find-price-translations.d.ts +2 -0
- package/types/components/widgets/pn-find-price/pn-find-price-types.d.ts +6 -1
- package/types/components/widgets/pn-product-card/pn-product-card-info.d.ts +7 -0
- package/types/components/widgets/pn-product-card/pn-product-card-price.d.ts +8 -0
- package/types/components/widgets/pn-product-card/pn-product-card.d.ts +3 -0
- package/types/components.d.ts +57 -0
- package/pn-market-web-components/p-233ca151.system.js +0 -1
- package/pn-market-web-components/p-4fcabdb8.entry.js +0 -1
- package/pn-market-web-components/p-b30e348c.system.entry.js +0 -1
- package/pn-market-web-components/p-bea2dcc6.entry.js +0 -1
- package/pn-market-web-components/p-d8882f68.system.entry.js +0 -1
package/types/components.d.ts
CHANGED
|
@@ -265,6 +265,21 @@ export namespace Components {
|
|
|
265
265
|
*/
|
|
266
266
|
"language": string;
|
|
267
267
|
}
|
|
268
|
+
interface PnProductCard {
|
|
269
|
+
}
|
|
270
|
+
interface PnProductCardInfo {
|
|
271
|
+
"label": string;
|
|
272
|
+
"paket": string;
|
|
273
|
+
"rulle": string;
|
|
274
|
+
"text": string;
|
|
275
|
+
}
|
|
276
|
+
interface PnProductCardPrice {
|
|
277
|
+
"amount": string;
|
|
278
|
+
"currency": string;
|
|
279
|
+
"label": string;
|
|
280
|
+
"note": string;
|
|
281
|
+
"url": string;
|
|
282
|
+
}
|
|
268
283
|
interface PnProductPricelist {
|
|
269
284
|
"language": string;
|
|
270
285
|
"market": string;
|
|
@@ -475,6 +490,24 @@ declare global {
|
|
|
475
490
|
prototype: HTMLPnPexPricefinderElement;
|
|
476
491
|
new (): HTMLPnPexPricefinderElement;
|
|
477
492
|
};
|
|
493
|
+
interface HTMLPnProductCardElement extends Components.PnProductCard, HTMLStencilElement {
|
|
494
|
+
}
|
|
495
|
+
var HTMLPnProductCardElement: {
|
|
496
|
+
prototype: HTMLPnProductCardElement;
|
|
497
|
+
new (): HTMLPnProductCardElement;
|
|
498
|
+
};
|
|
499
|
+
interface HTMLPnProductCardInfoElement extends Components.PnProductCardInfo, HTMLStencilElement {
|
|
500
|
+
}
|
|
501
|
+
var HTMLPnProductCardInfoElement: {
|
|
502
|
+
prototype: HTMLPnProductCardInfoElement;
|
|
503
|
+
new (): HTMLPnProductCardInfoElement;
|
|
504
|
+
};
|
|
505
|
+
interface HTMLPnProductCardPriceElement extends Components.PnProductCardPrice, HTMLStencilElement {
|
|
506
|
+
}
|
|
507
|
+
var HTMLPnProductCardPriceElement: {
|
|
508
|
+
prototype: HTMLPnProductCardPriceElement;
|
|
509
|
+
new (): HTMLPnProductCardPriceElement;
|
|
510
|
+
};
|
|
478
511
|
interface HTMLPnProductPricelistElement extends Components.PnProductPricelist, HTMLStencilElement {
|
|
479
512
|
}
|
|
480
513
|
var HTMLPnProductPricelistElement: {
|
|
@@ -574,6 +607,9 @@ declare global {
|
|
|
574
607
|
"pn-marketweb-siteheader-login": HTMLPnMarketwebSiteheaderLoginElement;
|
|
575
608
|
"pn-marketweb-siteheader-search": HTMLPnMarketwebSiteheaderSearchElement;
|
|
576
609
|
"pn-pex-pricefinder": HTMLPnPexPricefinderElement;
|
|
610
|
+
"pn-product-card": HTMLPnProductCardElement;
|
|
611
|
+
"pn-product-card-info": HTMLPnProductCardInfoElement;
|
|
612
|
+
"pn-product-card-price": HTMLPnProductCardPriceElement;
|
|
577
613
|
"pn-product-pricelist": HTMLPnProductPricelistElement;
|
|
578
614
|
"pn-product-pricelist-result": HTMLPnProductPricelistResultElement;
|
|
579
615
|
"pn-product-tile": HTMLPnProductTileElement;
|
|
@@ -862,6 +898,21 @@ declare namespace LocalJSX {
|
|
|
862
898
|
*/
|
|
863
899
|
"language"?: string;
|
|
864
900
|
}
|
|
901
|
+
interface PnProductCard {
|
|
902
|
+
}
|
|
903
|
+
interface PnProductCardInfo {
|
|
904
|
+
"label"?: string;
|
|
905
|
+
"paket"?: string;
|
|
906
|
+
"rulle"?: string;
|
|
907
|
+
"text"?: string;
|
|
908
|
+
}
|
|
909
|
+
interface PnProductCardPrice {
|
|
910
|
+
"amount"?: string;
|
|
911
|
+
"currency"?: string;
|
|
912
|
+
"label"?: string;
|
|
913
|
+
"note"?: string;
|
|
914
|
+
"url"?: string;
|
|
915
|
+
}
|
|
865
916
|
interface PnProductPricelist {
|
|
866
917
|
"language"?: string;
|
|
867
918
|
"market"?: string;
|
|
@@ -971,6 +1022,9 @@ declare namespace LocalJSX {
|
|
|
971
1022
|
"pn-marketweb-siteheader-login": PnMarketwebSiteheaderLogin;
|
|
972
1023
|
"pn-marketweb-siteheader-search": PnMarketwebSiteheaderSearch;
|
|
973
1024
|
"pn-pex-pricefinder": PnPexPricefinder;
|
|
1025
|
+
"pn-product-card": PnProductCard;
|
|
1026
|
+
"pn-product-card-info": PnProductCardInfo;
|
|
1027
|
+
"pn-product-card-price": PnProductCardPrice;
|
|
974
1028
|
"pn-product-pricelist": PnProductPricelist;
|
|
975
1029
|
"pn-product-pricelist-result": PnProductPricelistResult;
|
|
976
1030
|
"pn-product-tile": PnProductTile;
|
|
@@ -1010,6 +1064,9 @@ declare module "@stencil/core" {
|
|
|
1010
1064
|
"pn-marketweb-siteheader-login": LocalJSX.PnMarketwebSiteheaderLogin & JSXBase.HTMLAttributes<HTMLPnMarketwebSiteheaderLoginElement>;
|
|
1011
1065
|
"pn-marketweb-siteheader-search": LocalJSX.PnMarketwebSiteheaderSearch & JSXBase.HTMLAttributes<HTMLPnMarketwebSiteheaderSearchElement>;
|
|
1012
1066
|
"pn-pex-pricefinder": LocalJSX.PnPexPricefinder & JSXBase.HTMLAttributes<HTMLPnPexPricefinderElement>;
|
|
1067
|
+
"pn-product-card": LocalJSX.PnProductCard & JSXBase.HTMLAttributes<HTMLPnProductCardElement>;
|
|
1068
|
+
"pn-product-card-info": LocalJSX.PnProductCardInfo & JSXBase.HTMLAttributes<HTMLPnProductCardInfoElement>;
|
|
1069
|
+
"pn-product-card-price": LocalJSX.PnProductCardPrice & JSXBase.HTMLAttributes<HTMLPnProductCardPriceElement>;
|
|
1013
1070
|
"pn-product-pricelist": LocalJSX.PnProductPricelist & JSXBase.HTMLAttributes<HTMLPnProductPricelistElement>;
|
|
1014
1071
|
"pn-product-pricelist-result": LocalJSX.PnProductPricelistResult & JSXBase.HTMLAttributes<HTMLPnProductPricelistResultElement>;
|
|
1015
1072
|
"pn-product-tile": LocalJSX.PnProductTile & JSXBase.HTMLAttributes<HTMLPnProductTileElement>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
System.register(["./p-cec6130e.system.js"],(function(e){"use strict";var t;return{setters:[function(e){t=e.c}],execute:function(){var n=t({i18n:{componentheading:"",deliveryscopeheading:"",sizeheading:"",resultlistheading:"",weightlabel:"",maxweightlabel:"",maxmeasurementlabel:"",senddirectcta:"",stampshopcta:""},market:{currency:""}}),s=n.state,a=n.onChange;e("s",s)}}}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as i}from"./p-ec0adffe.js";import{c as a}from"./p-7dd91709.js";import{s as t}from"./p-c30207e6.js";import"./p-3359dac6.js";const n={sv:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Endast leveranser inom Sverige",sizeheading:"Hur mycket väger det?",resultlistheading:"Några utvalda val",weightlabel:"Vikt",maxweightlabel:"Maxvikt",maxmeasurementlabel:"Maxvolym",senddirectcta:"Köp frakt via Skicka Direkt",stampshopcta:"Köp frimärken via vår webshop"},en:{componentheading:"What do you want to send?",deliveryscopeheading:"Deliveries within Sweden only",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Weight",maxweightlabel:"Max weight",maxmeasurementlabel:"Maximum measurement",senddirectcta:"Buy shipping in Send Direct",stampshopcta:"Order home stamps from the webshop"},da:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Kun leveringer indenfor Sverige",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Vægt",maxweightlabel:"Max vægt",maxmeasurementlabel:"Maks. Volumen",senddirectcta:"Buy shipping in Send Direct",stampshopcta:"Order home stamps from the webshop"},no:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Kun leveranser innen Sverige",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Vekt",maxweightlabel:"Maks vekt",maxmeasurementlabel:"Maks volum",senddirectcta:"Buy shipping in Send Direct",stampshopcta:"Order home stamps from the webshop"},fi:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Toimitukset vain Ruotsin sisällä",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Paino",maxweightlabel:"Max paino",maxmeasurementlabel:"Max äänenvoimakkuus",senddirectcta:"Buy shipping in Send Direct",stampshopcta:"Order home stamps from the webshop"}},o={se:{currency:"kr"},dk:{currency:"dk"},fi:{currency:" €"},no:{currency:"kr"}},s=[{name:"Document",value:"document",illustration:"claims",unit:"gram"},{name:"Box Of Chocolate",value:"boxofchocolate",illustration:"outgoing",unit:"gram"},{name:"Rubber Boots",value:"rubberboots",illustration:"christmas",unit:"combo"},{name:"Moving Box",value:"movingbox",illustration:"outgoing",unit:"kgram"}],l={gram:[{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}],kgram:[{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}],combo:[{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},{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}]};let r=class{constructor(i){e(this,i),this.source="https://com-integration.postnord.com/globalassets/global/prices/sv-findprice.xlsx",this.language="sv",this.market="se",this.filteredItems=[],this.weight={value:0,name:""},this.weightvalue=0,this.sourceData={types:[],data:[]},this.sizecategory={value:"",name:"",icon:"",unit:""}}componentWillLoad(){this.setState(),this.getDataSource()}async getDataSource(){const e=`?cache=${Math.floor(9999*Math.random()+1)}`,i=await fetch(this.source+e),t=await i.blob();try{const e=await a(t);this.sourceData=e,this.filterItems()}catch(n){console.log("Unable to parse data")}}setState(){this.market&&(t.market=o[this.market]),this.language&&n[this.language]&&(t.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");const i=this.sourceData.data.filter((e=>"Sweden"===e.deliveryscope));if(!this.sizecategory)return;const a=i.filter((e=>e.sizecategory===this.sizecategory.value));if(!this.weight||!this.weight.value)return;const t=this.weight.value<=20?1e3*this.weight.value:this.weight.value;let n=a.filter((e=>(e.maxweight<=20?1e3*e.maxweight:e.maxweight)===t));if(0===n.length&&(n=a.filter((e=>(e.maxweight<=20?1e3*e.maxweight:e.maxweight)>=t)),n.length>0)){n.sort(((e,i)=>e.maxweight-i.maxweight));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:"findprice-form"},i("div",null,i("div",{class:"heading"},t.i18n.deliveryscopeheading)),i("div",null,i("div",{class:"heading"},t.i18n.componentheading),i("div",{class:"sizecategory"},s.map((e=>i("pn-choice-button",{choiceid:e.value,value:e.value,name:"sizecategory",type:"radio",checked:e.value===this.sizecategory.value,onChange:()=>{this.sizecategory=s.filter((i=>i.value===e.value))[0],0===this.weight.value&&(this.weight=l[this.sizecategory.unit][0],this.weightvalue=this.weight.value)}},i("pn-illustration",{illustration:e.illustration})," ",e.name))))),this.sizecategory.value&&l[this.sizecategory.unit]?i("div",null,t.i18n.sizeheading?i("div",{class:"heading"},t.i18n.sizeheading):null,i("div",{class:"weightoption"},i("div",{class:"weightoption-input"},i("pn-input",{inputid:"weightvalue",name:"weightvalue",type:"number",label:t.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=l[this.sizecategory.unit].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?l[this.sizecategory.unit].findIndex((e=>e.value===this.weightvalue)):0,onChange:e=>{this.weight=l[this.sizecategory.unit][e.target.value],this.weightvalue=this.weight.value},min:"0",max:l[this.sizecategory.unit].length-1}),i("datalist",{id:"weightlist"},l[this.sizecategory.unit].map(((e,a)=>{let t=e.name;return l[this.sizecategory.unit].length>6&&(t=a%5==0||0===a||a===l[this.sizecategory.unit].length-1?e.name:""),i("option",Object.assign({value:a},t?{label:t}:{}))})))))):null),this.filteredItems&&this.filteredItems.length>0?i("div",{class:"resultlist"},t.i18n.resultlistheading?i("div",{class:"heading"},t.i18n.resultlistheading):null,this.filteredItems.map((e=>i("div",null,i("pn-find-price-result",{item:e}))))):null)}static get watchers(){return{market:["setState"],language:["setState"],weightvalue:["filterItems"],sizecategory:["filterItems"]}}};r.style="pn-find-price .findprice-form{max-width:50em;margin:0 auto}pn-find-price h2,pn-find-price .heading{text-align:center;font-size:1.5em;line-height:1.1;font-weight:bold;margin-bottom:1rem}pn-find-price .sizecategory{text-align:center;margin-bottom:3rem}pn-find-price .weightoption{display:-ms-flexbox;display:flex;gap:1em}pn-find-price .weightoption-input{width:5em;position:relative}pn-find-price .weightoption-input input::-webkit-outer-spin-button,pn-find-price .weightoption-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}pn-find-price .weightoption-input-abbreviation{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:1.2em;margin-top:1.55rem;font-weight:500}pn-find-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-price .weightoption-range input{width:calc(100% - 1.5em)}pn-find-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-price .resultlist{margin:3em 0}";export{r as pn_find_price}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
System.register(["./p-5510f188.system.js","./p-233ca151.system.js","./p-cec6130e.system.js"],(function(t){"use strict";var e,i,s,n;return{setters:[function(t){e=t.r;i=t.h;s=t.a},function(t){n=t.s},function(){}],execute:function(){var r="pn-find-price-result .test{margin:3em 0}";var c=t("pn_find_price_result",function(){function t(t){e(this,t);this.item=null;this.shownitems=[];this.weightText=""}t.prototype.componentWillLoad=function(){this.composeItems()};t.prototype.composeItems=function(){this.shownitems=[];if(this.item.pricestamps){this.shownitems.push(Object.assign(Object.assign({},this.item),{priceagent:null,pricesenddirect:null}))}if(this.item.priceagent){this.shownitems.push(Object.assign(Object.assign({},this.item),{pricestamps:null,pricesenddirect:null}))}if(this.item.pricesenddirect){this.shownitems.push(Object.assign(Object.assign({},this.item),{pricestamps:null,priceagent:null}))}this.weightText=this.item.maxweight<=20?this.item.maxweight+"kg":this.item.maxweight>999?Math.round(this.item.maxweight/1e3)+" kg":this.item.maxweight+" g"};t.prototype.render=function(){var t=this;return i(s,null,this.shownitems.map((function(e){return i("pn-product-tile",null,i("pn-illustration",{slot:"illustration",illustration:e.illustration}),i("div",{slot:"content"},i("div",{class:"content"},i("h3",null,e.name),e.description?i("div",{class:"description"},e.description):null,e.info?i("div",{class:"description"},e.info):null)),e.note?i("small",{slot:"note"},i("p",null,e.note)):null,e.maxweight?i("pn-product-tile-info",{label:n.i18n.maxweightlabel,text:t.weightText}):null,e.maximummeasurements?i("pn-product-tile-info",{label:n.i18n.maxmeasurementlabel,text:e.maximummeasurements}):null,e.priceagent?i("pn-product-tile-price",{slot:"price",label:"",amount:e.priceagent+"",currency:n.market.currency,url:"https://shop.postnord.se/ebutik/default.aspx"}):null,e.pricestamps?i("pn-product-tile-price",{slot:"price",label:n.i18n.stampshopcta,amount:e.pricestamps+"",currency:n.market.currency}):null,e.pricesenddirect?i("pn-product-tile-price",{slot:"price",label:n.i18n.senddirectcta,amount:e.pricesenddirect+"",currency:n.market.currency,url:"https://portal.postnord.com/skickadirekt/"}):null)})))};Object.defineProperty(t,"watchers",{get:function(){return{item:["composeItems"]}},enumerable:false,configurable:true});return t}());c.style=r}}}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as l,a as s}from"./p-ec0adffe.js";import{s as e}from"./p-c30207e6.js";import"./p-3359dac6.js";let i=class{constructor(l){t(this,l),this.item=null,this.shownitems=[],this.weightText=""}componentWillLoad(){this.composeItems()}composeItems(){this.shownitems=[],this.item.pricestamps&&this.shownitems.push(Object.assign(Object.assign({},this.item),{priceagent:null,pricesenddirect:null})),this.item.priceagent&&this.shownitems.push(Object.assign(Object.assign({},this.item),{pricestamps:null,pricesenddirect:null})),this.item.pricesenddirect&&this.shownitems.push(Object.assign(Object.assign({},this.item),{pricestamps:null,priceagent:null})),this.weightText=this.item.maxweight<=20?this.item.maxweight+"kg":this.item.maxweight>999?Math.round(this.item.maxweight/1e3)+" kg":this.item.maxweight+" g"}render(){return l(s,null,this.shownitems.map((t=>l("pn-product-tile",null,l("pn-illustration",{slot:"illustration",illustration:t.illustration}),l("div",{slot:"content"},l("div",{class:"content"},l("h3",null,t.name),t.description?l("div",{class:"description"},t.description):null,t.info?l("div",{class:"description"},t.info):null)),t.note?l("small",{slot:"note"},l("p",null,t.note)):null,t.maxweight?l("pn-product-tile-info",{label:e.i18n.maxweightlabel,text:this.weightText}):null,t.maximummeasurements?l("pn-product-tile-info",{label:e.i18n.maxmeasurementlabel,text:t.maximummeasurements}):null,t.priceagent?l("pn-product-tile-price",{slot:"price",label:"",amount:t.priceagent+"",currency:e.market.currency,url:"https://shop.postnord.se/ebutik/default.aspx"}):null,t.pricestamps?l("pn-product-tile-price",{slot:"price",label:e.i18n.stampshopcta,amount:t.pricestamps+"",currency:e.market.currency}):null,t.pricesenddirect?l("pn-product-tile-price",{slot:"price",label:e.i18n.senddirectcta,amount:t.pricesenddirect+"",currency:e.market.currency,url:"https://portal.postnord.com/skickadirekt/"}):null))))}static get watchers(){return{item:["composeItems"]}}};i.style="pn-find-price-result .test{margin:3em 0}";export{i as pn_find_price_result}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,i,t,a){function n(e){return e instanceof t?e:new t((function(i){i(e)}))}return new(t||(t=Promise))((function(t,r){function o(e){try{s(a.next(e))}catch(i){r(i)}}function l(e){try{s(a["throw"](e))}catch(i){r(i)}}function s(e){e.done?t(e.value):n(e.value).then(o,l)}s((a=a.apply(e,i||[])).next())}))};var __generator=this&&this.__generator||function(e,i){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},a,n,r,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(e){return function(i){return s([e,i])}}function s(o){if(a)throw new TypeError("Generator is already executing.");while(t)try{if(a=1,n&&(r=o[0]&2?n["return"]:o[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;if(n=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:t.label++;return{value:o[1],done:false};case 5:t.label++;n=o[1];o=[0];continue;case 7:o=t.ops.pop();t.trys.pop();continue;default:if(!(r=t.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){t=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){t.label=o[1];break}if(o[0]===6&&t.label<r[1]){t.label=r[1];r=o;break}if(r&&t.label<r[2]){t.label=r[2];t.ops.push(o);break}if(r[2])t.ops.pop();t.trys.pop();continue}o=i.call(e,t)}catch(l){o=[6,l];n=0}finally{a=r=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,i){for(var t=0,a=i.length,n=e.length;t<a;t++,n++)e[n]=i[t];return e};System.register(["./p-5510f188.system.js","./p-5ce5be4f.system.js","./p-233ca151.system.js","./p-cec6130e.system.js"],(function(e){"use strict";var i,t,a,n;return{setters:[function(e){i=e.r;t=e.h},function(e){a=e.c},function(e){n=e.s},function(){}],execute:function(){var r={sv:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Endast leveranser inom Sverige",sizeheading:"Hur mycket väger det?",resultlistheading:"Några utvalda val",weightlabel:"Vikt",maxweightlabel:"Maxvikt",maxmeasurementlabel:"Maxvolym",senddirectcta:"Köp frakt via Skicka Direkt",stampshopcta:"Köp frimärken via vår webshop"},en:{componentheading:"What do you want to send?",deliveryscopeheading:"Deliveries within Sweden only",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Weight",maxweightlabel:"Max weight",maxmeasurementlabel:"Maximum measurement",senddirectcta:"Buy shipping in Send Direct",stampshopcta:"Order home stamps from the webshop"},da:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Kun leveringer indenfor Sverige",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Vægt",maxweightlabel:"Max vægt",maxmeasurementlabel:"Maks. Volumen",senddirectcta:"Buy shipping in Send Direct",stampshopcta:"Order home stamps from the webshop"},no:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Kun leveranser innen Sverige",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Vekt",maxweightlabel:"Maks vekt",maxmeasurementlabel:"Maks volum",senddirectcta:"Buy shipping in Send Direct",stampshopcta:"Order home stamps from the webshop"},fi:{componentheading:"Vad vill du skicka?",deliveryscopeheading:"Toimitukset vain Ruotsin sisällä",sizeheading:"How much does it weigh?",resultlistheading:"Some suitable options for you",weightlabel:"Paino",maxweightlabel:"Max paino",maxmeasurementlabel:"Max äänenvoimakkuus",senddirectcta:"Buy shipping in Send Direct",stampshopcta:"Order home stamps from the webshop"}};var o={se:{currency:"kr"},dk:{currency:"dk"},fi:{currency:" €"},no:{currency:"kr"}};var l=[{name:"Document",value:"document",illustration:"claims",unit:"gram"},{name:"Box Of Chocolate",value:"boxofchocolate",illustration:"outgoing",unit:"gram"},{name:"Rubber Boots",value:"rubberboots",illustration:"christmas",unit:"combo"},{name:"Moving Box",value:"movingbox",illustration:"outgoing",unit:"kgram"}];var s={gram:[{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}],kgram:[{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}],combo:[{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},{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 u="pn-find-price .findprice-form{max-width:50em;margin:0 auto}pn-find-price h2,pn-find-price .heading{text-align:center;font-size:1.5em;line-height:1.1;font-weight:bold;margin-bottom:1rem}pn-find-price .sizecategory{text-align:center;margin-bottom:3rem}pn-find-price .weightoption{display:-ms-flexbox;display:flex;gap:1em}pn-find-price .weightoption-input{width:5em;position:relative}pn-find-price .weightoption-input input::-webkit-outer-spin-button,pn-find-price .weightoption-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}pn-find-price .weightoption-input-abbreviation{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:1.2em;margin-top:1.55rem;font-weight:500}pn-find-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-price .weightoption-range input{width:calc(100% - 1.5em)}pn-find-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-price .resultlist{margin:3em 0}";var g=e("pn_find_price",function(){function e(e){i(this,e);this.source="https://com-integration.postnord.com/globalassets/global/prices/sv-findprice.xlsx";this.language="sv";this.market="se";this.filteredItems=[];this.weight={value:0,name:""};this.weightvalue=0;this.sourceData={types:[],data:[]};this.sizecategory={value:"",name:"",icon:"",unit:""}}e.prototype.componentWillLoad=function(){this.setState();this.getDataSource()};e.prototype.getDataSource=function(){return __awaiter(this,void 0,void 0,(function(){var e,i,t,n,r;return __generator(this,(function(o){switch(o.label){case 0:e="?cache="+Math.floor(Math.random()*(1e4-1)+1);return[4,fetch(this.source+e)];case 1:i=o.sent();return[4,i.blob()];case 2:t=o.sent();o.label=3;case 3:o.trys.push([3,5,,6]);return[4,a(t)];case 4:n=o.sent();this.sourceData=n;this.filterItems();return[3,6];case 5:r=o.sent();console.log("Unable to parse data");return[3,6];case 6:return[2]}}))}))};e.prototype.setState=function(){if(this.market){n.market=o[this.market]}if(this.language&&r[this.language]){n.i18n=r[this.language]}};e.prototype.filterItems=function(){var e=this;var i;if(!((i=this.sourceData)===null||i===void 0?void 0:i.data)){console.log("Data has not yet been loaded");return}var t=this.sourceData.data.filter((function(e){return e.deliveryscope==="Sweden"}));if(!this.sizecategory){return}var a=t.filter((function(i){return i.sizecategory===e.sizecategory.value}));if(!this.weight||!this.weight.value){return}var n=this.weight.value<=20?this.weight.value*1e3:this.weight.value;var r=a.filter((function(e){return(e.maxweight<=20?e.maxweight*1e3:e.maxweight)===n}));if(r.length===0){r=a.filter((function(e){return(e.maxweight<=20?e.maxweight*1e3:e.maxweight)>=n}));if(r.length>0){r.sort((function(e,i){return e.maxweight-i.maxweight}));var o=__spreadArray([],new Map(r.reverse().map((function(e){return[e["id"],e]}))).values());if(o.length>0){r=o}}}this.filteredItems=r};e.prototype.render=function(){var e=this;return t("div",null,t("div",{class:"findprice-form"},t("div",null,t("div",{class:"heading"},n.i18n.deliveryscopeheading)),t("div",null,t("div",{class:"heading"},n.i18n.componentheading),t("div",{class:"sizecategory"},l.map((function(i){return t("pn-choice-button",{choiceid:i.value,value:i.value,name:"sizecategory",type:"radio",checked:i.value===e.sizecategory.value,onChange:function(){e.sizecategory=l.filter((function(e){return e.value===i.value}))[0];if(e.weight.value===0){e.weight=s[e.sizecategory.unit][0];e.weightvalue=e.weight.value}}},t("pn-illustration",{illustration:i.illustration})," ",i.name)})))),this.sizecategory.value&&s[this.sizecategory.unit]?t("div",null,n.i18n.sizeheading?t("div",{class:"heading"},n.i18n.sizeheading):null,t("div",{class:"weightoption"},t("div",{class:"weightoption-input"},t("pn-input",{inputid:"weightvalue",name:"weightvalue",type:"number",label:n.i18n.weightlabel,value:this.weightvalue,onChange:function(i){if(i&&i.target&&i.target.value){var t=parseInt(i.target.value,10);if(!isNaN(t)){var a=s[e.sizecategory.unit].filter((function(e){var i=e.abbreviation==="kg"?e.value*1e3:e.value;return i>=t}));if(a&&a.length>0){e.weight=a[0];e.weightvalue=e.weight.value}}}}}),t("span",{class:"weightoption-input-abbreviation"},this.weight.abbreviation)),t("div",{class:"weightoption-range"},t("input",{type:"range",id:"weightrange",name:"weightrange",list:"weightlist",value:!this.weight.value?0:s[this.sizecategory.unit].findIndex((function(i){return i.value===e.weightvalue})),onChange:function(i){var t=i.target.value;e.weight=s[e.sizecategory.unit][t];e.weightvalue=e.weight.value},min:"0",max:s[this.sizecategory.unit].length-1}),t("datalist",{id:"weightlist"},s[this.sizecategory.unit].map((function(i,a){var n=i.name;if(s[e.sizecategory.unit].length>6){n=a%5===0||a===0||a===s[e.sizecategory.unit].length-1?i.name:""}return t("option",Object.assign({value:a},n?{label:n}:{}))})))))):null),this.filteredItems&&this.filteredItems.length>0?t("div",{class:"resultlist"},n.i18n.resultlistheading?t("div",{class:"heading"},n.i18n.resultlistheading):null,this.filteredItems.map((function(e){return t("div",null,t("pn-find-price-result",{item:e}))}))):null)};Object.defineProperty(e,"watchers",{get:function(){return{market:["setState"],language:["setState"],weightvalue:["filterItems"],sizecategory:["filterItems"]}},enumerable:false,configurable:true});return e}());g.style=u}}}));
|