@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.
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-choice-button_2.cjs.entry.js +2 -2
- package/cjs/{pn-find-service-and-price-store-7ced0e29.js → pn-find-service-and-price-store-56d8b760.js} +3 -1
- package/cjs/pn-find-service-and-price.cjs.entry.js +37 -20
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-product-pricelist-result.cjs.entry.js +13 -2
- package/cjs/{pn-product-pricelist-store-ffd73312.js → pn-product-pricelist-store-e4f8503b.js} +5 -1
- package/cjs/pn-product-pricelist.cjs.entry.js +114 -5
- package/cjs/pn-product-tile_3.cjs.entry.js +4 -4
- package/collection/components/widgets/pn-find-service-and-price/find-service-and-price.stories.js +1 -1
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.js +4 -4
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-store.js +3 -1
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-translations.js +10 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.css +5 -1
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.js +25 -18
- package/collection/components/widgets/pn-product-pricelist/data.js +17 -15
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-result.js +22 -7
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-store.js +5 -1
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-translations.js +20 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.css +50 -1
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.js +76 -2
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.stories.js +1 -1
- package/collection/components/widgets/pn-product-tile/pn-product-tile-price.css +5 -3
- package/collection/components/widgets/pn-product-tile/pn-product-tile-price.js +6 -11
- package/collection/components/widgets/pn-product-tile/pn-product-tile.css +4 -4
- package/collection/components/widgets/pn-product-tile/pn-product-tile.js +3 -3
- package/custom-elements/index.js +184 -41
- package/esm/loader.js +1 -1
- package/esm/pn-choice-button_2.entry.js +2 -2
- package/esm/{pn-find-service-and-price-store-0c7083bd.js → pn-find-service-and-price-store-d02cbfe1.js} +3 -1
- package/esm/pn-find-service-and-price.entry.js +37 -20
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-product-pricelist-result.entry.js +13 -2
- package/esm/{pn-product-pricelist-store-82211c4a.js → pn-product-pricelist-store-6259b354.js} +5 -1
- package/esm/pn-product-pricelist.entry.js +114 -5
- package/esm/pn-product-tile_3.entry.js +4 -4
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-choice-button_2.entry.js +1 -1
- package/esm-es5/{pn-find-service-and-price-store-0c7083bd.js → pn-find-service-and-price-store-d02cbfe1.js} +1 -1
- package/esm-es5/pn-find-service-and-price.entry.js +1 -1
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-product-pricelist-result.entry.js +1 -1
- package/esm-es5/pn-product-pricelist-store-6259b354.js +1 -0
- package/esm-es5/pn-product-pricelist.entry.js +1 -1
- package/esm-es5/pn-product-tile_3.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/p-3ae134bf.system.entry.js +1 -0
- package/pn-market-web-components/{p-d0e7e65c.system.js → p-43bb8707.system.js} +1 -1
- package/pn-market-web-components/p-4b4ee8d5.system.entry.js +1 -0
- package/pn-market-web-components/p-57a1db89.system.entry.js +1 -0
- package/pn-market-web-components/p-62700d6e.system.js +1 -1
- package/pn-market-web-components/{p-f37be6ee.system.entry.js → p-80fd4dd9.system.entry.js} +1 -1
- package/pn-market-web-components/p-926fc962.js +1 -0
- package/pn-market-web-components/p-a04d0ba4.entry.js +1 -0
- package/pn-market-web-components/{p-64a6c2fb.js → p-af861bb5.js} +1 -1
- package/pn-market-web-components/p-b129cc27.system.js +1 -0
- package/pn-market-web-components/p-b4904bdb.system.entry.js +1 -0
- package/pn-market-web-components/p-ba704cbf.entry.js +1 -0
- package/pn-market-web-components/p-ba8e9dfe.entry.js +1 -0
- package/pn-market-web-components/{p-dc5ff15f.entry.js → p-d3590589.entry.js} +1 -1
- package/pn-market-web-components/p-e377410f.entry.js +1 -0
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-store.d.ts +4 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-translations.d.ts +10 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-types.d.ts +2 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-result.d.ts +2 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-store.d.ts +8 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-translations.d.ts +20 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-types.d.ts +9 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist.d.ts +4 -0
- package/esm-es5/pn-product-pricelist-store-82211c4a.js +0 -1
- package/pn-market-web-components/p-1905c548.entry.js +0 -1
- package/pn-market-web-components/p-1fe6de09.entry.js +0 -1
- package/pn-market-web-components/p-23743bec.system.entry.js +0 -1
- package/pn-market-web-components/p-23d34c82.system.entry.js +0 -1
- package/pn-market-web-components/p-2fa246f1.system.js +0 -1
- package/pn-market-web-components/p-44f74289.system.entry.js +0 -1
- package/pn-market-web-components/p-4f283190.js +0 -1
- package/pn-market-web-components/p-c06b37c7.entry.js +0 -1
- package/pn-market-web-components/p-c9af6ced.entry.js +0 -1
- package/pn-market-web-components/p-ea9afb95.system.entry.js +0 -1
package/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[1],"language":[1],"endpoint":[1],"hideSiteSelector":[1028,"hide-site-selector"],"hideLanguageSelector":[1028,"hide-language-selector"],"hideSearch":[1028,"hide-search"],"hideLogin":[1028,"hide-login"],"i18n":[32],"gotData":[32],"fetchingData":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"loginDialog":[32],"minimizeSearch":[32]},[[9,"resize","handleResize"]]]]],["pn-find-service-and-price.cjs",[[0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]]],["pn-product-pricelist.cjs",[[4,"pn-product-pricelist",{"source":[1],"language":[1025],"market":[1025],"productid":[1],"filteredItems":[32],"sourceData":[32],"gotData":[32],"loading":[32]}]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-marketweb-sitefooter.cjs",[[0,"pn-marketweb-sitefooter",{"market":[1],"language":[1],"endpoint":[1],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]]],["pn-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[
|
|
17
|
+
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[1],"language":[1],"endpoint":[1],"hideSiteSelector":[1028,"hide-site-selector"],"hideLanguageSelector":[1028,"hide-language-selector"],"hideSearch":[1028,"hide-search"],"hideLogin":[1028,"hide-login"],"i18n":[32],"gotData":[32],"fetchingData":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"loginDialog":[32],"minimizeSearch":[32]},[[9,"resize","handleResize"]]]]],["pn-find-service-and-price.cjs",[[0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]]],["pn-product-pricelist.cjs",[[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]}]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-marketweb-sitefooter.cjs",[[0,"pn-marketweb-sitefooter",{"market":[1],"language":[1],"endpoint":[1],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]]],["pn-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-choice-button_2.cjs",[[0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}],[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9.cjs",[[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"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopen","setOpenMenu"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}],[0,"pn-marketweb-siteheader-login",{"endpoint":[1],"i18n":[8,"i-1-8n"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32]}],[0,"pn-marketweb-siteheader-search",{"i18n":[8,"i-1-8n"],"showOnlyLink":[1028,"show-only-link"],"hideSearch":[1028,"hide-search"],"search":[1040]}],[4,"pn-site-selector",{"buttontext":[1],"heading":[1],"language":[1],"i18n":[32]}],[0,"pn-site-selector-item",{"url":[1],"heading":[1],"description":[1],"newwindow":[4]}]]],["pn-product-tile_3.cjs",[[4,"pn-product-tile"],[0,"pn-product-tile-info",{"label":[1],"text":[1],"icon":[1]}],[0,"pn-product-tile-price",{"label":[1],"amount":[1],"currency":[1],"url":[1]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b58d2618.js');
|
|
6
|
-
const pnFindServiceAndPriceStore = require('./pn-find-service-and-price-store-
|
|
6
|
+
const pnFindServiceAndPriceStore = require('./pn-find-service-and-price-store-56d8b760.js');
|
|
7
7
|
require('./index-f472d191.js');
|
|
8
8
|
|
|
9
9
|
const pnChoiceButtonCss = "pn-choice-button{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;display:inline-block;background:#fff;position:relative;margin:0.2em 0.4em}pn-choice-button input{opacity:0;position:absolute;top:0;left:0;pointer-events:none;margin:0;width:100%;height:100%}pn-choice-button label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0.4rem 0.8rem;border:0.1rem solid #D3CECB;color:#005D92;font-weight:500;border-radius:0.8rem;text-align:center;cursor:pointer;-webkit-transition:background 0.2s, -webkit-box-shadow 0.1s;transition:background 0.2s, -webkit-box-shadow 0.1s;transition:box-shadow 0.1s, background 0.2s;transition:box-shadow 0.1s, background 0.2s, -webkit-box-shadow 0.1s}pn-choice-button label pn-illustration{display:inline-block;width:3rem;height:3rem;margin-right:0.9rem}pn-choice-button>input:checked+label.pn-choice-button{background:#E0F8FF;color:#005D92;border-color:#005D92;-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)}pn-choice-button>input:indeterminate+label.pn-choice-button{background:#FFFFFF;color:#005D92}pn-choice-button>input:hover+label.pn-choice-button{background:#E0F8FF}pn-choice-button>input:focus+label.pn-choice-button,pn-choice-button>input:active+label.pn-choice-button{-webkit-box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #005D92;box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #005D92}pn-choice-button>input:active+label.pn-choice-button{background:#8EDDF9}pn-choice-button>input:disabled+label.pn-choice-button{background-color:#D3CECB}pn-choice-button>input:checked+label.pn-choice-button:hover{background:#8EDDF9}pn-choice-button>input:checked+label.pn-choice-button:active{background:#8EDDF9;border:0.1rem solid #00A0D6}";
|
|
@@ -66,7 +66,7 @@ const PnfindServiceAndPriceResult = class {
|
|
|
66
66
|
(this.item.what === "letter" && this.item.maxweight > 999) ? Math.round(this.item.maxweight / 1000) + " kg" : this.item.maxweight + " g";
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
|
-
return (index.h(index.Host, null, this.shownitems.map((item) => (index.h("pn-product-tile", null, index.h("pn-illustration", { slot: "illustration", illustration: item.illustration }), index.h("div", { slot: "content" }, index.h("div", { class: "content" }, index.h("h3", null, item.name), (item.description) ? (index.h("div", { class: "description" }, item.description)) : null, (item.info) ? (index.h("div", { class: "description" }, item.info)) : null)), item.maxweight ? (index.h("pn-product-tile-info", { label: pnFindServiceAndPriceStore.state.i18n.maxweightlabel, text: this.weightText })) : null, item.maximummeasurements ? (index.h("pn-product-tile-info", { label: pnFindServiceAndPriceStore.state.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null, item.pricestamps ? (index.h("pn-product-tile-price", { slot: "price", label:
|
|
69
|
+
return (index.h(index.Host, null, this.shownitems.map((item) => (index.h("pn-product-tile", null, index.h("pn-illustration", { slot: "illustration", illustration: item.illustration }), index.h("div", { slot: "content" }, index.h("div", { class: "content" }, index.h("h3", null, item.name), (item.description) ? (index.h("div", { class: "description" }, item.description)) : null, (item.info) ? (index.h("div", { class: "description" }, item.info)) : null)), item.maxweight ? (index.h("pn-product-tile-info", { label: pnFindServiceAndPriceStore.state.i18n.maxweightlabel, text: this.weightText })) : null, item.maximummeasurements ? (index.h("pn-product-tile-info", { label: pnFindServiceAndPriceStore.state.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null, item.pricestamps ? (index.h("pn-product-tile-price", { slot: "price", label: pnFindServiceAndPriceStore.state.i18n.stampshopcta, amount: item.pricestamps + '', currency: pnFindServiceAndPriceStore.state.market.currency })) : null, item.priceagent ? (index.h("pn-product-tile-price", { slot: "price", label: "", amount: item.priceagent + '', currency: pnFindServiceAndPriceStore.state.market.currency, url: "https://shop.postnord.se/ebutik/default.aspx" })) : null, item.pricesenddirect ? (index.h("pn-product-tile-price", { slot: "price", label: pnFindServiceAndPriceStore.state.i18n.senddirectcta, amount: item.pricesenddirect + '', currency: pnFindServiceAndPriceStore.state.market.currency, url: "https://portal.postnord.com/skickadirekt/" })) : null, item.note ? (index.h("small", { slot: "note" }, index.h("p", null, item.note))) : null)))));
|
|
70
70
|
}
|
|
71
71
|
static get watchers() { return {
|
|
72
72
|
"item": ["composeItems"]
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b58d2618.js');
|
|
6
6
|
const convert = require('./convert-57b3dd5e.js');
|
|
7
|
-
const pnFindServiceAndPriceStore = require('./pn-find-service-and-price-store-
|
|
7
|
+
const pnFindServiceAndPriceStore = require('./pn-find-service-and-price-store-56d8b760.js');
|
|
8
8
|
require('./index-f472d191.js');
|
|
9
9
|
|
|
10
10
|
const translations = {
|
|
@@ -16,6 +16,8 @@ const translations = {
|
|
|
16
16
|
'weightlabel': 'Vikt',
|
|
17
17
|
'maxweightlabel': 'Maxvikt',
|
|
18
18
|
'maxmeasurementlabel': 'Maxvolym',
|
|
19
|
+
'senddirectcta': 'Köp frakt via Skicka Direkt',
|
|
20
|
+
'stampshopcta': 'Köp frimärken via vår webshop',
|
|
19
21
|
},
|
|
20
22
|
'en': {
|
|
21
23
|
'componentheading': 'What do you want to send?',
|
|
@@ -25,6 +27,8 @@ const translations = {
|
|
|
25
27
|
'weightlabel': 'Weight',
|
|
26
28
|
'maxweightlabel': 'Max weight',
|
|
27
29
|
'maxmeasurementlabel': 'Maximum measurement',
|
|
30
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
31
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
28
32
|
},
|
|
29
33
|
'da': {
|
|
30
34
|
'componentheading': 'Vad vill du skicka?',
|
|
@@ -34,6 +38,8 @@ const translations = {
|
|
|
34
38
|
'weightlabel': 'Vægt',
|
|
35
39
|
'maxweightlabel': 'Max vægt',
|
|
36
40
|
'maxmeasurementlabel': 'Maks. Volumen',
|
|
41
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
42
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
37
43
|
},
|
|
38
44
|
'no': {
|
|
39
45
|
'componentheading': 'Vad vill du skicka?',
|
|
@@ -43,6 +49,8 @@ const translations = {
|
|
|
43
49
|
'weightlabel': 'Vekt',
|
|
44
50
|
'maxweightlabel': 'Maks vekt',
|
|
45
51
|
'maxmeasurementlabel': 'Maks volum',
|
|
52
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
53
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
46
54
|
},
|
|
47
55
|
'fi': {
|
|
48
56
|
'componentheading': 'Vad vill du skicka?',
|
|
@@ -52,6 +60,8 @@ const translations = {
|
|
|
52
60
|
'weightlabel': 'Paino',
|
|
53
61
|
'maxweightlabel': 'Max paino',
|
|
54
62
|
'maxmeasurementlabel': 'Max äänenvoimakkuus',
|
|
63
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
64
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
67
|
const markets = {
|
|
@@ -119,7 +129,7 @@ const weights = {
|
|
|
119
129
|
]
|
|
120
130
|
};
|
|
121
131
|
|
|
122
|
-
const pnFindServiceAndPriceCss = "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:
|
|
132
|
+
const pnFindServiceAndPriceCss = "pn-find-service-and-price .findprice-form{max-width:50em;margin:0 auto}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:1.55rem;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}";
|
|
123
133
|
|
|
124
134
|
const PnfindServiceAndPrice = class {
|
|
125
135
|
constructor(hostRef) {
|
|
@@ -137,20 +147,21 @@ const PnfindServiceAndPrice = class {
|
|
|
137
147
|
componentWillLoad() {
|
|
138
148
|
this.setState();
|
|
139
149
|
this.getDataSource();
|
|
140
|
-
window.setTimeout(() => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}, 500)
|
|
146
|
-
// this.filterItems();
|
|
150
|
+
// window.setTimeout(() => {
|
|
151
|
+
// this.postagetype = postagetypes[0];
|
|
152
|
+
// this.deliveryscope = deliveryscopes[this.postagetype.value][0];
|
|
153
|
+
// this.weight = weights[this.postagetype.value][0];
|
|
154
|
+
// this.weightvalue = this.weight.value;
|
|
155
|
+
// }, 500)
|
|
147
156
|
}
|
|
148
157
|
async getDataSource() {
|
|
149
|
-
const
|
|
158
|
+
const cacheBusting = `?cache=${Math.floor(Math.random() * (10000 - 1) + 1)}`;
|
|
159
|
+
const req = await fetch(this.source + cacheBusting);
|
|
150
160
|
const reqbody = await req.blob();
|
|
151
161
|
try {
|
|
152
162
|
const convertedData = await convert.convertFileFromStream(reqbody);
|
|
153
163
|
this.sourceData = convertedData;
|
|
164
|
+
this.filterItems();
|
|
154
165
|
}
|
|
155
166
|
catch (e) {
|
|
156
167
|
console.log('Unable to parse data');
|
|
@@ -184,27 +195,33 @@ const PnfindServiceAndPrice = class {
|
|
|
184
195
|
}
|
|
185
196
|
// For letters we use grams. Otherwise we use KG
|
|
186
197
|
const comparisonWeight = (this.weight.abbreviation.toLocaleLowerCase() === "kg" && this.postagetype.value === 'letter') ? this.weight.value * 1000 : this.weight.value;
|
|
187
|
-
let
|
|
198
|
+
let weightFilteredData = deliveryScopeData.filter(x => x.maxweight === comparisonWeight);
|
|
188
199
|
// In parcels the maxwidths don't necessarily start at 1kg so we fetch any type below the user selected value
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
if (
|
|
200
|
+
if (weightFilteredData.length === 0) {
|
|
201
|
+
weightFilteredData = deliveryScopeData.filter(x => x.maxweight >= comparisonWeight);
|
|
202
|
+
if (weightFilteredData.length > 0) {
|
|
192
203
|
// We reverse the result array since the map will take the last unique item instead of the first
|
|
193
|
-
const uniqueWeightOptions = [...new Map(
|
|
204
|
+
const uniqueWeightOptions = [...new Map(weightFilteredData.reverse().map(item => [item["id"], item])).values()];
|
|
194
205
|
if (uniqueWeightOptions.length > 0) {
|
|
195
|
-
|
|
206
|
+
weightFilteredData = uniqueWeightOptions;
|
|
196
207
|
}
|
|
197
208
|
}
|
|
198
209
|
}
|
|
199
|
-
|
|
210
|
+
console.log('weightFilteredData', weightFilteredData);
|
|
211
|
+
this.filteredItems = weightFilteredData;
|
|
200
212
|
}
|
|
201
213
|
render() {
|
|
202
|
-
return (index.h("div", null, index.h("div", { class: "form" }, (pnFindServiceAndPriceStore.state.i18n.componentheading) ? (index.h("h2", null, pnFindServiceAndPriceStore.state.i18n.componentheading)) : null, index.h("div", { class: "postagetypes" }, postagetypes.map((postagetype) => (index.h("pn-choice-button", { choiceid: postagetype.value, value: postagetype.value, name: "postagetype", type: "radio", checked: postagetype.value === this.postagetype.value, onChange: () => {
|
|
214
|
+
return (index.h("div", null, index.h("div", { class: "findprice-form" }, (pnFindServiceAndPriceStore.state.i18n.componentheading) ? (index.h("h2", null, pnFindServiceAndPriceStore.state.i18n.componentheading)) : null, index.h("div", { class: "postagetypes" }, postagetypes.map((postagetype) => (index.h("pn-choice-button", { choiceid: postagetype.value, value: postagetype.value, name: "postagetype", type: "radio", checked: postagetype.value === this.postagetype.value, onChange: () => {
|
|
203
215
|
this.postagetype = postagetypes.filter(x => x.value === postagetype.value)[0];
|
|
204
|
-
this.
|
|
216
|
+
this.deliveryscope = { value: "", name: "", icon: "" };
|
|
217
|
+
this.weight = { value: 0, name: "" };
|
|
205
218
|
this.weightvalue = this.weight.value;
|
|
206
219
|
} }, index.h("pn-illustration", { illustration: postagetype.illustration }), " ", postagetype.name)))), this.postagetype.value && deliveryscopes[this.postagetype.value] ? (index.h("div", null, (pnFindServiceAndPriceStore.state.i18n.deliveryscopeheading) ? (index.h("div", { class: "heading" }, pnFindServiceAndPriceStore.state.i18n.deliveryscopeheading)) : null, index.h("div", { class: "deliveryscope" }, deliveryscopes[this.postagetype.value].map((deliveryscope) => (index.h("pn-choice-button", { choiceid: this.postagetype.value + deliveryscope.value, value: deliveryscope.value, name: "deliveryscope", type: "radio", checked: deliveryscope.value === this.deliveryscope.value, onChange: () => {
|
|
207
220
|
this.deliveryscope = deliveryscopes[this.postagetype.value].filter(x => x.value === deliveryscope.value)[0];
|
|
221
|
+
if (this.weight.value === 0) {
|
|
222
|
+
this.weight = weights[this.postagetype.value][0];
|
|
223
|
+
this.weightvalue = this.weight.value;
|
|
224
|
+
}
|
|
208
225
|
} }, index.h("pn-illustration", { illustration: deliveryscope.illustration }), " ", deliveryscope.name)))))) : null, (this.postagetype.value && weights[this.postagetype.value] && this.deliveryscope.value) ? (index.h("div", null, (pnFindServiceAndPriceStore.state.i18n.sizeheading) ? (index.h("div", { class: "heading" }, pnFindServiceAndPriceStore.state.i18n.sizeheading)) : null, index.h("div", { class: "weightoption" }, index.h("div", { class: "weightoption-input" }, index.h("pn-input", { inputid: "weightvalue", name: "weightvalue", type: "number", label: pnFindServiceAndPriceStore.state.i18n.weightlabel, value: this.weightvalue, onChange: (e) => {
|
|
209
226
|
if (e && e.target && e.target.value) {
|
|
210
227
|
const weightNum = parseInt(e.target.value, 10);
|
|
@@ -231,7 +248,7 @@ const PnfindServiceAndPrice = class {
|
|
|
231
248
|
labelText = (weightindex % 5 === 0 || weightindex === 0 || weightindex === weights[this.postagetype.value].length - 1) ? weight.name : '';
|
|
232
249
|
}
|
|
233
250
|
return (index.h("option", Object.assign({ value: weightindex }, (labelText ? { label: labelText } : {}))));
|
|
234
|
-
})))))) : null), (this.filteredItems) ? (index.h("div", { class: "resultlist" }, (pnFindServiceAndPriceStore.state.i18n.resultlistheading) ? (index.h("div", { class: "heading" }, pnFindServiceAndPriceStore.state.i18n.resultlistheading)) : null, this.filteredItems.map((item) => (index.h("div", null, index.h("pn-find-service-and-price-result", { item: item })))))) : null));
|
|
251
|
+
})))))) : null), (this.filteredItems && this.filteredItems.length > 0) ? (index.h("div", { class: "resultlist" }, (pnFindServiceAndPriceStore.state.i18n.resultlistheading) ? (index.h("div", { class: "heading" }, pnFindServiceAndPriceStore.state.i18n.resultlistheading)) : null, this.filteredItems.map((item) => (index.h("div", null, index.h("pn-find-service-and-price-result", { item: item })))))) : null));
|
|
235
252
|
}
|
|
236
253
|
static get watchers() { return {
|
|
237
254
|
"market": ["setState"],
|
|
@@ -55,5 +55,5 @@ const patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
patchBrowser().then(options => {
|
|
58
|
-
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[1],"language":[1],"endpoint":[1],"hideSiteSelector":[1028,"hide-site-selector"],"hideLanguageSelector":[1028,"hide-language-selector"],"hideSearch":[1028,"hide-search"],"hideLogin":[1028,"hide-login"],"i18n":[32],"gotData":[32],"fetchingData":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"loginDialog":[32],"minimizeSearch":[32]},[[9,"resize","handleResize"]]]]],["pn-find-service-and-price.cjs",[[0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]]],["pn-product-pricelist.cjs",[[4,"pn-product-pricelist",{"source":[1],"language":[1025],"market":[1025],"productid":[1],"filteredItems":[32],"sourceData":[32],"gotData":[32],"loading":[32]}]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-marketweb-sitefooter.cjs",[[0,"pn-marketweb-sitefooter",{"market":[1],"language":[1],"endpoint":[1],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]]],["pn-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[
|
|
58
|
+
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[1],"language":[1],"endpoint":[1],"hideSiteSelector":[1028,"hide-site-selector"],"hideLanguageSelector":[1028,"hide-language-selector"],"hideSearch":[1028,"hide-search"],"hideLogin":[1028,"hide-login"],"i18n":[32],"gotData":[32],"fetchingData":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"loginDialog":[32],"minimizeSearch":[32]},[[9,"resize","handleResize"]]]]],["pn-find-service-and-price.cjs",[[0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]]],["pn-product-pricelist.cjs",[[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]}]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-marketweb-sitefooter.cjs",[[0,"pn-marketweb-sitefooter",{"market":[1],"language":[1],"endpoint":[1],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]]],["pn-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-choice-button_2.cjs",[[0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}],[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9.cjs",[[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"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopen","setOpenMenu"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}],[0,"pn-marketweb-siteheader-login",{"endpoint":[1],"i18n":[8,"i-1-8n"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32]}],[0,"pn-marketweb-siteheader-search",{"i18n":[8,"i-1-8n"],"showOnlyLink":[1028,"show-only-link"],"hideSearch":[1028,"hide-search"],"search":[1040]}],[4,"pn-site-selector",{"buttontext":[1],"heading":[1],"language":[1],"i18n":[32]}],[0,"pn-site-selector-item",{"url":[1],"heading":[1],"description":[1],"newwindow":[4]}]]],["pn-product-tile_3.cjs",[[4,"pn-product-tile"],[0,"pn-product-tile-info",{"label":[1],"text":[1],"icon":[1]}],[0,"pn-product-tile-price",{"label":[1],"amount":[1],"currency":[1],"url":[1]}]]]], options);
|
|
59
59
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b58d2618.js');
|
|
6
|
-
const pnProductPricelistStore = require('./pn-product-pricelist-store-
|
|
6
|
+
const pnProductPricelistStore = require('./pn-product-pricelist-store-e4f8503b.js');
|
|
7
7
|
require('./index-f472d191.js');
|
|
8
8
|
|
|
9
9
|
const pnProductPricelistResultCss = "";
|
|
@@ -13,8 +13,13 @@ const PnFindProductPricelistResult = class {
|
|
|
13
13
|
index.registerInstance(this, hostRef);
|
|
14
14
|
this.item = null;
|
|
15
15
|
this.shownitems = [];
|
|
16
|
+
this.weightText = "";
|
|
16
17
|
}
|
|
17
18
|
componentWillLoad() {
|
|
19
|
+
this.composeItems();
|
|
20
|
+
}
|
|
21
|
+
composeItems() {
|
|
22
|
+
this.shownitems = [];
|
|
18
23
|
if (this.item.pricestamps) {
|
|
19
24
|
this.shownitems.push(Object.assign(Object.assign({}, this.item), { priceagent: null, pricesenddirect: null }));
|
|
20
25
|
}
|
|
@@ -24,10 +29,16 @@ const PnFindProductPricelistResult = class {
|
|
|
24
29
|
if (this.item.pricesenddirect) {
|
|
25
30
|
this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, priceagent: null }));
|
|
26
31
|
}
|
|
32
|
+
// Parcels are always in KG. Letter KG must be converted from grams
|
|
33
|
+
this.weightText = (this.item.what === "parcel") ? this.item.maxweight + 'kg' :
|
|
34
|
+
(this.item.what === "letter" && this.item.maxweight > 999) ? Math.round(this.item.maxweight / 1000) + " kg" : this.item.maxweight + " g";
|
|
27
35
|
}
|
|
28
36
|
render() {
|
|
29
|
-
return (index.h(index.Host, null, this.shownitems.map((item) => (index.h("pn-product-tile", null, index.h("pn-illustration", { slot: "illustration", illustration: item.illustration }), index.h("div", { slot: "content" }, index.h("div", { class: "content" }, index.h("h3", null, item.name), (item.description) ? (index.h("div", { class: "description" }, item.description)) : null, (item.info) ? (index.h("div", { class: "description" }, item.info)) : null)), item.maxweight ? (index.h("pn-product-tile-info", { label: pnProductPricelistStore.state.i18n.maxweightlabel, text:
|
|
37
|
+
return (index.h(index.Host, null, this.shownitems.map((item) => (index.h("pn-product-tile", null, index.h("pn-illustration", { slot: "illustration", illustration: item.illustration }), index.h("div", { slot: "content" }, index.h("div", { class: "content" }, index.h("h3", null, item.name), (item.description) ? (index.h("div", { class: "description" }, item.description)) : null, (item.info) ? (index.h("div", { class: "description" }, item.info)) : null)), item.maxweight ? (index.h("pn-product-tile-info", { label: pnProductPricelistStore.state.i18n.maxweightlabel, text: this.weightText })) : null, item.maximummeasurements ? (index.h("pn-product-tile-info", { label: pnProductPricelistStore.state.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null, item.pricestamps ? (index.h("pn-product-tile-price", { slot: "price", label: pnProductPricelistStore.state.i18n.stampshopcta, amount: item.pricestamps + '', currency: pnProductPricelistStore.state.market.currency })) : null, item.priceagent ? (index.h("pn-product-tile-price", { slot: "price", label: "", amount: item.priceagent + '', currency: pnProductPricelistStore.state.market.currency, url: "https://shop.postnord.se/ebutik/default.aspx" })) : null, item.pricesenddirect ? (index.h("pn-product-tile-price", { slot: "price", label: pnProductPricelistStore.state.i18n.senddirectcta, amount: item.pricesenddirect + '', currency: pnProductPricelistStore.state.market.currency, url: "https://portal.postnord.com/skickadirekt/" })) : null, item.note ? (index.h("small", { slot: "note" }, index.h("p", null, item.note))) : null)))));
|
|
30
38
|
}
|
|
39
|
+
static get watchers() { return {
|
|
40
|
+
"item": ["composeItems"]
|
|
41
|
+
}; }
|
|
31
42
|
};
|
|
32
43
|
PnFindProductPricelistResult.style = pnProductPricelistResultCss;
|
|
33
44
|
|
package/cjs/{pn-product-pricelist-store-ffd73312.js → pn-product-pricelist-store-e4f8503b.js}
RENAMED
|
@@ -6,7 +6,11 @@ const index = require('./index-f472d191.js');
|
|
|
6
6
|
const { state, onChange } = index.createStore({
|
|
7
7
|
i18n: {
|
|
8
8
|
maxweightlabel: '',
|
|
9
|
-
|
|
9
|
+
weightlabel: '',
|
|
10
|
+
maxmeasurementlabel: '',
|
|
11
|
+
sizeheading: '',
|
|
12
|
+
senddirectcta: '',
|
|
13
|
+
stampshopcta: '',
|
|
10
14
|
},
|
|
11
15
|
market: {
|
|
12
16
|
currency: ""
|
|
@@ -4,29 +4,49 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b58d2618.js');
|
|
6
6
|
const convert = require('./convert-57b3dd5e.js');
|
|
7
|
-
const pnProductPricelistStore = require('./pn-product-pricelist-store-
|
|
7
|
+
const pnProductPricelistStore = require('./pn-product-pricelist-store-e4f8503b.js');
|
|
8
8
|
require('./index-f472d191.js');
|
|
9
9
|
|
|
10
10
|
const translations = {
|
|
11
11
|
'sv': {
|
|
12
12
|
'maxweightlabel': 'Maxvikt',
|
|
13
|
+
'weightlabel': 'Vikt',
|
|
13
14
|
'maxmeasurementlabel': 'Maxvolym',
|
|
15
|
+
'sizeheading': 'Hur mycket väger det?',
|
|
16
|
+
'senddirectcta': 'Köp frakt via Skicka Direkt',
|
|
17
|
+
'stampshopcta': 'Köp frimärken via vår webshop',
|
|
14
18
|
},
|
|
15
19
|
'en': {
|
|
16
20
|
'maxweightlabel': 'Max weight',
|
|
21
|
+
'weightlabel': 'Weight',
|
|
17
22
|
'maxmeasurementlabel': 'Maximum measurement',
|
|
23
|
+
'sizeheading': 'How much does it weigh?',
|
|
24
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
25
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
18
26
|
},
|
|
19
27
|
'da': {
|
|
20
28
|
'maxweightlabel': 'Max vægt',
|
|
29
|
+
'weightlabel': 'Vægt',
|
|
21
30
|
'maxmeasurementlabel': 'Maks. Volumen',
|
|
31
|
+
'sizeheading': 'How much does it weigh?',
|
|
32
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
33
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
22
34
|
},
|
|
23
35
|
'no': {
|
|
24
36
|
'maxweightlabel': 'Maks vekt',
|
|
37
|
+
'weightlabel': 'Vekt',
|
|
25
38
|
'maxmeasurementlabel': 'Maks volum',
|
|
39
|
+
'sizeheading': 'How much does it weigh?',
|
|
40
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
41
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
26
42
|
},
|
|
27
43
|
'fi': {
|
|
28
44
|
'maxweightlabel': 'Max paino',
|
|
45
|
+
'weightlabel': 'Piano',
|
|
29
46
|
'maxmeasurementlabel': 'Max äänenvoimakkuus',
|
|
47
|
+
'sizeheading': 'How much does it weigh?',
|
|
48
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
49
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
30
50
|
}
|
|
31
51
|
};
|
|
32
52
|
const markets = {
|
|
@@ -44,7 +64,39 @@ const markets = {
|
|
|
44
64
|
}
|
|
45
65
|
};
|
|
46
66
|
|
|
47
|
-
const
|
|
67
|
+
const weights = {
|
|
68
|
+
"letter": [
|
|
69
|
+
{ name: "50g", abbreviation: 'g', value: 50 },
|
|
70
|
+
{ name: "100g", abbreviation: 'g', value: 100 },
|
|
71
|
+
{ name: "250g", abbreviation: 'g', value: 250 },
|
|
72
|
+
{ name: "500g", abbreviation: 'g', value: 500 },
|
|
73
|
+
{ name: "1kg", abbreviation: 'kg', value: 1 },
|
|
74
|
+
{ name: "2kg", abbreviation: 'kg', value: 2 },
|
|
75
|
+
],
|
|
76
|
+
"parcel": [
|
|
77
|
+
{ name: "1kg", abbreviation: 'kg', value: 1 },
|
|
78
|
+
{ name: "2kg", abbreviation: 'kg', value: 2 },
|
|
79
|
+
{ name: "3kg", abbreviation: 'kg', value: 3 },
|
|
80
|
+
{ name: "4kg", abbreviation: 'kg', value: 4 },
|
|
81
|
+
{ name: "5kg", abbreviation: 'kg', value: 5 },
|
|
82
|
+
{ name: "6kg", abbreviation: 'kg', value: 6 },
|
|
83
|
+
{ name: "7Kg", abbreviation: 'kg', value: 7 },
|
|
84
|
+
{ name: "8kg", abbreviation: 'kg', value: 8 },
|
|
85
|
+
{ name: "9kg", abbreviation: 'kg', value: 9 },
|
|
86
|
+
{ name: "10kg", abbreviation: 'kg', value: 10 },
|
|
87
|
+
{ name: "11kg", abbreviation: 'kg', value: 11 },
|
|
88
|
+
{ name: "12kg", abbreviation: 'kg', value: 12 },
|
|
89
|
+
{ name: "13kg", abbreviation: 'kg', value: 13 },
|
|
90
|
+
{ name: "14kg", abbreviation: 'kg', value: 14 },
|
|
91
|
+
{ name: "15kg", abbreviation: 'kg', value: 15 },
|
|
92
|
+
{ name: "16kg", abbreviation: 'kg', value: 16 },
|
|
93
|
+
{ name: "17kg", abbreviation: 'kg', value: 17 },
|
|
94
|
+
{ name: "18kg", abbreviation: 'kg', value: 18 },
|
|
95
|
+
{ name: "20kg", abbreviation: 'kg', value: 20 },
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const pnProductPricelistCss = "pn-product-pricelist pn-spinner{margin:1em auto}pn-product-pricelist h2,pn-product-pricelist .heading{text-align:center;font-size:1.5em;line-height:1.1;font-weight:bold;margin-bottom:1rem}pn-product-pricelist .content,pn-product-pricelist .weightselection{max-width:50em;margin:0 auto 1em}pn-product-pricelist .weightoption{display:-ms-flexbox;display:flex;gap:1em}pn-product-pricelist .weightoption-input{width:5em;position:relative}pn-product-pricelist .weightoption-input input::-webkit-outer-spin-button,pn-product-pricelist .weightoption-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}pn-product-pricelist .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-product-pricelist .weightoption-range{-ms-flex-positive:1;flex-grow:1;-ms-flex-item-align:end;align-self:flex-end;position:relative;top:0.5em}pn-product-pricelist .weightoption-range input{width:calc(100% - 1.5em)}pn-product-pricelist .weightoption-range datalist{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75em}pn-product-pricelist .resultlist:not([data-list-count=\"0\"]){margin-top:2em}";
|
|
48
100
|
|
|
49
101
|
const PnFindProductPricelist = class {
|
|
50
102
|
constructor(hostRef) {
|
|
@@ -57,6 +109,9 @@ const PnFindProductPricelist = class {
|
|
|
57
109
|
this.sourceData = { types: [], data: [] };
|
|
58
110
|
this.gotData = false;
|
|
59
111
|
this.loading = false;
|
|
112
|
+
this.postagetype = { value: "" };
|
|
113
|
+
this.weight = { value: 0, name: "" };
|
|
114
|
+
this.weightvalue = 0;
|
|
60
115
|
}
|
|
61
116
|
componentWillLoad() {
|
|
62
117
|
this.setState();
|
|
@@ -94,15 +149,69 @@ const PnFindProductPricelist = class {
|
|
|
94
149
|
return;
|
|
95
150
|
}
|
|
96
151
|
this.loading = false;
|
|
97
|
-
|
|
152
|
+
const productIdItems = this.sourceData.data.filter(x => x.id === this.productid);
|
|
153
|
+
if (productIdItems.length === 0) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.postagetype.value = productIdItems[0].what;
|
|
157
|
+
if (!weights[this.postagetype.value] || weights[this.postagetype.value].length === 0) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (this.weightvalue === 0) {
|
|
161
|
+
this.weight = weights[this.postagetype.value][0];
|
|
162
|
+
this.weightvalue = this.weight.value;
|
|
163
|
+
}
|
|
164
|
+
// For letters we use grams. Otherwise we use KG
|
|
165
|
+
const comparisonWeight = (this.weight.abbreviation.toLocaleLowerCase() === "kg" && this.postagetype.value === 'letter') ? this.weight.value * 1000 : this.weight.value;
|
|
166
|
+
let weightFilteredData = productIdItems.filter(x => x.maxweight === comparisonWeight);
|
|
167
|
+
// In parcels the maxwidths don't necessarily start at 1kg so we fetch any type below the user selected value
|
|
168
|
+
if (weightFilteredData.length === 0) {
|
|
169
|
+
weightFilteredData = productIdItems.filter(x => x.maxweight >= comparisonWeight);
|
|
170
|
+
if (weightFilteredData.length > 0) {
|
|
171
|
+
// We reverse the result array since the map will take the last unique item instead of the first
|
|
172
|
+
const uniqueWeightOptions = [...new Map(weightFilteredData.reverse().map(item => [item["id"], item])).values()];
|
|
173
|
+
if (uniqueWeightOptions.length > 0) {
|
|
174
|
+
weightFilteredData = uniqueWeightOptions;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
this.filteredItems = weightFilteredData;
|
|
98
179
|
this.gotData = this.filteredItems.length > 0;
|
|
99
180
|
}
|
|
100
181
|
render() {
|
|
101
|
-
return (index.h(index.Host, null, index.h("div", { class: "content" }, index.h("slot", null)), this.loading ? (index.h("pn-spinner", null)) : null, index.h("div", { class: "
|
|
182
|
+
return (index.h(index.Host, null, index.h("div", { class: "content" }, index.h("slot", null)), this.loading ? (index.h("pn-spinner", null)) : null, (this.postagetype.value && weights[this.postagetype.value]) ? (index.h("div", { class: "weightselection" }, (pnProductPricelistStore.state.i18n.sizeheading) ? (index.h("div", { class: "heading" }, pnProductPricelistStore.state.i18n.sizeheading)) : null, index.h("div", { class: "weightoption" }, index.h("div", { class: "weightoption-input" }, index.h("pn-input", { inputid: "weightvalue", name: "weightvalue", type: "number", label: pnProductPricelistStore.state.i18n.weightlabel, value: this.weightvalue, onChange: (e) => {
|
|
183
|
+
if (e && e.target && e.target.value) {
|
|
184
|
+
const weightNum = parseInt(e.target.value, 10);
|
|
185
|
+
if (!isNaN(weightNum)) {
|
|
186
|
+
let matchingWeights = weights[this.postagetype.value].filter((x) => {
|
|
187
|
+
let weightInGrams = (x.abbreviation === "kg") ? x.value * 1000 : x.value;
|
|
188
|
+
return weightInGrams >= weightNum;
|
|
189
|
+
});
|
|
190
|
+
if (matchingWeights && matchingWeights.length > 0) {
|
|
191
|
+
this.weight = matchingWeights[0];
|
|
192
|
+
this.weightvalue = this.weight.value;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
} }), index.h("span", { class: "weightoption-input-abbreviation" }, this.weight.abbreviation)), index.h("div", { class: "weightoption-range" }, index.h("input", { type: "range", id: "weightrange", name: "weightrange", list: "weightlist", value: (!this.weight.value) ? 0 : weights[this.postagetype.value].findIndex((x) => x.value === this.weightvalue), onChange: (e) => {
|
|
197
|
+
const value = e.target.value;
|
|
198
|
+
this.weight = weights[this.postagetype.value][value];
|
|
199
|
+
this.weightvalue = this.weight.value;
|
|
200
|
+
}, min: "0",
|
|
201
|
+
// max={ weights[this.postagetype.value][weights[this.postagetype.value].length - 1].value }
|
|
202
|
+
max: weights[this.postagetype.value].length - 1 }), index.h("datalist", { id: "weightlist" }, weights[this.postagetype.value].map((weight, weightindex) => {
|
|
203
|
+
let labelText = weight.name;
|
|
204
|
+
if (weights[this.postagetype.value].length > 6) {
|
|
205
|
+
labelText = (weightindex % 5 === 0 || weightindex === 0 || weightindex === weights[this.postagetype.value].length - 1) ? weight.name : '';
|
|
206
|
+
}
|
|
207
|
+
return (index.h("option", Object.assign({ value: weightindex }, (labelText ? { label: labelText } : {}))));
|
|
208
|
+
})))))) : null, index.h("div", { class: "resultlist", "data-list-count": this.filteredItems.length }, this.filteredItems.map((item) => (index.h("div", null, index.h("pn-product-pricelist-result", { item: item })))))));
|
|
102
209
|
}
|
|
103
210
|
static get watchers() { return {
|
|
104
211
|
"market": ["setState"],
|
|
105
|
-
"language": ["setState"]
|
|
212
|
+
"language": ["setState"],
|
|
213
|
+
"postagetype": ["filterItems"],
|
|
214
|
+
"weightvalue": ["filterItems"]
|
|
106
215
|
}; }
|
|
107
216
|
};
|
|
108
217
|
PnFindProductPricelist.style = pnProductPricelistCss;
|
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b58d2618.js');
|
|
6
6
|
|
|
7
|
-
const pnProductTileCss = "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{
|
|
7
|
+
const pnProductTileCss = "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{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center;-ms-flex-positive:1;flex-grow:1}pn-product-tile .details{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;width:100%}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}";
|
|
8
8
|
|
|
9
9
|
const PnProductTile = class {
|
|
10
10
|
constructor(hostRef) {
|
|
11
11
|
index.registerInstance(this, hostRef);
|
|
12
12
|
}
|
|
13
13
|
render() {
|
|
14
|
-
return (index.h(index.Host, null, index.h("slot", { name: "illustration" }), index.h("div", { class: "tilecontent" }, index.h("
|
|
14
|
+
return (index.h(index.Host, null, index.h("slot", { name: "illustration" }), index.h("div", { class: "tilecontent" }, index.h("div", { class: "details" }, index.h("slot", { name: "content" }), index.h("div", { class: "info" }, index.h("slot", null)), index.h("slot", { name: "note" })), index.h("slot", { name: "price" }))));
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
PnProductTile.style = pnProductTileCss;
|
|
@@ -29,7 +29,7 @@ const PnProductTileInfo = class {
|
|
|
29
29
|
index.h("pn-icon", { symbol: "align-center", small: "false", color: "black" });
|
|
30
30
|
PnProductTileInfo.style = pnProductTileInfoCss;
|
|
31
31
|
|
|
32
|
-
const pnProductTilePriceCss = "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
|
|
32
|
+
const pnProductTilePriceCss = "pn-product-tile-price{margin-top:1em;white-space:nowrap;text-align:right}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 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}";
|
|
33
33
|
|
|
34
34
|
const PnProductTilePrice = class {
|
|
35
35
|
constructor(hostRef) {
|
|
@@ -39,7 +39,7 @@ const PnProductTilePrice = class {
|
|
|
39
39
|
if (!this.amount) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
return (this.url) ? (index.h(index.Host, null, index.h("
|
|
42
|
+
return (this.url) ? (index.h(index.Host, null, index.h("h3", null, (this.amount) ? (index.h("span", { class: "pn-2xl" }, this.amount)) : null, (this.currency) ? (index.h("span", { class: "pn-2xl" }, this.currency)) : null), (this.label) ? (index.h("a", { href: this.url }, index.h("pn-button", { small: "true", icon: "arrow-right" }, this.label))) : null)) : (index.h(index.Host, null, index.h("h3", null, (this.amount) ? (index.h("span", { class: "pn-2xl" }, this.amount)) : null, (this.currency) ? (index.h("span", { class: "pn-2xl" }, this.currency)) : null)));
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
PnProductTilePrice.style = pnProductTilePriceCss;
|
package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.js
CHANGED
|
@@ -34,10 +34,10 @@ export class PnfindServiceAndPriceResult {
|
|
|
34
34
|
(item.info) ? (h("div", { class: "description" }, item.info)) : null)),
|
|
35
35
|
item.maxweight ? (h("pn-product-tile-info", { label: state.i18n.maxweightlabel, text: this.weightText })) : null,
|
|
36
36
|
item.maximummeasurements ? (h("pn-product-tile-info", { label: state.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null,
|
|
37
|
-
item.pricestamps ? (h("pn-product-tile-price", { slot: "price", label:
|
|
38
|
-
item.priceagent ? (h("pn-product-tile-price", { slot: "price", label: "
|
|
39
|
-
item.pricesenddirect ? (h("pn-product-tile-price", { slot: "price", label:
|
|
40
|
-
item.
|
|
37
|
+
item.pricestamps ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.stampshopcta, amount: item.pricestamps + '', currency: state.market.currency })) : null,
|
|
38
|
+
item.priceagent ? (h("pn-product-tile-price", { slot: "price", label: "", amount: item.priceagent + '', currency: state.market.currency, url: "https://shop.postnord.se/ebutik/default.aspx" })) : null,
|
|
39
|
+
item.pricesenddirect ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.senddirectcta, amount: item.pricesenddirect + '', currency: state.market.currency, url: "https://portal.postnord.com/skickadirekt/" })) : null,
|
|
40
|
+
item.note ? (h("small", { slot: "note" },
|
|
41
41
|
h("p", null, item.note))) : null)))));
|
|
42
42
|
}
|
|
43
43
|
static get is() { return "pn-find-service-and-price-result"; }
|
|
@@ -7,6 +7,8 @@ export const translations = {
|
|
|
7
7
|
'weightlabel': 'Vikt',
|
|
8
8
|
'maxweightlabel': 'Maxvikt',
|
|
9
9
|
'maxmeasurementlabel': 'Maxvolym',
|
|
10
|
+
'senddirectcta': 'Köp frakt via Skicka Direkt',
|
|
11
|
+
'stampshopcta': 'Köp frimärken via vår webshop',
|
|
10
12
|
},
|
|
11
13
|
'en': {
|
|
12
14
|
'componentheading': 'What do you want to send?',
|
|
@@ -16,6 +18,8 @@ export const translations = {
|
|
|
16
18
|
'weightlabel': 'Weight',
|
|
17
19
|
'maxweightlabel': 'Max weight',
|
|
18
20
|
'maxmeasurementlabel': 'Maximum measurement',
|
|
21
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
22
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
19
23
|
},
|
|
20
24
|
'da': {
|
|
21
25
|
'componentheading': 'Vad vill du skicka?',
|
|
@@ -25,6 +29,8 @@ export const translations = {
|
|
|
25
29
|
'weightlabel': 'Vægt',
|
|
26
30
|
'maxweightlabel': 'Max vægt',
|
|
27
31
|
'maxmeasurementlabel': 'Maks. Volumen',
|
|
32
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
33
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
28
34
|
},
|
|
29
35
|
'no': {
|
|
30
36
|
'componentheading': 'Vad vill du skicka?',
|
|
@@ -34,6 +40,8 @@ export const translations = {
|
|
|
34
40
|
'weightlabel': 'Vekt',
|
|
35
41
|
'maxweightlabel': 'Maks vekt',
|
|
36
42
|
'maxmeasurementlabel': 'Maks volum',
|
|
43
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
44
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
37
45
|
},
|
|
38
46
|
'fi': {
|
|
39
47
|
'componentheading': 'Vad vill du skicka?',
|
|
@@ -43,6 +51,8 @@ export const translations = {
|
|
|
43
51
|
'weightlabel': 'Paino',
|
|
44
52
|
'maxweightlabel': 'Max paino',
|
|
45
53
|
'maxmeasurementlabel': 'Max äänenvoimakkuus',
|
|
54
|
+
'senddirectcta': 'Buy shipping in Send Direct',
|
|
55
|
+
'stampshopcta': 'Order home stamps from the webshop',
|
|
46
56
|
}
|
|
47
57
|
};
|
|
48
58
|
export const markets = {
|