@tbox.cn/app-contracts-mall 0.12.5 → 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.
@@ -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/runtime.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * 类型面仍经 tsc emitDeclarationOnly 出 dist/*.d.ts。
5
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
- } from "./chunk-KIZD6FZ2.js";
8
+ readLoginMallId,
9
+ readScopeDefaultMallId
10
+ } from "./chunk-CV5ICZCZ.js";
10
11
 
11
12
  // src/query-context.ts
12
13
  function mallScopeOrEmpty(reqCtx) {
@@ -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
@@ -74,3 +74,12 @@ export declare function mallScopeOf(reqCtx: {
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;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  extractMallScope
3
- } from "../chunk-KIZD6FZ2.js";
3
+ } from "../chunk-CV5ICZCZ.js";
4
4
 
5
5
  // src/server/request-credentials.ts
6
6
  function readString(source, key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-contracts-mall",
3
- "version": "0.12.5",
3
+ "version": "0.13.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.12.4",
32
+ "@tbox.cn/app-contracts": "0.13.0",
33
33
  "zod": "3.25.76"
34
34
  },
35
35
  "devDependencies": {
package/src/runtime.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * 类型面仍经 tsc emitDeclarationOnly 出 dist/*.d.ts。
5
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/src/scope.ts CHANGED
@@ -90,3 +90,16 @@ export function readLoginMallId(context?: Readonly<Record<string, unknown>>): st
90
90
  const mallId = (mall as Record<string, unknown>).mallId;
91
91
  return typeof mallId === 'string' && mallId.length > 0 ? mallId : undefined;
92
92
  }
93
+
94
+ /**
95
+ * scopeDefaults 读取视图 → defaultMallId(provider 包换码器闭包单源;2026-10-12)。
96
+ * 结构化最小参数面(contracts-mall 禁 import SDK);空串/非串归一 undefined
97
+ * (与既有消费点 `as string | undefined` 行为逐字等价)。登录期求值——域装配
98
+ * 晚于 provider 包 register 仍生效(SDK ctx.scopeDefaults Proxy 视图惰性查表)。
99
+ */
100
+ export function readScopeDefaultMallId(
101
+ ctx: { scopeDefaults?: Readonly<Record<string, unknown>> } | undefined,
102
+ ): string | undefined {
103
+ const v = ctx?.scopeDefaults?.['defaultMallId'];
104
+ return typeof v === 'string' && v.length > 0 ? v : undefined;
105
+ }