@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
|
@@ -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() {
|
|
@@ -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
|
|
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
|
}
|
|
@@ -220,6 +241,47 @@ export default class ActionBridge {
|
|
|
220
241
|
return ActionCreator.createConfigActionWithData(config);
|
|
221
242
|
}
|
|
222
243
|
|
|
244
|
+
track(name, params, options) {
|
|
245
|
+
var data = ActionCreator.buildTrack(name);
|
|
246
|
+
if (params != null) data.setParams(params);
|
|
247
|
+
if (options != null) data.setOptions(options);
|
|
248
|
+
return this._adapter.sendAction(ActionCreator.createTrackActionWithData(data));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
buildTrack(name) {
|
|
252
|
+
return ActionCreator.buildTrack(name);
|
|
253
|
+
}
|
|
254
|
+
createTrackAction(name) {
|
|
255
|
+
return ActionCreator.createTrackAction(name);
|
|
256
|
+
}
|
|
257
|
+
createTrackActionWithData(track) {
|
|
258
|
+
return ActionCreator.createTrackActionWithData(track);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
grantBenefits(benefits, options) {
|
|
262
|
+
var data = ActionCreator.buildGrantBenefits(benefits);
|
|
263
|
+
if (options) {
|
|
264
|
+
if (options.title != null) data.setTitle(options.title);
|
|
265
|
+
if (options.message != null) data.setMessage(options.message);
|
|
266
|
+
if (options.okAction != null) data.setOkAction(options.okAction);
|
|
267
|
+
if (options.closeable != null) data.setCloseable(options.closeable);
|
|
268
|
+
if (options.duration != null) data.setDuration(options.duration);
|
|
269
|
+
if (options.theme != null) data.setTheme(options.theme);
|
|
270
|
+
if (options.text != null) data.setText(options.text);
|
|
271
|
+
}
|
|
272
|
+
return this._adapter.sendAction(ActionCreator.createGrantBenefitsActionWithData(data));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
buildGrantBenefits(benefits) {
|
|
276
|
+
return ActionCreator.buildGrantBenefits(benefits);
|
|
277
|
+
}
|
|
278
|
+
createGrantBenefitsAction(benefits) {
|
|
279
|
+
return ActionCreator.createGrantBenefitsAction(benefits);
|
|
280
|
+
}
|
|
281
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
282
|
+
return ActionCreator.createGrantBenefitsActionWithData(grantBenefits);
|
|
283
|
+
}
|
|
284
|
+
|
|
223
285
|
destroy() {
|
|
224
286
|
if (typeof this._adapter.destroy === 'function') {
|
|
225
287
|
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, 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;
|
|
@@ -72,6 +77,16 @@ export declare class ActionBridge {
|
|
|
72
77
|
createConfigAction(): Action;
|
|
73
78
|
createConfigActionWithData(config: Config): Action;
|
|
74
79
|
|
|
80
|
+
track(name: string, params?: Record<string, any>, options?: Record<string, any>): Promise<any>;
|
|
81
|
+
buildTrack(name: string): Track;
|
|
82
|
+
createTrackAction(name: string): Action;
|
|
83
|
+
createTrackActionWithData(track: Track): Action;
|
|
84
|
+
|
|
85
|
+
grantBenefits(benefits: any[], options?: { title?: string; message?: string; okAction?: Action; closeable?: boolean; duration?: number; theme?: any; text?: string }): Promise<any>;
|
|
86
|
+
buildGrantBenefits(benefits: any[]): GrantBenefits;
|
|
87
|
+
createGrantBenefitsAction(benefits: any[]): Action;
|
|
88
|
+
createGrantBenefitsActionWithData(grantBenefits: GrantBenefits): Action;
|
|
89
|
+
|
|
75
90
|
destroy(): void;
|
|
76
91
|
|
|
77
92
|
static ActionCreator: typeof ActionCreator;
|
|
@@ -5,10 +5,13 @@ 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';
|
|
11
12
|
import Config from './types/Config.js';
|
|
13
|
+
import Track from './types/Track.js';
|
|
14
|
+
import GrantBenefits from './types/GrantBenefits.js';
|
|
12
15
|
import Action from './types/Action.js';
|
|
13
16
|
|
|
14
17
|
const ActionType = {
|
|
@@ -19,10 +22,13 @@ const ActionType = {
|
|
|
19
22
|
ENTER_ROOM: 'enter_room',
|
|
20
23
|
LIVE_DETECT: 'live_detect',
|
|
21
24
|
ONELINK: 'onelink',
|
|
25
|
+
ASK: 'ask',
|
|
22
26
|
AGENCY_INVITE: 'agency_invite',
|
|
23
27
|
RECHARGE: 'recharge',
|
|
24
28
|
CLOSE: 'close',
|
|
25
29
|
CONFIG: 'config',
|
|
30
|
+
TRACK: 'track',
|
|
31
|
+
GRANT_BENEFITS: 'grant_benefits',
|
|
26
32
|
};
|
|
27
33
|
|
|
28
34
|
const ActionData = {
|
|
@@ -33,10 +39,13 @@ const ActionData = {
|
|
|
33
39
|
EnterRoom,
|
|
34
40
|
LiveDetect,
|
|
35
41
|
Onelink,
|
|
42
|
+
Ask,
|
|
36
43
|
AgencyInvite,
|
|
37
44
|
Recharge,
|
|
38
45
|
Close,
|
|
39
46
|
Config,
|
|
47
|
+
Track,
|
|
48
|
+
GrantBenefits,
|
|
40
49
|
};
|
|
41
50
|
|
|
42
51
|
const ActionCreator = {
|
|
@@ -144,6 +153,19 @@ const ActionCreator = {
|
|
|
144
153
|
return new Action(ActionType.ONELINK, onelink);
|
|
145
154
|
},
|
|
146
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
|
+
|
|
147
169
|
// AgencyInvite
|
|
148
170
|
buildAgencyInvite(id, type) {
|
|
149
171
|
return new AgencyInvite(id, type);
|
|
@@ -195,6 +217,32 @@ const ActionCreator = {
|
|
|
195
217
|
createConfigActionWithData(config) {
|
|
196
218
|
return new Action(ActionType.CONFIG, config);
|
|
197
219
|
},
|
|
220
|
+
|
|
221
|
+
// Track
|
|
222
|
+
buildTrack(name) {
|
|
223
|
+
return new Track(name);
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
createTrackAction(name) {
|
|
227
|
+
return new Action(ActionType.TRACK, new Track(name));
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
createTrackActionWithData(track) {
|
|
231
|
+
return new Action(ActionType.TRACK, track);
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
// GrantBenefits
|
|
235
|
+
buildGrantBenefits(benefits) {
|
|
236
|
+
return new GrantBenefits(benefits);
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
createGrantBenefitsAction(benefits) {
|
|
240
|
+
return new Action(ActionType.GRANT_BENEFITS, new GrantBenefits(benefits));
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
createGrantBenefitsActionWithData(grantBenefits) {
|
|
244
|
+
return new Action(ActionType.GRANT_BENEFITS, grantBenefits);
|
|
245
|
+
},
|
|
198
246
|
};
|
|
199
247
|
|
|
200
248
|
export { ActionCreator, ActionData, ActionType };
|
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;
|
|
@@ -225,6 +245,70 @@ export class Config {
|
|
|
225
245
|
toMap(): Record<string, any>;
|
|
226
246
|
}
|
|
227
247
|
|
|
248
|
+
export class Track {
|
|
249
|
+
constructor(name: string);
|
|
250
|
+
text: string | null;
|
|
251
|
+
name: string;
|
|
252
|
+
params: Record<string, any> | null;
|
|
253
|
+
options: Record<string, any> | null;
|
|
254
|
+
getText(): string | null;
|
|
255
|
+
setText(text: string): this;
|
|
256
|
+
getName(): string;
|
|
257
|
+
setName(name: string): this;
|
|
258
|
+
getParams(): Record<string, any> | null;
|
|
259
|
+
setParams(params: Record<string, any>): this;
|
|
260
|
+
getOptions(): Record<string, any> | null;
|
|
261
|
+
setOptions(options: Record<string, any>): this;
|
|
262
|
+
toMap(): Record<string, any>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export class GrantBenefitsTheme {
|
|
266
|
+
constructor();
|
|
267
|
+
image: string | null;
|
|
268
|
+
tintColor: string | null;
|
|
269
|
+
buttonImage: string | null;
|
|
270
|
+
topInset: number | null;
|
|
271
|
+
getImage(): string | null;
|
|
272
|
+
setImage(image: string): this;
|
|
273
|
+
getTintColor(): string | null;
|
|
274
|
+
setTintColor(tintColor: string): this;
|
|
275
|
+
getButtonImage(): string | null;
|
|
276
|
+
setButtonImage(buttonImage: string): this;
|
|
277
|
+
getTopInset(): number | null;
|
|
278
|
+
setTopInset(topInset: number): this;
|
|
279
|
+
toMap(): Record<string, any>;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export class GrantBenefits {
|
|
283
|
+
constructor(benefits: any[]);
|
|
284
|
+
text: string | null;
|
|
285
|
+
benefits: any[];
|
|
286
|
+
title: string | null;
|
|
287
|
+
message: string | null;
|
|
288
|
+
okAction: Action | null;
|
|
289
|
+
closeable: boolean | null;
|
|
290
|
+
duration: number | null;
|
|
291
|
+
theme: GrantBenefitsTheme | null;
|
|
292
|
+
static Theme: typeof GrantBenefitsTheme;
|
|
293
|
+
getText(): string | null;
|
|
294
|
+
setText(text: string): this;
|
|
295
|
+
getBenefits(): any[];
|
|
296
|
+
setBenefits(benefits: any[]): this;
|
|
297
|
+
getTitle(): string | null;
|
|
298
|
+
setTitle(title: string): this;
|
|
299
|
+
getMessage(): string | null;
|
|
300
|
+
setMessage(message: string): this;
|
|
301
|
+
getOkAction(): Action | null;
|
|
302
|
+
setOkAction(okAction: Action): this;
|
|
303
|
+
getCloseable(): boolean | null;
|
|
304
|
+
setCloseable(closeable: boolean): this;
|
|
305
|
+
getDuration(): number | null;
|
|
306
|
+
setDuration(duration: number): this;
|
|
307
|
+
getTheme(): GrantBenefitsTheme | null;
|
|
308
|
+
setTheme(theme: GrantBenefitsTheme): this;
|
|
309
|
+
toMap(): Record<string, any>;
|
|
310
|
+
}
|
|
311
|
+
|
|
228
312
|
export class Action {
|
|
229
313
|
constructor(type: ActionTypeValue, data: any);
|
|
230
314
|
type: ActionTypeValue;
|
|
@@ -238,7 +322,7 @@ export class Action {
|
|
|
238
322
|
toJson(): string;
|
|
239
323
|
}
|
|
240
324
|
|
|
241
|
-
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'agency_invite' | 'recharge' | 'close' | 'config';
|
|
325
|
+
export type ActionTypeValue = 'jump' | 'navigate' | 'replace' | 'goback' | 'enter_room' | 'live_detect' | 'onelink' | 'ask' | 'agency_invite' | 'recharge' | 'close' | 'config' | 'track' | 'grant_benefits';
|
|
242
326
|
|
|
243
327
|
export const ActionType: {
|
|
244
328
|
JUMP: 'jump';
|
|
@@ -248,10 +332,13 @@ export const ActionType: {
|
|
|
248
332
|
ENTER_ROOM: 'enter_room';
|
|
249
333
|
LIVE_DETECT: 'live_detect';
|
|
250
334
|
ONELINK: 'onelink';
|
|
335
|
+
ASK: 'ask';
|
|
251
336
|
AGENCY_INVITE: 'agency_invite';
|
|
252
337
|
RECHARGE: 'recharge';
|
|
253
338
|
CLOSE: 'close';
|
|
254
339
|
CONFIG: 'config';
|
|
340
|
+
TRACK: 'track';
|
|
341
|
+
GRANT_BENEFITS: 'grant_benefits';
|
|
255
342
|
};
|
|
256
343
|
|
|
257
344
|
export const ActionData: {
|
|
@@ -262,10 +349,13 @@ export const ActionData: {
|
|
|
262
349
|
EnterRoom: typeof EnterRoom;
|
|
263
350
|
LiveDetect: typeof LiveDetect;
|
|
264
351
|
Onelink: typeof Onelink;
|
|
352
|
+
Ask: typeof Ask;
|
|
265
353
|
AgencyInvite: typeof AgencyInvite;
|
|
266
354
|
Recharge: typeof Recharge;
|
|
267
355
|
Close: typeof Close;
|
|
268
356
|
Config: typeof Config;
|
|
357
|
+
Track: typeof Track;
|
|
358
|
+
GrantBenefits: typeof GrantBenefits;
|
|
269
359
|
};
|
|
270
360
|
|
|
271
361
|
export const ActionCreator: {
|
|
@@ -294,6 +384,9 @@ export const ActionCreator: {
|
|
|
294
384
|
buildOnelink(url: string): Onelink;
|
|
295
385
|
createOnelinkAction(url: string): Action;
|
|
296
386
|
createOnelinkActionWithData(onelink: Onelink): Action;
|
|
387
|
+
buildAsk(id: number): Ask;
|
|
388
|
+
createAskAction(id: number): Action;
|
|
389
|
+
createAskActionWithData(ask: Ask): Action;
|
|
297
390
|
buildAgencyInvite(id: number, type: string): AgencyInvite;
|
|
298
391
|
createAgencyInviteAction(id: number, type: string): Action;
|
|
299
392
|
createAgencyInviteActionWithData(agencyInvite: AgencyInvite): Action;
|
|
@@ -306,4 +399,10 @@ export const ActionCreator: {
|
|
|
306
399
|
buildConfig(): Config;
|
|
307
400
|
createConfigAction(): Action;
|
|
308
401
|
createConfigActionWithData(config: Config): Action;
|
|
402
|
+
buildTrack(name: string): Track;
|
|
403
|
+
createTrackAction(name: string): Action;
|
|
404
|
+
createTrackActionWithData(track: Track): Action;
|
|
405
|
+
buildGrantBenefits(benefits: any[]): GrantBenefits;
|
|
406
|
+
createGrantBenefitsAction(benefits: any[]): Action;
|
|
407
|
+
createGrantBenefitsActionWithData(grantBenefits: GrantBenefits): Action;
|
|
309
408
|
};
|