@tbox.cn/app-module-mall-core 1.0.0-alpha.1 → 1.0.0-alpha.10
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/README.md +4 -4
- package/dist/{chunk-QPBYZO27.js → chunk-ZBHJWURF.js} +1399 -1611
- package/dist/{chunk-FIHBQMON.js → chunk-ZVXAPBVE.js} +1 -1
- package/dist/client/index.d.ts +0 -11
- package/dist/client/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/server/index.js +1 -1
- package/package.json +7 -7
- package/src/client/HomeActivityDetailDialog.tsx +21 -81
- package/src/client/MallHome.tsx +109 -54
- package/src/client/cards/overrides/BumpInActivityChatCard.tsx +1 -1
- package/src/client/components/ActivityDetailPresentation/index.tsx +102 -9
- package/src/client/components/MemberGateSheet/index.tsx +38 -92
- package/src/client/home-slot.tsx +8 -64
- package/src/client/index.ts +4 -3
- package/src/client/member-gate-overlay.tsx +89 -0
- package/src/server/module-ports.ts +1 -1
- package/tbox.module.json +1 -2
- package/tests/MemberGateSheet.test.tsx +9 -0
- package/tests/home-slot.test.tsx +110 -30
- package/tsup.config.ts +0 -1
- package/dist/HomeActivityDetailDialog-2GJFYSMZ.less +0 -178
- package/dist/MallHome-PABCNS6D.less +0 -623
- package/dist/home-slot-WBZ6ONDP.less +0 -4
- package/dist/index-ELJ55M66.less +0 -256
- package/dist/index-U5YRUY7P.less +0 -352
- package/src/client/HomeActivityDetailDialog.less +0 -178
- package/src/client/MallHome.less +0 -623
- package/src/client/components/ActivityDetailPresentation/index.less +0 -352
- package/src/client/components/MemberGateSheet/index.less +0 -256
- package/src/client/home-slot.less +0 -4
|
@@ -240,7 +240,7 @@ import { createLogger as createLogger2 } from "@tbox.cn/app-agent-sdk-server";
|
|
|
240
240
|
var portsLogger = createLogger2("server");
|
|
241
241
|
function warnUnassembled(specifier, e) {
|
|
242
242
|
portsLogger.warn(
|
|
243
|
-
"module ports \u672A\u88C5\u914D\
|
|
243
|
+
"module ports \u672A\u88C5\u914D\uFF08pnpm exec tbox-app module add \u540E\u751F\u6548\uFF09",
|
|
244
244
|
specifier,
|
|
245
245
|
String(e?.message ?? e).slice(0, 120)
|
|
246
246
|
);
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { CardComponent } from '@tbox.cn/app-contracts';
|
|
2
2
|
import { ClientContext } from '@tbox.cn/app-agent-sdk-client';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* module-mall-core 客户端入口(与服务端 serverModule 对称;2026-09-20 随 module-mall-home 并入)。
|
|
6
|
-
*
|
|
7
|
-
* 注册面(应用组装端 registerAll(ctx) 内生效):
|
|
8
|
-
* - ctx.slots.register('home', homeSlotValue):商圈主屏槽(空态首屏 + 会话态恒挂载,域自持显隐);
|
|
9
|
-
* - ctx.cards.registerOverride('promotion-bumpin-activity', ...):聊天视图组合层覆盖
|
|
10
|
-
* (原始形态仍由 provider 模块注册——RawCardRenderer 详情弹层防嵌套);
|
|
11
|
-
* - ctx.cards.registerInlineFilter(filterInlineCards):会员门禁卡系剥离(浮层自持,不进内联流);
|
|
12
|
-
* - cards map 'mall-home':首页预览卡(dev 预览专用——/_tbox/card-preview 目录收录,chat 零出场)。
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
4
|
declare const clientModule: {
|
|
16
5
|
cards: {
|
|
17
6
|
'mall-home': CardComponent;
|
package/dist/client/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
resolveMallInfo,
|
|
10
10
|
resolveMallScopeAssembly,
|
|
11
11
|
serverModule
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZVXAPBVE.js";
|
|
13
13
|
import {
|
|
14
14
|
clientModule
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZBHJWURF.js";
|
|
16
16
|
export {
|
|
17
17
|
bindMallInfoContext,
|
|
18
18
|
buildDefaultMallContext,
|
package/dist/server/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-module-mall-core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "商圈基础模块:scope 域装配注册 + mall-info 工具链 + mall-directory 服务 +
|
|
5
|
+
"description": "商圈基础模块:scope 域装配注册 + mall-info 工具链 + mall-directory 服务 + 会员会话浮层(conversationOverlay 槽)+ MallHome 保留组件+ 首页预览卡。",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tbox.cn/app-contracts": "1.0.0-alpha.
|
|
23
|
-
"@tbox.cn/app-
|
|
24
|
-
"@tbox.cn/app-
|
|
25
|
-
"@tbox.cn/app-agent-sdk-
|
|
22
|
+
"@tbox.cn/app-contracts-mall": "1.0.0-alpha.10",
|
|
23
|
+
"@tbox.cn/app-agent-sdk-server": "1.0.0-alpha.10",
|
|
24
|
+
"@tbox.cn/app-contracts": "1.0.0-alpha.10",
|
|
25
|
+
"@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.10"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "18.3.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@phosphor-icons/react": "2.1.10",
|
|
31
31
|
"express": "4.22.2",
|
|
32
32
|
"zod": "3.25.76",
|
|
33
|
-
"@tbox.cn/app-agent-ui-kit": "1.0.0-alpha.
|
|
33
|
+
"@tbox.cn/app-agent-ui-kit": "^1.0.0-alpha.10"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"@tbox.cn/app-agent-ui-kit": {
|
|
@@ -10,18 +10,9 @@ import {
|
|
|
10
10
|
} from 'react';
|
|
11
11
|
import { createPortal } from 'react-dom';
|
|
12
12
|
import { X } from '@phosphor-icons/react';
|
|
13
|
+
import { OVERLAY_LAYER_CLASS, useOverlay } from '@tbox.cn/app-agent-ui-kit/overlay';
|
|
13
14
|
import type { TboxCardPayload } from '@tbox.cn/app-contracts';
|
|
14
15
|
import { ActivityDetailPresentation } from './components/ActivityDetailPresentation';
|
|
15
|
-
import './HomeActivityDetailDialog.less';
|
|
16
|
-
|
|
17
|
-
const FOCUSABLE_SELECTOR = [
|
|
18
|
-
'button:not([disabled])',
|
|
19
|
-
'[href]',
|
|
20
|
-
'input:not([disabled])',
|
|
21
|
-
'select:not([disabled])',
|
|
22
|
-
'textarea:not([disabled])',
|
|
23
|
-
'[tabindex]:not([tabindex="-1"])',
|
|
24
|
-
].join(',');
|
|
25
16
|
const MORPH_DURATION_MS = 300;
|
|
26
17
|
|
|
27
18
|
type MorphPhase = 'opening' | 'open' | 'closing';
|
|
@@ -140,70 +131,19 @@ export function HomeActivityDetailDialog({
|
|
|
140
131
|
return () => window.removeEventListener('resize', updateDestination);
|
|
141
132
|
}, []);
|
|
142
133
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
scrollHost.style.overscrollBehavior = 'none';
|
|
157
|
-
}
|
|
158
|
-
if (appRoot) {
|
|
159
|
-
appRoot.setAttribute('aria-hidden', 'true');
|
|
160
|
-
appRoot.inert = true;
|
|
161
|
-
}
|
|
162
|
-
closeRef.current?.focus();
|
|
163
|
-
|
|
164
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
165
|
-
if (event.key === 'Escape') {
|
|
166
|
-
event.preventDefault();
|
|
167
|
-
requestClose();
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
if (event.key !== 'Tab') return;
|
|
171
|
-
const focusable = Array.from(
|
|
172
|
-
panelRef.current?.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR) ?? [],
|
|
173
|
-
);
|
|
174
|
-
if (focusable.length === 0) {
|
|
175
|
-
event.preventDefault();
|
|
176
|
-
panelRef.current?.focus();
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
const first = focusable[0];
|
|
180
|
-
const last = focusable[focusable.length - 1];
|
|
181
|
-
if (event.shiftKey && document.activeElement === first) {
|
|
182
|
-
event.preventDefault();
|
|
183
|
-
last.focus();
|
|
184
|
-
} else if (!event.shiftKey && document.activeElement === last) {
|
|
185
|
-
event.preventDefault();
|
|
186
|
-
first.focus();
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
190
|
-
|
|
191
|
-
return () => {
|
|
192
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
193
|
-
if (closeTimerRef.current !== null) window.clearTimeout(closeTimerRef.current);
|
|
194
|
-
document.body.style.overflow = previousBodyOverflow;
|
|
195
|
-
if (scrollHost) {
|
|
196
|
-
scrollHost.style.overflow = previousScrollOverflow;
|
|
197
|
-
scrollHost.style.overscrollBehavior = previousOverscroll;
|
|
198
|
-
}
|
|
199
|
-
if (appRoot) {
|
|
200
|
-
appRoot.inert = previousInert;
|
|
201
|
-
if (previousAriaHidden === null) appRoot.removeAttribute('aria-hidden');
|
|
202
|
-
else appRoot.setAttribute('aria-hidden', previousAriaHidden);
|
|
203
|
-
}
|
|
204
|
-
(triggerRef.current ?? previousFocus)?.focus({ preventScroll: true });
|
|
205
|
-
};
|
|
206
|
-
}, [requestClose, triggerRef]);
|
|
134
|
+
// 弹层行为(传送遮罩层、滚动锁、应用根惰性、Escape、焦点循环与恢复)由 kit overlay 承担;
|
|
135
|
+
// 这里只留 FLIP 形变自己的状态机。
|
|
136
|
+
useOverlay({
|
|
137
|
+
active: true,
|
|
138
|
+
onDismiss: () => requestClose(),
|
|
139
|
+
panelRef,
|
|
140
|
+
initialFocus: closeRef,
|
|
141
|
+
restoreFocus: triggerRef.current ? { current: triggerRef.current } : 'previous',
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
useEffect(() => () => {
|
|
145
|
+
if (closeTimerRef.current !== null) window.clearTimeout(closeTimerRef.current);
|
|
146
|
+
}, []);
|
|
207
147
|
|
|
208
148
|
const surfaceRect = motion === 'fade'
|
|
209
149
|
? destination
|
|
@@ -221,32 +161,32 @@ export function HomeActivityDetailDialog({
|
|
|
221
161
|
|
|
222
162
|
return createPortal(
|
|
223
163
|
<div
|
|
224
|
-
className=
|
|
164
|
+
className={`home-activity-detail group/detail fixed inset-0 ${OVERLAY_LAYER_CLASS.modal}`}
|
|
225
165
|
data-motion={motion}
|
|
226
166
|
data-phase={phase}
|
|
227
167
|
data-return-origin={returnToOrigin ? 'true' : 'false'}
|
|
228
168
|
>
|
|
229
|
-
<button type="button" className="home-activity-detail__mask" aria-label="关闭活动详情" onClick={requestClose} />
|
|
169
|
+
<button type="button" className="home-activity-detail__mask absolute inset-0 size-full border-0 bg-transparent p-0 transition-colors duration-200 group-data-[phase=open]/detail:bg-scrim" aria-label="关闭活动详情" onClick={requestClose} />
|
|
230
170
|
<section
|
|
231
171
|
ref={panelRef}
|
|
232
172
|
id={getHomeActivityDialogId(card.id)}
|
|
233
|
-
className="home-activity-detail__surface"
|
|
173
|
+
className="home-activity-detail__surface fixed z-10 min-h-0 min-w-0 overflow-hidden rounded-xl bg-card shadow-[0_20px_60px_rgba(22,42,30,0.22)] contain-[layout_paint] transition-all duration-300 will-change-[top,left,width,height,border-radius,transform] group-data-[phase=open]/detail:rounded-2xl group-data-[motion=fade]/detail:group-data-[phase=opening]/detail:scale-[0.985] group-data-[motion=fade]/detail:group-data-[phase=opening]/detail:opacity-0 group-data-[motion=fade]/detail:group-data-[phase=open]/detail:scale-100 group-data-[motion=fade]/detail:group-data-[phase=open]/detail:opacity-100 group-data-[phase=closing]/detail:group-data-[return-origin=false]/detail:scale-[0.98] group-data-[phase=closing]/detail:group-data-[return-origin=false]/detail:opacity-0 max-[600px]:h-screen! max-[600px]:supports-[height:100dvh]:h-dvh! max-[600px]:w-screen! max-[600px]:rounded-none! motion-reduce:transition-none"
|
|
234
174
|
style={surfaceStyle}
|
|
235
175
|
role="dialog"
|
|
236
176
|
aria-modal="true"
|
|
237
177
|
aria-labelledby={titleId}
|
|
238
178
|
tabIndex={-1}
|
|
239
179
|
>
|
|
240
|
-
<h2 id={titleId} className="home-activity-detail__sr-title">{title}</h2>
|
|
180
|
+
<h2 id={titleId} className="home-activity-detail__sr-title sr-only">{title}</h2>
|
|
241
181
|
{transitionVisual && (
|
|
242
|
-
<div className="home-activity-detail__transition-visual" aria-hidden="true">{transitionVisual}</div>
|
|
182
|
+
<div className="home-activity-detail__transition-visual absolute inset-0 z-20 overflow-hidden bg-warn-surface transition-opacity duration-150 group-data-[phase=open]/detail:pointer-events-none group-data-[phase=open]/detail:opacity-0 group-data-[phase=open]/detail:delay-150 [&_.mall-home__linked-order]:m-0 [&_.mall-home__linked-order]:aspect-[353/240] [&_.mall-home__linked-order]:h-auto [&_.mall-home__linked-order]:w-full [&_.mall-home__linked-order]:rounded-none [&_.mall-home__linked-order]:shadow-none" aria-hidden="true">{transitionVisual}</div>
|
|
243
183
|
)}
|
|
244
|
-
<div className="home-activity-detail__content">
|
|
184
|
+
<div className="home-activity-detail__content absolute inset-0 z-10 min-h-0 translate-y-3 overflow-y-auto overscroll-contain bg-card pb-[env(safe-area-inset-bottom)] opacity-0 transition-[opacity,transform] duration-150 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden group-data-[phase=open]/detail:translate-y-0 group-data-[phase=open]/detail:opacity-100 group-data-[phase=open]/detail:delay-150 group-data-[motion=fade]/detail:group-data-[phase=open]/detail:delay-0 motion-reduce:transition-none">
|
|
245
185
|
<ActivityDetailPresentation variant="page">
|
|
246
186
|
{children}
|
|
247
187
|
</ActivityDetailPresentation>
|
|
248
188
|
</div>
|
|
249
|
-
<button ref={closeRef} type="button" className="home-activity-detail__close" aria-label="关闭活动详情,返回首页" onClick={requestClose}>
|
|
189
|
+
<button ref={closeRef} type="button" className="home-activity-detail__close absolute right-3.5 top-[max(14px,env(safe-area-inset-top))] z-30 grid size-10.5 place-items-center rounded-full border border-border bg-card p-0 text-foreground opacity-0 shadow-lg transition-opacity duration-150 group-data-[phase=open]/detail:opacity-100 group-data-[phase=open]/detail:delay-150 focus-visible:outline-3 focus-visible:outline-offset-2 focus-visible:outline-focus-ring motion-reduce:transition-none" aria-label="关闭活动详情,返回首页" onClick={requestClose}>
|
|
250
190
|
<X size={21} weight="bold" aria-hidden="true" />
|
|
251
191
|
</button>
|
|
252
192
|
</section>
|
package/src/client/MallHome.tsx
CHANGED
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
HomeActivityDetailDialog,
|
|
36
36
|
type SurfaceRect,
|
|
37
37
|
} from './HomeActivityDetailDialog';
|
|
38
|
-
import './MallHome.less';
|
|
39
38
|
interface MallHomeProps {
|
|
40
39
|
readonly mallName?: string;
|
|
41
40
|
readonly linkedOrder: LinkedOrderLoadState;
|
|
@@ -95,9 +94,12 @@ function HomeServiceCard({
|
|
|
95
94
|
const valueId = `mall-home-${tone}-value`;
|
|
96
95
|
const metaId = `mall-home-${tone}-meta`;
|
|
97
96
|
return (
|
|
98
|
-
<section
|
|
97
|
+
<section
|
|
98
|
+
className={`mall-home__service-card mall-home__service-card--${tone} relative min-w-0 overflow-hidden rounded-[16px] border-[0.5px] border-border bg-card shadow-[0_2px_16px_rgba(106,119,137,0.08)]`}
|
|
99
|
+
aria-label={label}
|
|
100
|
+
>
|
|
99
101
|
<button
|
|
100
|
-
className="mall-home__service-card-main"
|
|
102
|
+
className="mall-home__service-card-main relative flex h-full min-h-[95px] w-full cursor-pointer flex-col gap-1.5 border-0 bg-transparent p-3 text-left text-inherit [font-family:inherit] disabled:cursor-default disabled:opacity-[0.72] max-[360px]:px-2.5"
|
|
101
103
|
type="button"
|
|
102
104
|
disabled={disabled}
|
|
103
105
|
onClick={onClick}
|
|
@@ -105,26 +107,37 @@ function HomeServiceCard({
|
|
|
105
107
|
aria-labelledby={`${labelId} ${valueId}`}
|
|
106
108
|
aria-describedby={metaId}
|
|
107
109
|
>
|
|
108
|
-
<img
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
<img
|
|
111
|
+
className="mall-home__service-card-icon absolute top-3 right-3 z-[1] block h-8 w-[33.18px] object-contain max-[360px]:right-2.5"
|
|
112
|
+
src={iconSrc}
|
|
113
|
+
alt=""
|
|
114
|
+
aria-hidden="true"
|
|
115
|
+
/>
|
|
116
|
+
<span id={labelId} className="mall-home__service-card-eyebrow truncate pr-9 text-sm leading-5 text-foreground">{label}</span>
|
|
117
|
+
<span id={valueId} className="mall-home__service-card-value flex min-h-[22px] min-w-0 items-center" aria-live="polite">
|
|
111
118
|
{loading
|
|
112
119
|
? (
|
|
113
120
|
<>
|
|
114
121
|
<span
|
|
115
|
-
className="mall-home__service-card-skeleton mall-home__service-card-skeleton--value"
|
|
122
|
+
className="mall-home__service-card-skeleton mall-home__service-card-skeleton--value block h-[18px] w-[72%] shrink-0 rounded-[5px] bg-[linear-gradient(90deg,rgba(20,50,91,0.08),rgba(20,50,91,0.15),rgba(20,50,91,0.08))]"
|
|
116
123
|
aria-hidden="true"
|
|
117
124
|
/>
|
|
118
|
-
<span className="
|
|
125
|
+
<span className="sr-only">{loadingLabel}</span>
|
|
119
126
|
</>
|
|
120
127
|
)
|
|
121
|
-
:
|
|
128
|
+
: (
|
|
129
|
+
<strong
|
|
130
|
+
className={`line-clamp-2 text-base font-semibold leading-[22px] text-foreground ${primaryMonospace ? ' mall-home__plate font-mono tracking-[0.02em] tabular-nums' : ''}`}
|
|
131
|
+
>
|
|
132
|
+
{primary}
|
|
133
|
+
</strong>
|
|
134
|
+
)}
|
|
122
135
|
</span>
|
|
123
|
-
<span id={metaId} className="mall-home__service-card-meta">
|
|
136
|
+
<span id={metaId} className="mall-home__service-card-meta line-clamp-2 min-h-[17px] text-left text-xs leading-[17px] text-secondary-foreground">
|
|
124
137
|
{loading
|
|
125
138
|
? (
|
|
126
139
|
<span
|
|
127
|
-
className="mall-home__service-card-skeleton mall-home__service-card-skeleton--meta"
|
|
140
|
+
className="mall-home__service-card-skeleton mall-home__service-card-skeleton--meta block h-[13px] w-[88%] shrink-0 rounded-[5px] bg-[linear-gradient(90deg,rgba(20,50,91,0.08),rgba(20,50,91,0.15),rgba(20,50,91,0.08))]"
|
|
128
141
|
aria-hidden="true"
|
|
129
142
|
/>
|
|
130
143
|
)
|
|
@@ -234,6 +247,20 @@ interface BusinessArea {
|
|
|
234
247
|
readonly actions: readonly HomeAction[];
|
|
235
248
|
}
|
|
236
249
|
|
|
250
|
+
/**
|
|
251
|
+
* 区块色调:Tailwind 类名必须完整字面量才能被扫描,故按 tone 登记,不在运行时拼接。
|
|
252
|
+
* 图标底色/前景 + 动作卡键盘焦点描边;guide 是缺省主蓝(等价旧 `--area-color` 默认值)。
|
|
253
|
+
*/
|
|
254
|
+
const AREA_TONE_CLASS: Record<BusinessArea['tone'], { readonly icon: string; readonly focus: string }> = Object.freeze({
|
|
255
|
+
guide: Object.freeze({ icon: 'bg-[#edf6ff] text-[#1679df]', focus: 'focus-visible:outline-[#1679df]' }),
|
|
256
|
+
member: Object.freeze({ icon: 'bg-[#fff7e7] text-[#bd7200]', focus: 'focus-visible:outline-[#bd7200]' }),
|
|
257
|
+
marketing: Object.freeze({ icon: 'bg-[#fff1ef] text-[#db4e45]', focus: 'focus-visible:outline-[#db4e45]' }),
|
|
258
|
+
parking: Object.freeze({ icon: 'bg-[#edf3fb] text-[#173e78]', focus: 'focus-visible:outline-[#173e78]' }),
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
/** 联单进度条内的提示行(含重试/授权按钮)共用一份样式,只换文案 */
|
|
262
|
+
const PROGRESS_MESSAGE_CLASS = 'mall-home__progress-message flex h-full w-full items-center justify-center gap-2 rounded-[16px] bg-[rgba(244,252,255,0.94)] px-2.5 text-center text-xs font-bold leading-[1.2] text-[#0a6eb8]';
|
|
263
|
+
|
|
237
264
|
/**
|
|
238
265
|
* 首页开发测试入口:保留旧首页已经验证过的自然语言 query,统一走现有对话分发链。
|
|
239
266
|
* 这些入口不声明服务端能力已成功,只负责让同事快速触发对应能力做联调。
|
|
@@ -309,27 +336,39 @@ function LinkedOrderStatus({
|
|
|
309
336
|
onReauthorizeLinkedOrder,
|
|
310
337
|
}: Pick<MallHomeProps, 'linkedOrder' | 'onReloadLinkedOrder' | 'onReauthorizeLinkedOrder'>) {
|
|
311
338
|
if (linkedOrder.status === 'loading') {
|
|
312
|
-
return <div className=
|
|
339
|
+
return <div className={PROGRESS_MESSAGE_CLASS} role="status">正在同步联单进度…</div>;
|
|
313
340
|
}
|
|
314
341
|
|
|
315
342
|
if (linkedOrder.status === 'unauthenticated') {
|
|
316
343
|
return (
|
|
317
|
-
<div className=
|
|
344
|
+
<div className={PROGRESS_MESSAGE_CLASS}>
|
|
318
345
|
<span>登录支付宝后查看联单进度</span>
|
|
319
|
-
<button
|
|
346
|
+
<button
|
|
347
|
+
className="shrink-0 cursor-pointer rounded-[10px] border-0 bg-[#137dc4] px-2 py-[3px] text-xs leading-[1.2] text-white [font-family:inherit]"
|
|
348
|
+
type="button"
|
|
349
|
+
onClick={() => onReauthorizeLinkedOrder?.()}
|
|
350
|
+
>
|
|
351
|
+
重新授权
|
|
352
|
+
</button>
|
|
320
353
|
</div>
|
|
321
354
|
);
|
|
322
355
|
}
|
|
323
356
|
|
|
324
357
|
if (linkedOrder.status === 'forbidden') {
|
|
325
|
-
return <div className=
|
|
358
|
+
return <div className={PROGRESS_MESSAGE_CLASS}>当前账号暂时无法查看联单进度</div>;
|
|
326
359
|
}
|
|
327
360
|
|
|
328
361
|
if (linkedOrder.status === 'error') {
|
|
329
362
|
return (
|
|
330
|
-
<div className=
|
|
363
|
+
<div className={PROGRESS_MESSAGE_CLASS} role="alert">
|
|
331
364
|
<span>联单进度暂时无法同步</span>
|
|
332
|
-
<button
|
|
365
|
+
<button
|
|
366
|
+
className="shrink-0 cursor-pointer rounded-[10px] border-0 bg-[#137dc4] px-2 py-[3px] text-xs leading-[1.2] text-white [font-family:inherit]"
|
|
367
|
+
type="button"
|
|
368
|
+
onClick={() => onReloadLinkedOrder?.()}
|
|
369
|
+
>
|
|
370
|
+
重新加载
|
|
371
|
+
</button>
|
|
333
372
|
</div>
|
|
334
373
|
);
|
|
335
374
|
}
|
|
@@ -338,7 +377,7 @@ function LinkedOrderStatus({
|
|
|
338
377
|
? deriveLinkedOrderProgress(linkedOrder.banner)
|
|
339
378
|
: null;
|
|
340
379
|
if (!progress) {
|
|
341
|
-
return <div className=
|
|
380
|
+
return <div className={PROGRESS_MESSAGE_CLASS}>当前暂无可查看的联单活动</div>;
|
|
342
381
|
}
|
|
343
382
|
|
|
344
383
|
const nodes = progress.target <= 10
|
|
@@ -348,21 +387,31 @@ function LinkedOrderStatus({
|
|
|
348
387
|
|
|
349
388
|
return (
|
|
350
389
|
<div
|
|
351
|
-
className="mall-home__progress-content"
|
|
390
|
+
className="mall-home__progress-content flex h-full w-full items-center justify-between"
|
|
352
391
|
aria-label={`联单支付进度 ${progress.completed} / ${progress.target} ${progress.unit}`}
|
|
353
392
|
>
|
|
354
|
-
<strong className="mall-home__progress-label">联单进度</strong>
|
|
355
|
-
<div
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
393
|
+
<strong className="mall-home__progress-label shrink-0 text-xs font-extrabold leading-none whitespace-nowrap text-[#0a6eb8] [text-shadow:0_1px_0_rgba(255,255,255,0.72)]">联单进度</strong>
|
|
394
|
+
<div
|
|
395
|
+
className={`mall-home__nodes relative mx-2.5 flex min-w-0 flex-1 justify-between ${nodes.length === 0 ? ' mall-home__nodes--summary h-[22px] justify-center' : ''}`}
|
|
396
|
+
aria-hidden="true"
|
|
397
|
+
>
|
|
398
|
+
<span className="mall-home__rail absolute top-1/2 right-2 left-2 h-[3px] -translate-y-1/2 rounded-[2px] bg-[rgba(22,126,194,0.3)]" />
|
|
399
|
+
<span
|
|
400
|
+
className="mall-home__rail-fill absolute top-1/2 left-2 z-[1] h-[3px] max-w-[calc(100%_-_16px)] -translate-y-1/2 rounded-[2px] bg-[#087dd0] shadow-[0_0_6px_rgba(0,104,190,0.34)]"
|
|
401
|
+
style={{ width: railFill }}
|
|
402
|
+
/>
|
|
403
|
+
{nodes.length === 0 && (
|
|
404
|
+
<span className="mall-home__nodes-summary relative z-[2] rounded-[9px] bg-[rgba(234,248,255,0.94)] px-[7px] py-0.5 text-xs font-bold leading-[1.2] text-[#0a6eb8]">
|
|
405
|
+
已完成 {progress.completed} {progress.unit}
|
|
406
|
+
</span>
|
|
407
|
+
)}
|
|
359
408
|
{nodes.map((node) => {
|
|
360
409
|
const completed = node <= progress.completed;
|
|
361
410
|
const milestone = node === progress.target;
|
|
362
411
|
return (
|
|
363
412
|
<span
|
|
364
413
|
key={node}
|
|
365
|
-
className={`mall-home__node${completed ? ' mall-home__node--completed' :
|
|
414
|
+
className={`mall-home__node relative z-[2] flex size-[22px] shrink-0 items-center justify-center rounded-full border-[1.5px] border-[#1682cb] bg-[#eaf8ff] text-xs font-extrabold leading-none text-[#0d6fae] shadow-[0_2px_5px_rgba(0,83,151,0.22)] ${completed ? ' mall-home__node--completed border-white bg-[#91dcf2] text-[#0068e8]' : milestone ? ' mall-home__node--milestone border-[#ffdc6a] bg-[#1475b6] text-white' : ''}`}
|
|
366
415
|
>
|
|
367
416
|
{completed
|
|
368
417
|
? <Check size={15} weight="bold" />
|
|
@@ -373,7 +422,7 @@ function LinkedOrderStatus({
|
|
|
373
422
|
);
|
|
374
423
|
})}
|
|
375
424
|
</div>
|
|
376
|
-
<strong className="mall-home__progress-value">{progress.completed}/{progress.target}</strong>
|
|
425
|
+
<strong className="mall-home__progress-value shrink-0 text-xs font-extrabold leading-none whitespace-nowrap text-[#0a6eb8] [text-shadow:0_1px_0_rgba(255,255,255,0.72)]">{progress.completed}/{progress.target}</strong>
|
|
377
426
|
</div>
|
|
378
427
|
);
|
|
379
428
|
}
|
|
@@ -510,10 +559,10 @@ export function MallHome({
|
|
|
510
559
|
{/* 素材变量链(主题轨 T-2.3):poster 转 CSS background(stage 默认 + 移动断点 compact 覆写);
|
|
511
560
|
可点开活动详情时(canOpenActivity)为纯装饰,否则以 role=img 保留原 alt 语义 */}
|
|
512
561
|
<span
|
|
513
|
-
className="mall-home__linked-order-poster"
|
|
562
|
+
className="mall-home__linked-order-poster absolute top-0 left-1/2 block h-full w-full -translate-x-1/2 bg-cover bg-center bg-[image:var(--tbox-asset-home-poster-stage,linear-gradient(135deg,#eaf3ff,#d7e7fd))] max-[392px]:bg-[image:var(--tbox-asset-home-poster-compact,linear-gradient(135deg,#eaf3ff,#d7e7fd))]"
|
|
514
563
|
{...(canOpenActivity ? { 'aria-hidden': true } : { role: 'img', 'aria-label': '参与联单,碰出惊喜' })}
|
|
515
564
|
/>
|
|
516
|
-
<div className="mall-home__progress">
|
|
565
|
+
<div className="mall-home__progress absolute bottom-[18px] left-1/2 z-[2] h-8 w-[300px] -translate-x-1/2 max-[392px]:bottom-[7%] max-[392px]:h-[13.33%] max-[392px]:w-[85%]">
|
|
517
566
|
<LinkedOrderStatus
|
|
518
567
|
linkedOrder={linkedOrder}
|
|
519
568
|
onReloadLinkedOrder={onReloadLinkedOrder}
|
|
@@ -538,7 +587,7 @@ export function MallHome({
|
|
|
538
587
|
card: activityCard,
|
|
539
588
|
renderDetail: renderActivityDetail,
|
|
540
589
|
transitionVisual: (
|
|
541
|
-
<section className="mall-home__linked-order" aria-hidden="true">
|
|
590
|
+
<section className="mall-home__linked-order relative mx-page h-60 overflow-hidden rounded-[14px] bg-[#fff8e9] leading-[0] shadow-[0_10px_24px_rgba(47,88,121,0.1)] max-[392px]:aspect-[353/240] max-[392px]:h-auto" aria-hidden="true">
|
|
542
591
|
{linkedOrderVisual}
|
|
543
592
|
</section>
|
|
544
593
|
),
|
|
@@ -547,25 +596,28 @@ export function MallHome({
|
|
|
547
596
|
}, [activityCard, activityDetail, linkedOrderVisual, renderActivityDetail]);
|
|
548
597
|
|
|
549
598
|
return (
|
|
550
|
-
<main className="mall-home" aria-label="商场智能服务首页">
|
|
551
|
-
<header className="mall-home__welcome">
|
|
599
|
+
<main className="mall-home @container/mall-home w-full pt-2 pb-8.5 text-foreground" aria-label="商场智能服务首页">
|
|
600
|
+
<header className="mall-home__welcome px-page pb-5.5 pt-1">
|
|
552
601
|
<img
|
|
553
|
-
className="mall-home__welcome-sparkle"
|
|
602
|
+
className="mall-home__welcome-sparkle block h-[25.5px] w-9 object-contain"
|
|
554
603
|
src={welcomeSparkle}
|
|
555
604
|
alt=""
|
|
556
605
|
aria-hidden="true"
|
|
557
606
|
/>
|
|
558
|
-
<h1>欢迎来到{displayMallName}</h1>
|
|
559
|
-
<p>我可以帮你看联单进度、查停车、看会员与活动服务</p>
|
|
607
|
+
<h1 className="mt-1 text-xl font-bold leading-7 tracking-tight text-foreground">欢迎来到{displayMallName}</h1>
|
|
608
|
+
<p className="mt-1 text-xs leading-4.75 text-secondary-foreground">我可以帮你看联单进度、查停车、看会员与活动服务</p>
|
|
560
609
|
</header>
|
|
561
610
|
|
|
562
|
-
<section
|
|
611
|
+
<section
|
|
612
|
+
className="mall-home__linked-order relative mx-page h-60 overflow-hidden rounded-[14px] bg-[#fff8e9] leading-[0] shadow-[0_10px_24px_rgba(47,88,121,0.1)] max-[392px]:aspect-[353/240] max-[392px]:h-auto"
|
|
613
|
+
aria-label="碰一下联单活动"
|
|
614
|
+
>
|
|
563
615
|
{linkedOrderVisual}
|
|
564
616
|
{canOpenActivity && activityCard && (
|
|
565
617
|
<button
|
|
566
618
|
ref={activityTriggerRef}
|
|
567
619
|
type="button"
|
|
568
|
-
className="mall-home__linked-order-trigger"
|
|
620
|
+
className="mall-home__linked-order-trigger absolute inset-0 z-[3] h-full w-full cursor-pointer rounded-[inherit] border-0 bg-transparent p-0 outline-none focus-visible:shadow-[inset_0_0_0_3px_rgba(82,126,56,0.5)]"
|
|
569
621
|
aria-label={`查看${linkedOrder.status === 'ready' ? linkedOrder.banner.title || '联单活动' : '联单活动'}详情`}
|
|
570
622
|
aria-haspopup="dialog"
|
|
571
623
|
aria-expanded={Boolean(activityDetail)}
|
|
@@ -587,7 +639,7 @@ export function MallHome({
|
|
|
587
639
|
</HomeActivityDetailDialog>
|
|
588
640
|
)}
|
|
589
641
|
|
|
590
|
-
<div className="mall-home__service-pair">
|
|
642
|
+
<div className="mall-home__service-pair mx-page mt-4 grid grid-cols-2 items-stretch gap-3">
|
|
591
643
|
<MemberServiceCard
|
|
592
644
|
member={member}
|
|
593
645
|
onMemberPointsQuery={onMemberPointsQuery}
|
|
@@ -608,37 +660,40 @@ export function MallHome({
|
|
|
608
660
|
|
|
609
661
|
{/* 开发测试入口:后端开关(MALL_HOME_DEV_SERVICES → /api/m/mall-home/config)控制,fail-closed 缺省隐藏 */}
|
|
610
662
|
{showDevServices && (
|
|
611
|
-
<section className="mall-home__services" aria-labelledby="mall-home-services-title">
|
|
612
|
-
<header className="mall-home__section-header">
|
|
663
|
+
<section className="mall-home__services mx-page mt-5.5" aria-labelledby="mall-home-services-title">
|
|
664
|
+
<header className="mall-home__section-header mb-3 flex items-end justify-between gap-2">
|
|
613
665
|
<div>
|
|
614
|
-
<h2 id="mall-home-services-title">常用服务</h2>
|
|
615
|
-
<span className="mall-home__section-kicker">以下部分为开发测试入口,不对正式用户透出</span>
|
|
666
|
+
<h2 id="mall-home-services-title" className="text-lg font-bold leading-6 text-foreground">常用服务</h2>
|
|
667
|
+
<span className="mall-home__section-kicker mt-0.5 block text-xs leading-4 text-secondary-foreground">以下部分为开发测试入口,不对正式用户透出</span>
|
|
616
668
|
</div>
|
|
617
669
|
</header>
|
|
618
670
|
|
|
619
|
-
<div className="mall-home__areas">
|
|
671
|
+
<div className="mall-home__areas grid grid-cols-1 gap-3 @min-[820px]/mall-home:grid-cols-2">
|
|
620
672
|
{BUSINESS_AREAS.map((area) => {
|
|
621
673
|
const AreaIcon = area.icon;
|
|
622
674
|
return (
|
|
623
675
|
<section
|
|
624
|
-
className={`mall-home__area mall-home__area--${area.tone}`}
|
|
676
|
+
className={`mall-home__area mall-home__area--${area.tone} min-w-0 rounded-[16px] border-[0.5px] border-border bg-card p-3 shadow-[0_2px_16px_rgba(106,119,137,0.08)]`}
|
|
625
677
|
aria-labelledby={`mall-home-${area.moduleId}`}
|
|
626
678
|
key={area.moduleId}
|
|
627
679
|
>
|
|
628
|
-
<header className="mall-home__area-header">
|
|
629
|
-
<span className="mall-home__area-copy">
|
|
630
|
-
<h3 id={`mall-home-${area.moduleId}`}>{area.title}</h3>
|
|
631
|
-
<p>{area.description}</p>
|
|
680
|
+
<header className="mall-home__area-header mb-3 flex items-center justify-between gap-2">
|
|
681
|
+
<span className="mall-home__area-copy min-w-0">
|
|
682
|
+
<h3 id={`mall-home-${area.moduleId}`} className="text-sm font-semibold leading-5 text-foreground">{area.title}</h3>
|
|
683
|
+
<p className="text-xs leading-[17px] text-secondary-foreground">{area.description}</p>
|
|
632
684
|
</span>
|
|
633
|
-
<span
|
|
685
|
+
<span
|
|
686
|
+
className={`mall-home__area-icon flex size-8 shrink-0 items-center justify-center rounded-[10px] ${AREA_TONE_CLASS[area.tone].icon}`}
|
|
687
|
+
aria-hidden="true"
|
|
688
|
+
>
|
|
634
689
|
<AreaIcon size={22} weight="regular" />
|
|
635
690
|
</span>
|
|
636
691
|
</header>
|
|
637
|
-
<div className="mall-home__action-grid">
|
|
692
|
+
<div className="mall-home__action-grid grid grid-cols-[repeat(auto-fit,minmax(min(150px,100%),1fr))] gap-2">
|
|
638
693
|
{area.actions.map((action) => {
|
|
639
694
|
return (
|
|
640
695
|
<button
|
|
641
|
-
className=
|
|
696
|
+
className={`mall-home__action grid min-h-[72px] w-full min-w-0 cursor-pointer grid-cols-[minmax(0,1fr)_12px] items-center gap-2 rounded-[14px] border-[0.5px] border-border bg-card p-2.5 text-left text-foreground shadow-[0_2px_12px_rgba(106,119,137,0.05)] [font-family:inherit] active:scale-[0.99] active:bg-[rgba(11,15,23,0.02)] focus-visible:outline-2 focus-visible:outline-offset-2 ${AREA_TONE_CLASS[area.tone].focus}`}
|
|
642
697
|
type="button"
|
|
643
698
|
key={action.label}
|
|
644
699
|
onClick={() => {
|
|
@@ -647,11 +702,11 @@ export function MallHome({
|
|
|
647
702
|
onSend(action.query);
|
|
648
703
|
}}
|
|
649
704
|
>
|
|
650
|
-
<span className="mall-home__action-copy">
|
|
651
|
-
<strong>{action.label}</strong>
|
|
652
|
-
<small>{action.description}</small>
|
|
705
|
+
<span className="mall-home__action-copy min-w-0">
|
|
706
|
+
<strong className="block text-sm font-semibold leading-[18px] [overflow-wrap:anywhere]">{action.label}</strong>
|
|
707
|
+
<small className="mt-[3px] block text-xs leading-4 text-secondary-foreground [overflow-wrap:anywhere]">{action.description}</small>
|
|
653
708
|
</span>
|
|
654
|
-
<CaretRight size={14} weight="bold" aria-hidden="true" />
|
|
709
|
+
<CaretRight className="shrink-0 text-secondary-foreground" size={14} weight="bold" aria-hidden="true" />
|
|
655
710
|
</button>
|
|
656
711
|
);
|
|
657
712
|
})}
|
|
@@ -54,7 +54,7 @@ export const BumpInActivityChatCard: CardComponent = (props) => {
|
|
|
54
54
|
<button
|
|
55
55
|
ref={triggerRef}
|
|
56
56
|
type="button"
|
|
57
|
-
className="activity-detail-presentation__detail-trigger"
|
|
57
|
+
className="activity-detail-presentation__detail-trigger mt-2 mb-0 flex min-h-8 w-full cursor-pointer items-center justify-center gap-0.5 rounded-none border-0 bg-transparent p-0 text-xs font-normal leading-[18px] text-[#686d69] shadow-none [font-family:inherit] [&_svg]:shrink-0 active:opacity-[0.68] focus-visible:rounded-[5px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[rgba(9,107,250,0.28)]"
|
|
58
58
|
aria-haspopup="dialog"
|
|
59
59
|
aria-expanded={detailOrigin !== null}
|
|
60
60
|
aria-controls={getHomeActivityDialogId(cardId)}
|