@xhub-short/contracts 0.1.0-beta.11 → 0.1.0-beta.13

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
@@ -111,6 +111,8 @@ interface BaseContentItem {
111
111
  * This is the core data model for a video in the feed
112
112
  */
113
113
  interface VideoItem extends BaseContentItem {
114
+ /** Content type discriminator */
115
+ type: 'video';
114
116
  /** Video source configuration */
115
117
  source: VideoSource;
116
118
  /** Poster/thumbnail image URL */
@@ -1589,7 +1591,7 @@ type MessageValues = Record<string, MessageValue>;
1589
1591
  * - number.* : Number formatting suffixes
1590
1592
  * - error.* : Generic errors
1591
1593
  */
1592
- type MessageKey = 'feed.loading' | 'feed.empty' | 'feed.endReached' | 'feed.error' | 'feed.retry' | 'player.loading' | 'player.error' | 'player.error.network' | 'player.error.decode' | 'player.error.notSupported' | 'player.error.aborted' | 'player.tapToRetry' | 'comment.title' | 'comment.placeholder' | 'comment.empty' | 'comment.loading' | 'comment.error' | 'comment.retry' | 'comment.post' | 'comment.reply' | 'comment.replyTo' | 'comment.viewReplies' | 'comment.hideReplies' | 'comment.loadReplies' | 'comment.viewMoreReplies' | 'comment.delete' | 'comment.edit' | 'comment.report' | 'comment.deleteConfirmTitle' | 'comment.deleteConfirmMessage' | 'comment.deleteConfirmButton' | 'comment.count' | 'comment.replyCount' | 'comment.expand' | 'comment.collapse' | 'action.like' | 'action.liked' | 'action.comment' | 'action.share' | 'action.bookmark' | 'action.bookmarked' | 'action.follow' | 'action.following' | 'time.now' | 'time.seconds' | 'time.minutes' | 'time.hours' | 'time.days' | 'time.weeks' | 'time.months' | 'time.years' | 'number.thousand' | 'number.million' | 'number.billion' | 'error.generic' | 'error.network' | 'error.timeout' | 'common.cancel' | 'cancel' | 'close' | 'ok' | 'done' | 'aria.loading' | 'aria.videoPlayer' | 'aria.retry' | 'aria.sortComments' | 'aria.closeComments' | 'aria.addMedia' | 'aria.submitComment' | 'aria.openEmoji' | 'aria.cancelReply' | 'guest.loginToComment';
1594
+ type MessageKey = 'feed.loading' | 'feed.empty' | 'feed.endReached' | 'feed.error' | 'feed.retry' | 'player.loading' | 'player.error' | 'player.error.network' | 'player.error.decode' | 'player.error.notSupported' | 'player.error.aborted' | 'player.tapToRetry' | 'comment.title' | 'comment.placeholder' | 'comment.empty' | 'comment.loading' | 'comment.error' | 'comment.retry' | 'comment.post' | 'comment.reply' | 'comment.replyTo' | 'comment.viewReplies' | 'comment.hideReplies' | 'comment.loadReplies' | 'comment.viewMoreReplies' | 'comment.delete' | 'comment.edit' | 'comment.report' | 'comment.deleteConfirmTitle' | 'comment.deleteConfirmMessage' | 'comment.deleteConfirmButton' | 'comment.count' | 'comment.replyCount' | 'comment.expand' | 'comment.collapse' | 'action.like' | 'action.liked' | 'action.comment' | 'action.share' | 'action.bookmark' | 'action.bookmarked' | 'action.follow' | 'action.following' | 'time.now' | 'time.seconds' | 'time.minutes' | 'time.hours' | 'time.days' | 'time.weeks' | 'time.months' | 'time.years' | 'number.thousand' | 'number.million' | 'number.billion' | 'error.generic' | 'error.network' | 'error.timeout' | 'common.cancel' | 'cancel' | 'close' | 'ok' | 'done' | 'aria.loading' | 'aria.videoPlayer' | 'aria.retry' | 'aria.sortComments' | 'aria.closeComments' | 'aria.addMedia' | 'aria.submitComment' | 'aria.openEmoji' | 'aria.cancelReply' | 'guest.loginToComment' | 'playlist.collection.title' | 'playlist.collection.items_count' | 'playlist.collection.empty_title' | 'playlist.collection.empty_desc' | 'playlist.collection.error_title' | 'playlist.collection.retry' | 'playlist.collection.return_home';
1593
1595
  /**
1594
1596
  * Complete message catalog type
1595
1597
  * All keys must be present
@@ -1675,6 +1677,85 @@ interface LocalizationConfig {
1675
1677
  adapter?: ILocalization;
1676
1678
  }
1677
1679
 
1680
+ /**
1681
+ * Playlist data structure
1682
+ */
1683
+ interface PlaylistData {
1684
+ /** Unique playlist ID */
1685
+ id: string;
1686
+ /** Playlist title */
1687
+ title: string;
1688
+ /** Playlist description */
1689
+ description?: string;
1690
+ /** Playlist cover image URL */
1691
+ cover?: string;
1692
+ /** List of content items in this playlist */
1693
+ items: ContentItem[];
1694
+ /** Total number of items in playlist */
1695
+ totalItems: number;
1696
+ }
1697
+ /**
1698
+ * Playlist item metadata (within a playlist)
1699
+ */
1700
+ type PlaylistItem = ContentItem & {
1701
+ /** Position in the playlist (0-indexed) */
1702
+ position: number;
1703
+ /** ID of the playlist this item belongs to */
1704
+ playlistId: string;
1705
+ };
1706
+ /**
1707
+ * Summary of a playlist for collection views
1708
+ */
1709
+ interface PlaylistSummary {
1710
+ /** Unique playlist ID */
1711
+ id: string;
1712
+ /** Playlist title */
1713
+ title: string;
1714
+ /** Playlist description */
1715
+ description?: string;
1716
+ /** Playlist cover image URL */
1717
+ cover?: string;
1718
+ /** Total number of items in playlist */
1719
+ totalItems: number;
1720
+ /** Author/Creator information */
1721
+ author?: {
1722
+ id: string;
1723
+ name: string;
1724
+ };
1725
+ /** Last update timestamp */
1726
+ updatedAt?: string;
1727
+ }
1728
+ /**
1729
+ * Response structure for playlist collection
1730
+ */
1731
+ interface PlaylistCollectionResponse {
1732
+ /** List of playlist summaries */
1733
+ playlists: PlaylistSummary[];
1734
+ /** Cursor for next page (null if no more data) */
1735
+ nextCursor: string | null;
1736
+ /** Whether there are more items to load */
1737
+ hasMore: boolean;
1738
+ }
1739
+ /**
1740
+ * Port for fetching playlist data
1741
+ */
1742
+ interface IPlaylistDataSource {
1743
+ /**
1744
+ * Fetch a complete playlist by ID
1745
+ *
1746
+ * @param id - The playlist ID
1747
+ * @returns Promise resolving to PlaylistData
1748
+ */
1749
+ fetchPlaylist(id: string): Promise<PlaylistData>;
1750
+ /**
1751
+ * Fetch a collection of playlists
1752
+ *
1753
+ * @param cursor - Pagination cursor
1754
+ * @returns Promise resolving to PlaylistCollectionResponse
1755
+ */
1756
+ fetchPlaylistCollection(cursor?: string): Promise<PlaylistCollectionResponse>;
1757
+ }
1758
+
1678
1759
  /**
1679
1760
  * UI Component Types for XHub-short SDK
1680
1761
  *
@@ -2384,4 +2465,4 @@ type IconComponent = UIComponent<{
2384
2465
  */
2385
2466
  type FormatCountFn = (count: number) => string;
2386
2467
 
2387
- export { type ActionBarHeadlessProps, type ActionBarProps, type ActionButtonHeadlessProps, type AnalyticsConfig, type AnalyticsEvent, type AnalyticsEventType, type Author, type AuthorInfoHeadlessProps, type AuthorInfoProps, type BaseContentItem, type Comment, type CommentAdapterConfig, type CommentAuthor, type CommentConfig, type CommentEndpoints, type CommentInputHeadlessProps, type CommentItem, type CommentItemHeadlessProps, type CommentListResponse, type CommentManagerState, type CommentReportReason, type CommentSheetHeadlessProps, type CommentSheetProps, type CommentState, type CommentTransformers, type ContentItem, type ContentStats, DEFAULT_COMMENT_CONFIG, DEFAULT_COMMENT_ENDPOINTS, type DeleteCommentPayload, type EditCommentPayload, type ErrorBoundaryProps, type FeedResponse, type FeedState, type FormatCountFn, type IAnalytics, type ICommentAdapter, type IDataSource, type IInteraction, type ILocalization, type ILogger, type INetworkAdapter, type IPosterLoader, type ISessionStorage, type IStorage, type IVideoLoader, type IconComponent, type ImagePost, type ImagePostStats, type InternalLogger, type LocalizationConfig, type LogEntry, type LogLevel, type LoggerConfig, type MessageCatalog, type MessageKey, type MessageValue, type MessageValues, type MockCommentAdapterConfig, type MusicInfo, type NetworkQuality, type NetworkType, type OptimisticAction, type PartialMessageCatalog, type PlaybackState, type PlayerError, type PlayerState, type PostCommentPayload, type PostReplyPayload, type PrefetchCacheData, type PreloadConfig, type PreloadResult, type PreloadStatus, type ProgressBarHeadlessProps, type ReplyItem, type ReplyItemHeadlessProps, type ReplyListResponse, type ReportCommentPayload, type ReportReason, type SDKConfig, type SessionSnapshot, type SkeletonProps, type UIAuthorActions, type UIAuthorState, type UICommentActions, type UICommentState, type UIComponent, type UIFeedState, type UIInteractionActions, type UIInteractionState, type UINode, type UIPlayerControls, type UIPlayerState, type UIRef, type UIResourceState, type UISwipeState, type UIVideoInfoActions, type UIVideoInfoState, type VideoFeedHeadlessProps, type VideoFeedProps, type VideoInfoHeadlessProps, type VideoInfoProps, type VideoItem, type VideoPlayerHeadlessProps, type VideoPlayerWiredProps, type VideoQuality, type VideoSlotHeadlessProps, type VideoSlotProps, type VideoSource, type VideoStats, type WiredComponent, type WiredComponentConfig, isImagePost, isVideoItem };
2468
+ export { type ActionBarHeadlessProps, type ActionBarProps, type ActionButtonHeadlessProps, type AnalyticsConfig, type AnalyticsEvent, type AnalyticsEventType, type Author, type AuthorInfoHeadlessProps, type AuthorInfoProps, type BaseContentItem, type Comment, type CommentAdapterConfig, type CommentAuthor, type CommentConfig, type CommentEndpoints, type CommentInputHeadlessProps, type CommentItem, type CommentItemHeadlessProps, type CommentListResponse, type CommentManagerState, type CommentReportReason, type CommentSheetHeadlessProps, type CommentSheetProps, type CommentState, type CommentTransformers, type ContentItem, type ContentStats, DEFAULT_COMMENT_CONFIG, DEFAULT_COMMENT_ENDPOINTS, type DeleteCommentPayload, type EditCommentPayload, type ErrorBoundaryProps, type FeedResponse, type FeedState, type FormatCountFn, type IAnalytics, type ICommentAdapter, type IDataSource, type IInteraction, type ILocalization, type ILogger, type INetworkAdapter, type IPlaylistDataSource, type IPosterLoader, type ISessionStorage, type IStorage, type IVideoLoader, type IconComponent, type ImagePost, type ImagePostStats, type InternalLogger, type LocalizationConfig, type LogEntry, type LogLevel, type LoggerConfig, type MessageCatalog, type MessageKey, type MessageKey as MessageKeyType, type MessageValue, type MessageValues, type MockCommentAdapterConfig, type MusicInfo, type NetworkQuality, type NetworkType, type OptimisticAction, type PartialMessageCatalog, type PlaybackState, type PlayerError, type PlayerState, type PlaylistCollectionResponse, type PlaylistData, type PlaylistItem, type PlaylistSummary, type PostCommentPayload, type PostReplyPayload, type PrefetchCacheData, type PreloadConfig, type PreloadResult, type PreloadStatus, type ProgressBarHeadlessProps, type ReplyItem, type ReplyItemHeadlessProps, type ReplyListResponse, type ReportCommentPayload, type ReportReason, type SDKConfig, type SessionSnapshot, type SkeletonProps, type UIAuthorActions, type UIAuthorState, type UICommentActions, type UICommentState, type UIComponent, type UIFeedState, type UIInteractionActions, type UIInteractionState, type UINode, type UIPlayerControls, type UIPlayerState, type UIRef, type UIResourceState, type UISwipeState, type UIVideoInfoActions, type UIVideoInfoState, type VideoFeedHeadlessProps, type VideoFeedProps, type VideoInfoHeadlessProps, type VideoInfoProps, type VideoItem, type VideoPlayerHeadlessProps, type VideoPlayerWiredProps, type VideoQuality, type VideoSlotHeadlessProps, type VideoSlotProps, type VideoSource, type VideoStats, type WiredComponent, type WiredComponentConfig, isImagePost, isVideoItem };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // src/types.ts
2
2
  function isVideoItem(item) {
3
- return "source" in item && "duration" in item;
3
+ return item.type === "video";
4
4
  }
5
5
  function isImagePost(item) {
6
- return "type" in item && item.type === "image" && "images" in item;
6
+ return item.type === "image";
7
7
  }
8
8
 
9
9
  // src/comment-types.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xhub-short/contracts",
3
3
  "sideEffects": false,
4
- "version": "0.1.0-beta.11",
4
+ "version": "0.1.0-beta.13",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -22,7 +22,7 @@
22
22
  "devDependencies": {
23
23
  "tsup": "^8.3.0",
24
24
  "typescript": "^5.7.0",
25
- "@xhub-short/tsconfig": "0.0.0"
25
+ "@xhub-short/tsconfig": "0.0.1-beta.1"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsup",