@inappstory/react-sdk 0.2.5 → 0.3.1

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 (39) hide show
  1. package/dist/index.js +184 -4
  2. package/dist/types/appearance-manager/appearanceCommon.d.ts +15 -13
  3. package/dist/types/appearance-manager/gameReader.d.ts +30 -0
  4. package/dist/types/appearance-manager/goodsWidget.d.ts +43 -0
  5. package/dist/types/appearance-manager/index.d.ts +0 -3
  6. package/dist/types/appearance-manager/overrideByMediaQuery.d.ts +18 -0
  7. package/dist/types/appearance-manager/sharePanel.d.ts +44 -0
  8. package/dist/types/appearance-manager/storiesList.d.ts +103 -85
  9. package/dist/types/appearance-manager/storyReader.ts +64 -67
  10. package/dist/types/global.d.ts +11 -0
  11. package/dist/types/ias-container/IasContainer.d.ts +10 -0
  12. package/dist/types/ias-container/appearanceOptionsProps.d.ts +17 -0
  13. package/dist/types/ias-container/index.d.ts +1 -1
  14. package/dist/types/ias-container/publicEvents.d.ts +86 -0
  15. package/dist/types/ias-container/storyManagerEventsProps.d.ts +31 -0
  16. package/dist/types/index.d.ts +4 -10
  17. package/dist/types/share-page/index.d.ts +1 -0
  18. package/dist/types/share-page/sharePage.d.ts +9 -0
  19. package/dist/types/story-list/FavoriteStoryList.d.ts +5 -6
  20. package/dist/types/story-list/StoryList.d.ts +12 -11
  21. package/dist/types/story-list/UGCStoryList.d.ts +10 -8
  22. package/dist/types/story-list/favoriteCardCompositeViewModel.ts +3 -3
  23. package/dist/types/story-list/favoriteStoryCardViewModel.d.ts +1 -2
  24. package/dist/types/story-list/index.d.ts +8 -8
  25. package/dist/types/story-list/navigationViewModel.d.ts +1 -3
  26. package/dist/types/story-list/storyCardViewModel.d.ts +3 -3
  27. package/dist/types/storyManager.d.ts +43 -0
  28. package/package.json +2 -2
  29. package/dist/types/appearance-manager/AppearanceManager.d.ts +0 -38
  30. package/dist/types/appearance-manager/AppearanceManager.h.d.ts +0 -26
  31. package/dist/types/appearance-manager/gameReader.ts +0 -33
  32. package/dist/types/appearance-manager/goodsWidget.ts +0 -39
  33. package/dist/types/appearance-manager/storyFavoriteReader.ts +0 -20
  34. package/dist/types/appearance-manager/utils.d.ts +0 -7
  35. package/dist/types/ias-container/ias-container.d.ts +0 -8
  36. package/dist/types/story-list/storyListViewModel.d.ts +0 -21
  37. package/dist/types/story-list/viewModel.d.ts +0 -5
  38. package/dist/types/story-manager/StoryManager.d.ts +0 -45
  39. package/dist/types/story-manager/StoryManager.h.d.ts +0 -21
@@ -1,21 +1,23 @@
1
- export type CloseButtonPosition = "left" | "right"
1
+ export declare enum CloseButtonPosition {
2
+ LEFT = "left",
3
+ RIGHT = "right"
4
+ }
2
5
 
