@inappstory/react-sdk 1.8.0-rc.1 → 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.
@@ -6,16 +6,24 @@ import { BannerPlaceAppearance } from "./bannerPlaceAppearance";
6
6
  * @enum {string}
7
7
  */
8
8
  export enum BannerPlaceViewModelEvent {
9
- /** Emitted when playback starts */
10
- Play = "play",
11
- /** Emitted when playback stops */
12
- Stop = "stop",
13
9
  /** Emitted when banner loading starts */
14
10
  LoadStart = "loadStart",
15
11
  /** Emitted when banner loading completes */
16
12
  LoadEnd = "loadEnd",
17
13
  /** Emitted when banner loading fails */
18
- LoadError = "loadError"
14
+ LoadError = "loadError",
15
+ /** Emitted when changed active banner */
16
+ ActiveIndexChange = "activeIndexChange",
17
+ /** Emitted before transition to the next slide after the duration has elapsed */
18
+ AutoplayTimeLeft = "autoplayTimeLeft",
19
+ /** Emitted while autoplay timer tick */
20
+ AutoplayTimerTick = "autoplayTimerTick",
21
+ /** Emitted when the banner is in the viewport and started. */
22
+ ShowBanner = "showBanner",
23
+ /** Emitted when the banner is in the viewport and error occurs on start. */
24
+ ShowBannerFailed = "showBannerFailed",
25
+ /** Emitted when interacting with banner widgets */
26
+ BannerWidget = "bannerWidget"
19
27
  }
20
28
 
21
29
  /**
@@ -135,6 +143,12 @@ export interface BannerPlace {
135
143
  */
136
144
  get activeIndex(): number;
137
145
 
146
+ /**
147
+ * Gets pagination bullets length
148
+ * @returns {number}
149
+ */
150
+ get paginationBullets(): number;
151
+
138
152
  /**
139
153
  * Sets the slider controller implementation
140
154
  * @param {IBannerPlaceSliderController} sliderController - The slider controller to use
@@ -148,14 +162,31 @@ export interface BannerPlace {
148
162
  updateAppearance(appearance: BannerPlaceAppearance): void;
149
163
 
150
164
  /**
151
- * Starts playback of all banners
165
+ * Resume autoplay
152
166
  */
153
- play(): void;
167
+ resume(): void;
154
168
 
155
169
  /**
156
- * Stops playback of all banners
170
+ * Pause autoplay
157
171
  */
158
- stop(): void;
172
+ pause(): void;
173
+
174
+ /**
175
+ * Run transition to next slide.
176
+ */
177
+ showNext(): void;
178
+
179
+ /**
180
+ * Run transition to previous slide.
181
+ */
182
+ showPrevious(): void;
183
+
184
+ /**
185
+ * Run transition to the slide by index
186
+ * @param {number} index - Slide index
187
+ * @param {number} speed - Transition duration
188
+ */
189
+ showByIndex(index: number, speed?: number): void;
159
190
 
160
191
  /**
161
192
  * Reloads banners for this place
@@ -181,6 +212,12 @@ export interface BannerPlace {
181
212
  * @emits BannerPlaceViewModelEvent.LoadStart
182
213
  * @emits BannerPlaceViewModelEvent.LoadEnd
183
214
  * @emits BannerPlaceViewModelEvent.LoadError
215
+ * @emits BannerPlaceViewModelEvent.ActiveIndexChange
216
+ * @emits BannerPlaceViewModelEvent.AutoplayTimeLeft
217
+ * @emits BannerPlaceViewModelEvent.AutoplayTimerTick
218
+ * @emits BannerPlaceViewModelEvent.ShowBanner
219
+ * @emits BannerPlaceViewModelEvent.ShowBannerFailed
220
+ * @emits BannerPlaceViewModelEvent.BannerWidget,
184
221
  */
185
222
  fetchBanners(): Promise<Banner[]>;
186
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
@@ -52,12 +53,48 @@ interface IasBannerPlaceProps {
52
53
  */
53
54
  onLoadError?: (error: Error) => void;
54
55
 
56
+ /**
57
+ * Callback triggered when changed active banner
58
+ * @optional
59
+ */
60
+ onActiveIndexChange?: (index: number) => void;
61
+
62
+ /**
63
+ * Callback triggered before transition to the next slide after the duration has elapsed
64
+ * @optional
65
+ */
66
+ onAutoplayTimeLeft?: () => void;
67
+
68
+ /**
69
+ * Callback triggered when autoplay timer tick
70
+ * @optional
71
+ */
72
+ onAutoplayTimerTick?: (event: AutoplayTimerTickEvent) => void;
73
+
55
74
  /**
56
75
  * Callback triggered when banner place is ready
57
76
  * @param {BannerPlace} bannerPlace - The initialized banner place instance
58
77
  * @optional
59
78
  */
60
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;
61
98
  }
62
99
 
63
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