{"version":3,"names":["scProductPriceChoicesCss","wp","i18n","__"],"sources":["./src/components/controllers/product/sc-product-price-choices/sc-product-price-choices.css?tag=sc-product-price-choices&encapsulation=shadow","./src/components/controllers/product/sc-product-price-choices/sc-product-price-choices.tsx"],"sourcesContent":[":host {\n display: block;\n text-align: left;\n position: relative;\n z-index: 1;\n}\n","import { Component, h, Prop, Fragment, Host } from '@stencil/core';\nimport { __ } from '@wordpress/i18n';\nimport { intervalString } from '../../../../functions/price';\nimport { state } from '@store/product';\nimport { availablePrices } from '@store/product/getters';\nimport { setProduct } from '@store/product/setters';\n\n@Component({\n tag: 'sc-product-price-choices',\n styleUrl: 'sc-product-price-choices.css',\n shadow: true,\n})\nexport class ScProductPriceChoices {\n /** The product price choice label */\n @Prop() label: string;\n\n /** Whether to show the price */\n @Prop() showPrice: boolean;\n\n /** The product id */\n @Prop() productId: string;\n\n renderPrice(price) {\n return (\n \n \n \n {intervalString(price, {\n labels: {\n interval: __('Every', 'surecart'),\n period: __('for', 'surecart'),\n once: __('Once', 'surecart'),\n },\n showOnce: true,\n })}\n \n \n );\n }\n\n render() {\n const prices = availablePrices(this.productId);\n if (prices?.length < 2) return ;\n\n return (\n \n {(prices || []).map(price => (\n {\n if (e.target.checked) {\n setProduct(this.productId, { selectedPrice: price });\n }\n }}\n />\n ))}\n \n );\n }\n}\n"],"mappings":"uTAAA,MAAMA,EAA2B,mE,oQC6BTC,GAAAC,KAAAC,GAAE,oB,OACJF,GAAAC,KAAAC,GAAE,kB,KACJF,GAAAC,KAAAC,GAAE,oB"}