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a,iBACbW,EAAgB,kBAChBC,EAAiB,oBACjBC,EAAmB,sBACnBC,EAAqB,YACrBC,GACArB,KAAKnB,MAAM8B,OAEf,IAAKX,KAAKE,4BAA4BoB,KAAKV,OACvC,OAAO,KAGX,MACIU,MAAM,mBACFC,EAAkB,gBAClBC,EAAe,iBACfC,EAAgB,cAChBC,EAAa,0BACbC,IAEJ3B,KAAKE,4BAET,YAA4B,IAArBuB,EACH,gBAAC9B,EAAD,CAAeV,UAAWW,EAAyB,eAAc,MAC5D+B,GACG,gBAACvC,EAAD,CACIC,gBAAiBsC,EAA0BtC,gBAC3CC,eAAgBqC,EAA0BrC,iBAGlD,gBAACsC,EAAA,EAAD,CACI3C,UAAAA,EACAqB,cAAAA,EACAQ,iBAAAA,EACAC,wBAAAA,EACAc,mBAAoBX,EACpBY,iBAAkBX,EAClBF,iBAAAA,EACAc,eAAgBX,EAChBY,oBAAqBT,EACrBtB,mBAAoBD,KAAKD,wBACzB0B,iBAAAA,EACAjB,cAAegB,EACfE,cAAAA,EACAL,YAAAA,KAGR,OAxFL,E,iIAAA,GAFN,OAAU,CAAC,mBAAoB,0BAA2B,uBAC1D,EAAAzC,UACM,GA4FP,W,qIC3JO,MAAMqD,EAA6B,6BAC7BC,EAAiB,iBACjBC,EAAiB,iBACjBC,EAAkB,kBAClBC,EAAyC,yCACzCC,EAAsB,sBACtBC,EAAU,UACVC,EAAoB,qB,oHCJ1B,MAAMC,EAAU,CAACC,KAAsBC,IAC1C,IAAW,OAAOD,IAAa,MAAMA,IAAaC","sources":["webpack://elc-service-ratings-reviews/./src/internal/views/SocialProofReview.tsx","webpack://elc-service-ratings-reviews/./src/internal/views/SocialProofReviewResponsiveWrapper.tsx","webpack://elc-service-ratings-reviews/./src/exported/product-rating/ProductRating.tsx","webpack://elc-service-ratings-reviews/./src/internal/constants/DataTestIds.ts","webpack://elc-service-ratings-reviews/./src/internal/utils/Classes.ts"],"sourcesContent":["import * as React from 'react';\nimport { observer } from 'mobx-react';\nimport { classes } from '~utils/Classes';\nimport { SOCIAL_PROOF_REVIEW } from '../constants/DataTestIds';\n\nexport interface ISocialProofReview {\n reviewHeadline: string;\n}\n\nexport const SocialProofReview = observer(function SocialProofReview(props: ISocialProofReview) {\n const { reviewHeadline } = props;\n\n if (!reviewHeadline) {\n return null;\n }\n\n const socialProofReviewClassNames = classes(SOCIAL_PROOF_REVIEW);\n const formattedReview = `\"${reviewHeadline}\"`;\n\n return (\n \n {formattedReview}\n \n );\n});\n","import * as React from 'react';\nimport { observer } from 'mobx-react';\nimport { Breakpoints, ContentSpacing } from '@estee/elc-base-theme';\nimport { Desktop, Mobile } from '@estee/elc-layouts';\nimport styled from 'styled-components';\nimport { SocialProofReview } from './SocialProofReview';\nimport { SOCIAL_PROOF_REVIEW_RESPONSIVE_WRAPPER } from '../constants/DataTestIds';\nimport { classes } from '~utils/Classes';\n\nconst SocialProofReviewWrapper = styled.span`\n margin-right: ${ContentSpacing.space8};\n`;\nexport interface ISocialProofReviewResponsiveWrapperProps {\n desktopHeadline: string;\n mobileHeadline: string;\n}\n\nexport const SocialProofReviewResponsiveWrapper = observer(\n function SocialProofReviewResponsiveWrapper({\n desktopHeadline,\n mobileHeadline\n }: ISocialProofReviewResponsiveWrapperProps) {\n if (!desktopHeadline && !mobileHeadline) {\n return null;\n }\n const socialProofReviewResponsiveWrapperClassNames = classes(\n SOCIAL_PROOF_REVIEW_RESPONSIVE_WRAPPER\n );\n\n return (\n \n \n {() => }\n \n \n {() => }\n \n \n );\n }\n);\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport { observer } from 'mobx-react';\nimport { Rating } from '@estee/elc-rating';\nimport { translate } from '@estee/elc-service';\nimport { ProductRatingViewController } from '~controllers/ProductRatingViewController';\nimport { IProduct } from '~interfaces/IRating';\nimport { classes } from '~utils/Classes';\nimport { PRODUCT_RATING } from '../../internal/constants/DataTestIds';\nimport { SocialProofReviewResponsiveWrapper } from '~views/SocialProofReviewResponsiveWrapper';\n\nexport interface ITranslation {\n readReviewsLabel: string;\n firstToWriteReviewLabel: string;\n reviewsNumberLabel: string;\n}\n\nexport interface IProductRatingConfig {\n averageRating: number;\n className?: string;\n hideReadReviewsLink?: boolean;\n hideReviewsNumber?: boolean;\n hideReviewsLabel?: boolean;\n showEmptyRatingsStars: boolean;\n numberOfStars: number;\n productId: string;\n reviewsNumberLabel?: string;\n productRating?: number;\n reviewsNumber?: number;\n isClickable: boolean;\n product: IProduct;\n socialProofReviews: ISocialProofReviewConfig;\n}\n\ninterface ISocialProofReviewMaxNumberOfCharacters {\n longHeadline: number;\n shortHeadline: number;\n}\n\nexport interface ISocialProofReviewConfig {\n enabled: boolean;\n minNumberOfStars: number;\n maxNumberOfCharacters: ISocialProofReviewMaxNumberOfCharacters;\n}\n\nexport interface IProductRating {\n translations?: ITranslation;\n onReadReviewsClick?(): void;\n config: IProductRatingConfig;\n viewController: ProductRatingViewController;\n}\n\nconst RatingWrapper = styled.div`\n width: 100%;\n justify-content: flex-end;\n align-items: center;\n display: flex;\n`;\n\nconst ratingWrapperClassnames = classes('product-rating-wrapper');\n\n@translate(['readReviewsLabel', 'firstToWriteReviewLabel', 'reviewsNumberLabel'])\n@observer\nexport class ProductRating extends React.Component {\n private productRatingViewController: ProductRatingViewController;\n\n constructor(props: IProductRating) {\n super(props);\n this.productRatingViewController = props.viewController;\n }\n\n public async componentDidMount() {\n const {\n productId,\n numberOfStars,\n productRating,\n reviewsNumber,\n product,\n socialProofReviews\n } = this.props.config || {};\n\n await this.productRatingViewController.loaded({\n productId,\n numberOfStars,\n productRating,\n reviewsNumber,\n product,\n socialProofReviews\n });\n }\n\n private readReviewsClickHandler = async () => {\n if (this.props.onReadReviewsClick) {\n this.props.onReadReviewsClick();\n } else {\n this.productRatingViewController.onReadReviewsClick();\n }\n };\n\n public render() {\n const { readReviewsLabel, firstToWriteReviewLabel } = this.props\n .translations as ITranslation;\n const {\n className,\n numberOfStars,\n hideReviewsLabel,\n hideReviewsNumber,\n hideReadReviewsLink,\n showEmptyRatingsStars,\n isClickable\n } = this.props.config;\n\n if (!this.productRatingViewController.data.loaded) {\n return null;\n }\n\n const {\n data: {\n onWriteReviewClick,\n numberOfReviews,\n percentageRating,\n averageRating,\n filteredSocialProofReview\n }\n } = this.productRatingViewController;\n\n return percentageRating !== undefined ? (\n \n {filteredSocialProofReview && (\n \n )}\n \n \n ) : null;\n }\n}\n// tslint:disable-next-line:no-default-export\nexport default ProductRating;\n","export const REVIEW_OVERLAY_REMOVE_ICON = 'review-overlay-remove-icon';\nexport const REVIEW_DETAILS = 'review-details';\nexport const PRODUCT_RATING = 'product-rating';\nexport const REVIEWS_WRAPPER = 'reviews-wrapper';\nexport const SOCIAL_PROOF_REVIEW_RESPONSIVE_WRAPPER = 'social-proof-review-responsive-wrapper';\nexport const SOCIAL_PROOF_REVIEW = 'social-proof-review';\nexport const REVIEWS = 'reviews';\nexport const SPINNER_CONTAINER = 'spinner-container';\nexport const RATING_CLICKABLE = 'rating-clickable';\n","import classnames from 'classnames';\n\n// tslint:disable-next-line:export-name\nexport const classes = (component: string, ...classNames: (string | undefined)[]) =>\n classnames(`elc-${component}`, `js-${component}`, classNames);\n"],"names":["SocialProofReview","observer","props","reviewHeadline","socialProofReviewClassNames","formattedReview","className","SocialProofReviewWrapper","ContentSpacing","SocialProofReviewResponsiveWrapper","desktopHeadline","mobileHeadline","socialProofReviewResponsiveWrapperClassNames","minWidth","Breakpoints","maxWidth","RatingWrapper","ratingWrapperClassnames","constructor","super","readReviewsClickHandler","this","onReadReviewsClick","productRatingViewController","viewController","componentDidMount","productId","numberOfStars","productRating","reviewsNumber","product","socialProofReviews","config","loaded","render","readReviewsLabel","firstToWriteReviewLabel","translations","hideReviewsLabel","hideReviewsNumber","hideReadReviewsLink","showEmptyRatingsStars","isClickable","data","onWriteReviewClick","numberOfReviews","percentageRating","averageRating","filteredSocialProofReview","Rating","showReviewsNumber","showReadReviews","showEmptyStars","onWriteReviewsClick","REVIEW_OVERLAY_REMOVE_ICON","REVIEW_DETAILS","PRODUCT_RATING","REVIEWS_WRAPPER","SOCIAL_PROOF_REVIEW_RESPONSIVE_WRAPPER","SOCIAL_PROOF_REVIEW","REVIEWS","SPINNER_CONTAINER","classes","component","classNames"],"sourceRoot":""}