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BF,KAE3C,OAAOnB,KAAKC,MAAMqB,WAAWF,IAwCrC,W,0EC7DA,MAMA,EANqDnB,GACjDT,EAAAA,cAAAA,MAAAA,OAAAA,OAAAA,CAAK2B,UAAWlB,EAAMkB,UAAWI,GAAItB,EAAMsB,IAAQtB,EAAMuB,uBAAuBvB,IAC3EA,EAAMN,Y,onBCVf,MAAM8B,EAAU,CAAEC,QAAS,GAAIC,YAAa,IAEvCF,EAAQC,QAAQ,oCAAsC,CACnDE,EAAG,IAAMC,EAAQ,MACjBC,MAAO,gBACPC,GAAI,GAEJC,KAAK,EACLC,GAAI,YACJC,EAAG,mCACHC,EAAG,YAEHC,IAAK,GAGLC,GAAI,gDAKRC,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAab,QAApB,OACOY,OAAOC,aAAab,SAAW,IAC/BD,EAAQC,SAGXY,OAAOC,aAAaZ,YAApB,OACGW,OAAOC,aAAaZ,aAAe,IACnCF,EAAQE,aAEY,MAAMa,EAAiB,GAC9BA,EAAe,iGAAmG,CAC1HZ,EAAG,IAAMC,EAAQ,MACjBY,GAAI,wDAEpBH,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAaC,eAApB,OAC2BF,OAAOC,aAAaC,gBAAkB,IACtCA,I,mBCtC3BE,EAAOC,QAAUnD,O,oBCAjBkD,EAAOC,QAAUC,U","sources":["webpack://mattressfirm/./src/Utilities/is-targeting-criteria-match.ts?a7d0","webpack://mattressfirm/./src/modules/mfrm-targetted-footer-disclaimer/mfrm-targetted-footer-disclaimer.tsx?f2e5","webpack://mattressfirm/./src/modules/mfrm-targetted-footer-disclaimer/mfrm-targetted-footer-disclaimer.view.tsx?7713","webpack://mattressfirm/./lib/mfrm-targetted-footer-disclaimer/module-registration.js?c14d","webpack://mattressfirm/external var \"React\"?0d3b","webpack://mattressfirm/external var \"ReactDOM\"?853b"],"sourcesContent":["import { IGeoLocation } from '@msdyn365-commerce/core-internal';\r\nimport { IDictionary } from '@msdyn365-commerce/retail-proxy';\r\nimport { ITargetingData } from '../modules/mfrm-targetted-footer-disclaimer/mfrm-targetted-footer-disclaimer.props.autogenerated';\r\n\r\nconst isTargetingCriteriaMatched = (\r\n geoLocation: IGeoLocation | undefined,\r\n query: IDictionary | undefined,\r\n targetingRule: ITargetingData | undefined\r\n): Boolean => {\r\n let hasValidTargetedLocation = false;\r\n let queryResult = false;\r\n let hasKey = false;\r\n let hasValue = false;\r\n // targeting critieria doesn't exist return true and dispaly eyebrow message\r\n if (!targetingRule) {\r\n return true;\r\n }\r\n // if targeting critieria exists then do some business logic checks\r\n const hasState = targetingRule.state ? true : false;\r\n const hasCity = targetingRule.city ? true : false;\r\n const hasZipcode = targetingRule.zipCode ? true : false;\r\n const hasMetroCode = targetingRule.metroCode ? true : false;\r\n hasKey = targetingRule.sourceCode?.key ? true : false;\r\n hasValue = targetingRule.sourceCode?.value ? true : false;\r\n hasValidTargetedLocation = isValidTargetLocation(hasState, hasCity, hasZipcode, hasMetroCode, targetingRule, geoLocation);\r\n if (hasKey && hasValue && query) {\r\n Object.entries(query).forEach(([key, value]) => {\r\n if (\r\n key.toLowerCase() === targetingRule.sourceCode?.key?.toLowerCase() &&\r\n value.toLowerCase() === targetingRule.sourceCode?.value?.toLowerCase()\r\n ) {\r\n queryResult = true;\r\n }\r\n });\r\n }\r\n if (hasValidTargetedLocation && (queryResult || !(hasKey && hasValue))) {\r\n return true;\r\n }\r\n return false;\r\n};\r\n\r\nconst isValidTargetLocation = (\r\n hasState: boolean,\r\n hasCity: boolean,\r\n hasZipcode: boolean,\r\n hasMetroCode: boolean,\r\n targetingRule: ITargetingData,\r\n geoLocation: IGeoLocation | undefined\r\n) => {\r\n const state = targetingRule.state\r\n ?.toLowerCase()\r\n .split(',')\r\n ?.find(x => x.trim() === geoLocation?.region?.toLowerCase());\r\n const city = targetingRule.city\r\n ?.toLowerCase()\r\n .split(',')\r\n ?.find(x => x.trim() === geoLocation?.city?.toLowerCase());\r\n const zipCode = targetingRule.zipCode\r\n ?.toLowerCase()\r\n .split(',')\r\n ?.find(x => x.trim() === geoLocation?.zipCode?.toLowerCase());\r\n const metroCode = targetingRule.metroCode\r\n ?.toLowerCase()\r\n .split(',')\r\n ?.find(x => x.trim() === geoLocation?.metroCode?.toLowerCase());\r\n\r\n return (\r\n (hasState ? (state ? true : false) : true) &&\r\n (hasCity ? (city ? true : false) : true) &&\r\n (hasZipcode ? (zipCode ? true : false) : true) &&\r\n (hasMetroCode ? (metroCode ? true : false) : true)\r\n );\r\n};\r\n\r\nexport default isTargetingCriteriaMatched;\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/* tslint:disable: no-duplicate-imports */\r\nimport * as MsDyn365 from '@msdyn365-commerce/core';\r\nimport classnames from 'classnames';\r\nimport * as React from 'react';\r\nimport isTargetingCriteriaMatched from '../../Utilities/is-targeting-criteria-match';\r\nimport { IMfrmTargettedFooterDisclaimerProps, ITargetingData } from './mfrm-targetted-footer-disclaimer.props.autogenerated';\r\n\r\nexport interface ITextBlockViewProps extends IMfrmTargettedFooterDisclaimerProps<{}> {\r\n paragraph?: React.ReactNode;\r\n className?: string;\r\n}\r\n\r\n/**\r\n *\r\n * TextBlock component\r\n */\r\nclass TextBlock extends React.PureComponent> {\r\n public render(): JSX.Element | null {\r\n const { className } = this.props.config;\r\n\r\n const textBlockViewProps = {\r\n ...this.props,\r\n paragraph: this.getParagraph(),\r\n className: classnames('ms-text-block', className)\r\n };\r\n return this.props.renderView(textBlockViewProps) as React.ReactElement;\r\n }\r\n\r\n public handleTextChange = (paragraph: MsDyn365.RichText | undefined) => (event: MsDyn365.ContentEditableEvent) =>\r\n (paragraph = event.target.value);\r\n\r\n private getParagraph = () => {\r\n const { paragraphs } = this.props.config;\r\n const value: { paragraph: JSX.Element; isMatched: Boolean }[] = [];\r\n const { geoLocation, query } = this.props.context.request;\r\n /* VSI-Customization -- START pushing each 'text-block' with individual targeting criteria inside array */\r\n paragraphs &&\r\n paragraphs.forEach(para => {\r\n const targetingGeoLocation: ITargetingData | undefined = para.targeting;\r\n const criteriaMatched = isTargetingCriteriaMatched(geoLocation, query, targetingGeoLocation);\r\n if (criteriaMatched) {\r\n value.push({\r\n paragraph: (\r\n \r\n ),\r\n isMatched: criteriaMatched\r\n });\r\n }\r\n });\r\n /* VSI-Customization -- END */\r\n let flag = false;\r\n let paragraph;\r\n for (const para of value) {\r\n if (para.isMatched) {\r\n flag = true;\r\n paragraph = para.paragraph;\r\n break;\r\n }\r\n }\r\n return flag ? paragraph : value[0]?.paragraph;\r\n };\r\n}\r\nexport default TextBlock;\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/* tslint:disable: no-duplicate-imports */\r\nimport * as React from 'react';\r\nimport { ITextBlockViewProps } from './mfrm-targetted-footer-disclaimer';\r\n\r\nconst TextBlockView: React.FC = props => (\r\n
\r\n {props.paragraph}\r\n
\r\n);\r\n\r\nexport default TextBlockView;\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['mfrm-targetted-footer-disclaimer'] = {\n c: () => require('partner/modules/mfrm-targetted-footer-disclaimer/mfrm-targetted-footer-disclaimer.tsx'),\n $type: 'contentModule',\n da: [],\n \n iNM: false,\n ns: '__local__',\n n: 'mfrm-targetted-footer-disclaimer',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/mfrm-targetted-footer-disclaimer'\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|mfrm-targetted-footer-disclaimer|mfrm-targetted-footer-disclaimer'] = {\n c: () => require('partner/modules/mfrm-targetted-footer-disclaimer/mfrm-targetted-footer-disclaimer.view.tsx'),\n cn: '__local__-__local__-mfrm-targetted-footer-disclaimer'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["isValidTargetLocation","hasState","hasCity","hasZipcode","hasMetroCode","targetingRule","geoLocation","state","toLowerCase","split","find","x","trim","region","city","zipCode","metroCode","query","hasValidTargetedLocation","queryResult","hasKey","hasValue","sourceCode","key","value","Object","entries","forEach","TextBlock","React","constructor","handleTextChange","paragraph","event","target","getParagraph","paragraphs","this","props","config","context","request","para","targetingGeoLocation","targeting","criteriaMatched","isTargetingCriteriaMatched","push","MsDyn365","text","editProps","onEdit","requestContext","isMatched","flag","render","className","textBlockViewProps","classnames","renderView","id","renderModuleAttributes","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","viewDictionary","cn","module","exports","ReactDOM"],"sourceRoot":""}