@yagolive/event-kit 1.0.8 → 1.0.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # Changelog
2
2
 
3
+ ## @1.0.10 (2026-07-02)
4
+
5
+ ### 新增
6
+
7
+ - **VerifyTradePassword Action(验证交易密码)**: 新增验证交易密码动作类型
8
+ - `ActionType.VERIFY_TRADE_PASSWORD` = `'verify_trade_password'`
9
+ - `VerifyTradePassword` 数据类:仅含 `text` 可选字段(继承自 `Base`)
10
+ - `ActionCreator.buildVerifyTradePassword()`、`createVerifyTradePasswordAction()`、`createVerifyTradePasswordActionWithData()`
11
+ - `ActionBridge.verifyTradePassword()`、`buildVerifyTradePassword()`、`createVerifyTradePasswordAction()`、`createVerifyTradePasswordActionWithData()`
12
+
13
+ ### Action 类型完整列表
14
+
15
+ | 类型 | 字段 | 说明 |
16
+ |------|------|------|
17
+ | jump | path: string, text?: string | 页面跳转 |
18
+ | navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
19
+ | replace | screen: string, params?: Record, text?: string | 替换当前页面 |
20
+ | goback | text?: string | 返回上一页 |
21
+ | enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
22
+ | live_detect | text?: string | 活体检测 |
23
+ | onelink | url: string, share?: boolean, text?: string | 分享链接 |
24
+ | ask | id: number, title?: string, message?: string, accepted?: boolean, text?: string | 通用询问(邀请、审核) |
25
+ | agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
26
+ | recharge | text?: string | 充值操作 |
27
+ | close | text?: string | 关闭 WebView 窗口(addon 附加) |
28
+ | config | theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string, text?: string | 配置 WebView 主题(addon 附加) |
29
+ | track | name: string, params?: Record, options?: Record, text?: string | 统计事件上报 |
30
+ | grant_benefits | benefits: any[], title?: string, message?: string, okAction?: Action, closeable?: boolean, duration?: number, theme?: { image, tintColor, buttonImage?, topInset? }, text?: string | 权益下发 |
31
+ | verify_trade_password | text?: string | 验证交易密码 |
32
+
33
+ ---
34
+
35
+ ## @1.0.9 (2026-06-24)
36
+
37
+ ### 新增
38
+
39
+ - **Ask Action(通用询问)**: 新增通用询问动作类型,用于触发邀请、审核等需要用户确认/拒绝的场景
40
+ - `ActionType.ASK` = `'ask'`
41
+ - `Ask` 数据类:必填字段 `id`(number,询问 ID);可选字段 `title`(string,询问标题)、`message`(string,询问内容)、`accepted`(boolean,当前回复状态)、`text`
42
+ - `ActionCreator.buildAsk(id)`、`createAskAction(id)`、`createAskActionWithData(ask)`
43
+ - `ActionBridge.ask(id, options?)`、`buildAsk(id)`、`createAskAction(id)`、`createAskActionWithData(ask)`
44
+ - `bridge.ask(id, options)` 便捷方法支持传入 `{ title?, message?, accepted?, text? }`
45
+ - **语义**:app 侧消费时遵循以下规则——`title` 或 `message` 任一非空时弹出 `ConfirmDialog` 让用户选择;均为空则进入静默模式(如系统消息卡片中直接展示 Accept/Reject 按钮)
46
+
47
+ ### Action 类型完整列表
48
+
49
+ | 类型 | 字段 | 说明 |
50
+ |------|------|------|
51
+ | jump | path: string, text?: string | 页面跳转 |
52
+ | navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
53
+ | replace | screen: string, params?: Record, text?: string | 替换当前页面 |
54
+ | goback | text?: string | 返回上一页 |
55
+ | enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
56
+ | live_detect | text?: string | 活体检测 |
57
+ | onelink | url: string, share?: boolean, text?: string | 分享链接 |
58
+ | ask | id: number, title?: string, message?: string, accepted?: boolean, text?: string | 通用询问(邀请、审核) |
59
+ | agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
60
+ | recharge | text?: string | 充值操作 |
61
+ | close | text?: string | 关闭 WebView 窗口(addon 附加) |
62
+ | config | theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string, text?: string | 配置 WebView 主题(addon 附加) |
63
+ | track | name: string, params?: Record, options?: Record, text?: string | 统计事件上报 |
64
+ | grant_benefits | benefits: any[], title?: string, message?: string, okAction?: Action, closeable?: boolean, duration?: number, theme?: { image, tintColor, buttonImage?, topInset? }, text?: string | 权益下发 |
65
+
66
+ ---
67
+
3
68
  ## @1.0.8 (2026-06-17)
4
69
 
5
70
  ### 新增
package/README.md CHANGED
@@ -169,8 +169,8 @@ import { ActionCreator } from '@yagolive/event-kit';
169
169
 
170
170
  | 属性 | 类型 | 说明 |
171
171
  |------|------|------|
172
- | `ActionData` | Object | 包含所有数据类型类:Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits |
173
- | `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, GOBACK, ENTER_ROOM, LIVE_DETECT, ONELINK, AGENCY_INVITE, RECHARGE, CLOSE, CONFIG, TRACK, GRANT_BENEFITS |
172
+ | `ActionData` | Object | 包含所有数据类型类:Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, Ask, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits, VerifyTradePassword |
173
+ | `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, GOBACK, ENTER_ROOM, LIVE_DETECT, ONELINK, ASK, AGENCY_INVITE, RECHARGE, CLOSE, CONFIG, TRACK, GRANT_BENEFITS, VERIFY_TRADE_PASSWORD |
174
174
 
