@postrun/react 2.1.0 → 2.2.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.cts CHANGED
@@ -3,7 +3,7 @@ import { ReactNode, CSSProperties } from 'react';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { QueryClient, QueryKey } from '@tanstack/react-query';
5
5
  import { PostrunClient, ListProfilesQuery, DiscoverableAccountList, Connection, ConnectionKind, ConnectionStatus, ListMediaQuery, ListPostsQuery, ConnectablePlatform, MediaResource, MediaTarget, MediaKind, Metadata, ComposePostInput, PostValidation, XPostVariant, LinkedInPostVariant } from '@postrun/js';
6
- export { PostValidation, PostVariant, PostVariantError, ValidationIssue } from '@postrun/js';
6
+ export { PostValidation, PostVariant, PostVariantError, TikTokCreatorInfo, ValidationIssue } from '@postrun/js';
7
7
  import { TwitterComponents } from 'react-tweet';
8
8
 
9
9
  /**
@@ -333,6 +333,11 @@ declare const connectionKeys: {
333
333
  detail: (id: string) => readonly ["postrun", "connections", "detail", string];
334
334
  accounts: (id: string) => readonly ["postrun", "connections", "accounts", string];
335
335
  };
336
+ /** Query-key factory for TikTok reads (creator info keyed by connection id). */
337
+ declare const tiktokKeys: {
338
+ all: readonly ["postrun", "tiktok"];
339
+ creatorInfo: (connectionId: string) => readonly ["postrun", "tiktok", "creator-info", string];
340
+ };
336
341
 
337
342
  interface UseConnectParams {
338
343
  /** The profile to attach the new connection to. */
@@ -1332,7 +1337,7 @@ declare function useCreatePost(profileId: string): {
1332
1337
  }>;
1333
1338
  }[];
1334
1339
  isReady: boolean;
1335
- connectedChannels: ("x" | "linkedin" | "facebook_page" | "instagram" | "tiktok")[];
1340
+ connectedChannels: ("tiktok" | "x" | "linkedin" | "facebook_page" | "instagram")[];
1336
1341
  };
