@yagolive/event-kit 1.0.1 → 1.0.3

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,67 @@
1
1
  # Changelog
2
2
 
3
+ ## @1.0.3 (2026-05-27)
4
+
5
+ ### 修改
6
+
7
+ - **AgencyInfo 字段扩展**: 为 `AgencyInvite.AgencyInfo` 内部类新增 `ownerAvatar` 字段
8
+ - 新增 `ownerAvatar?: string`(工会长头像 URL)
9
+ - JS: `AgencyInfo` 类新增 `getOwnerAvatar()` / `setOwnerAvatar(ownerAvatar)` 方法
10
+ - Java: `AgencyInfo` 类新增 `getOwnerAvatar()` / `setOwnerAvatar(String ownerAvatar)` 方法
11
+ - `toMap()` 方法同步新增 `ownerAvatar` 字段处理
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
+ | agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
25
+
26
+ ### AgencyInfo 字段
27
+
28
+ | 字段 | 类型 | 说明 |
29
+ |------|------|------|
30
+ | id | string | 工会ID |
31
+ | name | string | 工会名称 |
32
+ | ownerId | string | 工会长用户ID |
33
+ | ownerName | string | 工会长名称 |
34
+ | ownerAvatar | string | 工会长头像URL |
35
+
36
+ ---
37
+
38
+ ## @1.0.2 (2026-05-26)
39
+
40
+ ### 新增
41
+
42
+ - **AgencyInvite Action**: 新增工会邀请动作类型
43
+ - `ActionType.AGENCY_INVITE` = `'agency_invite'`
44
+ - `AgencyInvite` 数据类:必填字段 `id`(number)、`type`('to_be_member' | 'to_be_subagency');可选字段 `title`、`message`、`agencyInfo`(嵌套对象)、`accepted`(boolean)、`text`
45
+ - `AgencyInvite.AgencyInfo` 内部类:`id`、`name`、`ownerId`、`ownerName`
46
+ - `AgencyInvite.AgencyInviteType` 枚举:`TO_BE_MEMBER`、`TO_BE_SUBAGENCY`
47
+ - `ActionCreator.buildAgencyInvite(id, type)`、`createAgencyInviteAction(id, type)`、`createAgencyInviteActionWithData(agencyInvite)`
48
+ - `ActionBridge.agencyInvite(id, type)`、`buildAgencyInvite(id, type)`、`createAgencyInviteAction(id, type)`、`createAgencyInviteActionWithData(agencyInvite)`
49
+
50
+ ### Action 类型完整列表
51
+
52
+ | 类型 | 字段 | 说明 |
53
+ |------|------|------|
54
+ | jump | path: string, text?: string | 页面跳转 |
55
+ | navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
56
+ | replace | screen: string, params?: Record, text?: string | 替换当前页面 |
57
+ | goback | text?: string | 返回上一页 |
58
+ | enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
59
+ | live_detect | text?: string | 活体检测 |
60
+ | onelink | url: string, share?: boolean, text?: string | 分享链接 |
61
+ | agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
62
+
63
+ ---
64
+
3
65
  ## @1.0.1 (2026-05-22)
4
66
 
5
67
  ### 新增
package/README.md CHANGED
@@ -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,38 @@ 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
+ | `setOwnerAvatar(ownerAvatar)` | ownerAvatar: string | 设置工会长头像 URL,返回 this |
670
+
616
671
  ### Action
617
672
 
618
673
  Action 对象,封装类型和数据。
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * YAGO Event Kit - Action Bridge (Full)
3
- * @version 1.0.1
3
+ * @version 1.0.3
4
4
  *
5
5
  * Generated by build script - do not edit manually.
6
6
  * Supports: Browser script tag, CommonJS, AMD
@@ -358,6 +358,141 @@ var Onelink = class {
358
358
  };
359
359
  var Onelink_default = Onelink;
