@tivio/sdk-react 4.2.0 → 4.3.0

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.
@@ -55,6 +55,12 @@ export declare type AdMetadata = {
55
55
  skip: () => void;
56
56
  } | null;
57
57
 
58
+ /**
59
+ * @public
60
+ */
61
+ export declare interface AdMonetization extends Monetization {
62
+ }
63
+
58
64
  /**
59
65
  * @public
60
66
  */
@@ -156,35 +162,6 @@ export declare type Assets = {
156
162
  [assetName: string]: ScalableAsset;
157
163
  };
158
164
 
159
- /**
160
- * @public
161
- */
162
- export declare type AuthOverlayPayload = {
163
- prefilledData?: {
164
- email: string;
165
- };
166
- /**
167
- * "Goto" function (see router.utils.ts) to run after the overlay is closed. Null if no redirect is required.
168
- * Defaults to homepage.
169
- */
170
- redirectAfterSubmit?: ((...args: any[]) => void) | null;
171
- };
172
-
173
- /**
174
- * @public
175
- */
176
- export declare type AuthOverlayState = {
177
- type: AuthOverlayType;
178
- closeAuthOverlay: () => void;
179
- openAuthOverlay: (type: AuthOverlayType, payload?: AuthOverlayPayload) => void;
180
- payload?: AuthOverlayPayload | null;
181
- };
182
-
183
- /**
184
- * @public
185
- */
186
- export declare type AuthOverlayType = 'login' | 'registration' | 'closed' | 'reset-password';
187
-
188
165
  /**
189
166
  * @public
190
167
  */
@@ -210,6 +187,11 @@ export declare type BadRequestError = Error & {
210
187
  };
211
188
  };
212
189
 
190
+ export declare enum BannerItemComponent {
191
+ CLASSIC = "CLASSIC",
192
+ SPLITTED = "SPLITTED"
193
+ }
194
+
213
195
  /**
214
196
  * @public
215
197
  */
@@ -380,6 +362,7 @@ export declare type CreateUserWithEmailAndPassword = (email: string, password: s
380
362
  export declare const CURRENCIES: string[];
381
363
 
382
364
  /**
365
+ * Three upper-case letters according to ISO-4217.
383
366
  * @public
384
367
  */
385
368
  export declare type Currency = 'CZK' | 'EUR' | 'USD';
@@ -415,6 +398,14 @@ export declare type Customizations = {
415
398
  coverWidth: number;
416
399
  fontWeight: string | number;
417
400
  overlayWidth: string | number;
401
+ text: {
402
+ width: string;
403
+ location: 'center' | 'bottom';
404
+ /**
405
+ * Font size in px
406
+ */
407
+ fontSize: number;
408
+ };
418
409
  };
419
410
  Row: {
420
411
  /**
@@ -433,6 +424,34 @@ export declare type Customizations = {
433
424
  logoHeight: string;
434
425
  borderBottom: string;
435
426
  };
427
+ VideoDetail: {
428
+ Banner: {
429
+ title: {
430
+ fontSize: string;
431
+ marginTop: number | string;
432
+ width: string;
433
+ };
434
+ overlays: {
435
+ left: {
436
+ width: string;
437
+ backgroundImage: string;
438
+ };
439
+ bottom: {
440
+ backgroundImage: string;
441
+ };
442
+ };
443
+ };
444
+ TagsRow: {
445
+ /**
446
+ * Tags of this tag type is shown in tags row on video detail screen
447
+ */
448
+ tagTypeId: string;
449
+ /**
450
+ * Row title
451
+ */
452
+ title: string;
453
+ };
454
+ };
436
455
  Input: InputOptions;
