@inappstory/react-sdk 1.8.0-rc.2 → 1.8.0-rc.3

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.
@@ -16,6 +16,8 @@ export enum BannerPlaceViewModelEvent {
16
16
  ActiveIndexChange = "activeIndexChange",
17
17
  /** Emitted before transition to the next slide after the duration has elapsed */
18
18
  AutoplayTimeLeft = "autoplayTimeLeft",
19
+ /** Emitted while autoplay timer tick */
20
+ AutoplayTimerTick = "autoplayTimerTick",
19
21
  /** Emitted when the banner is in the viewport and started. */
20
22
  ShowBanner = "showBanner",
21
23
  /** Emitted when the banner is in the viewport and error occurs on start. */
@@ -212,9 +214,10 @@ export interface BannerPlace {
212
214
  * @emits BannerPlaceViewModelEvent.LoadError
213
215
  * @emits BannerPlaceViewModelEvent.ActiveIndexChange
214
216
  * @emits BannerPlaceViewModelEvent.AutoplayTimeLeft
217
+ * @emits BannerPlaceViewModelEvent.AutoplayTimerTick
215
218
  * @emits BannerPlaceViewModelEvent.ShowBanner
216
219
  * @emits BannerPlaceViewModelEvent.ShowBannerFailed
217
- * @emits BannerPlaceViewModelEvent.BannerWidget
220
+ * @emits BannerPlaceViewModelEvent.BannerWidget,
218
221
  */
219
222
  fetchBanners(): Promise<Banner[]>;
220
223
  }
@@ -0,0 +1,27 @@
1
+ export interface ShowBannerEvent {
2
+ id: string;
3
+ bannerPlace: string;
4
+ payload?: string;
5
+ }
6
+
7
+ export interface ShowBannerFailedEvent {
8
+ id: string;
9
+ bannerPlace: string;
10
+ error: Error;
11
+ payload?: string;
12
+ }
13
+
14
+ export interface BannerWidgetEvent {
15
+ id: string;
16
+ bannerPlace: string;
17
+ widgetEventName: string;
18
+ widgetData: Record<string, any>;
19
+ payload?: string;
20
+ }
21
+
22
+ export interface AutoplayTimerTickEvent {
23
+ bannerIndex: number;
24
+ currentTime: number;
25
+ totalTime: number;
26
+ percents: number;
27
+ }
@@ -1,5 +1,6 @@
1
1
  import { BannerPlace } from "./bannerPlace";
2
2
  import { BannerPlaceAppearance } from "./bannerPlaceAppearance";
3
+ import { AutoplayTimerTickEvent, BannerWidgetEvent, ShowBannerEvent, ShowBannerFailedEvent } from "./events";
3
4
 
4
5
  /**
5
6
  * Props for IasBannerPlace component
@@ -53,10 +54,10 @@ interface IasBannerPlaceProps {
53
54
  onLoadError?: (error: Error) => void;
54
55
 
55
56
  /**
56
- * Callback triggered when when changed active banner
57
+ * Callback triggered when changed active banner
57
58
  * @optional
58
59
  */
59
- onActiveIndexChange?: () => void;
60
+ onActiveIndexChange?: (index: number) => void;
60
61
 
61
62
  /**
62
63
  * Callback triggered before transition to the next slide after the duration has elapsed
@@ -64,12 +65,36 @@ interface IasBannerPlaceProps {
64
65
  */
65
66
  onAutoplayTimeLeft?: () => void;
66
67
 
68
+ /**
69
+ * Callback triggered when autoplay timer tick
70
+ * @optional
71
+ */
72
+ onAutoplayTimerTick?: (event: AutoplayTimerTickEvent) => void;
73
+
67
74
  /**
68
75
  * Callback triggered when banner place is ready
69
76
  * @param {BannerPlace} bannerPlace - The initialized banner place instance
70
77
  * @optional
71
78
  */
72
79
  onReady?: (bannerPlace: BannerPlace) => void;
80
+
81
+ /**
82
+ * Triggered when the banner is in the viewport and started.
83
+ * @optional
84
+ */
85
+ onShowBanner?: (event: ShowBannerEvent) => void;
86
+
87
+ /**
88
+ * Triggered when the banner is in the viewport and error occurs on start.
89
+ * @optional
90
+ */
91
+ onShowBannerFailed?: (event: ShowBannerFailedEvent) => void;
92
+
93
+ /**
94
+ * Triggered when interacting with banner widgets.
95
+ * @optional
96
+ */
97
+ onBannerWidget?: (event: BannerWidgetEvent) => void;
73
98
  }
74
99
 
75
100
  /**
@@ -4,6 +4,7 @@ export * from "./bannerPlaceAppearance";
4
4
  export * from "./iasBannerPlace";
5
5
  export * from "./iasBannerPreview";
6
6
  export * from "./iasBannersProvider";
7
+ export * from "./events"
7
8
 
8
9
  import { IasBannersProvider } from "./iasBannersProvider";
9
10