@inappstory/js-sdk 3.6.2 → 3.7.0-rc.0

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.
Files changed (30) hide show
  1. package/dist/index.esm.mjs +1 -1
  2. package/dist/index.umd.js +1 -1
  3. package/dist/types/appearance-manager/appearanceCommon.d.ts +69 -3
  4. package/dist/types/appearance-manager/appearanceManager.d.ts +69 -1
  5. package/dist/types/appearance-manager/gameReader.d.ts +91 -15
  6. package/dist/types/appearance-manager/goodsWidget.d.ts +98 -17
  7. package/dist/types/appearance-manager/sharePanel.d.ts +129 -2
  8. package/dist/types/appearance-manager/storiesList.d.ts +303 -5
  9. package/dist/types/appearance-manager/storyFavoriteReader.d.ts +34 -0
  10. package/dist/types/appearance-manager/storyReader.d.ts +260 -0
  11. package/dist/types/in-app-messaging/iamErrors.d.ts +49 -45
  12. package/dist/types/in-app-messaging/inAppMessaging.d.ts +166 -0
  13. package/dist/types/inAppStoryManager.d.ts +187 -3
  14. package/dist/types/share-page/sharePage.d.ts +4 -0
  15. package/dist/types/story-list/StoryList.d.ts +30 -0
  16. package/dist/types/story-list/UGCStoryList.d.ts +30 -0
  17. package/dist/types/story-list/storyListLoadStatus.ts +46 -9
  18. package/package.json +6 -2
  19. package/plugins/banners/index.esm.mjs +1 -0
  20. package/plugins/banners/package.json +24 -0
  21. package/plugins/banners/types/banner.d.ts +197 -0
  22. package/plugins/banners/types/bannerPlace.d.ts +186 -0
  23. package/plugins/banners/types/bannerPlaceAppearance.d.ts +32 -0
  24. package/plugins/banners/types/iasBannerPlace.d.ts +77 -0
  25. package/plugins/banners/types/iasBannerPreview.d.ts +58 -0
  26. package/plugins/banners/types/iasBannersProvider.d.ts +52 -0
  27. package/plugins/banners/types/index.d.ts +29 -0
  28. package/plugins/dotLottie/iasDotLottiePlugin.umd.js +1 -1
  29. package/plugins/videoOnDemand/iasVideoOnDemandPlugin.umd.js +1 -1
  30. package/dist/types/appearance-manager/storyReader.ts +0 -73
@@ -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
+ }>;
@@ -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
@@ -1,48 +1,214 @@
1
+ import {
2
+ IamNotFoundByEventError,
3
+ IamMessageOpenError,
4
+ IamOtherReaderIsOpenError,
5
+ IamShowOnlyIfLoadedError,
6
+ IamMessageLimitExceededError,
7
+ IamNotFoundByIdError,
8
+ IamFrequencyLimitError,
9
+ IamCheckDisplayTimeRangeError
10
+ } from "./iamErrors";
11
+
12
+ /**
13
+ * Enum representing different types of in-app messages
14
+ */
1
15
  export declare enum IamMessageType {
16
+ /**
17
+ * Message appears as a bottom sheet (slides up from bottom of screen)
18
+ */
2
19
  BottomSheet = 1,
20
+
21
+ /**
22
+ * Message appears as a modal dialog (centered on screen)
23
+ */
3
24
  Modal = 2,
25
+
26
+ /**
27
+ * Message takes up the full screen
28
+ */
4
29
  Fullscreen = 3
5
30
  }
6
31
 
32
+ /**
33
+ * Interface representing an in-app message
34
+ */
7
35
  export interface IamMessage {
36
+ /**
37
+ * Unique identifier for the message
38
+ */
8
39
  id: number;
40
+
41
+ /**
42
+ * Name of the campaign this message belongs to
43
+ */
9
44
  campaignName: string;
45
+
46
+ /**
47
+ * Visual presentation type of the message
48
+ */
10
49
  type: IamMessageType;
11
50
  }
12
51
 
52
+ /**
53
+ * Type mapping of all possible IAM events and their payload structures
54
+ */
13
55
  export type IamEvents = {
56
+ /**
57
+ * Triggered when a message is closed
58
+ */
14
59
  close: {
60
+ /**
61
+ * The message that was closed
62
+ */
15
63
  message: IamMessage;
16
64
  };
65
+
66
+ /**
67
+ * Triggered when a widget within a message fires an event
68
+ */
17
69
  widgetEvent: {
70
+ /**
71
+ * The message containing the widget
72
+ */
18
73
  message: IamMessage;
74
+
75
+ /**
76
+ * Name/type of the widget event
77
+ */
19
78
  name: string;
79
+
80
+ /**
81
+ * Additional data associated with the event
82
+ */
20
83
  data: Record<string, any>;
21
84
  };
85
+
86
+ /**
87
+ * Triggered when a button is clicked within a message
88
+ */
22
89
  clickOnButton: {
90
+ /**
91
+ * Unique identifier of the clicked button
92
+ */
23
93
  id: number;
94
+
95
+ /**
96
+ * Index position of the button
97
+ */
24
98
  index: number;
99
+
100
+ /**
101
+ * URL associated with the button (if any)
102
+ */
25
103
  url: string;
104
+
105
+ /**
106
+ * ID of the HTML element that was clicked
107
+ */
26
108
  elementId: string;
27
109
  };
28
110
  };
