@inappstory/js-sdk 3.6.4 → 3.6.6

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,44 +1,171 @@
1
+ /**
2
+ * Built-in social platforms supported by default for sharing.
3
+ *
4
+ * @example
5
+ * const target: BaseShareTarget = "telegram";
6
+ */
1
7
  type BaseShareTarget = "vk" | "ok" | "facebook" | "x" | "linkedin" | "telegram" | "twitter";
8
+
9
+ /**
10
+ * Type representing either a built-in share target or a custom one.
11
+ *
12
+ * You can extend the list by providing your own custom string union.
13
+ *
14
+ * @template CustomTargets - Union of custom platform names (e.g., "your-platform-1" | "your-platform-2").
15
+ *
16
+ * @example
17
+ * type MyTargets = ShareTarget<"your-platform-1" | "your-platform-2">;
18
+ */
2
19
  export type ShareTarget<CustomTargets extends string = never> = BaseShareTarget | CustomTargets;
3
20
 
21
+ /**
22
+ * Parameters used to configure individual share targets.
23
+ */
4
24
  export type ShareTargetParams = {
25
+ /**
26
+ * Optional human-readable label shown for the share target.
27
+ */
5
28
  label?: string;
29
+
30
+ /**
31
+ * Optional icon settings for the share target.
32
+ */
6
33
  icon?: {
7
34
  svgSrc: {
35
+ /**
36
+ * Base SVG icon used to represent the share target.
37
+ */
8
38
  baseState: string;
9
39
  };
10
40
  };
41
+
42
+ /**
43
+ * Optional function to dynamically generate a sharing URL.
44
+ *
45
+ * @param config.url - The page URL being shared.
46
+ * @param config.text - Associated share message or title.
47
+ * @returns Generated share URL.
48
+ */
11
49
  getUrl?: (config: { url: string; text: string }) => string;
12
50
  };
13
51
 
52
+ /**
53
+ * Configuration for the Share Panel component.
54
+ *
55
+ * Supports visual customization, target management, and optional download/copy actions.
56
+ *
57
+ * @template CustomTargets - Extendable string union for additional custom share platforms.
58
+ * @see https://docs.inappstory.com/sdk-guides/react-sdk/share-panel.html
59
+ */
14
60
  export type SharePanel<CustomTargets extends string = never> = Partial<{
61
+ /**
62
+ * Background style of the share panel.
63
+ */
15
64
  background: string;
65
+
66
+ /**
67
+ * Border radius applied to the share panel container.
68
+ */
16
69
  borderRadius: number;
70
+
71
+ /**
72
+ * Divider styling between panel sections or items.
73
+ */
17
74
  divider: {
75
+ /**
76
+ * Background style of the divider line.
77
+ */
18
78
  background: string;
19
79
  };
80
+
81
+ /**
82
+ * Text appearance settings for share panel content.
83
+ */
20
84
  text: {
21
- color: string;
85
+ /**
86
+ * Text color used in the panel.
87
+ */
88
+ color: string
89
+
90
+ /**
91
+ * Font family, size, and style.
92
+ */
22
93
  font: string;
23
94
  };
95
+
96
+ /**
97
+ * List of enabled share targets (default or custom).
98
+ *
99
+ * @example
100
+ * targets: ["vk", "telegram", "reddit"]
101
+ */
24
102
  targets: ShareTarget<CustomTargets>[];
103
+
104
+ /**
105
+ * Parameters for each share target, keyed by platform name.
106
+ */
25
107
  targetParams: Partial<Record<ShareTarget<CustomTargets>, ShareTargetParams>>;
108
+
109
+ /**
110
+ * Copy-to-clipboard button settings.
111
+ */
26
112
  copyButton: {
113
+ /**
114
+ * Button label text (e.g., "Copy link").
115
+ */
27
116
  label: string;
117
+
118
+ /**
119
+ * SVG icons for base and success (copied) states.
120
+ */
28
121
  svgSrc: {
122
+ /**
123
+ * Default icon before copying.
124
+ */
29
125
  baseState: string;
126
+
127
+ /**
128
+ * Icon shown after successful copy.
129
+ */
130
+ doneState: string;
30
131
  };
31
132
  };
133
+
134
+ /**
135
+ * Optional download button settings.
136
+ */
32
137
  downloadButton: {
33
138
  svgSrc: {
139
+ /**
140
+ * Icon used for the download button.
141
+ */
34
142
  baseState: string;
35
143
  };
36
144
  };
145
+
146
+ /**
147
+ * Configuration for the share panel title section.
148
+ */
37
149
  title: {
38
150
  favicon: {
151
+ /**
152
+ * Background behind the favicon icon.
153
+ */
39
154
  background: string;
155
+
156
+ /**
157
+ * Whether the favicon is displayed.
158
+ */
40
159
  display: boolean;
41
160
  };
161
+
162
+ /**
163
+ * Function to generate a dynamic title based on the shared content.
164
+ *
165
+ * @param config.url - The URL being shared.
166
+ * @param config.text - Accompanying message or headline.
167
+ * @returns Title string.
168
+ */
42
169
  getValue: (config: { url: string; text: string }) => string;
43
170
  };
44
- }>;
171
+ }>;
@@ -1,103 +1,330 @@
1
1
  import { Option, RecursivePartial } from "../global";
