@tbox.cn/app-contracts-mall 0.1.1 → 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.
- package/dist/assembly.d.ts +29 -0
- package/dist/deployment.d.ts +43 -0
- package/dist/guard.d.ts +50 -0
- package/dist/index.d.ts +10 -2
- package/dist/member/cards.d.ts +517 -0
- package/dist/runtime.d.ts +11 -0
- package/dist/runtime.js +457 -0
- package/dist/scope.d.ts +49 -0
- package/dist/services/member.d.ts +101 -9
- package/dist/shopping-guide/cards.d.ts +4201 -0
- package/dist/shopping-guide/ports.d.ts +216 -0
- package/package.json +8 -8
- package/src/domain/coupon.ts +0 -8
- package/src/domain/discount.ts +0 -6
- package/src/domain/parking.ts +0 -13
- package/src/domain/points.ts +0 -14
- package/src/events/index.ts +0 -10
- package/src/index.ts +0 -13
- package/src/services/member.ts +0 -21
- package/src/services/parking.ts +0 -16
- package/src/services/promotion.ts +0 -6
- package/tsconfig.build.json +0 -15
- package/tsconfig.json +0 -5
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 商圈装配器(011 B2:TIER1 领域运行时):
|
|
3
|
+
* 纯函数——extractScopeKey/validateScope/extractMallScope,
|
|
4
|
+
* SDK 原语(ScopeSessionRegistry/ProviderRegistry)组合在模板装配点完成(011 L1)。
|
|
5
|
+
*
|
|
6
|
+
* 不 import app-sdk(依赖方向:contracts-mall → contracts;SDK 不依赖 TIER1)。
|
|
7
|
+
*/
|
|
8
|
+
import type { RequestContext } from '@tbox.cn/app-contracts';
|
|
9
|
+
import type { MallDeploymentControlPlane } from './deployment';
|
|
10
|
+
import { type MallScope, type MallRequestContext } from './scope';
|
|
11
|
+
/** 装配器产物:模板注入 createScopeSessionRegistry 的 extractor/validator + 领域提取函数 */
|
|
12
|
+
export interface MallRuntimeAssembly {
|
|
13
|
+
/**
|
|
14
|
+
* scope 键提取(SDK ScopeSessionRegistry 注入点):
|
|
15
|
+
* 无 mall scope → 抛 'Mall scope is required'(非 mall 部署不应装载本装配器)。
|
|
16
|
+
*/
|
|
17
|
+
extractScopeKey(ctx: RequestContext): string;
|
|
18
|
+
/** scope 白名单校验(SDK ScopeSessionRegistry 注入点):parseMallScope 成功且 mallId ∈ malls */
|
|
19
|
+
validateScope(attributes: Record<string, unknown>): boolean;
|
|
20
|
+
/** 011 D1:领域扁平 scope(回显 + ActionGrant 签发/校验单一来源) */
|
|
21
|
+
buildScope(attributes: Record<string, unknown>): Record<string, string>;
|
|
22
|
+
/** 提取 MallScope(模块 handler 前置;无 scope → undefined 由调用方降级) */
|
|
23
|
+
extractMallScope(ctx: RequestContext): MallScope | undefined;
|
|
24
|
+
/** 提取必在 MallScope(调用方已确认存在) */
|
|
25
|
+
requireMallScope(ctx: MallRequestContext): MallScope;
|
|
26
|
+
/** 控制平面(只读快照) */
|
|
27
|
+
controlPlane: Readonly<MallDeploymentControlPlane>;
|
|
28
|
+
}
|
|
29
|
+
export declare function createMallRuntimeAssembly(controlPlane: MallDeploymentControlPlane): MallRuntimeAssembly;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 商圈部署控制平面(011 L2:三段配置的类型真源):
|
|
3
|
+
* deployment(小程序/agent/组件清单)+ malls(白名单)+ providerInstances(外部服务实例)。
|
|
4
|
+
* 无内联密钥(loader 断言在模板层,见 011 L2)。
|
|
5
|
+
*/
|
|
6
|
+
import type { ProviderInstance } from '@tbox.cn/app-contracts';
|
|
7
|
+
/** 组件启用项:componentId + 可选 feature 子集(feature 门控 = 运行时护栏,非装配期裁剪,011 D10) */
|
|
8
|
+
export interface MallDeploymentComponent {
|
|
9
|
+
componentId: string;
|
|
10
|
+
/** 启用 feature(⊆ 模块 declaration.features,doctor feature-declaration 校验) */
|
|
11
|
+
enabledFeatures?: string[];
|
|
12
|
+
/** 可选组件:未安装该模块时 doctor 降级 warning(缺省 false = 必须安装) */
|
|
13
|
+
optional?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** 商圈白名单项 */
|
|
16
|
+
export interface MallDeploymentMall {
|
|
17
|
+
mallId: string;
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
/** Provider 模版声明(011 评审 7.1:credentialType 真源参数化,模板装配不再硬编码商家类型) */
|
|
21
|
+
export interface MallDeploymentProviderTemplate {
|
|
22
|
+
/** 'id@version'(与 ProviderInstance.providerTemplateId 匹配) */
|
|
23
|
+
providerTemplateId: string;
|
|
24
|
+
/** 认证类型(ProviderAuthStrategy.credentialType 注册点匹配键) */
|
|
25
|
+
credentialType: string;
|
|
26
|
+
}
|
|
27
|
+
/** 部署控制平面(部署配置 JSON 的形状) */
|
|
28
|
+
export interface MallDeploymentControlPlane {
|
|
29
|
+
deployment: {
|
|
30
|
+
/** 小程序 appId */
|
|
31
|
+
miniAppId: string;
|
|
32
|
+
/** agent 实例 id */
|
|
33
|
+
agentId: string;
|
|
34
|
+
/** 组件清单(与已装模块对账,doctor deployment-consistency) */
|
|
35
|
+
components: MallDeploymentComponent[];
|
|
36
|
+
};
|
|
37
|
+
/** 商圈白名单(validateScope 依据) */
|
|
38
|
+
malls: MallDeploymentMall[];
|
|
39
|
+
/** Provider 模版声明(可选;缺省由模板装配从实例派生) */
|
|
40
|
+
providerTemplates?: MallDeploymentProviderTemplate[];
|
|
41
|
+
/** Provider 实例(三段之三;机密走 credentialRef,禁内联密钥) */
|
|
42
|
+
providerInstances: ProviderInstance[];
|
|
43
|
+
}
|
package/dist/guard.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 商圈守卫(011:location/user 领域守卫,TIER1 运行时):
|
|
3
|
+
* 卡片/工具入参中的位置与用户字段防御解析。
|
|
4
|
+
* 平台存储数据不可全信——一切外部形状先过 zod。
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/** 商圈位置(经纬度字符串化,D11:数值一律字符串化) */
|
|
8
|
+
export interface MallLocation {
|
|
9
|
+
latitude: string;
|
|
10
|
+
longitude: string;
|
|
11
|
+
/** 可选商圈 id(位置所属 mall) */
|
|
12
|
+
mallId?: string;
|
|
13
|
+
/** 可选名称(POI) */
|
|
14
|
+
name?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const mallLocationSchema: z.ZodObject<{
|
|
17
|
+
latitude: z.ZodString;
|
|
18
|
+
longitude: z.ZodString;
|
|
19
|
+
mallId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
name: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
latitude: string;
|
|
23
|
+
longitude: string;
|
|
24
|
+
name?: string | undefined;
|
|
25
|
+
mallId?: string | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
latitude: string;
|
|
28
|
+
longitude: string;
|
|
29
|
+
name?: string | undefined;
|
|
30
|
+
mallId?: string | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
/** 解析失败返回 undefined(调用方降级「位置未知」文案) */
|
|
33
|
+
export declare function parseMallLocation(raw: unknown): MallLocation | undefined;
|
|
34
|
+
/** 商圈用户标识(D11 字符串化 user 字段守卫) */
|
|
35
|
+
export interface MallUserRef {
|
|
36
|
+
userId: string;
|
|
37
|
+
/** 可选 mall 会员主体 id */
|
|
38
|
+
subjectId?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const mallUserRefSchema: z.ZodObject<{
|
|
41
|
+
userId: z.ZodString;
|
|
42
|
+
subjectId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
userId: string;
|
|
45
|
+
subjectId?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
userId: string;
|
|
48
|
+
subjectId?: string | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
export declare function parseMallUserRef(raw: unknown): MallUserRef | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @tbox.cn/app-contracts-mall:商圈领域契约(TIER1,types
|
|
3
|
-
* 消费方(module
|
|
2
|
+
* @tbox.cn/app-contracts-mall:商圈领域契约(TIER1,types + runtime)。
|
|
3
|
+
* 消费方(module-* / scenario / 模板装配点)只依赖本契约,
|
|
4
4
|
* 不依赖任何模块实现包——结构类型子集接口 + 事件总线破环双向依赖。
|
|
5
|
+
* runtime 值(scope 解析/装配器/守卫)经 ./runtime 导出(dist/runtime.js)。
|
|
5
6
|
*/
|
|
6
7
|
export * from './domain/points';
|
|
7
8
|
export * from './domain/coupon';
|
|
@@ -11,3 +12,10 @@ export * from './services/member';
|
|
|
11
12
|
export * from './services/parking';
|
|
12
13
|
export * from './services/promotion';
|
|
13
14
|
export * from './events';
|
|
15
|
+
export * from './scope';
|
|
16
|
+
export * from './deployment';
|
|
17
|
+
export * from './assembly';
|
|
18
|
+
export * from './guard';
|
|
19
|
+
export * from './shopping-guide/cards';
|
|
20
|
+
export * from './shopping-guide/ports';
|
|
21
|
+
export * from './member/cards';
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 会员域卡片数据契约(011 K2:member 7 卡 zod schema,TIER1)。
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const memberStateSchema: z.ZodEnum<["active", "not_enrolled", "closed"]>;
|
|
6
|
+
/** member-info:账户 + 资料摘要 */
|
|
7
|
+
export declare const memberInfoCardDataSchema: z.ZodObject<{
|
|
8
|
+
userId: z.ZodString;
|
|
9
|
+
state: z.ZodEnum<["active", "not_enrolled", "closed"]>;
|
|
10
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
11
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
12
|
+
contactDisplay: z.ZodOptional<z.ZodString>;
|
|
13
|
+
memberRef: z.ZodOptional<z.ZodString>;
|
|
14
|
+
registeredAt: z.ZodOptional<z.ZodString>;
|
|
15
|
+
labels: z.ZodArray<z.ZodObject<{
|
|
16
|
+
labelRef: z.ZodString;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
name: string;
|
|
20
|
+
labelRef: string;
|
|
21
|
+
}, {
|
|
22
|
+
name: string;
|
|
23
|
+
labelRef: string;
|
|
24
|
+
}>, "many">;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
userId: string;
|
|
27
|
+
state: "active" | "not_enrolled" | "closed";
|
|
28
|
+
labels: {
|
|
29
|
+
name: string;
|
|
30
|
+
labelRef: string;
|
|
31
|
+
}[];
|
|
32
|
+
avatarUrl?: string | undefined;
|
|
33
|
+
displayName?: string | undefined;
|
|
34
|
+
contactDisplay?: string | undefined;
|
|
35
|
+
memberRef?: string | undefined;
|
|
36
|
+
registeredAt?: string | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
userId: string;
|
|
39
|
+
state: "active" | "not_enrolled" | "closed";
|
|
40
|
+
labels: {
|
|
41
|
+
name: string;
|
|
42
|
+
labelRef: string;
|
|
43
|
+
}[];
|
|
44
|
+
avatarUrl?: string | undefined;
|
|
45
|
+
displayName?: string | undefined;
|
|
46
|
+
contactDisplay?: string | undefined;
|
|
47
|
+
memberRef?: string | undefined;
|
|
48
|
+
registeredAt?: string | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
export type MemberInfoCardData = z.infer<typeof memberInfoCardDataSchema>;
|
|
51
|
+
/** member-card-summary:会员卡面(等级 + 积分摘要) */
|
|
52
|
+
export declare const memberCardSummaryCardDataSchema: z.ZodObject<{
|
|
53
|
+
userId: z.ZodString;
|
|
54
|
+
cardRef: z.ZodString;
|
|
55
|
+
cardDisplay: z.ZodString;
|
|
56
|
+
status: z.ZodEnum<["active", "inactive", "frozen", "expired", "unknown"]>;
|
|
57
|
+
levelName: z.ZodOptional<z.ZodString>;
|
|
58
|
+
availablePoints: z.ZodNumber;
|
|
59
|
+
cardImageUrl: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
status: "active" | "unknown" | "inactive" | "frozen" | "expired";
|
|
62
|
+
userId: string;
|
|
63
|
+
cardRef: string;
|
|
64
|
+
cardDisplay: string;
|
|
65
|
+
availablePoints: number;
|
|
66
|
+
levelName?: string | undefined;
|
|
67
|
+
cardImageUrl?: string | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
status: "active" | "unknown" | "inactive" | "frozen" | "expired";
|
|
70
|
+
userId: string;
|
|
71
|
+
cardRef: string;
|
|
72
|
+
cardDisplay: string;
|
|
73
|
+
availablePoints: number;
|
|
74
|
+
levelName?: string | undefined;
|
|
75
|
+
cardImageUrl?: string | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
export type MemberCardSummaryCardData = z.infer<typeof memberCardSummaryCardDataSchema>;
|
|
78
|
+
/** member-coupon-list */
|
|
79
|
+
export declare const memberCouponListCardDataSchema: z.ZodObject<{
|
|
80
|
+
userId: z.ZodString;
|
|
81
|
+
items: z.ZodArray<z.ZodObject<{
|
|
82
|
+
couponRef: z.ZodString;
|
|
83
|
+
title: z.ZodString;
|
|
84
|
+
type: z.ZodEnum<["amount", "discount", "gift", "parking", "unknown"]>;
|
|
85
|
+
status: z.ZodEnum<["effective", "used", "expired", "invalid", "unknown"]>;
|
|
86
|
+
benefitText: z.ZodOptional<z.ZodString>;
|
|
87
|
+
thresholdText: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
90
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
91
|
+
title: string;
|
|
92
|
+
couponRef: string;
|
|
93
|
+
benefitText?: string | undefined;
|
|
94
|
+
thresholdText?: string | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
97
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
98
|
+
title: string;
|
|
99
|
+
couponRef: string;
|
|
100
|
+
benefitText?: string | undefined;
|
|
101
|
+
thresholdText?: string | undefined;
|
|
102
|
+
}>, "many">;
|
|
103
|
+
total: z.ZodNumber;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
userId: string;
|
|
106
|
+
total: number;
|
|
107
|
+
items: {
|
|
108
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
109
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
110
|
+
title: string;
|
|
111
|
+
couponRef: string;
|
|
112
|
+
benefitText?: string | undefined;
|
|
113
|
+
thresholdText?: string | undefined;
|
|
114
|
+
}[];
|
|
115
|
+
}, {
|
|
116
|
+
userId: string;
|
|
117
|
+
total: number;
|
|
118
|
+
items: {
|
|
119
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
120
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
121
|
+
title: string;
|
|
122
|
+
couponRef: string;
|
|
123
|
+
benefitText?: string | undefined;
|
|
124
|
+
thresholdText?: string | undefined;
|
|
125
|
+
}[];
|
|
126
|
+
}>;
|
|
127
|
+
export type MemberCouponListCardData = z.infer<typeof memberCouponListCardDataSchema>;
|
|
128
|
+
/** member-coupon-detail */
|
|
129
|
+
export declare const memberCouponDetailCardDataSchema: z.ZodObject<{
|
|
130
|
+
couponRef: z.ZodString;
|
|
131
|
+
title: z.ZodString;
|
|
132
|
+
type: z.ZodEnum<["amount", "discount", "gift", "parking", "unknown"]>;
|
|
133
|
+
status: z.ZodEnum<["effective", "used", "expired", "invalid", "unknown"]>;
|
|
134
|
+
description: z.ZodOptional<z.ZodString>;
|
|
135
|
+
benefitText: z.ZodOptional<z.ZodString>;
|
|
136
|
+
thresholdText: z.ZodOptional<z.ZodString>;
|
|
137
|
+
}, "strip", z.ZodTypeAny, {
|
|
138
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
139
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
140
|
+
title: string;
|
|
141
|
+
couponRef: string;
|
|
142
|
+
description?: string | undefined;
|
|
143
|
+
benefitText?: string | undefined;
|
|
144
|
+
thresholdText?: string | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
147
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
148
|
+
title: string;
|
|
149
|
+
couponRef: string;
|
|
150
|
+
description?: string | undefined;
|
|
151
|
+
benefitText?: string | undefined;
|
|
152
|
+
thresholdText?: string | undefined;
|
|
153
|
+
}>;
|
|
154
|
+
export type MemberCouponDetailCardData = z.infer<typeof memberCouponDetailCardDataSchema>;
|
|
155
|
+
/**
|
|
156
|
+
* member-point-usage-list(011 K3:吸收教学 points 卡——userId/balance/level 字段对齐)。
|
|
157
|
+
*/
|
|
158
|
+
export declare const memberPointUsageListCardDataSchema: z.ZodObject<{
|
|
159
|
+
userId: z.ZodString;
|
|
160
|
+
balance: z.ZodNumber;
|
|
161
|
+
level: z.ZodEnum<["silver", "gold", "platinum"]>;
|
|
162
|
+
items: z.ZodArray<z.ZodObject<{
|
|
163
|
+
usageRecordRef: z.ZodString;
|
|
164
|
+
title: z.ZodString;
|
|
165
|
+
amount: z.ZodString;
|
|
166
|
+
usedAt: z.ZodOptional<z.ZodString>;
|
|
167
|
+
description: z.ZodOptional<z.ZodString>;
|
|
168
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
amount: string;
|
|
170
|
+
title: string;
|
|
171
|
+
usageRecordRef: string;
|
|
172
|
+
description?: string | undefined;
|
|
173
|
+
usedAt?: string | undefined;
|
|
174
|
+
}, {
|
|
175
|
+
amount: string;
|
|
176
|
+
title: string;
|
|
177
|
+
usageRecordRef: string;
|
|
178
|
+
description?: string | undefined;
|
|
179
|
+
usedAt?: string | undefined;
|
|
180
|
+
}>, "many">;
|
|
181
|
+
total: z.ZodNumber;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
userId: string;
|
|
184
|
+
total: number;
|
|
185
|
+
items: {
|
|
186
|
+
amount: string;
|
|
187
|
+
title: string;
|
|
188
|
+
usageRecordRef: string;
|
|
189
|
+
description?: string | undefined;
|
|
190
|
+
usedAt?: string | undefined;
|
|
191
|
+
}[];
|
|
192
|
+
balance: number;
|
|
193
|
+
level: "silver" | "gold" | "platinum";
|
|
194
|
+
}, {
|
|
195
|
+
userId: string;
|
|
196
|
+
total: number;
|
|
197
|
+
items: {
|
|
198
|
+
amount: string;
|
|
199
|
+
title: string;
|
|
200
|
+
usageRecordRef: string;
|
|
201
|
+
description?: string | undefined;
|
|
202
|
+
usedAt?: string | undefined;
|
|
203
|
+
}[];
|
|
204
|
+
balance: number;
|
|
205
|
+
level: "silver" | "gold" | "platinum";
|
|
206
|
+
}>;
|
|
207
|
+
export type MemberPointUsageListCardData = z.infer<typeof memberPointUsageListCardDataSchema>;
|
|
208
|
+
/** member-enrollment-form(入会表单;写动作 = member.enroll grant) */
|
|
209
|
+
export declare const memberEnrollmentFormCardDataSchema: z.ZodObject<{
|
|
210
|
+
userId: z.ZodString;
|
|
211
|
+
state: z.ZodEnum<["active", "not_enrolled", "closed"]>;
|
|
212
|
+
/** 表单必填项(渲染端收集后经 componentAction member.enroll 提交) */
|
|
213
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
214
|
+
fieldId: z.ZodString;
|
|
215
|
+
label: z.ZodString;
|
|
216
|
+
required: z.ZodBoolean;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
label: string;
|
|
219
|
+
fieldId: string;
|
|
220
|
+
required: boolean;
|
|
221
|
+
}, {
|
|
222
|
+
label: string;
|
|
223
|
+
fieldId: string;
|
|
224
|
+
required: boolean;
|
|
225
|
+
}>, "many">;
|
|
226
|
+
actionId: z.ZodString;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
userId: string;
|
|
229
|
+
actionId: string;
|
|
230
|
+
state: "active" | "not_enrolled" | "closed";
|
|
231
|
+
fields: {
|
|
232
|
+
label: string;
|
|
233
|
+
fieldId: string;
|
|
234
|
+
required: boolean;
|
|
235
|
+
}[];
|
|
236
|
+
}, {
|
|
237
|
+
userId: string;
|
|
238
|
+
actionId: string;
|
|
239
|
+
state: "active" | "not_enrolled" | "closed";
|
|
240
|
+
fields: {
|
|
241
|
+
label: string;
|
|
242
|
+
fieldId: string;
|
|
243
|
+
required: boolean;
|
|
244
|
+
}[];
|
|
245
|
+
}>;
|
|
246
|
+
export type MemberEnrollmentFormCardData = z.infer<typeof memberEnrollmentFormCardDataSchema>;
|
|
247
|
+
/** member-enrollment-status(入会结果状态卡) */
|
|
248
|
+
export declare const memberEnrollmentStatusCardDataSchema: z.ZodObject<{
|
|
249
|
+
userId: z.ZodString;
|
|
250
|
+
success: z.ZodBoolean;
|
|
251
|
+
memberRef: z.ZodOptional<z.ZodString>;
|
|
252
|
+
message: z.ZodOptional<z.ZodString>;
|
|
253
|
+
state: z.ZodEnum<["active", "not_enrolled", "closed"]>;
|
|
254
|
+
}, "strip", z.ZodTypeAny, {
|
|
255
|
+
success: boolean;
|
|
256
|
+
userId: string;
|
|
257
|
+
state: "active" | "not_enrolled" | "closed";
|
|
258
|
+
message?: string | undefined;
|
|
259
|
+
memberRef?: string | undefined;
|
|
260
|
+
}, {
|
|
261
|
+
success: boolean;
|
|
262
|
+
userId: string;
|
|
263
|
+
state: "active" | "not_enrolled" | "closed";
|
|
264
|
+
message?: string | undefined;
|
|
265
|
+
memberRef?: string | undefined;
|
|
266
|
+
}>;
|
|
267
|
+
export type MemberEnrollmentStatusCardData = z.infer<typeof memberEnrollmentStatusCardDataSchema>;
|
|
268
|
+
/** 7 卡 schema map(cardType → dataSchema) */
|
|
269
|
+
export declare const memberCardDataSchemas: {
|
|
270
|
+
readonly 'member-info': z.ZodObject<{
|
|
271
|
+
userId: z.ZodString;
|
|
272
|
+
state: z.ZodEnum<["active", "not_enrolled", "closed"]>;
|
|
273
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
274
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
275
|
+
contactDisplay: z.ZodOptional<z.ZodString>;
|
|
276
|
+
memberRef: z.ZodOptional<z.ZodString>;
|
|
277
|
+
registeredAt: z.ZodOptional<z.ZodString>;
|
|
278
|
+
labels: z.ZodArray<z.ZodObject<{
|
|
279
|
+
labelRef: z.ZodString;
|
|
280
|
+
name: z.ZodString;
|
|
281
|
+
}, "strip", z.ZodTypeAny, {
|
|
282
|
+
name: string;
|
|
283
|
+
labelRef: string;
|
|
284
|
+
}, {
|
|
285
|
+
name: string;
|
|
286
|
+
labelRef: string;
|
|
287
|
+
}>, "many">;
|
|
288
|
+
}, "strip", z.ZodTypeAny, {
|
|
289
|
+
userId: string;
|
|
290
|
+
state: "active" | "not_enrolled" | "closed";
|
|
291
|
+
labels: {
|
|
292
|
+
name: string;
|
|
293
|
+
labelRef: string;
|
|
294
|
+
}[];
|
|
295
|
+
avatarUrl?: string | undefined;
|
|
296
|
+
displayName?: string | undefined;
|
|
297
|
+
contactDisplay?: string | undefined;
|
|
298
|
+
memberRef?: string | undefined;
|
|
299
|
+
registeredAt?: string | undefined;
|
|
300
|
+
}, {
|
|
301
|
+
userId: string;
|
|
302
|
+
state: "active" | "not_enrolled" | "closed";
|
|
303
|
+
labels: {
|
|
304
|
+
name: string;
|
|
305
|
+
labelRef: string;
|
|
306
|
+
}[];
|
|
307
|
+
avatarUrl?: string | undefined;
|
|
308
|
+
displayName?: string | undefined;
|
|
309
|
+
contactDisplay?: string | undefined;
|
|
310
|
+
memberRef?: string | undefined;
|
|
311
|
+
registeredAt?: string | undefined;
|
|
312
|
+
}>;
|
|
313
|
+
readonly 'member-card-summary': z.ZodObject<{
|
|
314
|
+
userId: z.ZodString;
|
|
315
|
+
cardRef: z.ZodString;
|
|
316
|
+
cardDisplay: z.ZodString;
|
|
317
|
+
status: z.ZodEnum<["active", "inactive", "frozen", "expired", "unknown"]>;
|
|
318
|
+
levelName: z.ZodOptional<z.ZodString>;
|
|
319
|
+
availablePoints: z.ZodNumber;
|
|
320
|
+
cardImageUrl: z.ZodOptional<z.ZodString>;
|
|
321
|
+
}, "strip", z.ZodTypeAny, {
|
|
322
|
+
status: "active" | "unknown" | "inactive" | "frozen" | "expired";
|
|
323
|
+
userId: string;
|
|
324
|
+
cardRef: string;
|
|
325
|
+
cardDisplay: string;
|
|
326
|
+
availablePoints: number;
|
|
327
|
+
levelName?: string | undefined;
|
|
328
|
+
cardImageUrl?: string | undefined;
|
|
329
|
+
}, {
|
|
330
|
+
status: "active" | "unknown" | "inactive" | "frozen" | "expired";
|
|
331
|
+
userId: string;
|
|
332
|
+
cardRef: string;
|
|
333
|
+
cardDisplay: string;
|
|
334
|
+
availablePoints: number;
|
|
335
|
+
levelName?: string | undefined;
|
|
336
|
+
cardImageUrl?: string | undefined;
|
|
337
|
+
}>;
|
|
338
|
+
readonly 'member-coupon-list': z.ZodObject<{
|
|
339
|
+
userId: z.ZodString;
|
|
340
|
+
items: z.ZodArray<z.ZodObject<{
|
|
341
|
+
couponRef: z.ZodString;
|
|
342
|
+
title: z.ZodString;
|
|
343
|
+
type: z.ZodEnum<["amount", "discount", "gift", "parking", "unknown"]>;
|
|
344
|
+
status: z.ZodEnum<["effective", "used", "expired", "invalid", "unknown"]>;
|
|
345
|
+
benefitText: z.ZodOptional<z.ZodString>;
|
|
346
|
+
thresholdText: z.ZodOptional<z.ZodString>;
|
|
347
|
+
}, "strip", z.ZodTypeAny, {
|
|
348
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
349
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
350
|
+
title: string;
|
|
351
|
+
couponRef: string;
|
|
352
|
+
benefitText?: string | undefined;
|
|
353
|
+
thresholdText?: string | undefined;
|
|
354
|
+
}, {
|
|
355
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
356
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
357
|
+
title: string;
|
|
358
|
+
couponRef: string;
|
|
359
|
+
benefitText?: string | undefined;
|
|
360
|
+
thresholdText?: string | undefined;
|
|
361
|
+
}>, "many">;
|
|
362
|
+
total: z.ZodNumber;
|
|
363
|
+
}, "strip", z.ZodTypeAny, {
|
|
364
|
+
userId: string;
|
|
365
|
+
total: number;
|
|
366
|
+
items: {
|
|
367
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
368
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
369
|
+
title: string;
|
|
370
|
+
couponRef: string;
|
|
371
|
+
benefitText?: string | undefined;
|
|
372
|
+
thresholdText?: string | undefined;
|
|
373
|
+
}[];
|
|
374
|
+
}, {
|
|
375
|
+
userId: string;
|
|
376
|
+
total: number;
|
|
377
|
+
items: {
|
|
378
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
379
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
380
|
+
title: string;
|
|
381
|
+
couponRef: string;
|
|
382
|
+
benefitText?: string | undefined;
|
|
383
|
+
thresholdText?: string | undefined;
|
|
384
|
+
}[];
|
|
385
|
+
}>;
|
|
386
|
+
readonly 'member-coupon-detail': z.ZodObject<{
|
|
387
|
+
couponRef: z.ZodString;
|
|
388
|
+
title: z.ZodString;
|
|
389
|
+
type: z.ZodEnum<["amount", "discount", "gift", "parking", "unknown"]>;
|
|
390
|
+
status: z.ZodEnum<["effective", "used", "expired", "invalid", "unknown"]>;
|
|
391
|
+
description: z.ZodOptional<z.ZodString>;
|
|
392
|
+
benefitText: z.ZodOptional<z.ZodString>;
|
|
393
|
+
thresholdText: z.ZodOptional<z.ZodString>;
|
|
394
|
+
}, "strip", z.ZodTypeAny, {
|
|
395
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
396
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
397
|
+
title: string;
|
|
398
|
+
couponRef: string;
|
|
399
|
+
description?: string | undefined;
|
|
400
|
+
benefitText?: string | undefined;
|
|
401
|
+
thresholdText?: string | undefined;
|
|
402
|
+
}, {
|
|
403
|
+
type: "unknown" | "amount" | "discount" | "gift" | "parking";
|
|
404
|
+
status: "unknown" | "expired" | "effective" | "used" | "invalid";
|
|
405
|
+
title: string;
|
|
406
|
+
couponRef: string;
|
|
407
|
+
description?: string | undefined;
|
|
408
|
+
benefitText?: string | undefined;
|
|
409
|
+
thresholdText?: string | undefined;
|
|
410
|
+
}>;
|
|
411
|
+
readonly 'member-point-usage-list': z.ZodObject<{
|
|
412
|
+
userId: z.ZodString;
|
|
413
|
+
balance: z.ZodNumber;
|
|
414
|
+
level: z.ZodEnum<["silver", "gold", "platinum"]>;
|
|
415
|
+
items: z.ZodArray<z.ZodObject<{
|
|
416
|
+
usageRecordRef: z.ZodString;
|
|
417
|
+
title: z.ZodString;
|
|
418
|
+
amount: z.ZodString;
|
|
419
|
+
usedAt: z.ZodOptional<z.ZodString>;
|
|
420
|
+
description: z.ZodOptional<z.ZodString>;
|
|
421
|
+
}, "strip", z.ZodTypeAny, {
|
|
422
|
+
amount: string;
|
|
423
|
+
title: string;
|
|
424
|
+
usageRecordRef: string;
|
|
425
|
+
description?: string | undefined;
|
|
426
|
+
usedAt?: string | undefined;
|
|
427
|
+
}, {
|
|
428
|
+
amount: string;
|
|
429
|
+
title: string;
|
|
430
|
+
usageRecordRef: string;
|
|
431
|
+
description?: string | undefined;
|
|
432
|
+
usedAt?: string | undefined;
|
|
433
|
+
}>, "many">;
|
|
434
|
+
total: z.ZodNumber;
|
|
435
|
+
}, "strip", z.ZodTypeAny, {
|
|
436
|
+
userId: string;
|
|
437
|
+
total: number;
|
|
438
|
+
items: {
|
|
439
|
+
amount: string;
|
|
440
|
+
title: string;
|
|
441
|
+
usageRecordRef: string;
|
|
442
|
+
description?: string | undefined;
|
|
443
|
+
usedAt?: string | undefined;
|
|
444
|
+
}[];
|
|
445
|
+
balance: number;
|
|
446
|
+
level: "silver" | "gold" | "platinum";
|
|
447
|
+
}, {
|
|
448
|
+
userId: string;
|
|
449
|
+
total: number;
|
|
450
|
+
items: {
|
|
451
|
+
amount: string;
|
|
452
|
+
title: string;
|
|
453
|
+
usageRecordRef: string;
|
|
454
|
+
description?: string | undefined;
|
|
455
|
+
usedAt?: string | undefined;
|
|
456
|
+
}[];
|
|
457
|
+
balance: number;
|
|
458
|
+
level: "silver" | "gold" | "platinum";
|
|
459
|
+
}>;
|
|
460
|
+
readonly 'member-enrollment-form': z.ZodObject<{
|
|
461
|
+
userId: z.ZodString;
|
|
462
|
+
state: z.ZodEnum<["active", "not_enrolled", "closed"]>;
|
|
463
|
+
/** 表单必填项(渲染端收集后经 componentAction member.enroll 提交) */
|
|
464
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
465
|
+
fieldId: z.ZodString;
|
|
466
|
+
label: z.ZodString;
|
|
467
|
+
required: z.ZodBoolean;
|
|
468
|
+
}, "strip", z.ZodTypeAny, {
|
|
469
|
+
label: string;
|
|
470
|
+
fieldId: string;
|
|
471
|
+
required: boolean;
|
|
472
|
+
}, {
|
|
473
|
+
label: string;
|
|
474
|
+
fieldId: string;
|
|
475
|
+
required: boolean;
|
|
476
|
+
}>, "many">;
|
|
477
|
+
actionId: z.ZodString;
|
|
478
|
+
}, "strip", z.ZodTypeAny, {
|
|
479
|
+
userId: string;
|
|
480
|
+
actionId: string;
|
|
481
|
+
state: "active" | "not_enrolled" | "closed";
|
|
482
|
+
fields: {
|
|
483
|
+
label: string;
|
|
484
|
+
fieldId: string;
|
|
485
|
+
required: boolean;
|
|
486
|
+
}[];
|
|
487
|
+
}, {
|
|
488
|
+
userId: string;
|
|
489
|
+
actionId: string;
|
|
490
|
+
state: "active" | "not_enrolled" | "closed";
|
|
491
|
+
fields: {
|
|
492
|
+
label: string;
|
|
493
|
+
fieldId: string;
|
|
494
|
+
required: boolean;
|
|
495
|
+
}[];
|
|
496
|
+
}>;
|
|
497
|
+
readonly 'member-enrollment-status': z.ZodObject<{
|
|
498
|
+
userId: z.ZodString;
|
|
499
|
+
success: z.ZodBoolean;
|
|
500
|
+
memberRef: z.ZodOptional<z.ZodString>;
|
|
501
|
+
message: z.ZodOptional<z.ZodString>;
|
|
502
|
+
state: z.ZodEnum<["active", "not_enrolled", "closed"]>;
|
|
503
|
+
}, "strip", z.ZodTypeAny, {
|
|
504
|
+
success: boolean;
|
|
505
|
+
userId: string;
|
|
506
|
+
state: "active" | "not_enrolled" | "closed";
|
|
507
|
+
message?: string | undefined;
|
|
508
|
+
memberRef?: string | undefined;
|
|
509
|
+
}, {
|
|
510
|
+
success: boolean;
|
|
511
|
+
userId: string;
|
|
512
|
+
state: "active" | "not_enrolled" | "closed";
|
|
513
|
+
message?: string | undefined;
|
|
514
|
+
memberRef?: string | undefined;
|
|
515
|
+
}>;
|
|
516
|
+
};
|
|
517
|
+
export type MemberCardType = keyof typeof memberCardDataSchemas;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tbox.cn/app-contracts-mall runtime 入口(011 A5:types-only → types + runtime)。
|
|
3
|
+
* 本文件为唯一运行时 JS(经 tsup/esbuild 出 dist/runtime.js);
|
|
4
|
+
* 类型面仍经 tsc emitDeclarationOnly 出 dist/*.d.ts。
|
|
5
|
+
* 依赖方向:contracts-mall → contracts(TIER0);SDK 不 import 本包(011 B3)。
|
|
6
|
+
*/
|
|
7
|
+
export { MALL_SCOPE_KEY, mallScopeSchema, parseMallScope, extractMallScope, requireMallScope } from './scope';
|
|
8
|
+
export { createMallRuntimeAssembly } from './assembly';
|
|
9
|
+
export { mallLocationSchema, parseMallLocation, mallUserRefSchema, parseMallUserRef } from './guard';
|
|
10
|
+
export * from './shopping-guide/cards';
|
|
11
|
+
export * from './member/cards';
|