@postnord/pn-marketweb-components 1.0.41 → 1.0.44-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/cjs/{MarketWebLoginManager-859590e2.js → MarketWebLoginManager-1282a883.js} +1 -2
  2. package/cjs/{convert-57b3dd5e.js → convert-b8a6d658.js} +55 -0
  3. package/cjs/loader.cjs.js +1 -1
  4. package/cjs/pn-choice-button.cjs.entry.js +39 -0
  5. package/cjs/pn-find-price-result.cjs.entry.js +44 -0
  6. package/cjs/pn-find-price-store-85b100ba.js +23 -0
  7. package/cjs/pn-find-price.cjs.entry.js +260 -0
  8. package/cjs/{pn-choice-button_2.cjs.entry.js → pn-find-service-and-price-result.cjs.entry.js} +0 -33
  9. package/cjs/pn-find-service-and-price.cjs.entry.js +1 -1
  10. package/cjs/pn-language-selector_9.cjs.entry.js +17 -2
  11. package/cjs/pn-market-web-components.cjs.js +1 -1
  12. package/cjs/pn-marketweb-sitefooter.cjs.entry.js +0 -1
  13. package/cjs/pn-marketweb-siteheader.cjs.entry.js +5 -6
  14. package/cjs/pn-product-pricelist.cjs.entry.js +1 -1
  15. package/cjs/pn-profile-selector.cjs.entry.js +1 -1
  16. package/collection/collection-manifest.json +2 -0
  17. package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js +0 -1
  18. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.js +1 -1
  19. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +28 -30
  20. package/collection/components/navigation/pn-language-selector/pn-language-selector.js +15 -0
  21. package/collection/components/widgets/pn-find-price/data.js +68 -0
  22. package/collection/components/widgets/pn-find-price/find-price.stories.js +27 -0
  23. package/collection/components/widgets/pn-find-price/pn-find-price-result.css +3 -0
  24. package/collection/components/widgets/pn-find-price/pn-find-price-result.js +100 -0
  25. package/collection/components/widgets/pn-find-price/pn-find-price-store.js +20 -0
  26. package/collection/components/widgets/pn-find-price/pn-find-price-translations.js +71 -0
  27. package/collection/components/widgets/pn-find-price/pn-find-price-types.js +1 -0
  28. package/collection/components/widgets/pn-find-price/pn-find-price.css +55 -0
  29. package/collection/components/widgets/pn-find-price/pn-find-price.js +212 -0
  30. package/collection/globals/MarketWebLoginManager.js +1 -2
  31. package/collection/globals/shared/productprice/convert.js +55 -1
  32. package/custom-elements/index.d.ts +12 -0
  33. package/custom-elements/index.js +412 -37
  34. package/esm/{MarketWebLoginManager-83f2e86a.js → MarketWebLoginManager-310d2552.js} +1 -2
  35. package/esm/{convert-b49a0857.js → convert-8cce67c4.js} +55 -1
  36. package/esm/loader.js +1 -1
  37. package/esm/{pn-choice-button_2.entry.js → pn-choice-button.entry.js} +1 -39
  38. package/esm/pn-find-price-result.entry.js +40 -0
  39. package/esm/pn-find-price-store-d2053b72.js +21 -0
  40. package/esm/pn-find-price.entry.js +256 -0
  41. package/esm/pn-find-service-and-price-result.entry.js +41 -0
  42. package/esm/pn-find-service-and-price.entry.js +1 -1
  43. package/esm/pn-language-selector_9.entry.js +17 -2
  44. package/esm/pn-market-web-components.js +1 -1
  45. package/esm/pn-marketweb-sitefooter.entry.js +0 -1
  46. package/esm/pn-marketweb-siteheader.entry.js +5 -6
  47. package/esm/pn-product-pricelist.entry.js +1 -1
  48. package/esm/pn-profile-selector.entry.js +1 -1
  49. package/esm-es5/{MarketWebLoginManager-83f2e86a.js → MarketWebLoginManager-310d2552.js} +1 -1
  50. package/esm-es5/{convert-b49a0857.js → convert-8cce67c4.js} +1 -1
  51. package/esm-es5/loader.js +1 -1
  52. package/esm-es5/pn-choice-button.entry.js +1 -0
  53. package/esm-es5/pn-find-price-result.entry.js +1 -0
  54. package/esm-es5/pn-find-price-store-d2053b72.js +1 -0
  55. package/esm-es5/pn-find-price.entry.js +1 -0
  56. package/esm-es5/pn-find-service-and-price-result.entry.js +1 -0
  57. package/esm-es5/pn-find-service-and-price.entry.js +1 -1
  58. package/esm-es5/pn-language-selector_9.entry.js +1 -1
  59. package/esm-es5/pn-market-web-components.js +1 -1
  60. package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
  61. package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
  62. package/esm-es5/pn-product-pricelist.entry.js +1 -1
  63. package/esm-es5/pn-profile-selector.entry.js +1 -1
  64. package/package.json +1 -1
  65. package/pn-market-web-components/{p-e6a209c6.system.entry.js → p-0d0ea574.system.entry.js} +1 -1
  66. package/pn-market-web-components/p-1611123a.system.entry.js +1 -0
  67. package/pn-market-web-components/{p-b8af690a.entry.js → p-22738646.entry.js} +1 -1
  68. package/pn-market-web-components/p-233ca151.system.js +1 -0
  69. package/pn-market-web-components/p-2456901a.js +1 -0
  70. package/pn-market-web-components/p-2e6644ea.system.entry.js +1 -0
  71. package/pn-market-web-components/p-325a7cae.entry.js +1 -0
  72. package/pn-market-web-components/p-38ff23f5.entry.js +1 -0
  73. package/pn-market-web-components/p-4fcabdb8.entry.js +1 -0
  74. package/pn-market-web-components/p-50454694.system.entry.js +1 -0
  75. package/pn-market-web-components/{p-91624bd5.system.js → p-5ce5be4f.system.js} +2 -2
  76. package/pn-market-web-components/p-5f8ef634.entry.js +1 -0
  77. package/pn-market-web-components/p-6ee881ea.system.entry.js +1 -0
  78. package/pn-market-web-components/p-725e4377.entry.js +1 -0
  79. package/pn-market-web-components/{p-21e0e386.js → p-7dd91709.js} +1 -1
  80. package/pn-market-web-components/p-93d8620b.entry.js +1 -0
  81. package/pn-market-web-components/p-a22df959.system.js +1 -1
  82. package/pn-market-web-components/{p-9aca0bae.entry.js → p-a5284c78.entry.js} +1 -1
  83. package/pn-market-web-components/p-b30e348c.system.entry.js +1 -0
  84. package/pn-market-web-components/p-bea2dcc6.entry.js +1 -0
  85. package/pn-market-web-components/p-c30207e6.js +1 -0
  86. package/pn-market-web-components/{p-f4fda846.system.entry.js → p-d133f30d.system.entry.js} +1 -1
  87. package/pn-market-web-components/p-d8882f68.system.entry.js +1 -0
  88. package/pn-market-web-components/p-da370548.system.entry.js +1 -0
  89. package/pn-market-web-components/p-dd4de1a9.entry.js +1 -0
  90. package/pn-market-web-components/{p-e04f8d34.system.entry.js → p-eb75d0cf.system.entry.js} +1 -1
  91. package/pn-market-web-components/{p-58cdf3a6.system.js → p-f1311662.system.js} +1 -1
  92. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  93. package/types/components/navigation/pn-language-selector/pn-language-selector.d.ts +1 -0
  94. package/types/components/widgets/pn-find-price/pn-find-price-result.d.ts +9 -0
  95. package/types/components/widgets/pn-find-price/pn-find-price-store.d.ts +33 -0
  96. package/types/components/widgets/pn-find-price/pn-find-price-translations.d.ts +71 -0
  97. package/types/components/widgets/pn-find-price/pn-find-price-types.d.ts +46 -0
  98. package/types/components/widgets/pn-find-price/pn-find-price.d.ts +16 -0
  99. package/types/components.d.ts +37 -0
  100. package/esm-es5/pn-choice-button_2.entry.js +0 -1
  101. package/pn-market-web-components/p-37801e32.entry.js +0 -1
  102. package/pn-market-web-components/p-3f876199.entry.js +0 -1
  103. package/pn-market-web-components/p-4aa3b95d.entry.js +0 -1
  104. package/pn-market-web-components/p-861210ae.entry.js +0 -1
  105. package/pn-market-web-components/p-a924001f.system.entry.js +0 -1
  106. package/pn-market-web-components/p-ac36097e.system.entry.js +0 -1
  107. package/pn-market-web-components/p-b2383083.system.entry.js +0 -1
  108. package/pn-market-web-components/p-c254cfdf.js +0 -1
  109. package/pn-market-web-components/p-e9d8a991.entry.js +0 -1
  110. package/pn-market-web-components/p-ec1127de.system.entry.js +0 -1
