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A,QAAOE,EAAU4D,sBAAuBF,GACxC,GAAGA,YAET,OACInI,EAAAA,cAAA,OAAK2E,UAAU,iCACX3E,EAAAA,cAAA,OAAK2E,UAAU,0CAAoE,QAA5BoD,EAAE9B,EAAK1C,eAAeV,cAAM,IAAAkF,OAAA,EAA1BA,EAA4B5C,eACrFnF,EAAAA,cAAA,WACIA,EAAAA,cAACyG,EAAAA,gBAAe,CACZF,QAASA,EACT1F,GAAI+G,EACJd,SAAUA,EACVJ,UAAoD,QAA3CsB,EAA4B,QAA5BC,EAAEhC,EAAK1C,eAAeV,cAAM,IAAAoF,OAAA,EAA1BA,EAA4B9C,qBAAa,IAAA6C,EAAAA,EAd/B,EAerBpB,UAAQ,EACRpC,WAAWD,EAAAA,EAAAA,QAAOE,EAAUkC,uBAAkD,QAA5BuB,EAAEjC,EAAK1C,eAAeV,cAAM,IAAAqF,OAAA,EAA1BA,EAA4B/C,cAAe,KAC/Fc,KAAM,MAGdjG,EAAAA,cAAA,OAAK2E,UAAU,0CAA0CyD,KAoBpDjD,CAAcc,EAAMM,EAASO,EAAUa,EAAUlD,GAClDzE,EAAAA,cAACC,EAAAA,KAAIC,OAAAC,OAAA,GAAKO,GACLD,EAAeK,KAAIC,GAnEjBhB,CAAAA,GAEfC,EAAAA,cAACC,EAAAA,KAAIC,OAAAC,OAAA,GAAKJ,EAAMK,aACXL,EAAMM,UACNN,EAAMO,KAgEYR,CAAciB,gBCtF7CuH,EAAOC,QAAUvI,cCAjBsI,EAAOC,QAAUC","sources":["webpack://morland-ecommerce/./src/themes/morland/views/ratings-histogram.view.tsx?14cd","webpack://morland-ecommerce/./lib/ratings-histogram/module-registration.js?bc1d","webpack://morland-ecommerce/./src/modules/fabrikam/views/ratings-histogram.view.tsx?6e01","webpack://morland-ecommerce/./src/actions/ratings-reviews-state-data-action.ts?26cd","webpack://morland-ecommerce/./src/modules/ratings-histogram/component/components.tsx?f324","webpack://morland-ecommerce/./src/modules/ratings-histogram/ratings-histogram.tsx?f6bc","webpack://morland-ecommerce/./src/modules/ratings-histogram/ratings-histogram.view.tsx?5bff","webpack://morland-ecommerce/./src/modules/adventureworks/views/ratings-histogram.view.tsx?bb5b","webpack://morland-ecommerce/external var \"React\"?0d3b","webpack://morland-ecommerce/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\n/* eslint-disable no-duplicate-imports */\r\nimport { IHistogramItemViewProps, IRatingsHistogramViewProps } from '@msdyn365-commerce-modules/ratings-reviews';\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nconst RatingsHistogramView: React.FC = props => {\r\n const { heading, histogramItems, histogramProps, moduleProps } = props;\r\n return (\r\n \r\n
\r\n {heading}\r\n \r\n {histogramItems.map(item => {\r\n return histogramItem(item);\r\n })}\r\n \r\n
\r\n );\r\n};\r\n\r\nconst histogramItem = (props: IHistogramItemViewProps) => {\r\n return (\r\n \r\n {props.starLabel}\r\n {props.bar}\r\n {props.percentage}\r\n \r\n );\r\n};\r\n\r\nexport default RatingsHistogramView;\r\n","const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n (binding.modules['ratings-histogram'] = {\n c: () => require('@msdyn365-commerce-modules/ratings-reviews/dist/lib/modules/ratings-histogram/ratings-histogram'),\n $type: 'contentModule',\n da: [{name:'ratingsReviewsState', path:'@msdyn365-commerce-modules/ratings-reviews/dist/lib/actions/ratings-reviews-state-data-action', runOn: 1},{name:'ratingsSummary', path:'@msdyn365-commerce-modules/retail-actions/dist/lib/get-ratings-summary', runOn: 0}],\n \n iNM: true,\n ns: '@msdyn365-commerce-modules',\n n: 'ratings-histogram',\n p: 'ratings-reviews',\n \n pdp: '',\n \n \n md: 'node_modules/@msdyn365-commerce-modules/ratings-reviews/dist/lib/modules/ratings-histogram'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/ratings-reviews/dist/lib/actions/ratings-reviews-state-data-action';\n let dataAction = require('@msdyn365-commerce-modules/ratings-reviews/dist/lib/actions/ratings-reviews-state-data-action');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/retail-actions/dist/lib/get-ratings-summary';\n let dataAction = require('@msdyn365-commerce-modules/retail-actions/dist/lib/get-ratings-summary');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\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|morland|views|ratings-histogram'] = {\n c: () => require('partner/themes/morland/views/ratings-histogram.view.tsx'),\n cn: '__local__-__local__-ratings-histogram'\n };\nviewDictionary['@msdyn365-commerce-modules|fabrikam-design-kit|modules|fabrikam|views|ratings-histogram'] = {\n c: () => require('@msdyn365-commerce-modules/fabrikam-design-kit/dist/lib/modules/fabrikam/views/ratings-histogram.view.js'),\n cn: '@msdyn365-commerce-modules-fabrikam-design-kit-ratings-histogram'\n };\nviewDictionary['@msdyn365-commerce-modules|ratings-reviews|modules|ratings-histogram|ratings-histogram'] = {\n c: () => require('@msdyn365-commerce-modules/ratings-reviews/dist/lib/modules/ratings-histogram/ratings-histogram.view.js'),\n cn: '@msdyn365-commerce-modules-ratings-reviews-ratings-histogram'\n };\nviewDictionary['@msdyn365-commerce-theme|adventureworks-theme-kit|modules|adventureworks|views|ratings-histogram'] = {\n c: () => require('@msdyn365-commerce-theme/adventureworks-theme-kit/dist/lib/modules/adventureworks/views/ratings-histogram.view.js'),\n cn: '@msdyn365-commerce-theme-adventureworks-theme-kit-ratings-histogram'\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 { IHistogramItemViewProps, IRatingsHistogramViewProps } from '@msdyn365-commerce-modules/ratings-reviews';\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\nimport * as React from 'react';\n\nconst RatingsHistogramView: React.FC = props => {\n const { heading, histogramItems, histogramProps, moduleProps } = props;\n return (\n \n {heading}\n \n {histogramItems.map(item => {\n return histogramItem(item);\n })}\n \n \n );\n};\n\nconst histogramItem = (props: IHistogramItemViewProps) => {\n return (\n \n {props.starLabel}\n {props.bar}\n {props.percentage}\n \n );\n};\n\nexport default RatingsHistogramView;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionInput } from '@msdyn365-commerce/core';\nimport { GenericInput, getGenericAction } from '@msdyn365-commerce-modules/retail-actions';\n\nexport interface IRatingsReviewsState {\n filterKey: string;\n}\n\nexport function createRatingsReviewsStateInput(result: IRatingsReviewsState): GenericInput {\n return new GenericInput('ratingsReviewsState', result, 'ratingsReviewsStateInput');\n}\n\nconst createInternalRatingsReviewsStateInput = (): IActionInput => {\n return createRatingsReviewsStateInput({ filterKey: '1;2;3;4;5' });\n};\n\nexport const getGenericActionDataAction = createObservableDataAction({\n action: >getGenericAction,\n input: createInternalRatingsReviewsStateInput\n});\n\nexport default getGenericActionDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { RatingsSummary } from '@msdyn365-commerce/commerce-entities';\nimport { format, INodeProps, Progress } from '@msdyn365-commerce-modules/utilities';\nimport React from 'react';\n\nexport interface IHistogramItemsProps {\n ratingsSummary: RatingsSummary;\n resources: IHistogramItemsResources;\n locale: string;\n onClick(stars: number): void;\n}\n\nexport interface IHistogramItemsResources {\n barItemAriaLabel: string;\n}\n\nexport interface IHistogramItemViewProps {\n starLabel: React.ReactElement;\n bar: React.ReactElement;\n percentage: React.ReactElement;\n buttonProps: INodeProps;\n}\n\n/**\n * CartLineItems component.\n */\n\nexport const HistogramItems = (props: IHistogramItemsProps): IHistogramItemViewProps[] => {\n const { ratingsSummary } = props;\n const totalRatingsCount: number = ratingsSummary.totalRatingsCount || 0;\n if (totalRatingsCount === 0) {\n return [];\n }\n return [\n renderItem(props, 5, ratingsSummary.star5Count, totalRatingsCount),\n renderItem(props, 4, ratingsSummary.star4Count, totalRatingsCount),\n renderItem(props, 3, ratingsSummary.star3Count, totalRatingsCount),\n renderItem(props, 2, ratingsSummary.star2Count, totalRatingsCount),\n renderItem(props, 1, ratingsSummary.star1Count, totalRatingsCount)\n ];\n};\n\nconst renderItem = (props: IHistogramItemsProps, stars: number, count?: number, totalCount?: number): IHistogramItemViewProps => {\n count = count || 0;\n totalCount = totalCount || 0;\n const percentage = totalCount === 0 ? 0 : count / totalCount;\n const formattedPercent = new Intl.NumberFormat(props.locale, { style: 'percent' }).format(percentage);\n const ariaLabel = format(props.resources.barItemAriaLabel, stars, formattedPercent);\n\n return {\n starLabel: (\n \n ),\n percentage: (\n \n ),\n bar: ,\n buttonProps: {\n tag: 'button',\n className: 'ms-ratings-histogram__item',\n onClick: () => {\n props.onClick(stars);\n }\n }\n };\n};\n\nexport const AverageRatingNumber: React.FC<{ summary: RatingsSummary }> = (props: { summary: RatingsSummary }) => {\n return (\n

\n {props.summary.averageRating}\n {` `}/ 5\n

\n );\n};\n\nexport const TotalReviews: React.FC<{ summary: RatingsSummary }> = (props: { summary: RatingsSummary }) => {\n return

{props.summary.totalRatingsCount}

;\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { RatingComponent } from '@msdyn365-commerce/components';\nimport * as Msdyn365 from '@msdyn365-commerce/core';\nimport { format, IModuleProps, INodeProps } from '@msdyn365-commerce-modules/utilities';\nimport classname from 'classnames';\nimport { observer } from 'mobx-react';\nimport * as React from 'react';\n\nimport { createRatingsReviewsStateInput } from '../../actions/ratings-reviews-state-data-action';\nimport { AverageRatingNumber, HistogramItems, IHistogramItemViewProps, TotalReviews } from './component/components';\nimport { IRatingsHistogramData } from './ratings-histogram.data';\nimport { IRatingsHistogramProps } from './ratings-histogram.props.autogenerated';\n\nexport interface IRatingsHistogramViewProps extends IRatingsHistogramProps {\n className: string;\n histogramItems: IHistogramItemViewProps[];\n moduleProps: IModuleProps;\n heading: React.ReactNode;\n averageRating: React.ReactNode;\n averageNumber: React.ReactNode;\n totalReviews: React.ReactNode;\n histogramProps: INodeProps;\n ratingsSummaryProps: INodeProps;\n callbacks: IRatingsHistogramCallbacks;\n}\n\nexport interface IRatingsHistogramCallbacks {\n selectFilterBy(stars: number): void;\n}\n\n/**\n * RatingsHistogram component.\n * @extends {React.Component>}\n */\n@observer\nclass RatingsHistogram extends React.PureComponent> {\n constructor(props: IRatingsHistogramProps) {\n super(props);\n this.selectFilterBy = this.selectFilterBy.bind(this);\n }\n\n public render(): JSX.Element | null {\n const { resources } = this.props;\n const { className, heading } = this.props.config;\n const {\n ratingsSummary: { result: ratingsSummary }\n } = this.props.data;\n const ratingCount = ratingsSummary && ratingsSummary.totalRatingsCount ? `${ratingsSummary.totalRatingsCount}` : '0';\n\n const completeClass = classname('ms-ratings-histogram', className);\n const viewProps: IRatingsHistogramViewProps = {\n ...this.props,\n className: completeClass,\n callbacks: {\n selectFilterBy: this.selectFilterBy\n },\n moduleProps: {\n moduleProps: this.props,\n className: completeClass\n },\n histogramItems: ratingsSummary\n ? HistogramItems({\n ratingsSummary,\n resources: { ...resources },\n locale: this.props.context.request.locale,\n onClick: this.selectFilterBy\n })\n : [],\n averageRating: ratingsSummary && (\n \n ),\n averageNumber: ratingsSummary && ,\n totalReviews: ratingsSummary && ,\n ratingsSummaryProps: { className: 'ms-ratings-histogram__summary' },\n heading: heading && (\n \n ),\n histogramProps: { className: 'ms-ratings-histogram__histogram' }\n };\n\n return this.props.renderView(viewProps) as React.ReactElement;\n }\n\n public handleHeadingChange = (event: Msdyn365.ContentEditableEvent) => (this.props.config.heading!.text = event.target.value);\n\n public selectFilterBy(stars: number): void {\n const filterKey = `${stars}`;\n this.props.context.actionContext.update(createRatingsReviewsStateInput({ filterKey }), { filterKey });\n }\n}\n\nexport default RatingsHistogram;\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 { IHistogramItemViewProps } from './component/components';\nimport { IRatingsHistogramViewProps } from './ratings-histogram';\n\nconst RatingsHistogramView: React.FC = props => {\n const { heading, histogramItems, histogramProps, moduleProps } = props;\n\n return (\n \n {heading}\n \n {histogramItems.map(item => {\n return histogramItem(item);\n })}\n \n \n );\n};\n\nconst histogramItem = (props: IHistogramItemViewProps) => {\n return (\n \n {props.starLabel}\n {props.bar}\n {props.percentage}\n \n );\n};\n\nexport default RatingsHistogramView;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { RatingComponent } from '@msdyn365-commerce/components';\nimport { ICoreContext } from '@msdyn365-commerce/core';\nimport { IHistogramItemViewProps, IRatingsHistogramData, IRatingsHistogramViewProps } from '@msdyn365-commerce-modules/ratings-reviews';\nimport { format, Module, Node } from '@msdyn365-commerce-modules/utilities';\nimport * as React from 'react';\n\nimport { IRatingsHistogramProps, IRatingsHistogramResources } from '../definition-extensions/ratings-histogram.ext.props.autogenerated';\n\n/**\n * Histogram item.\n * @param props - Histogram Item ViewProps.\n * @returns Histogram Item node.\n */\nconst histogramItem = (props: IHistogramItemViewProps) => {\n return (\n \n {props.starLabel}\n {props.bar}\n \n );\n};\n\n/**\n * Average ratings.\n * @param data - Props data.\n * @param context - Histogram Item ViewProps.\n * @param typeName - Histogram Item ViewProps.\n * @param componentId - Histogram Item ViewProps.\n * @param resources - Module resource strings.\n * @returns Average ratings.\n */\nconst averageRating = (\n data: IRatingsHistogramData,\n context: ICoreContext,\n typeName: string,\n componentId: string,\n resources: IRatingsHistogramResources\n) => {\n const defaultAverageRating: number = 0;\n const reviewsCount = data.ratingsSummary.result?.reviewsCount ?? defaultAverageRating;\n const reviewsCountString = resources.numberOfReviewsString\n ? format(resources.numberOfReviewsString, reviewsCount)\n : `${reviewsCount} reviews`;\n\n return (\n
\n
{data.ratingsSummary.result?.averageRating}
\n
\n \n
\n
{reviewsCountString}
\n
\n );\n};\n\n/**\n * Histogram view.\n * @param props - Ratings HistogramV iewProps.\n * @returns Histogram view module.\n */\nconst RatingsHistogramView: React.FC> = props => {\n const { heading, histogramItems, histogramProps, moduleProps, data, resources } = props;\n const context = props.context;\n const typeName = props.typeName;\n const moduleId = props.id;\n\n return (\n \n {heading}\n
\n {averageRating(data, context, typeName, moduleId, resources)}\n \n {histogramItems.map(item => {\n return histogramItem(item);\n })}\n \n
\n
\n );\n};\n\nexport default RatingsHistogramView;\n","module.exports = React;","module.exports = ReactDOM;"],"names":["histogramItem","props","React","Node","Object","assign","buttonProps","starLabel","bar","percentage","heading","histogramItems","histogramProps","moduleProps","Module","id","map","item","binding","modules","dataActions","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","md","window","__bindings__","_objectSpread","viewDictionary","cn","createRatingsReviewsStateInput","result","GenericInput","getGenericActionDataAction","createObservableDataAction","action","getGenericAction","input","createInternalRatingsReviewsStateInput","filterKey","HistogramItems","ratingsSummary","totalRatingsCount","renderItem","star5Count","star4Count","star3Count","star2Count","star1Count","stars","count","totalCount","formattedPercent","Intl","NumberFormat","locale","style","format","ariaLabel","resources","barItemAriaLabel","className","Progress","value","max","tag","onClick","AverageRatingNumber","summary","averageRating","TotalReviews","RatingsHistogram","constructor","super","handleHeadingChange","event","this","config","text","target","selectFilterBy","bind","render","data","ratingCount","completeClass","classname","viewProps","callbacks","context","request","RatingComponent","avgRating","averageRatingAriaLabel","readOnly","hideCount","typeName","averageNumber","totalReviews","ratingsSummaryProps","Msdyn365","editProps","onEdit","requestContext","renderView","actionContext","update","__decorate","observer","moduleId","componentId","_data$ratingsSummary$","_data$ratingsSummary$2","_data$ratingsSummary$3","_data$ratingsSummary$4","_data$ratingsSummary$5","_data$ratingsSummary$6","reviewsCount","reviewsCountString","numberOfReviewsString","module","exports","ReactDOM"],"sourceRoot":""}