@inappstory/js-sdk 3.7.0-rc.8 → 3.7.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.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Banner place appearance settings
2
+ * Banner carousel appearance settings
3
3
  */
4
- export interface BannerPlaceAppearance {
4
+ export interface BannerCarouselAppearance {
5
5
  /** Set to true to enable continuous loop mode.
6
6
  * Because of nature of how the loop mode works (it will rearrange slides), total number of slides must be
7
7
  * more than or equal to slidesPerView + 1 */
@@ -29,4 +29,8 @@ export interface BannerPlaceAppearance {
29
29
  /** Border radius of banner */
30
30
  borderRadius?: number;
31
31
  };
32
+ /** List direction */
33
+ direction?: "row" | "column";
34
+ /** If false, then the only way to switch the slide is use of external API functions like showPrevious or showNext */
35
+ allowTouchMove?: boolean;
32
36
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Banner list appearance settings
3
+ */
4
+ export interface BannerListAppearance {
5
+ /** Space between slides */
6
+ gap?: number;
7
+
8
+ /** Banner card appearance options */
9
+ banner?: {
10
+ /** Border radius of banner */
11
+ borderRadius?: number;
12
+ };
13
+ }
@@ -0,0 +1,115 @@
1
+ import { Banner } from "./banner";
2
+ import { BannerPlace } from "./bannerPlace";
3
+ import { BannerCarouselAppearance } from "./bannerCarouselAppearance";
4
+ import { AutoplayTimerTickEvent, BannerWidgetEvent, ShowBannerEvent, ShowBannerFailedEvent } from "./events";
5
+
6
+ /**
7
+ * Props for IasBannerCarousel component
8
+ * @interface
9
+ */
10
+ interface IasBannerCarouselProps {
11
+ /**
12
+ * Unique identifier for the banner carousel
13
+ * @optional
14
+ */
15
+ placeId?: string;
16
+
17
+ /**
18
+ * Appearance configuration options for the banner carousel
19
+ * @optional
20
+ * @type {BannerCarouselAppearance}
21
+ */
22
+ appearance?: BannerCarouselAppearance;
23
+
24
+ /**
25
+ * Inline CSS styles for the banner carousel
26
+ * @optional
27
+ * @type {React.CSSProperties}
28
+ */
29
+ style?: React.CSSProperties;
30
+
31
+ /**
32
+ * CSS class name(s) for the banner carousel
33
+ * @optional
34
+ * @type {string}
35
+ */
36
+ className?: string;
37
+
38
+ /**
39
+ * Callback triggered when banner loading starts
40
+ * @optional
41
+ */
42
+ onLoadStart?: () => void;
43
+
44
+ /**
45
+ * Callback triggered when banner loading completes
46
+ * @optional
47
+ */
48
+ onLoadEnd?: (event: { banners: Banner[] }) => void;
49
+
50
+ /**
51
+ * Callback triggered when banner loading fails
52
+ * @param {Error} error - The error that occurred
53
+ * @optional
54
+ */
55
+ onLoadError?: (error: Error) => void;
56
+
57
+ /**
58
+ * Callback triggered when changed active banner
59
+ * @optional
60
+ */
61
+ onActiveIndexChange?: (index: number) => void;
62
+
63
+ /**
64
+ * Callback triggered before transition to the next slide after the duration has elapsed
65
+ * @optional
66
+ */
67
+ onAutoplayTimeLeft?: () => void;
68
+
69
+ /**
70
+ * Callback triggered when autoplay timer tick
71
+ * @optional
72
+ */
73
+ onAutoplayTimerTick?: (event: AutoplayTimerTickEvent) => void;
74
+
75
+ /**
76
+ * Callback triggered when banner carousel is ready
77
+ * @param {BannerPlace} bannerPlace - The initialized banner carousel instance
78
+ * @optional
79
+ */
80
+ onReady?: (bannerPlace: BannerPlace) => void;
81
+
82
+ /**
83
+ * Triggered when the banner is in the viewport and started.
84
+ * @optional
85
+ */
86
+ onShowBanner?: (event: ShowBannerEvent) => void;
87
+
88
+ /**
89
+ * Triggered when the banner is in the viewport and error occurs on start.
90
+ * @optional
91
+ */
92
+ onShowBannerFailed?: (event: ShowBannerFailedEvent) => void;
93
+
94
+ /**
95
+ * Triggered when interacting with banner widgets.
96
+ * @optional
97
+ */
98
+ onBannerWidget?: (event: BannerWidgetEvent) => void;
99
+ }
100
+
101
+ /**
102
+ * React component for displaying a banner carousel
103
+ * @component
104
+ * @param {IasBannerCarouselProps} props - Component properties
105
+ * @returns {JSX.Element} banner carousel component
106
+ *
107
+ * @example
108
+ * <IasBannerCarousel
109
+ * placeId="main-banner"
110
+ * appearanceOptions={appearanceOptions}
111
+ * onReady={(place) => console.log('Banner ready', place)}
112
+ * onLoadError={(error) => console.error('Load failed', error)}
113
+ * />
114
+ */
115
+ export declare const IasBannerCarousel: (props: IasBannerCarouselProps) => JSX.Element;
@@ -0,0 +1,97 @@
1
+ import { Banner } from "./banner";
2
+ import { BannerPlace } from "./bannerPlace";
3
+ import { BannerListAppearance } from "./bannerListAppearance";
4
+ import { BannerWidgetEvent, ShowBannerEvent, ShowBannerFailedEvent } from "./events";
5
+
6
+ /**
7
+ * Props for IasBannerList component
8
+ * @interface
9
+ */
10
+ interface IasBannerListProps {
11
+ /**
12
+ * Unique identifier for the banner place
13
+ * @optional
14
+ */
15
+ placeId?: string;
16
+
17
+ /**
18
+ * Appearance configuration options for the banner place
19
+ * @optional
20
+ * @type {BannerListAppearance}
21
+ */
22
+ appearance?: BannerListAppearance;
23
+
24
+ /**
25
+ * Inline CSS styles for the banner place
26
+ * @optional
27
+ * @type {React.CSSProperties}
28
+ */
29
+ style?: React.CSSProperties;
30
+
31
+ /**
32
+ * CSS class name(s) for the banner place
33
+ * @optional
34
+ * @type {string}
35
+ */
36
+ className?: string;
37
+
38
+ /**
39
+ * Callback triggered when banner loading starts
40
+ * @optional
41
+ */
42
+ onLoadStart?: () => void;
43
+
44
+ /**
45
+ * Callback triggered when banner loading completes
46
+ * @optional
47
+ */
48
+ onLoadEnd?: (event: { banners: Banner[] }) => void;
49
+
50
+ /**
51
+ * Callback triggered when banner loading fails
52
+ * @param {Error} error - The error that occurred
53
+ * @optional
54
+ */
55
+ onLoadError?: (error: Error) => void;
56
+
57
+ /**
58
+ * Callback triggered when banner place is ready
59
+ * @param {BannerPlace} bannerPlace - The initialized banner place instance
60
+ * @optional
61
+ */
62
+ onReady?: (bannerPlace: BannerPlace) => void;
63
+
64
+ /**
65
+ * Triggered when the banner is in the viewport and started.
66
+ * @optional
67
+ */
68
+ onShowBanner?: (event: ShowBannerEvent) => void;
69
+
70
+ /**
71
+ * Triggered when the banner is in the viewport and error occurs on start.
72
+ * @optional
73
+ */
74
+ onShowBannerFailed?: (event: ShowBannerFailedEvent) => void;
75
+
76
+ /**
77
+ * Triggered when interacting with banner widgets.
78
+ * @optional
79
+ */
80
+ onBannerWidget?: (event: BannerWidgetEvent) => void;
81
+ }
82
+
83
+ /**
84
+ * React component for displaying a banner place
85
+ * @component
86
+ * @param {IasBannerListProps} props - Component properties
87
+ * @returns {JSX.Element} Banner place component
88
+ *
89
+ * @example
90
+ * <IasBannerList
91
+ * placeId="main-banner"
92
+ * appearanceOptions={appearanceOptions}
93
+ * onReady={(place) => console.log('Banner ready', place)}
94
+ * onLoadError={(error) => console.error('Load failed', error)}
95
+ * />
96
+ */
97
+ export declare const IasBannerList: (props: IasBannerListProps) => JSX.Element;
@@ -1,5 +1,6 @@
1
+ import { Banner } from "./banner";
1
2
  import { BannerPlace } from "./bannerPlace";
2
- import { BannerPlaceAppearance } from "./bannerPlaceAppearance";
3
+ import { BannerCarouselAppearance } from "./bannerCarouselAppearance";
3
4
  import { AutoplayTimerTickEvent, BannerWidgetEvent, ShowBannerEvent, ShowBannerFailedEvent } from "./events";
4
5
 
5
6
  /**
@@ -16,9 +17,9 @@ interface IasBannerPlaceProps {
16
17
  /**
17
18
  * Appearance configuration options for the banner place
18
19
  * @optional
19
- * @type {BannerPlaceAppearance}
20
+ * @type {BannerCarouselAppearance}
20
21
  */
21
- appearance?: BannerPlaceAppearance;
22
+ appearance?: BannerCarouselAppearance;
22
23
 
23
24
  /**
24
25
  * Inline CSS styles for the banner place
@@ -44,7 +45,7 @@ interface IasBannerPlaceProps {
44
45
  * Callback triggered when banner loading completes
45
46
  * @optional
46
47
  */
47
- onLoadEnd?: () => void;
48
+ onLoadEnd?: (event: { banners: Banner[] }) => void;
48
49
 
49
50
  /**
50
51
  * Callback triggered when banner loading fails
@@ -102,7 +103,6 @@ interface IasBannerPlaceProps {
102
103
  * @component
103
104
  * @param {IasBannerPlaceProps} props - Component properties
104
105
  * @returns {JSX.Element} Banner place component
105
- *
106
106
  * @example
107
107
  * <IasBannerPlace
108
108
  * placeId="main-banner"
@@ -110,5 +110,6 @@ interface IasBannerPlaceProps {
110
110
  * onReady={(place) => console.log('Banner ready', place)}
111
111
  * onLoadError={(error) => console.error('Load failed', error)}
112
112
  * />
113
+ * @deprecated Use `IasBannerCarousel` instead
113
114
  */
114
115
  export declare const IasBannerPlace: (props: IasBannerPlaceProps) => JSX.Element;
@@ -1,7 +1,9 @@
1
+ import { BannerCarouselAppearance } from "./bannerCarouselAppearance";
2
+ import { BannerListAppearance } from "./bannerListAppearance";
1
3
  import { BannerPlace } from "./bannerPlace";
2
- import { BannerPlaceAppearance } from "./bannerPlaceAppearance";
3
4
 
4
- export interface BannerPlaceWidget extends BannerPlace {}
5
+ export interface BannerCarouselWidget extends BannerPlace {}
6
+ export interface BannerListWidget extends BannerPlace {}
5
7
 
6
8
  export interface IasBannersProvider {
7
9
  /**
@@ -25,7 +27,7 @@ export interface IasBannersProvider {
25
27
  * @param {string} mountSelector - CSS selector for the mount element
26
28
  * @param {Object} [params] - Optional parameters
27
29
  * @param {string} [params.placeId="default"] - Identifier for the banner place (defaults to "default" if not provided)
28
- * @param {BannerPlaceAppearance} [params.appearance] - Appearance configuration (optional)
30
+ * @param {BannerCarouselAppearance} [params.appearance] - Appearance configuration (optional)
29
31
  * @throws {Error} If mount point not found
30
32
  * @returns {BannerPlaceWidget} The created banner place instance
31
33
  * @example
@@ -44,9 +46,70 @@ export interface IasBannersProvider {
44
46
  * placeId: 'header-banner',
45
47
  * appearance: { /* appearance options *\/ }
46
48
  * });
49
+ * @deprecated Use `mountBannerCarousel` instead
47
50
  */
48
51
  mountBannerPlace(
49
52
  mountSelector: string,
50
- params?: { placeId?: string; appearance?: BannerPlaceAppearance }
53
+ params?: { placeId?: string; appearance?: BannerCarouselAppearance }
51
54
  ): BannerPlaceWidget;
55
+
56
+ /**
57
+ * Mounts a banner place component to the specified DOM element.
58
+ * @param {string} mountSelector - CSS selector for the mount element
59
+ * @param {Object} [params] - Optional parameters
60
+ * @param {string} [params.placeId="default"] - Identifier for the banner place (defaults to "default" if not provided)
61
+ * @param {BannerCarouselAppearance} [params.appearance] - Appearance configuration (optional)
62
+ * @throws {Error} If mount point not found
63
+ * @returns {BannerCarouselWidget} The created banner place instance
64
+ * @example
65
+ * // Minimal usage with defaults
66
+ * inAppStoryManager.banners.mountBannerCarousel('#banner-container');
67
+ *
68
+ * @example
69
+ * // With appearance configuration
70
+ * inAppStoryManager.banners.mountBannerCarousel('#banner-container', {
71
+ * appearance: { /* appearance options *\/ }
72
+ * });
73
+ *
74
+ * @example
75
+ * // With custom placeId and appearance
76
+ * inAppStoryManager.banners.mountBannerCarousel('#banner-container', {
77
+ * placeId: 'header-banner',
78
+ * appearance: { /* appearance options *\/ }
79
+ * });
80
+ */
81
+ mountBannerCarousel(
82
+ mountSelector: string,
83
+ params?: { placeId?: string; appearance?: BannerCarouselAppearance }
84
+ ): BannerCarouselWidget;
85
+
86
+ /**
87
+ * Mounts a banner place component to the specified DOM element.
88
+ * @param {string} mountSelector - CSS selector for the mount element
89
+ * @param {Object} [params] - Optional parameters
90
+ * @param {string} [params.placeId="default"] - Identifier for the banner place (defaults to "default" if not provided)
91
+ * @param {BannerListAppearance} [params.appearance] - Appearance configuration (optional)
92
+ * @throws {Error} If mount point not found
93
+ * @returns {BannerListWidget} The created banner place instance
94
+ * @example
95
+ * // Minimal usage with defaults
96
+ * inAppStoryManager.banners.mountBannerList('#banner-container');
97
+ *
98
+ * @example
99
+ * // With appearance configuration
100
+ * inAppStoryManager.banners.mountBannerList('#banner-container', {
101
+ * appearance: { /* appearance options *\/ }
102
+ * });
103
+ *
104
+ * @example
105
+ * // With custom placeId and appearance
106
+ * inAppStoryManager.banners.mountBannerList('#banner-container', {
107
+ * placeId: 'header-banner',
108
+ * appearance: { /* appearance options *\/ }
109
+ * });
110
+ */
111
+ mountBannerList(
112
+ mountSelector: string,
113
+ params?: { placeId?: string; appearance?: BannerListAppearance }
114
+ ): BannerListWidget;
52
115
  }
@@ -1,10 +1,12 @@
1
1
  export * from "./banner";
2
2
  export * from "./bannerPlace";
3
3
  export * from "./bannerPlaceAppearance";
4
+ export * from "./iasBannerCarousel";
5
+ export * from "./iasBannerList";
4
6
  export * from "./iasBannerPlace";
5
7
  export * from "./iasBannerPreview";
6
8
  export * from "./iasBannersProvider";
7
- export * from "./events"
9
+ export * from "./events";
8
10
 
9
11
  import { IasBannersProvider } from "./iasBannersProvider";
10
12