@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
@@ -4,88 +4,268 @@ import { StoriesList, UGCStoriesList } from "./story-list";
4
4
  import { PublicEventHandler, PublicEvents } from "./publicEvents";
5
5
  import { InAppMessaging } from "./in-app-messaging";
6
6
 
7
+ /**
8
+ * Source of a link click within stories.
9
+ */
7
10
  export declare enum StoryLinkSource {
8
11
  StoryList = "storyList",
9
12
  StoryReader = "storyReader",
10
13
  GameReader = "gameReader"
11
14
  }
12
15
 
16
+ /**
17
+ * Configuration options for initializing the InAppStoryManager.
18
+ */
13
19
  export type InAppStoryManagerConfig = {
20
+ /** API key for initializing the SDK */
14
21
  apiKey: string;
22
+ /** Unique user identifier (optional)
23
+ * @see https://docs.inappstory.com/sdk-guides/react-sdk/user-settings.html
24
+ */
15
25
  userId?: string | number;
26
+ /** Signature for the userId for validation (optional)
27
+ * @see https://docs.inappstory.com/sdk-guides/react-sdk/user-settings.html
28
+ */
16
29
  userIdSign?: string;
30
+ /** Tags for filtering stories (optional)
31
+ * @see https://docs.inappstory.com/sdk-guides/react-sdk/tags.html
32
+ */
17
33
  tags?: Array<string>;
34
+ /** Text placeholders to replace in stories (optional)
35
+ * @example
36
+ * placeholders: {
37
+ * "userName": "John"
38
+ * }
39
+ * @see https://docs.inappstory.com/sdk-guides/js-sdk/placeholders.html
40
+ */
18
41
  placeholders?: Record<string, string>;
42
+ /** Image placeholders to replace in stories (optional)
43
+ * @example
44
+ * imagePlaceholders: {
45
+ * "avatar": "https://example.com/avatar.png"
46
+ * }
47
+ * @see https://docs.inappstory.com/sdk-guides/js-sdk/placeholders.html
48
+ */
19
49
  imagePlaceholders?: Record<string, string>;
50
+ /** Language code for content display (e.g., "en-US") */
20
51
  lang?: string;
21
- dir?: "ltr" | "rtl"
52
+ /** Text direction: 'ltr' or 'rtl' */
53
+ dir?: "ltr" | "rtl";
54
+ /** Disables automatic deviceId generation
55
+ * @see https://docs.inappstory.com/sdk-guides/react-sdk/user-settings.html#overview
56
+ */
22
57
  disableDeviceId?: boolean;
23
58
  };
24
59
 
60
+ /**
61
+ * Configuration for the User Generated Content (UGC) editor.
62
+ */
25
63
  export type UgcEditorConfig = {
64
+ /** Unique session identifier */
26
65
  sessionId: string;
66
+ /** SDK API key */
27
67
  apiKey: string;
68
+ /** Editor configuration */
28
69
  editor: Record<any, any>;
70
+ /** SDK version */
29
71
  sdkVersion: string;
72
+ /** Application package identifier (optional) */
30
73
  appPackageId?: string;
74
+ /** Unique device identifier */
31
75
  deviceId: string;
76
+ /** User identifier (optional) */
32
77
  userId?: string;
78
+ /** Editor language code */
33
79
  lang: string;
34
80
  };
35
81
 
82
+ /**
83
+ * Handler for story link click events.
84
+ * @deprecated Use `clickOnButton` event instead.
85
+ */
36
86
  export type StoryLinkClickHandler = (payload: {
37
87
  data: { id: number; index: number; isDeeplink: boolean; url: string };
38
88
  src: StoryLinkSource;
39
89
  }) => void;
40
90
 
91
+ /**
92
+ * Interface for external plugin integration.
93
+ */
41
94
  export interface Plugin {
95
+ /** Unique plugin name */
42
96
  name: string;
97
+ /** Called when the plugin is installed */
43
98
  install(inAppStoryManager: InAppStoryManager, options?: any): void;
99
+ /** Called when the plugin is uninstalled */
44
100
  uninstall(inAppStoryManager: InAppStoryManager, options?: any): void;
45
101
  }
46
102
 
