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uBrB,EAC/C,OACIC,EAAAA,cAAAA,EAAAA,SAAA,KACIA,EAAAA,cAACU,EAAAA,KAAIC,OAAAC,OAAA,GAAKO,EAAc,CAAEE,QAAStB,EAAMuB,oBAChB,QADiCJ,EACrDnB,EAAMwB,OAAOC,eAAO,IAAAN,OAAA,EAApBA,EAAsBO,KACvBzB,EAAAA,cAACU,EAAAA,KAAIC,OAAAC,OAAA,GAAKQ,KAEbrB,EAAM2B,iBAAmBxB,EAAuBH,GAAS,OAoCQ4B,CAAmB5B,YC1DjG0K,EAAOC,QAAU1K,cCAjByK,EAAOC,QAAUC","sources":["webpack://suedwolle/./src/themes/suedwolle/views/site-picker.view.tsx?274b","webpack://suedwolle/./lib/site-picker/module-registration.js?c0d1","webpack://suedwolle/./src/modules/site-picker/site-picker.tsx?b9ec","webpack://suedwolle/./src/modules/site-picker/site-picker.view.tsx?5319","webpack://suedwolle/external var \"React\"?0d3b","webpack://suedwolle/external var \"ReactDOM\"?853b"],"sourcesContent":["/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nimport { ISitePickerViewProps } from '@msdyn365-commerce-modules/site-picker/src/modules/site-picker/./site-picker';\r\n\r\nexport default (props: ISitePickerViewProps) => {\r\n return <>{_renderSitePicker(props)};\r\n};\r\n\r\nconst _renderDesktopView = (props: ISitePickerViewProps) => {\r\n const { SitePickerMenu, SitePickerMenuSpan } = props;\r\n return (\r\n <>\r\n \r\n {props.config.heading?.text}\r\n \r\n \r\n {props.siteOptionsState ? _renderSiteOptionsList(props) : null}\r\n \r\n );\r\n};\r\n\r\nconst _renderSiteOptionsList = (props: ISitePickerViewProps): React.ReactNode => {\r\n const { SitePickerMenuList, SitePickerMenuListItem, SitePickerMenuListItemArray } = props;\r\n const options = SitePickerMenuListItemArray!.map((item, index) => {\r\n return (\r\n \r\n {item}\r\n \r\n );\r\n });\r\n return (\r\n \r\n {options}\r\n \r\n );\r\n};\r\n\r\n// const _renderMobileView = (props: ISitePickerViewProps): React.ReactNode => {\r\n// const { SitePickerMobileContainer } = props;\r\n// return (\r\n// \r\n//
\r\n// {props.SitePickerMenuListItemArray?.map((item, index) => {\r\n// return
{item}
;\r\n// })}\r\n//
\r\n//
\r\n// );\r\n// };\r\n\r\nconst _renderSitePicker = (props: ISitePickerViewProps): React.ReactNode => {\r\n const {\r\n // isMobileView,\r\n SitePicker\r\n } = props;\r\n return (\r\n \r\n {// isMobileView ? _renderMobileView(props) :\r\n _renderDesktopView(props)}\r\n \r\n );\r\n};\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['site-picker'] = {\n c: () => require('@msdyn365-commerce-modules/site-picker/dist/lib/modules/site-picker/site-picker'),\n $type: 'contentModule',\n da: [],\n \n iNM: true,\n ns: '@msdyn365-commerce-modules',\n n: 'site-picker',\n p: 'site-picker',\n \n pdp: '',\n \n \n md: 'node_modules/@msdyn365-commerce-modules/site-picker/dist/lib/modules/site-picker'\n });\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|themes|suedwolle|views|site-picker'] = {\n c: () => require('partner/themes/suedwolle/views/site-picker.view.tsx'),\n cn: '__local__-__local__-site-picker'\n };\nviewDictionary['@msdyn365-commerce-modules|site-picker|modules|site-picker|site-picker'] = {\n c: () => require('@msdyn365-commerce-modules/site-picker/dist/lib/modules/site-picker/site-picker.view.js'),\n cn: '@msdyn365-commerce-modules-site-picker-site-picker'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport MsDyn365, { IImageSettings, Image } from '@msdyn365-commerce/core';\nimport { addThrottledEvent, Drawer, IModuleProps, INodeProps, KeyCodes, NodeTag } from '@msdyn365-commerce-modules/utilities';\nimport classnames from 'classnames';\nimport { computed, observable } from 'mobx';\nimport React from 'react';\n\nimport { ISitePickerConfig, ISitePickerProps } from './site-picker.props.autogenerated';\n\nexport interface ISitePickerViewProps extends ISitePickerProps {\n SitePicker: IModuleProps;\n SitePickerMenu: INodeProps;\n SitePickerMenuSpan: INodeProps;\n SitePickerMenuList: INodeProps;\n SitePickerMenuListItem: INodeProps;\n SitePickerMenuListItemArray: React.ReactNode[] | undefined;\n siteOptionsState: boolean;\n SitePickerMobileContainer: INodeProps;\n isMobileView: boolean;\n renderSiteOptions(): void;\n resetSiteOptionsState(): void;\n}\n\nexport type GridSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\ninterface ISitePickerState {\n expandSiteOptions: boolean;\n isMobile: boolean;\n}\n\n/**\n *\n * SitePicker component.\n * @extends {React.PureComponent>}\n */\nclass SitePicker extends React.PureComponent, ISitePickerState> {\n private readonly _cookieName: string = '_msdyn365___site_';\n\n private readonly _cookieExpirationInSeconds: number = 5_184_000;\n\n private readonly _sitePickerMenuNode: React.RefObject;\n\n private readonly _sitePickerMenuButton: React.RefObject;\n\n private resizeThrottledEventHandler?: (event: Event) => void;\n\n @observable\n private viewport: GridSize;\n\n public constructor(props: ISitePickerViewProps) {\n super(props);\n this._handleChange = this._handleChange.bind(this);\n this._sitePickerMenuNode = React.createRef();\n this._sitePickerMenuButton = React.createRef();\n this._renderSiteOptions = this._renderSiteOptions.bind(this);\n this._resetSiteOptionsState = this._resetSiteOptionsState.bind(this);\n this._escFunction = this._escFunction.bind(this);\n this._handleOutsideClick = this._handleOutsideClick.bind(this);\n this._updateViewport = this._updateViewport.bind(this);\n this.viewport =\n props.context.request && props.context.request.device && props.context.request.device.Type === 'Mobile' ? 'xs' : 'lg';\n this.state = {\n expandSiteOptions: false,\n isMobile: this.isMobile\n };\n }\n\n @computed get isMobile(): boolean {\n return this.viewport === 'xs' || this.viewport === 'sm';\n }\n\n public componentDidMount(): void {\n if (MsDyn365.isBrowser) {\n document?.addEventListener('keydown', (this._escFunction as unknown) as EventListener, false);\n document?.body?.addEventListener('mousedown', this._handleOutsideClick);\n this.resizeThrottledEventHandler = window && addThrottledEvent(window, 'resize', this._updateViewport as EventListener);\n this._updateViewport();\n }\n }\n\n public componentWillUnmount(): void {\n if (MsDyn365.isBrowser) {\n document?.removeEventListener('keydown', (this._escFunction as unknown) as EventListener, false);\n document?.body?.removeEventListener('mousedown', this._handleOutsideClick, false);\n window && window.removeEventListener('resize', this.resizeThrottledEventHandler!, false);\n }\n }\n\n public render(): JSX.Element | null {\n const viewProps: ISitePickerViewProps = {\n ...(this.props as ISitePickerProps),\n SitePicker: {\n moduleProps: this.props,\n className: classnames('ms-site-picker', this.props.config.className, this.state.isMobile ? 'mobile-view' : 'desktop-view'),\n tag: 'div'\n },\n SitePickerMenu: {\n tag: 'button' as NodeTag,\n className: 'ms-site-picker__button',\n 'aria-label': this.props.config.heading?.text,\n 'aria-expanded': this.state.expandSiteOptions,\n onClick: this.props,\n ref: this._sitePickerMenuButton\n },\n SitePickerMenuSpan: {\n className: 'ms-site-picker__span',\n tag: 'span'\n },\n SitePickerMenuList: {\n className: 'ms-site-picker__list',\n role: 'menu',\n tag: 'ul',\n ref: this._sitePickerMenuNode\n },\n SitePickerMenuListItem: {\n className: 'ms-site-picker__list__item',\n role: 'presentation',\n tag: 'li'\n },\n SitePickerMobileContainer: {\n tag: Drawer,\n className: 'ms-site-picker__drawer',\n toggleButtonText: this.props.config.heading?.text,\n openGlyph: 'ms-site-picker__drawer-open',\n closeGlyph: 'ms-site-picker__drawer-close',\n glyphPlacement: 'end'\n },\n isMobileView: this.state.isMobile,\n SitePickerMenuListItemArray: this._renderSitePickerImage(),\n renderSiteOptions: this._renderSiteOptions,\n resetSiteOptionsState: this._resetSiteOptionsState,\n siteOptionsState: this.state.expandSiteOptions\n };\n return this.props.renderView(viewProps);\n }\n\n private _renderSiteOptions(): void {\n const expandSiteOptionsState = this.state.expandSiteOptions;\n this.setState({\n expandSiteOptions: !expandSiteOptionsState\n });\n }\n\n private _resetSiteOptionsState(): void {\n this.setState({\n expandSiteOptions: false\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly _escFunction = (event: any) => {\n const key = event.keyCode;\n if (this.state.expandSiteOptions) {\n switch (key) {\n case KeyCodes.Escape: {\n setTimeout(() => {\n const nextFocus = document && document.activeElement;\n if (\n this._sitePickerMenuButton?.current?.contains(nextFocus) ||\n this._sitePickerMenuNode?.current?.contains(nextFocus)\n ) {\n this._resetSiteOptionsState();\n this._sitePickerMenuButton?.current?.focus();\n }\n }, 50);\n break;\n }\n case KeyCodes.Tab: {\n setTimeout(() => {\n const nextFocus = document && document.activeElement;\n if (\n !this._sitePickerMenuButton?.current?.contains(nextFocus) &&\n !this._sitePickerMenuNode?.current?.contains(nextFocus)\n ) {\n this._resetSiteOptionsState();\n }\n }, 50);\n break;\n }\n default:\n return;\n }\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly _handleOutsideClick = (event: any) => {\n if (\n (this._sitePickerMenuButton.current?.contains(event.target) && this.state.expandSiteOptions) ||\n (this._sitePickerMenuNode.current?.contains(event.target) && this.state.expandSiteOptions)\n ) {\n return;\n }\n this._resetSiteOptionsState();\n };\n\n private _handleChange(e: React.MouseEvent): void {\n e.preventDefault();\n if (e.currentTarget.href && e.currentTarget.href.length > 0 && window) {\n if (this.props.context.request.cookies.isConsentGiven()) {\n const cookieConfig = { maxAge: this._cookieExpirationInSeconds };\n this.props.context.request.cookies.set(this._cookieName, e.currentTarget.href, cookieConfig);\n }\n window.location.assign(e.currentTarget.href);\n }\n }\n\n private _renderSitePickerImage(): React.ReactNode[] | undefined {\n const defaultImageSettings: IImageSettings = {\n viewports: {\n xs: { q: 'w=50&h=25&m=6', w: 0, h: 0 },\n sm: { q: 'w=50&h=25&m=6', w: 0, h: 0 },\n md: { q: 'w=40&h=20&m=6', w: 0, h: 0 },\n lg: { q: 'w=40&h=20&m=6', w: 0, h: 0 },\n xl: { q: 'w=40&h=20&m=6', w: 0, h: 0 }\n },\n lazyload: true\n };\n const siteOptions = this.props.config.siteOptions && this.props.config.siteOptions;\n return (\n siteOptions &&\n siteOptions.map((item, index) => {\n const image = item?.siteImage;\n const imageProps = {\n gridSettings: this.props.context.request.gridSettings!,\n imageSettings: image?.imageSettings?.viewports ? image.imageSettings : defaultImageSettings\n };\n return (\n \n {item?.siteName}\n \n \n );\n })\n );\n }\n\n private _updateViewport(): void {\n this.viewport = this._getViewport();\n this.setState({ isMobile: this.isMobile });\n }\n\n private _getViewport(): GridSize {\n const { context } = this.props;\n if (context.request && context.request.device && context.request.device.Type === 'Mobile') {\n return 'xs';\n }\n\n if (typeof window !== undefined && window.innerWidth) {\n const gridSettings = context.request.gridSettings;\n if (gridSettings) {\n if (gridSettings.xs && window.innerWidth <= gridSettings.xs.w) {\n return 'xs';\n } else if (gridSettings.sm && window.innerWidth <= gridSettings.sm.w) {\n return 'sm';\n } else if (gridSettings.md && window.innerWidth <= gridSettings.md.w) {\n return 'md';\n } else if (gridSettings.lg && window.innerWidth <= gridSettings.lg.w) {\n return 'lg';\n }\n return 'xl';\n }\n }\n return 'xs';\n }\n}\n\nexport default SitePicker;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\nimport * as React from 'react';\n\nimport { ISitePickerViewProps } from './site-picker';\n\nexport default (props: ISitePickerViewProps) => {\n return <>{_renderSitePicker(props)};\n};\n\nconst _renderDesktopView = (props: ISitePickerViewProps) => {\n const { SitePickerMenu, SitePickerMenuSpan } = props;\n return (\n <>\n \n {props.config.heading?.text}\n \n \n {props.siteOptionsState ? _renderSiteOptionsList(props) : null}\n \n );\n};\n\nconst _renderSiteOptionsList = (props: ISitePickerViewProps): React.ReactNode => {\n const { SitePickerMenuList, SitePickerMenuListItem, SitePickerMenuListItemArray } = props;\n const options = SitePickerMenuListItemArray!.map((item, index) => {\n return (\n \n {item}\n \n );\n });\n return (\n \n {options}\n \n );\n};\n\nconst _renderMobileView = (props: ISitePickerViewProps): React.ReactNode => {\n const { SitePickerMobileContainer } = props;\n return (\n \n
\n {props.SitePickerMenuListItemArray?.map((item, index) => {\n return
{item}
;\n })}\n
\n
\n );\n};\n\nconst _renderSitePicker = (props: ISitePickerViewProps): React.ReactNode => {\n const { isMobileView, SitePicker } = props;\n return {isMobileView ? _renderMobileView(props) : _renderDesktopView(props)};\n};\n","module.exports = React;","module.exports = ReactDOM;"],"names":["props","React","_renderSitePicker","_renderSiteOptionsList","SitePickerMenuList","SitePickerMenuListItem","SitePickerMenuListItemArray","options","map","item","index","Node","Object","assign","key","onMouseLeave","resetSiteOptionsState","SitePicker","Module","_props$config$heading","SitePickerMenu","SitePickerMenuSpan","onClick","renderSiteOptions","config","heading","text","siteOptionsState","_renderDesktopView","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","_objectSpread","viewDictionary","cn","constructor","super","_cookieName","_cookieExpirationInSeconds","_escFunction","event","keyCode","this","state","expandSiteOptions","KeyCodes","Escape","setTimeout","_this$_sitePickerMenu","_this$_sitePickerMenu2","nextFocus","document","activeElement","_this$_sitePickerMenu3","_sitePickerMenuButton","current","contains","_sitePickerMenuNode","_resetSiteOptionsState","focus","Tab","_this$_sitePickerMenu4","_this$_sitePickerMenu5","_handleOutsideClick","_this$_sitePickerMenu6","_this$_sitePickerMenu7","target","_handleChange","bind","_renderSiteOptions","_updateViewport","viewport","context","request","device","Type","isMobile","componentDidMount","_document","_document2","MsDyn365","isBrowser","addEventListener","body","resizeThrottledEventHandler","addThrottledEvent","componentWillUnmount","_document3","_document4","removeEventListener","render","_this$props$config$he","_this$props$config$he2","viewProps","moduleProps","className","classnames","tag","ref","role","SitePickerMobileContainer","Drawer","toggleButtonText","openGlyph","closeGlyph","glyphPlacement","isMobileView","_renderSitePickerImage","renderView","expandSiteOptionsState","setState","e","preventDefault","currentTarget","href","length","cookies","isConsentGiven","cookieConfig","maxAge","set","location","defaultImageSettings","viewports","xs","q","w","h","sm","lg","xl","lazyload","siteOptions","_image$imageSettings","_item$siteRedirectUrl","image","siteImage","imageProps","gridSettings","imageSettings","tabIndex","siteRedirectUrl","destinationUrl","siteName","Image","requestContext","src","altText","loadFailureBehavior","shouldSkipToMainImage","_getViewport","undefined","innerWidth","__decorate","observable","computed","_props$SitePickerMenu","_renderMobileView","module","exports","ReactDOM"],"sourceRoot":""}