@tbox.cn/app-contracts-mall 1.0.0-alpha.12 → 1.0.0-alpha.14
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/promotion/cards.d.ts +6 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +4 -1
- package/dist/services/promotion.d.ts +32 -0
- package/package.json +2 -2
- package/src/promotion/cards.ts +1 -0
- package/src/runtime.ts +1 -0
- package/src/service-slots.json +5 -0
- package/src/services/promotion.ts +35 -0
- package/tests/service-slots.test.ts +7 -5
|
@@ -155,6 +155,7 @@ export declare const promotionOfferListCardDataSchema: z.ZodObject<{
|
|
|
155
155
|
}>, "many">;
|
|
156
156
|
noResultsReason: z.ZodOptional<z.ZodString>;
|
|
157
157
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
158
|
+
showDealRecall: z.ZodOptional<z.ZodLiteral<true>>;
|
|
158
159
|
}, "strip", z.ZodTypeAny, {
|
|
159
160
|
items: {
|
|
160
161
|
title: string;
|
|
@@ -198,6 +199,7 @@ export declare const promotionOfferListCardDataSchema: z.ZodObject<{
|
|
|
198
199
|
presentation?: "coupon" | "promotion" | "recommendation" | "offer" | undefined;
|
|
199
200
|
maxItems?: number | undefined;
|
|
200
201
|
nextCursor?: string | undefined;
|
|
202
|
+
showDealRecall?: true | undefined;
|
|
201
203
|
}, {
|
|
202
204
|
items: {
|
|
203
205
|
title: string;
|
|
@@ -241,6 +243,7 @@ export declare const promotionOfferListCardDataSchema: z.ZodObject<{
|
|
|
241
243
|
presentation?: "coupon" | "promotion" | "recommendation" | "offer" | undefined;
|
|
242
244
|
maxItems?: number | undefined;
|
|
243
245
|
nextCursor?: string | undefined;
|
|
246
|
+
showDealRecall?: true | undefined;
|
|
244
247
|
}>;
|
|
245
248
|
export type PromotionOfferListCardData = z.infer<typeof promotionOfferListCardDataSchema>;
|
|
246
249
|
/** promotion-offer-detail:详情 + 领取/券码动作 */
|
|
@@ -1424,6 +1427,7 @@ export declare const promotionCardDataSchemas: {
|
|
|
1424
1427
|
}>, "many">;
|
|
1425
1428
|
noResultsReason: z.ZodOptional<z.ZodString>;
|
|
1426
1429
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
1430
|
+
showDealRecall: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1427
1431
|
}, "strip", z.ZodTypeAny, {
|
|
1428
1432
|
items: {
|
|
1429
1433
|
title: string;
|
|
@@ -1467,6 +1471,7 @@ export declare const promotionCardDataSchemas: {
|
|
|
1467
1471
|
presentation?: "coupon" | "promotion" | "recommendation" | "offer" | undefined;
|
|
1468
1472
|
maxItems?: number | undefined;
|
|
1469
1473
|
nextCursor?: string | undefined;
|
|
1474
|
+
showDealRecall?: true | undefined;
|
|
1470
1475
|
}, {
|
|
1471
1476
|
items: {
|
|
1472
1477
|
title: string;
|
|
@@ -1510,6 +1515,7 @@ export declare const promotionCardDataSchemas: {
|
|
|
1510
1515
|
presentation?: "coupon" | "promotion" | "recommendation" | "offer" | undefined;
|
|
1511
1516
|
maxItems?: number | undefined;
|
|
1512
1517
|
nextCursor?: string | undefined;
|
|
1518
|
+
showDealRecall?: true | undefined;
|
|
1513
1519
|
}>;
|
|
1514
1520
|
readonly 'promotion-offer-detail': z.ZodObject<{
|
|
1515
1521
|
presentation: z.ZodOptional<z.ZodEnum<["offer", "promotion", "promotion-guide", "coupon", "package"]>>;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { createMallRuntimeAssembly, createMallContextValidator, withMallName, AU
|
|
|
10
10
|
export { readMallIdFromUrl, readMiniAppIdFromUrl } from './mall-scope-url';
|
|
11
11
|
export { MEMBER_ACCOUNT_SERVICE, MEMBER_PROFILE_SERVICE, MEMBER_CARD_SERVICE, MEMBER_BENEFITS_SERVICE, MEMBER_ENROLLMENT_SERVICE, MEMBER_SNAPSHOT_SERVICE, classifyMemberOutcome, externalMemberRefOf, memberGateCardOf, resolveMemberGate, } from './services/member';
|
|
12
12
|
export { PARKING_QUERY_SERVICE, PARKING_PAYMENT_SERVICE, PARKING_VEHICLE_SERVICE, PARKING_SNAPSHOT_SERVICE } from './services/parking';
|
|
13
|
-
export { PROMOTION_OFFERS_SERVICE, PROMOTION_ENTITLEMENTS_SERVICE, PROMOTION_ACTIVITIES_SERVICE, PROMOTION_ACQUISITION_SERVICE, PROMOTION_ACTIVITY_ROUTING_POLICY, } from './services/promotion';
|
|
13
|
+
export { PROMOTION_OFFERS_SERVICE, PROMOTION_ENTITLEMENTS_SERVICE, PROMOTION_ACTIVITIES_SERVICE, PROMOTION_ACQUISITION_SERVICE, PROMOTION_DEAL_RECALL_SERVICE, PROMOTION_ACTIVITY_ROUTING_POLICY, } from './services/promotion';
|
|
14
14
|
export { SHOPPING_CATALOG_SERVICE, SHOPPING_SHOPS_SERVICE, SHOPPING_CATEGORIES_SERVICE, SHOPPING_DIRECTORY_SERVICE, } from './services/shopping-guide';
|
|
15
15
|
export { MALL_INFO_SERVICE } from './services/mall-info';
|
|
16
16
|
export { ACTIVITY_PLAY_QUERY_SERVICE } from './services/activity-play';
|
package/dist/runtime.js
CHANGED
|
@@ -175,6 +175,7 @@ var PROMOTION_OFFERS_SERVICE = "promotion.offers";
|
|
|
175
175
|
var PROMOTION_ENTITLEMENTS_SERVICE = "promotion.entitlements";
|
|
176
176
|
var PROMOTION_ACTIVITIES_SERVICE = "promotion.activities";
|
|
177
177
|
var PROMOTION_ACQUISITION_SERVICE = "promotion.acquisition";
|
|
178
|
+
var PROMOTION_DEAL_RECALL_SERVICE = "promotion.deal-recall";
|
|
178
179
|
var PROMOTION_ACTIVITY_ROUTING_POLICY = "promotion.activity-routing";
|
|
179
180
|
|
|
180
181
|
// src/services/shopping-guide.ts
|
|
@@ -927,7 +928,8 @@ var promotionOfferListCardDataSchema = z8.object({
|
|
|
927
928
|
summary: z8.string().optional(),
|
|
928
929
|
items: z8.array(offerSummarySchema),
|
|
929
930
|
noResultsReason: z8.string().optional(),
|
|
930
|
-
nextCursor: z8.string().optional()
|
|
931
|
+
nextCursor: z8.string().optional(),
|
|
932
|
+
showDealRecall: z8.literal(true).optional()
|
|
931
933
|
});
|
|
932
934
|
var promotionOfferDetailCardDataSchema = z8.object({
|
|
933
935
|
presentation: z8.enum(["offer", "promotion", "promotion-guide", "coupon", "package"]).optional(),
|
|
@@ -1343,6 +1345,7 @@ export {
|
|
|
1343
1345
|
PROMOTION_ACQUISITION_SERVICE,
|
|
1344
1346
|
PROMOTION_ACTIVITIES_SERVICE,
|
|
1345
1347
|
PROMOTION_ACTIVITY_ROUTING_POLICY,
|
|
1348
|
+
PROMOTION_DEAL_RECALL_SERVICE,
|
|
1346
1349
|
PROMOTION_ENTITLEMENTS_SERVICE,
|
|
1347
1350
|
PROMOTION_OFFERS_SERVICE,
|
|
1348
1351
|
SHOPPING_CATALOG_SERVICE,
|
|
@@ -16,6 +16,38 @@ export declare const PROMOTION_OFFERS_SERVICE = "promotion.offers";
|
|
|
16
16
|
export declare const PROMOTION_ENTITLEMENTS_SERVICE = "promotion.entitlements";
|
|
17
17
|
export declare const PROMOTION_ACTIVITIES_SERVICE = "promotion.activities";
|
|
18
18
|
export declare const PROMOTION_ACQUISITION_SERVICE = "promotion.acquisition";
|
|
19
|
+
export declare const PROMOTION_DEAL_RECALL_SERVICE = "promotion.deal-recall";
|
|
20
|
+
export interface RecalledDeal {
|
|
21
|
+
id: string;
|
|
22
|
+
kind: 'item' | 'shop';
|
|
23
|
+
title: string;
|
|
24
|
+
subtitle?: string;
|
|
25
|
+
imageUrl?: string;
|
|
26
|
+
price?: string;
|
|
27
|
+
url?: string;
|
|
28
|
+
distanceMeters?: number;
|
|
29
|
+
distanceDesc?: string;
|
|
30
|
+
}
|
|
31
|
+
export type DealRecallResult = {
|
|
32
|
+
status: 'ok';
|
|
33
|
+
items: RecalledDeal[];
|
|
34
|
+
partial?: boolean;
|
|
35
|
+
/** A continuation can skip these IDs even when a candidate was filtered out. */
|
|
36
|
+
scannedDealIds?: string[];
|
|
37
|
+
} | {
|
|
38
|
+
status: 'disabled' | 'login-required' | 'location-required' | 'mall-location-required' | 'shop-unmapped' | 'unavailable';
|
|
39
|
+
};
|
|
40
|
+
export interface PromotionDealRecallPort {
|
|
41
|
+
readonly enabled: boolean;
|
|
42
|
+
readonly offersIntro?: string;
|
|
43
|
+
recall(input: {
|
|
44
|
+
query: string;
|
|
45
|
+
shopName?: string;
|
|
46
|
+
search?: boolean;
|
|
47
|
+
limit?: number;
|
|
48
|
+
excludedDealIds?: readonly string[];
|
|
49
|
+
}): Promise<DealRecallResult>;
|
|
50
|
+
}
|
|
19
51
|
/** 查询上下文(scope + 主体 + 请求;credentials 为 C 端用户 Token 唯一来源) */
|
|
20
52
|
export interface PromotionQueryContext {
|
|
21
53
|
readonly scope: MallScope;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-contracts-mall",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "商圈领域契约(TIER1,types + runtime):Port 接口 + MallEventMap + 领域 DTO + scope/装配器运行时。",
|
|
6
6
|
"exports": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"zod": "3.25.76",
|
|
33
|
-
"@tbox.cn/app-contracts": "1.0.0-alpha.
|
|
33
|
+
"@tbox.cn/app-contracts": "1.0.0-alpha.14"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"tsup": "8.5.1",
|
package/src/promotion/cards.ts
CHANGED
|
@@ -69,6 +69,7 @@ export const promotionOfferListCardDataSchema = z.object({
|
|
|
69
69
|
items: z.array(offerSummarySchema),
|
|
70
70
|
noResultsReason: z.string().optional(),
|
|
71
71
|
nextCursor: z.string().optional(),
|
|
72
|
+
showDealRecall: z.literal(true).optional(),
|
|
72
73
|
});
|
|
73
74
|
export type PromotionOfferListCardData = z.infer<typeof promotionOfferListCardDataSchema>;
|
|
74
75
|
|
package/src/runtime.ts
CHANGED
package/src/service-slots.json
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"promotion.entitlements",
|
|
14
14
|
"promotion.activities",
|
|
15
15
|
"promotion.acquisition",
|
|
16
|
+
"promotion.deal-recall",
|
|
16
17
|
"shopping-guide.catalog",
|
|
17
18
|
"shopping-guide.shops",
|
|
18
19
|
"shopping-guide.categories",
|
|
@@ -71,6 +72,10 @@
|
|
|
71
72
|
"name": "营销领取",
|
|
72
73
|
"description": "券领取写链"
|
|
73
74
|
},
|
|
75
|
+
"promotion.deal-recall": {
|
|
76
|
+
"name": "外部团购推荐",
|
|
77
|
+
"description": "查询附近团购和已映射门店的商品"
|
|
78
|
+
},
|
|
74
79
|
"shopping-guide.catalog": {
|
|
75
80
|
"name": "商品导购",
|
|
76
81
|
"description": "搜索商品并提供相关推荐、商品详情和对比信息"
|
|
@@ -23,6 +23,41 @@ export const PROMOTION_OFFERS_SERVICE = 'promotion.offers';
|
|
|
23
23
|
export const PROMOTION_ENTITLEMENTS_SERVICE = 'promotion.entitlements';
|
|
24
24
|
export const PROMOTION_ACTIVITIES_SERVICE = 'promotion.activities';
|
|
25
25
|
export const PROMOTION_ACQUISITION_SERVICE = 'promotion.acquisition';
|
|
26
|
+
export const PROMOTION_DEAL_RECALL_SERVICE = 'promotion.deal-recall';
|
|
27
|
+
|
|
28
|
+
export interface RecalledDeal {
|
|
29
|
+
id: string;
|
|
30
|
+
kind: 'item' | 'shop';
|
|
31
|
+
title: string;
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
imageUrl?: string;
|
|
34
|
+
price?: string;
|
|
35
|
+
url?: string;
|
|
36
|
+
distanceMeters?: number;
|
|
37
|
+
distanceDesc?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type DealRecallResult =
|
|
41
|
+
| {
|
|
42
|
+
status: 'ok';
|
|
43
|
+
items: RecalledDeal[];
|
|
44
|
+
partial?: boolean;
|
|
45
|
+
/** A continuation can skip these IDs even when a candidate was filtered out. */
|
|
46
|
+
scannedDealIds?: string[];
|
|
47
|
+
}
|
|
48
|
+
| { status: 'disabled' | 'login-required' | 'location-required' | 'mall-location-required' | 'shop-unmapped' | 'unavailable' };
|
|
49
|
+
|
|
50
|
+
export interface PromotionDealRecallPort {
|
|
51
|
+
readonly enabled: boolean;
|
|
52
|
+
readonly offersIntro?: string;
|
|
53
|
+
recall(input: {
|
|
54
|
+
query: string;
|
|
55
|
+
shopName?: string;
|
|
56
|
+
search?: boolean;
|
|
57
|
+
limit?: number;
|
|
58
|
+
excludedDealIds?: readonly string[];
|
|
59
|
+
}): Promise<DealRecallResult>;
|
|
60
|
+
}
|
|
26
61
|
|
|
27
62
|
/** 查询上下文(scope + 主体 + 请求;credentials 为 C 端用户 Token 唯一来源) */
|
|
28
63
|
export interface PromotionQueryContext {
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
PROMOTION_ENTITLEMENTS_SERVICE,
|
|
23
23
|
PROMOTION_ACTIVITIES_SERVICE,
|
|
24
24
|
PROMOTION_ACQUISITION_SERVICE,
|
|
25
|
+
PROMOTION_DEAL_RECALL_SERVICE,
|
|
25
26
|
} from '../src/services/promotion';
|
|
26
27
|
import {
|
|
27
28
|
SHOPPING_CATALOG_SERVICE,
|
|
@@ -47,6 +48,7 @@ const constants = [
|
|
|
47
48
|
PROMOTION_ENTITLEMENTS_SERVICE,
|
|
48
49
|
PROMOTION_ACTIVITIES_SERVICE,
|
|
49
50
|
PROMOTION_ACQUISITION_SERVICE,
|
|
51
|
+
PROMOTION_DEAL_RECALL_SERVICE,
|
|
50
52
|
SHOPPING_CATALOG_SERVICE,
|
|
51
53
|
SHOPPING_SHOPS_SERVICE,
|
|
52
54
|
SHOPPING_CATEGORIES_SERVICE,
|
|
@@ -58,16 +60,16 @@ const constants = [
|
|
|
58
60
|
];
|
|
59
61
|
|
|
60
62
|
describe('service slot 词汇交叉锁(JSON 真源 ↔ TS 共址常量)', () => {
|
|
61
|
-
it('计数 =
|
|
62
|
-
expect(slotsJson.slots).toHaveLength(
|
|
63
|
-
expect(constants).toHaveLength(
|
|
63
|
+
it('计数 = 21(含独立团购召回槽)', () => {
|
|
64
|
+
expect(slotsJson.slots).toHaveLength(21);
|
|
65
|
+
expect(constants).toHaveLength(21);
|
|
64
66
|
});
|
|
65
67
|
|
|
66
68
|
it('常量并集 ≡ JSON slots(互为子集;无重复无缺漏)', () => {
|
|
67
69
|
const jsonSet = new Set(slotsJson.slots);
|
|
68
70
|
const constSet = new Set(constants);
|
|
69
|
-
expect(jsonSet.size).toBe(
|
|
70
|
-
expect(constSet.size).toBe(
|
|
71
|
+
expect(jsonSet.size).toBe(21);
|
|
72
|
+
expect(constSet.size).toBe(21);
|
|
71
73
|
for (const id of jsonSet) expect(constSet.has(id), `常量缺 ${id}`).toBe(true);
|
|
72
74
|
for (const id of constSet) expect(jsonSet.has(id), `JSON 缺 ${id}`).toBe(true);
|
|
73
75
|
});
|