@tivio/sdk-react 9.2.0-alpha.3 → 9.2.0-alpha.4

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/README.md CHANGED
@@ -5,9 +5,14 @@ above Tivio Studio. You can comfortably manage all you videos, settings such as
5
5
  settings in the administration of Tivio Studio while having the freedom to build your own application.
6
6
 
7
7
  ## Changelog
8
+ * 9.2.0-alpha.4
9
+ * patch: expose getUser, resetPassword and signOut methods in RemoteBundleState type
10
+ * patch: more precise types for user profile fields and methods
11
+ * patch: add missing jsdocs for some User type fields
12
+
8
13
  * 9.2.0-alpha.0
9
14
  * minor: add renderWebPlayer method for rendering outside of React
10
- * minor: "expose createTivio"
15
+ * minor: "expose createTivio"
11
16
 
12
17
  * 9.1.7
13
18
  * patch: update remote controller component API
package/README.md.bak CHANGED
@@ -5,9 +5,14 @@ above Tivio Studio. You can comfortably manage all you videos, settings such as
5
5
  settings in the administration of Tivio Studio while having the freedom to build your own application.
6
6
 
7
7
  ## Changelog
8
+ * 9.2.0-alpha.4
9
+ * patch: expose getUser, resetPassword and signOut methods in RemoteBundleState type
10
+ * patch: more precise types for user profile fields and methods
11
+ * patch: add missing jsdocs for some User type fields
12
+
8
13
  * 9.2.0-alpha.0
9
14
  * minor: add renderWebPlayer method for rendering outside of React
10
- * minor: "expose createTivio"
15
+ * minor: "expose createTivio"
11
16
 
12
17
  * 9.1.7
13
18
  * patch: update remote controller component API
package/dist/index.d.ts CHANGED
@@ -1052,10 +1052,12 @@ export declare interface CreateUserPayload {
1052
1052
  isAnonymous?: boolean;
1053
1053
  }
1054
1054
 
1055
+ export declare type CreateUserProfileRequest = Omit<UserProfile, 'id'>;
1056
+
1055
1057
  /**
1056
1058
  * @public
1057
1059
  */
1058
- export declare type CreateUserWithEmailAndPassword = (email: string, password: string, username?: string, phoneNumber?: string, referralToken?: string) => Promise<string | null>;
1060
+ export declare type CreateUserWithEmailAndPassword = (email: string, password: string, username: string, phoneNumber?: string, referralToken?: string) => Promise<string | null>;
1059
1061
 
