@yagolive/event-kit 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +86 -0
- package/README.md +23 -2
- package/{build → dist}/js/action_bridge.umd.js +56 -3
- package/{build → dist}/js/action_creator.umd.js +44 -3
- package/package.json +6 -5
- package/src/bridge/ActionBridge.js +14 -0
- package/src/bridge/index.d.ts +6 -1
- package/src/core/ActionCreator.js +16 -0
- package/src/core/index.d.ts +17 -1
- package/src/core/index.js +1 -0
- package/src/core/types/AgencyInvite.js +3 -1
- package/src/core/types/Recharge.js +16 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## @1.0.5 (2026-06-08)
|
|
4
|
+
|
|
5
|
+
### 新增
|
|
6
|
+
|
|
7
|
+
- **Recharge Action**: 新增充值操作动作类型
|
|
8
|
+
- `ActionType.RECHARGE` = `'recharge'`
|
|
9
|
+
- `Recharge` 数据类:仅含 `text` 可选字段(继承自 `Base`)
|
|
10
|
+
- `ActionCreator.buildRecharge()`、`createRechargeAction()`、`createRechargeActionWithData()`
|
|
11
|
+
- `ActionBridge.recharge()`、`buildRecharge()`、`createRechargeAction()`、`createRechargeActionWithData()`
|
|
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
|
+
| recharge | text?: string | 充值操作 |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## @1.0.4 (2026-05-28)
|
|
30
|
+
|
|
31
|
+
### 修改
|
|
32
|
+
|
|
33
|
+
- **EnterRoom.match 字段类型规范化**: 明确 `match` 字段类型为 `BSRoomMatchType` 枚举值
|
|
34
|
+
- 支持的匹配类型:`'recommend'`(推荐房间列表)、`'follow'`(关注)、`'agency'`(本公会的公会房)
|
|
35
|
+
- 移除了之前兼容的 `'hot'`、`'top3'` 字符串值
|
|
36
|
+
- JS/d.ts 类型保持 `string | null`,确保向后兼容性
|
|
37
|
+
- 测试页面新增 `testEnterRoomWithMatch()` 函数用于测试匹配模式
|
|
38
|
+
|
|
39
|
+
### Action 类型完整列表
|
|
40
|
+
|
|
41
|
+
| 类型 | 字段 | 说明 |
|
|
42
|
+
|------|------|------|
|
|
43
|
+
| jump | path: string, text?: string | 页面跳转 |
|
|
44
|
+
| navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
|
|
45
|
+
| replace | screen: string, params?: Record, text?: string | 替换当前页面 |
|
|
46
|
+
| goback | text?: string | 返回上一页 |
|
|
47
|
+
| enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
|
|
48
|
+
| live_detect | text?: string | 活体检测 |
|
|
49
|
+
| onelink | url: string, share?: boolean, text?: string | 分享链接 |
|
|
50
|
+
| agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## @1.0.3 (2026-05-27)
|
|
55
|
+
|
|
56
|
+
### 修改
|
|
57
|
+
|
|
58
|
+
- **AgencyInfo 字段扩展**: 为 `AgencyInvite.AgencyInfo` 内部类新增 `ownerAvatar` 字段
|
|
59
|
+
- 新增 `ownerAvatar?: string`(工会长头像 URL)
|
|
60
|
+
- JS: `AgencyInfo` 类新增 `getOwnerAvatar()` / `setOwnerAvatar(ownerAvatar)` 方法
|
|
61
|
+
- Java: `AgencyInfo` 类新增 `getOwnerAvatar()` / `setOwnerAvatar(String ownerAvatar)` 方法
|
|
62
|
+
- `toMap()` 方法同步新增 `ownerAvatar` 字段处理
|
|
63
|
+
|
|
64
|
+
### Action 类型完整列表
|
|
65
|
+
|
|
66
|
+
| 类型 | 字段 | 说明 |
|
|
67
|
+
|------|------|------|
|
|
68
|
+
| jump | path: string, text?: string | 页面跳转 |
|
|
69
|
+
| navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
|
|
70
|
+
| replace | screen: string, params?: Record, text?: string | 替换当前页面 |
|
|
71
|
+
| goback | text?: string | 返回上一页 |
|
|
72
|
+
| enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
|
|
73
|
+
| live_detect | text?: string | 活体检测 |
|
|
74
|
+
| onelink | url: string, share?: boolean, text?: string | 分享链接 |
|
|
75
|
+
| agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
|
|
76
|
+
|
|
77
|
+
### AgencyInfo 字段
|
|
78
|
+
|
|
79
|
+
| 字段 | 类型 | 说明 |
|
|
80
|
+
|------|------|------|
|
|
81
|
+
| id | string | 工会ID |
|
|
82
|
+
| name | string | 工会名称 |
|
|
83
|
+
| ownerId | string | 工会长用户ID |
|
|
84
|
+
| ownerName | string | 工会长名称 |
|
|
85
|
+
| ownerAvatar | string | 工会长头像URL |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
3
89
|
## @1.0.2 (2026-05-26)
|
|
4
90
|
|
|
5
91
|
### 新增
|
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 |
|
|
173
|
+
| `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, GOBACK, ENTER_ROOM, LIVE_DETECT, ONELINK, AGENCY_INVITE, RECHARGE |
|
|
170
174
|
|
|
171
175
|
#### 工厂方法
|
|
172
176
|
|
|
@@ -198,6 +202,9 @@ 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 |
|
|
201
208
|
|
|
202
209
|
#### 使用示例
|
|
203
210
|
|
|
@@ -239,6 +246,7 @@ ActionType.ENTER_ROOM // 'enter_room'
|
|
|
239
246
|
ActionType.LIVE_DETECT // 'live_detect'
|
|
240
247
|
ActionType.ONELINK // 'onelink'
|
|
241
248
|
ActionType.AGENCY_INVITE // 'agency_invite'
|
|
249
|
+
ActionType.RECHARGE // 'recharge'
|
|
242
250
|
```
|
|
243
251
|
|
|
244
252
|
### ActionBridge
|
|
@@ -309,6 +317,9 @@ new ActionBridge(adapter, options?)
|
|
|
309
317
|
| `agencyInvite(id, type)` | id: number, type: string | Promise | 工会邀请 |
|
|
310
318
|
| `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
|
|
311
319
|
| `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action(不自动发送) |
|
|
320
|
+
| `recharge()` | - | Promise | 充值操作 |
|
|
321
|
+
| `buildRecharge()` | - | Recharge | 构建 Recharge 对象(链式配置) |
|
|
322
|
+
| `createRechargeActionWithData(recharge)` | recharge: Recharge | Action | 从 Recharge 对象创建 Action(不自动发送) |
|
|
312
323
|
|
|
313
324
|
#### 静态方法
|
|
314
325
|
|
|
@@ -666,6 +677,16 @@ Onelink Action 数据。
|
|
|
666
677
|
| `setName(name)` | name: string | 设置工会名称,返回 this |
|
|
667
678
|
| `setOwnerId(ownerId)` | ownerId: string | 设置工会长 ID,返回 this |
|
|
668
679
|
| `setOwnerName(ownerName)` | ownerName: string | 设置工会长名称,返回 this |
|
|
680
|
+
| `setOwnerAvatar(ownerAvatar)` | ownerAvatar: string | 设置工会长头像 URL,返回 this |
|
|
681
|
+
|
|
682
|
+
### Recharge
|
|
683
|
+
|
|
684
|
+
充值操作 Action 数据。
|
|
685
|
+
|
|
686
|
+
| 方法 | 参数 | 说明 |
|
|
687
|
+
|------|------|------|
|
|
688
|
+
| `constructor()` | - | 创建充值数据 |
|
|
689
|
+
| `setText(text)` | text: string | 设置显示文本,返回 this |
|
|
669
690
|
|
|
670
691
|
### Action
|
|
671
692
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* YAGO Event Kit - Action Bridge (Full)
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.5
|
|
4
4
|
*
|
|
5
5
|
* Generated by build script - do not edit manually.
|
|
6
6
|
* Supports: Browser script tag, CommonJS, AMD
|
|
@@ -365,6 +365,7 @@ var AgencyInfo = class {
|
|
|
365
365
|
this.name = null;
|
|
366
366
|
this.ownerId = null;
|
|
367
367
|
this.ownerName = null;
|
|
368
|
+
this.ownerAvatar = null;
|
|
368
369
|
}
|
|
369
370
|
getId() {
|
|
370
371
|
return this.id;
|
|
@@ -394,12 +395,20 @@ var AgencyInfo = class {
|
|
|
394
395
|
this.ownerName = ownerName;
|
|
395
396
|
return this;
|
|
396
397
|
}
|
|
398
|
+
getOwnerAvatar() {
|
|
399
|
+
return this.ownerAvatar;
|
|
400
|
+
}
|
|
401
|
+
setOwnerAvatar(ownerAvatar) {
|
|
402
|
+
this.ownerAvatar = ownerAvatar;
|
|
403
|
+
return this;
|
|
404
|
+
}
|
|
397
405
|
toMap() {
|
|
398
406
|
const map = {};
|
|
399
407
|
if (this.id != null) map.id = this.id;
|
|
400
408
|
if (this.name != null) map.name = this.name;
|
|
401
409
|
if (this.ownerId != null) map.ownerId = this.ownerId;
|
|
402
410
|
if (this.ownerName != null) map.ownerName = this.ownerName;
|
|
411
|
+
if (this.ownerAvatar != null) map.ownerAvatar = this.ownerAvatar;
|
|
403
412
|
return map;
|
|
404
413
|
}
|
|
405
414
|
};
|
|
@@ -484,6 +493,26 @@ AgencyInvite.AgencyInfo = AgencyInfo;
|
|
|
484
493
|
AgencyInvite.AgencyInviteType = AgencyInviteType;
|
|
485
494
|
var AgencyInvite_default = AgencyInvite;
|
|
486
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
|
+
|
|
487
516
|
// src/core/types/Action.js
|
|
488
517
|
var Action = class {
|
|
489
518
|
constructor(type, data) {
|
|
@@ -529,7 +558,8 @@ var ActionType = {
|
|
|
529
558
|
ENTER_ROOM: "enter_room",
|
|
530
559
|
LIVE_DETECT: "live_detect",
|
|
531
560
|
ONELINK: "onelink",
|
|
532
|
-
AGENCY_INVITE: "agency_invite"
|
|
561
|
+
AGENCY_INVITE: "agency_invite",
|
|
562
|
+
RECHARGE: "recharge"
|
|
533
563
|
};
|
|
534
564
|
var ActionData = {
|
|
535
565
|
Jump: Jump_default,
|
|
@@ -539,7 +569,8 @@ var ActionData = {
|
|
|
539
569
|
EnterRoom: EnterRoom_default,
|
|
540
570
|
LiveDetect: LiveDetect_default,
|
|
541
571
|
Onelink: Onelink_default,
|
|
542
|
-
AgencyInvite: AgencyInvite_default
|
|
572
|
+
AgencyInvite: AgencyInvite_default,
|
|
573
|
+
Recharge: Recharge_default
|
|
543
574
|
};
|
|
544
575
|
var ActionCreator = {
|
|
545
576
|
ActionData,
|
|
@@ -631,6 +662,16 @@ var ActionCreator = {
|
|
|
631
662
|
},
|
|
632
663
|
createAgencyInviteActionWithData(agencyInvite) {
|
|
633
664
|
return new Action_default(ActionType.AGENCY_INVITE, agencyInvite);
|
|
665
|
+
},
|
|
666
|
+
// Recharge
|
|
667
|
+
buildRecharge() {
|
|
668
|
+
return new Recharge_default();
|
|
669
|
+
},
|
|
670
|
+
createRechargeAction() {
|
|
671
|
+
return new Action_default(ActionType.RECHARGE, new Recharge_default());
|
|
672
|
+
},
|
|
673
|
+
createRechargeActionWithData(recharge) {
|
|
674
|
+
return new Action_default(ActionType.RECHARGE, recharge);
|
|
634
675
|
}
|
|
635
676
|
};
|
|
636
677
|
|
|
@@ -906,6 +947,18 @@ var ActionBridge = class _ActionBridge {
|
|
|
906
947
|
createAgencyInviteActionWithData(agencyInvite) {
|
|
907
948
|
return ActionCreator.createAgencyInviteActionWithData(agencyInvite);
|
|
908
949
|
}
|
|
950
|
+
recharge() {
|
|
951
|
+
return this._adapter.sendAction(ActionCreator.createRechargeAction());
|
|
952
|
+
}
|
|
953
|
+
buildRecharge() {
|
|
954
|
+
return ActionCreator.buildRecharge();
|
|
955
|
+
}
|
|
956
|
+
createRechargeAction() {
|
|
957
|
+
return ActionCreator.createRechargeAction();
|
|
958
|
+
}
|
|
959
|
+
createRechargeActionWithData(recharge) {
|
|
960
|
+
return ActionCreator.createRechargeActionWithData(recharge);
|
|
961
|
+
}
|
|
909
962
|
destroy() {
|
|
910
963
|
if (typeof this._adapter.destroy === "function") {
|
|
911
964
|
this._adapter.destroy();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* YAGO Event Kit - Action Creator (Core Only)
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.5
|
|
4
4
|
*
|
|
5
5
|
* Generated by build script - do not edit manually.
|
|
6
6
|
* Supports: Browser script tag, CommonJS, AMD
|
|
@@ -365,6 +365,7 @@ var AgencyInfo = class {
|
|
|
365
365
|
this.name = null;
|
|
366
366
|
this.ownerId = null;
|
|
367
367
|
this.ownerName = null;
|
|
368
|
+
this.ownerAvatar = null;
|
|
368
369
|
}
|
|
369
370
|
getId() {
|
|
370
371
|
return this.id;
|
|
@@ -394,12 +395,20 @@ var AgencyInfo = class {
|
|
|
394
395
|
this.ownerName = ownerName;
|
|
395
396
|
return this;
|
|
396
397
|
}
|
|
398
|
+
getOwnerAvatar() {
|
|
399
|
+
return this.ownerAvatar;
|
|
400
|
+
}
|
|
401
|
+
setOwnerAvatar(ownerAvatar) {
|
|
402
|
+
this.ownerAvatar = ownerAvatar;
|
|
403
|
+
return this;
|
|
404
|
+
}
|
|
397
405
|
toMap() {
|
|
398
406
|
const map = {};
|
|
399
407
|
if (this.id != null) map.id = this.id;
|
|
400
408
|
if (this.name != null) map.name = this.name;
|
|
401
409
|
if (this.ownerId != null) map.ownerId = this.ownerId;
|
|
402
410
|
if (this.ownerName != null) map.ownerName = this.ownerName;
|
|
411
|
+
if (this.ownerAvatar != null) map.ownerAvatar = this.ownerAvatar;
|
|
403
412
|
return map;
|
|
404
413
|
}
|
|
405
414
|
};
|
|
@@ -484,6 +493,26 @@ AgencyInvite.AgencyInfo = AgencyInfo;
|
|
|
484
493
|
AgencyInvite.AgencyInviteType = AgencyInviteType;
|
|
485
494
|
var AgencyInvite_default = AgencyInvite;
|
|
486
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
|
+
|
|
487
516
|
// src/core/types/Action.js
|
|
488
517
|
var Action = class {
|
|
489
518
|
constructor(type, data) {
|
|
@@ -529,7 +558,8 @@ var ActionType = {
|
|
|
529
558
|
ENTER_ROOM: "enter_room",
|
|
530
559
|
LIVE_DETECT: "live_detect",
|
|
531
560
|
ONELINK: "onelink",
|
|
532
|
-
AGENCY_INVITE: "agency_invite"
|
|
561
|
+
AGENCY_INVITE: "agency_invite",
|
|
562
|
+
RECHARGE: "recharge"
|
|
533
563
|
};
|
|
534
564
|
var ActionData = {
|
|
535
565
|
Jump: Jump_default,
|
|
@@ -539,7 +569,8 @@ var ActionData = {
|
|
|
539
569
|
EnterRoom: EnterRoom_default,
|
|
540
570
|
LiveDetect: LiveDetect_default,
|
|
541
571
|
Onelink: Onelink_default,
|
|
542
|
-
AgencyInvite: AgencyInvite_default
|
|
572
|
+
AgencyInvite: AgencyInvite_default,
|
|
573
|
+
Recharge: Recharge_default
|
|
543
574
|
};
|
|
544
575
|
var ActionCreator = {
|
|
545
576
|
ActionData,
|
|
@@ -631,6 +662,16 @@ var ActionCreator = {
|
|
|
631
662
|
},
|
|
632
663
|
createAgencyInviteActionWithData(agencyInvite) {
|
|
633
664
|
return new Action_default(ActionType.AGENCY_INVITE, agencyInvite);
|
|
665
|
+
},
|
|
666
|
+
// Recharge
|
|
667
|
+
buildRecharge() {
|
|
668
|
+
return new Recharge_default();
|
|
669
|
+
},
|
|
670
|
+
createRechargeAction() {
|
|
671
|
+
return new Action_default(ActionType.RECHARGE, new Recharge_default());
|
|
672
|
+
},
|
|
673
|
+
createRechargeActionWithData(recharge) {
|
|
674
|
+
return new Action_default(ActionType.RECHARGE, recharge);
|
|
634
675
|
}
|
|
635
676
|
};
|
|
636
677
|
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yagolive/event-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "YAGO Event Kit - 跨环境 Action 创建与通信工具库,支持浏览器、React、Vue",
|
|
5
5
|
"main": "src/index.js",
|
|
6
|
-
"browser": "
|
|
6
|
+
"browser": "dist/js/action_bridge.umd.js",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"src/",
|
|
10
|
-
"
|
|
10
|
+
"dist/",
|
|
11
11
|
"CHANGELOG.md"
|
|
12
12
|
],
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"types": "./src/index.d.ts",
|
|
16
|
-
"browser": "./
|
|
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": "./
|
|
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"
|
|
@@ -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",
|
|
@@ -167,6 +167,20 @@ 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
|
+
|
|
170
184
|
destroy() {
|
|
171
185
|
if (typeof this._adapter.destroy === 'function') {
|
|
172
186
|
this._adapter.destroy();
|
package/src/bridge/index.d.ts
CHANGED
|
@@ -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,
|
|
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,11 @@ 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
|
+
|
|
59
64
|
destroy(): void;
|
|
60
65
|
|
|
61
66
|
static ActionCreator: typeof ActionCreator;
|
|
@@ -6,6 +6,7 @@ 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';
|
|
9
10
|
import Action from './types/Action.js';
|
|
10
11
|
|
|
11
12
|
const ActionType = {
|
|
@@ -17,6 +18,7 @@ const ActionType = {
|
|
|
17
18
|
LIVE_DETECT: 'live_detect',
|
|
18
19
|
ONELINK: 'onelink',
|
|
19
20
|
AGENCY_INVITE: 'agency_invite',
|
|
21
|
+
RECHARGE: 'recharge',
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
const ActionData = {
|
|
@@ -28,6 +30,7 @@ const ActionData = {
|
|
|
28
30
|
LiveDetect,
|
|
29
31
|
Onelink,
|
|
30
32
|
AgencyInvite,
|
|
33
|
+
Recharge,
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
const ActionCreator = {
|
|
@@ -147,6 +150,19 @@ const ActionCreator = {
|
|
|
147
150
|
createAgencyInviteActionWithData(agencyInvite) {
|
|
148
151
|
return new Action(ActionType.AGENCY_INVITE, agencyInvite);
|
|
149
152
|
},
|
|
153
|
+
|
|
154
|
+
// Recharge
|
|
155
|
+
buildRecharge() {
|
|
156
|
+
return new Recharge();
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
createRechargeAction() {
|
|
160
|
+
return new Action(ActionType.RECHARGE, new Recharge());
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
createRechargeActionWithData(recharge) {
|
|
164
|
+
return new Action(ActionType.RECHARGE, recharge);
|
|
165
|
+
},
|
|
150
166
|
};
|
|
151
167
|
|
|
152
168
|
export { ActionCreator, ActionData, ActionType };
|
package/src/core/index.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ export class AgencyInfo {
|
|
|
136
136
|
name: string | null;
|
|
137
137
|
ownerId: string | null;
|
|
138
138
|
ownerName: string | null;
|
|
139
|
+
ownerAvatar: string | null;
|
|
139
140
|
getId(): string | null;
|
|
140
141
|
setId(id: string): this;
|
|
141
142
|
getName(): string | null;
|
|
@@ -144,6 +145,8 @@ export class AgencyInfo {
|
|
|
144
145
|
setOwnerId(ownerId: string): this;
|
|
145
146
|
getOwnerName(): string | null;
|
|
146
147
|
setOwnerName(ownerName: string): this;
|
|
148
|
+
getOwnerAvatar(): string | null;
|
|
149
|
+
setOwnerAvatar(ownerAvatar: string): this;
|
|
147
150
|
toMap(): Record<string, any>;
|
|
148
151
|
}
|
|
149
152
|
|
|
@@ -180,6 +183,14 @@ export class AgencyInvite {
|
|
|
180
183
|
toMap(): Record<string, any>;
|
|
181
184
|
}
|
|
182
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
|
+
|
|
183
194
|
export class Action {
|
|
184
195
|
constructor(type: ActionTypeValue, data: any);
|
|
185
196
|
type: ActionTypeValue;
|
|
@@ -193,7 +204,7 @@ export class Action {
|
|
|
193
204
|
toJson(): string;
|
|
194
205
|
}
|
|
195
206
|
|
|
196
|
-
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite';
|
|
207
|
+
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite' | 'recharge';
|
|
197
208
|
|
|
198
209
|
export const ActionType: {
|
|
199
210
|
JUMP: 'jump';
|
|
@@ -204,6 +215,7 @@ export const ActionType: {
|
|
|
204
215
|
LIVE_DETECT: 'live_detect';
|
|
205
216
|
ONELINK: 'onelink';
|
|
206
217
|
AGENCY_INVITE: 'agency_invite';
|
|
218
|
+
RECHARGE: 'recharge';
|
|
207
219
|
};
|
|
208
220
|
|
|
209
221
|
export const ActionData: {
|
|
@@ -215,6 +227,7 @@ export const ActionData: {
|
|
|
215
227
|
LiveDetect: typeof LiveDetect;
|
|
216
228
|
Onelink: typeof Onelink;
|
|
217
229
|
AgencyInvite: typeof AgencyInvite;
|
|
230
|
+
Recharge: typeof Recharge;
|
|
218
231
|
};
|
|
219
232
|
|
|
220
233
|
export const ActionCreator: {
|
|
@@ -246,4 +259,7 @@ export const ActionCreator: {
|
|
|
246
259
|
buildAgencyInvite(id: number, type: string): AgencyInvite;
|
|
247
260
|
createAgencyInviteAction(id: number, type: string): Action;
|
|
248
261
|
createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
|
|
262
|
+
buildRecharge(): Recharge;
|
|
263
|
+
createRechargeAction(): Action;
|
|
264
|
+
createRechargeActionWithData(recharge: Recharge): Action;
|
|
249
265
|
};
|
package/src/core/index.js
CHANGED
|
@@ -7,4 +7,5 @@ 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';
|
|
10
11
|
export { default as Action } from './types/Action.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
class AgencyInfo {
|
|
2
|
-
constructor() { this.id = null; this.name = null; this.ownerId = null; this.ownerName = null; }
|
|
2
|
+
constructor() { this.id = null; this.name = null; this.ownerId = null; this.ownerName = null; this.ownerAvatar = null; }
|
|
3
3
|
getId() { return this.id; } setId(id) { this.id = id; return this; }
|
|
4
4
|
getName() { return this.name; } setName(name) { this.name = name; return this; }
|
|
5
5
|
getOwnerId() { return this.ownerId; } setOwnerId(ownerId) { this.ownerId = ownerId; return this; }
|
|
6
6
|
getOwnerName() { return this.ownerName; } setOwnerName(ownerName) { this.ownerName = ownerName; return this; }
|
|
7
|
+
getOwnerAvatar() { return this.ownerAvatar; } setOwnerAvatar(ownerAvatar) { this.ownerAvatar = ownerAvatar; return this; }
|
|
7
8
|
|
|
8
9
|
toMap() {
|
|
9
10
|
const map = {};
|
|
@@ -11,6 +12,7 @@ class AgencyInfo {
|
|
|
11
12
|
if (this.name != null) map.name = this.name;
|
|
12
13
|
if (this.ownerId != null) map.ownerId = this.ownerId;
|
|
13
14
|
if (this.ownerName != null) map.ownerName = this.ownerName;
|
|
15
|
+
if (this.ownerAvatar != null) map.ownerAvatar = this.ownerAvatar;
|
|
14
16
|
return map;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
@@ -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, 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,5 @@ 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';
|
|
12
13
|
export { Action } from './core/index.js';
|