@tivio/sdk-react 9.2.0 → 9.3.1

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.
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import type { PaletteType } from '@material-ui/core';
11
11
  import { default as React_2 } from 'react';
12
12
  import { RecommendationsQuery } from '@algolia/recommend';
13
13
  import type { TagManagerArgs } from 'react-gtm-module';
14
+ import type { Timestamp } from '@firebase/firestore-types';
14
15
 
15
16
  export declare interface ActivatedPromotion {
16
17
  id: string;
@@ -607,6 +608,10 @@ export declare interface BannerProps {
607
608
  */
608
609
  export declare type BannerPropsPartial = Partial<BannerProps>;
609
610
 
611
+ declare interface BaseWidgetControlPayload {
612
+ widgetPath: string;
613
+ }
614
+
610
615
  /**
611
616
  * @public
612
617
  */
@@ -661,6 +666,35 @@ export declare interface CancellingMonetizationsSummaryItem {
661
666
  cancellingUsers: number;
662
667
  }
663
668
 
669
+ declare interface ChangeStateResponse {
670
+ success: boolean;
671
+ }
672
+
673
+ declare interface ChangeWidgetStatePayload extends BaseWidgetControlPayload {
674
+ prevState: InteractiveWidgetState;
675
+ targetState: InteractiveWidgetState;
676
+ }
677
+
678
+ export declare interface ChangeWidgetStateRequest {
679
+ /** Path to the widget instance document */
680
+ widgetPath: string;
681
+ /** The state the client believes the widget is currently in */
682
+ prevState: InteractiveWidgetState;
683
+ /** The desired target state to transition to */
684
+ targetState: InteractiveWidgetState;
685
+ /** Active scene id */
686
+ activeSceneId?: string;
687
+ /** Audience delay in seconds */
688
+ audienceDelay?: number;
689
+ /** Time in seconds for the audience to answer the question */
690
+ answerTime?: number;
691
+ }
692
+
693
+ declare interface ChangeWidgetStateRequest_2 {
694
+ action: 'changeState';
695
+ payload: ChangeWidgetStatePayload;
696
+ }
697
+
664
698
  /**
665
699
  * @public
666
700
  * @deprecated this channel structure is not used anymore (don't confuse with tv channels, which are used).
@@ -714,6 +748,11 @@ export declare interface ChurnedMonetizationsSummaryItem {
714
748
  expiredUsers: number;
715
749
  }
716
750
 
751
+ export declare enum CloudflareStreamingPurchaseStatus {
752
+ PAID = "paid",
753
+ FREE = "free"
754
+ }
755
+
717
756
  /**
718
757
  * @public
719
758
  */
@@ -1353,6 +1392,18 @@ export declare interface EditMessageOptions extends Omit<AddMessageOptions, 'par
1353
1392
  videoTime?: number;
1354
1393
  }
1355
1394
 
1395
+ export declare interface EmailNotification {
1396
+ id: string;
1397
+ name: string;
1398
+ targeting: NotificationTargeting | null;
1399
+ templateId: string;
1400
+ thumbnailUrl?: string;
1401
+ triggerType: NotificationTriggerType;
1402
+ scheduleTime?: Date;
1403
+ status?: NotificationStatus;
1404
+ substitutions: NotificationSubstitution[];
1405
+ }
1406
+
1356
1407
  /**
1357
1408
  * Represents a SendGrid transactional template.
1358
1409
  */
@@ -1474,6 +1525,11 @@ export declare type Events = {
1474
1525
  'on-error': Error;
1475
1526
  };
1476
1527
 
1528
+ export declare interface ExtensionMetadata {
1529
+ purchaseStatus: CloudflareStreamingPurchaseStatus;
1530
+ activeVideoId?: string;
1531
+ }
1532
+
1477
1533
  /**
1478
1534
  * @public
1479
1535
  */
@@ -1482,6 +1538,23 @@ export declare type ExternalTvConfig = {
1482
1538
  splashScreenBackgroundColor?: string;
1483
1539
  };
1484
1540
 
1541
+ export declare interface FavoriteTagWithData {
1542
+ content: Tag;
1543
+ type: 'tag';
1544
+ }
1545
+
1546
+ export declare interface FavoriteVideoWithData {
1547
+ content: Video;
1548
+ type: 'video';
1549
+ }
1550
+
1551
+ /**
1552
+ * @public
1553
+ */
1554
+ export declare type FavoriteWithData = FavoriteVideoWithData | (FavoriteTagWithData & {
1555
+ profileId?: string;
1556
+ });
1557
+
1485
1558
  /**
1486
1559
  * @throws if fetch fails
1487
1560
  * @public
@@ -1543,6 +1616,24 @@ export declare type FrequencyInfo = {
1543
1616
  value: number;
1544
1617
  };
1545
1618
 
1619
+ export declare interface GenerateSourceRequest {
1620
+ profileId: string;
1621
+ videoId: string;
1622
+ protocol: VideoSourceProtocol;
1623
+ sessionType: SessionType;
1624
+ extensionMetadata: ExtensionMetadata;
1625
+ }
1626
+
1627
+ export declare interface GenerateWidgetJoinCodeRequest {
1628
+ action: 'generateWidgetJoinCode';
1629
+ payload: BaseWidgetControlPayload;
1630
+ }
1631
+
1632
+ declare interface GenerateWidgetJoinCodeResponse {
1633
+ code: string;
1634
+ qrCodeUri: string;
1635
+ }
1636
+
1546
1637
  /**
1547
1638
  * On call error interface for front-end.
1548
1639
  * Do not use it / throw it from @tivio/api.
@@ -1739,6 +1830,14 @@ export declare interface GetSourceUrlResponse {
1739
1830
 
1740
1831
  export declare type GetTilesInRowResponse<U extends NextPageParamType = NextPageParamType> = PaginatedResponse<TileData, U>;
1741
1832
 
1833
+ export declare interface GetUserProfileDataOptions {
1834
+ /**
1835
+ * If true, the data will be returned for all user profiles.
1836
+ * If false, the data will be returned only for the active user profile.
1837
+ */
1838
+ ignoreActiveUserProfile?: boolean;
1839
+ }
1840
+
1742
1841
  export declare interface GetUserRssUrlRequest {
1743
1842
  organizationId: string;
1744
1843
  }
