@inappstory/react-sdk 1.9.3 → 1.9.5

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
  */
@@ -154,14 +154,6 @@ export interface CloseGameEvent {
154
154
  id: string;
155
155
  }
156
156
 
157
- /** Event: mini-game finished */
158
- export interface FinishGameEvent {
159
- /** Game ID */
160
- id: string;
161
- /** Game result */
162
- result: Record<string, any>;
163
- }
164
-
165
157
  /** Generic game event */
166
158
  export interface EventGameEvent {
167
159
  /** Event name */
@@ -215,8 +207,6 @@ export interface StoryManagerEvents {
215
207
  startGame: StartGameEvent;
216
208
  /** Game closed */
217
209
  closeGame: CloseGameEvent;
218
- /** Game finished */
219
- finishGame: FinishGameEvent;
220
210
  /** Custom game event */
221
211
  eventGame: EventGameEvent;
222
212
  /** Close story reader event */
@@ -13,7 +13,6 @@ import {
13
13
  VisibleAreaUpdatedEvent,
14
14
  WidgetEvent,
15
15
  StartGameEvent,
16
- FinishGameEvent,
17
16
  CloseGameEvent,
18
17
  EventGameEvent,
19
18
  ProductCartUpdatedEvent,
@@ -125,12 +124,6 @@ export interface StoryManagerEventsProps {
125
124
  */
126
125
  onCloseGame?: (event: CloseGameEvent) => void;
127
126
 
128
- /**
129
- * Called when a game finishes
130
- * @param event - Contains game identifier and result payload
131
- */
132
- onFinishGame?: (event: FinishGameEvent) => void;
133
-
134
127
  /**
135
128
  * Called on custom in-game events
136
129
  * @param event - Contains event name and custom payload
@@ -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.3",
3
+ "version": "1.9.5",
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.34",
62
62
  "async-mutex": "^0.5.0",
63
63
  "bowser": "^2.11.0",
64
64
  "classnames": "^2.5.1",