@tivio/sdk-react 2.3.4-beta.1 → 2.3.4-beta.2

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 (52) hide show
  1. package/dist/components/ContextProvider.d.ts +3 -0
  2. package/dist/components/PlayerProvider.d.ts +19 -0
  3. package/dist/components/TivioProvider.d.ts +17 -0
  4. package/dist/components/TivioWidget.d.ts +7 -0
  5. package/dist/components/TivioWidgetError.d.ts +10 -0
  6. package/dist/components/TivioWidgetLoader.d.ts +6 -0
  7. package/dist/components/TvTivioProvider.d.ts +7 -0
  8. package/dist/components/context/ChannelsContext.d.ts +6 -0
  9. package/dist/components/context/OrganizationSubscriptionsContext.d.ts +9 -0
  10. package/dist/components/context/PurchasesWithVideosContext.d.ts +9 -0
  11. package/dist/components/context/RowItemsContext.d.ts +7 -0
  12. package/dist/components/context/ScreensContext.d.ts +6 -0
  13. package/dist/components/context/SectionsContext.d.ts +6 -0
  14. package/dist/components/context/UserContext.d.ts +9 -0
  15. package/dist/components/context/VideosContext.d.ts +6 -0
  16. package/dist/components/context/index.d.ts +8 -0
  17. package/dist/components/context/types.d.ts +27 -0
  18. package/dist/components/hooks/contentHooks.d.ts +68 -0
  19. package/dist/components/hooks/index.d.ts +16 -0
  20. package/dist/components/hooks/playerHooks.d.ts +23 -0
  21. package/dist/components/hooks/useCancelSubscription.d.ts +2 -0
  22. package/dist/components/hooks/useError.d.ts +9 -0
  23. package/dist/components/hooks/useFreePurchase.d.ts +4 -0
  24. package/dist/components/hooks/useItemsInRow.d.ts +11 -0
  25. package/dist/components/hooks/useOrganizationSubscriptions.d.ts +4 -0
  26. package/dist/components/hooks/usePurchaseSubscription.d.ts +3 -0
  27. package/dist/components/hooks/usePurchasesWithVideos.d.ts +7 -0
  28. package/dist/components/hooks/useRowsInScreen.d.ts +6 -0
  29. package/dist/components/hooks/useScreen.d.ts +12 -0
  30. package/dist/components/hooks/useScreens.d.ts +5 -0
  31. package/dist/components/hooks/useSearch.d.ts +8 -0
  32. package/dist/components/hooks/useTaggedVideos.d.ts +11 -0
  33. package/dist/components/hooks/useTivio.d.ts +3 -0
  34. package/dist/components/hooks/useTransactionPayment.d.ts +3 -0
  35. package/dist/components/hooks/useUser.d.ts +5 -0
  36. package/dist/config.d.ts +17 -0
  37. package/dist/index.d.ts +23 -0
  38. package/dist/index.js +1 -0
  39. package/dist/services/bundleLoader.d.ts +13 -0
  40. package/dist/services/bundlePromise.d.ts +4 -0
  41. package/dist/services/dependencyResolver.d.ts +23 -0
  42. package/dist/services/logger.d.ts +26 -0
  43. package/dist/services/packageLoader.d.ts +6 -0
  44. package/dist/services/pubSub.d.ts +13 -0
  45. package/dist/services/sentry.d.ts +4 -0
  46. package/dist/services/settings.d.ts +13 -0
  47. package/dist/types/bundle.types.d.ts +206 -0
  48. package/dist/types/common.d.ts +6 -0
  49. package/dist/types/config.types.d.ts +0 -0
  50. package/dist/types/customPlayer.types.d.ts +38 -0
  51. package/dist/types/types.d.ts +176 -0
  52. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const ContextProvider: React.FC;