175
175
  #### 工厂方法
176
176
 
@@ -199,6 +199,9 @@ import { ActionCreator } from '@yagolive/event-kit';
199
199
  | `buildOnelink(url?)` | url?: string | Onelink | 构建 Onelink 对象(链式配置) |
200
200
  | `createOnelinkAction(url)` | url: string | Action | 创建 Onelink Action |
201
201
  | `createOnelinkActionWithData(onelink)` | onelink: Onelink | Action | 从 Onelink 对象创建 Action |
202
+ | `buildAsk(id)` | id: number | Ask | 构建 Ask 对象(链式配置) |
203
+ | `createAskAction(id)` | id: number | Action | 创建通用询问 Action |
204
+ | `createAskActionWithData(ask)` | ask: Ask | Action | 从 Ask 对象创建 Action |
202
205
  | `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
203
206
  | `createAgencyInviteAction(id, type)` | id: number, type: string | Action | 创建工会邀请 Action |
204
207
  | `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action |
@@ -217,6 +220,9 @@ import { ActionCreator } from '@yagolive/event-kit';
217
220
  | `buildGrantBenefits(benefits)` | benefits: any[] | GrantBenefits | 构建 GrantBenefits 对象(链式配置) |
218
221
  | `createGrantBenefitsAction(benefits)` | benefits: any[] | Action | 创建权益下发 Action |
219
222
  | `createGrantBenefitsActionWithData(grantBenefits)` | grantBenefits: GrantBenefits | Action | 从 GrantBenefits 对象创建 Action |
223
+ | `buildVerifyTradePassword()` | - | VerifyTradePassword | 构建 VerifyTradePassword 对象(链式配置) |
224
+ | `createVerifyTradePasswordAction()` | - | Action | 创建验证交易密码 Action |
225
+ | `createVerifyTradePasswordActionWithData(verifyTradePassword)` | verifyTradePassword: VerifyTradePassword | Action | 从 VerifyTradePassword 对象创建 Action |
220
226
 
221
227
  #### 使用示例
222
228
 
@@ -257,12 +263,14 @@ ActionType.GOBACK // 'goback'
257
263
  ActionType.ENTER_ROOM // 'enter_room'
258
264
  ActionType.LIVE_DETECT // 'live_detect'
259
265
  ActionType.ONELINK // 'onelink'
266
+ ActionType.ASK // 'ask'
260
267
  ActionType.AGENCY_INVITE // 'agency_invite'
261
268
  ActionType.RECHARGE // 'recharge'
262
269
  ActionType.CLOSE // 'close' (addon)
263
270
  ActionType.CONFIG // 'config' (addon)
264
271
  ActionType.TRACK // 'track'
265
272
  ActionType.GRANT_BENEFITS // 'grant_benefits'
273
+ ActionType.VERIFY_TRADE_PASSWORD // 'verify_trade_password'
266
274
  ```
267
275
 
268
276
  ### ActionBridge
@@ -330,6 +338,9 @@ new ActionBridge(adapter, options?)
330
338
  | `onelink(url)` | url: string | Promise | 打开 Onelink |
331
339
  | `buildOnelink(url?)` | url?: string | Onelink | 构建 Onelink 对象(链式配置) |
332
340
  | `createOnelinkActionWithData(onelink)` | onelink: Onelink | Action | 从 Onelink 对象创建 Action(不自动发送) |
341
+ | `ask(id, options?)` | id: number, options?: { title?, message?, accepted?, text? } | Promise | 通用询问(邀请/审核) |
342
+ | `buildAsk(id)` | id: number | Ask | 构建 Ask 对象(链式配置) |
343
+ | `createAskActionWithData(ask)` | ask: Ask | Action | 从 Ask 对象创建 Action(不自动发送) |
333
344
  | `agencyInvite(id, type)` | id: number, type: string | Promise | 工会邀请 |
334
345
  | `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
