@yagolive/event-kit 1.0.3 → 1.0.6

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,94 @@
1
1
  # Changelog
2
2
 
3
+ ## @1.0.6 (2026-06-09)
4
+
5
+ ### 新增
6
+
7
+ - **Close Action(addon 附加类型)**: 新增关闭 WebView 窗口动作类型
8
+ - `ActionType.CLOSE` = `'close'`
9
+ - `Close` 数据类:仅含 `text` 可选字段(继承自 `Base`)
10
+ - `ActionCreator.buildClose()`、`createCloseAction()`、`createCloseActionWithData()`
11
+ - `ActionBridge.close()`、`buildClose()`、`createCloseAction()`、`createCloseActionWithData()`
12
+ - 来源:`packages/@yagolive/event_kit/addon.ts` 中的 `AddonAction`,由宿主容器扩展
13
+
14
+ - **Config Action(addon 附加类型)**: 新增配置 WebView 主题/品牌色动作类型
15
+ - `ActionType.CONFIG` = `'config'`
16
+ - `Config` 数据类:可选字段 `theme`(`'dark' | 'light'`)、`brandColor`(string)、`tintColor`(string)、`title`(string,页面标题)、`text`
17
+ - `Config.Theme` 枚举:`DARK = 'dark'`、`LIGHT = 'light'`
18
+ - `ActionCreator.buildConfig()`、`createConfigAction()`、`createConfigActionWithData()`
19
+ - `ActionBridge.config(options?)`、`buildConfig()`、`createConfigAction()`、`createConfigActionWithData()`
20
+ - `bridge.config()` 便捷方法接受 `{ theme?, brandColor?, tintColor?, title? }` 配置对象
21
+ - 来源:`packages/@yagolive/event_kit/addon.ts` 中的 `AddonAction`,由宿主容器扩展
22
+
23
+ ### Action 类型完整列表
24
+
25
+ | 类型 | 字段 | 说明 |
26
+ |------|------|------|
27
+ | jump | path: string, text?: string | 页面跳转 |
28
+ | navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
29
+ | replace | screen: string, params?: Record, text?: string | 替换当前页面 |
30
+ | goback | text?: string | 返回上一页 |
31
+ | enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
32
+ | live_detect | text?: string | 活体检测 |
33
+ | onelink | url: string, share?: boolean, text?: string | 分享链接 |
34
+ | agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
35
+ | recharge | text?: string | 充值操作 |
36
+ | close | text?: string | 关闭 WebView 窗口(addon 附加) |
37
+ | config | theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string, text?: string | 配置 WebView 主题(addon 附加) |
38
+
39
+ ---
40
+
41
+ ## @1.0.5 (2026-06-08)
42
+
43
+ ### 新增
44
+
45
+ - **Recharge Action**: 新增充值操作动作类型
46
+ - `ActionType.RECHARGE` = `'recharge'`
47
+ - `Recharge` 数据类:仅含 `text` 可选字段(继承自 `Base`)
48
+ - `ActionCreator.buildRecharge()`、`createRechargeAction()`、`createRechargeActionWithData()`
49
+ - `ActionBridge.recharge()`、`buildRecharge()`、`createRechargeAction()`、`createRechargeActionWithData()`
50
+
51
+ ### Action 类型完整列表
52
+
53
+ | 类型 | 字段 | 说明 |
54
+ |------|------|------|
55
+ | jump | path: string, text?: string | 页面跳转 |
56
+ | navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
57
+ | replace | screen: string, params?: Record, text?: string | 替换当前页面 |
58
+ | goback | text?: string | 返回上一页 |
59
+ | enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
60
+ | live_detect | text?: string | 活体检测 |
61
+ | onelink | url: string, share?: boolean, text?: string | 分享链接 |
62
+ | agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
63
+ | recharge | text?: string | 充值操作 |
64
+
65
+ ---
66
+
67
+ ## @1.0.4 (2026-05-28)
68
+
69
+ ### 修改
70
+
71
+ - **EnterRoom.match 字段类型规范化**: 明确 `match` 字段类型为 `BSRoomMatchType` 枚举值
72
+ - 支持的匹配类型:`'recommend'`(推荐房间列表)、`'follow'`(关注)、`'agency'`(本公会的公会房)
73
+ - 移除了之前兼容的 `'hot'`、`'top3'` 字符串值
74
+ - JS/d.ts 类型保持 `string | null`,确保向后兼容性
75
+ - 测试页面新增 `testEnterRoomWithMatch()` 函数用于测试匹配模式
76
+
77
+ ### Action 类型完整列表
78
+
79
+ | 类型 | 字段 | 说明 |
80
+ |------|------|------|
81
+ | jump | path: string, text?: string | 页面跳转 |
82
+ | navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
83
+ | replace | screen: string, params?: Record, text?: string | 替换当前页面 |
84
+ | goback | text?: string | 返回上一页 |
85
+ | enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
86
+ | live_detect | text?: string | 活体检测 |
87
+ | onelink | url: string, share?: boolean, text?: string | 分享链接 |
88
+ | agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
89
+
90
+ ---
91
+
3
92
  ## @1.0.3 (2026-05-27)