2
2
 
3
+ /**
4
+ * Slider alignment in the stories list.
5
+ */
3
6
  export declare enum StoriesListSliderAlign {
4
7
  CENTER = "center",
5
- /** @deprecated */
8
+ /** @deprecated Use START or END instead */
6
9
  LEFT = "left",
7
- /** @deprecated */
10
+ /** @deprecated Use START or END instead */
8
11
  RIGHT = "right",
9
12
  START = "start",
10
13
  END = "end"
11
14
  }
12
15
 
16
+ /**
17
+ * Card view variants for the stories list.
18
+ */
13
19
  export declare enum StoriesListCardViewVariant {
14
20
  CIRCLE = "circle",
15
21
  QUAD = "quad",
16
22
  RECTANGLE = "rectangle"
17
23
  }
18
24
 
25
+ /**
26
+ * Text alignment options for the card title.
27
+ */
19
28
  export declare enum StoriesListCardTitleTextAlign {
20
- /** @deprecated */
29
+ /** @deprecated Use START, END, or CENTER instead */
21
30
  LEFT = "left",
22
- /** @deprecated */
31
+ /** @deprecated Use START, END, or CENTER instead */
23
32
  RIGHT = "right",
24
33
  CENTER = "center",
25
34
  START = "start",
26
35
  END = "end"
27
36
  }
28
37
 
38
+ /**
39
+ * Position options for the card title.
40
+ */
29
41
  export declare enum StoriesListCardTitlePosition {
30
42
  CARD_INSIDE_BOTTOM = "cardInsideBottom",
31
43
  CARD_OUTSIDE_TOP = "cardOutsideTop",
32
44
  CARD_OUTSIDE_BOTTOM = "cardOutsideBottom"
33
45
  }
34
46
 
47
+ /**
48
+ * Cover quality options for the card.
49
+ */
35
50
  export declare enum StoriesListCardCoverQuality {
36
51
  Medium = "medium",
37
52
  High = "high"
38
53
  }
39
54
 
55
+ /**
56
+ * Stories list scrolling direction.
57
+ */
40
58
  export declare enum StoriesListDirection {
59
+ /** Vertical layout */
41
60
  COLUMN = "vertical",
61
+ /** Horizontal layout */
42
62
  ROW = "horizontal"
43
63
  }
44
64
 
65
+ /**
66
+ * Configuration options for the stories list.
67
+ */
45
68
  export type StoriesListOptions = RecursivePartial<{
69
+ /**
70
+ * Direction of the stories list.
71
+ * @default StoriesListDirection.ROW
72
+ */
46
73
  direction: StoriesListDirection | "vertical" | "horizontal";
74
+
75
+ /**
76
+ * Card options.
77
+ */
47
78
  card: StoriesListCardOptions;
79
+
80
+ /**
81
+ * Favorite card options.
82
+ */
48
83
  favoriteCard: StoriesListFavoriteCardOptions;
84
+
85
+ /**
86
+ * Layout options for the list.
87
+ */
49
88
  layout: {
89
+ /**
90
+ * Height of the list (number or string, e.g., "auto").
91
+ * @default "auto"
92
+ */
50
93
  height: number | string;
94
+
95
+ /**
96
+ * Background color of the list.
97
+ * @default "transparent"
98
+ */
51
99
  backgroundColor: string;
100
+
101
+ /**
102
+ * Slider alignment.
103
+ * @default StoriesListSliderAlign.START
104
+ */
52
105
  sliderAlign: StoriesListSliderAlign | "left" | "center" | "right" | "start" | "end";
53
106
  };
107
+
108
+ /**
109
+ * Horizontal padding (left and right).
110
+ * @default 20
111
+ */
54
112
  sidePadding: number;
113
+
114
+ /**
115
+ * Top padding.
116
+ * @default 20
117
+ */
55
118
  topPadding: number;
119
+
120
+ /**
121
+ * Bottom padding.
122
+ * @default 20
123
+ */
56
124
  bottomPadding: number;
125
+
126
+ /**
127
+ * Bottom margin of the entire list container.
128
+ * @default 17
129
+ */
57
130
  bottomMargin: number;
131
+
132
+ /**
133
+ * Navigation settings.
134
+ */
58
135
  navigation: {
59
- speed: number;
136
+ /**
137
+ * Show navigation controls (arrows).
138
+ * @default false
139
+ */
60
140
  showControls: boolean;
141
+
142
+ /**
143
+ * Size of navigation controls.
144
+ * @default 48
145
+ */
61
146
  controlsSize: number;
147
+
148
+ /**
149
+ * Background color of navigation controls.
150
+ * @default "white"
151
+ */
62
152
  controlsBackgroundColor: string;
153
+
154
+ /**
155
+ * Color of navigation controls icons.
156
+ * @default "black"
157
+ */
63
158
  controlsColor: string;
64
159
  };
160
+
161
+ /**
162
+ * User-generated content card options.
163
+ */
65
164
  ugcCard: StoriesListUgcCardOptions;
165
+
166
+ /**
167
+ * Automatically scroll the list when a story is closed.
168
+ * @default true
169
+ */
66
170
  autoScrollOnStoryClose: boolean;
67
171
  }>;
