"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FollowOrderCard = void 0;
const i18n_1 = __importDefault(require("../../../locales/i18n.js"));
const react_1 = __importDefault(require("react"));
const use_typewriter_1 = require("../../hooks/use-typewriter");
const cn_ui_1 = require("@cainiaofe/cn-ui");
const arms_hot_tag_log_1 = require("../../../utils/arms/arms-hot-tag-log.js");
const context_1 = require("../../../theme/context.js");
/**
 * 跟单任务摘要卡片
 */
const FollowOrderCard = ({ count, loading = false, onClick, iconUrl, }) => {
    const brandAssets = (0, context_1.useBrandAssets)();
    const bodyText = loading
        ? i18n_1.default.get({ id: 'LoadingDocumentaryTasks', dm: '正在加载跟单任务...' })
        : i18n_1.default.get({
            id: 'YouCurrentlyHaveCountTasksToFocu_1851507076',
            dm: '当前你有{count}个需要重点关注的任务～',
        }, { count });
    const displayText = (0, use_typewriter_1.useTypewriter)(bodyText, { speed: 50, enabled: true });
    const cardElement = (react_1.default.createElement("div", { className: `cn-ai-agent__summary-card${onClick ? ' cn-ai-agent__summary-card--clickable' : ''}`, role: onClick ? 'button' : undefined, tabIndex: onClick ? 0 : undefined, onClick: () => {
            if (onClick) {
                (0, arms_hot_tag_log_1.armsHottagLog)({
                    hottag: 'cn-ai-agent.followOrderCard.click',
                    name: i18n_1.default.get({ id: 'ClickOnTheDocumentaryTaskCard', dm: '点击跟单任务卡片' }),
                    c6: count,
                });
                onClick();
            }
        } },
        react_1.default.createElement("div", { className: "cn-ai-agent__summary-card-header" },
            react_1.default.createElement("span", { className: "cn-ai-agent__summary-card-icon" },
                react_1.default.createElement("img", { src: iconUrl || brandAssets.agent.followOrderIconUrl, alt: "", width: 16, height: 16 })),
            react_1.default.createElement("span", { className: "cn-ai-agent__summary-card-title" }, i18n_1.default.get({ id: 'DocumentaryTaskDynamics', dm: '跟单任务动态' }))),
        react_1.default.createElement("p", { className: "cn-ai-agent__summary-card-body" }, displayText)));
    return onClick ? (react_1.default.createElement(cn_ui_1.CnTooltip, { trigger: cardElement, triggerType: "hover", align: "b" },
        react_1.default.createElement("span", { style: { whiteSpace: 'nowrap' } }, i18n_1.default.get({
            id: 'ClickToSwitchToTheSmartMerchandi_916006378',
            dm: '点击切换到智能跟单视图',
        })))) : (cardElement);
};
exports.FollowOrderCard = FollowOrderCard;
exports.FollowOrderCard.displayName = 'FollowOrderCard';
