@tbox.cn/app-contracts-mall 0.2.0 → 0.10.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/README.md +16 -2
- package/dist/alipay-activity/cards.d.ts +305 -0
- package/dist/assembly.d.ts +73 -7
- package/dist/chunk-KIZD6FZ2.js +43 -0
- package/dist/deployment.d.ts +32 -33
- package/dist/domain/activity.d.ts +64 -0
- package/dist/domain/coupon.d.ts +2 -0
- package/dist/domain/entitlement.d.ts +53 -0
- package/dist/domain/offer.d.ts +111 -0
- package/dist/domain/operation.d.ts +22 -0
- package/dist/domain/parking.d.ts +195 -12
- package/dist/domain/points.d.ts +3 -2
- package/dist/domain/shopping-guide.d.ts +201 -0
- package/dist/index.d.ts +15 -2
- package/dist/mall-scope-url.d.ts +13 -0
- package/dist/member/cards.d.ts +636 -213
- package/dist/parking/cards.d.ts +1271 -0
- package/dist/promotion/cards.d.ts +2529 -0
- package/dist/query-context.d.ts +47 -0
- package/dist/runtime.d.ts +12 -2
- package/dist/runtime.js +940 -86
- package/dist/scope.d.ts +42 -15
- package/dist/server/index.d.ts +11 -0
- package/dist/server/index.js +92 -0
- package/dist/server/mall-context.d.ts +24 -0
- package/dist/server/mall-control-plane.d.ts +10 -0
- package/dist/server/request-credentials.d.ts +22 -0
- package/dist/services/customer-service.d.ts +11 -0
- package/dist/services/mall-info.d.ts +39 -0
- package/dist/services/member.d.ts +188 -31
- package/dist/services/parking.d.ts +115 -11
- package/dist/services/promotion.d.ts +100 -4
- package/dist/services/shopping-guide.d.ts +97 -0
- package/dist/shared/cards.d.ts +42 -0
- package/dist/shopping-guide/cards.d.ts +3399 -561
- package/package.json +19 -7
- package/src/alipay-activity/cards.ts +66 -0
- package/src/assembly.ts +159 -0
- package/src/deployment.ts +44 -0
- package/src/domain/activity.ts +66 -0
- package/src/domain/coupon.ts +11 -0
- package/src/domain/discount.ts +6 -0
- package/src/domain/entitlement.ts +56 -0
- package/src/domain/offer.ts +120 -0
- package/src/domain/operation.ts +40 -0
- package/src/domain/parking.ts +207 -0
- package/src/domain/points.ts +15 -0
- package/src/domain/shopping-guide.ts +242 -0
- package/src/events/index.ts +10 -0
- package/src/guard.ts +48 -0
- package/src/index.ts +34 -0
- package/src/mall-scope-url.ts +21 -0
- package/src/member/cards.ts +209 -0
- package/src/parking/cards.ts +233 -0
- package/src/promotion/cards.ts +290 -0
- package/src/query-context.ts +81 -0
- package/src/runtime.ts +43 -0
- package/src/scope.ts +92 -0
- package/src/server/index.ts +11 -0
- package/src/server/mall-context.ts +39 -0
- package/src/server/mall-control-plane.ts +92 -0
- package/src/server/request-credentials.ts +43 -0
- package/src/service-slots.json +26 -0
- package/src/services/customer-service.ts +12 -0
- package/src/services/mall-info.ts +48 -0
- package/src/services/member.ts +386 -0
- package/src/services/parking.ts +182 -0
- package/src/services/promotion.ts +126 -0
- package/src/services/shopping-guide.ts +138 -0
- package/src/shared/cards.ts +25 -0
- package/src/shopping-guide/cards.ts +438 -0
- package/tests/assembly-validate-scope.test.ts +132 -0
- package/tests/cards.test.ts +586 -0
- package/tests/context-unification.test.ts +73 -0
- package/tests/mall-control-plane.test.ts +169 -0
- package/tests/mall-scope-url.test.ts +59 -0
- package/tests/member-status.test.ts +197 -0
- package/tests/query-context.test.ts +111 -0
- package/tests/request-credentials.test.ts +38 -0
- package/tests/resolve-primitives.test.ts +55 -0
- package/tests/service-slots.test.ts +83 -0
- package/tsconfig.build.json +15 -0
- package/tsconfig.json +5 -0
- package/dist/shopping-guide/ports.d.ts +0 -216
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 营销权益(已领取资产)域模型(015,TIER1)。
|
|
3
|
+
*/
|
|
4
|
+
import type { OfferType } from './offer';
|
|
5
|
+
export type EntitlementStatus = 'EFFECTIVE' | 'USED' | 'EXPIRED' | 'INVALID' | 'UNKNOWN';
|
|
6
|
+
export interface PromotionEntitlement {
|
|
7
|
+
readonly entitlementRef: string;
|
|
8
|
+
readonly offerRef?: string;
|
|
9
|
+
readonly title: string;
|
|
10
|
+
/** 厂商券面图;相对路径由 Provider Adapter 归一为 HTTPS URL。 */
|
|
11
|
+
readonly imageUrl?: string;
|
|
12
|
+
readonly entitlementType: OfferType;
|
|
13
|
+
readonly status: EntitlementStatus;
|
|
14
|
+
/** 已授权 C 端详情使用的完整券码(不得写入日志) */
|
|
15
|
+
readonly code?: string;
|
|
16
|
+
readonly codeMasked?: string;
|
|
17
|
+
/** 小程序券码区域是否允许生成二维码;状态置灰不影响该能力。 */
|
|
18
|
+
readonly qrCodeEnabled?: boolean;
|
|
19
|
+
readonly stores?: ReadonlyArray<{
|
|
20
|
+
storeId: string;
|
|
21
|
+
storeName: string;
|
|
22
|
+
businessName?: string;
|
|
23
|
+
imageUrl?: string;
|
|
24
|
+
address?: string;
|
|
25
|
+
floor?: string;
|
|
26
|
+
latitude?: number;
|
|
27
|
+
longitude?: number;
|
|
28
|
+
}>;
|
|
29
|
+
/** 生效/过期窗口(ISO8601) */
|
|
30
|
+
readonly validFrom?: string;
|
|
31
|
+
readonly validUntil?: string;
|
|
32
|
+
/** 原生券面有效期文案(例如“含领取之日起7天内有效”)。 */
|
|
33
|
+
readonly validityText?: string;
|
|
34
|
+
/** 抵扣价值(cents;PERCENTAGE 类为折扣分子) */
|
|
35
|
+
readonly valueCents?: number;
|
|
36
|
+
readonly discountPercent?: number;
|
|
37
|
+
readonly thresholdText?: string;
|
|
38
|
+
readonly benefitText?: string;
|
|
39
|
+
readonly usageNotice?: string;
|
|
40
|
+
readonly guaranteeText?: string;
|
|
41
|
+
readonly usageSceneText?: string;
|
|
42
|
+
/** 使用时间(如 00:00:00 至 23:59:59)。 */
|
|
43
|
+
readonly usageTimeText?: string;
|
|
44
|
+
/** 可领取时间窗口。 */
|
|
45
|
+
readonly claimTimeText?: string;
|
|
46
|
+
/** 原生券面“使用规则”富文本。 */
|
|
47
|
+
readonly usageRuleText?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface PromotionEntitlementPage {
|
|
50
|
+
readonly items: readonly PromotionEntitlement[];
|
|
51
|
+
readonly nextCursor?: string;
|
|
52
|
+
readonly hasMore: boolean;
|
|
53
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 营销 Offer 域模型(015:POC marketing domain/offer 精华沉淀,TIER1)。
|
|
3
|
+
* 五类 facet 判别联合 + 可用性事实 + 参与方式;金额 cents(域内 number)。
|
|
4
|
+
*/
|
|
5
|
+
import type { FreeCouponClaimMode } from './coupon';
|
|
6
|
+
/** 券面值类型 */
|
|
7
|
+
export interface CouponFacet {
|
|
8
|
+
readonly kind: 'COUPON';
|
|
9
|
+
readonly discountType: 'AMOUNT' | 'PERCENTAGE';
|
|
10
|
+
/** AMOUNT → cents;PERCENTAGE → 折扣率分子(85 = 8.5 折) */
|
|
11
|
+
readonly value: number;
|
|
12
|
+
/** 使用门槛(cents) */
|
|
13
|
+
readonly thresholdCents?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface BundleFacet {
|
|
16
|
+
readonly kind: 'BUNDLE';
|
|
17
|
+
readonly items: ReadonlyArray<{
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly quantity: number;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface PromotionFacet {
|
|
23
|
+
readonly kind: 'PROMOTION';
|
|
24
|
+
readonly ruleType: 'FULL_REDUCTION' | 'DISCOUNT' | 'LADDER';
|
|
25
|
+
readonly ruleDescription: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ActivityFacet {
|
|
28
|
+
readonly kind: 'ACTIVITY';
|
|
29
|
+
readonly registrationRequired: boolean;
|
|
30
|
+
readonly capacity?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface GrouponFacet {
|
|
33
|
+
readonly kind: 'GROUPON';
|
|
34
|
+
readonly requiredParticipants: number;
|
|
35
|
+
readonly groupExpiresInSeconds?: number;
|
|
36
|
+
}
|
|
37
|
+
export type OfferFacet = CouponFacet | BundleFacet | PromotionFacet | ActivityFacet | GrouponFacet;
|
|
38
|
+
export type OfferType = 'COUPON' | 'BUNDLE' | 'PROMOTION' | 'ACTIVITY' | 'GROUPON';
|
|
39
|
+
/** 可用性(厂商事实,非客户端推断) */
|
|
40
|
+
export interface OfferAvailability {
|
|
41
|
+
readonly status: 'AVAILABLE' | 'UNAVAILABLE' | 'REQUIRES_ACTION' | 'UNKNOWN';
|
|
42
|
+
readonly reasonCodes: readonly string[];
|
|
43
|
+
readonly evaluatedAt: string;
|
|
44
|
+
/** true = 厂商实时评估;false = 目录静态推断(领取前须厂商校验) */
|
|
45
|
+
readonly authoritative: boolean;
|
|
46
|
+
readonly requiredActions?: readonly string[];
|
|
47
|
+
}
|
|
48
|
+
export type ParticipationMode = 'AUTOMATIC_DISCOUNT' | 'CLAIM_THEN_PURCHASE' | 'REGISTER_THEN_ATTEND' | 'GROUP_PURCHASE' | 'UNKNOWN';
|
|
49
|
+
export interface OfferParticipation {
|
|
50
|
+
readonly mode: ParticipationMode;
|
|
51
|
+
readonly steps: ReadonlyArray<{
|
|
52
|
+
readonly title: string;
|
|
53
|
+
readonly description: string;
|
|
54
|
+
}>;
|
|
55
|
+
readonly requirements?: readonly string[];
|
|
56
|
+
readonly notice?: string;
|
|
57
|
+
}
|
|
58
|
+
/** 营销 Offer(厂商实例聚合根引用) */
|
|
59
|
+
export interface PromotionOffer {
|
|
60
|
+
readonly offerRef: string;
|
|
61
|
+
readonly providerInstanceId?: string;
|
|
62
|
+
readonly offerType: OfferType;
|
|
63
|
+
readonly title: string;
|
|
64
|
+
readonly subtitle?: string;
|
|
65
|
+
readonly description?: string;
|
|
66
|
+
readonly imageUrl?: string;
|
|
67
|
+
/** Provider 直出的 C 端展示文案,避免客户端从金额/规则反推语义。 */
|
|
68
|
+
readonly priceText?: string;
|
|
69
|
+
readonly originalPriceText?: string;
|
|
70
|
+
readonly discountLabel?: string;
|
|
71
|
+
readonly claimActionLabel?: string;
|
|
72
|
+
/** 券的小程序详情入口;付费券抢购、免费券 REDIRECT 均由客户端在弹窗内唤起。 */
|
|
73
|
+
readonly purchaseUrl?: string;
|
|
74
|
+
/** 仅免费券消费;付费券始终使用 purchaseUrl 跳转。 */
|
|
75
|
+
readonly freeCouponClaimMode?: FreeCouponClaimMode;
|
|
76
|
+
readonly stockText?: string;
|
|
77
|
+
readonly usageNoticeText?: string;
|
|
78
|
+
readonly usageSceneText?: string;
|
|
79
|
+
readonly usageTimeText?: string;
|
|
80
|
+
readonly claimTimeText?: string;
|
|
81
|
+
/** Provider 直出的有效期文案(如「含领取之日起 7 天内有效」)。 */
|
|
82
|
+
readonly validityText?: string;
|
|
83
|
+
readonly usageRuleText?: string;
|
|
84
|
+
readonly guaranteeText?: string;
|
|
85
|
+
readonly tags: readonly string[];
|
|
86
|
+
/** ISO8601 有效期 [start, end] */
|
|
87
|
+
readonly validity: {
|
|
88
|
+
readonly start?: string;
|
|
89
|
+
readonly end: string;
|
|
90
|
+
};
|
|
91
|
+
readonly facets: readonly OfferFacet[];
|
|
92
|
+
readonly participation?: OfferParticipation;
|
|
93
|
+
readonly availability: OfferAvailability;
|
|
94
|
+
/** 领取/参与入口的厂商外部绑定(activityId 等,不透明) */
|
|
95
|
+
readonly externalBinding?: Readonly<Record<string, string>>;
|
|
96
|
+
}
|
|
97
|
+
/** Offer 分页(cursor 透传) */
|
|
98
|
+
export interface PromotionOfferPage {
|
|
99
|
+
readonly items: readonly PromotionOffer[];
|
|
100
|
+
readonly nextCursor?: string;
|
|
101
|
+
readonly hasMore: boolean;
|
|
102
|
+
}
|
|
103
|
+
/** 最优优惠测算(calculateBestDeal) */
|
|
104
|
+
export interface PromotionBestDeal {
|
|
105
|
+
readonly offerRef: string;
|
|
106
|
+
readonly title: string;
|
|
107
|
+
/** 预估优惠(cents) */
|
|
108
|
+
readonly estimatedSavingCents: number;
|
|
109
|
+
readonly reason: string;
|
|
110
|
+
readonly candidatesConsidered: number;
|
|
111
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 营销写操作域模型(015,TIER1):POC MarketingOperation 状态机沉淀。
|
|
3
|
+
* CREATED → EXECUTING → SUCCEEDED | PARTIAL | REJECTED | PENDING_AUTHORITY。
|
|
4
|
+
*/
|
|
5
|
+
export type PromotionOperationStatus = 'CREATED' | 'EXECUTING' | 'SUCCEEDED' | 'PARTIAL' | 'REJECTED' | 'PENDING_AUTHORITY';
|
|
6
|
+
/** 操作终态(模块出卡只关心四态;CREATED/EXECUTING 为过程态不出卡) */
|
|
7
|
+
export type PromotionOperationOutcome = Extract<PromotionOperationStatus, 'SUCCEEDED' | 'PARTIAL' | 'REJECTED' | 'PENDING_AUTHORITY'>;
|
|
8
|
+
export interface PromotionOperation {
|
|
9
|
+
readonly operationRef: string;
|
|
10
|
+
readonly status: PromotionOperationStatus;
|
|
11
|
+
readonly offerRef: string;
|
|
12
|
+
/** 厂商操作引用(对账/查询用,不透明) */
|
|
13
|
+
readonly externalOperationRef?: string;
|
|
14
|
+
/** 成功领取后的券码(脱敏) */
|
|
15
|
+
readonly codeMasked?: string;
|
|
16
|
+
/** 厂商错误码(30013 未授权 / 636·637 库存 / 638 重复 / 30017 不合格 等) */
|
|
17
|
+
readonly code?: string;
|
|
18
|
+
readonly message?: string;
|
|
19
|
+
readonly observedAt: string;
|
|
20
|
+
}
|
|
21
|
+
/** acquire 的厂商拒绝语义分类(错误码映射产物,出卡文案用) */
|
|
22
|
+
export type PromotionRejectionKind = 'AUTH_FAILED' | 'OUT_OF_STOCK' | 'ALREADY_ACQUIRED' | 'NOT_ELIGIBLE' | 'UNKNOWN';
|
package/dist/domain/parking.d.ts
CHANGED
|
@@ -1,13 +1,196 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 停车域模型(015:POC parking 域精华沉淀,TIER1)。
|
|
3
|
+
* 金额一律 cents(number);展示层字符串化(D11)。
|
|
4
|
+
*/
|
|
5
|
+
/** 停车车辆(绑定车) */
|
|
6
|
+
export interface ParkingVehicle {
|
|
7
|
+
readonly vehicleRef: string;
|
|
8
|
+
readonly plateNo: string;
|
|
9
|
+
readonly boundAt?: string;
|
|
10
|
+
/**
|
|
11
|
+
* 是否在场内(可选能力):provider 无入场查询能力时缺省,UI 据此不显示任何入场状态——
|
|
12
|
+
* 缺省与 false 不同义,false 是「查过,不在场」。
|
|
13
|
+
*/
|
|
14
|
+
readonly parked?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 入场探测结果元素(可选能力口 ParkingQueryPort.probeParkedVehicles 出参)。
|
|
18
|
+
* 仅含在场车辆;缺席 = 未入场或未知。
|
|
19
|
+
*/
|
|
20
|
+
export interface ParkingPresence {
|
|
21
|
+
readonly plateNo: string;
|
|
22
|
+
/** 已停时长(分钟,≥1);provider 给不出时缺省,UI 退回通用计费文案 */
|
|
23
|
+
readonly parkedMinutes?: number;
|
|
24
|
+
}
|
|
25
|
+
/** 费用明细项 */
|
|
26
|
+
export interface ParkingFeeItem {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
/** 应收(cents) */
|
|
29
|
+
readonly amountCents: number;
|
|
30
|
+
/** 优惠减免(cents,正数) */
|
|
31
|
+
readonly discountCents?: number;
|
|
32
|
+
readonly note?: string;
|
|
33
|
+
}
|
|
34
|
+
/** 报价快照(revision 乐观锁:权益重选 → 新 revision,旧卡提交被拒) */
|
|
35
|
+
export interface QuoteSnapshot {
|
|
36
|
+
readonly quoteRef: string;
|
|
37
|
+
readonly plateNo: string;
|
|
38
|
+
readonly mallId: string;
|
|
39
|
+
readonly entryAt?: string;
|
|
40
|
+
readonly exitAt?: string;
|
|
41
|
+
readonly feeItems: readonly ParkingFeeItem[];
|
|
42
|
+
/** 应收合计(cents) */
|
|
43
|
+
readonly totalCents: number;
|
|
44
|
+
/** 已减免合计(cents) */
|
|
45
|
+
readonly discountCents: number;
|
|
46
|
+
/** 应付(total - discount,cents) */
|
|
47
|
+
readonly payableCents: number;
|
|
48
|
+
/** 已生效权益(benefitRef → 标题) */
|
|
49
|
+
readonly appliedBenefits: ReadonlyArray<{
|
|
50
|
+
readonly benefitRef: string;
|
|
51
|
+
readonly title: string;
|
|
52
|
+
readonly discountCents: number;
|
|
53
|
+
}>;
|
|
54
|
+
/** 乐观锁版本(reprice 递增) */
|
|
55
|
+
readonly revision: number;
|
|
56
|
+
readonly paymentState: 'UNPAID' | 'PAYING' | 'PAID';
|
|
57
|
+
readonly expiresAt?: string;
|
|
58
|
+
/**
|
|
59
|
+
* 支付交接包(provider 有跳转支付页能力时给出):客户端卡据 kind 调壳 tbox 能力收款——
|
|
60
|
+
* `kind:'pay'` → `openParkingPay`(传 orderInfo,壳负责跳确认页/收银台);
|
|
61
|
+
* `kind:'unpaid'` → `openParkingUnpaidOrder`(传 orderNo,壳打开已有待支付订单详情页)。
|
|
62
|
+
* provider 无此语义时缺省(调用方退回内部建单/收银台流程)。
|
|
63
|
+
*/
|
|
64
|
+
readonly payHandoff?: {
|
|
65
|
+
readonly kind: 'pay' | 'unpaid';
|
|
66
|
+
readonly parkingStoreId?: string;
|
|
67
|
+
/** kind='pay' 时给——传给壳 `openParkingPay` 的订单信息 */
|
|
68
|
+
readonly orderInfo?: ParkingPayOrderInfo;
|
|
69
|
+
/** kind='unpaid' 时给——已有订单号(= 厂商 tradeOrderNo,与壳协议 orderNo 同号)传给壳 `openParkingUnpaidOrder` */
|
|
70
|
+
readonly orderNo?: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 厂商协议 `openParkingPay` 的 orderInfo(从 advancePaymentOrder 聚合)。
|
|
75
|
+
* 壳用这些字段自己拼确认页,不再回查费。
|
|
76
|
+
*/
|
|
77
|
+
export interface ParkingPayOrderInfo {
|
|
78
|
+
/** 停车秒数 */
|
|
79
|
+
readonly staySecond?: number;
|
|
80
|
+
/** 停车费,单位分 */
|
|
81
|
+
readonly parkingFee?: number;
|
|
82
|
+
/** 车牌绑定状态 */
|
|
83
|
+
readonly bindingStatus?: number;
|
|
84
|
+
/** 车牌 */
|
|
85
|
+
readonly plateNumber?: string;
|
|
86
|
+
/** 1=在场缴费,2=逃费/欠费 */
|
|
87
|
+
readonly orderType: number;
|
|
88
|
+
/** 车场侧订单号 */
|
|
89
|
+
readonly spParkingOrderId?: string;
|
|
90
|
+
/** 车场 ID(协议已定 string) */
|
|
91
|
+
readonly parkingId: string;
|
|
92
|
+
/** 入场时间 */
|
|
93
|
+
readonly entranceTime?: string;
|
|
94
|
+
/** 逗号分隔的能力枚举,如 "LEVEL_DISCOUNT,POINT_DISCOUNT,COUPON" */
|
|
95
|
+
readonly supportDiscount?: string;
|
|
96
|
+
}
|
|
97
|
+
/** 可选权益(用户可勾选参与 reprice) */
|
|
98
|
+
export interface ParkingBenefit {
|
|
99
|
+
readonly benefitRef: string;
|
|
100
|
+
readonly title: string;
|
|
101
|
+
readonly description?: string;
|
|
102
|
+
/** 是否已默认勾选生效 */
|
|
103
|
+
readonly autoSelected: boolean;
|
|
104
|
+
readonly estimatedDiscountCents?: number;
|
|
105
|
+
/** Provider 归一化后的权益类型;不得由客户端从标题猜测。 */
|
|
106
|
+
readonly kind?: 'points' | 'discount' | 'coupon' | 'other';
|
|
107
|
+
/**
|
|
108
|
+
* 与本权益互斥的权益类型(Provider 归一化下发;客户端不得从标题或类型推断)。
|
|
109
|
+
* 三类优惠(券 / 积分抵扣 / 等级权益)默认可叠加,互斥是厂商侧的按券配置——
|
|
110
|
+
* 部分停车券标记「不可与积分叠加」即 ['points']。互斥判定必须双向:勾选任一方
|
|
111
|
+
* 都要撤下另一方(见客户端 resolveBenefitSelection)。
|
|
112
|
+
*/
|
|
113
|
+
readonly exclusiveWithKinds?: readonly ('points' | 'discount' | 'coupon')[];
|
|
114
|
+
/** 仅在 Provider 返回权威兑换计划时提供。 */
|
|
115
|
+
readonly requiredPoints?: number;
|
|
116
|
+
/** 与 requiredPoints 对应的权威预估应付金额。 */
|
|
117
|
+
readonly previewPayableCents?: number;
|
|
118
|
+
/** 不可与哪些 benefitRef 同时生效;为空数组表示与所有同类别权益(如所有 coupon)互斥。 */
|
|
119
|
+
readonly exclusiveWith?: readonly string[];
|
|
120
|
+
/** 是否可与优惠券叠加(仅积分类权益有意义);undefined 表示未知/默认允许。 */
|
|
121
|
+
readonly stacksWithCoupon?: boolean;
|
|
122
|
+
}
|
|
123
|
+
/** 寻车定位 */
|
|
124
|
+
export interface ParkingLocation {
|
|
125
|
+
readonly floorName?: string;
|
|
126
|
+
readonly zoneName?: string;
|
|
127
|
+
readonly spaceNo?: string;
|
|
128
|
+
readonly walkingRoute?: string;
|
|
129
|
+
readonly mapUrl?: string;
|
|
130
|
+
}
|
|
131
|
+
/** 缴费记录条目 */
|
|
132
|
+
export interface ParkingPaymentRecord {
|
|
133
|
+
readonly recordRef: string;
|
|
134
|
+
readonly plateNo: string;
|
|
135
|
+
/** 实付(cents) */
|
|
136
|
+
readonly amountCents: number;
|
|
137
|
+
readonly paidAt: string;
|
|
138
|
+
readonly status: 'PAID' | 'REFUNDED' | 'CLOSED' | 'UNKNOWN';
|
|
139
|
+
/** 厂商原始交易状态文案(如「交易关闭」「交易完成」,供卡片直接展示) */
|
|
140
|
+
readonly statusText?: string;
|
|
141
|
+
readonly parkName?: string;
|
|
142
|
+
readonly plazaName?: string;
|
|
143
|
+
readonly entryAt?: string;
|
|
144
|
+
readonly exitAt?: string;
|
|
145
|
+
readonly payOrderNoMasked?: string;
|
|
146
|
+
/** 厂商订单是否已完成(开票资格的前置条件) */
|
|
147
|
+
readonly orderCompleted?: boolean;
|
|
148
|
+
/** 当前是否允许申请开票(同时受停车场配置与订单状态约束) */
|
|
149
|
+
readonly invoiceEligible?: boolean;
|
|
150
|
+
/** 是否已开票/已提交开票申请 */
|
|
151
|
+
readonly invoiceIssued?: boolean;
|
|
152
|
+
}
|
|
153
|
+
export interface ParkingRecordPage {
|
|
154
|
+
readonly items: readonly ParkingPaymentRecord[];
|
|
155
|
+
readonly total: number;
|
|
156
|
+
readonly page: number;
|
|
157
|
+
readonly pageSize: number;
|
|
158
|
+
readonly hasMore: boolean;
|
|
159
|
+
}
|
|
160
|
+
/** 停车场综合信息(四合一 kind) */
|
|
161
|
+
export interface ParkingInfo {
|
|
162
|
+
readonly kind: 'chargeRules' | 'benefitPolicy' | 'pendingOrder' | 'vehicleLocation';
|
|
163
|
+
readonly title: string;
|
|
164
|
+
/** 通用键值展示(余位数/首小时费率/会员权益政策等) */
|
|
165
|
+
readonly entries: ReadonlyArray<{
|
|
166
|
+
readonly label: string;
|
|
167
|
+
readonly value: string;
|
|
168
|
+
}>;
|
|
169
|
+
/** pendingOrder 时的待支付单引用 */
|
|
170
|
+
readonly pendingQuote?: QuoteSnapshot;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 支付操作(StateStore 持久化单据):
|
|
174
|
+
* PAYING →(reconcile 权威)→ PAID / CANCELLED;UNKNOWN = 厂商态不明(悬挂,下次交互收口,V2)。
|
|
175
|
+
*/
|
|
176
|
+
export interface PaymentOperation {
|
|
177
|
+
/** 对外不透明引用;卡片/客户端只能持有该值 */
|
|
178
|
+
readonly paymentRef: string;
|
|
179
|
+
/** 厂商支付引用,仅服务端持久化并用于回查 */
|
|
180
|
+
readonly providerPaymentRef: string;
|
|
181
|
+
readonly quoteRef: string;
|
|
182
|
+
readonly plateNo: string;
|
|
183
|
+
/** 支付操作归属主体;与 mallId 共同用于服务端授权 */
|
|
184
|
+
readonly subjectId: string;
|
|
185
|
+
readonly mallId: string;
|
|
186
|
+
readonly payableCents: number;
|
|
187
|
+
/** 厂商支付单号(masked 展示) */
|
|
188
|
+
readonly payOrderNoMasked?: string;
|
|
189
|
+
/** 厂商支付组件流水 ID(GetPaySign 产出;结果上报 UploadPayParamsResult 回传) */
|
|
190
|
+
readonly payOrderFlowId?: string;
|
|
191
|
+
readonly status: 'PAYING' | 'PAID' | 'CANCELLED' | 'UNKNOWN';
|
|
192
|
+
readonly createdAt: string;
|
|
193
|
+
readonly paidAt?: string;
|
|
194
|
+
/** 入场时间(建单时自报价带入):回执要算停车时长,而报价此时已不可达 */
|
|
195
|
+
readonly entryAt?: string;
|
|
13
196
|
}
|
package/dist/domain/points.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** 会员积分(商圈领域 DTO) */
|
|
2
2
|
export interface Points {
|
|
3
3
|
userId: string;
|
|
4
4
|
/** 当前积分余额 */
|
|
5
5
|
balance: number;
|
|
6
|
-
|
|
6
|
+
/** 厂商返回的真实会员标签;不得由积分余额推导。 */
|
|
7
|
+
membershipLabel?: string;
|
|
7
8
|
}
|
|
8
9
|
/** 积分余额变动结果 */
|
|
9
10
|
export interface PointsChangeResult {
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 商品导购域模型(shopping-guide domain model,TIER1)。
|
|
3
|
+
* 商品、门店(shop)、位置、类目、知识库、人工导购等核心业务实体。
|
|
4
|
+
* Port 接口见 services/shopping-guide.ts;卡片数据结构见 shopping-guide/cards.ts。
|
|
5
|
+
*/
|
|
6
|
+
import type { FreeCouponClaimMode } from './coupon';
|
|
7
|
+
/** 货币金额值对象 */
|
|
8
|
+
export interface MoneyRecord {
|
|
9
|
+
readonly currency: 'CNY';
|
|
10
|
+
readonly amountMinor: number;
|
|
11
|
+
readonly display: string;
|
|
12
|
+
}
|
|
13
|
+
/** 门店位置值对象(零坐标依赖,POC R5;poiId 有值时可升级为坐标导航) */
|
|
14
|
+
export interface ShopLocationRecord {
|
|
15
|
+
readonly buildingName?: string;
|
|
16
|
+
readonly floorName?: string;
|
|
17
|
+
readonly unitName?: string;
|
|
18
|
+
readonly displayText: string;
|
|
19
|
+
readonly poiId?: string;
|
|
20
|
+
}
|
|
21
|
+
/** @deprecated 使用 ShopLocationRecord */
|
|
22
|
+
export type MerchantLocationRecord = ShopLocationRecord;
|
|
23
|
+
/** 商品实体 */
|
|
24
|
+
export interface ProductRecord {
|
|
25
|
+
readonly productId: string;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly description?: string;
|
|
28
|
+
readonly imageUrls: readonly string[];
|
|
29
|
+
readonly brand?: string;
|
|
30
|
+
readonly categoryPath: readonly string[];
|
|
31
|
+
readonly price: ProductPrice;
|
|
32
|
+
readonly availability: ProductAvailability;
|
|
33
|
+
readonly merchant: ProductShopRef;
|
|
34
|
+
readonly labels: readonly string[];
|
|
35
|
+
readonly attributes: ReadonlyArray<ProductAttribute>;
|
|
36
|
+
readonly promotionFacts: readonly string[];
|
|
37
|
+
readonly observedAt: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ProductPrice {
|
|
40
|
+
readonly sale?: MoneyRecord;
|
|
41
|
+
readonly original?: MoneyRecord;
|
|
42
|
+
readonly promotion?: MoneyRecord;
|
|
43
|
+
}
|
|
44
|
+
export interface ProductAvailability {
|
|
45
|
+
readonly status: 'in_stock' | 'out_of_stock' | 'limited' | 'unknown';
|
|
46
|
+
readonly label: string;
|
|
47
|
+
readonly marketable: boolean;
|
|
48
|
+
readonly observedAt: string;
|
|
49
|
+
}
|
|
50
|
+
/** 商品上的门店引用(轻量,不含完整门店信息) */
|
|
51
|
+
export interface ProductShopRef {
|
|
52
|
+
readonly merchantId: string;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly location?: ShopLocationRecord;
|
|
55
|
+
}
|
|
56
|
+
/** @deprecated 使用 ProductShopRef */
|
|
57
|
+
export type ProductMerchantRef = ProductShopRef;
|
|
58
|
+
export interface ProductAttribute {
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly value: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ProductFacetsRecord {
|
|
63
|
+
readonly brands: ReadonlyArray<FacetOption>;
|
|
64
|
+
readonly categories: ReadonlyArray<FacetOption>;
|
|
65
|
+
readonly priceRanges: ReadonlyArray<PriceRangeFacet>;
|
|
66
|
+
readonly floors: ReadonlyArray<FloorFacetOption>;
|
|
67
|
+
}
|
|
68
|
+
export interface FacetOption {
|
|
69
|
+
readonly code: string;
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly count: number;
|
|
72
|
+
}
|
|
73
|
+
export interface PriceRangeFacet {
|
|
74
|
+
readonly minMinor: number;
|
|
75
|
+
readonly maxMinor: number;
|
|
76
|
+
readonly displayLabel: string;
|
|
77
|
+
readonly count: number;
|
|
78
|
+
}
|
|
79
|
+
export interface FloorFacetOption {
|
|
80
|
+
readonly code: string;
|
|
81
|
+
readonly displayName: string;
|
|
82
|
+
readonly count: number;
|
|
83
|
+
}
|
|
84
|
+
/** 门店关联优惠(来自 couponList) */
|
|
85
|
+
export interface ShopCoupon {
|
|
86
|
+
readonly name: string;
|
|
87
|
+
readonly imageUrl?: string;
|
|
88
|
+
/** 去 HTML 标签后的纯文本描述(可选) */
|
|
89
|
+
readonly description?: string;
|
|
90
|
+
/** 券面值(元,parValue/100) */
|
|
91
|
+
readonly faceValue?: number;
|
|
92
|
+
/** 售价(元,price/100;0 = 免费领取) */
|
|
93
|
+
readonly salePrice?: number;
|
|
94
|
+
/** 适用业态列表(useBusinessType) */
|
|
95
|
+
readonly applicableCategories?: string[];
|
|
96
|
+
/** 领取后有效小时数(expiredAfterHours) */
|
|
97
|
+
readonly validHours?: number;
|
|
98
|
+
/** 可用时间文案(useWeekTime 解析:星期段 + st-et 截前 5 位,provider 直出) */
|
|
99
|
+
readonly usageTimeText?: string;
|
|
100
|
+
/** 券的小程序详情入口;付费券固定跳转,免费券由 freeCouponClaimMode 决定。 */
|
|
101
|
+
readonly purchaseUrl?: string;
|
|
102
|
+
/** 仅免费券消费;缺省保持既有直领语义。 */
|
|
103
|
+
readonly freeCouponClaimMode?: FreeCouponClaimMode;
|
|
104
|
+
/**
|
|
105
|
+
* 营销域券引用(厂商 offerRef 形如 `offer:${couponNo}`)——厂商 couponList 返回券编号时提供;
|
|
106
|
+
* DIRECT 模式下经 promotion.acquire 同链路领取。
|
|
107
|
+
*/
|
|
108
|
+
readonly offerRef?: string;
|
|
109
|
+
}
|
|
110
|
+
/** 门店实体(聚合根) */
|
|
111
|
+
export interface ShopRecord {
|
|
112
|
+
readonly merchantId: string;
|
|
113
|
+
readonly name: string;
|
|
114
|
+
readonly logoUrl?: string;
|
|
115
|
+
readonly coverUrls: readonly string[];
|
|
116
|
+
readonly brand?: string;
|
|
117
|
+
readonly businessCategories: readonly string[];
|
|
118
|
+
readonly location: ShopLocationRecord;
|
|
119
|
+
readonly status: ShopStatus;
|
|
120
|
+
readonly description?: string;
|
|
121
|
+
readonly contactInfo?: ReadonlyArray<ContactChannel>;
|
|
122
|
+
readonly services: readonly string[];
|
|
123
|
+
readonly promotionFacts: readonly string[];
|
|
124
|
+
/** 门店关联优惠券列表(来自 provider couponList;有值时展示) */
|
|
125
|
+
readonly coupons?: ReadonlyArray<ShopCoupon>;
|
|
126
|
+
readonly observedAt: string;
|
|
127
|
+
}
|
|
128
|
+
/** @deprecated 使用 ShopRecord */
|
|
129
|
+
export type MerchantRecord = ShopRecord;
|
|
130
|
+
export interface ShopStatus {
|
|
131
|
+
readonly code: 'enabled' | 'disabled' | 'unknown';
|
|
132
|
+
readonly label: string;
|
|
133
|
+
readonly observedAt: string;
|
|
134
|
+
}
|
|
135
|
+
/** @deprecated 使用 ShopStatus */
|
|
136
|
+
export type MerchantStatus = ShopStatus;
|
|
137
|
+
export interface ContactChannel {
|
|
138
|
+
readonly channel: string;
|
|
139
|
+
readonly value: string;
|
|
140
|
+
}
|
|
141
|
+
export interface CategoryRecord {
|
|
142
|
+
readonly code: string;
|
|
143
|
+
readonly name: string;
|
|
144
|
+
readonly description?: string;
|
|
145
|
+
/** 类目图标 URL(C 端 GetListMallCategory 返回;空字符串时由前端展示默认图标) */
|
|
146
|
+
readonly iconUrl?: string;
|
|
147
|
+
readonly merchantCount: number;
|
|
148
|
+
readonly subCategories?: ReadonlyArray<SubCategoryRecord>;
|
|
149
|
+
}
|
|
150
|
+
export interface SubCategoryRecord {
|
|
151
|
+
readonly code: string;
|
|
152
|
+
readonly name: string;
|
|
153
|
+
readonly merchantCount: number;
|
|
154
|
+
}
|
|
155
|
+
export interface MallDirectoryRecord {
|
|
156
|
+
readonly mallId: string;
|
|
157
|
+
readonly mallName: string;
|
|
158
|
+
readonly buildings: ReadonlyArray<BuildingRecord>;
|
|
159
|
+
readonly observedAt: string;
|
|
160
|
+
}
|
|
161
|
+
export interface BuildingRecord {
|
|
162
|
+
readonly buildingCode: string;
|
|
163
|
+
readonly buildingName: string;
|
|
164
|
+
readonly floors: ReadonlyArray<FloorRecord>;
|
|
165
|
+
}
|
|
166
|
+
export interface FloorRecord {
|
|
167
|
+
readonly floorCode: string;
|
|
168
|
+
readonly floorName: string;
|
|
169
|
+
readonly businessCategories: readonly string[];
|
|
170
|
+
readonly merchantCount: number;
|
|
171
|
+
}
|
|
172
|
+
export interface FaqEntry {
|
|
173
|
+
readonly question: string;
|
|
174
|
+
readonly answer: string;
|
|
175
|
+
readonly category?: string;
|
|
176
|
+
readonly relevanceScore: number;
|
|
177
|
+
}
|
|
178
|
+
export interface KnowledgeEntry {
|
|
179
|
+
readonly content: string;
|
|
180
|
+
readonly title?: string;
|
|
181
|
+
readonly score: number;
|
|
182
|
+
}
|
|
183
|
+
export interface HumanGuideRecord {
|
|
184
|
+
readonly guideId: string;
|
|
185
|
+
readonly name: string;
|
|
186
|
+
readonly title?: string;
|
|
187
|
+
readonly avatarUrl?: string;
|
|
188
|
+
readonly contactInfo?: ReadonlyArray<ContactChannel>;
|
|
189
|
+
readonly available: boolean;
|
|
190
|
+
}
|
|
191
|
+
export interface NearbyMallRecord {
|
|
192
|
+
readonly mallId: string;
|
|
193
|
+
readonly name: string;
|
|
194
|
+
readonly address: string;
|
|
195
|
+
readonly distanceKm?: number;
|
|
196
|
+
readonly status: NearbyMallStatus;
|
|
197
|
+
}
|
|
198
|
+
export interface NearbyMallStatus {
|
|
199
|
+
readonly code: 'open' | 'closed' | 'unknown';
|
|
200
|
+
readonly label: string;
|
|
201
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @tbox.cn/app-contracts-mall:商圈领域契约(TIER1,types + runtime)。
|
|
3
|
-
* 消费方(module-* /
|
|
3
|
+
* 消费方(module-* / 模板装配点)只依赖本契约,
|
|
4
4
|
* 不依赖任何模块实现包——结构类型子集接口 + 事件总线破环双向依赖。
|
|
5
5
|
* runtime 值(scope 解析/装配器/守卫)经 ./runtime 导出(dist/runtime.js)。
|
|
6
6
|
*/
|
|
@@ -8,14 +8,27 @@ export * from './domain/points';
|
|
|
8
8
|
export * from './domain/coupon';
|
|
9
9
|
export * from './domain/discount';
|
|
10
10
|
export * from './domain/parking';
|
|
11
|
+
export * from './domain/offer';
|
|
12
|
+
export * from './domain/entitlement';
|
|
13
|
+
export * from './domain/activity';
|
|
14
|
+
export * from './domain/operation';
|
|
11
15
|
export * from './services/member';
|
|
12
16
|
export * from './services/parking';
|
|
13
17
|
export * from './services/promotion';
|
|
18
|
+
export * from './services/mall-info';
|
|
14
19
|
export * from './events';
|
|
15
20
|
export * from './scope';
|
|
21
|
+
export * from './query-context';
|
|
16
22
|
export * from './deployment';
|
|
17
23
|
export * from './assembly';
|
|
24
|
+
export * from './mall-scope-url';
|
|
18
25
|
export * from './guard';
|
|
19
26
|
export * from './shopping-guide/cards';
|
|
20
|
-
export * from './
|
|
27
|
+
export * from './shared/cards';
|
|
28
|
+
export * from './domain/shopping-guide';
|
|
29
|
+
export * from './services/shopping-guide';
|
|
30
|
+
export * from './services/customer-service';
|
|
21
31
|
export * from './member/cards';
|
|
32
|
+
export * from './promotion/cards';
|
|
33
|
+
export * from './parking/cards';
|
|
34
|
+
export * from './alipay-activity/cards';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mall scope URL 读源(客户端单一真源;自 mall 模板 platform/ 迁入,单一模板统一化 W1-①;
|
|
3
|
+
* search-only——hash 内参数不读,壳侧 URL 改写层若移参进 hash 则失效,接入契约显式声明)。
|
|
4
|
+
*
|
|
5
|
+
* mallId = 契约键(优先);plazaId = 商场通用别名兜底(壳侧词汇兼容,非 vendor 特判——
|
|
6
|
+
* 正式小程序壳 webview 传 ?…&plazaId=1105288,本 helper 将其归一为 mallId 读源)。
|
|
7
|
+
*
|
|
8
|
+
* 仅客户端消费(浏览器环境);服务端不调用(本包其余 runtime 同构,本文件为浏览器面例外,
|
|
9
|
+
* 函数体内联 window 访问——Node 侧调用会抛,属契约外用法)。
|
|
10
|
+
*/
|
|
11
|
+
export declare function readMallIdFromUrl(): string | null;
|
|
12
|
+
/** 小程序 appId 读源(可选;服务端按 root config 回填,客户端缺省不阻塞) */
|
|
13
|
+
export declare function readMiniAppIdFromUrl(): string | null;
|