@yagolive/event-kit 1.0.7 → 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 +72 -0
- package/README.md +81 -2
- package/dist/js/action_bridge.umd.js +341 -3
- package/dist/js/action_creator.umd.js +285 -3
- package/package.json +1 -1
- package/src/bridge/ActionBridge.js +62 -0
- package/src/bridge/index.d.ts +16 -1
- package/src/core/ActionCreator.js +48 -0
- package/src/core/index.d.ts +100 -1
- package/src/core/index.js +3 -0
- package/src/core/types/Ask.js +28 -0
- package/src/core/types/GrantBenefits.js +86 -0
- package/src/core/types/Track.js +35 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,77 @@
|
|
|
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
|
+
|
|
36
|
+
## @1.0.8 (2026-06-17)
|
|
37
|
+
|
|
38
|
+
### 新增
|
|
39
|
+
|
|
40
|
+
- **Track Action(统计事件上报)**: 新增统计事件上报动作类型
|
|
41
|
+
- `ActionType.TRACK` = `'track'`
|
|
42
|
+
- `Track` 数据类:必填字段 `name`(string,事件名);可选字段 `params`(Record,事件参数)、`options`(Record,事件选项)、`text`
|
|
43
|
+
- `ActionCreator.buildTrack(name)`、`createTrackAction(name)`、`createTrackActionWithData(track)`
|
|
44
|
+
- `ActionBridge.track(name, params?, options?)`、`buildTrack(name)`、`createTrackAction(name)`、`createTrackActionWithData(track)`
|
|
45
|
+
- `bridge.track(name, params, options)` 便捷方法支持传入事件参数和选项
|
|
46
|
+
|
|
47
|
+
- **GrantBenefits Action(权益下发)**: 新增权益下发动作类型
|
|
48
|
+
- `ActionType.GRANT_BENEFITS` = `'grant_benefits'`
|
|
49
|
+
- `GrantBenefits` 数据类:必填字段 `benefits`(BSBenefit[],下发权益列表);可选字段 `title`(弹窗标题)、`message`(弹窗消息)、`okAction`(Action,确认按钮动作)、`closeable`(boolean,是否允许关闭,默认 true)、`duration`(number,自动关闭时间,单位 ms)、`theme`(弹窗主题配置)、`text`
|
|
50
|
+
- `GrantBenefits.Theme` 内部类:`image`(主题图片)、`tintColor`(主题色)、`buttonImage`(按钮图片,可选)、`topInset`(头部高度,默认 196)
|
|
51
|
+
- `ActionCreator.buildGrantBenefits(benefits)`、`createGrantBenefitsAction(benefits)`、`createGrantBenefitsActionWithData(grantBenefits)`
|
|
52
|
+
- `ActionBridge.grantBenefits(benefits, options?)`、`buildGrantBenefits(benefits)`、`createGrantBenefitsAction(benefits)`、`createGrantBenefitsActionWithData(grantBenefits)`
|
|
53
|
+
- `bridge.grantBenefits(benefits, options)` 便捷方法支持传入可选配置对象
|
|
54
|
+
|
|
55
|
+
### Action 类型完整列表
|
|
56
|
+
|
|
57
|
+
| 类型 | 字段 | 说明 |
|
|
58
|
+
|------|------|------|
|
|
59
|
+
| jump | path: string, text?: string | 页面跳转 |
|
|
60
|
+
| navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
|
|
61
|
+
| replace | screen: string, params?: Record, text?: string | 替换当前页面 |
|
|
62
|
+
| goback | text?: string | 返回上一页 |
|
|
63
|
+
| enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
|
|
64
|
+
| live_detect | text?: string | 活体检测 |
|
|
65
|
+
| onelink | url: string, share?: boolean, text?: string | 分享链接 |
|
|
66
|
+
| agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
|
|
67
|
+
| recharge | text?: string | 充值操作 |
|
|
68
|
+
| close | text?: string | 关闭 WebView 窗口(addon 附加) |
|
|
69
|
+
| config | theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string, text?: string | 配置 WebView 主题(addon 附加) |
|
|
70
|
+
| track | name: string, params?: Record, options?: Record, text?: string | 统计事件上报 |
|
|
71
|
+
| grant_benefits | benefits: any[], title?: string, message?: string, okAction?: Action, closeable?: boolean, duration?: number, theme?: { image, tintColor, buttonImage?, topInset? }, text?: string | 权益下发 |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
3
75
|
## @1.0.7 (2026-06-10)
|
|
4
76
|
|
|
5
77
|
### 新增
|
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 |
|
|
173
|
-
| `ActionType` | Object | Action 类型枚举:JUMP, NAVIGATE, REPLACE, GOBACK, ENTER_ROOM, LIVE_DETECT, ONELINK, AGENCY_INVITE, RECHARGE, CLOSE, CONFIG |
|
|
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 |
|
|
@@ -211,6 +214,12 @@ import { ActionCreator } from '@yagolive/event-kit';
|
|
|
211
214
|
| `buildConfig()` | - | Config | 构建 Config 对象(链式配置,addon) |
|
|
212
215
|
| `createConfigAction()` | - | Action | 创建配置 Action(addon) |
|
|
213
216
|
| `createConfigActionWithData(config)` | config: Config | Action | 从 Config 对象创建 Action(addon) |
|
|
217
|
+
| `buildTrack(name)` | name: string | Track | 构建 Track 对象(链式配置) |
|
|
218
|
+
| `createTrackAction(name)` | name: string | Action | 创建统计事件上报 Action |
|
|
219
|
+
| `createTrackActionWithData(track)` | track: Track | Action | 从 Track 对象创建 Action |
|
|
220
|
+
| `buildGrantBenefits(benefits)` | benefits: any[] | GrantBenefits | 构建 GrantBenefits 对象(链式配置) |
|
|
221
|
+
| `createGrantBenefitsAction(benefits)` | benefits: any[] | Action | 创建权益下发 Action |
|
|
222
|
+
| `createGrantBenefitsActionWithData(grantBenefits)` | grantBenefits: GrantBenefits | Action | 从 GrantBenefits 对象创建 Action |
|
|
214
223
|
|
|
215
224
|
#### 使用示例
|
|
216
225
|
|
|
@@ -251,10 +260,13 @@ ActionType.GOBACK // 'goback'
|
|
|
251
260
|
ActionType.ENTER_ROOM // 'enter_room'
|
|
252
261
|
ActionType.LIVE_DETECT // 'live_detect'
|
|
253
262
|
ActionType.ONELINK // 'onelink'
|
|
263
|
+
ActionType.ASK // 'ask'
|
|
254
264
|
ActionType.AGENCY_INVITE // 'agency_invite'
|
|
255
265
|
ActionType.RECHARGE // 'recharge'
|
|
256
266
|
ActionType.CLOSE // 'close' (addon)
|
|
257
267
|
ActionType.CONFIG // 'config' (addon)
|
|
268
|
+
ActionType.TRACK // 'track'
|
|
269
|
+
ActionType.GRANT_BENEFITS // 'grant_benefits'
|
|
258
270
|
```
|
|
259
271
|
|
|
260
272
|
### ActionBridge
|
|
@@ -322,6 +334,9 @@ new ActionBridge(adapter, options?)
|
|
|
322
334
|
| `onelink(url)` | url: string | Promise | 打开 Onelink |
|
|
323
335
|
| `buildOnelink(url?)` | url?: string | Onelink | 构建 Onelink 对象(链式配置) |
|
|
324
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(不自动发送) |
|
|
325
340
|
| `agencyInvite(id, type)` | id: number, type: string | Promise | 工会邀请 |
|
|
326
341
|
| `buildAgencyInvite(id, type)` | id: number, type: string | AgencyInvite | 构建 AgencyInvite 对象(链式配置) |
|
|
327
342
|
| `createAgencyInviteActionWithData(agencyInvite)` | agencyInvite: AgencyInvite | Action | 从 AgencyInvite 对象创建 Action(不自动发送) |
|
|
@@ -334,6 +349,12 @@ new ActionBridge(adapter, options?)
|
|
|
334
349
|
| `config(options?)` | options?: { theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string } | Promise | 配置 WebView 主题色(addon) |
|
|
335
350
|
| `buildConfig()` | - | Config | 构建 Config 对象(链式配置,addon) |
|
|
336
351
|
| `createConfigActionWithData(config)` | config: Config | Action | 从 Config 对象创建 Action(addon) |
|
|
352
|
+
| `track(name, params?, options?)` | name: string, params?: Object, options?: Object | Promise | 统计事件上报 |
|
|
353
|
+
| `buildTrack(name)` | name: string | Track | 构建 Track 对象(链式配置) |
|
|
354
|
+
| `createTrackActionWithData(track)` | track: Track | Action | 从 Track 对象创建 Action(不自动发送) |
|
|
355
|
+
| `grantBenefits(benefits, options?)` | benefits: any[], options?: { title?, message?, okAction?, closeable?, duration?, theme?, text? } | Promise | 权益下发 |
|
|
356
|
+
| `buildGrantBenefits(benefits)` | benefits: any[] | GrantBenefits | 构建 GrantBenefits 对象(链式配置) |
|
|
357
|
+
| `createGrantBenefitsActionWithData(grantBenefits)` | grantBenefits: GrantBenefits | Action | 从 GrantBenefits 对象创建 Action(不自动发送) |
|
|
337
358
|
|
|
338
359
|
#### 静态方法
|
|
339
360
|
|
|
@@ -665,6 +686,21 @@ Onelink Action 数据。
|
|
|
665
686
|
| `setUrl(url)` | url: string (必填) | 设置链接 URL,返回 this |
|
|
666
687
|
| `setShare(share)` | share: boolean | 设置是否显示分享弹窗,返回 this |
|
|
667
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
|
+
|
|
668
704
|
### AgencyInvite
|
|
669
705
|
|
|
670
706
|
工会邀请 Action 数据。
|
|
@@ -733,6 +769,49 @@ Onelink Action 数据。
|
|
|
733
769
|
- `Config.Theme.DARK` = `'dark'`
|
|
734
770
|
- `Config.Theme.LIGHT` = `'light'`
|
|
735
771
|
|
|
772
|
+
### Track
|
|
773
|
+
|
|
774
|
+
统计事件上报 Action 数据。
|
|
775
|
+
|
|
776
|
+
| 方法 | 参数 | 说明 |
|
|
777
|
+
|------|------|------|
|
|
778
|
+
| `constructor(name)` | name: string (必填) | 创建 Track 数据 |
|
|
779
|
+
| `setText(text)` | text: string | 设置显示文本,返回 this |
|
|
780
|
+
| `setName(name)` | name: string (必填) | 设置事件名,返回 this |
|
|
781
|
+
| `setParams(params)` | params: Record<string, any> | 设置事件参数,返回 this |
|
|
782
|
+
| `setOptions(options)` | options: Record<string, any> | 设置事件选项,返回 this |
|
|
783
|
+
|
|
784
|
+
### GrantBenefits
|
|
785
|
+
|
|
786
|
+
权益下发 Action 数据。
|
|
787
|
+
|
|
788
|
+
| 方法 | 参数 | 说明 |
|
|
789
|
+
|------|------|------|
|
|
790
|
+
| `constructor(benefits)` | benefits: any[] (必填) | 创建 GrantBenefits 数据 |
|
|
791
|
+
| `setText(text)` | text: string | 设置显示文本,返回 this |
|
|
792
|
+
| `setBenefits(benefits)` | benefits: any[] (必填) | 设置权益列表,返回 this |
|
|
793
|
+
| `setTitle(title)` | title: string | 设置弹窗标题,返回 this |
|
|
794
|
+
| `setMessage(message)` | message: string | 设置弹窗消息,返回 this |
|
|
795
|
+
| `setOkAction(okAction)` | okAction: Action | 设置确认按钮动作,返回 this |
|
|
796
|
+
| `setCloseable(closeable)` | closeable: boolean | 设置是否允许关闭,返回 this |
|
|
797
|
+
| `setDuration(duration)` | duration: number | 设置自动关闭时间(毫秒),返回 this |
|
|
798
|
+
| `setTheme(theme)` | theme: Theme | 设置弹窗主题配置,返回 this |
|
|
799
|
+
|
|
800
|
+
**静态属性:**
|
|
801
|
+
|
|
802
|
+
| 属性 | 说明 |
|
|
803
|
+
|------|------|
|
|
804
|
+
| `GrantBenefits.Theme` | 弹窗主题配置内部类 |
|
|
805
|
+
|
|
806
|
+
**Theme 内部类:**
|
|
807
|
+
|
|
808
|
+
| 方法 | 参数 | 说明 |
|
|
809
|
+
|------|------|------|
|
|
810
|
+
| `setImage(image)` | image: string (必填) | 设置主题图片,返回 this |
|
|
811
|
+
| `setTintColor(tintColor)` | tintColor: string (必填) | 设置主题色,返回 this |
|
|
812
|
+
| `setButtonImage(buttonImage)` | buttonImage: string | 设置按钮图片,返回 this |
|
|
813
|
+
| `setTopInset(topInset)` | topInset: number | 设置头部高度(默认 196),返回 this |
|
|
814
|
+
|
|
736
815
|
### Action
|
|
737
816
|
|
|
738
817
|
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() {
|
|
@@ -593,6 +650,195 @@ Config.Theme = {
|
|
|
593
650
|
};
|
|
594
651
|
var Config_default = Config;
|
|
595
652
|
|
|
653
|
+
// src/core/types/Track.js
|
|
654
|
+
var Track = class {
|
|
655
|
+
constructor(name) {
|
|
656
|
+
this.text = null;
|
|
657
|
+
if (name == null) {
|
|
658
|
+
throw new Error("name cannot be null");
|
|
659
|
+
}
|
|
660
|
+
this.name = name;
|
|
661
|
+
this.params = null;
|
|
662
|
+
this.options = null;
|
|
663
|
+
}
|
|
664
|
+
getText() {
|
|
665
|
+
return this.text;
|
|
666
|
+
}
|
|
667
|
+
setText(text) {
|
|
668
|
+
this.text = text;
|
|
669
|
+
return this;
|
|
670
|
+
}
|
|
671
|
+
getName() {
|
|
672
|
+
return this.name;
|
|
673
|
+
}
|
|
674
|
+
setName(name) {
|
|
675
|
+
if (name == null) throw new Error("name cannot be null");
|
|
676
|
+
this.name = name;
|
|
677
|
+
return this;
|
|
678
|
+
}
|
|
679
|
+
getParams() {
|
|
680
|
+
return this.params;
|
|
681
|
+
}
|
|
682
|
+
setParams(params) {
|
|
683
|
+
this.params = params != null ? params : null;
|
|
684
|
+
return this;
|
|
685
|
+
}
|
|
686
|
+
getOptions() {
|
|
687
|
+
return this.options;
|
|
688
|
+
}
|
|
689
|
+
setOptions(options) {
|
|
690
|
+
this.options = options != null ? options : null;
|
|
691
|
+
return this;
|
|
692
|
+
}
|
|
693
|
+
toMap() {
|
|
694
|
+
const map = {};
|
|
695
|
+
if (this.text != null) map.text = this.text;
|
|
696
|
+
if (this.name != null) map.name = this.name;
|
|
697
|
+
if (this.params != null) map.params = this.params;
|
|
698
|
+
if (this.options != null) map.options = this.options;
|
|
699
|
+
return map;
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
var Track_default = Track;
|
|
703
|
+
|
|
704
|
+
// src/core/types/GrantBenefits.js
|
|
705
|
+
var Theme = class {
|
|
706
|
+
constructor() {
|
|
707
|
+
this.image = null;
|
|
708
|
+
this.tintColor = null;
|
|
709
|
+
this.buttonImage = null;
|
|
710
|
+
this.topInset = null;
|
|
711
|
+
}
|
|
712
|
+
getImage() {
|
|
713
|
+
return this.image;
|
|
714
|
+
}
|
|
715
|
+
setImage(image) {
|
|
716
|
+
this.image = image;
|
|
717
|
+
return this;
|
|
718
|
+
}
|
|
719
|
+
getTintColor() {
|
|
720
|
+
return this.tintColor;
|
|
721
|
+
}
|
|
722
|
+
setTintColor(tintColor) {
|
|
723
|
+
this.tintColor = tintColor;
|
|
724
|
+
return this;
|
|
725
|
+
}
|
|
726
|
+
getButtonImage() {
|
|
727
|
+
return this.buttonImage;
|
|
728
|
+
}
|
|
729
|
+
setButtonImage(buttonImage) {
|
|
730
|
+
this.buttonImage = buttonImage;
|
|
731
|
+
return this;
|
|
732
|
+
}
|
|
733
|
+
getTopInset() {
|
|
734
|
+
return this.topInset;
|
|
735
|
+
}
|
|
736
|
+
setTopInset(topInset) {
|
|
737
|
+
this.topInset = topInset;
|
|
738
|
+
return this;
|
|
739
|
+
}
|
|
740
|
+
toMap() {
|
|
741
|
+
const map = {};
|
|
742
|
+
if (this.image != null) map.image = this.image;
|
|
743
|
+
if (this.tintColor != null) map.tintColor = this.tintColor;
|
|
744
|
+
if (this.buttonImage != null) map.buttonImage = this.buttonImage;
|
|
745
|
+
if (this.topInset != null) map.topInset = this.topInset;
|
|
746
|
+
return map;
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
var GrantBenefits = class {
|
|
750
|
+
constructor(benefits) {
|
|
751
|
+
this.text = null;
|
|
752
|
+
if (benefits == null) {
|
|
753
|
+
throw new Error("benefits cannot be null");
|
|
754
|
+
}
|
|
755
|
+
this.benefits = benefits;
|
|
756
|
+
this.title = null;
|
|
757
|
+
this.message = null;
|
|
758
|
+
this.okAction = null;
|
|
759
|
+
this.closeable = null;
|
|
760
|
+
this.duration = null;
|
|
761
|
+
this.theme = null;
|
|
762
|
+
}
|
|
763
|
+
getText() {
|
|
764
|
+
return this.text;
|
|
765
|
+
}
|
|
766
|
+
setText(text) {
|
|
767
|
+
this.text = text;
|
|
768
|
+
return this;
|
|
769
|
+
}
|
|
770
|
+
getBenefits() {
|
|
771
|
+
return this.benefits;
|
|
772
|
+
}
|
|
773
|
+
setBenefits(benefits) {
|
|
774
|
+
if (benefits == null) throw new Error("benefits cannot be null");
|
|
775
|
+
this.benefits = benefits;
|
|
776
|
+
return this;
|
|
777
|
+
}
|
|
778
|
+
getTitle() {
|
|
779
|
+
return this.title;
|
|
780
|
+
}
|
|
781
|
+
setTitle(title) {
|
|
782
|
+
this.title = title;
|
|
783
|
+
return this;
|
|
784
|
+
}
|
|
785
|
+
getMessage() {
|
|
786
|
+
return this.message;
|
|
787
|
+
}
|
|
788
|
+
setMessage(message) {
|
|
789
|
+
this.message = message;
|
|
790
|
+
return this;
|
|
791
|
+
}
|
|
792
|
+
getOkAction() {
|
|
793
|
+
return this.okAction;
|
|
794
|
+
}
|
|
795
|
+
setOkAction(okAction) {
|
|
796
|
+
this.okAction = okAction;
|
|
797
|
+
return this;
|
|
798
|
+
}
|
|
799
|
+
getCloseable() {
|
|
800
|
+
return this.closeable;
|
|
801
|
+
}
|
|
802
|
+
setCloseable(closeable) {
|
|
803
|
+
this.closeable = closeable;
|
|
804
|
+
return this;
|
|
805
|
+
}
|
|
806
|
+
getDuration() {
|
|
807
|
+
return this.duration;
|
|
808
|
+
}
|
|
809
|
+
setDuration(duration) {
|
|
810
|
+
this.duration = duration;
|
|
811
|
+
return this;
|
|
812
|
+
}
|
|
813
|
+
getTheme() {
|
|
814
|
+
return this.theme;
|
|
815
|
+
}
|
|
816
|
+
setTheme(theme) {
|
|
817
|
+
this.theme = theme;
|
|
818
|
+
return this;
|
|
819
|
+
}
|
|
820
|
+
toMap() {
|
|
821
|
+
const map = {};
|
|
822
|
+
if (this.text != null) map.text = this.text;
|
|
823
|
+
if (this.title != null) map.title = this.title;
|
|
824
|
+
if (this.message != null) map.message = this.message;
|
|
825
|
+
if (this.benefits != null) map.benefits = this.benefits;
|
|
826
|
+
if (this.okAction != null) {
|
|
827
|
+
if (typeof this.okAction.toMap === "function") {
|
|
828
|
+
map.okAction = this.okAction.toMap();
|
|
829
|
+
} else {
|
|
830
|
+
map.okAction = this.okAction;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
if (this.closeable != null) map.closeable = this.closeable;
|
|
834
|
+
if (this.duration != null) map.duration = this.duration;
|
|
835
|
+
if (this.theme != null) map.theme = this.theme.toMap();
|
|
836
|
+
return map;
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
GrantBenefits.Theme = Theme;
|
|
840
|
+
var GrantBenefits_default = GrantBenefits;
|
|
841
|
+
|
|
596
842
|
// src/core/types/Action.js
|
|
597
843
|
var Action = class {
|
|
598
844
|
constructor(type, data) {
|
|
@@ -638,10 +884,13 @@ var ActionType = {
|
|
|
638
884
|
ENTER_ROOM: "enter_room",
|
|
639
885
|
LIVE_DETECT: "live_detect",
|
|
640
886
|
ONELINK: "onelink",
|
|
887
|
+
ASK: "ask",
|
|
641
888
|
AGENCY_INVITE: "agency_invite",
|
|
642
889
|
RECHARGE: "recharge",
|
|
643
890
|
CLOSE: "close",
|
|
644
|
-
CONFIG: "config"
|
|
891
|
+
CONFIG: "config",
|
|
892
|
+
TRACK: "track",
|
|
893
|
+
GRANT_BENEFITS: "grant_benefits"
|
|
645
894
|
};
|
|
646
895
|
var ActionData = {
|
|
647
896
|
Jump: Jump_default,
|
|
@@ -651,10 +900,13 @@ var ActionData = {
|
|
|
651
900
|
EnterRoom: EnterRoom_default,
|
|
652
901
|
LiveDetect: LiveDetect_default,
|
|
653
902
|
Onelink: Onelink_default,
|
|
903
|
+
Ask: Ask_default,
|
|
654
904
|
AgencyInvite: AgencyInvite_default,
|
|
655
905
|
Recharge: Recharge_default,
|
|
656
906
|
Close: Close_default,
|
|
657
|
-
Config: Config_default
|
|
907
|
+
Config: Config_default,
|
|
908
|
+
Track: Track_default,
|
|
909
|
+
GrantBenefits: GrantBenefits_default
|
|
658
910
|
};
|
|
659
911
|
var ActionCreator = {
|
|
660
912
|
ActionData,
|
|
@@ -737,6 +989,16 @@ var ActionCreator = {
|
|
|
737
989
|
createOnelinkActionWithData(onelink) {
|
|
738
990
|
return new Action_default(ActionType.ONELINK, onelink);
|
|
739
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
|
+
},
|
|
740
1002
|
// AgencyInvite
|
|
741
1003
|
buildAgencyInvite(id, type) {
|
|
742
1004
|
return new AgencyInvite_default(id, type);
|
|
@@ -776,6 +1038,26 @@ var ActionCreator = {
|
|
|
776
1038
|
},
|
|
777
1039
|
createConfigActionWithData(config) {
|
|
778
1040
|
return new Action_default(ActionType.CONFIG, config);
|
|
1041
|
+
},
|
|
1042
|
+
// Track
|
|
1043
|
+
buildTrack(name) {
|
|
1044
|
+
return new Track_default(name);
|
|
1045
|
+
},
|
|
1046
|
+
createTrackAction(name) {
|
|
1047
|
+
return new Action_default(ActionType.TRACK, new Track_default(name));
|
|
1048
|
+
},
|
|
1049
|
+
createTrackActionWithData(track) {
|
|
1050
|
+
return new Action_default(ActionType.TRACK, track);
|
|
1051
|
+
},
|
|
1052
|
+
// GrantBenefits
|
|
1053
|
+
buildGrantBenefits(benefits) {
|
|
1054
|
+
return new GrantBenefits_default(benefits);
|
|
1055
|
+
},
|
|
1056
|
+
createGrantBenefitsAction(benefits) {
|
|
1057
|
+
return new Action_default(ActionType.GRANT_BENEFITS, new GrantBenefits_default(benefits));
|
|
1058
|
+
},
|
|
1059
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
1060
|
+
return new Action_default(ActionType.GRANT_BENEFITS, grantBenefits);
|
|
779
1061
|
}
|
|
780
1062
|
};
|
|
781
1063
|
|
|
@@ -1048,6 +1330,25 @@ var ActionBridge = class _ActionBridge {
|
|
|
1048
1330
|
createOnelinkActionWithData(onelink) {
|
|
1049
1331
|
return ActionCreator.createOnelinkActionWithData(onelink);
|
|
1050
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
|
+
}
|
|
1051
1352
|
agencyInvite(id, type) {
|
|
1052
1353
|
return this._adapter.sendAction(ActionCreator.createAgencyInviteAction(id, type));
|
|
1053
1354
|
}
|
|
@@ -1103,6 +1404,43 @@ var ActionBridge = class _ActionBridge {
|
|
|
1103
1404
|
createConfigActionWithData(config) {
|
|
1104
1405
|
return ActionCreator.createConfigActionWithData(config);
|
|
1105
1406
|
}
|
|
1407
|
+
track(name, params, options) {
|
|
1408
|
+
var data = ActionCreator.buildTrack(name);
|
|
1409
|
+
if (params != null) data.setParams(params);
|
|
1410
|
+
if (options != null) data.setOptions(options);
|
|
1411
|
+
return this._adapter.sendAction(ActionCreator.createTrackActionWithData(data));
|
|
1412
|
+
}
|
|
1413
|
+
buildTrack(name) {
|
|
1414
|
+
return ActionCreator.buildTrack(name);
|
|
1415
|
+
}
|
|
1416
|
+
createTrackAction(name) {
|
|
1417
|
+
return ActionCreator.createTrackAction(name);
|
|
1418
|
+
}
|
|
1419
|
+
createTrackActionWithData(track) {
|
|
1420
|
+
return ActionCreator.createTrackActionWithData(track);
|
|
1421
|
+
}
|
|
1422
|
+
grantBenefits(benefits, options) {
|
|
1423
|
+
var data = ActionCreator.buildGrantBenefits(benefits);
|
|
1424
|
+
if (options) {
|
|
1425
|
+
if (options.title != null) data.setTitle(options.title);
|
|
1426
|
+
if (options.message != null) data.setMessage(options.message);
|
|
1427
|
+
if (options.okAction != null) data.setOkAction(options.okAction);
|
|
1428
|
+
if (options.closeable != null) data.setCloseable(options.closeable);
|
|
1429
|
+
if (options.duration != null) data.setDuration(options.duration);
|
|
1430
|
+
if (options.theme != null) data.setTheme(options.theme);
|
|
1431
|
+
if (options.text != null) data.setText(options.text);
|
|
1432
|
+
}
|
|
1433
|
+
return this._adapter.sendAction(ActionCreator.createGrantBenefitsActionWithData(data));
|
|
1434
|
+
}
|
|
1435
|
+
buildGrantBenefits(benefits) {
|
|
1436
|
+
return ActionCreator.buildGrantBenefits(benefits);
|
|
1437
|
+
}
|
|
1438
|
+
createGrantBenefitsAction(benefits) {
|
|
1439
|
+
return ActionCreator.createGrantBenefitsAction(benefits);
|
|
1440
|
+
}
|
|
1441
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
1442
|
+
return ActionCreator.createGrantBenefitsActionWithData(grantBenefits);
|
|
1443
|
+
}
|
|
1106
1444
|
destroy() {
|
|
1107
1445
|
if (typeof this._adapter.destroy === "function") {
|
|
1108
1446
|
this._adapter.destroy();
|