import useEngineContext from "../../../../hooks/useEngineContext.js";
import { mock } from "../../mock.js";
import React, { useMemo } from "react";
import { locales } from "@pisell/utils";
import { Iconfont, PisellCard, PisellText } from "@pisell/materials";
import classNames from "classnames";
import "./index.less";
//#region src/components/eventBooking/components/productCard/index.tsx
const PisellProductCard = ({ item, showImage = true, showName = true, showPrice = true, showArrow = true, disabled = false, selected = false, className, style, onClick }) => {
	var _utils$storage;
	const utils = useEngineContext().appHelper.utils || {};
	const isEn = (utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get("umi_locale")) === "en-US";
	const { product_card } = mock;
	const { image, title, price, currency, isMultiPrice } = item || product_card;
	/**
	* @title: 显示单位
	* @description:
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-23 10:21
	*/
	const fromText = useMemo(() => {
		if (!isMultiPrice) return "";
		return locales.getText("pisell2.event.price.from");
	}, [isMultiPrice]);
	return /* @__PURE__ */ React.createElement(PisellCard, {
		className: classNames("pisell-product-card", className),
		style,
		onClick,
		borderRadius: 8,
		disabled,
		selected
	}, /* @__PURE__ */ React.createElement("div", { className: "pisell-product-card-content" }, showImage && /* @__PURE__ */ React.createElement("div", { className: "pisell-product-card-image" }, image ? /* @__PURE__ */ React.createElement("img", { src: image }) : /* @__PURE__ */ React.createElement("div", { className: "image" })), /* @__PURE__ */ React.createElement("div", { className: "pisell-product-card-info" }, showName && /* @__PURE__ */ React.createElement("div", { className: "pisell-product-card-name" }, title), showPrice && /* @__PURE__ */ React.createElement("div", { className: "pisell-product-card-price" }, isEn ? fromText : "", /* @__PURE__ */ React.createElement(PisellText.Amount, {
		value: price,
		showCurrencySymbol: true
	}), !isEn ? fromText : "")), showArrow && /* @__PURE__ */ React.createElement("div", { className: "pisell-product-card-arrow" }, /* @__PURE__ */ React.createElement(Iconfont, { type: "pisell2-chevron-right" }))));
};
//#endregion
export { PisellProductCard as default };