1337
1342
  /**
1338
1343
  * Validate a composed post WITHOUT saving or publishing it — the read-scoped
@@ -1351,7 +1356,7 @@ declare function useValidatePost(profileId: string): {
1351
1356
  validate: (input: Omit<ComposePostInput, "profileId">) => Promise<PostValidation>;
1352
1357
  publishable: boolean | undefined;
1353
1358
  issues: {
1354
- code: "unauthorized" | "forbidden" | "not_found" | "conflict" | "validation_failed" | "rate_limited" | "internal_error" | "idempotency_key_invalid" | "idempotency_key_reused" | "idempotency_request_in_progress" | "account_not_available" | "connection_reauth_required" | "connection_not_pending" | "not_implemented" | "connection_discovery_failed" | "media_processing" | "not_publishable" | "invalid_connection" | "invalid_media" | "profile_scope_invalid" | "media_unprobeable" | "media_too_large" | "media_aspect_ratio_unsupported" | "media_resolution_too_low" | "media_gif_unsupported" | "media_format_recompressed" | "media_resolution_downscaled" | "video_container_unsupported" | "video_codec_unsupported" | "video_audio_codec_unsupported" | "video_too_large" | "video_too_small" | "video_dimensions_unsupported" | "video_dimensions_too_large" | "video_fps_unsupported" | "video_fps_too_low" | "video_aspect_unsupported" | "video_duration_too_short" | "video_duration_exceeds_max" | "video_transform_failed" | "media_fetch_failed" | "document_format_unsupported" | "document_too_large" | "document_too_many_pages" | "media_format_indeterminate" | "media_count_invalid" | "body_too_long" | "content_missing" | "content_conflict" | "content_incomplete" | "content_kind_mismatch" | "media_type_mismatch" | "tag_limit_exceeded" | "reel_field_on_non_reel" | "field_placement_invalid" | "media_not_ready" | "media_failed" | "media_unsupported" | "media_kind_mismatch" | "variant_unparseable" | "publishing_unavailable" | "x_duplicate_content" | "x_not_authorized" | "x_access_not_permitted" | "x_rate_limited" | "x_publish_failed" | "x_media_upload_failed" | "linkedin_duplicate_content" | "linkedin_auth_expired" | "linkedin_permission_denied" | "linkedin_media_processing" | "linkedin_media_upload_failed" | "linkedin_publish_failed" | "instagram_media_processing" | "instagram_container_expired" | "instagram_container_failed" | "instagram_rate_limited" | "instagram_not_authorized" | "instagram_publish_failed" | "facebook_reel_processing" | "facebook_reel_failed" | "facebook_rate_limited" | "facebook_not_authorized" | "facebook_publish_failed" | "tiktok_privacy_not_allowed" | "tiktok_duration_exceeds_max" | "tiktok_media_processing" | "tiktok_not_authorized" | "tiktok_rate_limited" | "tiktok_publish_failed" | "connection_platform_mismatch" | "connection_removed";
1359
+ code: "unauthorized" | "forbidden" | "not_found" | "conflict" | "validation_failed" | "rate_limited" | "internal_error" | "idempotency_key_invalid" | "idempotency_key_reused" | "idempotency_request_in_progress" | "account_not_available" | "connection_reauth_required" | "connection_not_pending" | "not_implemented" | "connection_discovery_failed" | "tiktok_creator_info_unavailable" | "media_processing" | "not_publishable" | "invalid_connection" | "invalid_media" | "profile_scope_invalid" | "media_unprobeable" | "media_too_large" | "media_aspect_ratio_unsupported" | "media_resolution_too_low" | "media_gif_unsupported" | "media_format_recompressed" | "media_resolution_downscaled" | "video_container_unsupported" | "video_codec_unsupported" | "video_audio_codec_unsupported" | "video_too_large" | "video_too_small" | "video_dimensions_unsupported" | "video_dimensions_too_large" | "video_fps_unsupported" | "video_fps_too_low" | "video_aspect_unsupported" | "video_duration_too_short" | "video_duration_exceeds_max" | "video_transform_failed" | "media_fetch_failed" | "document_format_unsupported" | "document_too_large" | "document_too_many_pages" | "media_format_indeterminate" | "media_count_invalid" | "body_too_long" | "content_missing" | "content_conflict" | "content_incomplete" | "content_kind_mismatch" | "media_type_mismatch" | "tag_limit_exceeded" | "reel_field_on_non_reel" | "field_placement_invalid" | "media_not_ready" | "media_failed" | "media_unsupported" | "media_kind_mismatch" | "variant_unparseable" | "publishing_unavailable" | "x_duplicate_content" | "x_not_authorized" | "x_access_not_permitted" | "x_rate_limited" | "x_publish_failed" | "x_media_upload_failed" | "linkedin_duplicate_content" | "linkedin_auth_expired" | "linkedin_permission_denied" | "linkedin_rate_limited" | "linkedin_media_processing" | "linkedin_media_failed" | "linkedin_media_upload_failed" | "linkedin_publish_failed" | "instagram_media_processing" | "instagram_container_expired" | "instagram_container_failed" | "instagram_rate_limited" | "instagram_not_authorized" | "instagram_publish_failed" | "facebook_reel_processing" | "facebook_reel_failed" | "facebook_rate_limited" | "facebook_not_authorized" | "facebook_publish_failed" | "tiktok_privacy_not_allowed" | "tiktok_duration_exceeds_max" | "tiktok_media_processing" | "tiktok_not_authorized" | "tiktok_rate_limited" | "tiktok_publish_failed" | "post_publish_failed" | "post_partially_published" | "connection_platform_mismatch" | "connection_removed";
1355
1360
  message: string;
1356
1361
  hint?: string;
1357
1362
  allowed?: Array<string>;
@@ -1362,7 +1367,7 @@ declare function useValidatePost(profileId: string): {
1362
1367
  isPending: boolean;
1363
1368
  error: Error | null;
1364
1369
  isReady: boolean;
1365
- connectedChannels: ("x" | "linkedin" | "facebook_page" | "instagram" | "tiktok")[];
1370
+ connectedChannels: ("tiktok" | "x" | "linkedin" | "facebook_page" | "instagram")[];
1366
1371
  };
1367
1372
  /**
1368
1373
  * Update a post by id. Pass a light edit directly (`{ schedule_at }`,
@@ -1568,6 +1573,36 @@ declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
1568
1573
  deleted: true;
1569
1574
  }, Error, string, unknown>;
1570
1575
 
1576
+ /**
1577
+ * Fetch a TikTok connection's live creator info — the data TikTok's Content
1578
+ * Posting policy REQUIRES the publishing UI to render before a post: the
1579
+ * `creator` (nickname + avatar), the `privacy_options` to offer (with NO default
1580
+ * selected — render each with `tiktokPrivacyLabel`), the positive `interaction`
1581
+ * (allowed) flags for the Comment/Duet/Stitch toggles, and the per-account video
1582
+ * length cap (`max_video_duration_sec`).
1583
+ *
1584
+ * Pass the id of the TikTok connection the composer is posting through, or `null`
1585
+ * when none is selected yet — the query is DISABLED while `connectionId` is null
1586
+ * (no request fires). The host knows which connection is TikTok (it picked it), so
1587
+ * only call this for a TikTok connection; a non-TikTok id surfaces a 404 as
1588
+ * `error` (the API never leaks the platform). Returns the standard react-query
1589
+ * result — read `data` (the creator info), `isLoading`, and `error`.
1590
+ */
1591
+ declare function useTikTokCreatorInfo(connectionId: string | null): _tanstack_react_query.UseQueryResult<NoInfer<{
1592
+ creator: {
1593
+ nickname: string;
1594
+ username: string;
1595
+ avatar_url: string | null;
1596
+ };
1597
+ privacy_options: Array<"PUBLIC_TO_EVERYONE" | "MUTUAL_FOLLOW_FRIENDS" | "FOLLOWER_OF_CREATOR" | "SELF_ONLY">;
1598
+ interaction: {
1599
+ comment: boolean;
1600
+ duet: boolean;
1601
+ stitch: boolean;
1602
+ };
1603
+ max_video_duration_sec: number;
1604
+ }>, Error>;
1605
+
1571
1606
  /**
1572
1607
  * Public input types for the post-preview components. These describe data the
1573
1608
  * CUSTOMER supplies for presentation — NOT shapes from our OpenAPI contract — so
@@ -1716,4 +1751,4 @@ declare function LinkedInPostPreviewImpl({ variant, author, media, theme, time,
1716
1751
  * absorbs unstable media arrays). */