4
93
 
5
94
  ### 修改
package/README.md CHANGED
@@ -21,6 +21,10 @@ YAGO App Action 创建与通信工具库,支持浏览器、React、Vue 等多
21
21
  └─────────────────────────────────────────────────────┘
22
22
  ```
23
23
 
24
+ ## 更新日志
25
+
26
+ 详细更新日志请查看 [CHANGELOG](./CHANGELOG.md)。
27
+
24
28
  ## 安装
25
29
 
26
30
  ```bash
@@ -165,8 +169,8 @@ import { ActionCreator } from '@yagolive/event-kit';
165
169
 
166
170
  | 属性 | 类型 | 说明 |
167
171
  |------|------|------|
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 |
172
+ | `ActionData` | Object | 包含所有数据类型类:Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, Recharge, Close, Config |
173
+ | `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, GOBACK, ENTER_ROOM, LIVE_DETECT, ONELINK, AGENCY_INVITE, RECHARGE, CLOSE, CONFIG |
170
174
 
171
175
  #### 工厂方法
172
176
 
@@ -198,6 +202,15 @@ import { ActionCreator } from '@yagolive/event-kit';
198
202
  | `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
199
203
  | `createAgencyInviteAction(id, type)` | id: number, type: string | Action | 创建工会邀请 Action |
200
204
  | `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action |
205
+ | `buildRecharge()` | - | Recharge | 构建 Recharge 对象(链式配置) |
206
+ | `createRechargeAction()` | - | Action | 创建充值 Action |
207
+ | `createRechargeActionWithData(recharge)` | recharge: Recharge | Action | 从 Recharge 对象创建 Action |
208
+ | `buildClose()` | - | Close | 构建 Close 对象(链式配置,addon) |
209
+ | `createCloseAction()` | - | Action | 创建关闭 Action(addon) |
210
+ | `createCloseActionWithData(close)` | close: Close | Action | 从 Close 对象创建 Action(addon) |
211
+ | `buildConfig()` | - | Config | 构建 Config 对象(链式配置,addon) |
212
+ | `createConfigAction()` | - | Action | 创建配置 Action(addon) |
213
+ | `createConfigActionWithData(config)` | config: Config | Action | 从 Config 对象创建 Action(addon) |
201
214
 
202
215
  #### 使用示例
203
216
 
@@ -239,6 +252,9 @@ ActionType.ENTER_ROOM // 'enter_room'
239
252
  ActionType.LIVE_DETECT // 'live_detect'
240
253
  ActionType.ONELINK // 'onelink'
241
254
  ActionType.AGENCY_INVITE // 'agency_invite'
255
+ ActionType.RECHARGE // 'recharge'
256
+ ActionType.CLOSE // 'close' (addon)
257
+ ActionType.CONFIG // 'config' (addon)
242
258
  ```
243
259
 
244
260
  ### ActionBridge
@@ -309,6 +325,15 @@ new ActionBridge(adapter, options?)
309
325
  | `agencyInvite(id, type)` | id: number, type: string | Promise | 工会邀请 |
310
326
  | `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
311
327
  | `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action(不自动发送) |
328
+ | `recharge()` | - | Promise | 充值操作 |
329
+ | `buildRecharge()` | - | Recharge | 构建 Recharge 对象(链式配置) |
330
+ | `createRechargeActionWithData(recharge)` | recharge: Recharge | Action | 从 Recharge 对象创建 Action(不自动发送) |
331
+ | `close()` | - | Promise | 关闭 WebView 窗口(addon) |
332
+ | `buildClose()` | - | Close | 构建 Close 对象(链式配置,addon) |
333
+ | `createCloseActionWithData(close)` | close: Close | Action | 从 Close 对象创建 Action(addon) |
334
+ | `config(options?)` | options?: { theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string } | Promise | 配置 WebView 主题色(addon) |
335
+ | `buildConfig()` | - | Config | 构建 Config 对象(链式配置,addon) |
336
+ | `createConfigActionWithData(config)` | config: Config | Action | 从 Config 对象创建 Action(addon) |
312
337
 
313
338
  #### 静态方法
314
339
 
@@ -668,6 +693,42 @@ Onelink Action 数据。
668
693
  | `setOwnerName(ownerName)` | ownerName: string | 设置工会长名称,返回 this |
669
694
  | `setOwnerAvatar(ownerAvatar)` | ownerAvatar: string | 设置工会长头像 URL,返回 this |
670
695
 
