@postnord/pn-marketweb-components 1.0.40 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/loader.cjs.js +1 -1
- package/cjs/mockresponse-c40ea527.js +24 -0
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-pex-pricefinder.cjs.entry.js +121 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/widgets/pn-pex-pricefinder/pex-pricefinder.stories.js +22 -0
- package/collection/components/widgets/pn-pex-pricefinder/pn-pex-pricefinder.css +59 -0
- package/collection/components/widgets/pn-pex-pricefinder/pn-pex-pricefinder.js +188 -0
- package/collection/components/widgets/pn-pex-pricefinder/translations.js +22 -0
- package/collection/components/widgets/pn-pex-pricefinder/types.js +1 -0
- package/custom-elements/index.d.ts +6 -0
- package/custom-elements/index.js +133 -16
- package/custom-elements/mockresponse.js +20 -0
- package/esm/loader.js +1 -1
- package/esm/mockresponse-e2c08e66.js +20 -0
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-pex-pricefinder.entry.js +117 -0
- package/esm-es5/loader.js +1 -1
- package/esm-es5/mockresponse-e2c08e66.js +1 -0
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-pex-pricefinder.entry.js +1 -0
- package/package.json +2 -2
- package/pn-market-web-components/p-33cefc5e.system.entry.js +1 -0
- package/pn-market-web-components/p-84d9f552.system.js +1 -0
- package/pn-market-web-components/p-942f590f.entry.js +1 -0
- package/pn-market-web-components/p-a22df959.system.js +1 -1
- package/pn-market-web-components/p-c25ada49.js +1 -0
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/widgets/pn-pex-pricefinder/pn-pex-pricefinder.d.ts +30 -0
- package/types/components/widgets/pn-pex-pricefinder/translations.d.ts +22 -0
- package/types/components/widgets/pn-pex-pricefinder/types.d.ts +27 -0
- package/types/components.d.ts +37 -0
package/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[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.cjs",[[0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]]],["pn-product-pricelist.cjs",[[4,"pn-product-pricelist",{"source":[1],"language":[1025],"market":[1025],"productid":[1],"filteredItems":[32],"sourceData":[32],"gotData":[32],"loading":[32],"postagetype":[32],"weight":[32],"weightvalue":[32]}]]],["pn-marketweb-sitefooter.cjs",[[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.cjs",[[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.cjs",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-filter-search.cjs",[[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-profile-selector.cjs",[[0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-sidenav.cjs",[[4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["pn-sidenav-level.cjs",[[4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]]],["pn-sidenav-link.cjs",[[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.cjs",[[4,"pn-product-tile"],[0,"pn-product-tile-info",{"label":[1],"text":[1],"icon":[1]}],[0,"pn-product-tile-price",{"label":[1],"amount":[1],"currency":[1],"url":[1]}]]],["pn-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-bonus-progressbar-level.cjs",[[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.cjs",[[0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}],[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9.cjs",[[4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}],[4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}],[0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}],[4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"],"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);
|
|
17
|
+
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[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.cjs",[[0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]]],["pn-product-pricelist.cjs",[[4,"pn-product-pricelist",{"source":[1],"language":[1025],"market":[1025],"productid":[1],"filteredItems":[32],"sourceData":[32],"gotData":[32],"loading":[32],"postagetype":[32],"weight":[32],"weightvalue":[32]}]]],["pn-marketweb-sitefooter.cjs",[[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.cjs",[[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.cjs",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-filter-search.cjs",[[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.cjs",[[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.cjs",[[0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-sidenav.cjs",[[4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["pn-sidenav-level.cjs",[[4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]]],["pn-sidenav-link.cjs",[[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.cjs",[[4,"pn-product-tile"],[0,"pn-product-tile-info",{"label":[1],"text":[1],"icon":[1]}],[0,"pn-product-tile-price",{"label":[1],"amount":[1],"currency":[1],"url":[1]}]]],["pn-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-bonus-progressbar-level.cjs",[[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.cjs",[[0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}],[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9.cjs",[[4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}],[4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}],[0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}],[4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"],"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);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const request = {
|
|
4
|
+
timestamp: 1344531600
|
|
5
|
+
};
|
|
6
|
+
const query = {
|
|
7
|
+
from: "14321",
|
|
8
|
+
to: "21421",
|
|
9
|
+
weight: "2500",
|
|
10
|
+
when: "2023-05-24T12:00:00Z"
|
|
11
|
+
};
|
|
12
|
+
const data = {
|
|
13
|
+
value: 2000
|
|
14
|
+
};
|
|
15
|
+
const mockresponse = {
|
|
16
|
+
request: request,
|
|
17
|
+
query: query,
|
|
18
|
+
data: data
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.data = data;
|
|
22
|
+
exports.default = mockresponse;
|
|
23
|
+
exports.query = query;
|
|
24
|
+
exports.request = request;
|
|
@@ -55,5 +55,5 @@ const patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
patchBrowser().then(options => {
|
|
58
|
-
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[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.cjs",[[0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]]],["pn-product-pricelist.cjs",[[4,"pn-product-pricelist",{"source":[1],"language":[1025],"market":[1025],"productid":[1],"filteredItems":[32],"sourceData":[32],"gotData":[32],"loading":[32],"postagetype":[32],"weight":[32],"weightvalue":[32]}]]],["pn-marketweb-sitefooter.cjs",[[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.cjs",[[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.cjs",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-filter-search.cjs",[[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-profile-selector.cjs",[[0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-sidenav.cjs",[[4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["pn-sidenav-level.cjs",[[4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]]],["pn-sidenav-link.cjs",[[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.cjs",[[4,"pn-product-tile"],[0,"pn-product-tile-info",{"label":[1],"text":[1],"icon":[1]}],[0,"pn-product-tile-price",{"label":[1],"amount":[1],"currency":[1],"url":[1]}]]],["pn-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-bonus-progressbar-level.cjs",[[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.cjs",[[0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}],[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9.cjs",[[4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}],[4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}],[0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}],[4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"],"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);
|
|
58
|
+
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[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.cjs",[[0,"pn-find-service-and-price",{"source":[1],"language":[1025],"market":[1025],"filteredItems":[32],"postagetype":[32],"weight":[32],"weightvalue":[32],"deliveryscope":[32],"sourceData":[32]}]]],["pn-product-pricelist.cjs",[[4,"pn-product-pricelist",{"source":[1],"language":[1025],"market":[1025],"productid":[1],"filteredItems":[32],"sourceData":[32],"gotData":[32],"loading":[32],"postagetype":[32],"weight":[32],"weightvalue":[32]}]]],["pn-marketweb-sitefooter.cjs",[[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.cjs",[[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.cjs",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-filter-search.cjs",[[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.cjs",[[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.cjs",[[0,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"spamode":[4],"loginManager":[32],"loggedIn":[32],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-sidenav.cjs",[[4,"pn-sidenav",{"language":[1],"navLabel":[1,"nav-label"],"i18n":[32]},[[0,"language","setLanguage"],[0,"openSubMenuLevelChange","onOpenSubMenuLevelChange"]]]]],["pn-sidenav-level.cjs",[[4,"pn-sidenav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"alignment":[32]}]]],["pn-sidenav-link.cjs",[[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.cjs",[[4,"pn-product-tile"],[0,"pn-product-tile-info",{"label":[1],"text":[1],"icon":[1]}],[0,"pn-product-tile-price",{"label":[1],"amount":[1],"currency":[1],"url":[1]}]]],["pn-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"shownitems":[16],"weightText":[32]}]]],["pn-bonus-progressbar-level.cjs",[[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.cjs",[[0,"pn-find-service-and-price-result",{"item":[1040],"shownitems":[16],"weightText":[32]}],[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1]}],[4,"pn-site-footer-col"]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-language-selector_9.cjs",[[4,"pn-mainnav-level",{"level":[32],"levelId":[32],"isOpen":[32],"parentName":[32],"parentHref":[32],"parentLinkId":[32],"listCount":[32],"alignment":[32]}],[4,"pn-language-selector",{"value":[1537],"selectedLanguageName":[32],"options":[32],"i18n":[32]}],[0,"pn-language-selector-option",{"name":[1],"code":[1],"url":[1],"selected":[4],"currentLanguage":[1,"current-language"]}],[4,"pn-mainnav",{"market":[1],"language":[1],"navigationId":[1,"navigation-id"],"openMenu":[1028,"open-menu"],"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);
|
|
59
59
|
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-cd08e313.js');
|
|
6
|
+
|
|
7
|
+
const translations = {
|
|
8
|
+
'sv': {
|
|
9
|
+
"heading": "Beräkna kostnad med PEX Bud",
|
|
10
|
+
"labelFrom": "Från postkod",
|
|
11
|
+
"labelTo": "Till postkod",
|
|
12
|
+
"zipPlaceholder": "Ex. 12831",
|
|
13
|
+
"labelWeight": "Vikt (i gram)",
|
|
14
|
+
"weightPlaceholder": "Ex. 1000",
|
|
15
|
+
"labelWhen": "När",
|
|
16
|
+
"submitButtonText": "Beräkna pris"
|
|
17
|
+
},
|
|
18
|
+
'en': {
|
|
19
|
+
"heading": "Calculate cost with PEX Bud",
|
|
20
|
+
"labelFrom": "From zip",
|
|
21
|
+
"labelTo": "To zip",
|
|
22
|
+
"zipPlaceholder": "Ex. 12831",
|
|
23
|
+
"labelWeight": "Weight (in grams)",
|
|
24
|
+
"weightPlaceholder": "Ex. 1000",
|
|
25
|
+
"labelWhen": "When",
|
|
26
|
+
"submitButtonText": "Calculate price"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const pnPexPricefinderCss = ".pex-pricefinder-top{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.pex-pricefinder-top pn-illustration{width:5.5rem;height:5.5rem;margin-right:1.6rem}.pex-pricefinder-form{margin:1.6rem 0 0 0;padding:0;border:0}.pex-pricefinder-form fieldset{margin:0;padding:0;border:0}.pex-pricefinder-form fieldset+fieldset{margin-top:1.6rem}.pex-pricefinder-form fieldset>div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:1em}.pex-pricefinder-form fieldset>div>*{-ms-flex-positive:1;flex-grow:1;width:100%}.pex-pricefinder-form pn-button{-ms-flex-item-align:end;align-self:end;margin-left:auto}.pex-pricefinder-form .datepicker{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}.pex-pricefinder-form .datepicker label{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end;cursor:pointer;-webkit-transition:color 0.2s;transition:color 0.2s}.pex-pricefinder-form .datepicker pn-date-picker{width:100%}.pex-pricefinder-response{margin-top:2.4rem;text-align:center;font-size:2.4em}";
|
|
31
|
+
|
|
32
|
+
let PnPexPricefinder = class {
|
|
33
|
+
constructor(hostRef) {
|
|
34
|
+
index.registerInstance(this, hostRef);
|
|
35
|
+
/** Specifies which language we want to show component in (sv,da,fi,no,en) */
|
|
36
|
+
this.language = "sv";
|
|
37
|
+
/** Currency (Kr, €)*/
|
|
38
|
+
this.currency = "Kr";
|
|
39
|
+
/** API Url */
|
|
40
|
+
this.apiUrl = "/api/pex/order";
|
|
41
|
+
this.i18n = translations.sv;
|
|
42
|
+
this.fromzip = null;
|
|
43
|
+
this.tozip = null;
|
|
44
|
+
this.weight = 100;
|
|
45
|
+
this.when = (new Date()).toISOString().split('T')[0];
|
|
46
|
+
this.response = null;
|
|
47
|
+
}
|
|
48
|
+
componentWillLoad() {
|
|
49
|
+
this.init();
|
|
50
|
+
}
|
|
51
|
+
async init() {
|
|
52
|
+
this.checkParameters();
|
|
53
|
+
this.setLanguage();
|
|
54
|
+
}
|
|
55
|
+
checkParameters() {
|
|
56
|
+
const params = new URLSearchParams(window.location.href);
|
|
57
|
+
if (!params) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const paramKeys = ['fromzip', 'tozip', 'weight', 'when'];
|
|
61
|
+
paramKeys.forEach((key) => {
|
|
62
|
+
if (params.get(key)) {
|
|
63
|
+
this[key] = params.get(key);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
setLanguage() {
|
|
68
|
+
if (translations[this.language]) {
|
|
69
|
+
this.i18n = translations[this.language];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
onSubmit(e) {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
const formData = new FormData(e.target);
|
|
75
|
+
const requestQuery = this.compileRequestQuery(formData);
|
|
76
|
+
this.fetchResult(requestQuery);
|
|
77
|
+
}
|
|
78
|
+
compileRequestQuery(formData) {
|
|
79
|
+
let query = {
|
|
80
|
+
"from": formData.get("fromzip"),
|
|
81
|
+
"to": formData.get("tozip"),
|
|
82
|
+
"weight": formData.get("weight"),
|
|
83
|
+
"when": formData.get("when")
|
|
84
|
+
};
|
|
85
|
+
if (!query.when) {
|
|
86
|
+
query.when = this.hostElement.querySelector('input.date-input').value;
|
|
87
|
+
}
|
|
88
|
+
if (!formData.get("fromzip") || !formData.get("tozip") || !formData.get("weight")) {
|
|
89
|
+
console.error("Form data is not compliant");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
return query;
|
|
93
|
+
}
|
|
94
|
+
async fetchResult(query) {
|
|
95
|
+
this.response = null;
|
|
96
|
+
const params = new URLSearchParams(query);
|
|
97
|
+
const req = await (fetch(`${this.apiUrl}?${params.toString()}`, {
|
|
98
|
+
method: 'get',
|
|
99
|
+
headers: {
|
|
100
|
+
'Content-Type': 'application/json'
|
|
101
|
+
}
|
|
102
|
+
}).catch(this.onFetchError.bind(this)));
|
|
103
|
+
let response = await (req.json().catch(this.onFetchError.bind(this)));
|
|
104
|
+
if (!response) {
|
|
105
|
+
response = await (await Promise.resolve().then(function () { return require('./mockresponse-c40ea527.js'); })).default;
|
|
106
|
+
}
|
|
107
|
+
if (response) {
|
|
108
|
+
this.response = response;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
onFetchError(error) {
|
|
112
|
+
console.error('onFetchError(error', error);
|
|
113
|
+
}
|
|
114
|
+
render() {
|
|
115
|
+
return (index.h(index.Host, null, index.h("div", { class: "pex-pricefinder-top" }, index.h("pn-illustration", { illustration: "PEX-truck" }), index.h("h2", null, this.i18n.heading)), index.h("form", { method: "get", action: "", class: "pex-pricefinder-form", onSubmit: this.onSubmit.bind(this) }, index.h("fieldset", null, index.h("div", null, index.h("pn-input", { type: "number", label: this.i18n.labelFrom, inputid: "fromzip", name: "fromzip", placeholder: this.i18n.zipPlaceholder, required: true, value: this.fromzip }), index.h("pn-input", { type: "number", label: this.i18n.labelTo, inputid: "tozip", name: "tozip", placeholder: this.i18n.zipPlaceholder, required: true, value: this.tozip }))), index.h("fieldset", null, index.h("div", null, index.h("pn-input", { type: "number", label: this.i18n.labelWeight, inputid: "weight", name: "weight", placeholder: this.i18n.weightPlaceholder, required: true, value: this.weight }), index.h("div", { class: "datepicker" }, index.h("label", { htmlFor: "when" }, this.i18n.labelWhen), index.h("pn-date-picker", { inputid: "when", name: "when", "start-of-week": "1", min: (new Date()).toISOString().split('T')[0], language: this.language, value: this.when })))), index.h("fieldset", null, index.h("div", null, index.h("pn-button", { type: "submit" }, this.i18n.submitButtonText)))), this.response ? (index.h("div", { class: "pex-pricefinder-response" }, index.h("strong", null, this.response.data.value, " ", this.currency))) : null));
|
|
116
|
+
}
|
|
117
|
+
get hostElement() { return index.getElement(this); }
|
|
118
|
+
};
|
|
119
|
+
PnPexPricefinder.style = pnPexPricefinderCss;
|
|
120
|
+
|
|
121
|
+
exports.pn_pex_pricefinder = PnPexPricefinder;
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"./components/navigation/pn-site-selector/pn-site-selector.js",
|
|
26
26
|
"./components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.js",
|
|
27
27
|
"./components/widgets/pn-find-service-and-price/pn-find-service-and-price.js",
|
|
28
|
+
"./components/widgets/pn-pex-pricefinder/pn-pex-pricefinder.js",
|
|
28
29
|
"./components/widgets/pn-product-pricelist/pn-product-pricelist-result.js",
|
|
29
30
|
"./components/widgets/pn-product-pricelist/pn-product-pricelist.js",
|
|
30
31
|
"./components/widgets/pn-product-tile/pn-product-tile-info.js",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import readme from "./readme.md";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Widgets/Pex Pricefinder",
|
|
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-pex-pricefinder language="${args.language}">
|
|
14
|
+
</pn-product-tile>
|
|
15
|
+
</div>
|
|
16
|
+
`;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Primary = Template.bind({});
|
|
20
|
+
Primary.args = {
|
|
21
|
+
language: "sv",
|
|
22
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.pex-pricefinder-top {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
.pex-pricefinder-top pn-illustration {
|
|
6
|
+
width: 5.5rem;
|
|
7
|
+
height: 5.5rem;
|
|
8
|
+
margin-right: 1.6rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.pex-pricefinder-form {
|
|
12
|
+
margin: 1.6rem 0 0 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
border: 0;
|
|
15
|
+
}
|
|
16
|
+
.pex-pricefinder-form fieldset {
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
border: 0;
|
|
20
|
+
}
|
|
21
|
+
.pex-pricefinder-form fieldset + fieldset {
|
|
22
|
+
margin-top: 1.6rem;
|
|
23
|
+
}
|
|
24
|
+
.pex-pricefinder-form fieldset > div {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 1em;
|
|
28
|
+
}
|
|
29
|
+
.pex-pricefinder-form fieldset > div > * {
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
.pex-pricefinder-form pn-button {
|
|
34
|
+
align-self: end;
|
|
35
|
+
margin-left: auto;
|
|
36
|
+
}
|
|
37
|
+
.pex-pricefinder-form .datepicker {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
}
|
|
41
|
+
.pex-pricefinder-form .datepicker label {
|
|
42
|
+
margin-bottom: 0.4rem;
|
|
43
|
+
color: #5E554A;
|
|
44
|
+
font-size: 0.875em;
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
align-items: flex-end;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
transition: color 0.2s;
|
|
50
|
+
}
|
|
51
|
+
.pex-pricefinder-form .datepicker pn-date-picker {
|
|
52
|
+
width: 100%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pex-pricefinder-response {
|
|
56
|
+
margin-top: 2.4rem;
|
|
57
|
+
text-align: center;
|
|
58
|
+
font-size: 2.4em;
|
|
59
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Component, h, Host, Element, Prop, State, Listen } from "@stencil/core";
|
|
2
|
+
import { translations } from "./translations";
|
|
3
|
+
export class PnPexPricefinder {
|
|
4
|
+
constructor() {
|
|
5
|
+
/** Specifies which language we want to show component in (sv,da,fi,no,en) */
|
|
6
|
+
this.language = "sv";
|
|
7
|
+
/** Currency (Kr, €)*/
|
|
8
|
+
this.currency = "Kr";
|
|
9
|
+
/** API Url */
|
|
10
|
+
this.apiUrl = "/api/pex/order";
|
|
11
|
+
this.i18n = translations.sv;
|
|
12
|
+
this.fromzip = null;
|
|
13
|
+
this.tozip = null;
|
|
14
|
+
this.weight = 100;
|
|
15
|
+
this.when = (new Date()).toISOString().split('T')[0];
|
|
16
|
+
this.response = null;
|
|
17
|
+
}
|
|
18
|
+
componentWillLoad() {
|
|
19
|
+
this.init();
|
|
20
|
+
}
|
|
21
|
+
async init() {
|
|
22
|
+
this.checkParameters();
|
|
23
|
+
this.setLanguage();
|
|
24
|
+
}
|
|
25
|
+
checkParameters() {
|
|
26
|
+
const params = new URLSearchParams(window.location.href);
|
|
27
|
+
if (!params) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const paramKeys = ['fromzip', 'tozip', 'weight', 'when'];
|
|
31
|
+
paramKeys.forEach((key) => {
|
|
32
|
+
if (params.get(key)) {
|
|
33
|
+
this[key] = params.get(key);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
setLanguage() {
|
|
38
|
+
if (translations[this.language]) {
|
|
39
|
+
this.i18n = translations[this.language];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
onSubmit(e) {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
const formData = new FormData(e.target);
|
|
45
|
+
const requestQuery = this.compileRequestQuery(formData);
|
|
46
|
+
this.fetchResult(requestQuery);
|
|
47
|
+
}
|
|
48
|
+
compileRequestQuery(formData) {
|
|
49
|
+
let query = {
|
|
50
|
+
"from": formData.get("fromzip"),
|
|
51
|
+
"to": formData.get("tozip"),
|
|
52
|
+
"weight": formData.get("weight"),
|
|
53
|
+
"when": formData.get("when")
|
|
54
|
+
};
|
|
55
|
+
if (!query.when) {
|
|
56
|
+
query.when = this.hostElement.querySelector('input.date-input').value;
|
|
57
|
+
}
|
|
58
|
+
if (!formData.get("fromzip") || !formData.get("tozip") || !formData.get("weight")) {
|
|
59
|
+
console.error("Form data is not compliant");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
return query;
|
|
63
|
+
}
|
|
64
|
+
async fetchResult(query) {
|
|
65
|
+
this.response = null;
|
|
66
|
+
const params = new URLSearchParams(query);
|
|
67
|
+
const req = await (fetch(`${this.apiUrl}?${params.toString()}`, {
|
|
68
|
+
method: 'get',
|
|
69
|
+
headers: {
|
|
70
|
+
'Content-Type': 'application/json'
|
|
71
|
+
}
|
|
72
|
+
}).catch(this.onFetchError.bind(this)));
|
|
73
|
+
let response = await (req.json().catch(this.onFetchError.bind(this)));
|
|
74
|
+
if (!response) {
|
|
75
|
+
response = await (await import("./mockresponse.json")).default;
|
|
76
|
+
}
|
|
77
|
+
if (response) {
|
|
78
|
+
this.response = response;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
onFetchError(error) {
|
|
82
|
+
console.error('onFetchError(error', error);
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
return (h(Host, null,
|
|
86
|
+
h("div", { class: "pex-pricefinder-top" },
|
|
87
|
+
h("pn-illustration", { illustration: "PEX-truck" }),
|
|
88
|
+
h("h2", null, this.i18n.heading)),
|
|
89
|
+
h("form", { method: "get", action: "", class: "pex-pricefinder-form", onSubmit: this.onSubmit.bind(this) },
|
|
90
|
+
h("fieldset", null,
|
|
91
|
+
h("div", null,
|
|
92
|
+
h("pn-input", { type: "number", label: this.i18n.labelFrom, inputid: "fromzip", name: "fromzip", placeholder: this.i18n.zipPlaceholder, required: true, value: this.fromzip }),
|
|
93
|
+
h("pn-input", { type: "number", label: this.i18n.labelTo, inputid: "tozip", name: "tozip", placeholder: this.i18n.zipPlaceholder, required: true, value: this.tozip }))),
|
|
94
|
+
h("fieldset", null,
|
|
95
|
+
h("div", null,
|
|
96
|
+
h("pn-input", { type: "number", label: this.i18n.labelWeight, inputid: "weight", name: "weight", placeholder: this.i18n.weightPlaceholder, required: true, value: this.weight }),
|
|
97
|
+
h("div", { class: "datepicker" },
|
|
98
|
+
h("label", { htmlFor: "when" }, this.i18n.labelWhen),
|
|
99
|
+
h("pn-date-picker", { inputid: "when", name: "when", "start-of-week": "1", min: (new Date()).toISOString().split('T')[0], language: this.language, value: this.when })))),
|
|
100
|
+
h("fieldset", null,
|
|
101
|
+
h("div", null,
|
|
102
|
+
h("pn-button", { type: "submit" }, this.i18n.submitButtonText)))),
|
|
103
|
+
this.response ? (h("div", { class: "pex-pricefinder-response" },
|
|
104
|
+
h("strong", null,
|
|
105
|
+
this.response.data.value,
|
|
106
|
+
" ",
|
|
107
|
+
this.currency))) : null));
|
|
108
|
+
}
|
|
109
|
+
static get is() { return "pn-pex-pricefinder"; }
|
|
110
|
+
static get originalStyleUrls() { return {
|
|
111
|
+
"$": ["pn-pex-pricefinder.scss"]
|
|
112
|
+
}; }
|
|
113
|
+
static get styleUrls() { return {
|
|
114
|
+
"$": ["pn-pex-pricefinder.css"]
|
|
115
|
+
}; }
|
|
116
|
+
static get properties() { return {
|
|
117
|
+
"language": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"mutable": false,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "string",
|
|
122
|
+
"resolved": "string",
|
|
123
|
+
"references": {}
|
|
124
|
+
},
|
|
125
|
+
"required": false,
|
|
126
|
+
"optional": false,
|
|
127
|
+
"docs": {
|
|
128
|
+
"tags": [],
|
|
129
|
+
"text": "Specifies which language we want to show component in (sv,da,fi,no,en)"
|
|
130
|
+
},
|
|
131
|
+
"attribute": "language",
|
|
132
|
+
"reflect": false,
|
|
133
|
+
"defaultValue": "\"sv\""
|
|
134
|
+
},
|
|
135
|
+
"currency": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "string",
|
|
140
|
+
"resolved": "string",
|
|
141
|
+
"references": {}
|
|
142
|
+
},
|
|
143
|
+
"required": false,
|
|
144
|
+
"optional": false,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [],
|
|
147
|
+
"text": "Currency (Kr, \u20AC)"
|
|
148
|
+
},
|
|
149
|
+
"attribute": "currency",
|
|
150
|
+
"reflect": false,
|
|
151
|
+
"defaultValue": "\"Kr\""
|
|
152
|
+
},
|
|
153
|
+
"apiUrl": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "string",
|
|
158
|
+
"resolved": "string",
|
|
159
|
+
"references": {}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": "API Url"
|
|
166
|
+
},
|
|
167
|
+
"attribute": "api-url",
|
|
168
|
+
"reflect": false,
|
|
169
|
+
"defaultValue": "\"/api/pex/order\""
|
|
170
|
+
}
|
|
171
|
+
}; }
|
|
172
|
+
static get states() { return {
|
|
173
|
+
"i18n": {},
|
|
174
|
+
"fromzip": {},
|
|
175
|
+
"tozip": {},
|
|
176
|
+
"weight": {},
|
|
177
|
+
"when": {},
|
|
178
|
+
"response": {}
|
|
179
|
+
}; }
|
|
180
|
+
static get elementRef() { return "hostElement"; }
|
|
181
|
+
static get listeners() { return [{
|
|
182
|
+
"name": "language",
|
|
183
|
+
"method": "setLanguage",
|
|
184
|
+
"target": undefined,
|
|
185
|
+
"capture": false,
|
|
186
|
+
"passive": false
|
|
187
|
+
}]; }
|
|
188
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const translations = {
|
|
2
|
+
'sv': {
|
|
3
|
+
"heading": "Beräkna kostnad med PEX Bud",
|
|
4
|
+
"labelFrom": "Från postkod",
|
|
5
|
+
"labelTo": "Till postkod",
|
|
6
|
+
"zipPlaceholder": "Ex. 12831",
|
|
7
|
+
"labelWeight": "Vikt (i gram)",
|
|
8
|
+
"weightPlaceholder": "Ex. 1000",
|
|
9
|
+
"labelWhen": "När",
|
|
10
|
+
"submitButtonText": "Beräkna pris"
|
|
11
|
+
},
|
|
12
|
+
'en': {
|
|
13
|
+
"heading": "Calculate cost with PEX Bud",
|
|
14
|
+
"labelFrom": "From zip",
|
|
15
|
+
"labelTo": "To zip",
|
|
16
|
+
"zipPlaceholder": "Ex. 12831",
|
|
17
|
+
"labelWeight": "Weight (in grams)",
|
|
18
|
+
"weightPlaceholder": "Ex. 1000",
|
|
19
|
+
"labelWhen": "When",
|
|
20
|
+
"submitButtonText": "Calculate price"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -104,6 +104,12 @@ export const PnMarketwebSiteheaderSearch: {
|
|
|
104
104
|
new (): PnMarketwebSiteheaderSearch;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
interface PnPexPricefinder extends Components.PnPexPricefinder, HTMLElement {}
|
|
108
|
+
export const PnPexPricefinder: {
|
|
109
|
+
prototype: PnPexPricefinder;
|
|
110
|
+
new (): PnPexPricefinder;
|
|
111
|
+
};
|
|
112
|
+
|
|
107
113
|
interface PnProductPricelist extends Components.PnProductPricelist, HTMLElement {}
|
|
108
114
|
export const PnProductPricelist: {
|
|
109
115
|
prototype: PnProductPricelist;
|