@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.
@@ -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
  */
@@ -683,6 +688,35 @@ export declare interface CancellingMonetizationsSummaryItem {
683
688
  cancellingUsers: number;
684
689
  }
685
690
 
691
+ declare interface ChangeStateResponse {
692
+ success: boolean;
693
+ }
694
+
695
+ declare interface ChangeWidgetStatePayload extends BaseWidgetControlPayload {
696
+ prevState: InteractiveWidgetState;
697
+ targetState: InteractiveWidgetState;
698
+ }
699
+
700
+ export declare interface ChangeWidgetStateRequest {
701
+ /** Path to the widget instance document */
702
+ widgetPath: string;
703
+ /** The state the client believes the widget is currently in */
704
+ prevState: InteractiveWidgetState;
705
+ /** The desired target state to transition to */
706
+ targetState: InteractiveWidgetState;
707
+ /** Active scene id */
708
+ activeSceneId?: string;
709
+ /** Audience delay in seconds */
710
+ audienceDelay?: number;
711
+ /** Time in seconds for the audience to answer the question */
712
+ answerTime?: number;
713
+ }
714
+
715
+ declare interface ChangeWidgetStateRequest_2 {
716
+ action: 'changeState';
717
+ payload: ChangeWidgetStatePayload;
718
+ }
719
+
686
720
  /**
687
721
  * @public
688
722
  * @deprecated this channel structure is not used anymore (don't confuse with tv channels, which are used).
@@ -736,6 +770,11 @@ export declare interface ChurnedMonetizationsSummaryItem {
736
770
  expiredUsers: number;
737
771
  }
738
772
 
773
+ export declare enum CloudflareStreamingPurchaseStatus {
774
+ PAID = "paid",
775
+ FREE = "free"
776
+ }
777
+
739
778
  /**
740
779
  * @public
741
780
  */
@@ -1626,6 +1665,18 @@ export declare interface EditMessageOptions extends Omit<AddMessageOptions, 'par
1626
1665
  videoTime?: number;
1627
1666
  }
1628
1667
 
1668
+ export declare interface EmailNotification {
1669
+ id: string;
1670
+ name: string;
1671
+ targeting: NotificationTargeting | null;
1672
+ templateId: string;
1673
+ thumbnailUrl?: string;
1674
+ triggerType: NotificationTriggerType;
1675
+ scheduleTime?: Date;
1676
+ status?: NotificationStatus;
1677
+ substitutions: NotificationSubstitution[];
1678
+ }
1679
+
1629
1680
  /**
1630
1681
  * Represents a SendGrid transactional template.
1631
1682
  */
@@ -1747,6 +1798,11 @@ export declare type Events = {
1747
1798
  'on-error': Error;
1748
1799
  };
1749
1800
 
1801
+ export declare interface ExtensionMetadata {
1802
+ purchaseStatus: CloudflareStreamingPurchaseStatus;
1803
+ activeVideoId?: string;
1804
+ }
1805
+
1750
1806
  /**
1751
1807
  * @public
1752
1808
  */
@@ -1755,6 +1811,23 @@ export declare type ExternalTvConfig = {
1755
1811
  splashScreenBackgroundColor?: string;
1756
1812
  };
1757
1813
 
