@tbox.cn/app-module-alipay-activity 0.3.3 → 0.3.5
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/AGENTS.md +6 -8
- package/INTEGRATION.md +26 -0
- package/dist/{chunk-5VWMSB4Z.js → chunk-DNQIX4XG.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +20 -20
- package/dist/server/index.js +1 -1
- package/package.json +7 -6
- package/src/server/index.ts +6 -0
- package/src/server/tools.ts +2 -2
package/AGENTS.md
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
# module-alipay-activity —— 集成指引(AI 助手用)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- 服务槽清单:见 `tbox.module.json` 的 `contributes.services`(demand 侧,含 title/description meta)。
|
|
3
|
+
本模块为商圈业务模块(支付宝碰一下活动查询与展示)。服务槽、接口清单、接入依赖与可选降级见本包
|
|
4
|
+
`INTEGRATION.md`(真源);结构事实(槽位/必选性)见本包 `tbox.module.json`。
|
|
6
5
|
|
|
7
6
|
## 自定义 API 对接(AI 集成)
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
本模块 Port 接口为 adapter 的实现契约(输入 `ServiceAdapterInput`:config/instanceId/credentialRef)。
|
|
8
|
+
见本包 `INTEGRATION.md`(接入语义真源);实施落点与流程见应用根 `INTEGRATION.md`
|
|
9
|
+
与 `packages/provider-custom/INTEGRATION.md`。
|
|
12
10
|
|
|
13
11
|
## 真实厂商接入
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
见本包 `INTEGRATION.md`;官方 provider 包形态用 `tbox-app new provider <name>` 骨架
|
|
14
|
+
(应用态 `packages/provider-<id>` local 形态 / 仓库态 `modules/provider-<id>` 发布形态)。
|
package/INTEGRATION.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# INTEGRATION —— module-alipay-activity(支付宝碰一下活动)接入指引
|
|
2
|
+
|
|
3
|
+
> 本模块**零服务槽声明**(无 consumes/owns)——不走「自定义 API」内联声明流程;接入面 =
|
|
4
|
+
> `config/bumpin.json` 配置面 + 支付宝开放平台凭证。本文件只写该配置面事实。
|
|
5
|
+
|
|
6
|
+
## 接入面(config/bumpin.json)
|
|
7
|
+
|
|
8
|
+
- 必填:`gateway`(支付宝网关地址)、`actSchemeId`(活动方案 id);可选:
|
|
9
|
+
`linkedCardBackgroundUrl?`(联单卡背景)、`credentialRef?`(仅声明位)。
|
|
10
|
+
- 配置缺失/解析失败 → 工具静默降级(`supported:false`,不报错)——验收判据 = 工具返回
|
|
11
|
+
真实活动数据而非 `supported:false`。
|
|
12
|
+
|
|
13
|
+
## 凭证通道(三分优先级)
|
|
14
|
+
|
|
15
|
+
1. 离散 env:`MINI_APP_ID` + `MINI_APP_PRIVATE_KEY` + `MINI_APP_ALIPAY_PUB_KEY`(三键齐备);
|
|
16
|
+
2. `config/credentials/alipay-bumpin.json`(与 bumpin.json 同目录,stem 固定);
|
|
17
|
+
3. env `ALIPAY_BUMPIN`。
|
|
18
|
+
占位值(PLACEHOLDER*)视为缺失。配置路径由 mall-core register 注入(`TBOX_CONFIG_DIR`
|
|
19
|
+
或应用 `config/`)。
|
|
20
|
+
|
|
21
|
+
## 身份与门禁
|
|
22
|
+
|
|
23
|
+
- 请求身份取平台 `openid`(2088 前缀 → `user_id`,否则 `open_id`);登录门禁拦匿名态,
|
|
24
|
+
未入会用户经 member 门禁附卡引导。
|
|
25
|
+
- 营销活动意图经本模块 `activity-router` 策略承接(策略由 scope 绑定的 provider 注册
|
|
26
|
+
决定;未启用时回到营销模块 provider 路径)。
|
|
@@ -485,7 +485,7 @@ function createBumpInTools(getCtx2) {
|
|
|
485
485
|
const cardData = toBumpInCardData(detail, "detail");
|
|
486
486
|
return {
|
|
487
487
|
...cardData,
|
|
488
|
-
// note
|
|
488
|
+
// note 契约:标题 + 进度要点(cardData.totalProgress/currentProgress 由 guide 解析)
|
|
489
489
|
cards: [
|
|
490
490
|
{
|
|
491
491
|
cardType: "promotion-bumpin-activity",
|
package/dist/index.js
CHANGED
package/dist/server/index.d.ts
CHANGED
|
@@ -115,23 +115,23 @@ declare const serverModule: {
|
|
|
115
115
|
merchantLogo: zod.ZodOptional<zod.ZodString>;
|
|
116
116
|
itemLogo: zod.ZodOptional<zod.ZodString>;
|
|
117
117
|
}, "strip", zod.ZodTypeAny, {
|
|
118
|
+
merchantName: string;
|
|
118
119
|
prizeId: string;
|
|
119
120
|
voucherName: string;
|
|
120
121
|
voucherType: string;
|
|
121
122
|
reductionAmount: string;
|
|
122
123
|
thresholdAmountText: string;
|
|
123
124
|
unit: string;
|
|
124
|
-
merchantName: string;
|
|
125
125
|
merchantLogo?: string | undefined;
|
|
126
126
|
itemLogo?: string | undefined;
|
|
127
127
|
}, {
|
|
128
|
+
merchantName: string;
|
|
128
129
|
prizeId: string;
|
|
129
130
|
voucherName: string;
|
|
130
131
|
voucherType: string;
|
|
131
132
|
reductionAmount: string;
|
|
132
133
|
thresholdAmountText: string;
|
|
133
134
|
unit: string;
|
|
134
|
-
merchantName: string;
|
|
135
135
|
merchantLogo?: string | undefined;
|
|
136
136
|
itemLogo?: string | undefined;
|
|
137
137
|
}>, "many">;
|
|
@@ -148,25 +148,29 @@ declare const serverModule: {
|
|
|
148
148
|
description?: string | undefined;
|
|
149
149
|
}>, "many">>;
|
|
150
150
|
}, "strip", zod.ZodTypeAny, {
|
|
151
|
-
activityRef: string;
|
|
152
151
|
title: string;
|
|
152
|
+
mode: "detail" | "banner";
|
|
153
|
+
activityRef: string;
|
|
153
154
|
actStatus: "NOT_START" | "INIT" | "PROCESSING" | "FINISH" | "RECEIVED";
|
|
154
155
|
vouchers: {
|
|
156
|
+
merchantName: string;
|
|
155
157
|
prizeId: string;
|
|
156
158
|
voucherName: string;
|
|
157
159
|
voucherType: string;
|
|
158
160
|
reductionAmount: string;
|
|
159
161
|
thresholdAmountText: string;
|
|
160
162
|
unit: string;
|
|
161
|
-
merchantName: string;
|
|
162
163
|
merchantLogo?: string | undefined;
|
|
163
164
|
itemLogo?: string | undefined;
|
|
164
165
|
}[];
|
|
165
|
-
|
|
166
|
-
progressStyle: "bar" | "steps";
|
|
166
|
+
progressStyle: "steps" | "bar";
|
|
167
167
|
description?: string | undefined;
|
|
168
|
-
|
|
168
|
+
steps?: {
|
|
169
|
+
title: string;
|
|
170
|
+
description?: string | undefined;
|
|
171
|
+
}[] | undefined;
|
|
169
172
|
coverUrl?: string | undefined;
|
|
173
|
+
mainTitle?: string | undefined;
|
|
170
174
|
backgroundUrl?: string | undefined;
|
|
171
175
|
tagLabel?: string | undefined;
|
|
172
176
|
cardLogoUrl?: string | undefined;
|
|
@@ -175,28 +179,29 @@ declare const serverModule: {
|
|
|
175
179
|
progressUnit?: string | undefined;
|
|
176
180
|
startAtText?: string | undefined;
|
|
177
181
|
endAtText?: string | undefined;
|
|
178
|
-
steps?: {
|
|
179
|
-
title: string;
|
|
180
|
-
description?: string | undefined;
|
|
181
|
-
}[] | undefined;
|
|
182
182
|
}, {
|
|
183
|
-
activityRef: string;
|
|
184
183
|
title: string;
|
|
184
|
+
activityRef: string;
|
|
185
185
|
actStatus: "NOT_START" | "INIT" | "PROCESSING" | "FINISH" | "RECEIVED";
|
|
186
186
|
vouchers: {
|
|
187
|
+
merchantName: string;
|
|
187
188
|
prizeId: string;
|
|
188
189
|
voucherName: string;
|
|
189
190
|
voucherType: string;
|
|
190
191
|
reductionAmount: string;
|
|
191
192
|
thresholdAmountText: string;
|
|
192
193
|
unit: string;
|
|
193
|
-
merchantName: string;
|
|
194
194
|
merchantLogo?: string | undefined;
|
|
195
195
|
itemLogo?: string | undefined;
|
|
196
196
|
}[];
|
|
197
197
|
description?: string | undefined;
|
|
198
|
-
|
|
198
|
+
mode?: "detail" | "banner" | undefined;
|
|
199
|
+
steps?: {
|
|
200
|
+
title: string;
|
|
201
|
+
description?: string | undefined;
|
|
202
|
+
}[] | undefined;
|
|
199
203
|
coverUrl?: string | undefined;
|
|
204
|
+
mainTitle?: string | undefined;
|
|
200
205
|
backgroundUrl?: string | undefined;
|
|
201
206
|
tagLabel?: string | undefined;
|
|
202
207
|
cardLogoUrl?: string | undefined;
|
|
@@ -205,12 +210,7 @@ declare const serverModule: {
|
|
|
205
210
|
progressUnit?: string | undefined;
|
|
206
211
|
startAtText?: string | undefined;
|
|
207
212
|
endAtText?: string | undefined;
|
|
208
|
-
|
|
209
|
-
steps?: {
|
|
210
|
-
title: string;
|
|
211
|
-
description?: string | undefined;
|
|
212
|
-
}[] | undefined;
|
|
213
|
-
progressStyle?: "bar" | "steps" | undefined;
|
|
213
|
+
progressStyle?: "steps" | "bar" | undefined;
|
|
214
214
|
}>>;
|
|
215
215
|
};
|
|
216
216
|
skills: {
|
package/dist/server/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-module-alipay-activity",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "支付宝互动营销活动模块:碰出惊喜(碰一下)活动查询与展示(codegen 源)。",
|
|
6
6
|
"exports": {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tbox.cn/app-contracts": "0.
|
|
22
|
-
"@tbox.cn/app-contracts-mall": "0.
|
|
21
|
+
"@tbox.cn/app-contracts": "0.13.0",
|
|
22
|
+
"@tbox.cn/app-contracts-mall": "0.13.0",
|
|
23
23
|
"alipay-sdk": "4.14.0",
|
|
24
|
-
"@tbox.cn/app-agent-sdk-client": "0.1.
|
|
25
|
-
"@tbox.cn/app-agent-sdk-server": "0.
|
|
24
|
+
"@tbox.cn/app-agent-sdk-client": "0.1.6",
|
|
25
|
+
"@tbox.cn/app-agent-sdk-server": "0.2.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"zod": "3.25.76",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"tsup.config.ts",
|
|
51
51
|
"README.md",
|
|
52
52
|
"LICENSE",
|
|
53
|
-
"AGENTS.md"
|
|
53
|
+
"AGENTS.md",
|
|
54
|
+
"INTEGRATION.md"
|
|
54
55
|
],
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": ">=20.0.0"
|
package/src/server/index.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* module-alipay-activity 服务端入口(双端自注册闭环——见模块 AGENTS.md 与 INTEGRATION.md)。
|
|
3
|
+
* 职责:碰一下活动查询工具/横幅卡(配置面直读 config/bumpin.json,零服务槽)+ 活动路由
|
|
4
|
+
* 策略承接点(activity-router——是否承接由 scope 绑定的 provider 注册决定,未启用放行)。
|
|
5
|
+
* 入口约定:register 只注册不解析;配置缺失时工具静默降级(supported:false)。
|
|
6
|
+
*/
|
|
1
7
|
import type { ServerContext, ServerModule, PreToolDef } from '@tbox.cn/app-agent-sdk-server';
|
|
2
8
|
import { definePreTool, loadModuleSkills } from '@tbox.cn/app-agent-sdk-server';
|
|
3
9
|
import bumpInActivityMeta from './cards/bumpin-activity/meta';
|
package/src/server/tools.ts
CHANGED
|
@@ -152,7 +152,7 @@ export function createBumpInTools(getCtx: () => ServerContext) {
|
|
|
152
152
|
const cardData = toBumpInCardData(detail as PromotionActivityDetail, 'detail');
|
|
153
153
|
return {
|
|
154
154
|
...cardData,
|
|
155
|
-
// note
|
|
155
|
+
// note 契约:标题 + 进度要点(cardData.totalProgress/currentProgress 由 guide 解析)
|
|
156
156
|
cards: [
|
|
157
157
|
{
|
|
158
158
|
cardType: 'promotion-bumpin-activity',
|
|
@@ -204,7 +204,7 @@ export function createBumpInTools(getCtx: () => ServerContext) {
|
|
|
204
204
|
},
|
|
205
205
|
});
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
//(2026-09-01):出卡工具创建点单点 wrap——参与动作在卡上,getBumpInActivity 带 actions 句
|
|
208
208
|
return {
|
|
209
209
|
getBumpInActivity: withCardEmissionHint(getBumpInActivity, { actions: true }),
|
|
210
210
|
getBumpInActivityBanner: withCardEmissionHint(getBumpInActivityBanner),
|