@@ -1961,6 +2060,7 @@ export declare interface InteractiveWidget<T extends InteractiveWidgetScene = In
1961
2060
  readonly isWaitingForStart: boolean;
1962
2061
  answerQuestion(answerId: string): void;
1963
2062
  submitAnswer(request: Pick<SubmitAnswerRequest, 'answerOptionId' | 'answerText'>): Promise<void>;
2063
+ verifyJoinCode(joinCode: string, shouldJoinPlayer?: boolean): Promise<boolean>;
1964
2064
  destroy(): void;
1965
2065
  }
1966
2066
 
@@ -1986,6 +2086,7 @@ export declare interface InteractiveWidgetSceneBase<TType extends InteractiveWid
1986
2086
  type: TType;
1987
2087
  name: Translation;
1988
2088
  metadata: SceneMetadata<TType>;
2089
+ state: InteractiveWidgetState;
1989
2090
  }
1990
2091
 
1991
2092
  export declare enum InteractiveWidgetSceneTemplateType {
@@ -2211,6 +2312,12 @@ export declare interface LeaderboardPlayer {
2211
2312
 
2212
2313
  export declare type LeaderboardScene = InteractiveWidgetSceneBase<InteractiveWidgetSceneTemplateType.LEADERBOARD>;
2213
2314
 
2315
+ export declare interface LeaderboardsRequest {
2316
+ widgetPath: string;
2317
+ lastQuestionIndex: number;
2318
+ allPlayers?: boolean;
2319
+ }
2320
+
2214
2321
  /**
2215
2322
  * @public
2216
2323
  */
@@ -2354,6 +2461,21 @@ export declare interface MallTvExternals {
2354
2461
  mallTvEntityId: string;
2355
2462
  }
2356
2463
 
2464
+ /**
2465
+ * Response for {@link ManagementGenerateSourceRequest}
2466
+ * @private
2467
+ * @example ```json
2468
+ * {
2469
+ * "sessionId": "f6439376-bc57-4891-ac64-4dde4254a423",
2470
+ * "url": "https://live.streaming.tivio.studio/live/ol24ae7lQ4ES1PN6UYSk/tRRu9BMn3eTTX22iTyLz/f6439376-bc57-4891-ac64-4dde4254a423/index.m3u8"
2471
+ * }
2472
+ * ```
2473
+ */
2474
+ export declare interface ManagementGenerateSourceResponse {
2475
+ sessionId: string;
2476
+ url: string;
2477
+ }
2478
+
2357
2479
  /**
2358
2480
  * @public
2359
2481
  */
@@ -2654,17 +2776,11 @@ export declare type NoGraphicsScene = InteractiveWidgetSceneBase<InteractiveWidg
2654
2776
  */
2655
2777
  export declare type NonAdSourceType = Exclude<SourceType, SourceType.ADVERTISEMENT>;
2656
2778
 
2657
- declare interface Notification_2 {
2658
- id: string;
2659
- name: string;
2660
- targeting: NotificationTargeting | null;
2661
- templateId: string;
2662
- thumbnailUrl?: string;
2663
- triggerType: NotificationTriggerType;
2664
- scheduleTime?: Date;
2665
- status?: NotificationStatus;
2666
- substitutions: NotificationSubstitution[];
2667
- }
2779
+ declare type Notification_2 = {
2780
+ type: NotificationType.PUSH;
2781
+ } & SchedulePushNotificationPayload | {
2782
+ type?: NotificationType.EMAIL;
2783
+ } & EmailNotification;
2668
2784
  export { Notification_2 as Notification }
2669
2785
 
2670
2786
  export declare interface NotificationDuration {
@@ -2735,6 +2851,11 @@ export declare interface NotificationTargeting {
2735
2851
 
2736
2852
  export declare type NotificationTriggerType = 'scheduled' | 'manual' | 'purchaseStatusChange' | 'duration' | 'userRegistration';
2737
2853
 
2854
+ export declare enum NotificationType {
2855
+ PUSH = "PUSH",
2856
+ EMAIL = "EMAIL"
2857
+ }
2858
+
2738
2859
  /**
2739
2860
  * @public
2740
2861
  */
@@ -2839,6 +2960,7 @@ export declare interface OrganizationSettingsField extends OrganizationResponsiv
2839
2960
  };
2840
2961
  rss?: {
2841
2962
  title?: string;
2963
+ enabled?: boolean;
2842
2964
  };
2843
2965
  /**
2844
2966
  * Setting for EPG screen on web
@@ -2868,6 +2990,9 @@ export declare interface OrganizationSettingsField extends OrganizationResponsiv
2868
2990
  };
2869
2991
  };
2870
2992
  voucher?: VoucherPageConfiguration;
2993
+ pushNotifications?: {
2994
+ enabled?: boolean;
2995
+ };
2871
2996
  }
2872
2997
 
2873
2998
  /**
@@ -4053,6 +4178,20 @@ export declare enum PurchaseStatus {
4053
4178
  */
4054
4179
  export declare type PurchaseType = 'transaction' | 'subscription' | 'voucher';
4055
4180
 
4181
+ export declare type PushNotificationSchedulerRequest = {
4182
+ operation: SchedulerOperation.SCHEDULE;
4183
+ status: NotificationStatus;
4184
+ payload: SchedulePushNotificationPayload;
4185
+ } | {
4186
+ operation: SchedulerOperation.UNSCHEDULE;
4187
+ organizationId: string;
4188
+ contentId: string;
4189
+ } | {
4190
+ operation: SchedulerOperation.GET_STATUS;
4191
+ organizationId: string;
4192
+ contentId: string;
4193
+ };
4194
+
4056
4195
  /**
4057
4196
  * TODO more generic name, since we support stargaze payment gateway as well
4058
4197
  * @public
@@ -4219,6 +4358,8 @@ export declare interface QuizGameGroupStats {
4219
4358
 
4220
4359
  export declare enum QuizGameGroupType {
4221
4360
  HIGHLIGHTED_PLAYERS = "HIGHLIGHTED_PLAYERS",
4361
+ /** Participants playing in Offline mode */
4362
+ LOCAL_PLAYERS = "LOCAL_PLAYERS",
4222
4363
  ALL = "ALL",
4223
4364
  PARTY = "PARTY"
4224
4365
  }
@@ -4226,7 +4367,8 @@ export declare enum QuizGameGroupType {
4226
4367
  export declare enum QuizGameRole {
4227
4368
  OBS = "OBS",
4228
4369
  HOST = "HOST",
4229
- PLAYER = "PLAYER"
4370
+ PLAYER = "PLAYER",
4371
+ LOCAL_PLAYER = "LOCAL_PLAYER"
4230
4372
  }
4231
4373
 
4232
4374
  export declare enum QuizGameStatus {
@@ -4471,6 +4613,7 @@ export declare interface RouterOverrides {
4471
4613
  urlHandle?: string;
4472
4614
  replace?: boolean;
4473
4615
  params?: string;
4616
+ callbackUrl?: string;
4474
4617
  }) => void;
4475
4618
  goToRegistrationPage: (options?: {
4476
4619
  origin?: RegistrationRedirect;
@@ -4784,6 +4927,38 @@ export declare interface ScheduleNotificationRequest {
4784
4927
  notificationPath: string;
4785
4928
  }
4786
4929
 
4930
+ export declare interface SchedulePushNotificationPayload {
4931
+ /**
4932
+ * To which content document will this notification relate to.
4933
+ */
4934
+ contentId: string;
4935
+ /**
4936
+ * Content document type.
4937
+ */
4938
+ contentType: 'video' | 'article';
4939
+ /**
4940
+ * To users of which organization should notifications be sent.
4941
+ */
4942
+ organizationId: string;
4943
+ /**
4944
+ * Contents of notification message that will be shown to users.
4945
+ */
4946
+ notification: {
4947
+ title: string;
4948
+ body?: string;
4949
+ imageUrl?: string;
4950
+ data?: {
4951
+ [key: string]: string;
4952
+ };
4953
+ };
4954
+ }
4955
+
4956
+ export declare enum SchedulerOperation {
4957
+ SCHEDULE = "SCHEDULE",
4958
+ UNSCHEDULE = "UNSCHEDULE",
4959
+ GET_STATUS = "GET_STATUS"
4960
+ }
4961
+
4787
4962
  /**
4788
4963
  * @public
4789
4964
  */
@@ -4968,6 +5143,27 @@ export declare interface SendMessageResponse {
4968
5143
  messageId?: string;
4969
5144
  }
4970
5145
 
5146
+ export declare interface SendPushNotificationsResponse {
5147
+ /**
5148
+ * Potential user count to send notifications to.
5149
+ * Will include organization users that have at least 1 device registered to receive notifications.
5150
+ */
5151
+ potentialUserCount: number;
5152
+ /**
5153
+ * Potential device count from users to send notifications to.
5154
+ * Resulting number is equals to {@link successNotificationCount} + {@link failureNotificationCount}
5155
+ */
5156
+ potentialDeviceCount: number;
5157
+ /**
5158
+ * Number of successfully sent notifications.
5159
+ */
5160
+ successNotificationCount: number;
5161
+ /**
5162
+ * Number of notifications that failed to send.
5163
+ */
5164
+ failureNotificationCount: number;
5165
+ }
5166
+
4971
5167
  export declare interface SendTivioTemplateEmailRequest {
4972
5168
  notificationId: string;
4973
5169
  organizationId: string;
@@ -5003,6 +5199,24 @@ export declare interface SeriesTileSpecificData {
5003
5199
  availableSeasons: AvailableSeason[];
5004
5200
  }
5005
5201
 
5202
+ /**
5203
+ * @public
5204
+ */
5205
+ export declare enum SessionType {
5206
+ /**
5207
+ * Umbrella streaming - viewer will be able to switch between different sources linked to the main source.
5208
+ */
5209
+ INTERACTIVE = "interactive",
5210
+ /**
5211
+ * Classic streaming - viewer will be able to watch a single LIVE source.
5212
+ */
5213
+ LIVE = "live",
5214
+ /**
5215
+ * On-demand streaming - viewer will be able to watch a single VOD source.
5216
+ */
5217
+ ON_DEMAND = "ondemand"
5218
+ }
5219
+
5006
5220
  export declare interface SetCustomClaimsRequest {
5007
5221
  organizationId: string;
5008
5222
  }
@@ -5263,6 +5477,19 @@ export declare type StartAndContinuePosition = {
5263
5477
  continueFromPosition?: number;
5264
5478
  };
5265
5479
 
5480
+ export declare type StartLiveStreamPayload = BaseWidgetControlPayload;
5481
+
5482
+ declare interface StartLiveStreamRequest {
5483
+ action: 'startLiveStream';
5484
+ payload: StartLiveStreamPayload;
5485
+ }
5486
+
5487
+ export declare interface StartLiveStreamResponse {
5488
+ liveStreamProcessPath: string;
5489
+ streamingStudioProcessPath: string;
5490
+ error?: string;
5491
+ }
5492
+
5266
5493
  /**
5267
5494
  * @public
5268
5495
  */
@@ -5385,8 +5612,8 @@ export declare interface Tag extends RowItem {
5385
5612
  detailBanner?: string;
5386
5613
  availableSeasons?: AvailableSeason[];
5387
5614
  isFavorite: boolean;
5388
- addToFavorites: () => void;
5389
- removeFromFavorites: () => void;
5615
+ addToFavorites: () => Promise<void>;
5616
+ removeFromFavorites: () => Promise<void>;
5390
5617
  cover: string;
5391
5618
  getApplicationName: () => string | undefined;
5392
5619
  seriesRef?: DocumentReference<any>;
@@ -6292,6 +6519,25 @@ export declare enum TvStreamType {
6292
6519
  */
6293
6520
  export declare const TvTivioProvider: React_2.FC<TivioProviderProps>;
6294
6521
 
6522
+ export declare type UpdateNotificationSettingsRequest = {
6523
+ tokenToAdd: string;
6524
+ platform: string;
6525
+ tokenToDelete?: string;
6526
+ validateToken?: never;
6527
+ } | {
6528
+ tokenToDelete: string;
6529
+ tokenToAdd?: never;
6530
+ platform?: never;
6531
+ validateToken?: never;
6532
+ } | {
6533
+ validateToken: string;
6534
+ tokenToAdd?: never;
6535
+ platform?: never;
6536
+ tokenToDelete?: never;
6537
+ };
6538
+
6539
+ export declare type UpdateNotificationSettingsResponse = Promise<boolean>;
6540
+
6295
6541
  export declare type UpsertCommentResponse = AddEditCommentResponse | DeleteCommentResponse;
6296
6542
 
6297
6543
  /**
@@ -6386,7 +6632,7 @@ export declare const useChannelSource: (tvChannelId: string) => {
6386
6632
  * but for live video with comments, we want to subscribe to conversation
6387
6633
  */
6388
6634
  export declare type UseComments = (options: UseMessagesOptions) => {
6389
- pagination: PaginationInterface<Comment>;
6635
+ pagination: PaginationInterface<unknown>;
6390
6636
  addComment: (options: AddMessageOptions) => Promise<UseMessagesAddEditMessageResponse>;
6391
6637
  editComment: (options: EditMessageOptions) => Promise<UseMessagesAddEditMessageResponse>;
6392
6638
  deleteComment: (commentId: string) => Promise<UseMessagesDeleteMessageResponse>;
@@ -6649,6 +6895,9 @@ export declare type User = {
6649
6895
  getAllExtendableSubscriptions: () => Promise<Purchase[]>;
6650
6896
  getRssValidToken: () => Promise<TokenInterface | undefined>;
6651
6897
  getRssUrl: () => Promise<GetUserRssUrlResponse>;
6898
+ getFavorites: (options?: GetUserProfileDataOptions) => Promise<FavoriteWithData[]>;
6899
+ getWatchPositions: (options?: GetUserProfileDataOptions) => Promise<WatchPositionWithData[]>;
6900
+ getWatchHistory: (options?: GetUserProfileDataOptions) => Promise<WatchPositionWithData[]>;
6652
6901
  invalidateAllTokens: (type: TokenType) => Promise<void>;
6653
6902
  isPartiallyRegistered: boolean;
6654
6903
  conversationStore: ConversationStore;
@@ -6680,6 +6929,16 @@ export declare enum UserGroup {
6680
6929
  PREMIUM = "premium"
6681
6930
  }
6682
6931
 
6932
+ export declare interface UserNotificationRegistrationToken {
6933
+ token: string;
6934
+ platform?: string;
6935
+ created: Timestamp;
6936
+ }
6937
+
6938
+ export declare interface UserNotificationSettings {
6939
+ registrationTokens?: UserNotificationRegistrationToken[];
6940
+ }
6941
+
6683
6942
  /**
6684
6943
  * @public
6685
6944
  */
@@ -6948,6 +7207,16 @@ export declare interface verifyCustomTokenProps {
6948
7207
  organizationPath: string;
6949
7208
  }
6950
7209
 
7210
+ declare interface VerifyJoinCodePayload extends BaseWidgetControlPayload {
7211
+ joinCode: string;
7212
+ shouldJoinPlayer?: boolean;
7213
+ }
7214
+
7215
+ export declare interface VerifyJoinCodeRequest {
7216
+ action: 'verifyJoinCode';
7217
+ payload: VerifyJoinCodePayload;
7218
+ }
7219
+
6951
7220
  /**
6952
7221
  * @public
6953
7222
  */
@@ -7004,8 +7273,8 @@ export declare interface Video extends RowItem, MonetizableItem, ReactableConten
7004
7273
  tasting: Video | null;
7005
7274
  watchPosition: number | null;
7006
7275
  isFavorite: boolean;
7007
- addToFavorites: () => void;
7008
- removeFromFavorites: () => void;
7276
+ addToFavorites: () => Promise<void>;
7277
+ removeFromFavorites: () => Promise<void>;
7009
7278
  availability: ContentAvailability | null;
7010
7279
  sourceLanguages: LangCode[];
7011
7280
  urlByLanguage: (lang: LangCode) => string | undefined;
@@ -7529,6 +7798,21 @@ export declare interface WarningConfirmationOverlayPayload extends ConfirmationO
7529
7798
  subscriptionExpirationText?: string;
7530
7799
  }
7531
7800
 
7801
+ /**
7802
+ * @public
7803
+ */
7804
+ export declare interface WatchPositionWithData extends Omit<UserWatchPositionField, 'videoRef' | 'tagRef'> {
7805
+ /**
7806
+ * Video that given watch position is related to.
7807
+ */
7808
+ video: Video;
7809
+ /**
7810
+ * If user watches episode of series, we have to save series ref as well.
7811
+ * Same for {@link episodeNumber} and {@link seasonNumber}.
7812
+ */
7813
+ tag?: Tag;
7814
+ }
7815
+
7532
7816
  /**
7533
7817
  * @public
7534
7818
  */
@@ -7938,6 +8222,16 @@ export declare type Widget = {
7938
8222
  lastVideo: Video | null;
7939
8223
  };
7940
8224
 
8225
+ export declare type WidgetControlRequest = StartLiveStreamRequest | ChangeWidgetStateRequest_2 | GenerateWidgetJoinCodeRequest | VerifyJoinCodeRequest;
8226
+
8227
+ export declare type WidgetControlResponse<T extends WidgetControlRequest['action']> = T extends 'startLiveStream' ? StartLiveStreamResponse : T extends 'changeState' ? ChangeStateResponse : T extends 'generateWidgetJoinCode' ? GenerateWidgetJoinCodeResponse : T extends 'verifyJoinCode' ? boolean : never;
8228
+
8229
+ export declare interface WidgetSecret {
8230
+ code: string;
8231
+ type: 'JWT' | 'alphanumeric';
8232
+ expired?: Date;
8233
+ }
8234
+
7941
8235
  /**
7942
8236
  * @public
7943
8237
  */