29
111
 
112
+ /**
113
+ * Type definition for IAM event handlers
114
+ * @template Event - The event name (keyof IamEvents)
115
+ */
30
116
  export type IamEventHandler<Event extends keyof IamEvents> = (event: IamEvents[Event]) => void;
31
117
 
118
+ /**
119
+ * Interface for the In-App Messaging service
120
+ */
32
121
  export interface InAppMessaging {
122
+ /**
123
+ * Gets the currently active/open message
124
+ */
33
125
  get activeMessage(): IamMessage | null;
126
+
127
+ /**
128
+ * Indicates whether messages have been loaded
129
+ */
34
130
  get isLoaded(): boolean;
131
+
132
+ /**
133
+ * Indicates whether messages are currently loading
134
+ */
35
135
  get isLoading(): boolean;
136
+
137
+ /**
138
+ * Indicates whether a message is currently open/visible
139
+ */
36
140
  get isOpened(): boolean;
37
141
 
142
+ /**
143
+ * Preloads messages for faster display later
144
+ * @param options - Optional configuration
145
+ * @param options.tags - Filter messages by tags
146
+ * @returns Promise resolving to array of loaded messages
147
+ */
38
148
  preload(options?: { tags?: string[] }): Promise<IamMessage[]>;
149
+
150
+ /**
151
+ * Displays a message by its ID
152
+ * @param messageId - The ID of the message to show
153
+ * @param options - Optional display configuration
154
+ * @param options.showOnlyIfLoaded - If true, only shows messages that were preloaded
155
+ * @returns Promise resolving to the displayed message
156
+ * @throws {IamNotFoundByIdError} If no message exists with this ID
157
+ * @throws {IamMessageOpenError} If this message is already open
158
+ * @throws {IamOtherReaderIsOpenError} If another reader is active
159
+ * @throws {IamShowOnlyIfLoadedError} If showOnlyIfLoaded=true but message wasn't preloaded
160
+ * @throws {IamMessageLimitExceededError} If message display limit was reached
161
+ */
39
162
  showMessageById(messageId: number | string, options?: { showOnlyIfLoaded?: boolean }): Promise<IamMessage>;
163
+
164
+ /**
165
+ * Displays a message associated with an event name
166
+ * @param eventName - The event name triggering the message
167
+ * @param options - Optional display configuration
168
+ * @param options.showOnlyIfLoaded - If true, only shows messages that were preloaded
169
+ * @param options.tags - Filter messages by tags
170
+ * @returns Promise resolving to the displayed message
171
+ * @throws {IamNotFoundByEventError} If no message exists for this event
172
+ * @throws {IamFrequencyLimitError} If message frequency limit was exceeded
173
+ * @throws {IamCheckDisplayTimeRangeError} If current time is outside allowed display period
174
+ * @throws {IamOtherReaderIsOpenError} If another reader is active
175
+ * @throws {IamShowOnlyIfLoadedError} If showOnlyIfLoaded=true but message wasn't preloaded
176
+ */
40
177
  showMessageByEvent(
41
178
  eventName: string,
42
179
  options?: { showOnlyIfLoaded?: boolean; tags?: string[] }
43
180
  ): Promise<IamMessage>;
181
+
182
+ /**
183
+ * Closes the currently open message
184
+ * @returns Promise that resolves when the message is closed
185
+ */
44
186
  close(): Promise<void>;
187
+
188
+ /**
189
+ * Registers an event listener
190
+ * @template Event - The event name to listen for
191
+ * @param eventName - Name of the event to listen for
192
+ * @param listener - Callback function to handle the event
193
+ * @returns The InAppMessaging instance for chaining
194
+ */
45
195
  on<Event extends keyof IamEvents>(eventName: Event, listener: IamEventHandler<Event>): this;
196
+
197
+ /**
198
+ * Registers a one-time event listener
199
+ * @template Event - The event name to listen for
200
+ * @param eventName - Name of the event to listen for
201
+ * @param listener - Callback function to handle the event
202
+ * @returns The InAppMessaging instance for chaining
203
+ */
46
204
  once<Event extends keyof IamEvents>(eventName: Event, listener: IamEventHandler<Event>): this;
205
+
206
+ /**
207
+ * Removes an event listener
208
+ * @template Event - The event name to remove listener for
209
+ * @param eventName - Name of the event
210
+ * @param listener - Callback function to remove
211
+ * @returns The InAppMessaging instance for chaining
212
+ */
47
213
  off<Event extends keyof IamEvents>(eventName: Event, listener: IamEventHandler<Event>): this;
48
214
  }