696
+ ### Recharge
697
+
698
+ 充值操作 Action 数据。
699
+
700
+ | 方法 | 参数 | 说明 |
701
+ |------|------|------|
702
+ | `constructor()` | - | 创建充值数据 |
703
+ | `setText(text)` | text: string | 设置显示文本,返回 this |
704
+
705
+ ### Close(addon 附加)
706
+
707
+ 关闭 WebView 窗口 Action 数据。来源于 `addon.ts` 的 `AddonAction`,由宿主容器扩展。
708
+
709
+ | 方法 | 参数 | 说明 |
710
+ |------|------|------|
711
+ | `constructor()` | - | 创建 Close 数据 |
712
+ | `setText(text)` | text: string | 设置显示文本,返回 this |
713
+
714
+ ### Config(addon 附加)
715
+
716
+ 配置 WebView 主题色等参数 Action 数据。来源于 `addon.ts` 的 `AddonAction`,由宿主容器扩展。
717
+
718
+ | 方法 | 参数 | 说明 |
719
+ |------|------|------|
720
+ | `constructor()` | - | 创建 Config 数据 |
721
+ | `setText(text)` | text: string | 设置显示文本,返回 this |
722
+ | `setTheme(theme)` | theme: 'dark' \| 'light' | 设置主题,返回 this |
723
+ | `setBrandColor(brandColor)` | brandColor: string | 设置品牌色,返回 this |
724
+ | `setTintColor(tintColor)` | tintColor: string | 设置主题色,返回 this |
725
+ | `setTitle(title)` | title: string | 设置页面标题,返回 this |
726
+
727
+ **静态属性**:
728
+
729
+ - `Config.Theme.DARK` = `'dark'`
730
+ - `Config.Theme.LIGHT` = `'light'`
731
+
671
732
  ### Action
672
733
 
673
734
  Action 对象,封装类型和数据。
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * YAGO Event Kit - Action Bridge (Full)
3
- * @version 1.0.3
3
+ * @version 1.0.6
4
4
  *
5
5
  * Generated by build script - do not edit manually.
6
6
  * Supports: Browser script tag, CommonJS, AMD
@@ -493,6 +493,106 @@ AgencyInvite.AgencyInfo = AgencyInfo;
493
493
  AgencyInvite.AgencyInviteType = AgencyInviteType;
494
494
  var AgencyInvite_default = AgencyInvite;
495
495
 
496
+ // src/core/types/Recharge.js
497
+ var Recharge = class {
498
+ constructor() {
499
+ this.text = null;
500
+ }
501
+ getText() {
502
+ return this.text;
503
+ }
504
+ setText(text) {
505
+ this.text = text;
506
+ return this;
507
+ }
508
+ toMap() {
509
+ var map = {};
510
+ if (this.text != null) map.text = this.text;
511
+ return map;
512
+ }
513
+ };
514
+ var Recharge_default = Recharge;
515
+
516
+ // src/core/types/Close.js
517
+ var Close = class {
518
+ constructor() {
519
+ this.text = null;
520
+ }
521
+ getText() {
522
+ return this.text;
523
+ }
524
+ setText(text) {
525
+ this.text = text;
526
+ return this;
527
+ }
528
+ toMap() {
529
+ const map = {};
530
+ if (this.text != null) map.text = this.text;
531
+ return map;
532
+ }
533
+ };
534
+ var Close_default = Close;
535
+
536
+ // src/core/types/Config.js
537
+ var Config = class {
538
+ constructor() {
539
+ this.text = null;
540
+ this.theme = null;
541
+ this.brandColor = null;
542
+ this.tintColor = null;
543
+ this.title = null;
544
+ }
545
+ getText() {
546
+ return this.text;
547
+ }
548
+ setText(text) {
549
+ this.text = text;
550
+ return this;
551
+ }
552
+ getTheme() {
553
+ return this.theme;
554
+ }
555
+ setTheme(theme) {
556
+ this.theme = theme;
557
+ return this;
558
+ }
559
+ getBrandColor() {
560
+ return this.brandColor;
561
+ }
562
+ setBrandColor(brandColor) {
563
+ this.brandColor = brandColor;
564
+ return this;
565
+ }
566
+ getTintColor() {
567
+ return this.tintColor;
568
+ }
569
+ setTintColor(tintColor) {
570
+ this.tintColor = tintColor;
571
+ return this;
572
+ }
573
+ getTitle() {
574
+ return this.title;
575
+ }
576
+ setTitle(title) {
577
+ this.title = title;
578
+ return this;
579
+ }
580
+ toMap() {
581
+ const map = {};
582
+ if (this.text != null) map.text = this.text;
583
+ if (this.theme != null) map.theme = this.theme;
584
+ if (this.brandColor != null) map.brandColor = this.brandColor;
585
+ if (this.tintColor != null) map.tintColor = this.tintColor;
586
+ if (this.title != null) map.title = this.title;
587
+ return map;
588
+ }
589
+ };
590
+ Config.Theme = {
591
+ DARK: "dark",
592
+ LIGHT: "light"
593
+ };
594
+ var Config_default = Config;
595
+
496
596
  // src/core/types/Action.js
