@tivio/sdk-react 4.4.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -209,6 +209,7 @@ export declare type BannerProps = {
209
209
  borderRadius?: string | number;
210
210
  buttonText?: string;
211
211
  onButtonClick?: () => void;
212
+ numberOfLines?: number;
212
213
  };
213
214
 
214
215
  /**
@@ -324,6 +325,36 @@ export declare type Components = {
324
325
  */
325
326
  export declare type Config = SdkReactConfig;
326
327
 
328
+ /**
329
+ * @public
330
+ */
331
+ export declare interface ConfirmationOverlayContextState {
332
+ isOpen: boolean;
333
+ payload: ConfirmationOverlayPayload | null;
334
+ closeOverlay: () => void;
335
+ openOverlay: (payload: ConfirmationOverlayPayload) => void;
336
+ confirmAction: () => void;
337
+ }
338
+
339
+ /**
340
+ * @public
341
+ */
342
+ export declare type ConfirmationOverlayPayload = SuccessConfirmationOverlayPayload | WarningConfirmationOverlayPayload;
343
+
344
+ /**
345
+ * @public
346
+ */
347
+ export declare interface ConfirmationOverlayPayloadBase {
348
+ title?: string;
349
+ caption?: string;
350
+ onClose?: () => void;
351
+ onConfirm?: () => void;
352
+ /**
353
+ * If configured, then overlay is automatically confirmed after this time.
354
+ */
355
+ automaticConfirmDelayMs?: number;
356
+ }
357
+
327
358
  /**
328
359
  * @public
329
360
  * @TODO move somewhere else
@@ -690,9 +721,10 @@ export declare interface IndexedUser extends IndexedObject {
690
721
  * @public
691
722
  */
