@inappstory/react-sdk 1.7.3 → 1.8.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.
- package/dist/index.esm.mjs +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/types/appearance-manager/appearanceCommon.d.ts +69 -3
- package/dist/types/appearance-manager/gameReader.d.ts +83 -4
- package/dist/types/appearance-manager/goodsWidget.d.ts +84 -1
- package/dist/types/appearance-manager/sharePanel.d.ts +133 -7
- package/dist/types/appearance-manager/storiesList.d.ts +303 -5
- package/dist/types/appearance-manager/storyReader.d.ts +260 -0
- package/dist/types/ias-container/IasContainer.d.ts +24 -0
- package/dist/types/ias-container/appearanceOptionsProps.d.ts +20 -1
- package/dist/types/ias-container/storyManagerEventsProps.d.ts +78 -0
- package/dist/types/in-app-messaging/iamErrors.d.ts +49 -45
- package/dist/types/in-app-messaging/inAppMessaging.d.ts +166 -0
- package/dist/types/story-list/FavoriteStoryList.d.ts +51 -1
- package/dist/types/story-list/StoryList.d.ts +169 -0
- package/dist/types/story-list/UGCStoryList.d.ts +61 -0
- package/dist/types/story-list/navigationViewModel.d.ts +43 -0
- package/dist/types/story-list/storyCardViewModel.d.ts +87 -3
- package/dist/types/story-list/storyListApi.d.ts +3 -2
- package/dist/types/story-list/storyListLoadStatus.ts +47 -10
- package/dist/types/storyManager.d.ts +179 -0
- package/package.json +6 -2
- package/plugins/banners/index.esm.mjs +1 -0
- package/plugins/banners/package.json +24 -0
- package/plugins/banners/types/banner.d.ts +197 -0
- package/plugins/banners/types/bannerPlace.d.ts +186 -0
- package/plugins/banners/types/bannerPlaceAppearance.d.ts +32 -0
- package/plugins/banners/types/iasBannerPlace.d.ts +77 -0
- package/plugins/banners/types/iasBannerPreview.d.ts +58 -0
- package/plugins/banners/types/iasBannersProvider.d.ts +52 -0
- package/plugins/banners/types/index.d.ts +29 -0
- package/plugins/dotLottie/iasDotLottiePlugin.umd.js +1 -1
- package/plugins/videoOnDemand/iasVideoOnDemandPlugin.umd.js +1 -1
- package/dist/types/appearance-manager/storyReader.ts +0 -125
|
@@ -2,12 +2,31 @@ import {
|
|
|
2
2
|
AppearanceCommonOptions,
|
|
3
3
|
GameReaderOptions,
|
|
4
4
|
GoodsWidgetOptions,
|
|
5
|
-
StoryReaderOptions
|
|
5
|
+
StoryReaderOptions
|
|
6
6
|
} from "../appearance-manager";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Appearance customization options.
|
|
10
|
+
* Allows styling different parts of the InAppStory
|
|
11
|
+
*/
|
|
8
12
|
export interface AppearanceOptionsProps {
|
|
13
|
+
/**
|
|
14
|
+
* Common appearance options applied across All IAS components
|
|
15
|
+
*/
|
|
9
16
|
commonOptions?: AppearanceCommonOptions;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Customization options specific to the Story Reader component
|
|
20
|
+
*/
|
|
10
21
|
storyReaderOptions?: StoryReaderOptions;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Customization options specific to the Game Reader component
|
|
25
|
+
*/
|
|
11
26
|
gameReaderOptions?: GameReaderOptions;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Customization options for the Goods Widget (V1) appearance
|
|
30
|
+
*/
|
|
12
31
|
goodsWidgetOptions?: GoodsWidgetOptions;
|
|
13
32
|
}
|
|
@@ -14,18 +14,96 @@ import {
|
|
|
14
14
|
WidgetEvent
|
|
15
15
|
} from "./publicEvents";
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Interface for `StoryManager` event handlers.
|
|
19
|
+
* Contains callback props for various events that occur during story interactions.
|
|
20
|
+
* All event handlers are optional and follow the naming pattern `on[EventName]`.
|
|
21
|
+
*
|
|
22
|
+
* Each event handler receives a specific event object with relevant data about the interaction.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Example of using event handlers
|
|
26
|
+
* <IASContainer
|
|
27
|
+
* onShowStory={(event) => console.log('Story shown:', event.id)}
|
|
28
|
+
* onCloseStory={(event) => console.log('Story closed:', event.id)}
|
|
29
|
+
* />
|
|
30
|
+
*/
|
|
17
31
|
export interface StoryManagerEventsProps {
|
|
32
|
+
/**
|
|
33
|
+
* Called when a user clicks on a story in the story list
|
|
34
|
+
* @param event - Contains story ID and other metadata
|
|
35
|
+
*/
|
|
18
36
|
onClickOnStory?: (event: ClickOnStoryEvent) => void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Called when a story becomes visible in the reader
|
|
40
|
+
* @param event - Contains story ID and opening context
|
|
41
|
+
*/
|
|
19
42
|
onShowStory?: (event: ShowStoryEvent) => void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Called when a story is closed
|
|
46
|
+
* @param event - Contains story ID and close action
|
|
47
|
+
*/
|
|
20
48
|
onCloseStory?: (event: CloseStoryEvent) => void;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Called when a new slide is shown in the story
|
|
52
|
+
* @param event - Contains story ID and slide index
|
|
53
|
+
*/
|
|
21
54
|
onShowSlide?: (event: ShowSlideEvent) => void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Called when a user clicks on an interactive button in the story
|
|
58
|
+
* @param event - Contains URL
|
|
59
|
+
*/
|
|
22
60
|
onClickOnButton?: (event: ClickOnButtonEvent) => void;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Called when a user likes a story
|
|
64
|
+
* @param event - Contains story ID and like status
|
|
65
|
+
*/
|
|
23
66
|
onLikeStory?: (event: LikeStoryEvent) => void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Called when a user dislikes a story
|
|
70
|
+
* @param event - Contains story ID and dislike status
|
|
71
|
+
*/
|
|
24
72
|
onDislikeStory?: (event: DislikeStoryEvent) => void;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Called when a user favorites a story
|
|
76
|
+
* @param event - Contains story ID and favorite status
|
|
77
|
+
*/
|
|
25
78
|
onFavoriteStory?: (event: FavoriteStoryEvent) => void;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Called when a user shares a story (without specific path)
|
|
82
|
+
* @param event - Contains story ID and share method
|
|
83
|
+
*/
|
|
26
84
|
onShareStory?: (event: ShareStoryEvent) => void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Called when a user shares a story with a specific path/slide
|
|
88
|
+
* @param event - Contains story ID, slide index, and share method
|
|
89
|
+
*/
|
|
27
90
|
onShareStoryWithPath?: (event: ShareStoryWithPathEvent) => void;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Called when stories feed becomes visible to the user
|
|
94
|
+
* @param event - Contains feed slug and impression data
|
|
95
|
+
*/
|
|
28
96
|
onFeedImpression?: (event: FeedImpressionEvent) => void;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Called when the visible area of stories in a feed changes
|
|
100
|
+
* @param event - Contains visibility information for stories in viewport
|
|
101
|
+
*/
|
|
29
102
|
onVisibleAreaUpdated?: (event: VisibleAreaUpdatedEvent) => void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Generic handler for widget-specific events
|
|
106
|
+
* @param event - Contains widget type and event-specific data
|
|
107
|
+
*/
|
|
30
108
|
onWidgetEvent?: (event: WidgetEvent) => void;
|
|
31
109
|
}
|
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
}
|
|
@@ -2,10 +2,60 @@ import { StoriesListOptions, NavigationViewModel } from "..";
|
|
|
2
2
|
import { StoryCardViewModel } from "./storyCardViewModel";
|
|
3
3
|
import { OverrideByMediaQuery } from "../appearance-manager/overrideByMediaQuery";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Props for the FavoriteStoryList component that displays a user's favorite stories
|
|
7
|
+
*/
|
|
5
8
|
interface FavoriteStoryListProps {
|
|
9
|
+
/**
|
|
10
|
+
* Configuration options for customizing the appearance and behavior of the list
|
|
11
|
+
*/
|
|
6
12
|
options?: StoriesListOptions;
|
|
7
|
-
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Custom render function for story cards
|
|
16
|
+
*
|
|
17
|
+
* @param storyCard - Data object containing card content and metadata
|
|
18
|
+
* @returns React node to render for the card
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* (storyCard) => (
|
|
22
|
+
* <CustomCard
|
|
23
|
+
* title={storyCard.title}
|
|
24
|
+
* image={storyCard.getImageSrcByCoverQuality('high')}
|
|
25
|
+
* />
|
|
26
|
+
* )
|
|
27
|
+
*/
|
|
8
28
|
storyCardView?: (storyCard: StoryCardViewModel) => React.ReactNode;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Custom render function for navigation controls
|
|
32
|
+
*
|
|
33
|
+
* @param navigation - Data object containing navigation state and methods
|
|
34
|
+
* @returns React node to render for navigation
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* (navigation) => (
|
|
38
|
+
* <div className="custom-nav">
|
|
39
|
+
* <button onClick={navigation.onPrev} disabled={navigation.reachStart}>
|
|
40
|
+
* Previous
|
|
41
|
+
* </button>
|
|
42
|
+
* <button onClick={navigation.onNext} disabled={navigation.reachEnd}>
|
|
43
|
+
* Next
|
|
44
|
+
* </button>
|
|
45
|
+
* </div>
|
|
46
|
+
* )
|
|
47
|
+
*/
|
|
9
48
|
navigationView?: (navigation: NavigationViewModel) => React.ReactNode;
|
|
10
49
|
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Component that displays a scrollable list of a user's favorite stories
|
|
53
|
+
* with support for custom rendering and responsive configuration
|
|
54
|
+
*
|
|
55
|
+
* @param props - Configuration properties for the component
|
|
56
|
+
* @returns React element representing the favorite stories list
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* <FavoriteStoryList />
|
|
60
|
+
*/
|
|
11
61
|
export declare const FavoriteStoryList: (props: FavoriteStoryListProps) => JSX.Element;
|
|
@@ -6,19 +6,188 @@ import { FavoriteCardCompositeViewModel } from "./favoriteCardCompositeViewModel
|
|
|
6
6
|
import { StoryListApi } from "./storyListApi";
|
|
7
7
|
import { StoriesListOptions } from "../appearance-manager";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Props for the StoryList component that displays a list of stories previews
|
|
11
|
+
* @see https://docs.inappstory.com/sdk-guides/react-sdk/story-list.html
|
|
12
|
+
*/
|
|
9
13
|
interface StoryListProps {
|
|
14
|
+
/**
|
|
15
|
+
* Ref for accessing the StoryList component API
|
|
16
|
+
*/
|
|
10
17
|
ref?: React.Ref<StoryListApi | null>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Appearance settings for the stories list
|
|
21
|
+
*/
|
|
11
22
|
options?: StoriesListOptions;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Feed identifier for loading stories
|
|
26
|
+
* @default default
|
|
27
|
+
*/
|
|
12
28
|
feedSlug?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Use the testKey to see stories with status `Moderation`.
|
|
32
|
+
*/
|
|
13
33
|
testKey?: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Callback when UGC card is clicked
|
|
37
|
+
*/
|
|
14
38
|
onUgcCardClick?: () => void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Callback when favorite card is clicked
|
|
42
|
+
*/
|
|
15
43
|
onFavoriteCardClick?: () => void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Flag indicating whether to use UGC cards
|
|
47
|
+
*/
|
|
16
48
|
useUgcCard?: boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Flag indicating whether favorite cards are present
|
|
52
|
+
*/
|
|
17
53
|
hasFavorite?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Callback triggered when story list loading starts
|
|
57
|
+
*/
|
|
18
58
|
onLoadStart?: () => void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Callback triggered when story list loading completes
|
|
62
|
+
* @param storyListLoadStatus - Status of the story list loading
|
|
63
|
+
*/
|
|
19
64
|
onLoadEnd?: (storyListLoadStatus: StoryListLoadStatus) => void;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Custom render for story cards
|
|
68
|
+
* @param storyCard - Data for rendering a story card
|
|
69
|
+
* @returns React element for the story card
|
|
70
|
+
* @example
|
|
71
|
+
* // Custom card with gradient overlay
|
|
72
|
+
* storyCardView={(card) => (
|
|
73
|
+
* <div style={{
|
|
74
|
+
* position: 'relative',
|
|
75
|
+
* borderRadius: 8,
|
|
76
|
+
* overflow: 'hidden',
|
|
77
|
+
* aspectRatio: card.getAspectRatio('grid')
|
|
78
|
+
* }}>
|
|
79
|
+
* <img
|
|
80
|
+
* src={card.getImageSrcByCoverQuality('medium')}
|
|
81
|
+
* alt={card.title}
|
|
82
|
+
* style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
|
83
|
+
* />
|
|
84
|
+
* <div style={{
|
|
85
|
+
* position: 'absolute',
|
|
86
|
+
* bottom: 0,
|
|
87
|
+
* left: 0,
|
|
88
|
+
* right: 0,
|
|
89
|
+
* padding: 16,
|
|
90
|
+
* background: 'linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%)'
|
|
91
|
+
* }}>
|
|
92
|
+
* <h3 style={{ color: '#fff', margin: 0 }}>{card.title}</h3>
|
|
93
|
+
* </div>
|
|
94
|
+
* </div>
|
|
95
|
+
* )}
|
|
96
|
+
*/
|
|
20
97
|
storyCardView?: (storyCard: StoryCardViewModel) => React.ReactNode;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Custom render for navigation
|
|
101
|
+
* @param navigation - Data for rendering navigation
|
|
102
|
+
* @returns React element for navigation
|
|
103
|
+
* @example
|
|
104
|
+
* // Custom navigation arrows with disabled states
|
|
105
|
+
* navigationView={(nav) => (
|
|
106
|
+
* <div style={{
|
|
107
|
+
* display: 'flex',
|
|
108
|
+
* justifyContent: 'center',
|
|
109
|
+
* gap: 16,
|
|
110
|
+
* padding: '16px 0'
|
|
111
|
+
* }}>
|
|
112
|
+
* <button
|
|
113
|
+
* onClick={nav.onPrev}
|
|
114
|
+
* disabled={nav.reachStart}
|
|
115
|
+
* style={{
|
|
116
|
+
* padding: '8px 16px',
|
|
117
|
+
* opacity: nav.reachStart ? 0.5 : 1,
|
|
118
|
+
* cursor: nav.reachStart ? 'not-allowed' : 'pointer'
|
|
119
|
+
* }}
|
|
120
|
+
* >
|
|
121
|
+
* ← Previous
|
|
122
|
+
* </button>
|
|
123
|
+
* <button
|
|
124
|
+
* onClick={nav.onNext}
|
|
125
|
+
* disabled={nav.reachEnd}
|
|
126
|
+
* style={{
|
|
127
|
+
* padding: '8px 16px',
|
|
128
|
+
* opacity: nav.reachEnd ? 0.5 : 1,
|
|
129
|
+
* cursor: nav.reachEnd ? 'not-allowed' : 'pointer'
|
|
130
|
+
* }}
|
|
131
|
+
* >
|
|
132
|
+
* Next →
|
|
133
|
+
* </button>
|
|
134
|
+
* </div>
|
|
135
|
+
* )}
|
|
136
|
+
*/
|
|
21
137
|
navigationView?: (navigation: NavigationViewModel) => React.ReactNode;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Custom render function for favorite cards
|
|
141
|
+
* @param favoriteCardCompositeViewModel - Data for rendering a favorite card
|
|
142
|
+
* @returns React element for the favorite card
|
|
143
|
+
* @example
|
|
144
|
+
* // Favorite card with special badge
|
|
145
|
+
* favoriteCardView={(favoriteCard) => (
|
|
146
|
+
* <div style={{
|
|
147
|
+
* border: '2px dashed gold',
|
|
148
|
+
* borderRadius: 12,
|
|
149
|
+
* padding: 16,
|
|
150
|
+
* position: 'relative'
|
|
151
|
+
* }}>
|
|
152
|
+
* <h3 style={{ marginTop: 0, color: 'gold' }}>
|
|
153
|
+
* Favorites Collection ({favoriteCard.favoriteStories.length})
|
|
154
|
+
* </h3>
|
|
155
|
+
* <div style={{
|
|
156
|
+
* display: 'grid',
|
|
157
|
+
* gridTemplateColumns: 'repeat(auto-fill, minmax(80px, 1fr))',
|
|
158
|
+
* gap: 8
|
|
159
|
+
* }}>
|
|
160
|
+
* {favoriteCard.favoriteStories.map(story => (
|
|
161
|
+
* <img
|
|
162
|
+
* key={story.id}
|
|
163
|
+
* src={story.getImageSrcByCoverQuality('medium')}
|
|
164
|
+
* alt={story.title}
|
|
165
|
+
* style={{
|
|
166
|
+
* width: '100%',
|
|
167
|
+
* aspectRatio: '1',
|
|
168
|
+
* objectFit: 'cover',
|
|
169
|
+
* borderRadius: 4
|
|
170
|
+
* }}
|
|
171
|
+
* />
|
|
172
|
+
* ))}
|
|
173
|
+
* </div>
|
|
174
|
+
* </div>
|
|
175
|
+
* )}
|
|
176
|
+
*/
|
|
22
177
|
favoriteCardView?: (favoriteCardCompositeViewModel: FavoriteCardCompositeViewModel) => React.ReactNode;
|
|
23
178
|
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Component for displaying a list of stories previews
|
|
182
|
+
* @param props - Component props
|
|
183
|
+
* @returns React story list component
|
|
184
|
+
* @example
|
|
185
|
+
* // Basic usage with custom card and navigation
|
|
186
|
+
* <StoryList
|
|
187
|
+
* feedSlug="default"
|
|
188
|
+
* storyCardView={(card) => <CustomStoryCard card={card} />}
|
|
189
|
+
* navigationView={(nav) => <CustomNavigation {...nav} />}
|
|
190
|
+
* onLoadEnd={(status) => console.log('Loaded', status.defaultListLength, 'stories')}
|
|
191
|
+
* />
|
|
192
|
+
*/
|
|
24
193
|
export declare const StoryList: (props: StoryListProps) => JSX.Element;
|