@tivio/sdk-react 3.2.3 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Changelog
4
4
 
5
+ * v3.3.0
6
+ * minor: Add getPlayerCapabilities to getters.
7
+ * patch: Added option to log out via `setUser(null)`, requires @tivio/core-react-dom@2.17.9
8
+ * v3.2.5
9
+ * patch: added recovery flag to QerkoPaymentInfo type
10
+ * patch: bundle.types changes - internal.components.WebVideoScreen
11
+ * patch: types changes - add new onBack prop to WebPlayerProps
12
+ * patch: Refactor useVideo hook, now uses hook from core-react
13
+ * v3.2.4
14
+ * minor: added useApplyInviteCode
15
+ * minor: better errors from useVoucher
16
+ * v3.2.3
17
+ * minor: added usePurchaseRecovery hook
5
18
  * patch: deprecated `useLastVideoByWidgetId`
6
19
  * v3.2.2
7
20
  * minor: useRowsInScreen, useItemsInRow, useTaggedVideos - hasNextPage and loading added to pagination
@@ -140,7 +153,7 @@ import { setUser } from '@tivio/sdk-react'
140
153
  await setUser('userId', { token: 'xxx'})
141
154
 
142
155
  // Log out
143
- await setUser('userId', null)
156
+ await setUser(null)
144
157
  ```
145
158
 
146
159
  ## Tivio widget
package/README.md.bak CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Changelog
4
4
 
5
+ * v3.3.0
6
+ * minor: Add getPlayerCapabilities to getters.
7
+ * patch: Added option to log out via `setUser(null)`, requires @tivio/core-react-dom@2.17.9
8
+ * v3.2.5
9
+ * patch: added recovery flag to QerkoPaymentInfo type
10
+ * patch: bundle.types changes - internal.components.WebVideoScreen
11
+ * patch: types changes - add new onBack prop to WebPlayerProps
12
+ * patch: Refactor useVideo hook, now uses hook from core-react
13
+ * v3.2.4
14
+ * minor: added useApplyInviteCode
15
+ * minor: better errors from useVoucher
16
+ * v3.2.3
17
+ * minor: added usePurchaseRecovery hook
5
18
  * patch: deprecated `useLastVideoByWidgetId`
6
19
  * v3.2.2
7
20
  * minor: useRowsInScreen, useItemsInRow, useTaggedVideos - hasNextPage and loading added to pagination
@@ -144,7 +157,7 @@ import { setUser } from '@tivio/sdk-react'
144
157
  await setUser('userId', { token: 'xxx'})
145
158
 
146
159
  // Log out
147
- await setUser('userId', null)
160
+ await setUser(null)
148
161
  ```
149
162
 
150
163
  ## Tivio widget
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import { RemoteBundleState } from '../services/bundleLoader';
2
+ import type { RemoteBundleState } from '../types/bundle.types';
3
3
  interface Props {
4
4
  bundleState: RemoteBundleState;
5
- children: any;
6
5
  }
7
6
  declare const ContextProvider: React.FC<Props>;
8
7
  export { ContextProvider, };
@@ -3,8 +3,7 @@
3
3
  * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
4
  */
5
5
  import React from 'react';
