@tbox.cn/app-module-shopping-guide 0.2.1
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/LICENSE +21 -0
- package/dist/chunk-AGBLC6XI.js +1294 -0
- package/dist/chunk-U4WDS5PQ.js +173 -0
- package/dist/client/index.d.ts +25 -0
- package/dist/client/index.js +6 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +22 -0
- package/dist/server/index.d.ts +4098 -0
- package/dist/server/index.js +18 -0
- package/package.json +62 -0
- package/skills/shopping-guide/SKILL.md +36 -0
- package/skills/shopping-guide/references/comparison-format.md +5 -0
- package/skills/shopping-guide/references/faq-answers.md +5 -0
- package/skills/shopping-guide/references/floor-directory.md +4 -0
- package/skills/shopping-guide/references/intent-patterns.md +5 -0
- package/skills/shopping-guide/references/location-format.md +5 -0
- package/skills/shopping-guide/references/policy-lookup.md +5 -0
- package/skills/shopping-guide/references/product-search-tips.md +6 -0
- package/skills/shopping-guide/references/recommendation-style.md +5 -0
- package/src/client/cards/index.tsx +267 -0
- package/src/client/index.ts +39 -0
- package/src/index.ts +6 -0
- package/src/server/cards/category-list/meta.ts +19 -0
- package/src/server/cards/customer-service-faq/meta.ts +18 -0
- package/src/server/cards/human-guide-list/meta.ts +19 -0
- package/src/server/cards/index.ts +43 -0
- package/src/server/cards/location-handoff/meta.ts +20 -0
- package/src/server/cards/mall-directory/meta.ts +27 -0
- package/src/server/cards/merchant-detail/meta.ts +27 -0
- package/src/server/cards/merchant-list/meta.ts +31 -0
- package/src/server/cards/nearby-mall-list/meta.ts +17 -0
- package/src/server/cards/product-comparison/meta.ts +29 -0
- package/src/server/cards/product-detail/meta.ts +29 -0
- package/src/server/cards/product-list/meta.ts +32 -0
- package/src/server/domain/value-objects.ts +49 -0
- package/src/server/index.ts +180 -0
- package/src/server/integrations/joycity/adapter.ts +226 -0
- package/src/server/integrations/joycity/auth-strategy.ts +38 -0
- package/src/server/integrations/joycity/gateway.ts +128 -0
- package/src/server/ports/index.ts +151 -0
- package/src/server/ports/local-adapters.ts +90 -0
- package/src/server/projections/index.ts +253 -0
- package/src/server/tools/index.ts +407 -0
- package/tbox.component.json +48 -0
- package/tests/shopping-guide.test.ts +290 -0
- package/tsconfig.json +8 -0
- package/tsup.config.ts +29 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SHOPPING_GUIDE_PROVIDER_TEMPLATE_ID,
|
|
3
|
+
computeJoyCityCSign,
|
|
4
|
+
createShoppingGuideTools,
|
|
5
|
+
joycityCSignedAuthStrategy,
|
|
6
|
+
resolveShoppingGuidePorts,
|
|
7
|
+
serverModule,
|
|
8
|
+
shoppingGuideCards
|
|
9
|
+
} from "../chunk-AGBLC6XI.js";
|
|
10
|
+
export {
|
|
11
|
+
SHOPPING_GUIDE_PROVIDER_TEMPLATE_ID,
|
|
12
|
+
computeJoyCityCSign,
|
|
13
|
+
createShoppingGuideTools,
|
|
14
|
+
joycityCSignedAuthStrategy,
|
|
15
|
+
resolveShoppingGuidePorts,
|
|
16
|
+
serverModule,
|
|
17
|
+
shoppingGuideCards
|
|
18
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tbox.cn/app-module-shopping-guide",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "商圈导购模块:商品/商户搜索、推荐、对比、商场目录、客服FAQ、人工导购、位置导航。",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./server": {
|
|
12
|
+
"types": "./dist/server/index.d.ts",
|
|
13
|
+
"import": "./dist/server/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./client": {
|
|
16
|
+
"types": "./dist/client/index.d.ts",
|
|
17
|
+
"import": "./dist/client/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@tbox.cn/app-sdk": "^0.2.0",
|
|
23
|
+
"@tbox.cn/app-contracts": "^0.1.0",
|
|
24
|
+
"@tbox.cn/app-contracts-mall": "^0.2.0"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"zod": "^3.24.0",
|
|
28
|
+
"react": "^18.3.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/react": "^18.3.12",
|
|
32
|
+
"@types/node": "^24.0.0",
|
|
33
|
+
"typescript": "^5.7.0",
|
|
34
|
+
"tsx": "^4.19.0",
|
|
35
|
+
"vitest": "^4.1.4",
|
|
36
|
+
"zod": "^3.24.0",
|
|
37
|
+
"tsup": "^8.0.0"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"src",
|
|
42
|
+
"tests",
|
|
43
|
+
"skills",
|
|
44
|
+
"tbox.component.json",
|
|
45
|
+
"tsconfig.json",
|
|
46
|
+
"tsup.config.ts",
|
|
47
|
+
"README.md",
|
|
48
|
+
"LICENSE"
|
|
49
|
+
],
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=20.0.0"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"scripts": {
|
|
58
|
+
"typecheck": "tsc --noEmit",
|
|
59
|
+
"test": "vitest run",
|
|
60
|
+
"build": "tsup"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shopping-guide
|
|
3
|
+
description: 商圈导购 SOP——商品/门店搜索、推荐、对比、楼层目录、客服政策的标准回答流程。
|
|
4
|
+
routingTerms:
|
|
5
|
+
- 找店
|
|
6
|
+
- 买什么
|
|
7
|
+
- 推荐
|
|
8
|
+
- 对比
|
|
9
|
+
- 几楼
|
|
10
|
+
- 楼层
|
|
11
|
+
- 导航
|
|
12
|
+
- 退换货
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# 商圈导购 SOP
|
|
16
|
+
|
|
17
|
+
你是商圈导购助手。回答购物相关问题时遵循本 SOP。
|
|
18
|
+
|
|
19
|
+
## 核心规则
|
|
20
|
+
|
|
21
|
+
1. **先搜索后回答**:涉及具体商品/门店,必须调用对应工具获取权威数据,禁止编造价格/库存/位置。
|
|
22
|
+
2. **工具绑定卡片**:搜索类工具自动出卡,回答时用文字补充要点即可。
|
|
23
|
+
3. **位置优先**:用户问「在哪里」时优先用搜索结果内嵌的 location.displayText,不必再调 get-location;仅当用户明确要求「导航/怎么走」时调 get-location。
|
|
24
|
+
4. **政策问题走 FAQ**:退换货/积分/停车等服务政策问题,优先调 customer-service-faq;稳定知识走 search-knowledge。
|
|
25
|
+
5. **门店详情按需**:仅当用户点击门店卡片要看详情时调 get-merchant,不在 search-merchants 后自动补调。
|
|
26
|
+
6. **对比**:用户要求对比 2-4 个商品时用 compare-products,并排输出差异。
|
|
27
|
+
7. **人工兜底**:用户明确要求联系人工时调 list-human-guides。
|
|
28
|
+
|
|
29
|
+
## 参考
|
|
30
|
+
|
|
31
|
+
- 门店位置表达:`references/location-format.md`
|
|
32
|
+
- 商品搜索技巧:`references/product-search-tips.md`
|
|
33
|
+
- 楼层目录回答:`references/floor-directory.md`
|
|
34
|
+
- 政策查询:`references/policy-lookup.md`
|
|
35
|
+
- 对比回答:`references/comparison-format.md`
|
|
36
|
+
- 推荐话术:`references/recommendation-style.md`
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* module-shopping-guide 客户端卡片渲染(011 K1:11 卡)。
|
|
3
|
+
* 只消费 SDK 基元(CardFrame/ValueText/StatusPill,封顶 5 件)+ antd-mobile + `--tbox-*` tokens。
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { CardFrame, ValueText, StatusPill } from '@tbox.cn/app-sdk/client';
|
|
7
|
+
import type {
|
|
8
|
+
ProductListCardData,
|
|
9
|
+
ProductDetailCardData,
|
|
10
|
+
MerchantListCardData,
|
|
11
|
+
MerchantDetailCardData,
|
|
12
|
+
CategoryListCardData,
|
|
13
|
+
ProductComparisonCardData,
|
|
14
|
+
MallDirectoryCardData,
|
|
15
|
+
NearbyMallListCardData,
|
|
16
|
+
CustomerServiceFaqCardData,
|
|
17
|
+
HumanGuideListCardData,
|
|
18
|
+
LocationHandoffCardData,
|
|
19
|
+
} from '@tbox.cn/app-contracts-mall';
|
|
20
|
+
|
|
21
|
+
const listStyle: React.CSSProperties = { listStyle: 'none', margin: 0, padding: 0 };
|
|
22
|
+
const itemStyle: React.CSSProperties = {
|
|
23
|
+
padding: '8px 0',
|
|
24
|
+
borderBottom: '1px solid var(--tbox-divider, #f0f0f0)',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function ProductListCard(props: { data: ProductListCardData }) {
|
|
28
|
+
const { data } = props;
|
|
29
|
+
if (data.items.length === 0) {
|
|
30
|
+
return <CardFrame title="商品列表">{data.noResultsReason ?? '暂无商品'}</CardFrame>;
|
|
31
|
+
}
|
|
32
|
+
return (
|
|
33
|
+
<CardFrame title="商品列表" subtitle={data.summary}>
|
|
34
|
+
<ul style={listStyle}>
|
|
35
|
+
{data.items.map((item) => (
|
|
36
|
+
<li key={item.productId} style={itemStyle}>
|
|
37
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
38
|
+
<span style={{ fontSize: 14, fontWeight: 600 }}>{item.name}</span>
|
|
39
|
+
<span style={{ fontSize: 14, color: 'var(--tbox-primary, #e93b3d)' }}>
|
|
40
|
+
{item.price.sale?.display ?? ''}
|
|
41
|
+
</span>
|
|
42
|
+
</div>
|
|
43
|
+
<div style={{ marginTop: 4, display: 'flex', gap: 6, alignItems: 'center', flexWrap: 'wrap' }}>
|
|
44
|
+
<StatusPill
|
|
45
|
+
tone={item.availability.marketable ? 'success' : 'neutral'}
|
|
46
|
+
text={item.availability.label}
|
|
47
|
+
/>
|
|
48
|
+
{item.badges.map((b) => (
|
|
49
|
+
<StatusPill key={b} tone="neutral" text={b} />
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
<ValueText label="门店" value={`${item.merchant.name}${item.merchant.location ? ` · ${item.merchant.location.displayText}` : ''}`} />
|
|
53
|
+
</li>
|
|
54
|
+
))}
|
|
55
|
+
</ul>
|
|
56
|
+
</CardFrame>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function ProductDetailCard(props: { data: ProductDetailCardData }) {
|
|
61
|
+
const { data } = props;
|
|
62
|
+
return (
|
|
63
|
+
<CardFrame title={data.name} subtitle={data.brand}>
|
|
64
|
+
{data.imageUrls[0] && (
|
|
65
|
+
<img src={data.imageUrls[0]} alt={data.name} style={{ width: '100%', borderRadius: 8, marginBottom: 8 }} />
|
|
66
|
+
)}
|
|
67
|
+
<ValueText label="价格" value={data.price.sale?.display ?? '—'} />
|
|
68
|
+
<ValueText label="库存" value={data.availability.label} />
|
|
69
|
+
<ValueText
|
|
70
|
+
label="门店"
|
|
71
|
+
value={`${data.merchant.name}${data.merchant.location ? ` · ${data.merchant.location.displayText}` : ''}`}
|
|
72
|
+
/>
|
|
73
|
+
{data.attributes.map((a) => (
|
|
74
|
+
<ValueText key={a.name} label={a.name} value={a.value} />
|
|
75
|
+
))}
|
|
76
|
+
{data.promotionFacts.map((p) => (
|
|
77
|
+
<div key={p} style={{ fontSize: 12, color: 'var(--tbox-primary, #e93b3d)', marginTop: 4 }}>
|
|
78
|
+
{p}
|
|
79
|
+
</div>
|
|
80
|
+
))}
|
|
81
|
+
</CardFrame>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function MerchantListCard(props: { data: MerchantListCardData }) {
|
|
86
|
+
const { data } = props;
|
|
87
|
+
if (data.items.length === 0) {
|
|
88
|
+
return <CardFrame title="门店列表">{data.noResultsReason ?? '暂无门店'}</CardFrame>;
|
|
89
|
+
}
|
|
90
|
+
return (
|
|
91
|
+
<CardFrame title="门店列表" subtitle={data.summary}>
|
|
92
|
+
<ul style={listStyle}>
|
|
93
|
+
{data.items.map((item) => (
|
|
94
|
+
<li key={item.merchantId} style={itemStyle}>
|
|
95
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
96
|
+
<span style={{ fontSize: 14, fontWeight: 600 }}>{item.name}</span>
|
|
97
|
+
<StatusPill tone={item.status.code === 'enabled' ? 'success' : 'warning'} text={item.status.label} />
|
|
98
|
+
</div>
|
|
99
|
+
<ValueText label="位置" value={item.location.displayText} />
|
|
100
|
+
{item.promotionFacts.length > 0 && (
|
|
101
|
+
<div style={{ fontSize: 12, color: 'var(--tbox-primary, #e93b3d)' }}>
|
|
102
|
+
{item.promotionFacts.join(' · ')}
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
</li>
|
|
106
|
+
))}
|
|
107
|
+
</ul>
|
|
108
|
+
</CardFrame>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function MerchantDetailCard(props: { data: MerchantDetailCardData }) {
|
|
113
|
+
const { data } = props;
|
|
114
|
+
return (
|
|
115
|
+
<CardFrame title={data.name} subtitle={data.brand}>
|
|
116
|
+
<StatusPill tone={data.status.code === 'enabled' ? 'success' : 'warning'} text={data.status.label} />
|
|
117
|
+
<ValueText label="位置" value={data.location.displayText} />
|
|
118
|
+
<ValueText label="业态" value={data.businessCategories.join(' / ')} />
|
|
119
|
+
{data.description && <div style={{ fontSize: 13, marginTop: 6 }}>{data.description}</div>}
|
|
120
|
+
{data.contactInfo?.map((c, i) => (
|
|
121
|
+
<ValueText key={i} label={c.channel} value={c.value} />
|
|
122
|
+
))}
|
|
123
|
+
{data.promotionFacts.map((p) => (
|
|
124
|
+
<div key={p} style={{ fontSize: 12, color: 'var(--tbox-primary, #e93b3d)', marginTop: 4 }}>
|
|
125
|
+
{p}
|
|
126
|
+
</div>
|
|
127
|
+
))}
|
|
128
|
+
</CardFrame>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function CategoryListCard(props: { data: CategoryListCardData }) {
|
|
133
|
+
const { data } = props;
|
|
134
|
+
return (
|
|
135
|
+
<CardFrame title="业态分类">
|
|
136
|
+
<ul style={listStyle}>
|
|
137
|
+
{data.categories.map((c) => (
|
|
138
|
+
<li key={c.code} style={itemStyle}>
|
|
139
|
+
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
140
|
+
<span style={{ fontSize: 14, fontWeight: 600 }}>{c.name}</span>
|
|
141
|
+
<span style={{ fontSize: 12, color: 'var(--tbox-text-secondary, #888)' }}>
|
|
142
|
+
{c.merchantCount} 家
|
|
143
|
+
</span>
|
|
144
|
+
</div>
|
|
145
|
+
{c.subCategories && c.subCategories.length > 0 && (
|
|
146
|
+
<div style={{ fontSize: 12, color: 'var(--tbox-text-secondary, #888)', marginTop: 2 }}>
|
|
147
|
+
{c.subCategories.map((s) => s.name).join(' / ')}
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
150
|
+
</li>
|
|
151
|
+
))}
|
|
152
|
+
</ul>
|
|
153
|
+
</CardFrame>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function ProductComparisonCard(props: { data: ProductComparisonCardData }) {
|
|
158
|
+
const { data } = props;
|
|
159
|
+
return (
|
|
160
|
+
<CardFrame title="商品对比">
|
|
161
|
+
{data.products.map((p) => (
|
|
162
|
+
<div key={p.productId} style={itemStyle}>
|
|
163
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
164
|
+
<span style={{ fontSize: 14, fontWeight: 600 }}>{p.name}</span>
|
|
165
|
+
<span style={{ fontSize: 14, color: 'var(--tbox-primary, #e93b3d)' }}>
|
|
166
|
+
{p.price.sale?.display ?? '—'}
|
|
167
|
+
</span>
|
|
168
|
+
</div>
|
|
169
|
+
<ValueText label="库存" value={p.availability.label} />
|
|
170
|
+
{p.attributes.map((a) => (
|
|
171
|
+
<ValueText key={a.name} label={a.name} value={a.value} />
|
|
172
|
+
))}
|
|
173
|
+
</div>
|
|
174
|
+
))}
|
|
175
|
+
</CardFrame>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function MallDirectoryCard(props: { data: MallDirectoryCardData }) {
|
|
180
|
+
const { data } = props;
|
|
181
|
+
return (
|
|
182
|
+
<CardFrame title={`${data.mallName} · 楼层目录`}>
|
|
183
|
+
{data.buildings.map((b) => (
|
|
184
|
+
<div key={b.buildingCode} style={{ marginBottom: 8 }}>
|
|
185
|
+
<div style={{ fontSize: 14, fontWeight: 600, marginBottom: 4 }}>{b.buildingName}</div>
|
|
186
|
+
{b.floors.map((f) => (
|
|
187
|
+
<div key={f.floorCode} style={{ display: 'flex', justifyContent: 'space-between', padding: '3px 0' }}>
|
|
188
|
+
<span style={{ fontSize: 13 }}>{f.floorName}</span>
|
|
189
|
+
<span style={{ fontSize: 12, color: 'var(--tbox-text-secondary, #888)' }}>
|
|
190
|
+
{f.businessCategories.join(' / ') || `${f.merchantCount} 家`}
|
|
191
|
+
</span>
|
|
192
|
+
</div>
|
|
193
|
+
))}
|
|
194
|
+
</div>
|
|
195
|
+
))}
|
|
196
|
+
</CardFrame>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function NearbyMallListCard(props: { data: NearbyMallListCardData }) {
|
|
201
|
+
const { data } = props;
|
|
202
|
+
if (data.malls.length === 0) return <CardFrame title="附近商场">暂无附近商场</CardFrame>;
|
|
203
|
+
return (
|
|
204
|
+
<CardFrame title="附近商场">
|
|
205
|
+
{data.malls.map((m) => (
|
|
206
|
+
<div key={m.mallId} style={itemStyle}>
|
|
207
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
208
|
+
<span style={{ fontSize: 14, fontWeight: 600 }}>{m.name}</span>
|
|
209
|
+
<StatusPill tone={m.status.code === 'open' ? 'success' : 'neutral'} text={m.status.label} />
|
|
210
|
+
</div>
|
|
211
|
+
<ValueText label="地址" value={m.address} />
|
|
212
|
+
{m.distanceKm !== undefined && <ValueText label="距离" value={`${m.distanceKm.toFixed(1)} km`} />}
|
|
213
|
+
</div>
|
|
214
|
+
))}
|
|
215
|
+
</CardFrame>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function CustomerServiceFaqCard(props: { data: CustomerServiceFaqCardData }) {
|
|
220
|
+
const { data } = props;
|
|
221
|
+
if (data.faqs.length === 0) {
|
|
222
|
+
return <CardFrame title="客服FAQ">{data.noResultsReason ?? '未找到相关常见问题'}</CardFrame>;
|
|
223
|
+
}
|
|
224
|
+
return (
|
|
225
|
+
<CardFrame title="相关常见问题">
|
|
226
|
+
{data.faqs.map((f, i) => (
|
|
227
|
+
<div key={i} style={itemStyle}>
|
|
228
|
+
<div style={{ fontSize: 13, fontWeight: 600 }}>{f.question}</div>
|
|
229
|
+
<div style={{ fontSize: 13, marginTop: 4 }}>{f.answer}</div>
|
|
230
|
+
</div>
|
|
231
|
+
))}
|
|
232
|
+
</CardFrame>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function HumanGuideListCard(props: { data: HumanGuideListCardData }) {
|
|
237
|
+
const { data } = props;
|
|
238
|
+
return (
|
|
239
|
+
<CardFrame title={`${data.merchantName} · 人工导购`}>
|
|
240
|
+
{data.guides.length === 0 ? (
|
|
241
|
+
<div style={{ fontSize: 13 }}>暂无导购员信息</div>
|
|
242
|
+
) : (
|
|
243
|
+
data.guides.map((g) => (
|
|
244
|
+
<div key={g.guideId} style={itemStyle}>
|
|
245
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
|
|
246
|
+
<span style={{ fontSize: 14, fontWeight: 600 }}>{g.name}</span>
|
|
247
|
+
<StatusPill tone={g.available ? 'success' : 'neutral'} text={g.available ? '在线' : '离线'} />
|
|
248
|
+
</div>
|
|
249
|
+
{g.title && <div style={{ fontSize: 12, color: 'var(--tbox-text-secondary, #888)' }}>{g.title}</div>}
|
|
250
|
+
</div>
|
|
251
|
+
))
|
|
252
|
+
)}
|
|
253
|
+
</CardFrame>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export function LocationHandoffCard(props: { data: LocationHandoffCardData }) {
|
|
258
|
+
const { data } = props;
|
|
259
|
+
return (
|
|
260
|
+
<CardFrame title={`${data.merchantName} · 位置`}>
|
|
261
|
+
<ValueText label="位置" value={data.location.displayText} />
|
|
262
|
+
{data.location.buildingName && <ValueText label="楼栋" value={data.location.buildingName} />}
|
|
263
|
+
{data.location.floorName && <ValueText label="楼层" value={data.location.floorName} />}
|
|
264
|
+
{data.location.unitName && <ValueText label="铺位" value={data.location.unitName} />}
|
|
265
|
+
</CardFrame>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* module-shopping-guide 客户端入口(与服务端 serverModule 对称)。
|
|
3
|
+
*/
|
|
4
|
+
import type { CardComponent } from '@tbox.cn/app-contracts';
|
|
5
|
+
import type { ClientContext, ClientModule } from '@tbox.cn/app-sdk/client';
|
|
6
|
+
import {
|
|
7
|
+
ProductListCard,
|
|
8
|
+
ProductDetailCard,
|
|
9
|
+
MerchantListCard,
|
|
10
|
+
MerchantDetailCard,
|
|
11
|
+
CategoryListCard,
|
|
12
|
+
ProductComparisonCard,
|
|
13
|
+
MallDirectoryCard,
|
|
14
|
+
NearbyMallListCard,
|
|
15
|
+
CustomerServiceFaqCard,
|
|
16
|
+
HumanGuideListCard,
|
|
17
|
+
LocationHandoffCard,
|
|
18
|
+
} from './cards';
|
|
19
|
+
|
|
20
|
+
const cards = {
|
|
21
|
+
'product-list': ProductListCard as CardComponent,
|
|
22
|
+
'product-detail': ProductDetailCard as CardComponent,
|
|
23
|
+
'merchant-list': MerchantListCard as CardComponent,
|
|
24
|
+
'merchant-detail': MerchantDetailCard as CardComponent,
|
|
25
|
+
'category-list': CategoryListCard as CardComponent,
|
|
26
|
+
'product-comparison': ProductComparisonCard as CardComponent,
|
|
27
|
+
'mall-directory': MallDirectoryCard as CardComponent,
|
|
28
|
+
'nearby-mall-list': NearbyMallListCard as CardComponent,
|
|
29
|
+
'customer-service-faq': CustomerServiceFaqCard as CardComponent,
|
|
30
|
+
'human-guide-list': HumanGuideListCard as CardComponent,
|
|
31
|
+
'location-handoff': LocationHandoffCard as CardComponent,
|
|
32
|
+
} as const;
|
|
33
|
+
|
|
34
|
+
export const clientModule = {
|
|
35
|
+
cards,
|
|
36
|
+
register(ctx: ClientContext): void {
|
|
37
|
+
ctx.cards.registerMap(cards);
|
|
38
|
+
},
|
|
39
|
+
} satisfies ClientModule;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CardMeta } from '@tbox.cn/app-contracts';
|
|
2
|
+
import { categoryListCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
3
|
+
import { nowIso } from '../../domain/value-objects';
|
|
4
|
+
|
|
5
|
+
const meta: CardMeta<typeof categoryListCardDataSchema> = {
|
|
6
|
+
cardType: 'category-list',
|
|
7
|
+
dataSchema: categoryListCardDataSchema,
|
|
8
|
+
allowedTools: ['list-categories'],
|
|
9
|
+
displayName: '业态分类目录',
|
|
10
|
+
description: '商场全部业态分类(餐饮/零售/娱乐等)',
|
|
11
|
+
sampleData: {
|
|
12
|
+
categories: [{ code: 'c1', name: '餐饮', merchantCount: 42 }],
|
|
13
|
+
observedAt: nowIso(),
|
|
14
|
+
},
|
|
15
|
+
priority: 100,
|
|
16
|
+
schemaVersion: 1,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CardMeta } from '@tbox.cn/app-contracts';
|
|
2
|
+
import { customerServiceFaqCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
3
|
+
|
|
4
|
+
const meta: CardMeta<typeof customerServiceFaqCardDataSchema> = {
|
|
5
|
+
cardType: 'customer-service-faq',
|
|
6
|
+
dataSchema: customerServiceFaqCardDataSchema,
|
|
7
|
+
allowedTools: ['customer-service-faq'],
|
|
8
|
+
displayName: '客服FAQ',
|
|
9
|
+
description: '常见问题答案(退换货/积分/停车政策)',
|
|
10
|
+
sampleData: {
|
|
11
|
+
query: '如何退换货',
|
|
12
|
+
faqs: [{ question: '如何退换货', answer: '凭小票 7 天内可退换。', relevanceScore: 0.9 }],
|
|
13
|
+
},
|
|
14
|
+
priority: 100,
|
|
15
|
+
schemaVersion: 1,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CardMeta } from '@tbox.cn/app-contracts';
|
|
2
|
+
import { humanGuideListCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
3
|
+
|
|
4
|
+
const meta: CardMeta<typeof humanGuideListCardDataSchema> = {
|
|
5
|
+
cardType: 'human-guide-list',
|
|
6
|
+
dataSchema: humanGuideListCardDataSchema,
|
|
7
|
+
allowedTools: ['list-human-guides'],
|
|
8
|
+
displayName: '人工导购',
|
|
9
|
+
description: '指定门店可联系的导购员列表',
|
|
10
|
+
sampleData: {
|
|
11
|
+
merchantId: 'm1',
|
|
12
|
+
merchantName: '示例门店',
|
|
13
|
+
guides: [{ guideId: 'g1', name: '小导', available: true, itemActions: [] }],
|
|
14
|
+
},
|
|
15
|
+
priority: 100,
|
|
16
|
+
schemaVersion: 1,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 导购 11 卡 meta 聚合导出(每卡一个 meta.ts,doctor AST 约定)。
|
|
3
|
+
*/
|
|
4
|
+
import productListMeta from './product-list/meta';
|
|
5
|
+
import productDetailMeta from './product-detail/meta';
|
|
6
|
+
import merchantListMeta from './merchant-list/meta';
|
|
7
|
+
import merchantDetailMeta from './merchant-detail/meta';
|
|
8
|
+
import categoryListMeta from './category-list/meta';
|
|
9
|
+
import productComparisonMeta from './product-comparison/meta';
|
|
10
|
+
import mallDirectoryMeta from './mall-directory/meta';
|
|
11
|
+
import nearbyMallListMeta from './nearby-mall-list/meta';
|
|
12
|
+
import customerServiceFaqMeta from './customer-service-faq/meta';
|
|
13
|
+
import humanGuideListMeta from './human-guide-list/meta';
|
|
14
|
+
import locationHandoffMeta from './location-handoff/meta';
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
productListMeta,
|
|
18
|
+
productDetailMeta,
|
|
19
|
+
merchantListMeta,
|
|
20
|
+
merchantDetailMeta,
|
|
21
|
+
categoryListMeta,
|
|
22
|
+
productComparisonMeta,
|
|
23
|
+
mallDirectoryMeta,
|
|
24
|
+
nearbyMallListMeta,
|
|
25
|
+
customerServiceFaqMeta,
|
|
26
|
+
humanGuideListMeta,
|
|
27
|
+
locationHandoffMeta,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** 11 卡 meta map(key 约定 = cardType) */
|
|
31
|
+
export const shoppingGuideCards = {
|
|
32
|
+
'product-list': productListMeta,
|
|
33
|
+
'product-detail': productDetailMeta,
|
|
34
|
+
'merchant-list': merchantListMeta,
|
|
35
|
+
'merchant-detail': merchantDetailMeta,
|
|
36
|
+
'category-list': categoryListMeta,
|
|
37
|
+
'product-comparison': productComparisonMeta,
|
|
38
|
+
'mall-directory': mallDirectoryMeta,
|
|
39
|
+
'nearby-mall-list': nearbyMallListMeta,
|
|
40
|
+
'customer-service-faq': customerServiceFaqMeta,
|
|
41
|
+
'human-guide-list': humanGuideListMeta,
|
|
42
|
+
'location-handoff': locationHandoffMeta,
|
|
43
|
+
} as const;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CardMeta } from '@tbox.cn/app-contracts';
|
|
2
|
+
import { locationHandoffCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
3
|
+
|
|
4
|
+
const meta: CardMeta<typeof locationHandoffCardDataSchema> = {
|
|
5
|
+
cardType: 'location-handoff',
|
|
6
|
+
dataSchema: locationHandoffCardDataSchema,
|
|
7
|
+
allowedTools: ['get-location'],
|
|
8
|
+
displayName: '位置导航',
|
|
9
|
+
description: '门店位置与导航能力',
|
|
10
|
+
sampleData: {
|
|
11
|
+
merchantId: 'm1',
|
|
12
|
+
merchantName: '示例门店',
|
|
13
|
+
location: { displayText: 'A 栋 3 楼 301' },
|
|
14
|
+
itemActions: [],
|
|
15
|
+
},
|
|
16
|
+
priority: 110,
|
|
17
|
+
schemaVersion: 1,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CardMeta } from '@tbox.cn/app-contracts';
|
|
2
|
+
import { mallDirectoryCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
3
|
+
import { nowIso } from '../../domain/value-objects';
|
|
4
|
+
|
|
5
|
+
const meta: CardMeta<typeof mallDirectoryCardDataSchema> = {
|
|
6
|
+
cardType: 'mall-directory',
|
|
7
|
+
dataSchema: mallDirectoryCardDataSchema,
|
|
8
|
+
allowedTools: ['mall-directory'],
|
|
9
|
+
displayName: '商场楼层目录',
|
|
10
|
+
description: '楼栋-楼层结构(几楼有什么)',
|
|
11
|
+
sampleData: {
|
|
12
|
+
mallId: 'mall-1',
|
|
13
|
+
mallName: '示例商场',
|
|
14
|
+
buildings: [
|
|
15
|
+
{
|
|
16
|
+
buildingCode: 'A',
|
|
17
|
+
buildingName: 'A 栋',
|
|
18
|
+
floors: [{ floorCode: '3F', floorName: '3 楼', businessCategories: ['餐饮'], merchantCount: 12 }],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
observedAt: nowIso(),
|
|
22
|
+
},
|
|
23
|
+
priority: 100,
|
|
24
|
+
schemaVersion: 1,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CardMeta } from '@tbox.cn/app-contracts';
|
|
2
|
+
import { merchantDetailCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
3
|
+
import { nowIso } from '../../domain/value-objects';
|
|
4
|
+
|
|
5
|
+
const meta: CardMeta<typeof merchantDetailCardDataSchema> = {
|
|
6
|
+
cardType: 'merchant-detail',
|
|
7
|
+
dataSchema: merchantDetailCardDataSchema,
|
|
8
|
+
allowedTools: ['get-merchant'],
|
|
9
|
+
displayName: '门店详情',
|
|
10
|
+
description: '单个门店完整快照(图片/简介/联系方式)',
|
|
11
|
+
sampleData: {
|
|
12
|
+
merchantId: 'm1',
|
|
13
|
+
name: '示例门店',
|
|
14
|
+
coverUrls: [],
|
|
15
|
+
businessCategories: ['餐饮'],
|
|
16
|
+
location: { displayText: 'A 栋 3 楼' },
|
|
17
|
+
status: { code: 'enabled', label: '营业中', observedAt: nowIso() },
|
|
18
|
+
services: [],
|
|
19
|
+
promotionFacts: [],
|
|
20
|
+
evidence: [],
|
|
21
|
+
itemActions: [],
|
|
22
|
+
},
|
|
23
|
+
priority: 80,
|
|
24
|
+
schemaVersion: 1,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|