@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
|
@@ -1,15 +1,99 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import './index.less';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* 联单主视觉(素材变量链,主题轨 T-2.3):img/picture → CSS background。
|
|
6
5
|
* page 变体在移动断点(≤392px)切 compact 裁切;strip 恒定 stage(原实现语义保持)。
|
|
6
|
+
* 元素只消费不声明 `--tbox-asset-*`(声明会截断 html[data-theme] 覆写继承)。
|
|
7
7
|
*/
|
|
8
|
+
const POSTER_BASE = 'activity-detail-presentation__poster block h-full w-full bg-cover bg-center';
|
|
9
|
+
const POSTER_STAGE = 'bg-[image:var(--tbox-asset-home-poster-stage,linear-gradient(135deg,#eaf3ff,#d7e7fd))]';
|
|
10
|
+
const POSTER_COMPACT = 'max-[392px]:bg-[image:var(--tbox-asset-home-poster-compact,linear-gradient(135deg,#eaf3ff,#d7e7fd))]';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 嵌入皮肤(跨模块,写成后代工具类而不是样式文件):
|
|
14
|
+
* barrier 有两层,故这些规则只能是「描述别人的后代」(选择器权重 0,2,0 高于卡片自身工具类的 0,1,0):
|
|
15
|
+
* ① SDK 的 `.tbox-card` 卡框在 kit 的 `@layer base` 里——详情页自身已是完整表面,必须抹平;
|
|
16
|
+
* ② 卡主体是 module-alipay-activity 的 `.promotion-bumpin__*` 标记:聊天流用它自己的深蓝头图,
|
|
17
|
+
* 详情页要的是白底平铺(主视觉已由上方 hero 承载,不能重复)。
|
|
18
|
+
* 数组里每一项都是完整类名字面量(`join` 只补分隔空格,不拼类名),构建期可被扫描。
|
|
19
|
+
*/
|
|
20
|
+
const EMBED_SKIN = [
|
|
21
|
+
// ① 卡框抹平:外边距/裁切/描边/圆角/阴影/入场动画全部让位
|
|
22
|
+
'[&_.tbox-card]:m-0 [&_.tbox-card]:animate-none [&_.tbox-card]:overflow-visible',
|
|
23
|
+
'[&_.tbox-card]:rounded-none [&_.tbox-card]:border-0 [&_.tbox-card]:bg-transparent [&_.tbox-card]:shadow-none',
|
|
24
|
+
// ② 头部:白底平铺,隐藏封面与遮罩伪元素,压掉深蓝渐变与最小高度
|
|
25
|
+
'[&_.promotion-bumpin]:m-0 [&_.promotion-bumpin]:overflow-visible [&_.promotion-bumpin]:rounded-none',
|
|
26
|
+
'[&_.promotion-bumpin]:border-0 [&_.promotion-bumpin]:bg-card [&_.promotion-bumpin]:shadow-none',
|
|
27
|
+
'[&_.promotion-bumpin__header]:block [&_.promotion-bumpin__header]:min-h-0',
|
|
28
|
+
'[&_.promotion-bumpin__header]:bg-card! [&_.promotion-bumpin__header]:bg-none!',
|
|
29
|
+
'[&_.promotion-bumpin__header]:px-[11px] [&_.promotion-bumpin__header]:pt-[10px] [&_.promotion-bumpin__header]:pb-[7px]',
|
|
30
|
+
'[&_.promotion-bumpin__header]:before:hidden',
|
|
31
|
+
'[&_.promotion-bumpin__cover]:hidden [&_.promotion-bumpin__cover-placeholder]:hidden',
|
|
32
|
+
'[&_.promotion-bumpin__header-copy]:relative [&_.promotion-bumpin__header-copy]:z-[1]',
|
|
33
|
+
'[&_.promotion-bumpin__header-copy]:grid [&_.promotion-bumpin__header-copy]:max-w-full [&_.promotion-bumpin__header-copy]:gap-[3.5px]',
|
|
34
|
+
// 标签 / 标题 / 时段:改浅底深字,与详情页正文同一套字号档位
|
|
35
|
+
'[&_.promotion-bumpin__tag]:justify-self-start [&_.promotion-bumpin__tag]:rounded-full',
|
|
36
|
+
'[&_.promotion-bumpin__tag]:border-0 [&_.promotion-bumpin__tag]:bg-[#edf8f1]',
|
|
37
|
+
'[&_.promotion-bumpin__tag]:px-[10px] [&_.promotion-bumpin__tag]:py-[3px]',
|
|
38
|
+
'[&_.promotion-bumpin__tag]:text-sm [&_.promotion-bumpin__tag]:leading-[19px] [&_.promotion-bumpin__tag]:text-[#19744a]',
|
|
39
|
+
'[&_.promotion-bumpin__title]:m-0 [&_.promotion-bumpin__title]:text-xl [&_.promotion-bumpin__title]:leading-[28px]',
|
|
40
|
+
'[&_.promotion-bumpin__title]:font-[750] [&_.promotion-bumpin__title]:text-[#263022]',
|
|
41
|
+
'[&_.promotion-bumpin__period]:justify-self-start [&_.promotion-bumpin__period]:bg-transparent [&_.promotion-bumpin__period]:px-0 [&_.promotion-bumpin__period]:py-0',
|
|
42
|
+
'[&_.promotion-bumpin__period]:text-sm [&_.promotion-bumpin__period]:leading-[21px] [&_.promotion-bumpin__period]:text-[#6f7969]',
|
|
43
|
+
'[&_.promotion-bumpin__subtitle]:justify-self-start [&_.promotion-bumpin__subtitle]:bg-transparent [&_.promotion-bumpin__subtitle]:px-0 [&_.promotion-bumpin__subtitle]:py-0',
|
|
44
|
+
'[&_.promotion-bumpin__subtitle]:text-sm [&_.promotion-bumpin__subtitle]:leading-[21px] [&_.promotion-bumpin__subtitle]:text-[#6f7969]',
|
|
45
|
+
// 进度:浅蓝底内嵌块 + 蓝系节点,与首页联单进度同一套色
|
|
46
|
+
'[&_.promotion-bumpin__progress]:mx-4 [&_.promotion-bumpin__progress]:gap-1 [&_.promotion-bumpin__progress]:overflow-hidden',
|
|
47
|
+
'[&_.promotion-bumpin__progress]:rounded-[14px] [&_.promotion-bumpin__progress]:border [&_.promotion-bumpin__progress]:border-[rgba(10,110,184,0.12)]',
|
|
48
|
+
'[&_.promotion-bumpin__progress]:bg-[#f2f8fc] [&_.promotion-bumpin__progress]:px-3.5 [&_.promotion-bumpin__progress]:pt-1.5 [&_.promotion-bumpin__progress]:pb-[5px]',
|
|
49
|
+
'[&_.promotion-bumpin__steps]:px-1.5 [&_.promotion-bumpin__step-item]:gap-0.5',
|
|
50
|
+
'[&_.promotion-bumpin__step-node]:size-[22px] [&_.promotion-bumpin__step-node]:text-xs',
|
|
51
|
+
'[&_.promotion-bumpin__step-node]:border-[#1682cb] [&_.promotion-bumpin__step-node]:bg-[#eaf8ff] [&_.promotion-bumpin__step-node]:text-[#0d6fae]',
|
|
52
|
+
'[&_.promotion-bumpin__step-node_svg]:size-3',
|
|
53
|
+
'[&_.promotion-bumpin__step-node--done]:border-[#0a6eb8] [&_.promotion-bumpin__step-node--done]:bg-[#0a6eb8] [&_.promotion-bumpin__step-node--done]:text-white',
|
|
54
|
+
'[&_.promotion-bumpin__step-node--done]:shadow-[0_3px_9px_rgba(10,110,184,0.22)]',
|
|
55
|
+
'[&_.promotion-bumpin__step-node--locked]:border-[#ffdc6a] [&_.promotion-bumpin__step-node--locked]:bg-[#1475b6] [&_.promotion-bumpin__step-node--locked]:text-white',
|
|
56
|
+
'[&_.promotion-bumpin__step-line]:top-[11px] [&_.promotion-bumpin__step-line]:h-[2px] [&_.promotion-bumpin__step-line]:bg-[rgba(22,126,194,0.22)]',
|
|
57
|
+
'[&_.promotion-bumpin__step-line--done]:bg-[#0a6eb8] [&_.promotion-bumpin__step-line--done]:shadow-none',
|
|
58
|
+
'[&_.promotion-bumpin__progress-fill]:bg-[#0a6eb8] [&_.promotion-bumpin__progress-fill]:shadow-none',
|
|
59
|
+
'[&_.promotion-bumpin__step-label]:text-xs [&_.promotion-bumpin__step-label]:leading-[13px] [&_.promotion-bumpin__step-label]:text-[#6f7969]',
|
|
60
|
+
'[&_.promotion-bumpin__progress-text]:text-xs [&_.promotion-bumpin__progress-text]:leading-[13px] [&_.promotion-bumpin__progress-text]:text-[#6f7969]',
|
|
61
|
+
'[&_.promotion-bumpin__progress-bar]:h-2 [&_.promotion-bumpin__progress-bar]:bg-[rgba(10,110,184,0.14)]',
|
|
62
|
+
// 奖励池 / 活动规则:白卡片 + 细描边,标题与条目按详情页正文排版
|
|
63
|
+
'[&_.promotion-bumpin__prizes]:mx-4 [&_.promotion-bumpin__prizes]:mt-4 [&_.promotion-bumpin__prizes]:overflow-hidden',
|
|
64
|
+
'[&_.promotion-bumpin__prizes]:rounded-[14px] [&_.promotion-bumpin__prizes]:border [&_.promotion-bumpin__prizes]:border-[rgba(106,119,137,0.16)]',
|
|
65
|
+
'[&_.promotion-bumpin__prizes]:bg-card [&_.promotion-bumpin__prizes]:shadow-[0_3px_12px_rgba(70,91,122,0.06)]',
|
|
66
|
+
'[&_.promotion-bumpin__rules]:mx-4 [&_.promotion-bumpin__rules]:mt-4 [&_.promotion-bumpin__rules]:overflow-hidden',
|
|
67
|
+
'[&_.promotion-bumpin__rules]:rounded-[14px] [&_.promotion-bumpin__rules]:border [&_.promotion-bumpin__rules]:border-[rgba(106,119,137,0.16)]',
|
|
68
|
+
'[&_.promotion-bumpin__rules]:bg-card [&_.promotion-bumpin__rules]:shadow-[0_3px_12px_rgba(70,91,122,0.06)]',
|
|
69
|
+
'[&_.promotion-bumpin__prizes-header]:gap-2 [&_.promotion-bumpin__prizes-header]:border-b [&_.promotion-bumpin__prizes-header]:border-[rgba(106,119,137,0.12)]',
|
|
70
|
+
'[&_.promotion-bumpin__prizes-header]:px-3.5 [&_.promotion-bumpin__prizes-header]:pt-3 [&_.promotion-bumpin__prizes-header]:pb-2.5',
|
|
71
|
+
'[&_.promotion-bumpin__prizes-header]:text-base [&_.promotion-bumpin__prizes-header]:font-semibold',
|
|
72
|
+
'[&_.promotion-bumpin__prizes-header]:leading-[22px] [&_.promotion-bumpin__prizes-header]:text-[#263022]',
|
|
73
|
+
'[&_.promotion-bumpin__rules-header]:border-b [&_.promotion-bumpin__rules-header]:border-[rgba(106,119,137,0.12)]',
|
|
74
|
+
'[&_.promotion-bumpin__rules-header]:px-3.5 [&_.promotion-bumpin__rules-header]:pt-3 [&_.promotion-bumpin__rules-header]:pb-2.5',
|
|
75
|
+
'[&_.promotion-bumpin__rules-header]:text-base [&_.promotion-bumpin__rules-header]:font-semibold',
|
|
76
|
+
'[&_.promotion-bumpin__rules-header]:leading-[22px] [&_.promotion-bumpin__rules-header]:text-[#263022]',
|
|
77
|
+
'[&_.promotion-bumpin__prizes-header_svg]:size-[26px] [&_.promotion-bumpin__prizes-header_svg]:rounded-[8px]',
|
|
78
|
+
'[&_.promotion-bumpin__prizes-header_svg]:bg-[#edf6ff] [&_.promotion-bumpin__prizes-header_svg]:p-1.5 [&_.promotion-bumpin__prizes-header_svg]:text-[#0a6eb8]',
|
|
79
|
+
'[&_.promotion-bumpin__prize-item]:gap-3 [&_.promotion-bumpin__prize-item]:border-b [&_.promotion-bumpin__prize-item]:border-[rgba(106,119,137,0.1)]',
|
|
80
|
+
'[&_.promotion-bumpin__prize-item]:bg-card [&_.promotion-bumpin__prize-item]:px-3.5 [&_.promotion-bumpin__prize-item]:py-3',
|
|
81
|
+
'[&_.promotion-bumpin__prize-logo]:size-[42px] [&_.promotion-bumpin__prize-logo]:rounded-[12px]',
|
|
82
|
+
'[&_.promotion-bumpin__prize-logo-placeholder]:size-[42px] [&_.promotion-bumpin__prize-logo-placeholder]:rounded-[12px]',
|
|
83
|
+
'[&_.promotion-bumpin__prize-copy_strong]:text-base [&_.promotion-bumpin__prize-copy_strong]:leading-[22px] [&_.promotion-bumpin__prize-copy_strong]:text-[#263022]',
|
|
84
|
+
'[&_.promotion-bumpin__prize-copy_small]:text-sm [&_.promotion-bumpin__prize-copy_small]:leading-5 [&_.promotion-bumpin__prize-copy_small]:text-[#6f7969]',
|
|
85
|
+
'[&_.promotion-bumpin__prize-amount]:text-sm [&_.promotion-bumpin__prize-amount]:leading-5 [&_.promotion-bumpin__prize-amount]:text-[#6f7969]',
|
|
86
|
+
'[&_.promotion-bumpin__prizes-toggle]:border-t [&_.promotion-bumpin__prizes-toggle]:border-[rgba(106,119,137,0.1)]',
|
|
87
|
+
'[&_.promotion-bumpin__prizes-toggle]:bg-[#f8fafc] [&_.promotion-bumpin__prizes-toggle]:px-3.5 [&_.promotion-bumpin__prizes-toggle]:py-[11px]',
|
|
88
|
+
'[&_.promotion-bumpin__prizes-toggle]:text-sm [&_.promotion-bumpin__prizes-toggle]:leading-5 [&_.promotion-bumpin__prizes-toggle]:text-[#6f7969]',
|
|
89
|
+
'[&_.promotion-bumpin__rules-content]:px-3.5 [&_.promotion-bumpin__rules-content]:pt-3 [&_.promotion-bumpin__rules-content]:pb-3.5',
|
|
90
|
+
'[&_.promotion-bumpin__rules-content]:text-sm [&_.promotion-bumpin__rules-content]:leading-6 [&_.promotion-bumpin__rules-content]:text-[#6f7969]',
|
|
91
|
+
].join(' ');
|
|
92
|
+
|
|
8
93
|
export function ActivityDetailHero({ variant = 'page' }: { readonly variant?: 'page' | 'strip' }) {
|
|
9
|
-
const className =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
: 'activity-detail-presentation__poster';
|
|
94
|
+
const className = variant === 'strip'
|
|
95
|
+
? `${POSTER_BASE} activity-detail-presentation__poster--stage ${POSTER_STAGE}`
|
|
96
|
+
: `${POSTER_BASE} ${POSTER_STAGE} ${POSTER_COMPACT}`;
|
|
13
97
|
return <span className={className} role="img" aria-label="参与联单,碰出惊喜" />;
|
|
14
98
|
}
|
|
15
99
|
|
|
@@ -20,12 +104,21 @@ export function ActivityDetailPresentation({
|
|
|
20
104
|
readonly children: ReactNode;
|
|
21
105
|
readonly variant: 'page' | 'inline';
|
|
22
106
|
}) {
|
|
107
|
+
const isPage = variant === 'page';
|
|
23
108
|
return (
|
|
24
|
-
<div
|
|
25
|
-
|
|
26
|
-
|
|
109
|
+
<div
|
|
110
|
+
className={`activity-detail-presentation activity-detail-presentation--${variant} w-full min-w-0 overflow-hidden bg-card text-[#263022] ${isPage ? '' : '@container/activity rounded-[14px] [contain:layout_paint]'}`}
|
|
111
|
+
>
|
|
112
|
+
<div
|
|
113
|
+
className={`activity-detail-presentation__hero activity-detail-presentation__hero--${variant} relative w-full overflow-hidden bg-[#fff8e9] ${isPage ? 'aspect-[353/240]' : 'aspect-auto h-[152px]'}`}
|
|
114
|
+
>
|
|
115
|
+
<ActivityDetailHero variant={isPage ? 'page' : 'strip'} />
|
|
116
|
+
</div>
|
|
117
|
+
<div
|
|
118
|
+
className={`activity-detail-presentation__body relative z-[1] min-w-0 bg-card [&>*]:w-full ${isPage ? '-mt-[50px] rounded-t-[22px] px-0 pt-1 pb-4.5 shadow-[0_-10px_28px_rgba(38,48,34,0.08)]' : '-mt-3.5 rounded-t-[16px] px-0 pt-0 pb-2 shadow-none'} ${EMBED_SKIN}`}
|
|
119
|
+
>
|
|
120
|
+
{children}
|
|
27
121
|
</div>
|
|
28
|
-
<div className="activity-detail-presentation__body">{children}</div>
|
|
29
122
|
</div>
|
|
30
123
|
);
|
|
31
124
|
}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
2
|
import { X } from '@phosphor-icons/react';
|
|
3
|
+
import { Overlay } from '@tbox.cn/app-agent-ui-kit/overlay';
|
|
4
4
|
import type { GateCardContext, GatePhase } from '../../member-gate';
|
|
5
|
-
import './index.less';
|
|
6
|
-
|
|
7
|
-
const FOCUSABLE_SELECTOR = [
|
|
8
|
-
'button:not([disabled])',
|
|
9
|
-
'[href]',
|
|
10
|
-
'input:not([disabled])',
|
|
11
|
-
'select:not([disabled])',
|
|
12
|
-
'textarea:not([disabled])',
|
|
13
|
-
'[tabindex]:not([tabindex="-1"])',
|
|
14
|
-
].join(',');
|
|
15
|
-
|
|
16
5
|
const DEFAULT_TITLE: Record<GateCardContext['kind'], string> = {
|
|
17
6
|
login: '登录后继续',
|
|
18
7
|
enroll: '入会后继续',
|
|
@@ -51,10 +40,12 @@ export function MemberGateSheet({
|
|
|
51
40
|
onRetry,
|
|
52
41
|
onDismiss,
|
|
53
42
|
}: MemberGateSheetProps) {
|
|
54
|
-
const sheetRef = useRef<HTMLElement>(null);
|
|
55
43
|
const closeRef = useRef<HTMLButtonElement>(null);
|
|
56
44
|
const confirmButtonRef = useRef<HTMLButtonElement>(null);
|
|
57
45
|
const openingRef = useRef(false);
|
|
46
|
+
// 两段式关闭:先播退场动画(onExited)再交还门禁状态机;换卡(context 变)时复位。
|
|
47
|
+
const [closing, setClosing] = useState(false);
|
|
48
|
+
const requestDismiss = () => setClosing(true);
|
|
58
49
|
|
|
59
50
|
const contextId = context.id;
|
|
60
51
|
const titleId = `member-login-sheet-title-${contextId}`;
|
|
@@ -73,59 +64,6 @@ export function MemberGateSheet({
|
|
|
73
64
|
: message ?? '请稍后重试'
|
|
74
65
|
: context.subtitle ?? DEFAULT_DESCRIPTION[context.kind];
|
|
75
66
|
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
const previousFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
78
|
-
const previousOverflow = document.body.style.overflow;
|
|
79
|
-
const appRoot = document.getElementById('root');
|
|
80
|
-
const previousAriaHidden = appRoot?.getAttribute('aria-hidden') ?? null;
|
|
81
|
-
const previousInert = appRoot?.inert ?? false;
|
|
82
|
-
|
|
83
|
-
document.body.style.overflow = 'hidden';
|
|
84
|
-
if (appRoot) {
|
|
85
|
-
appRoot.setAttribute('aria-hidden', 'true');
|
|
86
|
-
appRoot.inert = true;
|
|
87
|
-
}
|
|
88
|
-
closeRef.current?.focus();
|
|
89
|
-
|
|
90
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
91
|
-
if (event.key === 'Escape') {
|
|
92
|
-
event.preventDefault();
|
|
93
|
-
onDismiss();
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (event.key !== 'Tab') return;
|
|
97
|
-
|
|
98
|
-
const focusable = Array.from(
|
|
99
|
-
sheetRef.current?.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR) ?? [],
|
|
100
|
-
);
|
|
101
|
-
if (focusable.length === 0) {
|
|
102
|
-
event.preventDefault();
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const first = focusable[0];
|
|
106
|
-
const last = focusable[focusable.length - 1];
|
|
107
|
-
if (event.shiftKey && document.activeElement === first) {
|
|
108
|
-
event.preventDefault();
|
|
109
|
-
last.focus();
|
|
110
|
-
} else if (!event.shiftKey && document.activeElement === last) {
|
|
111
|
-
event.preventDefault();
|
|
112
|
-
first.focus();
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
117
|
-
return () => {
|
|
118
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
119
|
-
document.body.style.overflow = previousOverflow;
|
|
120
|
-
if (appRoot) {
|
|
121
|
-
appRoot.inert = previousInert;
|
|
122
|
-
if (previousAriaHidden === null) appRoot.removeAttribute('aria-hidden');
|
|
123
|
-
else appRoot.setAttribute('aria-hidden', previousAriaHidden);
|
|
124
|
-
}
|
|
125
|
-
previousFocus?.focus();
|
|
126
|
-
};
|
|
127
|
-
}, [contextId, onDismiss]);
|
|
128
|
-
|
|
129
67
|
// 阶段回退(cancel 收场/终态重试重开/同浮层新卡重新武装)时复位一次性标志,confirm 按钮重新可用
|
|
130
68
|
useEffect(() => {
|
|
131
69
|
if (phase === 'idle') {
|
|
@@ -133,6 +71,13 @@ export function MemberGateSheet({
|
|
|
133
71
|
}
|
|
134
72
|
}, [phase, contextId]);
|
|
135
73
|
|
|
74
|
+
// 同浮层换卡(门禁卡被新消息替换)时重新武装并回到关闭按钮(旧实现的 effect 依赖 contextId,
|
|
75
|
+
// 换卡即重聚焦;内核只管首次打开,这里补回同一语义)。
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
setClosing(false);
|
|
78
|
+
closeRef.current?.focus({ preventScroll: true });
|
|
79
|
+
}, [contextId]);
|
|
80
|
+
|
|
136
81
|
const performConfirm = () => {
|
|
137
82
|
if (openingRef.current) return;
|
|
138
83
|
openingRef.current = true;
|
|
@@ -146,42 +91,45 @@ export function MemberGateSheet({
|
|
|
146
91
|
: CONFIRM_LABEL[context.kind];
|
|
147
92
|
const confirmDisabled = busy || phase !== 'idle';
|
|
148
93
|
|
|
149
|
-
return
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
94
|
+
return (
|
|
95
|
+
<Overlay
|
|
96
|
+
open={!closing}
|
|
97
|
+
onDismiss={requestDismiss}
|
|
98
|
+
onExited={onDismiss}
|
|
99
|
+
exitMs={220}
|
|
100
|
+
placement="bottom"
|
|
101
|
+
labelledBy={titleId}
|
|
102
|
+
describedBy={descriptionId}
|
|
103
|
+
initialFocus={closeRef}
|
|
104
|
+
rootClassName="member-login-sheet group"
|
|
105
|
+
maskClassName="bg-scrim animate-[member-login-mask-in_180ms_ease-out_both] group-data-[state=closed]:animate-[member-login-mask-out_160ms_ease-in_both] motion-reduce:animate-none"
|
|
106
|
+
panelClassName="member-login-sheet__panel flex h-[58vh] min-h-0 w-full max-w-[560px] flex-col overflow-hidden rounded-t-[28px] bg-card shadow-[0_-14px_44px_rgba(35,47,28,0.16)] animate-[member-login-sheet-in_260ms_cubic-bezier(0.22,0.72,0.24,1)_both] [@media(max-height:620px)]:h-[64vh] [@media(max-height:620px)]:supports-[height:100dvh]:h-[64dvh] landscape:[@media(max-height:500px)]:h-[88vh] landscape:[@media(max-height:500px)]:supports-[height:100dvh]:h-[88dvh] max-h-[calc(100vh-env(safe-area-inset-top)-12px)] supports-[height:100dvh]:max-h-[calc(100dvh-env(safe-area-inset-top)-12px)] group-data-[state=closed]:animate-[member-login-sheet-out_200ms_ease-in_both] motion-reduce:animate-none"
|
|
107
|
+
>
|
|
108
|
+
<div className="member-login-sheet__handle absolute left-1/2 top-2.25 z-10 h-1 w-9.5 -translate-x-1/2 rounded-full bg-neutral-soft" aria-hidden="true" />
|
|
161
109
|
<button
|
|
162
110
|
ref={closeRef}
|
|
163
111
|
type="button"
|
|
164
|
-
className="member-login-sheet__close"
|
|
112
|
+
className="member-login-sheet__close absolute right-4.5 top-4.5 z-20 grid size-9 place-items-center rounded-full border border-border bg-card p-0 text-foreground shadow-md outline-none focus-visible:ring-3 focus-visible:ring-focus-ring"
|
|
165
113
|
aria-label="关闭登录提示"
|
|
166
|
-
onClick={
|
|
114
|
+
onClick={requestDismiss}
|
|
167
115
|
>
|
|
168
116
|
<X size={18} weight="bold" aria-hidden="true" />
|
|
169
117
|
</button>
|
|
170
118
|
|
|
171
|
-
<div className="member-login-sheet__scroll">
|
|
119
|
+
<div className="member-login-sheet__scroll flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
|
|
172
120
|
{/* 素材变量链(主题轨 T-2.3):主视觉经 CSS background(--tbox-asset-member-login-hero) */}
|
|
173
|
-
<div className="member-login-sheet__hero" aria-hidden="true" />
|
|
174
|
-
<div className="member-login-sheet__tear" aria-hidden="true" />
|
|
121
|
+
<div className="member-login-sheet__hero relative min-h-40 w-full flex-[1_1_190px] overflow-hidden member-hero [@media(max-height:620px)]:min-h-29 [@media(max-height:620px)]:flex-[0_0_116px]" aria-hidden="true" />
|
|
122
|
+
<div className="member-login-sheet__tear relative z-10 -mt-3.75 h-4 w-full shrink-0 bg-card [clip-path:polygon(0_70%,8%_28%,15%_72%,24%_22%,33%_66%,43%_18%,53%_72%,63%_25%,72%_68%,82%_20%,91%_64%,100%_32%,100%_100%,0_100%)]" aria-hidden="true" />
|
|
175
123
|
|
|
176
|
-
<div className="member-login-sheet__content">
|
|
124
|
+
<div className="member-login-sheet__content shrink-0 px-3 pb-[calc(14px+env(safe-area-inset-bottom))] pt-3 text-center [@media(max-height:620px)]:pt-2 [&_h2]:m-0 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:leading-tight [&_h2]:text-foreground">
|
|
177
125
|
<h2 id={titleId}>{heroTitle}</h2>
|
|
178
|
-
<p id={descriptionId} className="member-login-sheet__description">
|
|
126
|
+
<p id={descriptionId} className="member-login-sheet__description mt-1.5 text-sm leading-normal text-muted-foreground">
|
|
179
127
|
{description}
|
|
180
128
|
</p>
|
|
181
129
|
|
|
182
130
|
{isTerminal ? (
|
|
183
|
-
<div className="member-login-sheet__status-actions">
|
|
184
|
-
<button type="button" onClick={
|
|
131
|
+
<div className="member-login-sheet__status-actions mx-auto mt-2 grid w-[min(100%,292px)] grid-cols-2 gap-2.5 [&_button]:min-h-11 [&_button]:rounded-xl [&_button]:border-0 [&_button]:bg-muted [&_button]:px-2.5 [&_button]:text-sm [&_button]:font-semibold [&_button]:text-secondary-foreground [&_button:last-child]:bg-member-accent [&_button:last-child]:text-white [&_button:disabled]:cursor-not-allowed [&_button:disabled]:opacity-68 [&_button:focus-visible]:ring-3 [&_button:focus-visible]:ring-focus-ring [&_button:active:not(:disabled)]:scale-98">
|
|
132
|
+
<button type="button" onClick={requestDismiss}>暂不</button>
|
|
185
133
|
<button
|
|
186
134
|
ref={confirmButtonRef}
|
|
187
135
|
type="button"
|
|
@@ -195,7 +143,7 @@ export function MemberGateSheet({
|
|
|
195
143
|
<button
|
|
196
144
|
ref={confirmButtonRef}
|
|
197
145
|
type="button"
|
|
198
|
-
className="member-login-sheet__login"
|
|
146
|
+
className="member-login-sheet__login mx-auto mt-2 flex min-h-11 w-[min(100%,292px)] items-center justify-center rounded-xl border-0 bg-member-accent px-4 text-sm font-semibold leading-none text-white shadow-md transition active:scale-98 disabled:cursor-not-allowed disabled:opacity-68"
|
|
199
147
|
disabled={confirmDisabled}
|
|
200
148
|
onClick={performConfirm}
|
|
201
149
|
>
|
|
@@ -204,8 +152,6 @@ export function MemberGateSheet({
|
|
|
204
152
|
)}
|
|
205
153
|
</div>
|
|
206
154
|
</div>
|
|
207
|
-
|
|
208
|
-
</div>,
|
|
209
|
-
document.body,
|
|
155
|
+
</Overlay>
|
|
210
156
|
);
|
|
211
157
|
}
|
package/src/client/home-slot.tsx
CHANGED
|
@@ -5,17 +5,15 @@
|
|
|
5
5
|
*
|
|
6
6
|
* slot 值 = 自持渲染函数(kit ChatPage 恒挂载;域自持数据加载/门禁状态机/浮层显隐)。
|
|
7
7
|
*/
|
|
8
|
-
import { useCallback, useEffect,
|
|
8
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
9
9
|
import type { HomeSlotRenderProps, HomeSlotValue, TboxCardPayload } from '@tbox.cn/app-contracts';
|
|
10
|
-
import {
|
|
11
|
-
import { RawCardRenderer,
|
|
10
|
+
import { getAuthClient } from '@tbox.cn/app-agent-sdk-client';
|
|
11
|
+
import { RawCardRenderer, useChatStore } from '@tbox.cn/app-agent-ui-kit';
|
|
12
12
|
import { readMallIdFromUrl } from '@tbox.cn/app-contracts-mall';
|
|
13
13
|
|
|
14
14
|
import { MallHome } from './MallHome';
|
|
15
|
+
import { useMemberGateController } from './member-gate-overlay';
|
|
15
16
|
import { MemberGateSheet } from './components/MemberGateSheet';
|
|
16
|
-
import { selectLatestMemberGateCard } from './components/MemberGateSheet/model';
|
|
17
|
-
import { createMemberGate, useMemberGate } from './member-gate';
|
|
18
|
-
import { directLoginGate } from './mock-direct-gate';
|
|
19
17
|
import {
|
|
20
18
|
loadHomeConfig,
|
|
21
19
|
loadLinkedPanelState,
|
|
@@ -23,8 +21,6 @@ import {
|
|
|
23
21
|
pickMallId,
|
|
24
22
|
} from './home-runtime';
|
|
25
23
|
import type { HomeConfig, LinkedOrderLoadState, MemberLoadState, ParkingLoadState } from './home-runtime';
|
|
26
|
-
import './home-slot.less';
|
|
27
|
-
|
|
28
24
|
const PARKING_FEE_QUERY = '查询停车费';
|
|
29
25
|
const PARKING_VEHICLE_QUERY = '我的车辆';
|
|
30
26
|
const PARKING_SERVICE_QUERY = '停车服务';
|
|
@@ -34,16 +30,12 @@ function renderHomeActivityDetail(card: TboxCardPayload) {
|
|
|
34
30
|
return <RawCardRenderer card={card} />;
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
/** 门禁排障五锚(open/receipt/relogin/judge/replay)——对齐 SESSION-UPGRADE 域日志先例 */
|
|
38
|
-
const gateLogger = createLogger('MEMBER-GATE');
|
|
39
33
|
|
|
40
34
|
function HomeSlotContent({ onSend, mallName }: HomeSlotRenderProps) {
|
|
41
|
-
const store = useChatStoreApi();
|
|
42
35
|
const messages = useChatStore((s) => s.messages);
|
|
43
36
|
const orphanCards = useChatStore((s) => s.orphanCards);
|
|
44
37
|
const cardsByMessageId = useChatStore((s) => s.cardsByMessageId);
|
|
45
38
|
const retryBootstrap = useChatStore((s) => s.retryBootstrap);
|
|
46
|
-
const isGenerating = useChatStore((s) => s.isGenerating);
|
|
47
39
|
// 面板 mallId 读源:URL 优先(?mallId= / 小程序壳 ?plazaId=)——挂载即可发 /api/m/mall-core/linked-panel,免等
|
|
48
40
|
// createConversation + WS HELLO 握手;URL 缺席回退 HELLO_ACK(原逻辑不变)。HELLO 后到且值不同时,
|
|
49
41
|
// 面板 effect 依赖 mallId 自动重载(以 HELLO 为准,旧请求经 AbortController 中止)。
|
|
@@ -63,58 +55,10 @@ function HomeSlotContent({ onSend, mallName }: HomeSlotRenderProps) {
|
|
|
63
55
|
// parking-vehicle-management 各卡 bound 数快照(按卡 id 跟踪;已有卡 bound 变化=绑定/解绑发生)
|
|
64
56
|
const prevParkingBoundByCardRef = useRef<Map<string, number>>(new Map());
|
|
65
57
|
|
|
66
|
-
const
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
// 会员门禁状态机(deps 全注入 store/平台面;实例单建——store 方法经 getState 现取)
|
|
72
|
-
const gate = useMemo(
|
|
73
|
-
() =>
|
|
74
|
-
createMemberGate({
|
|
75
|
-
// 壳内走桥(容器 mock-enrollment/真实厂商 gate 页);非壳(扫码直开/浏览器)走 H5 直连 mock 入会
|
|
76
|
-
getLoginState: (params) => (isInAlipayShell() ? getLoginState(params) : directLoginGate()),
|
|
77
|
-
retryBootstrap: (refreshAuth) => store.getState().retryBootstrap(refreshAuth),
|
|
78
|
-
loadPanel: async (panelMallId) => {
|
|
79
|
-
const panel = await loadLinkedPanelState(getAuthClient(), panelMallId, fetch);
|
|
80
|
-
return { member: { status: panel.member.status } };
|
|
81
|
-
},
|
|
82
|
-
waitForSocketOpen,
|
|
83
|
-
getAuthState: () => getAuthClient().getAuthState(),
|
|
84
|
-
sendMessage: (input) => store.getState().sendMessage(input),
|
|
85
|
-
sendUiAction: (surfaceId, action) => store.getState().sendUiAction(surfaceId, action),
|
|
86
|
-
hideCard: (cardId) => store.getState().hideCard(cardId),
|
|
87
|
-
toast: (content) => {
|
|
88
|
-
void toast(content);
|
|
89
|
-
},
|
|
90
|
-
isGenerating: () => store.getState().isGenerating,
|
|
91
|
-
lastUserMessage: () => {
|
|
92
|
-
const live = store.getState().messages;
|
|
93
|
-
for (let i = live.length - 1; i >= 0; i -= 1) {
|
|
94
|
-
if (live[i]?.role === 'user') return { id: live[i].id, content: live[i].content };
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
},
|
|
98
|
-
readMallId: () =>
|
|
99
|
-
pickMallId(store.getState().helloAck?.mallScope?.mallId, readMallIdFromUrl()),
|
|
100
|
-
refreshPanel: () => setLinkedPanelReloadEpoch((epoch) => epoch + 1),
|
|
101
|
-
log: (message) => {
|
|
102
|
-
gateLogger.info(message);
|
|
103
|
-
},
|
|
104
|
-
}),
|
|
105
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
106
|
-
[],
|
|
107
|
-
);
|
|
108
|
-
const gateState = useMemberGate(gate);
|
|
109
|
-
|
|
110
|
-
// 门禁卡到达 → 武装浮层(飞轮中忽略;同卡不重复;replayQuery 缺省取触发原话)
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (!gateCard) return;
|
|
113
|
-
const { phase, card } = gate.getState();
|
|
114
|
-
if (phase === 'opening' || phase === 'syncing') return;
|
|
115
|
-
if (card?.id === gateCard.id) return;
|
|
116
|
-
gate.trigger(gateCard, undefined);
|
|
117
|
-
}, [gateCard, gate, gateState.phase]);
|
|
58
|
+
const refreshPanel = useCallback(() => {
|
|
59
|
+
setLinkedPanelReloadEpoch((epoch) => epoch + 1);
|
|
60
|
+
}, []);
|
|
61
|
+
const { gate, gateState, isGenerating } = useMemberGateController(refreshPanel);
|
|
118
62
|
|
|
119
63
|
// 首页配置单次加载(app 级旗标,无 mall/会话维度,无 reload epoch);任何失败保持隐藏。
|
|
120
64
|
useEffect(() => {
|
package/src/client/index.ts
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
* module-mall-core 客户端入口(与服务端 serverModule 对称;2026-09-20 随 module-mall-home 并入)。
|
|
3
3
|
*
|
|
4
4
|
* 注册面(应用组装端 registerAll(ctx) 内生效):
|
|
5
|
-
* - ctx.slots.register('
|
|
5
|
+
* - ctx.slots.register('conversationOverlay', ...):会员授权/入会浮层;
|
|
6
6
|
* - ctx.cards.registerOverride('promotion-bumpin-activity', ...):聊天视图组合层覆盖
|
|
7
7
|
* (原始形态仍由 provider 模块注册——RawCardRenderer 详情弹层防嵌套);
|
|
8
8
|
* - ctx.cards.registerInlineFilter(filterInlineCards):会员门禁卡系剥离(浮层自持,不进内联流);
|
|
9
9
|
* - cards map 'mall-home':首页预览卡(dev 预览专用——/_tbox/card-preview 目录收录,chat 零出场)。
|
|
10
10
|
*/
|
|
11
|
+
import { createElement } from 'react';
|
|
11
12
|
import type { CardComponent } from '@tbox.cn/app-contracts';
|
|
12
13
|
import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
|
|
13
|
-
import {
|
|
14
|
+
import { MemberGateOverlay } from './member-gate-overlay.js';
|
|
14
15
|
import { BumpInActivityChatCard } from './cards/overrides/BumpInActivityChatCard.js';
|
|
15
16
|
import { MallHomePreviewCard } from './cards/mall-home/index.js';
|
|
16
17
|
import { filterInlineCards } from './components/MemberGateSheet/model.js';
|
|
@@ -22,7 +23,7 @@ const cards = {
|
|
|
22
23
|
export const clientModule = {
|
|
23
24
|
cards,
|
|
24
25
|
register(ctx: ClientContext): void {
|
|
25
|
-
ctx.slots.register('
|
|
26
|
+
ctx.slots.register('conversationOverlay', () => createElement(MemberGateOverlay));
|
|
26
27
|
ctx.cards.registerMap(cards);
|
|
27
28
|
ctx.cards.registerOverride('promotion-bumpin-activity', BumpInActivityChatCard);
|
|
28
29
|
ctx.cards.registerInlineFilter(filterInlineCards);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { createLogger, getAuthClient, getLoginState, isInAlipayShell, waitForSocketOpen } from '@tbox.cn/app-agent-sdk-client';
|
|
3
|
+
import { toast, useChatStore, useChatStoreApi } from '@tbox.cn/app-agent-ui-kit';
|
|
4
|
+
import { readMallIdFromUrl } from '@tbox.cn/app-contracts-mall';
|
|
5
|
+
import { MemberGateSheet } from './components/MemberGateSheet';
|
|
6
|
+
import { selectLatestMemberGateCard } from './components/MemberGateSheet/model';
|
|
7
|
+
import { createMemberGate, useMemberGate } from './member-gate';
|
|
8
|
+
import { directLoginGate } from './mock-direct-gate';
|
|
9
|
+
import { loadLinkedPanelState, pickMallId } from './home-runtime';
|
|
10
|
+
|
|
11
|
+
const gateLogger = createLogger('MEMBER-GATE');
|
|
12
|
+
const ignorePanelRefresh = () => {};
|
|
13
|
+
|
|
14
|
+
export function useMemberGateController(refreshPanel = ignorePanelRefresh) {
|
|
15
|
+
const store = useChatStoreApi();
|
|
16
|
+
const messages = useChatStore((s) => s.messages);
|
|
17
|
+
const orphanCards = useChatStore((s) => s.orphanCards);
|
|
18
|
+
const cardsByMessageId = useChatStore((s) => s.cardsByMessageId);
|
|
19
|
+
const isGenerating = useChatStore((s) => s.isGenerating);
|
|
20
|
+
const gateCard = useMemo(
|
|
21
|
+
() => selectLatestMemberGateCard(messages.map((message) => message.id), cardsByMessageId, orphanCards),
|
|
22
|
+
[messages, cardsByMessageId, orphanCards],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
// 会员门禁状态机(deps 全注入 store/平台面;实例单建——store 方法经 getState 现取)
|
|
26
|
+
const gate = useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
createMemberGate({
|
|
29
|
+
// 壳内走桥(容器 mock-enrollment/真实厂商 gate 页);非壳(扫码直开/浏览器)走 H5 直连 mock 入会
|
|
30
|
+
getLoginState: (params) => (isInAlipayShell() ? getLoginState(params) : directLoginGate()),
|
|
31
|
+
retryBootstrap: (refreshAuth) => store.getState().retryBootstrap(refreshAuth),
|
|
32
|
+
loadPanel: async (panelMallId) => {
|
|
33
|
+
const panel = await loadLinkedPanelState(getAuthClient(), panelMallId, fetch);
|
|
34
|
+
return { member: { status: panel.member.status } };
|
|
35
|
+
},
|
|
36
|
+
waitForSocketOpen,
|
|
37
|
+
getAuthState: () => getAuthClient().getAuthState(),
|
|
38
|
+
sendMessage: (input) => store.getState().sendMessage(input),
|
|
39
|
+
sendUiAction: (surfaceId, action) => store.getState().sendUiAction(surfaceId, action),
|
|
40
|
+
hideCard: (cardId) => store.getState().hideCard(cardId),
|
|
41
|
+
toast: (content) => {
|
|
42
|
+
void toast(content);
|
|
43
|
+
},
|
|
44
|
+
isGenerating: () => store.getState().isGenerating,
|
|
45
|
+
lastUserMessage: () => {
|
|
46
|
+
const live = store.getState().messages;
|
|
47
|
+
for (let i = live.length - 1; i >= 0; i -= 1) {
|
|
48
|
+
if (live[i]?.role === 'user') return { id: live[i].id, content: live[i].content };
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
},
|
|
52
|
+
readMallId: () =>
|
|
53
|
+
pickMallId(store.getState().helloAck?.mallScope?.mallId, readMallIdFromUrl()),
|
|
54
|
+
refreshPanel,
|
|
55
|
+
log: (message) => {
|
|
56
|
+
gateLogger.info(message);
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
[store, refreshPanel],
|
|
60
|
+
);
|
|
61
|
+
const gateState = useMemberGate(gate);
|
|
62
|
+
|
|
63
|
+
// 门禁卡到达 → 武装浮层(飞轮中忽略;同卡不重复;replayQuery 缺省取触发原话)
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!gateCard) return;
|
|
66
|
+
const { phase, card } = gate.getState();
|
|
67
|
+
if (phase === 'opening' || phase === 'syncing') return;
|
|
68
|
+
if (card?.id === gateCard.id) return;
|
|
69
|
+
gate.trigger(gateCard, undefined);
|
|
70
|
+
}, [gateCard, gate, gateState.phase]);
|
|
71
|
+
|
|
72
|
+
return { gate, gateState, isGenerating };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function MemberGateOverlay() {
|
|
76
|
+
const { gate, gateState, isGenerating } = useMemberGateController();
|
|
77
|
+
if (!gateState.sheetVisible || !gateState.card) return null;
|
|
78
|
+
return (
|
|
79
|
+
<MemberGateSheet
|
|
80
|
+
context={gateState.card}
|
|
81
|
+
phase={gateState.phase}
|
|
82
|
+
message={gateState.message}
|
|
83
|
+
busy={isGenerating}
|
|
84
|
+
onConfirm={() => gate.confirm()}
|
|
85
|
+
onRetry={() => gate.retry()}
|
|
86
|
+
onDismiss={() => gate.dismiss()}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
@@ -48,7 +48,7 @@ type BumpinPorts = {
|
|
|
48
48
|
|
|
49
49
|
function warnUnassembled(specifier: string, e: unknown): void {
|
|
50
50
|
portsLogger.warn(
|
|
51
|
-
'module ports 未装配(
|
|
51
|
+
'module ports 未装配(pnpm exec tbox-app module add 后生效)',
|
|
52
52
|
specifier,
|
|
53
53
|
String((e as Error)?.message ?? e).slice(0, 120),
|
|
54
54
|
);
|
package/tbox.module.json
CHANGED
|
@@ -132,6 +132,9 @@ describe('MemberGateSheet', () => {
|
|
|
132
132
|
act(() => (actions[1] as HTMLButtonElement).click());
|
|
133
133
|
expect(onRetry).toHaveBeenCalledTimes(1);
|
|
134
134
|
act(() => (actions[0] as HTMLButtonElement).click());
|
|
135
|
+
const closingSheet = document.body.querySelector('.member-login-sheet') as HTMLElement;
|
|
136
|
+
expect(closingSheet.getAttribute('data-state')).toBe('closed');
|
|
137
|
+
act(() => closingSheet.dispatchEvent(new Event('animationend', { bubbles: true })));
|
|
135
138
|
expect(onDismiss).toHaveBeenCalledTimes(1);
|
|
136
139
|
|
|
137
140
|
// login 卡型的终态标题区分
|
|
@@ -154,6 +157,9 @@ describe('MemberGateSheet', () => {
|
|
|
154
157
|
|
|
155
158
|
const close = document.body.querySelector('[aria-label="关闭登录提示"]') as HTMLButtonElement;
|
|
156
159
|
act(() => close.click());
|
|
160
|
+
const sheet = document.body.querySelector('.member-login-sheet') as HTMLElement;
|
|
161
|
+
expect(sheet.getAttribute('data-state')).toBe('closed');
|
|
162
|
+
act(() => sheet.dispatchEvent(new Event('animationend', { bubbles: true })));
|
|
157
163
|
expect(onDismiss).toHaveBeenCalledTimes(1);
|
|
158
164
|
});
|
|
159
165
|
|
|
@@ -163,6 +169,9 @@ describe('MemberGateSheet', () => {
|
|
|
163
169
|
|
|
164
170
|
act(() => document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })));
|
|
165
171
|
expect(document.body.querySelector('[role="alertdialog"]')).toBeNull();
|
|
172
|
+
const sheet = document.body.querySelector('.member-login-sheet') as HTMLElement;
|
|
173
|
+
expect(sheet.getAttribute('data-state')).toBe('closed');
|
|
174
|
+
act(() => sheet.dispatchEvent(new Event('animationend', { bubbles: true })));
|
|
166
175
|
expect(onDismiss).toHaveBeenCalledTimes(1);
|
|
167
176
|
|
|
168
177
|
act(() => root.unmount());
|