@tbox.cn/app-contracts-mall 1.0.0-alpha.8 → 1.0.0-alpha.9

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.
@@ -19,6 +19,41 @@ export declare const activityPlayCardDataSchema: z.ZodEffects<z.ZodObject<{
19
19
  title: z.ZodString;
20
20
  description: z.ZodOptional<z.ZodString>;
21
21
  imageUrl: z.ZodOptional<z.ZodString>;
22
+ detailCoverUrl: z.ZodOptional<z.ZodString>;
23
+ participationRules: z.ZodOptional<z.ZodObject<{
24
+ ruleTexts: z.ZodArray<z.ZodString, "many">;
25
+ }, "strict", z.ZodTypeAny, {
26
+ ruleTexts: string[];
27
+ }, {
28
+ ruleTexts: string[];
29
+ }>>;
30
+ rewardSummary: z.ZodOptional<z.ZodObject<{
31
+ items: z.ZodArray<z.ZodObject<{
32
+ title: z.ZodString;
33
+ tierName: z.ZodString;
34
+ imageUrl: z.ZodOptional<z.ZodString>;
35
+ }, "strict", z.ZodTypeAny, {
36
+ title: string;
37
+ tierName: string;
38
+ imageUrl?: string | undefined;
39
+ }, {
40
+ title: string;
41
+ tierName: string;
42
+ imageUrl?: string | undefined;
43
+ }>, "many">;
44
+ }, "strict", z.ZodTypeAny, {
45
+ items: {
46
+ title: string;
47
+ tierName: string;
48
+ imageUrl?: string | undefined;
49
+ }[];
50
+ }, {
51
+ items: {
52
+ title: string;
53
+ tierName: string;
54
+ imageUrl?: string | undefined;
55
+ }[];
56
+ }>>;
22
57
  startsAt: z.ZodOptional<z.ZodString>;
23
58
  endsAt: z.ZodOptional<z.ZodString>;
24
59
  status: z.ZodEnum<["not_started", "active", "ended", "disabled", "unknown"]>;
@@ -28,6 +63,17 @@ export declare const activityPlayCardDataSchema: z.ZodEffects<z.ZodObject<{
28
63
  activityId: string;
29
64
  description?: string | undefined;
30
65
  imageUrl?: string | undefined;
66
+ detailCoverUrl?: string | undefined;
67
+ participationRules?: {
68
+ ruleTexts: string[];
69
+ } | undefined;
70
+ rewardSummary?: {
71
+ items: {
72
+ title: string;
73
+ tierName: string;
74
+ imageUrl?: string | undefined;
75
+ }[];
76
+ } | undefined;
31
77
  startsAt?: string | undefined;
32
78
  endsAt?: string | undefined;
33
79
  }, {
@@ -36,6 +82,17 @@ export declare const activityPlayCardDataSchema: z.ZodEffects<z.ZodObject<{
36
82
  activityId: string;
37
83
  description?: string | undefined;
38
84
  imageUrl?: string | undefined;
85
+ detailCoverUrl?: string | undefined;
86
+ participationRules?: {
87
+ ruleTexts: string[];
88
+ } | undefined;
89
+ rewardSummary?: {
90
+ items: {
91
+ title: string;
92
+ tierName: string;
93
+ imageUrl?: string | undefined;
94
+ }[];
95
+ } | undefined;
39
96
  startsAt?: string | undefined;
40
97
  endsAt?: string | undefined;
41
98
  }>, "many">;
@@ -46,6 +103,17 @@ export declare const activityPlayCardDataSchema: z.ZodEffects<z.ZodObject<{
46
103
  activityId: string;
47
104
  description?: string | undefined;
48
105
  imageUrl?: string | undefined;
106
+ detailCoverUrl?: string | undefined;
107
+ participationRules?: {
108
+ ruleTexts: string[];
109
+ } | undefined;
110
+ rewardSummary?: {
111
+ items: {
112
+ title: string;
113
+ tierName: string;
114
+ imageUrl?: string | undefined;
115
+ }[];
116
+ } | undefined;
49
117
  startsAt?: string | undefined;
50
118
  endsAt?: string | undefined;
51
119
  }[];
@@ -58,6 +126,17 @@ export declare const activityPlayCardDataSchema: z.ZodEffects<z.ZodObject<{
58
126
  activityId: string;
59
127
  description?: string | undefined;
60
128
  imageUrl?: string | undefined;
129
+ detailCoverUrl?: string | undefined;
130
+ participationRules?: {
131
+ ruleTexts: string[];
132
+ } | undefined;
133
+ rewardSummary?: {
134
+ items: {
135
+ title: string;
136
+ tierName: string;
137
+ imageUrl?: string | undefined;
138
+ }[];
139
+ } | undefined;
61
140
  startsAt?: string | undefined;
62
141
  endsAt?: string | undefined;
63
142
  }[];
@@ -70,6 +149,17 @@ export declare const activityPlayCardDataSchema: z.ZodEffects<z.ZodObject<{
70
149
  activityId: string;
71
150
  description?: string | undefined;
72
151
  imageUrl?: string | undefined;
152
+ detailCoverUrl?: string | undefined;
153
+ participationRules?: {
154
+ ruleTexts: string[];
155
+ } | undefined;
156
+ rewardSummary?: {
157
+ items: {
158
+ title: string;
159
+ tierName: string;
160
+ imageUrl?: string | undefined;
161
+ }[];
162
+ } | undefined;
73
163
  startsAt?: string | undefined;
74
164
  endsAt?: string | undefined;
75
165
  }[];
@@ -82,6 +172,17 @@ export declare const activityPlayCardDataSchema: z.ZodEffects<z.ZodObject<{
82
172
  activityId: string;
83
173
  description?: string | undefined;
84
174
  imageUrl?: string | undefined;
175
+ detailCoverUrl?: string | undefined;
176
+ participationRules?: {
177
+ ruleTexts: string[];
178
+ } | undefined;
179
+ rewardSummary?: {
180
+ items: {
181
+ title: string;
182
+ tierName: string;
183
+ imageUrl?: string | undefined;
184
+ }[];
185
+ } | undefined;
85
186
  startsAt?: string | undefined;
86
187
  endsAt?: string | undefined;
87
188
  }[];
@@ -1,19 +1,7 @@
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
- */
1
+ /** 奖品统一列表卡契约;详情查询出单条列表,完整详情经 HTTP 在半屏展示。 */
12
2
  import { z } from 'zod';
13
3
  /** 本人奖品列表卡型(列表查询工具出卡) */
14
4
  export declare const ACTIVITY_PLAY_PRIZE_LIST_CARD_TYPE = "activity-play-prize-list";
15
- /** 本人奖品详情卡型(详情查询工具出卡) */
16
- export declare const ACTIVITY_PLAY_PRIZE_DETAIL_CARD_TYPE = "activity-play-prize-detail";
17
5
  /**
18
6
  * 列表卡片展示条目上限(契约单源):schema items.max 与模块出卡适配共用同此值——
19
7
  * 超出由适配层截断展示(total 仍为供应商真实值 + truncated 标记),两侧不得各写一个数。
@@ -259,56 +247,3 @@ export declare const activityPlayPrizeListCardDataSchema: z.ZodObject<{
259
247
  truncated?: boolean | undefined;
260
248
  }>;
261
249
  export type ActivityPlayPrizeListCardData = z.infer<typeof activityPlayPrizeListCardDataSchema>;
262
- /**
263
- * 本人奖品详情卡片 data(平铺:{mallId, ...PrizeDetail}——不套 mode/items 或额外
264
- * prize 包装对象)。prizeUrl 仅为指引事实字段(不据此增加按钮、自动请求或导航)。
265
- */
266
- export declare const activityPlayPrizeDetailCardDataSchema: z.ZodObject<{
267
- prizeRecordRef: z.ZodEffects<z.ZodString, string, string>;
268
- title: z.ZodString;
269
- prizeType: z.ZodString;
270
- claimStatus: z.ZodString;
271
- useStatus: z.ZodString;
272
- activityId: z.ZodOptional<z.ZodString>;
273
- activityTitle: z.ZodOptional<z.ZodString>;
274
- imageUrl: z.ZodOptional<z.ZodString>;
275
- wonAt: z.ZodOptional<z.ZodString>;
276
- usageRuleText: z.ZodOptional<z.ZodString>;
277
- } & {
278
- redemptionMethod: z.ZodOptional<z.ZodString>;
279
- redemptionInstruction: z.ZodOptional<z.ZodString>;
280
- prizeUrl: z.ZodOptional<z.ZodString>;
281
- } & {
282
- mallId: z.ZodString;
283
- }, "strict", z.ZodTypeAny, {
284
- title: string;
285
- mallId: string;
286
- prizeRecordRef: string;
287
- prizeType: string;
288
- claimStatus: string;
289
- useStatus: string;
290
- activityId?: string | undefined;
291
- imageUrl?: string | undefined;
292
- activityTitle?: string | undefined;
293
- wonAt?: string | undefined;
294
- usageRuleText?: string | undefined;
295
- redemptionMethod?: string | undefined;
296
- redemptionInstruction?: string | undefined;
297
- prizeUrl?: string | undefined;
298
- }, {
299
- title: string;
300
- mallId: string;
301
- prizeRecordRef: string;
302
- prizeType: string;
303
- claimStatus: string;
304
- useStatus: string;
305
- activityId?: string | undefined;
306
- imageUrl?: string | undefined;
307
- activityTitle?: string | undefined;
308
- wonAt?: string | undefined;
309
- usageRuleText?: string | undefined;
310
- redemptionMethod?: string | undefined;
311
- redemptionInstruction?: string | undefined;
312
- prizeUrl?: string | undefined;
313
- }>;
314
- export type ActivityPlayPrizeDetailCardData = z.infer<typeof activityPlayPrizeDetailCardDataSchema>;
@@ -22,6 +22,18 @@ export interface ActivityPlayActivity {
22
22
  readonly description?: string;
23
23
  /** HTTPS 封面地址 */
24
24
  readonly imageUrl?: string;
25
+ /** 详情主图;缺省使用列表封面。 */
26
+ readonly detailCoverUrl?: string;
27
+ readonly participationRules?: {
28
+ readonly ruleTexts: readonly string[];
29
+ };
30
+ readonly rewardSummary?: {
31
+ readonly items: readonly {
32
+ readonly title: string;
33
+ readonly tierName: string;
34
+ readonly imageUrl?: string;
35
+ }[];
36
+ };
25
37
  /** 含时区的 ISO 时间;缺失表示供应商未提供该事实,不编造 */
26
38
  readonly startsAt?: string;
27
39
  readonly endsAt?: string;
@@ -56,6 +68,41 @@ export declare const activityPlayActivitySchema: z.ZodObject<{
56
68
  title: z.ZodString;
57
69
  description: z.ZodOptional<z.ZodString>;
58
70
  imageUrl: z.ZodOptional<z.ZodString>;
71
+ detailCoverUrl: z.ZodOptional<z.ZodString>;
72
+ participationRules: z.ZodOptional<z.ZodObject<{
73
+ ruleTexts: z.ZodArray<z.ZodString, "many">;
74
+ }, "strict", z.ZodTypeAny, {
75
+ ruleTexts: string[];
76
+ }, {
77
+ ruleTexts: string[];
78
+ }>>;
79
+ rewardSummary: z.ZodOptional<z.ZodObject<{
80
+ items: z.ZodArray<z.ZodObject<{
81
+ title: z.ZodString;
82
+ tierName: z.ZodString;
83
+ imageUrl: z.ZodOptional<z.ZodString>;
84
+ }, "strict", z.ZodTypeAny, {
85
+ title: string;
86
+ tierName: string;
87
+ imageUrl?: string | undefined;
88
+ }, {
89
+ title: string;
90
+ tierName: string;
91
+ imageUrl?: string | undefined;
92
+ }>, "many">;
93
+ }, "strict", z.ZodTypeAny, {
94
+ items: {
95
+ title: string;
96
+ tierName: string;
97
+ imageUrl?: string | undefined;
98
+ }[];
99
+ }, {
100
+ items: {
101
+ title: string;
102
+ tierName: string;
103
+ imageUrl?: string | undefined;
104
+ }[];
105
+ }>>;
59
106
  startsAt: z.ZodOptional<z.ZodString>;
60
107
  endsAt: z.ZodOptional<z.ZodString>;
61
108
  status: z.ZodEnum<["not_started", "active", "ended", "disabled", "unknown"]>;
@@ -65,6 +112,17 @@ export declare const activityPlayActivitySchema: z.ZodObject<{
65
112
  activityId: string;
66
113
  description?: string | undefined;
67
114
  imageUrl?: string | undefined;
115
+ detailCoverUrl?: string | undefined;
116
+ participationRules?: {
117
+ ruleTexts: string[];
118
+ } | undefined;
119
+ rewardSummary?: {
120
+ items: {
121
+ title: string;
122
+ tierName: string;
123
+ imageUrl?: string | undefined;
124
+ }[];
125
+ } | undefined;
68
126
  startsAt?: string | undefined;
69
127
  endsAt?: string | undefined;
70
128
  }, {
@@ -73,6 +131,17 @@ export declare const activityPlayActivitySchema: z.ZodObject<{
73
131
  activityId: string;
74
132
  description?: string | undefined;
75
133
  imageUrl?: string | undefined;
134
+ detailCoverUrl?: string | undefined;
135
+ participationRules?: {
136
+ ruleTexts: string[];
137
+ } | undefined;
138
+ rewardSummary?: {
139
+ items: {
140
+ title: string;
141
+ tierName: string;
142
+ imageUrl?: string | undefined;
143
+ }[];
144
+ } | undefined;
76
145
  startsAt?: string | undefined;
77
146
  endsAt?: string | undefined;
78
147
  }>;
package/dist/runtime.js CHANGED
@@ -209,6 +209,15 @@ var activityPlayActivitySchema = z.object({
209
209
  title: activityPlayTitleSchema,
210
210
  description: activityPlayDescriptionSchema.optional(),
211
211
  imageUrl: activityPlayImageUrlSchema.optional(),
212
+ detailCoverUrl: activityPlayImageUrlSchema.optional(),
213
+ participationRules: z.object({ ruleTexts: z.array(z.string().min(1)) }).strict().optional(),
214
+ rewardSummary: z.object({
215
+ items: z.array(z.object({
216
+ title: z.string().min(1),
217
+ tierName: z.string().min(1),
218
+ imageUrl: activityPlayImageUrlSchema.optional()
219
+ }).strict())
220
+ }).strict().optional(),
212
221
  startsAt: activityPlayTimeSchema.optional(),
213
222
  endsAt: activityPlayTimeSchema.optional(),
214
223
  status: z.enum(["not_started", "active", "ended", "disabled", "unknown"])
@@ -1294,7 +1303,6 @@ var activityPlayCardDataSchema = z10.object({
1294
1303
  // src/activity-play-prize/cards.ts
1295
1304
  import { z as z11 } from "zod";
1296
1305
  var ACTIVITY_PLAY_PRIZE_LIST_CARD_TYPE = "activity-play-prize-list";
1297
- var ACTIVITY_PLAY_PRIZE_DETAIL_CARD_TYPE = "activity-play-prize-detail";
1298
1306
  var ACTIVITY_PLAY_PRIZE_CARD_MAX_ITEMS = 50;
1299
1307
  var activityPlayPrizeCardItemSchema = activityPlayPrizeRecordSchema.extend({
1300
1308
  itemActions: z11.array(actionDraftSchema).max(4).optional()
@@ -1309,13 +1317,9 @@ var activityPlayPrizeListCardDataSchema = z11.object({
1309
1317
  /** 展示截断标记:items 超出 50 条展示上限被截断时为 true(total 仍为真实值——展示范围 ≠ 记录范围) */
1310
1318
  truncated: z11.boolean().optional()
1311
1319
  }).strict();
1312
- var activityPlayPrizeDetailCardDataSchema = activityPlayPrizeDetailSchema.extend({
1313
- mallId: z11.string().min(1)
1314
- }).strict();
1315
1320
  export {
1316
1321
  ACTIVITY_PLAY_PRIZES_SERVICE,
1317
1322
  ACTIVITY_PLAY_PRIZE_CARD_MAX_ITEMS,
1318
- ACTIVITY_PLAY_PRIZE_DETAIL_CARD_TYPE,
1319
1323
  ACTIVITY_PLAY_PRIZE_LIST_CARD_TYPE,
1320
1324
  ACTIVITY_PLAY_PRIZE_STATUS_UNKNOWN,
1321
1325
  ACTIVITY_PLAY_QUERY_SERVICE,
@@ -1354,7 +1358,6 @@ export {
1354
1358
  activityPlayPrizeActivityIdSchema,
1355
1359
  activityPlayPrizeActivityTitleSchema,
1356
1360
  activityPlayPrizeCardItemSchema,
1357
- activityPlayPrizeDetailCardDataSchema,
1358
1361
  activityPlayPrizeDetailSchema,
1359
1362
  activityPlayPrizeListCardDataSchema,
1360
1363
  activityPlayPrizeListResultSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-contracts-mall",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.9",
4
4
  "type": "module",
5
5
  "description": "商圈领域契约(TIER1,types + runtime):Port 接口 + MallEventMap + 领域 DTO + scope/装配器运行时。",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "zod": "3.25.76",
33
- "@tbox.cn/app-contracts": "1.0.0-alpha.8"
33
+ "@tbox.cn/app-contracts": "1.0.0-alpha.9"
34
34
  },
35
35
  "devDependencies": {
36
36
  "tsup": "8.5.1",
@@ -1,25 +1,12 @@
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
- */
1
+ /** 奖品统一列表卡契约;详情查询出单条列表,完整详情经 HTTP 在半屏展示。 */
12
2
  import { z } from 'zod';
13
3
  import { actionDraftSchema } from '../shared/cards';
14
4
  import {
15
- activityPlayPrizeDetailSchema,
16
5
  activityPlayPrizeRecordSchema,
17
6
  } from '../domain/activity-play-prize';
18
7
 
19
8
  /** 本人奖品列表卡型(列表查询工具出卡) */
20
9
  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
10
 
24
11
  /**
25
12
  * 列表卡片展示条目上限(契约单源):schema items.max 与模块出卡适配共用同此值——
@@ -56,14 +43,3 @@ export const activityPlayPrizeListCardDataSchema = z
56
43
  })
57
44
  .strict();
58
45
  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>;
@@ -24,6 +24,12 @@ export interface ActivityPlayActivity {
24
24
  readonly description?: string;
25
25
  /** HTTPS 封面地址 */
26
26
  readonly imageUrl?: string;
27
+ /** 详情主图;缺省使用列表封面。 */
28
+ readonly detailCoverUrl?: string;
29
+ readonly participationRules?: { readonly ruleTexts: readonly string[] };
30
+ readonly rewardSummary?: {
31
+ readonly items: readonly { readonly title: string; readonly tierName: string; readonly imageUrl?: string }[];
32
+ };
27
33
  /** 含时区的 ISO 时间;缺失表示供应商未提供该事实,不编造 */
28
34
  readonly startsAt?: string;
29
35
  readonly endsAt?: string;
@@ -76,6 +82,15 @@ export const activityPlayActivitySchema = z
76
82
  title: activityPlayTitleSchema,
77
83
  description: activityPlayDescriptionSchema.optional(),
78
84
  imageUrl: activityPlayImageUrlSchema.optional(),
85
+ detailCoverUrl: activityPlayImageUrlSchema.optional(),
86
+ participationRules: z.object({ ruleTexts: z.array(z.string().min(1)) }).strict().optional(),
87
+ rewardSummary: z.object({
88
+ items: z.array(z.object({
89
+ title: z.string().min(1),
90
+ tierName: z.string().min(1),
91
+ imageUrl: activityPlayImageUrlSchema.optional(),
92
+ }).strict()),
93
+ }).strict().optional(),
79
94
  startsAt: activityPlayTimeSchema.optional(),
80
95
  endsAt: activityPlayTimeSchema.optional(),
81
96
  status: z.enum(['not_started', 'active', 'ended', 'disabled', 'unknown']),
@@ -15,10 +15,8 @@ import {
15
15
  toActivityPlayPrizeStatusTag,
16
16
  } from '../src/domain/activity-play-prize';
17
17
  import {
18
- ACTIVITY_PLAY_PRIZE_DETAIL_CARD_TYPE,
19
18
  ACTIVITY_PLAY_PRIZE_LIST_CARD_TYPE,
20
19
  activityPlayPrizeCardItemSchema,
21
- activityPlayPrizeDetailCardDataSchema,
22
20
  activityPlayPrizeListCardDataSchema,
23
21
  } from '../src/activity-play-prize/cards';
24
22
  import { ACTIVITY_PLAY_PRIZES_SERVICE } from '../src/services/activity-play-prize';
@@ -150,26 +148,8 @@ describe('奖品卡片数据 schema(两张稳定卡型)', () => {
150
148
  expect(activityPlayPrizeListCardDataSchema.safeParse({ mallId: 'mall-demo', items: [listItem] }).success).toBe(false);
151
149
  });
152
150
 
153
- it('详情卡:平铺 {mallId, ...detail}——不套 mode/items/prize 包装', () => {
154
- const detail = {
155
- ...fullRecord,
156
- redemptionMethod: '门店柜台',
157
- redemptionInstruction: '请按活动页面的领取及使用指引操作',
158
- prizeUrl: 'https://example.com/claim',
159
- };
160
- const data = { mallId: 'mall-demo', ...detail };
161
- expect(activityPlayPrizeDetailCardDataSchema.safeParse(data).success).toBe(true);
162
-
163
- // 套 mode / items / prize 包装对象均非法(api.md 钉死平铺)
164
- expect(activityPlayPrizeDetailCardDataSchema.safeParse({ mallId: 'mall-demo', mode: 'detail', prize: detail }).success).toBe(false);
165
- expect(activityPlayPrizeDetailCardDataSchema.safeParse({ mallId: 'mall-demo', items: [detail] }).success).toBe(false);
166
- // 无 mallId 拒收
167
- expect(activityPlayPrizeDetailCardDataSchema.safeParse(detail).success).toBe(false);
168
- });
169
-
170
151
  it('卡型常量与槽词汇面稳定', () => {
171
152
  expect(ACTIVITY_PLAY_PRIZE_LIST_CARD_TYPE).toBe('activity-play-prize-list');
172
- expect(ACTIVITY_PLAY_PRIZE_DETAIL_CARD_TYPE).toBe('activity-play-prize-detail');
173
153
  expect(ACTIVITY_PLAY_PRIZES_SERVICE).toBe('activity-play.prizes');
174
154
  });
175
155
  });
@@ -121,3 +121,19 @@ describe('activityPlayCardDataSchema(出卡契约:list/detail 传输形态
121
121
  expect(activityPlayCardDataSchema.safeParse({ mallId: 'mall-demo', mode: 'list', items: [{ ...item, loginRequired: false }] }).success).toBe(false);
122
122
  });
123
123
  });
124
+
125
+
126
+ describe('活动详情扩展契约', () => {
127
+ it('规则和奖品设置可选;缺失兼容基础对象,非法嵌套字段拒绝', () => {
128
+ expect(activityPlayActivitySchema.safeParse({ ...base,
129
+ detailCoverUrl: 'https://example.com/detail.png',
130
+ participationRules: { ruleTexts: ['每日三次'] },
131
+ rewardSummary: { items: [{ title: '礼盒', tierName: '奖品 1' }] },
132
+ }).success).toBe(true);
133
+ for (const fields of [
134
+ { participationRules: { ruleTexts: [3] } },
135
+ { rewardSummary: { items: [{ title: '礼盒' }] } },
136
+ { detailCoverUrl: 'http://example.com/image.png' },
137
+ ]) expect(activityPlayActivitySchema.safeParse({ ...base, ...fields }).success).toBe(false);
138
+ });
139
+ });