@tbox.cn/app-contracts-mall 1.0.0-alpha.1 → 1.0.0-alpha.10

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,208 @@
1
+ /**
2
+ * 活动玩法·个人奖品域模型(任务07——供应商返回的本人中奖记录 DTO + 字段级校验单源)。
3
+ * 语义独立于营销券/权益域:本域只描述「外部供应商提供的本人奖品事实」,不承诺领取核销、
4
+ * 本地奖品库、同步任务或结果推送(一期均不建)。
5
+ *
6
+ * 字段口径(api.md「本人奖品查询」唯一字段清单):
7
+ * - prizeRecordRef/title 必填;记录标识按供应商原字符串定位(同名奖品的不同中奖记录
8
+ * 可区分;'001'/'1.20'/'1e3' 等标识不做数字或 JSON 预解析);
9
+ * - activityId/activityTitle 仅为供应商提供的来源事实(缺失不编造、不以活动列表补齐,
10
+ * 也不是本地登记或查询前置);
11
+ * - prizeType/claimStatus/useStatus 经适配层明确映射产生,未知或缺失兜底 UNKNOWN;
12
+ * - 可选字段缺席归一为缺省(不编造值);必填字段或响应结构非法须上层显性失败,
13
+ * 不得丢弃坏记录后声称用户未中奖;
14
+ * - 图片/时间校验与活动域共用单源 schema(HTTPS / 含时区真实日历时刻)。
15
+ */
16
+ import { z } from 'zod';
17
+ /** 未知状态兜底桶(固定值——适配层映射产物,未确认来源不得编造具体状态) */
18
+ export declare const ACTIVITY_PLAY_PRIZE_STATUS_UNKNOWN: "UNKNOWN";
19
+ /** 状态桶标签(映射后的供应商状态——已知集确认前为 string 面) */
20
+ export type ActivityPlayPrizeStatusTag = string;
21
+ /**
22
+ * 状态标签归一(契约单源):raw 命中 known 集 → 原样通过;其余(缺失/null/未知字符串/
23
+ * 非字符串)→ UNKNOWN。只用于归一第三方原始状态值;接口示例不构成供应商已支持证据,
24
+ * known 集以琥珀确认的映射表为准(协议核验页)。
25
+ */
26
+ export declare function toActivityPlayPrizeStatusTag(raw: unknown, known: readonly string[]): ActivityPlayPrizeStatusTag;
27
+ /** 中奖记录标识:非空白 ≤128 的原字符串(不数字化/不按名称或活动 ID 推算;空白串显性拒绝) */
28
+ export declare const activityPlayPrizeRecordRefSchema: z.ZodEffects<z.ZodString, string, string>;
29
+ /** 奖品名称:非空 ≤64 */
30
+ export declare const activityPlayPrizeTitleSchema: z.ZodString;
31
+ /** 来源活动标识(供应商提供的事实——不是本系统登记键):非空 ≤128 原字符串 */
32
+ export declare const activityPlayPrizeActivityIdSchema: z.ZodString;
33
+ /** 来源活动名称:非空 ≤64 */
34
+ export declare const activityPlayPrizeActivityTitleSchema: z.ZodString;
35
+ /** 状态桶标签(prizeType/claimStatus/useStatus 共用):非空 ≤32 */
36
+ export declare const activityPlayPrizeStatusTagSchema: z.ZodString;
37
+ /** 使用规则:普通文本 ≤500 */
38
+ export declare const activityPlayPrizeUsageRuleTextSchema: z.ZodString;
39
+ /** 领取方式(详情):非空 ≤64 */
40
+ export declare const activityPlayPrizeRedemptionMethodSchema: z.ZodString;
41
+ /** 领取说明(详情):普通文本 ≤500 */
42
+ export declare const activityPlayPrizeRedemptionInstructionSchema: z.ZodString;
43
+ /** 外部领取指引:有效 URL 且恒 HTTPS(事实字段——不作为插件地址、不据此增加按钮) */
44
+ export declare const activityPlayPrizeUrlSchema: z.ZodString;
45
+ /** 奖品记录基础面(列表项与详情共用同源字段集;strict 拒未知键) */
46
+ export declare const activityPlayPrizeRecordSchema: z.ZodObject<{
47
+ prizeRecordRef: z.ZodEffects<z.ZodString, string, string>;
48
+ title: z.ZodString;
49
+ /** 奖品类型标签(映射后——未知为 UNKNOWN) */
50
+ prizeType: z.ZodString;
51
+ /** 领取状态标签(映射后——未知/缺失为 UNKNOWN) */
52
+ claimStatus: z.ZodString;
53
+ /** 使用状态标签(映射后——未知/缺失为 UNKNOWN) */
54
+ useStatus: z.ZodString;
55
+ activityId: z.ZodOptional<z.ZodString>;
56
+ activityTitle: z.ZodOptional<z.ZodString>;
57
+ imageUrl: z.ZodOptional<z.ZodString>;
58
+ /** 中奖时间(含时区 ISO 真实日历时刻——缺失不编造) */
59
+ wonAt: z.ZodOptional<z.ZodString>;
60
+ usageRuleText: z.ZodOptional<z.ZodString>;
61
+ }, "strict", z.ZodTypeAny, {
62
+ title: string;
63
+ prizeRecordRef: string;
64
+ prizeType: string;
65
+ claimStatus: string;
66
+ useStatus: string;
67
+ activityId?: string | undefined;
68
+ imageUrl?: string | undefined;
69
+ activityTitle?: string | undefined;
70
+ wonAt?: string | undefined;
71
+ usageRuleText?: string | undefined;
72
+ }, {
73
+ title: string;
74
+ prizeRecordRef: string;
75
+ prizeType: string;
76
+ claimStatus: string;
77
+ useStatus: string;
78
+ activityId?: string | undefined;
79
+ imageUrl?: string | undefined;
80
+ activityTitle?: string | undefined;
81
+ wonAt?: string | undefined;
82
+ usageRuleText?: string | undefined;
83
+ }>;
84
+ /** 奖品详情(记录基础面 + 领取方式/说明与外部指引;strict 拒未知键) */
85
+ export declare const activityPlayPrizeDetailSchema: z.ZodObject<{
86
+ prizeRecordRef: z.ZodEffects<z.ZodString, string, string>;
87
+ title: z.ZodString;
88
+ /** 奖品类型标签(映射后——未知为 UNKNOWN) */
89
+ prizeType: z.ZodString;
90
+ /** 领取状态标签(映射后——未知/缺失为 UNKNOWN) */
91
+ claimStatus: z.ZodString;
92
+ /** 使用状态标签(映射后——未知/缺失为 UNKNOWN) */
93
+ useStatus: z.ZodString;
94
+ activityId: z.ZodOptional<z.ZodString>;
95
+ activityTitle: z.ZodOptional<z.ZodString>;
96
+ imageUrl: z.ZodOptional<z.ZodString>;
97
+ /** 中奖时间(含时区 ISO 真实日历时刻——缺失不编造) */
98
+ wonAt: z.ZodOptional<z.ZodString>;
99
+ usageRuleText: z.ZodOptional<z.ZodString>;
100
+ } & {
101
+ redemptionMethod: z.ZodOptional<z.ZodString>;
102
+ redemptionInstruction: z.ZodOptional<z.ZodString>;
103
+ prizeUrl: z.ZodOptional<z.ZodString>;
104
+ }, "strict", z.ZodTypeAny, {
105
+ title: string;
106
+ prizeRecordRef: string;
107
+ prizeType: string;
108
+ claimStatus: string;
109
+ useStatus: string;
110
+ activityId?: string | undefined;
111
+ imageUrl?: string | undefined;
112
+ activityTitle?: string | undefined;
113
+ wonAt?: string | undefined;
114
+ usageRuleText?: string | undefined;
115
+ redemptionMethod?: string | undefined;
116
+ redemptionInstruction?: string | undefined;
117
+ prizeUrl?: string | undefined;
118
+ }, {
119
+ title: string;
120
+ prizeRecordRef: string;
121
+ prizeType: string;
122
+ claimStatus: string;
123
+ useStatus: string;
124
+ activityId?: string | undefined;
125
+ imageUrl?: string | undefined;
126
+ activityTitle?: string | undefined;
127
+ wonAt?: string | undefined;
128
+ usageRuleText?: string | undefined;
129
+ redemptionMethod?: string | undefined;
130
+ redemptionInstruction?: string | undefined;
131
+ prizeUrl?: string | undefined;
132
+ }>;
133
+ /** 列表结果(total 非负整数——实际统计/翻页覆盖范围按供应商实调记录,不冒称全量历史) */
134
+ export declare const activityPlayPrizeListResultSchema: z.ZodObject<{
135
+ total: z.ZodNumber;
136
+ items: z.ZodArray<z.ZodObject<{
137
+ prizeRecordRef: z.ZodEffects<z.ZodString, string, string>;
138
+ title: z.ZodString;
139
+ /** 奖品类型标签(映射后——未知为 UNKNOWN) */
140
+ prizeType: z.ZodString;
141
+ /** 领取状态标签(映射后——未知/缺失为 UNKNOWN) */
142
+ claimStatus: z.ZodString;
143
+ /** 使用状态标签(映射后——未知/缺失为 UNKNOWN) */
144
+ useStatus: z.ZodString;
145
+ activityId: z.ZodOptional<z.ZodString>;
146
+ activityTitle: z.ZodOptional<z.ZodString>;
147
+ imageUrl: z.ZodOptional<z.ZodString>;
148
+ /** 中奖时间(含时区 ISO 真实日历时刻——缺失不编造) */
149
+ wonAt: z.ZodOptional<z.ZodString>;
150
+ usageRuleText: z.ZodOptional<z.ZodString>;
151
+ }, "strict", z.ZodTypeAny, {
152
+ title: string;
153
+ prizeRecordRef: string;
154
+ prizeType: string;
155
+ claimStatus: string;
156
+ useStatus: string;
157
+ activityId?: string | undefined;
158
+ imageUrl?: string | undefined;
159
+ activityTitle?: string | undefined;
160
+ wonAt?: string | undefined;
161
+ usageRuleText?: string | undefined;
162
+ }, {
163
+ title: string;
164
+ prizeRecordRef: string;
165
+ prizeType: string;
166
+ claimStatus: string;
167
+ useStatus: string;
168
+ activityId?: string | undefined;
169
+ imageUrl?: string | undefined;
170
+ activityTitle?: string | undefined;
171
+ wonAt?: string | undefined;
172
+ usageRuleText?: string | undefined;
173
+ }>, "many">;
174
+ }, "strict", z.ZodTypeAny, {
175
+ items: {
176
+ title: string;
177
+ prizeRecordRef: string;
178
+ prizeType: string;
179
+ claimStatus: string;
180
+ useStatus: string;
181
+ activityId?: string | undefined;
182
+ imageUrl?: string | undefined;
183
+ activityTitle?: string | undefined;
184
+ wonAt?: string | undefined;
185
+ usageRuleText?: string | undefined;
186
+ }[];
187
+ total: number;
188
+ }, {
189
+ items: {
190
+ title: string;
191
+ prizeRecordRef: string;
192
+ prizeType: string;
193
+ claimStatus: string;
194
+ useStatus: string;
195
+ activityId?: string | undefined;
196
+ imageUrl?: string | undefined;
197
+ activityTitle?: string | undefined;
198
+ wonAt?: string | undefined;
199
+ usageRuleText?: string | undefined;
200
+ }[];
201
+ total: number;
202
+ }>;
203
+ /** 奖品记录(列表条目形态) */
204
+ export type ActivityPlayPrizeRecord = z.infer<typeof activityPlayPrizeRecordSchema>;
205
+ /** 奖品详情(详情返回形态) */
206
+ export type ActivityPlayPrizeDetail = z.infer<typeof activityPlayPrizeDetailSchema>;
207
+ /** 列表结果(HTTP data 面——无 itemActions/noResultsReason,出卡适配层补充) */
208
+ export type ActivityPlayPrizeListResult = z.infer<typeof activityPlayPrizeListResultSchema>;
@@ -0,0 +1,147 @@
1
+ /**
2
+ * 活动玩法域模型(TIER1):远端活动查询 DTO + 字段级运行时校验单源。
3
+ * 活动事实来自供应商 API(查询时转换——远端活动改造 2026-11-17):本层只描述
4
+ * 供应商返回的活动对象,不做本地目录登记、状态计算或参与入口准备。
5
+ *
6
+ * 身份语义:activityId 是供应商返回的活动标识,按原字符串处理('001'/'1.20'/'1e3'
7
+ * 不改写、不作数字预解析);公开面不出现第二个 ID 或别名映射。
8
+ *
9
+ * 字段校验单源:`activityPlayActivitySchema` 是工具/HTTP/卡片三方共用的活动对象形状
10
+ * (strict 拒未知键——供给侧键名漂移显性失败,不静默放行);
11
+ * 可选字段(description/imageUrl/startsAt/endsAt)缺席即省略,不合成默认值。
12
+ */
13
+ import { z } from 'zod';
14
+ /** 活动开放状态(供应商状态转换后返回;unknown = 上游未知值,不得按 active 参与展示) */
15
+ export type ActivityPlayStatus = 'not_started' | 'active' | 'ended' | 'disabled' | 'unknown';
16
+ /** 活动对象(列表/详情同形;activityId 与状态均来自供应商) */
17
+ export interface ActivityPlayActivity {
18
+ /** 供应商活动标识(按原字符串处理——非本地配置、非数字) */
19
+ readonly activityId: string;
20
+ readonly title: string;
21
+ /** 展示说明,按普通文本处理 */
22
+ readonly description?: string;
23
+ /** HTTPS 封面地址 */
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
+ };
37
+ /** 含时区的 ISO 时间;缺失表示供应商未提供该事实,不编造 */
38
+ readonly startsAt?: string;
39
+ readonly endsAt?: string;
40
+ /**
41
+ * 供应商转换后的活动状态:不表示参与资格;unknown 是保守兜底
42
+ * (上游枚举缺失/无法映射时不得推断为 active)。
43
+ */
44
+ readonly status: ActivityPlayStatus;
45
+ }
46
+ /** 列表结果(上游范围/分页记录归供应商核验;列表被截断不等同没有更多活动) */
47
+ export interface ActivityPlayPage {
48
+ readonly items: readonly ActivityPlayActivity[];
49
+ }
50
+ /**
51
+ * 供应商活动标识:非空、≤128、拒控制字符与路径段破坏符(/ ? # % ——路径定位与
52
+ * URL 编码歧义防线)。除上述形态约束外**按原字符串**收发:字符集/数字形态不做
53
+ * 归一,'001' 与 '1' 是两个不同活动(与旧 activityRef 的字符集白名单语义不同——
54
+ * 现由供应商定义标识空间)。
55
+ */
56
+ export declare const activityPlayIdSchema: z.ZodEffects<z.ZodString, string, string>;
57
+ /** 活动名称:非空、≤64 */
58
+ export declare const activityPlayTitleSchema: z.ZodString;
59
+ /** 说明:普通文本,≤500 */
60
+ export declare const activityPlayDescriptionSchema: z.ZodString;
61
+ /** 时间:含时区偏移的 ISO 形态,且为真实日历时刻(拒 2027-02-30 类滚日值) */
62
+ export declare const activityPlayTimeSchema: z.ZodString;
63
+ /** 封面图:有效 URL 且恒 HTTPS(拒 https://? 等残缺形态) */
64
+ export declare const activityPlayImageUrlSchema: z.ZodString;
65
+ /** 活动对象 schema(列表项/详情/H5 与 B 端展示同形;strict 拒未知键——含旧字段 activityRef/loginRequired) */
66
+ export declare const activityPlayActivitySchema: z.ZodObject<{
67
+ activityId: z.ZodEffects<z.ZodString, string, string>;
68
+ title: z.ZodString;
69
+ description: z.ZodOptional<z.ZodString>;
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
+ }>>;
106
+ startsAt: z.ZodOptional<z.ZodString>;
107
+ endsAt: z.ZodOptional<z.ZodString>;
108
+ status: z.ZodEnum<["not_started", "active", "ended", "disabled", "unknown"]>;
109
+ }, "strict", z.ZodTypeAny, {
110
+ status: "unknown" | "not_started" | "active" | "ended" | "disabled";
111
+ title: string;
112
+ activityId: string;
113
+ description?: string | undefined;
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;
126
+ startsAt?: string | undefined;
127
+ endsAt?: string | undefined;
128
+ }, {
129
+ status: "unknown" | "not_started" | "active" | "ended" | "disabled";
130
+ title: string;
131
+ activityId: string;
132
+ description?: string | undefined;
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;
145
+ startsAt?: string | undefined;
146
+ endsAt?: string | undefined;
147
+ }>;
package/dist/index.d.ts CHANGED
@@ -12,10 +12,14 @@ export * from './domain/offer';
12
12
  export * from './domain/entitlement';
13
13
  export * from './domain/activity';
14
14
  export * from './domain/operation';
15
+ export * from './domain/activity-play';
16
+ export * from './domain/activity-play-prize';
15
17
  export * from './services/member';
16
18
  export * from './services/parking';
17
19
  export * from './services/promotion';
18
20
  export * from './services/mall-info';
21
+ export * from './services/activity-play';
22
+ export * from './services/activity-play-prize';
19
23
  export * from './events';
20
24
  export * from './scope';
21
25
  export * from './query-context';
@@ -31,4 +35,6 @@ export * from './services/customer-service';
31
35
  export * from './member/cards';
32
36
  export * from './promotion/cards';
33
37
  export * from './parking/cards';
38
+ export * from './activity-play/cards';
39
+ export * from './activity-play-prize/cards';
34
40
  export * from './alipay-activity/cards';