@tbox.cn/app-contracts-mall 0.14.0 → 0.17.2

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.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * 活动玩法·个人奖品查询 Port(activity-play.prizes 槽——任务07)。
3
+ * 语义:使用当前商圈解析出的授权商家业务连接 + 可信 subjectId(= identity.userId 原值
4
+ * 同值传递,任务06 约定)查询本人中奖记录列表/详情;厂商 wire 词汇不进本层。
5
+ * 结构类型子集接口——provider 包 adapter 实现,消费方(业务模块)仅依赖本契约包。
6
+ *
7
+ * 范围纪律(供给方/消费方共同遵守):
8
+ * - subjectId 必填在场(本人查询语义);缺用户由消费方在**调用 provider 前**显性认证失败
9
+ * (先失败后调供给——缺用户时零奖品 API 调用);
10
+ * - subjectId 不是支付宝 user_id/OpenID/会员号的别名——供应商须明确按该值查询,并与插件
11
+ * 参与发奖使用同一值;
12
+ * - 详情须由上游按商家+玩家范围查询或归属校验保证本人可见——知道记录标识 ≠ 可读取,
13
+ * 不可见记录与不存在同返回 null(不区分泄露他人记录);
14
+ * - 活动枚举/活动白名单/活动当前状态都**不是**本 Port 的前置(活动结束、下架或活动接口
15
+ * 故障不影响本人奖品查询);
16
+ * - 仅供应商成功确认无记录 → total=0/items=[];供应商失败上抛,不得伪装空结果;
17
+ * - 复用与活动查询同一商家业务连接(消费方不另行建第二套凭据/连接/活动登记)。
18
+ */
19
+ import type { ActivityPlayPrizeDetail, ActivityPlayPrizeListResult } from '../domain/activity-play-prize';
20
+ import type { MallQueryContext } from '../query-context';
21
+ export declare const ACTIVITY_PLAY_PRIZES_SERVICE = "activity-play.prizes";
22
+ /**
23
+ * 奖品查询上下文(MallQueryContext 的本人查询形态:subjectId 必填——由消费方经
24
+ * toMallQueryContext + 严格主体检查组装,值与 identity.userId 原值相等)。
25
+ */
26
+ export type ActivityPlayPrizeQueryContext = MallQueryContext & {
27
+ /** 当前用户 userid 原值(不数字化/不加去前缀/不重哈希) */
28
+ readonly subjectId: string;
29
+ };
30
+ /** activity-play.prizes 槽供给端口(provider 包 adapter 实现) */
31
+ export interface ActivityPlayPrizeQueryPort {
32
+ /** 本人奖品列表(供应商成功确认无记录 → total=0/items=[];失败上抛供给错误) */
33
+ listMyPrizes(q: ActivityPlayPrizeQueryContext): Promise<ActivityPlayPrizeListResult>;
34
+ /** 本人奖品详情(记录不存在或对当前用户/商家不可见 → null;失败上抛供给错误) */
35
+ getMyPrizeDetail(q: ActivityPlayPrizeQueryContext, prizeRecordRef: string): Promise<ActivityPlayPrizeDetail | null>;
36
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * 活动玩法 Port(activity-play.query 查询契约 + activity-play.entry 入口准备契约——task-03)。
3
+ * 语义独立于营销域(promotion.*):本包只描述「本系统登记的活动目录」的查询与参与入口
4
+ * 登记,不承诺报名/场次/发奖/票券/远端同步。厂商 wire 词汇不进本层。
5
+ * 结构类型子集接口——provider 包 adapter 实现,消费方(业务模块)仅依赖契约包。
6
+ *
7
+ * 两槽一致性联检(评审判据「活动 DTO 相同不足以证明供给一致」):Port 实例**可选**
8
+ * 携带 `supplyBinding`(registry 绑定键 + 供给归一目录指纹)——消费方(入口准备)比对
9
+ * 两槽签名,不相等或任一侧缺席 = 不可证同源 → fail-closed ENTRY_UNAVAILABLE;
10
+ * provider 名/impl 为 registry 绑定键词汇(非厂商字面量)。
11
+ */
12
+ import type { MallQueryContext } from '../query-context';
13
+ import type { ActivityPlayActivity, ActivityPlayEntryRecord, ActivityPlayPage } from '../domain/activity-play';
14
+ export declare const ACTIVITY_PLAY_QUERY_SERVICE = "activity-play.query";
15
+ export declare const ACTIVITY_PLAY_ENTRY_SERVICE = "activity-play.entry";
16
+ /** 查询上下文(三域同形——module 直接复用 toMallQueryContext 组合子即可组装) */
17
+ export type ActivityPlayQueryContext = MallQueryContext & {
18
+ /** 主体由登录态归一(source !== 'anonymous' 本包才写入;此处仅供类型消费方读取) */
19
+ readonly subjectId?: string;
20
+ };
21
+ /** 列表查询输入(本期为有限本地目录,无远端分页协议) */
22
+ export interface ActivityPlayListInput {
23
+ /** 名称/说明关键词匹配(实现方负责大小写与空白归一) */
24
+ readonly keyword?: string;
25
+ /** 数量上限:缺省 20、范围 1—50(越界由实现方按契约钳制或拒绝) */
26
+ readonly limit?: number;
27
+ }
28
+ /**
29
+ * activity-play.query 槽供给端口(provider 包 adapter 实现)。
30
+ * - listActivities:按登记顺序返回;隐藏停用(disabled)活动是列表语义的一部分;
31
+ * 空目录(配置完整、零活动)返回空 items 而非错误;
32
+ * - getActivity:活动引用精确查;不存在返回 null;停用活动照常返回(状态 = disabled)。
33
+ * status 由实现方按服务端时间计算(单源助手 activityPlayStatusOf)。
34
+ */
35
+ /**
36
+ * 供给一致性联检签名(可选成员——两 Port 同构):
37
+ * - `provider`/`implementation`:registry 绑定双键(供给方自持常量——非厂商字面量词汇);
38
+ * - `directoryHash`:供给归一目录的稳定指纹(含 entry 目标——目录键序无关化):
39
+ * 同一供给的两槽求值(同 binding、同合并目录)恒相等;槽级/实例级覆盖造成目录分叉
40
+ * (同活动字段不同 entry 目标)或绑定分叉(不同 provider/implementation)即不相等。
41
+ */
42
+ export interface ActivityPlaySupplyBinding {
43
+ readonly provider: string;
44
+ readonly implementation: string;
45
+ readonly directoryHash: string;
46
+ }
47
+ export interface ActivityPlayQueryPort {
48
+ listActivities(q: ActivityPlayQueryContext, input: ActivityPlayListInput): Promise<ActivityPlayPage>;
49
+ getActivity(q: ActivityPlayQueryContext, activityRef: string): Promise<ActivityPlayActivity | null>;
50
+ /** 可选:两槽一致性联检签名(entry 消费方比对;缺席 = 不可证一致→fail-closed) */
51
+ readonly supplyBinding?: ActivityPlaySupplyBinding;
52
+ }
53
+ export interface ActivityPlayEntryPort {
54
+ /**
55
+ * 按可信上下文与 activityRef 读取入口登记:返回 entry 侧目录条目视图
56
+ * (该供给同 ref 的活动属性 + 结构化目标),消费方做两槽一致性比对后出站;
57
+ * 该 ref 无 entry 登记 → null(缺失与未配置由消费方以 ENTRY_UNAVAILABLE /
58
+ * NOT_CONFIGURED 区分——槽未配置在 resolveService 阶段即显性失败)。
59
+ */
60
+ getEntry(q: ActivityPlayQueryContext, activityRef: string): Promise<ActivityPlayEntryRecord | null>;
61
+ /** 可选:两槽一致性联检签名(消费方与 query 侧实例比对;缺席 = 不可证一致→fail-closed) */
62
+ readonly supplyBinding?: ActivityPlaySupplyBinding;
63
+ }
@@ -196,13 +196,13 @@ export declare const pageInfoSchema: z.ZodObject<{
196
196
  hasMore: z.ZodBoolean;
197
197
  }, "strip", z.ZodTypeAny, {
198
198
  page: number;
199
- pageSize: number;
200
199
  total: number;
200
+ pageSize: number;
201
201
  hasMore: boolean;
202
202
  }, {
203
203
  page: number;
204
- pageSize: number;
205
204
  total: number;
205
+ pageSize: number;
206
206
  hasMore: boolean;
207
207
  }>;
208
208
  export declare const refinementSchema: z.ZodObject<{
@@ -562,13 +562,13 @@ export declare const productListCardDataSchema: z.ZodObject<{
562
562
  hasMore: z.ZodBoolean;
563
563
  }, "strip", z.ZodTypeAny, {
564
564
  page: number;
565
- pageSize: number;
566
565
  total: number;
566
+ pageSize: number;
567
567
  hasMore: boolean;
568
568
  }, {
569
569
  page: number;
570
- pageSize: number;
571
570
  total: number;
571
+ pageSize: number;
572
572
  hasMore: boolean;
573
573
  }>>;
574
574
  refinements: z.ZodArray<z.ZodObject<{
@@ -582,7 +582,6 @@ export declare const productListCardDataSchema: z.ZodObject<{
582
582
  queryText: string;
583
583
  }>, "many">;
584
584
  }, "strip", z.ZodTypeAny, {
585
- context: "recommendation" | "search" | "similar" | "history";
586
585
  items: {
587
586
  name: string;
588
587
  merchant: {
@@ -648,6 +647,7 @@ export declare const productListCardDataSchema: z.ZodObject<{
648
647
  expiresAt?: string | undefined;
649
648
  }[] | undefined;
650
649
  }[];
650
+ context: "recommendation" | "search" | "similar" | "history";
651
651
  refinements: {
652
652
  label: string;
653
653
  queryText: string;
@@ -656,12 +656,11 @@ export declare const productListCardDataSchema: z.ZodObject<{
656
656
  noResultsReason?: string | undefined;
657
657
  pageInfo?: {
658
658
  page: number;
659
- pageSize: number;
660
659
  total: number;
660
+ pageSize: number;
661
661
  hasMore: boolean;
662
662
  } | undefined;
663
663
  }, {
664
- context: "recommendation" | "search" | "similar" | "history";
665
664
  items: {
666
665
  name: string;
667
666
  merchant: {
@@ -727,6 +726,7 @@ export declare const productListCardDataSchema: z.ZodObject<{
727
726
  expiresAt?: string | undefined;
728
727
  }[] | undefined;
729
728
  }[];
729
+ context: "recommendation" | "search" | "similar" | "history";
730
730
  refinements: {
731
731
  label: string;
732
732
  queryText: string;
@@ -735,8 +735,8 @@ export declare const productListCardDataSchema: z.ZodObject<{
735
735
  noResultsReason?: string | undefined;
736
736
  pageInfo?: {
737
737
  page: number;
738
- pageSize: number;
739
738
  total: number;
739
+ pageSize: number;
740
740
  hasMore: boolean;
741
741
  } | undefined;
742
742
  }>;
@@ -1037,13 +1037,13 @@ export declare const shopListCardDataSchema: z.ZodObject<{
1037
1037
  hasMore: z.ZodBoolean;
1038
1038
  }, "strip", z.ZodTypeAny, {
1039
1039
  page: number;
1040
- pageSize: number;
1041
1040
  total: number;
1041
+ pageSize: number;
1042
1042
  hasMore: boolean;
1043
1043
  }, {
1044
1044
  page: number;
1045
- pageSize: number;
1046
1045
  total: number;
1046
+ pageSize: number;
1047
1047
  hasMore: boolean;
1048
1048
  }>>;
1049
1049
  refinements: z.ZodArray<z.ZodObject<{
@@ -1057,7 +1057,6 @@ export declare const shopListCardDataSchema: z.ZodObject<{
1057
1057
  queryText: string;
1058
1058
  }>, "many">;
1059
1059
  }, "strip", z.ZodTypeAny, {
1060
- context: "recommendation" | "search";
1061
1060
  items: {
1062
1061
  status: {
1063
1062
  code: "enabled" | "unknown" | "disabled";
@@ -1119,6 +1118,7 @@ export declare const shopListCardDataSchema: z.ZodObject<{
1119
1118
  offerRef?: string | undefined;
1120
1119
  }[] | undefined;
1121
1120
  }[];
1121
+ context: "recommendation" | "search";
1122
1122
  refinements: {
1123
1123
  label: string;
1124
1124
  queryText: string;
@@ -1129,8 +1129,8 @@ export declare const shopListCardDataSchema: z.ZodObject<{
1129
1129
  noResultsReason?: string | undefined;
1130
1130
  pageInfo?: {
1131
1131
  page: number;
1132
- pageSize: number;
1133
1132
  total: number;
1133
+ pageSize: number;
1134
1134
  hasMore: boolean;
1135
1135
  } | undefined;
1136
1136
  categoryTabs?: {
@@ -1138,7 +1138,6 @@ export declare const shopListCardDataSchema: z.ZodObject<{
1138
1138
  name: string;
1139
1139
  }[] | undefined;
1140
1140
  }, {
1141
- context: "recommendation" | "search";
1142
1141
  items: {
1143
1142
  status: {
1144
1143
  code: "enabled" | "unknown" | "disabled";
@@ -1200,6 +1199,7 @@ export declare const shopListCardDataSchema: z.ZodObject<{
1200
1199
  offerRef?: string | undefined;
1201
1200
  }[] | undefined;
1202
1201
  }[];
1202
+ context: "recommendation" | "search";
1203
1203
  refinements: {
1204
1204
  label: string;
1205
1205
  queryText: string;
@@ -1210,8 +1210,8 @@ export declare const shopListCardDataSchema: z.ZodObject<{
1210
1210
  noResultsReason?: string | undefined;
1211
1211
  pageInfo?: {
1212
1212
  page: number;
1213
- pageSize: number;
1214
1213
  total: number;
1214
+ pageSize: number;
1215
1215
  hasMore: boolean;
1216
1216
  } | undefined;
1217
1217
  categoryTabs?: {
@@ -1518,13 +1518,13 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
1518
1518
  hasMore: z.ZodBoolean;
1519
1519
  }, "strip", z.ZodTypeAny, {
1520
1520
  page: number;
1521
- pageSize: number;
1522
1521
  total: number;
1522
+ pageSize: number;
1523
1523
  hasMore: boolean;
1524
1524
  }, {
1525
1525
  page: number;
1526
- pageSize: number;
1527
1526
  total: number;
1527
+ pageSize: number;
1528
1528
  hasMore: boolean;
1529
1529
  }>>;
1530
1530
  refinements: z.ZodArray<z.ZodObject<{
@@ -1538,7 +1538,6 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
1538
1538
  queryText: string;
1539
1539
  }>, "many">;
1540
1540
  }, "strip", z.ZodTypeAny, {
1541
- context: "recommendation" | "search";
1542
1541
  items: {
1543
1542
  status: {
1544
1543
  code: "enabled" | "unknown" | "disabled";
@@ -1600,6 +1599,7 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
1600
1599
  offerRef?: string | undefined;
1601
1600
  }[] | undefined;
1602
1601
  }[];
1602
+ context: "recommendation" | "search";
1603
1603
  refinements: {
1604
1604
  label: string;
1605
1605
  queryText: string;
@@ -1610,8 +1610,8 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
1610
1610
  noResultsReason?: string | undefined;
1611
1611
  pageInfo?: {
1612
1612
  page: number;
1613
- pageSize: number;
1614
1613
  total: number;
1614
+ pageSize: number;
1615
1615
  hasMore: boolean;
1616
1616
  } | undefined;
1617
1617
  categoryTabs?: {
@@ -1619,7 +1619,6 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
1619
1619
  name: string;
1620
1620
  }[] | undefined;
1621
1621
  }, {
1622
- context: "recommendation" | "search";
1623
1622
  items: {
1624
1623
  status: {
1625
1624
  code: "enabled" | "unknown" | "disabled";
@@ -1681,6 +1680,7 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
1681
1680
  offerRef?: string | undefined;
1682
1681
  }[] | undefined;
1683
1682
  }[];
1683
+ context: "recommendation" | "search";
1684
1684
  refinements: {
1685
1685
  label: string;
1686
1686
  queryText: string;
@@ -1691,8 +1691,8 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
1691
1691
  noResultsReason?: string | undefined;
1692
1692
  pageInfo?: {
1693
1693
  page: number;
1694
- pageSize: number;
1695
1694
  total: number;
1695
+ pageSize: number;
1696
1696
  hasMore: boolean;
1697
1697
  } | undefined;
1698
1698
  categoryTabs?: {
@@ -3915,7 +3915,6 @@ export declare const recommendMerchantsCardDataSchema: z.ZodObject<{
3915
3915
  noResultsReason: z.ZodOptional<z.ZodString>;
3916
3916
  observedAt: z.ZodString;
3917
3917
  }, "strip", z.ZodTypeAny, {
3918
- observedAt: string;
3919
3918
  items: {
3920
3919
  status: {
3921
3920
  code: "enabled" | "unknown" | "disabled";
@@ -3956,6 +3955,7 @@ export declare const recommendMerchantsCardDataSchema: z.ZodObject<{
3956
3955
  rating?: string | undefined;
3957
3956
  avgSpend?: string | undefined;
3958
3957
  }[];
3958
+ observedAt: string;
3959
3959
  summary?: string | undefined;
3960
3960
  noResultsReason?: string | undefined;
3961
3961
  categoryTabs?: {
@@ -3963,7 +3963,6 @@ export declare const recommendMerchantsCardDataSchema: z.ZodObject<{
3963
3963
  name: string;
3964
3964
  }[] | undefined;
3965
3965
  }, {
3966
- observedAt: string;
3967
3966
  items: {
3968
3967
  status: {
3969
3968
  code: "enabled" | "unknown" | "disabled";
@@ -4004,6 +4003,7 @@ export declare const recommendMerchantsCardDataSchema: z.ZodObject<{
4004
4003
  rating?: string | undefined;
4005
4004
  avgSpend?: string | undefined;
4006
4005
  }[];
4006
+ observedAt: string;
4007
4007
  summary?: string | undefined;
4008
4008
  noResultsReason?: string | undefined;
4009
4009
  categoryTabs?: {
@@ -4354,13 +4354,13 @@ export declare const shoppingGuideCardDataSchemas: {
4354
4354
  hasMore: z.ZodBoolean;
4355
4355
  }, "strip", z.ZodTypeAny, {
4356
4356
  page: number;
4357
- pageSize: number;
4358
4357
  total: number;
4358
+ pageSize: number;
4359
4359
  hasMore: boolean;
4360
4360
  }, {
4361
4361
  page: number;
4362
- pageSize: number;
4363
4362
  total: number;
4363
+ pageSize: number;
4364
4364
  hasMore: boolean;
4365
4365
  }>>;
4366
4366
  refinements: z.ZodArray<z.ZodObject<{
@@ -4374,7 +4374,6 @@ export declare const shoppingGuideCardDataSchemas: {
4374
4374
  queryText: string;
4375
4375
  }>, "many">;
4376
4376
  }, "strip", z.ZodTypeAny, {
4377
- context: "recommendation" | "search" | "similar" | "history";
4378
4377
  items: {
4379
4378
  name: string;
4380
4379
  merchant: {
@@ -4440,6 +4439,7 @@ export declare const shoppingGuideCardDataSchemas: {
4440
4439
  expiresAt?: string | undefined;
4441
4440
  }[] | undefined;
4442
4441
  }[];
4442
+ context: "recommendation" | "search" | "similar" | "history";
4443
4443
  refinements: {
4444
4444
  label: string;
4445
4445
  queryText: string;
@@ -4448,12 +4448,11 @@ export declare const shoppingGuideCardDataSchemas: {
4448
4448
  noResultsReason?: string | undefined;
4449
4449
  pageInfo?: {
4450
4450
  page: number;
4451
- pageSize: number;
4452
4451
  total: number;
4452
+ pageSize: number;
4453
4453
  hasMore: boolean;
4454
4454
  } | undefined;
4455
4455
  }, {
4456
- context: "recommendation" | "search" | "similar" | "history";
4457
4456
  items: {
4458
4457
  name: string;
4459
4458
  merchant: {
@@ -4519,6 +4518,7 @@ export declare const shoppingGuideCardDataSchemas: {
4519
4518
  expiresAt?: string | undefined;
4520
4519
  }[] | undefined;
4521
4520
  }[];
4521
+ context: "recommendation" | "search" | "similar" | "history";
4522
4522
  refinements: {
4523
4523
  label: string;
4524
4524
  queryText: string;
@@ -4527,8 +4527,8 @@ export declare const shoppingGuideCardDataSchemas: {
4527
4527
  noResultsReason?: string | undefined;
4528
4528
  pageInfo?: {
4529
4529
  page: number;
4530
- pageSize: number;
4531
4530
  total: number;
4531
+ pageSize: number;
4532
4532
  hasMore: boolean;
4533
4533
  } | undefined;
4534
4534
  }>;
@@ -5159,13 +5159,13 @@ export declare const shoppingGuideCardDataSchemas: {
5159
5159
  hasMore: z.ZodBoolean;
5160
5160
  }, "strip", z.ZodTypeAny, {
5161
5161
  page: number;
5162
- pageSize: number;
5163
5162
  total: number;
5163
+ pageSize: number;
5164
5164
  hasMore: boolean;
5165
5165
  }, {
5166
5166
  page: number;
5167
- pageSize: number;
5168
5167
  total: number;
5168
+ pageSize: number;
5169
5169
  hasMore: boolean;
5170
5170
  }>>;
5171
5171
  refinements: z.ZodArray<z.ZodObject<{
@@ -5179,7 +5179,6 @@ export declare const shoppingGuideCardDataSchemas: {
5179
5179
  queryText: string;
5180
5180
  }>, "many">;
5181
5181
  }, "strip", z.ZodTypeAny, {
5182
- context: "recommendation" | "search";
5183
5182
  items: {
5184
5183
  status: {
5185
5184
  code: "enabled" | "unknown" | "disabled";
@@ -5241,6 +5240,7 @@ export declare const shoppingGuideCardDataSchemas: {
5241
5240
  offerRef?: string | undefined;
5242
5241
  }[] | undefined;
5243
5242
  }[];
5243
+ context: "recommendation" | "search";
5244
5244
  refinements: {
5245
5245
  label: string;
5246
5246
  queryText: string;
@@ -5251,8 +5251,8 @@ export declare const shoppingGuideCardDataSchemas: {
5251
5251
  noResultsReason?: string | undefined;
5252
5252
  pageInfo?: {
5253
5253
  page: number;
5254
- pageSize: number;
5255
5254
  total: number;
5255
+ pageSize: number;
5256
5256
  hasMore: boolean;
5257
5257
  } | undefined;
5258
5258
  categoryTabs?: {
@@ -5260,7 +5260,6 @@ export declare const shoppingGuideCardDataSchemas: {
5260
5260
  name: string;
5261
5261
  }[] | undefined;
5262
5262
  }, {
5263
- context: "recommendation" | "search";
5264
5263
  items: {
5265
5264
  status: {
5266
5265
  code: "enabled" | "unknown" | "disabled";
@@ -5322,6 +5321,7 @@ export declare const shoppingGuideCardDataSchemas: {
5322
5321
  offerRef?: string | undefined;
5323
5322
  }[] | undefined;
5324
5323
  }[];
5324
+ context: "recommendation" | "search";
5325
5325
  refinements: {
5326
5326
  label: string;
5327
5327
  queryText: string;
@@ -5332,8 +5332,8 @@ export declare const shoppingGuideCardDataSchemas: {
5332
5332
  noResultsReason?: string | undefined;
5333
5333
  pageInfo?: {
5334
5334
  page: number;
5335
- pageSize: number;
5336
5335
  total: number;
5336
+ pageSize: number;
5337
5337
  hasMore: boolean;
5338
5338
  } | undefined;
5339
5339
  categoryTabs?: {
@@ -6939,7 +6939,6 @@ export declare const shoppingGuideCardDataSchemas: {
6939
6939
  noResultsReason: z.ZodOptional<z.ZodString>;
6940
6940
  observedAt: z.ZodString;
6941
6941
  }, "strip", z.ZodTypeAny, {
6942
- observedAt: string;
6943
6942
  items: {
6944
6943
  status: {
6945
6944
  code: "enabled" | "unknown" | "disabled";
@@ -6980,6 +6979,7 @@ export declare const shoppingGuideCardDataSchemas: {
6980
6979
  rating?: string | undefined;
6981
6980
  avgSpend?: string | undefined;
6982
6981
  }[];
6982
+ observedAt: string;
6983
6983
  summary?: string | undefined;
6984
6984
  noResultsReason?: string | undefined;
6985
6985
  categoryTabs?: {
@@ -6987,7 +6987,6 @@ export declare const shoppingGuideCardDataSchemas: {
6987
6987
  name: string;
6988
6988
  }[] | undefined;
6989
6989
  }, {
6990
- observedAt: string;
6991
6990
  items: {
6992
6991
  status: {
6993
6992
  code: "enabled" | "unknown" | "disabled";
@@ -7028,6 +7027,7 @@ export declare const shoppingGuideCardDataSchemas: {
7028
7027
  rating?: string | undefined;
7029
7028
  avgSpend?: string | undefined;
7030
7029
  }[];
7030
+ observedAt: string;
7031
7031
  summary?: string | undefined;
7032
7032
  noResultsReason?: string | undefined;
7033
7033
  categoryTabs?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-contracts-mall",
3
- "version": "0.14.0",
3
+ "version": "0.17.2",
4
4
  "type": "module",
5
5
  "description": "商圈领域契约(TIER1,types + runtime):Port 接口 + MallEventMap + 领域 DTO + scope/装配器运行时。",
6
6
  "exports": {
@@ -0,0 +1,32 @@
1
+ /**
2
+ * 活动玩法域卡片数据契约(task-02 服务端出卡)。
3
+ * 单一稳定 CardType `activity-play`,mode 区分列表/详情传输形态——视觉由前端渲染器
4
+ * 按 mode 组织,传输层不拆分多卡型(与 promotion 域 9 卡型形态区分)。
5
+ * 条目复用 activityPlayActivitySchema(含 B 端 enabled 剥离——卡data 不带配置字段)。
6
+ * 信封字段(卡片 ID/时间戳/历史标记/版本)由 SDK 生成,不在本契约。
7
+ */
8
+ import { z } from 'zod';
9
+ import { activityPlayActivitySchema } from '../domain/activity-play';
10
+
11
+ /** 卡片数据(工具出卡 / 前端渲染双层共用契约面) */
12
+ export const activityPlayCardDataSchema = z
13
+ .object({
14
+ /** 商圈标识:来自当前执行上下文 scope,非模型输入或硬编码值 */
15
+ mallId: z.string().min(1),
16
+ /** 传输形态:list(列表,可空,≤50 项)/ detail(详情,恰好 1 项,可携 disabled) */
17
+ mode: z.enum(['list', 'detail']),
18
+ /** 活动条目(契约单源 ActivityPlayActivity;不带 enabled 配置字段)——list 可空 ≤50 项 */
19
+ items: z.array(activityPlayActivitySchema).max(50),
20
+ })
21
+ .superRefine((data, ctx) => {
22
+ if (data.mode === 'detail' && data.items.length !== 1) {
23
+ ctx.addIssue({
24
+ code: z.ZodIssueCode.custom,
25
+ path: ['items'],
26
+ message: 'detail 模式 items 恰好 1 项(空或多项均非法)',
27
+ });
28
+ }
29
+ });
30
+
31
+ /** 卡片数据类型(zod 推断;客户端渲染器与工具出卡共用类型面) */
32
+ export type ActivityPlayCardData = z.infer<typeof activityPlayCardDataSchema>;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * 个人奖品域卡片数据契约(任务07——本人奖品列表/详情两张稳定卡型)。
3
+ * 与活动域「单一 cardType + mode」形态区分:奖品按 api.md 卡片表为两张独立卡型
4
+ *(列表含 itemActions 标准动作 / 详情平铺),传输层不共用 mode。
5
+ *
6
+ * 分层纪律:HTTP 业务 DTO 只含奖品事实(domain 单源,条目数跟随供应商返回不加展示上限);
7
+ * itemActions、noResultsReason、truncated 是卡片适配层补充字段,仅出现在本卡片契约面
8
+ * ——不回写 DTO、不透传厂商原始 JSON。列表动作沿既有 actionDraftSchema(shared/cards
9
+ * 单源)的 send 形态:value 携带准确中奖记录标识、visibleValue 可用可读名称;信封字段
10
+ * 由 SDK 卡片框架承载,不在本契约。
11
+ */
12
+ import { z } from 'zod';
13
+ import { actionDraftSchema } from '../shared/cards';
14
+ import {
15
+ activityPlayPrizeDetailSchema,
16
+ activityPlayPrizeRecordSchema,
17
+ } from '../domain/activity-play-prize';
18
+
19
+ /** 本人奖品列表卡型(列表查询工具出卡) */
20
+ export const ACTIVITY_PLAY_PRIZE_LIST_CARD_TYPE = 'activity-play-prize-list';
21
+ /** 本人奖品详情卡型(详情查询工具出卡) */
22
+ export const ACTIVITY_PLAY_PRIZE_DETAIL_CARD_TYPE = 'activity-play-prize-detail';
23
+
24
+ /**
25
+ * 列表卡片展示条目上限(契约单源):schema items.max 与模块出卡适配共用同此值——
26
+ * 超出由适配层截断展示(total 仍为供应商真实值 + truncated 标记),两侧不得各写一个数。
27
+ */
28
+ export const ACTIVITY_PLAY_PRIZE_CARD_MAX_ITEMS = 50;
29
+
30
+ /**
31
+ * 列表卡片条目(奖品记录 DTO + 出卡适配层补充的标准动作)。
32
+ * itemActions 至多 4 项;适配层恒只产出 send 单一 kind(前端经 SDK sendMessage 发起
33
+ * 详情查询——不新增动作协议),schema 沿 actionDraftSchema 单源(判别联合天然拒未知 kind)。
34
+ */
35
+ export const activityPlayPrizeCardItemSchema = activityPlayPrizeRecordSchema
36
+ .extend({
37
+ itemActions: z.array(actionDraftSchema).max(4).optional(),
38
+ })
39
+ .strict();
40
+ export type ActivityPlayPrizeCardItem = z.infer<typeof activityPlayPrizeCardItemSchema>;
41
+
42
+ /**
43
+ * 本人奖品列表卡片 data(成功空态 = total 0 + 空 items,可附 noResultsReason;
44
+ * 查询失败不产生本卡型——失败走错误路径,不伪装「未中奖」)。
45
+ */
46
+ export const activityPlayPrizeListCardDataSchema = z
47
+ .object({
48
+ /** 商圈标识:来自当前执行上下文 scope(非模型输入/硬编码) */
49
+ mallId: z.string().min(1),
50
+ /** 供应商真实总数(≠ items.length——items 为展示面,至多 ACTIVITY_PLAY_PRIZE_CARD_MAX_ITEMS 条) */
51
+ total: z.number().int().min(0),
52
+ items: z.array(activityPlayPrizeCardItemSchema).max(ACTIVITY_PLAY_PRIZE_CARD_MAX_ITEMS),
53
+ noResultsReason: z.string().min(1).max(120).optional(),
54
+ /** 展示截断标记:items 超出 50 条展示上限被截断时为 true(total 仍为真实值——展示范围 ≠ 记录范围) */
55
+ truncated: z.boolean().optional(),
56
+ })
57
+ .strict();
58
+ export type ActivityPlayPrizeListCardData = z.infer<typeof activityPlayPrizeListCardDataSchema>;
59
+
60
+ /**
61
+ * 本人奖品详情卡片 data(平铺:{mallId, ...PrizeDetail}——不套 mode/items 或额外
62
+ * prize 包装对象)。prizeUrl 仅为指引事实字段(不据此增加按钮、自动请求或导航)。
63
+ */
64
+ export const activityPlayPrizeDetailCardDataSchema = activityPlayPrizeDetailSchema
65
+ .extend({
66
+ mallId: z.string().min(1),
67
+ })
68
+ .strict();
69
+ export type ActivityPlayPrizeDetailCardData = z.infer<typeof activityPlayPrizeDetailCardDataSchema>;