@yagolive/event-kit 1.0.7 → 1.0.8
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 +39 -0
- package/README.md +59 -2
- package/dist/js/action_bridge.umd.js +253 -3
- package/dist/js/action_creator.umd.js +216 -3
- package/package.json +1 -1
- package/src/bridge/ActionBridge.js +41 -0
- package/src/bridge/index.d.ts +11 -1
- package/src/core/ActionCreator.js +32 -0
- package/src/core/index.d.ts +75 -1
- package/src/core/index.js +2 -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 +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## @1.0.8 (2026-06-17)
|
|
4
|
+
|
|
5
|
+
### 新增
|
|
6
|
+
|
|
7
|
+
- **Track Action(统计事件上报)**: 新增统计事件上报动作类型
|
|
8
|
+
- `ActionType.TRACK` = `'track'`
|
|
9
|
+
- `Track` 数据类:必填字段 `name`(string,事件名);可选字段 `params`(Record,事件参数)、`options`(Record,事件选项)、`text`
|
|
10
|
+
- `ActionCreator.buildTrack(name)`、`createTrackAction(name)`、`createTrackActionWithData(track)`
|
|
11
|
+
- `ActionBridge.track(name, params?, options?)`、`buildTrack(name)`、`createTrackAction(name)`、`createTrackActionWithData(track)`
|
|
12
|
+
- `bridge.track(name, params, options)` 便捷方法支持传入事件参数和选项
|
|
13
|
+
|
|
14
|
+
- **GrantBenefits Action(权益下发)**: 新增权益下发动作类型
|
|
15
|
+
- `ActionType.GRANT_BENEFITS` = `'grant_benefits'`
|
|
16
|
+
- `GrantBenefits` 数据类:必填字段 `benefits`(BSBenefit[],下发权益列表);可选字段 `title`(弹窗标题)、`message`(弹窗消息)、`okAction`(Action,确认按钮动作)、`closeable`(boolean,是否允许关闭,默认 true)、`duration`(number,自动关闭时间,单位 ms)、`theme`(弹窗主题配置)、`text`
|
|
17
|
+
- `GrantBenefits.Theme` 内部类:`image`(主题图片)、`tintColor`(主题色)、`buttonImage`(按钮图片,可选)、`topInset`(头部高度,默认 196)
|
|
18
|
+
- `ActionCreator.buildGrantBenefits(benefits)`、`createGrantBenefitsAction(benefits)`、`createGrantBenefitsActionWithData(grantBenefits)`
|
|
19
|
+
- `ActionBridge.grantBenefits(benefits, options?)`、`buildGrantBenefits(benefits)`、`createGrantBenefitsAction(benefits)`、`createGrantBenefitsActionWithData(grantBenefits)`
|
|
20
|
+
- `bridge.grantBenefits(benefits, options)` 便捷方法支持传入可选配置对象
|
|
21
|
+
|
|
22
|
+
### Action 类型完整列表
|
|
23
|
+
|
|
24
|
+
| 类型 | 字段 | 说明 |
|
|
25
|
+
|------|------|------|
|
|
26
|
+
| jump | path: string, text?: string | 页面跳转 |
|
|
27
|
+
| navigate | screen: string, params?: Record, text?: string | 导航到指定屏幕 |
|
|
28
|
+
| replace | screen: string, params?: Record, text?: string | 替换当前页面 |
|
|
29
|
+
| goback | text?: string | 返回上一页 |
|
|
30
|
+
| enter_room | id?: number, match?: string, callbacks?: Record, useReplace?: boolean, text?: string | 进入房间 |
|
|
31
|
+
| live_detect | text?: string | 活体检测 |
|
|
32
|
+
| onelink | url: string, share?: boolean, text?: string | 分享链接 |
|
|
33
|
+
| agency_invite | id: number, type: string, title?: string, message?: string, agencyInfo?: AgencyInfo, accepted?: boolean, text?: string | 工会邀请 |
|
|
34
|
+
| recharge | text?: string | 充值操作 |
|
|
35
|
+
| close | text?: string | 关闭 WebView 窗口(addon 附加) |
|
|
36
|
+
| config | theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string, text?: string | 配置 WebView 主题(addon 附加) |
|
|
37
|
+
| track | name: string, params?: Record, options?: Record, text?: string | 统计事件上报 |
|
|
38
|
+
| grant_benefits | benefits: any[], title?: string, message?: string, okAction?: Action, closeable?: boolean, duration?: number, theme?: { image, tintColor, buttonImage?, topInset? }, text?: string | 权益下发 |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
3
42
|
## @1.0.7 (2026-06-10)
|
|
4
43
|
|
|
5
44
|
### 新增
|
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, 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 |
|
|
174
174
|
|
|
175
175
|
#### 工厂方法
|
|
176
176
|
|
|
@@ -211,6 +211,12 @@ import { ActionCreator } from '@yagolive/event-kit';
|
|
|
211
211
|
| `buildConfig()` | - | Config | 构建 Config 对象(链式配置,addon) |
|
|
212
212
|
| `createConfigAction()` | - | Action | 创建配置 Action(addon) |
|
|
213
213
|
| `createConfigActionWithData(config)` | config: Config | Action | 从 Config 对象创建 Action(addon) |
|
|
214
|
+
| `buildTrack(name)` | name: string | Track | 构建 Track 对象(链式配置) |
|
|
215
|
+
| `createTrackAction(name)` | name: string | Action | 创建统计事件上报 Action |
|
|
216
|
+
| `createTrackActionWithData(track)` | track: Track | Action | 从 Track 对象创建 Action |
|
|
217
|
+
| `buildGrantBenefits(benefits)` | benefits: any[] | GrantBenefits | 构建 GrantBenefits 对象(链式配置) |
|
|
218
|
+
| `createGrantBenefitsAction(benefits)` | benefits: any[] | Action | 创建权益下发 Action |
|
|
219
|
+
| `createGrantBenefitsActionWithData(grantBenefits)` | grantBenefits: GrantBenefits | Action | 从 GrantBenefits 对象创建 Action |
|
|
214
220
|
|
|
215
221
|
#### 使用示例
|
|
216
222
|
|
|
@@ -255,6 +261,8 @@ ActionType.AGENCY_INVITE // 'agency_invite'
|
|
|
255
261
|
ActionType.RECHARGE // 'recharge'
|
|
256
262
|
ActionType.CLOSE // 'close' (addon)
|
|
257
263
|
ActionType.CONFIG // 'config' (addon)
|
|
264
|
+
ActionType.TRACK // 'track'
|
|
265
|
+
ActionType.GRANT_BENEFITS // 'grant_benefits'
|
|
258
266
|
```
|
|
259
267
|
|
|
260
268
|
### ActionBridge
|
|
@@ -334,6 +342,12 @@ new ActionBridge(adapter, options?)
|
|
|
334
342
|
| `config(options?)` | options?: { theme?: 'dark' \| 'light', brandColor?: string, tintColor?: string, title?: string } | Promise | 配置 WebView 主题色(addon) |
|
|
335
343
|
| `buildConfig()` | - | Config | 构建 Config 对象(链式配置,addon) |
|
|
336
344
|
| `createConfigActionWithData(config)` | config: Config | Action | 从 Config 对象创建 Action(addon) |
|
|
345
|
+
| `track(name, params?, options?)` | name: string, params?: Object, options?: Object | Promise | 统计事件上报 |
|
|
346
|
+
| `buildTrack(name)` | name: string | Track | 构建 Track 对象(链式配置) |
|
|
347
|
+
| `createTrackActionWithData(track)` | track: Track | Action | 从 Track 对象创建 Action(不自动发送) |
|
|
348
|
+
| `grantBenefits(benefits, options?)` | benefits: any[], options?: { title?, message?, okAction?, closeable?, duration?, theme?, text? } | Promise | 权益下发 |
|
|
349
|
+
| `buildGrantBenefits(benefits)` | benefits: any[] | GrantBenefits | 构建 GrantBenefits 对象(链式配置) |
|
|
350
|
+
| `createGrantBenefitsActionWithData(grantBenefits)` | grantBenefits: GrantBenefits | Action | 从 GrantBenefits 对象创建 Action(不自动发送) |
|
|
337
351
|
|
|
338
352
|
#### 静态方法
|
|
339
353
|
|
|
@@ -733,6 +747,49 @@ Onelink Action 数据。
|
|
|
733
747
|
- `Config.Theme.DARK` = `'dark'`
|
|
734
748
|
- `Config.Theme.LIGHT` = `'light'`
|
|
735
749
|
|
|
750
|
+
### Track
|
|
751
|
+
|
|
752
|
+
统计事件上报 Action 数据。
|
|
753
|
+
|
|
754
|
+
| 方法 | 参数 | 说明 |
|
|
755
|
+
|------|------|------|
|
|
756
|
+
| `constructor(name)` | name: string (必填) | 创建 Track 数据 |
|
|
757
|
+
| `setText(text)` | text: string | 设置显示文本,返回 this |
|
|
758
|
+
| `setName(name)` | name: string (必填) | 设置事件名,返回 this |
|
|
759
|
+
| `setParams(params)` | params: Record<string, any> | 设置事件参数,返回 this |
|
|
760
|
+
| `setOptions(options)` | options: Record<string, any> | 设置事件选项,返回 this |
|
|
761
|
+
|
|
762
|
+
### GrantBenefits
|
|
763
|
+
|
|
764
|
+
权益下发 Action 数据。
|
|
765
|
+
|
|
766
|
+
| 方法 | 参数 | 说明 |
|
|
767
|
+
|------|------|------|
|
|
768
|
+
| `constructor(benefits)` | benefits: any[] (必填) | 创建 GrantBenefits 数据 |
|
|
769
|
+
| `setText(text)` | text: string | 设置显示文本,返回 this |
|
|
770
|
+
| `setBenefits(benefits)` | benefits: any[] (必填) | 设置权益列表,返回 this |
|
|
771
|
+
| `setTitle(title)` | title: string | 设置弹窗标题,返回 this |
|
|
772
|
+
| `setMessage(message)` | message: string | 设置弹窗消息,返回 this |
|
|
773
|
+
| `setOkAction(okAction)` | okAction: Action | 设置确认按钮动作,返回 this |
|
|
774
|
+
| `setCloseable(closeable)` | closeable: boolean | 设置是否允许关闭,返回 this |
|
|
775
|
+
| `setDuration(duration)` | duration: number | 设置自动关闭时间(毫秒),返回 this |
|
|
776
|
+
| `setTheme(theme)` | theme: Theme | 设置弹窗主题配置,返回 this |
|
|
777
|
+
|
|
778
|
+
**静态属性:**
|
|
779
|
+
|
|
780
|
+
| 属性 | 说明 |
|
|
781
|
+
|------|------|
|
|
782
|
+
| `GrantBenefits.Theme` | 弹窗主题配置内部类 |
|
|
783
|
+
|
|
784
|
+
**Theme 内部类:**
|
|
785
|
+
|
|
786
|
+
| 方法 | 参数 | 说明 |
|
|
787
|
+
|------|------|------|
|
|
788
|
+
| `setImage(image)` | image: string (必填) | 设置主题图片,返回 this |
|
|
789
|
+
| `setTintColor(tintColor)` | tintColor: string (必填) | 设置主题色,返回 this |
|
|
790
|
+
| `setButtonImage(buttonImage)` | buttonImage: string | 设置按钮图片,返回 this |
|
|
791
|
+
| `setTopInset(topInset)` | topInset: number | 设置头部高度(默认 196),返回 this |
|
|
792
|
+
|
|
736
793
|
### Action
|
|
737
794
|
|
|
738
795
|
Action 对象,封装类型和数据。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* YAGO Event Kit - Action Bridge (Full)
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.8
|
|
4
4
|
*
|
|
5
5
|
* Generated by build script - do not edit manually.
|
|
6
6
|
* Supports: Browser script tag, CommonJS, AMD
|
|
@@ -593,6 +593,195 @@ Config.Theme = {
|
|
|
593
593
|
};
|
|
594
594
|
var Config_default = Config;
|
|
595
595
|
|
|
596
|
+
// src/core/types/Track.js
|
|
597
|
+
var Track = class {
|
|
598
|
+
constructor(name) {
|
|
599
|
+
this.text = null;
|
|
600
|
+
if (name == null) {
|
|
601
|
+
throw new Error("name cannot be null");
|
|
602
|
+
}
|
|
603
|
+
this.name = name;
|
|
604
|
+
this.params = null;
|
|
605
|
+
this.options = null;
|
|
606
|
+
}
|
|
607
|
+
getText() {
|
|
608
|
+
return this.text;
|
|
609
|
+
}
|
|
610
|
+
setText(text) {
|
|
611
|
+
this.text = text;
|
|
612
|
+
return this;
|
|
613
|
+
}
|
|
614
|
+
getName() {
|
|
615
|
+
return this.name;
|
|
616
|
+
}
|
|
617
|
+
setName(name) {
|
|
618
|
+
if (name == null) throw new Error("name cannot be null");
|
|
619
|
+
this.name = name;
|
|
620
|
+
return this;
|
|
621
|
+
}
|
|
622
|
+
getParams() {
|
|
623
|
+
return this.params;
|
|
624
|
+
}
|
|
625
|
+
setParams(params) {
|
|
626
|
+
this.params = params != null ? params : null;
|
|
627
|
+
return this;
|
|
628
|
+
}
|
|
629
|
+
getOptions() {
|
|
630
|
+
return this.options;
|
|
631
|
+
}
|
|
632
|
+
setOptions(options) {
|
|
633
|
+
this.options = options != null ? options : null;
|
|
634
|
+
return this;
|
|
635
|
+
}
|
|
636
|
+
toMap() {
|
|
637
|
+
const map = {};
|
|
638
|
+
if (this.text != null) map.text = this.text;
|
|
639
|
+
if (this.name != null) map.name = this.name;
|
|
640
|
+
if (this.params != null) map.params = this.params;
|
|
641
|
+
if (this.options != null) map.options = this.options;
|
|
642
|
+
return map;
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
var Track_default = Track;
|
|
646
|
+
|
|
647
|
+
// src/core/types/GrantBenefits.js
|
|
648
|
+
var Theme = class {
|
|
649
|
+
constructor() {
|
|
650
|
+
this.image = null;
|
|
651
|
+
this.tintColor = null;
|
|
652
|
+
this.buttonImage = null;
|
|
653
|
+
this.topInset = null;
|
|
654
|
+
}
|
|
655
|
+
getImage() {
|
|
656
|
+
return this.image;
|
|
657
|
+
}
|
|
658
|
+
setImage(image) {
|
|
659
|
+
this.image = image;
|
|
660
|
+
return this;
|
|
661
|
+
}
|
|
662
|
+
getTintColor() {
|
|
663
|
+
return this.tintColor;
|
|
664
|
+
}
|
|
665
|
+
setTintColor(tintColor) {
|
|
666
|
+
this.tintColor = tintColor;
|
|
667
|
+
return this;
|
|
668
|
+
}
|
|
669
|
+
getButtonImage() {
|
|
670
|
+
return this.buttonImage;
|
|
671
|
+
}
|
|
672
|
+
setButtonImage(buttonImage) {
|
|
673
|
+
this.buttonImage = buttonImage;
|
|
674
|
+
return this;
|
|
675
|
+
}
|
|
676
|
+
getTopInset() {
|
|
677
|
+
return this.topInset;
|
|
678
|
+
}
|
|
679
|
+
setTopInset(topInset) {
|
|
680
|
+
this.topInset = topInset;
|
|
681
|
+
return this;
|
|
682
|
+
}
|
|
683
|
+
toMap() {
|
|
684
|
+
const map = {};
|
|
685
|
+
if (this.image != null) map.image = this.image;
|
|
686
|
+
if (this.tintColor != null) map.tintColor = this.tintColor;
|
|
687
|
+
if (this.buttonImage != null) map.buttonImage = this.buttonImage;
|
|
688
|
+
if (this.topInset != null) map.topInset = this.topInset;
|
|
689
|
+
return map;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
var GrantBenefits = class {
|
|
693
|
+
constructor(benefits) {
|
|
694
|
+
this.text = null;
|
|
695
|
+
if (benefits == null) {
|
|
696
|
+
throw new Error("benefits cannot be null");
|
|
697
|
+
}
|
|
698
|
+
this.benefits = benefits;
|
|
699
|
+
this.title = null;
|
|
700
|
+
this.message = null;
|
|
701
|
+
this.okAction = null;
|
|
702
|
+
this.closeable = null;
|
|
703
|
+
this.duration = null;
|
|
704
|
+
this.theme = null;
|
|
705
|
+
}
|
|
706
|
+
getText() {
|
|
707
|
+
return this.text;
|
|
708
|
+
}
|
|
709
|
+
setText(text) {
|
|
710
|
+
this.text = text;
|
|
711
|
+
return this;
|
|
712
|
+
}
|
|
713
|
+
getBenefits() {
|
|
714
|
+
return this.benefits;
|
|
715
|
+
}
|
|
716
|
+
setBenefits(benefits) {
|
|
717
|
+
if (benefits == null) throw new Error("benefits cannot be null");
|
|
718
|
+
this.benefits = benefits;
|
|
719
|
+
return this;
|
|
720
|
+
}
|
|
721
|
+
getTitle() {
|
|
722
|
+
return this.title;
|
|
723
|
+
}
|
|
724
|
+
setTitle(title) {
|
|
725
|
+
this.title = title;
|
|
726
|
+
return this;
|
|
727
|
+
}
|
|
728
|
+
getMessage() {
|
|
729
|
+
return this.message;
|
|
730
|
+
}
|
|
731
|
+
setMessage(message) {
|
|
732
|
+
this.message = message;
|
|
733
|
+
return this;
|
|
734
|
+
}
|
|
735
|
+
getOkAction() {
|
|
736
|
+
return this.okAction;
|
|
737
|
+
}
|
|
738
|
+
setOkAction(okAction) {
|
|
739
|
+
this.okAction = okAction;
|
|
740
|
+
return this;
|
|
741
|
+
}
|
|
742
|
+
getCloseable() {
|
|
743
|
+
return this.closeable;
|
|
744
|
+
}
|
|
745
|
+
setCloseable(closeable) {
|
|
746
|
+
this.closeable = closeable;
|
|
747
|
+
return this;
|
|
748
|
+
}
|
|
749
|
+
getDuration() {
|
|
750
|
+
return this.duration;
|
|
751
|
+
}
|
|
752
|
+
setDuration(duration) {
|
|
753
|
+
this.duration = duration;
|
|
754
|
+
return this;
|
|
755
|
+
}
|
|
756
|
+
getTheme() {
|
|
757
|
+
return this.theme;
|
|
758
|
+
}
|
|
759
|
+
setTheme(theme) {
|
|
760
|
+
this.theme = theme;
|
|
761
|
+
return this;
|
|
762
|
+
}
|
|
763
|
+
toMap() {
|
|
764
|
+
const map = {};
|
|
765
|
+
if (this.text != null) map.text = this.text;
|
|
766
|
+
if (this.title != null) map.title = this.title;
|
|
767
|
+
if (this.message != null) map.message = this.message;
|
|
768
|
+
if (this.benefits != null) map.benefits = this.benefits;
|
|
769
|
+
if (this.okAction != null) {
|
|
770
|
+
if (typeof this.okAction.toMap === "function") {
|
|
771
|
+
map.okAction = this.okAction.toMap();
|
|
772
|
+
} else {
|
|
773
|
+
map.okAction = this.okAction;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (this.closeable != null) map.closeable = this.closeable;
|
|
777
|
+
if (this.duration != null) map.duration = this.duration;
|
|
778
|
+
if (this.theme != null) map.theme = this.theme.toMap();
|
|
779
|
+
return map;
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
GrantBenefits.Theme = Theme;
|
|
783
|
+
var GrantBenefits_default = GrantBenefits;
|
|
784
|
+
|
|
596
785
|
// src/core/types/Action.js
|
|
597
786
|
var Action = class {
|
|
598
787
|
constructor(type, data) {
|
|
@@ -641,7 +830,9 @@ var ActionType = {
|
|
|
641
830
|
AGENCY_INVITE: "agency_invite",
|
|
642
831
|
RECHARGE: "recharge",
|
|
643
832
|
CLOSE: "close",
|
|
644
|
-
CONFIG: "config"
|
|
833
|
+
CONFIG: "config",
|
|
834
|
+
TRACK: "track",
|
|
835
|
+
GRANT_BENEFITS: "grant_benefits"
|
|
645
836
|
};
|
|
646
837
|
var ActionData = {
|
|
647
838
|
Jump: Jump_default,
|
|
@@ -654,7 +845,9 @@ var ActionData = {
|
|
|
654
845
|
AgencyInvite: AgencyInvite_default,
|
|
655
846
|
Recharge: Recharge_default,
|
|
656
847
|
Close: Close_default,
|
|
657
|
-
Config: Config_default
|
|
848
|
+
Config: Config_default,
|
|
849
|
+
Track: Track_default,
|
|
850
|
+
GrantBenefits: GrantBenefits_default
|
|
658
851
|
};
|
|
659
852
|
var ActionCreator = {
|
|
660
853
|
ActionData,
|
|
@@ -776,6 +969,26 @@ var ActionCreator = {
|
|
|
776
969
|
},
|
|
777
970
|
createConfigActionWithData(config) {
|
|
778
971
|
return new Action_default(ActionType.CONFIG, config);
|
|
972
|
+
},
|
|
973
|
+
// Track
|
|
974
|
+
buildTrack(name) {
|
|
975
|
+
return new Track_default(name);
|
|
976
|
+
},
|
|
977
|
+
createTrackAction(name) {
|
|
978
|
+
return new Action_default(ActionType.TRACK, new Track_default(name));
|
|
979
|
+
},
|
|
980
|
+
createTrackActionWithData(track) {
|
|
981
|
+
return new Action_default(ActionType.TRACK, track);
|
|
982
|
+
},
|
|
983
|
+
// GrantBenefits
|
|
984
|
+
buildGrantBenefits(benefits) {
|
|
985
|
+
return new GrantBenefits_default(benefits);
|
|
986
|
+
},
|
|
987
|
+
createGrantBenefitsAction(benefits) {
|
|
988
|
+
return new Action_default(ActionType.GRANT_BENEFITS, new GrantBenefits_default(benefits));
|
|
989
|
+
},
|
|
990
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
991
|
+
return new Action_default(ActionType.GRANT_BENEFITS, grantBenefits);
|
|
779
992
|
}
|
|
780
993
|
};
|
|
781
994
|
|
|
@@ -1103,6 +1316,43 @@ var ActionBridge = class _ActionBridge {
|
|
|
1103
1316
|
createConfigActionWithData(config) {
|
|
1104
1317
|
return ActionCreator.createConfigActionWithData(config);
|
|
1105
1318
|
}
|
|
1319
|
+
track(name, params, options) {
|
|
1320
|
+
var data = ActionCreator.buildTrack(name);
|
|
1321
|
+
if (params != null) data.setParams(params);
|
|
1322
|
+
if (options != null) data.setOptions(options);
|
|
1323
|
+
return this._adapter.sendAction(ActionCreator.createTrackActionWithData(data));
|
|
1324
|
+
}
|
|
1325
|
+
buildTrack(name) {
|
|
1326
|
+
return ActionCreator.buildTrack(name);
|
|
1327
|
+
}
|
|
1328
|
+
createTrackAction(name) {
|
|
1329
|
+
return ActionCreator.createTrackAction(name);
|
|
1330
|
+
}
|
|
1331
|
+
createTrackActionWithData(track) {
|
|
1332
|
+
return ActionCreator.createTrackActionWithData(track);
|
|
1333
|
+
}
|
|
1334
|
+
grantBenefits(benefits, options) {
|
|
1335
|
+
var data = ActionCreator.buildGrantBenefits(benefits);
|
|
1336
|
+
if (options) {
|
|
1337
|
+
if (options.title != null) data.setTitle(options.title);
|
|
1338
|
+
if (options.message != null) data.setMessage(options.message);
|
|
1339
|
+
if (options.okAction != null) data.setOkAction(options.okAction);
|
|
1340
|
+
if (options.closeable != null) data.setCloseable(options.closeable);
|
|
1341
|
+
if (options.duration != null) data.setDuration(options.duration);
|
|
1342
|
+
if (options.theme != null) data.setTheme(options.theme);
|
|
1343
|
+
if (options.text != null) data.setText(options.text);
|
|
1344
|
+
}
|
|
1345
|
+
return this._adapter.sendAction(ActionCreator.createGrantBenefitsActionWithData(data));
|
|
1346
|
+
}
|
|
1347
|
+
buildGrantBenefits(benefits) {
|
|
1348
|
+
return ActionCreator.buildGrantBenefits(benefits);
|
|
1349
|
+
}
|
|
1350
|
+
createGrantBenefitsAction(benefits) {
|
|
1351
|
+
return ActionCreator.createGrantBenefitsAction(benefits);
|
|
1352
|
+
}
|
|
1353
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
1354
|
+
return ActionCreator.createGrantBenefitsActionWithData(grantBenefits);
|
|
1355
|
+
}
|
|
1106
1356
|
destroy() {
|
|
1107
1357
|
if (typeof this._adapter.destroy === "function") {
|
|
1108
1358
|
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.8
|
|
4
4
|
*
|
|
5
5
|
* Generated by build script - do not edit manually.
|
|
6
6
|
* Supports: Browser script tag, CommonJS, AMD
|
|
@@ -593,6 +593,195 @@ Config.Theme = {
|
|
|
593
593
|
};
|
|
594
594
|
var Config_default = Config;
|
|
595
595
|
|
|
596
|
+
// src/core/types/Track.js
|
|
597
|
+
var Track = class {
|
|
598
|
+
constructor(name) {
|
|
599
|
+
this.text = null;
|
|
600
|
+
if (name == null) {
|
|
601
|
+
throw new Error("name cannot be null");
|
|
602
|
+
}
|
|
603
|
+
this.name = name;
|
|
604
|
+
this.params = null;
|
|
605
|
+
this.options = null;
|
|
606
|
+
}
|
|
607
|
+
getText() {
|
|
608
|
+
return this.text;
|
|
609
|
+
}
|
|
610
|
+
setText(text) {
|
|
611
|
+
this.text = text;
|
|
612
|
+
return this;
|
|
613
|
+
}
|
|
614
|
+
getName() {
|
|
615
|
+
return this.name;
|
|
616
|
+
}
|
|
617
|
+
setName(name) {
|
|
618
|
+
if (name == null) throw new Error("name cannot be null");
|
|
619
|
+
this.name = name;
|
|
620
|
+
return this;
|
|
621
|
+
}
|
|
622
|
+
getParams() {
|
|
623
|
+
return this.params;
|
|
624
|
+
}
|
|
625
|
+
setParams(params) {
|
|
626
|
+
this.params = params != null ? params : null;
|
|
627
|
+
return this;
|
|
628
|
+
}
|
|
629
|
+
getOptions() {
|
|
630
|
+
return this.options;
|
|
631
|
+
}
|
|
632
|
+
setOptions(options) {
|
|
633
|
+
this.options = options != null ? options : null;
|
|
634
|
+
return this;
|
|
635
|
+
}
|
|
636
|
+
toMap() {
|
|
637
|
+
const map = {};
|
|
638
|
+
if (this.text != null) map.text = this.text;
|
|
639
|
+
if (this.name != null) map.name = this.name;
|
|
640
|
+
if (this.params != null) map.params = this.params;
|
|
641
|
+
if (this.options != null) map.options = this.options;
|
|
642
|
+
return map;
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
var Track_default = Track;
|
|
646
|
+
|
|
647
|
+
// src/core/types/GrantBenefits.js
|
|
648
|
+
var Theme = class {
|
|
649
|
+
constructor() {
|
|
650
|
+
this.image = null;
|
|
651
|
+
this.tintColor = null;
|
|
652
|
+
this.buttonImage = null;
|
|
653
|
+
this.topInset = null;
|
|
654
|
+
}
|
|
655
|
+
getImage() {
|
|
656
|
+
return this.image;
|
|
657
|
+
}
|
|
658
|
+
setImage(image) {
|
|
659
|
+
this.image = image;
|
|
660
|
+
return this;
|
|
661
|
+
}
|
|
662
|
+
getTintColor() {
|
|
663
|
+
return this.tintColor;
|
|
664
|
+
}
|
|
665
|
+
setTintColor(tintColor) {
|
|
666
|
+
this.tintColor = tintColor;
|
|
667
|
+
return this;
|
|
668
|
+
}
|
|
669
|
+
getButtonImage() {
|
|
670
|
+
return this.buttonImage;
|
|
671
|
+
}
|
|
672
|
+
setButtonImage(buttonImage) {
|
|
673
|
+
this.buttonImage = buttonImage;
|
|
674
|
+
return this;
|
|
675
|
+
}
|
|
676
|
+
getTopInset() {
|
|
677
|
+
return this.topInset;
|
|
678
|
+
}
|
|
679
|
+
setTopInset(topInset) {
|
|
680
|
+
this.topInset = topInset;
|
|
681
|
+
return this;
|
|
682
|
+
}
|
|
683
|
+
toMap() {
|
|
684
|
+
const map = {};
|
|
685
|
+
if (this.image != null) map.image = this.image;
|
|
686
|
+
if (this.tintColor != null) map.tintColor = this.tintColor;
|
|
687
|
+
if (this.buttonImage != null) map.buttonImage = this.buttonImage;
|
|
688
|
+
if (this.topInset != null) map.topInset = this.topInset;
|
|
689
|
+
return map;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
var GrantBenefits = class {
|
|
693
|
+
constructor(benefits) {
|
|
694
|
+
this.text = null;
|
|
695
|
+
if (benefits == null) {
|
|
696
|
+
throw new Error("benefits cannot be null");
|
|
697
|
+
}
|
|
698
|
+
this.benefits = benefits;
|
|
699
|
+
this.title = null;
|
|
700
|
+
this.message = null;
|
|
701
|
+
this.okAction = null;
|
|
702
|
+
this.closeable = null;
|
|
703
|
+
this.duration = null;
|
|
704
|
+
this.theme = null;
|
|
705
|
+
}
|
|
706
|
+
getText() {
|
|
707
|
+
return this.text;
|
|
708
|
+
}
|
|
709
|
+
setText(text) {
|
|
710
|
+
this.text = text;
|
|
711
|
+
return this;
|
|
712
|
+
}
|
|
713
|
+
getBenefits() {
|
|
714
|
+
return this.benefits;
|
|
715
|
+
}
|
|
716
|
+
setBenefits(benefits) {
|
|
717
|
+
if (benefits == null) throw new Error("benefits cannot be null");
|
|
718
|
+
this.benefits = benefits;
|
|
719
|
+
return this;
|
|
720
|
+
}
|
|
721
|
+
getTitle() {
|
|
722
|
+
return this.title;
|
|
723
|
+
}
|
|
724
|
+
setTitle(title) {
|
|
725
|
+
this.title = title;
|
|
726
|
+
return this;
|
|
727
|
+
}
|
|
728
|
+
getMessage() {
|
|
729
|
+
return this.message;
|
|
730
|
+
}
|
|
731
|
+
setMessage(message) {
|
|
732
|
+
this.message = message;
|
|
733
|
+
return this;
|
|
734
|
+
}
|
|
735
|
+
getOkAction() {
|
|
736
|
+
return this.okAction;
|
|
737
|
+
}
|
|
738
|
+
setOkAction(okAction) {
|
|
739
|
+
this.okAction = okAction;
|
|
740
|
+
return this;
|
|
741
|
+
}
|
|
742
|
+
getCloseable() {
|
|
743
|
+
return this.closeable;
|
|
744
|
+
}
|
|
745
|
+
setCloseable(closeable) {
|
|
746
|
+
this.closeable = closeable;
|
|
747
|
+
return this;
|
|
748
|
+
}
|
|
749
|
+
getDuration() {
|
|
750
|
+
return this.duration;
|
|
751
|
+
}
|
|
752
|
+
setDuration(duration) {
|
|
753
|
+
this.duration = duration;
|
|
754
|
+
return this;
|
|
755
|
+
}
|
|
756
|
+
getTheme() {
|
|
757
|
+
return this.theme;
|
|
758
|
+
}
|
|
759
|
+
setTheme(theme) {
|
|
760
|
+
this.theme = theme;
|
|
761
|
+
return this;
|
|
762
|
+
}
|
|
763
|
+
toMap() {
|
|
764
|
+
const map = {};
|
|
765
|
+
if (this.text != null) map.text = this.text;
|
|
766
|
+
if (this.title != null) map.title = this.title;
|
|
767
|
+
if (this.message != null) map.message = this.message;
|
|
768
|
+
if (this.benefits != null) map.benefits = this.benefits;
|
|
769
|
+
if (this.okAction != null) {
|
|
770
|
+
if (typeof this.okAction.toMap === "function") {
|
|
771
|
+
map.okAction = this.okAction.toMap();
|
|
772
|
+
} else {
|
|
773
|
+
map.okAction = this.okAction;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (this.closeable != null) map.closeable = this.closeable;
|
|
777
|
+
if (this.duration != null) map.duration = this.duration;
|
|
778
|
+
if (this.theme != null) map.theme = this.theme.toMap();
|
|
779
|
+
return map;
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
GrantBenefits.Theme = Theme;
|
|
783
|
+
var GrantBenefits_default = GrantBenefits;
|
|
784
|
+
|
|
596
785
|
// src/core/types/Action.js
|
|
597
786
|
var Action = class {
|
|
598
787
|
constructor(type, data) {
|
|
@@ -641,7 +830,9 @@ var ActionType = {
|
|
|
641
830
|
AGENCY_INVITE: "agency_invite",
|
|
642
831
|
RECHARGE: "recharge",
|
|
643
832
|
CLOSE: "close",
|
|
644
|
-
CONFIG: "config"
|
|
833
|
+
CONFIG: "config",
|
|
834
|
+
TRACK: "track",
|
|
835
|
+
GRANT_BENEFITS: "grant_benefits"
|
|
645
836
|
};
|
|
646
837
|
var ActionData = {
|
|
647
838
|
Jump: Jump_default,
|
|
@@ -654,7 +845,9 @@ var ActionData = {
|
|
|
654
845
|
AgencyInvite: AgencyInvite_default,
|
|
655
846
|
Recharge: Recharge_default,
|
|
656
847
|
Close: Close_default,
|
|
657
|
-
Config: Config_default
|
|
848
|
+
Config: Config_default,
|
|
849
|
+
Track: Track_default,
|
|
850
|
+
GrantBenefits: GrantBenefits_default
|
|
658
851
|
};
|
|
659
852
|
var ActionCreator = {
|
|
660
853
|
ActionData,
|
|
@@ -776,6 +969,26 @@ var ActionCreator = {
|
|
|
776
969
|
},
|
|
777
970
|
createConfigActionWithData(config) {
|
|
778
971
|
return new Action_default(ActionType.CONFIG, config);
|
|
972
|
+
},
|
|
973
|
+
// Track
|
|
974
|
+
buildTrack(name) {
|
|
975
|
+
return new Track_default(name);
|
|
976
|
+
},
|
|
977
|
+
createTrackAction(name) {
|
|
978
|
+
return new Action_default(ActionType.TRACK, new Track_default(name));
|
|
979
|
+
},
|
|
980
|
+
createTrackActionWithData(track) {
|
|
981
|
+
return new Action_default(ActionType.TRACK, track);
|
|
982
|
+
},
|
|
983
|
+
// GrantBenefits
|
|
984
|
+
buildGrantBenefits(benefits) {
|
|
985
|
+
return new GrantBenefits_default(benefits);
|
|
986
|
+
},
|
|
987
|
+
createGrantBenefitsAction(benefits) {
|
|
988
|
+
return new Action_default(ActionType.GRANT_BENEFITS, new GrantBenefits_default(benefits));
|
|
989
|
+
},
|
|
990
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
991
|
+
return new Action_default(ActionType.GRANT_BENEFITS, grantBenefits);
|
|
779
992
|
}
|
|
780
993
|
};
|
|
781
994
|
|
package/package.json
CHANGED
|
@@ -220,6 +220,47 @@ export default class ActionBridge {
|
|
|
220
220
|
return ActionCreator.createConfigActionWithData(config);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
track(name, params, options) {
|
|
224
|
+
var data = ActionCreator.buildTrack(name);
|
|
225
|
+
if (params != null) data.setParams(params);
|
|
226
|
+
if (options != null) data.setOptions(options);
|
|
227
|
+
return this._adapter.sendAction(ActionCreator.createTrackActionWithData(data));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
buildTrack(name) {
|
|
231
|
+
return ActionCreator.buildTrack(name);
|
|
232
|
+
}
|
|
233
|
+
createTrackAction(name) {
|
|
234
|
+
return ActionCreator.createTrackAction(name);
|
|
235
|
+
}
|
|
236
|
+
createTrackActionWithData(track) {
|
|
237
|
+
return ActionCreator.createTrackActionWithData(track);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
grantBenefits(benefits, options) {
|
|
241
|
+
var data = ActionCreator.buildGrantBenefits(benefits);
|
|
242
|
+
if (options) {
|
|
243
|
+
if (options.title != null) data.setTitle(options.title);
|
|
244
|
+
if (options.message != null) data.setMessage(options.message);
|
|
245
|
+
if (options.okAction != null) data.setOkAction(options.okAction);
|
|
246
|
+
if (options.closeable != null) data.setCloseable(options.closeable);
|
|
247
|
+
if (options.duration != null) data.setDuration(options.duration);
|
|
248
|
+
if (options.theme != null) data.setTheme(options.theme);
|
|
249
|
+
if (options.text != null) data.setText(options.text);
|
|
250
|
+
}
|
|
251
|
+
return this._adapter.sendAction(ActionCreator.createGrantBenefitsActionWithData(data));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
buildGrantBenefits(benefits) {
|
|
255
|
+
return ActionCreator.buildGrantBenefits(benefits);
|
|
256
|
+
}
|
|
257
|
+
createGrantBenefitsAction(benefits) {
|
|
258
|
+
return ActionCreator.createGrantBenefitsAction(benefits);
|
|
259
|
+
}
|
|
260
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
261
|
+
return ActionCreator.createGrantBenefitsActionWithData(grantBenefits);
|
|
262
|
+
}
|
|
263
|
+
|
|
223
264
|
destroy() {
|
|
224
265
|
if (typeof this._adapter.destroy === 'function') {
|
|
225
266
|
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, Recharge, Close, Config,
|
|
2
|
+
Action, Jump, Navigate, Replace, Goback, EnterRoom, LiveDetect, Onelink, 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';
|
|
@@ -72,6 +72,16 @@ export declare class ActionBridge {
|
|
|
72
72
|
createConfigAction(): Action;
|
|
73
73
|
createConfigActionWithData(config: Config): Action;
|
|
74
74
|
|
|
75
|
+
track(name: string, params?: Record<string, any>, options?: Record<string, any>): Promise<any>;
|
|
76
|
+
buildTrack(name: string): Track;
|
|
77
|
+
createTrackAction(name: string): Action;
|
|
78
|
+
createTrackActionWithData(track: Track): Action;
|
|
79
|
+
|
|
80
|
+
grantBenefits(benefits: any[], options?: { title?: string; message?: string; okAction?: Action; closeable?: boolean; duration?: number; theme?: any; text?: string }): Promise<any>;
|
|
81
|
+
buildGrantBenefits(benefits: any[]): GrantBenefits;
|
|
82
|
+
createGrantBenefitsAction(benefits: any[]): Action;
|
|
83
|
+
createGrantBenefitsActionWithData(grantBenefits: GrantBenefits): Action;
|
|
84
|
+
|
|
75
85
|
destroy(): void;
|
|
76
86
|
|
|
77
87
|
static ActionCreator: typeof ActionCreator;
|
|
@@ -9,6 +9,8 @@ import AgencyInvite from './types/AgencyInvite.js';
|
|
|
9
9
|
import Recharge from './types/Recharge.js';
|
|
10
10
|
import Close from './types/Close.js';
|
|
11
11
|
import Config from './types/Config.js';
|
|
12
|
+
import Track from './types/Track.js';
|
|
13
|
+
import GrantBenefits from './types/GrantBenefits.js';
|
|
12
14
|
import Action from './types/Action.js';
|
|
13
15
|
|
|
14
16
|
const ActionType = {
|
|
@@ -23,6 +25,8 @@ const ActionType = {
|
|
|
23
25
|
RECHARGE: 'recharge',
|
|
24
26
|
CLOSE: 'close',
|
|
25
27
|
CONFIG: 'config',
|
|
28
|
+
TRACK: 'track',
|
|
29
|
+
GRANT_BENEFITS: 'grant_benefits',
|
|
26
30
|
};
|
|
27
31
|
|
|
28
32
|
const ActionData = {
|
|
@@ -37,6 +41,8 @@ const ActionData = {
|
|
|
37
41
|
Recharge,
|
|
38
42
|
Close,
|
|
39
43
|
Config,
|
|
44
|
+
Track,
|
|
45
|
+
GrantBenefits,
|
|
40
46
|
};
|
|
41
47
|
|
|
42
48
|
const ActionCreator = {
|
|
@@ -195,6 +201,32 @@ const ActionCreator = {
|
|
|
195
201
|
createConfigActionWithData(config) {
|
|
196
202
|
return new Action(ActionType.CONFIG, config);
|
|
197
203
|
},
|
|
204
|
+
|
|
205
|
+
// Track
|
|
206
|
+
buildTrack(name) {
|
|
207
|
+
return new Track(name);
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
createTrackAction(name) {
|
|
211
|
+
return new Action(ActionType.TRACK, new Track(name));
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
createTrackActionWithData(track) {
|
|
215
|
+
return new Action(ActionType.TRACK, track);
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
// GrantBenefits
|
|
219
|
+
buildGrantBenefits(benefits) {
|
|
220
|
+
return new GrantBenefits(benefits);
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
createGrantBenefitsAction(benefits) {
|
|
224
|
+
return new Action(ActionType.GRANT_BENEFITS, new GrantBenefits(benefits));
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
228
|
+
return new Action(ActionType.GRANT_BENEFITS, grantBenefits);
|
|
229
|
+
},
|
|
198
230
|
};
|
|
199
231
|
|
|
200
232
|
export { ActionCreator, ActionData, ActionType };
|
package/src/core/index.d.ts
CHANGED
|
@@ -225,6 +225,70 @@ export class Config {
|
|
|
225
225
|
toMap(): Record<string, any>;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
export class Track {
|
|
229
|
+
constructor(name: string);
|
|
230
|
+
text: string | null;
|
|
231
|
+
name: string;
|
|
232
|
+
params: Record<string, any> | null;
|
|
233
|
+
options: Record<string, any> | null;
|
|
234
|
+
getText(): string | null;
|
|
235
|
+
setText(text: string): this;
|
|
236
|
+
getName(): string;
|
|
237
|
+
setName(name: string): this;
|
|
238
|
+
getParams(): Record<string, any> | null;
|
|
239
|
+
setParams(params: Record<string, any>): this;
|
|
240
|
+
getOptions(): Record<string, any> | null;
|
|
241
|
+
setOptions(options: Record<string, any>): this;
|
|
242
|
+
toMap(): Record<string, any>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export class GrantBenefitsTheme {
|
|
246
|
+
constructor();
|
|
247
|
+
image: string | null;
|
|
248
|
+
tintColor: string | null;
|
|
249
|
+
buttonImage: string | null;
|
|
250
|
+
topInset: number | null;
|
|
251
|
+
getImage(): string | null;
|
|
252
|
+
setImage(image: string): this;
|
|
253
|
+
getTintColor(): string | null;
|
|
254
|
+
setTintColor(tintColor: string): this;
|
|
255
|
+
getButtonImage(): string | null;
|
|
256
|
+
setButtonImage(buttonImage: string): this;
|
|
257
|
+
getTopInset(): number | null;
|
|
258
|
+
setTopInset(topInset: number): this;
|
|
259
|
+
toMap(): Record<string, any>;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export class GrantBenefits {
|
|
263
|
+
constructor(benefits: any[]);
|
|
264
|
+
text: string | null;
|
|
265
|
+
benefits: any[];
|
|
266
|
+
title: string | null;
|
|
267
|
+
message: string | null;
|
|
268
|
+
okAction: Action | null;
|
|
269
|
+
closeable: boolean | null;
|
|
270
|
+
duration: number | null;
|
|
271
|
+
theme: GrantBenefitsTheme | null;
|
|
272
|
+
static Theme: typeof GrantBenefitsTheme;
|
|
273
|
+
getText(): string | null;
|
|
274
|
+
setText(text: string): this;
|
|
275
|
+
getBenefits(): any[];
|
|
276
|
+
setBenefits(benefits: any[]): this;
|
|
277
|
+
getTitle(): string | null;
|
|
278
|
+
setTitle(title: string): this;
|
|
279
|
+
getMessage(): string | null;
|
|
280
|
+
setMessage(message: string): this;
|
|
281
|
+
getOkAction(): Action | null;
|
|
282
|
+
setOkAction(okAction: Action): this;
|
|
283
|
+
getCloseable(): boolean | null;
|
|
284
|
+
setCloseable(closeable: boolean): this;
|
|
285
|
+
getDuration(): number | null;
|
|
286
|
+
setDuration(duration: number): this;
|
|
287
|
+
getTheme(): GrantBenefitsTheme | null;
|
|
288
|
+
setTheme(theme: GrantBenefitsTheme): this;
|
|
289
|
+
toMap(): Record<string, any>;
|
|
290
|
+
}
|
|
291
|
+
|
|
228
292
|
export class Action {
|
|
229
293
|
constructor(type: ActionTypeValue, data: any);
|
|
230
294
|
type: ActionTypeValue;
|
|
@@ -238,7 +302,7 @@ export class Action {
|
|
|
238
302
|
toJson(): string;
|
|
239
303
|
}
|
|
240
304
|
|
|
241
|
-
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite' | 'recharge' | 'close' | 'config';
|
|
305
|
+
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite' | 'recharge' | 'close' | 'config' | 'track' | 'grant_benefits';
|
|
242
306
|
|
|
243
307
|
export const ActionType: {
|
|
244
308
|
JUMP: 'jump';
|
|
@@ -252,6 +316,8 @@ export const ActionType: {
|
|
|
252
316
|
RECHARGE: 'recharge';
|
|
253
317
|
CLOSE: 'close';
|
|
254
318
|
CONFIG: 'config';
|
|
319
|
+
TRACK: 'track';
|
|
320
|
+
GRANT_BENEFITS: 'grant_benefits';
|
|
255
321
|
};
|
|
256
322
|
|
|
257
323
|
export const ActionData: {
|
|
@@ -266,6 +332,8 @@ export const ActionData: {
|
|
|
266
332
|
Recharge: typeof Recharge;
|
|
267
333
|
Close: typeof Close;
|
|
268
334
|
Config: typeof Config;
|
|
335
|
+
Track: typeof Track;
|
|
336
|
+
GrantBenefits: typeof GrantBenefits;
|
|
269
337
|
};
|
|
270
338
|
|
|
271
339
|
export const ActionCreator: {
|
|
@@ -306,4 +374,10 @@ export const ActionCreator: {
|
|
|
306
374
|
buildConfig(): Config;
|
|
307
375
|
createConfigAction(): Action;
|
|
308
376
|
createConfigActionWithData(config: Config): Action;
|
|
377
|
+
buildTrack(name: string): Track;
|
|
378
|
+
createTrackAction(name: string): Action;
|
|
379
|
+
createTrackActionWithData(track: Track): Action;
|
|
380
|
+
buildGrantBenefits(benefits: any[]): GrantBenefits;
|
|
381
|
+
createGrantBenefitsAction(benefits: any[]): Action;
|
|
382
|
+
createGrantBenefitsActionWithData(grantBenefits: GrantBenefits): Action;
|
|
309
383
|
};
|
package/src/core/index.js
CHANGED
|
@@ -10,4 +10,6 @@ export { default as AgencyInvite } from './types/AgencyInvite.js';
|
|
|
10
10
|
export { default as Recharge } from './types/Recharge.js';
|
|
11
11
|
export { default as Close } from './types/Close.js';
|
|
12
12
|
export { default as Config } from './types/Config.js';
|
|
13
|
+
export { default as Track } from './types/Track.js';
|
|
14
|
+
export { default as GrantBenefits } from './types/GrantBenefits.js';
|
|
13
15
|
export { default as Action } from './types/Action.js';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
class Theme {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.image = null;
|
|
4
|
+
this.tintColor = null;
|
|
5
|
+
this.buttonImage = null;
|
|
6
|
+
this.topInset = null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getImage() { return this.image; }
|
|
10
|
+
setImage(image) { this.image = image; return this; }
|
|
11
|
+
getTintColor() { return this.tintColor; }
|
|
12
|
+
setTintColor(tintColor) { this.tintColor = tintColor; return this; }
|
|
13
|
+
getButtonImage() { return this.buttonImage; }
|
|
14
|
+
setButtonImage(buttonImage) { this.buttonImage = buttonImage; return this; }
|
|
15
|
+
getTopInset() { return this.topInset; }
|
|
16
|
+
setTopInset(topInset) { this.topInset = topInset; return this; }
|
|
17
|
+
|
|
18
|
+
toMap() {
|
|
19
|
+
const map = {};
|
|
20
|
+
if (this.image != null) map.image = this.image;
|
|
21
|
+
if (this.tintColor != null) map.tintColor = this.tintColor;
|
|
22
|
+
if (this.buttonImage != null) map.buttonImage = this.buttonImage;
|
|
23
|
+
if (this.topInset != null) map.topInset = this.topInset;
|
|
24
|
+
return map;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class GrantBenefits {
|
|
29
|
+
constructor(benefits) {
|
|
30
|
+
this.text = null;
|
|
31
|
+
if (benefits == null) {
|
|
32
|
+
throw new Error('benefits cannot be null');
|
|
33
|
+
}
|
|
34
|
+
this.benefits = benefits;
|
|
35
|
+
this.title = null;
|
|
36
|
+
this.message = null;
|
|
37
|
+
this.okAction = null;
|
|
38
|
+
this.closeable = null;
|
|
39
|
+
this.duration = null;
|
|
40
|
+
this.theme = null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getText() { return this.text; }
|
|
44
|
+
setText(text) { this.text = text; return this; }
|
|
45
|
+
getBenefits() { return this.benefits; }
|
|
46
|
+
setBenefits(benefits) {
|
|
47
|
+
if (benefits == null) throw new Error('benefits cannot be null');
|
|
48
|
+
this.benefits = benefits;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
getTitle() { return this.title; }
|
|
52
|
+
setTitle(title) { this.title = title; return this; }
|
|
53
|
+
getMessage() { return this.message; }
|
|
54
|
+
setMessage(message) { this.message = message; return this; }
|
|
55
|
+
getOkAction() { return this.okAction; }
|
|
56
|
+
setOkAction(okAction) { this.okAction = okAction; return this; }
|
|
57
|
+
getCloseable() { return this.closeable; }
|
|
58
|
+
setCloseable(closeable) { this.closeable = closeable; return this; }
|
|
59
|
+
getDuration() { return this.duration; }
|
|
60
|
+
setDuration(duration) { this.duration = duration; return this; }
|
|
61
|
+
getTheme() { return this.theme; }
|
|
62
|
+
setTheme(theme) { this.theme = theme; return this; }
|
|
63
|
+
|
|
64
|
+
toMap() {
|
|
65
|
+
const map = {};
|
|
66
|
+
if (this.text != null) map.text = this.text;
|
|
67
|
+
if (this.title != null) map.title = this.title;
|
|
68
|
+
if (this.message != null) map.message = this.message;
|
|
69
|
+
if (this.benefits != null) map.benefits = this.benefits;
|
|
70
|
+
if (this.okAction != null) {
|
|
71
|
+
if (typeof this.okAction.toMap === 'function') {
|
|
72
|
+
map.okAction = this.okAction.toMap();
|
|
73
|
+
} else {
|
|
74
|
+
map.okAction = this.okAction;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (this.closeable != null) map.closeable = this.closeable;
|
|
78
|
+
if (this.duration != null) map.duration = this.duration;
|
|
79
|
+
if (this.theme != null) map.theme = this.theme.toMap();
|
|
80
|
+
return map;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
GrantBenefits.Theme = Theme;
|
|
85
|
+
|
|
86
|
+
export default GrantBenefits;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class Track {
|
|
2
|
+
constructor(name) {
|
|
3
|
+
this.text = null;
|
|
4
|
+
if (name == null) {
|
|
5
|
+
throw new Error('name cannot be null');
|
|
6
|
+
}
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.params = null;
|
|
9
|
+
this.options = null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
getText() { return this.text; }
|
|
13
|
+
setText(text) { this.text = text; return this; }
|
|
14
|
+
getName() { return this.name; }
|
|
15
|
+
setName(name) {
|
|
16
|
+
if (name == null) throw new Error('name cannot be null');
|
|
17
|
+
this.name = name;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
getParams() { return this.params; }
|
|
21
|
+
setParams(params) { this.params = params != null ? params : null; return this; }
|
|
22
|
+
getOptions() { return this.options; }
|
|
23
|
+
setOptions(options) { this.options = options != null ? options : null; return this; }
|
|
24
|
+
|
|
25
|
+
toMap() {
|
|
26
|
+
const map = {};
|
|
27
|
+
if (this.text != null) map.text = this.text;
|
|
28
|
+
if (this.name != null) map.name = this.name;
|
|
29
|
+
if (this.params != null) map.params = this.params;
|
|
30
|
+
if (this.options != null) map.options = this.options;
|
|
31
|
+
return map;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default Track;
|
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, Action } from './core/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';
|
|
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
|
@@ -12,4 +12,6 @@ export { AgencyInvite } from './core/index.js';
|
|
|
12
12
|
export { Recharge } from './core/index.js';
|
|
13
13
|
export { Close } from './core/index.js';
|
|
14
14
|
export { Config } from './core/index.js';
|
|
15
|
+
export { Track } from './core/index.js';
|
|
16
|
+
export { GrantBenefits } from './core/index.js';
|
|
15
17
|
export { Action } from './core/index.js';
|