@tbox.cn/app-module-promotion 0.9.4 → 0.10.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-promotion",
3
- "version": "0.9.4",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "商圈营销模块:资格校验、推荐降级链、券卡(codegen 源)。",
6
6
  "exports": {
@@ -18,9 +18,9 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@tbox.cn/app-contracts": "0.10.0",
22
- "@tbox.cn/app-contracts-mall": "0.10.0",
23
- "@tbox.cn/app-sdk": "0.19.0",
21
+ "@tbox.cn/app-contracts": "0.11.0",
22
+ "@tbox.cn/app-contracts-mall": "0.11.0",
23
+ "@tbox.cn/app-sdk": "0.20.0",
24
24
  "jsbarcode": "^3.12.3",
25
25
  "qrcode": "^1.5.4"
26
26
  },
@@ -69,7 +69,7 @@ const cards = {
69
69
  } as const;
70
70
 
71
71
  /**
72
- * 文件加载式 skill(009 两形态之二;模板 module-weather 同款):
72
+ * 文件加载式 skill(009 两形态之二;模块 skills/ 目录文件即唯一源):
73
73
  * 顶层 await loadModuleSkills → 填回声明式通道(装配端 registerAll 自动注册)。
74
74
  * codegen 展开改写约定:第一参随包名改写(@tbox.cn/app-module-promotion → @app/module-promotion)。
75
75
  */
package/tbox.module.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "module-promotion",
4
+ "title": "营销中心",
5
+ "description": "活动、优惠、权益、套餐查询与券领取,最划算计算",
4
6
  "version": "0.3.0",
5
7
  "kind": "business",
6
8
  "risk": {
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  function requestContext(mallId = 'mall-demo'): RequestContext {
21
21
  return {
22
- identity: { userId: 'u_1001', source: 'dev' },
22
+ identity: { userId: 'u_1001', source: 'local' },
23
23
  credentials: { provider: 'dev', token: 'user-token' },
24
24
  attributes: { mall: { miniAppId: 'app', mallId } },
25
25
  };
@@ -57,7 +57,7 @@ const q = { scope: { miniAppId: 'app', mallId: 'mall-1' }, subjectId: 'u_1' } as
57
57
 
58
58
  /** 上下文统一化:显式缝——reqCtx 由调用方透传(handle 第四参 / 工具 execute 第二参) */
59
59
  const testRequestContext = (userId = 'u_1') => ({
60
- identity: { userId, source: 'dev' as const },
60
+ identity: { userId, source: 'local' as const },
61
61
  attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } },
62
62
  });
63
63
 
@@ -310,7 +310,7 @@ describe('promotion 确定性意图路由', () => {
310
310
 
311
311
  it('“最近有什么营销活动”只返回活动卡,不经过会员积分候选卡', async () => {
312
312
  const ctx = createServerContext();
313
- const reqCtx = { identity: { userId: 'u_activity', source: 'dev' as const }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } };
313
+ const reqCtx = { identity: { userId: 'u_activity', source: 'local' as const }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } };
314
314
  const handler = createPromotionIntentHandler(ctx);
315
315
 
316
316
  expect(handler.intents?.flatMap((intent) => intent.patterns)).toEqual(
@@ -610,7 +610,7 @@ describe('createPromotionActions.acquire(actions 层闭环)', () => {
610
610
  providers: { resolve: async () => { throw new Error('no provider'); } },
611
611
  }) as never;
612
612
  const reqCtx = (userId: string) =>
613
- ({ identity: { userId, source: 'dev' }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } }) as never;
613
+ ({ identity: { userId, source: 'local' }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } }) as never;
614
614
 
615
615
  it('会员门禁:not_enrolled 拦截且不触 promotion 服务(门禁先于幂等占位;深链解耦后恒带卡)', async () => {
616
616
  vi.mocked(resolvePromotionAcquisitionPort).mockClear();
@@ -803,7 +803,7 @@ describe("M1' 承接:券详情收口到列表浮层", () => {
803
803
  const ctxFake = {
804
804
  auth: {
805
805
  getContext: () => ({
806
- identity: { userId: 'u_1', source: 'dev' },
806
+ identity: { userId: 'u_1', source: 'local' },
807
807
  attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } },
808
808
  }),
809
809
  },
@@ -832,7 +832,7 @@ describe('会员门禁(TIER1 门禁闭环,SPEC-3)', () => {
832
832
  const ctxWithGate = (factory: unknown) =>
833
833
  ({ services: { resolve: (key: string) => (key === 'member.status' ? factory : undefined) } }) as never;
834
834
  const reqCtxOf = (userId = 'u_gate') =>
835
- ({ identity: { userId, source: 'dev' as const }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } }) as never;
835
+ ({ identity: { userId, source: 'local' as const }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } }) as never;
836
836
  const execCtx = (userId = 'u_gate') => createToolExecContext(reqCtxOf(userId)) as never;
837
837
 
838
838
  it('listEntitlements:not_enrolled + enrollUrl → 出 member-enrollment-cta 且 found:false', async () => {