1060
1062
  export declare interface CreatorsWithVoucherSubscriptions {
1061
1063
  id: string;
@@ -1672,6 +1674,10 @@ export declare interface GetSourceUrlRequest {
1672
1674
  * Start time in ms, for live streams. Will return manifest with desired start.
1673
1675
  */
1674
1676
  startTimeMs?: number;
1677
+ /**
1678
+ * Parameters related to ads.
1679
+ */
1680
+ adParams?: Record<string, string | number | undefined>;
1675
1681
  }
1676
1682
 
1677
1683
  export declare interface GetSourceUrlResponse {
@@ -5469,20 +5475,27 @@ export declare type TivioAnalytics = {
5469
5475
  */
5470
5476
  export declare interface TivioAuth {
5471
5477
  /**
5478
+ * Create and sign up new user with given email and password.
5472
5479
  * @param email
5473
5480
  * @param password
5481
+ * @returns {string} - uid of newly created and signed-up user
5474
5482
  */
5475
5483
  createUserWithEmailAndPassword: CreateUserWithEmailAndPassword;
5476
5484
  /**
5477
- * Sign in the user and starts listening on his purchases
5485
+ * Sign in the user with given email and password and start listening on their purchases.
5478
5486
  * @param email
5479
5487
  * @param password
5488
+ * @returns {string} - uid of signed-in user.
5480
5489
  */
5481
5490
  signInWithEmailAndPassword: (email: string, password: string) => Promise<string | null>;
5482
5491
  signInWithCustomToken: (token: string) => Promise<string | null>;
5492
+ /**
5493
+ * Signs out currently signed-in user.
5494
+ */
5483
5495
  signOut: () => Promise<void>;
5484
5496
  /**
5485
- * Used for reset forgotten password by user
5497
+ * Resets password for given user email.
5498
+ * @param email
5486
5499
  */
5487
5500
  resetPassword: (email: string) => Promise<void>;
5488
5501
  }
@@ -5625,13 +5638,13 @@ export declare type TivioGetters = {
5625
5638
  /**
5626
5639
  * Get video by its id.
5627
5640
  * @param videoId - video id
5628
- * @returns {Promise<Video | null>} video or null if video does not exists
5641
+ * @returns {Promise<Video | null>} video or null if video does not exist
5629
5642
  */
5630
5643
  getVideoById: (videoId: string) => Promise<Video | null>;
5631
5644
  /**
5632
5645
  * Get screen by its id.
5633
5646
  * @param screenId - screen id
5634
- * @returns {Promise<Screen | null>} screen or null if screen does not exists
5647
+ * @returns {Promise<Screen | null>} screen or null if screen does not exist
5635
5648
  */
5636
5649
  getScreenById: (screenId: string, cb?: (error: Error | null, data: Screen_2 | null, disposer?: Disposer_2) => void) => Promise<Screen_2 | null>;
5637
5650
  /**
@@ -5639,6 +5652,11 @@ export declare type TivioGetters = {
5639
5652
  * @returns PlayerCapability[]
5640
5653
  */
5641
5654
  getPlayerCapabilities: () => PlayerCapability[];
5655
+ /**
5656
+ * Get currently logged-in user. If no user is logged in, returns `null`.
5657
+ * @returns User
5658
+ */
5659
+ getUser: () => User | null;
5642
5660
  };
5643
5661
 
5644
5662
  /**
@@ -5834,7 +5852,7 @@ export declare type TivioJsBundleExposedApi = {
5834
5852
  getTagById: (tagId: string) => Promise<Tag | null>;
5835
5853
  createPlayerWrapper: (playerImplementation: PlayerInterfaceForPlayerWrapper) => TivioPlayerWrapper;
5836
5854
  destroy: () => Promise<void>;
5837
- } & Pick<TivioGetters, 'getVideoById' | 'getScreenById' | 'organization'> & Pick<TivioSubscriptions, 'subscribeToVideo' | 'subscribeToItemsInRow' | 'subscribeToRowsInScreen'> & Pick<TivioAuth, 'createUserWithEmailAndPassword' | 'signInWithEmailAndPassword'> & Pick<TivioSetters, 'setBundleVersion' | 'setUser' | 'setLanguage' | 'setStorageManager'>;
5855
+ } & Pick<TivioGetters, 'getVideoById' | 'getScreenById' | 'organization' | 'getUser'> & Pick<TivioSubscriptions, 'subscribeToVideo' | 'subscribeToItemsInRow' | 'subscribeToRowsInScreen'> & Pick<TivioAuth, 'createUserWithEmailAndPassword' | 'signInWithEmailAndPassword' | 'resetPassword' | 'signOut'> & Pick<TivioSetters, 'setBundleVersion' | 'setUser' | 'setLanguage' | 'setStorageManager'>;
5838
5856
 
5839
5857
  /**
5840
5858
  * @public
@@ -6476,18 +6494,45 @@ export declare type User = {
6476
6494
  isPurchasesInitialized: boolean;
6477
6495
  isSignedIn: boolean;
6478
6496
  isReady: boolean;
6497
+ /**
6498
+ * Email of this user.
6499
+ */
6479
6500
  email?: string;
6480
6501
  type?: UserType;
6481
6502
  photoURL: string | null;
6503
+ /**
6504
+ * Name of this user - typically first and last name combined, or any other nickname chosen by user.
6505
+ */
6482
6506
  name?: string;
6483
6507
  /**
6484
6508
  * Authentication id differs from {@link id}.
6485
6509
  */
6486
6510
  authUserId?: string;
6511
+ /**
6512
+ * List of content (e.g. videos / series) that user marked as their favorite.
6513
+ * Changes based on currently {@link activeUserProfileId}
6514
+ */
6487
6515
  favorites: any[];
6516
+ /**
6517
+ * List of content (e.g. videos / series) that user watched recently with precise time position where they last left watching.
6518
+ * Number of entries in the list is limited by constant number (i.e. older entries are deleted when limit is reached).
6519
+ * In some cases entries are actively removed even if they are new, for example when user watched video to the end.
6520
+ * Changes based on currently {@link activeUserProfileId}.
6521
+ */
6488
6522
  watchedPositions: any[];
6523
+ /**
6524
+ * Similar to {@link watchedPositions}, but has higher limit for number of entries,
6525
+ * and they never actively deleted (e.g. when user watched video to the end)
6526
+ * Changes based on currently {@link activeUserProfileId}.
6527
+ */
6489
6528
  watchHistory: any[];
6490
- profiles: any[];
6529
+ /**
6530
+ * List of profiles for this user.
6531
+ */
6532
+ profiles: UserProfile[];
6533
+ /**
6534
+ * Currently active user profile id.
6535
+ */
6491
6536
  activeUserProfileId: string | null;
6492
6537
  patreon?: PatreonUserAuth;
6493
6538
  subscriptionIdsToShow: string[] | null;
@@ -6495,9 +6540,22 @@ export declare type User = {
6495
6540
  isAnonymous: boolean;
6496
6541
  isDiscordConnected: boolean;
6497
6542
  disconnectDiscord: () => Promise<void>;
6498
- createUserProfile: (request: any) => Promise<void>;
6543
+ /**
6544
+ * Create new profile for this user.
6545
+ * @param request
6546
+ */
6547
+ createUserProfile: (request: CreateUserProfileRequest) => Promise<void>;
6548
+ /**
6549
+ * Delete given profile from this user.
6550
+ * @param profileId
6551
+ */
6499
6552
  deleteUserProfile: (profileId: string) => Promise<void>;
6500
- setActiveUserProfileId: (id: string) => void;
6553
+ /**
6554
+ * Activate given profile for this user.
6555
+ * After activation {@link favorites}, {@link watchedPositions} and {@link watchHistory} of given profile will be used.
6556
+ * @param profileId
6557
+ */
6558
+ setActiveUserProfileId: (profileId: string) => void;
6501
6559
  getFollowedOrganizations: () => Promise<Array<FollowedOrganizationData | undefined>>;
6502
6560
  sendFinalizeRegistrationEmail: (email: string) => Promise<void>;
6503
6561
  isUserAlreadyRegisteredByTenant: (email: string) => Promise<boolean>;