@postnord/pn-marketweb-components 2.0.21 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-language-selector_9.cjs.entry.js +1 -1
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-marketweb-siteheader-profileselection.cjs.entry.js +161 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.css +0 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.js +319 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-search.js +1 -1
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +2 -2
- package/custom-elements/index.d.ts +6 -0
- package/custom-elements/index.js +158 -2
- package/esm/loader.js +1 -1
- package/esm/pn-language-selector_9.entry.js +1 -1
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-marketweb-siteheader-profileselection.entry.js +157 -0
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-language-selector_9.entry.js +1 -1
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-siteheader-profileselection.entry.js +1 -0
- package/package.json +1 -1
- package/pn-market-web-components/p-67887512.system.js +1 -1
- package/pn-market-web-components/{p-28d3a96e.entry.js → p-7f5bee11.entry.js} +1 -1
- package/pn-market-web-components/p-a94593a9.system.entry.js +1 -0
- package/pn-market-web-components/{p-d85f3f93.system.entry.js → p-e23a18f4.system.entry.js} +1 -1
- package/pn-market-web-components/p-fcea21cb.entry.js +1 -0
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.d.ts +28 -0
- package/types/components.d.ts +46 -0
- package/umd/pn-marketweb-salesforce.js +1 -1
package/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"userToken":[1,"user-token"],"userFullname":[1,"user-fullname"],"userLoggedin":[4,"user-loggedin"],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"AutocompleteEndpoint":[1,"autocomplete-endpoint"],"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.cjs",[[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.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-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"description":[16],"shownitems":[16],"showMeasurement":[4,"show-measurement"],"weightText":[32]}]]],["pn-marketweb-sitefooter.cjs",[[4,"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-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-customernumber-selector.cjs",[[4,"pn-customernumber-selector",{"language":[1537],"open":[1540],"title":[1],"description":[1],"i18n":[32]}]]],["pn-customernumber-selector-option.cjs",[[4,"pn-customernumber-selector-option",{"title":[1],"description":[1],"url":[1]}]]],["pn-filter-checkbox.cjs",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-marketweb-search.cjs",[[1,"pn-marketweb-search",{"disabled":[4],"placeholder":[1],"inputid":[1],"name":[1],"autocomplete":[1],"list":[1],"value":[1],"label":[1],"loading":[4],"button":[1],"light":[4],"suggestionObserver":[32],"hasClonedInput":[32],"listSuggestion":[32]},[[0,"input","inputHandler"]]]]],["pn-product-tile.cjs",[[4,"pn-product-tile"]]],["pn-profile-selector.cjs",[[4,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"heading":[1],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-profile-selector-option.cjs",[[0,"pn-profile-selector-option",{"title":[1],"description":[1],"url":[1]}]]],["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-find-service-and-price-result.cjs",[[0,"pn-find-service-and-price-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-marketweb-input.cjs",[[0,"pn-marketweb-input",{"disabled":[4],"error":[1],"invalid":[4],"helpertext":[1],"label":[1],"placeholder":[1],"inputid":[1],"name":[1],"required":[4],"type":[1025],"autocomplete":[1],"valid":[4],"value":[1],"maxlength":[1],"min":[1],"max":[1],"step":[1],"pattern":[1],"showText":[32]}]]],["pn-find-price-result.cjs",[[0,"pn-find-price-result",{"item":[1040],"shownitems":[16],"Usp1":[1,"usp-1"],"Usp2":[1,"usp-2"],"Usp3":[1,"usp-3"],"description":[16],"showMeasurement":[4,"show-measurement"],"weightText":[32],"linkId":[32]}]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1],"linktitle":[1]}],[4,"pn-site-footer-col"]]],["pn-choice-button.cjs",[[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-product-tile-info_2.cjs",[[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-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],"fullname":[1],"loggedin":[4],"loginManager":[32],"toggleButtonText":[32],"username":[32]}],[0,"pn-marketweb-siteheader-search",{"i18n":[8,"i-1-8n"],"showOnlyLink":[1028,"show-only-link"],"hideSearch":[1028,"hide-search"],"language":[1537],"search":[1040],"primary":[4],"autoCompleteOptions":[32]}],[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-card_4.cjs",[[0,"pn-product-card-info",{"rulle":[1],"paket":[1],"label":[1],"text":[1]}],[0,"pn-product-card-price",{"label":[1],"amount":[1],"currency":[1],"note":[1],"url":[1],"service":[1],"linkid":[1]}],[4,"pn-titletag",{"icon":[1],"color":[1537]}],[4,"pn-product-card"]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"userToken":[1,"user-token"],"userFullname":[1,"user-fullname"],"userLoggedin":[4,"user-loggedin"],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"AutocompleteEndpoint":[1,"autocomplete-endpoint"],"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.cjs",[[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.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-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"description":[16],"shownitems":[16],"showMeasurement":[4,"show-measurement"],"weightText":[32]}]]],["pn-marketweb-sitefooter.cjs",[[4,"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-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-customernumber-selector.cjs",[[4,"pn-customernumber-selector",{"language":[1537],"open":[1540],"title":[1],"description":[1],"i18n":[32]}]]],["pn-customernumber-selector-option.cjs",[[4,"pn-customernumber-selector-option",{"title":[1],"description":[1],"url":[1]}]]],["pn-filter-checkbox.cjs",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-marketweb-search.cjs",[[1,"pn-marketweb-search",{"disabled":[4],"placeholder":[1],"inputid":[1],"name":[1],"autocomplete":[1],"list":[1],"value":[1],"label":[1],"loading":[4],"button":[1],"light":[4],"suggestionObserver":[32],"hasClonedInput":[32],"listSuggestion":[32]},[[0,"input","inputHandler"]]]]],["pn-marketweb-siteheader-profileselection.cjs",[[0,"pn-marketweb-siteheader-profileselection",{"endpoint":[1],"token":[1],"i18n":[8,"i-1-8n"],"emitEvents":[4,"emit-events"],"loginDialog":[1040],"fullname":[1],"loggedin":[4],"loginManager":[32],"toggleButtonText":[32],"username":[32]}]]],["pn-product-tile.cjs",[[4,"pn-product-tile"]]],["pn-profile-selector.cjs",[[4,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"heading":[1],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-profile-selector-option.cjs",[[0,"pn-profile-selector-option",{"title":[1],"description":[1],"url":[1]}]]],["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-find-service-and-price-result.cjs",[[0,"pn-find-service-and-price-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-marketweb-input.cjs",[[0,"pn-marketweb-input",{"disabled":[4],"error":[1],"invalid":[4],"helpertext":[1],"label":[1],"placeholder":[1],"inputid":[1],"name":[1],"required":[4],"type":[1025],"autocomplete":[1],"valid":[4],"value":[1],"maxlength":[1],"min":[1],"max":[1],"step":[1],"pattern":[1],"showText":[32]}]]],["pn-find-price-result.cjs",[[0,"pn-find-price-result",{"item":[1040],"shownitems":[16],"Usp1":[1,"usp-1"],"Usp2":[1,"usp-2"],"Usp3":[1,"usp-3"],"description":[16],"showMeasurement":[4,"show-measurement"],"weightText":[32],"linkId":[32]}]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1],"linktitle":[1]}],[4,"pn-site-footer-col"]]],["pn-choice-button.cjs",[[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-product-tile-info_2.cjs",[[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-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],"fullname":[1],"loggedin":[4],"loginManager":[32],"toggleButtonText":[32],"username":[32]}],[0,"pn-marketweb-siteheader-search",{"i18n":[8,"i-1-8n"],"showOnlyLink":[1028,"show-only-link"],"hideSearch":[1028,"hide-search"],"language":[1537],"search":[1040],"primary":[4],"autoCompleteOptions":[32]}],[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-card_4.cjs",[[0,"pn-product-card-info",{"rulle":[1],"paket":[1],"label":[1],"text":[1]}],[0,"pn-product-card-price",{"label":[1],"amount":[1],"currency":[1],"note":[1],"url":[1],"service":[1],"linkid":[1]}],[4,"pn-titletag",{"icon":[1],"color":[1537]}],[4,"pn-product-card"]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -537,7 +537,7 @@ let PnMarketwebSiteheaderSearch = class {
|
|
|
537
537
|
if (!data || !data.hits || !data.hits.length) {
|
|
538
538
|
return;
|
|
539
539
|
}
|
|
540
|
-
const suggestions = data.hits.map((item) => {
|
|
540
|
+
const suggestions = data.hits.filter(item => item.type === "editorial").map((item) => {
|
|
541
541
|
return item.query;
|
|
542
542
|
});
|
|
543
543
|
// Store query in store
|
|
@@ -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],"userToken":[1,"user-token"],"userFullname":[1,"user-fullname"],"userLoggedin":[4,"user-loggedin"],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"AutocompleteEndpoint":[1,"autocomplete-endpoint"],"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.cjs",[[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.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-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"description":[16],"shownitems":[16],"showMeasurement":[4,"show-measurement"],"weightText":[32]}]]],["pn-marketweb-sitefooter.cjs",[[4,"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-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-customernumber-selector.cjs",[[4,"pn-customernumber-selector",{"language":[1537],"open":[1540],"title":[1],"description":[1],"i18n":[32]}]]],["pn-customernumber-selector-option.cjs",[[4,"pn-customernumber-selector-option",{"title":[1],"description":[1],"url":[1]}]]],["pn-filter-checkbox.cjs",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-marketweb-search.cjs",[[1,"pn-marketweb-search",{"disabled":[4],"placeholder":[1],"inputid":[1],"name":[1],"autocomplete":[1],"list":[1],"value":[1],"label":[1],"loading":[4],"button":[1],"light":[4],"suggestionObserver":[32],"hasClonedInput":[32],"listSuggestion":[32]},[[0,"input","inputHandler"]]]]],["pn-product-tile.cjs",[[4,"pn-product-tile"]]],["pn-profile-selector.cjs",[[4,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"heading":[1],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-profile-selector-option.cjs",[[0,"pn-profile-selector-option",{"title":[1],"description":[1],"url":[1]}]]],["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-find-service-and-price-result.cjs",[[0,"pn-find-service-and-price-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-marketweb-input.cjs",[[0,"pn-marketweb-input",{"disabled":[4],"error":[1],"invalid":[4],"helpertext":[1],"label":[1],"placeholder":[1],"inputid":[1],"name":[1],"required":[4],"type":[1025],"autocomplete":[1],"valid":[4],"value":[1],"maxlength":[1],"min":[1],"max":[1],"step":[1],"pattern":[1],"showText":[32]}]]],["pn-find-price-result.cjs",[[0,"pn-find-price-result",{"item":[1040],"shownitems":[16],"Usp1":[1,"usp-1"],"Usp2":[1,"usp-2"],"Usp3":[1,"usp-3"],"description":[16],"showMeasurement":[4,"show-measurement"],"weightText":[32],"linkId":[32]}]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1],"linktitle":[1]}],[4,"pn-site-footer-col"]]],["pn-choice-button.cjs",[[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-product-tile-info_2.cjs",[[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-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],"fullname":[1],"loggedin":[4],"loginManager":[32],"toggleButtonText":[32],"username":[32]}],[0,"pn-marketweb-siteheader-search",{"i18n":[8,"i-1-8n"],"showOnlyLink":[1028,"show-only-link"],"hideSearch":[1028,"hide-search"],"language":[1537],"search":[1040],"primary":[4],"autoCompleteOptions":[32]}],[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-card_4.cjs",[[0,"pn-product-card-info",{"rulle":[1],"paket":[1],"label":[1],"text":[1]}],[0,"pn-product-card-price",{"label":[1],"amount":[1],"currency":[1],"note":[1],"url":[1],"service":[1],"linkid":[1]}],[4,"pn-titletag",{"icon":[1],"color":[1537]}],[4,"pn-product-card"]]]], options);
|
|
58
|
+
return index.bootstrapLazy([["pn-marketweb-siteheader.cjs",[[4,"pn-marketweb-siteheader",{"market":[1537],"language":[1537],"environment":[1537],"userToken":[1,"user-token"],"userFullname":[1,"user-fullname"],"userLoggedin":[4,"user-loggedin"],"endpoint":[1],"hideSiteSelector":[1540,"hide-site-selector"],"hideLanguageSelector":[1540,"hide-language-selector"],"hideSearch":[1540,"hide-search"],"hideLogin":[1540,"hide-login"],"AutocompleteEndpoint":[1,"autocomplete-endpoint"],"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.cjs",[[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.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-product-pricelist-result.cjs",[[0,"pn-product-pricelist-result",{"item":[1040],"description":[16],"shownitems":[16],"showMeasurement":[4,"show-measurement"],"weightText":[32]}]]],["pn-marketweb-sitefooter.cjs",[[4,"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-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-customernumber-selector.cjs",[[4,"pn-customernumber-selector",{"language":[1537],"open":[1540],"title":[1],"description":[1],"i18n":[32]}]]],["pn-customernumber-selector-option.cjs",[[4,"pn-customernumber-selector-option",{"title":[1],"description":[1],"url":[1]}]]],["pn-filter-checkbox.cjs",[[1,"pn-filter-checkbox",{"value":[520],"name":[1],"checkboxid":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-marketweb-search.cjs",[[1,"pn-marketweb-search",{"disabled":[4],"placeholder":[1],"inputid":[1],"name":[1],"autocomplete":[1],"list":[1],"value":[1],"label":[1],"loading":[4],"button":[1],"light":[4],"suggestionObserver":[32],"hasClonedInput":[32],"listSuggestion":[32]},[[0,"input","inputHandler"]]]]],["pn-marketweb-siteheader-profileselection.cjs",[[0,"pn-marketweb-siteheader-profileselection",{"endpoint":[1],"token":[1],"i18n":[8,"i-1-8n"],"emitEvents":[4,"emit-events"],"loginDialog":[1040],"fullname":[1],"loggedin":[4],"loginManager":[32],"toggleButtonText":[32],"username":[32]}]]],["pn-product-tile.cjs",[[4,"pn-product-tile"]]],["pn-profile-selector.cjs",[[4,"pn-profile-selector",{"language":[1537],"returnUrl":[1,"return-url"],"heading":[1],"i18n":[32],"isLoading":[32],"numberOfProfiles":[32]}]]],["pn-profile-selector-option.cjs",[[0,"pn-profile-selector-option",{"title":[1],"description":[1],"url":[1]}]]],["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-find-service-and-price-result.cjs",[[0,"pn-find-service-and-price-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-marketweb-input.cjs",[[0,"pn-marketweb-input",{"disabled":[4],"error":[1],"invalid":[4],"helpertext":[1],"label":[1],"placeholder":[1],"inputid":[1],"name":[1],"required":[4],"type":[1025],"autocomplete":[1],"valid":[4],"value":[1],"maxlength":[1],"min":[1],"max":[1],"step":[1],"pattern":[1],"showText":[32]}]]],["pn-find-price-result.cjs",[[0,"pn-find-price-result",{"item":[1040],"shownitems":[16],"Usp1":[1,"usp-1"],"Usp2":[1,"usp-2"],"Usp3":[1,"usp-3"],"description":[16],"showMeasurement":[4,"show-measurement"],"weightText":[32],"linkId":[32]}]]],["pn-site-footer_2.cjs",[[4,"pn-site-footer",{"url":[1],"linktitle":[1]}],[4,"pn-site-footer-col"]]],["pn-choice-button.cjs",[[4,"pn-choice-button",{"value":[520],"name":[1],"choiceid":[1],"type":[1],"disabled":[4],"checked":[4],"indeterminate":[1028]},[[0,"change","handlechange"]]]]],["pn-mainnav-link.cjs",[[4,"pn-mainnav-link",{"name":[1],"href":[1],"target":[1],"linkid":[1],"levelId":[32],"open":[32],"hasChildren":[32]}]]],["pn-product-tile-info_2.cjs",[[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-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],"fullname":[1],"loggedin":[4],"loginManager":[32],"toggleButtonText":[32],"username":[32]}],[0,"pn-marketweb-siteheader-search",{"i18n":[8,"i-1-8n"],"showOnlyLink":[1028,"show-only-link"],"hideSearch":[1028,"hide-search"],"language":[1537],"search":[1040],"primary":[4],"autoCompleteOptions":[32]}],[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-card_4.cjs",[[0,"pn-product-card-info",{"rulle":[1],"paket":[1],"label":[1],"text":[1]}],[0,"pn-product-card-price",{"label":[1],"amount":[1],"currency":[1],"note":[1],"url":[1],"service":[1],"linkid":[1]}],[4,"pn-titletag",{"icon":[1],"color":[1537]}],[4,"pn-product-card"]]]], options);
|
|
59
59
|
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-e3e27c79.js');
|
|
6
|
+
const MarketWebLoginManager = require('./MarketWebLoginManager-865226ea.js');
|
|
7
|
+
|
|
8
|
+
const pnMarketwebSiteheaderProfileselectionCss = "";
|
|
9
|
+
|
|
10
|
+
let PnMarketwebSiteheaderProfileSelection = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.loginStateChange = index.createEvent(this, "loginStateChange", 7);
|
|
14
|
+
/** Specifies which endpoint domain we should load from */
|
|
15
|
+
this.endpoint = "";
|
|
16
|
+
/** Access token passed from backend */
|
|
17
|
+
this.token = "";
|
|
18
|
+
this.emitEvents = true;
|
|
19
|
+
// Login dialog
|
|
20
|
+
this.loginDialog = null;
|
|
21
|
+
/** User Fullname */
|
|
22
|
+
this.fullname = "";
|
|
23
|
+
this.loggedin = false;
|
|
24
|
+
this.loginManager = null;
|
|
25
|
+
this.toggleButtonText = "";
|
|
26
|
+
this.username = this.fullname;
|
|
27
|
+
}
|
|
28
|
+
componentWillLoad() {
|
|
29
|
+
const userInfo = this.loggedin && this.fullname ? { given_name: this.fullname } : null;
|
|
30
|
+
this.loginManager = new MarketWebLoginManager.MarketWebLoginManager({ endpoint: this.endpoint, eventTarget: this.hostElement, userInfo });
|
|
31
|
+
this.hostElement["loginmanager"] = this.loginManager;
|
|
32
|
+
if (this.token) {
|
|
33
|
+
this.loginManager.registerToken(this.token, 'backend');
|
|
34
|
+
}
|
|
35
|
+
else if (this.emitEvents) { // The primary login instance
|
|
36
|
+
this.loginManager.invalidateTokenOfType('backend');
|
|
37
|
+
}
|
|
38
|
+
this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
|
|
39
|
+
this.init();
|
|
40
|
+
this.setUserName();
|
|
41
|
+
this.setToggleButtonText();
|
|
42
|
+
}
|
|
43
|
+
async init() {
|
|
44
|
+
this.toggleButtonText = this.loginDialog.loginMenuLinkText;
|
|
45
|
+
this.loginManager.init(this.emitEvents);
|
|
46
|
+
this.setToggleButtonText();
|
|
47
|
+
}
|
|
48
|
+
setUserName() {
|
|
49
|
+
const userInfo = this.loginManager.getUserInfo();
|
|
50
|
+
let name = "";
|
|
51
|
+
if (!this.loggedin || !userInfo) {
|
|
52
|
+
this.username = name;
|
|
53
|
+
}
|
|
54
|
+
if (userInfo && userInfo.given_name) {
|
|
55
|
+
name = userInfo.given_name + ((userInfo === null || userInfo === void 0 ? void 0 : userInfo.family_name) ? ` ${userInfo === null || userInfo === void 0 ? void 0 : userInfo.family_name}` : "");
|
|
56
|
+
}
|
|
57
|
+
if (!name && userInfo && userInfo.email) {
|
|
58
|
+
name = userInfo.email;
|
|
59
|
+
}
|
|
60
|
+
if (!name && this.fullname) {
|
|
61
|
+
name = this.fullname;
|
|
62
|
+
}
|
|
63
|
+
this.username = name;
|
|
64
|
+
}
|
|
65
|
+
setToggleButtonText() {
|
|
66
|
+
if (this.loggedin) {
|
|
67
|
+
this.toggleButtonText = this.username;
|
|
68
|
+
if (!this.toggleButtonText) {
|
|
69
|
+
this.toggleButtonText = this.loginDialog.loggedInButtonText;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.toggleButtonText = this.loginDialog.loginMenuLinkText;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
onLoginStateChange(e) {
|
|
77
|
+
if (this.loggedin !== e.detail && this.emitEvents) {
|
|
78
|
+
this.loggedin = e.detail;
|
|
79
|
+
this.loginStateChange.emit({ loggedIn: this.loggedin, token: this.loginManager.getToken() });
|
|
80
|
+
this.setUserName();
|
|
81
|
+
this.setToggleButtonText();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
uniqueId(text) {
|
|
85
|
+
return "loginlink-" + text.replace(/[^A-Za-z0-9.\\\/]/igm, "") + "-" + (this.emitEvents ? "1" : "2");
|
|
86
|
+
}
|
|
87
|
+
linkAppearanceAttributes(link) {
|
|
88
|
+
let attributes = {};
|
|
89
|
+
if (link.linkType) {
|
|
90
|
+
switch (link.linkType) {
|
|
91
|
+
case 'primary':
|
|
92
|
+
attributes = {
|
|
93
|
+
appearance: '',
|
|
94
|
+
variant: ''
|
|
95
|
+
};
|
|
96
|
+
break;
|
|
97
|
+
case 'secondary':
|
|
98
|
+
attributes = {
|
|
99
|
+
appearance: 'light',
|
|
100
|
+
variant: 'outlined'
|
|
101
|
+
};
|
|
102
|
+
break;
|
|
103
|
+
case 'regularlink':
|
|
104
|
+
default:
|
|
105
|
+
attributes = {
|
|
106
|
+
appearance: 'light',
|
|
107
|
+
variant: 'borderless',
|
|
108
|
+
icon: 'arrow-right'
|
|
109
|
+
};
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return attributes;
|
|
113
|
+
}
|
|
114
|
+
if (!link.linkType) {
|
|
115
|
+
attributes = {
|
|
116
|
+
appearance: link.primaryLinkApperance ? "dark" : "light"
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return attributes;
|
|
120
|
+
}
|
|
121
|
+
render() {
|
|
122
|
+
var _a, _b, _c;
|
|
123
|
+
if (!this.loginDialog) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
let hostElementAttribute = {
|
|
127
|
+
username: null
|
|
128
|
+
};
|
|
129
|
+
if (this.username) {
|
|
130
|
+
hostElementAttribute.username = this.username;
|
|
131
|
+
}
|
|
132
|
+
return (index.h(index.Host, Object.assign({}, hostElementAttribute), index.h("pn-nav-dropdown", { label: this.toggleButtonText, icon: "user", class: "siteheader-logindialog" }, (!this.loginDialog.overrideLoginMenu) ?
|
|
133
|
+
index.h("div", { "data-loggedin": this.loggedin + '' }, (!this.loggedin) ?
|
|
134
|
+
index.h("div", null, (_a = this.loginDialog.loginTitle) !== null && _a !== void 0 ? _a : index.h("strong", null, this.loginDialog.loginTitle), ((_b = this.loginDialog.loginMenuLinks) === null || _b === void 0 ? void 0 : _b.length) > 0 ?
|
|
135
|
+
index.h("ul", null, this.loginDialog.loginMenuLinks.map((link, i) => {
|
|
136
|
+
const href = (i === 0 && !link.href) ? this.loginManager.getLoginUrl() : link.href;
|
|
137
|
+
return (index.h("li", null, index.h("pn-button", Object.assign({ href: href, id: this.uniqueId(link.linkText) }, this.linkAppearanceAttributes(link), (link.openInNewWindow && { target: '_blank' })), link.linkText)));
|
|
138
|
+
}))
|
|
139
|
+
: (index.h("ul", null, index.h("li", null, index.h("pn-button", { href: this.loginManager.getLoginUrl(this.loginDialog.loginUrl), target: "_top" }, this.loginDialog.loginLinkText)), index.h("li", null, index.h("pn-button", { href: this.loginDialog.registerUrl, target: "_top", appearance: "light", variant: "outlined" }, this.loginDialog.createLoginLinkText)))))
|
|
140
|
+
:
|
|
141
|
+
index.h("div", null, index.h("ul", null, this.loginDialog.loggedInLinks.map((link) => {
|
|
142
|
+
const isLogoutLink = link.href.indexOf('logout') !== -1;
|
|
143
|
+
const href = (isLogoutLink) ? this.loginManager.getLogoutUrl(link.href.replace('logout', '').replace('http://window.location.href/?', '').replace('https://window.location.href/?', '')) : link.href;
|
|
144
|
+
return (index.h("li", null, index.h("pn-button", Object.assign({ href: href, id: this.uniqueId(link.linkText) }, (link.openInNewWindow && { target: '_blank' }), this.linkAppearanceAttributes(link), { onClick: () => {
|
|
145
|
+
if (isLogoutLink) {
|
|
146
|
+
this.loginManager.clearUserData();
|
|
147
|
+
}
|
|
148
|
+
} }), link.linkText)));
|
|
149
|
+
}))))
|
|
150
|
+
:
|
|
151
|
+
index.h("div", null, index.h("ul", null, (_c = this.loginDialog.loginMenuLinks) === null || _c === void 0 ? void 0 : _c.map(link => index.h("li", null, index.h("a", { href: link.href, target: link.openInNewWindow ? "_blank" : "_self", class: "btn btn-link" }, link.linkText))))))));
|
|
152
|
+
}
|
|
153
|
+
get hostElement() { return index.getElement(this); }
|
|
154
|
+
static get watchers() { return {
|
|
155
|
+
"i18n": ["init"],
|
|
156
|
+
"loginDialog": ["init"]
|
|
157
|
+
}; }
|
|
158
|
+
};
|
|
159
|
+
PnMarketwebSiteheaderProfileSelection.style = pnMarketwebSiteheaderProfileselectionCss;
|
|
160
|
+
|
|
161
|
+
exports.pn_marketweb_siteheader_profileselection = PnMarketwebSiteheaderProfileSelection;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"./components/input/pn-marketweb-search/pn-marketweb-search.js",
|
|
9
9
|
"./components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js",
|
|
10
10
|
"./components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.js",
|
|
11
|
+
"./components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-profileselection.js",
|
|
11
12
|
"./components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-search.js",
|
|
12
13
|
"./components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js",
|
|
13
14
|
"./components/minor/pn-titletag/pn-titletag.js",
|
|
File without changes
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { Component, Prop, h, State, Element, Watch, Event, Host } from "@stencil/core";
|
|
2
|
+
import { MarketWebLoginManager } from "../../../globals/MarketWebLoginManager";
|
|
3
|
+
export class PnMarketwebSiteheaderProfileSelection {
|
|
4
|
+
constructor() {
|
|
5
|
+
/** Specifies which endpoint domain we should load from */
|
|
6
|
+
this.endpoint = "";
|
|
7
|
+
/** Access token passed from backend */
|
|
8
|
+
this.token = "";
|
|
9
|
+
this.emitEvents = true;
|
|
10
|
+
// Login dialog
|
|
11
|
+
this.loginDialog = null;
|
|
12
|
+
/** User Fullname */
|
|
13
|
+
this.fullname = "";
|
|
14
|
+
this.loggedin = false;
|
|
15
|
+
this.loginManager = null;
|
|
16
|
+
this.toggleButtonText = "";
|
|
17
|
+
this.username = this.fullname;
|
|
18
|
+
}
|
|
19
|
+
componentWillLoad() {
|
|
20
|
+
const userInfo = this.loggedin && this.fullname ? { given_name: this.fullname } : null;
|
|
21
|
+
this.loginManager = new MarketWebLoginManager({ endpoint: this.endpoint, eventTarget: this.hostElement, userInfo });
|
|
22
|
+
this.hostElement["loginmanager"] = this.loginManager;
|
|
23
|
+
if (this.token) {
|
|
24
|
+
this.loginManager.registerToken(this.token, 'backend');
|
|
25
|
+
}
|
|
26
|
+
else if (this.emitEvents) { // The primary login instance
|
|
27
|
+
this.loginManager.invalidateTokenOfType('backend');
|
|
28
|
+
}
|
|
29
|
+
this.hostElement.addEventListener(this.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
|
|
30
|
+
this.init();
|
|
31
|
+
this.setUserName();
|
|
32
|
+
this.setToggleButtonText();
|
|
33
|
+
}
|
|
34
|
+
async init() {
|
|
35
|
+
this.toggleButtonText = this.loginDialog.loginMenuLinkText;
|
|
36
|
+
this.loginManager.init(this.emitEvents);
|
|
37
|
+
this.setToggleButtonText();
|
|
38
|
+
}
|
|
39
|
+
setUserName() {
|
|
40
|
+
const userInfo = this.loginManager.getUserInfo();
|
|
41
|
+
let name = "";
|
|
42
|
+
if (!this.loggedin || !userInfo) {
|
|
43
|
+
this.username = name;
|
|
44
|
+
}
|
|
45
|
+
if (userInfo && userInfo.given_name) {
|
|
46
|
+
name = userInfo.given_name + ((userInfo === null || userInfo === void 0 ? void 0 : userInfo.family_name) ? ` ${userInfo === null || userInfo === void 0 ? void 0 : userInfo.family_name}` : "");
|
|
47
|
+
}
|
|
48
|
+
if (!name && userInfo && userInfo.email) {
|
|
49
|
+
name = userInfo.email;
|
|
50
|
+
}
|
|
51
|
+
if (!name && this.fullname) {
|
|
52
|
+
name = this.fullname;
|
|
53
|
+
}
|
|
54
|
+
this.username = name;
|
|
55
|
+
}
|
|
56
|
+
setToggleButtonText() {
|
|
57
|
+
if (this.loggedin) {
|
|
58
|
+
this.toggleButtonText = this.username;
|
|
59
|
+
if (!this.toggleButtonText) {
|
|
60
|
+
this.toggleButtonText = this.loginDialog.loggedInButtonText;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.toggleButtonText = this.loginDialog.loginMenuLinkText;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
onLoginStateChange(e) {
|
|
68
|
+
if (this.loggedin !== e.detail && this.emitEvents) {
|
|
69
|
+
this.loggedin = e.detail;
|
|
70
|
+
this.loginStateChange.emit({ loggedIn: this.loggedin, token: this.loginManager.getToken() });
|
|
71
|
+
this.setUserName();
|
|
72
|
+
this.setToggleButtonText();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
uniqueId(text) {
|
|
76
|
+
return "loginlink-" + text.replace(/[^A-Za-z0-9.\\\/]/igm, "") + "-" + (this.emitEvents ? "1" : "2");
|
|
77
|
+
}
|
|
78
|
+
linkAppearanceAttributes(link) {
|
|
79
|
+
let attributes = {};
|
|
80
|
+
if (link.linkType) {
|
|
81
|
+
switch (link.linkType) {
|
|
82
|
+
case 'primary':
|
|
83
|
+
attributes = {
|
|
84
|
+
appearance: '',
|
|
85
|
+
variant: ''
|
|
86
|
+
};
|
|
87
|
+
break;
|
|
88
|
+
case 'secondary':
|
|
89
|
+
attributes = {
|
|
90
|
+
appearance: 'light',
|
|
91
|
+
variant: 'outlined'
|
|
92
|
+
};
|
|
93
|
+
break;
|
|
94
|
+
case 'regularlink':
|
|
95
|
+
default:
|
|
96
|
+
attributes = {
|
|
97
|
+
appearance: 'light',
|
|
98
|
+
variant: 'borderless',
|
|
99
|
+
icon: 'arrow-right'
|
|
100
|
+
};
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
return attributes;
|
|
104
|
+
}
|
|
105
|
+
if (!link.linkType) {
|
|
106
|
+
attributes = {
|
|
107
|
+
appearance: link.primaryLinkApperance ? "dark" : "light"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return attributes;
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
if (!this.loginDialog) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
let hostElementAttribute = {
|
|
118
|
+
username: null
|
|
119
|
+
};
|
|
120
|
+
if (this.username) {
|
|
121
|
+
hostElementAttribute.username = this.username;
|
|
122
|
+
}
|
|
123
|
+
return (h(Host, Object.assign({}, hostElementAttribute),
|
|
124
|
+
h("pn-nav-dropdown", { label: this.toggleButtonText, icon: "user", class: "siteheader-logindialog" }, (!this.loginDialog.overrideLoginMenu) ?
|
|
125
|
+
h("div", { "data-loggedin": this.loggedin + '' }, (!this.loggedin) ?
|
|
126
|
+
h("div", null, (_a = this.loginDialog.loginTitle) !== null && _a !== void 0 ? _a : h("strong", null, this.loginDialog.loginTitle),
|
|
127
|
+
((_b = this.loginDialog.loginMenuLinks) === null || _b === void 0 ? void 0 : _b.length) > 0 ?
|
|
128
|
+
h("ul", null, this.loginDialog.loginMenuLinks.map((link, i) => {
|
|
129
|
+
const href = (i === 0 && !link.href) ? this.loginManager.getLoginUrl() : link.href;
|
|
130
|
+
return (h("li", null,
|
|
131
|
+
h("pn-button", Object.assign({ href: href, id: this.uniqueId(link.linkText) }, this.linkAppearanceAttributes(link), (link.openInNewWindow && { target: '_blank' })), link.linkText)));
|
|
132
|
+
}))
|
|
133
|
+
: (h("ul", null,
|
|
134
|
+
h("li", null,
|
|
135
|
+
h("pn-button", { href: this.loginManager.getLoginUrl(this.loginDialog.loginUrl), target: "_top" }, this.loginDialog.loginLinkText)),
|
|
136
|
+
h("li", null,
|
|
137
|
+
h("pn-button", { href: this.loginDialog.registerUrl, target: "_top", appearance: "light", variant: "outlined" }, this.loginDialog.createLoginLinkText)))))
|
|
138
|
+
:
|
|
139
|
+
h("div", null,
|
|
140
|
+
h("ul", null, this.loginDialog.loggedInLinks.map((link) => {
|
|
141
|
+
const isLogoutLink = link.href.indexOf('logout') !== -1;
|
|
142
|
+
const href = (isLogoutLink) ? this.loginManager.getLogoutUrl(link.href.replace('logout', '').replace('http://window.location.href/?', '').replace('https://window.location.href/?', '')) : link.href;
|
|
143
|
+
return (h("li", null,
|
|
144
|
+
h("pn-button", Object.assign({ href: href, id: this.uniqueId(link.linkText) }, (link.openInNewWindow && { target: '_blank' }), this.linkAppearanceAttributes(link), { onClick: () => { if (isLogoutLink) {
|
|
145
|
+
this.loginManager.clearUserData();
|
|
146
|
+
} } }), link.linkText)));
|
|
147
|
+
}))))
|
|
148
|
+
:
|
|
149
|
+
h("div", null,
|
|
150
|
+
h("ul", null, (_c = this.loginDialog.loginMenuLinks) === null || _c === void 0 ? void 0 : _c.map(link => h("li", null,
|
|
151
|
+
h("a", { href: link.href, target: link.openInNewWindow ? "_blank" : "_self", class: "btn btn-link" }, link.linkText))))))));
|
|
152
|
+
}
|
|
153
|
+
static get is() { return "pn-marketweb-siteheader-profileselection"; }
|
|
154
|
+
static get originalStyleUrls() { return {
|
|
155
|
+
"$": ["pn-marketweb-siteheader-profileselection.scss"]
|
|
156
|
+
}; }
|
|
157
|
+
static get styleUrls() { return {
|
|
158
|
+
"$": ["pn-marketweb-siteheader-profileselection.css"]
|
|
159
|
+
}; }
|
|
160
|
+
static get properties() { return {
|
|
161
|
+
"endpoint": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"mutable": false,
|
|
164
|
+
"complexType": {
|
|
165
|
+
"original": "string",
|
|
166
|
+
"resolved": "string",
|
|
167
|
+
"references": {}
|
|
168
|
+
},
|
|
169
|
+
"required": false,
|
|
170
|
+
"optional": false,
|
|
171
|
+
"docs": {
|
|
172
|
+
"tags": [],
|
|
173
|
+
"text": "Specifies which endpoint domain we should load from"
|
|
174
|
+
},
|
|
175
|
+
"attribute": "endpoint",
|
|
176
|
+
"reflect": false,
|
|
177
|
+
"defaultValue": "\"\""
|
|
178
|
+
},
|
|
179
|
+
"token": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"mutable": false,
|
|
182
|
+
"complexType": {
|
|
183
|
+
"original": "string",
|
|
184
|
+
"resolved": "string",
|
|
185
|
+
"references": {}
|
|
186
|
+
},
|
|
187
|
+
"required": false,
|
|
188
|
+
"optional": false,
|
|
189
|
+
"docs": {
|
|
190
|
+
"tags": [],
|
|
191
|
+
"text": "Access token passed from backend"
|
|
192
|
+
},
|
|
193
|
+
"attribute": "token",
|
|
194
|
+
"reflect": false,
|
|
195
|
+
"defaultValue": "\"\""
|
|
196
|
+
},
|
|
197
|
+
"i18n": {
|
|
198
|
+
"type": "any",
|
|
199
|
+
"mutable": false,
|
|
200
|
+
"complexType": {
|
|
201
|
+
"original": "any",
|
|
202
|
+
"resolved": "any",
|
|
203
|
+
"references": {}
|
|
204
|
+
},
|
|
205
|
+
"required": false,
|
|
206
|
+
"optional": false,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": ""
|
|
210
|
+
},
|
|
211
|
+
"attribute": "i-1-8n",
|
|
212
|
+
"reflect": false
|
|
213
|
+
},
|
|
214
|
+
"emitEvents": {
|
|
215
|
+
"type": "boolean",
|
|
216
|
+
"mutable": false,
|
|
217
|
+
"complexType": {
|
|
218
|
+
"original": "boolean",
|
|
219
|
+
"resolved": "boolean",
|
|
220
|
+
"references": {}
|
|
221
|
+
},
|
|
222
|
+
"required": false,
|
|
223
|
+
"optional": false,
|
|
224
|
+
"docs": {
|
|
225
|
+
"tags": [],
|
|
226
|
+
"text": ""
|
|
227
|
+
},
|
|
228
|
+
"attribute": "emit-events",
|
|
229
|
+
"reflect": false,
|
|
230
|
+
"defaultValue": "true"
|
|
231
|
+
},
|
|
232
|
+
"loginDialog": {
|
|
233
|
+
"type": "unknown",
|
|
234
|
+
"mutable": true,
|
|
235
|
+
"complexType": {
|
|
236
|
+
"original": "LoginDialog",
|
|
237
|
+
"resolved": "LoginDialog",
|
|
238
|
+
"references": {
|
|
239
|
+
"LoginDialog": {
|
|
240
|
+
"location": "import",
|
|
241
|
+
"path": "./pn-marketweb-siteheader-types"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"required": false,
|
|
246
|
+
"optional": false,
|
|
247
|
+
"docs": {
|
|
248
|
+
"tags": [],
|
|
249
|
+
"text": ""
|
|
250
|
+
},
|
|
251
|
+
"defaultValue": "null"
|
|
252
|
+
},
|
|
253
|
+
"fullname": {
|
|
254
|
+
"type": "string",
|
|
255
|
+
"mutable": false,
|
|
256
|
+
"complexType": {
|
|
257
|
+
"original": "string",
|
|
258
|
+
"resolved": "string",
|
|
259
|
+
"references": {}
|
|
260
|
+
},
|
|
261
|
+
"required": false,
|
|
262
|
+
"optional": false,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": "User Fullname"
|
|
266
|
+
},
|
|
267
|
+
"attribute": "fullname",
|
|
268
|
+
"reflect": false,
|
|
269
|
+
"defaultValue": "\"\""
|
|
270
|
+
},
|
|
271
|
+
"loggedin": {
|
|
272
|
+
"type": "boolean",
|
|
273
|
+
"mutable": false,
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "boolean",
|
|
276
|
+
"resolved": "boolean",
|
|
277
|
+
"references": {}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": false,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [],
|
|
283
|
+
"text": ""
|
|
284
|
+
},
|
|
285
|
+
"attribute": "loggedin",
|
|
286
|
+
"reflect": false,
|
|
287
|
+
"defaultValue": "false"
|
|
288
|
+
}
|
|
289
|
+
}; }
|
|
290
|
+
static get states() { return {
|
|
291
|
+
"loginManager": {},
|
|
292
|
+
"toggleButtonText": {},
|
|
293
|
+
"username": {}
|
|
294
|
+
}; }
|
|
295
|
+
static get events() { return [{
|
|
296
|
+
"method": "loginStateChange",
|
|
297
|
+
"name": "loginStateChange",
|
|
298
|
+
"bubbles": true,
|
|
299
|
+
"cancelable": true,
|
|
300
|
+
"composed": true,
|
|
301
|
+
"docs": {
|
|
302
|
+
"tags": [],
|
|
303
|
+
"text": ""
|
|
304
|
+
},
|
|
305
|
+
"complexType": {
|
|
306
|
+
"original": "any",
|
|
307
|
+
"resolved": "any",
|
|
308
|
+
"references": {}
|
|
309
|
+
}
|
|
310
|
+
}]; }
|
|
311
|
+
static get elementRef() { return "hostElement"; }
|
|
312
|
+
static get watchers() { return [{
|
|
313
|
+
"propName": "i18n",
|
|
314
|
+
"methodName": "init"
|
|
315
|
+
}, {
|
|
316
|
+
"propName": "loginDialog",
|
|
317
|
+
"methodName": "init"
|
|
318
|
+
}]; }
|
|
319
|
+
}
|
|
@@ -41,7 +41,7 @@ export class PnMarketwebSiteheaderSearch {
|
|
|
41
41
|
if (!data || !data.hits || !data.hits.length) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
const suggestions = data.hits.map((item) => {
|
|
44
|
+
const suggestions = data.hits.filter(item => item.type === "editorial").map((item) => {
|
|
45
45
|
return item.query;
|
|
46
46
|
});
|
|
47
47
|
// Store query in store
|
|
@@ -51,7 +51,7 @@ const PrimaryTemplate = ({ ...args }) => {
|
|
|
51
51
|
hide-search="false"
|
|
52
52
|
hide-login="false"
|
|
53
53
|
cache="false"
|
|
54
|
-
|
|
54
|
+
autocomplete-endpoint="http://localhost:51444/find_v2/_autocomplete"
|
|
55
55
|
session-forward="true">
|
|
56
56
|
<a href="" class="header-cart" slot="toprightend" style="align-self:center;position:relative;text-decoration:none;">
|
|
57
57
|
<span>Varukorg</span>
|
|
@@ -69,7 +69,7 @@ Content that is higher than 100% viewport height
|
|
|
69
69
|
-->
|
|
70
70
|
`;
|
|
71
71
|
};
|
|
72
|
-
//
|
|
72
|
+
//
|
|
73
73
|
export const Primary = PrimaryTemplate.bind({});
|
|
74
74
|
Primary.args = {
|
|
75
75
|
market : "se",
|
|
@@ -128,6 +128,12 @@ export const PnMarketwebSiteheaderLogin: {
|
|
|
128
128
|
new (): PnMarketwebSiteheaderLogin;
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
interface PnMarketwebSiteheaderProfileselection extends Components.PnMarketwebSiteheaderProfileselection, HTMLElement {}
|
|
132
|
+
export const PnMarketwebSiteheaderProfileselection: {
|
|
133
|
+
prototype: PnMarketwebSiteheaderProfileselection;
|
|
134
|
+
new (): PnMarketwebSiteheaderProfileselection;
|
|
135
|
+
};
|
|
136
|
+
|
|
131
137
|
interface PnMarketwebSiteheaderSearch extends Components.PnMarketwebSiteheaderSearch, HTMLElement {}
|
|
132
138
|
export const PnMarketwebSiteheaderSearch: {
|
|
133
139
|
prototype: PnMarketwebSiteheaderSearch;
|