@inappstory/js-sdk 3.6.4 → 3.6.6

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.
@@ -0,0 +1,260 @@
1
+ import { CloseButtonPosition } from "./appearanceCommon";
2
+ import { SharePanel } from "./sharePanel";
3
+ import { Nullable, RecursivePartial } from "../global";
4
+
5
+ /**
6
+ * Defines the swipe animation style used when navigating between stories.
7
+ *
8
+ * This affects the visual transition effect when the user swipes to the next or previous story.
9
+ */
10
+ export declare enum StoryReaderSwipeStyle {
11
+ /**
12
+ * Flat swipe with no 3D or overlay effects.
13
+ * Simple, fast, and performance-optimized.
14
+ */
15
+ FLAT = "flat",
16
+
17
+ /**
18
+ * Cover swipe where the next story over the current one.
19
+ * Offers a layered visual effect.
20
+ */
21
+ COVER = "cover",
22
+
23
+ /**
24
+ * 3D cube rotation effect between stories.
25
+ * Visually rich but more performance-intensive.
26
+ */
27
+ CUBE = "cube"
28
+ }
29
+ /**
30
+ * Enum representing story reader layout variants
31
+ *
32
+ * @property {string} Classic - Classic display variant (default)
33
+ * @property {string} Modern - Modern experimental display variant
34
+ */
35
+ export declare enum StoryReaderLayout {
36
+ /** Classic display variant (default) */
37
+ Classic = "classic",
38
+
39
+ /** Modern experimental display variant */
40
+ Modern = "modern"
41
+ }
42
+
43
+ /**
44
+ * Appearance options for Story Reader.
45
+ */
46
+ export type StoryReaderOptions = RecursivePartial<{
47
+ /**
48
+ * Position of the close button.
49
+ *
50
+ * @default CloseButtonPosition.END
51
+ */
52
+ closeButtonPosition: CloseButtonPosition | "left" | "right";
53
+
54
+ /**
55
+ * Swipe animation style for switching between stories.
56
+ *
57
+ * @default StoryReaderSwipeStyle.FLAT
58
+ */
59
+ scrollStyle: StoryReaderSwipeStyle | "flat" | "cover" | "cube";
60
+
61
+ /**
62
+ * Vertical offset for the timeline block (in pixels).
63
+ * @default 8
64
+ */
65
+ timelineBlockTopOffset: Nullable<number>;
66
+
67
+ /**
68
+ * Vertical offset for the bottom action panel (in pixels).
69
+ * @default 0
70
+ */
71
+ actionPanelBottomOffset: Nullable<number>;
72
+
73
+ /**
74
+ * Border radius applied to the story container (in pixels).
75
+ *
76
+ * @default 12
77
+ */
78
+ borderRadius: number;
79
+
80
+ /**
81
+ * Enables the experimental modern layout variant.
82
+ *
83
+ * @default false
84
+ * @deprecated Use `layout` property instead
85
+ */
86
+ useExperimentalModernVariant: boolean;
87
+
88
+ /**
89
+ * Layout style for rendering stories.
90
+ * Can be `'classic'` or `'modern'`.
91
+ *
92
+ * @default StoryReaderLayout.Classic
93
+ */
94
+ layout: StoryReaderLayout;
95
+
96
+ /**
97
+ * Loader configuration, supports default and custom options.
98
+ */
99
+ loader: {
100
+ default: {
101
+ /**
102
+ * Primary loader color.
103
+ * @default #FFF
104
+ */
105
+ color: string;
106
+ /**
107
+ * Accent loader color.
108
+ * @default transparent
109
+ */
110
+ accentColor: string;
111
+ };
112
+ };
113
+
114
+ /**
115
+ * Whether the story list should loop back to the beginning after the last story.
116
+ *
117
+ * @default false
118
+ */
119
+ recycleStoriesList: boolean;
120
+
121
+ /**
122
+ * Automatically closes the viewer after the last slide, using a timer.
123
+ *
124
+ * @default false
125
+ */
126
+ closeOnLastSlideByTimer: boolean;
127
+
128
+ /**
129
+ * Configuration for the share panel.
130
+ * @see https://docs.inappstory.com/sdk-guides/react-sdk/share-panel.html
131
+ */
132
+ sharePanel: SharePanel<string>;
133
+
134
+ /**
135
+ * Global backdrop settings for all slides.
136
+ */
137
+ commonBackdrop: {
138
+ /**
139
+ * Background color.
140
+ * @default
141
+ * rgba(51, 51, 51, 1)
142
+ */
143
+ color: string;
144
+ /**
145
+ * CSS backdrop filter (e.g., `blur(10px)`).
146
+ * @default null
147
+ */
148
+ backdropFilter: string;
149
+ };
150
+
151
+ /**
152
+ * Slide-specific backdrop settings.
153
+ */
154
+ slideBackdrop: {
155
+ /**
156
+ * Opacity of the backdrop layer.
157
+ * @default 0.56
158
+ */
159
+ opacity: number;
160
+ /**
161
+ * Blur intensity applied to the backdrop.
162
+ * @default 30
163
+ */
164
+ blur: number;
165
+ /**
166
+ * Array of CSS linear-gradient strings used as overlays.
167
+ * @default
168
+ * ["rgba(0, 0, 0, 0.1) 0%", "rgba(0, 0, 0, 0.9) 100%"]
169
+ */
170
+ linearGradientOverlay: string[];
171
+ };
172
+
173
+ /**
174
+ * Close button configuration.
175
+ */
176
+ closeButton: {
177
+ svgSrc: {
178
+ /**
179
+ * Base (default) SVG icon for the close button.
180
+ */
181
+ baseState: string;
182
+ };
183
+ };
184
+
185
+ /**
186
+ * Like button configuration.
187
+ */
188
+ likeButton: {
189
+ svgSrc: {
190
+ /**
191
+ * SVG icon for the default (inactive) state.
192
+ */
193
+ baseState: string;
194
+ /**
195
+ * SVG icon for the active (liked) state.
196
+ */
197
+ activeState: string;
198
+ };
199
+ };
200
+
201
+ /**
202
+ * Dislike button configuration.
203
+ */
204
+ dislikeButton: {
205
+ svgSrc: {
206
+ /**
207
+ * SVG icon for the default (inactive) state.
208
+ */
209
+ baseState: string;
210
+ /**
211
+ * SVG icon for the active (disliked) state.
212
+ */
213
+ activeState: string;
214
+ };
215
+ };
216
+
217
+ /**
218
+ * Favorite button configuration.
219
+ */
220
+ favoriteButton: {
221
+ svgSrc: {
222
+ /**
223
+ * SVG icon for the default (not-favorited) state.
224
+ */
225
+ baseState: string;
226
+ /**
227
+ * SVG icon for the active (favorited) state.
228
+ */
229
+ activeState: string;
230
+ };
231
+ };
232
+
233
+ /**
234
+ * Mute button configuration.
235
+ */
236
+ muteButton: {
237
+ svgSrc: {
238
+ /**
239
+ * SVG icon for the unmuted state.
240
+ */
241
+ baseState: string;
242
+ /**
243
+ * SVG icon for the muted state.
244
+ */
245
+ activeState: string;
246
+ };
247
+ };
248
+
249
+ /**
250
+ * Share button configuration.
251
+ */
252
+ shareButton: {
253
+ svgSrc: {
254
+ /**
255
+ * SVG icon for the share button.
256
+ */
257
+ baseState: string;
258
+ };
259
+ };
260
+ }>;
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Base StoryReader event.
3
+ * Used as a foundation for most story-related events.
4
+ */
5
+ export interface StoryReaderEvent {
6
+ /** Unique story identifier */
7
+ id: number;
8
+ /** Story title (optional) */
9
+ title?: string;
10
+ /** Number of slides in the story */
11
+ slidesCount?: number;
12
+ /** Feed name where the story was loaded from */
13
+ feed?: string;
14
+ /** Source of story launch (e.g., deeplink, banner) */
15
+ source?: string;
16
+ /** Filters applied to the story list */
17
+ filter: Record<string, unknown>;
18
+ /** User-generated payload (e.g., UGC data) */
19
+ ugcPayload: Record<string, unknown>;
20
+ /** Number of items in the default list */
21
+ defaultListLength: number;
22
+ /** Number of items in the favorites list */
23
+ favoriteListLength: number;
24
+ }
25
+
26
+ /**
27
+ * Possible reasons for closing StoryReader.
28
+ */
29
+ export enum CloseAction {
30
+ /** Closed via the close (X) button in UI */
31
+ closeReaderByCloseBtn = "closeReaderByCloseBtn",
32
+ /** Closed via ESC key (desktop only) */
33
+ closeReaderByEscBtn = "closeReaderByEscBtn",
34
+ /** Closed by swipe down (mobile only) */
35
+ swipeDown = "swipeDown",
36
+ /** Closed by swipe to next story (mobile only) */
37
+ swipe = "swipe",
38
+ /** Closed by clicking the first (backward) or last (forward) slide */
39
+ lastSlideClick = "lastSlideClick",
40
+ /** Closed automatically by timer transition to next story */
41
+ auto = "auto",
42
+ /** Closed using public API: StoryManager.closeStoryReader */
43
+ externalCloseReader = "externalCloseReader"
44
+ }
45
+
46
+ /** Event: user clicked on a story */
47
+ export interface ClickOnStoryEvent extends StoryReaderEvent {
48
+ /** Story index inside feed */
49
+ index: number;
50
+ /** Whether the click was triggered by deeplink */
51
+ isDeeplink: boolean;
52
+ /** URL if click leads externally */
53
+ url?: string;
54
+ }
55
+
56
+ /** Event: story was shown */
57
+ export interface ShowStoryEvent extends StoryReaderEvent {}
58
+
59
+ /** Event: story was closed */
60
+ export interface CloseStoryEvent extends StoryReaderEvent {
61
+ /** Close reason */
62
+ action: CloseAction;
63
+ }
64
+
65
+ /** Event: specific slide was shown */
66
+ export interface ShowSlideEvent extends StoryReaderEvent {
67
+ /** Index of the current slide */
68
+ index: number;
69
+ /** Slide payload (e.g., JSON data) */
70
+ payload: string;
71
+ }
72
+
73
+ /** Event: story was liked */
74
+ export interface LikeStoryEvent extends StoryReaderEvent {
75
+ /** true — liked, false — unliked */
76
+ value: boolean;
77
+ }
78
+
79
+ /** Event: story was disliked */
80
+ export interface DislikeStoryEvent extends StoryReaderEvent {
81
+ /** true — disliked, false — undisliked */
82
+ value: boolean;
83
+ }
84
+
85
+ /** Event: story was added/removed from favorites */
86
+ export interface FavoriteStoryEvent extends StoryReaderEvent {
87
+ /** true — added, false — removed */
88
+ value: boolean;
89
+ }
90
+
91
+ /** Event: story was shared */
92
+ export interface ShareStoryEvent extends StoryReaderEvent {}
93
+
94
+ /** Event: story was shared with a given URL */
95
+ export interface ShareStoryWithPathEvent extends StoryReaderEvent {
96
+ /** URL used for sharing */
97
+ url: string;
98
+ }
99
+
100
+ /** Event: user clicked on the "favorites" cell */
101
+ export interface ClickOnFavoriteCellEvent {
102
+ /** Feed name where the click happened */
103
+ feed: string;
104
+ }
105
+
106
+ /** Event: feed was loaded */
107
+ export interface FeedLoadEvent {
108
+ /** Feed name */
109
+ feed: string;
110
+ /** List of stories in the feed */
111
+ stories: Array<{ id: number; title: string; slidesCount: number }>;
112
+ }
113
+
114
+ /** Event: feed impression (visible stories) */
115
+ export interface FeedImpressionEvent {
116
+ /** Feed name */
117
+ feed: string;
118
+ /** Stories that entered visible area */
119
+ stories: Array<{ id: number; title: string; slidesCount: number }>;
120
+ }
121
+
122
+ /** Event: visible area with stories was updated */
123
+ export interface VisibleAreaUpdatedEvent {
124
+ /** Feed name */
125
+ feed: string;
126
+ /** Stories that became visible */
127
+ stories: Array<{ id: number; title: string; slidesCount: number }>;
128
+ }
129
+
130
+ /** Generic widget event */
131
+ export interface WidgetEvent {
132
+ /** Event name */
133
+ name: string;
134
+ /** Event data */
135
+ data: any;
136
+ }
137
+
138
+ /** Event: mini-game started */
139
+ export interface StartGameEvent {
140
+ /** Game ID */
141
+ id: string;
142
+ }
143
+
144
+ /** Event: mini-game closed */
145
+ export interface CloseGameEvent {
146
+ /** Game ID */
147
+ id: string;
148
+ }
149
+
150
+ /** Event: mini-game finished */
151
+ export interface FinishGameEvent {
152
+ /** Game ID */
153
+ id: string;
154
+ /** Game result */
155
+ result: Record<string, any>;
156
+ }
157
+
158
+ /** Generic game event */
159
+ export interface EventGameEvent {
160
+ /** Event name */
161
+ name: string;
162
+ /** Event payload */
163
+ payload: Record<string, any>;
164
+ }
165
+
166
+ /**
167
+ * All StoryManager events that can be emitted externally.
168
+ */
169
+ export interface StoryManagerEvents {
170
+ /** Story preview card is clicked */
171
+ clickOnStory: ClickOnStoryEvent;
172
+ /** Story is shown */
173
+ showStory: ShowSlideEvent;
174
+ /** Story is closed */
175
+ closeStory: CloseStoryEvent;
176
+ /** Slide is shown */
177
+ showSlide: ShowSlideEvent;
178
+ /** Story was liked */
179
+ likeStory: LikeStoryEvent;
180
+ /** Story was disliked */
181
+ dislikeStory: DislikeStoryEvent;
182
+ /** Story added/removed from favorites */
183
+ favoriteStory: FavoriteStoryEvent;
184
+ /** Story was shared */
185
+ shareStory: ShareStoryEvent;
186
+ /** Story shared with a given URL */
187
+ shareStoryWithPath: ShareStoryWithPathEvent;
188
+ /** Feed impression */
189
+ feedImpression: FeedImpressionEvent;
190
+ /** Visible area with stories was updated */
191
+ visibleAreaUpdated: VisibleAreaUpdatedEvent;
192
+ /** Widget event */
193
+ widgetEvent: WidgetEvent;
194
+ /** Game started */
195
+ startGame: StartGameEvent;
196
+ /** Game closed */
197
+ closeGame: CloseGameEvent;
198
+ /** Game finished */
199
+ finishGame: FinishGameEvent;
200
+ /** Custom game event */
201
+ eventGame: EventGameEvent;
202
+ /**
203
+ * @deprecated
204
+ * See https://docs.inappstory.com/sdk-guides/react-sdk/link-handling.html
205
+ */
206
+ clickOnButton: any;
207
+ }
@@ -1,48 +1,52 @@
1
- export declare class IamNotFoundByEventError extends Error {
2
- constructor(eventName: string);
3
- name: string;
4
- }
5
-
6
- export declare class IamNotFoundByIdError extends Error {
7
- constructor(messageId: string | number);
8
- name: string;
9
- }
10
-
11
- export declare class IamNotFoundLimitError extends Error {
12
- constructor(messageId: string | number);
13
- name: string;
14
- }
15
-
16
- export declare class IamMessageOpenError extends Error {
17
- constructor(messageId: string | number);
18
- name: string;
19
- }
20
-
21
- export declare class IamOtherReaderIsOpenError extends Error {
22
- constructor();
23
- name: string;
24
- }
25
-
26
- export declare class IamShowOnlyIfLoadedError extends Error {
27
- constructor();
28
- name: string;
29
- }
30
-
31
- export declare class IamFrequencyLimitError extends Error {
32
- constructor();
33
- name: string;
34
- }
35
-
36
- export declare class IamCheckDisplayTimeRangeError extends Error {
37
- constructor();
38
- name: string;
39
- }
40
-
41
- export declare class IamMessageLimitExceededError extends Error {
42
- constructor(messageId: string | number);
43
- name: string;
44
- }
45
-
1
+ /**
2
+ * Error thrown when no message is found matching the specified event name
3
+ */
4
+ export declare class IamNotFoundByEventError extends Error {}
5
+
6
+ /**
7
+ * Error thrown when no message is found matching the specified message ID
8
+ */
9
+ export declare class IamNotFoundByIdError extends Error {}
10
+
11
+ /**
12
+ * Error thrown when no display limit configuration is found for the specified message
13
+ */
14
+ export declare class IamNotFoundLimitError extends Error {}
15
+
16
+ /**
17
+ * Error thrown when attempting to open a message that is already open
18
+ */
19
+ export declare class IamMessageOpenError extends Error {}
20
+
21
+ /**
22
+ * Error thrown when attempting to open a message while another reader is active
23
+ */
24
+ export declare class IamOtherReaderIsOpenError extends Error {}
25
+
26
+ /**
27
+ * Error thrown when attempting to show a message that hasn't been preloaded,
28
+ * when the showOnlyIfLoaded option is enabled
29
+ */
30
+ export declare class IamShowOnlyIfLoadedError extends Error {}
31
+
32
+ /**
33
+ * Error thrown when a message's frequency limit has been exceeded
34
+ */
35
+ export declare class IamFrequencyLimitError extends Error {}
36
+
37
+ /**
38
+ * Error thrown when attempting to show a message outside its allowed display time range
39
+ */
40
+ export declare class IamCheckDisplayTimeRangeError extends Error {}
41
+
42
+ /**
43
+ * Error thrown when a message's display limit has been exceeded
44
+ */
45
+ export declare class IamMessageLimitExceededError extends Error {}
46
+
47
+ /**
48
+ * Union type representing all possible In-App Messaging error types
49
+ */
46
50
  export type IamError =
47
51
  | IamNotFoundByEventError
48
52
  | IamNotFoundByIdError