@yagolive/event-kit 1.0.0 → 1.0.1
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 +17 -1
- package/README.md +1 -1
- package/build/js/action_bridge.umd.js +45 -1
- package/build/js/action_creator.umd.js +33 -1
- package/package.json +1 -1
- 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 +14 -1
- package/src/core/index.js +1 -0
- package/src/core/types/Goback.js +16 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## @1.0.1 (2026-05-22)
|
|
4
|
+
|
|
5
|
+
### 新增
|
|
6
|
+
|
|
7
|
+
- **Goback Action**: 新增返回上一页动作类型
|
|
8
|
+
- `ActionType.GOBACK` = `'goback'`
|
|
9
|
+
- `Goback` 数据类:仅含 `text` 可选字段
|
|
10
|
+
- `ActionCreator.buildGoback()`、`createGobackAction()`、`createGobackActionWithData()`
|
|
11
|
+
- `ActionBridge.goback()`、`buildGoback()`、`createGobackAction()`、`createGobackActionWithData()`
|
|
12
|
+
|
|
13
|
+
### 修复
|
|
14
|
+
|
|
15
|
+
- 修复 Java `ActionData.Base` 接口 `setText()` 返回类型从 `void` 改为 `Base`,解决链式调用编译错误
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
3
19
|
## @1.0.0 (2026-05-22)
|
|
4
20
|
|
|
5
21
|
### 新增
|
|
@@ -10,7 +26,7 @@
|
|
|
10
26
|
- Bridge 层: 统一的 ActionBridge 接口,注入适配器实现跨环境通信
|
|
11
27
|
- Integrations 层: React / Vue 3 框架集成
|
|
12
28
|
|
|
13
|
-
- **ActionCreator**:
|
|
29
|
+
- **ActionCreator**:
|
|
14
30
|
- `ActionCreator.ActionData`: 包含 Jump、Navigate、Replace、EnterRoom、LiveDetect、Onelink 数据类型
|
|
15
31
|
- `ActionCreator.ActionType`: Action 类型枚举(JUMP、NAVIGATE、REPLACE、ENTER_ROOM、LIVE_DETECT、ONELINK)
|
|
16
32
|
- 工厂方法: buildJump、createJumpAction、createJumpActionWithData、buildNavigate、createNavigateAction、createNavigateActionWithParams、createNavigateActionWithData、buildReplace、createReplaceAction、createReplaceActionWithParams、createReplaceActionWithData、buildEnterRoom、createEnterRoomAction、createEnterRoomActionWithData、buildLiveDetect、createLiveDetectAction、createLiveDetectActionWithData、buildOnelink、createOnelinkAction、createOnelinkActionWithData
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ YAGO App Action 创建与通信工具库,支持浏览器、React、Vue 等多
|
|
|
14
14
|
│ ActionBridge (注入适配器) │
|
|
15
15
|
├─────────────────────────────────────────────────────┤
|
|
16
16
|
│ 适配器层 (Adapters) │
|
|
17
|
-
│ RNWebViewAdapter │ MockAdapter
|
|
17
|
+
│ RNWebViewAdapter │ MockAdapter │
|
|
18
18
|
├─────────────────────────────────────────────────────┤
|
|
19
19
|
│ 核心层 (Core) │
|
|
20
20
|
│ ActionCreator │ ActionType │ ActionData │
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* YAGO Event Kit - Action Bridge (Full)
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.1
|
|
4
4
|
*
|
|
5
5
|
* Generated by build script - do not edit manually.
|
|
6
6
|
* Supports: Browser script tag, CommonJS, AMD
|
|
@@ -279,6 +279,26 @@ EnterRoom.OpenActivityCallback = OpenActivityCallback;
|
|
|
279
279
|
EnterRoom.SwitchRoomTypeCallback = SwitchRoomTypeCallback;
|
|
280
280
|
var EnterRoom_default = EnterRoom;
|
|
281
281
|
|
|
282
|
+
// src/core/types/Goback.js
|
|
283
|
+
var Goback = class {
|
|
284
|
+
constructor() {
|
|
285
|
+
this.text = null;
|
|
286
|
+
}
|
|
287
|
+
getText() {
|
|
288
|
+
return this.text;
|
|
289
|
+
}
|
|
290
|
+
setText(text) {
|
|
291
|
+
this.text = text;
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
toMap() {
|
|
295
|
+
const map = {};
|
|
296
|
+
if (this.text != null) map.text = this.text;
|
|
297
|
+
return map;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
var Goback_default = Goback;
|
|
301
|
+
|
|
282
302
|
// src/core/types/LiveDetect.js
|
|
283
303
|
var LiveDetect = class {
|
|
284
304
|
constructor() {
|
|
@@ -379,6 +399,7 @@ var ActionType = {
|
|
|
379
399
|
JUMP: "jump",
|
|
380
400
|
NAVIGATE: "navigate",
|
|
381
401
|
REPLACE: "replace",
|
|
402
|
+
GOBACK: "goback",
|
|
382
403
|
ENTER_ROOM: "enter_room",
|
|
383
404
|
LIVE_DETECT: "live_detect",
|
|
384
405
|
ONELINK: "onelink"
|
|
@@ -387,6 +408,7 @@ var ActionData = {
|
|
|
387
408
|
Jump: Jump_default,
|
|
388
409
|
Navigate: Navigate_default,
|
|
389
410
|
Replace: Replace_default,
|
|
411
|
+
Goback: Goback_default,
|
|
390
412
|
EnterRoom: EnterRoom_default,
|
|
391
413
|
LiveDetect: LiveDetect_default,
|
|
392
414
|
Onelink: Onelink_default
|
|
@@ -430,6 +452,16 @@ var ActionCreator = {
|
|
|
430
452
|
createReplaceActionWithData(replace) {
|
|
431
453
|
return new Action_default(ActionType.REPLACE, replace);
|
|
432
454
|
},
|
|
455
|
+
// Goback
|
|
456
|
+
buildGoback() {
|
|
457
|
+
return new Goback_default();
|
|
458
|
+
},
|
|
459
|
+
createGobackAction() {
|
|
460
|
+
return new Action_default(ActionType.GOBACK, new Goback_default());
|
|
461
|
+
},
|
|
462
|
+
createGobackActionWithData(goback) {
|
|
463
|
+
return new Action_default(ActionType.GOBACK, goback);
|
|
464
|
+
},
|
|
433
465
|
// EnterRoom
|
|
434
466
|
buildEnterRoom() {
|
|
435
467
|
return new EnterRoom_default();
|
|
@@ -676,6 +708,18 @@ var ActionBridge = class _ActionBridge {
|
|
|
676
708
|
createReplaceActionWithData(replace) {
|
|
677
709
|
return ActionCreator.createReplaceActionWithData(replace);
|
|
678
710
|
}
|
|
711
|
+
goback() {
|
|
712
|
+
return this._adapter.sendAction(ActionCreator.createGobackAction());
|
|
713
|
+
}
|
|
714
|
+
buildGoback() {
|
|
715
|
+
return ActionCreator.buildGoback();
|
|
716
|
+
}
|
|
717
|
+
createGobackAction() {
|
|
718
|
+
return ActionCreator.createGobackAction();
|
|
719
|
+
}
|
|
720
|
+
createGobackActionWithData(goback) {
|
|
721
|
+
return ActionCreator.createGobackActionWithData(goback);
|
|
722
|
+
}
|
|
679
723
|
enterRoom(id) {
|
|
680
724
|
return this._adapter.sendAction(ActionCreator.createEnterRoomAction(id));
|
|
681
725
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* YAGO Event Kit - Action Creator (Core Only)
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.1
|
|
4
4
|
*
|
|
5
5
|
* Generated by build script - do not edit manually.
|
|
6
6
|
* Supports: Browser script tag, CommonJS, AMD
|
|
@@ -279,6 +279,26 @@ EnterRoom.OpenActivityCallback = OpenActivityCallback;
|
|
|
279
279
|
EnterRoom.SwitchRoomTypeCallback = SwitchRoomTypeCallback;
|
|
280
280
|
var EnterRoom_default = EnterRoom;
|
|
281
281
|
|
|
282
|
+
// src/core/types/Goback.js
|
|
283
|
+
var Goback = class {
|
|
284
|
+
constructor() {
|
|
285
|
+
this.text = null;
|
|
286
|
+
}
|
|
287
|
+
getText() {
|
|
288
|
+
return this.text;
|
|
289
|
+
}
|
|
290
|
+
setText(text) {
|
|
291
|
+
this.text = text;
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
toMap() {
|
|
295
|
+
const map = {};
|
|
296
|
+
if (this.text != null) map.text = this.text;
|
|
297
|
+
return map;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
var Goback_default = Goback;
|
|
301
|
+
|
|
282
302
|
// src/core/types/LiveDetect.js
|
|
283
303
|
var LiveDetect = class {
|
|
284
304
|
constructor() {
|
|
@@ -379,6 +399,7 @@ var ActionType = {
|
|
|
379
399
|
JUMP: "jump",
|
|
380
400
|
NAVIGATE: "navigate",
|
|
381
401
|
REPLACE: "replace",
|
|
402
|
+
GOBACK: "goback",
|
|
382
403
|
ENTER_ROOM: "enter_room",
|
|
383
404
|
LIVE_DETECT: "live_detect",
|
|
384
405
|
ONELINK: "onelink"
|
|
@@ -387,6 +408,7 @@ var ActionData = {
|
|
|
387
408
|
Jump: Jump_default,
|
|
388
409
|
Navigate: Navigate_default,
|
|
389
410
|
Replace: Replace_default,
|
|
411
|
+
Goback: Goback_default,
|
|
390
412
|
EnterRoom: EnterRoom_default,
|
|
391
413
|
LiveDetect: LiveDetect_default,
|
|
392
414
|
Onelink: Onelink_default
|
|
@@ -430,6 +452,16 @@ var ActionCreator = {
|
|
|
430
452
|
createReplaceActionWithData(replace) {
|
|
431
453
|
return new Action_default(ActionType.REPLACE, replace);
|
|
432
454
|
},
|
|
455
|
+
// Goback
|
|
456
|
+
buildGoback() {
|
|
457
|
+
return new Goback_default();
|
|
458
|
+
},
|
|
459
|
+
createGobackAction() {
|
|
460
|
+
return new Action_default(ActionType.GOBACK, new Goback_default());
|
|
461
|
+
},
|
|
462
|
+
createGobackActionWithData(goback) {
|
|
463
|
+
return new Action_default(ActionType.GOBACK, goback);
|
|
464
|
+
},
|
|
433
465
|
// EnterRoom
|
|
434
466
|
buildEnterRoom() {
|
|
435
467
|
return new EnterRoom_default();
|
package/package.json
CHANGED
|
@@ -97,6 +97,20 @@ export default class ActionBridge {
|
|
|
97
97
|
return ActionCreator.createReplaceActionWithData(replace);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
goback() {
|
|
101
|
+
return this._adapter.sendAction(ActionCreator.createGobackAction());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
buildGoback() {
|
|
105
|
+
return ActionCreator.buildGoback();
|
|
106
|
+
}
|
|
107
|
+
createGobackAction() {
|
|
108
|
+
return ActionCreator.createGobackAction();
|
|
109
|
+
}
|
|
110
|
+
createGobackActionWithData(goback) {
|
|
111
|
+
return ActionCreator.createGobackActionWithData(goback);
|
|
112
|
+
}
|
|
113
|
+
|
|
100
114
|
enterRoom(id) {
|
|
101
115
|
return this._adapter.sendAction(ActionCreator.createEnterRoomAction(id));
|
|
102
116
|
}
|
package/src/bridge/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Action, Jump, Navigate, Replace, EnterRoom, LiveDetect, Onelink,
|
|
2
|
+
Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink,
|
|
3
3
|
ActionType, ActionData, ActionCreator,
|
|
4
4
|
} from '../core/index.js';
|
|
5
5
|
import { IActionAdapter, RNWebViewAdapter, MockAdapter, AdapterOptions } from '../adapters/index.js';
|
|
@@ -31,6 +31,11 @@ export declare class ActionBridge {
|
|
|
31
31
|
createReplaceActionWithParams(screen: string, params: Record<string, any>): Action;
|
|
32
32
|
createReplaceActionWithData(replace: Replace): Action;
|
|
33
33
|
|
|
34
|
+
goback(): Promise<any>;
|
|
35
|
+
buildGoback(): Goback;
|
|
36
|
+
createGobackAction(): Action;
|
|
37
|
+
createGobackActionWithData(goback: Goback): Action;
|
|
38
|
+
|
|
34
39
|
enterRoom(id: number): Promise<any>;
|
|
35
40
|
buildEnterRoom(): EnterRoom;
|
|
36
41
|
createEnterRoomAction(id: number): Action;
|
|
@@ -2,6 +2,7 @@ import Jump from './types/Jump.js';
|
|
|
2
2
|
import Navigate from './types/Navigate.js';
|
|
3
3
|
import Replace from './types/Replace.js';
|
|
4
4
|
import EnterRoom from './types/EnterRoom.js';
|
|
5
|
+
import Goback from './types/Goback.js';
|
|
5
6
|
import LiveDetect from './types/LiveDetect.js';
|
|
6
7
|
import Onelink from './types/Onelink.js';
|
|
7
8
|
import Action from './types/Action.js';
|
|
@@ -10,6 +11,7 @@ const ActionType = {
|
|
|
10
11
|
JUMP: 'jump',
|
|
11
12
|
NAVIGATE: 'navigate',
|
|
12
13
|
REPLACE: 'replace',
|
|
14
|
+
GOBACK: 'goback',
|
|
13
15
|
ENTER_ROOM: 'enter_room',
|
|
14
16
|
LIVE_DETECT: 'live_detect',
|
|
15
17
|
ONELINK: 'onelink',
|
|
@@ -19,6 +21,7 @@ const ActionData = {
|
|
|
19
21
|
Jump,
|
|
20
22
|
Navigate,
|
|
21
23
|
Replace,
|
|
24
|
+
Goback,
|
|
22
25
|
EnterRoom,
|
|
23
26
|
LiveDetect,
|
|
24
27
|
Onelink,
|
|
@@ -75,6 +78,19 @@ const ActionCreator = {
|
|
|
75
78
|
return new Action(ActionType.REPLACE, replace);
|
|
76
79
|
},
|
|
77
80
|
|
|
81
|
+
// Goback
|
|
82
|
+
buildGoback() {
|
|
83
|
+
return new Goback();
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
createGobackAction() {
|
|
87
|
+
return new Action(ActionType.GOBACK, new Goback());
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
createGobackActionWithData(goback) {
|
|
91
|
+
return new Action(ActionType.GOBACK, goback);
|
|
92
|
+
},
|
|
93
|
+
|
|
78
94
|
// EnterRoom
|
|
79
95
|
buildEnterRoom() {
|
|
80
96
|
return new EnterRoom();
|
package/src/core/index.d.ts
CHANGED
|
@@ -29,6 +29,14 @@ export class Replace extends Navigate {
|
|
|
29
29
|
constructor(screen: string, params?: Record<string, any>);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export class Goback {
|
|
33
|
+
constructor();
|
|
34
|
+
text: string | null;
|
|
35
|
+
getText(): string | null;
|
|
36
|
+
setText(text: string): this;
|
|
37
|
+
toMap(): Record<string, any>;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
export class OpenGiftPopupCallback {
|
|
33
41
|
constructor();
|
|
34
42
|
id: number | null;
|
|
@@ -136,12 +144,13 @@ export class Action {
|
|
|
136
144
|
toJson(): string;
|
|
137
145
|
}
|
|
138
146
|
|
|
139
|
-
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'enter_room' | 'live_detect' | 'onelink';
|
|
147
|
+
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink';
|
|
140
148
|
|
|
141
149
|
export const ActionType: {
|
|
142
150
|
JUMP: 'jump';
|
|
143
151
|
NAVIGATE: 'navigate';
|
|
144
152
|
REPLACE: 'replace';
|
|
153
|
+
GOBACK: 'goback';
|
|
145
154
|
ENTER_ROOM: 'enter_room';
|
|
146
155
|
LIVE_DETECT: 'live_detect';
|
|
147
156
|
ONELINK: 'onelink';
|
|
@@ -151,6 +160,7 @@ export const ActionData: {
|
|
|
151
160
|
Jump: typeof Jump;
|
|
152
161
|
Navigate: typeof Navigate;
|
|
153
162
|
Replace: typeof Replace;
|
|
163
|
+
Goback: typeof Goback;
|
|
154
164
|
EnterRoom: typeof EnterRoom;
|
|
155
165
|
LiveDetect: typeof LiveDetect;
|
|
156
166
|
Onelink: typeof Onelink;
|
|
@@ -170,6 +180,9 @@ export const ActionCreator: {
|
|
|
170
180
|
createReplaceAction(screen: string): Action;
|
|
171
181
|
createReplaceActionWithParams(screen: string, params: Record<string, any>): Action;
|
|
172
182
|
createReplaceActionWithData(replace: Replace): Action;
|
|
183
|
+
buildGoback(): Goback;
|
|
184
|
+
createGobackAction(): Action;
|
|
185
|
+
createGobackActionWithData(goback: Goback): Action;
|
|
173
186
|
buildEnterRoom(): EnterRoom;
|
|
174
187
|
createEnterRoomAction(id: string): Action;
|
|
175
188
|
createEnterRoomActionWithData(enterRoom: EnterRoom): Action;
|
package/src/core/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { ActionCreator, ActionData, ActionType } from './ActionCreator.js';
|
|
|
2
2
|
export { default as Jump } from './types/Jump.js';
|
|
3
3
|
export { default as Navigate } from './types/Navigate.js';
|
|
4
4
|
export { default as Replace } from './types/Replace.js';
|
|
5
|
+
export { default as Goback } from './types/Goback.js';
|
|
5
6
|
export { default as EnterRoom } from './types/EnterRoom.js';
|
|
6
7
|
export { default as LiveDetect } from './types/LiveDetect.js';
|
|
7
8
|
export { default as Onelink } from './types/Onelink.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class Goback {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.text = null;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
getText() { return this.text; }
|
|
7
|
+
setText(text) { this.text = text; return this; }
|
|
8
|
+
|
|
9
|
+
toMap() {
|
|
10
|
+
const map = {};
|
|
11
|
+
if (this.text != null) map.text = this.text;
|
|
12
|
+
return map;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default Goback;
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ActionBridge } from './bridge/index.js';
|
|
2
|
-
export { ActionCreator, ActionData, ActionType, Jump, Navigate, Replace, EnterRoom, LiveDetect, Onelink, Action } from './core/index.js';
|
|
2
|
+
export { ActionCreator, ActionData, ActionType, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, Action } from './core/index.js';
|
|
3
3
|
export { RNWebViewAdapter, MockAdapter, IActionAdapter, MockCall } from './adapters/index.js';
|
|
4
4
|
export { ActionBridgeProvider, useActionBridge } from './integrations/react/index.js';
|
package/src/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { RNWebViewAdapter, MockAdapter } from './adapters/index.js';
|
|
|
4
4
|
export { Jump } from './core/index.js';
|
|
5
5
|
export { Navigate } from './core/index.js';
|
|
6
6
|
export { Replace } from './core/index.js';
|
|
7
|
+
export { Goback } from './core/index.js';
|
|
7
8
|
export { EnterRoom } from './core/index.js';
|
|
8
9
|
export { LiveDetect } from './core/index.js';
|
|
9
10
|
export { Onelink } from './core/index.js';
|