@tivio/sdk-react 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -6,6 +6,13 @@ settings in the administration of Tivio Studio while having the freedom to build
6
6
 
7
7
  ## Changelog
8
8
 
9
+ * v4.4.0
10
+ * minor: PrimaryButton component props type set to any for now
11
+ * patch: isPurchasableAsVoucher added to PurchasableMonetization
12
+ * patch: voucherPurchase flag added to purchase overlays
13
+ * patch: item added to MonetizationsSelectOverlayData
14
+ * minor: added hungarian language to `LangCode` enum
15
+
9
16
  * v4.3.0:
10
17
  * minor: add GetPurchaseInfoResponse and PurchaseEndpointPayload to exported types
11
18
  * minor: support for disabling purchase of specified subscriptions (new param in useOrganizationSubscriptions hook)
package/README.md.bak CHANGED
@@ -6,6 +6,13 @@ settings in the administration of Tivio Studio while having the freedom to build
6
6
 
7
7
  ## Changelog
8
8
 
9
+ * v4.4.0
10
+ * minor: PrimaryButton component props type set to any for now
11
+ * patch: isPurchasableAsVoucher added to PurchasableMonetization
12
+ * patch: voucherPurchase flag added to purchase overlays
13
+ * patch: item added to MonetizationsSelectOverlayData
14
+ * minor: added hungarian language to `LangCode` enum
15
+
9
16
  * v4.3.0:
10
17
  * minor: add GetPurchaseInfoResponse and PurchaseEndpointPayload to exported types
11
18
  * minor: support for disabling purchase of specified subscriptions (new param in useOrganizationSubscriptions hook)
package/dist/index.d.ts CHANGED
@@ -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
  /**
@@ -476,6 +476,13 @@ export declare interface GenericOnCallError {
476
476
  */
477
477
  export declare const getPubSub: () => PubSub;
478
478
 
479
+ /**
480
+ * @public
481
+ */
482
+ export declare type GetPurchasableMonetizationsOptions = {
483
+ includeMonetizationsWithPurchaseDisabled: boolean;
484
+ };
485
+
479
486
  /**
480
487
  * Response from Tivio getPurchaseInfo HTTP endpoint.
481
488
  *
@@ -594,6 +601,11 @@ declare interface IntroMarker {
594
601
  skip: () => void;
595
602
  }
596
603
 
604
+ /**
605
+ * @public
606
+ */
607
+ export declare type ItemComponent = RowItemComponent | BannerItemComponent;
608
+
597
609
  /**
598
610
  * @public
599
611
  */
@@ -630,7 +642,8 @@ export declare enum LangCode {
630
642
  PL = "pl",
631
643
  PT = "pt",
632
644
  SK = "sk",
633
- ES = "es"
645
+ ES = "es",
646
+ HU = "hu"
634
647
  }
635
648
 
