@tivio/sdk-react 4.3.0 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -189,7 +189,7 @@ export declare type BadRequestError = Error & {
189
189
 
190
190
  export declare enum BannerItemComponent {
191
191
  CLASSIC = "CLASSIC",
192
- SPLITTED = "SPLITTED"
192
+ SPLIT = "SPLIT"
193
193
  }
194
194
 
195
195
  /**
@@ -407,6 +407,14 @@ export declare type Customizations = {
407
407
  fontSize: number;
408
408
  };
409
409
  };
410
+ SplitBanner: {
411
+ height: string;
412
+ Image: {
413
+ mobile: {
414
+ height: string;
415
+ };
416
+ };
417
+ };
410
418
  Row: {
411
419
  /**
412
420
  * Customizations of Banner component that is used as Row on Customer screen (e.g. WebBannerData)
@@ -443,7 +451,8 @@ export declare type Customizations = {
443
451
  };
444
452
  TagsRow: {
445
453
  /**
446
- * Tags of this tag type is shown in tags row on video detail screen
454
+ * Tags of this tag type is shown in tags row on video detail screen.
455
+ * The same config is used for SplitBanner.
447
456
  */
448
457
  tagTypeId: string;
449
458
  /**
@@ -613,6 +622,13 @@ export declare interface GenericOnCallError {
613
622
  */
614
623
  export declare const getPubSub: () => PubSub;
615
624
 
625
+ /**
626
+ * @public
627
+ */
628
+ export declare type GetPurchasableMonetizationsOptions = {
629
+ includeMonetizationsWithPurchaseDisabled: boolean;
630
+ };
631
+
616
632
  /**
617
633
  * Response from Tivio getPurchaseInfo HTTP endpoint.
618
634
  *
@@ -738,6 +754,11 @@ declare interface IntroMarker {
738
754
  skip: () => void;
739
755
  }
740
756
 
757
+ /**
758
+ * @public
759
+ */
760
+ export declare type ItemComponent = RowItemComponent | BannerItemComponent;
761
+
741
762
  /**
742
763
  * @public
743
764
  */
@@ -774,7 +795,8 @@ export declare enum LangCode {
774
795
  PL = "pl",
775
796
  PT = "pt",
776
797
  SK = "sk",
777
- ES = "es"
798
+ ES = "es",
799
+ HU = "hu"
778
800
  }
779
801
 
780
802
  /**
@@ -907,9 +929,49 @@ export declare enum MONETIZATION_FREQUENCY {
907
929
  DAILY = "DAILY",
908
930
  WEEKLY = "WEEKLY",
909
931
  MONTHLY = "MONTHLY",
932
+ HALF_ANNUALLY = "HALF_ANNUALLY",
910
933
  ANNUALLY = "ANNUALLY"
911
934
  }
912
935
 
936
+ /**
937
+ * @public
938
+ */
939
+ export declare interface MonetizationCardProps {
940
+ subscription: PurchasableMonetization;
941
+ onClick: (subscription: PurchasableMonetization) => void;
942
+ buttonLabel: string;
943
+ purchased: boolean;
944
+ focused?: boolean;
945
+ }
946
+
947
+ /**
948
+ * @public
949
+ */
950
+ export declare interface MonetizationsSelectOverlayData {
951
+ subscriptions?: PurchasableMonetization[];
952
+ /**
953
+ * Item from which monetization select was opened.
954
+ * Note: does not necessarily mean that result purchase will be transaction.
955
+ */
956
+ item?: Video | TvChannel;
957
+ /**
958
+ * If set to true, user is buying voucher.
959
+ * Otherwise, user is making a purchase for himself.
960
+ */
961
+ voucherPurchase?: boolean;
962
+ onPurchase?: () => void;
963
+ onClose?: () => void;
964
+ }
965
+
966
+ /**
967
+ * @public
968
+ */
969
+ export declare type MonetizationsSelectOverlayState = {
970
+ data: MonetizationsSelectOverlayData | null;
971
+ closeMonetizationsSelectOverlay: () => void;
972
+ openMonetizationsSelectOverlay: (data: MonetizationsSelectOverlayData) => void;
973
+ };
974
+
913
975
  /**
914
976
  * @public
915
977
  * @TODO change to enum
@@ -1293,7 +1355,15 @@ export declare interface PurchasableMonetization extends Monetization {
1293
1355
  price?: string | number;
1294
1356
  promotion: Promotion | null;
1295
1357
  frequency?: MONETIZATION_FREQUENCY;
1296
- isPurchased?: boolean;
1358
+ /**
1359
+ * Returns TRUE if subscription is purchased (and not expired) by user.
1360
+ * Returns TRUE if transaction is purchased (and not expired) for transactionItemId.
1361
+ * Returns FALSE otherwise.
1362
+ *
1363
+ * @param transactionItemId id of item for which transaction purchase is checked
1364
+ * @param transactionField type of item (video or tvChannel)
1365
+ */
1366
+ isPurchased(transactionItemId?: string, transactionField?: 'videoId' | 'tvChannelId'): boolean;
1297
1367
  benefits?: Translation[];
1298
1368
  localizedBenefits?: string[];
1299
1369
  /**
@@ -1301,6 +1371,11 @@ export declare interface PurchasableMonetization extends Monetization {
1301
1371
  * still have bought but can't be purchased anymore.
1302
1372
  */
1303
1373
  purchaseDisabled?: boolean;
1374
+ /**
1375
+ * When set to true, users can buy this monetization as a voucher (e.g. to send it as a gift to a friend).
1376
+ * If not set or set to false, users cannot buy it as a voucher.
1377
+ */
1378
+ isPurchasableAsVoucher?: boolean;
1304
1379
  }