103
+ /**
104
+ * Main class for managing stories, games, and content.
105
+ */
47
106
  export declare class InAppStoryManager {
107
+ /** SDK version name (e.g., '1.7.0') */
48
108
  get sdkVersionName(): string;
109
+
110
+ /** Numeric SDK version code (e.g., 10700) */
49
111
  get sdkVersionCode(): number;
112
+
113
+ /** Module for displaying in-app messages */
50
114
  inAppMessaging: InAppMessaging;
115
+
116
+ /** Sets the handler for story link clicks
117
+ * @example
118
+ * manager.storyLinkClickHandler = ({ data, src }) => {
119
+ * console.log(`Link clicked: ${data.url} from ${src}`);
120
+ * };
121
+ * @deprecated Use `clickOnButton` event instead.
122
+ */
51
123
  set storyLinkClickHandler(value: StoryLinkClickHandler);
52
124
 
125
+ /**
126
+ * Creates an instance of InAppStoryManager.
127
+ * @param config SDK configuration
128
+ */
53
129
  constructor(config: InAppStoryManagerConfig);
130
+
131
+ /**
132
+ * Gets the current instance of the manager.
133
+ */
54
134
  static getInstance(): InAppStoryManager;
135
+
136
+ /**
137
+ * Installs a plugin at the class level.
138
+ * @param plugin The plugin instance
139
+ * @param options Optional plugin options
140
+ */
55
141
  static use(plugin: Plugin, options?: any): void;
56
142
 
143
+ /**
144
+ * Destroys the manager instance.
145
+ */
57
146
  destroy(): void;
147
+
148
+ /**
149
+ * Displays onboarding stories.
150
+ * @param appearanceManager Appearance manager instance
151
+ * @param options Optional filtering options
152
+ */
58
153
  showOnboardingStories(
59
154
  appearanceManager: AppearanceManager,
60
155
  options?: { feed?: string; customTags?: Array<string>; limit?: number }
61
156
  ): Promise<void>;
157
+
158
+ /**
159
+ * Displays the share page for a specific story.
160
+ * @param storyId The story ID
161
+ */
62
162
  showSharePage(storyId: number | string, appearanceManager: AppearanceManager): Promise<void>;
163
+
164
+ /**
165
+ * Opens a specific story.
166
+ * @param id The story ID
167
+ */
63
168
  showStory(id: number | string, appearanceManager: AppearanceManager): Promise<void>;
169
+
170
+ /**
171
+ * Opens a specific story only once.
172
+ * @param id The story ID
173
+ */
64
174
  showStoryOnce(id: number | string, appearanceManager: AppearanceManager): Promise<void>;
175
+
176
+ /**
177
+ * Opens a game by its instance ID.
178
+ * @param gameInstanceId Game instance identifier
179
+ * @param appearanceManager Appearance manager instance
180
+ * @param gameOptions Optional game parameters
181
+ */
65
182
  openGame(
66
- gameInstanceId: string,
183
+ gameInstanceId: string | number,
67
184
  appearanceManager: AppearanceManager,
68
185
  gameOptions?: { demoMode?: boolean }
69
186
  ): Promise<void>;
187
+
188
+ /**
189
+ * Closes the currently active game, if any.
190
+ * @returns Whether the game was closed
191
+ */
70
192
  closeGame(): Promise<boolean>;
193
+
194
+ /**
195
+ * Closes the story reader, if it is open.
196
+ */
71
197
  closeStoryReader(): Promise<boolean | undefined>;
198
+
199
+ /**
200
+ * Closes the goods widget, if it is open.
201
+ */
72
202
  closeGoodsWidget(): void;
203
+
204
+ /**
205
+ * Retrieves the UGC editor configuration.
206
+ */
73
207
  getUgcEditorConfig(): Promise<UgcEditorConfig>;
208
+
209
+ /**
210
+ * Retrieves the nonce, if set.
211
+ */
74
212
  getNonce(): string | undefined;
213
+
214
+ /**
215
+ * Sets the user ID.
216
+ * @param userId User identifier
217
+ * @param sign Optional signature
218
+ */
75
219
  setUserId(userId: string | number, sign?: string): Promise<void>;
220
+
221
+ /**
222
+ * Logs out the current user.
223
+ */
76
224
  userLogout(): Promise<void>;
225
+
226
+ /**
227
+ * Sets the content language.
228
+ */
77
229
  setLang(lang: string): void;
230
+
231
+ /**
232
+ * Sets tags for filtering stories.
233
+ */
78
234
  setTags(tags: string[]): void;
235
+
236
+ /**
237
+ * Sets text placeholders.
238
+ */
79
239
  setPlaceholders(placeholders: Dict<string, string>): void;
240
+
241
+ /**
242
+ * Sets image placeholders.
243
+ */
80
244
  setImagePlaceholders(imagePlaceholders: Dict<string, string>): void;
245
+
246
+ /**
247
+ * Subscribes to an SDK event.
248
+ */
81
249
  on<Event extends keyof PublicEvents>(eventName: Event, listener: PublicEventHandler<Event>): this;
250
+
251
+ /**
252
+ * Subscribes to a one-time SDK event.
253
+ */
82
254
  once<Event extends keyof PublicEvents>(eventName: Event, listener: PublicEventHandler<Event>): this;
255
+
256
+ /**
257
+ * Unsubscribes from an SDK event.
258
+ */
83
259
  off<Event extends keyof PublicEvents>(eventName: Event, listener: PublicEventHandler<Event>): this;
84
260
 
85
261
  /** @deprecated Use `showSharePage()` instead */
86
262
  SharePage: {
87
263
  new (storyId: number | string, appearanceManager: AppearanceManager, options?: SharePageOptions): SharePage;
88
264
  };
265
+
266
+ /**
267
+ * Component for displaying a list of stories.
268
+ */
89
269
  StoriesList: {
90
270
  new (
91
271
  mountSelector: string,
@@ -93,6 +273,10 @@ export declare class InAppStoryManager {
93
273
  options: { feed?: string; testKey?: string; useUgcCard?: boolean }
94
274
  ): StoriesList;
95
275
  };
276
+
277
+ /**
278
+ * Component for displaying a list of UGC stories.
279
+ */
96
280
  UGCStoriesList: {
97
281
  new (
98
282
  mountSelector: string,
@@ -100,4 +284,4 @@ export declare class InAppStoryManager {
100
284
  options: { filter?: Record<string, any>; testKey?: string; useUgcCard?: boolean }
101
285
  ): UGCStoriesList;
102
286
  };
103
- }
287
+ }
@@ -7,6 +7,10 @@ export type SharePageOptions = {
7
7
  handleStoryReaderClose?: () => void;
8
8
  };
9
9
 
10
+ /**
11
+ * @deprecated Use showSharePage() instead
12
+ * @see https://docs.inappstory.com/sdk-guides/sharing/sharing.html
13
+ */
10
14
  export declare class SharePage extends EventEmitter {
11
15
  constructor(storyId: number | string, appearanceManager: AppearanceManager, options?: SharePageOptions);
12
16
 
@@ -2,18 +2,48 @@ import { EventEmitter } from "events";
2
2
  import { AppearanceManager } from "../appearance-manager";
3
3
  import { StoriesListType } from "./storiesListType";
4
4
 
5
+ /**
6
+ * Component for rendering and managing a list of stories.
7
+ *
8
+ * Emits events related to story list loading and interactions.
9
+ */
5
10
  export declare class StoriesList extends EventEmitter {
11
+ /** Type of the stories list (e.g., regular, UGC, etc.) */
6
12
  get type(): StoriesListType;
13
+
14
+ /** Feed slug used for loading stories */
7
15
  get feedSlug(): string;
16
+
17
+ /** Test key for loading stories in test mode */
8
18
  get testKey(): string;
19
+
20
+ /** Whether the list includes a UGC card */
9
21
  get useUgcCard(): boolean;
10
22
 
23
+ /**
24
+ * Creates a new StoriesList instance and mounts it to the given selector.
25
+ * @param mountSelector CSS selector or DOM element where the list will be mounted
26
+ * @param appearanceManager Instance controlling the list’s appearance
27
+ * @param options Additional configuration:
28
+ * - `feed`: Feed slug to load stories from
29
+ * - `testKey`: Key for loading test stories
30
+ * - `useUgcCard`: Whether to display a UGC card in the list
31
+ */
11
32
  constructor(
12
33
  mountSelector: string,
13
34
  appearanceManager: AppearanceManager,
14
35
  options: { feed?: string; testKey?: string; useUgcCard?: boolean }
15
36
  );
16
37
 
38
+ /**
39
+ * Reloads the list of stories.
40
+ * @param options Options for reloading:
41
+ * - `needLoader`: Whether to show a loading indicator
42
+ */
17
43
  reload(options?: { needLoader: boolean }): Promise<void>;
44
+
45
+ /**
46
+ * Destroys the list instance and removes it from the DOM.
47
+ */
18
48
  destroy(): void;
19
49
  }
@@ -2,18 +2,48 @@ import { EventEmitter } from "events";
2
2
  import { AppearanceManager } from "../appearance-manager";
3
3
  import { StoriesListType } from "./storiesListType";
4
4
 
5
+ /**
6
+ * Component for rendering and managing a list of user-generated content (UGC) stories.
7
+ *
8
+ * Emits events related to list loading, filtering, and user interactions.
9
+ */
5
10
  export declare class UGCStoriesList extends EventEmitter {
11
+ /** Type of the stories list (e.g., regular, UGC, etc.) */
6
12
  get type(): StoriesListType;
13
+
14
+ /** Feed slug used for loading stories (if applicable) */
7
15
  get feedSlug(): string;
16
+
17
+ /** Test key for loading stories in test mode */
8
18
  get testKey(): string;
19
+
20
+ /** Whether the list includes a UGC card */
9
21
  get useUgcCard(): boolean;
10
22
 
23
+ /**
24
+ * Creates a new UGCStoriesList instance and mounts it to the given selector.
25
+ * @param mountSelector CSS selector or DOM element where the list will be mounted
26
+ * @param appearanceManager Instance controlling the list’s appearance
27
+ * @param options Additional configuration:
28
+ * - `filter`: Filter parameters for loading specific stories
29
+ * - `testKey`: Key for loading test stories
30
+ * - `useUgcCard`: Whether to display a UGC card in the list
31
+ */
11
32
  constructor(
12
33
  mountSelector: string,
13
34
  appearanceManager: AppearanceManager,
14
35
  options: { filter?: Record<string, any>; testKey?: string; useUgcCard?: boolean }
15
36
  );
16
37
 
38
+ /**
39
+ * Reloads the list of UGC stories.
40
+ * @param options Options for reloading:
41
+ * - `needLoader`: Whether to show a loading indicator
42
+ */
17
43
  reload(options?: { needLoader: boolean }): Promise<void>;
44
+
45
+ /**
46
+ * Destroys the list instance and removes it from the DOM.
47
+ */
18
48
  destroy(): void;
19
49
  }
@@ -1,12 +1,49 @@
1
+ /**
2
+ * Represents the loading status and metadata for a story list
3
+ */
1
4
  export interface StoryListLoadStatus {
2
- feed: string | number,
3
- filter: Record<string, any> | null,
4
- defaultListLength: number,
5
- favoriteListLength: number,
6
- success: boolean,
5
+ /**
6
+ * The feed identifier that was loaded
7
+ */
8
+ feed: string;
9
+
10
+ /**
11
+ * Applied filters for the story list, or null if no filters were applied
12
+ */
13
+ filter: Record<string, any> | null;
14
+
15
+ /**
16
+ * Number of items in the default (non-favorite) story list
17
+ */
18
+ defaultListLength: number;
19
+
20
+ /**
21
+ * Number of items in the favorites list
22
+ */
23
+ favoriteListLength: number;
24
+
25
+ /**
26
+ * Indicates whether the loading operation was successful
27
+ */
28
+ success: boolean;
29
+
30
+ /**
31
+ * Error details if the loading failed, or null if successful
32
+ */
7
33
  error: {
8
- name: string,
9
- networkStatus: number,
10
- networkMessage: string
11
- } | null
34
+ /**
35
+ * Name/type of the error that occurred
36
+ */
37
+ name: string;
38
+
39
+ /**
40
+ * HTTP status code or network error code
41
+ */
42
+ networkStatus: number;
43
+
44
+ /**
45
+ * Human-readable error message from the network request
46
+ */
47
+ networkMessage: string;
48
+ } | null;
12
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inappstory/js-sdk",
3
- "version": "3.6.2",
3
+ "version": "3.7.0-rc.0",
4
4
  "description": "JS SDK",
5
5
  "keywords": [
6
6
  "stories",
@@ -35,6 +35,10 @@
35
35
  "./plugins/videoOnDemand": {
36
36
  "types": "./plugins/videoOnDemand/iasVideoOnDemandPlugin.d.ts",
37
37
  "default": "./plugins/videoOnDemand/iasVideoOnDemandPlugin.umd.js"
38
+ },
39
+ "./plugins/banners": {
40
+ "types": "./plugins/banners/types/index.d.ts",
41
+ "default": "./plugins/banners/index.esm.mjs"
38
42
  }
39
43
  },
40
44
  "main": "dist/index.umd.js",
@@ -54,7 +58,7 @@
54
58
  "Samsung >= 5"
55
59
  ],
56
60
  "dependencies": {
57
- "@inappstory/react-sdk": "^1.7.2",
61
+ "@inappstory/react-sdk": "^1.8.0-rc.0",
58
62
  "react": "^18.2.0",
59
63
  "react-dom": "^18.2.0"
60
64
  },