636
649
  /**
@@ -763,9 +776,49 @@ export declare enum MONETIZATION_FREQUENCY {
763
776
  DAILY = "DAILY",
764
777
  WEEKLY = "WEEKLY",
765
778
  MONTHLY = "MONTHLY",
779
+ HALF_ANNUALLY = "HALF_ANNUALLY",
766
780
  ANNUALLY = "ANNUALLY"
767
781
  }
768
782
 
783
+ /**
784
+ * @public
785
+ */
786
+ export declare interface MonetizationCardProps {
787
+ subscription: PurchasableMonetization;
788
+ onClick: (subscription: PurchasableMonetization) => void;
789
+ buttonLabel: string;
790
+ purchased: boolean;
791
+ focused?: boolean;
792
+ }
793
+
794
+ /**
795
+ * @public
796
+ */
797
+ export declare interface MonetizationsSelectOverlayData {
798
+ subscriptions?: PurchasableMonetization[];
799
+ /**
800
+ * Item from which monetization select was opened.
801
+ * Note: does not necessarily mean that result purchase will be transaction.
802
+ */
803
+ item?: Video | TvChannel;
804
+ /**
805
+ * If set to true, user is buying voucher.
806
+ * Otherwise, user is making a purchase for himself.
807
+ */
808
+ voucherPurchase?: boolean;
809
+ onPurchase?: () => void;
810
+ onClose?: () => void;
811
+ }
812
+
813
+ /**
814
+ * @public
815
+ */
816
+ export declare type MonetizationsSelectOverlayState = {
817
+ data: MonetizationsSelectOverlayData | null;
818
+ closeMonetizationsSelectOverlay: () => void;
819
+ openMonetizationsSelectOverlay: (data: MonetizationsSelectOverlayData) => void;
820
+ };
821
+
769
822
  /**
770
823
  * @public
771
824
  * @TODO change to enum
@@ -1139,7 +1192,15 @@ export declare interface PurchasableMonetization extends Monetization {
1139
1192
  price?: string | number;
1140
1193
  promotion: Promotion | null;
1141
1194
  frequency?: MONETIZATION_FREQUENCY;
1142
- isPurchased?: boolean;
1195
+ /**
1196
+ * Returns TRUE if subscription is purchased (and not expired) by user.
1197
+ * Returns TRUE if transaction is purchased (and not expired) for transactionItemId.
1198
+ * Returns FALSE otherwise.
1199
+ *
1200
+ * @param transactionItemId id of item for which transaction purchase is checked
1201
+ * @param transactionField type of item (video or tvChannel)
1202
+ */
1203
+ isPurchased(transactionItemId?: string, transactionField?: 'videoId' | 'tvChannelId'): boolean;
1143
1204
  benefits?: Translation[];
1144
1205
  localizedBenefits?: string[];
1145
1206
  /**
@@ -1147,6 +1208,11 @@ export declare interface PurchasableMonetization extends Monetization {
1147
1208
  * still have bought but can't be purchased anymore.
1148
1209
  */
1149
1210
  purchaseDisabled?: boolean;
1211
+ /**
1212
+ * When set to true, users can buy this monetization as a voucher (e.g. to send it as a gift to a friend).
1213
+ * If not set or set to false, users cannot buy it as a voucher.
1214
+ */
1215
+ isPurchasableAsVoucher?: boolean;
1150
1216
  }
1151
1217
 
1152
1218
  /**
@@ -1221,6 +1287,10 @@ export declare type PurchaseEndpointPayload = {
1221
1287
  * Timestamp of the last change of the purchase - in this case it is timestamp when it was paid.
1222
1288
  */
1223
1289
  updated: number;
1290
+ /**
1291
+ * True if delayed payment is confirmed but not charged yet, undefined in all other cases.
1292
+ */
1293
+ isDelayedPayment?: boolean;
1224
1294
  };
1225
1295
  /**
1226
1296
  * Information about the monetization which has been bought by this purchase. Monetization definition may change in time so information provided here
@@ -1233,7 +1303,6 @@ export declare type PurchaseEndpointPayload = {
1233
1303
  currency?: Currency;
1234
1304
  /**
1235
1305
  * Frequency in which the user will be charged.
1236
- * One of "ONE_TIME_PAYMENT", "DAILY", "WEEKLY", "MONTHLY" and "ANNUALLY.
1237
1306
  */
1238
1307
  frequency?: MONETIZATION_FREQUENCY | null;
1239
1308
  /**
@@ -1361,6 +1430,11 @@ export declare interface QerkoCancellationInfo {
1361
1430
  export declare interface QerkoData {
1362
1431
  monetization: PurchasableMonetization;
1363
1432
  item?: Video | TvChannel;
1433
+ /**
1434
+ * If set to true, user is buying voucher.
1435
+ * Otherwise, user is making a purchase for himself.
1436
+ */
1437
+ voucherPurchase?: boolean;
1364
1438
  onPurchase?: () => void;
1365
1439
  onClose?: () => void;
1366
1440
  }