@@ -1725,4 +1725,58 @@ async function convertFileFromStream(stream, filterColumnNames = ["what", "deliv
1725
1725
  return fileData;
1726
1726
  }
1727
1727
 
1728
- export { convertFileFromStream as c };
1728
+ async function convertFileForSizeCategogy(stream, filterColumnNames = ["sizecategory"]) {
1729
+ const toFilterValue = (x) => x.toLowerCase().replace(/\s+/g, '');
1730
+ const sheets = await readXlsxFile(stream, { getSheets: true });
1731
+ let dataRows = [];
1732
+ let sizecategoryColumn;
1733
+ let sheetsData = await Promise.all(sheets.map(async (sheet) => { return await readXlsxFile(stream, { sheet: sheet.name }) }));
1734
+
1735
+ let types = {};
1736
+ sheetsData.forEach(sheetData => {
1737
+ const firstRow = sheetData.shift().map(x => toFilterValue(x));
1738
+ // Set up column for adding options
1739
+ firstRow.forEach((col, i) => {
1740
+ if (typeof types[col] === "undefined" && filterColumnNames.includes(col)) {
1741
+ types[col] = [];
1742
+ }
1743
+ if(col === "sizecategory")
1744
+ sizecategoryColumn = i;
1745
+ });
1746
+
1747
+ sheetData.forEach((row, rowindex) => {
1748
+ // read sizeCategory column of each row and split it to save data for each item
1749
+ const firstColRow = row[sizecategoryColumn];
1750
+ const sizeCatColumnValue = firstColRow.split('/');
1751
+
1752
+ sizeCatColumnValue.forEach((value, j) => {
1753
+ const dataRow = {};
1754
+
1755
+ firstRow.forEach(async (col, i) => {
1756
+ const rowVal = (i === sizecategoryColumn) ? value : row[i];
1757
+ dataRow[col] = rowVal;
1758
+
1759
+ // Add to types options
1760
+ if (filterColumnNames.includes(col)) {
1761
+ const filterVal = toFilterValue(rowVal);
1762
+ dataRow[col] = filterVal;
1763
+
1764
+ if (!types[col].includes(filterVal)) {
1765
+ types[col].push(filterVal);
1766
+ }
1767
+ }
1768
+ });
1769
+ dataRows.push(dataRow);
1770
+ });
1771
+ });
1772
+ });
1773
+
1774
+
1775
+ const fileData = {
1776
+ "types": types,
1777
+ "data": dataRows
1778
+ };
1779
+ return fileData;
1780
+ }
1781
+
1782
+ export { convertFileFromStream as a, convertFileForSizeCategogy as c };
package/esm/loader.js CHANGED
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["pn-marketweb-siteheader",[[4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"token":[1],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"sessionForward":[4,"session-forward"],"cache":[4],"spaMode":[4,"spa-mode"],"i18n":[32],"gotData":[32],"fetchingData":[32],"homePageLink":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"languageOptions":[32],"loginDialog":[32],"minimizeSearch":[32],"loggedIn":[32],"loginManager":[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]]],["pn-find-service-and-price",[[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",[[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-marketweb-sitefooter",[[0,"pn-marketweb-sitefooter",{"market":[1537],"language":[1537],"environment":[1537],"endpoint":[1],"cache":[4],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]]],["pn-bonus-progressbar",[[4,"pn-bonus-progressbar",{"icon":[1],"heading":[1],"theme":[513],"bonuspercentage":[1],"currency":[513],"value":[1538],"min":[1538],"max":[1538],"valuepercentage":[32],"progresspercentage":[32],"levelValues":[32],"currentLevelAdjustedValue":[32]}]]],["pn-filter-checkbox",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-filter-search",[[1,"pn-filter-search",{"disabled":[4],"placeholder":[1],"inputid":[1],"name":[1],"autocomplete":[1],"value":[1],"label":[1],"loading":[4],"button":[1],"light":[4]},[[0,"input","inputHandler"]]]]],["pn-pex-pricefinder",[[0,"pn-pex-pricefinder",{"language":[1],"currency":[1],"apiUrl":[1,"api-url"],"i18n":[32],"fromzip":[32],"tozip":[32],"weight":[32],"when":[32],"response":[32]},[[0,"language","setLanguage"]]]]],["pn-profile-selector",[[0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-sidenav",[[4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["pn-sidenav-level",[[4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]]],["pn-sidenav-link",[[4,"pn-sidenav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"icon":[1],"current":[4],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-product-tile_3",[[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]}]]],["pn-product-pricelist-result",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-bonus-progressbar-level",[[0,"pn-bonus-progressbar-level",{"current":[516],"value":[1538],"bonuspercentage":[1537],"visualpercentage":[1538],"percentage":[32],"max":[32],"min":[32],"currency":[32]}]]],["pn-choice-button_2",[[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-site-footer_2",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-mainnav-link",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9",[[4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}],[4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}],[0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}],[4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"],"navLabel":[1,"nav-label"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopenstate","setMenuOpenState"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}],[0,"pn-marketweb-siteheader-login",{"endpoint":[1],"token":[1],"i18n":[8,"i-1-8n"],"emitEvents":[4,"emit-events"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32],"username":[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":[1537],"heading":[1537],"language":[1537],"i18n":[32]}],[0,"pn-site-selector-item",{"url":[1],"heading":[1],"description":[1],"newwindow":[4]}]]]], options);
13
+ return bootstrapLazy([["pn-marketweb-siteheader",[[4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"token":[1],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"sessionForward":[4,"session-forward"],"cache":[4],"spaMode":[4,"spa-mode"],"i18n":[32],"gotData":[32],"fetchingData":[32],"homePageLink":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"languageOptions":[32],"loginDialog":[32],"minimizeSearch":[32],"loggedIn":[32],"loginManager":[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]]],["pn-find-price",[[0,"pn-find-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"weight":[32],"weightvalue":[32],"sourceData":[32],"sizecategory":[32]}]]],["pn-find-service-and-price",[[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",[[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-marketweb-sitefooter",[[0,"pn-marketweb-sitefooter",{"market":[1537],"language":[1537],"environment":[1537],"endpoint":[1],"cache":[4],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]]],["pn-bonus-progressbar",[[4,"pn-bonus-progressbar",{"icon":[1],"heading":[1],"theme":[513],"bonuspercentage":[1],"currency":[513],"value":[1538],"min":[1538],"max":[1538],"valuepercentage":[32],"progresspercentage":[32],"levelValues":[32],"currentLevelAdjustedValue":[32]}]]],["pn-filter-checkbox",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-filter-search",[[1,"pn-filter-search",{"disabled":[4],"placeholder":[1],"inputid":[1],"name":[1],"autocomplete":[1],"value":[1],"label":[1],"loading":[4],"button":[1],"light":[4]},[[0,"input","inputHandler"]]]]],["pn-pex-pricefinder",[[0,"pn-pex-pricefinder",{"language":[1],"currency":[1],"apiUrl":[1,"api-url"],"i18n":[32],"fromzip":[32],"tozip":[32],"weight":[32],"when":[32],"response":[32]},[[0,"language","setLanguage"]]]]],["pn-profile-selector",[[0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-sidenav",[[4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["pn-sidenav-level",[[4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]]],["pn-sidenav-link",[[4,"pn-sidenav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"icon":[1],"current":[4],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-find-price-result",[[0,"pn-find-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-find-service-and-price-result",[[0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-product-pricelist-result",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-bonus-progressbar-level",[[0,"pn-bonus-progressbar-level",{"current":[516],"value":[1538],"bonuspercentage":[1537],"visualpercentage":[1538],"percentage":[32],"max":[32],"min":[32],"currency":[32]}]]],["pn-site-footer_2",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-choice-button",[[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-mainnav-link",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9",[[4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}],[4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}],[0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}],[4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"],"navLabel":[1,"nav-label"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopenstate","setMenuOpenState"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}],[0,"pn-marketweb-siteheader-login",{"endpoint":[1],"token":[1],"i18n":[8,"i-1-8n"],"emitEvents":[4,"emit-events"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32],"username":[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":[1537],"heading":[1537],"language":[1537],"i18n":[32]}],[0,"pn-site-selector-item",{"url":[1],"heading":[1],"description":[1],"newwindow":[4]}]]],["pn-product-tile_3",[[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);
14
14
  });
15
15
  };
16
16
 
@@ -1,6 +1,4 @@
1
1
  import { r as registerInstance, h, a as Host, g as getElement } from './index-b26d0794.js';
2
- import { s as state } from './pn-find-service-and-price-store-2ddc6cfa.js';
3
- import './index-94746173.js';
4
2
 
5
3
  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}";
6
4
 
@@ -34,40 +32,4 @@ let PnChoiceButton = class {
34
32
  };
35
33
  PnChoiceButton.style = pnChoiceButtonCss;
36
34
 
37
- const pnFindServiceAndPriceResultCss = "";
38
-
39
- let PnfindServiceAndPriceResult = class {
40
- constructor(hostRef) {
41
- registerInstance(this, hostRef);
42
- this.item = null;
43
- this.shownitems = [];
44
- this.weightText = "";
45
- }
46
- componentWillLoad() {
47
- this.composeItems();
48
- }
49
- composeItems() {
50
- this.shownitems = [];
51
- if (this.item.pricestamps) {
52
- this.shownitems.push(Object.assign(Object.assign({}, this.item), { priceagent: null, pricesenddirect: null }));
53
- }
54
- if (this.item.priceagent) {
55
- this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, pricesenddirect: null }));
56
- }
57
- if (this.item.pricesenddirect) {
58
- this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, priceagent: null }));
59
- }
60
- // Parcels are always in KG. Letter KG must be converted from grams
61
- this.weightText = (this.item.what === "parcel") ? this.item.maxweight + 'kg' :
62
- (this.item.what === "letter" && this.item.maxweight > 999) ? Math.round(this.item.maxweight / 1000) + " kg" : this.item.maxweight + " g";
63
- }
64
- render() {
65
- return (h(Host, null, this.shownitems.map((item) => (h("pn-product-tile", null, h("pn-illustration", { slot: "illustration", illustration: item.illustration }), h("div", { slot: "content" }, h("div", { class: "content" }, h("h3", null, item.name), (item.description) ? (h("div", { class: "description" }, item.description)) : null, (item.info) ? (h("div", { class: "description" }, item.info)) : null)), item.maxweight ? (h("pn-product-tile-info", { label: state.i18n.maxweightlabel, text: this.weightText })) : null, item.maximummeasurements ? (h("pn-product-tile-info", { label: state.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null, item.pricestamps ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.stampshopcta, amount: item.pricestamps + '', currency: state.market.currency })) : null, 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, 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, item.note ? (h("small", { slot: "note" }, h("p", null, item.note))) : null)))));
66
- }
67
- static get watchers() { return {
68
- "item": ["composeItems"]
69
- }; }
70
- };
71
- PnfindServiceAndPriceResult.style = pnFindServiceAndPriceResultCss;
72
-
73
- export { PnChoiceButton as pn_choice_button, PnfindServiceAndPriceResult as pn_find_service_and_price_result };
35
+ export { PnChoiceButton as pn_choice_button };
@@ -0,0 +1,40 @@
1
+ import { r as registerInstance, h, a as Host } from './index-b26d0794.js';
2
+ import { s as state } from './pn-find-price-store-d2053b72.js';
3
+ import './index-94746173.js';
4
+
5
+ const pnFindPriceResultCss = "pn-find-price-result .test{margin:3em 0}";
6
+
7
+ let PnfindPriceResult = class {
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.item = null;
11
+ this.shownitems = [];
12
+ this.weightText = "";
13
+ }
14
+ componentWillLoad() {
15
+ this.composeItems();
16
+ }
17
+ composeItems() {
18
+ this.shownitems = [];
19
+ if (this.item.pricestamps) {
20
+ this.shownitems.push(Object.assign(Object.assign({}, this.item), { priceagent: null, pricesenddirect: null }));
21
+ }
22
+ if (this.item.priceagent) {
23
+ this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, pricesenddirect: null }));
24
+ }
25
+ if (this.item.pricesenddirect) {
26
+ this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, priceagent: null }));
27
+ }
28
+ this.weightText = (this.item.maxweight <= 20) ? this.item.maxweight + 'kg' :
29
+ (this.item.maxweight > 999) ? Math.round(this.item.maxweight / 1000) + " kg" : this.item.maxweight + " g";
30
+ }
31
+ render() {
32
+ return (h(Host, null, this.shownitems.map((item) => (h("pn-product-tile", null, h("pn-illustration", { slot: "illustration", illustration: item.illustration }), h("div", { slot: "content" }, h("div", { class: "content" }, h("h3", null, item.name), (item.description) ? (h("div", { class: "description" }, item.description)) : null, (item.info) ? (h("div", { class: "description" }, item.info)) : null)), item.note ? (h("small", { slot: "note" }, h("p", null, item.note))) : null, item.maxweight ? (h("pn-product-tile-info", { label: state.i18n.maxweightlabel, text: this.weightText })) : null, item.maximummeasurements ? (h("pn-product-tile-info", { label: state.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null, 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, item.pricestamps ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.stampshopcta, amount: item.pricestamps + '', currency: state.market.currency })) : null, 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)))));
33
+ }
34
+ static get watchers() { return {
35
+ "item": ["composeItems"]
36
+ }; }
37
+ };
38
+ PnfindPriceResult.style = pnFindPriceResultCss;
39
+
40
+ export { PnfindPriceResult as pn_find_price_result };
@@ -0,0 +1,21 @@
1
+ import { c as createStore } from './index-94746173.js';
2
+
3
+ // Read more about how stencil stores work here: https://stenciljs.com/docs/stencil-store
4
+ const { state, onChange } = createStore({
5
+ i18n: {
6
+ componentheading: '',
7
+ deliveryscopeheading: '',
8
+ sizeheading: '',
9
+ resultlistheading: '',
10
+ weightlabel: '',
11
+ maxweightlabel: '',
12
+ maxmeasurementlabel: '',
13
+ senddirectcta: '',
14
+ stampshopcta: '',
15
+ },
16
+ market: {
17
+ currency: ""
18
+ }
19
+ });
20
+
21
+ export { state as s };
@@ -0,0 +1,256 @@
1
+ import { r as registerInstance, h } from './index-b26d0794.js';
2
+ import { c as convertFileForSizeCategogy } from './convert-8cce67c4.js';
3
+ import { s as state } from './pn-find-price-store-d2053b72.js';
4
+ import './index-94746173.js';
5
+
6
+ const translations = {
7
+ 'sv': {
8
+ 'componentheading': 'Vad vill du skicka?',
9
+ 'deliveryscopeheading': 'Endast leveranser inom Sverige',
10
+ 'sizeheading': 'Hur mycket väger det?',
11
+ 'resultlistheading': 'Några utvalda val',
12
+ 'weightlabel': 'Vikt',
13
+ 'maxweightlabel': 'Maxvikt',
14
+ 'maxmeasurementlabel': 'Maxvolym',
15
+ 'senddirectcta': 'Köp frakt via Skicka Direkt',
16
+ 'stampshopcta': 'Köp frimärken via vår webshop',
17
+ },
18
+ 'en': {
19
+ 'componentheading': 'What do you want to send?',
20
+ 'deliveryscopeheading': 'Deliveries within Sweden only',
21
+ 'sizeheading': 'How much does it weigh?',
22
+ 'resultlistheading': 'Some suitable options for you',
23
+ 'weightlabel': 'Weight',
24
+ 'maxweightlabel': 'Max weight',
25
+ 'maxmeasurementlabel': 'Maximum measurement',
26
+ 'senddirectcta': 'Buy shipping in Send Direct',
27
+ 'stampshopcta': 'Order home stamps from the webshop',
28
+ },
29
+ 'da': {
30
+ 'componentheading': 'Vad vill du skicka?',
31
+ 'deliveryscopeheading': 'Kun leveringer indenfor Sverige',
32
+ 'sizeheading': 'How much does it weigh?',
33
+ 'resultlistheading': 'Some suitable options for you',
34
+ 'weightlabel': 'Vægt',
35
+ 'maxweightlabel': 'Max vægt',
36
+ 'maxmeasurementlabel': 'Maks. Volumen',
37
+ 'senddirectcta': 'Buy shipping in Send Direct',
38
+ 'stampshopcta': 'Order home stamps from the webshop',
39
+ },
40
+ 'no': {
41
+ 'componentheading': 'Vad vill du skicka?',
42
+ 'deliveryscopeheading': 'Kun leveranser innen Sverige',
43
+ 'sizeheading': 'How much does it weigh?',
44
+ 'resultlistheading': 'Some suitable options for you',
45
+ 'weightlabel': 'Vekt',
46
+ 'maxweightlabel': 'Maks vekt',
47
+ 'maxmeasurementlabel': 'Maks volum',
48
+ 'senddirectcta': 'Buy shipping in Send Direct',
49
+ 'stampshopcta': 'Order home stamps from the webshop',
50
+ },
51
+ 'fi': {
52
+ 'componentheading': 'Vad vill du skicka?',
53
+ 'deliveryscopeheading': 'Toimitukset vain Ruotsin sisällä',
54
+ 'sizeheading': 'How much does it weigh?',
55
+ 'resultlistheading': 'Some suitable options for you',
56
+ 'weightlabel': 'Paino',
57
+ 'maxweightlabel': 'Max paino',
58
+ 'maxmeasurementlabel': 'Max äänenvoimakkuus',
59
+ 'senddirectcta': 'Buy shipping in Send Direct',
60
+ 'stampshopcta': 'Order home stamps from the webshop',
61
+ }
62
+ };
63
+ const markets = {
64
+ 'se': {
65
+ "currency": "kr",
66
+ },
67
+ 'dk': {
68
+ "currency": "dk",
69
+ },
70
+ 'fi': {
71
+ "currency": " €",
72
+ },
73
+ 'no': {
74
+ "currency": "kr",
75
+ }
76
+ };
77
+
78
+ const sizeCategories = [
79
+ { name: "Document", value: "document", illustration: "claims", unit: "gram" },
80
+ { name: "Box Of Chocolate", value: "boxofchocolate", illustration: "outgoing", unit: "gram" },
81
+ { name: "Rubber Boots", value: "rubberboots", illustration: "christmas", unit: "combo" },
82
+ { name: "Moving Box", value:"movingbox", illustration: "outgoing", unit: "kgram" },
83
+ ];
84
+
85
+ const weights = {
86
+ "gram": [
87
+ { name: "50g", abbreviation: 'g', value: 50 },
88
+ { name: "100g", abbreviation: 'g', value: 100 },
89
+ { name: "250g", abbreviation: 'g', value: 250 },
90
+ { name: "500g", abbreviation: 'g', value: 500 },
91
+ { name: "1kg", abbreviation: 'kg', value: 1 },
92
+ { name: "2kg", abbreviation: 'kg', value: 2 },
93
+ ],
94
+ "kgram": [
95
+ { name: "1kg", abbreviation: 'kg', value: 1 },
96
+ { name: "2kg", abbreviation: 'kg', value: 2 },
97
+ { name: "3kg", abbreviation: 'kg', value: 3 },
98
+ { name: "4kg", abbreviation: 'kg', value: 4 },
99
+ { name: "5kg", abbreviation: 'kg', value: 5 },
100
+ { name: "6kg", abbreviation: 'kg', value: 6 },
101
+ { name: "7Kg", abbreviation: 'kg', value: 7 },
102
+ { name: "8kg", abbreviation: 'kg', value: 8 },
103
+ { name: "9kg", abbreviation: 'kg', value: 9 },
104
+ { name: "10kg", abbreviation: 'kg', value: 10 },
105
+ { name: "11kg", abbreviation: 'kg', value: 11 },
106
+ { name: "12kg", abbreviation: 'kg', value: 12 },
107
+ { name: "13kg", abbreviation: 'kg', value: 13 },
108
+ { name: "14kg", abbreviation: 'kg', value: 14 },
109
+ { name: "15kg", abbreviation: 'kg', value: 15 },
110
+ { name: "16kg", abbreviation: 'kg', value: 16 },
111
+ { name: "17kg", abbreviation: 'kg', value: 17 },
112
+ { name: "18kg", abbreviation: 'kg', value: 18 },
113
+ { name: "20kg", abbreviation: 'kg', value: 20 },
114
+ ],
115
+ "combo": [
116
+ { name: "50g", abbreviation: 'g', value: 50 },
117
+ { name: "100g", abbreviation: 'g', value: 100 },
118
+ { name: "250g", abbreviation: 'g', value: 250 },
119
+ { name: "500g", abbreviation: 'g', value: 500 },
120
+ { name: "1kg", abbreviation: 'kg', value: 1 },
121
+ { name: "2kg", abbreviation: 'kg', value: 2 },
122
+ { name: "3kg", abbreviation: 'kg', value: 3 },
123
+ { name: "4kg", abbreviation: 'kg', value: 4 },
124
+ { name: "5kg", abbreviation: 'kg', value: 5 },
125
+ { name: "6kg", abbreviation: 'kg', value: 6 },
126
+ { name: "7Kg", abbreviation: 'kg', value: 7 },
127
+ { name: "8kg", abbreviation: 'kg', value: 8 },
128
+ { name: "9kg", abbreviation: 'kg', value: 9 },
129
+ { name: "10kg", abbreviation: 'kg', value: 10 },
130
+ { name: "11kg", abbreviation: 'kg', value: 11 },
131
+ { name: "12kg", abbreviation: 'kg', value: 12 },
132
+ { name: "13kg", abbreviation: 'kg', value: 13 },
133
+ { name: "14kg", abbreviation: 'kg', value: 14 },
134
+ { name: "15kg", abbreviation: 'kg', value: 15 },
135
+ { name: "16kg", abbreviation: 'kg', value: 16 },
136
+ { name: "17kg", abbreviation: 'kg', value: 17 },
137
+ { name: "18kg", abbreviation: 'kg', value: 18 },
138
+ { name: "20kg", abbreviation: 'kg', value: 20 },
139
+ ]
140
+ };
141
+
142
+ const pnFindPriceCss = "pn-find-price .findprice-form{max-width:50em;margin:0 auto}pn-find-price h2,pn-find-price .heading{text-align:center;font-size:1.5em;line-height:1.1;font-weight:bold;margin-bottom:1rem}pn-find-price .sizecategory{text-align:center;margin-bottom:3rem}pn-find-price .weightoption{display:-ms-flexbox;display:flex;gap:1em}pn-find-price .weightoption-input{width:5em;position:relative}pn-find-price .weightoption-input input::-webkit-outer-spin-button,pn-find-price .weightoption-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}pn-find-price .weightoption-input-abbreviation{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:1.2em;margin-top:1.55rem;font-weight:500}pn-find-price .weightoption-range{-ms-flex-positive:1;flex-grow:1;-ms-flex-item-align:end;align-self:flex-end;position:relative;top:0.5em}pn-find-price .weightoption-range input{width:calc(100% - 1.5em)}pn-find-price .weightoption-range datalist{width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75em}pn-find-price .resultlist{margin:3em 0}";
143
+
144
+ let PnfindPrice = class {
145
+ constructor(hostRef) {
146
+ registerInstance(this, hostRef);
147
+ this.source = "https://com-integration.postnord.com/globalassets/global/prices/sv-findprice.xlsx";
148
+ this.language = "sv";
149
+ this.market = "se";
150
+ this.filteredItems = [];
151
+ this.weight = { value: 0, name: "" };
152
+ this.weightvalue = 0;
153
+ this.sourceData = { types: [], data: [] };
154
+ this.sizecategory = { value: "", name: "", icon: "", unit: "" };
155
+ }
156
+ componentWillLoad() {
157
+ this.setState();
158
+ this.getDataSource();
159
+ }
160
+ async getDataSource() {
161
+ const cacheBusting = `?cache=${Math.floor(Math.random() * (10000 - 1) + 1)}`;
162
+ const req = await fetch(this.source + cacheBusting);
163
+ const reqbody = await req.blob();
164
+ try {
165
+ const convertedData = await convertFileForSizeCategogy(reqbody);
166
+ this.sourceData = convertedData;
167
+ this.filterItems();
168
+ }
169
+ catch (e) {
170
+ console.log('Unable to parse data');
171
+ }
172
+ }
173
+ setState() {
174
+ if (this.market) {
175
+ state.market = markets[this.market];
176
+ }
177
+ if (this.language && translations[this.language]) {
178
+ state.i18n = translations[this.language];
179
+ }
180
+ }
181
+ filterItems() {
182
+ var _a;
183
+ if (!((_a = this.sourceData) === null || _a === void 0 ? void 0 : _a.data)) {
184
+ console.log('Data has not yet been loaded');
185
+ return;
186
+ }
187
+ const deliveryScopeData = this.sourceData.data.filter((x) => x.deliveryscope === "Sweden");
188
+ if (!this.sizecategory) {
189
+ return;
190
+ }
191
+ const sizeItemData = deliveryScopeData.filter((x) => x.sizecategory === this.sizecategory.value);
192
+ if (!this.weight || !this.weight.value) {
193
+ return;
194
+ }
195
+ const comparisonWeight = this.weight.value <= 20 ? this.weight.value * 1000 : this.weight.value;
196
+ let weightFilteredData = sizeItemData.filter(x => (x.maxweight <= 20 ? x.maxweight * 1000 : x.maxweight) === comparisonWeight);
197
+ // if no value found select the next available value
198
+ if (weightFilteredData.length === 0) {
199
+ weightFilteredData = sizeItemData.filter(x => (x.maxweight <= 20 ? x.maxweight * 1000 : x.maxweight) >= comparisonWeight);
200
+ if (weightFilteredData.length > 0) {
201
+ //sort based on the maxvalue
202
+ weightFilteredData.sort((a, b) => { return (a.maxweight - b.maxweight); });
203
+ // map to get the next unique item
204
+ const uniqueWeightOptions = [...new Map(weightFilteredData.reverse().map(item => [item["id"], item])).values()];
205
+ if (uniqueWeightOptions.length > 0) {
206
+ weightFilteredData = uniqueWeightOptions;
207
+ }
208
+ }
209
+ }
210
+ this.filteredItems = weightFilteredData;
211
+ }
212
+ render() {
213
+ return (h("div", null, h("div", { class: "findprice-form" }, h("div", null, (h("div", { class: "heading" }, state.i18n.deliveryscopeheading))), h("div", null, (h("div", { class: "heading" }, state.i18n.componentheading)), h("div", { class: "sizecategory" }, sizeCategories.map((sizeCategory) => (h("pn-choice-button", { choiceid: sizeCategory.value, value: sizeCategory.value, name: "sizecategory", type: "radio", checked: sizeCategory.value === this.sizecategory.value, onChange: () => {
214
+ this.sizecategory = sizeCategories.filter(x => x.value === sizeCategory.value)[0];
215
+ if (this.weight.value === 0) {
216
+ this.weight = weights[this.sizecategory.unit][0];
217
+ this.weightvalue = this.weight.value;
218
+ }
219
+ } }, h("pn-illustration", { illustration: sizeCategory.illustration }), " ", sizeCategory.name))))), (this.sizecategory.value && weights[this.sizecategory.unit]) ? (h("div", null, (state.i18n.sizeheading) ? (h("div", { class: "heading" }, state.i18n.sizeheading)) : null, h("div", { class: "weightoption" }, h("div", { class: "weightoption-input" }, h("pn-input", { inputid: "weightvalue", name: "weightvalue", type: "number", label: state.i18n.weightlabel, value: this.weightvalue, onChange: (e) => {
220
+ if (e && e.target && e.target.value) {
221
+ const weightNum = parseInt(e.target.value, 10);
222
+ if (!isNaN(weightNum)) {
223
+ let matchingWeights = weights[this.sizecategory.unit].filter((x) => {
224
+ let weightInGrams = (x.abbreviation === "kg") ? x.value * 1000 : x.value;
225
+ return weightInGrams >= weightNum;
226
+ });
227
+ if (matchingWeights && matchingWeights.length > 0) {
228
+ this.weight = matchingWeights[0];
229
+ this.weightvalue = this.weight.value;
230
+ }
231
+ }
232
+ }
233
+ } }), h("span", { class: "weightoption-input-abbreviation" }, this.weight.abbreviation)), h("div", { class: "weightoption-range" }, h("input", { type: "range", id: "weightrange", name: "weightrange", list: "weightlist", value: (!this.weight.value) ? 0 : weights[this.sizecategory.unit].findIndex((x) => x.value === this.weightvalue), onChange: (e) => {
234
+ const value = e.target.value;
235
+ this.weight = weights[this.sizecategory.unit][value];
236
+ this.weightvalue = this.weight.value;
237
+ }, min: "0",
238
+ // max={ weights[this.postagetype.value][weights[this.postagetype.value].length - 1].value }
239
+ max: weights[this.sizecategory.unit].length - 1 }), h("datalist", { id: "weightlist" }, weights[this.sizecategory.unit].map((weight, weightindex) => {
240
+ let labelText = weight.name;
241
+ if (weights[this.sizecategory.unit].length > 6) {
242
+ labelText = (weightindex % 5 === 0 || weightindex === 0 || weightindex === weights[this.sizecategory.unit].length - 1) ? weight.name : '';
243
+ }
244
+ return (h("option", Object.assign({ value: weightindex }, (labelText ? { label: labelText } : {}))));
245
+ })))))) : null), (this.filteredItems && this.filteredItems.length > 0) ? (h("div", { class: "resultlist" }, (state.i18n.resultlistheading) ? (h("div", { class: "heading" }, state.i18n.resultlistheading)) : null, this.filteredItems.map((item) => (h("div", null, h("pn-find-price-result", { item: item })))))) : null));
246
+ }
247
+ static get watchers() { return {
248
+ "market": ["setState"],
249
+ "language": ["setState"],
250
+ "weightvalue": ["filterItems"],
251
+ "sizecategory": ["filterItems"]
252
+ }; }
253
+ };
254
+ PnfindPrice.style = pnFindPriceCss;
255
+
256
+ export { PnfindPrice as pn_find_price };
@@ -0,0 +1,41 @@
1
+ import { r as registerInstance, h, a as Host } from './index-b26d0794.js';
2
+ import { s as state } from './pn-find-service-and-price-store-2ddc6cfa.js';
3
+ import './index-94746173.js';
4
+
5
+ const pnFindServiceAndPriceResultCss = "";
6
+
7
+ let PnfindServiceAndPriceResult = class {
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.item = null;
11
+ this.shownitems = [];
12
+ this.weightText = "";
13
+ }
14
+ componentWillLoad() {
15
+ this.composeItems();
16
+ }
17
+ composeItems() {
18
+ this.shownitems = [];
19
+ if (this.item.pricestamps) {
20
+ this.shownitems.push(Object.assign(Object.assign({}, this.item), { priceagent: null, pricesenddirect: null }));
21
+ }
22
+ if (this.item.priceagent) {
23
+ this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, pricesenddirect: null }));
24
+ }
25
+ if (this.item.pricesenddirect) {
26
+ this.shownitems.push(Object.assign(Object.assign({}, this.item), { pricestamps: null, priceagent: null }));
27
+ }
28
+ // Parcels are always in KG. Letter KG must be converted from grams
29
+ this.weightText = (this.item.what === "parcel") ? this.item.maxweight + 'kg' :
30
+ (this.item.what === "letter" && this.item.maxweight > 999) ? Math.round(this.item.maxweight / 1000) + " kg" : this.item.maxweight + " g";
31
+ }
32
+ render() {
33
+ return (h(Host, null, this.shownitems.map((item) => (h("pn-product-tile", null, h("pn-illustration", { slot: "illustration", illustration: item.illustration }), h("div", { slot: "content" }, h("div", { class: "content" }, h("h3", null, item.name), (item.description) ? (h("div", { class: "description" }, item.description)) : null, (item.info) ? (h("div", { class: "description" }, item.info)) : null)), item.maxweight ? (h("pn-product-tile-info", { label: state.i18n.maxweightlabel, text: this.weightText })) : null, item.maximummeasurements ? (h("pn-product-tile-info", { label: state.i18n.maxmeasurementlabel, text: item.maximummeasurements })) : null, item.pricestamps ? (h("pn-product-tile-price", { slot: "price", label: state.i18n.stampshopcta, amount: item.pricestamps + '', currency: state.market.currency })) : null, 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, 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, item.note ? (h("small", { slot: "note" }, h("p", null, item.note))) : null)))));
34
+ }
35
+ static get watchers() { return {
36
+ "item": ["composeItems"]
37
+ }; }
38
+ };
39
+ PnfindServiceAndPriceResult.style = pnFindServiceAndPriceResultCss;
40
+
41
+ export { PnfindServiceAndPriceResult as pn_find_service_and_price_result };
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h } from './index-b26d0794.js';
2
- import { c as convertFileFromStream } from './convert-b49a0857.js';
2
+ import { a as convertFileFromStream } from './convert-8cce67c4.js';
3
3
  import { s as state } from './pn-find-service-and-price-store-2ddc6cfa.js';
