@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
@@ -0,0 +1,186 @@
1
+ import { Banner } from "./banner";
2
+ import { BannerPlaceAppearance } from "./bannerPlaceAppearance";
3
+
4
+ /**
5
+ * Events emitted by BannerPlaceViewModel
6
+ * @enum {string}
7
+ */
8
+ export enum BannerPlaceViewModelEvent {
9
+ /** Emitted when playback starts */
10
+ Play = "play",
11
+ /** Emitted when playback stops */
12
+ Stop = "stop",
13
+ /** Emitted when banner loading starts */
14
+ LoadStart = "loadStart",
15
+ /** Emitted when banner loading completes */
16
+ LoadEnd = "loadEnd",
17
+ /** Emitted when banner loading fails */
18
+ LoadError = "loadError"
19
+ }
20
+
21
+ /**
22
+ * Banner slider autoplay control
23
+ */
24
+ export interface IBannerPlaceSliderAutoplay {
25
+ /**
26
+ * Gets whether autoplay is currently paused
27
+ * @returns {boolean} True if autoplay is paused
28
+ */
29
+ isPaused(): boolean;
30
+
31
+ /**
32
+ * Resumes the autoplay
33
+ */
34
+ resume(): void;
35
+
36
+ /**
37
+ * Pauses the autoplay
38
+ */
39
+ pause(): void;
40
+
41
+ /**
42
+ * Starts autoplay
43
+ */
44
+ start(duration: number): void;
45
+
46
+ /**
47
+ * Starts autoplay with specified duration
48
+ * @param {number} delay - Duration between slides in milliseconds
49
+ */
50
+ setDelay(delay: number): void;
51
+
52
+ /**
53
+ * Stops the autoplay completely
54
+ */
55
+ stop(): void;
56
+ }
57
+
58
+ /**
59
+ * Banner slider controller
60
+ */
61
+ export interface IBannerPlaceSliderController {
62
+ /**
63
+ * Autoplay control instance
64
+ * @type {IBannerPlaceSliderAutoplay}
65
+ */
66
+ readonly autoplay: IBannerPlaceSliderAutoplay;
67
+
68
+ /**
69
+ * Gets total number of slides
70
+ * @returns {number} Total slides count
71
+ */
72
+ getTotalPages(): number;
73
+
74
+ /**
75
+ * Gets currently active slide index
76
+ * @returns {number} Active slide index
77
+ */
78
+ getActiveIndex(): number;
79
+
80
+ /**
81
+ * Navigates to next slide
82
+ */
83
+ toNextSlide(): void;
84
+
85
+ /**
86
+ * Navigates to previous slide
87
+ */
88
+ toPrevSlide(): void;
89
+
90
+ /**
91
+ * Slides to specific index
92
+ * @param {number} index - Target slide index
93
+ * @param {number} [speed] - Optional transition speed in milliseconds
94
+ */
95
+ slideTo(index: number, speed?: number): void;
96
+ }
97
+
98
+ /**
99
+ * ViewModel for managing banner place state and behavior
100
+ */
101
+ export interface BannerPlace {
102
+ /**
103
+ * Gets the banner place identifier
104
+ * @returns {string}
105
+ */
106
+ get id(): string;
107
+
108
+ /**
109
+ * Gets the current banners
110
+ * @returns {Banner[]}
111
+ */
112
+ get banners(): Banner[];
113
+
114
+ /**
115
+ * Gets the median content ratio of all banners
116
+ * @returns {number}
117
+ */
118
+ get contentRatio(): number;
119
+
120
+ /**
121
+ * Gets whether banners are currently loading
122
+ * @returns {boolean}
123
+ */
124
+ get isLoading(): boolean;
125
+
126
+ /**
127
+ * Gets the slider controller instance
128
+ * @returns {IBannerPlaceSliderController}
129
+ */
130
+ get slider(): IBannerPlaceSliderController;
131
+
132
+ /**
133
+ * Gets the index of currently active banner
134
+ * @returns {number}
135
+ */
136
+ get activeIndex(): number;
137
+
138
+ /**
139
+ * Sets the slider controller implementation
140
+ * @param {IBannerPlaceSliderController} sliderController - The slider controller to use
141
+ */
142
+ setSliderController(sliderController: IBannerPlaceSliderController): void;
143
+
144
+ /**
145
+ * Updates appearance options from DTO
146
+ * @param {BannerPlaceAppearance} appearance - Appearance configuration
147
+ */
148
+ updateAppearance(appearance: BannerPlaceAppearance): void;
149
+
150
+ /**
151
+ * Starts playback of all banners
152
+ */
153
+ play(): void;
154
+
155
+ /**
156
+ * Stops playback of all banners
157
+ */
158
+ stop(): void;
159
+
160
+ /**
161
+ * Reloads banners for this place
162
+ * @returns {Promise<Banner[]>}
163
+ */
164
+ reload(): Promise<Banner[]>;
165
+
166
+ /**
167
+ * Cleans up resources and destroys all banners
168
+ */
169
+ destroy(): void;
170
+
171
+ /**
172
+ * Updates user-specific data for this banner place
173
+ * @param {string} data - User data to store
174
+ * @returns {Promise<void>}
175
+ */
176
+ updateUserData(data: string): Promise<void>;
177
+
178
+ /**
179
+ * Fetches banners from store and creates view models
180
+ * @returns {Promise<Banner[]>}
181
+ * @emits BannerPlaceViewModelEvent.LoadStart
182
+ * @emits BannerPlaceViewModelEvent.LoadEnd
183
+ * @emits BannerPlaceViewModelEvent.LoadError
184
+ */
185
+ fetchBanners(): Promise<Banner[]>;
186
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Banner place appearance settings
3
+ */
4
+ export interface BannerPlaceAppearance {
5
+ /** Set to true to enable continuous loop mode.
6
+ * Because of nature of how the loop mode works (it will rearrange slides), total number of slides must be
7
+ * more than or equal to slidesPerView + 1 */
8
+ loop?: boolean;
9
+ /** Space between slides */
10
+ gap?: number;
11
+ /** Enables autoplay */
12
+ autoplay?: boolean;
13
+ /** Slides per view */
14
+ slidesPerView?: number;
15
+ /** Transition duration (in ms) */
16
+ animationSpeed?: number;
17
+ /** Navigation params */
18
+ navigation?: {
19
+ /** Control default navigation */
20
+ enabled?: boolean;
21
+ };
22
+ /** Pagination params */
23
+ pagination?: {
24
+ /** Control default pagination */
25
+ enabled?: boolean;
26
+ };
27
+ /** Banner card appearance options */
28
+ banner?: {
29
+ /** Border radius of banner */
30
+ borderRadius?: number;
31
+ };
32
+ }
@@ -0,0 +1,77 @@
1
+ import { BannerPlace } from "./bannerPlace";
2
+ import { BannerPlaceAppearance } from "./bannerPlaceAppearance";
3
+
4
+ /**
5
+ * Props for IasBannerPlace component
6
+ * @interface
7
+ */
8
+ interface IasBannerPlaceProps {
9
+ /**
10
+ * Unique identifier for the banner place
11
+ * @optional
12
+ */
13
+ placeId?: string;
14
+
15
+ /**
16
+ * Appearance configuration options for the banner place
17
+ * @optional
18
+ * @type {BannerPlaceAppearance}
19
+ */
20
+ appearance?: BannerPlaceAppearance;
21
+
22
+ /**
23
+ * Inline CSS styles for the banner place
24
+ * @optional
25
+ * @type {React.CSSProperties}
26
+ */
27
+ style?: React.CSSProperties;
28
+
29
+ /**
30
+ * CSS class name(s) for the banner place
31
+ * @optional
32
+ * @type {string}
33
+ */
34
+ className?: string;
35
+
36
+ /**
37
+ * Callback triggered when banner loading starts
38
+ * @optional
39
+ */
40
+ onLoadStart?: () => void;
41
+
42
+ /**
43
+ * Callback triggered when banner loading completes
44
+ * @optional
45
+ */
46
+ onLoadEnd?: () => void;
47
+
48
+ /**
49
+ * Callback triggered when banner loading fails
50
+ * @param {Error} error - The error that occurred
51
+ * @optional
52
+ */
53
+ onLoadError?: (error: Error) => void;
54
+
55
+ /**
56
+ * Callback triggered when banner place is ready
57
+ * @param {BannerPlace} bannerPlace - The initialized banner place instance
58
+ * @optional
59
+ */
60
+ onReady?: (bannerPlace: BannerPlace) => void;
61
+ }
62
+
63
+ /**
64
+ * React component for displaying a banner place
65
+ * @component
66
+ * @param {IasBannerPlaceProps} props - Component properties
67
+ * @returns {JSX.Element} Banner place component
68
+ *
69
+ * @example
70
+ * <IasBannerPlace
71
+ * placeId="main-banner"
72
+ * appearanceOptions={appearanceOptions}
73
+ * onReady={(place) => console.log('Banner ready', place)}
74
+ * onLoadError={(error) => console.error('Load failed', error)}
75
+ * />
76
+ */
77
+ export declare const IasBannerPlace: (props: IasBannerPlaceProps) => JSX.Element;
@@ -0,0 +1,58 @@
1
+ import { BannerPlace } from "./bannerPlace";
2
+ /**
3
+ * Props for IasBannerPreview component
4
+ * @interface
5
+ */
6
+ interface IasBannerPreviewProps {
7
+ /**
8
+ * Unique identifier of the banner to preview
9
+ * @type {string | number}
10
+ * @required
11
+ */
12
+ bannerId: string | number;
13
+
14
+ /**
15
+ * Callback triggered when banner preview loading starts
16
+ * @optional
17
+ */
18
+ onLoadStart?: () => void;
19
+
20
+ /**
21
+ * Callback triggered when banner preview loading completes
22
+ * @optional
23
+ */
24
+ onLoadEnd?: () => void;
25
+
26
+ /**
27
+ * Callback triggered when banner preview loading fails
28
+ * @param {Error} error - The error that occurred during loading
29
+ * @optional
30
+ */
31
+ onLoadError?: (error: Error) => void;
32
+
33
+ /**
34
+ * Callback triggered when banner preview is ready
35
+ * @param {BannerPlace} bannerPlace - The initialized banner place instance
36
+ * @optional
37
+ */
38
+ onReady?: (bannerPlace: BannerPlace) => void;
39
+ }
40
+
41
+ /**
42
+ * React component for displaying a banner preview
43
+ * @component
44
+ * @param {IasBannerPreviewProps} props - Component properties
45
+ * @returns {JSX.Element} Banner preview component
46
+ *
47
+ * @example
48
+ * <IasBannerPreview
49
+ * bannerId="12345"
50
+ * onReady={(place) => console.log('Preview ready', place)}
51
+ * onLoadError={(error) => console.error('Preview load failed', error)}
52
+ * />
53
+ *
54
+ * @example
55
+ * // Minimal usage
56
+ * <IasBannerPreview bannerId={42} />
57
+ */
58
+ export declare const IasBannerPreview: (props: IasBannerPreviewProps) => JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { BannerPlace } from "./bannerPlace";
2
+ import { BannerPlaceAppearance } from "./bannerPlaceAppearance";
3
+
4
+ export interface BannerPlaceWidget extends BannerPlace {}
5
+
6
+ export interface IasBannersProvider {
7
+ /**
8
+ * Clears all banner places by destroying them and resetting the collection.
9
+ * @example
10
+ * inAppStoryManager.banners.clear();
11
+ */
12
+ clear(): void;
13
+
14
+ /**
15
+ * Creates a new banner place instance with optional place ID.
16
+ * @param {string | number} [placeId] - Optional identifier for the banner place
17
+ * @returns {BannerPlace} New banner place view model instance
18
+ * @example
19
+ * const bannerPlace = inAppStoryManager.banners.createBannerPlace('your-banner-place');
20
+ */
21
+ createBannerPlace(placeId?: string | number): BannerPlace;
22
+
23
+ /**
24
+ * Mounts a banner place component to the specified DOM element.
25
+ * @param {string} mountSelector - CSS selector for the mount element
26
+ * @param {Object} [params] - Optional parameters
27
+ * @param {string} [params.placeId="default"] - Identifier for the banner place (defaults to "default" if not provided)
28
+ * @param {BannerPlaceAppearance} [params.appearance] - Appearance configuration (optional)
29
+ * @throws {Error} If mount point not found
30
+ * @returns {BannerPlaceWidget} The created banner place instance
31
+ * @example
32
+ * // Minimal usage with defaults
33
+ * inAppStoryManager.banners.mountBannerPlace('#banner-container');
34
+ *
35
+ * @example
36
+ * // With appearance configuration
37
+ * inAppStoryManager.banners.mountBannerPlace('#banner-container', {
38
+ * appearance: { /* appearance options *\/ }
39
+ * });
40
+ *
41
+ * @example
42
+ * // With custom placeId and appearance
43
+ * inAppStoryManager.banners.mountBannerPlace('#banner-container', {
44
+ * placeId: 'header-banner',
45
+ * appearance: { /* appearance options *\/ }
46
+ * });
47
+ */
48
+ mountBannerPlace(
49
+ mountSelector: string,
50
+ params?: { placeId?: string; appearance?: BannerPlaceAppearance }
51
+ ): BannerPlaceWidget;
52
+ }
@@ -0,0 +1,29 @@
1
+ export * from "./banner";
2
+ export * from "./bannerPlace";
3
+ export * from "./bannerPlaceAppearance";
4
+ export * from "./iasBannerPlace";
5
+ export * from "./iasBannerPreview";
6
+ export * from "./iasBannersProvider";
7
+
8
+ import { IasBannersProvider } from "./iasBannersProvider";
9
+
10
+ declare module "@inappstory/js-sdk" {
11
+ interface InAppStoryManager {
12
+ banners: IasBannersProvider;
13
+ }
14
+ }
15
+
16
+ declare module "@inappstory/react-sdk" {
17
+ interface StoryManager {
18
+ banners: IasBannersProvider;
19
+ }
20
+ }
21
+
22
+ export declare class IasBannersPlugin {
23
+ name: string;
24
+ install(storyManager: any): void;
25
+ uninstall(): void;
26
+ }
27
+
28
+ declare const pluginInstance: IasBannersPlugin;
29
+ export default pluginInstance;