{"version":3,"sources":["webpack:///src/modules/site-picker/site-picker.view.tsx?dcff","webpack:///external \"React\"?c481","webpack:///external \"ReactDOM\"?4b2d","webpack:///src/modules/site-picker/site-picker.tsx?35ca","webpack:///./lib/site-picker/module-registration.js?c0d1"],"names":["props","React","_renderSitePicker","_renderSiteOptionsList","SitePickerMenuList","SitePickerMenuListItem","SitePickerMenuListItemArray","options","map","item","index","Node","Object","assign","key","onMouseLeave","resetSiteOptionsState","isMobileView","SitePicker","Module","_props$SitePickerMenu","SitePickerMobileContainer","onClick","renderSiteOptions","_renderMobileView","_props$config$heading","SitePickerMenu","SitePickerMenuSpan","config","heading","text","siteOptionsState","_renderDesktopView","module","exports","ReactDOM","PureComponent","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","createRef","_renderSiteOptions","_updateViewport","viewport","context","request","device","Type","isMobile","componentDidMount","_document","_document2","MsDyn365","isBrowser","addEventListener","body","resizeThrottledEventHandler","window","addThrottledEvent","componentWillUnmount","_document3","_document4","removeEventListener","render","_this$props$config$he","_this$props$config$he2","viewProps","_objectSpread","moduleProps","className","classnames","tag","ref","role","Drawer","toggleButtonText","openGlyph","closeGlyph","glyphPlacement","_renderSitePickerImage","renderView","expandSiteOptionsState","setState","e","preventDefault","currentTarget","href","length","cookies","isConsentGiven","cookieConfig","maxAge","set","location","defaultImageSettings","viewports","xs","q","w","h","sm","md","lg","xl","lazyload","siteOptions","_image$imageSettings","_item$siteRedirectUrl","image","siteImage","imageProps","gridSettings","imageSettings","createElement","tabIndex","siteRedirectUrl","destinationUrl","siteName","Image","requestContext","src","altText","loadFailureBehavior","shouldSkipToMainImage","_getViewport","undefined","innerWidth","__decorate","observable","computed","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","__bindings__","viewDictionary","cn"],"mappings":";4IAUgBA,aACLC,2BAAA,KAAGC,EAAkBF,IAGhC,MAaMG,EAA0BH,IAC5B,MAAM,mBAAEI,EAAkB,uBAAEC,EAAsB,4BAAEC,GAAgCN,EAC9EO,EAAUD,EAA6BE,IAAI,CAACC,EAAMC,IAEhDT,gBAACU,OAAIC,OAAAC,OAAA,GAAKR,EAAsB,CAAES,IAAKJ,IAClCD,IAIb,OACIR,gBAACU,OAAIC,OAAAC,OAAA,GAAKT,EAAkB,CAAEW,aAAcf,EAAMgB,wBAC7CT,IAkBPL,EAAqBF,IACvB,MAAM,aAAEiB,EAAY,WAAEC,GAAelB,EACrC,OAAOC,gBAACkB,SAAMP,OAAAC,OAAA,GAAKK,GAAaD,EAfTjB,KAAgD,IAAAoB,EACvE,MAAM,0BAAEC,GAA8BrB,EACtC,OACIC,gBAACU,OAAIC,OAAAC,OAAA,GAAKQ,EAAyB,CAAEC,QAAStB,EAAMuB,oBAChDtB,gBAAA,WACsC,QADtCmB,EACKpB,EAAMM,mCAA2B,IAAAc,OAAA,EAAjCA,EAAmCZ,IAAI,CAACC,EAAMC,IACpCT,gBAAA,OAAKa,IAAKJ,GAAQD,OASMe,CAAkBxB,GA5CzCA,KAA+B,IAAAyB,EACvD,MAAM,eAAEC,EAAc,mBAAEC,GAAuB3B,EAC/C,OACIC,2BAAA,KACIA,gBAACU,OAAIC,OAAAC,OAAA,GAAKa,EAAc,CAAEJ,QAAStB,EAAMuB,oBAChB,QADiCE,EACrDzB,EAAM4B,OAAOC,eAAO,IAAAJ,OAAA,EAApBA,EAAsBK,KACvB7B,gBAACU,OAAIC,OAAAC,OAAA,GAAKc,KAEb3B,EAAM+B,iBAAmB5B,EAAuBH,GAAS,OAoCQgC,CAAmBhC,M,mBC1DjGiC,EAAOC,QA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HC,IAAK,GAGLxC,GAAI,oFAKR5C,OAAOqF,aAAerF,OAAOqF,cAAgB,GAC7CrF,OAAOqF,aAAaX,QAAOhE,IAAA,GACpBV,OAAOqF,aAAaX,SAAW,IAC/BD,EAAQC,SAGX1E,OAAOqF,aAAaV,YAAWjE,IAAA,GAC5BV,OAAOqF,aAAaV,aAAe,IACnCF,EAAQE,aAEY,MAAMW,EAAiB,GAC9BA,EAAe,0EAA4E,CACnGV,EAAGA,IAAMC,EAAQ,QACjBU,GAAI,sDAEpBvF,OAAOqF,aAAerF,OAAOqF,cAAgB,GAC7CrF,OAAOqF,aAAaC,eAAc5E,IAAA,GACPV,OAAOqF,aAAaC,gBAAkB,IACtCA,K","file":"static/js/138.1d193464cbc5801574bc.chunk.js","sourcesContent":["/*!\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;","/*!\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","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['@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 };"],"sourceRoot":""}