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IACtCA,UCtC3BE,EAAOC,QAAUnH,cCAjBkH,EAAOC,QAAUC","sources":["webpack://Dobbies.Commerce/./src/modules/dobbies-new-store-locator/dobbies-new-store-locator.tsx?c179","webpack://Dobbies.Commerce/./src/modules/dobbies-new-store-locator/dobbies-new-store-locator.view.tsx?e889","webpack://Dobbies.Commerce/./lib/dobbies-new-store-locator/module-registration.js?4d25","webpack://Dobbies.Commerce/external var \"React\"?0d3b","webpack://Dobbies.Commerce/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 * as React from 'react';\r\n\r\nimport { IDobbiesNewStoreLocatorData } from './dobbies-new-store-locator.data';\r\nimport { IDobbiesNewStoreLocatorProps } from './dobbies-new-store-locator.props.autogenerated';\r\n\r\nexport interface IDobbiesNewStoreLocatorViewProps extends IDobbiesNewStoreLocatorProps {}\r\n\r\nexport interface IDobbiesNewStore {\r\n name?: string;\r\n pageUrl?: string;\r\n}\r\n\r\nexport interface IDobbiesNewStoreLocatorSortedData {\r\n alphabet: string;\r\n stores: IDobbiesNewStore[];\r\n}\r\n\r\n/**\r\n *\r\n * DobbiesNewStoreLocator component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass DobbiesNewStoreLocator extends React.PureComponent> {\r\n public render(): JSX.Element | null {\r\n return this.props.renderView(this.props);\r\n }\r\n}\r\n\r\nexport default DobbiesNewStoreLocator;\r\n","/*!\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 * as React from 'react';\r\nimport { IDobbiesNewStore, IDobbiesNewStoreLocatorViewProps } from './dobbies-new-store-locator';\r\nimport MsDyn365 from '@msdyn365-commerce/core';\r\nimport { IStoresInfoData } from './dobbies-new-store-locator.props.autogenerated';\r\nexport interface IDobbiesStoresByRegions {\r\n regionName: string;\r\n stores: IDobbiesNewStore[][];\r\n}\r\n\r\nexport default (props: IDobbiesNewStoreLocatorViewProps) => {\r\n const [selectedAlphabet, setSelectedAlphabet] = React.useState('');\r\n const [storesByRegions, setStoresByRegions] = React.useState([]);\r\n const [noStoreAlphabetsState, setNoStoreAlphabets] = React.useState([]);\r\n const alphabetsList = [\r\n 'A',\r\n 'B',\r\n 'C',\r\n 'D',\r\n 'E',\r\n 'F',\r\n 'G',\r\n 'H',\r\n 'I',\r\n 'J',\r\n 'K',\r\n 'L',\r\n 'M',\r\n 'N',\r\n 'O',\r\n 'P',\r\n 'Q',\r\n 'R',\r\n 'S',\r\n 'T',\r\n 'U',\r\n 'V',\r\n 'W',\r\n 'X',\r\n 'Y',\r\n 'Z'\r\n ];\r\n\r\n const [englandSectionCollapsed, setEnglandSectionCollapsed] = React.useState(false);\r\n const [scotlandSectionCollapsed, setScotlandSectionCollapsed] = React.useState(false);\r\n const [niSectionCollapsed, setNISectionCollapsed] = React.useState(false);\r\n const [walesSectionCollapsed, setWalesSectionCollapsed] = React.useState(false);\r\n const [ldSectionCollapsed, setLDSectionCollapsed] = React.useState(false);\r\n\r\n const collapseUnCollapseRegion = (regionName: string) => {\r\n if (regionName.toLowerCase() === 'england') {\r\n setEnglandSectionCollapsed(!englandSectionCollapsed);\r\n }\r\n if (regionName.toLowerCase() === 'scotland') {\r\n setScotlandSectionCollapsed(!scotlandSectionCollapsed);\r\n }\r\n if (regionName.toLowerCase() === 'northern ireland') {\r\n setNISectionCollapsed(!niSectionCollapsed);\r\n }\r\n if (regionName.toLowerCase() === 'wales') {\r\n setWalesSectionCollapsed(!walesSectionCollapsed);\r\n }\r\n if (regionName.toLowerCase() === 'little dobbies') {\r\n setLDSectionCollapsed(!ldSectionCollapsed);\r\n }\r\n };\r\n\r\n const shouldShowStoresForRegion = (regionName: string) => {\r\n if (regionName.toLowerCase() === 'england') {\r\n return !englandSectionCollapsed;\r\n }\r\n if (regionName.toLowerCase() === 'scotland') {\r\n return !scotlandSectionCollapsed;\r\n }\r\n if (regionName.toLowerCase() === 'northern ireland') {\r\n return !niSectionCollapsed;\r\n }\r\n if (regionName.toLowerCase() === 'wales') {\r\n return !walesSectionCollapsed;\r\n }\r\n if (regionName.toLowerCase() === 'little dobbies') {\r\n return !ldSectionCollapsed;\r\n }\r\n return false;\r\n };\r\n\r\n const _getScreenSize = () => {\r\n if (MsDyn365.isBrowser && window) {\r\n if (window.innerWidth >= 1700) {\r\n return 4;\r\n } else if (window.innerWidth >= 1210 && window.innerWidth < 1700) {\r\n return 3;\r\n } else if (window.innerWidth >= 700 && window.innerWidth < 1210) {\r\n return 2;\r\n } else if (window.innerWidth < 700) {\r\n return 1;\r\n }\r\n }\r\n return -1;\r\n };\r\n const showNoResults = () => {\r\n for (const sbyr of storesByRegions) {\r\n if (sbyr.stores.length && sbyr.stores[0].length) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n\r\n const createStoresDataArray = (regionName: string, storesInfo: IStoresInfoData[]): IDobbiesNewStore[][] => {\r\n const screenSize = _getScreenSize();\r\n const dobbiesStores: IDobbiesNewStore[][] = [];\r\n if (regionName.toLowerCase() === 'england') {\r\n if (screenSize === 4 || screenSize === 3) {\r\n const num_of_rows = 14;\r\n const num_of_columns = 4;\r\n let curr_row_filling = 0;\r\n let curr_col_filling = 0;\r\n const configStores = storesInfo || [];\r\n for (let i = 0; i < num_of_rows; i++) {\r\n dobbiesStores.push([]);\r\n }\r\n for (const cs of configStores) {\r\n if (curr_row_filling < num_of_rows && curr_col_filling < num_of_columns) {\r\n dobbiesStores[curr_row_filling][curr_col_filling] = { name: cs.storeName, pageUrl: cs.storePageUrl };\r\n curr_row_filling = curr_row_filling + 1;\r\n } else if (curr_row_filling >= num_of_rows && curr_col_filling < num_of_columns) {\r\n curr_row_filling = 0;\r\n curr_col_filling = curr_col_filling + 1;\r\n dobbiesStores[curr_row_filling][curr_col_filling] = { name: cs.storeName, pageUrl: cs.storePageUrl };\r\n curr_row_filling = curr_row_filling + 1;\r\n }\r\n }\r\n } else {\r\n const num_of_rows = 28;\r\n const num_of_columns = 2;\r\n let curr_row_filling = 0;\r\n let curr_col_filling = 0;\r\n const configStores = storesInfo || [];\r\n for (let i = 0; i < num_of_rows; i++) {\r\n dobbiesStores.push([]);\r\n }\r\n for (const cs of configStores) {\r\n if (curr_row_filling < num_of_rows && curr_col_filling < num_of_columns) {\r\n dobbiesStores[curr_row_filling][curr_col_filling] = { name: cs.storeName, pageUrl: cs.storePageUrl };\r\n curr_row_filling = curr_row_filling + 1;\r\n } else if (curr_row_filling >= num_of_rows && curr_col_filling < num_of_columns) {\r\n curr_row_filling = 0;\r\n curr_col_filling = curr_col_filling + 1;\r\n dobbiesStores[curr_row_filling][curr_col_filling] = { name: cs.storeName, pageUrl: cs.storePageUrl };\r\n curr_row_filling = curr_row_filling + 1;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (\r\n regionName.toLowerCase() === 'scotland' ||\r\n regionName.toLowerCase() === 'northern ireland' ||\r\n regionName.toLowerCase() === 'wales' ||\r\n regionName.toLowerCase() === 'little dobbies'\r\n ) {\r\n if (screenSize === 4 || screenSize === 3) {\r\n const num_of_rows = 3;\r\n const num_of_columns = 4;\r\n let curr_row_filling = 0;\r\n let curr_col_filling = 0;\r\n const configStores = storesInfo || [];\r\n for (let i = 0; i < num_of_rows; i++) {\r\n dobbiesStores.push([]);\r\n }\r\n for (const cs of configStores) {\r\n if (curr_row_filling < num_of_rows && curr_col_filling < num_of_columns) {\r\n dobbiesStores[curr_row_filling][curr_col_filling] = { name: cs.storeName, pageUrl: cs.storePageUrl };\r\n curr_row_filling = curr_row_filling + 1;\r\n } else if (curr_row_filling >= num_of_rows && curr_col_filling < num_of_columns) {\r\n curr_row_filling = 0;\r\n curr_col_filling = curr_col_filling + 1;\r\n dobbiesStores[curr_row_filling][curr_col_filling] = { name: cs.storeName, pageUrl: cs.storePageUrl };\r\n curr_row_filling = curr_row_filling + 1;\r\n }\r\n }\r\n } else {\r\n const num_of_rows = 6;\r\n const num_of_columns = 2;\r\n let curr_row_filling = 0;\r\n let curr_col_filling = 0;\r\n const configStores = storesInfo || [];\r\n for (let i = 0; i < num_of_rows; i++) {\r\n dobbiesStores.push([]);\r\n }\r\n for (const cs of configStores) {\r\n if (curr_row_filling < num_of_rows && curr_col_filling < num_of_columns) {\r\n dobbiesStores[curr_row_filling][curr_col_filling] = { name: cs.storeName, pageUrl: cs.storePageUrl };\r\n curr_row_filling = curr_row_filling + 1;\r\n } else if (curr_row_filling >= num_of_rows && curr_col_filling < num_of_columns) {\r\n curr_row_filling = 0;\r\n curr_col_filling = curr_col_filling + 1;\r\n dobbiesStores[curr_row_filling][curr_col_filling] = { name: cs.storeName, pageUrl: cs.storePageUrl };\r\n curr_row_filling = curr_row_filling + 1;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return dobbiesStores;\r\n };\r\n\r\n const isANoStoreAlphabet = (alphabet: string) => {\r\n return noStoreAlphabetsState.includes(alphabet);\r\n };\r\n\r\n const updateRegions = () => {\r\n const allStoresByRegions: IDobbiesStoresByRegions[] = [];\r\n const configRegions = props.config.storesByRegionsData || [];\r\n const nostoresAlphabets: string[] = [];\r\n if (configRegions && configRegions.length) {\r\n for (const cr of configRegions) {\r\n if (cr.regionName && cr.storesInfo) {\r\n const stores = createStoresDataArray(cr.regionName, cr.storesInfo);\r\n allStoresByRegions.push({ regionName: cr.regionName, stores: stores });\r\n }\r\n }\r\n }\r\n for (const alpha of alphabetsList) {\r\n let hasStores = false;\r\n for (const asbr of allStoresByRegions) {\r\n if (hasStores) {\r\n break;\r\n }\r\n for (const st of asbr.stores) {\r\n if (hasStores) {\r\n break;\r\n }\r\n for (const stCol of st) {\r\n if (stCol.name?.toLowerCase().startsWith(alpha.toLowerCase())) {\r\n hasStores = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (!hasStores) {\r\n nostoresAlphabets.push(alpha);\r\n }\r\n }\r\n\r\n setStoresByRegions(allStoresByRegions);\r\n setNoStoreAlphabets(nostoresAlphabets);\r\n };\r\n\r\n const updateSelectedAlphabetView = () => {\r\n const allStoresByRegions: IDobbiesStoresByRegions[] = [];\r\n const configRegions = props.config.storesByRegionsData || [];\r\n if (configRegions && configRegions.length) {\r\n for (const cr of configRegions) {\r\n if (cr.regionName && cr.storesInfo) {\r\n const stores = createStoresDataArray(\r\n cr.regionName,\r\n cr.storesInfo.filter(si => si.storeName?.startsWith(selectedAlphabet))\r\n );\r\n allStoresByRegions.push({ regionName: cr.regionName, stores: stores });\r\n }\r\n }\r\n }\r\n\r\n setStoresByRegions(allStoresByRegions);\r\n };\r\n\r\n React.useEffect(() => {\r\n if (selectedAlphabet) {\r\n updateSelectedAlphabetView();\r\n }\r\n }, [selectedAlphabet]);\r\n\r\n React.useEffect(() => {\r\n updateRegions();\r\n }, []);\r\n\r\n React.useEffect(() => {\r\n console.log('Stores By Regions Updated', storesByRegions);\r\n }, [storesByRegions]);\r\n\r\n const getJSXElementOfStores = (stores: IDobbiesNewStore[][]): JSX.Element => {\r\n if (stores && stores.length) {\r\n const columns = stores[0].length;\r\n const rows = stores.length;\r\n const allColumns: IDobbiesNewStore[][] = [];\r\n for (let i = 0; i < columns; i++) {\r\n allColumns.push([]);\r\n for (let j = 0; j < rows; j++) {\r\n if (stores[j][i]) {\r\n allColumns[i][j] = stores[j][i];\r\n }\r\n }\r\n }\r\n return (\r\n <>\r\n {allColumns.map((col, index) => {\r\n return (\r\n
    \r\n {col.map((elem, index) => {\r\n return (\r\n
  • \r\n {elem.name}\r\n
  • \r\n );\r\n })}\r\n
