@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
@@ -1,34 +1,110 @@
1
1
  import { CloseButtonPosition } from "./appearanceCommon";
2
2
  import { RecursivePartial } from "../global";
3
3
 
4
+ import { CloseButtonPosition } from "./appearanceCommon";
5
+ import { RecursivePartial } from "../global";
6
+
7
+ /**
8
+ * Appearance options for Game Reader.
9
+ */
4
10
  export type GameReaderOptions = RecursivePartial<{
5
- borderRadius?: number;
6
- loader?: {
11
+ /**
12
+ * Loader colors and custom loader string.
13
+ */
14
+ loader: {
15
+ /**
16
+ * Default loader colors.
17
+ */
7
18
  default: {
8
- color: Optional<string>;
9
- accentColor: Optional<string>;
19
+ /**
20
+ * Main color of the loader.
21
+ * @default "white"
22
+ */
23
+ color: string;
24
+
25
+ /**
26
+ * Accent color of the loader.
27
+ * @default "transparent"
28
+ */
29
+ accentColor: string;
10
30
  };
11
- custom: Optional<string>;
31
+
32
+ /**
33
+ * Custom loader SVG or component as a string.
34
+ * @default null
35
+ */
36
+ custom: string | null;
12
37
  };
13
- closeButtonPosition?: CloseButtonPosition | "left" | "right" | "start" | "end";
14
- closeButton?: {
38
+
39
+ /**
40
+ * Position of the close button.
41
+ * Allowed values: enum CloseButtonPosition or string literals.
42
+ * @default CloseButtonPosition.END (or "end")
43
+ * @deprecated `left`, `right`
44
+ */
45
+ closeButtonPosition: CloseButtonPosition | "left" | "right";
46
+
47
+ /**
48
+ * Close button SVG icon configuration.
49
+ */
50
+ closeButton: {
15
51
  svgSrc: {
52
+ /**
53
+ * Base state SVG icon string for the close button.
54
+ */
16
55
  baseState: string;
17
56
  };
18
57
  };
19
58
 
20
- /** @deprecated Use the `backdrop` instead. */
21
- backdropColor?: string;
22
- backdrop?: {
23
- opacity?: number; // .56
24
- blur?: number; // 30
25
- background?: string;
26
- };
27
- game?: {
59
+ /**
60
+ * Background color for the game container inside the reader.
61
+ * @default "rgb(51, 51, 51)"
62
+ */
63
+ game: {
28
64
  backdropColor: string;
29
65
  };
66
+
67
+ /**
68
+ * Border radius of the main container (e.g. rounded corners).
69
+ * @default 5
70
+ */
71
+ borderRadius: number;
72
+
73
+ /**
74
+ * Backdrop options while game loading.
75
+ */
76
+ backdrop: {
77
+ /**
78
+ * Opacity of the backdrop background.
79
+ * @default 1
80
+ */
81
+ opacity: number;
82
+
83
+ /**
84
+ * Background color of the backdrop.
85
+ * @default "#1a1a1a"
86
+ */
87
+ background: string;
88
+ };
89
+
90
+ /**
91
+ * Forces desktop mode if true.
92
+ */
93
+ forceDesktopMode?: boolean;
94
+
95
+ /**
96
+ * Forces orientation check if true.
97
+ * @default true
98
+ */
99
+ forceCheckOrientation?: boolean;
30
100
  }>;
31
101
 
102
+ /**
103
+ * Options for opening a game.
104
+ */
32
105
  export type OpenGameOptions = Partial<{
106
+ /**
107
+ * Enables demo mode.
108
+ */
33
109
  demoMode: boolean;
34
110
  }>;
@@ -1,53 +1,134 @@
1
1
  import { RecursivePartial } from "../global";
2
-
2
+ /**
3
+ * Represents a single good/item.
4
+ */
3
5
  export type Goods = Partial<{
4
- imgSrc: string;
6
+ /** SKU identifier */
7
+ sku: string;
8
+
9
+ /** Image source URL */
10
+ imgSrc?: string;
11
+
12
+ /** Main title */
5
13
  title: string;
6
- subTitle: string;
14
+
15
+ /** Subtitle or secondary title */
16
+ subTitle?: string;
17
+
18
+ /** Current price */
7
19
  price: string;
8
- oldPrice: string;
9
- sku: string;
10
- rawData: any;
11
- }>;
12
20
 
13
- export interface GoodsRenderItemProps<T extends Goods = Goods> {
14
- goods: T;
15
- index: number;
16
- onClick: (goods: T) => void;
17
- }
21
+ /** Old price, if applicable */
22
+ oldPrice?: string;
18
23
 
19
- export type GoodsWidgetOptions<T extends Goods = Goods> = RecursivePartial<{
24
+ /** Raw additional data */
25
+ rawData?: any;
26
+ }>;
27
+
28
+ /**
29
+ * Appearance options for configuring the Goods Widget V1.
30
+ */
31
+ export type GoodsWidgetOptions = RecursivePartial<{
32
+ /** Configuration for the goods list container */
20
33
  goodsList: GoodsListOptions;
34
+
35
+ /** Configuration for individual goods cards */
21
36
  goodsCard: GoodsCardOptions;
37
+
38
+ /** Loader appearance settings */
22
39
  loader: {
40
+ /**
41
+ * Default loader colors.
42
+ * @default { color: "gray", accentColor: "transparent" }
43
+ */
23
44
  default: {
24
45
  color: string;
25
46
  accentColor: string;
26
47
  };
48
+
49
+ /** Custom loader markup or component as a string */
27
50
  custom: string;
28
51
  };
29
- openGoodsWidgetHandler: (goodsList: T[]) => Promise<T[]>;
52
+
53
+ /**
54
+ * Handler to open goods widget and optionally modify or fetch goods.
55
+ * @default goods => Promise.resolve(goods)
56
+ */
57
+ openGoodsWidgetHandler: <T extends Goods = Goods>(goodsList: T[]) => Promise<T[]>;
58
+
59
+ /** Indicates if the widget is in loading state */
30
60
  isLoading?: boolean;
31
- renderItem?: (props: GoodsRenderItemProps<T>) => React.ReactNode;
32
- getCardHtml?: (goods: T, index: number) => string;
33
- itemClickHandler?: (goods: T) => void;
61
+
62
+ /**
63
+ * Custom renderer function for goods items.
64
+ * @param props.goods The good item.
65
+ * @param props.index Index of the item.
66
+ * @param props.onClick Click handler for the item.
67
+ */
68
+ renderItem?: <T extends Goods = Goods>(props: {
69
+ goods: T;
70
+ index: number;
71
+ onClick: (goods: T) => void;
72
+ }) => React.ReactNode;
73
+
74
+ /**
75
+ * Function to get HTML string for a goods card.
76
+ * @param goods The good item.
77
+ * @param index Index of the item.
78
+ */
79
+ getCardHtml?: <T extends Goods = Goods>(goods: T, index: number) => string;
80
+
81
+ /**
82
+ * Handler called when a goods item is clicked.
83
+ */
84
+ itemClickHandler?: <T extends Goods = Goods>(goods: T) => void;
34
85
  }>;
35
86
 
87
+ /**
88
+ * Configuration options for a goods card.
89
+ */
36
90
  export type GoodsCardOptions = Partial<{
91
+ /** Color of the main text */
37
92
  mainTextColor: string;
93
+
94
+ /** Color of the old price text */
38
95
  oldPriceTextColor: string;
96
+
97
+ /** Background color for the image area */
39
98
  imageBackgroundColor: string;
99
+
100
+ /** Corner radius of the image */
40
101
  imageCornerRadius: number;
102
+
103
+ /** Font for the title text */
41
104
  titleFont: string;
105
+
106
+ /** Font for the subtitle text */
42
107
  subtitleFont: string;
108
+
109
+ /** Font for the price text */
43
110
  priceFont: string;
111
+
112
+ /** Font for the old price text */
44
113
  oldPriceFont: string;
45
114
  }>;
46
115
 
116
+ /**
117
+ * Configuration options for the goods list container.
118
+ */
47
119
  export type GoodsListOptions = Partial<{
120
+ /** Background color behind the close button */
48
121
  closeBackgroundColor: string;
122
+
123
+ /** Close button image URL */
49
124
  closeImage: string;
125
+
126
+ /** Height of the substrate container */
50
127
  substrateHeight: number;
128
+
129
+ /** Color of the substrate */
51
130
  substrateColor: string;
131
+
132
+ /** Color for the dim overlay */
52
133
  dimColor: string;
53
134
  }>;
@@ -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
+ }>;