@tbox.cn/app-module-promotion 0.10.8 → 1.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -3
- package/dist/chunk-T5Z2SDH3.js +1368 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +436 -436
- package/package.json +5 -8
- package/src/client/cards/promotion-activity-category-list/index.tsx +14 -10
- package/src/client/cards/promotion-activity-detail/index.tsx +42 -30
- package/src/client/cards/promotion-activity-list/index.tsx +16 -12
- package/src/client/cards/promotion-best-deal/index.tsx +4 -4
- package/src/client/cards/promotion-entitlement-list/index.tsx +24 -20
- package/src/client/cards/promotion-offer-detail/index.tsx +47 -37
- package/src/client/cards/promotion-offer-list/index.tsx +69 -53
- package/src/client/components/CouponQrCode.tsx +2 -2
- package/src/client/components/CouponSheet.tsx +20 -20
- package/src/client/components/ImageWithFallback.tsx +1 -1
- package/src/client/components/class-names.ts +57 -0
- package/src/client/index.ts +1 -2
- package/tbox.module.json +0 -1
- package/tsup.config.ts +0 -5
- package/dist/chunk-HZIEXNVQ.js +0 -1332
- package/dist/promotion-ESTNS7IL.css +0 -2139
- package/src/client/styles/promotion.css +0 -2139
- package/src/client/types/css.d.ts +0 -2
|
@@ -7,6 +7,13 @@ import type { SheetFact } from '../../components/CouponSheet';
|
|
|
7
7
|
import { ImageWithFallback } from '../../components/ImageWithFallback';
|
|
8
8
|
import { offerTypeLabel } from '../view';
|
|
9
9
|
import { scrollCardBottom } from '../../utils/scroll-card-bottom';
|
|
10
|
+
import {
|
|
11
|
+
PROMOTION_CHIP_CLASS,
|
|
12
|
+
PROMOTION_CHIP_COUPON_CLASS,
|
|
13
|
+
PROMOTION_CHIP_COUPON_LG_CLASS,
|
|
14
|
+
PROMOTION_STATUS_CLASS,
|
|
15
|
+
PROMOTION_STATUS_TONE_CLASS,
|
|
16
|
+
} from '../../components/class-names';
|
|
10
17
|
|
|
11
18
|
const statusText = (status?: string, claimable?: boolean) => {
|
|
12
19
|
if (status === 'REQUIRES_ACTION') return '需操作';
|
|
@@ -17,6 +24,15 @@ const statusText = (status?: string, claimable?: boolean) => {
|
|
|
17
24
|
const statusTone = (status?: string, claimable?: boolean) =>
|
|
18
25
|
status?.toLowerCase() ?? (claimable ? 'available' : 'unavailable');
|
|
19
26
|
|
|
27
|
+
/** 状态徽章:hook 保留动态 BEM 修饰符,工具类按 tone 取完整字面量(禁运行时拼接)。 */
|
|
28
|
+
const statusBadgeClass = (status?: string, claimable?: boolean) => {
|
|
29
|
+
const tone = statusTone(status, claimable);
|
|
30
|
+
return `promotion-status promotion-status--${tone} ${PROMOTION_STATUS_CLASS} ${PROMOTION_STATUS_TONE_CLASS[tone] ?? ''}`;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** `.promotion-button` + `--primary`(票根紧凑钮,仅推荐卡动作 chip 使用) */
|
|
34
|
+
const PROMOTION_BUTTON_PRIMARY_CLASS = 'flex h-[38px] w-full cursor-pointer items-center justify-center gap-1.5 rounded-[7px] border-0 bg-[#ee3347] mt-[11px] text-xs font-black leading-[normal] tracking-[1px] text-white [clip-path:polygon(12px_0,100%_0,calc(100%_-_12px)_100%,0_100%)] [font-family:\'Kaiti_SC\',STKaiti,KaiTi,serif] disabled:cursor-not-allowed disabled:opacity-50';
|
|
35
|
+
|
|
20
36
|
const couponSubtitleIsTime = (subtitle: string) => {
|
|
21
37
|
const plainText = subtitle.replace(/<[^>]+>/g, ' ').replace(/ /gi, ' ');
|
|
22
38
|
return /\d{4}\s*[-/.年]\s*\d{1,2}\s*[-/.月]\s*\d{1,2}|\d{1,2}:\d{2}/.test(plainText);
|
|
@@ -78,19 +94,19 @@ export function PromotionOfferListCard(props: {
|
|
|
78
94
|
const [offer, ...alternatives] = data.items;
|
|
79
95
|
if (!offer) return <Empty text={data.noResultsReason ?? '暂未找到匹配当前场景的优惠'} />;
|
|
80
96
|
return (
|
|
81
|
-
<section className="promotion-card promotion-recommendation" aria-label="更适合你的优惠">
|
|
82
|
-
<header className="promotion-card__header">
|
|
83
|
-
<span className="promotion-card__mark promotion-card__mark--violet"><Sparkle weight="fill" /></span>
|
|
84
|
-
<div><span className="promotion-card__eyebrow">智能匹配</span><h3>更适合你的优惠</h3><p>根据当前可用性与预计节省排序</p></div>
|
|
97
|
+
<section className="promotion-card promotion-recommendation relative w-full overflow-hidden bg-card text-sm leading-[normal] tracking-[0] text-foreground pb-[15px]" aria-label="更适合你的优惠">
|
|
98
|
+
<header className="promotion-card__header flex min-w-0 items-center gap-2.5 px-4 pt-3.5 pb-3 max-[380px]:px-[13px] min-[760px]:pt-[15px]">
|
|
99
|
+
<span className="promotion-card__mark promotion-card__mark--violet grid h-[38px] w-[38px] flex-[0_0_38px] place-items-center rounded-[10px] border border-[rgba(155,104,20,0.22)] bg-[#fff0cb] text-[#9b6814] shadow-[0_5px_14px_rgba(8,119,95,0.08)] [&_svg]:size-5"><Sparkle weight="fill" /></span>
|
|
100
|
+
<div className="min-w-0 flex-1"><span className="promotion-card__eyebrow mb-0.5 block text-xs font-bold leading-[14px] text-[#2368ec]">智能匹配</span><h3 className="text-lg font-bold leading-[22px] text-foreground [overflow-wrap:anywhere] max-[380px]:text-base">更适合你的优惠</h3><p className="mt-0.5 truncate text-xs leading-4 text-secondary-foreground">根据当前可用性与预计节省排序</p></div>
|
|
85
101
|
</header>
|
|
86
|
-
<div className="promotion-recommendation__main">
|
|
87
|
-
<ImageWithFallback src={offer.imageUrl} alt={offer.title} className="promotion-recommendation__image" />
|
|
88
|
-
<div
|
|
89
|
-
<em>{offer.benefitText ?? offerTypeLabel(offer.offerType)}</em>
|
|
102
|
+
<div className="promotion-recommendation__main mx-4 grid grid-cols-[70px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-[8px] border border-[rgba(35,104,236,0.16)] bg-[#f5fbf8] p-[9px]">
|
|
103
|
+
<ImageWithFallback src={offer.imageUrl} alt={offer.title} className="promotion-recommendation__image h-[62px] w-[70px] rounded-[7px] object-cover" />
|
|
104
|
+
<div className="grid min-w-0 gap-[3px]"><span className={statusBadgeClass(offer.availabilityStatus, offer.claimable)}>{statusText(offer.availabilityStatus, offer.claimable)}</span><strong className="truncate text-sm leading-[normal]">{offer.title}</strong><small className="truncate text-xs leading-[normal] text-secondary-foreground">{offer.subtitle ?? offer.validityText ?? '当前商场可用'}</small></div>
|
|
105
|
+
<em className="text-lg font-extrabold not-italic leading-[normal] tabular-nums text-[var(--tbox-domain-promotion-accent,#e42f46)]">{offer.benefitText ?? offerTypeLabel(offer.offerType)}</em>
|
|
90
106
|
</div>
|
|
91
|
-
<div className="promotion-recommendation__reason"><Lightbulb weight="duotone" /><span><b>推荐依据</b>{data.summary ?? '综合资格、可用性和优惠力度'}</span></div>
|
|
92
|
-
{alternatives.length > 0 && <div className="promotion-recommendation__alternatives">另有 {alternatives.length} 个候选优惠</div>}
|
|
93
|
-
<ItemActionsRow actions={offer.itemActions ?? []} cardId={cardId} isHistory={isHistory} className="promotion-recommendation__actions" chipClassName=
|
|
107
|
+
<div className="promotion-recommendation__reason mx-4 mt-2.5 flex items-start gap-[7px] rounded-[7px] bg-[var(--tbox-domain-promotion-surface,#fff1f3)] px-[9px] py-2 text-xs leading-[normal] text-[#744333] [&_svg]:shrink-0 [&_svg]:text-[var(--tbox-domain-promotion-accent,#e42f46)]"><Lightbulb weight="duotone" /><span className="grid gap-[1px]"><b>推荐依据</b>{data.summary ?? '综合资格、可用性和优惠力度'}</span></div>
|
|
108
|
+
{alternatives.length > 0 && <div className="promotion-recommendation__alternatives mx-4 mt-2 text-xs leading-[normal] text-secondary-foreground">另有 {alternatives.length} 个候选优惠</div>}
|
|
109
|
+
<ItemActionsRow actions={offer.itemActions ?? []} cardId={cardId} isHistory={isHistory} className="promotion-recommendation__actions" chipClassName={`promotion-button promotion-button--primary ${PROMOTION_BUTTON_PRIMARY_CLASS}`} />
|
|
94
110
|
</section>
|
|
95
111
|
);
|
|
96
112
|
}
|
|
@@ -107,66 +123,66 @@ export function PromotionOfferListCard(props: {
|
|
|
107
123
|
const items = data.mode === 'claimable' ? data.items.filter((item) => item.claimable) : data.items;
|
|
108
124
|
const maxItems = data.maxItems ?? 4;
|
|
109
125
|
return (
|
|
110
|
-
<section className={`promotion-card promotion-list${promotion ? ' promotion-list--promotion' : ''}${coupon ? ' promotion-list--coupon promotion-list--offers' : ''}`} aria-label={title}>
|
|
111
|
-
{promotion && hero && <div className="promotion-list__hero"><ImageWithFallback src={hero.imageUrl} alt={title} className="promotion-list__hero-image" /><div className="promotion-list__glass"><span>刚刚更新</span><strong>{data.items.length} 个活动正在进行</strong></div></div>}
|
|
126
|
+
<section className={`promotion-card promotion-list relative w-full overflow-hidden bg-card text-sm leading-[normal] tracking-[0] text-foreground ${promotion ? ' promotion-list--promotion' : ''}${coupon ? ' promotion-list--coupon promotion-list--offers pb-3' : ''}`} aria-label={title}>
|
|
127
|
+
{promotion && hero && <div className="promotion-list__hero relative h-[92px] overflow-hidden bg-[#eef2f8]"><ImageWithFallback src={hero.imageUrl} alt={title} className="promotion-list__hero-image h-full w-full object-cover" /><div className="promotion-list__glass absolute right-3 bottom-2.5 left-3 grid gap-[1px] rounded-[7px] border border-[rgba(255,255,255,0.68)] bg-[rgba(255,255,255,0.78)] px-2.5 py-2 shadow-[0_8px_20px_rgba(21,45,88,0.15)] backdrop-blur-[6px]"><span className="text-xs font-bold leading-[normal] text-[#128356]">刚刚更新</span><strong className="text-sm leading-[18px]">{data.items.length} 个活动正在进行</strong></div></div>}
|
|
112
128
|
{coupon ? (
|
|
113
|
-
<header className="promotion-activity__header promotion-activity__header--pea promotion-coupon__header">
|
|
114
|
-
<div className="promotion-activity__header-copy">
|
|
115
|
-
<div className="promotion-activity__header-title-row">
|
|
129
|
+
<header className="promotion-activity__header promotion-activity__header--pea promotion-coupon__header relative flex min-h-[87px] items-center overflow-hidden bg-[#f9f1e2] bg-cover bg-center bg-[image:var(--tbox-asset-promotion-coupon-header,linear-gradient(135deg,#fff1f3,#ffe4e8))] px-3.5 pt-3 pb-2.5">
|
|
130
|
+
<div className="promotion-activity__header-copy relative z-[1] w-[52%] min-w-0">
|
|
131
|
+
<div className="promotion-activity__header-title-row flex items-center gap-2.5 text-[#2f3a22] [&_svg]:size-[15px] [&_svg]:shrink-0 [&_svg]:text-[#4f7b37]">
|
|
116
132
|
<Ticket weight="fill" />
|
|
117
|
-
<h3>{title}</h3>
|
|
133
|
+
<h3 className="text-base font-bold leading-[21px] text-[#2f3a22] [overflow-wrap:anywhere]">{title}</h3>
|
|
118
134
|
</div>
|
|
119
|
-
<p>{eyebrow}</p>
|
|
135
|
+
<p className="mt-1 text-xs leading-4 text-[#626b5c]">{eyebrow}</p>
|
|
120
136
|
</div>
|
|
121
137
|
</header>
|
|
122
138
|
) : (
|
|
123
|
-
<header className="promotion-card__header">
|
|
124
|
-
<span className="promotion-card__mark">{promotion ? <CalendarDots weight="duotone" /> : <Sparkle weight="fill" />}</span>
|
|
125
|
-
<div><span className="promotion-card__eyebrow">{eyebrow}</span><h3>{title}</h3><p>{summary ?? '根据当前场景实时筛选'}</p></div>
|
|
126
|
-
<b className="promotion-card__count">{data.items.length} 个</b>
|
|
139
|
+
<header className="promotion-card__header flex min-w-0 items-center gap-2.5 px-4 pt-3.5 pb-3 max-[380px]:px-[13px] min-[760px]:pt-[15px]">
|
|
140
|
+
<span className="promotion-card__mark grid h-[38px] w-[38px] flex-[0_0_38px] place-items-center rounded-[10px] border border-[rgba(8,119,95,0.18)] bg-[#dff6ed] text-[#08775f] shadow-[0_5px_14px_rgba(8,119,95,0.08)] [&_svg]:size-5">{promotion ? <CalendarDots weight="duotone" /> : <Sparkle weight="fill" />}</span>
|
|
141
|
+
<div className="min-w-0 flex-1"><span className="promotion-card__eyebrow mb-0.5 block text-xs font-bold leading-[14px] text-[#2368ec]">{eyebrow}</span><h3 className="text-lg font-bold leading-[22px] text-foreground [overflow-wrap:anywhere] max-[380px]:text-base">{title}</h3><p className="mt-0.5 truncate text-xs leading-4 text-secondary-foreground">{summary ?? '根据当前场景实时筛选'}</p></div>
|
|
142
|
+
<b className="promotion-card__count flex-none rounded-full border border-[rgba(83,91,108,0.13)] bg-[#f0f3f8] px-2 py-1.25 text-xs leading-[normal] text-secondary-foreground max-[380px]:hidden">{data.items.length} 个</b>
|
|
127
143
|
</header>
|
|
128
144
|
)}
|
|
129
145
|
{!items.length ? <Empty text={data.noResultsReason ?? '暂未找到符合条件的优惠'} /> : (
|
|
130
|
-
<div ref={listRef} className={`promotion-list__items${expanded ? ' promotion-list__items--expanded' : ''}`} style={{ maxHeight: expanded ? listHeights.expanded || undefined : listHeights.collapsed || undefined }} onTransitionEnd={() => { if (bottomRef.current) scrollCardBottom(bottomRef.current); }}>
|
|
146
|
+
<div ref={listRef} className={coupon ? `promotion-list__items overflow-hidden px-3.5 pb-1 ${expanded ? ' promotion-list__items--expanded transition-none' : ' transition-[max-height] duration-[320ms] ease-[ease]'}` : `promotion-list__items px-4 pb-1 max-[380px]:px-[13px]${expanded ? ' promotion-list__items--expanded' : ''}`} style={{ maxHeight: expanded ? listHeights.expanded || undefined : listHeights.collapsed || undefined }} onTransitionEnd={() => { if (bottomRef.current) scrollCardBottom(bottomRef.current); }}>
|
|
131
147
|
{items.map((item) => coupon ? (
|
|
132
148
|
<article
|
|
133
149
|
key={item.offerRef}
|
|
134
|
-
className="promotion-coupon-row"
|
|
150
|
+
className="promotion-coupon-row relative grid min-h-[77px] w-full cursor-pointer grid-cols-[68px_minmax(0,1fr)_auto] items-center gap-x-[9px] gap-y-0 overflow-hidden border-0 py-2.5 text-left text-inherit focus-visible:rounded-[6px] focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[#2368ec]"
|
|
135
151
|
role="button"
|
|
136
152
|
tabIndex={0}
|
|
137
153
|
aria-label={`${item.claimActionLabel ?? '领取'}「${item.title}」`}
|
|
138
154
|
onClick={() => setOpenRef(item.offerRef)}
|
|
139
155
|
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setOpenRef(item.offerRef); } }}
|
|
140
156
|
>
|
|
141
|
-
<ImageWithFallback src={item.imageUrl} alt={item.title} className="promotion-coupon-row__thumb" />
|
|
142
|
-
<div className="promotion-coupon-row__main">
|
|
143
|
-
<strong className="promotion-coupon-row__title">{item.title}</strong>
|
|
144
|
-
{item.tags.some((tag) => !/^TOP[1-5]$/i.test(tag)) && <span className="promotion-coupon-row__tags">{item.tags.filter((tag) => !/^TOP[1-5]$/i.test(tag)).slice(0, 3).map((tag) => <em key={tag} className={/^(精选|餐饮|购物|生活)$/.test(tag) ? 'promotion-coupon-row__tag--category' : 'promotion-coupon-row__tag--meta'}>{tag}</em>)}</span>}
|
|
157
|
+
<ImageWithFallback src={item.imageUrl} alt={item.title} className="promotion-coupon-row__thumb h-[68px] w-[68px] shrink-0 rounded-[9px] object-cover shadow-[inset_0_0_0_1px_rgba(11,15,23,0.04)] [&:not(.promotion-image--fallback)]:block" />
|
|
158
|
+
<div className="promotion-coupon-row__main relative flex min-w-0 flex-col justify-center gap-1 self-stretch pr-0.5">
|
|
159
|
+
<strong className="promotion-coupon-row__title line-clamp-2 text-sm font-semibold leading-[19px] text-foreground">{item.title}</strong>
|
|
160
|
+
{item.tags.some((tag) => !/^TOP[1-5]$/i.test(tag)) && <span className="promotion-coupon-row__tags mt-0 flex gap-1 overflow-hidden">{item.tags.filter((tag) => !/^TOP[1-5]$/i.test(tag)).slice(0, 3).map((tag) => <em key={tag} className={`${/^(精选|餐饮|购物|生活)$/.test(tag) ? 'promotion-coupon-row__tag--category' : 'promotion-coupon-row__tag--meta'} shrink-0 max-w-[80px] truncate rounded-[3.5px] bg-[#fff4df] px-[5px] py-[1px] text-xs font-normal not-italic leading-[14px] text-[#986415]`}>{tag}</em>)}</span>}
|
|
145
161
|
{item.subtitle && !couponSubtitleIsTime(item.subtitle)
|
|
146
|
-
&& <span className="promotion-coupon-row__sub" dangerouslySetInnerHTML={{ __html: item.subtitle }} />}
|
|
147
|
-
<span className="promotion-coupon-row__price">
|
|
162
|
+
&& <span className="promotion-coupon-row__sub line-clamp-2 text-xs leading-[11.5px] text-[rgba(11,15,23,0.55)]" dangerouslySetInnerHTML={{ __html: item.subtitle }} />}
|
|
163
|
+
<span className="promotion-coupon-row__price mt-[1px] flex min-w-0 items-baseline gap-1">
|
|
148
164
|
{/* 售价缺省时退回 benefitText:老 provider 没有价格字段,不能让这行空着 */}
|
|
149
|
-
<b>{item.priceText ?? item.benefitText ?? offerTypeLabel(item.offerType)}</b>
|
|
150
|
-
{item.discountLabel && <em className="promotion-coupon-row__discount">{item.discountLabel}</em>}
|
|
151
|
-
{item.priceText && item.originalPriceText && <s>{item.originalPriceText}</s>}
|
|
165
|
+
<b className="shrink-0 text-sm font-extrabold leading-[17px] text-[#e8471c]">{item.priceText ?? item.benefitText ?? offerTypeLabel(item.offerType)}</b>
|
|
166
|
+
{item.discountLabel && <em className="promotion-coupon-row__discount shrink-0 rounded-[2px] bg-[#fff1eb] px-[3.5px] py-[1px] text-xs font-bold not-italic leading-[10.5px] text-[#e8471c]">{item.discountLabel}</em>}
|
|
167
|
+
{item.priceText && item.originalPriceText && <s className="truncate text-xs leading-3 text-[rgba(11,15,23,0.38)]">{item.originalPriceText}</s>}
|
|
152
168
|
</span>
|
|
153
169
|
</div>
|
|
154
170
|
{/* 领/抢是拉起浮层的入口,不是成交按钮:整行已是可交互控件,
|
|
155
171
|
这里只做视觉承诺——真正的领取动作只在浮层里出现一次 */}
|
|
156
|
-
<span className="promotion-item-actions promotion-item-actions--coupon" aria-hidden="true">
|
|
157
|
-
<span className=
|
|
172
|
+
<span className="promotion-item-actions promotion-item-actions--coupon contents shrink-0" aria-hidden="true">
|
|
173
|
+
<span className={`promotion-chip promotion-chip--coupon ${PROMOTION_CHIP_COUPON_CLASS}`}>{item.claimActionLabel ?? '领取'}</span>
|
|
158
174
|
</span>
|
|
159
175
|
</article>
|
|
160
176
|
) : (
|
|
161
|
-
<article key={item.offerRef}>
|
|
162
|
-
<span className="promotion-list__visual"><ImageWithFallback src={item.imageUrl} alt={item.title} className="promotion-list__thumb" /><em>{item.benefitText ?? offerTypeLabel(item.offerType)}</em></span>
|
|
163
|
-
<span className="promotion-list__copy">
|
|
164
|
-
<small>{promotion ? '本周活动' : offerTypeLabel(item.offerType)}</small>
|
|
165
|
-
<strong>{item.title}</strong>
|
|
166
|
-
<span>{item.subtitle ?? item.validityText ?? '当前商场可用'}</span>
|
|
177
|
+
<article key={item.offerRef} className="grid min-h-[66px] w-full grid-cols-[52px_minmax(0,1fr)_auto_12px] items-center gap-[9px] border-t border-border py-2 text-left text-inherit first:border-t-0 max-[380px]:grid-cols-[46px_minmax(0,1fr)_auto_10px] max-[380px]:gap-[7px]">
|
|
178
|
+
<span className="promotion-list__visual relative h-[48px] w-[52px] max-[380px]:w-[46px]"><ImageWithFallback src={item.imageUrl} alt={item.title} className="promotion-list__thumb h-[48px] w-[52px] rounded-[7px] object-cover max-[380px]:w-[46px]" /><em className="absolute right-[3px] bottom-[3px] max-w-[47px] truncate rounded-[4px] border border-[rgba(255,255,255,0.7)] bg-[rgba(255,255,255,0.82)] px-1 py-0.5 text-xs font-extrabold not-italic leading-[normal] text-[var(--tbox-domain-promotion-accent,#e42f46)] backdrop-blur-[3.5px]">{item.benefitText ?? offerTypeLabel(item.offerType)}</em></span>
|
|
179
|
+
<span className="promotion-list__copy grid min-w-0 gap-0.5">
|
|
180
|
+
<small className="text-xs font-bold leading-[normal] text-[#128356]">{promotion ? '本周活动' : offerTypeLabel(item.offerType)}</small>
|
|
181
|
+
<strong className="truncate text-sm leading-[18px]">{item.title}</strong>
|
|
182
|
+
<span className="truncate text-xs leading-[normal] text-secondary-foreground">{item.subtitle ?? item.validityText ?? '当前商场可用'}</span>
|
|
167
183
|
</span>
|
|
168
|
-
<span className={
|
|
169
|
-
<ItemActionsRow actions={item.itemActions ?? []} cardId={cardId} isHistory={isHistory} className="promotion-item-actions" chipClassName=
|
|
184
|
+
<span className={statusBadgeClass(item.availabilityStatus, item.claimable)}>{statusText(item.availabilityStatus, item.claimable)}</span>
|
|
185
|
+
<ItemActionsRow actions={item.itemActions ?? []} cardId={cardId} isHistory={isHistory} className="promotion-item-actions contents" chipClassName={PROMOTION_CHIP_CLASS} />
|
|
170
186
|
</article>
|
|
171
187
|
))}
|
|
172
188
|
</div>
|
|
@@ -174,7 +190,7 @@ export function PromotionOfferListCard(props: {
|
|
|
174
190
|
{items.length > maxItems && (
|
|
175
191
|
<button
|
|
176
192
|
type="button"
|
|
177
|
-
className=
|
|
193
|
+
className={coupon ? `promotion-list__toggle flex min-h-8 w-full cursor-pointer items-center justify-center gap-0.5 mt-0.5 border-0 bg-transparent px-0 py-0 text-xs font-normal leading-[normal] text-[#686d69] [font-family:inherit] hover:brightness-100 focus-visible:rounded-[5px] focus-visible:outline-3 focus-visible:outline-offset-2 focus-visible:outline-[rgba(9,107,250,0.28)] [&_svg]:transition-transform [&_svg]:duration-[160ms] [&_svg]:ease-[ease] [&_svg[data-rotated=true]]:rotate-180` : `promotion-list__toggle inline-flex w-full cursor-pointer items-center justify-center gap-[3px] mt-0.5 border-0 border-t border-[rgba(188,205,191,0.42)] bg-[linear-gradient(105deg,#fffaf0_0%,#f9f5e9_46%,#eaf6f3_100%)] px-3 pt-[7px] pb-2 text-xs font-semibold leading-[normal] text-foreground [font-family:inherit] hover:brightness-[0.94] focus-visible:outline-3 focus-visible:outline-foreground focus-visible:outline-offset-[-3px] [&_svg]:transition-transform [&_svg]:duration-[160ms] [&_svg]:ease-[ease] [&_svg[data-rotated=true]]:rotate-180`}
|
|
178
194
|
aria-expanded={expanded}
|
|
179
195
|
onClick={toggleExpanded}
|
|
180
196
|
>
|
|
@@ -183,8 +199,8 @@ export function PromotionOfferListCard(props: {
|
|
|
183
199
|
{coupon && <CaretDown size={17} aria-hidden="true" data-rotated={expanded || undefined} />}
|
|
184
200
|
</button>
|
|
185
201
|
)}
|
|
186
|
-
{items.length > maxItems && <div ref={bottomRef} className="promotion-list__bottom-anchor" aria-hidden="true" />}
|
|
187
|
-
{data.nextCursor && <p className="promotion-list__more">还有更多内容,可继续查询</p>}
|
|
202
|
+
{items.length > maxItems && <div ref={bottomRef} className="promotion-list__bottom-anchor h-0 flex-none scroll-mb-[max(96px,calc(var(--tbox-chat-bottom-height,0px)_+_24px))]" aria-hidden="true" />}
|
|
203
|
+
{data.nextCursor && <p className="promotion-list__more px-4 pt-1 pb-[9px] text-center text-xs leading-[normal] text-secondary-foreground">还有更多内容,可继续查询</p>}
|
|
188
204
|
{openRef && (() => {
|
|
189
205
|
const target = items.find((i) => i.offerRef === openRef);
|
|
190
206
|
if (!target) return null;
|
|
@@ -229,15 +245,15 @@ export function PromotionOfferListCard(props: {
|
|
|
229
245
|
});
|
|
230
246
|
}}
|
|
231
247
|
foot={<>
|
|
232
|
-
<span className="promotion-sheet__foot-price">
|
|
233
|
-
<b>{target.priceText ?? target.benefitText ?? ''}</b>
|
|
234
|
-
{target.priceText && target.originalPriceText && <s>{target.originalPriceText}</s>}
|
|
248
|
+
<span className="promotion-sheet__foot-price flex min-w-0 items-baseline gap-1">
|
|
249
|
+
<b className="text-xl font-extrabold leading-[normal] text-[#e8471c]">{target.priceText ?? target.benefitText ?? ''}</b>
|
|
250
|
+
{target.priceText && target.originalPriceText && <s className="text-xs leading-[normal] text-[rgba(11,15,23,0.4)]">{target.originalPriceText}</s>}
|
|
235
251
|
</span>
|
|
236
252
|
{redirectOnly ? (
|
|
237
253
|
<button
|
|
238
254
|
type="button"
|
|
239
255
|
disabled={!target.purchaseUrl}
|
|
240
|
-
className=
|
|
256
|
+
className={`promotion-chip promotion-chip--coupon promotion-chip--coupon-lg ${PROMOTION_CHIP_COUPON_LG_CLASS}`}
|
|
241
257
|
onClick={() => {
|
|
242
258
|
if (!target.purchaseUrl) return;
|
|
243
259
|
void navigateToAlipayPage(target.purchaseUrl).catch((err: unknown) => {
|
|
@@ -251,7 +267,7 @@ export function PromotionOfferListCard(props: {
|
|
|
251
267
|
// 直接走写动作,不再绕发消息:结果以新卡片回到对话流,当前浮层保持已领取态
|
|
252
268
|
<button
|
|
253
269
|
type="button"
|
|
254
|
-
className=
|
|
270
|
+
className={`promotion-chip promotion-chip--coupon promotion-chip--coupon-lg ${PROMOTION_CHIP_COUPON_LG_CLASS}`}
|
|
255
271
|
onClick={() => {
|
|
256
272
|
setClaimingRef(target.offerRef);
|
|
257
273
|
sendCardAction(cardId, { type: 'moduleAction', actionId: 'promotion.acquire-from-list', contextToken: token }, { offerRef: target.offerRef });
|
|
@@ -267,7 +283,7 @@ export function PromotionOfferListCard(props: {
|
|
|
267
283
|
cardId={cardId}
|
|
268
284
|
isHistory={isHistory}
|
|
269
285
|
className="promotion-item-actions"
|
|
270
|
-
chipClassName=
|
|
286
|
+
chipClassName={`promotion-chip promotion-chip--coupon promotion-chip--coupon-lg ${PROMOTION_CHIP_COUPON_LG_CLASS}`}
|
|
271
287
|
/>
|
|
272
288
|
)}
|
|
273
289
|
</>}
|
|
@@ -281,7 +297,7 @@ export function PromotionOfferListCard(props: {
|
|
|
281
297
|
markSelfRendering(PromotionOfferListCard);
|
|
282
298
|
|
|
283
299
|
function Empty({ text }: { text: string }) {
|
|
284
|
-
return <div className="promotion-card__empty"><Ticket size={28} weight="duotone" /><span>{text}</span></div>;
|
|
300
|
+
return <div className="promotion-card__empty flex min-h-[94px] items-center justify-center gap-2 p-5 text-xs leading-[normal] text-secondary-foreground"><Ticket size={28} weight="duotone" /><span>{text}</span></div>;
|
|
285
301
|
}
|
|
286
302
|
|
|
287
303
|
export default PromotionOfferListCard;
|
|
@@ -23,7 +23,7 @@ export function CouponQrCode(props: { value: string; disabled?: boolean }) {
|
|
|
23
23
|
return () => { active = false; };
|
|
24
24
|
}, [disabled, value]);
|
|
25
25
|
|
|
26
|
-
return src ? <img className={`promotion-sheet__qrcode${disabled ? ' promotion-sheet__qrcode--disabled' : ''}`} src={src} alt="券码二维码" /> : null;
|
|
26
|
+
return src ? <img className={`promotion-sheet__qrcode block h-auto w-[min(70%,120px)] aspect-square mx-auto mt-2.5 mb-3 [image-rendering:pixelated] ${disabled ? ' promotion-sheet__qrcode--disabled opacity-85' : ''}`} src={src} alt="券码二维码" /> : null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export function CouponBarcode(props: { value: string; disabled?: boolean }) {
|
|
@@ -44,5 +44,5 @@ export function CouponBarcode(props: { value: string; disabled?: boolean }) {
|
|
|
44
44
|
ref.current.replaceChildren();
|
|
45
45
|
}
|
|
46
46
|
}, [disabled, value]);
|
|
47
|
-
return <svg ref={ref} className={`promotion-sheet__barcode${disabled ? ' promotion-sheet__barcode--disabled' : ''}`} aria-label="券码条形码" role="img" />;
|
|
47
|
+
return <svg ref={ref} className={`promotion-sheet__barcode block h-auto min-h-[26px] w-[min(70%,160px)] mx-auto mt-3.5 mb-2.5 ${disabled ? ' promotion-sheet__barcode--disabled opacity-85' : ''}`} aria-label="券码条形码" role="img" />;
|
|
48
48
|
}
|
|
@@ -71,7 +71,7 @@ export function CouponSheet(props: {
|
|
|
71
71
|
|
|
72
72
|
return createPortal(
|
|
73
73
|
<div
|
|
74
|
-
className={`promotion-sheet${closing ? '
|
|
74
|
+
className={`promotion-sheet fixed inset-0 z-[60] flex items-end justify-center bg-[rgba(11,15,23,0.42)] motion-reduce:animate-none ${closing ? 'promotion-sheet--closing pointer-events-none animate-[promotion-sheet-out_180ms_ease-in_both]' : 'animate-[promotion-sheet-in_180ms_ease-out]'}`}
|
|
75
75
|
role="dialog"
|
|
76
76
|
aria-modal="true"
|
|
77
77
|
aria-label={`${title} 详情`}
|
|
@@ -80,35 +80,35 @@ export function CouponSheet(props: {
|
|
|
80
80
|
}}
|
|
81
81
|
onMouseDown={(e) => { if (e.target === e.currentTarget) requestClose(); }}
|
|
82
82
|
>
|
|
83
|
-
<div className=
|
|
84
|
-
<button type="button" className="promotion-sheet__close" aria-label="关闭详情" onClick={requestClose}>
|
|
83
|
+
<div className={`promotion-sheet__panel relative flex max-h-[82vh] w-full max-w-[375px] flex-col rounded-t-[18px] bg-card motion-reduce:animate-none ${closing ? 'animate-[promotion-sheet-down_180ms_ease-in_both]' : 'animate-[promotion-sheet-up_220ms_cubic-bezier(0.22,1,0.36,1)]'}`}>
|
|
84
|
+
<button type="button" className="promotion-sheet__close absolute top-3 right-3 z-[2] grid size-[30px] cursor-pointer place-items-center rounded-full border-0 bg-[rgba(11,15,23,0.42)] text-white [font-family:inherit]" aria-label="关闭详情" onClick={requestClose}>
|
|
85
85
|
<X size={18} weight="bold" aria-hidden="true" />
|
|
86
86
|
</button>
|
|
87
|
-
<div className="promotion-sheet__scroll">
|
|
88
|
-
<ImageWithFallback src={imageUrl} alt={title} className={
|
|
87
|
+
<div className="promotion-sheet__scroll overflow-y-auto pb-1.5 [-webkit-overflow-scrolling:touch]">
|
|
88
|
+
<ImageWithFallback src={imageUrl} alt={title} className={imageFit === 'cover' ? 'promotion-sheet__image promotion-sheet__image--cover block h-[210px] w-full rounded-t-[18px] bg-[#f5f6f8] object-cover' : 'promotion-sheet__image h-[210px] w-full rounded-t-[18px] bg-[#f5f6f8] object-contain'} />
|
|
89
89
|
{/* 价格条压在图下沿:与列表行同一组价格语言,浮层里放大一档 */}
|
|
90
90
|
{(priceMain || aside) && (
|
|
91
|
-
<div className="promotion-sheet__price">
|
|
92
|
-
{priceMain && <b>{priceMain}</b>}
|
|
93
|
-
{priceMain && priceOriginal && <s>{priceOriginal}</s>}
|
|
94
|
-
{aside && <span className="promotion-sheet__stock">{aside}</span>}
|
|
91
|
+
<div className="promotion-sheet__price flex items-baseline gap-2 bg-[linear-gradient(180deg,#fdf1e8_0%,#fbe7d9_100%)] px-4 py-3">
|
|
92
|
+
{priceMain && <b className="text-2xl font-extrabold leading-[27px] text-[#e8471c]">{priceMain}</b>}
|
|
93
|
+
{priceMain && priceOriginal && <s className="text-xs leading-[normal] text-[rgba(11,15,23,0.4)]">{priceOriginal}</s>}
|
|
94
|
+
{aside && <span className="promotion-sheet__stock ml-auto text-xs leading-[normal] text-[rgba(11,15,23,0.55)]">{aside}</span>}
|
|
95
95
|
</div>
|
|
96
96
|
)}
|
|
97
|
-
<h4 className="promotion-sheet__title">{title}</h4>
|
|
98
|
-
{(noticeText || guaranteeText) && <div className="promotion-sheet__notice-strip">
|
|
99
|
-
{noticeText && <span><b>须知</b>{noticeText}</span>}
|
|
100
|
-
{guaranteeText && <span><b>保障</b>{guaranteeText}</span>}
|
|
97
|
+
<h4 className="promotion-sheet__title mx-4 mt-3.5 text-lg font-bold leading-[23px] text-[rgba(11,15,23,0.9)]">{title}</h4>
|
|
98
|
+
{(noticeText || guaranteeText) && <div className="promotion-sheet__notice-strip mx-4 mt-3 grid gap-[3px] rounded-[5px] bg-[#fff8ef] px-[7px] py-1.5 text-sm leading-[19px]">
|
|
99
|
+
{noticeText && <span className="grid grid-cols-[72px_minmax(0,1fr)] gap-1.5"><b className="w-auto text-left text-[#b38a3e]">须知</b>{noticeText}</span>}
|
|
100
|
+
{guaranteeText && <span className="grid grid-cols-[72px_minmax(0,1fr)] gap-1.5"><b className="w-auto text-left text-[#ef7654]">保障</b>{guaranteeText}</span>}
|
|
101
101
|
</div>}
|
|
102
|
-
{subtitle && <p className="promotion-sheet__sub" dangerouslySetInnerHTML={{ __html: subtitle }} />}
|
|
102
|
+
{subtitle && <p className="promotion-sheet__sub mx-4 mt-3 text-sm leading-[19px] text-[rgba(11,15,23,0.55)]" dangerouslySetInnerHTML={{ __html: subtitle }} />}
|
|
103
103
|
{beforeFacts}
|
|
104
104
|
{facts.length > 0 && (
|
|
105
105
|
<>
|
|
106
|
-
<div className="promotion-sheet__section">使用须知</div>
|
|
107
|
-
<dl className="promotion-sheet__facts">
|
|
106
|
+
<div className="promotion-sheet__section mx-4 mt-[17px] text-sm font-bold leading-5 text-[rgba(11,15,23,0.9)]">使用须知</div>
|
|
107
|
+
<dl className="promotion-sheet__facts mx-4 mt-2 rounded-[10px] bg-[#f7f8fa] px-3 py-[3px]">
|
|
108
108
|
{facts.map((f) => (
|
|
109
|
-
<div key={f.label}>
|
|
110
|
-
<dt>{f.icon}{f.label}</dt>
|
|
111
|
-
<dd dangerouslySetInnerHTML={{ __html: sanitizeActivityHtml(f.value) }} />
|
|
109
|
+
<div key={f.label} className="flex gap-1.5 border-b border-[#ecedf1] py-[11px] last:border-b-0">
|
|
110
|
+
<dt className="flex w-[70px] shrink-0 items-center gap-[3.5px] text-xs leading-[17px] text-[rgba(11,15,23,0.55)]">{f.icon}{f.label}</dt>
|
|
111
|
+
<dd className="text-sm leading-[19px] text-[rgba(11,15,23,0.85)] [overflow-wrap:anywhere]" dangerouslySetInnerHTML={{ __html: sanitizeActivityHtml(f.value) }} />
|
|
112
112
|
</div>
|
|
113
113
|
))}
|
|
114
114
|
</dl>
|
|
@@ -116,7 +116,7 @@ export function CouponSheet(props: {
|
|
|
116
116
|
)}
|
|
117
117
|
{extra}
|
|
118
118
|
</div>
|
|
119
|
-
{foot && <div className="promotion-sheet__foot">{foot}</div>}
|
|
119
|
+
{foot && <div className="promotion-sheet__foot flex items-center justify-between gap-3 border-t border-[#eef0f3] bg-card px-4 pt-[11px] pb-[calc(11px+env(safe-area-inset-bottom,0px))]">{foot}</div>}
|
|
120
120
|
</div>
|
|
121
121
|
</div>,
|
|
122
122
|
document.body,
|
|
@@ -17,7 +17,7 @@ export function ImageWithFallback(props: {
|
|
|
17
17
|
if (!src || failed) {
|
|
18
18
|
return (
|
|
19
19
|
<div
|
|
20
|
-
className={`img-fallback promotion-image--fallback ${className ?? ''}`.trim()}
|
|
20
|
+
className={`img-fallback promotion-image--fallback grid place-items-center bg-[#f1f2f4] text-[rgba(11,15,23,0.26)] ${className ?? ''}`.trim()}
|
|
21
21
|
aria-label={alt}
|
|
22
22
|
role="img"
|
|
23
23
|
>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* promotion 卡片共用的工具类字面量(迁移自原模块样式表的 `.promotion-status` / `.promotion-chip*` 族)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么集中在这里:状态徽章与动作 chip 由 4 张卡复用同一副骨架,而 Tailwind 只认完整字面量
|
|
5
|
+
* (禁 `bg-${x}` 拼接)。hook 类(`promotion-status` / `promotion-chip*` 等 BEM)仍写在组件里,
|
|
6
|
+
* 这里只放视觉工具类;色调走 Record 映射(同 MallHome 的 AREA_TONE_CLASS 范式)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** `.promotion-status` 骨架(原 font-size 18px / padding 8px 14px) */
|
|
10
|
+
export const PROMOTION_STATUS_CLASS = 'inline-flex flex-none items-center gap-[3px] whitespace-nowrap rounded-full px-[7px] py-1 text-xs font-bold not-italic leading-[normal]';
|
|
11
|
+
|
|
12
|
+
/** `.promotion-status--*` 色调;未知 tone 不落任何色(等价旧 CSS 无匹配修饰符) */
|
|
13
|
+
export const PROMOTION_STATUS_TONE_CLASS: Record<string, string> = {
|
|
14
|
+
available: 'bg-[#eaf8f1] text-[#128356]',
|
|
15
|
+
requires_action: 'bg-[var(--tbox-domain-promotion-surface,#fff1f3)] text-[#a43d25]',
|
|
16
|
+
unavailable: 'bg-[#f0f3f2] text-secondary-foreground',
|
|
17
|
+
unknown: 'bg-[#f0f3f2] text-secondary-foreground',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* `.promotion-chip` 骨架(原 min-width 104px / height 40px,含 `::after` 箭头)。
|
|
22
|
+
* `[font-family:inherit]` 对应旧 `.promotion-card button { font: inherit }`。
|
|
23
|
+
*/
|
|
24
|
+
export const PROMOTION_CHIP_CLASS = 'inline-flex h-5 w-auto min-w-[52px] cursor-pointer items-center justify-center rounded-full border border-[#d9e0ea] bg-[#f4f8ff] px-[7px] text-xs font-bold leading-none text-[#2368ec] [font-family:inherit] transition-[border-color,color,background-color] duration-[160ms] ease-[ease] after:ml-1 after:content-[\'→\'] after:text-xs after:leading-none hover:not-disabled:border-[#2368ec] hover:not-disabled:bg-[#2368ec] hover:not-disabled:text-white hover:not-disabled:shadow-[0_3px_8px_rgba(35,104,236,0.18)] focus-visible:outline-3 focus-visible:outline-offset-2 focus-visible:outline-[rgba(255,111,31,0.22)] disabled:cursor-not-allowed disabled:opacity-45';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 活动卡内的 chip:`.promotion-activity button:focus-visible`(绿描边、offset 3px)
|
|
28
|
+
* 在旧 CSS 里以 (0,2,1) 压过 `.promotion-chip:focus-visible` (0,2,0),这里写成同一条字面量。
|
|
29
|
+
*/
|
|
30
|
+
export const PROMOTION_CHIP_ACTIVITY_CLASS = 'inline-flex h-5 w-auto min-w-[52px] cursor-pointer items-center justify-center rounded-full border border-[#d9e0ea] bg-[#f4f8ff] px-[7px] text-xs font-bold leading-none text-[#2368ec] [font-family:inherit] transition-[border-color,color,background-color] duration-[160ms] ease-[ease] after:ml-1 after:content-[\'→\'] after:text-xs after:leading-none hover:not-disabled:border-[#2368ec] hover:not-disabled:bg-[#2368ec] hover:not-disabled:text-white hover:not-disabled:shadow-[0_3px_8px_rgba(35,104,236,0.18)] focus-visible:outline-3 focus-visible:outline-offset-3 focus-visible:outline-[#0b8b70] disabled:cursor-not-allowed disabled:opacity-45';
|
|
31
|
+
|
|
32
|
+
/** `.promotion-chip--coupon`(米金实心胶囊,height 64px / min-width 96px) */
|
|
33
|
+
export const PROMOTION_CHIP_COUPON_CLASS = 'inline-flex h-8 w-auto min-w-[48px] cursor-pointer items-center justify-center rounded-full border-0 bg-[linear-gradient(160deg,#c3ad78_0%,#a89058_100%)] px-[7.5px] text-xs font-bold leading-none tracking-[1px] text-white shadow-none [font-family:inherit] after:hidden hover:not-disabled:border-0 hover:not-disabled:bg-[linear-gradient(160deg,#b39d68_0%,#967f4a_100%)] hover:not-disabled:text-white hover:not-disabled:shadow-none focus-visible:outline-none focus-visible:shadow-[inset_0_0_0_3px_#fff,inset_0_0_0_6px_#5f101d] disabled:cursor-not-allowed disabled:opacity-45';
|
|
34
|
+
|
|
35
|
+
/** `.promotion-chip--coupon-lg`(浮层底部主按钮:min-width 240px / height 84px) */
|
|
36
|
+
export const PROMOTION_CHIP_COUPON_LG_CLASS = 'inline-flex h-[42px] w-auto min-w-[120px] cursor-pointer items-center justify-center rounded-full border-0 bg-[linear-gradient(160deg,#c3ad78_0%,#a89058_100%)] px-[7.5px] text-sm font-bold leading-none tracking-[1px] text-white shadow-none [font-family:inherit] after:hidden hover:not-disabled:border-0 hover:not-disabled:bg-[linear-gradient(160deg,#b39d68_0%,#967f4a_100%)] hover:not-disabled:text-white hover:not-disabled:shadow-none focus-visible:outline-none focus-visible:shadow-[inset_0_0_0_3px_#fff,inset_0_0_0_6px_#5f101d] disabled:cursor-not-allowed disabled:opacity-45';
|
|
37
|
+
|
|
38
|
+
/** `.promotion-chip--coupon-off`(不可再用:退成描边灰,压过米金实心) */
|
|
39
|
+
export const PROMOTION_CHIP_COUPON_OFF_CLASS = 'inline-flex h-8 w-auto min-w-[48px] items-center justify-center rounded-full border-0 bg-[#f5f5f7] px-[7.5px] text-xs font-bold leading-none tracking-[1px] text-[rgba(11,15,23,0.45)] shadow-[inset_0_0_0_1px_#e3e4e8] [font-family:inherit] after:hidden hover:not-disabled:bg-[#f5f5f7] hover:not-disabled:text-[rgba(11,15,23,0.45)] hover:not-disabled:shadow-[inset_0_0_0_1px_#e3e4e8] focus-visible:outline-none focus-visible:shadow-[inset_0_0_0_3px_#fff,inset_0_0_0_6px_#5f101d]';
|
|
40
|
+
|
|
41
|
+
/** `.promotion-activity__status`(活动条目/封面上的状态胶囊) */
|
|
42
|
+
export const PROMOTION_ACTIVITY_STATUS_CLASS = 'inline-flex items-center whitespace-nowrap rounded-full border border-[rgba(10,133,103,0.16)] bg-[rgba(235,250,244,0.92)] px-[6px] py-[3.5px] text-xs font-bold leading-3 text-[#08745f] backdrop-blur-[6px]';
|
|
43
|
+
|
|
44
|
+
/** `.promotion-activity__status--*` 色调(AVAILABLE/UNKNOWN 无修饰符,沿用骨架色) */
|
|
45
|
+
export const PROMOTION_ACTIVITY_STATUS_TONE_CLASS: Record<string, string> = {
|
|
46
|
+
full: 'border-[rgba(80,91,87,0.12)] bg-[rgba(245,247,246,0.94)] text-[#687570]',
|
|
47
|
+
ended: 'border-[rgba(80,91,87,0.12)] bg-[rgba(245,247,246,0.94)] text-[#687570]',
|
|
48
|
+
upcoming: 'border-[rgba(184,134,46,0.18)] bg-[rgba(255,246,223,0.94)] text-[#92600e]',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/** `.promotion-activity__category-icon` 四色编码(index % 4;0 = 基座) */
|
|
52
|
+
export const PROMOTION_CATEGORY_ICON_TONE_CLASS: Record<number, string> = {
|
|
53
|
+
0: 'text-[#08775f] bg-[#dff6ed]',
|
|
54
|
+
1: 'text-[#9b6814] bg-[#fff0cb]',
|
|
55
|
+
2: 'text-[#b44333] bg-[#ffebe7]',
|
|
56
|
+
3: 'text-[#0d7384] bg-[#e1f5f7]',
|
|
57
|
+
};
|
package/src/client/index.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* module-promotion 客户端入口:9 个稳定传输卡型,renderer 内覆盖多个展示语义。
|
|
3
|
+
* 样式:全部规则已迁到卡内 Tailwind 工具类,模块不再携带自持样式表与副作用 import。
|
|
3
4
|
*/
|
|
4
|
-
import './styles/promotion.css'; // 0.4.0 模块自持 CSS(副作用 import,首行保证先行加载)
|
|
5
|
-
|
|
6
5
|
import type { CardComponent } from '@tbox.cn/app-contracts';
|
|
7
6
|
import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
|
|
8
7
|
import {
|
package/tbox.module.json
CHANGED
package/tsup.config.ts
CHANGED
|
@@ -27,11 +27,6 @@ export default defineConfig({
|
|
|
27
27
|
'express',
|
|
28
28
|
'@phosphor-icons/react',
|
|
29
29
|
],
|
|
30
|
-
// 0.3.2/0.4.0 D1:模块自持 CSS 出货链。
|
|
31
|
-
// 顶层 loader 写法(实测:esbuildOptions 内设 loader 被 tsup 覆盖失效——CSS 提取断链静默丢失)。
|
|
32
|
-
loader: {
|
|
33
|
-
'.css': 'copy',
|
|
34
|
-
},
|
|
35
30
|
esbuildOptions(options) {
|
|
36
31
|
options.jsx = 'automatic';
|
|
37
32
|
},
|