6
- import { RemoteBundleState } from '../services/bundleLoader';
7
- import { Config } from '../types/bundle.types';
6
+ import type { Config, RemoteBundleState } from '../types/bundle.types';
8
7
  export declare type TivioProviderProps = {
9
8
  /**
10
9
  * This prop must be set only once and not change value afterwards
@@ -29,8 +29,8 @@ declare const useSection: (sectionId: string) => {
29
29
  * @param videoId - video id
30
30
  */
31
31
  declare const useVideo: (videoId?: string | undefined) => {
32
- error: string | null;
33
32
  data: Video | null;
33
+ error: string | null;
34
34
  };
35
35
  /**
36
36
  * Use videos in section
@@ -18,3 +18,4 @@ export * from './useVoucher';
18
18
  export * from './useTivio';
19
19
  export * from './useLastVideoByWidgetId';
20
20
  export * from './useWatchWithoutAdsOffer';
21
+ export * from './useApplyInviteCode';
@@ -0,0 +1,6 @@
1
+ export declare function useApplyInviteCode(): {
2
+ applyInviteCodeResult?: boolean | undefined;
3
+ loading: boolean;
4
+ error?: any;
5
+ applyInviteCode: (code: string) => void;
6
+ };
@@ -2,10 +2,5 @@ export declare function usePurchaseRecovery(): {
2
2
  purchaseRecoveryResult?: string | undefined;
3
3
  loading: boolean;
4
4
  error?: any;
5
- purchaseRecovery: (monetizationId: string) => Promise<string>;
6
- } | {
7
- purchaseRecoveryResult: undefined;
8
- loading: true;
9
- error: undefined;
10
- purchaseRecovery: () => void;
5
+ purchaseRecovery: (monetizationId: string) => void;
11
6
  };
@@ -1,4 +1,4 @@
1
1
  import { QerkoTransaction } from '@tivio/common';
2
- import { NewVoucher } from './useTransactionPayment';
2
+ import { NewVoucher } from '../../types/bundle.types';
3
3
  declare const usePurchaseSubscription: (monetizationId: string, voucher?: NewVoucher | undefined) => QerkoTransaction;
4
4
  export { usePurchaseSubscription, };
@@ -1,12 +1,10 @@
1
1
  import { ScreenOptions } from '@tivio/common';
2
2
  /**
3
+ * @deprecated
4
+ *
3
5
  * Use app screen
4
6
  * @param screenId - screen ID
5
7
  * @param options - subscribe to screen options
6
8
  */
7
- declare const useScreen: (screenId: string, options?: ScreenOptions | undefined) => {
8
- error: Error | null;
9
- data: import("@tivio/common").Screen | null;
10
- isLoading: boolean;
11
- };
9
+ declare const useScreen: (screenId: string, options?: ScreenOptions | undefined) => never;
12
10
  export { useScreen, };
@@ -1,10 +1,5 @@
1
1
  import { QerkoTransaction } from '@tivio/common';
2
- /**
3
- * TODO: Duplicate, because we can't import types from core-js.
4
- */
5
- declare type NewVoucher = {
6
- expirationDate: Date | number;
7
- };
2
+ import { NewVoucher } from '../../types/bundle.types';
8
3
  declare const useTransactionPayment: (videoId: string, monetizationId: string, voucher?: NewVoucher | undefined) => QerkoTransaction;
9
4
  export { useTransactionPayment, };
10
5
  export type { NewVoucher, };
@@ -1,3 +1,8 @@
1
+ export declare type BadRequestError = Error & {
2
+ details?: {
3
+ reason?: 'DOES_NOT_EXIST' | 'EXPIRED' | 'ALREADY_USED';
4
+ };
5
+ };
1
6
  /**
2
7
  * TODO: Should be in core-js, we can't import types from it, though.
3
8
  */
@@ -11,6 +16,10 @@ declare type Voucher = {
11
16
  declare const useVoucher: (voucherId: string) => {
12
17
  activate: (() => Promise<void>) | null;
13
18
  voucher: Voucher | null;
14
- error: Error | null;
19
+ /**
20
+ * You can check error.details if you need to know error type when you want your own error messages
21
+ * (can be one of "DOES_NOT_EXIST", "EXPIRED" and "ALREADY_USED").
22
+ */
23
+ error: Error | BadRequestError | null;
15
24
  };
16
25
  export { useVoucher, };
package/dist/index.d.ts CHANGED
@@ -16,6 +16,5 @@ export * from './types/types';
16
16
  export { Disposer } from './types/common';
17
17
  export { Empty } from './types/common';
18
18
  export { Nullable } from './types/common';
19
- export { Config } from './types/bundle.types';
20
- export { TivioBundle, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, PlayerCapability, Currency, TivioInternalHooks, TivioInternalProviders, } from './types/bundle.types';
19
+ export * from './types/bundle.types';
21
20
  export { setUser } from './services/login';