@@ -1369,8 +1443,14 @@ export declare interface QerkoData {
1369
1443
  * @public
1370
1444
  */
1371
1445
  export declare interface QerkoOverlayState {
1446
+ isOpen: boolean;
1372
1447
  data: QerkoData | null;
1373
- openQerkoOverlay: ((data: QerkoData) => void);
1448
+ /**
1449
+ * Prepares data for
1450
+ * Use this in case when you need to split actions
1451
+ */
1452
+ setData: (data: QerkoData) => void;
1453
+ openQerkoOverlay: (data?: QerkoData) => void;
1374
1454
  closeQerkoOverlay: () => void;
1375
1455
  }
1376
1456
 
@@ -1469,17 +1549,7 @@ export declare interface RouterOverridesContextState {
1469
1549
  /**
1470
1550
  * @public
1471
1551
  */
1472
- export declare interface Row {
1473
- id: string;
1474
- rowId: string;
1475
- name: string;
1476
- description?: string;
1477
- itemComponent: RowItemComponent;
1478
- rowComponent: RowComponent;
1479
- assets: Assets;
1480
- type: ScreenRowType;
1481
- isLiveRow: boolean;
1482
- }
1552
+ export declare type Row = RowStandard | RowBanner;
1483
1553
 
1484
1554
  /**
1485
1555
  * @public
@@ -1490,6 +1560,27 @@ export declare enum ROW_ITEM_TYPES {
1490
1560
  TV_CHANNEL = "TV_CHANNEL"
1491
1561
  }
1492
1562
 
1563
+ /**
1564
+ * @private
1565
+ */
1566
+ export declare interface RowBanner extends RowBase {
1567
+ rowComponent: RowComponent.BANNER;
1568
+ itemComponent: BannerItemComponent;
1569
+ }
1570
+
1571
+ /**
1572
+ * @private
1573
+ */
1574
+ declare interface RowBase {
1575
+ id: string;
1576
+ rowId: string;
1577
+ name: string;
1578
+ description?: string;
1579
+ assets: Assets;
1580
+ type: ScreenRowType;
1581
+ isLiveRow: boolean;
1582
+ }
1583
+
1493
1584
  /**
1494
1585
  * @public
1495
1586
  */
@@ -1502,6 +1593,7 @@ export declare enum RowComponent {
1502
1593
  * @public
1503
1594
  */
1504
1595
  export declare interface RowItem extends RowItemAssets {
1596
+ created?: Date;
1505
1597
  itemType: ROW_ITEM_TYPES;
1506
1598
  name?: string;
1507
1599
  description?: string;
@@ -1542,6 +1634,14 @@ export declare type RowItemsSubscription = (rowId: string, cb: (error: Error | n
1542
1634
  hasNextPage: boolean;
1543
1635
  } | null, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => Disposer_2;
1544
1636
 
1637
+ /**
1638
+ * @private
1639
+ */
1640
+ export declare interface RowStandard extends RowBase {
1641
+ rowComponent: RowComponent.ROW;
1642
+ itemComponent: RowItemComponent;
1643
+ }
1644
+
1545
1645
  /**
1546
1646
  * @public
1547
1647
  */
@@ -1629,6 +1729,12 @@ export declare interface Section {
1629
1729
  videos: Video[];
1630
1730
  }
1631
1731
 
1732
+ export declare enum SemanticDate {
1733
+ YESTERDAY = "Yesterday",
1734
+ TODAY = "Today",
1735
+ TOMORROW = "Tomorrow"
1736
+ }
1737
+
1632
1738
  /**
1633
1739
  * Used for entities, that can be global (e.g. asset presets, tag types).
1634
1740
  * Non-global is stored under organizations (in sub-collection), and shown for organization's users and super-admin.
@@ -1748,17 +1854,6 @@ export declare type SubscribeToTaggedVideosOptions = SubscribeToItemsInRowOption
1748
1854
  where?: WhereFilter[];
1749
1855
  };
1750
1856
 
1751
- /**
1752
- * @public
1753
- */
1754
- export declare interface SubscriptionCardProps {
1755
- subscription: PurchasableMonetization;
1756
- onClick: (subscription: PurchasableMonetization) => void;
1757
- buttonLabel: string;
1758
- purchased: boolean;
1759
- focused?: boolean;
1760
- }
1761
-
1762
1857
  declare type SubscriptionInfo = {
1763
1858
  type: 'subscription';
1764
1859
  name: string;
@@ -1766,24 +1861,6 @@ declare type SubscriptionInfo = {
1766
1861
  frequency: string;
1767
1862
  };
1768
1863
 
1769
- /**
1770
- * @public
1771
- */
1772
- export declare interface SubscriptionOverlayData {
1773
- subscriptions?: PurchasableMonetization[];
1774
- onPurchase?: () => void;
1775
- onClose?: () => void;
1776
- }
1777
-
1778
- /**
1779
- * @public
1780
- */
1781
- export declare type SubscriptionOverlayState = {
1782
- data: SubscriptionOverlayData | null;
1783
- closeSubscriptionOverlay: () => void;
1784
- openSubscriptionOverlay: (data: SubscriptionOverlayData) => void;
1785
- };
1786
-
1787
1864
  /**
1788
1865
  * @public
1789
1866
  */
@@ -1798,6 +1875,7 @@ export declare interface Tag extends RowItem {
1798
1875
  isFavorite: boolean;
1799
1876
  addToFavorites: () => void;
1800
1877
  removeFromFavorites: () => void;
1878
+ cover: string;
1801
1879
  }
1802
1880
 
1803
1881
  /**
@@ -1831,6 +1909,7 @@ export declare type TileProps = {
1831
1909
  * Now used for backward compatibility for WebTileGrid. Consider to use it other way.
1832
1910
  */
1833
1911
  containerMargin?: number | string;
1912
+ created?: Date;
1834
1913
  };
1835
1914
 
1836
1915
  /**
@@ -2040,7 +2119,7 @@ export declare type TivioInternalBundle = {
2040
2119
  * @public
2041
2120
  */
2042
2121
  export declare type TivioInternalComponents = {
2043
- PrimaryButton: React_2.ComponentType;
2122
+ PrimaryButton: React_2.ComponentType<any>;
2044
2123
  WebLandingScreen: React_2.ComponentType<{
2045
2124
  logo?: string;
2046
2125
  }>;
@@ -2054,7 +2133,7 @@ export declare type TivioInternalComponents = {
2054
2133
  * @public
2055
2134
  */
2056
2135
  export declare type TivioInternalHooks = {
2057
- useSubscriptionsOverlay: () => SubscriptionOverlayState;
2136
+ useMonetizationsSelectOverlay: () => MonetizationsSelectOverlayState;
2058
2137
  useQerkoOverlay: () => QerkoOverlayState;
2059
2138
  usePurchasesWithVideos: () => {
2060
2139
  purchases: Purchase[];
@@ -2077,15 +2156,12 @@ export declare type TivioInternalHooks = {
2077
2156
  loading: boolean;
2078
2157
  });
2079
2158
  useTvChannel: UseTvChannel;
2080
- usePaymentOverlay: () => {
2081
- videoIdOrUrlName: string | null;
2082
- setVideoIdOrUrlName: (videoIdOrUrlName: string | null) => void;
2083
- };
2084
2159
  useChannelSource: UseChannelSource;
2085
2160
  useUser: () => {
2086
2161
  user: User | null;
2087
2162
  error: string | null;
2088
2163
  isInitialized: boolean;
2164
+ isSignedIn: boolean;
2089
2165
  };
2090
2166
  };
2091
2167
 
@@ -2101,10 +2177,9 @@ export declare type TivioInternalProviders = {
2101
2177
  }>;
2102
2178
  ConfigProvider: React_2.ComponentType;
2103
2179
  UserContextProvider: React_2.ComponentType;
2104
- SubscriptionOverlayContextProvider: React_2.ComponentType;
2180
+ MonetizationsSelectOverlayContextProvider: React_2.ComponentType;
2105
2181
  QerkoOverlayContextProvider: React_2.ComponentType;
2106
2182
  PurchasesWithVideosContextProvider: React_2.ComponentType;
2107
- PaymentOverlayContextProvider: React_2.ComponentType;
2108
2183
  /**
2109
2184
  * @deprecated not used in our app, can be removed when no sdk in production uses it
2110
2185
  */
@@ -2341,8 +2416,14 @@ export declare interface TvChannel extends RowItem {
2341
2416
  logo?: string;
2342
2417
  hls: string;
2343
2418
  dash: string;
2419
+ /**
2420
+ * Returns all transactions and subscriptions applied to this tv channel.
2421
+ * Transactions before subscriptions, sorted by price ascending.
2422
+ */
2423
+ getPurchasableMonetizations(options?: GetPurchasableMonetizationsOptions): PurchasableMonetization[];
2344
2424
  purchasableMonetization: any | null;
2345
2425
  price: number;
2426
+ cover: string;
2346
2427
  }
2347
2428
 
2348
2429
  /**
@@ -2662,6 +2743,7 @@ export declare const useUser: () => {
2662
2743
  user: User | null;
2663
2744
  error: string | null;
2664
2745
  isInitialized: boolean;
2746
+ isSignedIn: boolean;
2665
2747
  };
2666
2748
 
2667
2749
  /**
@@ -2731,7 +2813,10 @@ export declare enum VastProvider {
2731
2813
  MALL_TV_PREBID = "malltv-prebid",
2732
2814
  PRIMA = "prima",
2733
2815
  TEST = "test",
2734
- TEST_VPAID = "test-vpaid"
2816
+ TEST_VPAID = "test-vpaid",
2817
+ JOJ_TEST_AD_FORM_PROGRAMMATIC = "joj-test-ad-form-programmatic",
2818
+ JOJ_TEST_TESTER_VASTERIX = "joj-test-tester-vasterix",
2819
+ JOJ_TEST_TESTER_ADFORM_30 = "joj-test-tester-adform-30"
2735
2820
  }
2736
2821
 
2737
2822
  /**
@@ -2743,7 +2828,6 @@ export declare interface Video extends RowItem {
2743
2828
  * @deprecated use assets instead
2744
2829
  */
2745
2830
  cover: string | null;
2746
- created: Date;
2747
2831
  sectionId: string | null;
2748
2832
  channelId: string | null;
2749
2833
  /**
@@ -2755,11 +2839,15 @@ export declare interface Video extends RowItem {
2755
2839
  image: string | null;
2756
2840
  isPlayable: boolean;
2757
2841
  monetizations: Monetization[];
2758
- transactionId?: string;
2759
- sources?: any[];
2842
+ /**
2843
+ * Returns all transactions and subscriptions applied to this video.
2844
+ * Transactions before subscriptions, sorted by price ascending.
2845
+ */
2846
+ getPurchasableMonetizations(options?: GetPurchasableMonetizationsOptions): PurchasableMonetization[];
2847
+ purchasableMonetization: any | null;
2760
2848
  transaction: PurchasableMonetization | undefined;
2761
2849
  subscriptions: PurchasableMonetization[];
2762
- subscriptionIds: string[];
2850
+ sources?: any[];
2763
2851
  isPlaylist: boolean;
2764
2852
  name: string;
2765
2853
  urlNames?: string[];
@@ -2774,7 +2862,6 @@ export declare interface Video extends RowItem {
2774
2862
  detailBanner?: string;
2775
2863
  linkedVideosRaw: any[];
2776
2864
  linkedVideos: LinkedVideo[];
2777
- purchasableMonetization: any | null;
2778
2865
  contentType: VideoContentType | null;
2779
2866
  year?: number;
2780
2867
  episodeNumber?: number;
@@ -2831,6 +2918,14 @@ export declare enum VideoType {
2831
2918
  * Video is a standard single video.
2832
2919
  */
2833
2920
  VIDEO = "VIDEO",
2921
+ /**
2922
+ * Part of video original video like CUT.
2923
+ */
2924
+ CUT = "CUT",
2925
+ /**
2926
+ * Part of video original video like TRAILER.
2927
+ */
2928
+ TRAILER = "TRAILER",
2834
2929
  TV_PROGRAM = "TV_PROGRAM",
2835
2930
  /**
2836
2931
  * Video object represents whole series, e.g. tv show.