1814
+ export declare interface FavoriteTagWithData {
1815
+ content: Tag;
1816
+ type: 'tag';
1817
+ }
1818
+
1819
+ export declare interface FavoriteVideoWithData {
1820
+ content: Video;
1821
+ type: 'video';
1822
+ }
1823
+
1824
+ /**
1825
+ * @public
1826
+ */
1827
+ export declare type FavoriteWithData = FavoriteVideoWithData | (FavoriteTagWithData & {
1828
+ profileId?: string;
1829
+ });
1830
+
1758
1831
  /**
1759
1832
  * @throws if fetch fails
1760
1833
  * @public
@@ -1816,6 +1889,24 @@ export declare type FrequencyInfo = {
1816
1889
  value: number;
1817
1890
  };
1818
1891
 
1892
+ export declare interface GenerateSourceRequest {
1893
+ profileId: string;
1894
+ videoId: string;
1895
+ protocol: VideoSourceProtocol;
1896
+ sessionType: SessionType;
1897
+ extensionMetadata: ExtensionMetadata;
1898
+ }
1899
+
1900
+ export declare interface GenerateWidgetJoinCodeRequest {
1901
+ action: 'generateWidgetJoinCode';
1902
+ payload: BaseWidgetControlPayload;
1903
+ }
1904
+
1905
+ declare interface GenerateWidgetJoinCodeResponse {
1906
+ code: string;
1907
+ qrCodeUri: string;
1908
+ }
1909
+
1819
1910
  /**
1820
1911
  * On call error interface for front-end.
1821
1912
  * Do not use it / throw it from @tivio/api.
@@ -2012,6 +2103,14 @@ export declare interface GetSourceUrlResponse {
2012
2103
 
2013
2104
  export declare type GetTilesInRowResponse<U extends NextPageParamType = NextPageParamType> = PaginatedResponse<TileData, U>;
2014
2105
 
2106
+ export declare interface GetUserProfileDataOptions {
2107
+ /**
2108
+ * If true, the data will be returned for all user profiles.
2109
+ * If false, the data will be returned only for the active user profile.
2110
+ */
2111
+ ignoreActiveUserProfile?: boolean;
2112
+ }
2113
+
2015
2114
  export declare interface GetUserRssUrlRequest {
2016
2115
  organizationId: string;
2017
2116
  }
@@ -2244,6 +2343,7 @@ export declare interface InteractiveWidget<T extends InteractiveWidgetScene = In
2244
2343
  readonly isWaitingForStart: boolean;
2245
2344
  answerQuestion(answerId: string): void;
2246
2345
  submitAnswer(request: Pick<SubmitAnswerRequest, 'answerOptionId' | 'answerText'>): Promise<void>;
2346
+ verifyJoinCode(joinCode: string, shouldJoinPlayer?: boolean): Promise<boolean>;
2247
2347
  destroy(): void;
2248
2348
  }
2249
2349
 
@@ -2269,6 +2369,7 @@ export declare interface InteractiveWidgetSceneBase<TType extends InteractiveWid
2269
2369
  type: TType;
2270
2370
  name: Translation;
2271
2371
  metadata: SceneMetadata<TType>;
2372
+ state: InteractiveWidgetState;
2272
2373
  }
2273
2374
 
