@inappstory/react-sdk 1.9.2 → 1.9.4

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.
@@ -1,8 +1,9 @@
1
1
  import { CloseButtonPosition } from "./appearanceCommon";
2
2
  import { RecursivePartial } from "../global";
3
-
3
+ import { SharePanel } from "./sharePanel";
4
4
  import { CloseButtonPosition } from "./appearanceCommon";
5
5
  import { RecursivePartial } from "../global";
6
+ import { SharePanel } from "./sharePanel";
6
7
 
7
8
  /**
8
9
  * Appearance options for Game Reader.
@@ -97,6 +98,12 @@ export type GameReaderOptions = RecursivePartial<{
97
98
  * @default true
98
99
  */
99
100
  forceCheckOrientation?: boolean;
101
+
102
+ /**
103
+ * Configuration for the share panel.
104
+ * @see https://docs.inappstory.com/sdk-guides/react-sdk/share-panel.html
105
+ */
106
+ sharePanel: SharePanel<string>;
100
107
  }>;
101
108
 
102
109
  /**
@@ -18,6 +18,12 @@ type BaseShareTarget = "vk" | "ok" | "facebook" | "x" | "linkedin" | "telegram"
18
18
  */
19
19
  export type ShareTarget<CustomTargets extends string = never> = BaseShareTarget | CustomTargets;
20
20
 
21
+ export declare enum ShareType {
22
+ Text = "text",
23
+ Link = "link",
24
+ Image = "image"
25
+ }
26
+
21
27
  /**
22
28
  * Parameters used to configure individual share targets.
23
29
  */
@@ -112,9 +118,15 @@ export type SharePanel<CustomTargets extends string = never> = Partial<{
112
118
  copyButton: {
113
119
  /**
114
120
  * Button label text (e.g., "Copy link").
121
+ * @deprecated Use `getLabel` instead
115
122
  */
116
123
  label: string;
117
124
 
125
+ /**
126
+ * Button label text (e.g., "Copy link", "CopyText")
127
+ */
128
+ getLabel: (config: { url?: string; text?: string; type: ShareType }) => string;
129
+
118
130
  /**
119
131
  * SVG icons for base and success (copied) states.
120
132
  */
@@ -152,6 +152,7 @@ export interface InAppMessaging {
152
152
  * @param messageId - The ID of the message to show
153
153
  * @param options - Optional display configuration
154
154
  * @param options.showOnlyIfLoaded - If true, only shows messages that were preloaded
155
+ * @param options.signal - Abort signal to cancel the operation
155
156
  * @returns Promise resolving to the displayed message
156
157
  * @throws {IamNotFoundByIdError} If no message exists with this ID
157
158
  * @throws {IamMessageOpenError} If this message is already open
@@ -159,7 +160,7 @@ export interface InAppMessaging {
159
160
  * @throws {IamShowOnlyIfLoadedError} If showOnlyIfLoaded=true but message wasn't preloaded
160
161
  * @throws {IamMessageLimitExceededError} If message display limit was reached
161
162
  */
162
- showMessageById(messageId: number | string, options?: { showOnlyIfLoaded?: boolean }): Promise<IamMessage>;
163
+ showMessageById(messageId: number | string, options?: { showOnlyIfLoaded?: boolean; signal?: AbortSignal; }): Promise<IamMessage>;
163
164
 
164
165
  /**
165
166
  * Displays a message associated with an event name
@@ -167,6 +168,7 @@ export interface InAppMessaging {
167
168
  * @param options - Optional display configuration
168
169
  * @param options.showOnlyIfLoaded - If true, only shows messages that were preloaded
169
170
  * @param options.tags - Filter messages by tags
171
+ * @param options.signal - Abort signal to cancel the operation
170
172
  * @returns Promise resolving to the displayed message
171
173
  * @throws {IamNotFoundByEventError} If no message exists for this event
172
174
  * @throws {IamFrequencyLimitError} If message frequency limit was exceeded
@@ -176,7 +178,7 @@ export interface InAppMessaging {
176
178
  */
177
179
  showMessageByEvent(
178
180
  eventName: string,
179
- options?: { showOnlyIfLoaded?: boolean; tags?: string[] }
181
+ options?: { showOnlyIfLoaded?: boolean; tags?: string[]; signal?: AbortSignal; }
180
182
  ): Promise<IamMessage>;
181
183
 
182
184
  /**
@@ -163,7 +163,7 @@ export declare class StoryManager {
163
163
  get sdkVersionCode(): number;
164
164
 
165
165
  /** SDK user device ID */
166
- get deviceId(): string
166
+ get deviceId(): string;
167
167
 
168
168
  /** SDK user agent */
169
169
  get userAgent(): string;
@@ -218,7 +218,12 @@ export declare class StoryManager {
218
218
  };
219
219
 
220
220
  */
221
- showOnboardingStories(options?: { feed?: string; customTags?: string[]; limit?: number }): Promise<{
221
+ showOnboardingStories(options?: {
222
+ feed?: string;
223
+ customTags?: string[];
224
+ limit?: number;
225
+ signal?: AbortSignal;
226
+ }): Promise<{
222
227
  stories: {
223
228
  title: Option<string>;
224
229
  tags: string[];
@@ -233,23 +238,26 @@ export declare class StoryManager {
233
238
  /**
234
239
  * Displays the share page for a specific story.
235
240
  * @param storyId The story ID
241
+ * @param options.signal Abort signal to cancel the operation
236
242
  * @see https://docs.inappstory.com/sdk-guides/sharing/sharing.html
237
243
  * @example
238
244
  * storyManager.showSharePage("yout-story-id").catch(console.error)
239
245
  */
240
- showSharePage(storyId: number | string): Promise<void>;
246
+ showSharePage(storyId: number | string, options?: { signal?: AbortSignal }): Promise<void>;
241
247
 
242
248
  /**
243
249
  * Displays a specific story.
244
250
  * @param id The story ID
251
+ * @param options.signal Abort signal to cancel the operation
245
252
  */
246
- showStory(id: number | string): Promise<void>;
253
+ showStory(id: number | string, options?: { signal?: AbortSignal }): Promise<void>;
247
254
 
248
255
  /**
249
256
  * Displays a story only once.
250
257
  * @param id The story ID
258
+ * @param options.signal Abort signal to cancel the operation
251
259
  */
252
- showStoryOnce(id: number | string): Promise<void>;
260
+ showStoryOnce(id: number | string, options?: { signal?: AbortSignal }): Promise<void>;
253
261
 
254
262
  /**
255
263
  * Opens a game by its instance ID.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inappstory/react-sdk",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "React SDK",
5
5
  "keywords": [
6
6
  "stories",
@@ -58,7 +58,7 @@
58
58
  "Samsung >= 5"
59
59
  ],
60
60
  "dependencies": {
61
- "@inappstory/slide-api": "^0.1.29",
61
+ "@inappstory/slide-api": "^0.1.32",
62
62
  "async-mutex": "^0.5.0",
63
63
  "bowser": "^2.11.0",
64
64
  "classnames": "^2.5.1",