497
597
  var Action = class {
498
598
  constructor(type, data) {
@@ -538,7 +638,10 @@ var ActionType = {
538
638
  ENTER_ROOM: "enter_room",
539
639
  LIVE_DETECT: "live_detect",
540
640
  ONELINK: "onelink",
541
- AGENCY_INVITE: "agency_invite"
641
+ AGENCY_INVITE: "agency_invite",
642
+ RECHARGE: "recharge",
643
+ CLOSE: "close",
644
+ CONFIG: "config"
542
645
  };
543
646
  var ActionData = {
544
647
  Jump: Jump_default,
@@ -548,7 +651,10 @@ var ActionData = {
548
651
  EnterRoom: EnterRoom_default,
549
652
  LiveDetect: LiveDetect_default,
550
653
  Onelink: Onelink_default,
551
- AgencyInvite: AgencyInvite_default
654
+ AgencyInvite: AgencyInvite_default,
655
+ Recharge: Recharge_default,
656
+ Close: Close_default,
657
+ Config: Config_default
552
658
  };
553
659
  var ActionCreator = {
554
660
  ActionData,
@@ -640,6 +746,36 @@ var ActionCreator = {
640
746
  },
641
747
  createAgencyInviteActionWithData(agencyInvite) {
642
748
  return new Action_default(ActionType.AGENCY_INVITE, agencyInvite);
749
+ },
750
+ // Recharge
751
+ buildRecharge() {
752
+ return new Recharge_default();
753
+ },
754
+ createRechargeAction() {
755
+ return new Action_default(ActionType.RECHARGE, new Recharge_default());
756
+ },
757
+ createRechargeActionWithData(recharge) {
758
+ return new Action_default(ActionType.RECHARGE, recharge);
759
+ },
760
+ // Close
761
+ buildClose() {
762
+ return new Close_default();
763
+ },
764
+ createCloseAction() {
765
+ return new Action_default(ActionType.CLOSE, new Close_default());
766
+ },
767
+ createCloseActionWithData(close) {
768
+ return new Action_default(ActionType.CLOSE, close);
769
+ },
770
+ // Config
771
+ buildConfig() {
772
+ return new Config_default();
773
+ },
774
+ createConfigAction() {
775
+ return new Action_default(ActionType.CONFIG, new Config_default());
776
+ },
777
+ createConfigActionWithData(config) {
778
+ return new Action_default(ActionType.CONFIG, config);
643
779
  }
644
780
  };
645
781
 
@@ -915,6 +1051,49 @@ var ActionBridge = class _ActionBridge {
915
1051
  createAgencyInviteActionWithData(agencyInvite) {
916
1052
  return ActionCreator.createAgencyInviteActionWithData(agencyInvite);
917
1053
  }
1054
+ recharge() {
1055
+ return this._adapter.sendAction(ActionCreator.createRechargeAction());
1056
+ }
1057
+ buildRecharge() {
1058
+ return ActionCreator.buildRecharge();
1059
+ }
1060
+ createRechargeAction() {
1061
+ return ActionCreator.createRechargeAction();
1062
+ }
1063
+ createRechargeActionWithData(recharge) {
1064
+ return ActionCreator.createRechargeActionWithData(recharge);
1065
+ }
1066
+ close() {
1067
+ return this._adapter.sendAction(ActionCreator.createCloseAction());
1068
+ }
1069
+ buildClose() {
1070
+ return ActionCreator.buildClose();
1071
+ }
1072
+ createCloseAction() {
1073
+ return ActionCreator.createCloseAction();
1074
+ }
1075
+ createCloseActionWithData(close) {
1076
+ return ActionCreator.createCloseActionWithData(close);
1077
+ }
1078
+ config(options) {
1079
+ var data = ActionCreator.buildConfig();
1080
+ if (options) {
1081
+ if (options.theme != null) data.setTheme(options.theme);
1082
+ if (options.brandColor != null) data.setBrandColor(options.brandColor);
1083
+ if (options.tintColor != null) data.setTintColor(options.tintColor);
1084
+ if (options.title != null) data.setTitle(options.title);
1085
+ }
1086
+ return this._adapter.sendAction(ActionCreator.createConfigActionWithData(data));
1087
+ }
1088
+ buildConfig() {
1089
+ return ActionCreator.buildConfig();
1090
+ }
1091
+ createConfigAction() {
1092
+ return ActionCreator.createConfigAction();
1093
+ }
1094
+ createConfigActionWithData(config) {
1095
+ return ActionCreator.createConfigActionWithData(config);
1096
+ }
918
1097
  destroy() {
919
1098
  if (typeof this._adapter.destroy === "function") {
920
1099
  this._adapter.destroy();
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * YAGO Event Kit - Action Creator (Core Only)
3
- * @version 1.0.3
3
+ * @version 1.0.6
4
4
  *
5
5
  * Generated by build script - do not edit manually.
6
6
  * Supports: Browser script tag, CommonJS, AMD
@@ -493,6 +493,106 @@ AgencyInvite.AgencyInfo = AgencyInfo;
493
493
  AgencyInvite.AgencyInviteType = AgencyInviteType;
494
494
  var AgencyInvite_default = AgencyInvite;
495
495
 
496
+ // src/core/types/Recharge.js
497
+ var Recharge = class {
498
+ constructor() {
499
+ this.text = null;
500
+ }
501
+ getText() {
502
+ return this.text;
503
+ }
504
+ setText(text) {
505
+ this.text = text;
506
+ return this;
507
+ }
508
+ toMap() {
509
+ var map = {};
510
+ if (this.text != null) map.text = this.text;
511
+ return map;
512
+ }
513
+ };
514
+ var Recharge_default = Recharge;
515
+
516
+ // src/core/types/Close.js
517
+ var Close = class {
518
+ constructor() {
519
+ this.text = null;
520
+ }
521
+ getText() {
522
+ return this.text;
523
+ }
524
+ setText(text) {
525
+ this.text = text;
526
+ return this;
527
+ }
528
+ toMap() {
529
+ const map = {};
530
+ if (this.text != null) map.text = this.text;
531
+ return map;
532
+ }
533
+ };
534
+ var Close_default = Close;
535
+
536
+ // src/core/types/Config.js
537
+ var Config = class {
538
+ constructor() {
539
+ this.text = null;
540
+ this.theme = null;
541
+ this.brandColor = null;
542
+ this.tintColor = null;
543
+ this.title = null;
544
+ }
545
+ getText() {
546
+ return this.text;
547
+ }
548
+ setText(text) {
549
+ this.text = text;
550
+ return this;
551
+ }
552
+ getTheme() {
553
+ return this.theme;
554
+ }
555
+ setTheme(theme) {
556
+ this.theme = theme;
557
+ return this;
558
+ }
559
+ getBrandColor() {
560
+ return this.brandColor;
561
+ }
562
+ setBrandColor(brandColor) {
563
+ this.brandColor = brandColor;
564
+ return this;
565
+ }
566
+ getTintColor() {
567
+ return this.tintColor;
568
+ }
569
+ setTintColor(tintColor) {
570
+ this.tintColor = tintColor;
571
+ return this;
572
+ }
573
+ getTitle() {
574
+ return this.title;
575
+ }
576
+ setTitle(title) {
577
+ this.title = title;
578
+ return this;
579
+ }
580
+ toMap() {
581
+ const map = {};
582
+ if (this.text != null) map.text = this.text;
583
+ if (this.theme != null) map.theme = this.theme;
584
+ if (this.brandColor != null) map.brandColor = this.brandColor;
585
+ if (this.tintColor != null) map.tintColor = this.tintColor;
586
+ if (this.title != null) map.title = this.title;
587
+ return map;
588
+ }
589
+ };
590
+ Config.Theme = {
591
+ DARK: "dark",
592
+ LIGHT: "light"
593
+ };
594
+ var Config_default = Config;
595
+
496
596
  // src/core/types/Action.js
497
597
  var Action = class {
498
598
  constructor(type, data) {
@@ -538,7 +638,10 @@ var ActionType = {
538
638
  ENTER_ROOM: "enter_room",
539
639
  LIVE_DETECT: "live_detect",
540
640
  ONELINK: "onelink",
541
- AGENCY_INVITE: "agency_invite"
641
+ AGENCY_INVITE: "agency_invite",
642
+ RECHARGE: "recharge",
643
+ CLOSE: "close",
644
+ CONFIG: "config"
542
645
  };
543
646
  var ActionData = {
544
647
  Jump: Jump_default,
@@ -548,7 +651,10 @@ var ActionData = {
548
651
  EnterRoom: EnterRoom_default,
549
652
  LiveDetect: LiveDetect_default,
550
653
  Onelink: Onelink_default,
551
- AgencyInvite: AgencyInvite_default
654
+ AgencyInvite: AgencyInvite_default,
655
+ Recharge: Recharge_default,
656
+ Close: Close_default,
657
+ Config: Config_default
552
658
  };
553
659
  var ActionCreator = {
554
660
  ActionData,
@@ -640,6 +746,36 @@ var ActionCreator = {
640
746
  },
641
747
  createAgencyInviteActionWithData(agencyInvite) {
642
748
  return new Action_default(ActionType.AGENCY_INVITE, agencyInvite);
749
+ },
750
+ // Recharge
751
+ buildRecharge() {
752
+ return new Recharge_default();
753
+ },
754
+ createRechargeAction() {
755
+ return new Action_default(ActionType.RECHARGE, new Recharge_default());
756
+ },
757
+ createRechargeActionWithData(recharge) {
758
+ return new Action_default(ActionType.RECHARGE, recharge);
759
+ },
760
+ // Close
761
+ buildClose() {
762
+ return new Close_default();
763
+ },
764
+ createCloseAction() {
765
+ return new Action_default(ActionType.CLOSE, new Close_default());
766
+ },
767
+ createCloseActionWithData(close) {
768
+ return new Action_default(ActionType.CLOSE, close);
769
+ },
770
+ // Config
771
+ buildConfig() {
772
+ return new Config_default();
773
+ },
774
+ createConfigAction() {
775
+ return new Action_default(ActionType.CONFIG, new Config_default());
776
+ },
777
+ createConfigActionWithData(config) {
778
+ return new Action_default(ActionType.CONFIG, config);
643
779
  }
644
780
  };
645
781
 
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "name": "@yagolive/event-kit",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "YAGO Event Kit - 跨环境 Action 创建与通信工具库,支持浏览器、React、Vue",
5
5
  "main": "src/index.js",
6
- "browser": "build/js/action_bridge.umd.js",
6
+ "browser": "dist/js/action_bridge.umd.js",
7
7
  "types": "src/index.d.ts",
8
8
  "files": [
9
9
  "src/",
10
- "build/",
10
+ "dist/",
11
11
  "CHANGELOG.md"
12
12
  ],
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./src/index.d.ts",
16
- "browser": "./build/js/action_bridge.umd.js",
16
+ "browser": "./dist/js/action_bridge.umd.js",
17
17
  "import": "./src/index.js",
18
18
  "require": "./src/index.js",
19
19
  "default": "./src/index.js"
20
20
  },
21
21
  "./core": {
22
22
  "types": "./src/core/index.d.ts",
23
- "browser": "./build/js/action_creator.umd.js",
23
+ "browser": "./dist/js/action_creator.umd.js",
24
24
  "import": "./src/core/index.js",
25
25
  "require": "./src/core/index.js",
26
26
  "default": "./src/core/index.js"
@@ -167,6 +167,55 @@ export default class ActionBridge {
167
167
  return ActionCreator.createAgencyInviteActionWithData(agencyInvite);
168
168
  }
169
169
 
170
+ recharge() {
171
+ return this._adapter.sendAction(ActionCreator.createRechargeAction());
172
+ }
173
+
174
+ buildRecharge() {
175
+ return ActionCreator.buildRecharge();
176
+ }
177
+ createRechargeAction() {
178
+ return ActionCreator.createRechargeAction();
179
+ }
180
+ createRechargeActionWithData(recharge) {
181
+ return ActionCreator.createRechargeActionWithData(recharge);
182
+ }
183
+
184
+ close() {
185
+ return this._adapter.sendAction(ActionCreator.createCloseAction());
186
+ }
187
+
188
+ buildClose() {
189
+ return ActionCreator.buildClose();
190
+ }
191
+ createCloseAction() {
192
+ return ActionCreator.createCloseAction();
193
+ }
194
+ createCloseActionWithData(close) {
195
+ return ActionCreator.createCloseActionWithData(close);
196
+ }
197
+
198
+ config(options) {
199
+ var data = ActionCreator.buildConfig();
200
+ if (options) {
201
+ if (options.theme != null) data.setTheme(options.theme);
202
+ if (options.brandColor != null) data.setBrandColor(options.brandColor);
203
+ if (options.tintColor != null) data.setTintColor(options.tintColor);
204
+ if (options.title != null) data.setTitle(options.title);
205
+ }
206
+ return this._adapter.sendAction(ActionCreator.createConfigActionWithData(data));
207
+ }
208
+
209
+ buildConfig() {
210
+ return ActionCreator.buildConfig();
211
+ }
212
+ createConfigAction() {
213
+ return ActionCreator.createConfigAction();
214
+ }
215
+ createConfigActionWithData(config) {
216
+ return ActionCreator.createConfigActionWithData(config);
217
+ }
218
+
170
219
  destroy() {
171
220
  if (typeof this._adapter.destroy === 'function') {
172
221
  this._adapter.destroy();
@@ -1,5 +1,5 @@
1
1
  import {
2
- Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite,
2
+ Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, Recharge, Close, Config,
3
3
  ActionType, ActionData, ActionCreator,
4
4
  } from '../core/index.js';
5
5
  import { IActionAdapter, RNWebViewAdapter, MockAdapter, AdapterOptions } from '../adapters/index.js';
@@ -56,6 +56,21 @@ export declare class ActionBridge {
56
56
  createAgencyInviteAction(id: number, type: string): Action;
57
57
  createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
58
58
 
59
+ recharge(): Promise<any>;
60
+ buildRecharge(): Recharge;
61
+ createRechargeAction(): Action;
62
+ createRechargeActionWithData(recharge: Recharge): Action;
63
+
64
+ close(): Promise<any>;
65
+ buildClose(): Close;
66
+ createCloseAction(): Action;
67
+ createCloseActionWithData(close: Close): Action;
68
+
69
+ config(options?: { theme?: 'dark' | 'light'; brandColor?: string; tintColor?: string; title?: string }): Promise<any>;
70
+ buildConfig(): Config;
71
+ createConfigAction(): Action;
72
+ createConfigActionWithData(config: Config): Action;
73
+
59
74
  destroy(): void;
60
75
 
61
76
  static ActionCreator: typeof ActionCreator;
@@ -6,6 +6,9 @@ import Goback from './types/Goback.js';
6
6
  import LiveDetect from './types/LiveDetect.js';
7
7
  import Onelink from './types/Onelink.js';
8
8
  import AgencyInvite from './types/AgencyInvite.js';
9
+ import Recharge from './types/Recharge.js';
10
+ import Close from './types/Close.js';
11
+ import Config from './types/Config.js';
9
12
  import Action from './types/Action.js';
10
13
 
11
14
  const ActionType = {
@@ -17,6 +20,9 @@ const ActionType = {
17
20
  LIVE_DETECT: 'live_detect',
18
21
  ONELINK: 'onelink',
19
22
  AGENCY_INVITE: 'agency_invite',
23
+ RECHARGE: 'recharge',
24
+ CLOSE: 'close',
25
+ CONFIG: 'config',
20
26
  };
21
27
 
22
28
  const ActionData = {
@@ -28,6 +34,9 @@ const ActionData = {
28
34
  LiveDetect,
29
35
  Onelink,
30
36
  AgencyInvite,
37
+ Recharge,
38
+ Close,
39
+ Config,
31
40
  };
32
41
 
33
42
  const ActionCreator = {
@@ -147,6 +156,45 @@ const ActionCreator = {
147
156
  createAgencyInviteActionWithData(agencyInvite) {
148
157
  return new Action(ActionType.AGENCY_INVITE, agencyInvite);
149
158
  },
159
+
160
+ // Recharge
161
+ buildRecharge() {
162
+ return new Recharge();
163
+ },
164
+
165
+ createRechargeAction() {
166
+ return new Action(ActionType.RECHARGE, new Recharge());
167
+ },
168
+
169
+ createRechargeActionWithData(recharge) {
170
+ return new Action(ActionType.RECHARGE, recharge);
171
+ },
172
+
173
+ // Close
174
+ buildClose() {
175
+ return new Close();
176
+ },
177
+
178
+ createCloseAction() {
179
+ return new Action(ActionType.CLOSE, new Close());
180
+ },
181
+
182
+ createCloseActionWithData(close) {
183
+ return new Action(ActionType.CLOSE, close);
184
+ },
185
+
186
+ // Config
187
+ buildConfig() {
188
+ return new Config();
189
+ },
190
+
191
+ createConfigAction() {
192
+ return new Action(ActionType.CONFIG, new Config());
193
+ },
194
+
195
+ createConfigActionWithData(config) {
196
+ return new Action(ActionType.CONFIG, config);
197
+ },
150
198
  };
151
199
 
152
200
  export { ActionCreator, ActionData, ActionType };
@@ -183,6 +183,48 @@ export class AgencyInvite {
183
183
  toMap(): Record<string, any>;
184
184
  }
185
185
 
186
+ export class Recharge {
187
+ constructor();
188
+ text: string | null;
189
+ getText(): string | null;
190
+ setText(text: string): this;
191
+ toMap(): Record<string, any>;
192
+ }
193
+
194
+ export class Close {
195
+ constructor();
196
+ text: string | null;
197
+ getText(): string | null;
198
+ setText(text: string): this;
199
+ toMap(): Record<string, any>;
200
+ }
201
+
202
+ export const ConfigTheme: {
203
+ DARK: 'dark';
204
+ LIGHT: 'light';
205
+ };
206
+
207
+ export class Config {
208
+ constructor();
209
+ text: string | null;
210
+ theme: 'dark' | 'light' | null;
211
+ brandColor: string | null;
212
+ tintColor: string | null;
213
+ title: string | null;
214
+ static Theme: typeof ConfigTheme;
215
+ getText(): string | null;
216
+ setText(text: string): this;
217
+ getTheme(): 'dark' | 'light' | null;
218
+ setTheme(theme: 'dark' | 'light'): this;
219
+ getBrandColor(): string | null;
220
+ setBrandColor(brandColor: string): this;
221
+ getTintColor(): string | null;
222
+ setTintColor(tintColor: string): this;
223
+ getTitle(): string | null;
224
+ setTitle(title: string): this;
225
+ toMap(): Record<string, any>;
226
+ }
227
+
186
228
  export class Action {
187
229
  constructor(type: ActionTypeValue, data: any);
188
230
  type: ActionTypeValue;
@@ -196,7 +238,7 @@ export class Action {
196
238
  toJson(): string;
197
239
  }
198
240
 
199
- export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite';
241
+ export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite' | 'recharge' | 'close' | 'config';
200
242
 
201
243
  export const ActionType: {
202
244
  JUMP: 'jump';
@@ -207,6 +249,9 @@ export const ActionType: {
207
249
  LIVE_DETECT: 'live_detect';
208
250
  ONELINK: 'onelink';
209
251
  AGENCY_INVITE: 'agency_invite';
252
+ RECHARGE: 'recharge';
253
+ CLOSE: 'close';
254
+ CONFIG: 'config';
210
255
  };
211
256
 
212
257
  export const ActionData: {
@@ -218,6 +263,9 @@ export const ActionData: {
218
263
  LiveDetect: typeof LiveDetect;
219
264
  Onelink: typeof Onelink;
220
265
  AgencyInvite: typeof AgencyInvite;
266
+ Recharge: typeof Recharge;
267
+ Close: typeof Close;
268
+ Config: typeof Config;
221
269
  };
222
270
 
223
271
  export const ActionCreator: {
@@ -249,4 +297,13 @@ export const ActionCreator: {
249
297
  buildAgencyInvite(id: number, type: string): AgencyInvite;
250
298
  createAgencyInviteAction(id: number, type: string): Action;
251
299
  createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
300
+ buildRecharge(): Recharge;
301
+ createRechargeAction(): Action;
302
+ createRechargeActionWithData(recharge: Recharge): Action;
303
+ buildClose(): Close;
304
+ createCloseAction(): Action;
305
+ createCloseActionWithData(close: Close): Action;
306
+ buildConfig(): Config;
307
+ createConfigAction(): Action;
308
+ createConfigActionWithData(config: Config): Action;
252
309
  };
package/src/core/index.js CHANGED
@@ -7,4 +7,7 @@ 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
9
  export { default as AgencyInvite } from './types/AgencyInvite.js';
10
+ export { default as Recharge } from './types/Recharge.js';
11
+ export { default as Close } from './types/Close.js';
12
+ export { default as Config } from './types/Config.js';
10
13
  export { default as Action } from './types/Action.js';
@@ -0,0 +1,16 @@
1
+ class Close {
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 Close;
@@ -0,0 +1,37 @@
1
+ class Config {
2
+ constructor() {
3
+ this.text = null;
4
+ this.theme = null;
5
+ this.brandColor = null;
6
+ this.tintColor = null;
7
+ this.title = null;
8
+ }
9
+
10
+ getText() { return this.text; }
11
+ setText(text) { this.text = text; return this; }
12
+ getTheme() { return this.theme; }
13
+ setTheme(theme) { this.theme = theme; return this; }
14
+ getBrandColor() { return this.brandColor; }
15
+ setBrandColor(brandColor) { this.brandColor = brandColor; return this; }
16
+ getTintColor() { return this.tintColor; }
17
+ setTintColor(tintColor) { this.tintColor = tintColor; return this; }
18
+ getTitle() { return this.title; }
19
+ setTitle(title) { this.title = title; return this; }
20
+
21
+ toMap() {
22
+ const map = {};
23
+ if (this.text != null) map.text = this.text;
24
+ if (this.theme != null) map.theme = this.theme;
25
+ if (this.brandColor != null) map.brandColor = this.brandColor;
26
+ if (this.tintColor != null) map.tintColor = this.tintColor;
27
+ if (this.title != null) map.title = this.title;
28
+ return map;
29
+ }
30
+ }
31
+
32
+ Config.Theme = {
33
+ DARK: 'dark',
34
+ LIGHT: 'light',
35
+ };
36
+
37
+ export default Config;
@@ -0,0 +1,16 @@
1
+ class Recharge {
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
+ var map = {};
11
+ if (this.text != null) map.text = this.text;
12
+ return map;
13
+ }
14
+ }
15
+
16
+ export default Recharge;
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, Action } from './core/index.js';
2
+ export { ActionCreator, ActionData, ActionType, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, Recharge, Close, Config, 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
@@ -9,4 +9,7 @@ export { EnterRoom } from './core/index.js';
9
9
  export { LiveDetect } from './core/index.js';
10
10
  export { Onelink } from './core/index.js';
11
11
  export { AgencyInvite } from './core/index.js';
12
+ export { Recharge } from './core/index.js';
13
+ export { Close } from './core/index.js';
14
+ export { Config } from './core/index.js';
12
15
  export { Action } from './core/index.js';