@tbox.cn/app-module-promotion 0.1.0 → 0.2.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.
@@ -3,7 +3,7 @@ import { CardMeta } from '@tbox.cn/app-contracts';
3
3
  import * as zod from 'zod';
4
4
  import { z } from 'zod';
5
5
  import { ServerContext } from '@tbox.cn/app-sdk/server';
6
- import { PromotionQueryPort, MemberQueryPort, Coupon } from '@tbox.cn/app-contracts-mall';
6
+ import { PromotionQueryPort, MemberBenefitsPort, Coupon } from '@tbox.cn/app-contracts-mall';
7
7
 
8
8
  /** PromotionService:营销资格与发券 */
9
9
  interface PromotionService extends PromotionQueryPort {
@@ -14,7 +14,7 @@ interface PromotionService extends PromotionQueryPort {
14
14
  */
15
15
  declare class InMemoryPromotionService implements PromotionService {
16
16
  private getMember;
17
- constructor(getMember: () => MemberQueryPort | undefined);
17
+ constructor(getMember: () => MemberBenefitsPort | undefined);
18
18
  queryEligibleCoupons(userId: string): Promise<Coupon[]>;
19
19
  }
20
20
 
@@ -25,14 +25,14 @@ declare const dataSchema: z.ZodObject<{
25
25
  status: z.ZodEnum<["AVAILABLE", "USED", "EXPIRED"]>;
26
26
  }, "strip", z.ZodTypeAny, {
27
27
  status: "AVAILABLE" | "USED" | "EXPIRED";
28
- couponId: string;
29
- title: string;
30
28
  amount: number;
29
+ title: string;
30
+ couponId: string;
31
31
  }, {
32
32
  status: "AVAILABLE" | "USED" | "EXPIRED";
33
- couponId: string;
34
- title: string;
35
33
  amount: number;
34
+ title: string;
35
+ couponId: string;
36
36
  }>;
37
37
  declare const meta: CardMeta<typeof dataSchema>;
38
38
 
@@ -46,14 +46,14 @@ declare const serverModule: {
46
46
  status: zod.ZodEnum<["AVAILABLE", "USED", "EXPIRED"]>;
47
47
  }, "strip", zod.ZodTypeAny, {
48
48
  status: "AVAILABLE" | "USED" | "EXPIRED";
49
- couponId: string;
50
- title: string;
51
49
  amount: number;
50
+ title: string;
51
+ couponId: string;
52
52
  }, {
53
53
  status: "AVAILABLE" | "USED" | "EXPIRED";
54
- couponId: string;
55
- title: string;
56
54
  amount: number;
55
+ title: string;
56
+ couponId: string;
57
57
  }>>;
58
58
  };
59
59
  register(ctx: ServerContext): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-promotion",
3
- "version": "0.1.0",
3
+ "version": "0.2.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-sdk": "^0.1.0",
21
+ "@tbox.cn/app-sdk": "^0.2.0",
22
22
  "@tbox.cn/app-contracts": "^0.1.0",
23
- "@tbox.cn/app-contracts-mall": "^0.1.0"
23
+ "@tbox.cn/app-contracts-mall": "^0.2.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "zod": "^3.24.0",
@@ -1,5 +1,5 @@
1
1
  import type { ServerContext, ServerModule } from '@tbox.cn/app-sdk/server';
2
- import type { MemberQueryPort } from '@tbox.cn/app-contracts-mall';
2
+ import type { MemberBenefitsPort } from '@tbox.cn/app-contracts-mall';
3
3
  import { InMemoryPromotionService } from './service';
4
4
  import couponMeta from './cards/coupon/meta';
5
5
  import { createPromotionHandler } from './handler';
@@ -27,7 +27,7 @@ export const serverModule = {
27
27
  currentCtx = ctx;
28
28
  if (!promotionSingleton) {
29
29
  promotionSingleton = new InMemoryPromotionService(() =>
30
- currentCtx?.resolveService<MemberQueryPort>('member'),
30
+ currentCtx?.resolveService<MemberBenefitsPort>('member'),
31
31
  );
32
32
  }
33
33
  const promotion = promotionSingleton;
@@ -1,5 +1,5 @@
1
1
  import type { Coupon } from '@tbox.cn/app-contracts-mall';
2
- import type { MemberQueryPort, PromotionQueryPort } from '@tbox.cn/app-contracts-mall';
2
+ import type { MemberBenefitsPort, PromotionQueryPort } from '@tbox.cn/app-contracts-mall';
3
3
 
4
4
  /** PromotionService:营销资格与发券 */
5
5
  export interface PromotionService extends PromotionQueryPort {}
@@ -9,7 +9,7 @@ export interface PromotionService extends PromotionQueryPort {}
9
9
  * 通过注入 getMember 访问会员数据,不依赖 member 实现包(结构类型子集接口)。
10
10
  */
11
11
  export class InMemoryPromotionService implements PromotionService {
12
- constructor(private getMember: () => MemberQueryPort | undefined) {}
12
+ constructor(private getMember: () => MemberBenefitsPort | undefined) {}
13
13
 
14
14
  async queryEligibleCoupons(userId: string): Promise<Coupon[]> {
15
15
  const member = this.getMember();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "module-promotion",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "kind": "business",
6
6
  "risk": { "level": "low", "writeBoundary": "source" },
7
7
  "distribution": { "defaultMode": "codegen" },