4
4
  import './index-94746173.js';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, a as Host, g as getElement } from './index-b26d0794.js';
2
2
  import { s as state, o as onChange } from './pn-mainnav-store-c14ad7e8.js';
3
- import { M as MarketWebLoginManager } from './MarketWebLoginManager-83f2e86a.js';
3
+ import { M as MarketWebLoginManager } from './MarketWebLoginManager-310d2552.js';
4
4
  import './index-94746173.js';
5
5
 
6
6
  const translations$1 = {
@@ -33,6 +33,7 @@ let PnlanguageSelector = class {
33
33
  this.options = [];
34
34
  }
35
35
  componentWillLoad() {
36
+ this.setInitialSelectedLanguageName();
36
37
  this.setTranslations();
37
38
  }
38
39
  componentDidLoad() {
@@ -42,6 +43,20 @@ let PnlanguageSelector = class {
42
43
  this.setSelectedLanguageName();
43
44
  this.addEventBindingsToOptions();
44
45
  }
46
+ setInitialSelectedLanguageName() {
47
+ if (!window.Intl || !this.value) {
48
+ return;
49
+ }
50
+ const langs = new Intl.DisplayNames([this.value], { type: 'language' });
51
+ if (!langs) {
52
+ return;
53
+ }
54
+ const languageName = langs.of(this.value);
55
+ if (!languageName) {
56
+ return;
57
+ }
58
+ this.selectedLanguageName = languageName.charAt(0).toUpperCase() + languageName.slice(1);
59
+ }
45
60
  addEventBindingsToOptions() {
46
61
  const options = [].slice.apply(this.hostElement.querySelectorAll("pn-language-selector-option"));
47
62
  options.map((option) => {
@@ -437,7 +452,7 @@ let PnMarketwebSiteheaderLogin = class {
437
452
  : (h("ul", null, h("li", null, h("pn-button", { href: this.loginManager.getLoginUrl(this.loginDialog.loginUrl), target: "_top" }, this.loginDialog.loginLinkText)), h("li", null, h("pn-button", { href: this.loginDialog.registerUrl, target: "_top", appearance: "light", variant: "outlined" }, this.loginDialog.createLoginLinkText)))))
438
453
  :
439
454
  h("div", null, h("ul", null, this.loginDialog.loggedInLinks.map((link) => {
440
- const isLogoutLink = link.href.indexOf('logout');
455
+ const isLogoutLink = link.href.indexOf('logout') !== -1;
441
456
  const href = (isLogoutLink) ? this.loginManager.getLogoutUrl(link.href.replace('logout', '').replace('http://window.location.href/?', '').replace('https://window.location.href/?', '')) : link.href;
442
457
  return (h("li", null, h("pn-button", Object.assign({ href: href, id: this.uniqueId(link.linkText) }, (link.openInNewWindow && { target: '_blank' }), this.linkAppearanceAttributes(link), { onClick: () => {
443
458
  if (isLogoutLink) {
@@ -53,5 +53,5 @@ const patchCloneNodeFix = (HTMLElementPrototype) => {
53
53
  };
54
54
 
55
55
  patchBrowser().then(options => {
56
- return bootstrapLazy([["pn-marketweb-siteheader",[[4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"token":[1],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"sessionForward":[4,"session-forward"],"cache":[4],"spaMode":[4,"spa-mode"],"i18n":[32],"gotData":[32],"fetchingData":[32],"homePageLink":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"languageOptions":[32],"loginDialog":[32],"minimizeSearch":[32],"loggedIn":[32],"loginManager":[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]]],["pn-find-service-and-price",[[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",[[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-marketweb-sitefooter",[[0,"pn-marketweb-sitefooter",{"market":[1537],"language":[1537],"environment":[1537],"endpoint":[1],"cache":[4],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]]],["pn-bonus-progressbar",[[4,"pn-bonus-progressbar",{"icon":[1],"heading":[1],"theme":[513],"bonuspercentage":[1],"currency":[513],"value":[1538],"min":[1538],"max":[1538],"valuepercentage":[32],"progresspercentage":[32],"levelValues":[32],"currentLevelAdjustedValue":[32]}]]],["pn-filter-checkbox",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-filter-search",[[1,"pn-filter-search",{"disabled":[4],"placeholder":[1],"inputid":[1],"name":[1],"autocomplete":[1],"value":[1],"label":[1],"loading":[4],"button":[1],"light":[4]},[[0,"input","inputHandler"]]]]],["pn-pex-pricefinder",[[0,"pn-pex-pricefinder",{"language":[1],"currency":[1],"apiUrl":[1,"api-url"],"i18n":[32],"fromzip":[32],"tozip":[32],"weight":[32],"when":[32],"response":[32]},[[0,"language","setLanguage"]]]]],["pn-profile-selector",[[0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-sidenav",[[4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["pn-sidenav-level",[[4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]]],["pn-sidenav-link",[[4,"pn-sidenav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"icon":[1],"current":[4],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-product-tile_3",[[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]}]]],["pn-product-pricelist-result",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-bonus-progressbar-level",[[0,"pn-bonus-progressbar-level",{"current":[516],"value":[1538],"bonuspercentage":[1537],"visualpercentage":[1538],"percentage":[32],"max":[32],"min":[32],"currency":[32]}]]],["pn-choice-button_2",[[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-site-footer_2",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-mainnav-link",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9",[[4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}],[4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}],[0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}],[4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"],"navLabel":[1,"nav-label"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopenstate","setMenuOpenState"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}],[0,"pn-marketweb-siteheader-login",{"endpoint":[1],"token":[1],"i18n":[8,"i-1-8n"],"emitEvents":[4,"emit-events"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32],"username":[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":[1537],"heading":[1537],"language":[1537],"i18n":[32]}],[0,"pn-site-selector-item",{"url":[1],"heading":[1],"description":[1],"newwindow":[4]}]]]], options);
56
+ return bootstrapLazy([["pn-marketweb-siteheader",[[4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"token":[1],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"sessionForward":[4,"session-forward"],"cache":[4],"spaMode":[4,"spa-mode"],"i18n":[32],"gotData":[32],"fetchingData":[32],"homePageLink":[32],"menuItems":[32],"siteDefinition":[32],"search":[32],"siteSelector":[32],"languageSelector":[32],"languageOptions":[32],"loginDialog":[32],"minimizeSearch":[32],"loggedIn":[32],"loginManager":[32]},[[0,"setLanguage","onLanguageSelectorChange"],[0,"loginStateChange","onLoginStateChange"],[9,"resize","handleResize"]]]]],["pn-find-price",[[0,"pn-find-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"weight":[32],"weightvalue":[32],"sourceData":[32],"sizecategory":[32]}]]],["pn-find-service-and-price",[[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",[[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-marketweb-sitefooter",[[0,"pn-marketweb-sitefooter",{"market":[1537],"language":[1537],"environment":[1537],"endpoint":[1],"cache":[4],"siteDefinition":[32],"footerContent":[32],"i18n":[32],"gotData":[32],"fetchingData":[32]}]]],["pn-bonus-progressbar",[[4,"pn-bonus-progressbar",{"icon":[1],"heading":[1],"theme":[513],"bonuspercentage":[1],"currency":[513],"value":[1538],"min":[1538],"max":[1538],"valuepercentage":[32],"progresspercentage":[32],"levelValues":[32],"currentLevelAdjustedValue":[32]}]]],["pn-filter-checkbox",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-filter-search",[[1,"pn-filter-search",{"disabled":[4],"placeholder":[1],"inputid":[1],"name":[1],"autocomplete":[1],"value":[1],"label":[1],"loading":[4],"button":[1],"light":[4]},[[0,"input","inputHandler"]]]]],["pn-pex-pricefinder",[[0,"pn-pex-pricefinder",{"language":[1],"currency":[1],"apiUrl":[1,"api-url"],"i18n":[32],"fromzip":[32],"tozip":[32],"weight":[32],"when":[32],"response":[32]},[[0,"language","setLanguage"]]]]],["pn-profile-selector",[[0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-sidenav",[[4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["pn-sidenav-level",[[4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]]],["pn-sidenav-link",[[4,"pn-sidenav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"icon":[1],"current":[4],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-find-price-result",[[0,"pn-find-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-find-service-and-price-result",[[0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-product-pricelist-result",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-bonus-progressbar-level",[[0,"pn-bonus-progressbar-level",{"current":[516],"value":[1538],"bonuspercentage":[1537],"visualpercentage":[1538],"percentage":[32],"max":[32],"min":[32],"currency":[32]}]]],["pn-site-footer_2",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-choice-button",[[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-mainnav-link",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9",[[4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}],[4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}],[0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}],[4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"],"navLabel":[1,"nav-label"]},[[0,"language","setLanguage"],[0,"market","setMarket"],[0,"menuLanguageChange","onLanguageChange"],[0,"setmenuopenstate","setMenuOpenState"],[0,"openMenuLevelChange","onOpenMenuLevelChange"]]],[4,"pn-mainnav-list",{"heading":[1],"linkCount":[32]}],[0,"pn-marketweb-siteheader-login",{"endpoint":[1],"token":[1],"i18n":[8,"i-1-8n"],"emitEvents":[4,"emit-events"],"loginDialog":[1040],"loginManager":[32],"loggedIn":[32],"toggleButtonText":[32],"username":[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":[1537],"heading":[1537],"language":[1537],"i18n":[32]}],[0,"pn-site-selector-item",{"url":[1],"heading":[1],"description":[1],"newwindow":[4]}]]],["pn-product-tile_3",[[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);
57
57
  });
@@ -127,7 +127,6 @@ let PnMarketwebSiteheader = class {
127
127
  await this.setStateFromData(data);
128
128
  }
129
129
  onFetchRefreshed(data) {
130
- console.log('Data was updated after request', data);
131
130
  this.setStateFromData(data);
132
131
  }
133
132
  getLinkContentByType(linkType = "") {