@yagolive/event-kit 1.0.0 → 1.0.2

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,48 @@
1
1
  # Changelog
2
2
 
3
+ ## @1.0.2 (2026-05-26)
4
+
5
+ ### 新增
6
+
7
+ - **AgencyInvite Action**: 新增工会邀请动作类型
8
+ - `ActionType.AGENCY_INVITE` = `'agency_invite'`
9
+ - `AgencyInvite` 数据类:必填字段 `id`(number)、`type`('to_be_member' | 'to_be_subagency');可选字段 `title`、`message`、`agencyInfo`(嵌套对象)、`accepted`(boolean)、`text`
10
+ - `AgencyInvite.AgencyInfo` 内部类:`id`、`name`、`ownerId`、`ownerName`
11
+ - `AgencyInvite.AgencyInviteType` 枚举:`TO_BE_MEMBER`、`TO_BE_SUBAGENCY`
12
+ - `ActionCreator.buildAgencyInvite(id, type)`、`createAgencyInviteAction(id, type)`、`createAgencyInviteActionWithData(agencyInvite)`
13
+ - `ActionBridge.agencyInvite(id, type)`、`buildAgencyInvite(id, type)`、`createAgencyInviteAction(id, type)`、`createAgencyInviteActionWithData(agencyInvite)`
14
+
15
+ ### Action 类型完整列表
16
+
17
+ | 类型 | 字段 | 说明 |
18
+ |------|------|------|
19
+ | jump | path: string, text?: string | 页面跳转 |
20
+ | navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
21
+ | replace | screen: string, params?: Record, text?: string | 替换当前页面 |
22
+ | goback | text?: string | 返回上一页 |
23
+ | enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
24
+ | live_detect | text?: string | 活体检测 |
25
+ | onelink | url: string, share?: boolean, text?: string | 分享链接 |
26
+ | agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
27
+
28
+ ---
29
+
30
+ ## @1.0.1 (2026-05-22)
31
+
32
+ ### 新增
33
+
34
+ - **Goback Action**: 新增返回上一页动作类型
35
+ - `ActionType.GOBACK` = `'goback'`
36
+ - `Goback` 数据类:仅含 `text` 可选字段
37
+ - `ActionCreator.buildGoback()`、`createGobackAction()`、`createGobackActionWithData()`
38
+ - `ActionBridge.goback()`、`buildGoback()`、`createGobackAction()`、`createGobackActionWithData()`
39
+
40
+ ### 修复
41
+
42
+ - 修复 Java `ActionData.Base` 接口 `setText()` 返回类型从 `void` 改为 `Base`,解决链式调用编译错误
43
+
44
+ ---
45
+
3
46
  ## @1.0.0 (2026-05-22)
4
47
 
5
48
  ### 新增
@@ -10,7 +53,7 @@
10
53
  - Bridge 层: 统一的 ActionBridge 接口,注入适配器实现跨环境通信
11
54
  - Integrations 层: React / Vue 3 框架集成
12
55
 
13
- - **ActionCreator**:
56
+ - **ActionCreator**:
14
57
  - `ActionCreator.ActionData`: 包含 Jump、Navigate、Replace、EnterRoom、LiveDetect、Onelink 数据类型
15
58
  - `ActionCreator.ActionType`: Action 类型枚举(JUMP、NAVIGATE、REPLACE、ENTER_ROOM、LIVE_DETECT、ONELINK)
16
59
  - 工厂方法: buildJump、createJumpAction、createJumpActionWithData、buildNavigate、createNavigateAction、createNavigateActionWithParams、createNavigateActionWithData、buildReplace、createReplaceAction、createReplaceActionWithParams、createReplaceActionWithData、buildEnterRoom、createEnterRoomAction、createEnterRoomActionWithData、buildLiveDetect、createLiveDetectAction、createLiveDetectActionWithData、buildOnelink、createOnelinkAction、createOnelinkActionWithData
package/README.md CHANGED
@@ -14,7 +14,7 @@ YAGO App Action 创建与通信工具库,支持浏览器、React、Vue 等多
14
14
  │ ActionBridge (注入适配器) │
15
15
  ├─────────────────────────────────────────────────────┤
16
16
  │ 适配器层 (Adapters) │
17
- │ RNWebViewAdapter │ MockAdapter
17
+ │ RNWebViewAdapter │ MockAdapter
18
18
  ├─────────────────────────────────────────────────────┤
19
19
  │ 核心层 (Core) │
20
20
  │ ActionCreator │ ActionType │ ActionData │
@@ -165,8 +165,8 @@ import { ActionCreator } from '@yagolive/event-kit';
165
165
 
166
166
  | 属性 | 类型 | 说明 |
167
167
  |------|------|------|
168
- | `ActionData` | Object | 包含所有数据类型类:Jump, Navigate, Replace, EnterRoom, LiveDetect, Onelink |
169
- | `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, ENTER_ROOM, LIVE_DETECT, ONELINK |
168
+ | `ActionData` | Object | 包含所有数据类型类:Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite |
169
+ | `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, GOBACK, ENTER_ROOM, LIVE_DETECT, ONELINK, AGENCY_INVITE |
170
170
 
171
171
  #### 工厂方法
172
172
 
@@ -183,6 +183,9 @@ import { ActionCreator } from '@yagolive/event-kit';
183
183
  | `createReplaceAction(screen)` | screen: string | Action | 创建替换导航 Action |
184
184
  | `createReplaceActionWithParams(screen, params)` | screen: string, params: Object | Action | 创建替换导航 Action(带参数) |
185
185
  | `createReplaceActionWithData(replace)` | replace: Replace | Action | 从 Replace 对象创建 Action |