360
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
+ this.ownerAvatar = null;
369
+ }
370
+ getId() {
371
+ return this.id;
372
+ }
373
+ setId(id) {
374
+ this.id = id;
375
+ return this;
376
+ }
377
+ getName() {
378
+ return this.name;
379
+ }
380
+ setName(name) {
381
+ this.name = name;
382
+ return this;
383
+ }
384
+ getOwnerId() {
385
+ return this.ownerId;
386
+ }
387
+ setOwnerId(ownerId) {
388
+ this.ownerId = ownerId;
389
+ return this;
390
+ }
391
+ getOwnerName() {
392
+ return this.ownerName;
393
+ }
394
+ setOwnerName(ownerName) {
395
+ this.ownerName = ownerName;
396
+ return this;
397
+ }
398
+ getOwnerAvatar() {
399
+ return this.ownerAvatar;
400
+ }
401
+ setOwnerAvatar(ownerAvatar) {
402
+ this.ownerAvatar = ownerAvatar;
403
+ return this;
404
+ }
405
+ toMap() {
406
+ const map = {};
407
+ if (this.id != null) map.id = this.id;
408
+ if (this.name != null) map.name = this.name;
409
+ if (this.ownerId != null) map.ownerId = this.ownerId;
410
+ if (this.ownerName != null) map.ownerName = this.ownerName;
411
+ if (this.ownerAvatar != null) map.ownerAvatar = this.ownerAvatar;
412
+ return map;
413
+ }
414
+ };
415
+ var AgencyInviteType = {
416
+ TO_BE_MEMBER: "to_be_member",
417
+ TO_BE_SUBAGENCY: "to_be_subagency"
418
+ };
419
+ var AgencyInvite = class {
420
+ constructor(id, type) {
421
+ if (id == null) throw new Error("id cannot be null");
422
+ if (type == null) throw new Error("type cannot be null");
423
+ this.text = null;
424
+ this.id = id;
425
+ this.type = type;
426
+ this.title = null;
427
+ this.message = null;
428
+ this.agencyInfo = null;
429
+ this.accepted = null;
430
+ }
431
+ getText() {
432
+ return this.text;
433
+ }
434
+ setText(text) {
435
+ this.text = text;
436
+ return this;
437
+ }
438
+ getId() {
439
+ return this.id;
440
+ }
441
+ setId(id) {
442
+ this.id = id;
443
+ return this;
444
+ }
445
+ getType() {
446
+ return this.type;
447
+ }
448
+ setType(type) {
449
+ this.type = type;
450
+ return this;
451
+ }
452
+ getTitle() {
453
+ return this.title;
454
+ }
455
+ setTitle(title) {
456
+ this.title = title;
457
+ return this;
458
+ }
459
+ getMessage() {
460
+ return this.message;
461
+ }
462
+ setMessage(message) {
463
+ this.message = message;
464
+ return this;
465
+ }
466
+ getAgencyInfo() {
467
+ return this.agencyInfo;
468
+ }
469
+ setAgencyInfo(agencyInfo) {
470
+ this.agencyInfo = agencyInfo;
471
+ return this;
472
+ }
473
+ getAccepted() {
474
+ return this.accepted;
475
+ }
476
+ setAccepted(accepted) {
477
+ this.accepted = accepted;
478
+ return this;
479
+ }
480
+ toMap() {
481
+ const map = {};
482
+ if (this.text != null) map.text = this.text;
483
+ if (this.id != null) map.id = this.id;
484
+ if (this.type != null) map.type = this.type;
485
+ if (this.title != null) map.title = this.title;
486
+ if (this.message != null) map.message = this.message;
487
+ if (this.agencyInfo != null) map.agencyInfo = this.agencyInfo.toMap();
488
+ if (this.accepted != null) map.accepted = this.accepted;
489
+ return map;
490
+ }
491
+ };
492
+ AgencyInvite.AgencyInfo = AgencyInfo;
493
+ AgencyInvite.AgencyInviteType = AgencyInviteType;
494
+ var AgencyInvite_default = AgencyInvite;
495
+
361
496
  // src/core/types/Action.js