68
172
 
173
+ /**
174
+ * Options for individual story cards.
175
+ */
69
176
  export type StoriesListCardOptions = RecursivePartial<{
70
177
  title: {
178
+ /**
179
+ * Padding around the title.
180
+ * @default 10.6
181
+ */
71
182
  padding: string | number;
183
+
184
+ /**
185
+ * CSS font property for the title.
186
+ * @default '16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
187
+ */
72
188
  font: string;
189
+
190
+ /**
191
+ * Whether to display the title.
192
+ * @default true
193
+ */
73
194
  display: boolean;
195
+
196
+ /**
197
+ * Text alignment for the title.
198
+ * @default StoriesListCardTitleTextAlign.START
199
+ */
74
200
  textAlign: StoriesListCardTitleTextAlign | "left" | "center" | "right" | "start" | "end";
201
+
202
+ /**
203
+ * Position of the title relative to the card.
204
+ * @default StoriesListCardTitlePosition.CARD_INSIDE_BOTTOM
205
+ */
75
206
  position: StoriesListCardTitlePosition | "cardInsideBottom" | "cardOutsideTop" | "cardOutsideBottom";
207
+
208
+ /**
209
+ * Maximum number of lines shown in the title.
210
+ * @default 4
211
+ */
76
212
  lineClamp: number;
77
213
  };
214
+
215
+ /**
216
+ * Gap between cards.
217
+ * @default 10
218
+ */
78
219
  gap: number;
220
+
221
+ /**
222
+ * Card height in pixels.
223
+ * @default 178
224
+ */
79
225
  height: number;
226
+
227
+ /**
228
+ * Aspect ratio of the card (width / height).
229
+ * @default null
230
+ */
80
231
  aspectRatio: number;
232
+
233
+ /**
234
+ * Quality of the card cover image.
235
+ * @default StoriesListCardCoverQuality.High
236
+ */
81
237
  coverQuality: StoriesListCardCoverQuality | "medium" | "high";
238
+
239
+ /**
240
+ * Enables lazy loading for the card cover image.
241
+ * @default false
242
+ */
82
243
  coverLazyLoading: boolean;
244
+
245
+ /**
246
+ * Visual variant of the card.
247
+ * @default StoriesListCardViewVariant.RECTANGLE
248
+ */
83
249
  variant: StoriesListCardViewVariant | "circle" | "quad" | "rectangle";
250
+
251
+ /**
252
+ * Card border settings.
253
+ */
84
254
  border: {
255
+ /**
256
+ * Border radius in pixels.
257
+ * @default 21
258
+ */
85
259
  radius: number;
260
+
261
+ /**
262
+ * Border color.
263
+ * @default "black"
264
+ */
86
265
  color: string;
266
+
267
+ /**
268
+ * Border width in pixels.
269
+ * @default 2
270
+ */
87
271
  width: number;
272
+
273
+ /**
274
+ * Gap between border and card content in pixels.
275
+ * @default 5
276
+ */
88
277
  gap: number;
278
+
279
+ /**
280
+ * Border gradient, if applicable.
281
+ * @default null
282
+ */
89
283
  gradient: string;
90
284
  };
285
+
286
+ /**
287
+ * CSS box-shadow property for the card.
288
+ * @default null
289
+ */
91
290
  boxShadow: string;
291
+
292
+ /**
293
+ * CSS drop-shadow property for the card.
294
+ * @default null
295
+ */
92
296
  dropShadow: string;
297
+
298
+ /**
299
+ * Opacity of the card (0 to 1).
300
+ * @default null
301
+ */
93
302
  opacity: number;
303
+
304
+ /**
305
+ * Mask settings for the card.
306
+ */
94
307
  mask: {
308
+ /**
309
+ * Mask color.
310
+ * @default null
311
+ */
95
312
  color: string;
313
+
314
+ /**
315
+ * Linear gradient for the mask.
316
+ * @default null
317
+ */
96
318
  linearGradient: {
97
319
  direction: string;
98
320
  points: Array<string>;
99
321
  };
100
322
  };
323
+
324
+ /**
325
+ * SVG masks for the card.
326
+ * @default null
327
+ */
101
328
  svgMask: {
102
329
  cardMask: string;
103
330
  overlayMask: Array<{
@@ -105,24 +332,95 @@ export type StoriesListCardOptions = RecursivePartial<{
105
332
  background: string;
106
333
  }>;
107
334
  };
335
+
336
+ /**
337
+ * Styles applied to the card when it is in the "opened" state.
338
+ */
108
339
  opened: {
340
+ /**
341
+ * Border settings for the opened card.
342
+ * These override the default border settings when the card is opened.
343
+ * All properties are optional and if null, the default card border settings are used.
344
+ */
109
345
  border: {
346
+ /**
347
+ * Border radius for the opened card.
348
+ * @default null (inherits from default card border radius)
349
+ */
110
350
  radius: number;
351
+
352
+ /**
353
+ * Border color for the opened card.
354
+ * @default null (inherits from default card border color)
355
+ */
111
356
  color: string;
357
+
358
+ /**
359
+ * Border width for the opened card.
360
+ * @default null (inherits from default card border width)
361
+ */
112
362
  width: number;
363
+
364
+ /**
365
+ * Gap between border and content for the opened card.
366
+ * @default null (inherits from default card border gap)
367
+ */
113
368
  gap: number;
369
+
370
+ /**
371
+ * Border gradient for the opened card.
372
+ * @default null (inherits from default card border gradient)
373
+ */
114
374
  gradient: string;
115
375
  };
376
+
377
+ /**
378
+ * CSS box-shadow property for the opened card.
379
+ * This shadow is applied instead of the default boxShadow when the card is opened.
380
+ * @default null (inherits from default card boxShadow)
381
+ */
116
382
  boxShadow: string;
383
+
384
+ /**
385
+ * CSS drop-shadow property for the opened card.
386
+ * Overrides default dropShadow when opened.
387
+ * @default null (inherits from default card dropShadow)
388
+ */
117
389
  dropShadow: string;
390
+
391
+ /**
392
+ * Opacity of the opened card (0 to 1).
393
+ * Overrides default opacity when opened.
394
+ * @default null (inherits from default card opacity)
395
+ */
118
396
  opacity: number;
397
+
398
+ /**
399
+ * Mask settings for the opened card.
400
+ * Overrides default mask when opened.
401
+ */
119
402
  mask: {
403
+ /**
404
+ * Mask color for the opened card.
405
+ * @default null (inherits from default mask color)
406
+ */
120
407
  color: string;
408
+
409
+ /**
410
+ * Linear gradient mask for the opened card.
411
+ * @default null (inherits from default mask linear gradient)
412
+ */
121
413
  linearGradient: {
122
414
  direction: string;
123
415
  points: Array<string>;
124
416
  };
125
417
  };
418
+
419
+ /**
420
+ * SVG masks for the opened card.
421
+ * Overrides default svgMask when opened.
422
+ * @default null (inherits from default svgMask)
423
+ */
126
424
  svgMask: {
127
425
  cardMask: string;
128
426
  overlayMask: Array<{
@@ -1,20 +1,54 @@
1
1
  import { RecursivePartial } from "../global";
2
2
  import { CloseButtonPosition } from "./appearanceCommon";
3
3
 
4
+ /**
5
+ * Configuration options for customizing the appearance of the favorite story reader component.
6
+ */
4
7
  export type StoryFavoriteReaderOptions = RecursivePartial<{
8
+ /**
9
+ * Title block styling.
10
+ */
5
11
  title: {
12
+ /** Text content of the title. */
6
13
  content: string;
14
+
15
+ /** Font used for the title. */
7
16
  font: string;
17
+
18
+ /** Text color of the title. */
8
19
  color: string;
20
+
21
+ /** Background color behind the title. */
9
22
  backgroundColor: string;
10
23
  };
24
+
25
+ /**
26
+ * Position of the close button (e.g., top-left, top-right).
27
+ */
11
28
  closeButtonPosition: CloseButtonPosition;
29
+
30
+ /**
31
+ * Styling for the close button.
32
+ */
12
33
  closeButton: {
13
34
  svgSrc: {
35
+ /** Source URL or inline SVG for the button's default (base) state. */
14
36
  baseState: string;
15
37
  };
16
38
  };
39
+
40
+ /**
41
+ * Offset from the top of the header (in pixels).
42
+ */
17
43
  headerTopOffset: number;
44
+
45
+ /**
46
+ * Offset from the bottom of the screen/component (in pixels).
47
+ */
18
48
  bottomOffset: number;
49
+
50
+ /**
51
+ * Background color of the favorite story reader.
52
+ */
19
53
  backgroundColor: string;
20
54
  }>;