@yagolive/event-kit 1.0.8 → 1.0.9
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 +33 -0
- package/README.md +24 -2
- package/dist/js/action_bridge.umd.js +89 -1
- package/dist/js/action_creator.umd.js +70 -1
- package/package.json +1 -1
- package/src/bridge/ActionBridge.js +21 -0
- package/src/bridge/index.d.ts +6 -1
- package/src/core/ActionCreator.js +16 -0
- package/src/core/index.d.ts +26 -1
- package/src/core/index.js +1 -0
- package/src/core/types/Ask.js +28 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## @1.0.9 (2026-06-24)
|
|
4
|
+
|
|
5
|
+
### 新增
|
|
6
|
+
|
|
7
|
+
- **Ask Action(通用询问)**: 新增通用询问动作类型,用于触发邀请、审核等需要用户确认/拒绝的场景
|
|
8
|
+
- `ActionType.ASK` = `'ask'`
|
|
9
|
+
- `Ask` 数据类:必填字段 `id`(number,询问 ID);可选字段 `title`(string,询问标题)、`message`(string,询问内容)、`accepted`(boolean,当前回复状态)、`text`
|
|
10
|
+
- `ActionCreator.buildAsk(id)`、`createAskAction(id)`、`createAskActionWithData(ask)`
|
|
11
|
+
- `ActionBridge.ask(id, options?)`、`buildAsk(id)`、`createAskAction(id)`、`createAskActionWithData(ask)`
|
|
12
|
+
- `bridge.ask(id, options)` 便捷方法支持传入 `{ title?, message?, accepted?, text? }`
|
|
13
|
+
- **语义**:app 侧消费时遵循以下规则——`title` 或 `message` 任一非空时弹出 `ConfirmDialog` 让用户选择;均为空则进入静默模式(如系统消息卡片中直接展示 Accept/Reject 按钮)
|
|
14
|
+
|
|
15
|
+
### Action 类型完整列表
|
|
16
|
+
|
|
17
|
+
| 类型 | 字段 | 说明 |
|
|
18
|
+
|------|------|------|
|
|
19
|
+
| jump | path: string, text?: string | 页面跳转 |
|
|
20
|
+
| navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
|
|
21
|
+
| replace | screen: string, params?: Record, text?: string | 替换当前页面 |
|
|
22
|
+
| goback | text?: string | 返回上一页 |
|
|
23
|
+
| enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
|
|
24
|
+
| live_detect | text?: string | 活体检测 |
|
|
25
|
+
| onelink | url: string, share?: boolean, text?: string | 分享链接 |
|
|
26
|
+
| ask | id: number, title?: string, message?: string, accepted?: boolean, text?: string | 通用询问(邀请、审核) |
|
|
27
|
+
| agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
|
|
28
|
+
| recharge | text?: string | 充值操作 |
|
|
29
|
+
| close | text?: string | 关闭 WebView 窗口(addon 附加) |
|
|
30
|
+
| config | theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string, text?: string | 配置 WebView 主题(addon 附加) |
|
|
31
|
+
| track | name: string, params?: Record, options?: Record, text?: string | 统计事件上报 |
|
|
32
|
+
| grant_benefits | benefits: any[], title?: string, message?: string, okAction?: Action, closeable?: boolean, duration?: number, theme?: { image, tintColor, buttonImage?, topInset? }, text?: string | 权益下发 |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
3
36
|
## @1.0.8 (2026-06-17)
|
|
4
37
|
|
|
5
38
|
### 新增
|
package/README.md
CHANGED
|
@@ -169,8 +169,8 @@ import { ActionCreator } from '@yagolive/event-kit';
|
|
|
169
169
|
|
|
170
170
|
| 属性 | 类型 | 说明 |
|
|
171
171
|
|------|------|------|
|
|
172
|
-
| `ActionData` | Object | 包含所有数据类型类:Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits |
|
|
173
|
-
| `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, GOBACK, ENTER_ROOM, LIVE_DETECT, ONELINK, AGENCY_INVITE, RECHARGE, CLOSE, CONFIG, TRACK, GRANT_BENEFITS |
|
|
172
|
+
| `ActionData` | Object | 包含所有数据类型类:Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, Ask, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits |
|
|
173
|
+
| `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, GOBACK, ENTER_ROOM, LIVE_DETECT, ONELINK, ASK, AGENCY_INVITE, RECHARGE, CLOSE, CONFIG, TRACK, GRANT_BENEFITS |
|
|
174
174
|
|
|
175
175
|
#### 工厂方法
|
|
176
176
|
|
|
@@ -199,6 +199,9 @@ import { ActionCreator } from '@yagolive/event-kit';
|
|
|
199
199
|
| `buildOnelink(url?)` | url?: string | Onelink | 构建 Onelink 对象(链式配置) |
|
|
200
200
|
| `createOnelinkAction(url)` | url: string | Action | 创建 Onelink Action |
|
|
201
201
|
| `createOnelinkActionWithData(onelink)` | onelink: Onelink | Action | 从 Onelink 对象创建 Action |
|
|
202
|
+
| `buildAsk(id)` | id: number | Ask | 构建 Ask 对象(链式配置) |
|
|
203
|
+
| `createAskAction(id)` | id: number | Action | 创建通用询问 Action |
|
|
204
|
+
| `createAskActionWithData(ask)` | ask: Ask | Action | 从 Ask 对象创建 Action |
|
|
202
205
|
| `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
|
|
203
206
|
| `createAgencyInviteAction(id, type)` | id: number, type: string | Action | 创建工会邀请 Action |
|
|
204
207
|
| `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action |
|
|
@@ -257,6 +260,7 @@ ActionType.GOBACK // 'goback'
|
|
|
257
260
|
ActionType.ENTER_ROOM // 'enter_room'
|
|
258
261
|
ActionType.LIVE_DETECT // 'live_detect'
|
|
259
262
|
ActionType.ONELINK // 'onelink'
|
|
263
|
+
ActionType.ASK // 'ask'
|
|
260
264
|
ActionType.AGENCY_INVITE // 'agency_invite'
|
|
261
265
|
ActionType.RECHARGE // 'recharge'
|
|
262
266
|
ActionType.CLOSE // 'close' (addon)
|
|
@@ -330,6 +334,9 @@ new ActionBridge(adapter, options?)
|
|
|
330
334
|
| `onelink(url)` | url: string | Promise | 打开 Onelink |
|
|
331
335
|
| `buildOnelink(url?)` | url?: string | Onelink | 构建 Onelink 对象(链式配置) |
|
|
332
336
|
| `createOnelinkActionWithData(onelink)` | onelink: Onelink | Action | 从 Onelink 对象创建 Action(不自动发送) |
|
|
337
|
+
| `ask(id, options?)` | id: number, options?: { title?, message?, accepted?, text? } | Promise | 通用询问(邀请/审核) |
|
|
338
|
+
| `buildAsk(id)` | id: number | Ask | 构建 Ask 对象(链式配置) |
|
|
339
|
+
| `createAskActionWithData(ask)` | ask: Ask | Action | 从 Ask 对象创建 Action(不自动发送) |
|
|
333
340
|
| `agencyInvite(id, type)` | id: number, type: string | Promise | 工会邀请 |
|
|
334
341
|
| `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
|
|
335
342
|
| `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action(不自动发送) |
|
|
@@ -679,6 +686,21 @@ Onelink Action 数据。
|
|
|
679
686
|
| `setUrl(url)` | url: string (必填) | 设置链接 URL,返回 this |
|
|
680
687
|
| `setShare(share)` | share: boolean | 设置是否显示分享弹窗,返回 this |
|
|
681
688
|
|
|
689
|
+
### Ask
|
|
690
|
+
|
|
691
|
+
通用询问 Action 数据,用于邀请、审核等需要用户确认/拒绝的场景。
|
|
692
|
+
|
|
693
|
+
> **App 侧消费语义**:当 `title` 或 `message` 任一非空时,app 侧弹出 `ConfirmDialog` 让用户确认;均为空则进入静默模式,由调用方(如系统消息卡片)在界面上直接展示 Accept/Reject 按钮。
|
|
694
|
+
|
|
695
|
+
| 方法 | 参数 | 说明 |
|
|
696
|
+
|------|------|------|
|
|
697
|
+
| `constructor(id)` | id: number (必填) | 创建通用询问数据 |
|
|
698
|
+
| `setText(text)` | text: string | 设置显示文本,返回 this |
|
|
699
|
+
| `setId(id)` | id: number | 设置询问 ID,返回 this |
|
|
700
|
+
| `setTitle(title)` | title: string | 设置询问标题,返回 this |
|
|
701
|
+
| `setMessage(message)` | message: string | 设置询问内容,返回 this |
|
|
702
|
+
| `setAccepted(accepted)` | accepted: boolean | 设置当前回复状态(true=已接受,false=已拒绝,未设置=未回复),返回 this |
|
|
703
|
+
|
|
682
704
|
### AgencyInvite
|
|
683
705
|
|
|
684
706
|
工会邀请 Action 数据。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* YAGO Event Kit - Action Bridge (Full)
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.9
|
|
4
4
|
*
|
|
5
5
|
* Generated by build script - do not edit manually.
|
|
6
6
|
* Supports: Browser script tag, CommonJS, AMD
|
|
@@ -358,6 +358,63 @@ var Onelink = class {
|
|
|
358
358
|
};
|
|
359
359
|
var Onelink_default = Onelink;
|
|
360
360
|
|
|
361
|
+
// src/core/types/Ask.js
|
|
362
|
+
var Ask = class {
|
|
363
|
+
constructor(id) {
|
|
364
|
+
if (id == null) throw new Error("id cannot be null");
|
|
365
|
+
this.text = null;
|
|
366
|
+
this.id = id;
|
|
367
|
+
this.title = null;
|
|
368
|
+
this.message = null;
|
|
369
|
+
this.accepted = null;
|
|
370
|
+
}
|
|
371
|
+
getText() {
|
|
372
|
+
return this.text;
|
|
373
|
+
}
|
|
374
|
+
setText(text) {
|
|
375
|
+
this.text = text;
|
|
376
|
+
return this;
|
|
377
|
+
}
|
|
378
|
+
getId() {
|
|
379
|
+
return this.id;
|
|
380
|
+
}
|
|
381
|
+
setId(id) {
|
|
382
|
+
this.id = id;
|
|
383
|
+
return this;
|
|
384
|
+
}
|
|
385
|
+
getTitle() {
|
|
386
|
+
return this.title;
|
|
387
|
+
}
|
|
388
|
+
setTitle(title) {
|
|
389
|
+
this.title = title;
|
|
390
|
+
return this;
|
|
391
|
+
}
|
|
392
|
+
getMessage() {
|
|
393
|
+
return this.message;
|
|
394
|
+
}
|
|
395
|
+
setMessage(message) {
|
|
396
|
+
this.message = message;
|
|
397
|
+
return this;
|
|
398
|
+
}
|
|
399
|
+
getAccepted() {
|
|
400
|
+
return this.accepted;
|
|
401
|
+
}
|
|
402
|
+
setAccepted(accepted) {
|
|
403
|
+
this.accepted = accepted;
|
|
404
|
+
return this;
|
|
405
|
+
}
|
|
406
|
+
toMap() {
|
|
407
|
+
const map = {};
|
|
408
|
+
if (this.text != null) map.text = this.text;
|
|
409
|
+
if (this.id != null) map.id = this.id;
|
|
410
|
+
if (this.title != null) map.title = this.title;
|
|
411
|
+
if (this.message != null) map.message = this.message;
|
|
412
|
+
if (this.accepted != null) map.accepted = this.accepted;
|
|
413
|
+
return map;
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
var Ask_default = Ask;
|
|
417
|
+
|
|
361
418
|
// src/core/types/AgencyInvite.js
|
|
362
419
|
var AgencyInfo = class {
|
|
363
420
|
constructor() {
|
|
@@ -827,6 +884,7 @@ var ActionType = {
|
|
|
827
884
|
ENTER_ROOM: "enter_room",
|
|
828
885
|
LIVE_DETECT: "live_detect",
|
|
829
886
|
ONELINK: "onelink",
|
|
887
|
+
ASK: "ask",
|
|
830
888
|
AGENCY_INVITE: "agency_invite",
|
|
831
889
|
RECHARGE: "recharge",
|
|
832
890
|
CLOSE: "close",
|
|
@@ -842,6 +900,7 @@ var ActionData = {
|
|
|
842
900
|
EnterRoom: EnterRoom_default,
|
|
843
901
|
LiveDetect: LiveDetect_default,
|
|
844
902
|
Onelink: Onelink_default,
|
|
903
|
+
Ask: Ask_default,
|
|
845
904
|
AgencyInvite: AgencyInvite_default,
|
|
846
905
|
Recharge: Recharge_default,
|
|
847
906
|
Close: Close_default,
|
|
@@ -930,6 +989,16 @@ var ActionCreator = {
|
|
|
930
989
|
createOnelinkActionWithData(onelink) {
|
|
931
990
|
return new Action_default(ActionType.ONELINK, onelink);
|
|
932
991
|
},
|
|
992
|
+
// Ask
|
|
993
|
+
buildAsk(id) {
|
|
994
|
+
return new Ask_default(id);
|
|
995
|
+
},
|
|
996
|
+
createAskAction(id) {
|
|
997
|
+
return new Action_default(ActionType.ASK, new Ask_default(id));
|
|
998
|
+
},
|
|
999
|
+
createAskActionWithData(ask) {
|
|
1000
|
+
return new Action_default(ActionType.ASK, ask);
|
|
1001
|
+
},
|
|
933
1002
|
// AgencyInvite
|
|
934
1003
|
buildAgencyInvite(id, type) {
|
|
935
1004
|
return new AgencyInvite_default(id, type);
|
|
@@ -1261,6 +1330,25 @@ var ActionBridge = class _ActionBridge {
|
|
|
1261
1330
|
createOnelinkActionWithData(onelink) {
|
|
1262
1331
|
return ActionCreator.createOnelinkActionWithData(onelink);
|
|
1263
1332
|
}
|
|
1333
|
+
ask(id, options) {
|
|
1334
|
+
var data = ActionCreator.buildAsk(id);
|
|
1335
|
+
if (options) {
|
|
1336
|
+
if (options.title != null) data.setTitle(options.title);
|
|
1337
|
+
if (options.message != null) data.setMessage(options.message);
|
|
1338
|
+
if (options.accepted != null) data.setAccepted(options.accepted);
|
|
1339
|
+
if (options.text != null) data.setText(options.text);
|
|
1340
|
+
}
|
|
1341
|
+
return this._adapter.sendAction(ActionCreator.createAskActionWithData(data));
|
|
1342
|
+
}
|
|
1343
|
+
buildAsk(id) {
|
|
1344
|
+
return ActionCreator.buildAsk(id);
|
|
1345
|
+
}
|
|
1346
|
+
createAskAction(id) {
|
|
1347
|
+
return ActionCreator.createAskAction(id);
|
|
1348
|
+
}
|
|
1349
|
+
createAskActionWithData(ask) {
|
|
1350
|
+
return ActionCreator.createAskActionWithData(ask);
|
|
1351
|
+
}
|
|
1264
1352
|
agencyInvite(id, type) {
|
|
1265
1353
|
return this._adapter.sendAction(ActionCreator.createAgencyInviteAction(id, type));
|
|
1266
1354
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* YAGO Event Kit - Action Creator (Core Only)
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.9
|
|
4
4
|
*
|
|
5
5
|
* Generated by build script - do not edit manually.
|
|
6
6
|
* Supports: Browser script tag, CommonJS, AMD
|
|
@@ -358,6 +358,63 @@ var Onelink = class {
|
|
|
358
358
|
};
|
|
359
359
|
var Onelink_default = Onelink;
|
|
360
360
|
|
|
361
|
+
// src/core/types/Ask.js
|
|
362
|
+
var Ask = class {
|
|
363
|
+
constructor(id) {
|
|
364
|
+
if (id == null) throw new Error("id cannot be null");
|
|
365
|
+
this.text = null;
|
|
366
|
+
this.id = id;
|
|
367
|
+
this.title = null;
|
|
368
|
+
this.message = null;
|
|
369
|
+
this.accepted = null;
|
|
370
|
+
}
|
|
371
|
+
getText() {
|
|
372
|
+
return this.text;
|
|
373
|
+
}
|
|
374
|
+
setText(text) {
|
|
375
|
+
this.text = text;
|
|
376
|
+
return this;
|
|
377
|
+
}
|
|
378
|
+
getId() {
|
|
379
|
+
return this.id;
|
|
380
|
+
}
|
|
381
|
+
setId(id) {
|
|
382
|
+
this.id = id;
|
|
383
|
+
return this;
|
|
384
|
+
}
|
|
385
|
+
getTitle() {
|
|
386
|
+
return this.title;
|
|
387
|
+
}
|
|
388
|
+
setTitle(title) {
|
|
389
|
+
this.title = title;
|
|
390
|
+
return this;
|
|
391
|
+
}
|
|
392
|
+
getMessage() {
|
|
393
|
+
return this.message;
|
|
394
|
+
}
|
|
395
|
+
setMessage(message) {
|
|
396
|
+
this.message = message;
|
|
397
|
+
return this;
|
|
398
|
+
}
|
|
399
|
+
getAccepted() {
|
|
400
|
+
return this.accepted;
|
|
401
|
+
}
|
|
402
|
+
setAccepted(accepted) {
|
|
403
|
+
this.accepted = accepted;
|
|
404
|
+
return this;
|
|
405
|
+
}
|
|
406
|
+
toMap() {
|
|
407
|
+
const map = {};
|
|
408
|
+
if (this.text != null) map.text = this.text;
|
|
409
|
+
if (this.id != null) map.id = this.id;
|
|
410
|
+
if (this.title != null) map.title = this.title;
|
|
411
|
+
if (this.message != null) map.message = this.message;
|
|
412
|
+
if (this.accepted != null) map.accepted = this.accepted;
|
|
413
|
+
return map;
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
var Ask_default = Ask;
|
|
417
|
+
|
|
361
418
|
// src/core/types/AgencyInvite.js
|
|
362
419
|
var AgencyInfo = class {
|
|
363
420
|
constructor() {
|
|
@@ -827,6 +884,7 @@ var ActionType = {
|
|
|
827
884
|
ENTER_ROOM: "enter_room",
|
|
828
885
|
LIVE_DETECT: "live_detect",
|
|
829
886
|
ONELINK: "onelink",
|
|
887
|
+
ASK: "ask",
|
|
830
888
|
AGENCY_INVITE: "agency_invite",
|
|
831
889
|
RECHARGE: "recharge",
|
|
832
890
|
CLOSE: "close",
|
|
@@ -842,6 +900,7 @@ var ActionData = {
|
|
|
842
900
|
EnterRoom: EnterRoom_default,
|
|
843
901
|
LiveDetect: LiveDetect_default,
|
|
844
902
|
Onelink: Onelink_default,
|
|
903
|
+
Ask: Ask_default,
|
|
845
904
|
AgencyInvite: AgencyInvite_default,
|
|
846
905
|
Recharge: Recharge_default,
|
|
847
906
|
Close: Close_default,
|
|
@@ -930,6 +989,16 @@ var ActionCreator = {
|
|
|
930
989
|
createOnelinkActionWithData(onelink) {
|
|
931
990
|
return new Action_default(ActionType.ONELINK, onelink);
|
|
932
991
|
},
|
|
992
|
+
// Ask
|
|
993
|
+
buildAsk(id) {
|
|
994
|
+
return new Ask_default(id);
|
|
995
|
+
},
|
|
996
|
+
createAskAction(id) {
|
|
997
|
+
return new Action_default(ActionType.ASK, new Ask_default(id));
|
|
998
|
+
},
|
|
999
|
+
createAskActionWithData(ask) {
|
|
1000
|
+
return new Action_default(ActionType.ASK, ask);
|
|
1001
|
+
},
|
|
933
1002
|
// AgencyInvite
|
|
934
1003
|
buildAgencyInvite(id, type) {
|
|
935
1004
|
return new AgencyInvite_default(id, type);
|
package/package.json
CHANGED
|
@@ -157,6 +157,27 @@ export default class ActionBridge {
|
|
|
157
157
|
return ActionCreator.createOnelinkActionWithData(onelink);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
ask(id, options) {
|
|
161
|
+
var data = ActionCreator.buildAsk(id);
|
|
162
|
+
if (options) {
|
|
163
|
+
if (options.title != null) data.setTitle(options.title);
|
|
164
|
+
if (options.message != null) data.setMessage(options.message);
|
|
165
|
+
if (options.accepted != null) data.setAccepted(options.accepted);
|
|
166
|
+
if (options.text != null) data.setText(options.text);
|
|
167
|
+
}
|
|
168
|
+
return this._adapter.sendAction(ActionCreator.createAskActionWithData(data));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
buildAsk(id) {
|
|
172
|
+
return ActionCreator.buildAsk(id);
|
|
173
|
+
}
|
|
174
|
+
createAskAction(id) {
|
|
175
|
+
return ActionCreator.createAskAction(id);
|
|
176
|
+
}
|
|
177
|
+
createAskActionWithData(ask) {
|
|
178
|
+
return ActionCreator.createAskActionWithData(ask);
|
|
179
|
+
}
|
|
180
|
+
|
|
160
181
|
agencyInvite(id, type) {
|
|
161
182
|
return this._adapter.sendAction(ActionCreator.createAgencyInviteAction(id, type));
|
|
162
183
|
}
|
package/src/bridge/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits,
|
|
2
|
+
Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, Ask, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits,
|
|
3
3
|
ActionType, ActionData, ActionCreator,
|
|
4
4
|
} from '../core/index.js';
|
|
5
5
|
import { IActionAdapter, RNWebViewAdapter, MockAdapter, AdapterOptions, SendActionOption } from '../adapters/index.js';
|
|
@@ -52,6 +52,11 @@ export declare class ActionBridge {
|
|
|
52
52
|
createOnelinkAction(url: string): Action;
|
|
53
53
|
createOnelinkActionWithData(onelink: Onelink): Action;
|
|
54
54
|
|
|
55
|
+
ask(id: number, options?: { title?: string; message?: string; accepted?: boolean; text?: string }): Promise<any>;
|
|
56
|
+
buildAsk(id: number): Ask;
|
|
57
|
+
createAskAction(id: number): Action;
|
|
58
|
+
createAskActionWithData(ask: Ask): Action;
|
|
59
|
+
|
|
55
60
|
agencyInvite(id: number, type: string): Promise<any>;
|
|
56
61
|
buildAgencyInvite(id: number, type: string): AgencyInvite;
|
|
57
62
|
createAgencyInviteAction(id: number, type: string): Action;
|
|
@@ -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 Ask from './types/Ask.js';
|
|
8
9
|
import AgencyInvite from './types/AgencyInvite.js';
|
|
9
10
|
import Recharge from './types/Recharge.js';
|
|
10
11
|
import Close from './types/Close.js';
|
|
@@ -21,6 +22,7 @@ const ActionType = {
|
|
|
21
22
|
ENTER_ROOM: 'enter_room',
|
|
22
23
|
LIVE_DETECT: 'live_detect',
|
|
23
24
|
ONELINK: 'onelink',
|
|
25
|
+
ASK: 'ask',
|
|
24
26
|
AGENCY_INVITE: 'agency_invite',
|
|
25
27
|
RECHARGE: 'recharge',
|
|
26
28
|
CLOSE: 'close',
|
|
@@ -37,6 +39,7 @@ const ActionData = {
|
|
|
37
39
|
EnterRoom,
|
|
38
40
|
LiveDetect,
|
|
39
41
|
Onelink,
|
|
42
|
+
Ask,
|
|
40
43
|
AgencyInvite,
|
|
41
44
|
Recharge,
|
|
42
45
|
Close,
|
|
@@ -150,6 +153,19 @@ const ActionCreator = {
|
|
|
150
153
|
return new Action(ActionType.ONELINK, onelink);
|
|
151
154
|
},
|
|
152
155
|
|
|
156
|
+
// Ask
|
|
157
|
+
buildAsk(id) {
|
|
158
|
+
return new Ask(id);
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
createAskAction(id) {
|
|
162
|
+
return new Action(ActionType.ASK, new Ask(id));
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
createAskActionWithData(ask) {
|
|
166
|
+
return new Action(ActionType.ASK, ask);
|
|
167
|
+
},
|
|
168
|
+
|
|
153
169
|
// AgencyInvite
|
|
154
170
|
buildAgencyInvite(id, type) {
|
|
155
171
|
return new AgencyInvite(id, type);
|
package/src/core/index.d.ts
CHANGED
|
@@ -131,6 +131,26 @@ export class Onelink {
|
|
|
131
131
|
toMap(): Record<string, any>;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
export class Ask {
|
|
135
|
+
constructor(id: number);
|
|
136
|
+
text: string | null;
|
|
137
|
+
id: number;
|
|
138
|
+
title: string | null;
|
|
139
|
+
message: string | null;
|
|
140
|
+
accepted: boolean | null;
|
|
141
|
+
getText(): string | null;
|
|
142
|
+
setText(text: string): this;
|
|
143
|
+
getId(): number;
|
|
144
|
+
setId(id: number): this;
|
|
145
|
+
getTitle(): string | null;
|
|
146
|
+
setTitle(title: string): this;
|
|
147
|
+
getMessage(): string | null;
|
|
148
|
+
setMessage(message: string): this;
|
|
149
|
+
getAccepted(): boolean | null;
|
|
150
|
+
setAccepted(accepted: boolean): this;
|
|
151
|
+
toMap(): Record<string, any>;
|
|
152
|
+
}
|
|
153
|
+
|
|
134
154
|
export class AgencyInfo {
|
|
135
155
|
id: string | null;
|
|
136
156
|
name: string | null;
|
|
@@ -302,7 +322,7 @@ export class Action {
|
|
|
302
322
|
toJson(): string;
|
|
303
323
|
}
|
|
304
324
|
|
|
305
|
-
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite' | 'recharge' | 'close' | 'config' | 'track' | 'grant_benefits';
|
|
325
|
+
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'ask' | 'agency_invite' | 'recharge' | 'close' | 'config' | 'track' | 'grant_benefits';
|
|
306
326
|
|
|
307
327
|
export const ActionType: {
|
|
308
328
|
JUMP: 'jump';
|
|
@@ -312,6 +332,7 @@ export const ActionType: {
|
|
|
312
332
|
ENTER_ROOM: 'enter_room';
|
|
313
333
|
LIVE_DETECT: 'live_detect';
|
|
314
334
|
ONELINK: 'onelink';
|
|
335
|
+
ASK: 'ask';
|
|
315
336
|
AGENCY_INVITE: 'agency_invite';
|
|
316
337
|
RECHARGE: 'recharge';
|
|
317
338
|
CLOSE: 'close';
|
|
@@ -328,6 +349,7 @@ export const ActionData: {
|
|
|
328
349
|
EnterRoom: typeof EnterRoom;
|
|
329
350
|
LiveDetect: typeof LiveDetect;
|
|
330
351
|
Onelink: typeof Onelink;
|
|
352
|
+
Ask: typeof Ask;
|
|
331
353
|
AgencyInvite: typeof AgencyInvite;
|
|
332
354
|
Recharge: typeof Recharge;
|
|
333
355
|
Close: typeof Close;
|
|
@@ -362,6 +384,9 @@ export const ActionCreator: {
|
|
|
362
384
|
buildOnelink(url: string): Onelink;
|
|
363
385
|
createOnelinkAction(url: string): Action;
|
|
364
386
|
createOnelinkActionWithData(onelink: Onelink): Action;
|
|
387
|
+
buildAsk(id: number): Ask;
|
|
388
|
+
createAskAction(id: number): Action;
|
|
389
|
+
createAskActionWithData(ask: Ask): Action;
|
|
365
390
|
buildAgencyInvite(id: number, type: string): AgencyInvite;
|
|
366
391
|
createAgencyInviteAction(id: number, type: string): Action;
|
|
367
392
|
createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
|
package/src/core/index.js
CHANGED
|
@@ -6,6 +6,7 @@ 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 Ask } from './types/Ask.js';
|
|
9
10
|
export { default as AgencyInvite } from './types/AgencyInvite.js';
|
|
10
11
|
export { default as Recharge } from './types/Recharge.js';
|
|
11
12
|
export { default as Close } from './types/Close.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class Ask {
|
|
2
|
+
constructor(id) {
|
|
3
|
+
if (id == null) throw new Error('id cannot be null');
|
|
4
|
+
this.text = null;
|
|
5
|
+
this.id = id;
|
|
6
|
+
this.title = null;
|
|
7
|
+
this.message = null;
|
|
8
|
+
this.accepted = null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getText() { return this.text; } setText(text) { this.text = text; return this; }
|
|
12
|
+
getId() { return this.id; } setId(id) { this.id = id; return this; }
|
|
13
|
+
getTitle() { return this.title; } setTitle(title) { this.title = title; return this; }
|
|
14
|
+
getMessage() { return this.message; } setMessage(message) { this.message = message; return this; }
|
|
15
|
+
getAccepted() { return this.accepted; } setAccepted(accepted) { this.accepted = accepted; return this; }
|
|
16
|
+
|
|
17
|
+
toMap() {
|
|
18
|
+
const map = {};
|
|
19
|
+
if (this.text != null) map.text = this.text;
|
|
20
|
+
if (this.id != null) map.id = this.id;
|
|
21
|
+
if (this.title != null) map.title = this.title;
|
|
22
|
+
if (this.message != null) map.message = this.message;
|
|
23
|
+
if (this.accepted != null) map.accepted = this.accepted;
|
|
24
|
+
return map;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Ask;
|
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, Recharge, Close, Config, Track, GrantBenefits, Action } from './core/index.js';
|
|
2
|
+
export { ActionCreator, ActionData, ActionType, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, Ask, AgencyInvite, Recharge, Close, Config, Track, GrantBenefits, 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,6 +8,7 @@ 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 { Ask } from './core/index.js';
|
|
11
12
|
export { AgencyInvite } from './core/index.js';
|
|
12
13
|
export { Recharge } from './core/index.js';
|
|
13
14
|
export { Close } from './core/index.js';
|