@tbox.cn/app-module-promotion 0.10.3 → 0.10.5
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 +6 -8
- package/INTEGRATION.md +25 -0
- package/dist/{chunk-AI3K2MST.js → chunk-ONDEOXMY.js} +4 -2
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +588 -588
- package/dist/server/index.js +1 -1
- package/package.json +7 -6
- package/src/client/cards/index.ts +1 -1
- package/src/client/cards/view.ts +1 -1
- package/src/client/components/ImageWithFallback.tsx +1 -1
- package/src/client/index.ts +1 -1
- package/src/client/types/css.d.ts +1 -1
- package/src/server/actions.ts +1 -1
- package/src/server/cards/promotion-entitlement-list/samples.ts +1 -0
- package/src/server/cards/promotion-offer-list/samples.ts +1 -0
- package/src/server/handler.ts +1 -1
- package/src/server/index.ts +8 -2
- package/src/server/ports.ts +1 -1
- package/src/server/service.ts +1 -1
- package/src/server/tools.ts +2 -2
- package/tests/samples.test.ts +9 -0
package/dist/server/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-module-promotion",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "商圈营销模块:资格校验、推荐降级链、券卡(codegen 源)。",
|
|
6
6
|
"exports": {
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tbox.cn/app-contracts": "0.12.
|
|
22
|
-
"@tbox.cn/app-contracts-mall": "0.12.
|
|
21
|
+
"@tbox.cn/app-contracts": "0.12.3",
|
|
22
|
+
"@tbox.cn/app-contracts-mall": "0.12.4",
|
|
23
23
|
"jsbarcode": "^3.12.3",
|
|
24
24
|
"qrcode": "^1.5.4",
|
|
25
|
-
"@tbox.cn/app-agent-sdk-client": "0.1.
|
|
26
|
-
"@tbox.cn/app-agent-sdk-server": "0.
|
|
25
|
+
"@tbox.cn/app-agent-sdk-client": "0.1.4",
|
|
26
|
+
"@tbox.cn/app-agent-sdk-server": "0.2.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@phosphor-icons/react": "2.1.10",
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"README.md",
|
|
55
55
|
"LICENSE",
|
|
56
56
|
"skills",
|
|
57
|
-
"AGENTS.md"
|
|
57
|
+
"AGENTS.md",
|
|
58
|
+
"INTEGRATION.md"
|
|
58
59
|
],
|
|
59
60
|
"engines": {
|
|
60
61
|
"node": ">=20.0.0"
|
package/src/client/cards/view.ts
CHANGED
package/src/client/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* module-promotion 客户端入口:9 个稳定传输卡型,renderer 内覆盖多个展示语义。
|
|
3
3
|
*/
|
|
4
|
-
import './styles/promotion.css'; // 0.4.0
|
|
4
|
+
import './styles/promotion.css'; // 0.4.0 模块自持 CSS(副作用 import,首行保证先行加载)
|
|
5
5
|
|
|
6
6
|
import type { CardComponent } from '@tbox.cn/app-contracts';
|
|
7
7
|
import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** 0.4.0
|
|
1
|
+
/** 0.4.0 模块自持 CSS(经 tsup loader: { '.css': 'copy' } 出货,样式在应用侧生效) */
|
|
2
2
|
declare module '*.css';
|
package/src/server/actions.ts
CHANGED
|
@@ -41,6 +41,7 @@ export const samples: CardSample<PromotionEntitlementListCardData>[] = [
|
|
|
41
41
|
note: '无图片、长标题和 UNKNOWN 状态的容错形态',
|
|
42
42
|
group: '我的券',
|
|
43
43
|
data: { items: [{ entitlementRef: 'ent:unknown', title: '会员限定超长名称测试|指定商户周末到店消费专享权益', entitlementType: 'COUPON', status: 'UNKNOWN', codeMasked: '**** 0000', benefitText: '满100减20', usageNotice: '使用门店和适用商品请以券详情说明为准', validUntilText: '有效期待品牌方确认' }] },
|
|
44
|
+
hidden: true,
|
|
44
45
|
},
|
|
45
46
|
{
|
|
46
47
|
label: '我的券·空态',
|
package/src/server/handler.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* promotion 意图 handler(
|
|
2
|
+
* promotion 意图 handler(intents patterns 命中出搜索/推荐卡;写走 acquire 动作)。
|
|
3
3
|
*/
|
|
4
4
|
import type { HandlerDefinition, ServerContext } from '@tbox.cn/app-agent-sdk-server';
|
|
5
5
|
import { matchIntent } from '@tbox.cn/app-agent-sdk-server';
|
package/src/server/index.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* module-promotion 服务端入口(双端自注册闭环——见模块 AGENTS.md 与 INTEGRATION.md)。
|
|
3
|
+
* 职责:营销优惠/权益/活动/领取四槽解析 + 营销工具族 + 券/活动卡族 + 领取写动作
|
|
4
|
+
* (会员门禁 + externalMemberRef 解析后调 acquisition)。
|
|
5
|
+
* 入口约定:register 只注册不解析;活动意图先经 alipay-activity 路由策略(未启用放行)。
|
|
6
|
+
*/
|
|
1
7
|
import type { ServerContext, ServerModule, PreToolDef } from '@tbox.cn/app-agent-sdk-server';
|
|
2
8
|
import { definePreTool, getRequestContext, loadModuleSkills } from '@tbox.cn/app-agent-sdk-server';
|
|
3
9
|
import { Router } from 'express';
|
|
@@ -35,7 +41,7 @@ const getCtx = (): ServerContext => {
|
|
|
35
41
|
const tools = createPromotionTools({ getCtx });
|
|
36
42
|
|
|
37
43
|
/**
|
|
38
|
-
* 可领券问句确定性预执行(
|
|
44
|
+
* 可领券问句确定性预执行(2026-09-01):券意图轮零 LLM 预执行出券列表卡。
|
|
39
45
|
* - run = 零参 CLAIMABLE(可领券查询语义,与「有什么券」问词匹配);
|
|
40
46
|
* - OWNED 意图排除:用户说「我的券/已领取/券包」需要 mode=OWNED,交模型精确传参;
|
|
41
47
|
* - silent:不发前端事件;结果 reminder 注入 + cards 经 capture 入本轮候选池;
|
|
@@ -125,7 +131,7 @@ export const serverModule = {
|
|
|
125
131
|
});
|
|
126
132
|
ctx.routes.register('promotion', router);
|
|
127
133
|
|
|
128
|
-
//
|
|
134
|
+
// 唯一写动作 acquire(register 闭包 ctx——SubjectBinding resolveService + 幂等)
|
|
129
135
|
const actions = createPromotionActions(ctx);
|
|
130
136
|
for (const action of Object.values(actions)) {
|
|
131
137
|
ctx.cardActions.register(action);
|
package/src/server/ports.ts
CHANGED
|
@@ -40,7 +40,7 @@ async function resolvePromotionSlot<T>(
|
|
|
40
40
|
})) as T;
|
|
41
41
|
} catch (e) {
|
|
42
42
|
if (isExpectedProviderAbsence(e)) return fallback; // 预期缺席 → InMemory 兜底
|
|
43
|
-
throw e; // PROVIDER_NOT_IMPLEMENTED 等非预期缺席 → 上抛(配置即声明,
|
|
43
|
+
throw e; // PROVIDER_NOT_IMPLEMENTED 等非预期缺席 → 上抛(配置即声明, 起无回退)
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
package/src/server/service.ts
CHANGED
package/src/server/tools.ts
CHANGED
|
@@ -272,7 +272,7 @@ export function activityDetail(
|
|
|
272
272
|
) {
|
|
273
273
|
const start = dateText(detail.startAt);
|
|
274
274
|
const end = dateText(detail.endAt);
|
|
275
|
-
// 报名深链为 provider 出参快照(数据驱动,
|
|
275
|
+
// 报名深链为 provider 出参快照(数据驱动, 起不再模块侧拼装)
|
|
276
276
|
const registrationUrl = detail.registrationUrl;
|
|
277
277
|
return {
|
|
278
278
|
presentation,
|
|
@@ -767,7 +767,7 @@ export function createPromotionTools(opts: { getCtx: () => ServerContext }) {
|
|
|
767
767
|
},
|
|
768
768
|
});
|
|
769
769
|
|
|
770
|
-
|
|
770
|
+
//(2026-09-01):出卡工具创建点单点 wrap(description 追加预告知句)——
|
|
771
771
|
// 注册即 wrapped 实例;领券/领取类动作卡带 actions 句。
|
|
772
772
|
return {
|
|
773
773
|
listActivityCategories: withCardEmissionHint(listActivityCategories),
|
package/tests/samples.test.ts
CHANGED
|
@@ -39,4 +39,13 @@ describe('promotion samples 双断言(样本即契约)', () => {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
it('缺图与 UNKNOWN 降级样本保留质量检查但不进入 Preview', () => {
|
|
44
|
+
expect(
|
|
45
|
+
offerListMeta.samples?.find((sample) => sample.label === '领券·缺图与长文案')?.hidden,
|
|
46
|
+
).toBe(true);
|
|
47
|
+
expect(
|
|
48
|
+
entitlementListMeta.samples?.find((sample) => sample.label === '我的券·缺图长文案')?.hidden,
|
|
49
|
+
).toBe(true);
|
|
50
|
+
});
|
|
42
51
|
});
|