1305
1380
 
1306
1381
  /**
@@ -1375,6 +1450,10 @@ export declare type PurchaseEndpointPayload = {
1375
1450
  * Timestamp of the last change of the purchase - in this case it is timestamp when it was paid.
1376
1451
  */
1377
1452
  updated: number;
1453
+ /**
1454
+ * True if delayed payment is confirmed but not charged yet, undefined in all other cases.
1455
+ */
1456
+ isDelayedPayment?: boolean;
1378
1457
  };
1379
1458
  /**
1380
1459
  * Information about the monetization which has been bought by this purchase. Monetization definition may change in time so information provided here
@@ -1387,7 +1466,6 @@ export declare type PurchaseEndpointPayload = {
1387
1466
  currency?: Currency;
1388
1467
  /**
1389
1468
  * Frequency in which the user will be charged.
1390
- * One of "ONE_TIME_PAYMENT", "DAILY", "WEEKLY", "MONTHLY" and "ANNUALLY.
1391
1469
  */
1392
1470
  frequency?: MONETIZATION_FREQUENCY | null;
1393
1471
  /**
@@ -1515,6 +1593,11 @@ export declare interface QerkoCancellationInfo {
1515
1593
  export declare interface QerkoData {
1516
1594
  monetization: PurchasableMonetization;
1517
1595
  item?: Video | TvChannel;
1596
+ /**
1597
+ * If set to true, user is buying voucher.
1598
+ * Otherwise, user is making a purchase for himself.
1599
+ */
1600
+ voucherPurchase?: boolean;
1518
1601
  onPurchase?: () => void;
1519
1602
  onClose?: () => void;
1520
1603
  }
