@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.
@@ -7,7 +7,7 @@ import {
7
7
  resolvePromotionEntitlementsPort,
8
8
  resolvePromotionOffersPort,
9
9
  serverModule
10
- } from "../chunk-AI3K2MST.js";
10
+ } from "../chunk-ONDEOXMY.js";
11
11
  export {
12
12
  InMemoryPromotionService,
13
13
  inMemoryPromotion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-promotion",
3
- "version": "0.10.3",
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.0",
22
- "@tbox.cn/app-contracts-mall": "0.12.1",
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.1",
26
- "@tbox.cn/app-agent-sdk-server": "0.1.1"
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"
@@ -1,5 +1,5 @@
1
1
  /**
2
- * module-promotion 客户端卡片聚合(0.4.0 D6:一卡一目录)。
2
+ * module-promotion 客户端卡片聚合(0.4.0 一卡一目录)。
3
3
  */
4
4
  export { default as PromotionOfferListCard } from './promotion-offer-list';
5
5
  export { default as PromotionOfferDetailCard } from './promotion-offer-detail';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * promotion 展示纯函数(0.4.0 D6:状态文案/色调映射,可单测)。
2
+ * promotion 展示纯函数(0.4.0 状态文案/色调映射,可单测)。
3
3
  */
4
4
  export type PromotionTone = 'available' | 'unavailable' | 'succeeded' | 'pending' | 'rejected' | 'neutral';
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 图片 + 加载失败占位(0.4.0 D6:模块自持 ~20 行,禁跨模块依赖/基元封顶不破)。
2
+ * 图片 + 加载失败占位(0.4.0 模块自持 ~20 行,禁跨模块依赖/基元封顶不破)。
3
3
  * 源:POC shopping-guide 占位语义。src 缺省或加载失败 → 图标占位。
4
4
  */
5
5
  import { useState } from 'react';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * module-promotion 客户端入口:9 个稳定传输卡型,renderer 内覆盖多个展示语义。
3
3
  */
4
- import './styles/promotion.css'; // 0.4.0 D1:模块自持 CSS(副作用 import,首行保证先行加载)
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 D1:模块自持 CSS(经 tsup loader: { '.css': 'copy' } 出货,样式在应用侧生效) */
1
+ /** 0.4.0 模块自持 CSS(经 tsup loader: { '.css': 'copy' } 出货,样式在应用侧生效) */
2
2
  declare module '*.css';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * promotion 写动作(015 S6:唯一写动作 acquire;execute 内预检 R3 + member.status 会员门禁)。
2
+ * promotion 写动作(唯一写动作 acquire;execute 内预检 + member.status 会员门禁)。
3
3
  */
4
4
  import { randomUUID } from 'node:crypto';
5
5
  import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
@@ -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: '我的券·空态',
@@ -120,6 +120,7 @@ export const samples: CardSample<PromotionOfferListCardData>[] = [
120
120
  itemActions: claimAction('领取', '会员限定满减优惠券'),
121
121
  }],
122
122
  },
123
+ hidden: true,
123
124
  },
124
125
  {
125
126
  label: '领券·滤掉不可领',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * promotion 意图 handler(015 S6:intents patterns 命中出搜索/推荐卡;写走 acquire 动作)。
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';
@@ -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
- * 可领券问句确定性预执行(W5 P1,2026-09-01):券意图轮零 LLM 预执行出券列表卡。
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
- // 015 S6:唯一写动作 acquire(register 闭包 ctx——SubjectBinding resolveService + 幂等)
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);
@@ -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 等非预期缺席 → 上抛(配置即声明,F5 起无回退)
43
+ throw e; // PROVIDER_NOT_IMPLEMENTED 等非预期缺席 → 上抛(配置即声明, 起无回退)
44
44
  }
45
45
  }
46
46
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * InMemory 营销服务(015 S6:四 Port 演示实现;未装配 provider 降级 + 单测基座)。
2
+ * InMemory 营销服务(四 Port 演示实现;未装配 provider 降级 + 单测基座)。
3
3
  * 演示数据:2 Offer(满减券/团购)+ 1 活动 + entitlements 按 acquire 落账。
4
4
  */
5
5
  import type {
@@ -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 出参快照(数据驱动,F5 起不再模块侧拼装)
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
- // W2(2026-09-01):出卡工具创建点单点 wrap(description 追加预告知句)——
770
+ //(2026-09-01):出卡工具创建点单点 wrap(description 追加预告知句)——
771
771
  // 注册即 wrapped 实例;领券/领取类动作卡带 actions 句。
772
772
  return {
773
773
  listActivityCategories: withCardEmissionHint(listActivityCategories),
@@ -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
  });