186
+ | `buildGoback()` | - | Goback | 构建 Goback 对象(链式配置) |
187
+ | `createGobackAction()` | - | Action | 创建返回上一页 Action |
188
+ | `createGobackActionWithData(goback)` | goback: Goback | Action | 从 Goback 对象创建 Action |
186
189
  | `buildEnterRoom()` | - | EnterRoom | 构建 EnterRoom 对象(链式配置) |
187
190
  | `createEnterRoomAction(id)` | id: number | Action | 创建进房 Action |
188
191
  | `createEnterRoomActionWithData(enterRoom)` | enterRoom: EnterRoom | Action | 从 EnterRoom 对象创建 Action |
@@ -192,6 +195,9 @@ import { ActionCreator } from '@yagolive/event-kit';
192
195
  | `buildOnelink(url?)` | url?: string | Onelink | 构建 Onelink 对象(链式配置) |
193
196
  | `createOnelinkAction(url)` | url: string | Action | 创建 Onelink Action |
194
197
  | `createOnelinkActionWithData(onelink)` | onelink: Onelink | Action | 从 Onelink 对象创建 Action |
198
+ | `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
199
+ | `createAgencyInviteAction(id, type)` | id: number, type: string | Action | 创建工会邀请 Action |
200
+ | `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action |
195
201
 
196
202
  #### 使用示例
197
203
 
@@ -228,9 +234,11 @@ import { ActionType } from '@yagolive/event-kit';
228
234
  ActionType.JUMP // 'jump'
229
235
  ActionType.NAVIGATE // 'navigate'
230
236
  ActionType.REPLACE // 'replace'
237
+ ActionType.GOBACK // 'goback'
231
238
  ActionType.ENTER_ROOM // 'enter_room'
232
239
  ActionType.LIVE_DETECT // 'live_detect'
233
240
  ActionType.ONELINK // 'onelink'