3
+ export { ContextProvider, };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
+ */
5
+ import React, { FunctionComponentElement } from 'react';
6
+ export declare type PlayerProviderProps = {
7
+ children: React.ReactNode;
8
+ playerWrapperId?: string;
9
+ };
10
+ export declare type Player = any;
11
+ /**
12
+ * value
13
+ * - undefined - you are trying to access this context but are not inside <PlayerContext /> that is a bug
14
+ * - null - we are waiting for remote code
15
+ * - Player - player is ready
16
+ */
17
+ export declare const PlayerContext: React.Context<any>;
18
+ export declare const PlayerProvider: ({ children, playerWrapperId, }: PlayerProviderProps) => FunctionComponentElement<PlayerProviderProps>;
19
+ export declare function withPlayerContext(id: string): <P>(WrappedComponent: React.ComponentType<P>) => (props: P) => JSX.Element;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
+ */
5
+ import React from 'react';
6
+ import { RemoteBundleState } from '../services/bundleLoader';
7
+ import { Config } from '../types/bundle.types';
8
+ export declare type TivioProviderProps = {
9
+ /**
10
+ * This prop must be set only once and not change value afterwards
11
+ */
12
+ conf?: Config;
13
+ children: React.ReactNode;
14
+ };
15
+ declare const TivioContext: React.Context<RemoteBundleState | null>;
16
+ export declare const TivioProvider: React.FC<TivioProviderProps>;
17
+ export { TivioContext, };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
+ */
5
+ import React from 'react';
6
+ import type { TivioWidgetProps, TivioWidgetRef } from '../types/types';
7
+ export declare const TivioWidget: React.ForwardRefExoticComponent<Pick<TivioWidgetProps, "id" | "onEnabled" | "onBlur"> & React.RefAttributes<TivioWidgetRef>>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
+ */
5
+ import React from 'react';
6
+ declare type TivioWidgetErrorProps = {
7
+ error: string | null;
8
+ };
9
+ export declare const TivioWidgetError: React.FC<TivioWidgetErrorProps>;
10
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
+ */
5
+ import React from 'react';
6
+ export declare const TivioWidgetLoader: React.FC;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
+ */
5
+ import React from 'react';
6
+ import { TivioProviderProps } from './TivioProvider';
7
+ export declare const TvTivioProvider: React.FC<TivioProviderProps>;
@@ -0,0 +1,6 @@
1
+ import { Channel } from '@tivio/common';
2
+ import React from 'react';
3
+ import type { DataState } from './types';
4
+ declare const ChannelsContext: React.Context<DataState<Channel>>;
5
+ declare const ChannelsContextProvider: React.FC;
6
+ export { ChannelsContext, ChannelsContextProvider, };
@@ -0,0 +1,9 @@
1
+ import { Monetization } from '@tivio/common';
2
+ import React from 'react';
3
+ interface OrganizationSubscriptionsContextState {
4
+ subscriptions: Monetization[];
5
+ setSubscriptions: (subscriptions: Monetization[]) => void;
6
+ }
7
+ declare const OrganizationSubscriptionsContext: React.Context<OrganizationSubscriptionsContextState>;
8
+ declare const OrganizationSubscriptionsContextProvider: React.FC;
9
+ export { OrganizationSubscriptionsContextProvider, OrganizationSubscriptionsContext, };
@@ -0,0 +1,9 @@
1
+ import { Purchase } from '@tivio/common';
2
+ import React from 'react';
3
+ interface PurchasesWithVideosContextState {
4
+ purchases: Purchase[];
5
+ setPurchases: (purchases: Purchase[]) => void;
6
+ }
7
+ declare const PurchasesWithVideosContext: React.Context<PurchasesWithVideosContextState>;
8
+ declare const PurchasesWithVideosContextProvider: React.FC;
9
+ export { PurchasesWithVideosContext, PurchasesWithVideosContextProvider, };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { DataState } from './types';
3
+ import type { Tag, Video } from '@tivio/common';
4
+ declare type Item = Video | Tag;
5
+ declare const RowItemsContext: React.Context<DataState<Item> | null>;
6
+ declare const RowItemsContextProvider: React.FC;
7
+ export { RowItemsContext, RowItemsContextProvider, };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { SingleDataState } from './types';
3
+ import type { Screen } from '@tivio/common';
4
+ declare const ScreensContext: React.Context<SingleDataState<Screen> | null>;
5
+ declare const ScreensContextProvider: React.FC;
6
+ export { ScreensContext, ScreensContextProvider, };
@@ -0,0 +1,6 @@
1
+ import { Section } from '@tivio/common';
2
+ import React from 'react';
3
+ import { DataState } from './types';
4
+ declare const SectionsContext: React.Context<DataState<Section>>;
5
+ declare const SectionsContextProvider: React.FC;
6
+ export { SectionsContext, SectionsContextProvider, };
@@ -0,0 +1,9 @@
1
+ import { User } from '@tivio/common';
2
+ import React from 'react';
3
+ interface UserContextState {
4
+ user: User | null;
5
+ setUser: (user: User) => void;
6
+ }
7
+ declare const UserContext: React.Context<UserContextState>;
8
+ declare const UserContextProvider: React.FC;
9
+ export { UserContextProvider, UserContext, };
@@ -0,0 +1,6 @@
1
+ import { Video } from '@tivio/common';
2
+ import React from 'react';
3
+ import { DataState } from './types';
4
+ declare const VideosContext: React.Context<DataState<Video>>;
5
+ declare const VideosContextProvider: React.FC;
6
+ export { VideosContext, VideosContextProvider, };
@@ -0,0 +1,8 @@
1
+ export * from './ChannelsContext';
2
+ export * from './OrganizationSubscriptionsContext';
3
+ export * from './PurchasesWithVideosContext';
4
+ export * from './ScreensContext';
5
+ export * from './SectionsContext';
6
+ export * from './UserContext';
7
+ export * from './VideosContext';
8
+ export * from './RowItemsContext';
@@ -0,0 +1,27 @@
1
+ export interface SingleHookData<T> {
2
+ data: T | null;
3
+ error: Error | null;
4
+ isLoading: boolean;
5
+ }
6
+ export interface SingleDataState<T> {
7
+ data: {
8
+ [key: string]: SingleHookData<T>;
9
+ };
10
+ setData: (key: string, data: SingleHookData<T>) => void;
11
+ }
12
+ export declare type PaginationData<T> = {
13
+ items: T[];
14
+ hasNextPage: boolean;
15
+ fetchMore: Function;
16
+ };
17
+ export interface HookData<T> {
18
+ data: PaginationData<T> | null;
19
+ error: Error | null;
20
+ isLoading: boolean;
21
+ }
22
+ export interface DataState<T> {
23
+ data: {
24
+ [key: string]: HookData<T>;
25
+ };
26
+ setData: (key: string, data: HookData<T>) => void;
27
+ }
@@ -0,0 +1,68 @@
1
+ import { Channel, Section, Video, Widget } from '../..';
2
+ import { ChannelsContext, SectionsContext, VideosContext } from '../context';
3
+ /**
4
+ * Use widget
5
+ * @param widgetId - widget id
6
+ */
7
+ declare const useWidget: (widgetId: string) => {
8
+ error: string;
9
+ widget: Widget | null;
10
+ };
11
+ /**
12
+ * Use channel
13
+ * @param channelId - channel id
14
+ */
15
+ declare const useChannel: (channelId: string) => {
16
+ error: string | null;
17
+ data: Channel | null;
18
+ };
19
+ /**
20
+ * Use section
21
+ * @param sectionId - section id
22
+ */
23
+ declare const useSection: (sectionId: string) => {
24
+ error: string | null;
25
+ data: Section | null;
26
+ };
27
+ /**
28
+ * Use video
29
+ * @param videoId - video id
30
+ */
31
+ declare const useVideo: (videoId?: string | undefined) => {
32
+ error: string | null;
33
+ data: Video | null;
34
+ };
35
+ /**
36
+ * Use videos in section
37
+ * @param sectionId - section id
38
+ * @param [limit] - videos count, defaults to 10
39
+ */
40
+ declare const useVideosInSection: (sectionId?: string | undefined, limit?: number) => {
41
+ error: Error | null;
42
+ data: import("../context/types").PaginationData<Video> | null;
43
+ isLoading: boolean;
44
+ };
45
+ /**
46
+ * Use section in channel
47
+ * @param channelId - channel id
48
+ * @param [limit] - sections count, defaults to 10
49
+ */
50
+ declare const useSectionsInChannel: (channelId: string, limit?: number) => {
51
+ error: Error | null;
52
+ data: import("../context/types").PaginationData<import("@tivio/common/dist/types/externalTypes/section").Section> | null;
53
+ isLoading: boolean;
54
+ };
55
+ /**
56
+ * Use channels in widget
57
+ * @param widgetId - widget id
58
+ * @param [limit] - channels count, defaults to 10
59
+ */
60
+ declare const useChannelsInWidget: (widgetId: string, limit?: number) => {
61
+ error: Error | null;
62
+ data: import("../context/types").PaginationData<import("@tivio/common/dist/types/externalTypes/channel").Channel> | null;
63
+ isLoading: boolean;
64
+ };
65
+ declare const useIsLoaded: () => {
66
+ isTivioLoaded: boolean;
67
+ };
68
+ export { useWidget, useChannel, useIsLoaded, useSection, useVideo, useVideosInSection, useSectionsInChannel, useChannelsInWidget, VideosContext, SectionsContext, ChannelsContext, };
@@ -0,0 +1,16 @@
1
+ export * from './useUser';
2
+ export * from './useTaggedVideos';
3
+ export * from './useScreens';
4
+ export * from './useScreen';
5
+ export * from './useSearch';
6
+ export * from './useItemsInRow';
7
+ export * from './useCancelSubscription';
8
+ export * from './useTransactionPayment';
9
+ export * from './usePurchaseSubscription';
10
+ export * from './contentHooks';
11
+ export * from './playerHooks';
12
+ export * from './useOrganizationSubscriptions';
13
+ export * from './usePurchasesWithVideos';
14
+ export * from './useFreePurchase';
15
+ export * from './useRowsInScreen';
16
+ export * from './useTivio';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
+ */
5
+ import type { AdSource, UsePlayerEvent } from '../../types/customPlayer.types';
6
+ import type { BetOffer, Marker } from '../../types/types';
7
+ export declare const usePlayerEvent: UsePlayerEvent;
8
+ export declare const useMarkers: () => Marker[] | null;
9
+ export declare const useBetOffer: () => BetOffer | null;
10
+ interface IntroMarker {
11
+ marker: Marker;
12
+ skip: () => void;
13
+ }
14
+ export declare const useIntro: () => IntroMarker | null;
15
+ export declare const useAd: () => AdSource | null;
16
+ export declare const useCurrentMarker: () => Marker | null;
17
+ export declare const useSeekState: () => boolean | null;
18
+ interface AdSegment {
19
+ remainingMs: number;
20
+ canSeek: boolean;
21
+ }
22
+ export declare const useAdSegment: () => AdSegment | null;
23
+ export {};
@@ -0,0 +1,2 @@
1
+ import { UseCancelSubscription } from '@tivio/common';
2
+ export declare const useCancelSubscription: UseCancelSubscription;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hook for displaying errors in UI components
3
+ */
4
+ declare const useError: () => {
5
+ error: Error | null;
6
+ raiseError: (error: Error) => void;
7
+ resetError: () => void;
8
+ };
9
+ export { useError, };
@@ -0,0 +1,4 @@
1
+ declare const useFreePurchase: () => {
2
+ purchase: (monetizationId: string) => Promise<void>;
3
+ };
4
+ export { useFreePurchase, };
@@ -0,0 +1,11 @@
1
+ import { PaginationInterface, SubscribeToItemsInRowOptions, Tag, Video } from '@tivio/common';
2
+ /**
3
+ * Use row items
4
+ * @param rowId - row ID
5
+ * @param options - subscription options
6
+ */
7
+ declare const useItemsInRow: (rowId: string, options?: SubscribeToItemsInRowOptions) => {
8
+ pagination: PaginationInterface<Video | Tag> | null;
9
+ error: Error | null;
10
+ };
11
+ export { useItemsInRow, };
@@ -0,0 +1,4 @@
1
+ declare const useOrganizationSubscriptions: () => {
2
+ subscriptions: import("@tivio/common").Monetization[];
3
+ };
4
+ export { useOrganizationSubscriptions, };
@@ -0,0 +1,3 @@
1
+ import { QerkoTransaction } from '@tivio/common';
2
+ declare const usePurchaseSubscription: (monetizationId: string) => QerkoTransaction;
3
+ export { usePurchaseSubscription, };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Return purchases with initialized video (purchases[i].video not null)
3
+ */
4
+ declare const usePurchasesWithVideos: () => {
5
+ purchases: import("@tivio/common/dist/types/externalTypes/user").Purchase[];
6
+ };
7
+ export { usePurchasesWithVideos, };
@@ -0,0 +1,6 @@
1
+ import { PaginationInterface, PaginationOptions, Row } from '@tivio/common';
2
+ declare const useRowsInScreen: (screenId: string, options?: PaginationOptions) => {
3
+ pagination: PaginationInterface<Row> | null;
4
+ error: Error | null;
5
+ };
6
+ export { useRowsInScreen, };
@@ -0,0 +1,12 @@
1
+ import { ScreenOptions } from '@tivio/common';
2
+ /**
3
+ * Use app screen
4
+ * @param screenId - screen ID
5
+ * @param options - subscribe to screen options
6
+ */
7
+ declare const useScreen: (screenId: string, options?: ScreenOptions | undefined) => {
8
+ error: Error | null;
9
+ data: import("@tivio/common").Screen | null;
10
+ isLoading: boolean;
11
+ };
12
+ export { useScreen, };
@@ -0,0 +1,5 @@
1
+ import { Screen } from '@tivio/common';
2
+ declare const useScreens: () => {
3
+ screens: Screen[];
4
+ };
5
+ export { useScreens, };
@@ -0,0 +1,8 @@
1
+ import { ALGOLIA_INDEX_NAME, UseSearch } from '@tivio/common';
2
+ /**
3
+ * Full text search that returns entities based on search query.
4
+ * @param indexName - index that search would be performed on ('videos', 'tags', etc.)
5
+ * @param options - pagination options
6
+ */
7
+ export declare const useSearch: UseSearch;
8
+ export { ALGOLIA_INDEX_NAME };
@@ -0,0 +1,11 @@
1
+ import { PaginationInterface, SubscribeToItemsInRowOptions, Video } from '@tivio/common';
2
+ /**
3
+ * Returns videos with given tag ids
4
+ * @param tagIds - tag ids
5
+ * @param options - subscription options
6
+ */
7
+ declare const useTaggedVideos: (tagIds: string[], options?: SubscribeToItemsInRowOptions) => {
8
+ pagination: PaginationInterface<Video> | null;
9
+ error: Error | null;
10
+ };
11
+ export { useTaggedVideos, };
@@ -0,0 +1,3 @@
1
+ declare const useTivioData: () => import("../../types/bundle.types").RemoteBundleState;
2
+ declare const useTivioReadyData: () => import("../../types/bundle.types").RemoteBundleState | null;
3
+ export { useTivioData, useTivioReadyData, };
@@ -0,0 +1,3 @@
1
+ import { QerkoTransaction } from '@tivio/common';
2
+ declare const useTransactionPayment: (videoId: string, monetizationId: string) => QerkoTransaction;
3
+ export { useTransactionPayment, };
@@ -0,0 +1,5 @@
1
+ declare const useUser: () => {
2
+ user: import("@tivio/common/dist/types/externalTypes/user").User | null;
3
+ error: string | null;
4
+ };
5
+ export { useUser, };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
+ */
5
+ import { Config as ExternalConfig, InternalConfig } from './types/bundle.types';
6
+ export declare const defaultConf: {
7
+ secret: null;
8
+ resolverUrl: string;
9
+ disableUnmounting: boolean;
10
+ fetchPackage: import("./services/packageLoader").FetchPackage;
11
+ pubSub: import("./types/bundle.types").PubSub;
12
+ LoaderComponent: import("react").FC<{}>;
13
+ ErrorComponent: import("react").FC<{
14
+ error: string | null;
15
+ }>;
16
+ };
17
+ export declare const createInternalConf: (conf: ExternalConfig | null) => InternalConfig;
@@ -0,0 +1,23 @@
1
+ export { PlayerProvider, withPlayerContext } from './components/PlayerProvider';
2
+ export type { PlayerProviderProps } from './components/PlayerProvider';
3
+ export { bundlePromise } from './services/bundlePromise';
4
+ export * from './components/hooks';
5
+ export * from './components/TivioProvider';
6
+ export * from './components/TivioWidget';
7
+ export * from './components/TivioWidgetError';
8
+ export * from './components/TvTivioProvider';
9
+ export * from './components/TivioWidgetLoader';
10
+ export * from './types/customPlayer.types';
11
+ export * from './services/bundleLoader';
12
+ export * from './services/pubSub';
13
+ export * from './types/types';
14
+ export { Disposer } from './types/common';
15
+ export { Empty } from './types/common';
16
+ export { Nullable } from './types/common';
17
+ export { Config } from './types/bundle.types';
18
+ export { TivioBundle } from './types/bundle.types';
19
+ export { TivioHooks } from './types/bundle.types';
20
+ export { TivioComponents } from './types/bundle.types';
21
+ export { TivioAuth } from './types/bundle.types';
22
+ export { TivioGetters } from './types/bundle.types';
23
+ export { TivioSubscriptions } from './types/bundle.types';