@tbox.cn/app-module-customer-service 1.0.0-alpha.1 → 1.0.0-alpha.7

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 CHANGED
@@ -6,10 +6,10 @@
6
6
  ## 自定义 API 对接(AI 集成)
7
7
 
8
8
  见本包 `INTEGRATION.md`(接入语义真源);实施落点与流程见
9
- `npx --yes @tbox.cn/app-cli skills get integration`(任务路由/材料清单)与
10
- `npx --yes @tbox.cn/app-cli skills get provider-custom`(adapter 实施)。
9
+ `pnpm exec tbox-app skills get integration`(任务路由/材料清单)与
10
+ `pnpm exec tbox-app skills get provider-custom`(adapter 实施)。
11
11
 
12
12
  ## 真实厂商接入
13
13
 
14
- 见本包 `INTEGRATION.md`;官方 provider 包形态:应用态 `npx --yes @tbox.cn/app-cli new provider <name>`(`packages/provider-<id>`
14
+ 见本包 `INTEGRATION.md`;官方 provider 包形态:应用态 `pnpm exec tbox-app new provider <name>`(`packages/provider-<id>`
15
15
  local 形态)/ 仓内发布源 `tbox-app-dev new provider <name>`(`modules/provider-<id>` 发布形态)。
package/README.md CHANGED
@@ -99,5 +99,5 @@ schema 真源与样例数据锚)。
99
99
  在生成应用中:
100
100
 
101
101
  ```sh
102
- npx --yes @tbox.cn/app-cli module add @tbox.cn/app-module-customer-service
102
+ pnpm exec tbox-app module add @tbox.cn/app-module-customer-service
103
103
  ```
@@ -1,6 +1,3 @@
1
- // src/client/index.ts
2
- import "../customer-service-UTQ5AVTL.css";
3
-
4
1
  // src/client/cards/customer-service-faq/index.tsx
5
2
  import { useState } from "react";
6
3
  import { CaretDown, Phone, ArrowSquareOut } from "@phosphor-icons/react";
@@ -12,33 +9,43 @@ function CustomerServiceFaqCard(props) {
12
9
  data.faqs.length > 0 ? 0 : null
13
10
  );
14
11
  if (data.faqs.length === 0) {
15
- return /* @__PURE__ */ jsx("section", { className: "cs-card", children: /* @__PURE__ */ jsx("div", { className: "cs-empty", children: data.noResultsReason ?? "\u672A\u627E\u5230\u76F8\u5173\u5E38\u89C1\u95EE\u9898" }) });
12
+ return /* @__PURE__ */ jsx("section", { className: "cs-card p-5 text-foreground", children: /* @__PURE__ */ jsx("div", { className: "cs-empty mt-2 py-6 text-xs text-muted-foreground", children: data.noResultsReason ?? "\u672A\u627E\u5230\u76F8\u5173\u5E38\u89C1\u95EE\u9898" }) });
16
13
  }
