@tbox.cn/app-contracts-mall 0.12.4 → 0.13.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 +7 -7
- package/dist/{chunk-KIZD6FZ2.js → chunk-CV5ICZCZ.js} +6 -1
- package/dist/domain/parking.d.ts +2 -2
- package/dist/domain/shopping-guide.d.ts +1 -1
- package/dist/guard.d.ts +2 -2
- package/dist/mall-scope-url.d.ts +1 -1
- package/dist/member/cards.d.ts +3 -3
- package/dist/parking/cards.d.ts +1 -1
- package/dist/promotion/cards.d.ts +6 -6
- package/dist/query-context.d.ts +1 -1
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +11 -9
- package/dist/scope.d.ts +16 -7
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/request-credentials.d.ts +2 -2
- package/dist/services/customer-service.d.ts +4 -3
- package/dist/services/member.d.ts +15 -15
- package/dist/services/parking.d.ts +5 -5
- package/dist/services/promotion.d.ts +4 -3
- package/dist/services/shopping-guide.d.ts +3 -1
- package/dist/shared/cards.d.ts +2 -2
- package/dist/shopping-guide/cards.d.ts +11 -11
- package/package.json +2 -2
- package/src/assembly.ts +7 -7
- package/src/domain/parking.ts +2 -2
- package/src/domain/shopping-guide.ts +1 -1
- package/src/guard.ts +2 -2
- package/src/mall-scope-url.ts +1 -1
- package/src/member/cards.ts +3 -3
- package/src/parking/cards.ts +1 -1
- package/src/promotion/cards.ts +2 -2
- package/src/query-context.ts +1 -1
- package/src/runtime.ts +3 -3
- package/src/scope.ts +20 -7
- package/src/server/index.ts +1 -1
- package/src/server/mall-control-plane.ts +2 -2
- package/src/server/request-credentials.ts +2 -2
- package/src/services/customer-service.ts +4 -3
- package/src/services/mall-info.ts +1 -1
- package/src/services/member.ts +22 -22
- package/src/services/parking.ts +7 -7
- package/src/services/promotion.ts +4 -3
- package/src/services/shopping-guide.ts +3 -1
- package/src/shared/cards.ts +2 -2
- package/src/shopping-guide/cards.ts +7 -7
package/dist/assembly.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 商圈装配器(
|
|
2
|
+
* 商圈装配器(TIER1 领域运行时):
|
|
3
3
|
* 纯函数——extractScopeKey/validateScope/extractMallScope,
|
|
4
|
-
* SDK 原语(ScopeSessionRegistry/ProviderRegistry
|
|
4
|
+
* SDK 原语(ScopeSessionRegistry/ProviderRegistry)组合在模板装配点完成。
|
|
5
5
|
*
|
|
6
6
|
* 不 import app-sdk(依赖方向:contracts-mall → contracts;SDK 不依赖 TIER1)。
|
|
7
7
|
*
|
|
@@ -19,7 +19,7 @@ import { type MallScope } from './scope';
|
|
|
19
19
|
*/
|
|
20
20
|
export declare const AUTH_LOGIN_SERVICE = "auth.alipay-login";
|
|
21
21
|
/**
|
|
22
|
-
* mall 域装配形状(TIER0 ScopeAssemblyContract 的 TIER1 具体化;
|
|
22
|
+
* mall 域装配形状(TIER0 ScopeAssemblyContract 的 TIER1 具体化; 自 module-mall-core 下沉):
|
|
23
23
|
* module-mall-core register 期注册于 ctx.domainAssemblies(SCOPE_ASSEMBLY_KIND),
|
|
24
24
|
* 消费方(模板装配点/本包家页面/SDK)按本类型泛型断言查表——域模块间零包依赖
|
|
25
25
|
* (workspace-dag 铁律:跨模块走注册表 + 契约类型)。
|
|
@@ -46,7 +46,7 @@ export interface MallScopeAssembly extends ScopeAssemblyContract {
|
|
|
46
46
|
readonly scopeDefaults: Readonly<Record<string, unknown>> | undefined;
|
|
47
47
|
/** 016:默认商圈 HELLO context(无 URL 参数访问时的服务端兜底;缺省 defaultMallId → undefined) */
|
|
48
48
|
defaultMallContext(): Record<string, unknown> | undefined;
|
|
49
|
-
/**
|
|
49
|
+
/** ENHANCE_CTX 双职责(miniAppId 回填 + mall.info 预热;fail-soft——抛错/超时原 context 继续) */
|
|
50
50
|
enhanceHelloContext(context: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -67,7 +67,7 @@ export interface MallRuntimeAssembly {
|
|
|
67
67
|
extractScopeKey(ctx: RequestContext): string;
|
|
68
68
|
/** scope 形状校验(SDK ScopeSessionRegistry 注入点):单一形状守卫核(白名单判定已退役) */
|
|
69
69
|
validateScope(attributes: Record<string, unknown>): boolean;
|
|
70
|
-
/**
|
|
70
|
+
/** 领域扁平 scope(回显 + ActionGrant 签发/校验单一来源) */
|
|
71
71
|
buildScope(attributes: Record<string, unknown>): Record<string, string>;
|
|
72
72
|
/** 提取 MallScope(模块 handler 前置;无 scope → undefined 由调用方降级) */
|
|
73
73
|
extractMallScope(ctx: RequestContext): MallScope | undefined;
|
|
@@ -84,8 +84,8 @@ export declare function createMallRuntimeAssembly(controlPlane: MallDeploymentCo
|
|
|
84
84
|
*/
|
|
85
85
|
export declare function createMallContextValidator(): (attributes: Record<string, unknown>) => boolean;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
87
|
+
* buildScope 包装——从控制平面参考表回填 mallName(自 mall 模板 deployment.ts
|
|
88
|
+
* 迁入,单一模板统一化)。
|
|
89
89
|
* scopeFlat(mallId[+miniAppId])→ HELLO_ACK.mallScope 回显,mallName 为壳品牌区
|
|
90
90
|
* (ChatHeader)服务端真源。
|
|
91
91
|
*
|
|
@@ -31,6 +31,10 @@ function readLoginMallId(context) {
|
|
|
31
31
|
const mallId = mall.mallId;
|
|
32
32
|
return typeof mallId === "string" && mallId.length > 0 ? mallId : void 0;
|
|
33
33
|
}
|
|
34
|
+
function readScopeDefaultMallId(ctx) {
|
|
35
|
+
const v = ctx?.scopeDefaults?.["defaultMallId"];
|
|
36
|
+
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
37
|
+
}
|
|
34
38
|
|
|
35
39
|
export {
|
|
36
40
|
MALL_SCOPE_KEY,
|
|
@@ -39,5 +43,6 @@ export {
|
|
|
39
43
|
parseMallScope,
|
|
40
44
|
extractMallScope,
|
|
41
45
|
mallScopeOf,
|
|
42
|
-
readLoginMallId
|
|
46
|
+
readLoginMallId,
|
|
47
|
+
readScopeDefaultMallId
|
|
43
48
|
};
|
package/dist/domain/parking.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 停车域模型(015:POC parking 域精华沉淀,TIER1)。
|
|
3
|
-
* 金额一律 cents(number
|
|
3
|
+
* 金额一律 cents(number);展示层字符串化。
|
|
4
4
|
*/
|
|
5
5
|
/** 停车车辆(绑定车) */
|
|
6
6
|
export interface ParkingVehicle {
|
|
@@ -195,7 +195,7 @@ export interface PaymentOperation {
|
|
|
195
195
|
readonly entryAt?: string;
|
|
196
196
|
/**
|
|
197
197
|
* 报价投影(建单时自报价快照,对齐 entryAt 同模式——PAID 原卡翻转要重灌终态卡数据,
|
|
198
|
-
* 而
|
|
198
|
+
* 而 报价缓存仅 UNPAID 态可见、届时不可达)。optional:存量 PAYING 单与旧版本
|
|
199
199
|
* 发起的支付无此投影,PAID 收口降级为出回执新卡(零回归语义)。
|
|
200
200
|
*/
|
|
201
201
|
readonly quoteProjection?: {
|
|
@@ -10,7 +10,7 @@ export interface MoneyRecord {
|
|
|
10
10
|
readonly amountMinor: number;
|
|
11
11
|
readonly display: string;
|
|
12
12
|
}
|
|
13
|
-
/** 门店位置值对象(零坐标依赖,POC
|
|
13
|
+
/** 门店位置值对象(零坐标依赖,POC ;poiId 有值时可升级为坐标导航) */
|
|
14
14
|
export interface ShopLocationRecord {
|
|
15
15
|
readonly buildingName?: string;
|
|
16
16
|
readonly floorName?: string;
|
package/dist/guard.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 平台存储数据不可全信——一切外部形状先过 zod。
|
|
5
5
|
*/
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
/**
|
|
7
|
+
/** 商圈位置(经纬度字符串化,数值一律字符串化) */
|
|
8
8
|
export interface MallLocation {
|
|
9
9
|
latitude: string;
|
|
10
10
|
longitude: string;
|
|
@@ -31,7 +31,7 @@ export declare const mallLocationSchema: z.ZodObject<{
|
|
|
31
31
|
}>;
|
|
32
32
|
/** 解析失败返回 undefined(调用方降级「位置未知」文案) */
|
|
33
33
|
export declare function parseMallLocation(raw: unknown): MallLocation | undefined;
|
|
34
|
-
/**
|
|
34
|
+
/** 商圈用户标识(字符串化 user 字段守卫) */
|
|
35
35
|
export interface MallUserRef {
|
|
36
36
|
userId: string;
|
|
37
37
|
/** 可选 mall 会员主体 id */
|
package/dist/mall-scope-url.d.ts
CHANGED
package/dist/member/cards.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 会员域卡片数据契约(
|
|
2
|
+
* 会员域卡片数据契约(member 卡 zod schema,TIER1;券面 0.4.0 净删——promotion 承接)。
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
export declare const memberAuthStateSchema: z.ZodEnum<["authenticated", "unauthenticated"]>;
|
|
@@ -232,7 +232,7 @@ export declare const memberCardSummaryCardDataSchema: z.ZodObject<{
|
|
|
232
232
|
}>;
|
|
233
233
|
export type MemberCardSummaryCardData = z.infer<typeof memberCardSummaryCardDataSchema>;
|
|
234
234
|
/**
|
|
235
|
-
* member-point-usage-list
|
|
235
|
+
* member-point-usage-list(余额、厂商会员标签与积分流水)。
|
|
236
236
|
*/
|
|
237
237
|
export declare const memberPointUsageListCardDataSchema: z.ZodObject<{
|
|
238
238
|
userId: z.ZodString;
|
|
@@ -406,7 +406,7 @@ export declare const memberEnrollmentFormCardDataSchema: z.ZodObject<{
|
|
|
406
406
|
manualNotice?: string | undefined;
|
|
407
407
|
}>;
|
|
408
408
|
export type MemberEnrollmentFormCardData = z.infer<typeof memberEnrollmentFormCardDataSchema>;
|
|
409
|
-
/** member-enrollment-status(入会结果状态卡;pending
|
|
409
|
+
/** member-enrollment-status(入会结果状态卡;pending 态附显式刷新按钮) */
|
|
410
410
|
export declare const memberEnrollmentStatusCardDataSchema: z.ZodObject<{
|
|
411
411
|
userId: z.ZodString;
|
|
412
412
|
attemptRef: z.ZodOptional<z.ZodString>;
|
package/dist/parking/cards.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare const promotionOfferListCardDataSchema: z.ZodObject<{
|
|
|
52
52
|
availabilityStatus: z.ZodOptional<z.ZodEnum<["AVAILABLE", "UNAVAILABLE", "REQUIRES_ACTION", "UNKNOWN"]>>;
|
|
53
53
|
validityText: z.ZodOptional<z.ZodString>;
|
|
54
54
|
imageUrl: z.ZodOptional<z.ZodString>;
|
|
55
|
-
/** 0.3.2
|
|
55
|
+
/** 0.3.2 条目动作(send:查看详情) */
|
|
56
56
|
itemActions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
57
57
|
kind: z.ZodLiteral<"send">;
|
|
58
58
|
label: z.ZodString;
|
|
@@ -436,7 +436,7 @@ export declare const promotionEntitlementListCardDataSchema: z.ZodObject<{
|
|
|
436
436
|
usageRuleText: z.ZodOptional<z.ZodString>;
|
|
437
437
|
validityText: z.ZodOptional<z.ZodString>;
|
|
438
438
|
validUntilText: z.ZodOptional<z.ZodString>;
|
|
439
|
-
/** 0.3.2
|
|
439
|
+
/** 0.3.2 条目动作(send:查看详情) */
|
|
440
440
|
itemActions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
441
441
|
kind: z.ZodLiteral<"send">;
|
|
442
442
|
label: z.ZodString;
|
|
@@ -817,7 +817,7 @@ export declare const promotionBestDealCardDataSchema: z.ZodObject<{
|
|
|
817
817
|
availabilityStatus: z.ZodOptional<z.ZodEnum<["AVAILABLE", "UNAVAILABLE", "REQUIRES_ACTION", "UNKNOWN"]>>;
|
|
818
818
|
validityText: z.ZodOptional<z.ZodString>;
|
|
819
819
|
imageUrl: z.ZodOptional<z.ZodString>;
|
|
820
|
-
/** 0.3.2
|
|
820
|
+
/** 0.3.2 条目动作(send:查看详情) */
|
|
821
821
|
itemActions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
822
822
|
kind: z.ZodLiteral<"send">;
|
|
823
823
|
label: z.ZodString;
|
|
@@ -1321,7 +1321,7 @@ export declare const promotionCardDataSchemas: {
|
|
|
1321
1321
|
availabilityStatus: z.ZodOptional<z.ZodEnum<["AVAILABLE", "UNAVAILABLE", "REQUIRES_ACTION", "UNKNOWN"]>>;
|
|
1322
1322
|
validityText: z.ZodOptional<z.ZodString>;
|
|
1323
1323
|
imageUrl: z.ZodOptional<z.ZodString>;
|
|
1324
|
-
/** 0.3.2
|
|
1324
|
+
/** 0.3.2 条目动作(send:查看详情) */
|
|
1325
1325
|
itemActions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
1326
1326
|
kind: z.ZodLiteral<"send">;
|
|
1327
1327
|
label: z.ZodString;
|
|
@@ -1701,7 +1701,7 @@ export declare const promotionCardDataSchemas: {
|
|
|
1701
1701
|
usageRuleText: z.ZodOptional<z.ZodString>;
|
|
1702
1702
|
validityText: z.ZodOptional<z.ZodString>;
|
|
1703
1703
|
validUntilText: z.ZodOptional<z.ZodString>;
|
|
1704
|
-
/** 0.3.2
|
|
1704
|
+
/** 0.3.2 条目动作(send:查看详情) */
|
|
1705
1705
|
itemActions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
1706
1706
|
kind: z.ZodLiteral<"send">;
|
|
1707
1707
|
label: z.ZodString;
|
|
@@ -2078,7 +2078,7 @@ export declare const promotionCardDataSchemas: {
|
|
|
2078
2078
|
availabilityStatus: z.ZodOptional<z.ZodEnum<["AVAILABLE", "UNAVAILABLE", "REQUIRES_ACTION", "UNKNOWN"]>>;
|
|
2079
2079
|
validityText: z.ZodOptional<z.ZodString>;
|
|
2080
2080
|
imageUrl: z.ZodOptional<z.ZodString>;
|
|
2081
|
-
/** 0.3.2
|
|
2081
|
+
/** 0.3.2 条目动作(send:查看详情) */
|
|
2082
2082
|
itemActions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
2083
2083
|
kind: z.ZodLiteral<"send">;
|
|
2084
2084
|
label: z.ZodString;
|
package/dist/query-context.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 留在模块内,不在本文件。
|
|
7
7
|
*
|
|
8
8
|
* plazaId 边界(不可变约束):plazaId 归一是客户端 mall-scope-url 单点职责,
|
|
9
|
-
* 本文件只认 mallId
|
|
9
|
+
* 本文件只认 mallId 契约键,不接受别名(解析入口/工具面/上下文提取/装饰器四道防护一致收口)。
|
|
10
10
|
*/
|
|
11
11
|
import type { RequestContext } from '@tbox.cn/app-contracts';
|
|
12
12
|
import type { MallScope } from './scope';
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @tbox.cn/app-contracts-mall runtime 入口(
|
|
2
|
+
* @tbox.cn/app-contracts-mall runtime 入口(types-only → types + runtime)。
|
|
3
3
|
* 本文件为唯一运行时 JS(经 tsup/esbuild 出 dist/runtime.js);
|
|
4
4
|
* 类型面仍经 tsc emitDeclarationOnly 出 dist/*.d.ts。
|
|
5
|
-
* 依赖方向:contracts-mall → contracts(TIER0);SDK 不 import
|
|
5
|
+
* 依赖方向:contracts-mall → contracts(TIER0);SDK 不 import 本包。
|
|
6
6
|
*/
|
|
7
|
-
export { MALL_SCOPE_KEY, mallScopeSchema, mallSlot, parseMallScope, extractMallScope, mallScopeOf, readLoginMallId } from './scope';
|
|
7
|
+
export { MALL_SCOPE_KEY, mallScopeSchema, mallSlot, parseMallScope, extractMallScope, mallScopeOf, readLoginMallId, readScopeDefaultMallId } from './scope';
|
|
8
8
|
export { mallScopeOrEmpty, mallSubjectIdOf, withMallScopeFromQuery, toMallQueryContext } from './query-context';
|
|
9
9
|
export { createMallRuntimeAssembly, createMallContextValidator, withMallName, AUTH_LOGIN_SERVICE } from './assembly';
|
|
10
10
|
export { readMallIdFromUrl, readMiniAppIdFromUrl } from './mall-scope-url';
|
package/dist/runtime.js
CHANGED
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
mallScopeSchema,
|
|
6
6
|
mallSlot,
|
|
7
7
|
parseMallScope,
|
|
8
|
-
readLoginMallId
|
|
9
|
-
|
|
8
|
+
readLoginMallId,
|
|
9
|
+
readScopeDefaultMallId
|
|
10
|
+
} from "./chunk-CV5ICZCZ.js";
|
|
10
11
|
|
|
11
12
|
// src/query-context.ts
|
|
12
13
|
function mallScopeOrEmpty(reqCtx) {
|
|
@@ -124,7 +125,7 @@ function memberGateCardOf(userId, status) {
|
|
|
124
125
|
return {
|
|
125
126
|
cardType: "member-login-cta",
|
|
126
127
|
data: { title: "\u767B\u5F55\u540E\u7EE7\u7EED", ...loginUrl ? { loginUrl } : {} },
|
|
127
|
-
// note
|
|
128
|
+
// note 契约:主体+动作(模型据此答话转述——「点击卡片登录」)
|
|
128
129
|
note: "\u672A\u767B\u5F55 \xB7 \u70B9\u51FB\u5361\u7247\u767B\u5F55"
|
|
129
130
|
};
|
|
130
131
|
}
|
|
@@ -408,7 +409,7 @@ var categoryListCardDataSchema = z3.object({
|
|
|
408
409
|
iconUrl: httpsUrlSchema.optional(),
|
|
409
410
|
merchantCount: z3.number().int().min(0),
|
|
410
411
|
subCategories: z3.array(z3.object({ code: z3.string(), name: z3.string(), merchantCount: z3.number().int().min(0) })).optional(),
|
|
411
|
-
/** 0.3.2
|
|
412
|
+
/** 0.3.2 类别条目动作(send 合成话术/外链) */
|
|
412
413
|
itemActions: z3.array(actionDraftSchema).optional()
|
|
413
414
|
})
|
|
414
415
|
),
|
|
@@ -450,7 +451,7 @@ var productComparisonCardDataSchema = z3.object({
|
|
|
450
451
|
caveats: z3.array(z3.string())
|
|
451
452
|
})
|
|
452
453
|
),
|
|
453
|
-
/** 0.3.2
|
|
454
|
+
/** 0.3.2 刷新截止时间(ISO);到期后渲染端禁用全部条目交互 */
|
|
454
455
|
refreshRequiredAt: isoDateTimeSchema.optional(),
|
|
455
456
|
observedAt: isoDateTimeSchema
|
|
456
457
|
});
|
|
@@ -467,7 +468,7 @@ var mallDirectoryCardDataSchema = z3.object({
|
|
|
467
468
|
floorName: z3.string(),
|
|
468
469
|
businessCategories: z3.array(z3.string()),
|
|
469
470
|
merchantCount: z3.number().int().min(0),
|
|
470
|
-
/** 0.3.2
|
|
471
|
+
/** 0.3.2 楼层条目动作(send:查看楼层门店) */
|
|
471
472
|
itemActions: z3.array(actionDraftSchema).optional()
|
|
472
473
|
})
|
|
473
474
|
)
|
|
@@ -496,7 +497,7 @@ var customerServiceFaqCardDataSchema = z3.object({
|
|
|
496
497
|
answer: z3.string().min(1),
|
|
497
498
|
category: z3.string().optional(),
|
|
498
499
|
relevanceScore: z3.number().min(0).max(1),
|
|
499
|
-
/** 0.3.2
|
|
500
|
+
/** 0.3.2 答案参考外链(openLink) */
|
|
500
501
|
referenceUrl: httpsUrlSchema.optional()
|
|
501
502
|
})
|
|
502
503
|
),
|
|
@@ -836,7 +837,7 @@ var offerSummarySchema = z6.object({
|
|
|
836
837
|
availabilityStatus: z6.enum(["AVAILABLE", "UNAVAILABLE", "REQUIRES_ACTION", "UNKNOWN"]).optional(),
|
|
837
838
|
validityText: z6.string().optional(),
|
|
838
839
|
imageUrl: imageUrlSchema,
|
|
839
|
-
/** 0.3.2
|
|
840
|
+
/** 0.3.2 条目动作(send:查看详情) */
|
|
840
841
|
itemActions: z6.array(actionDraftSchema).optional(),
|
|
841
842
|
tags: z6.array(z6.string())
|
|
842
843
|
});
|
|
@@ -927,7 +928,7 @@ var promotionEntitlementListCardDataSchema = z6.object({
|
|
|
927
928
|
usageRuleText: z6.string().optional(),
|
|
928
929
|
validityText: z6.string().optional(),
|
|
929
930
|
validUntilText: z6.string().optional(),
|
|
930
|
-
/** 0.3.2
|
|
931
|
+
/** 0.3.2 条目动作(send:查看详情) */
|
|
931
932
|
itemActions: z6.array(actionDraftSchema).optional(),
|
|
932
933
|
stores: z6.array(z6.object({
|
|
933
934
|
storeId: z6.string(),
|
|
@@ -1294,6 +1295,7 @@ export {
|
|
|
1294
1295
|
readLoginMallId,
|
|
1295
1296
|
readMallIdFromUrl,
|
|
1296
1297
|
readMiniAppIdFromUrl,
|
|
1298
|
+
readScopeDefaultMallId,
|
|
1297
1299
|
reasonItemSchema,
|
|
1298
1300
|
recommendMerchantsCardDataSchema,
|
|
1299
1301
|
refinementSchema,
|
package/dist/scope.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 商圈 scope(
|
|
2
|
+
* 商圈 scope(TIER1 领域语义唯一真源):
|
|
3
3
|
* MallScope 类型 + zod 解析 + ContextSlot 槽位 + RequestContext 提取器。
|
|
4
4
|
*
|
|
5
|
-
* 消费方(模块)只依赖本文件解析 attributes
|
|
6
|
-
* TIER0(app-contracts)不出现任何 mall
|
|
5
|
+
* 消费方(模块)只依赖本文件解析 attributes,不解析原始形状;
|
|
6
|
+
* TIER0(app-contracts)不出现任何 mall 语义。
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import type { RequestContext } from '@tbox.cn/app-contracts';
|
|
@@ -18,12 +18,12 @@ export interface MallScope {
|
|
|
18
18
|
* 尽力回填的展示/定位值,非会话边界(边界恒 mallId)。
|
|
19
19
|
*/
|
|
20
20
|
miniAppId?: string;
|
|
21
|
-
/** 商圈 id(会话边界:跨 mall
|
|
21
|
+
/** 商圈 id(会话边界:跨 mall 强制新会话) */
|
|
22
22
|
mallId: string;
|
|
23
23
|
/** 可选主体 id(会员体系 subject) */
|
|
24
24
|
subjectId?: string;
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
26
|
+
/** 服务端回显形状(= MallScope + 服务端生成的 sessionId;与输入形状分离) */
|
|
27
27
|
export interface MallSessionScope extends MallScope {
|
|
28
28
|
sessionId: string;
|
|
29
29
|
}
|
|
@@ -50,7 +50,7 @@ export declare const mallSlot: import("@tbox.cn/app-contracts").ContextSlot<{
|
|
|
50
50
|
miniAppId?: string | undefined;
|
|
51
51
|
subjectId?: string | undefined;
|
|
52
52
|
}, "mall">;
|
|
53
|
-
/** 解析失败返回 undefined(不 throw
|
|
53
|
+
/** 解析失败返回 undefined(不 throw),模块自行降级(语义;mallSlot 薄包装) */
|
|
54
54
|
export declare function parseMallScope(attributes: Record<string, unknown> | undefined): MallScope | undefined;
|
|
55
55
|
/** 从 RequestContext 提取 MallScope(parseMallScope 包装) */
|
|
56
56
|
export declare function extractMallScope(ctx: RequestContext): MallScope | undefined;
|
|
@@ -69,8 +69,17 @@ export declare function mallScopeOf(reqCtx: {
|
|
|
69
69
|
* 对外移除已随 0.8.0 落地(0.7.3 additive 波次保留至本波次)。
|
|
70
70
|
*/
|
|
71
71
|
/**
|
|
72
|
-
* 登录 context 宽松读取 mallId
|
|
72
|
+
* 登录 context 宽松读取 mallId(换码器归 provider 包后的共享读取器)。
|
|
73
73
|
* 登录 URL 可只带 mallId(不套 parseMallScope 全形状)——登录换码先例,与
|
|
74
74
|
* MALL_SCOPE_KEY 共置单一真源;provider 包 scoped 谓词与换码体共用本入口。
|
|
75
75
|
*/
|
|
76
76
|
export declare function readLoginMallId(context?: Readonly<Record<string, unknown>>): string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* scopeDefaults 读取视图 → defaultMallId(provider 包换码器闭包单源;2026-10-12)。
|
|
79
|
+
* 结构化最小参数面(contracts-mall 禁 import SDK);空串/非串归一 undefined
|
|
80
|
+
* (与既有消费点 `as string | undefined` 行为逐字等价)。登录期求值——域装配
|
|
81
|
+
* 晚于 provider 包 register 仍生效(SDK ctx.scopeDefaults Proxy 视图惰性查表)。
|
|
82
|
+
*/
|
|
83
|
+
export declare function readScopeDefaultMallId(ctx: {
|
|
84
|
+
scopeDefaults?: Readonly<Record<string, unknown>>;
|
|
85
|
+
} | undefined): string | undefined;
|
package/dist/server/index.d.ts
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
extractMallScope
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-CV5ICZCZ.js";
|
|
4
4
|
|
|
5
5
|
// src/server/request-credentials.ts
|
|
6
6
|
function readString(source, key) {
|
|
@@ -53,7 +53,7 @@ var mallAttributesSchema = z.strictObject({
|
|
|
53
53
|
/** 展示地址(可选;推荐 Banner 展示用) */
|
|
54
54
|
address: z.string().optional()
|
|
55
55
|
}).optional()
|
|
56
|
-
// 门店维度(stores
|
|
56
|
+
// 门店维度(stores)显式非目标——新行业拓扑 = 新 TIER1 投影包,不在本文件扩键
|
|
57
57
|
});
|
|
58
58
|
function parseMallAttributes(inst) {
|
|
59
59
|
const result = mallAttributesSchema.safeParse(inst.attributes ?? {});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 请求级凭证访问器(单源):从 RequestContext.credentials 提取用户级凭证,
|
|
3
3
|
* 供 provider adapter factory 构造请求级薄壳 service(E2 不变式:用户凭证只入
|
|
4
4
|
* service 请求层,禁止写入被缓存的 transport/authStrategy)。
|
|
5
5
|
*
|
|
@@ -16,7 +16,7 @@ export declare function credentialsVisitortoken(ctx: RequestContext): string;
|
|
|
16
16
|
/**
|
|
17
17
|
* 平台 openId(ctx.credentials.attributes.openid;外部身份绑定场景)。
|
|
18
18
|
* 契约唯一通道:ExternalCredentials.attributes 三元组随 external claim 流动
|
|
19
|
-
|
|
19
|
+
* (契约类型定义于 identity.ts)——曾误读顶层 credentials.openid(契约无此键,恒 undefined,
|
|
20
20
|
* 致绑定动作 OpenId 恒空),勿改回顶层读取。
|
|
21
21
|
*/
|
|
22
22
|
export declare function credentialsOpenId(ctx: RequestContext): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 客服承接域 Port
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* 客服承接域 Port 契约:FAQ/知识库检索两方法。
|
|
3
|
+
* 客服承接 = 本地知识库域(与 provider 远程检索面正交,恒本地装配)——知识库供给走
|
|
4
|
+
* 资源绑定(integrations.json modules 节),非槽位 adapter;见
|
|
5
|
+
* module-customer-service INTEGRATION.md。
|
|
5
6
|
*/
|
|
6
7
|
import type { ShoppingQueryContext } from './shopping-guide';
|
|
7
8
|
import type { FaqEntry, KnowledgeEntry } from '../domain/shopping-guide';
|
|
@@ -2,8 +2,10 @@ import type { Points } from '../domain/points';
|
|
|
2
2
|
import type { DiscountRule } from '../domain/discount';
|
|
3
3
|
import type { Identity, RequestContext } from '@tbox.cn/app-contracts';
|
|
4
4
|
/**
|
|
5
|
-
* 会员域 Port
|
|
6
|
-
*
|
|
5
|
+
* 会员域 Port(每服务槽一接口):账户 / 资料 / 卡面 / 权益(含积分) / 入会 五业务 Port +
|
|
6
|
+
* 跨模块工厂契约。结构类型子集接口——模块完整实现 extends 本接口,消费方仅依赖契约包。
|
|
7
|
+
* 自定义 API 接入:每个 Port = 你的后端需提供的一组能力(经 provider-custom 落地,
|
|
8
|
+
* 见应用根 INTEGRATION.md)。
|
|
7
9
|
*/
|
|
8
10
|
export declare const MEMBER_ACCOUNT_SERVICE = "member.account";
|
|
9
11
|
export declare const MEMBER_PROFILE_SERVICE = "member.profile";
|
|
@@ -96,7 +98,7 @@ export interface MemberBenefitsSnapshot {
|
|
|
96
98
|
readonly observedAt: string;
|
|
97
99
|
}
|
|
98
100
|
export interface MemberBenefitsPort {
|
|
99
|
-
/**
|
|
101
|
+
/** 积分查询 */
|
|
100
102
|
queryPoints(userId: string): Promise<Points>;
|
|
101
103
|
/** 权益快照 */
|
|
102
104
|
getBenefits(userId: string): Promise<MemberBenefitsSnapshot>;
|
|
@@ -105,9 +107,9 @@ export interface MemberBenefitsPort {
|
|
|
105
107
|
items: ReadonlyArray<PointUsageRecord>;
|
|
106
108
|
total: number;
|
|
107
109
|
}>;
|
|
108
|
-
/**
|
|
110
|
+
/** 折扣规则查询(无规则时 undefined) */
|
|
109
111
|
queryDiscount(userId: string): Promise<DiscountRule | undefined>;
|
|
110
|
-
/**
|
|
112
|
+
/** 积分结算写(幂等键由调用方生成——同键重入应返回首果) */
|
|
111
113
|
deductPoints(userId: string, amount: number, idempotencyKey: string): Promise<boolean>;
|
|
112
114
|
refundPoints(userId: string, amount: number, idempotencyKey: string): Promise<boolean>;
|
|
113
115
|
awardPoints(userId: string, amount: number): Promise<boolean>;
|
|
@@ -115,21 +117,20 @@ export interface MemberBenefitsPort {
|
|
|
115
117
|
export interface PointUsageRecord {
|
|
116
118
|
readonly usageRecordRef: string;
|
|
117
119
|
readonly title: string;
|
|
118
|
-
/**
|
|
120
|
+
/** 字符串化金额(展示层统一字符串) */
|
|
119
121
|
readonly amount: string;
|
|
120
122
|
readonly usedAt?: string;
|
|
121
123
|
readonly description?: string;
|
|
122
124
|
}
|
|
123
125
|
/**
|
|
124
|
-
*
|
|
125
|
-
* member 模块 register 期注册 `(reqCtx) => resolveMemberBenefitsPort(reqCtx, ctx)
|
|
126
|
-
* (017 槽位原子化:本面 = benefits 单槽契约,benefits 方法族);
|
|
126
|
+
* 会员权益解析工厂:跨模块 'member.service' 注册面(benefits 单槽契约)。
|
|
127
|
+
* member 模块 register 期注册 `(reqCtx) => resolveMemberBenefitsPort(reqCtx, ctx)`;
|
|
127
128
|
* 跨模块消费方经 ctx.resolveService<MemberBenefitsFactory>('member.service')
|
|
128
|
-
* 结构解析后 `await factory(reqCtx)
|
|
129
|
+
* 结构解析后 `await factory(reqCtx)`。
|
|
129
130
|
* 身份/会员资格判定请走 'member.status' 注册面(outcome + account),勿经本面取 account 域数据。
|
|
130
131
|
*/
|
|
131
132
|
export type MemberBenefitsFactory = (reqCtx: RequestContext) => Promise<MemberBenefitsPort>;
|
|
132
|
-
/**
|
|
133
|
+
/** 入会身份来源:授权 profile 可信度高于手填 */
|
|
133
134
|
export type MemberEnrollmentIdentity = 'alipay_authorized' | 'enrollment_submission';
|
|
134
135
|
export interface MemberEnrollmentInput {
|
|
135
136
|
readonly userId: string;
|
|
@@ -138,7 +139,7 @@ export interface MemberEnrollmentInput {
|
|
|
138
139
|
readonly fieldValues: Readonly<Record<string, string>>;
|
|
139
140
|
/** 已同意的 consent id 集合(模块侧校验必勾后传入) */
|
|
140
141
|
readonly acceptedConsentIds: readonly string[];
|
|
141
|
-
/** 幂等键(模块生成:
|
|
142
|
+
/** 幂等键(模块生成:userId+mallId+formVersion 摘要)——同键重入返回首果 */
|
|
142
143
|
readonly idempotencyKey: string;
|
|
143
144
|
readonly formVersion?: string;
|
|
144
145
|
}
|
|
@@ -146,7 +147,7 @@ export type MemberEnrollmentResult = {
|
|
|
146
147
|
readonly status: 'active';
|
|
147
148
|
readonly memberRef: string;
|
|
148
149
|
}
|
|
149
|
-
/**
|
|
150
|
+
/** 厂商异步确认态(pending 卡 + 显式刷新收口) */
|
|
150
151
|
| {
|
|
151
152
|
readonly status: 'pending_confirmation';
|
|
152
153
|
readonly attemptRef: string;
|
|
@@ -166,8 +167,7 @@ export interface MemberEnrollmentPort {
|
|
|
166
167
|
}>;
|
|
167
168
|
/**
|
|
168
169
|
* 入会表单定义(厂商端点拉取,如厂商 enrollmentConfig 端点);无表单端点厂商可缺省——
|
|
169
|
-
* 调用方 typeof
|
|
170
|
-
* fat 接口收编。
|
|
170
|
+
* 调用方 typeof 守卫降级(入会走固定授权流)。
|
|
171
171
|
*/
|
|
172
172
|
getEnrollmentFormDefinition?(userId: string): Promise<MemberEnrollmentFormDefinition>;
|
|
173
173
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 停车域 Port
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* 停车域 Port(查询 / 缴费 / 车辆 三槽各一 Port):结算写全部收口进 ParkingPaymentPort
|
|
3
|
+
* (厂商真实支付链)。自定义 API 接入:每个 Port = 你的后端需提供的一组能力
|
|
4
|
+
* (经 provider-custom 落地,见应用根 INTEGRATION.md)。
|
|
5
5
|
*/
|
|
6
6
|
import type { MallScope } from '../scope';
|
|
7
7
|
import type { RequestContext } from '@tbox.cn/app-contracts';
|
|
@@ -26,7 +26,7 @@ export interface ParkingQueryPort {
|
|
|
26
26
|
* 缺席 = provider 无入场查询能力(调用方 typeof 守卫,按未入场渲染)——厂商差异留在 provider 包。
|
|
27
27
|
*/
|
|
28
28
|
probeParkedVehicles?(q: ParkingQueryContext, plateNos: readonly string[]): Promise<readonly ParkingPresence[]>;
|
|
29
|
-
/**
|
|
29
|
+
/** 计费报价(恒实时打厂商;已支付态命中自动收口 PaymentOperation)。
|
|
30
30
|
* 指定车牌/vehicleRef/barcode 时返回 ≤1 条;无车辆线索("我的车"语义)扫描绑定车队时返回所有在场有费车辆(≥1 条)。空数组 = 无在场车。 */
|
|
31
31
|
queryFee(q: ParkingQueryContext, input: {
|
|
32
32
|
plateNo?: string;
|
|
@@ -88,7 +88,7 @@ export interface ParkingPaymentPort {
|
|
|
88
88
|
}>;
|
|
89
89
|
/** step3:客户端结果上报(status 仅上报,不作收口依据;flowId 来自 getPaymentSign) */
|
|
90
90
|
uploadResult(q: ParkingQueryContext, paymentRef: string, status: 'success' | 'cancel' | 'failure' | 'unavailable', payOrderFlowId?: string): Promise<void>;
|
|
91
|
-
/**
|
|
91
|
+
/** 权威收口唯一源:厂商侧回查支付态 */
|
|
92
92
|
reconcile(q: ParkingQueryContext, paymentRef: string): Promise<'PAID' | 'PAYING' | 'CANCELLED' | 'UNKNOWN'>;
|
|
93
93
|
/** 权益重选(reprice):新报价(revision 递增)。detail 透传试算业务字段(部分服务必填) */
|
|
94
94
|
reprice(q: ParkingQueryContext, quoteRef: string, benefitRefs: readonly string[], detail?: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 营销域 Port
|
|
2
|
+
* 营销域 Port(查询三 Port + 领取写一 Port,按读写边界拆分)——自定义 API 接入:每个
|
|
3
|
+
* Port = 你的后端需提供的一组能力(经 provider-custom 落地,见应用根 INTEGRATION.md)。
|
|
3
4
|
* 结构类型子集接口——模块完整实现 extends 本接口,消费方仅依赖契约包。
|
|
4
|
-
* C 端主体经 ctx.requestContext.credentials
|
|
5
|
-
* 状态服务解析('member.status' 判定 + externalMemberRefOf
|
|
5
|
+
* C 端主体经 ctx.requestContext.credentials;externalMemberRef 由消费方经 member 域
|
|
6
|
+
* 状态服务解析('member.status' 判定 + externalMemberRefOf 取值)。
|
|
6
7
|
*/
|
|
7
8
|
import type { MallScope } from '../scope';
|
|
8
9
|
import type { RequestContext } from '@tbox.cn/app-contracts';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 导购域 Port
|
|
2
|
+
* 导购域 Port 接口(检索/商户/类目/目录四远程 Port + 本地导航/协助,TIER1 结构类型子集)。
|
|
3
|
+
* 自定义 API 接入:远程四 Port = 你的后端需提供的能力(经 provider-custom 落地);导航/
|
|
4
|
+
* 协助两 Port 模块本地承接,无需后端。
|
|
3
5
|
* 模块完整实现 extends 本接口;消费方(其他模块)仅依赖契约包。
|
|
4
6
|
* 领域模型见 domain/shopping-guide.ts。
|
|
5
7
|
*/
|
package/dist/shared/cards.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 商圈通用卡片片段(0.3.2
|
|
2
|
+
* 商圈通用卡片片段(0.3.2 actionDraftSchema 单源——从 shopping-guide/cards.ts 抽出,
|
|
3
3
|
* 四域条目动作共用;index.ts 与 runtime.ts 均 re-export 本文件,M2 导出面)。
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 卡内条目动作草稿(判别联合——仅客户端本地语义,write 变体无 token 机制支撑不进)。
|
|
8
8
|
* - send:发消息(value 缺省用 label);link:打开 URL(tel:/https:)。
|
|
9
9
|
* 渲染端经 card-action-handler 既有通道分发(零新机制);zod 判别联合天然拒未知 kind。
|
|
10
10
|
*/
|