3
- export type AppearanceCommonOptions = {
4
- hasFavorite?: boolean;
5
- hasLike?: boolean;
6
- hasShare?: boolean;
7
- closeButtonPosition?: CloseButtonPosition;
8
- loader?: {
6
+ export type AppearanceCommonOptions = RecursivePartial<{
7
+ hasFavorite: boolean;
8
+ hasLike: boolean;
9
+ hasShare: boolean;
10
+ closeButtonPosition: CloseButtonPosition | "left" | "right";
11
+ loader: {
9
12
  default: {
10
- color: Optional<string>;
11
- accentColor: Optional<string>;
13
+ color: string;
14
+ accentColor: string;
12
15
  };
13
- custom: Optional<string>;
16
+ custom: string;
14
17
  };
15
- closeButton?: {
18
+ closeButton: {
16
19
  svgSrc: {
17
20
  baseState: string;
18
21
  };
19
22
  };
20
- forceDesktopMode?: boolean;
21
- };
23
+ }>;
@@ -0,0 +1,30 @@
1
+
2
+ import { CloseButtonPosition } from "./appearanceCommon";
3
+
4
+ export type GameReaderOptions = RecursivePartial<{
5
+ loader: {
6
+ default: {
7
+ color: string;
8
+ accentColor: string;
9
+ };
10
+ custom: string;
11
+ };
12
+
13
+ closeButtonPosition: CloseButtonPosition | "left" | "right";
14
+
15
+ closeButton: {
16
+ svgSrc: {
17
+ baseState: string;
18
+ };
19
+ };
20
+
21
+ backdropColor: string;
22
+
23
+ game: {
24
+ backdropColor: string;
25
+ };
26
+ }>;
27
+
28
+ export type OpenGameOptions = Partial<{
29
+ demoMode: boolean;
30
+ }>;
@@ -0,0 +1,43 @@
1
+ export type Goods = Partial<{
2
+ imgSrc: string;
3
+ title: string;
4
+ subTitle: string;
5
+ price: string;
6
+ oldPrice: string;
7
+ sku: string;
8
+ rawData: any;
9
+ }>;
10
+
11
+ export type GoodsWidgetOptions = RecursivePartial<{
12
+ goodsList: GoodsListOptions;
13
+ goodsCard: GoodsCardOptions;
14
+ loader: {
15
+ default: {
16
+ color: string;
17
+ accentColor: string;
18
+ };
19
+ custom: string;
20
+ };
21
+ openGoodsWidgetHandler: (goodsList: Goods[]) => Promise<Goods[]>;
22
+ getCardHtml?: (goods: Goods, index: number) => string;
23
+ itemClickHandler?: (goods: Goods) => void;
24
+ }>;
25
+
26
+ export type GoodsCardOptions = Partial<{
27
+ mainTextColor: string;
28
+ oldPriceTextColor: string;
29
+ imageBackgroundColor: string;
30
+ imageCornerRadius: number;
31
+ titleFont: string;
32
+ subtitleFont: string;
33
+ priceFont: string;
34
+ oldPriceFont: string;
35
+ }>;
36
+
37
+ export type GoodsListOptions = Partial<{
38
+ closeBackgroundColor: string;
39
+ closeImage: string;
40
+ substrateHeight: number;
41
+ substrateColor: string;
42
+ dimColor: string;
43
+ }>;
@@ -1,8 +1,5 @@
1
1
  export * from "./appearanceCommon"
2
- export * from "./AppearanceManager"
3
- export * from "./AppearanceManager.h"
4
2
  export * from "./gameReader"
5
3
  export * from "./goodsWidget"
6
4
  export * from "./storiesList"
7
- export * from "./storyFavoriteReader"
8
5
  export * from "./storyReader"
@@ -0,0 +1,18 @@
1
+ import { AppearanceCommonOptions } from "./appearanceCommon";
2
+ export { GameReaderOptions } from "./gameReader";
3
+ export { GoodsWidgetOptions } from "./goodsWidget";
4
+ export { StoriesListOptions } from "./storiesList";
5
+ export { StoryReaderOptions } from "./storyReader";
6
+
7
+ export type OverrideByMediaQuery<
8
+ Options extends
9
+ | AppearanceCommonOptions
10
+ | StoriesListOptions
11
+ | StoryReaderOptions
12
+ | GoodsWidgetOptions
13
+ | GameReaderOptions = any
14
+ > = Partial<{
15
+ viewportMinSize: number | "sm" | "md" | "lg" | "xl";
16
+ mediaQuery: null | string;
17
+ options: Options;
18
+ }>;
@@ -0,0 +1,44 @@
1
+ type BaseShareTarget = "vk" | "ok" | "facebook" | "x" | "linkedin" | "telegram" | "twitter";
2
+ export type ShareTarget<CustomTargets extends string = never> = BaseShareTarget | CustomTargets;
3
+
4
+ export type ShareTargetParams = {
5
+ label?: string;
6
+ icon?: {
7
+ svgSrc: {
8
+ baseState: string;
9
+ };
10
+ };
11
+ getUrl?: (config: { url: string; text: string }) => string;
12
+ };
13
+
14
+ export type SharePanel<CustomTargets extends string = never> = Partial<{
15
+ background: React.CSSProperties["background"];
16
+ borderRadius: number;
17
+ divider: {
18
+ background: React.CSSProperties["background"];
19
+ };
20
+ text: {
21
+ color: React.CSSProperties["color"];
22
+ font: React.CSSProperties["font"];
23
+ };
24
+ targets: ShareTarget<CustomTargets>[];
25
+ targetParams: Partial<Record<ShareTarget<CustomTargets>, ShareTargetParams>>;
26
+ copyButton: {
27
+ label: string;
28
+ svgSrc: {
29
+ baseState: string;
30
+ };
31
+ };
32
+ downloadButton: {
33
+ svgSrc: {
34
+ baseState: string;
35
+ };
36
+ };
37
+ title: {
38
+ favicon: {
39
+ background: React.CSSProperties["background"];
40
+ display: boolean;
41
+ };
42
+ getValue: (config: { url: string; text: string }) => string;
43
+ };
44
+ }>;
@@ -1,128 +1,146 @@
1
- /// <reference path="./utils.d.ts" />
1
+ export declare enum StoriesListSliderAlign {
2
+ CENTER = "center",
3
+ LEFT = "left",
4
+ RIGHT = "right"
5
+ }
2
6
 
3
- export type StoriesListSliderAlign = "center" | "left" | "right"
7
+ export declare enum StoriesListCardViewVariant {
8
+ CIRCLE = "circle",
9
+ QUAD = "quad",
10
+ RECTANGLE = "rectangle"
11
+ }
4
12
 
5
- export type StoriesListOptions = Partial<{
6
- direction: "horizontal" | "vertical";
13
+ export declare enum StoriesListCardTitleTextAlign {
14
+ LEFT = "left",
15
+ CENTER = "center",
16
+ RIGHT = "right"
17
+ }
18
+
19
+ export declare enum StoriesListCardTitlePosition {
20
+ CARD_INSIDE_BOTTOM = "cardInsideBottom",
21
+ CARD_OUTSIDE_TOP = "cardOutsideTop",
22
+ CARD_OUTSIDE_BOTTOM = "cardOutsideBottom"
23
+ }
24
+
25
+ export declare enum StoriesListCardCoverQuality {
26
+ Medium = "medium",
27
+ High = "high"
28
+ }
29
+
30
+ export declare enum StoriesListDirection {
31
+ COLUMN = "vertical",
32
+ ROW = "horizontal"
33
+ }
34
+
35
+ export type StoriesListOptions = RecursivePartial<{
36
+ direction: StoriesListDirection | "vertical" | "horizontal";
7
37
  card: StoriesListCardOptions;
8
38
  favoriteCard: StoriesListFavoriteCardOptions;
9
- layout: Partial<{
39
+ layout: {
10
40
  height: number | string;
11
41
  backgroundColor: string;
12
- sliderAlign: StoriesListSliderAlign;
13
- }>;
42
+ sliderAlign: StoriesListSliderAlign | "left" | "center" | "right";
43
+ };
14
44
  sidePadding: number;
15
45
  topPadding: number;
16
46
  bottomPadding: number;
17
47
  bottomMargin: number;
18
- navigation: Partial<{
48
+ navigation: {
19
49
  speed: number;
20
50
  showControls: boolean;
21
51
  controlsSize: number;
22
52
  controlsBackgroundColor: string;
23
53
  controlsColor: string;
24
- }>;
25
- handleStoryLinkClick: (payload: StoriesListClickEvent) => void;
26
- handleStartLoad: (loaderContainer: HTMLElement) => void;
27
- handleStopLoad: (loaderContainer: HTMLElement) => void;
54
+ };
28
55
  ugcCard: StoriesListUgcCardOptions;
29
56
  }>;
30
- export type StoriesListCardViewVariant = "circle" | "quad" | "rectangle"
31
-
32
- export type StoriesListCardTitleTextAlign = "left" | "center" | "right"
33
57
 
34
- export type StoriesListCardTitlePosition = "cardInsideBottom" | "cardOutsideTop" | "cardOutsideBottom"
35
-
36
- export type StoriesListCardCoverQuality = "medium" | "high"
37
-
38
- export type StoriesListCardOptions = Partial<{
39
- title: Partial<{
58
+ export type StoriesListCardOptions = RecursivePartial<{
59
+ title: {
40
60
  color: string;
41
61
  padding: string | number;
42
62
  font: string;
43
63
  display: boolean;
44
- textAlign: StoriesListCardTitleTextAlign;
45
- position: StoriesListCardTitlePosition;
64
+ textAlign: StoriesListCardTitleTextAlign | "left" | "center" | "right";
65
+ position: StoriesListCardTitlePosition | "cardInsideBottom" | "cardOutsideTop" | "cardOutsideBottom";
46
66
  lineClamp: number;
47
- }>;
67
+ };
48
68
  gap: number;
49
69
  height: number;
50
- aspectRatio: Optional<number>;
51
- coverQuality: StoriesListCardCoverQuality;
70
+ aspectRatio: number;
71
+ coverQuality: StoriesListCardCoverQuality | "medium" | "high";
52
72
  coverLazyLoading: boolean;
53
- variant: StoriesListCardViewVariant;
54
- border: Partial<{
73
+ variant: StoriesListCardViewVariant | "circle" | "quad" | "rectangle";
74
+ border: {
55
75
  radius: number;
56
76
  color: string;
57
77
  width: number;
58
78
  gap: number;
59
- gradient: Optional<string>;
60
- }>;
61
- boxShadow: Optional<string>;
62
- dropShadow: Optional<string>;
63
- opacity: Optional<number>;
64
- mask: Partial<{
65
- color: Optional<string>;
66
- linearGradient?: Optional<{
79
+ gradient: string;
80
+ };
81
+ boxShadow: string;
82
+ dropShadow: string;
83
+ opacity: number;
84
+ mask: {
85
+ color: string;
86
+ linearGradient: {
67
87
  direction: string;
68
88
  points: Array<string>;
69
- }>;
70
- }>;
71
- svgMask: Partial<Optional<{
72
- cardMask: Optional<string>;
89
+ };
90
+ };
91
+ svgMask: {
92
+ cardMask: string;
73
93
  overlayMask: Array<{
74
- mask: Optional<string>;
75
- background: Optional<string>;
76
- }>;
77
- }>>;
78
- opened: Partial<{
79
- border: Partial<{
80
- radius: Optional<number>;
81
- color: Optional<string>;
82
- width: Optional<number>;
83
- gap: Optional<number>;
84
- gradient: Optional<string>;
94
+ mask: string;
95
+ background: string;
85
96
  }>;
86
- boxShadow: Optional<string>;
87
- dropShadow: Optional<string>;
88
- opacity: Optional<number>;
97
+ };
98
+ opened: {
99
+ border: {
100
+ radius: number;
101
+ color: string;
102
+ width: number;
103
+ gap: number;
104
+ gradient: string;
105
+ };
106
+ boxShadow: string;
107
+ dropShadow: string;
108
+ opacity: number;
89
109
  mask: {
90
- color: Optional<string>;
91
- linearGradient: Optional<{
110
+ color: string;
111
+ linearGradient: {
92
112
  direction: string;
93
113
  points: Array<string>;
114
+ };
115
+ };
116
+ svgMask: {
117
+ cardMask: string;
118
+ overlayMask: Array<{
119
+ mask: string;
120
+ background: string;
94
121
  }>;
95
122
  };
96
- svgMask: Optional<{
97
- cardMask: Optional<string>;
98
- overlayMask: Optional<Array<{
99
- mask: Optional<string>;
100
- background: Optional<string>;
101
- }>>;
102
- }>;
103
- }>;
104
- }>;
105
- export type StoriesListFavoriteCardOptions = Partial<StoriesListCardOptions & {
106
- title: StoriesListCardOptions["title"] & {
107
- content: string;
108
123
  };
109
124
  }>;
110
125
 
111
- export type StoriesListUgcCardOptions = Partial<Omit<StoriesListCardOptions, "opened"> & {
112
- title: Partial<StoriesListCardOptions["title"]> & {
113
- content?: Option<string>;
114
- };
115
- image: {
116
- svgSrc: {
117
- baseState: string;
126
+ export type StoriesListFavoriteCardOptions = RecursivePartial<
127
+ StoriesListCardOptions & {
128
+ title: StoriesListCardOptions["title"] & {
129
+ content: string;
118
130
  };
119
- };
120
- backgroundColor: string;
121
- }>;
122
- export type StoriesListClickEvent = {
123
- id: number;
124
- index: number;
125
- isDeeplink: boolean;
126
- url: string | undefined;
127
- };
128
- export type StoriesListEvents = "startLoad" | "endLoad"
131
+ }
132
+ >;
133
+
134
+ export type StoriesListUgcCardOptions = RecursivePartial<
135
+ Omit<StoriesListCardOptions, "opened"> & {
136
+ title: StoriesListCardOptions["title"] & {
137
+ content: Option<string>;
138
+ };
139
+ image: {
140
+ svgSrc: {
141
+ baseState: string;
142
+ };
143
+ };
144
+ backgroundColor: string;
145
+ }
146
+ >;
@@ -1,84 +1,81 @@
1
1
  import { CloseButtonPosition } from "./appearanceCommon";
2
2
  import { GameReaderOptions } from "./gameReader";
3
- /// <reference path="../global.d.ts" />
3
+ import { SharePanel } from "./sharePanel"
4
4
 
5
- export type StoryReaderSwipeStyle = "flat" | "cover" | "cube"
5
+ export declare enum StoryReaderSwipeStyle {
6
+ FLAT = "flat",
7
+ COVER = "cover",
8
+ CUBE = "cube"
9
+ }
6
10
 
7
- export type SharePanelTargets = "vk" | "ok" | "facebook" | "twitter" | "linkedin" | "telegram"
11
+ export declare enum SharePanelTargets {
12
+ VK = "vk",
13
+ OK = "ok",
14
+ FACEBOOK = "facebook",
15
+ X = "twitter",
16
+ LINKEDIN = "linkedin",
17
+ TELEGRAM = "telegram"
18
+ }
8
19
 
9
- export type StoryReaderOptions = {
10
- gameReaderOptions: GameReaderOptions,
11
- closeButtonPosition?: CloseButtonPosition,
12
- scrollStyle: StoryReaderSwipeStyle,
13
- timelineBlockTopOffset: Nullable<number>,
14
- actionPanelBottomOffset: Nullable<number>,
15
- borderRadius: Optional<number>
16
- loader?: {
20
+ export type StoryReaderOptions = RecursivePartial<{
21
+ gameReaderOptions: GameReaderOptions;
22
+ closeButtonPosition: CloseButtonPosition | "left" | "right";
23
+ scrollStyle: StoryReaderSwipeStyle | "flat" | "cover" | "cube";
24
+ timelineBlockTopOffset: Nullable<number>;
25
+ actionPanelBottomOffset: Nullable<number>;
26
+ borderRadius: number;
27
+ loader: {
17
28
  default: {
18
- color: Optional<string>,
19
- accentColor: Optional<string>,
20
- },
21
- custom: Optional<string>
22
- },
23
- recycleStoriesList?: boolean,
24
- closeOnLastSlideByTimer?: boolean,
25
- sharePanel: {
26
- targets: Array<SharePanelTargets>
27
- copyButton?: {
28
- svgSrc: {
29
- baseState: string,
30
- }
31
- },
32
- downloadButton?: {
33
- svgSrc: {
34
- baseState: string,
35
- }
36
- }
37
- },
38
- commonBackdrop?: {
39
- color: Option<string>, // colorValue
40
- backdropFilter: Option<string> // null or blur(3px)
41
- },
42
- slideBackdrop?: {
43
- opacity: number, // .56
44
- blur: number, // 30
45
- linearGradientOverlay: Array<string> // ["rgba(0, 0, 0, 0.1) 0%", "rgba(0, 0, 0, 0.9) 100%"]
46
- },
47
- faviconApiUrl: string,
48
- closeButton?: {
29
+ color: string;
30
+ accentColor: string;
31
+ };
32
+ custom: string;
33
+ };
34
+ recycleStoriesList: boolean;
35
+ closeOnLastSlideByTimer: boolean;
36
+ sharePanel: SharePanel<string>;
37
+ commonBackdrop: {
38
+ color: string;
39
+ backdropFilter: string;
40
+ };
41
+ slideBackdrop: {
42
+ opacity: number;
43
+ blur: number;
44
+ linearGradientOverlay: string[];
45
+ };
46
+ faviconApiUrl: string;
47
+ closeButton: {
49
48
  svgSrc: {
50
- baseState: string
51
- }
52
- },
49
+ baseState: string;
50
+ };
51
+ };
53
52
  likeButton: {
54
53
  svgSrc: {
55
- baseState: string,
56
- activeState: string,
57
- }
58
- },
54
+ baseState: string;
55
+ activeState: string;
56
+ };
57
+ };
59
58
  dislikeButton: {
60
59
  svgSrc: {
61
- baseState: string,
62
- activeState: string,
63
- }
64
- },
60
+ baseState: string;
61
+ activeState: string;
62
+ };
63
+ };
65
64
  favoriteButton: {
66
65
  svgSrc: {
67
- baseState: string,
68
- activeState: string,
69
- }
70
- },
66
+ baseState: string;
67
+ activeState: string;
68
+ };
69
+ };
71
70
  muteButton: {
72
71
  svgSrc: {
73
- baseState: string,
74
- activeState: string,
75
- }
76
- },
72
+ baseState: string;
73
+ activeState: string;
74
+ };
75
+ };
77
76
  shareButton: {
78
77
  svgSrc: {
79
- baseState: string,
80
- }
81
- }
82
-
83
-
84
- };
78
+ baseState: string;
79
+ };
80
+ };
81
+ }>;
@@ -0,0 +1,11 @@
1
+ declare type RecursivePartial<T> = {
2
+ [P in keyof T]?: T[P] extends object ? RecursivePartial<T[P]> | null : T[P] | null;
3
+ };
4
+
5
+ declare type Nullable<T> = T | null;
6
+ declare type Optional<T> = T | null;
7
+ declare type Option<T> = T | null;
8
+
9
+ declare type Dict<K extends string | number | symbol = string, T = any> = Record<K, T>
10
+
11
+ declare type Brand<T, B extends string> = T & { readonly __brand: B }
@@ -0,0 +1,10 @@
1
+ import { StoryManager, StoryManagerConfig } from "..";
2
+ import { StoryManagerEventsProps } from "./storyManagerEventsProps";
3
+ import { AppearanceOptionsProps } from "./appearanceOptionsProps";
4
+
5
+ interface IASContainerProps extends StoryManagerEventsProps, AppearanceOptionsProps {
6
+ config: StoryManagerConfig;
7
+ children?: React.ReactNode;
8
+ }
9
+
10
+ export declare const IASContainer: (props: IASContainerProps) => JSX.Element;
@@ -0,0 +1,17 @@
1
+ import {
2
+ AppearanceCommonOptions,
3
+ GameReaderOptions,
4
+ GoodsWidgetOptions,
5
+ StoryReaderOptions
6
+ } from "../appearance-manager";
7
+
8
+ export interface AppearanceOptionsProps {
9
+ commonOptions?: AppearanceCommonOptions;
10
+ storyReaderOptions?: StoryReaderOptions;
11
+ gameReaderOptions?: GameReaderOptions;
12
+ goodsWidgetOptions?: GoodsWidgetOptions;
13
+ commonOptionsOverrideByMediaQuery?: OverrideByMediaQuery<AppearanceCommonOptions>[];
14
+ storyReaderOptionsOverrideByMediaQuery?: OverrideByMediaQuery<StoryReaderOptions>[];
15
+ gameReaderOptionsOverrideByMediaQuery?: OverrideByMediaQuery<GameReaderOptions>[];
16
+ goodsWidgetOptionsOverrideByMediaQuery?: OverrideByMediaQuery<GoodsWidgetOptions>[];
17
+ }
@@ -1 +1 @@
1
- export { IASContainer } from './ias-container';
1
+ export { IASContainer } from './IasContainer';