\r\n );\r\n })}\r\n \r\n );\r\n }\r\n\r\n return <>;\r\n };\r\n\r\n return (\r\n
\r\n

STORE LOCATOR

\r\n
\r\n

Select the area’s first letter to find your nearest store

\r\n
    \r\n {alphabetsList.map((alphabet, index) => {\r\n return (\r\n {\r\n setSelectedAlphabet(alphabet);\r\n const selectedAlphabets = document.getElementsByClassName('store-selected') as HTMLCollection;\r\n if (selectedAlphabets && selectedAlphabets.length) {\r\n for (let iter = 0; iter < selectedAlphabets.length; iter++) {\r\n selectedAlphabets[iter].classList.remove('store-selected');\r\n }\r\n }\r\n const brandSelected = document.getElementById(`store-select-${alphabet}`);\r\n brandSelected?.classList.add('store-selected');\r\n }}\r\n >\r\n {alphabet}\r\n \r\n );\r\n })}\r\n
\r\n
\r\n
\r\n {storesByRegions.length ? (\r\n storesByRegions.map(storeByRegion => {\r\n return (\r\n <>\r\n {storeByRegion.stores[0].length ? (\r\n
\r\n {\r\n collapseUnCollapseRegion(storeByRegion.regionName);\r\n }}\r\n >\r\n {storeByRegion.regionName}{' '}\r\n

\r\n {shouldShowStoresForRegion(storeByRegion.regionName) ? (\r\n \r\n <>{getJSXElementOfStores(storeByRegion.stores)}\r\n
\r\n ) : (\r\n <>\r\n )}\r\n
\r\n ) : (\r\n <>\r\n )}\r\n \r\n );\r\n })\r\n ) : (\r\n <>\r\n )}\r\n {showNoResults() ?

No store found

: <>}\r\n
\r\n \r\n );\r\n};\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['dobbies-new-store-locator'] = {\n c: () => require('partner/modules/dobbies-new-store-locator/dobbies-new-store-locator.tsx'),\n $type: 'contentModule',\n da: [],\n \n iNM: false,\n ns: '__local__',\n n: 'dobbies-new-store-locator',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/dobbies-new-store-locator'\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__|modules|dobbies-new-store-locator|dobbies-new-store-locator'] = {\n c: () => require('partner/modules/dobbies-new-store-locator/dobbies-new-store-locator.view.tsx'),\n cn: '__local__-__local__-dobbies-new-store-locator'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["DobbiesNewStoreLocator","React","render","this","props","renderView","selectedAlphabet","setSelectedAlphabet","storesByRegions","setStoresByRegions","noStoreAlphabetsState","setNoStoreAlphabets","alphabetsList","englandSectionCollapsed","setEnglandSectionCollapsed","scotlandSectionCollapsed","setScotlandSectionCollapsed","niSectionCollapsed","setNISectionCollapsed","walesSectionCollapsed","setWalesSectionCollapsed","ldSectionCollapsed","setLDSectionCollapsed","shouldShowStoresForRegion","regionName","toLowerCase","createStoresDataArray","storesInfo","screenSize","_getScreenSize","MsDyn365","isBrowser","window","innerWidth","dobbiesStores","num_of_rows","num_of_columns","curr_row_filling","curr_col_filling","configStores","i","push","cs","name","storeName","pageUrl","storePageUrl","isANoStoreAlphabet","alphabet","includes","updateSelectedAlphabetView","allStoresByRegions","configRegions","config","storesByRegionsData","length","cr","stores","filter","si","_si$storeName","startsWith","updateRegions","nostoresAlphabets","alpha","hasStores","asbr","st","stCol","_stCol$name","console","log","className","map","index","id","key","onClick","selectedAlphabets","document","getElementsByClassName","iter","classList","remove","brandSelected","getElementById","add","href","storeByRegion","columns","rows","allColumns","j","col","elem","getJSXElementOfStores","showNoResults","sbyr","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","__bindings__","_objectSpread","viewDictionary","cn","module","exports","ReactDOM"],"sourceRoot":""}