437
456
  landing: {
438
457
  row: {
@@ -526,6 +545,22 @@ export declare type DocumentOptions = Partial<{
526
545
  subscribeOnChanges: boolean;
527
546
  }>;
528
547
 
548
+ /**
549
+ * @public
550
+ */
551
+ export declare interface Duration {
552
+ units: DurationUnits;
553
+ value: number;
554
+ }
555
+
556
+ /**
557
+ * @public
558
+ */
559
+ export declare enum DurationUnits {
560
+ DAY = "day",
561
+ MONTH = "month"
562
+ }
563
+
529
564
  /**
530
565
  * @public
531
566
  */
@@ -578,6 +613,21 @@ export declare interface GenericOnCallError {
578
613
  */
579
614
  export declare const getPubSub: () => PubSub;
580
615
 
616
+ /**
617
+ * Response from Tivio getPurchaseInfo HTTP endpoint.
618
+ *
619
+ * @public
620
+ */
621
+ export declare type GetPurchaseInfoResponse = {
622
+ monetizationId: string;
623
+ monetization: PurchaseMonetization;
624
+ status: PurchaseStatus;
625
+ video?: {
626
+ id: string;
627
+ name: string | Translation;
628
+ };
629
+ };
630
+
581
631
  /**
582
632
  * @public
583
633
  */
@@ -775,6 +825,20 @@ export declare type LiveTvChannelSource = SourceBase & {
775
825
  channelName: string;
776
826
  };
777
827
 
828
+ /**
829
+ * @public
830
+ */
831
+ export declare type LocationField = {
832
+ /**
833
+ * Two-letter uppercase continent code (TODO not sure if this ISO-3166 format or something else, we get these from maxmind service)
834
+ */
835
+ continentCode?: 'AF' | 'AN' | 'AS' | 'EU' | 'NA' | 'OC' | 'SA';
836
+ /**
837
+ * Two-letter uppercase country code according to ISO-3166 format (see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
838
+ */
839
+ countryIsoCode?: string;
840
+ };
841
+
778
842
  declare interface Logger {
779
843
  /** important messages */
780
844
  warn(...data: LoggerArgs): void;
@@ -830,14 +894,9 @@ export declare interface MigratedVideoExternals {
830
894
  */
831
895
  export declare interface Monetization {
832
896
  id: string;
833
- price?: string | number;
834
897
  type?: MonetizationType;
835
- frequency?: MONETIZATION_FREQUENCY;
836
- isPurchased?: boolean;
837
898
  name?: string;
838
899
  description?: string;
839
- benefits?: Translation[];
840
- localizedBenefits?: string[];
841
900
  }
842
901
 
843
902
  /**
@@ -907,6 +966,13 @@ export declare interface OrderBy {
907
966
  directionStr?: OrderByDirection;
908
967
  }
909
968
 
969
+ /**
970
+ * The same as WhereFilter, but in array, for easier usage.
971
+ * Format: [field, directionStr] or [field]
972
+ * @public
973
+ */
974
+ export declare type OrderByArray = [string, OrderByDirection] | [string];
975
+
910
976
  declare type OrderByDirection = 'desc' | 'asc';
911
977
 
912
978
  /**
@@ -1197,6 +1263,14 @@ export declare enum PlayerWrapperEventType {
1197
1263
  */
1198
1264
  export declare type PlayerWrapperEventTypeType = `${PlayerWrapperEventType}`;
1199
1265
 
1266
+ /**
1267
+ * @public
1268
+ */
1269
+ export declare interface Promotion {
1270
+ duration?: Duration;
1271
+ price?: number;
1272
+ }
1273
+
1200
1274
  /**
1201
1275
  * @public
1202
1276
  */
@@ -1205,6 +1279,30 @@ export declare interface PubSub {
1205
1279
  subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
1206
1280
  }
1207
1281
 
1282
+ /**
1283
+ * @public
1284
+ */
1285
+ export declare interface PurchasableMonetization extends Monetization {
1286
+ /**
1287
+ * Price before any discounts (e.g. promotions).
1288
+ */
1289
+ originalPrice: number;
1290
+ /**
1291
+ * Final price (after discounts).
1292
+ */
1293
+ price?: string | number;
1294
+ promotion: Promotion | null;
1295
+ frequency?: MONETIZATION_FREQUENCY;
1296
+ isPurchased?: boolean;
1297
+ benefits?: Translation[];
1298
+ localizedBenefits?: string[];
1299
+ /**
1300
+ * Set to true for subscriptions which is not possible to buy - typically for historical subscriptions which users
1301
+ * still have bought but can't be purchased anymore.
1302
+ */
1303
+ purchaseDisabled?: boolean;
1304
+ }
1305
+
1208
1306
  /**
1209
1307
  * @public
1210
1308
  */
@@ -1236,6 +1334,132 @@ export declare type Purchase = {
1236
1334
  voucherId?: string;
1237
1335
  };
1238
1336
 
1337
+ /**
1338
+ * @public
1339
+ */
1340
+ export declare enum PurchaseDocumentGateway {
1341
+ 'qerko' = "qerko",
1342
+ 'oktagon' = "oktagon",
1343
+ 'voucher' = "voucher",
1344
+ 'comgate' = "comgate"
1345
+ }
1346
+
1347
+ /**
1348
+ * Payload which is sent to organization's webhook (if provided). It is send only when purchase status changes to PAID,
1349
+ * it means that it is send also when user applies the voucher.
1350
+ *
1351
+ * @public
1352
+ */
1353
+ export declare type PurchaseEndpointPayload = {
1354
+ /**
1355
+ * Information about the purchase which changes status to PAID.
1356
+ */
1357
+ purchase: {
1358
+ /**
1359
+ * Two-letter upper-case continent code.
1360
+ */
1361
+ continentCode?: LocationField['continentCode'];
1362
+ /**
1363
+ * Two-letter upper-case country code according to ISO-3166 format (see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes).
1364
+ */
1365
+ countryIsoCode?: LocationField['countryIsoCode'];
1366
+ /**
1367
+ * Gateway name or "voucher".
1368
+ */
1369
+ gateway: PurchaseDocumentGateway;
1370
+ /**
1371
+ * Tivio ID of the purchase.
1372
+ */
1373
+ id: string;
1374
+ /**
1375
+ * Timestamp of the last change of the purchase - in this case it is timestamp when it was paid.
1376
+ */
1377
+ updated: number;
1378
+ };
1379
+ /**
1380
+ * Information about the monetization which has been bought by this purchase. Monetization definition may change in time so information provided here
1381
+ * reflects monetization definition in time of the purchase.
1382
+ */
1383
+ monetization: {
1384
+ /**
1385
+ * Currency in which the purchase has been made. Three upper-case letters according to ISO-4217.
1386
+ */
1387
+ currency?: Currency;
1388
+ /**
1389
+ * Frequency in which the user will be charged.
1390
+ * One of "ONE_TIME_PAYMENT", "DAILY", "WEEKLY", "MONTHLY" and "ANNUALLY.
1391
+ */
1392
+ frequency?: MONETIZATION_FREQUENCY | null;
1393
+ /**
1394
+ * Tivio ID of the monetization.
1395
+ */
1396
+ id: string;
1397
+ /**
1398
+ * Price of the purchase.
1399
+ */
1400
+ price?: number;
1401
+ /**
1402
+ * Name of the monetization.
1403
+ */
1404
+ title?: string;
1405
+ /**
1406
+ * Type of the monetization ("transaction" or "subscription").
1407
+ */
1408
+ type: MonetizationType;
1409
+ };
1410
+ /**
1411
+ * Information about the video which has been bought by this purchase. Provided only for transaction purchases.
1412
+ */
1413
+ video?: {
1414
+ /**
1415
+ * Tivio ID of the video.
1416
+ */
1417
+ id: string;
1418
+ /**
1419
+ * Name of the video.
1420
+ */
1421
+ name: string | Translation;
1422
+ };
1423
+ /**
1424
+ * Information about the user who made this purchase.
1425
+ */
1426
+ user: {
1427
+ /**
1428
+ * User's e-mail.
1429
+ */
1430
+ email: string;
1431
+ /**
1432
+ * External ID of the user.
1433
+ */
1434
+ externalUserId: string;
1435
+ /**
1436
+ * Tivio ID of the user.
1437
+ */
1438
+ id: string;
1439
+ /**
1440
+ * User's name.
1441
+ */
1442
+ name: string;
1443
+ };
1444
+ /**
1445
+ * Information about the voucher. Provided only when purchase is purchase (not application) of the voucher.
1446
+ */
1447
+ voucher?: {
1448
+ /**
1449
+ * Voucher code.
1450
+ */
1451
+ code: string;
1452
+ /**
1453
+ * Voucher expiration timestamp.
1454
+ */
1455
+ expiration: number;
1456
+ /**
1457
+ * Duration (in seconds) after which purchase is considered expired. If undefined, monetization's duration is used.
1458
+ */
1459
+ purchaseDuration?: number;
1460
+ };
1461
+ };
1462
+
1239
1463
  /**
1240
1464
  * @public
1241
1465
  */
@@ -1289,7 +1513,7 @@ export declare interface QerkoCancellationInfo {
1289
1513
  * @public
1290
1514
  */
1291
1515
  export declare interface QerkoData {
1292
- monetization: Monetization;
1516
+ monetization: PurchasableMonetization;
1293
1517
  item?: Video | TvChannel;
1294
1518
  onPurchase?: () => void;
1295
1519
  onClose?: () => void;
@@ -1387,13 +1611,14 @@ export declare type RequiredNullable<T> = {
1387
1611
  * @public
1388
1612
  */
1389
1613
  export declare interface RouterOverrides {
1390
- goToVideoDetailPage: (videoId: string) => void;
1614
+ goToVideoDetailPage: (videoIdOrUrlName: string) => void;
1391
1615
  goToSeriesDetailPage: (tagId: string) => void;
1392
1616
  goToTagPage: (tagId: string) => void;
1393
- goToLoginScreen: () => void;
1617
+ goToLoginPage: () => void;
1618
+ goToRegistrationPage: () => void;
1394
1619
  goBack: () => void;
1395
- goLivePlayer: (videoId: string) => void;
1396
- goVodPlayer: (tvChannelId: string) => void;
1620
+ goLivePlayer: (tvChannelId: string) => void;
1621
+ goVodPlayer: (videoIdOrUrlName: string) => void;
1397
1622
  goToHome: () => void;
1398
1623
  }
1399
1624
 
@@ -1690,8 +1915,8 @@ export declare type SubscribeToTaggedVideosOptions = SubscribeToItemsInRowOption
1690
1915
  * @public
1691
1916
  */
1692
1917
  export declare interface SubscriptionCardProps {
1693
- subscription: Monetization;
1694
- onClick: (subscription: Monetization) => void;
1918
+ subscription: PurchasableMonetization;
1919
+ onClick: (subscription: PurchasableMonetization) => void;
1695
1920
  buttonLabel: string;
1696
1921
  purchased: boolean;
1697
1922
  focused?: boolean;
@@ -1708,7 +1933,7 @@ declare type SubscriptionInfo = {
1708
1933
  * @public
1709
1934
  */
1710
1935
  export declare interface SubscriptionOverlayData {
1711
- subscriptions?: Monetization[];
1936
+ subscriptions?: PurchasableMonetization[];
1712
1937
  onPurchase?: () => void;
1713
1938
  onClose?: () => void;
1714
1939
  }
@@ -1753,6 +1978,9 @@ export declare type TileOptions = {
1753
1978
  * This property is ignored for CIRCLED tiles, they always have border-radius: 50%;
1754
1979
  */
1755
1980
  borderRadius: string | number;
1981
+ innerContainer: {
1982
+ margin: string;
1983
+ };
1756
1984
  innerLabel: {
1757
1985
  /**
1758
1986
  * Font size in px
@@ -1770,6 +1998,12 @@ export declare type TileOptions = {
1770
1998
  sizes: {
1771
1999
  [variant in TileSizeVariant]: TileSizesMap;
1772
2000
  };
2001
+ badge: {
2002
+ /**
2003
+ * Font size in px
2004
+ */
2005
+ fontSize: number;
2006
+ };
1773
2007
  };
1774
2008
 
1775
2009
  /**
@@ -1779,6 +2013,7 @@ export declare type TileProps = {
1779
2013
  cover: string;
1780
2014
  bottomLabel: string;
1781
2015
  bottomLabelAreaHeight: number;
2016
+ bottomLabelTextLinesCount: number;
1782
2017
  innerLabel: string;
1783
2018
  duration: string;
1784
2019
  price: string | null;
@@ -1813,7 +2048,11 @@ export declare type TileSizes = {
1813
2048
  coverWidth: number;
1814
2049
  coverHeight: number;
1815
2050
  cellPaddingRight: number;
1816
- labelHeight: number;
2051
+ /**
2052
+ * Count of lines of label text.
2053
+ * Now only bottom label supports multiline text.
2054
+ */
2055
+ labelLinesCount: number;
1817
2056
  };
1818
2057
 
1819
2058
  /**
@@ -1847,6 +2086,7 @@ export declare interface TivioAuth {
1847
2086
  * @param password
1848
2087
  */
1849
2088
  signInWithEmailAndPassword: (email: string, password: string) => Promise<string | null>;
2089
+ signInWithCustomToken: (token: string) => Promise<string | null>;
1850
2090
  signOut: () => Promise<void>;
1851
2091
  /**
1852
2092
  * Used for reset forgotten password by user
@@ -2038,7 +2278,7 @@ export declare type TivioInternalComponents = {
2038
2278
  logo?: string;
2039
2279
  }>;
2040
2280
  WebVideoScreen: React_2.ComponentType<{
2041
- videoId: string;
2281
+ videoIdOrUrlName: string;
2042
2282
  }>;
2043
2283
  WebSeriesDetailScreen: React_2.ComponentType<WebSeriesDetailScreenProps>;
2044
2284
  };
@@ -2047,20 +2287,33 @@ export declare type TivioInternalComponents = {
2047
2287
  * @public
2048
2288
  */
2049
2289
  export declare type TivioInternalHooks = {
2050
- useAuthOverlay: () => AuthOverlayState;
2051
2290
  useSubscriptionsOverlay: () => SubscriptionOverlayState;
2052
2291
  useQerkoOverlay: () => QerkoOverlayState;
2053
2292
  usePurchasesWithVideos: () => {
2054
2293
  purchases: Purchase[];
2055
2294
  };
2056
- useOrganizationSubscriptions: () => {
2057
- subscriptions: Monetization[];
2295
+ useOrganizationSubscriptions: (onlyPurchasableSubscriptions?: boolean) => {
2296
+ subscriptions: PurchasableMonetization[];
2058
2297
  };
2059
2298
  useIsMonetizationPurchased: () => {
2060
2299
  isOneOfSubscriptionPurchased: (subscriptionIds: string[]) => boolean;
2061
2300
  };
2062
- useReferralInfo: any;
2301
+ useReferralInfo: (referralToken: string) => ({
2302
+ data: {
2303
+ email: string;
2304
+ externalUserId: string;
2305
+ promotionId?: string;
2306
+ referralId: string;
2307
+ promotion?: any;
2308
+ };
2309
+ error: Error | null;
2310
+ loading: boolean;
2311
+ });
2063
2312
  useTvChannel: UseTvChannel;
2313
+ usePaymentOverlay: () => {
2314
+ videoIdOrUrlName: string | null;
2315
+ setVideoIdOrUrlName: (videoIdOrUrlName: string | null) => void;
2316
+ };
2064
2317
  useChannelSource: UseChannelSource;
2065
2318
  useUser: () => {
2066
2319
  user: User | null;
@@ -2074,7 +2327,6 @@ export declare type TivioInternalHooks = {
2074
2327
  */
2075
2328
  export declare type TivioInternalProviders = {
2076
2329
  AppThemeProvider: React_2.ComponentType;
2077
- AuthOverlayContextProvider: React_2.ComponentType;
2078
2330
  CustomerProvider: React_2.ComponentType<{
2079
2331
  customer: CUSTOMER_BUILD;
2080
2332
  platform: PLATFORM;
@@ -2085,6 +2337,10 @@ export declare type TivioInternalProviders = {
2085
2337
  SubscriptionOverlayContextProvider: React_2.ComponentType;
2086
2338
  QerkoOverlayContextProvider: React_2.ComponentType;
2087
2339
  PurchasesWithVideosContextProvider: React_2.ComponentType;
2340
+ PaymentOverlayContextProvider: React_2.ComponentType;
2341
+ /**
2342
+ * @deprecated not used in our app, can be removed when no sdk in production uses it
2343
+ */
2088
2344
  OrganizationSubscriptionsContextProvider: React_2.ComponentType;
2089
2345
  RouterOverridesContextProvider: React_2.ComponentType<RouterOverridesContextState>;
2090
2346
  };
@@ -2472,8 +2728,8 @@ export declare const useMarkers: () => Marker[] | null;
2472
2728
  /**
2473
2729
  * @public
2474
2730
  */
2475
- export declare const useOrganizationSubscriptions: () => {
2476
- subscriptions: Monetization[];
2731
+ export declare const useOrganizationSubscriptions: (onlyPurchasableSubscriptions?: boolean | undefined) => {
2732
+ subscriptions: PurchasableMonetization[];
2477
2733
  };
2478
2734
 
2479
2735
  /**
@@ -2651,10 +2907,10 @@ export declare const useUser: () => {
2651
2907
 
2652
2908
  /**
2653
2909
  * Use video
2654
- * @param videoId - video id
2910
+ * @param videoIdOrUrlName - video id or video nice url (e.g. some-interesting-video)
2655
2911
  * @public
2656
2912
  */
2657
- export declare const useVideo: (videoId?: string | undefined) => {
2913
+ export declare const useVideo: (videoIdOrUrlName?: string | undefined) => {
2658
2914
  data: Video | null;
2659
2915
  error: string | null;
2660
2916
  };
@@ -2740,14 +2996,15 @@ export declare interface Video extends RowItem {
2740
2996
  image: string | null;
2741
2997
  isPlayable: boolean;
2742
2998
  monetizations: Monetization[];
2743
- monetization: Monetization | undefined;
2744
2999
  transactionId?: string;
2745
- transaction: Monetization | undefined;
2746
- subscriptions: Monetization[];
3000
+ sources?: any[];
3001
+ transaction: PurchasableMonetization | undefined;
3002
+ subscriptions: PurchasableMonetization[];
2747
3003
  subscriptionIds: string[];
2748
3004
  isPlaylist: boolean;
2749
3005
  name: string;
2750
- description?: string;
3006
+ urlNames?: string[];
3007
+ urlName?: string;
2751
3008
  price: number | null;
2752
3009
  detailedPrice: DetailedPrice | null;
2753
3010
  uri: string;
@@ -2822,6 +3079,13 @@ export declare enum VideoType {
2822
3079
  SERIES = "SERIES"
2823
3080
  }
2824
3081
 
3082
+ /**
3083
+ * @public
3084
+ */
3085
+ export declare type VideoUrlName = {
3086
+ [key in LangCode]?: string[];
3087
+ };
3088
+
2825
3089
  /**
2826
3090
  * @public
2827
3091
  */
@@ -2947,6 +3211,13 @@ export declare interface WhereFilter {
2947
3211
  value: any;
2948
3212
  }
2949
3213
 
3214
+ /**
3215
+ * The same as WhereFilter, but in array, for easier usage.
3216
+ * Format: [field, operator, value]
3217
+ * @public
3218
+ */
3219
+ export declare type WhereFilterArray = [string, WhereFilterOp, any];
3220
+
2950
3221
  declare type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in';
2951
3222
 
2952
3223
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "4.2.0",
3
+ "version": "4.3.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.98",
33
+ "@tivio/common": "1.1.99",
34
34
  "dayjs": "^1.11.0",
35
35
  "es7-object-polyfill": "^1.0.1",
36
36
  "firebase": "8.10.1",