241
+ ActionType.AGENCY_INVITE // 'agency_invite'
234
242
  ```
235
243
 
236
244
  ### ActionBridge
@@ -285,6 +293,9 @@ new ActionBridge(adapter, options?)
285
293
  | `replace(screen, params?)` | screen: string, params?: Object | Promise | 替换当前页面 |
286
294
  | `buildReplace(screen?, params?)` | screen?: string, params?: Object | Replace | 构建 Replace 对象(链式配置) |
287
295
  | `createReplaceActionWithData(replace)` | replace: Replace | Action | 从 Replace 对象创建 Action(不自动发送) |
296
+ | `goback()` | - | Promise | 返回上一页 |
297
+ | `buildGoback()` | - | Goback | 构建 Goback 对象(链式配置) |
298
+ | `createGobackActionWithData(goback)` | goback: Goback | Action | 从 Goback 对象创建 Action(不自动发送) |
288
299
  | `enterRoom(id)` | id: number | Promise | 进入房间 |
289
300
  | `buildEnterRoom()` | - | EnterRoom | 构建 EnterRoom 对象(链式配置) |
290
301
  | `createEnterRoomAction(id)` | id: number | Action | 创建进房 Action(不自动发送) |
@@ -295,6 +306,9 @@ new ActionBridge(adapter, options?)
295
306
  | `onelink(url)` | url: string | Promise | 打开 Onelink |
296
307
  | `buildOnelink(url?)` | url?: string | Onelink | 构建 Onelink 对象(链式配置) |
297
308
  | `createOnelinkActionWithData(onelink)` | onelink: Onelink | Action | 从 Onelink 对象创建 Action(不自动发送) |
309
+ | `agencyInvite(id, type)` | id: number, type: string | Promise | 工会邀请 |
310
+ | `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
311
+ | `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action(不自动发送) |
298
312
 
299
313
  #### 静态方法
300
314
 
@@ -567,6 +581,15 @@ export default {
567
581
 
568
582
  替换导航 Action 数据,继承自 Navigate,API 相同。
569
583
 
584
+ ### Goback
585
+
586
+ 返回上一页 Action 数据。
587
+
588
+ | 方法 | 参数 | 说明 |
589
+ |------|------|------|
590
+ | `constructor()` | - | 创建返回数据 |
591
+ | `setText(text)` | text: string | 设置显示文本,返回 this |
592
+
570
593
  ### EnterRoom
571
594
 
572
595
  进房 Action 数据。
@@ -613,6 +636,37 @@ Onelink Action 数据。
613
636
  | `setUrl(url)` | url: string (必填) | 设置链接 URL,返回 this |
614
637
  | `setShare(share)` | share: boolean | 设置是否显示分享弹窗,返回 this |
615
638
 
639
+ ### AgencyInvite
640
+
641
+ 工会邀请 Action 数据。
642
+
643
+ | 方法 | 参数 | 说明 |
644
+ |------|------|------|
645
+ | `constructor(id, type)` | id: number (必填), type: string (必填) | 创建工会邀请数据 |
646
+ | `setText(text)` | text: string | 设置显示文本,返回 this |
647
+ | `setId(id)` | id: number | 设置邀请 ID,返回 this |
648
+ | `setType(type)` | type: string | 设置邀请类型('to_be_member' \| 'to_be_subagency'),返回 this |
649
+ | `setTitle(title)` | title: string | 设置邀请标题,返回 this |
650
+ | `setMessage(message)` | message: string | 设置邀请内容,返回 this |
651
+ | `setAgencyInfo(agencyInfo)` | agencyInfo: AgencyInfo | 设置工会信息,返回 this |
652
+ | `setAccepted(accepted)` | accepted: boolean | 设置邀请状态,返回 this |
653
+
654
+ **静态属性:**
655
+
656
+ | 属性 | 说明 |
657
+ |------|------|
658
+ | `AgencyInvite.AgencyInviteType` | 邀请类型枚举:TO_BE_MEMBER, TO_BE_SUBAGENCY |
659
+ | `AgencyInvite.AgencyInfo` | 工会信息内部类 |
660
+
661
+ **AgencyInfo 内部类:**
662
+
663
+ | 方法 | 参数 | 说明 |
664
+ |------|------|------|
665
+ | `setId(id)` | id: string | 设置工会 ID,返回 this |
666
+ | `setName(name)` | name: string | 设置工会名称,返回 this |
667
+ | `setOwnerId(ownerId)` | ownerId: string | 设置工会长 ID,返回 this |
668
+ | `setOwnerName(ownerName)` | ownerName: string | 设置工会长名称,返回 this |
669
+
616
670
  ### Action
617
671
 
618
672
  Action 对象,封装类型和数据。
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * YAGO Event Kit - Action Bridge (Full)
3
- * @version 1.0.0
3
+ * @version 1.0.2
4
4
  *
5
5
  * Generated by build script - do not edit manually.
6
6
  * Supports: Browser script tag, CommonJS, AMD
@@ -279,6 +279,26 @@ EnterRoom.OpenActivityCallback = OpenActivityCallback;
279
279
  EnterRoom.SwitchRoomTypeCallback = SwitchRoomTypeCallback;
280
280
  var EnterRoom_default = EnterRoom;
281
281
 
282
+ // src/core/types/Goback.js
283
+ var Goback = class {
284
+ constructor() {
285
+ this.text = null;
286
+ }
287
+ getText() {
288
+ return this.text;
289
+ }
290
+ setText(text) {
291
+ this.text = text;
292
+ return this;
293
+ }
294
+ toMap() {
295
+ const map = {};
296
+ if (this.text != null) map.text = this.text;
297
+ return map;
298
+ }
299
+ };
300
+ var Goback_default = Goback;
301
+
282
302
  // src/core/types/LiveDetect.js
283
303
  var LiveDetect = class {
284
304
  constructor() {
@@ -338,6 +358,132 @@ var Onelink = class {
338
358
  };
339
359
  var Onelink_default = Onelink;
340
360
 
361
+ // src/core/types/AgencyInvite.js
362
+ var AgencyInfo = class {
363
+ constructor() {
364
+ this.id = null;
365
+ this.name = null;
366
+ this.ownerId = null;
367
+ this.ownerName = null;
368
+ }
369
+ getId() {
370
+ return this.id;
371
+ }
372
+ setId(id) {
373
+ this.id = id;
374
+ return this;
375
+ }
376
+ getName() {
377
+ return this.name;
378
+ }
379
+ setName(name) {
380
+ this.name = name;
381
+ return this;
382
+ }
383
+ getOwnerId() {
384
+ return this.ownerId;
385
+ }
386
+ setOwnerId(ownerId) {
387
+ this.ownerId = ownerId;
388
+ return this;
389
+ }
390
+ getOwnerName() {
391
+ return this.ownerName;
392
+ }
393
+ setOwnerName(ownerName) {
394
+ this.ownerName = ownerName;
395
+ return this;
396
+ }
397
+ toMap() {
398
+ const map = {};
399
+ if (this.id != null) map.id = this.id;
400
+ if (this.name != null) map.name = this.name;
401
+ if (this.ownerId != null) map.ownerId = this.ownerId;
402
+ if (this.ownerName != null) map.ownerName = this.ownerName;
403
+ return map;
404
+ }
405
+ };
406
+ var AgencyInviteType = {
407
+ TO_BE_MEMBER: "to_be_member",
408
+ TO_BE_SUBAGENCY: "to_be_subagency"
409
+ };
410
+ var AgencyInvite = class {
411
+ constructor(id, type) {
412
+ if (id == null) throw new Error("id cannot be null");
413
+ if (type == null) throw new Error("type cannot be null");
414
+ this.text = null;
415
+ this.id = id;
416
+ this.type = type;
417
+ this.title = null;
418
+ this.message = null;
419
+ this.agencyInfo = null;
420
+ this.accepted = null;
421
+ }
422
+ getText() {
423
+ return this.text;
424
+ }
425
+ setText(text) {
426
+ this.text = text;
427
+ return this;
428
+ }
429
+ getId() {
430
+ return this.id;
431
+ }
432
+ setId(id) {
433
+ this.id = id;
434
+ return this;
435
+ }
436
+ getType() {
437
+ return this.type;
438
+ }
439
+ setType(type) {
440
+ this.type = type;
441
+ return this;
442
+ }
443
+ getTitle() {
444
+ return this.title;
445
+ }
446
+ setTitle(title) {
447
+ this.title = title;
448
+ return this;
449
+ }
450
+ getMessage() {
451
+ return this.message;
452
+ }
453
+ setMessage(message) {
454
+ this.message = message;
455
+ return this;
456
+ }
457
+ getAgencyInfo() {
458
+ return this.agencyInfo;
459
+ }
460
+ setAgencyInfo(agencyInfo) {
461
+ this.agencyInfo = agencyInfo;
462
+ return this;
463
+ }
464
+ getAccepted() {
465
+ return this.accepted;
466
+ }
467
+ setAccepted(accepted) {
468
+ this.accepted = accepted;
469
+ return this;
470
+ }
471
+ toMap() {
472
+ const map = {};
473
+ if (this.text != null) map.text = this.text;
474
+ if (this.id != null) map.id = this.id;
475
+ if (this.type != null) map.type = this.type;
476
+ if (this.title != null) map.title = this.title;
477
+ if (this.message != null) map.message = this.message;
478
+ if (this.agencyInfo != null) map.agencyInfo = this.agencyInfo.toMap();
479
+ if (this.accepted != null) map.accepted = this.accepted;
480
+ return map;
481
+ }
482
+ };
483
+ AgencyInvite.AgencyInfo = AgencyInfo;
484
+ AgencyInvite.AgencyInviteType = AgencyInviteType;
485
+ var AgencyInvite_default = AgencyInvite;
486
+
341
487
  // src/core/types/Action.js
342
488
  var Action = class {
343
489
  constructor(type, data) {
@@ -379,17 +525,21 @@ var ActionType = {
379
525
  JUMP: "jump",
380
526
  NAVIGATE: "navigate",
381
527
  REPLACE: "replace",
528
+ GOBACK: "goback",
382
529
  ENTER_ROOM: "enter_room",
383
530
  LIVE_DETECT: "live_detect",
384
- ONELINK: "onelink"
531
+ ONELINK: "onelink",
532
+ AGENCY_INVITE: "agency_invite"
385
533
  };
386
534
  var ActionData = {
387
535
  Jump: Jump_default,
388
536
  Navigate: Navigate_default,
389
537
  Replace: Replace_default,
538
+ Goback: Goback_default,
390
539
  EnterRoom: EnterRoom_default,
391
540
  LiveDetect: LiveDetect_default,
392
- Onelink: Onelink_default
541
+ Onelink: Onelink_default,
542
+ AgencyInvite: AgencyInvite_default
393
543
  };
394
544
  var ActionCreator = {
395
545
  ActionData,
@@ -430,6 +580,16 @@ var ActionCreator = {
430
580
  createReplaceActionWithData(replace) {
431
581
  return new Action_default(ActionType.REPLACE, replace);
432
582
  },
583
+ // Goback
584
+ buildGoback() {
585
+ return new Goback_default();
586
+ },
587
+ createGobackAction() {
588
+ return new Action_default(ActionType.GOBACK, new Goback_default());
589
+ },
590
+ createGobackActionWithData(goback) {
591
+ return new Action_default(ActionType.GOBACK, goback);
592
+ },
433
593
  // EnterRoom
434
594
  buildEnterRoom() {
435
595
  return new EnterRoom_default();
@@ -461,6 +621,16 @@ var ActionCreator = {
461
621
  },
462
622
  createOnelinkActionWithData(onelink) {
463
623
  return new Action_default(ActionType.ONELINK, onelink);
624
+ },
625
+ // AgencyInvite
626
+ buildAgencyInvite(id, type) {
627
+ return new AgencyInvite_default(id, type);
628
+ },
629
+ createAgencyInviteAction(id, type) {
630
+ return new Action_default(ActionType.AGENCY_INVITE, new AgencyInvite_default(id, type));
631
+ },
632
+ createAgencyInviteActionWithData(agencyInvite) {
633
+ return new Action_default(ActionType.AGENCY_INVITE, agencyInvite);
464
634
  }
465
635
  };
466
636
 
@@ -676,6 +846,18 @@ var ActionBridge = class _ActionBridge {
676
846
  createReplaceActionWithData(replace) {
677
847
  return ActionCreator.createReplaceActionWithData(replace);
678
848
  }
849
+ goback() {
850
+ return this._adapter.sendAction(ActionCreator.createGobackAction());
851
+ }
852
+ buildGoback() {
853
+ return ActionCreator.buildGoback();
854
+ }
855
+ createGobackAction() {
856
+ return ActionCreator.createGobackAction();
857
+ }
858
+ createGobackActionWithData(goback) {
859
+ return ActionCreator.createGobackActionWithData(goback);
860
+ }
679
861
  enterRoom(id) {
680
862
  return this._adapter.sendAction(ActionCreator.createEnterRoomAction(id));
681
863
  }
@@ -712,6 +894,18 @@ var ActionBridge = class _ActionBridge {
712
894
  createOnelinkActionWithData(onelink) {
713
895
  return ActionCreator.createOnelinkActionWithData(onelink);
714
896
  }
897
+ agencyInvite(id, type) {
898
+ return this._adapter.sendAction(ActionCreator.createAgencyInviteAction(id, type));
899
+ }
900
+ buildAgencyInvite(id, type) {
901
+ return ActionCreator.buildAgencyInvite(id, type);
902
+ }
903
+ createAgencyInviteAction(id, type) {
904
+ return ActionCreator.createAgencyInviteAction(id, type);
905
+ }
906
+ createAgencyInviteActionWithData(agencyInvite) {
907
+ return ActionCreator.createAgencyInviteActionWithData(agencyInvite);
908
+ }
715
909
  destroy() {
716
910
  if (typeof this._adapter.destroy === "function") {
717
911
  this._adapter.destroy();
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * YAGO Event Kit - Action Creator (Core Only)
3
- * @version 1.0.0
3
+ * @version 1.0.2
4
4
  *
5
5
  * Generated by build script - do not edit manually.
6
6
  * Supports: Browser script tag, CommonJS, AMD
@@ -279,6 +279,26 @@ EnterRoom.OpenActivityCallback = OpenActivityCallback;
279
279
  EnterRoom.SwitchRoomTypeCallback = SwitchRoomTypeCallback;
280
280
  var EnterRoom_default = EnterRoom;
281
281
 
282
+ // src/core/types/Goback.js
283
+ var Goback = class {
284
+ constructor() {
285
+ this.text = null;
286
+ }
287
+ getText() {
288
+ return this.text;
289
+ }
290
+ setText(text) {
291
+ this.text = text;
292
+ return this;
293
+ }
294
+ toMap() {
295
+ const map = {};
296
+ if (this.text != null) map.text = this.text;
297
+ return map;
298
+ }
299
+ };
300
+ var Goback_default = Goback;
301
+
282
302
  // src/core/types/LiveDetect.js
283
303
  var LiveDetect = class {
284
304
  constructor() {
@@ -338,6 +358,132 @@ var Onelink = class {
338
358
  };
339
359
  var Onelink_default = Onelink;
340
360
 
361
+ // src/core/types/AgencyInvite.js
362
+ var AgencyInfo = class {
363
+ constructor() {
364
+ this.id = null;
365
+ this.name = null;
366
+ this.ownerId = null;
367
+ this.ownerName = null;
368
+ }
369
+ getId() {
370
+ return this.id;
371
+ }
372
+ setId(id) {
373
+ this.id = id;
374
+ return this;
375
+ }
376
+ getName() {
377
+ return this.name;
378
+ }
379
+ setName(name) {
380
+ this.name = name;
381
+ return this;
382
+ }
383
+ getOwnerId() {
384
+ return this.ownerId;
385
+ }
386
+ setOwnerId(ownerId) {
387
+ this.ownerId = ownerId;
388
+ return this;
389
+ }
390
+ getOwnerName() {
391
+ return this.ownerName;
392
+ }
393
+ setOwnerName(ownerName) {
394
+ this.ownerName = ownerName;
395
+ return this;
396
+ }
397
+ toMap() {
398
+ const map = {};
399
+ if (this.id != null) map.id = this.id;
400
+ if (this.name != null) map.name = this.name;
401
+ if (this.ownerId != null) map.ownerId = this.ownerId;
402
+ if (this.ownerName != null) map.ownerName = this.ownerName;
403
+ return map;
404
+ }
405
+ };
406
+ var AgencyInviteType = {
407
+ TO_BE_MEMBER: "to_be_member",
408
+ TO_BE_SUBAGENCY: "to_be_subagency"
409
+ };
410
+ var AgencyInvite = class {
411
+ constructor(id, type) {
412
+ if (id == null) throw new Error("id cannot be null");
413
+ if (type == null) throw new Error("type cannot be null");
414
+ this.text = null;
415
+ this.id = id;
416
+ this.type = type;
417
+ this.title = null;
418
+ this.message = null;
419
+ this.agencyInfo = null;
420
+ this.accepted = null;
421
+ }
422
+ getText() {
423
+ return this.text;
424
+ }
425
+ setText(text) {
426
+ this.text = text;
427
+ return this;
428
+ }
429
+ getId() {
430
+ return this.id;
431
+ }
432
+ setId(id) {
433
+ this.id = id;
434
+ return this;
435
+ }
436
+ getType() {
437
+ return this.type;
438
+ }
439
+ setType(type) {
440
+ this.type = type;
441
+ return this;
442
+ }
443
+ getTitle() {
444
+ return this.title;
445
+ }
446
+ setTitle(title) {
447
+ this.title = title;
448
+ return this;
449
+ }
450
+ getMessage() {
451
+ return this.message;
452
+ }
453
+ setMessage(message) {
454
+ this.message = message;
455
+ return this;
456
+ }
457
+ getAgencyInfo() {
458
+ return this.agencyInfo;
459
+ }
460
+ setAgencyInfo(agencyInfo) {
461
+ this.agencyInfo = agencyInfo;
462
+ return this;
463
+ }
464
+ getAccepted() {
465
+ return this.accepted;
466
+ }
467
+ setAccepted(accepted) {
468
+ this.accepted = accepted;
469
+ return this;
470
+ }
471
+ toMap() {
472
+ const map = {};
473
+ if (this.text != null) map.text = this.text;
474
+ if (this.id != null) map.id = this.id;
475
+ if (this.type != null) map.type = this.type;
476
+ if (this.title != null) map.title = this.title;
477
+ if (this.message != null) map.message = this.message;
478
+ if (this.agencyInfo != null) map.agencyInfo = this.agencyInfo.toMap();
479
+ if (this.accepted != null) map.accepted = this.accepted;
480
+ return map;
481
+ }
482
+ };
483
+ AgencyInvite.AgencyInfo = AgencyInfo;
484
+ AgencyInvite.AgencyInviteType = AgencyInviteType;
485
+ var AgencyInvite_default = AgencyInvite;
486
+
341
487
  // src/core/types/Action.js
342
488
  var Action = class {
343
489
  constructor(type, data) {
@@ -379,17 +525,21 @@ var ActionType = {
379
525
  JUMP: "jump",
380
526
  NAVIGATE: "navigate",
381
527
  REPLACE: "replace",
528
+ GOBACK: "goback",
382
529
  ENTER_ROOM: "enter_room",
383
530
  LIVE_DETECT: "live_detect",
384
- ONELINK: "onelink"
531
+ ONELINK: "onelink",
532
+ AGENCY_INVITE: "agency_invite"
385
533
  };
386
534
  var ActionData = {
387
535
  Jump: Jump_default,
388
536
  Navigate: Navigate_default,
389
537
  Replace: Replace_default,
538
+ Goback: Goback_default,
390
539
  EnterRoom: EnterRoom_default,
391
540
  LiveDetect: LiveDetect_default,
392
- Onelink: Onelink_default
541
+ Onelink: Onelink_default,
542
+ AgencyInvite: AgencyInvite_default
393
543
  };
394
544
  var ActionCreator = {
395
545
  ActionData,
@@ -430,6 +580,16 @@ var ActionCreator = {
430
580
  createReplaceActionWithData(replace) {
431
581
  return new Action_default(ActionType.REPLACE, replace);
432
582
  },
583
+ // Goback
584
+ buildGoback() {
585
+ return new Goback_default();
586
+ },
587
+ createGobackAction() {
588
+ return new Action_default(ActionType.GOBACK, new Goback_default());
589
+ },
590
+ createGobackActionWithData(goback) {
591
+ return new Action_default(ActionType.GOBACK, goback);
592
+ },
433
593
  // EnterRoom
434
594
  buildEnterRoom() {
435
595
  return new EnterRoom_default();
@@ -461,6 +621,16 @@ var ActionCreator = {
461
621
  },
462
622
  createOnelinkActionWithData(onelink) {
463
623
  return new Action_default(ActionType.ONELINK, onelink);
624
+ },
625
+ // AgencyInvite
626
+ buildAgencyInvite(id, type) {
627
+ return new AgencyInvite_default(id, type);
628
+ },
629
+ createAgencyInviteAction(id, type) {
630
+ return new Action_default(ActionType.AGENCY_INVITE, new AgencyInvite_default(id, type));
631
+ },
632
+ createAgencyInviteActionWithData(agencyInvite) {
633
+ return new Action_default(ActionType.AGENCY_INVITE, agencyInvite);
464
634
  }
465
635
  };
466
636
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagolive/event-kit",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "YAGO Event Kit - 跨环境 Action 创建与通信工具库,支持浏览器、React、Vue",
5
5
  "main": "src/index.js",
6
6
  "browser": "build/js/action_bridge.umd.js",
@@ -97,6 +97,20 @@ export default class ActionBridge {
97
97
  return ActionCreator.createReplaceActionWithData(replace);
98
98
  }
99
99
 
100
+ goback() {
101
+ return this._adapter.sendAction(ActionCreator.createGobackAction());
102
+ }
103
+
104
+ buildGoback() {
105
+ return ActionCreator.buildGoback();
106
+ }
107
+ createGobackAction() {
108
+ return ActionCreator.createGobackAction();
109
+ }
110
+ createGobackActionWithData(goback) {
111
+ return ActionCreator.createGobackActionWithData(goback);
112
+ }
113
+
100
114
  enterRoom(id) {
101
115
  return this._adapter.sendAction(ActionCreator.createEnterRoomAction(id));
102
116
  }
@@ -139,6 +153,20 @@ export default class ActionBridge {
139
153
  return ActionCreator.createOnelinkActionWithData(onelink);
140
154
  }
141
155
 
156
+ agencyInvite(id, type) {
157
+ return this._adapter.sendAction(ActionCreator.createAgencyInviteAction(id, type));
158
+ }
159
+
160
+ buildAgencyInvite(id, type) {
161
+ return ActionCreator.buildAgencyInvite(id, type);
162
+ }
163
+ createAgencyInviteAction(id, type) {
164
+ return ActionCreator.createAgencyInviteAction(id, type);
165
+ }
166
+ createAgencyInviteActionWithData(agencyInvite) {
167
+ return ActionCreator.createAgencyInviteActionWithData(agencyInvite);
168
+ }
169
+
142
170
  destroy() {
143
171
  if (typeof this._adapter.destroy === 'function') {
144
172
  this._adapter.destroy();
@@ -1,5 +1,5 @@
1
1
  import {
2
- Action, Jump, Navigate, Replace, EnterRoom, LiveDetect, Onelink,
2
+ Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite,
3
3
  ActionType, ActionData, ActionCreator,
4
4
  } from '../core/index.js';
5
5
  import { IActionAdapter, RNWebViewAdapter, MockAdapter, AdapterOptions } from '../adapters/index.js';
@@ -31,6 +31,11 @@ export declare class ActionBridge {
31
31
  createReplaceActionWithParams(screen: string, params: Record<string, any>): Action;
32
32
  createReplaceActionWithData(replace: Replace): Action;
33
33
 
34
+ goback(): Promise<any>;
35
+ buildGoback(): Goback;
36
+ createGobackAction(): Action;
37
+ createGobackActionWithData(goback: Goback): Action;
38
+
34
39
  enterRoom(id: number): Promise<any>;
35
40
  buildEnterRoom(): EnterRoom;
36
41
  createEnterRoomAction(id: number): Action;
@@ -46,6 +51,11 @@ export declare class ActionBridge {
46
51
  createOnelinkAction(url: string): Action;
47
52
  createOnelinkActionWithData(onelink: Onelink): Action;
48
53
 
54
+ agencyInvite(id: number, type: string): Promise<any>;
55
+ buildAgencyInvite(id: number, type: string): AgencyInvite;
56
+ createAgencyInviteAction(id: number, type: string): Action;
57
+ createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
58
+
49
59
  destroy(): void;
50
60
 
51
61
  static ActionCreator: typeof ActionCreator;
@@ -2,26 +2,32 @@ import Jump from './types/Jump.js';
2
2
  import Navigate from './types/Navigate.js';
3
3
  import Replace from './types/Replace.js';
4
4
  import EnterRoom from './types/EnterRoom.js';
5
+ import Goback from './types/Goback.js';
5
6
  import LiveDetect from './types/LiveDetect.js';
6
7
  import Onelink from './types/Onelink.js';
8
+ import AgencyInvite from './types/AgencyInvite.js';
7
9
  import Action from './types/Action.js';
8
10
 
9
11
  const ActionType = {
10
12
  JUMP: 'jump',
11
13
  NAVIGATE: 'navigate',
12
14
  REPLACE: 'replace',
15
+ GOBACK: 'goback',
13
16
  ENTER_ROOM: 'enter_room',
14
17
  LIVE_DETECT: 'live_detect',
15
18
  ONELINK: 'onelink',
19
+ AGENCY_INVITE: 'agency_invite',
16
20
  };
17
21
 
18
22
  const ActionData = {
19
23
  Jump,
20
24
  Navigate,
21
25
  Replace,
26
+ Goback,
22
27
  EnterRoom,
23
28
  LiveDetect,
24
29
  Onelink,
30
+ AgencyInvite,
25
31
  };
26
32
 
27
33
  const ActionCreator = {
@@ -75,6 +81,19 @@ const ActionCreator = {
75
81
  return new Action(ActionType.REPLACE, replace);
76
82
  },
77
83
 
84
+ // Goback
85
+ buildGoback() {
86
+ return new Goback();
87
+ },
88
+
89
+ createGobackAction() {
90
+ return new Action(ActionType.GOBACK, new Goback());
91
+ },
92
+
93
+ createGobackActionWithData(goback) {
94
+ return new Action(ActionType.GOBACK, goback);
95
+ },
96
+
78
97
  // EnterRoom
79
98
  buildEnterRoom() {
80
99
  return new EnterRoom();
@@ -115,6 +134,19 @@ const ActionCreator = {
115
134
  createOnelinkActionWithData(onelink) {
116
135
  return new Action(ActionType.ONELINK, onelink);
117
136
  },
137
+
138
+ // AgencyInvite
139
+ buildAgencyInvite(id, type) {
140
+ return new AgencyInvite(id, type);
141
+ },
142
+
143
+ createAgencyInviteAction(id, type) {
144
+ return new Action(ActionType.AGENCY_INVITE, new AgencyInvite(id, type));
145
+ },
146
+
147
+ createAgencyInviteActionWithData(agencyInvite) {
148
+ return new Action(ActionType.AGENCY_INVITE, agencyInvite);
149
+ },
118
150
  };
119
151
 
120
152
  export { ActionCreator, ActionData, ActionType };
@@ -29,6 +29,14 @@ export class Replace extends Navigate {
29
29
  constructor(screen: string, params?: Record<string, any>);
30
30
  }
31
31
 
32
+ export class Goback {
33
+ constructor();
34
+ text: string | null;
35
+ getText(): string | null;
36
+ setText(text: string): this;
37
+ toMap(): Record<string, any>;
38
+ }
39
+
32
40
  export class OpenGiftPopupCallback {
33
41
  constructor();
34
42
  id: number | null;
@@ -123,6 +131,55 @@ export class Onelink {
123
131
  toMap(): Record<string, any>;
124
132
  }
125
133
 
134
+ export class AgencyInfo {
135
+ id: string | null;
136
+ name: string | null;
137
+ ownerId: string | null;
138
+ ownerName: string | null;
139
+ getId(): string | null;
140
+ setId(id: string): this;
141
+ getName(): string | null;
142
+ setName(name: string): this;
143
+ getOwnerId(): string | null;
144
+ setOwnerId(ownerId: string): this;
145
+ getOwnerName(): string | null;
146
+ setOwnerName(ownerName: string): this;
147
+ toMap(): Record<string, any>;
148
+ }
149
+
150
+ export const AgencyInviteType: {
151
+ TO_BE_MEMBER: 'to_be_member';
152
+ TO_BE_SUBAGENCY: 'to_be_subagency';
153
+ };
154
+
155
+ export class AgencyInvite {
156
+ constructor(id: number, type: string);
157
+ text: string | null;
158
+ id: number;
159
+ type: string;
160
+ title: string | null;
161
+ message: string | null;
162
+ agencyInfo: AgencyInfo | null;
163
+ accepted: boolean | null;
164
+ static AgencyInfo: typeof AgencyInfo;
165
+ static AgencyInviteType: typeof AgencyInviteType;
166
+ getText(): string | null;
167
+ setText(text: string): this;
168
+ getId(): number;
169
+ setId(id: number): this;
170
+ getType(): string;
171
+ setType(type: string): this;
172
+ getTitle(): string | null;
173
+ setTitle(title: string): this;
174
+ getMessage(): string | null;
175
+ setMessage(message: string): this;
176
+ getAgencyInfo(): AgencyInfo | null;
177
+ setAgencyInfo(agencyInfo: AgencyInfo): this;
178
+ getAccepted(): boolean | null;
179
+ setAccepted(accepted: boolean): this;
180
+ toMap(): Record<string, any>;
181
+ }
182
+
126
183
  export class Action {
127
184
  constructor(type: ActionTypeValue, data: any);
128
185
  type: ActionTypeValue;
@@ -136,24 +193,28 @@ export class Action {
136
193
  toJson(): string;
137
194
  }
138
195
 
139
- export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'enter_room' | 'live_detect' | 'onelink';
196
+ export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite';
140
197
 
141
198
  export const ActionType: {
142
199
  JUMP: 'jump';
143
200
  NAVIGATE: 'navigate';
144
201
  REPLACE: 'replace';
202
+ GOBACK: 'goback';
145
203
  ENTER_ROOM: 'enter_room';
146
204
  LIVE_DETECT: 'live_detect';
147
205
  ONELINK: 'onelink';
206
+ AGENCY_INVITE: 'agency_invite';
148
207
  };
149
208
 
150
209
  export const ActionData: {
151
210
  Jump: typeof Jump;
152
211
  Navigate: typeof Navigate;
153
212
  Replace: typeof Replace;
213
+ Goback: typeof Goback;
154
214
  EnterRoom: typeof EnterRoom;
155
215
  LiveDetect: typeof LiveDetect;
156
216
  Onelink: typeof Onelink;
217
+ AgencyInvite: typeof AgencyInvite;
157
218
  };
158
219
 
159
220
  export const ActionCreator: {
@@ -170,6 +231,9 @@ export const ActionCreator: {
170
231
  createReplaceAction(screen: string): Action;
171
232
  createReplaceActionWithParams(screen: string, params: Record<string, any>): Action;
172
233
  createReplaceActionWithData(replace: Replace): Action;
234
+ buildGoback(): Goback;
235
+ createGobackAction(): Action;
236
+ createGobackActionWithData(goback: Goback): Action;
173
237
  buildEnterRoom(): EnterRoom;
174
238
  createEnterRoomAction(id: string): Action;
175
239
  createEnterRoomActionWithData(enterRoom: EnterRoom): Action;
@@ -179,4 +243,7 @@ export const ActionCreator: {
179
243
  buildOnelink(url: string): Onelink;
180
244
  createOnelinkAction(url: string): Action;
181
245
  createOnelinkActionWithData(onelink: Onelink): Action;
246
+ buildAgencyInvite(id: number, type: string): AgencyInvite;
247
+ createAgencyInviteAction(id: number, type: string): Action;
248
+ createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
182
249
  };
package/src/core/index.js CHANGED
@@ -2,7 +2,9 @@ export { ActionCreator, ActionData, ActionType } from './ActionCreator.js';
2
2
  export { default as Jump } from './types/Jump.js';
3
3
  export { default as Navigate } from './types/Navigate.js';
4
4
  export { default as Replace } from './types/Replace.js';
5
+ export { default as Goback } from './types/Goback.js';
5
6
  export { default as EnterRoom } from './types/EnterRoom.js';
6
7
  export { default as LiveDetect } from './types/LiveDetect.js';
7
8
  export { default as Onelink } from './types/Onelink.js';
9
+ export { default as AgencyInvite } from './types/AgencyInvite.js';
8
10
  export { default as Action } from './types/Action.js';
@@ -0,0 +1,60 @@
1
+ class AgencyInfo {
2
+ constructor() { this.id = null; this.name = null; this.ownerId = null; this.ownerName = null; }
3
+ getId() { return this.id; } setId(id) { this.id = id; return this; }
4
+ getName() { return this.name; } setName(name) { this.name = name; return this; }
5
+ getOwnerId() { return this.ownerId; } setOwnerId(ownerId) { this.ownerId = ownerId; return this; }
6
+ getOwnerName() { return this.ownerName; } setOwnerName(ownerName) { this.ownerName = ownerName; return this; }
7
+
8
+ toMap() {
9
+ const map = {};
10
+ if (this.id != null) map.id = this.id;
11
+ if (this.name != null) map.name = this.name;
12
+ if (this.ownerId != null) map.ownerId = this.ownerId;
13
+ if (this.ownerName != null) map.ownerName = this.ownerName;
14
+ return map;
15
+ }
16
+ }
17
+
18
+ const AgencyInviteType = {
19
+ TO_BE_MEMBER: 'to_be_member',
20
+ TO_BE_SUBAGENCY: 'to_be_subagency',
21
+ };
22
+
23
+ class AgencyInvite {
24
+ constructor(id, type) {
25
+ if (id == null) throw new Error('id cannot be null');
26
+ if (type == null) throw new Error('type cannot be null');
27
+ this.text = null;
28
+ this.id = id;
29
+ this.type = type;
30
+ this.title = null;
31
+ this.message = null;
32
+ this.agencyInfo = null;
33
+ this.accepted = null;
34
+ }
35
+
36
+ getText() { return this.text; } setText(text) { this.text = text; return this; }
37
+ getId() { return this.id; } setId(id) { this.id = id; return this; }
38
+ getType() { return this.type; } setType(type) { this.type = type; return this; }
39
+ getTitle() { return this.title; } setTitle(title) { this.title = title; return this; }
40
+ getMessage() { return this.message; } setMessage(message) { this.message = message; return this; }
41
+ getAgencyInfo() { return this.agencyInfo; } setAgencyInfo(agencyInfo) { this.agencyInfo = agencyInfo; return this; }
42
+ getAccepted() { return this.accepted; } setAccepted(accepted) { this.accepted = accepted; return this; }
43
+
44
+ toMap() {
45
+ const map = {};
46
+ if (this.text != null) map.text = this.text;
47
+ if (this.id != null) map.id = this.id;
48
+ if (this.type != null) map.type = this.type;
49
+ if (this.title != null) map.title = this.title;
50
+ if (this.message != null) map.message = this.message;
51
+ if (this.agencyInfo != null) map.agencyInfo = this.agencyInfo.toMap();
52
+ if (this.accepted != null) map.accepted = this.accepted;
53
+ return map;
54
+ }
55
+ }
56
+
57
+ AgencyInvite.AgencyInfo = AgencyInfo;
58
+ AgencyInvite.AgencyInviteType = AgencyInviteType;
59
+
60
+ export default AgencyInvite;
@@ -0,0 +1,16 @@
1
+ class Goback {
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 Goback;
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, EnterRoom, LiveDetect, Onelink, Action } from './core/index.js';
2
+ export { ActionCreator, ActionData, ActionType, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, 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
@@ -4,7 +4,9 @@ export { RNWebViewAdapter, MockAdapter } from './adapters/index.js';
4
4
  export { Jump } from './core/index.js';
5
5
  export { Navigate } from './core/index.js';
6
6
  export { Replace } from './core/index.js';
7
+ export { Goback } from './core/index.js';
7
8
  export { EnterRoom } from './core/index.js';
8
9
  export { LiveDetect } from './core/index.js';
9
10
  export { Onelink } from './core/index.js';
11
+ export { AgencyInvite } from './core/index.js';
10
12
  export { Action } from './core/index.js';