17
- return /* @__PURE__ */ jsxs("section", { className: "cs-card cs-faq", children: [
18
- /* @__PURE__ */ jsx("div", { className: "cs-card-title", children: "\u76F8\u5173\u5E38\u89C1\u95EE\u9898" }),
19
- /* @__PURE__ */ jsx("ul", { className: "cs-faq-list", children: data.faqs.map((f, i) => {
14
+ return /* @__PURE__ */ jsxs("section", { className: "cs-card cs-faq p-5 text-foreground", children: [
15
+ /* @__PURE__ */ jsxs("div", { className: "cs-card-title mb-2 flex items-center gap-2 text-lg font-bold leading-6 text-foreground", children: [
16
+ /* @__PURE__ */ jsx("span", { className: "h-4 w-1 rounded bg-accent", "aria-hidden": "true" }),
17
+ "\u76F8\u5173\u5E38\u89C1\u95EE\u9898"
18
+ ] }),
19
+ /* @__PURE__ */ jsx("ul", { className: "cs-faq-list m-0 list-none p-0", children: data.faqs.map((f, i) => {
20
20
  const open = openIndex === i;
21
- return /* @__PURE__ */ jsxs("li", { className: "cs-faq-item", children: [
21
+ return /* @__PURE__ */ jsxs("li", { className: "cs-faq-item mt-2 overflow-hidden rounded-lg border border-border", children: [
22
22
  /* @__PURE__ */ jsxs(
23
23
  "button",
24
24
  {
25
25
  type: "button",
26
- className: "cs-faq-item__q",
26
+ className: "cs-faq-item__q flex w-full items-center justify-between gap-2 border-0 bg-card p-3 text-left text-sm font-medium text-foreground",
27
27
  "aria-expanded": open,
28
28
  onClick: () => setOpenIndex(open ? null : i),
29
29
  children: [
30
30
  /* @__PURE__ */ jsx("span", { children: f.question }),
31
- /* @__PURE__ */ jsx(CaretDown, { size: 16, className: "cs-faq-item__chevron", "data-rotated": open || void 0 })
31
+ /* @__PURE__ */ jsx(
32
+ CaretDown,
33
+ {
34
+ size: 16,
35
+ className: "cs-faq-item__chevron shrink-0 transition-transform data-[rotated]:rotate-180",
36
+ "data-rotated": open || void 0
37
+ }
38
+ )
32
39
  ]
33
40
  }
34
41
  ),
35
- open && /* @__PURE__ */ jsxs("div", { className: "cs-faq-item__a", children: [
36
- /* @__PURE__ */ jsx("p", { children: f.answer }),
42
+ open && /* @__PURE__ */ jsxs("div", { className: "cs-faq-item__a border-t border-border bg-muted px-3 pb-3", children: [
43
+ /* @__PURE__ */ jsx("p", { className: "pb-1 pt-2.5 text-xs leading-5 text-foreground", children: f.answer }),
37
44
  f.referenceUrl && /* @__PURE__ */ jsxs(
38
45
  "button",
39
46
  {
40
47
  type: "button",
41
- className: "cs-link-btn cs-faq-item__ref",
48
+ className: "cs-link-btn cs-faq-item__ref mt-1 inline-flex items-center gap-1 border-0 bg-transparent p-0 text-sm text-primary underline underline-offset-2",
42
49
  onClick: () => {
43
50
  sendCardAction(cardId, { type: "openLink", url: f.referenceUrl });
44
51
  },
@@ -55,7 +62,7 @@ function CustomerServiceFaqCard(props) {
55
62
  "button",
56
63
  {
57
64
  type: "button",
58
- className: "cs-contact-btn",
65
+ className: "cs-contact-btn mt-3 flex h-10 w-full items-center justify-center gap-1.5 rounded-lg border-2 border-primary-foreground bg-primary-soft text-sm font-medium text-primary",
59
66
  onClick: () => {
60
67
  sendCardAction(cardId, { type: "openLink", url: `tel:${data.contactPhone}` });
61
68
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-customer-service",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.7",
4
4
  "type": "module",
5
5
  "description": "商圈客服承接模块:服务政策 FAQ 知识检索(命中正文作答/无结果联系客服卡)。",
6
6
  "exports": {
@@ -19,10 +19,10 @@
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "dependencies": {
22
- "@tbox.cn/app-contracts": "1.0.0-alpha.1",
23
- "@tbox.cn/app-contracts-mall": "1.0.0-alpha.1",
24
- "@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.1",
25
- "@tbox.cn/app-agent-sdk-server": "1.0.0-alpha.1"
22
+ "@tbox.cn/app-contracts-mall": "1.0.0-alpha.7",
23
+ "@tbox.cn/app-contracts": "1.0.0-alpha.7",
24
+ "@tbox.cn/app-agent-sdk-server": "1.0.0-alpha.7",
25
+ "@tbox.cn/app-agent-sdk-client": "1.0.0-alpha.7"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "zod": "3.25.76",
@@ -60,9 +60,6 @@
60
60
  "access": "public"
61
61
  },
62
62
  "license": "MIT",
63
- "sideEffects": [
64
- "**/*.css"
65
- ],
66
63
  "scripts": {
67
64
  "typecheck": "tsc --noEmit",
68
65
  "test": "vitest run",
@@ -18,33 +18,44 @@ export function CustomerServiceFaqCard(props: {
18
18
  );
19
19
 
20
20
  if (data.faqs.length === 0) {
21
- return <section className="cs-card"><div className="cs-empty">{data.noResultsReason ?? '未找到相关常见问题'}</div></section>;
21
+ return (
22
+ <section className="cs-card p-5 text-foreground">
23
+ <div className="cs-empty mt-2 py-6 text-xs text-muted-foreground">{data.noResultsReason ?? '未找到相关常见问题'}</div>
24
+ </section>
25
+ );
22
26
  }
23
27
 
24
28
  return (
25
- <section className="cs-card cs-faq">
26
- <div className="cs-card-title">相关常见问题</div>
27
- <ul className="cs-faq-list">
29
+ <section className="cs-card cs-faq p-5 text-foreground">
30
+ <div className="cs-card-title mb-2 flex items-center gap-2 text-lg font-bold leading-6 text-foreground">
31
+ <span className="h-4 w-1 rounded bg-accent" aria-hidden="true" />
32
+ 相关常见问题
33
+ </div>
34
+ <ul className="cs-faq-list m-0 list-none p-0">
28
35
  {data.faqs.map((f, i) => {
29
36
  const open = openIndex === i;
30
37
  return (
31
- <li key={i} className="cs-faq-item">
38
+ <li key={i} className="cs-faq-item mt-2 overflow-hidden rounded-lg border border-border">
32
39
  <button
33
40
  type="button"
34
- className="cs-faq-item__q"
41
+ className="cs-faq-item__q flex w-full items-center justify-between gap-2 border-0 bg-card p-3 text-left text-sm font-medium text-foreground"
35
42
  aria-expanded={open}
36
43
  onClick={() => setOpenIndex(open ? null : i)}
37
44
  >
38
45
  <span>{f.question}</span>
39
- <CaretDown size={16} className="cs-faq-item__chevron" data-rotated={open || undefined} />
46
+ <CaretDown
47
+ size={16}
48
+ className="cs-faq-item__chevron shrink-0 transition-transform data-[rotated]:rotate-180"
49
+ data-rotated={open || undefined}
50
+ />
40
51
  </button>
41
52
  {open && (
42
- <div className="cs-faq-item__a">
43
- <p>{f.answer}</p>
53
+ <div className="cs-faq-item__a border-t border-border bg-muted px-3 pb-3">
54
+ <p className="pb-1 pt-2.5 text-xs leading-5 text-foreground">{f.answer}</p>
44
55
  {f.referenceUrl && (
45
56
  <button
46
57
  type="button"
47
- className="cs-link-btn cs-faq-item__ref"
58
+ className="cs-link-btn cs-faq-item__ref mt-1 inline-flex items-center gap-1 border-0 bg-transparent p-0 text-sm text-primary underline underline-offset-2"
48
59
  onClick={() => {
49
60
  sendCardAction(cardId, { type: 'openLink', url: f.referenceUrl! });
50
61
  }}
@@ -62,7 +73,7 @@ export function CustomerServiceFaqCard(props: {
62
73
  {data.contactPhone && (
63
74
  <button
64
75
  type="button"
65
- className="cs-contact-btn"
76
+ className="cs-contact-btn mt-3 flex h-10 w-full items-center justify-center gap-1.5 rounded-lg border-2 border-primary-foreground bg-primary-soft text-sm font-medium text-primary"
66
77
  onClick={() => {
67
78
  sendCardAction(cardId, { type: 'openLink', url: `tel:${data.contactPhone}` });
68
79
  }}
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * module-customer-service 客户端入口(与服务端 serverModule 对称)。
3
3
  */
4
- import './styles/customer-service.css'; // 模块自持 CSS(副作用 import,首行保证先行加载)
5
-
6
4
  import type { CardComponent } from '@tbox.cn/app-contracts';
7
5
  import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
8
6
  import { CustomerServiceFaqCard } from './cards';
package/tbox.module.json CHANGED
@@ -3,7 +3,6 @@
3
3
  "id": "module-customer-service",
4
4
  "name": "客服问答",
5
5
  "description": "根据商场知识库解答营业时间、服务政策和办事流程等常见问题",
6
- "version": "0.1.0",
7
6
  "kind": "business",
8
7
  "risk": {
9
8
  "level": "low",
package/tsup.config.ts CHANGED
@@ -27,9 +27,6 @@ export default defineConfig({
27
27
  'express',
28
28
  '@phosphor-icons/react',
29
29
  ],
30
- loader: {
31
- '.css': 'copy',
32
- },
33
30
  esbuildOptions(options) {
34
31
  options.jsx = 'automatic';
35
32
  },
@@ -1,141 +0,0 @@
1
- /* ============================================================
2
- * module-customer-service 客户端域样式(自 module-shopping-guide 迁入,
3
- * 2026-08-31 客服模块拆分;类名 sg- → cs-,模块自持 CSS 零跨模块共享)。
4
- * 视觉源:mall-vis 导购蓝系延续(FAQ 卡原 sg-faq 视觉 1:1 迁移)。
5
- * 机械规则:大写 PX 不转;rgba() 传统语法;禁 color-mix / !important;直引 --tbox-* 恒带 fallback;域专属视觉走域变量。
6
- * ============================================================ */
7
-
8
- /* ===== 域变量 ===== */
9
- .cs-card {
10
- --cs-accent: #096bfa;
11
- --cs-surface: #f7faff;
12
- --cs-accent-border: #cfe0f7;
13
- --cs-text-2: var(--tbox-text-secondary, #888);
14
- --cs-text-3: var(--tbox-muted, #aaa);
15
- --cs-border: var(--tbox-border, #ececec);
16
- --cs-bg-subtle: var(--tbox-bg-subtle, #f7f7f7);
17
- }
18
-
19
- /* ===== 卡根 ===== */
20
- .cs-card {
21
- box-sizing: border-box;
22
- padding: 40px;
23
- color: var(--tbox-text-primary, #202124);
24
- font: inherit;
25
- }
26
- .cs-card *,
27
- .cs-card *::before,
28
- .cs-card *::after {
29
- box-sizing: border-box;
30
- }
31
- .cs-card button {
32
- cursor: pointer;
33
- }
34
- .cs-card button:disabled {
35
- cursor: not-allowed;
36
- opacity: 0.5;
37
- }
38
- .cs-card ul,
39
- .cs-card ol,
40
- .cs-card dl,
41
- .cs-card dd,
42
- .cs-card dt,
43
- .cs-card p {
44
- margin: 0;
45
- padding: 0;
46
- list-style: none;
47
- }
48
-
49
- /* ===== 布局 ===== */
50
- .cs-card-title {
51
- display: flex;
52
- align-items: center;
53
- gap: 16px;
54
- font-size: 34px;
55
- font-weight: 700;
56
- line-height: 48px;
57
- margin-bottom: 16px;
58
- color: var(--tbox-text-primary, #202124);
59
- }
60
- .cs-card-title::before {
61
- content: '';
62
- flex: 0 0 8px;
63
- width: 8px;
64
- height: 32px;
65
- border-radius: 4px;
66
- background: var(--cs-accent);
67
- }
68
- .cs-empty {
69
- padding: 48px 0;
70
- margin-top: 16px;
71
- font-size: 22px;
72
- color: var(--cs-text-3);
73
- }
74
- .cs-link-btn {
75
- display: inline-flex;
76
- align-items: center;
77
- gap: 8px;
78
- padding: 0;
79
- border: 0;
80
- background: transparent;
81
- color: var(--cs-accent);
82
- font-size: 26px;
83
- text-decoration: underline;
84
- text-underline-offset: 4px;
85
- }
86
-
87
- /* ===== customer-service-faq ===== */
88
- .cs-faq-item {
89
- border: 1px solid var(--cs-border);
90
- border-radius: 20px;
91
- margin-top: 16px;
92
- overflow: hidden;
93
- }
94
- .cs-faq-item__q {
95
- display: flex;
96
- align-items: center;
97
- justify-content: space-between;
98
- gap: 16px;
99
- width: 100%;
100
- padding: 24px;
101
- border: 0;
102
- background: var(--tbox-bg-card, #fff);
103
- color: var(--tbox-text-primary, #202124);
104
- font-size: 28px;
105
- font-weight: 500;
106
- text-align: left;
107
- }
108
- .cs-faq-item__chevron[data-rotated] {
109
- transform: rotate(180deg);
110
- transition: transform 0.15s ease;
111
- }
112
- .cs-faq-item__a {
113
- padding: 0 24px 24px;
114
- border-top: 1px solid var(--cs-border);
115
- background: var(--cs-bg-subtle);
116
- }
117
- .cs-faq-item__a p {
118
- padding: 20px 0 8px;
119
- font-size: 26px;
120
- line-height: 40px;
121
- color: var(--tbox-text-primary, #202124);
122
- }
123
- .cs-faq-item__ref {
124
- margin-top: 8px;
125
- font-size: 24px;
126
- }
127
- .cs-contact-btn {
128
- display: flex;
129
- align-items: center;
130
- justify-content: center;
131
- gap: 12px;
132
- width: 100%;
133
- margin-top: 24px;
134
- height: 80px;
135
- border-radius: 18px;
136
- border: 2px solid var(--cs-accent-border);
137
- color: var(--cs-accent);
138
- background: var(--cs-surface);
139
- font-size: 28px;
140
- font-weight: 500;
141
- }
@@ -1,141 +0,0 @@
1
- /* ============================================================
2
- * module-customer-service 客户端域样式(自 module-shopping-guide 迁入,
3
- * 2026-08-31 客服模块拆分;类名 sg- → cs-,模块自持 CSS 零跨模块共享)。
4
- * 视觉源:mall-vis 导购蓝系延续(FAQ 卡原 sg-faq 视觉 1:1 迁移)。
5
- * 机械规则:大写 PX 不转;rgba() 传统语法;禁 color-mix / !important;直引 --tbox-* 恒带 fallback;域专属视觉走域变量。
6
- * ============================================================ */
7
-
8
- /* ===== 域变量 ===== */
9
- .cs-card {
10
- --cs-accent: #096bfa;
11
- --cs-surface: #f7faff;
12
- --cs-accent-border: #cfe0f7;
13
- --cs-text-2: var(--tbox-text-secondary, #888);
14
- --cs-text-3: var(--tbox-muted, #aaa);
15
- --cs-border: var(--tbox-border, #ececec);
16
- --cs-bg-subtle: var(--tbox-bg-subtle, #f7f7f7);
17
- }
18
-
19
- /* ===== 卡根 ===== */
20
- .cs-card {
21
- box-sizing: border-box;
22
- padding: 40px;
23
- color: var(--tbox-text-primary, #202124);
24
- font: inherit;
25
- }
26
- .cs-card *,
27
- .cs-card *::before,
28
- .cs-card *::after {
29
- box-sizing: border-box;
30
- }
31
- .cs-card button {
32
- cursor: pointer;
33
- }
34
- .cs-card button:disabled {
35
- cursor: not-allowed;
36
- opacity: 0.5;
37
- }
38
- .cs-card ul,
39
- .cs-card ol,
40
- .cs-card dl,
41
- .cs-card dd,
42
- .cs-card dt,
43
- .cs-card p {
44
- margin: 0;
45
- padding: 0;
46
- list-style: none;
47
- }
48
-
49
- /* ===== 布局 ===== */
50
- .cs-card-title {
51
- display: flex;
52
- align-items: center;
53
- gap: 16px;
54
- font-size: 34px;
55
- font-weight: 700;
56
- line-height: 48px;
57
- margin-bottom: 16px;
58
- color: var(--tbox-text-primary, #202124);
59
- }
60
- .cs-card-title::before {
61
- content: '';
62
- flex: 0 0 8px;
63
- width: 8px;
64
- height: 32px;
65
- border-radius: 4px;
66
- background: var(--cs-accent);
67
- }
68
- .cs-empty {
69
- padding: 48px 0;
70
- margin-top: 16px;
71
- font-size: 22px;
72
- color: var(--cs-text-3);
73
- }
74
- .cs-link-btn {
75
- display: inline-flex;
76
- align-items: center;
77
- gap: 8px;
78
- padding: 0;
79
- border: 0;
80
- background: transparent;
81
- color: var(--cs-accent);
82
- font-size: 26px;
83
- text-decoration: underline;
84
- text-underline-offset: 4px;
85
- }
86
-
87
- /* ===== customer-service-faq ===== */
88
- .cs-faq-item {
89
- border: 1px solid var(--cs-border);
90
- border-radius: 20px;
91
- margin-top: 16px;
92
- overflow: hidden;
93
- }
94
- .cs-faq-item__q {
95
- display: flex;
96
- align-items: center;
97
- justify-content: space-between;
98
- gap: 16px;
99
- width: 100%;
100
- padding: 24px;
101
- border: 0;
102
- background: var(--tbox-bg-card, #fff);
103
- color: var(--tbox-text-primary, #202124);
104
- font-size: 28px;
105
- font-weight: 500;
106
- text-align: left;
107
- }
108
- .cs-faq-item__chevron[data-rotated] {
109
- transform: rotate(180deg);
110
- transition: transform 0.15s ease;
111
- }
112
- .cs-faq-item__a {
113
- padding: 0 24px 24px;
114
- border-top: 1px solid var(--cs-border);
115
- background: var(--cs-bg-subtle);
116
- }
117
- .cs-faq-item__a p {
118
- padding: 20px 0 8px;
119
- font-size: 26px;
120
- line-height: 40px;
121
- color: var(--tbox-text-primary, #202124);
122
- }
123
- .cs-faq-item__ref {
124
- margin-top: 8px;
125
- font-size: 24px;
126
- }
127
- .cs-contact-btn {
128
- display: flex;
129
- align-items: center;
130
- justify-content: center;
131
- gap: 12px;
132
- width: 100%;
133
- margin-top: 24px;
134
- height: 80px;
135
- border-radius: 18px;
136
- border: 2px solid var(--cs-accent-border);
137
- color: var(--cs-accent);
138
- background: var(--cs-surface);
139
- font-size: 28px;
140
- font-weight: 500;
141
- }