@tbox.cn/app-contracts-mall 0.17.1 → 0.18.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/dist/activity-play/cards.d.ts +18 -24
- package/dist/activity-play-prize/cards.d.ts +314 -0
- package/dist/alipay-activity/cards.d.ts +4 -4
- package/dist/domain/activity-play-prize.d.ts +208 -0
- package/dist/domain/activity-play.d.ts +35 -172
- package/dist/index.d.ts +3 -0
- package/dist/parking/cards.d.ts +4 -4
- package/dist/promotion/cards.d.ts +40 -40
- package/dist/runtime.d.ts +5 -2
- package/dist/runtime.js +734 -730
- package/dist/services/activity-play-prize.d.ts +36 -0
- package/dist/services/activity-play.d.ts +18 -42
- package/dist/shopping-guide/cards.d.ts +36 -36
- package/package.json +2 -2
- package/src/activity-play/cards.ts +4 -3
- package/src/activity-play-prize/cards.ts +69 -0
- package/src/domain/activity-play-prize.ts +105 -0
- package/src/domain/activity-play.ts +44 -192
- package/src/index.ts +3 -0
- package/src/runtime.ts +20 -10
- package/src/service-slots.json +5 -5
- package/src/services/activity-play-prize.ts +47 -0
- package/src/services/activity-play.ts +18 -44
- package/tests/activity-play-prize.test.ts +175 -0
- package/tests/activity-play.test.ts +58 -167
- package/tests/service-slots.test.ts +4 -3
|
@@ -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
|
+
}
|
|
@@ -1,63 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 活动玩法 Port(activity-play.query
|
|
3
|
-
* 语义独立于营销域(promotion
|
|
4
|
-
*
|
|
2
|
+
* 活动玩法 Port(activity-play.query 查询契约——远端活动查询,2026-11-17 改造)。
|
|
3
|
+
* 语义独立于营销域(promotion.*):本包只描述「供应商 API 查询到的外部活动」,
|
|
4
|
+
* 不承诺本地目录、参与入口、报名/场次/发奖。厂商 wire 词汇(路径、信封、状态枚举)
|
|
5
|
+
* 不进本层——归 provider 包 adapter。
|
|
5
6
|
* 结构类型子集接口——provider 包 adapter 实现,消费方(业务模块)仅依赖契约包。
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* 远端语义(远端活动改造):
|
|
9
|
+
* - 每次业务查询取得外部事实(不在构造时缓存活动、无本地活动数据库/同步);
|
|
10
|
+
* - 活动范围由当前商家连接限定;已知其他商家的 activityId 也不可读
|
|
11
|
+
* (越权/不可见 → null,消费方映射 404);
|
|
12
|
+
* - 状态由供应商转换(枚举见 domain;未知值 → 'unknown',不按 active 推断);
|
|
13
|
+
* - 上游失败是失败(不得转成成功空列表——区分缺连接/上游故障/合法空集)。
|
|
11
14
|
*/
|
|
12
15
|
import type { MallQueryContext } from '../query-context';
|
|
13
|
-
import type { ActivityPlayActivity,
|
|
16
|
+
import type { ActivityPlayActivity, ActivityPlayPage } from '../domain/activity-play';
|
|
14
17
|
export declare const ACTIVITY_PLAY_QUERY_SERVICE = "activity-play.query";
|
|
15
|
-
export declare const ACTIVITY_PLAY_ENTRY_SERVICE = "activity-play.entry";
|
|
16
18
|
/** 查询上下文(三域同形——module 直接复用 toMallQueryContext 组合子即可组装) */
|
|
17
19
|
export type ActivityPlayQueryContext = MallQueryContext & {
|
|
18
20
|
/** 主体由登录态归一(source !== 'anonymous' 本包才写入;此处仅供类型消费方读取) */
|
|
19
21
|
readonly subjectId?: string;
|
|
20
22
|
};
|
|
21
|
-
/**
|
|
23
|
+
/** 列表查询输入(覆盖范围/排序/分页按供应商实调能力记录,不承诺全部历史) */
|
|
22
24
|
export interface ActivityPlayListInput {
|
|
23
|
-
/**
|
|
25
|
+
/** 名称/说明关键词匹配(上游查询或后端适配实现——覆盖范围在核验中记录) */
|
|
24
26
|
readonly keyword?: string;
|
|
25
|
-
/** 数量上限:缺省 20、范围 1—50
|
|
27
|
+
/** 数量上限:缺省 20、范围 1—50;越界拒绝(不可静默钳制) */
|
|
26
28
|
readonly limit?: number;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* activity-play.query 槽供给端口(provider 包 adapter 实现)。
|
|
30
|
-
* - listActivities
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* status 由实现方按服务端时间计算(单源助手 activityPlayStatusOf)。
|
|
32
|
+
* - listActivities:当前商家连接下的活动列表;合法空集返回空 items(非错误);
|
|
33
|
+
* - getActivity:供应商活动标识精确查;不存在/不可见/其他商家范围 → null;
|
|
34
|
+
* 未知状态照常返回(status = 'unknown'——不推断)。
|
|
34
35
|
*/
|
|
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
36
|
export interface ActivityPlayQueryPort {
|
|
48
37
|
listActivities(q: ActivityPlayQueryContext, input: ActivityPlayListInput): Promise<ActivityPlayPage>;
|
|
49
|
-
getActivity(q: ActivityPlayQueryContext,
|
|
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;
|
|
38
|
+
getActivity(q: ActivityPlayQueryContext, activityId: string): Promise<ActivityPlayActivity | null>;
|
|
63
39
|
}
|
|
@@ -195,14 +195,14 @@ export declare const pageInfoSchema: z.ZodObject<{
|
|
|
195
195
|
total: z.ZodNumber;
|
|
196
196
|
hasMore: z.ZodBoolean;
|
|
197
197
|
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
total: number;
|
|
198
199
|
page: number;
|
|
199
200
|
pageSize: number;
|
|
200
|
-
total: number;
|
|
201
201
|
hasMore: boolean;
|
|
202
202
|
}, {
|
|
203
|
+
total: number;
|
|
203
204
|
page: number;
|
|
204
205
|
pageSize: number;
|
|
205
|
-
total: number;
|
|
206
206
|
hasMore: boolean;
|
|
207
207
|
}>;
|
|
208
208
|
export declare const refinementSchema: z.ZodObject<{
|
|
@@ -561,14 +561,14 @@ export declare const productListCardDataSchema: z.ZodObject<{
|
|
|
561
561
|
total: z.ZodNumber;
|
|
562
562
|
hasMore: z.ZodBoolean;
|
|
563
563
|
}, "strip", z.ZodTypeAny, {
|
|
564
|
+
total: number;
|
|
564
565
|
page: number;
|
|
565
566
|
pageSize: number;
|
|
566
|
-
total: number;
|
|
567
567
|
hasMore: boolean;
|
|
568
568
|
}, {
|
|
569
|
+
total: number;
|
|
569
570
|
page: number;
|
|
570
571
|
pageSize: number;
|
|
571
|
-
total: 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;
|
|
@@ -655,13 +655,12 @@ export declare const productListCardDataSchema: z.ZodObject<{
|
|
|
655
655
|
summary?: string | undefined;
|
|
656
656
|
noResultsReason?: string | undefined;
|
|
657
657
|
pageInfo?: {
|
|
658
|
+
total: number;
|
|
658
659
|
page: number;
|
|
659
660
|
pageSize: number;
|
|
660
|
-
total: 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;
|
|
@@ -734,9 +734,9 @@ export declare const productListCardDataSchema: z.ZodObject<{
|
|
|
734
734
|
summary?: string | undefined;
|
|
735
735
|
noResultsReason?: string | undefined;
|
|
736
736
|
pageInfo?: {
|
|
737
|
+
total: number;
|
|
737
738
|
page: number;
|
|
738
739
|
pageSize: number;
|
|
739
|
-
total: number;
|
|
740
740
|
hasMore: boolean;
|
|
741
741
|
} | undefined;
|
|
742
742
|
}>;
|
|
@@ -1036,14 +1036,14 @@ export declare const shopListCardDataSchema: z.ZodObject<{
|
|
|
1036
1036
|
total: z.ZodNumber;
|
|
1037
1037
|
hasMore: z.ZodBoolean;
|
|
1038
1038
|
}, "strip", z.ZodTypeAny, {
|
|
1039
|
+
total: number;
|
|
1039
1040
|
page: number;
|
|
1040
1041
|
pageSize: number;
|
|
1041
|
-
total: number;
|
|
1042
1042
|
hasMore: boolean;
|
|
1043
1043
|
}, {
|
|
1044
|
+
total: number;
|
|
1044
1045
|
page: number;
|
|
1045
1046
|
pageSize: number;
|
|
1046
|
-
total: 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;
|
|
@@ -1128,9 +1128,9 @@ export declare const shopListCardDataSchema: z.ZodObject<{
|
|
|
1128
1128
|
summary?: string | undefined;
|
|
1129
1129
|
noResultsReason?: string | undefined;
|
|
1130
1130
|
pageInfo?: {
|
|
1131
|
+
total: number;
|
|
1131
1132
|
page: number;
|
|
1132
1133
|
pageSize: number;
|
|
1133
|
-
total: 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;
|
|
@@ -1209,9 +1209,9 @@ export declare const shopListCardDataSchema: z.ZodObject<{
|
|
|
1209
1209
|
summary?: string | undefined;
|
|
1210
1210
|
noResultsReason?: string | undefined;
|
|
1211
1211
|
pageInfo?: {
|
|
1212
|
+
total: number;
|
|
1212
1213
|
page: number;
|
|
1213
1214
|
pageSize: number;
|
|
1214
|
-
total: number;
|
|
1215
1215
|
hasMore: boolean;
|
|
1216
1216
|
} | undefined;
|
|
1217
1217
|
categoryTabs?: {
|
|
@@ -1517,14 +1517,14 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
|
|
|
1517
1517
|
total: z.ZodNumber;
|
|
1518
1518
|
hasMore: z.ZodBoolean;
|
|
1519
1519
|
}, "strip", z.ZodTypeAny, {
|
|
1520
|
+
total: number;
|
|
1520
1521
|
page: number;
|
|
1521
1522
|
pageSize: number;
|
|
1522
|
-
total: number;
|
|
1523
1523
|
hasMore: boolean;
|
|
1524
1524
|
}, {
|
|
1525
|
+
total: number;
|
|
1525
1526
|
page: number;
|
|
1526
1527
|
pageSize: number;
|
|
1527
|
-
total: 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;
|
|
@@ -1609,9 +1609,9 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
|
|
|
1609
1609
|
summary?: string | undefined;
|
|
1610
1610
|
noResultsReason?: string | undefined;
|
|
1611
1611
|
pageInfo?: {
|
|
1612
|
+
total: number;
|
|
1612
1613
|
page: number;
|
|
1613
1614
|
pageSize: number;
|
|
1614
|
-
total: 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;
|
|
@@ -1690,9 +1690,9 @@ export declare const merchantListCardDataSchema: z.ZodObject<{
|
|
|
1690
1690
|
summary?: string | undefined;
|
|
1691
1691
|
noResultsReason?: string | undefined;
|
|
1692
1692
|
pageInfo?: {
|
|
1693
|
+
total: number;
|
|
1693
1694
|
page: number;
|
|
1694
1695
|
pageSize: number;
|
|
1695
|
-
total: 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?: {
|
|
@@ -4353,14 +4353,14 @@ export declare const shoppingGuideCardDataSchemas: {
|
|
|
4353
4353
|
total: z.ZodNumber;
|
|
4354
4354
|
hasMore: z.ZodBoolean;
|
|
4355
4355
|
}, "strip", z.ZodTypeAny, {
|
|
4356
|
+
total: number;
|
|
4356
4357
|
page: number;
|
|
4357
4358
|
pageSize: number;
|
|
4358
|
-
total: number;
|
|
4359
4359
|
hasMore: boolean;
|
|
4360
4360
|
}, {
|
|
4361
|
+
total: number;
|
|
4361
4362
|
page: number;
|
|
4362
4363
|
pageSize: number;
|
|
4363
|
-
total: 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;
|
|
@@ -4447,13 +4447,12 @@ export declare const shoppingGuideCardDataSchemas: {
|
|
|
4447
4447
|
summary?: string | undefined;
|
|
4448
4448
|
noResultsReason?: string | undefined;
|
|
4449
4449
|
pageInfo?: {
|
|
4450
|
+
total: number;
|
|
4450
4451
|
page: number;
|
|
4451
4452
|
pageSize: number;
|
|
4452
|
-
total: 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;
|
|
@@ -4526,9 +4526,9 @@ export declare const shoppingGuideCardDataSchemas: {
|
|
|
4526
4526
|
summary?: string | undefined;
|
|
4527
4527
|
noResultsReason?: string | undefined;
|
|
4528
4528
|
pageInfo?: {
|
|
4529
|
+
total: number;
|
|
4529
4530
|
page: number;
|
|
4530
4531
|
pageSize: number;
|
|
4531
|
-
total: number;
|
|
4532
4532
|
hasMore: boolean;
|
|
4533
4533
|
} | undefined;
|
|
4534
4534
|
}>;
|
|
@@ -5158,14 +5158,14 @@ export declare const shoppingGuideCardDataSchemas: {
|
|
|
5158
5158
|
total: z.ZodNumber;
|
|
5159
5159
|
hasMore: z.ZodBoolean;
|
|
5160
5160
|
}, "strip", z.ZodTypeAny, {
|
|
5161
|
+
total: number;
|
|
5161
5162
|
page: number;
|
|
5162
5163
|
pageSize: number;
|
|
5163
|
-
total: number;
|
|
5164
5164
|
hasMore: boolean;
|
|
5165
5165
|
}, {
|
|
5166
|
+
total: number;
|
|
5166
5167
|
page: number;
|
|
5167
5168
|
pageSize: number;
|
|
5168
|
-
total: 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;
|
|
@@ -5250,9 +5250,9 @@ export declare const shoppingGuideCardDataSchemas: {
|
|
|
5250
5250
|
summary?: string | undefined;
|
|
5251
5251
|
noResultsReason?: string | undefined;
|
|
5252
5252
|
pageInfo?: {
|
|
5253
|
+
total: number;
|
|
5253
5254
|
page: number;
|
|
5254
5255
|
pageSize: number;
|
|
5255
|
-
total: 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;
|
|
@@ -5331,9 +5331,9 @@ export declare const shoppingGuideCardDataSchemas: {
|
|
|
5331
5331
|
summary?: string | undefined;
|
|
5332
5332
|
noResultsReason?: string | undefined;
|
|
5333
5333
|
pageInfo?: {
|
|
5334
|
+
total: number;
|
|
5334
5335
|
page: number;
|
|
5335
5336
|
pageSize: number;
|
|
5336
|
-
total: 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.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "商圈领域契约(TIER1,types + runtime):Port 接口 + MallEventMap + 领域 DTO + scope/装配器运行时。",
|
|
6
6
|
"exports": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tbox.cn/app-contracts": "0.13.
|
|
32
|
+
"@tbox.cn/app-contracts": "0.13.4",
|
|
33
33
|
"zod": "3.25.76"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 活动玩法域卡片数据契约(远端活动改造 2026-11-17)。
|
|
3
3
|
* 单一稳定 CardType `activity-play`,mode 区分列表/详情传输形态——视觉由前端渲染器
|
|
4
4
|
* 按 mode 组织,传输层不拆分多卡型(与 promotion 域 9 卡型形态区分)。
|
|
5
|
-
* 条目复用 activityPlayActivitySchema
|
|
5
|
+
* 条目复用 activityPlayActivitySchema(供应商活动对象——卡 data 不带本地目录/入口配置字段)。
|
|
6
|
+
* 本人奖品两张卡型归任务 07,不在本契约预置空实现。
|
|
6
7
|
* 信封字段(卡片 ID/时间戳/历史标记/版本)由 SDK 生成,不在本契约。
|
|
7
8
|
*/
|
|
8
9
|
import { z } from 'zod';
|
|
@@ -15,7 +16,7 @@ export const activityPlayCardDataSchema = z
|
|
|
15
16
|
mallId: z.string().min(1),
|
|
16
17
|
/** 传输形态:list(列表,可空,≤50 项)/ detail(详情,恰好 1 项,可携 disabled) */
|
|
17
18
|
mode: z.enum(['list', 'detail']),
|
|
18
|
-
/**
|
|
19
|
+
/** 活动条目(供应商活动对象:activityId/title/status 等——list 可空 ≤50 项) */
|
|
19
20
|
items: z.array(activityPlayActivitySchema).max(50),
|
|
20
21
|
})
|
|
21
22
|
.superRefine((data, ctx) => {
|
|
@@ -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>;
|