335
346
  | `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action(不自动发送) |
@@ -348,6 +359,9 @@ new ActionBridge(adapter, options?)
348
359
  | `grantBenefits(benefits, options?)` | benefits: any[], options?: { title?, message?, okAction?, closeable?, duration?, theme?, text? } | Promise | 权益下发 |
349
360
  | `buildGrantBenefits(benefits)` | benefits: any[] | GrantBenefits | 构建 GrantBenefits 对象(链式配置) |
350
361
  | `createGrantBenefitsActionWithData(grantBenefits)` | grantBenefits: GrantBenefits | Action | 从 GrantBenefits 对象创建 Action(不自动发送) |
362
+ | `verifyTradePassword()` | - | Promise | 验证交易密码 |
363
+ | `buildVerifyTradePassword()` | - | VerifyTradePassword | 构建 VerifyTradePassword 对象(链式配置) |
364
+ | `createVerifyTradePasswordActionWithData(verifyTradePassword)` | verifyTradePassword: VerifyTradePassword | Action | 从 VerifyTradePassword 对象创建 Action(不自动发送) |
351
365
 
352
366
  #### 静态方法
353
367
 
@@ -679,6 +693,21 @@ Onelink Action 数据。
679
693
  | `setUrl(url)` | url: string (必填) | 设置链接 URL,返回 this |
680
694
  | `setShare(share)` | share: boolean | 设置是否显示分享弹窗,返回 this |
681
695
 
696
+ ### Ask
697
+
698
+ 通用询问 Action 数据,用于邀请、审核等需要用户确认/拒绝的场景。
699
+
700
+ > **App 侧消费语义**:当 `title` 或 `message` 任一非空时,app 侧弹出 `ConfirmDialog` 让用户确认;均为空则进入静默模式,由调用方(如系统消息卡片)在界面上直接展示 Accept/Reject 按钮。
701
+
702
+ | 方法 | 参数 | 说明 |
703
+ |------|------|------|
704
+ | `constructor(id)` | id: number (必填) | 创建通用询问数据 |
705
+ | `setText(text)` | text: string | 设置显示文本,返回 this |
706
+ | `setId(id)` | id: number | 设置询问 ID,返回 this |
707
+ | `setTitle(title)` | title: string | 设置询问标题,返回 this |
708
+ | `setMessage(message)` | message: string | 设置询问内容,返回 this |
709
+ | `setAccepted(accepted)` | accepted: boolean | 设置当前回复状态(true=已接受,false=已拒绝,未设置=未回复),返回 this |
710
+
682
711
  ### AgencyInvite
683
712
 
684
713
  工会邀请 Action 数据。
@@ -790,6 +819,15 @@ Onelink Action 数据。
790
819
  | `setButtonImage(buttonImage)` | buttonImage: string | 设置按钮图片,返回 this |
791
820
  | `setTopInset(topInset)` | topInset: number | 设置头部高度(默认 196),返回 this |
792
821
 
822
+ ### VerifyTradePassword
823
+
824
+ 验证交易密码 Action 数据。
825
+
826
+ | 方法 | 参数 | 说明 |
827
+ |------|------|------|
828
+ | `constructor()` | - | 创建验证交易密码数据 |
829
+ | `setText(text)` | text: string | 设置显示文本,返回 this |
830
+
793
831
  ### Action
794
832
 
795
833
  Action 对象,封装类型和数据。
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * YAGO Event Kit - Action Bridge (Full)
3
- * @version 1.0.8
3
+ * @version 1.0.10
4
4
  *
5
5
  * Generated by build script - do not edit manually.
6
6
  * Supports: Browser script tag, CommonJS, AMD
@@ -358,6 +358,63 @@ var Onelink = class {
358
358
  };
359
359
  var Onelink_default = Onelink;
360
360
 
361
+ // src/core/types/Ask.js
362
+ var Ask = class {
363
+ constructor(id) {
364
+ if (id == null) throw new Error("id cannot be null");
365
+ this.text = null;
366
+ this.id = id;
367
+ this.title = null;
368
+ this.message = null;
369
+ this.accepted = null;
370
+ }
371
+ getText() {
372
+ return this.text;
373
+ }
374
+ setText(text) {
375
+ this.text = text;
376
+ return this;
377
+ }
378
+ getId() {
379
+ return this.id;
380
+ }
381
+ setId(id) {
382
+ this.id = id;
383
+ return this;
384
+ }
385
+ getTitle() {
386
+ return this.title;
387
+ }
388
+ setTitle(title) {
389
+ this.title = title;
390
+ return this;
391
+ }
392
+ getMessage() {
393
+ return this.message;
394
+ }
395
+ setMessage(message) {
396
+ this.message = message;
397
+ return this;
398
+ }
399
+ getAccepted() {
400
+ return this.accepted;
401
+ }
402
+ setAccepted(accepted) {
403
+ this.accepted = accepted;
404
+ return this;
405
+ }
406
+ toMap() {
407
+ const map = {};
408
+ if (this.text != null) map.text = this.text;
409
+ if (this.id != null) map.id = this.id;
410
+ if (this.title != null) map.title = this.title;
411
+ if (this.message != null) map.message = this.message;
412
+ if (this.accepted != null) map.accepted = this.accepted;
413
+ return map;
414
+ }
415
+ };
416
+ var Ask_default = Ask;
417
+
361
418
  // src/core/types/AgencyInvite.js
362
419
  var AgencyInfo = class {
363
420
  constructor() {
@@ -782,6 +839,26 @@ var GrantBenefits = class {
782
839
  GrantBenefits.Theme = Theme;
783
840
  var GrantBenefits_default = GrantBenefits;
784
841
 
842
+ // src/core/types/VerifyTradePassword.js
843
+ var VerifyTradePassword = class {
844
+ constructor() {
845
+ this.text = null;
846
+ }
847
+ getText() {
848
+ return this.text;
849
+ }
850
+ setText(text) {
851
+ this.text = text;
852
+ return this;
853
+ }
854
+ toMap() {
855
+ const map = {};
856
+ if (this.text != null) map.text = this.text;
857
+ return map;
858
+ }
859
+ };
860
+ var VerifyTradePassword_default = VerifyTradePassword;
861
+
785
862
  // src/core/types/Action.js
786
863
  var Action = class {
787
864
  constructor(type, data) {
@@ -827,12 +904,14 @@ var ActionType = {
827
904
  ENTER_ROOM: "enter_room",
828
905
  LIVE_DETECT: "live_detect",
829
906
  ONELINK: "onelink",
907
+ ASK: "ask",
830
908
  AGENCY_INVITE: "agency_invite",
831
909
  RECHARGE: "recharge",
832
910
  CLOSE: "close",
833
911
  CONFIG: "config",
834
912
  TRACK: "track",
835
- GRANT_BENEFITS: "grant_benefits"
913
+ GRANT_BENEFITS: "grant_benefits",
914
+ VERIFY_TRADE_PASSWORD: "verify_trade_password"
836
915
  };
837
916
  var ActionData = {
838
917
  Jump: Jump_default,
@@ -842,12 +921,14 @@ var ActionData = {
842
921
  EnterRoom: EnterRoom_default,
843
922
  LiveDetect: LiveDetect_default,
844
923
  Onelink: Onelink_default,
924
+ Ask: Ask_default,
845
925
  AgencyInvite: AgencyInvite_default,
846
926
  Recharge: Recharge_default,
847
927
  Close: Close_default,
848
928
  Config: Config_default,
849
929
  Track: Track_default,
850
- GrantBenefits: GrantBenefits_default
930
+ GrantBenefits: GrantBenefits_default,
931
+ VerifyTradePassword: VerifyTradePassword_default
851
932
  };
852
933
  var ActionCreator = {
853
934
  ActionData,
@@ -930,6 +1011,16 @@ var ActionCreator = {
930
1011
  createOnelinkActionWithData(onelink) {
931
1012
  return new Action_default(ActionType.ONELINK, onelink);
932
1013
  },
1014
+ // Ask
1015
+ buildAsk(id) {
1016
+ return new Ask_default(id);
1017
+ },
1018
+ createAskAction(id) {
1019
+ return new Action_default(ActionType.ASK, new Ask_default(id));
1020
+ },
1021
+ createAskActionWithData(ask) {
1022
+ return new Action_default(ActionType.ASK, ask);
1023
+ },
933
1024
  // AgencyInvite
934
1025
  buildAgencyInvite(id, type) {
935
1026
  return new AgencyInvite_default(id, type);
@@ -989,6 +1080,16 @@ var ActionCreator = {
989
1080
  },
990
1081
  createGrantBenefitsActionWithData(grantBenefits) {
991
1082
  return new Action_default(ActionType.GRANT_BENEFITS, grantBenefits);
1083
+ },
1084
+ // VerifyTradePassword
1085
+ buildVerifyTradePassword() {
1086
+ return new VerifyTradePassword_default();
1087
+ },
1088
+ createVerifyTradePasswordAction() {
1089
+ return new Action_default(ActionType.VERIFY_TRADE_PASSWORD, new VerifyTradePassword_default());
1090
+ },
1091
+ createVerifyTradePasswordActionWithData(verifyTradePassword) {
1092
+ return new Action_default(ActionType.VERIFY_TRADE_PASSWORD, verifyTradePassword);
992
1093
  }
993
1094
  };
994
1095
 
@@ -1261,6 +1362,25 @@ var ActionBridge = class _ActionBridge {
1261
1362
  createOnelinkActionWithData(onelink) {
1262
1363
  return ActionCreator.createOnelinkActionWithData(onelink);
1263
1364
  }
1365
+ ask(id, options) {
1366
+ var data = ActionCreator.buildAsk(id);
1367
+ if (options) {
1368
+ if (options.title != null) data.setTitle(options.title);
1369
+ if (options.message != null) data.setMessage(options.message);
1370
+ if (options.accepted != null) data.setAccepted(options.accepted);
1371
+ if (options.text != null) data.setText(options.text);
1372
+ }
1373
+ return this._adapter.sendAction(ActionCreator.createAskActionWithData(data));
1374
+ }
1375
+ buildAsk(id) {
1376
+ return ActionCreator.buildAsk(id);
1377
+ }
1378
+ createAskAction(id) {
1379
+ return ActionCreator.createAskAction(id);
1380
+ }
1381
+ createAskActionWithData(ask) {
1382
+ return ActionCreator.createAskActionWithData(ask);
1383
+ }
1264
1384
  agencyInvite(id, type) {
1265
1385
  return this._adapter.sendAction(ActionCreator.createAgencyInviteAction(id, type));
1266
1386
  }
@@ -1353,6 +1473,18 @@ var ActionBridge = class _ActionBridge {
1353
1473
  createGrantBenefitsActionWithData(grantBenefits) {
1354
1474
  return ActionCreator.createGrantBenefitsActionWithData(grantBenefits);
1355
1475
  }
1476
+ verifyTradePassword() {
1477
+ return this._adapter.sendAction(ActionCreator.createVerifyTradePasswordAction());
1478
+ }
1479
+ buildVerifyTradePassword() {
1480
+ return ActionCreator.buildVerifyTradePassword();
1481
+ }
1482
+ createVerifyTradePasswordAction() {
1483
+ return ActionCreator.createVerifyTradePasswordAction();
1484
+ }
1485
+ createVerifyTradePasswordActionWithData(verifyTradePassword) {
1486
+ return ActionCreator.createVerifyTradePasswordActionWithData(verifyTradePassword);
1487
+ }
1356
1488
  destroy() {
1357
1489
  if (typeof this._adapter.destroy === "function") {
1358
1490
  this._adapter.destroy();
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * YAGO Event Kit - Action Creator (Core Only)
3
- * @version 1.0.8
3
+ * @version 1.0.10
4
4
  *
5
5
  * Generated by build script - do not edit manually.
6
6
  * Supports: Browser script tag, CommonJS, AMD
@@ -358,6 +358,63 @@ var Onelink = class {
358
358
  };
359
359
  var Onelink_default = Onelink;
360
360
 
361
+ // src/core/types/Ask.js
362
+ var Ask = class {
363
+ constructor(id) {
364
+ if (id == null) throw new Error("id cannot be null");
365
+ this.text = null;
366
+ this.id = id;
367
+ this.title = null;
368
+ this.message = null;
369
+ this.accepted = null;
370
+ }
371
+ getText() {
372
+ return this.text;
373
+ }
374
+ setText(text) {
375
+ this.text = text;
376
+ return this;
377
+ }
378
+ getId() {
379
+ return this.id;
380
+ }
381
+ setId(id) {
382
+ this.id = id;
383
+ return this;
384
+ }
385
+ getTitle() {
386
+ return this.title;
387
+ }
388
+ setTitle(title) {
389
+ this.title = title;
390
+ return this;
391
+ }
392
+ getMessage() {
393
+ return this.message;
394
+ }
395
+ setMessage(message) {
396
+ this.message = message;
397
+ return this;
398
+ }
399
+ getAccepted() {
400
+ return this.accepted;
401
+ }
402
+ setAccepted(accepted) {
403
+ this.accepted = accepted;
404
+ return this;
405
+ }
406
+ toMap() {
407
+ const map = {};
408
+ if (this.text != null) map.text = this.text;
409
+ if (this.id != null) map.id = this.id;
410
+ if (this.title != null) map.title = this.title;
411
+ if (this.message != null) map.message = this.message;
412
+ if (this.accepted != null) map.accepted = this.accepted;
413
+ return map;
414
+ }
415
+ };
416
+ var Ask_default = Ask;
417
+
361
418
  // src/core/types/AgencyInvite.js
362
419
  var AgencyInfo = class {
363
420
  constructor() {
@@ -782,6 +839,26 @@ var GrantBenefits = class {
782
839
  GrantBenefits.Theme = Theme;
783
840
  var GrantBenefits_default = GrantBenefits;
784
841
 
842
+ // src/core/types/VerifyTradePassword.js
843
+ var VerifyTradePassword = class {
844
+ constructor() {
845
+ this.text = null;
846
+ }
847
+ getText() {
848
+ return this.text;
849
+ }
850
+ setText(text) {
851
+ this.text = text;
852
+ return this;
853
+ }
854
+ toMap() {
855
+ const map = {};
856
+ if (this.text != null) map.text = this.text;
857
+ return map;
858
+ }
859
+ };
860
+ var VerifyTradePassword_default = VerifyTradePassword;
861
+
785
862
  // src/core/types/Action.js
786
863
  var Action = class {
787
864
  constructor(type, data) {
@@ -827,12 +904,14 @@ var ActionType = {
827
904
  ENTER_ROOM: "enter_room",
828
905
  LIVE_DETECT: "live_detect",
829
906
  ONELINK: "onelink",
907
+ ASK: "ask",
830
908
  AGENCY_INVITE: "agency_invite",
831
909
  RECHARGE: "recharge",
832
910
  CLOSE: "close",
833
911
  CONFIG: "config",
834
912
  TRACK: "track",
835
- GRANT_BENEFITS: "grant_benefits"
913
+ GRANT_BENEFITS: "grant_benefits",
914
+ VERIFY_TRADE_PASSWORD: "verify_trade_password"
836
915
  };
837
916
  var ActionData = {
838
917
  Jump: Jump_default,
@@ -842,12 +921,14 @@ var ActionData = {
842
921
  EnterRoom: EnterRoom_default,
843
922
  LiveDetect: LiveDetect_default,
844
923
  Onelink: Onelink_default,
924
+ Ask: Ask_default,
845
925
  AgencyInvite: AgencyInvite_default,
846
926
  Recharge: Recharge_default,
847
927
  Close: Close_default,
848
928
  Config: Config_default,
849
929
  Track: Track_default,
850
- GrantBenefits: GrantBenefits_default
930
+ GrantBenefits: GrantBenefits_default,
931
+ VerifyTradePassword: VerifyTradePassword_default
851
932
  };
852
933
  var ActionCreator = {
853
934
  ActionData,
@@ -930,6 +1011,16 @@ var ActionCreator = {
930
1011
  createOnelinkActionWithData(onelink) {
931
1012
  return new Action_default(ActionType.ONELINK, onelink);
932
1013
  },
1014
+ // Ask
1015
+ buildAsk(id) {
1016
+ return new Ask_default(id);
1017
+ },
1018
+ createAskAction(id) {
1019
+ return new Action_default(ActionType.ASK, new Ask_default(id));
1020
+ },
1021
+ createAskActionWithData(ask) {
1022
+ return new Action_default(ActionType.ASK, ask);
1023
+ },
933
1024
  // AgencyInvite
934
1025
  buildAgencyInvite(id, type) {
935
1026
  return new AgencyInvite_default(id, type);
@@ -989,6 +1080,16 @@ var ActionCreator = {
989
1080
  },
990
1081
  createGrantBenefitsActionWithData(grantBenefits) {
991
1082
  return new Action_default(ActionType.GRANT_BENEFITS, grantBenefits);
1083
+ },
1084
+ // VerifyTradePassword
1085
+ buildVerifyTradePassword() {
1086
+ return new VerifyTradePassword_default();
1087
+ },
1088
+ createVerifyTradePasswordAction() {
1089
+ return new Action_default(ActionType.VERIFY_TRADE_PASSWORD, new VerifyTradePassword_default());
1090
+ },
1091
+ createVerifyTradePasswordActionWithData(verifyTradePassword) {
1092
+ return new Action_default(ActionType.VERIFY_TRADE_PASSWORD, verifyTradePassword);
992
1093
  }
993
1094
  };
994
1095
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagolive/event-kit",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "YAGO Event Kit - 跨环境 Action 创建与通信工具库,支持浏览器、React、Vue",
5
5
  "main": "src/index.js",
6
6
  "browser": "dist/js/action_bridge.umd.js",
@@ -10,6 +10,13 @@
10
10
  "dist/",
11
11
  "CHANGELOG.md"
12
12
  ],
13
+ "scripts": {
14
+ "dev": "node scripts/build.js --watch && npx serve .",
15
+ "build": "node scripts/build.js",
16
+ "build:core": "node scripts/build.js --core",
17
+ "build:bridge": "node scripts/build.js --bridge",
18
+ "build:watch": "node scripts/build.js --watch"
19
+ },
13
20
  "exports": {
14
21
  ".": {
15
22
  "types": "./src/index.d.ts",
@@ -71,13 +78,6 @@
71
78
  "optional": true
72
79
  }
73
80
  },
74
- "scripts": {
75
- "dev": "node scripts/build.js --watch && npx serve .",
76
- "build": "node scripts/build.js",
77
- "build:core": "node scripts/build.js --core",
78
- "build:bridge": "node scripts/build.js --bridge",
79
- "build:watch": "node scripts/build.js --watch"
80
- },
81
81
  "devDependencies": {
82
82
  "esbuild": "^0.25.0"
83
83
  },
@@ -157,6 +157,27 @@ export default class ActionBridge {
157
157
  return ActionCreator.createOnelinkActionWithData(onelink);
158
158
  }
159
159
 
160
+ ask(id, options) {
161
+ var data = ActionCreator.buildAsk(id);
162
+ if (options) {
163
+ if (options.title != null) data.setTitle(options.title);
164
+ if (options.message != null) data.setMessage(options.message);
165
+ if (options.accepted != null) data.setAccepted(options.accepted);
166
+ if (options.text != null) data.setText(options.text);
167
+ }
168
+ return this._adapter.sendAction(ActionCreator.createAskActionWithData(data));
169
+ }
170
+
171
+ buildAsk(id) {
172
+ return ActionCreator.buildAsk(id);
173
+ }
174
+ createAskAction(id) {
175
+ return ActionCreator.createAskAction(id);
176
+ }
177
+ createAskActionWithData(ask) {
178
+ return ActionCreator.createAskActionWithData(ask);
179
+ }
180
+
160
181
  agencyInvite(id, type) {
161
182
  return this._adapter.sendAction(ActionCreator.createAgencyInviteAction(id, type));
162
183
  }
@@ -261,6 +282,20 @@ export default class ActionBridge {
261
282
  return ActionCreator.createGrantBenefitsActionWithData(grantBenefits);
262
283
  }
263
284
 
285
+ verifyTradePassword() {
286
+ return this._adapter.sendAction(ActionCreator.createVerifyTradePasswordAction());
287
+ }
288
+
289
+ buildVerifyTradePassword() {
290
+ return ActionCreator.buildVerifyTradePassword();
291
+ }
292
+ createVerifyTradePasswordAction() {
293
+ return ActionCreator.createVerifyTradePasswordAction();
294
+ }
295
+ createVerifyTradePasswordActionWithData(verifyTradePassword) {
296
+ return ActionCreator.createVerifyTradePasswordActionWithData(verifyTradePassword);
297
+ }
298
+
264
299
  destroy() {
265
300
  if (typeof this._adapter.destroy === 'function') {
266
301
  this._adapter.destroy();
@@ -1,5 +1,5 @@
1
1
  import {
2
- Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits,
2
+ Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, Ask, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits, VerifyTradePassword,
3
3
  ActionType, ActionData, ActionCreator,
4
4
  } from '../core/index.js';
5
5
  import { IActionAdapter, RNWebViewAdapter, MockAdapter, AdapterOptions, SendActionOption } from '../adapters/index.js';
@@ -52,6 +52,11 @@ export declare class ActionBridge {
52
52
  createOnelinkAction(url: string): Action;
53
53
  createOnelinkActionWithData(onelink: Onelink): Action;
54
54
 
55
+ ask(id: number, options?: { title?: string; message?: string; accepted?: boolean; text?: string }): Promise<any>;
56
+ buildAsk(id: number): Ask;
57
+ createAskAction(id: number): Action;
58
+ createAskActionWithData(ask: Ask): Action;
59
+
55
60
  agencyInvite(id: number, type: string): Promise<any>;
56
61
  buildAgencyInvite(id: number, type: string): AgencyInvite;
57
62
  createAgencyInviteAction(id: number, type: string): Action;
@@ -82,6 +87,11 @@ export declare class ActionBridge {
82
87
  createGrantBenefitsAction(benefits: any[]): Action;
83
88
  createGrantBenefitsActionWithData(grantBenefits: GrantBenefits): Action;
84
89
 
90
+ verifyTradePassword(): Promise<any>;
91
+ buildVerifyTradePassword(): VerifyTradePassword;
92
+ createVerifyTradePasswordAction(): Action;
93
+ createVerifyTradePasswordActionWithData(verifyTradePassword: VerifyTradePassword): Action;
94
+
85
95
  destroy(): void;
86
96
 
87
97
  static ActionCreator: typeof ActionCreator;
@@ -5,12 +5,14 @@ import EnterRoom from './types/EnterRoom.js';
5
5
  import Goback from './types/Goback.js';
6
6
  import LiveDetect from './types/LiveDetect.js';
7
7
  import Onelink from './types/Onelink.js';
8
+ import Ask from './types/Ask.js';
8
9
  import AgencyInvite from './types/AgencyInvite.js';
9
10
  import Recharge from './types/Recharge.js';
10
11
  import Close from './types/Close.js';
11
12
  import Config from './types/Config.js';
12
13
  import Track from './types/Track.js';
13
14
  import GrantBenefits from './types/GrantBenefits.js';
15
+ import VerifyTradePassword from './types/VerifyTradePassword.js';
14
16
  import Action from './types/Action.js';
15
17
 
16
18
  const ActionType = {
@@ -21,12 +23,14 @@ const ActionType = {
21
23
  ENTER_ROOM: 'enter_room',
22
24
  LIVE_DETECT: 'live_detect',
23
25
  ONELINK: 'onelink',
26
+ ASK: 'ask',
24
27
  AGENCY_INVITE: 'agency_invite',
25
28
  RECHARGE: 'recharge',
26
29
  CLOSE: 'close',
27
30
  CONFIG: 'config',
28
31
  TRACK: 'track',
29
32
  GRANT_BENEFITS: 'grant_benefits',
33
+ VERIFY_TRADE_PASSWORD: 'verify_trade_password',
30
34
  };
31
35
 
32
36
  const ActionData = {
@@ -37,12 +41,14 @@ const ActionData = {
37
41
  EnterRoom,
38
42
  LiveDetect,
39
43
  Onelink,
44
+ Ask,
40
45
  AgencyInvite,
41
46
  Recharge,
42
47
  Close,
43
48
  Config,
44
49
  Track,
45
50
  GrantBenefits,
51
+ VerifyTradePassword,
46
52
  };
47
53
 
48
54
  const ActionCreator = {
@@ -150,6 +156,19 @@ const ActionCreator = {
150
156
  return new Action(ActionType.ONELINK, onelink);
151
157
  },
152
158
 
159
+ // Ask
160
+ buildAsk(id) {
161
+ return new Ask(id);
162
+ },
163
+
164
+ createAskAction(id) {
165
+ return new Action(ActionType.ASK, new Ask(id));
166
+ },
167
+
168
+ createAskActionWithData(ask) {
169
+ return new Action(ActionType.ASK, ask);
170
+ },
171
+
153
172
  // AgencyInvite
154
173
  buildAgencyInvite(id, type) {
155
174
  return new AgencyInvite(id, type);
@@ -227,6 +246,19 @@ const ActionCreator = {
227
246
  createGrantBenefitsActionWithData(grantBenefits) {
228
247
  return new Action(ActionType.GRANT_BENEFITS, grantBenefits);
229
248
  },
249
+
250
+ // VerifyTradePassword
251
+ buildVerifyTradePassword() {
252
+ return new VerifyTradePassword();
253
+ },
254
+
255
+ createVerifyTradePasswordAction() {
256
+ return new Action(ActionType.VERIFY_TRADE_PASSWORD, new VerifyTradePassword());
257
+ },
258
+
259
+ createVerifyTradePasswordActionWithData(verifyTradePassword) {
260
+ return new Action(ActionType.VERIFY_TRADE_PASSWORD, verifyTradePassword);
261
+ },
230
262
  };
231
263
 
232
264
  export { ActionCreator, ActionData, ActionType };
@@ -131,6 +131,26 @@ export class Onelink {
131
131
  toMap(): Record<string, any>;
132
132
  }
133
133
 
134
+ export class Ask {
135
+ constructor(id: number);
136
+ text: string | null;
137
+ id: number;
138
+ title: string | null;
139
+ message: string | null;
140
+ accepted: boolean | null;
141
+ getText(): string | null;
142
+ setText(text: string): this;
143
+ getId(): number;
144
+ setId(id: number): this;
145
+ getTitle(): string | null;
146
+ setTitle(title: string): this;
147
+ getMessage(): string | null;
148
+ setMessage(message: string): this;
149
+ getAccepted(): boolean | null;
150
+ setAccepted(accepted: boolean): this;
151
+ toMap(): Record<string, any>;
152
+ }
153
+
134
154
  export class AgencyInfo {
135
155
  id: string | null;
136
156
  name: string | null;
@@ -289,6 +309,14 @@ export class GrantBenefits {
289
309
  toMap(): Record<string, any>;
290
310
  }
291
311
 
312
+ export class VerifyTradePassword {
313
+ constructor();
314
+ text: string | null;
315
+ getText(): string | null;
316
+ setText(text: string): this;
317
+ toMap(): Record<string, any>;
318
+ }
319
+
292
320
  export class Action {
293
321
  constructor(type: ActionTypeValue, data: any);
294
322
  type: ActionTypeValue;
@@ -302,7 +330,7 @@ export class Action {
302
330
  toJson(): string;
303
331
  }
304
332
 
305
- export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite' | 'recharge' | 'close' | 'config' | 'track' | 'grant_benefits';
333
+ export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'ask' | 'agency_invite' | 'recharge' | 'close' | 'config' | 'track' | 'grant_benefits' | 'verify_trade_password';
306
334
 
307
335
  export const ActionType: {
308
336
  JUMP: 'jump';
@@ -312,12 +340,14 @@ export const ActionType: {
312
340
  ENTER_ROOM: 'enter_room';
313
341
  LIVE_DETECT: 'live_detect';
314
342
  ONELINK: 'onelink';
343
+ ASK: 'ask';
315
344
  AGENCY_INVITE: 'agency_invite';
316
345
  RECHARGE: 'recharge';
317
346
  CLOSE: 'close';
318
347
  CONFIG: 'config';
319
348
  TRACK: 'track';
320
349
  GRANT_BENEFITS: 'grant_benefits';
350
+ VERIFY_TRADE_PASSWORD: 'verify_trade_password';
321
351
  };
322
352
 
323
353
  export const ActionData: {
@@ -328,12 +358,14 @@ export const ActionData: {
328
358
  EnterRoom: typeof EnterRoom;
329
359
  LiveDetect: typeof LiveDetect;
330
360
  Onelink: typeof Onelink;
361
+ Ask: typeof Ask;
331
362
  AgencyInvite: typeof AgencyInvite;
332
363
  Recharge: typeof Recharge;
333
364
  Close: typeof Close;
334
365
  Config: typeof Config;
335
366
  Track: typeof Track;
336
367
  GrantBenefits: typeof GrantBenefits;
368
+ VerifyTradePassword: typeof VerifyTradePassword;
337
369
  };
338
370
 
339
371
  export const ActionCreator: {
@@ -362,6 +394,9 @@ export const ActionCreator: {
362
394
  buildOnelink(url: string): Onelink;
363
395
  createOnelinkAction(url: string): Action;
364
396
  createOnelinkActionWithData(onelink: Onelink): Action;
397
+ buildAsk(id: number): Ask;
398
+ createAskAction(id: number): Action;
399
+ createAskActionWithData(ask: Ask): Action;
365
400
  buildAgencyInvite(id: number, type: string): AgencyInvite;
366
401
  createAgencyInviteAction(id: number, type: string): Action;
367
402
  createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
@@ -380,4 +415,7 @@ export const ActionCreator: {
380
415
  buildGrantBenefits(benefits: any[]): GrantBenefits;
381
416
  createGrantBenefitsAction(benefits: any[]): Action;
382
417
  createGrantBenefitsActionWithData(grantBenefits: GrantBenefits): Action;
418
+ buildVerifyTradePassword(): VerifyTradePassword;
419
+ createVerifyTradePasswordAction(): Action;
420
+ createVerifyTradePasswordActionWithData(verifyTradePassword: VerifyTradePassword): Action;
383
421
  };
package/src/core/index.js CHANGED
@@ -6,10 +6,12 @@ export { default as Goback } from './types/Goback.js';
6
6
  export { default as EnterRoom } from './types/EnterRoom.js';
7
7
  export { default as LiveDetect } from './types/LiveDetect.js';
8
8
  export { default as Onelink } from './types/Onelink.js';
9
+ export { default as Ask } from './types/Ask.js';
9
10
  export { default as AgencyInvite } from './types/AgencyInvite.js';
10
11
  export { default as Recharge } from './types/Recharge.js';
11
12
  export { default as Close } from './types/Close.js';
12
13
  export { default as Config } from './types/Config.js';
13
14
  export { default as Track } from './types/Track.js';
14
15
  export { default as GrantBenefits } from './types/GrantBenefits.js';
16
+ export { default as VerifyTradePassword } from './types/VerifyTradePassword.js';
15
17
  export { default as Action } from './types/Action.js';
@@ -0,0 +1,28 @@
1
+ class Ask {
2
+ constructor(id) {
3
+ if (id == null) throw new Error('id cannot be null');
4
+ this.text = null;
5
+ this.id = id;
6
+ this.title = null;
7
+ this.message = null;
8
+ this.accepted = null;
9
+ }
10
+
11
+ getText() { return this.text; } setText(text) { this.text = text; return this; }
12
+ getId() { return this.id; } setId(id) { this.id = id; return this; }
13
+ getTitle() { return this.title; } setTitle(title) { this.title = title; return this; }
14
+ getMessage() { return this.message; } setMessage(message) { this.message = message; return this; }
15
+ getAccepted() { return this.accepted; } setAccepted(accepted) { this.accepted = accepted; return this; }
16
+
17
+ toMap() {
18
+ const map = {};
19
+ if (this.text != null) map.text = this.text;
20
+ if (this.id != null) map.id = this.id;
21
+ if (this.title != null) map.title = this.title;
22
+ if (this.message != null) map.message = this.message;
23
+ if (this.accepted != null) map.accepted = this.accepted;
24
+ return map;
25
+ }
26
+ }
27
+
28
+ export default Ask;
@@ -0,0 +1,16 @@
1
+ class VerifyTradePassword {
2
+ constructor() {
3
+ this.text = null;
4
+ }
5
+
6
+ getText() { return this.text; }
7
+ setText(text) { this.text = text; return this; }
8
+
9
+ toMap() {
10
+ const map = {};
11
+ if (this.text != null) map.text = this.text;
12
+ return map;
13
+ }
14
+ }
15
+
16
+ export default VerifyTradePassword;
package/src/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { ActionBridge } from './bridge/index.js';
2
- export { ActionCreator, ActionData, ActionType, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits, Action } from './core/index.js';
2
+ export { ActionCreator, ActionData, ActionType, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, Ask, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits, VerifyTradePassword, Action } from './core/index.js';
3
3
  export { RNWebViewAdapter, MockAdapter, IActionAdapter, MockCall } from './adapters/index.js';
4
4
  export { ActionBridgeProvider, useActionBridge } from './integrations/react/index.js';
package/src/index.js CHANGED
@@ -8,10 +8,12 @@ export { Goback } from './core/index.js';
8
8
  export { EnterRoom } from './core/index.js';
9
9
  export { LiveDetect } from './core/index.js';
10
10
  export { Onelink } from './core/index.js';
11
+ export { Ask } from './core/index.js';
11
12
  export { AgencyInvite } from './core/index.js';
12
13
  export { Recharge } from './core/index.js';
13
14
  export { Close } from './core/index.js';
14
15
  export { Config } from './core/index.js';
15
16
  export { Track } from './core/index.js';
16
17
  export { GrantBenefits } from './core/index.js';
18
+ export { VerifyTradePassword } from './core/index.js';
17
19
  export { Action } from './core/index.js';