@inappstory/js-sdk 3.0.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.
@@ -0,0 +1,12 @@
1
+ export interface StoryListLoadStatus {
2
+ feed: string | number,
3
+ filter: Record<string, any> | null,
4
+ defaultListLength: number,
5
+ favoriteListLength: number,
6
+ success: boolean,
7
+ error: {
8
+ name: string,
9
+ networkStatus: number,
10
+ networkMessage: string
11
+ } | null
12
+ }
@@ -0,0 +1,91 @@
1
+ import { SharePage, SharePageOptions } from "./share-page";
2
+ import { AppearanceManager } from "./appearance-manager/appearanceManager";
3
+ import { StoriesList, UGCStoriesList } from "./story-list";
4
+ import { PublicEventHandler, PublicEvents } from "./publicEvents";
5
+
6
+ export declare enum StoryLinkSource {
7
+ StoryList = "storyList",
8
+ StoryReader = "storyReader",
9
+ GameReader = "gameReader"
10
+ }
11
+
12
+ export type StoryManagerConfig = {
13
+ apiKey: string;
14
+ userId?: string | number;
15
+ tags?: Array<string>;
16
+ placeholders?: Record<string, string>;
17
+ imagePlaceholders?: Record<string, string>;
18
+ lang?: string;
19
+ disableDeviceId?: boolean;
20
+ };
21
+
22
+ export type UgcEditorConfig = {
23
+ sessionId: string;
24
+ apiKey: string;
25
+ editor: Record<any, any>;
26
+ sdkVersion: string;
27
+ appPackageId?: string;
28
+ deviceId: string;
29
+ userId?: string;
30
+ lang: string;
31
+ };
32
+
33
+ export type StoryLinkClickHandler = (payload: {
34
+ data: { id: number; index: number; isDeeplink: boolean; url: string };
35
+ src: StoryLinkSource;
36
+ }) => void;
37
+
38
+ export interface Plugin {
39
+ name: string;
40
+ install(storyManager: StoryManager, options?: any): void;
41
+ uninstall(storyManager: StoryManager, options?: any): void;
42
+ }
43
+
44
+ export declare class StoryManager {
45
+ get sdkVersionName(): string;
46
+ get sdkVersionCode(): number;
47
+ set storyLinkClickHandler(value: StoryLinkClickHandler);
48
+
49
+ constructor(config: StoryManagerConfig);
50
+ static getInstance(): StoryManager;
51
+ static use(plugin: any, options?: any): void;
52
+
53
+ destroy(): void;
54
+ showOnboardingStories(
55
+ appearanceManager: AppearanceManager,
56
+ options?: { feed?: string; customTags?: Array<string>; limit?: number }
57
+ ): Promise<void>;
58
+ showStory(id: number | string, appearanceManager: AppearanceManager): Promise<void>;
59
+ showStoryOnce(id: number | string, appearanceManager: AppearanceManager): Promise<void>;
60
+ openGame(
61
+ gameInstanceId: string,
62
+ appearanceManager: AppearanceManager,
63
+ gameOptions?: { demoMode?: boolean }
64
+ ): Promise<void>;
65
+ closeGame(): Promise<boolean>;
66
+ closeStoryReader(): Promise<boolean | undefined>;
67
+ closeGoodsWidget(): void;
68
+ getUgcEditorConfig(): Promise<UgcEditorConfig>;
69
+ getNonce(): string | undefined;
70
+ on<Event extends keyof PublicEvents>(eventName: Event, listener: PublicEventHandler<Event>): this;
71
+ once<Event extends keyof PublicEvents>(eventName: Event, listener: PublicEventHandler<Event>): this;
72
+ off<Event extends keyof PublicEvents>(eventName: Event, listener: PublicEventHandler<Event>): this;
73
+
74
+ SharePage: {
75
+ new (storyId: number | string, appearanceManager: AppearanceManager, options?: SharePageOptions): SharePage;
76
+ };
77
+ StoriesList: {
78
+ new (
79
+ mountSelector: string,
80
+ appearanceManager: AppearanceManager,
81
+ options: { feed?: string; testKey?: string; useUgcCard?: boolean }
82
+ ): StoriesList;
83
+ };
84
+ UGCStoriesList: {
85
+ new (
86
+ mountSelector: string,
87
+ appearanceManager: AppearanceManager,
88
+ options: { filter?: Record<string, any>; testKey?: string; useUgcCard?: boolean }
89
+ ): UGCStoriesList;
90
+ };
91
+ }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@inappstory/js-sdk",
3
+ "version": "3.0.0-rc.0",
4
+ "description": "JS SDK",
5
+ "main": "dist/index.umd.js",
6
+ "module": "dist/index.esm.mjs",
7
+ "types": "dist/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types/index.d.ts",
11
+ "require": "./dist/index.umd.js",
12
+ "import": "./dist/index.esm.mjs",
13
+ "default": "./dist/index.umd.js"
14
+ },
15
+ "./plugins/dotLottie": {
16
+ "types": "./plugins/dotLottie/dotLottie.d.ts",
17
+ "default": "./plugins/dotLottie/dotLottie.umd.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "plugins"
23
+ ],
24
+ "license": "MIT",
25
+ "keywords": [
26
+ "stories",
27
+ "stories SDK",
28
+ "InAppStory"
29
+ ],
30
+ "author": "Inappstory",
31
+ "maintainers": [
32
+ {
33
+ "name": "Inappstory",
34
+ "email": "dev@inappstory.com"
35
+ }
36
+ ],
37
+ "homepage": "https://inappstory.com",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/inappstory/react-web-sdk.git"
41
+ },
42
+ "bugs": "https://github.com/inappstory/react-web-sdk/issues",
43
+ "dependencies": {
44
+ "@inappstory/slide-api": "0.0.13",
45
+ "@inappstory/video-player": "^1.0.1",
46
+ "bowser": "^2.4.0",
47
+ "classnames": "^2.5.1",
48
+ "effector": "^23.2.2",
49
+ "lodash": "^4.17.21",
50
+ "parse-css-sides": "^3.0.1",
51
+ "react-input-mask": "^2.0.4",
52
+ "uuid": "^10.0.0",
53
+ "react": "^18.2.0",
54
+ "react-dom": "^18.2.0"
55
+ },
56
+ "devDependencies": {},
57
+ "scripts": {},
58
+ "browserslist": [
59
+ "Android >= 5",
60
+ "IOS >= 11",
61
+ "Safari >= 11",
62
+ "Chrome >= 49",
63
+ "Firefox >= 31",
64
+ "Samsung >= 5"
65
+ ]
66
+ }
@@ -0,0 +1,28 @@
1
+ export type LottiePlayerEventName = "play" | "complete" | "beforeLoad" | "load" | "minPlayingTimeExpired" | "error";
2
+
3
+ export interface LottiePlayer {
4
+ get frameRate(): number;
5
+ get loop(): boolean;
6
+
7
+ destroy(): void;
8
+ play(): void;
9
+ stop(): void;
10
+ setSpeed(speed: number): void;
11
+ setTimer(duration: number): void;
12
+ clearTimer(): void;
13
+ on(eventName: LottiePlayerEventName, listener: (...args: any[]) => void): this;
14
+ once(eventName: LottiePlayerEventName, listener: (...args: any[]) => void): this;
15
+ off(eventName: LottiePlayerEventName, listener: (...args: any[]) => void): this;
16
+ }
17
+
18
+ export declare class DotLottie {
19
+ createLottiePlayer(
20
+ canvas: HTMLCanvasElement,
21
+ config: {
22
+ url?: string;
23
+ size: number;
24
+ sha1: string;
25
+ durationMinimalMs: number;
26
+ }
27
+ ): LottiePlayer;
28
+ }