{"version":3,"file":"product-type-a54db001.js","sources":["../../../client/src/javascripts/customer_pages/_utils/product-was-price.jsx","../../../client/src/javascripts/customer_pages/_utils/types/was-price-type.js","../../../client/src/javascripts/customer_pages/_utils/product-price.jsx","../../../client/src/javascripts/customer_pages/_utils/get-orientation.js","../../../client/src/javascripts/customer_pages/_shelf-category/types/product-type.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Currency from './tools/currency';\nimport genericHelpers from './generic-helpers';\n\nfunction ProductWasPrice(props) {\n const { was_price: wasPrice, set_size: setSize, price } = props;\n\n const updatedWasPrice = []\n .concat(wasPrice)\n .filter(Boolean)\n .reduce((memo, wp) => {\n if (wp.quantity <= (setSize || 1)) {\n return wp;\n }\n\n return memo;\n }, {});\n\n const isValid = genericHelpers.isWasPriceValid({\n was_price: updatedWasPrice,\n price,\n });\n\n return isValid ? (\n {Currency.format(updatedWasPrice.value)}\n ) : null;\n}\n\nProductWasPrice.propTypes = {\n price: PropTypes.number,\n set_size: PropTypes.number,\n was_price: PropTypes.arrayOf(\n PropTypes.shape({\n end_date: PropTypes.string,\n quantity: PropTypes.number,\n value: PropTypes.number,\n start_data: PropTypes.string,\n })\n ),\n};\n\nProductWasPrice.defaultProps = {\n price: null,\n set_size: null,\n was_price: null,\n};\n\nexport default ProductWasPrice;\n","import PropTypes from 'prop-types';\n\nconst wasPriceType = PropTypes.arrayOf(\n PropTypes.shape({\n end_date: PropTypes.string,\n quantity: PropTypes.number,\n value: PropTypes.number,\n start_data: PropTypes.string,\n })\n);\n\nexport default wasPriceType;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport DisplayPrice from './display-price';\nimport ProductWasPrice from './product-was-price';\nimport wasPriceType from './types/was-price-type';\n\nfunction ProductPrice(props) {\n const { price, price_range: priceRange, set_size: setSize } = props;\n\n if (setSize) {\n return (\n

\n \n \n \n / each\n \n

\n );\n }\n\n if (priceRange) {\n const [priceFrom, priceTo] = priceRange;\n\n return (\n

\n \n  – \n \n

\n );\n }\n\n return (\n

\n \n \n

\n );\n}\n\nProductPrice.propTypes = {\n price: PropTypes.number,\n price_range: PropTypes.arrayOf(PropTypes.number),\n set_size: PropTypes.number,\n was_price: wasPriceType,\n};\n\nProductPrice.defaultProps = {\n price: null,\n price_range: null,\n set_size: null,\n was_price: null,\n};\n\nexport default ProductPrice;\n","function getSize({ title }) {\n const [size] = title.split(' ');\n return { size };\n}\n\nfunction getHeightAndWidth({ size }) {\n const [height, width] = size.split('x').map(num => parseInt(num, 10));\n return { height, width };\n}\n\nfunction getOrientation({ title }) {\n const { size } = getSize({ title });\n const { height, width } = getHeightAndWidth({ size });\n\n if (height > width) {\n return 'portrait';\n }\n if (height === width) {\n return 'square';\n }\n return 'landscape';\n}\n\nexport default getOrientation;\n","import PropTypes from 'prop-types';\nimport wasPriceType from './was-price-type';\n\nconst productType = PropTypes.shape({\n category_title: PropTypes.string,\n design_code: PropTypes.string,\n flag: PropTypes.number,\n id: PropTypes.number,\n images: PropTypes.arrayOf(PropTypes.string),\n is_card: PropTypes.bool,\n price: PropTypes.number,\n price_range: PropTypes.arrayOf(PropTypes.number),\n stacked: PropTypes.bool,\n theme_name: PropTypes.string,\n theme_title: PropTypes.string,\n title: PropTypes.string,\n url: PropTypes.string,\n was_price: PropTypes.oneOfType([\n wasPriceType,\n PropTypes.arrayOf(wasPriceType),\n ]),\n});\n\nexport default productType;\n"],"names":["ProductWasPrice","props","wasPrice","setSize","price","updatedWasPrice","memo","wp","genericHelpers","React","Currency","PropTypes","wasPriceType","ProductPrice","priceRange","DisplayPrice","priceFrom","priceTo","getSize","title","size","getHeightAndWidth","height","width","num","getOrientation","productType"],"mappings":"6QAKA,SAASA,EAAgBC,EAAO,CAC9B,KAAM,CAAE,UAAWC,EAAU,SAAUC,EAAS,MAAAC,CAAU,EAAAH,EAEpDI,EAAkB,CAAA,EACrB,OAAOH,CAAQ,EACf,OAAO,OAAO,EACd,OAAO,CAACI,EAAMC,IACTA,EAAG,WAAaJ,GA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