2274
2375
  export declare enum InteractiveWidgetSceneTemplateType {
@@ -2494,6 +2595,12 @@ export declare interface LeaderboardPlayer {
2494
2595
 
2495
2596
  export declare type LeaderboardScene = InteractiveWidgetSceneBase<InteractiveWidgetSceneTemplateType.LEADERBOARD>;
2496
2597
 
2598
+ export declare interface LeaderboardsRequest {
2599
+ widgetPath: string;
2600
+ lastQuestionIndex: number;
2601
+ allPlayers?: boolean;
2602
+ }
2603
+
2497
2604
  /**
2498
2605
  * @public
2499
2606
  */
@@ -2637,6 +2744,21 @@ export declare interface MallTvExternals {
2637
2744
  mallTvEntityId: string;
2638
2745
  }
2639
2746
 
2747
+ /**
2748
+ * Response for {@link ManagementGenerateSourceRequest}
2749
+ * @private
2750
+ * @example ```json
2751
+ * {
2752
+ * "sessionId": "f6439376-bc57-4891-ac64-4dde4254a423",
2753
+ * "url": "https://live.streaming.tivio.studio/live/ol24ae7lQ4ES1PN6UYSk/tRRu9BMn3eTTX22iTyLz/f6439376-bc57-4891-ac64-4dde4254a423/index.m3u8"
2754
+ * }
2755
+ * ```
2756
+ */
2757
+ export declare interface ManagementGenerateSourceResponse {
2758
+ sessionId: string;
2759
+ url: string;
2760
+ }
2761
+
2640
2762
  /**
2641
2763
  * @public
2642
2764
  */
@@ -2937,17 +3059,11 @@ export declare type NoGraphicsScene = InteractiveWidgetSceneBase<InteractiveWidg
2937
3059
  */
2938
3060
  export declare type NonAdSourceType = Exclude<SourceType, SourceType.ADVERTISEMENT>;
2939
3061
 
2940
- declare interface Notification_2 {
2941
- id: string;
2942
- name: string;
2943
- targeting: NotificationTargeting | null;
2944
- templateId: string;
2945
- thumbnailUrl?: string;
2946
- triggerType: NotificationTriggerType;
2947
- scheduleTime?: Date;
2948
- status?: NotificationStatus;
2949
- substitutions: NotificationSubstitution[];
2950
- }
3062
+ declare type Notification_2 = {
3063
+ type: NotificationType.PUSH;
3064
+ } & SchedulePushNotificationPayload | {
3065
+ type?: NotificationType.EMAIL;
3066
+ } & EmailNotification;
2951
3067
  export { Notification_2 as Notification }
2952
3068
 
2953
3069
  export declare interface NotificationDuration {
@@ -3018,6 +3134,11 @@ export declare interface NotificationTargeting {
3018
3134
 
3019
3135
  export declare type NotificationTriggerType = 'scheduled' | 'manual' | 'purchaseStatusChange' | 'duration' | 'userRegistration';
3020
3136
 
3137
+ export declare enum NotificationType {
3138
+ PUSH = "PUSH",
3139
+ EMAIL = "EMAIL"
3140
+ }
3141
+
3021
3142
  /**
3022
3143
  * @public
3023
3144
  */
@@ -3132,6 +3253,7 @@ export declare interface OrganizationSettingsField extends OrganizationResponsiv
3132
3253
  };
3133
3254
  rss?: {
3134
3255
  title?: string;
3256
+ enabled?: boolean;
3135
3257
  };
3136
3258
  /**
3137
3259
  * Setting for EPG screen on web
@@ -3161,6 +3283,9 @@ export declare interface OrganizationSettingsField extends OrganizationResponsiv
3161
3283
  };
3162
3284
  };
3163
3285
  voucher?: VoucherPageConfiguration;
3286
+ pushNotifications?: {
3287
+ enabled?: boolean;
3288
+ };
3164
3289
  }
3165
3290
 
3166
3291
  /**
@@ -4346,6 +4471,20 @@ export declare enum PurchaseStatus {
4346
4471
  */
4347
4472
  export declare type PurchaseType = 'transaction' | 'subscription' | 'voucher';
4348
4473
 
4474
+ export declare type PushNotificationSchedulerRequest = {
4475
+ operation: SchedulerOperation.SCHEDULE;
4476
+ status: NotificationStatus;
4477
+ payload: SchedulePushNotificationPayload;
4478
+ } | {
4479
+ operation: SchedulerOperation.UNSCHEDULE;
4480
+ organizationId: string;
4481
+ contentId: string;
4482
+ } | {
4483
+ operation: SchedulerOperation.GET_STATUS;
4484
+ organizationId: string;
4485
+ contentId: string;
4486
+ };
4487
+
4349
4488
  /**
4350
4489
  * TODO more generic name, since we support stargaze payment gateway as well
4351
4490
  * @public
@@ -4512,6 +4651,8 @@ export declare interface QuizGameGroupStats {
4512
4651
 
4513
4652
  export declare enum QuizGameGroupType {
4514
4653
  HIGHLIGHTED_PLAYERS = "HIGHLIGHTED_PLAYERS",
4654
+ /** Participants playing in Offline mode */
4655
+ LOCAL_PLAYERS = "LOCAL_PLAYERS",
4515
4656
  ALL = "ALL",
4516
4657
  PARTY = "PARTY"
4517
4658
  }
@@ -4519,7 +4660,8 @@ export declare enum QuizGameGroupType {
4519
4660
  export declare enum QuizGameRole {
4520
4661
  OBS = "OBS",
4521
4662
  HOST = "HOST",
4522
- PLAYER = "PLAYER"
4663
+ PLAYER = "PLAYER",
4664
+ LOCAL_PLAYER = "LOCAL_PLAYER"
4523
4665
  }
4524
4666
 
4525
4667
  export declare enum QuizGameStatus {
@@ -4773,6 +4915,7 @@ export declare interface RouterOverrides {
4773
4915
  urlHandle?: string;
4774
4916
  replace?: boolean;
4775
4917
  params?: string;
4918
+ callbackUrl?: string;
4776
4919
  }) => void;
4777
4920
  goToRegistrationPage: (options?: {
4778
4921
  origin?: RegistrationRedirect;
@@ -5086,6 +5229,38 @@ export declare interface ScheduleNotificationRequest {
5086
5229
  notificationPath: string;
5087
5230
  }
5088
5231
 
5232
+ export declare interface SchedulePushNotificationPayload {
5233
+ /**
5234
+ * To which content document will this notification relate to.
5235
+ */
5236
+ contentId: string;
5237
+ /**
5238
+ * Content document type.
5239
+ */
5240
+ contentType: 'video' | 'article';
5241
+ /**
5242
+ * To users of which organization should notifications be sent.
5243
+ */
5244
+ organizationId: string;
5245
+ /**
5246
+ * Contents of notification message that will be shown to users.
5247
+ */
5248
+ notification: {
5249
+ title: string;
5250
+ body?: string;
5251
+ imageUrl?: string;
5252
+ data?: {
5253
+ [key: string]: string;
5254
+ };
5255
+ };
5256
+ }
5257
+
5258
+ export declare enum SchedulerOperation {
5259
+ SCHEDULE = "SCHEDULE",
5260
+ UNSCHEDULE = "UNSCHEDULE",
5261
+ GET_STATUS = "GET_STATUS"
5262
+ }
5263
+
5089
5264
  /**
5090
5265
  * @public
5091
5266
  */
@@ -5270,6 +5445,27 @@ export declare interface SendMessageResponse {
5270
5445
  messageId?: string;
5271
5446
  }
5272
5447
 
5448
+ export declare interface SendPushNotificationsResponse {
5449
+ /**
5450
+ * Potential user count to send notifications to.
5451
+ * Will include organization users that have at least 1 device registered to receive notifications.
5452
+ */
5453
+ potentialUserCount: number;
5454
+ /**
5455
+ * Potential device count from users to send notifications to.
5456
+ * Resulting number is equals to {@link successNotificationCount} + {@link failureNotificationCount}
5457
+ */
5458
+ potentialDeviceCount: number;
5459
+ /**
5460
+ * Number of successfully sent notifications.
5461
+ */
5462
+ successNotificationCount: number;
5463
+ /**
5464
+ * Number of notifications that failed to send.
5465
+ */
5466
+ failureNotificationCount: number;
5467
+ }
5468
+
5273
5469
  export declare interface SendTivioTemplateEmailRequest {
5274
5470
  notificationId: string;
5275
5471
  organizationId: string;
@@ -5305,6 +5501,24 @@ export declare interface SeriesTileSpecificData {
5305
5501
  availableSeasons: AvailableSeason[];
5306
5502
  }
5307
5503
 
5504
+ /**
5505
+ * @public
5506
+ */
5507
+ export declare enum SessionType {
5508
+ /**
5509
+ * Umbrella streaming - viewer will be able to switch between different sources linked to the main source.
5510
+ */
5511
+ INTERACTIVE = "interactive",
5512
+ /**
5513
+ * Classic streaming - viewer will be able to watch a single LIVE source.
5514
+ */
5515
+ LIVE = "live",
5516
+ /**
5517
+ * On-demand streaming - viewer will be able to watch a single VOD source.
5518
+ */
5519
+ ON_DEMAND = "ondemand"
5520
+ }
5521
+
5308
5522
  export declare interface SetCustomClaimsRequest {
5309
5523
  organizationId: string;
5310
5524
  }
@@ -5565,6 +5779,19 @@ export declare type StartAndContinuePosition = {
5565
5779
  continueFromPosition?: number;
5566
5780
  };
5567
5781
 
5782
+ export declare type StartLiveStreamPayload = BaseWidgetControlPayload;
5783
+
5784
+ declare interface StartLiveStreamRequest {
5785
+ action: 'startLiveStream';
5786
+ payload: StartLiveStreamPayload;
5787
+ }
5788
+
5789
+ export declare interface StartLiveStreamResponse {
5790
+ liveStreamProcessPath: string;
5791
+ streamingStudioProcessPath: string;
5792
+ error?: string;
5793
+ }
5794
+
5568
5795
  /**
5569
5796
  * @public
5570
5797
  */
@@ -5687,8 +5914,8 @@ export declare interface Tag extends RowItem {
5687
5914
  detailBanner?: string;
5688
5915
  availableSeasons?: AvailableSeason[];
5689
5916
  isFavorite: boolean;
5690
- addToFavorites: () => void;
5691
- removeFromFavorites: () => void;
5917
+ addToFavorites: () => Promise<void>;
5918
+ removeFromFavorites: () => Promise<void>;
5692
5919
  cover: string;
5693
5920
  getApplicationName: () => string | undefined;
5694
5921
  seriesRef?: DocumentReference<any>;
@@ -6688,6 +6915,25 @@ export declare enum TvStreamType {
6688
6915
  */
6689
6916
  export declare const TvTivioProvider: React_2.FC<TivioProviderProps>;
6690
6917
 
6918
+ export declare type UpdateNotificationSettingsRequest = {
6919
+ tokenToAdd: string;
6920
+ platform: string;
6921
+ tokenToDelete?: string;
6922
+ validateToken?: never;
6923
+ } | {
6924
+ tokenToDelete: string;
6925
+ tokenToAdd?: never;
6926
+ platform?: never;
6927
+ validateToken?: never;
6928
+ } | {
6929
+ validateToken: string;
6930
+ tokenToAdd?: never;
6931
+ platform?: never;
6932
+ tokenToDelete?: never;
6933
+ };
6934
+
6935
+ export declare type UpdateNotificationSettingsResponse = Promise<boolean>;
6936
+
6691
6937
  export declare type UpsertCommentResponse = AddEditCommentResponse | DeleteCommentResponse;
6692
6938
 
6693
6939
  /**
@@ -6782,7 +7028,7 @@ export declare const useChannelSource: (tvChannelId: string) => {
6782
7028
  * but for live video with comments, we want to subscribe to conversation
6783
7029
  */
6784
7030
  export declare type UseComments = (options: UseMessagesOptions) => {
6785
- pagination: PaginationInterface<Comment>;
7031
+ pagination: PaginationInterface<unknown>;
6786
7032
  addComment: (options: AddMessageOptions) => Promise<UseMessagesAddEditMessageResponse>;
6787
7033
  editComment: (options: EditMessageOptions) => Promise<UseMessagesAddEditMessageResponse>;
6788
7034
  deleteComment: (commentId: string) => Promise<UseMessagesDeleteMessageResponse>;
@@ -7045,6 +7291,9 @@ export declare type User = {
7045
7291
  getAllExtendableSubscriptions: () => Promise<Purchase[]>;
7046
7292
  getRssValidToken: () => Promise<TokenInterface | undefined>;
7047
7293
  getRssUrl: () => Promise<GetUserRssUrlResponse>;
7294
+ getFavorites: (options?: GetUserProfileDataOptions) => Promise<FavoriteWithData[]>;
7295
+ getWatchPositions: (options?: GetUserProfileDataOptions) => Promise<WatchPositionWithData[]>;
7296
+ getWatchHistory: (options?: GetUserProfileDataOptions) => Promise<WatchPositionWithData[]>;
7048
7297
  invalidateAllTokens: (type: TokenType) => Promise<void>;
7049
7298
  isPartiallyRegistered: boolean;
7050
7299
  conversationStore: ConversationStore;
@@ -7076,6 +7325,16 @@ export declare enum UserGroup {
7076
7325
  PREMIUM = "premium"
7077
7326
  }
7078
7327
 
7328
+ export declare interface UserNotificationRegistrationToken {
7329
+ token: string;
7330
+ platform?: string;
7331
+ created: Timestamp;
7332
+ }
7333
+
7334
+ export declare interface UserNotificationSettings {
7335
+ registrationTokens?: UserNotificationRegistrationToken[];
7336
+ }
7337
+
7079
7338
  /**
7080
7339
  * @public
7081
7340
  */
@@ -7344,6 +7603,16 @@ export declare interface verifyCustomTokenProps {
7344
7603
  organizationPath: string;
7345
7604
  }
7346
7605
 
7606
+ declare interface VerifyJoinCodePayload extends BaseWidgetControlPayload {
7607
+ joinCode: string;
7608
+ shouldJoinPlayer?: boolean;
7609
+ }
7610
+
7611
+ export declare interface VerifyJoinCodeRequest {
7612
+ action: 'verifyJoinCode';
7613
+ payload: VerifyJoinCodePayload;
7614
+ }
7615
+
7347
7616
  /**
7348
7617
  * @public
7349
7618
  */
@@ -7400,8 +7669,8 @@ export declare interface Video extends RowItem, MonetizableItem, ReactableConten
7400
7669
  tasting: Video | null;
7401
7670
  watchPosition: number | null;
7402
7671
  isFavorite: boolean;
7403
- addToFavorites: () => void;
7404
- removeFromFavorites: () => void;
7672
+ addToFavorites: () => Promise<void>;
7673
+ removeFromFavorites: () => Promise<void>;
7405
7674
  availability: ContentAvailability | null;
7406
7675
  sourceLanguages: LangCode[];
7407
7676
  urlByLanguage: (lang: LangCode) => string | undefined;
@@ -7925,6 +8194,21 @@ export declare interface WarningConfirmationOverlayPayload extends ConfirmationO
7925
8194
  subscriptionExpirationText?: string;
7926
8195
  }
7927
8196
 
8197
+ /**
8198
+ * @public
8199
+ */
8200
+ export declare interface WatchPositionWithData extends Omit<UserWatchPositionField, 'videoRef' | 'tagRef'> {
8201
+ /**
8202
+ * Video that given watch position is related to.
8203
+ */
8204
+ video: Video;
8205
+ /**
8206
+ * If user watches episode of series, we have to save series ref as well.
8207
+ * Same for {@link episodeNumber} and {@link seasonNumber}.
8208
+ */
8209
+ tag?: Tag;
8210
+ }
8211
+
7928
8212
  /**
7929
8213
  * @public
7930
8214
  */
@@ -8334,6 +8618,16 @@ export declare type Widget = {
8334
8618
  lastVideo: Video | null;
8335
8619
  };
8336
8620
 
8621
+ export declare type WidgetControlRequest = StartLiveStreamRequest | ChangeWidgetStateRequest_2 | GenerateWidgetJoinCodeRequest | VerifyJoinCodeRequest;
8622
+
8623
+ 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;
8624
+
8625
+ export declare interface WidgetSecret {
8626
+ code: string;
8627
+ type: 'JWT' | 'alphanumeric';
8628
+ expired?: Date;
8629
+ }
8630
+
8337
8631
  /**
8338
8632
  * @public
8339
8633
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "9.2.0",
3
+ "version": "9.3.1",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -38,7 +38,7 @@
38
38
  "@material-ui/core": "^4.11.2",
39
39
  "@material-ui/icons": "^4.11.2",
40
40
  "@sentry/browser": "^6.1.0",
41
- "@tivio/common": "1.1.131",
41
+ "@tivio/common": "1.1.133",
42
42
  "dayjs": "^1.11.0",
43
43
  "es7-object-polyfill": "^1.0.1",
44
44
  "firebase": "8.10.1",