@@ -1523,8 +1606,14 @@ export declare interface QerkoData {
1523
1606
  * @public
1524
1607
  */
1525
1608
  export declare interface QerkoOverlayState {
1609
+ isOpen: boolean;
1526
1610
  data: QerkoData | null;
1527
- openQerkoOverlay: ((data: QerkoData) => void);
1611
+ /**
1612
+ * Prepares data for
1613
+ * Use this in case when you need to split actions
1614
+ */
1615
+ setData: (data: QerkoData) => void;
1616
+ openQerkoOverlay: (data?: QerkoData) => void;
1528
1617
  closeQerkoOverlay: () => void;
1529
1618
  }
1530
1619
 
@@ -1632,17 +1721,7 @@ export declare interface RouterOverridesContextState {
1632
1721
  /**
1633
1722
  * @public
1634
1723
  */
1635
- export declare interface Row {
1636
- id: string;
1637
- rowId: string;
1638
- name: string;
1639
- description?: string;
1640
- itemComponent: RowItemComponent;
1641
- rowComponent: RowComponent;
1642
- assets: Assets;
1643
- type: ScreenRowType;
1644
- isLiveRow: boolean;
1645
- }
1724
+ export declare type Row = RowStandard | RowBanner;
1646
1725
 
1647
1726
  /**
1648
1727
  * @public
@@ -1653,6 +1732,27 @@ export declare enum ROW_ITEM_TYPES {
1653
1732
  TV_CHANNEL = "TV_CHANNEL"
1654
1733
  }
1655
1734
 
1735
+ /**
1736
+ * @private
1737
+ */
1738
+ export declare interface RowBanner extends RowBase {
1739
+ rowComponent: RowComponent.BANNER;
1740
+ itemComponent: BannerItemComponent;
1741
+ }
1742
+
1743
+ /**
1744
+ * @private
1745
+ */
1746
+ declare interface RowBase {
1747
+ id: string;
1748
+ rowId: string;
1749
+ name: string;
1750
+ description?: string;
1751
+ assets: Assets;
1752
+ type: ScreenRowType;
1753
+ isLiveRow: boolean;
1754
+ }
1755
+
1656
1756
  /**
1657
1757
  * @public
1658
1758
  */
@@ -1665,6 +1765,7 @@ export declare enum RowComponent {
1665
1765
  * @public
1666
1766
  */
1667
1767
  export declare interface RowItem extends RowItemAssets {
1768
+ created?: Date;
1668
1769
  itemType: ROW_ITEM_TYPES;
1669
1770
  name?: string;
1670
1771
  description?: string;
@@ -1705,6 +1806,14 @@ export declare type RowItemsSubscription = (rowId: string, cb: (error: Error | n
1705
1806
  hasNextPage: boolean;
1706
1807
  } | null, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => Disposer_2;
1707
1808
 
1809
+ /**
1810
+ * @private
1811
+ */
1812
+ export declare interface RowStandard extends RowBase {
1813
+ rowComponent: RowComponent.ROW;
1814
+ itemComponent: RowItemComponent;
1815
+ }
1816
+
1708
1817
  /**
1709
1818
  * @public
1710
1819
  */
@@ -1792,6 +1901,12 @@ export declare interface Section {
1792
1901
  videos: Video[];
1793
1902
  }
1794
1903
 
1904
+ export declare enum SemanticDate {
1905
+ YESTERDAY = "Yesterday",
1906
+ TODAY = "Today",
1907
+ TOMORROW = "Tomorrow"
1908
+ }
1909
+
1795
1910
  /**
1796
1911
  * Used for entities, that can be global (e.g. asset presets, tag types).
1797
1912
  * Non-global is stored under organizations (in sub-collection), and shown for organization's users and super-admin.
@@ -1911,17 +2026,6 @@ export declare type SubscribeToTaggedVideosOptions = SubscribeToItemsInRowOption
1911
2026
  where?: WhereFilter[];
1912
2027
  };
1913
2028
 
1914
- /**
1915
- * @public
1916
- */
1917
- export declare interface SubscriptionCardProps {
1918
- subscription: PurchasableMonetization;
1919
- onClick: (subscription: PurchasableMonetization) => void;
1920
- buttonLabel: string;
1921
- purchased: boolean;
1922
- focused?: boolean;
1923
- }
1924
-
1925
2029
  declare type SubscriptionInfo = {
1926
2030
  type: 'subscription';
1927
2031
  name: string;
@@ -1929,24 +2033,6 @@ declare type SubscriptionInfo = {
1929
2033
  frequency: string;
1930
2034
  };
1931
2035
 
1932
- /**
1933
- * @public
1934
- */
1935
- export declare interface SubscriptionOverlayData {
1936
- subscriptions?: PurchasableMonetization[];
1937
- onPurchase?: () => void;
1938
- onClose?: () => void;
1939
- }
1940
-
1941
- /**
1942
- * @public
1943
- */
1944
- export declare type SubscriptionOverlayState = {
1945
- data: SubscriptionOverlayData | null;
1946
- closeSubscriptionOverlay: () => void;
1947
- openSubscriptionOverlay: (data: SubscriptionOverlayData) => void;
1948
- };
1949
-
1950
2036
  /**
1951
2037
  * @public
1952
2038
  */
@@ -1961,6 +2047,7 @@ export declare interface Tag extends RowItem {
1961
2047
  isFavorite: boolean;
1962
2048
  addToFavorites: () => void;
1963
2049
  removeFromFavorites: () => void;
2050
+ cover: string;
1964
2051
  }
1965
2052
 
1966
2053
  /**
@@ -2032,6 +2119,7 @@ export declare type TileProps = {
2032
2119
  * Now used for backward compatibility for WebTileGrid. Consider to use it other way.
2033
2120
  */
2034
2121
  containerMargin?: number | string;
2122
+ created?: Date;
2035
2123
  };
2036
2124
 
2037
2125
  /**
@@ -2273,7 +2361,7 @@ export declare type TivioInternalBundle = {
2273
2361
  * @public
2274
2362
  */
2275
2363
  export declare type TivioInternalComponents = {
2276
- PrimaryButton: React_2.ComponentType;
2364
+ PrimaryButton: React_2.ComponentType<any>;
2277
2365
  WebLandingScreen: React_2.ComponentType<{
2278
2366
  logo?: string;
2279
2367
  }>;
@@ -2287,7 +2375,7 @@ export declare type TivioInternalComponents = {
2287
2375
  * @public
2288
2376
  */
2289
2377
  export declare type TivioInternalHooks = {
2290
- useSubscriptionsOverlay: () => SubscriptionOverlayState;
2378
+ useMonetizationsSelectOverlay: () => MonetizationsSelectOverlayState;
2291
2379
  useQerkoOverlay: () => QerkoOverlayState;
2292
2380
  usePurchasesWithVideos: () => {
2293
2381
  purchases: Purchase[];
@@ -2310,15 +2398,12 @@ export declare type TivioInternalHooks = {
2310
2398
  loading: boolean;
2311
2399
  });
2312
2400
  useTvChannel: UseTvChannel;
2313
- usePaymentOverlay: () => {
2314
- videoIdOrUrlName: string | null;
2315
- setVideoIdOrUrlName: (videoIdOrUrlName: string | null) => void;
2316
- };
2317
2401
  useChannelSource: UseChannelSource;
2318
2402
  useUser: () => {
2319
2403
  user: User | null;
2320
2404
  error: string | null;
2321
2405
  isInitialized: boolean;
2406
+ isSignedIn: boolean;
2322
2407
  };
2323
2408
  };
2324
2409
 
@@ -2334,10 +2419,9 @@ export declare type TivioInternalProviders = {
2334
2419
  }>;
2335
2420
  ConfigProvider: React_2.ComponentType;
2336
2421
  UserContextProvider: React_2.ComponentType;
2337
- SubscriptionOverlayContextProvider: React_2.ComponentType;
2422
+ MonetizationsSelectOverlayContextProvider: React_2.ComponentType;
2338
2423
  QerkoOverlayContextProvider: React_2.ComponentType;
2339
2424
  PurchasesWithVideosContextProvider: React_2.ComponentType;
2340
- PaymentOverlayContextProvider: React_2.ComponentType;
2341
2425
  /**
2342
2426
  * @deprecated not used in our app, can be removed when no sdk in production uses it
2343
2427
  */
@@ -2582,8 +2666,14 @@ export declare interface TvChannel extends RowItem {
2582
2666
  logo?: string;
2583
2667
  hls: string;
2584
2668
  dash: string;
2669
+ /**
2670
+ * Returns all transactions and subscriptions applied to this tv channel.
2671
+ * Transactions before subscriptions, sorted by price ascending.
2672
+ */
2673
+ getPurchasableMonetizations(options?: GetPurchasableMonetizationsOptions): PurchasableMonetization[];
2585
2674
  purchasableMonetization: any | null;
2586
2675
  price: number;
2676
+ cover: string;
2587
2677
  }
2588
2678
 
2589
2679
  /**
@@ -2793,6 +2883,10 @@ export declare type User = {
2793
2883
  * Returns "active" (non-expired) subscription purchases
2794
2884
  */
2795
2885
  purchasedSubscriptions: Purchase[];
2886
+ /**
2887
+ * Returns last expired subscription which user can renew or undefined
2888
+ */
2889
+ extendableSubscription?: Purchase;
2796
2890
  isPurchasesInitialized: boolean;
2797
2891
  isSignedIn: boolean;
2798
2892
  email?: string;
@@ -2828,7 +2922,7 @@ export declare enum UserType {
2828
2922
  /**
2829
2923
  * @public
2830
2924
  */
2831
- export declare type UseSearch = <T extends ALGOLIA_INDEX_NAME>(indexName: T, options?: UseSearchOptions) => {
2925
+ export declare type UseSearch = <T extends ALGOLIA_INDEX_NAME>(indexName: T, options?: UseSearchOptions<T>) => {
2832
2926
  search: (query: string) => void;
2833
2927
  pagination: Omit<PaginationInterface<UseSearchResult<T>>, 'loading'> | null;
2834
2928
  error: Error | null;
@@ -2847,15 +2941,26 @@ export declare const useSearch: UseSearch;
2847
2941
  /**
2848
2942
  * @public
2849
2943
  */
2850
- export declare type UseSearchOptions = PaginationOptions & Partial<{
2851
- minQueryLength: number;
2852
- }>;
2944
+ export declare type UseSearchOptions<T extends ALGOLIA_INDEX_NAME = any> = PaginationOptions & {
2945
+ minQueryLength?: number;
2946
+ } & (T extends ALGOLIA_INDEX_NAME.VIDEOS ? UseSearchVideoOptions : {});
2853
2947
 
2854
2948
  /**
2855
2949
  * @public
2856
2950
  */
2857
2951
  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;
2858
2952
 
2953
+ /**
2954
+ * @public
2955
+ */
2956
+ export declare type UseSearchVideoOptions = {
2957
+ /**
2958
+ * If true video tags are awaited before loading is over.
2959
+ * Otherwise, only videos are awaited.
2960
+ */
2961
+ waitForTags?: boolean;
2962
+ };
2963
+
2859
2964
  /**
2860
2965
  * @public
2861
2966
  */
@@ -2903,6 +3008,7 @@ export declare const useUser: () => {
2903
3008
  user: User | null;
2904
3009
  error: string | null;
2905
3010
  isInitialized: boolean;
3011
+ isSignedIn: boolean;
2906
3012
  };
2907
3013
 
2908
3014
  /**
@@ -2972,7 +3078,10 @@ export declare enum VastProvider {
2972
3078
  MALL_TV_PREBID = "malltv-prebid",
2973
3079
  PRIMA = "prima",
2974
3080
  TEST = "test",
2975
- TEST_VPAID = "test-vpaid"
3081
+ TEST_VPAID = "test-vpaid",
3082
+ JOJ_TEST_AD_FORM_PROGRAMMATIC = "joj-test-ad-form-programmatic",
3083
+ JOJ_TEST_TESTER_VASTERIX = "joj-test-tester-vasterix",
3084
+ JOJ_TEST_TESTER_ADFORM_30 = "joj-test-tester-adform-30"
2976
3085
  }
2977
3086
 
2978
3087
  /**
@@ -2984,7 +3093,6 @@ export declare interface Video extends RowItem {
2984
3093
  * @deprecated use assets instead
2985
3094
  */
2986
3095
  cover: string | null;
2987
- created: Date;
2988
3096
  sectionId: string | null;
2989
3097
  channelId: string | null;
2990
3098
  /**
@@ -2996,11 +3104,15 @@ export declare interface Video extends RowItem {
2996
3104
  image: string | null;
2997
3105
  isPlayable: boolean;
2998
3106
  monetizations: Monetization[];
2999
- transactionId?: string;
3000
- sources?: any[];
3107
+ /**
3108
+ * Returns all transactions and subscriptions applied to this video.
3109
+ * Transactions before subscriptions, sorted by price ascending.
3110
+ */
3111
+ getPurchasableMonetizations(options?: GetPurchasableMonetizationsOptions): PurchasableMonetization[];
3112
+ purchasableMonetization: any | null;
3001
3113
  transaction: PurchasableMonetization | undefined;
3002
3114
  subscriptions: PurchasableMonetization[];
3003
- subscriptionIds: string[];
3115
+ sources?: any[];
3004
3116
  isPlaylist: boolean;
3005
3117
  name: string;
3006
3118
  urlNames?: string[];
@@ -3015,7 +3127,6 @@ export declare interface Video extends RowItem {
3015
3127
  detailBanner?: string;
3016
3128
  linkedVideosRaw: any[];
3017
3129
  linkedVideos: LinkedVideo[];
3018
- purchasableMonetization: any | null;
3019
3130
  contentType: VideoContentType | null;
3020
3131
  year?: number;
3021
3132
  episodeNumber?: number;
@@ -3072,6 +3183,14 @@ export declare enum VideoType {
3072
3183
  * Video is a standard single video.
3073
3184
  */
3074
3185
  VIDEO = "VIDEO",
3186
+ /**
3187
+ * Part of video original video like CUT.
3188
+ */
3189
+ CUT = "CUT",
3190
+ /**
3191
+ * Part of video original video like TRAILER.
3192
+ */
3193
+ TRAILER = "TRAILER",
3075
3194
  TV_PROGRAM = "TV_PROGRAM",
3076
3195
  /**
3077
3196
  * Video object represents whole series, e.g. tv show.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "4.3.0",
3
+ "version": "4.4.1",
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.99",
33
+ "@tivio/common": "1.1.101",
34
34
  "dayjs": "^1.11.0",
35
35
  "es7-object-polyfill": "^1.0.1",
36
36
  "firebase": "8.10.1",