@postnord/pn-marketweb-components 1.0.3 → 1.0.7
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/convert-57b3dd5e.js +1730 -0
- package/cjs/{index-0f43b450.js → index-b58d2618.js} +82 -0
- package/cjs/index-f472d191.js +181 -0
- package/cjs/loader.cjs.js +2 -2
- package/cjs/pn-choice-button_2.cjs.entry.js +78 -0
- package/cjs/pn-find-service-and-price-store-7ced0e29.js +21 -0
- package/cjs/pn-find-service-and-price.cjs.entry.js +246 -0
- package/cjs/pn-language-selector_9.cjs.entry.js +646 -0
- package/cjs/pn-mainnav-link.cjs.entry.js +45 -0
- package/cjs/pn-mainnav-store-dda9827f.js +18 -0
- package/cjs/pn-market-web-components.cjs.js +2 -2
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +145 -0
- package/cjs/{pn-siteheader.cjs.entry.js → pn-marketweb-siteheader.cjs.entry.js} +14 -11
- package/cjs/pn-product-pricelist-result.cjs.entry.js +34 -0
- package/cjs/pn-product-pricelist-store-ffd73312.js +16 -0
- package/cjs/pn-product-pricelist.cjs.entry.js +110 -0
- package/cjs/pn-product-tile_3.cjs.entry.js +49 -0
- package/cjs/pn-site-footer_2.cjs.entry.js +36 -0
- package/collection/collection-manifest.json +22 -3
- package/collection/components/input/pn-choice-button/choice-button.stories.js +34 -0
- package/collection/components/input/pn-choice-button/pn-choice-button.css +66 -0
- package/collection/components/input/pn-choice-button/pn-choice-button.js +170 -0
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter-types.js +10 -0
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.css +0 -0
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js +166 -0
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.stories.js +54 -0
- package/collection/components/layout-components/{pn-siteheader → pn-marketweb-sitefooter}/translations.js +0 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.css +34 -0
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-login.js → pn-marketweb-siteheader/pn-marketweb-siteheader-login.js} +6 -6
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-loginmanager.js → pn-marketweb-siteheader/pn-marketweb-siteheader-loginmanager.js} +0 -0
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-search.css → pn-marketweb-siteheader/pn-marketweb-siteheader-search.css} +0 -0
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-search.js → pn-marketweb-siteheader/pn-marketweb-siteheader-search.js} +5 -6
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader-types.js → pn-marketweb-siteheader/pn-marketweb-siteheader-types.js} +0 -0
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader.css → pn-marketweb-siteheader/pn-marketweb-siteheader.css} +21 -21
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader.js → pn-marketweb-siteheader/pn-marketweb-siteheader.js} +13 -10
- package/collection/components/layout-components/{pn-siteheader/pn-siteheader.stories.js → pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js} +2 -2
- package/collection/components/layout-components/pn-marketweb-siteheader/translations.js +47 -0
- package/collection/components/navigation/pn-language-selector/language-selector.stories.js +43 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector-option.css +74 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector-option.js +148 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector-types.js +1 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector.css +32 -0
- package/collection/components/navigation/pn-language-selector/pn-language-selector.js +92 -0
- package/collection/components/navigation/pn-language-selector/translations.js +17 -0
- package/collection/components/navigation/pn-mainnav/main-nav.stories.js +92 -0
- package/collection/components/navigation/pn-mainnav/pn-main-nav-mockdata.js +5851 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-level.css +139 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-level.js +93 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-link.css +221 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-link.js +126 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-list.css +51 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-list.js +46 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav-store.js +14 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav.css +100 -0
- package/collection/components/navigation/pn-mainnav/pn-mainnav.js +200 -0
- package/collection/components/navigation/pn-mainnav/translations.js +32 -0
- package/collection/components/navigation/pn-mainnav/types.js +1 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer-col.css +20 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer-col.js +14 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer.css +72 -0
- package/collection/components/navigation/pn-site-footer/pn-site-footer.js +50 -0
- package/collection/components/navigation/pn-site-footer/site-footer.stories.js +87 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector-i18n.js +18 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector-item.css +62 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector-item.js +103 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector-types.js +1 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector.css +29 -0
- package/collection/components/navigation/pn-site-selector/pn-site-selector.js +96 -0
- package/collection/components/navigation/pn-site-selector/site-selector.stories.js +35 -0
- package/collection/components/widgets/pn-find-service-and-price/data.js +53 -0
- package/collection/components/widgets/pn-find-service-and-price/find-service-and-price.stories.js +27 -0
- package/collection/components/widgets/pn-find-service-and-price/libs/convertnode.js +58 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.css +0 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.js +101 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-store.js +18 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-translations.js +61 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-types.js +1 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.css +52 -0
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.js +229 -0
- package/collection/components/widgets/pn-find-service-and-price/runconvert.js +2 -0
- package/collection/components/widgets/pn-product-pricelist/data.js +51 -0
- package/collection/components/widgets/pn-product-pricelist/libs/convert.js +43 -0
- package/collection/components/widgets/pn-product-pricelist/libs/convertnode.js +58 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-result.css +0 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-result.js +86 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-store.js +13 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-translations.js +36 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-types.js +1 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.css +6 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.js +157 -0
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.stories.js +35 -0
- package/collection/components/widgets/pn-product-pricelist/runconvert.js +2 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile-info.css +3 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile-info.js +70 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile-price.css +21 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile-price.js +99 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile.css +48 -0
- package/collection/components/widgets/pn-product-tile/pn-product-tile.js +21 -0
- package/collection/components/widgets/pn-product-tile/product-tile.stories.js +50 -0
- package/collection/globals/shared/productprice/convert.js +43 -0
- package/collection/globals/shared/productprice/product-price-types.js +1 -0
- package/custom-elements/index.d.ts +126 -12
- package/custom-elements/index.js +3042 -27
- package/esm/convert-b49a0857.js +1728 -0
- package/esm/{index-1e3839a0.js → index-52dc19ca.js} +79 -1
- package/esm/index-7c277874.js +179 -0
- package/esm/loader.js +2 -2
- package/esm/pn-choice-button_2.entry.js +73 -0
- package/esm/pn-find-service-and-price-store-0c7083bd.js +19 -0
- package/esm/pn-find-service-and-price.entry.js +242 -0
- package/esm/pn-language-selector_9.entry.js +634 -0
- package/esm/pn-mainnav-link.entry.js +41 -0
- package/esm/pn-mainnav-store-a0726338.js +15 -0
- package/esm/pn-market-web-components.js +2 -2
- package/esm/pn-marketweb-sitefooter.entry.js +141 -0
- package/esm/{pn-siteheader.entry.js → pn-marketweb-siteheader.entry.js} +14 -11
- package/esm/pn-product-pricelist-result.entry.js +30 -0
- package/esm/pn-product-pricelist-store-82211c4a.js +14 -0
- package/esm/pn-product-pricelist.entry.js +106 -0
- package/esm/pn-product-tile_3.entry.js +43 -0
- package/esm/pn-site-footer_2.entry.js +31 -0
- package/esm-es5/convert-b49a0857.js +13 -0
- package/esm-es5/index-52dc19ca.js +1 -0
- package/esm-es5/index-7c277874.js +1 -0
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-choice-button_2.entry.js +1 -0
- package/esm-es5/pn-find-service-and-price-store-0c7083bd.js +1 -0
- package/esm-es5/pn-find-service-and-price.entry.js +1 -0
- package/esm-es5/pn-language-selector_9.entry.js +1 -0
- package/esm-es5/pn-mainnav-link.entry.js +1 -0
- package/esm-es5/pn-mainnav-store-a0726338.js +1 -0
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -0
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -0
- package/esm-es5/pn-product-pricelist-result.entry.js +1 -0
- package/esm-es5/pn-product-pricelist-store-82211c4a.js +1 -0
- package/esm-es5/pn-product-pricelist.entry.js +1 -0
- package/esm-es5/pn-product-tile_3.entry.js +1 -0
- package/esm-es5/pn-site-footer_2.entry.js +1 -0
- package/package.json +6 -3
- package/pn-market-web-components/p-05d06f7f.system.js +1 -0
- package/pn-market-web-components/p-0a756d7d.system.entry.js +1 -0
- package/pn-market-web-components/p-1905c548.entry.js +1 -0
- package/pn-market-web-components/p-1fe6de09.entry.js +1 -0
- package/pn-market-web-components/p-21e0e386.js +13 -0
- package/pn-market-web-components/p-23743bec.system.entry.js +1 -0
- package/pn-market-web-components/p-23d34c82.system.entry.js +1 -0
- package/pn-market-web-components/p-27502f43.system.entry.js +1 -0
- package/pn-market-web-components/p-2fa246f1.system.js +1 -0
- package/pn-market-web-components/p-3ae74105.system.entry.js +1 -0
- package/pn-market-web-components/p-44f74289.system.entry.js +1 -0
- package/pn-market-web-components/p-46018354.system.js +1 -0
- package/pn-market-web-components/p-4bf9a9ff.js +1 -0
- package/pn-market-web-components/p-4f283190.js +1 -0
- package/pn-market-web-components/p-5f1ad0b7.entry.js +1 -0
- package/pn-market-web-components/p-62700d6e.system.js +1 -0
- package/pn-market-web-components/p-64a6c2fb.js +1 -0
- package/pn-market-web-components/p-7331d3bb.system.js +1 -0
- package/pn-market-web-components/p-91624bd5.system.js +13 -0
- package/pn-market-web-components/p-986d3894.entry.js +1 -0
- package/pn-market-web-components/p-a5179982.system.entry.js +1 -0
- package/pn-market-web-components/p-be245b29.entry.js +1 -0
- package/pn-market-web-components/p-bfc523fc.js +1 -0
- package/pn-market-web-components/p-c06b37c7.entry.js +1 -0
- package/pn-market-web-components/p-c9af6ced.entry.js +1 -0
- package/pn-market-web-components/p-ce136600.js +1 -0
- package/pn-market-web-components/p-d0e7e65c.system.js +1 -0
- package/pn-market-web-components/p-dc5ff15f.entry.js +1 -0
- package/pn-market-web-components/p-e367b055.system.entry.js +1 -0
- package/pn-market-web-components/p-ea9afb95.system.entry.js +1 -0
- package/pn-market-web-components/p-ec95bda3.entry.js +1 -0
- package/pn-market-web-components/p-f37be6ee.system.entry.js +1 -0
- package/pn-market-web-components/p-fee1d1c9.entry.js +1 -0
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/pn-market-web-components/pn-market-web-components.js +1 -1
- package/types/components/input/pn-choice-button/pn-choice-button.d.ts +20 -0
- package/types/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter-types.d.ts +21 -0
- package/types/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.d.ts +23 -0
- package/types/components/layout-components/{pn-siteheader → pn-marketweb-sitefooter}/translations.d.ts +0 -0
- package/types/components/layout-components/{pn-siteheader/pn-siteheader-login.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader-login.d.ts} +3 -3
- package/types/components/layout-components/{pn-siteheader/pn-siteheader-loginmanager.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader-loginmanager.d.ts} +0 -0
- package/types/components/layout-components/{pn-siteheader/pn-siteheader-search.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader-search.d.ts} +2 -2
- package/types/components/layout-components/{pn-siteheader/pn-siteheader-types.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader-types.d.ts} +1 -0
- package/types/components/layout-components/{pn-siteheader/pn-siteheader.d.ts → pn-marketweb-siteheader/pn-marketweb-siteheader.d.ts} +3 -2
- package/types/components/layout-components/pn-marketweb-siteheader/translations.d.ts +47 -0
- package/types/components/navigation/pn-language-selector/pn-language-selector-option.d.ts +12 -0
- package/types/components/navigation/pn-language-selector/pn-language-selector-types.d.ts +9 -0
- package/types/components/navigation/pn-language-selector/pn-language-selector.d.ts +15 -0
- package/types/components/navigation/pn-language-selector/translations.d.ts +17 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav-level.d.ts +15 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav-link.d.ts +19 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav-list.d.ts +7 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav-store.d.ts +21 -0
- package/types/components/navigation/pn-mainnav/pn-mainnav.d.ts +24 -0
- package/types/components/navigation/pn-mainnav/translations.d.ts +32 -0
- package/types/components/navigation/pn-mainnav/types.d.ts +6 -0
- package/types/components/navigation/pn-site-footer/pn-site-footer-col.d.ts +3 -0
- package/types/components/navigation/pn-site-footer/pn-site-footer.d.ts +6 -0
- package/types/components/navigation/pn-site-selector/pn-site-selector-item.d.ts +7 -0
- package/types/components/navigation/pn-site-selector/pn-site-selector-types.d.ts +3 -0
- package/types/components/navigation/pn-site-selector/pn-site-selector.d.ts +12 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.d.ts +9 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-store.d.ts +29 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-translations.d.ts +61 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price-types.d.ts +27 -0
- package/types/components/widgets/pn-find-service-and-price/pn-find-service-and-price.d.ts +18 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-result.d.ts +7 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-store.d.ts +19 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-translations.d.ts +36 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist-types.d.ts +7 -0
- package/types/components/widgets/pn-product-pricelist/pn-product-pricelist.d.ts +16 -0
- package/types/components/widgets/pn-product-tile/pn-product-tile-info.d.ts +6 -0
- package/types/components/widgets/pn-product-tile/pn-product-tile-price.d.ts +7 -0
- package/types/components/widgets/pn-product-tile/pn-product-tile.d.ts +3 -0
- package/types/components.d.ts +486 -28
- package/types/globals/shared/productprice/product-price-types.d.ts +19 -0
- package/cjs/pn-siteheader-login_2.cjs.entry.js +0 -295
- package/collection/components/layout-components/pn-siteheader/pn-siteheader-login.css +0 -34
- package/esm/pn-siteheader-login_2.entry.js +0 -290
- package/esm-es5/index-1e3839a0.js +0 -1
- package/esm-es5/pn-siteheader-login_2.entry.js +0 -1
- package/esm-es5/pn-siteheader.entry.js +0 -1
- package/pn-market-web-components/p-0e743863.system.js +0 -1
- package/pn-market-web-components/p-1e159db8.js +0 -1
- package/pn-market-web-components/p-50b6c2c1.system.entry.js +0 -1
- package/pn-market-web-components/p-530b52d0.system.js +0 -1
- package/pn-market-web-components/p-9a654a14.system.entry.js +0 -1
- package/pn-market-web-components/p-a1045531.entry.js +0 -1
- package/pn-market-web-components/p-fc344aee.entry.js +0 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Component, h, Prop, State, Host, Watch } from "@stencil/core";
|
|
2
|
+
import { translations, markets } from "./pn-product-pricelist-translations";
|
|
3
|
+
import { convertFileFromStream } from "../../../globals/shared/productprice/convert.js";
|
|
4
|
+
import { state } from "./pn-product-pricelist-store";
|
|
5
|
+
export class PnFindProductPricelist {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.source = "https://com-integration.postnord.com/globalassets/global/prices/sv-se-findprice.xlsx";
|
|
8
|
+
this.language = "sv";
|
|
9
|
+
this.market = "se";
|
|
10
|
+
this.productid = "";
|
|
11
|
+
this.filteredItems = [];
|
|
12
|
+
this.sourceData = { types: [], data: [] };
|
|
13
|
+
this.gotData = false;
|
|
14
|
+
this.loading = false;
|
|
15
|
+
}
|
|
16
|
+
componentWillLoad() {
|
|
17
|
+
this.setState();
|
|
18
|
+
this.getDataSource().then(() => { });
|
|
19
|
+
}
|
|
20
|
+
setState() {
|
|
21
|
+
if (this.market) {
|
|
22
|
+
state.market = markets[this.market];
|
|
23
|
+
}
|
|
24
|
+
if (this.language && translations[this.language]) {
|
|
25
|
+
state.i18n = translations[this.language];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async getDataSource() {
|
|
29
|
+
if (!this.productid) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.loading = true;
|
|
33
|
+
const req = await fetch(this.source);
|
|
34
|
+
const reqbody = await req.blob();
|
|
35
|
+
try {
|
|
36
|
+
const convertedData = await convertFileFromStream(reqbody);
|
|
37
|
+
this.sourceData = convertedData;
|
|
38
|
+
this.filterItems();
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
this.loading = false;
|
|
42
|
+
console.warn('Unable to parse data');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
filterItems() {
|
|
46
|
+
var _a;
|
|
47
|
+
if (!((_a = this.sourceData) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
48
|
+
console.info('Data has not yet been loaded');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.loading = false;
|
|
52
|
+
this.filteredItems = this.sourceData.data.filter(x => x.id === this.productid);
|
|
53
|
+
this.gotData = this.filteredItems.length > 0;
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return (h(Host, null,
|
|
57
|
+
h("div", { class: "content" },
|
|
58
|
+
h("slot", null)),
|
|
59
|
+
this.loading ? (h("pn-spinner", null)) : null,
|
|
60
|
+
h("div", { class: "resultlist", "data-list-count": this.filteredItems.length }, this.filteredItems.map((item) => (h("div", null,
|
|
61
|
+
h("pn-product-pricelist-result", { item: item })))))));
|
|
62
|
+
}
|
|
63
|
+
static get is() { return "pn-product-pricelist"; }
|
|
64
|
+
static get originalStyleUrls() { return {
|
|
65
|
+
"$": ["pn-product-pricelist.scss"]
|
|
66
|
+
}; }
|
|
67
|
+
static get styleUrls() { return {
|
|
68
|
+
"$": ["pn-product-pricelist.css"]
|
|
69
|
+
}; }
|
|
70
|
+
static get properties() { return {
|
|
71
|
+
"source": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"mutable": false,
|
|
74
|
+
"complexType": {
|
|
75
|
+
"original": "string",
|
|
76
|
+
"resolved": "string",
|
|
77
|
+
"references": {}
|
|
78
|
+
},
|
|
79
|
+
"required": false,
|
|
80
|
+
"optional": false,
|
|
81
|
+
"docs": {
|
|
82
|
+
"tags": [],
|
|
83
|
+
"text": ""
|
|
84
|
+
},
|
|
85
|
+
"attribute": "source",
|
|
86
|
+
"reflect": false,
|
|
87
|
+
"defaultValue": "\"https://com-integration.postnord.com/globalassets/global/prices/sv-se-findprice.xlsx\""
|
|
88
|
+
},
|
|
89
|
+
"language": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"mutable": true,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "string",
|
|
94
|
+
"resolved": "string",
|
|
95
|
+
"references": {}
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"optional": false,
|
|
99
|
+
"docs": {
|
|
100
|
+
"tags": [],
|
|
101
|
+
"text": ""
|
|
102
|
+
},
|
|
103
|
+
"attribute": "language",
|
|
104
|
+
"reflect": false,
|
|
105
|
+
"defaultValue": "\"sv\""
|
|
106
|
+
},
|
|
107
|
+
"market": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"mutable": true,
|
|
110
|
+
"complexType": {
|
|
111
|
+
"original": "string",
|
|
112
|
+
"resolved": "string",
|
|
113
|
+
"references": {}
|
|
114
|
+
},
|
|
115
|
+
"required": false,
|
|
116
|
+
"optional": false,
|
|
117
|
+
"docs": {
|
|
118
|
+
"tags": [],
|
|
119
|
+
"text": ""
|
|
120
|
+
},
|
|
121
|
+
"attribute": "market",
|
|
122
|
+
"reflect": false,
|
|
123
|
+
"defaultValue": "\"se\""
|
|
124
|
+
},
|
|
125
|
+
"productid": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"mutable": false,
|
|
128
|
+
"complexType": {
|
|
129
|
+
"original": "string",
|
|
130
|
+
"resolved": "string",
|
|
131
|
+
"references": {}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
},
|
|
139
|
+
"attribute": "productid",
|
|
140
|
+
"reflect": false,
|
|
141
|
+
"defaultValue": "\"\""
|
|
142
|
+
}
|
|
143
|
+
}; }
|
|
144
|
+
static get states() { return {
|
|
145
|
+
"filteredItems": {},
|
|
146
|
+
"sourceData": {},
|
|
147
|
+
"gotData": {},
|
|
148
|
+
"loading": {}
|
|
149
|
+
}; }
|
|
150
|
+
static get watchers() { return [{
|
|
151
|
+
"propName": "market",
|
|
152
|
+
"methodName": "setState"
|
|
153
|
+
}, {
|
|
154
|
+
"propName": "language",
|
|
155
|
+
"methodName": "setState"
|
|
156
|
+
}]; }
|
|
157
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import readme from "./readme.md";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Widgets/Product price list",
|
|
5
|
+
parameters: {
|
|
6
|
+
notes: readme
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const Template = ({ ...args }) => {
|
|
13
|
+
return `
|
|
14
|
+
<div style="max-width: 50em; margin:1em auto 0;">
|
|
15
|
+
<pn-product-pricelist
|
|
16
|
+
source="${args.source}"
|
|
17
|
+
market="${args.market}"
|
|
18
|
+
language="${args.language}"
|
|
19
|
+
productid="${args.productid}">
|
|
20
|
+
<h2>${args.heading}</h2>
|
|
21
|
+
<p>${args.description}</p>
|
|
22
|
+
</pn-product-pricelist>
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Primary = Template.bind({});
|
|
28
|
+
Primary.args = {
|
|
29
|
+
heading: '1:a-klassbrev inrikes',
|
|
30
|
+
description: '1:a-klassbrev kan väga upp till 2 kg och delas normalt ut första alternativt andra dagen dagen efter att det lämnats. För att skicka ett 1:a-klassbrev behöver du vara avtalskund hos oss.',
|
|
31
|
+
source: 'https://com-integration.postnord.com/globalassets/global/prices/sv-se-findprice.xlsx',
|
|
32
|
+
language: 'sv',
|
|
33
|
+
market: 'se',
|
|
34
|
+
productid: 'expressletter'
|
|
35
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Component, h, Prop, Host } from "@stencil/core";
|
|
2
|
+
export class PnProductTileInfo {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, null,
|
|
5
|
+
(this.label) ? (h("p", null,
|
|
6
|
+
h("small", null, this.label))) : null,
|
|
7
|
+
(this.text) ? (h("h3", null, this.text)) : null));
|
|
8
|
+
}
|
|
9
|
+
static get is() { return "pn-product-tile-info"; }
|
|
10
|
+
static get originalStyleUrls() { return {
|
|
11
|
+
"$": ["pn-product-tile-info.scss"]
|
|
12
|
+
}; }
|
|
13
|
+
static get styleUrls() { return {
|
|
14
|
+
"$": ["pn-product-tile-info.css"]
|
|
15
|
+
}; }
|
|
16
|
+
static get properties() { return {
|
|
17
|
+
"label": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"mutable": false,
|
|
20
|
+
"complexType": {
|
|
21
|
+
"original": "string",
|
|
22
|
+
"resolved": "string",
|
|
23
|
+
"references": {}
|
|
24
|
+
},
|
|
25
|
+
"required": false,
|
|
26
|
+
"optional": false,
|
|
27
|
+
"docs": {
|
|
28
|
+
"tags": [],
|
|
29
|
+
"text": ""
|
|
30
|
+
},
|
|
31
|
+
"attribute": "label",
|
|
32
|
+
"reflect": false
|
|
33
|
+
},
|
|
34
|
+
"text": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"mutable": false,
|
|
37
|
+
"complexType": {
|
|
38
|
+
"original": "string",
|
|
39
|
+
"resolved": "string",
|
|
40
|
+
"references": {}
|
|
41
|
+
},
|
|
42
|
+
"required": false,
|
|
43
|
+
"optional": false,
|
|
44
|
+
"docs": {
|
|
45
|
+
"tags": [],
|
|
46
|
+
"text": ""
|
|
47
|
+
},
|
|
48
|
+
"attribute": "text",
|
|
49
|
+
"reflect": false
|
|
50
|
+
},
|
|
51
|
+
"icon": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"mutable": false,
|
|
54
|
+
"complexType": {
|
|
55
|
+
"original": "string",
|
|
56
|
+
"resolved": "string",
|
|
57
|
+
"references": {}
|
|
58
|
+
},
|
|
59
|
+
"required": false,
|
|
60
|
+
"optional": false,
|
|
61
|
+
"docs": {
|
|
62
|
+
"tags": [],
|
|
63
|
+
"text": ""
|
|
64
|
+
},
|
|
65
|
+
"attribute": "icon",
|
|
66
|
+
"reflect": false
|
|
67
|
+
}
|
|
68
|
+
}; }
|
|
69
|
+
}
|
|
70
|
+
h("pn-icon", { symbol: "align-center", small: "false", color: "black" });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
pn-product-tile-price span:last-child {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
margin-left: 0.2em;
|
|
4
|
+
}
|
|
5
|
+
pn-product-tile-price + pn-product-tile-price {
|
|
6
|
+
margin-left: 1.5em;
|
|
7
|
+
}
|
|
8
|
+
pn-product-tile-price small {
|
|
9
|
+
display: flex;
|
|
10
|
+
}
|
|
11
|
+
pn-product-tile-price pn-icon {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
align-self: center;
|
|
14
|
+
}
|
|
15
|
+
pn-product-tile-price a {
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
color: #005D92;
|
|
18
|
+
}
|
|
19
|
+
pn-product-tile-price a h3 {
|
|
20
|
+
text-decoration: underline;
|
|
21
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Component, h, Prop, Host } from "@stencil/core";
|
|
2
|
+
export class PnProductTilePrice {
|
|
3
|
+
render() {
|
|
4
|
+
if (!this.amount) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
return (this.url) ? (h(Host, null,
|
|
8
|
+
h("a", { href: this.url },
|
|
9
|
+
(this.label) ? (h("p", null,
|
|
10
|
+
h("small", null,
|
|
11
|
+
this.label,
|
|
12
|
+
h("pn-icon", { symbol: "open-in-new", small: "true", color: "blue700" })))) : null,
|
|
13
|
+
h("h3", null,
|
|
14
|
+
(this.amount) ? (h("span", { class: "pn-2xl" }, this.amount)) : null,
|
|
15
|
+
(this.currency) ? (h("span", null, this.currency)) : null)))) : (h(Host, null,
|
|
16
|
+
(this.label) ? (h("p", null,
|
|
17
|
+
h("small", null, this.label))) : null,
|
|
18
|
+
h("h3", null,
|
|
19
|
+
(this.amount) ? (h("span", { class: "pn-2xl" }, this.amount)) : null,
|
|
20
|
+
(this.currency) ? (h("span", null, this.currency)) : null)));
|
|
21
|
+
}
|
|
22
|
+
static get is() { return "pn-product-tile-price"; }
|
|
23
|
+
static get originalStyleUrls() { return {
|
|
24
|
+
"$": ["pn-product-tile-price.scss"]
|
|
25
|
+
}; }
|
|
26
|
+
static get styleUrls() { return {
|
|
27
|
+
"$": ["pn-product-tile-price.css"]
|
|
28
|
+
}; }
|
|
29
|
+
static get properties() { return {
|
|
30
|
+
"label": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"mutable": false,
|
|
33
|
+
"complexType": {
|
|
34
|
+
"original": "string",
|
|
35
|
+
"resolved": "string",
|
|
36
|
+
"references": {}
|
|
37
|
+
},
|
|
38
|
+
"required": false,
|
|
39
|
+
"optional": false,
|
|
40
|
+
"docs": {
|
|
41
|
+
"tags": [],
|
|
42
|
+
"text": ""
|
|
43
|
+
},
|
|
44
|
+
"attribute": "label",
|
|
45
|
+
"reflect": false
|
|
46
|
+
},
|
|
47
|
+
"amount": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"complexType": {
|
|
51
|
+
"original": "string",
|
|
52
|
+
"resolved": "string",
|
|
53
|
+
"references": {}
|
|
54
|
+
},
|
|
55
|
+
"required": false,
|
|
56
|
+
"optional": false,
|
|
57
|
+
"docs": {
|
|
58
|
+
"tags": [],
|
|
59
|
+
"text": ""
|
|
60
|
+
},
|
|
61
|
+
"attribute": "amount",
|
|
62
|
+
"reflect": false
|
|
63
|
+
},
|
|
64
|
+
"currency": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"mutable": false,
|
|
67
|
+
"complexType": {
|
|
68
|
+
"original": "string",
|
|
69
|
+
"resolved": "string",
|
|
70
|
+
"references": {}
|
|
71
|
+
},
|
|
72
|
+
"required": false,
|
|
73
|
+
"optional": false,
|
|
74
|
+
"docs": {
|
|
75
|
+
"tags": [],
|
|
76
|
+
"text": ""
|
|
77
|
+
},
|
|
78
|
+
"attribute": "currency",
|
|
79
|
+
"reflect": false
|
|
80
|
+
},
|
|
81
|
+
"url": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"mutable": false,
|
|
84
|
+
"complexType": {
|
|
85
|
+
"original": "string",
|
|
86
|
+
"resolved": "string",
|
|
87
|
+
"references": {}
|
|
88
|
+
},
|
|
89
|
+
"required": false,
|
|
90
|
+
"optional": false,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": ""
|
|
94
|
+
},
|
|
95
|
+
"attribute": "url",
|
|
96
|
+
"reflect": false
|
|
97
|
+
}
|
|
98
|
+
}; }
|
|
99
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
pn-product-tile {
|
|
2
|
+
margin-bottom: 1em;
|
|
3
|
+
border: 0.1rem solid #D3CECB;
|
|
4
|
+
outline: none;
|
|
5
|
+
background: white;
|
|
6
|
+
box-shadow: 0px 0.6px 1.8px rgba(0, 0, 0, 0.1), 0px 3.2px 7.2px rgba(0, 0, 0, 0.13);
|
|
7
|
+
display: flex;
|
|
8
|
+
padding: 1.5em;
|
|
9
|
+
word-break: break-word;
|
|
10
|
+
text-decoration: none;
|
|
11
|
+
border-radius: 0.8rem;
|
|
12
|
+
}
|
|
13
|
+
pn-product-tile [slot=content] h3 {
|
|
14
|
+
display: flex;
|
|
15
|
+
width: 100%;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
margin-bottom: 0.5em;
|
|
18
|
+
}
|
|
19
|
+
pn-product-tile > pn-illustration {
|
|
20
|
+
min-width: 8rem;
|
|
21
|
+
width: 8rem;
|
|
22
|
+
height: 8rem;
|
|
23
|
+
margin-right: 3rem;
|
|
24
|
+
align-self: center;
|
|
25
|
+
}
|
|
26
|
+
pn-product-tile .tilecontent {
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
align-items: flex-start;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
}
|
|
32
|
+
pn-product-tile .details {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
width: 100%;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
pn-product-tile .info {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
flex-grow: 1;
|
|
42
|
+
max-width: calc((100% / 3) * 2);
|
|
43
|
+
flex-flow: wrap;
|
|
44
|
+
}
|
|
45
|
+
pn-product-tile .info > * {
|
|
46
|
+
min-width: 6em;
|
|
47
|
+
margin: 0.2em 1em 0.2em 0;
|
|
48
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component, h, Host } from "@stencil/core";
|
|
2
|
+
export class PnProductTile {
|
|
3
|
+
render() {
|
|
4
|
+
return (h(Host, null,
|
|
5
|
+
h("slot", { name: "illustration" }),
|
|
6
|
+
h("div", { class: "tilecontent" },
|
|
7
|
+
h("slot", { name: "content" }),
|
|
8
|
+
h("div", { class: "details" },
|
|
9
|
+
h("div", { class: "info" },
|
|
10
|
+
h("slot", null)),
|
|
11
|
+
h("slot", { name: "price" })),
|
|
12
|
+
h("slot", { name: "note" }))));
|
|
13
|
+
}
|
|
14
|
+
static get is() { return "pn-product-tile"; }
|
|
15
|
+
static get originalStyleUrls() { return {
|
|
16
|
+
"$": ["pn-product-tile.scss"]
|
|
17
|
+
}; }
|
|
18
|
+
static get styleUrls() { return {
|
|
19
|
+
"$": ["pn-product-tile.css"]
|
|
20
|
+
}; }
|
|
21
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import readme from "./readme.md";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Widgets/Product Tile",
|
|
5
|
+
parameters: {
|
|
6
|
+
notes: readme
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = ({ ...args }) => {
|
|
11
|
+
return `
|
|
12
|
+
<div style="max-width: 30em; margin:1em auto 0;">
|
|
13
|
+
<pn-product-tile>
|
|
14
|
+
<div slot="content">
|
|
15
|
+
<h3>${args.heading}</h3>
|
|
16
|
+
<p>${args.description}</p>
|
|
17
|
+
</div>
|
|
18
|
+
<pn-product-tile-info label="${args.info1label}" text="${args.info1value}"></pn-product-tile-info>
|
|
19
|
+
<pn-product-tile-info label="${args.info2label}" text="${args.info2value}"></pn-product-tile-info>
|
|
20
|
+
<pn-product-tile-price slot="price" label="${args.pricelabel}" amount="${args.priceamount}" currency="${args.pricecurrency}"></pn-product-tile-price>
|
|
21
|
+
</pn-product-tile>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Primary = Template.bind({});
|
|
27
|
+
Primary.args = {
|
|
28
|
+
heading: "Skicka hem",
|
|
29
|
+
description: "Lorem ipsum dolor sit amet",
|
|
30
|
+
info1label: "Maxvikt",
|
|
31
|
+
info1value: "250g",
|
|
32
|
+
info2label: "Max längd + bredd + höjd",
|
|
33
|
+
info2value: "90cm",
|
|
34
|
+
pricelabel: "Skicka direkt",
|
|
35
|
+
priceamount: "52",
|
|
36
|
+
pricecurrency: "kr"
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Secondary = Template.bind({});
|
|
40
|
+
Secondary.args = {
|
|
41
|
+
heading: "",
|
|
42
|
+
description: "",
|
|
43
|
+
info1label: "Maxvikt",
|
|
44
|
+
info1value: "250g",
|
|
45
|
+
info2label: "Max längd + bredd + höjd",
|
|
46
|
+
info2value: "90cm",
|
|
47
|
+
pricelabel: "Skicka direkt",
|
|
48
|
+
priceamount: "52",
|
|
49
|
+
pricecurrency: "kr"
|
|
50
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import readXlsxFile from 'read-excel-file';
|
|
2
|
+
|
|
3
|
+
async function convertFileFromStream(stream, filterColumnNames = ["what", "deliveryscope"]) {
|
|
4
|
+
const toFilterValue = (x) => x.toLowerCase().replace(/\s+/g, '');
|
|
5
|
+
const sheets = await readXlsxFile(stream, { getSheets: true })
|
|
6
|
+
let dataRows = [];
|
|
7
|
+
let sheetsData = await Promise.all(sheets.map(async (sheet) => { return await readXlsxFile(stream, { sheet: sheet.name }) }));
|
|
8
|
+
|
|
9
|
+
let types = {};
|
|
10
|
+
sheetsData.forEach(sheetData => {
|
|
11
|
+
const firstRow = sheetData.shift().map(x => toFilterValue(x));
|
|
12
|
+
// Set up column for adding options
|
|
13
|
+
firstRow.forEach((col, i) => {
|
|
14
|
+
if (typeof types[col] === "undefined" && filterColumnNames.includes(col)) {
|
|
15
|
+
types[col] = [];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
sheetData.forEach((row, rowindex) => {
|
|
19
|
+
const dataRow = {};
|
|
20
|
+
firstRow.forEach(async (col, i) => {
|
|
21
|
+
const rowVal = row[i];
|
|
22
|
+
dataRow[col] = rowVal;
|
|
23
|
+
// Add to types options
|
|
24
|
+
if (filterColumnNames.includes(col)) {
|
|
25
|
+
const filterVal = toFilterValue(rowVal);
|
|
26
|
+
dataRow[col] = filterVal;
|
|
27
|
+
if (!types[col].includes(filterVal)) {
|
|
28
|
+
types[col].push(filterVal);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
dataRows.push(dataRow);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const fileData = {
|
|
37
|
+
"types": types,
|
|
38
|
+
"data": dataRows
|
|
39
|
+
};
|
|
40
|
+
return fileData;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { convertFileFromStream };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|