1717
1752
  declare const LinkedInPostPreview: react.MemoExoticComponent<typeof LinkedInPostPreviewImpl>;
1718
1753
 
1719
- export { type CalendarFilters, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionsFilter, type DiscoverableAccount, type InfiniteList, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, UploadError, type UseConnectParams, type UseConnectResult, type UseMediaUploadOptions, type UseMediaUploadResult, XPostPreview, type XPostPreviewProps, type XPreviewAuthor, type XPreviewMedia, type XPreviewQuotedTweet, connectionKeys, mediaKeys, postKeys, profileKeys, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
1754
+ export { type CalendarFilters, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionsFilter, type DiscoverableAccount, type InfiniteList, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, UploadError, type UseConnectParams, type UseConnectResult, type UseMediaUploadOptions, type UseMediaUploadResult, XPostPreview, type XPostPreviewProps, type XPreviewAuthor, type XPreviewMedia, type XPreviewQuotedTweet, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useTikTokCreatorInfo, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { ReactNode, CSSProperties } from 'react';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { QueryClient, QueryKey } from '@tanstack/react-query';
5
5
  import { PostrunClient, ListProfilesQuery, DiscoverableAccountList, Connection, ConnectionKind, ConnectionStatus, ListMediaQuery, ListPostsQuery, ConnectablePlatform, MediaResource, MediaTarget, MediaKind, Metadata, ComposePostInput, PostValidation, XPostVariant, LinkedInPostVariant } from '@postrun/js';
6
- export { PostValidation, PostVariant, PostVariantError, ValidationIssue } from '@postrun/js';
6
+ export { PostValidation, PostVariant, PostVariantError, TikTokCreatorInfo, ValidationIssue } from '@postrun/js';
7
7
  import { TwitterComponents } from 'react-tweet';
8
8
 
9
9
  /**
@@ -333,6 +333,11 @@ declare const connectionKeys: {
333
333
  detail: (id: string) => readonly ["postrun", "connections", "detail", string];
334
334
  accounts: (id: string) => readonly ["postrun", "connections", "accounts", string];
335
335
  };
336
+ /** Query-key factory for TikTok reads (creator info keyed by connection id). */
337
+ declare const tiktokKeys: {
338
+ all: readonly ["postrun", "tiktok"];
339
+ creatorInfo: (connectionId: string) => readonly ["postrun", "tiktok", "creator-info", string];
340
+ };
336
341
 
337
342
  interface UseConnectParams {
338
343
  /** The profile to attach the new connection to. */
@@ -1332,7 +1337,7 @@ declare function useCreatePost(profileId: string): {
1332
1337
  }>;
1333
1338
  }[];
1334
1339
  isReady: boolean;
1335
- connectedChannels: ("x" | "linkedin" | "facebook_page" | "instagram" | "tiktok")[];
1340
+ connectedChannels: ("tiktok" | "x" | "linkedin" | "facebook_page" | "instagram")[];
1336
1341
  };
1337
1342
  /**
1338
1343
  * Validate a composed post WITHOUT saving or publishing it — the read-scoped
@@ -1351,7 +1356,7 @@ declare function useValidatePost(profileId: string): {
1351
1356
  validate: (input: Omit<ComposePostInput, "profileId">) => Promise<PostValidation>;
1352
1357
  publishable: boolean | undefined;
1353
1358
  issues: {
1354
- code: "unauthorized" | "forbidden" | "not_found" | "conflict" | "validation_failed" | "rate_limited" | "internal_error" | "idempotency_key_invalid" | "idempotency_key_reused" | "idempotency_request_in_progress" | "account_not_available" | "connection_reauth_required" | "connection_not_pending" | "not_implemented" | "connection_discovery_failed" | "media_processing" | "not_publishable" | "invalid_connection" | "invalid_media" | "profile_scope_invalid" | "media_unprobeable" | "media_too_large" | "media_aspect_ratio_unsupported" | "media_resolution_too_low" | "media_gif_unsupported" | "media_format_recompressed" | "media_resolution_downscaled" | "video_container_unsupported" | "video_codec_unsupported" | "video_audio_codec_unsupported" | "video_too_large" | "video_too_small" | "video_dimensions_unsupported" | "video_dimensions_too_large" | "video_fps_unsupported" | "video_fps_too_low" | "video_aspect_unsupported" | "video_duration_too_short" | "video_duration_exceeds_max" | "video_transform_failed" | "media_fetch_failed" | "document_format_unsupported" | "document_too_large" | "document_too_many_pages" | "media_format_indeterminate" | "media_count_invalid" | "body_too_long" | "content_missing" | "content_conflict" | "content_incomplete" | "content_kind_mismatch" | "media_type_mismatch" | "tag_limit_exceeded" | "reel_field_on_non_reel" | "field_placement_invalid" | "media_not_ready" | "media_failed" | "media_unsupported" | "media_kind_mismatch" | "variant_unparseable" | "publishing_unavailable" | "x_duplicate_content" | "x_not_authorized" | "x_access_not_permitted" | "x_rate_limited" | "x_publish_failed" | "x_media_upload_failed" | "linkedin_duplicate_content" | "linkedin_auth_expired" | "linkedin_permission_denied" | "linkedin_media_processing" | "linkedin_media_upload_failed" | "linkedin_publish_failed" | "instagram_media_processing" | "instagram_container_expired" | "instagram_container_failed" | "instagram_rate_limited" | "instagram_not_authorized" | "instagram_publish_failed" | "facebook_reel_processing" | "facebook_reel_failed" | "facebook_rate_limited" | "facebook_not_authorized" | "facebook_publish_failed" | "tiktok_privacy_not_allowed" | "tiktok_duration_exceeds_max" | "tiktok_media_processing" | "tiktok_not_authorized" | "tiktok_rate_limited" | "tiktok_publish_failed" | "connection_platform_mismatch" | "connection_removed";
1359
+ code: "unauthorized" | "forbidden" | "not_found" | "conflict" | "validation_failed" | "rate_limited" | "internal_error" | "idempotency_key_invalid" | "idempotency_key_reused" | "idempotency_request_in_progress" | "account_not_available" | "connection_reauth_required" | "connection_not_pending" | "not_implemented" | "connection_discovery_failed" | "tiktok_creator_info_unavailable" | "media_processing" | "not_publishable" | "invalid_connection" | "invalid_media" | "profile_scope_invalid" | "media_unprobeable" | "media_too_large" | "media_aspect_ratio_unsupported" | "media_resolution_too_low" | "media_gif_unsupported" | "media_format_recompressed" | "media_resolution_downscaled" | "video_container_unsupported" | "video_codec_unsupported" | "video_audio_codec_unsupported" | "video_too_large" | "video_too_small" | "video_dimensions_unsupported" | "video_dimensions_too_large" | "video_fps_unsupported" | "video_fps_too_low" | "video_aspect_unsupported" | "video_duration_too_short" | "video_duration_exceeds_max" | "video_transform_failed" | "media_fetch_failed" | "document_format_unsupported" | "document_too_large" | "document_too_many_pages" | "media_format_indeterminate" | "media_count_invalid" | "body_too_long" | "content_missing" | "content_conflict" | "content_incomplete" | "content_kind_mismatch" | "media_type_mismatch" | "tag_limit_exceeded" | "reel_field_on_non_reel" | "field_placement_invalid" | "media_not_ready" | "media_failed" | "media_unsupported" | "media_kind_mismatch" | "variant_unparseable" | "publishing_unavailable" | "x_duplicate_content" | "x_not_authorized" | "x_access_not_permitted" | "x_rate_limited" | "x_publish_failed" | "x_media_upload_failed" | "linkedin_duplicate_content" | "linkedin_auth_expired" | "linkedin_permission_denied" | "linkedin_rate_limited" | "linkedin_media_processing" | "linkedin_media_failed" | "linkedin_media_upload_failed" | "linkedin_publish_failed" | "instagram_media_processing" | "instagram_container_expired" | "instagram_container_failed" | "instagram_rate_limited" | "instagram_not_authorized" | "instagram_publish_failed" | "facebook_reel_processing" | "facebook_reel_failed" | "facebook_rate_limited" | "facebook_not_authorized" | "facebook_publish_failed" | "tiktok_privacy_not_allowed" | "tiktok_duration_exceeds_max" | "tiktok_media_processing" | "tiktok_not_authorized" | "tiktok_rate_limited" | "tiktok_publish_failed" | "post_publish_failed" | "post_partially_published" | "connection_platform_mismatch" | "connection_removed";
1355
1360
  message: string;
1356
1361
  hint?: string;
1357
1362
  allowed?: Array<string>;
@@ -1362,7 +1367,7 @@ declare function useValidatePost(profileId: string): {
1362
1367
  isPending: boolean;
1363
1368
  error: Error | null;
1364
1369
  isReady: boolean;
1365
- connectedChannels: ("x" | "linkedin" | "facebook_page" | "instagram" | "tiktok")[];
1370
+ connectedChannels: ("tiktok" | "x" | "linkedin" | "facebook_page" | "instagram")[];
1366
1371
  };
1367
1372
  /**
1368
1373
  * Update a post by id. Pass a light edit directly (`{ schedule_at }`,
@@ -1568,6 +1573,36 @@ declare function useDeletePost(): _tanstack_react_query.UseMutationResult<{
1568
1573
  deleted: true;
1569
1574
  }, Error, string, unknown>;
1570
1575
 
1576
+ /**
1577
+ * Fetch a TikTok connection's live creator info — the data TikTok's Content
1578
+ * Posting policy REQUIRES the publishing UI to render before a post: the
1579
+ * `creator` (nickname + avatar), the `privacy_options` to offer (with NO default
1580
+ * selected — render each with `tiktokPrivacyLabel`), the positive `interaction`
1581
+ * (allowed) flags for the Comment/Duet/Stitch toggles, and the per-account video
1582
+ * length cap (`max_video_duration_sec`).
1583
+ *
1584
+ * Pass the id of the TikTok connection the composer is posting through, or `null`
1585
+ * when none is selected yet — the query is DISABLED while `connectionId` is null
1586
+ * (no request fires). The host knows which connection is TikTok (it picked it), so
1587
+ * only call this for a TikTok connection; a non-TikTok id surfaces a 404 as
1588
+ * `error` (the API never leaks the platform). Returns the standard react-query
1589
+ * result — read `data` (the creator info), `isLoading`, and `error`.
1590
+ */
1591
+ declare function useTikTokCreatorInfo(connectionId: string | null): _tanstack_react_query.UseQueryResult<NoInfer<{
1592
+ creator: {
1593
+ nickname: string;
1594
+ username: string;
1595
+ avatar_url: string | null;
1596
+ };
1597
+ privacy_options: Array<"PUBLIC_TO_EVERYONE" | "MUTUAL_FOLLOW_FRIENDS" | "FOLLOWER_OF_CREATOR" | "SELF_ONLY">;
1598
+ interaction: {
1599
+ comment: boolean;
1600
+ duet: boolean;
1601
+ stitch: boolean;
1602
+ };
1603
+ max_video_duration_sec: number;
1604
+ }>, Error>;
1605
+
1571
1606
  /**
1572
1607
  * Public input types for the post-preview components. These describe data the
1573
1608
  * CUSTOMER supplies for presentation — NOT shapes from our OpenAPI contract — so
@@ -1716,4 +1751,4 @@ declare function LinkedInPostPreviewImpl({ variant, author, media, theme, time,
1716
1751
  * absorbs unstable media arrays). */
1717
1752
  declare const LinkedInPostPreview: react.MemoExoticComponent<typeof LinkedInPostPreviewImpl>;
1718
1753
 
1719
- export { type CalendarFilters, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionsFilter, type DiscoverableAccount, type InfiniteList, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, UploadError, type UseConnectParams, type UseConnectResult, type UseMediaUploadOptions, type UseMediaUploadResult, XPostPreview, type XPostPreviewProps, type XPreviewAuthor, type XPreviewMedia, type XPreviewQuotedTweet, connectionKeys, mediaKeys, postKeys, profileKeys, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
1754
+ export { type CalendarFilters, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionsFilter, type DiscoverableAccount, type InfiniteList, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, UploadError, type UseConnectParams, type UseConnectResult, type UseMediaUploadOptions, type UseMediaUploadResult, XPostPreview, type XPostPreviewProps, type XPreviewAuthor, type XPreviewMedia, type XPreviewQuotedTweet, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useTikTokCreatorInfo, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createContext, memo, useMemo, useState, useEffect, Fragment as Fragment$1, useRef, createElement, useContext, useCallback } from 'react';
3
3
  import { useInfiniteQuery, useQuery, useMutation, QueryClient } from '@tanstack/react-query';
4
- import { createPostrunClient, profilesList, profilesGet, profilesCreate, profilesUpdate, profilesDelete, connectionsConnect, connectionsListByProfile, connectionsGet, connectionsListAccounts, connectionsSelect, connectionsDelete, mediaGet, mediaList, mediaUpdate, mediaDelete, postsList, postsGet, postsCreate, buildCreatePost, isPostPlatform, failedVariants, isPublished, postsValidate, postsUpdate, postsDelete, mediaCreate, PostrunError } from '@postrun/js';
4
+ import { createPostrunClient, profilesList, profilesGet, profilesCreate, profilesUpdate, profilesDelete, connectionsConnect, connectionsListByProfile, connectionsGet, connectionsListAccounts, connectionsSelect, connectionsDelete, mediaGet, mediaList, mediaUpdate, mediaDelete, postsList, postsGet, postsCreate, buildCreatePost, isPostPlatform, failedVariants, isPublished, postsValidate, postsUpdate, postsDelete, tiktokCreatorInfo, mediaCreate, PostrunError } from '@postrun/js';
5
5
  import Nango, { AuthError } from '@nangohq/frontend';
6
6
  import pWaitFor, { TimeoutError } from 'p-wait-for';
7
7
  import pLimit from 'p-limit';
@@ -129,6 +129,10 @@ var connectionKeys = {
129
129
  detail: (id) => [...connectionKeys.details(), id],
130
130
  accounts: (id) => [...connectionKeys.all, "accounts", id]
131
131
  };
132
+ var tiktokKeys = {
133
+ all: [ROOT, "tiktok"],
134
+ creatorInfo: (connectionId) => [...tiktokKeys.all, "creator-info", connectionId]
135
+ };
132
136
 
133
137
  // src/profiles.ts
134
138
  function useProfiles(query) {
@@ -604,6 +608,8 @@ async function uploadBytes(target, file, options = {}) {
604
608
  }
605
609
 
606
610
  // src/media.ts
611
+ var MEDIA_POLL_INTERVAL_MS = 1500;
612
+ var MEDIA_POLL_TIMEOUT_MS = 30 * 60 * 1e3;
607
613
  async function pollUntilSettled(client, id, signal, onTick) {
608
614
  let latest;
609
615
  await pWaitFor(
@@ -615,7 +621,7 @@ async function pollUntilSettled(client, id, signal, onTick) {
615
621
  onTick?.(latest);
616
622
  return latest.status === "ready" || latest.status === "failed";
617
623
  },
618
- { interval: 1500, timeout: 3e5 }
624
+ { interval: MEDIA_POLL_INTERVAL_MS, timeout: MEDIA_POLL_TIMEOUT_MS }
619
625
  );
620
626
  if (!latest) {
621
627
  throw new Error("Media polling returned no result.");
@@ -953,6 +959,19 @@ function useDeletePost() {
953
959
  queryClient
954
960
  );
955
961
  }
962
+ function useTikTokCreatorInfo(connectionId) {
963
+ const { client, queryClient } = usePostrun();
964
+ return useQuery(
965
+ {
966
+ // `connectionId ?? ''` only ever keys the cache when the query is enabled
967
+ // (a non-null id), so the empty fallback is never used to fetch.
968
+ queryKey: tiktokKeys.creatorInfo(connectionId ?? ""),
969
+ queryFn: async () => (await tiktokCreatorInfo({ client, path: { id: connectionId ?? "" } })).data,
970
+ enabled: connectionId !== null
971
+ },
972
+ queryClient
973
+ );
974
+ }
956
975
  function fileKey(file) {
957
976
  return file ? `${file.name}:${file.size}:${file.lastModified}` : "";
958
977
  }
@@ -1668,6 +1687,6 @@ function LinkedInPostPreviewImpl({
1668
1687
  }
1669
1688
  var LinkedInPostPreview = memo(LinkedInPostPreviewImpl);
1670
1689
 
1671
- export { Connect, LinkedInPostPreview, PostrunProvider, UploadError, XPostPreview, connectionKeys, mediaKeys, postKeys, profileKeys, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
1690
+ export { Connect, LinkedInPostPreview, PostrunProvider, UploadError, XPostPreview, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, useCalendar, useConnect, useConnection, useConnections, useCreatePost, useCreateProfile, useDeleteMedia, useDeletePost, useDeleteProfile, useDisconnect, useDiscoverableAccounts, useInfiniteList, useMedia, useMediaInfinite, useMediaList, useMediaUpload, usePost, usePostrun, usePosts, usePostsInfinite, useProfile, useProfiles, useProfilesInfinite, useSelectAccount, useTikTokCreatorInfo, useUpdateMedia, useUpdatePost, useUpdateProfile, useValidatePost };
1672
1691
  //# sourceMappingURL=index.js.map
1673
1692
  //# sourceMappingURL=index.js.map