692
723
  export declare interface IndexedVideo extends IndexedObject {
693
- organizationPath?: string;
724
+ assets: any;
725
+ organizationPath: string;
694
726
  tagPaths?: string[];
695
- created: Date;
727
+ created: Date | string;
696
728
  isDraft: boolean;
697
729
  type: VideoType;
698
730
  contentType?: VideoContentType;
@@ -880,6 +912,11 @@ declare interface Logger {
880
912
  */
881
913
  declare type LoggerArgs = any[];
882
914
 
915
+ export declare enum LoginRedirect {
916
+ PAYMENT = "payment",
917
+ VOUCHER = "voucher"
918
+ }
919
+
883
920
  /**
884
921
  * @public
885
922
  */
@@ -933,6 +970,14 @@ export declare enum MONETIZATION_FREQUENCY {
933
970
  ANNUALLY = "ANNUALLY"
934
971
  }
935
972
 
973
+ /**
974
+ * @public
975
+ */
976
+ export declare interface MonetizationActions {
977
+ selectMonetization: (monetization: PurchasableMonetization) => void;
978
+ errors: string[];
979
+ }
980
+
936
981
  /**
937
982
  * @public
938
983
  */
@@ -1041,6 +1086,7 @@ declare type OrderByDirection = 'desc' | 'asc';
1041
1086
  * @public
1042
1087
  */
1043
1088
  export declare interface Organization {
1089
+ userProfileConfiguration: any;
1044
1090
  }
1045
1091
 
1046
1092
  /**
@@ -1454,6 +1500,14 @@ export declare type PurchaseEndpointPayload = {
1454
1500
  * True if delayed payment is confirmed but not charged yet, undefined in all other cases.
1455
1501
  */
1456
1502
  isDelayedPayment?: boolean;
1503
+ /**
1504
+ * Purchase status before change.
1505
+ */
1506
+ previousStatus: PurchaseStatus;
1507
+ /**
1508
+ * Purchase status after change.
1509
+ */
1510
+ newStatus: PurchaseStatus;
1457
1511
  };
1458
1512
  /**
1459
1513
  * Information about the monetization which has been bought by this purchase. Monetization definition may change in time so information provided here
@@ -1700,15 +1754,27 @@ export declare type RequiredNullable<T> = {
1700
1754
  * @public
1701
1755
  */
1702
1756
  export declare interface RouterOverrides {
1757
+ getVideoDetailPath: (videoIdOrUrlName: string) => string;
1758
+ getSeriesDetailPath: (tagId: string) => string;
1759
+ getTagPath: (tagId: string) => string;
1760
+ getLoginPath: () => string;
1761
+ getRegistrationPath: () => string;
1762
+ getLivePlayerPath: (tvChannelId: string) => string;
1763
+ getVodPlayerPath: (videoIdOrUrlName: string) => string;
1764
+ getHomePath: (screens: ScreenConfig[]) => string;
1703
1765
  goToVideoDetailPage: (videoIdOrUrlName: string) => void;
1704
1766
  goToSeriesDetailPage: (tagId: string) => void;
1705
1767
  goToTagPage: (tagId: string) => void;
1706
- goToLoginPage: () => void;
1768
+ goToLoginPage: (options?: {
1769
+ manual?: boolean;
1770
+ origin?: LoginRedirect;
1771
+ }) => void;
1707
1772
  goToRegistrationPage: () => void;
1708
1773
  goBack: () => void;
1709
1774
  goLivePlayer: (tvChannelId: string) => void;
1710
1775
  goVodPlayer: (videoIdOrUrlName: string) => void;
1711
- goToHome: () => void;
1776
+ goToHome: (user?: any, activeUserProfileId?: string) => void;
1777
+ goToRoute: (route: string) => void;
1712
1778
  }
1713
1779
 
1714
1780
  /**
@@ -1716,6 +1782,9 @@ export declare interface RouterOverrides {
1716
1782
  */
1717
1783
  export declare interface RouterOverridesContextState {
1718
1784
  routerOverrides: RouterOverrides;
1785
+ Link: React_2.ComponentType<{
1786
+ href?: string;
1787
+ }>;
1719
1788
  }
1720
1789
 
1721
1790
  /**
@@ -1751,6 +1820,7 @@ declare interface RowBase {
1751
1820
  assets: Assets;
1752
1821
  type: ScreenRowType;
1753
1822
  isLiveRow: boolean;
1823
+ numberOfLines?: number;
1754
1824
  }
1755
1825
 
1756
1826
  /**
@@ -1846,6 +1916,11 @@ export { Screen_2 as Screen }
1846
1916
  export declare type ScreenConfig = {
1847
1917
  id: string;
1848
1918
  name: string;
1919
+ route?: string;
1920
+ showForUserProfileType?: {
1921
+ kids: boolean;
1922
+ adults: boolean;
1923
+ };
1849
1924
  };
1850
1925
 
1851
1926
  /**
@@ -2033,11 +2108,20 @@ declare type SubscriptionInfo = {
2033
2108
  frequency: string;
2034
2109
  };
2035
2110
 
2111
+ /**
2112
+ * @public
2113
+ */
2114
+ export declare interface SuccessConfirmationOverlayPayload extends ConfirmationOverlayPayloadBase {
2115
+ type: 'success';
2116
+ confirmButtonText?: string;
2117
+ }
2118
+
2036
2119
  /**
2037
2120
  * @public
2038
2121
  */
2039
2122
  export declare interface Tag extends RowItem {
2040
2123
  id: string;
2124
+ itemType: ROW_ITEM_TYPES.TAG;
2041
2125
  tagId: string;
2042
2126
  type?: string | null;
2043
2127
  metadata?: any[];
@@ -2100,7 +2184,6 @@ export declare type TileProps = {
2100
2184
  cover: string;
2101
2185
  bottomLabel: string;
2102
2186
  bottomLabelAreaHeight: number;
2103
- bottomLabelTextLinesCount: number;
2104
2187
  innerLabel: string;
2105
2188
  duration: string;
2106
2189
  price: string | null;
@@ -2120,6 +2203,7 @@ export declare type TileProps = {
2120
2203
  */
2121
2204
  containerMargin?: number | string;
2122
2205
  created?: Date;
2206
+ numberOfLines?: number;
2123
2207
  };
2124
2208
 
2125
2209
  /**
@@ -2255,7 +2339,8 @@ export declare interface TivioConfig {
2255
2339
  language: LangCode;
2256
2340
  debug?: boolean;
2257
2341
  verbose?: boolean;
2258
- firebaseApp?: any;
2342
+ firebaseApp?: any | null;
2343
+ firestore?: any | null;
2259
2344
  currency: Currency;
2260
2345
  /**
2261
2346
  * Configuration for GDPR consent collection (CMP)
@@ -2369,6 +2454,10 @@ export declare type TivioInternalComponents = {
2369
2454
  videoIdOrUrlName: string;
2370
2455
  }>;
2371
2456
  WebSeriesDetailScreen: React_2.ComponentType<WebSeriesDetailScreenProps>;
2457
+ WebConfirmationOverlay: React_2.ComponentType;
2458
+ UserProfilesOverlay: React_2.ComponentType<{
2459
+ onClose: (selectedProfileId: string) => void;
2460
+ }>;
2372
2461
  };
2373
2462
 
2374
2463
  /**
@@ -2377,6 +2466,9 @@ export declare type TivioInternalComponents = {
2377
2466
  export declare type TivioInternalHooks = {
2378
2467
  useMonetizationsSelectOverlay: () => MonetizationsSelectOverlayState;
2379
2468
  useQerkoOverlay: () => QerkoOverlayState;
2469
+ useConfirmationOverlay: () => ConfirmationOverlayContextState;
2470
+ useMonetizationActions: () => MonetizationActions;
2471
+ useCancelSubscriptions: () => UseCancelSubscriptionsResult;
2380
2472
  usePurchasesWithVideos: () => {
2381
2473
  purchases: Purchase[];
2382
2474
  };
@@ -2405,6 +2497,7 @@ export declare type TivioInternalHooks = {
2405
2497
  isInitialized: boolean;
2406
2498
  isSignedIn: boolean;
2407
2499
  };
2500
+ useOrganization: () => Organization | null;
2408
2501
  };
2409
2502
 
2410
2503
  /**
@@ -2426,7 +2519,10 @@ export declare type TivioInternalProviders = {
2426
2519
  * @deprecated not used in our app, can be removed when no sdk in production uses it
2427
2520
  */
2428
2521
  OrganizationSubscriptionsContextProvider: React_2.ComponentType;
2429
- RouterOverridesContextProvider: React_2.ComponentType<RouterOverridesContextState>;
2522
+ RouterOverridesContextProvider: React_2.ComponentType<{
2523
+ state: RouterOverridesContextState;
2524
+ }>;
2525
+ ConfirmationOverlayContextProvider: React_2.ComponentType;
2430
2526
  };
2431
2527
 
2432
2528
  /**
@@ -2657,10 +2753,10 @@ export declare type TvAppProps = {
2657
2753
  * @public
2658
2754
  */
2659
2755
  export declare interface TvChannel extends RowItem {
2660
- name: string;
2661
2756
  id: string;
2757
+ itemType: ROW_ITEM_TYPES.TV_CHANNEL;
2758
+ name: string;
2662
2759
  path: string;
2663
- itemType: ROW_ITEM_TYPES;
2664
2760
  country?: string;
2665
2761
  filters: string[];
2666
2762
  logo?: string;
@@ -2674,6 +2770,7 @@ export declare interface TvChannel extends RowItem {
2674
2770
  purchasableMonetization: any | null;
2675
2771
  price: number;
2676
2772
  cover: string;
2773
+ isPlayable: boolean;
2677
2774
  }
2678
2775
 
2679
2776
  /**
@@ -2767,6 +2864,15 @@ export declare type UseCancelSubscription = (subscriptionId: string) => {
2767
2864
  */
2768
2865
  export declare const useCancelSubscription: UseCancelSubscription;
2769
2866
 
2867
+ /**
2868
+ * @public
2869
+ */
2870
+ export declare interface UseCancelSubscriptionsResult {
2871
+ cancelSubscriptions: (subscriptionIds: string[]) => Promise<void>;
2872
+ cancellationInfos: QerkoCancellationInfo[];
2873
+ errors: string[];
2874
+ }
2875
+
2770
2876
  /**
2771
2877
  * @public
2772
2878
  */
@@ -2883,8 +2989,13 @@ export declare type User = {
2883
2989
  * Returns "active" (non-expired) subscription purchases
2884
2990
  */
2885
2991
  purchasedSubscriptions: Purchase[];
2992
+ /**
2993
+ * Returns last expired subscription which user can renew or undefined
2994
+ */
2995
+ extendableSubscription?: Purchase;
2886
2996
  isPurchasesInitialized: boolean;
2887
2997
  isSignedIn: boolean;
2998
+ isReady: boolean;
2888
2999
  email?: string;
2889
3000
  type?: UserType;
2890
3001
  photoURL: string | null;
@@ -2892,6 +3003,10 @@ export declare type User = {
2892
3003
  authUserId?: string;
2893
3004
  favorites: any[];
2894
3005
  watchedPositions: any[];
3006
+ profiles: any[];
3007
+ activeUserProfileId: string | null;
3008
+ createUserProfile: (request: any) => Promise<void>;
3009
+ setActiveUserProfileId: (id: string) => void;
2895
3010
  };
2896
3011
 
2897
3012
  /**
@@ -2918,7 +3033,7 @@ export declare enum UserType {
2918
3033
  /**
2919
3034
  * @public
2920
3035
  */
2921
- export declare type UseSearch = <T extends ALGOLIA_INDEX_NAME>(indexName: T, options?: UseSearchOptions) => {
3036
+ export declare type UseSearch = <T extends ALGOLIA_INDEX_NAME>(indexName: T, options?: UseSearchOptions<T>) => {
2922
3037
  search: (query: string) => void;
2923
3038
  pagination: Omit<PaginationInterface<UseSearchResult<T>>, 'loading'> | null;
2924
3039
  error: Error | null;
@@ -2937,14 +3052,25 @@ export declare const useSearch: UseSearch;
2937
3052
  /**
2938
3053
  * @public
2939
3054
  */
2940
- export declare type UseSearchOptions = PaginationOptions & Partial<{
2941
- minQueryLength: number;
2942
- }>;
3055
+ export declare type UseSearchOptions<T extends ALGOLIA_INDEX_NAME = any> = PaginationOptions & {
3056
+ minQueryLength?: number;
3057
+ } & (T extends ALGOLIA_INDEX_NAME.VIDEOS | ALGOLIA_INDEX_NAME.VIDEOSDESC ? UseSearchVideoOptions : {});
3058
+
3059
+ /**
3060
+ * @public
3061
+ */
3062
+ export declare type UseSearchResult<T extends ALGOLIA_INDEX_NAME> = T extends ALGOLIA_INDEX_NAME.VIDEOS | ALGOLIA_INDEX_NAME.VIDEOSDESC ? Video : T extends ALGOLIA_INDEX_NAME.TAGS ? Tag : T extends ALGOLIA_INDEX_NAME.TV_CHANNELS ? TvChannel : unknown;
2943
3063
 
2944
3064
  /**
2945
3065
  * @public
2946
3066
  */
2947
- export declare type UseSearchResult<T extends ALGOLIA_INDEX_NAME> = T extends ALGOLIA_INDEX_NAME.VIDEOS ? Video : T extends ALGOLIA_INDEX_NAME.TAGS ? Tag : T extends ALGOLIA_INDEX_NAME.TV_CHANNELS ? TvChannel : unknown;
3067
+ export declare type UseSearchVideoOptions = {
3068
+ /**
3069
+ * If true video tags are awaited before loading is over.
3070
+ * Otherwise, only videos are awaited.
3071
+ */
3072
+ waitForTags?: boolean;
3073
+ };
2948
3074
 
2949
3075
  /**
2950
3076
  * @public
@@ -3074,6 +3200,7 @@ export declare enum VastProvider {
3074
3200
  */
3075
3201
  export declare interface Video extends RowItem {
3076
3202
  id: string;
3203
+ itemType: ROW_ITEM_TYPES.VIDEO;
3077
3204
  /**
3078
3205
  * @deprecated use assets instead
3079
3206
  */
@@ -3234,6 +3361,15 @@ declare type Voucher = {
3234
3361
  voucherInfo: SubscriptionInfo | TransactionInfo;
3235
3362
  };
3236
3363
 
3364
+ /**
3365
+ * @public
3366
+ */
3367
+ export declare interface WarningConfirmationOverlayPayload extends ConfirmationOverlayPayloadBase {
3368
+ type: 'warning';
3369
+ confirmButtonText?: string;
3370
+ closeButtonText?: string;
3371
+ }
3372
+
3237
3373
  /**
3238
3374
  * @public
3239
3375
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -30,7 +30,7 @@
30
30
  "@material-ui/core": "^4.11.2",
31
31
  "@material-ui/icons": "^4.11.2",
32
32
  "@sentry/browser": "^6.1.0",
33
- "@tivio/common": "1.1.100",
33
+ "@tivio/common": "1.1.102",
34
34
  "dayjs": "^1.11.0",
35
35
  "es7-object-polyfill": "^1.0.1",
36
36
  "firebase": "8.10.1",