362
497
  var Action = class {
363
498
  constructor(type, data) {
@@ -402,7 +537,8 @@ var ActionType = {
402
537
  GOBACK: "goback",
403
538
  ENTER_ROOM: "enter_room",
404
539
  LIVE_DETECT: "live_detect",
405
- ONELINK: "onelink"
540
+ ONELINK: "onelink",
541
+ AGENCY_INVITE: "agency_invite"
406
542
  };
407
543
  var ActionData = {
408
544
  Jump: Jump_default,
@@ -411,7 +547,8 @@ var ActionData = {
411
547
  Goback: Goback_default,
412
548
  EnterRoom: EnterRoom_default,
413
549
  LiveDetect: LiveDetect_default,
414
- Onelink: Onelink_default
550
+ Onelink: Onelink_default,
551
+ AgencyInvite: AgencyInvite_default
415
552
  };
416
553
  var ActionCreator = {
417
554
  ActionData,
@@ -493,6 +630,16 @@ var ActionCreator = {
493
630
  },
494
631
  createOnelinkActionWithData(onelink) {
495
632
  return new Action_default(ActionType.ONELINK, onelink);
633
+ },
634
+ // AgencyInvite
635
+ buildAgencyInvite(id, type) {
636
+ return new AgencyInvite_default(id, type);
637
+ },
638
+ createAgencyInviteAction(id, type) {
639
+ return new Action_default(ActionType.AGENCY_INVITE, new AgencyInvite_default(id, type));
640
+ },
641
+ createAgencyInviteActionWithData(agencyInvite) {
642
+ return new Action_default(ActionType.AGENCY_INVITE, agencyInvite);
496
643
  }
497
644
  };
498
645
 
@@ -756,6 +903,18 @@ var ActionBridge = class _ActionBridge {
756
903
  createOnelinkActionWithData(onelink) {
757
904
  return ActionCreator.createOnelinkActionWithData(onelink);
758
905
  }
906
+ agencyInvite(id, type) {
907
+ return this._adapter.sendAction(ActionCreator.createAgencyInviteAction(id, type));
908
+ }
909
+ buildAgencyInvite(id, type) {
910
+ return ActionCreator.buildAgencyInvite(id, type);
911
+ }
912
+ createAgencyInviteAction(id, type) {
913
+ return ActionCreator.createAgencyInviteAction(id, type);
914
+ }
915
+ createAgencyInviteActionWithData(agencyInvite) {
916
+ return ActionCreator.createAgencyInviteActionWithData(agencyInvite);
917
+ }
759
918
  destroy() {
760
919
  if (typeof this._adapter.destroy === "function") {
761
920
  this._adapter.destroy();
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * YAGO Event Kit - Action Creator (Core Only)
3
- * @version 1.0.1
3
+ * @version 1.0.3
4
4
  *
5
5
  * Generated by build script - do not edit manually.
6
6
  * Supports: Browser script tag, CommonJS, AMD
@@ -358,6 +358,141 @@ var Onelink = class {
358
358
  };
359
359
  var Onelink_default = Onelink;
360
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
+ this.ownerAvatar = null;
369
+ }
370
+ getId() {
371
+ return this.id;
372
+ }
373
+ setId(id) {
374
+ this.id = id;
375
+ return this;
376
+ }
377
+ getName() {
378
+ return this.name;
379
+ }
380
+ setName(name) {
381
+ this.name = name;
382
+ return this;
383
+ }
384
+ getOwnerId() {
385
+ return this.ownerId;
386
+ }
387
+ setOwnerId(ownerId) {
388
+ this.ownerId = ownerId;
389
+ return this;
390
+ }
391
+ getOwnerName() {
392
+ return this.ownerName;
393
+ }
394
+ setOwnerName(ownerName) {
395
+ this.ownerName = ownerName;
396
+ return this;
397
+ }
398
+ getOwnerAvatar() {
399
+ return this.ownerAvatar;
400
+ }
401
+ setOwnerAvatar(ownerAvatar) {
402
+ this.ownerAvatar = ownerAvatar;
403
+ return this;
404
+ }
405
+ toMap() {
406
+ const map = {};
407
+ if (this.id != null) map.id = this.id;
408
+ if (this.name != null) map.name = this.name;
409
+ if (this.ownerId != null) map.ownerId = this.ownerId;
410
+ if (this.ownerName != null) map.ownerName = this.ownerName;
411
+ if (this.ownerAvatar != null) map.ownerAvatar = this.ownerAvatar;
412
+ return map;
413
+ }
414
+ };
415
+ var AgencyInviteType = {
416
+ TO_BE_MEMBER: "to_be_member",
417
+ TO_BE_SUBAGENCY: "to_be_subagency"
418
+ };
419
+ var AgencyInvite = class {
420
+ constructor(id, type) {
421
+ if (id == null) throw new Error("id cannot be null");
422
+ if (type == null) throw new Error("type cannot be null");
423
+ this.text = null;
424
+ this.id = id;
425
+ this.type = type;
426
+ this.title = null;
427
+ this.message = null;
428
+ this.agencyInfo = null;
429
+ this.accepted = null;
430
+ }
431
+ getText() {
432
+ return this.text;
433
+ }
434
+ setText(text) {
435
+ this.text = text;
436
+ return this;
437
+ }
438
+ getId() {
439
+ return this.id;
440
+ }
441
+ setId(id) {
442
+ this.id = id;
443
+ return this;
444
+ }
445
+ getType() {
446
+ return this.type;
447
+ }
448
+ setType(type) {
449
+ this.type = type;
450
+ return this;
451
+ }
452
+ getTitle() {
453
+ return this.title;
454
+ }
455
+ setTitle(title) {
456
+ this.title = title;
457
+ return this;
458
+ }
459
+ getMessage() {
460
+ return this.message;
461
+ }
462
+ setMessage(message) {
463
+ this.message = message;
464
+ return this;
465
+ }
466
+ getAgencyInfo() {
467
+ return this.agencyInfo;
468
+ }
469
+ setAgencyInfo(agencyInfo) {
470
+ this.agencyInfo = agencyInfo;
471
+ return this;
472
+ }
473
+ getAccepted() {
474
+ return this.accepted;
475
+ }
476
+ setAccepted(accepted) {
477
+ this.accepted = accepted;
478
+ return this;
479
+ }
480
+ toMap() {
481
+ const map = {};
482
+ if (this.text != null) map.text = this.text;
483
+ if (this.id != null) map.id = this.id;
484
+ if (this.type != null) map.type = this.type;
485
+ if (this.title != null) map.title = this.title;
486
+ if (this.message != null) map.message = this.message;
487
+ if (this.agencyInfo != null) map.agencyInfo = this.agencyInfo.toMap();
488
+ if (this.accepted != null) map.accepted = this.accepted;
489
+ return map;
490
+ }
491
+ };
492
+ AgencyInvite.AgencyInfo = AgencyInfo;
493
+ AgencyInvite.AgencyInviteType = AgencyInviteType;
494
+ var AgencyInvite_default = AgencyInvite;
495
+
361
496
  // src/core/types/Action.js
362
497
  var Action = class {
363
498
  constructor(type, data) {
@@ -402,7 +537,8 @@ var ActionType = {
402
537
  GOBACK: "goback",
403
538
  ENTER_ROOM: "enter_room",
404
539
  LIVE_DETECT: "live_detect",
405
- ONELINK: "onelink"
540
+ ONELINK: "onelink",
541
+ AGENCY_INVITE: "agency_invite"
406
542
  };
407
543
  var ActionData = {
408
544
  Jump: Jump_default,
@@ -411,7 +547,8 @@ var ActionData = {
411
547
  Goback: Goback_default,
412
548
  EnterRoom: EnterRoom_default,
413
549
  LiveDetect: LiveDetect_default,
414
- Onelink: Onelink_default
550
+ Onelink: Onelink_default,
551
+ AgencyInvite: AgencyInvite_default
415
552
  };
416
553
  var ActionCreator = {
417
554
  ActionData,
@@ -493,6 +630,16 @@ var ActionCreator = {
493
630
  },
494
631
  createOnelinkActionWithData(onelink) {
495
632
  return new Action_default(ActionType.ONELINK, onelink);
633
+ },
634
+ // AgencyInvite
635
+ buildAgencyInvite(id, type) {
636
+ return new AgencyInvite_default(id, type);
637
+ },
638
+ createAgencyInviteAction(id, type) {
639
+ return new Action_default(ActionType.AGENCY_INVITE, new AgencyInvite_default(id, type));
640
+ },
641
+ createAgencyInviteActionWithData(agencyInvite) {
642
+ return new Action_default(ActionType.AGENCY_INVITE, agencyInvite);
496
643
  }
497
644
  };
498
645
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagolive/event-kit",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "YAGO Event Kit - 跨环境 Action 创建与通信工具库,支持浏览器、React、Vue",
5
5
  "main": "src/index.js",
6
6
  "browser": "build/js/action_bridge.umd.js",
@@ -72,6 +72,7 @@
72
72
  }
73
73
  },
74
74
  "scripts": {
75
+ "dev": "node scripts/build.js --watch && npx serve .",
75
76
  "build": "node scripts/build.js",
76
77
  "build:core": "node scripts/build.js --core",
77
78
  "build:bridge": "node scripts/build.js --bridge",
@@ -153,6 +153,20 @@ export default class ActionBridge {
153
153
  return ActionCreator.createOnelinkActionWithData(onelink);
154
154
  }
155
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
+
156
170
  destroy() {
157
171
  if (typeof this._adapter.destroy === 'function') {
158
172
  this._adapter.destroy();
@@ -1,5 +1,5 @@
1
1
  import {
2
- Action, Jump, Navigate, Replace, Goback, 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';
@@ -51,6 +51,11 @@ export declare class ActionBridge {
51
51
  createOnelinkAction(url: string): Action;
52
52
  createOnelinkActionWithData(onelink: Onelink): Action;
53
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
+
54
59
  destroy(): void;
55
60
 
56
61
  static ActionCreator: typeof ActionCreator;
@@ -5,6 +5,7 @@ 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 AgencyInvite from './types/AgencyInvite.js';
8
9
  import Action from './types/Action.js';
9
10
 
10
11
  const ActionType = {
@@ -15,6 +16,7 @@ const ActionType = {
15
16
  ENTER_ROOM: 'enter_room',
16
17
  LIVE_DETECT: 'live_detect',
17
18
  ONELINK: 'onelink',
19
+ AGENCY_INVITE: 'agency_invite',
18
20
  };
19
21
 
20
22
  const ActionData = {
@@ -25,6 +27,7 @@ const ActionData = {
25
27
  EnterRoom,
26
28
  LiveDetect,
27
29
  Onelink,
30
+ AgencyInvite,
28
31
  };
29
32
 
30
33
  const ActionCreator = {
@@ -131,6 +134,19 @@ const ActionCreator = {
131
134
  createOnelinkActionWithData(onelink) {
132
135
  return new Action(ActionType.ONELINK, onelink);
133
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
+ },
134
150
  };
135
151
 
136
152
  export { ActionCreator, ActionData, ActionType };
@@ -131,6 +131,58 @@ export class Onelink {
131
131
  toMap(): Record<string, any>;
132
132
  }
133
133
 
134
+ export class AgencyInfo {
135
+ id: string | null;
136
+ name: string | null;
137
+ ownerId: string | null;
138
+ ownerName: string | null;
139
+ ownerAvatar: string | null;
140
+ getId(): string | null;
141
+ setId(id: string): this;
142
+ getName(): string | null;
143
+ setName(name: string): this;
144
+ getOwnerId(): string | null;
145
+ setOwnerId(ownerId: string): this;
146
+ getOwnerName(): string | null;
147
+ setOwnerName(ownerName: string): this;
148
+ getOwnerAvatar(): string | null;
149
+ setOwnerAvatar(ownerAvatar: string): this;
150
+ toMap(): Record<string, any>;
151
+ }
152
+
153
+ export const AgencyInviteType: {
154
+ TO_BE_MEMBER: 'to_be_member';
155
+ TO_BE_SUBAGENCY: 'to_be_subagency';
156
+ };
157
+
158
+ export class AgencyInvite {
159
+ constructor(id: number, type: string);
160
+ text: string | null;
161
+ id: number;
162
+ type: string;
163
+ title: string | null;
164
+ message: string | null;
165
+ agencyInfo: AgencyInfo | null;
166
+ accepted: boolean | null;
167
+ static AgencyInfo: typeof AgencyInfo;
168
+ static AgencyInviteType: typeof AgencyInviteType;
169
+ getText(): string | null;
170
+ setText(text: string): this;
171
+ getId(): number;
172
+ setId(id: number): this;
173
+ getType(): string;
174
+ setType(type: string): this;
175
+ getTitle(): string | null;
176
+ setTitle(title: string): this;
177
+ getMessage(): string | null;
178
+ setMessage(message: string): this;
179
+ getAgencyInfo(): AgencyInfo | null;
180
+ setAgencyInfo(agencyInfo: AgencyInfo): this;
181
+ getAccepted(): boolean | null;
182
+ setAccepted(accepted: boolean): this;
183
+ toMap(): Record<string, any>;
184
+ }
185
+
134
186
  export class Action {
135
187
  constructor(type: ActionTypeValue, data: any);
136
188
  type: ActionTypeValue;
@@ -144,7 +196,7 @@ export class Action {
144
196
  toJson(): string;
145
197
  }
146
198
 
147
- export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink';
199
+ export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite';
148
200
 
149
201
  export const ActionType: {
150
202
  JUMP: 'jump';
@@ -154,6 +206,7 @@ export const ActionType: {
154
206
  ENTER_ROOM: 'enter_room';
155
207
  LIVE_DETECT: 'live_detect';
156
208
  ONELINK: 'onelink';
209
+ AGENCY_INVITE: 'agency_invite';
157
210
  };
158
211
 
159
212
  export const ActionData: {
@@ -164,6 +217,7 @@ export const ActionData: {
164
217
  EnterRoom: typeof EnterRoom;
165
218
  LiveDetect: typeof LiveDetect;
166
219
  Onelink: typeof Onelink;
220
+ AgencyInvite: typeof AgencyInvite;
167
221
  };
168
222
 
169
223
  export const ActionCreator: {
@@ -192,4 +246,7 @@ export const ActionCreator: {
192
246
  buildOnelink(url: string): Onelink;
193
247
  createOnelinkAction(url: string): Action;
194
248
  createOnelinkActionWithData(onelink: Onelink): Action;
249
+ buildAgencyInvite(id: number, type: string): AgencyInvite;
250
+ createAgencyInviteAction(id: number, type: string): Action;
251
+ createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
195
252
  };
package/src/core/index.js CHANGED
@@ -6,4 +6,5 @@ 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 AgencyInvite } from './types/AgencyInvite.js';
9
10
  export { default as Action } from './types/Action.js';
@@ -0,0 +1,62 @@
1
+ class AgencyInfo {
2
+ constructor() { this.id = null; this.name = null; this.ownerId = null; this.ownerName = null; this.ownerAvatar = 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
+ getOwnerAvatar() { return this.ownerAvatar; } setOwnerAvatar(ownerAvatar) { this.ownerAvatar = ownerAvatar; return this; }
8
+
9
+ toMap() {
10
+ const map = {};
11
+ if (this.id != null) map.id = this.id;
12
+ if (this.name != null) map.name = this.name;
13
+ if (this.ownerId != null) map.ownerId = this.ownerId;
14
+ if (this.ownerName != null) map.ownerName = this.ownerName;
15
+ if (this.ownerAvatar != null) map.ownerAvatar = this.ownerAvatar;
16
+ return map;
17
+ }
18
+ }
19
+
20
+ const AgencyInviteType = {
21
+ TO_BE_MEMBER: 'to_be_member',
22
+ TO_BE_SUBAGENCY: 'to_be_subagency',
23
+ };
24
+
25
+ class AgencyInvite {
26
+ constructor(id, type) {
27
+ if (id == null) throw new Error('id cannot be null');
28
+ if (type == null) throw new Error('type cannot be null');
29
+ this.text = null;
30
+ this.id = id;
31
+ this.type = type;
32
+ this.title = null;
33
+ this.message = null;
34
+ this.agencyInfo = null;
35
+ this.accepted = null;
36
+ }
37
+
38
+ getText() { return this.text; } setText(text) { this.text = text; return this; }
39
+ getId() { return this.id; } setId(id) { this.id = id; return this; }
40
+ getType() { return this.type; } setType(type) { this.type = type; return this; }
41
+ getTitle() { return this.title; } setTitle(title) { this.title = title; return this; }
42
+ getMessage() { return this.message; } setMessage(message) { this.message = message; return this; }
43
+ getAgencyInfo() { return this.agencyInfo; } setAgencyInfo(agencyInfo) { this.agencyInfo = agencyInfo; return this; }
44
+ getAccepted() { return this.accepted; } setAccepted(accepted) { this.accepted = accepted; return this; }
45
+
46
+ toMap() {
47
+ const map = {};
48
+ if (this.text != null) map.text = this.text;
49
+ if (this.id != null) map.id = this.id;
50
+ if (this.type != null) map.type = this.type;
51
+ if (this.title != null) map.title = this.title;
52
+ if (this.message != null) map.message = this.message;
53
+ if (this.agencyInfo != null) map.agencyInfo = this.agencyInfo.toMap();
54
+ if (this.accepted != null) map.accepted = this.accepted;
55
+ return map;
56
+ }
57
+ }
58
+
59
+ AgencyInvite.AgencyInfo = AgencyInfo;
60
+ AgencyInvite.AgencyInviteType = AgencyInviteType;
61
+
62
+ export default AgencyInvite;
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, 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
@@ -8,4 +8,5 @@ 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 { AgencyInvite } from './core/index.js';
11
12
  export { Action } from './core/index.js';