@postrun/react 2.11.0 → 2.12.0
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.cjs +8 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -8
- package/dist/index.d.ts +2 -8
- package/dist/index.js +7 -62
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
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, Metadata, ComposePostInput, PostValidation, MediaKind, InstagramPostVariant, PostVariant, LinkedInPostVariant, TikTokPostVariant, XPostVariant, XPoll as XPoll$1, TikTokCreatorInfo, TikTokOptionsValue } from '@postrun/js';
|
|
6
|
-
export { PostValidation, PostVariant, PostVariantError, TIKTOK_CAPTION_MAX, TikTokCreatorInfo, ValidationIssue, captionMaxFor } from '@postrun/js';
|
|
6
|
+
export { PostValidation, PostVariant, PostVariantError, TIKTOK_CAPTION_MAX, TikTokCreatorInfo, UploadError, ValidationIssue, captionMaxFor } from '@postrun/js';
|
|
7
7
|
import { TwitterComponents } from 'react-tweet';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -939,12 +939,6 @@ declare function useDeleteMedia(): _tanstack_react_query.UseMutationResult<{
|
|
|
939
939
|
deleted: true;
|
|
940
940
|
}, Error, string, unknown>;
|
|
941
941
|
|
|
942
|
-
/** A failed direct-to-storage upload, carrying the HTTP status (0 = network). */
|
|
943
|
-
declare class UploadError extends Error {
|
|
944
|
-
readonly status: number;
|
|
945
|
-
constructor(status: number, message: string);
|
|
946
|
-
}
|
|
947
|
-
|
|
948
942
|
/**
|
|
949
943
|
* The calendar/queue filter surface — a date window over `schedule_at` plus a
|
|
950
944
|
* derived-status multi-select, scoped to an optional profile. Picked straight
|
|
@@ -3505,4 +3499,4 @@ declare function Declaration({ brandedContent }: {
|
|
|
3505
3499
|
brandedContent: boolean;
|
|
3506
3500
|
}): react.JSX.Element;
|
|
3507
3501
|
|
|
3508
|
-
export { ArticleCard, type ArticleCardProps, AudienceSelect, type CalendarFilters, CommercialDisclosure, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionIdentity, type ConnectionsFilter, Declaration, type DiscoverableAccount, DocumentCard, type DocumentCardProps, type InfiniteList, InstagramPostPreview, type InstagramPostPreviewProps, type InstagramPreviewAuthor, type InstagramPreviewVariant, type InstagramTheme, InteractionToggles, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LinkedInPreviewVariant, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, Poll, type PollProps, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, type ReadPostVariant, ReelPreview, type ReelPreviewProps, type ResolvedMedia, TikTokCaptionField, type TikTokCaptionFieldProps, TikTokPostPreview, type TikTokPostPreviewProps, type TikTokPreviewVariant, TikTokPublishPanel, type TikTokPublishPanelProps, type TikTokTheme,
|
|
3502
|
+
export { ArticleCard, type ArticleCardProps, AudienceSelect, type CalendarFilters, CommercialDisclosure, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionIdentity, type ConnectionsFilter, Declaration, type DiscoverableAccount, DocumentCard, type DocumentCardProps, type InfiniteList, InstagramPostPreview, type InstagramPostPreviewProps, type InstagramPreviewAuthor, type InstagramPreviewVariant, type InstagramTheme, InteractionToggles, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LinkedInPreviewVariant, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, Poll, type PollProps, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, type ReadPostVariant, ReelPreview, type ReelPreviewProps, type ResolvedMedia, TikTokCaptionField, type TikTokCaptionFieldProps, TikTokPostPreview, type TikTokPostPreviewProps, type TikTokPreviewVariant, TikTokPublishPanel, type TikTokPublishPanelProps, type TikTokTheme, type UseConnectParams, type UseConnectResult, type UseMediaUploadOptions, type UseMediaUploadResult, XPoll, type XPollProps, XPostPreview, type XPostPreviewProps, type XPreviewAuthor, type XPreviewMedia, type XPreviewQuotedTweet, type XPreviewVariant, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, toPreviewMedia, 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, Metadata, ComposePostInput, PostValidation, MediaKind, InstagramPostVariant, PostVariant, LinkedInPostVariant, TikTokPostVariant, XPostVariant, XPoll as XPoll$1, TikTokCreatorInfo, TikTokOptionsValue } from '@postrun/js';
|
|
6
|
-
export { PostValidation, PostVariant, PostVariantError, TIKTOK_CAPTION_MAX, TikTokCreatorInfo, ValidationIssue, captionMaxFor } from '@postrun/js';
|
|
6
|
+
export { PostValidation, PostVariant, PostVariantError, TIKTOK_CAPTION_MAX, TikTokCreatorInfo, UploadError, ValidationIssue, captionMaxFor } from '@postrun/js';
|
|
7
7
|
import { TwitterComponents } from 'react-tweet';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -939,12 +939,6 @@ declare function useDeleteMedia(): _tanstack_react_query.UseMutationResult<{
|
|
|
939
939
|
deleted: true;
|
|
940
940
|
}, Error, string, unknown>;
|
|
941
941
|
|
|
942
|
-
/** A failed direct-to-storage upload, carrying the HTTP status (0 = network). */
|
|
943
|
-
declare class UploadError extends Error {
|
|
944
|
-
readonly status: number;
|
|
945
|
-
constructor(status: number, message: string);
|
|
946
|
-
}
|
|
947
|
-
|
|
948
942
|
/**
|
|
949
943
|
* The calendar/queue filter surface — a date window over `schedule_at` plus a
|
|
950
944
|
* derived-status multi-select, scoped to an optional profile. Picked straight
|
|
@@ -3505,4 +3499,4 @@ declare function Declaration({ brandedContent }: {
|
|
|
3505
3499
|
brandedContent: boolean;
|
|
3506
3500
|
}): react.JSX.Element;
|
|
3507
3501
|
|
|
3508
|
-
export { ArticleCard, type ArticleCardProps, AudienceSelect, type CalendarFilters, CommercialDisclosure, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionIdentity, type ConnectionsFilter, Declaration, type DiscoverableAccount, DocumentCard, type DocumentCardProps, type InfiniteList, InstagramPostPreview, type InstagramPostPreviewProps, type InstagramPreviewAuthor, type InstagramPreviewVariant, type InstagramTheme, InteractionToggles, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LinkedInPreviewVariant, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, Poll, type PollProps, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, type ReadPostVariant, ReelPreview, type ReelPreviewProps, type ResolvedMedia, TikTokCaptionField, type TikTokCaptionFieldProps, TikTokPostPreview, type TikTokPostPreviewProps, type TikTokPreviewVariant, TikTokPublishPanel, type TikTokPublishPanelProps, type TikTokTheme,
|
|
3502
|
+
export { ArticleCard, type ArticleCardProps, AudienceSelect, type CalendarFilters, CommercialDisclosure, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionIdentity, type ConnectionsFilter, Declaration, type DiscoverableAccount, DocumentCard, type DocumentCardProps, type InfiniteList, InstagramPostPreview, type InstagramPostPreviewProps, type InstagramPreviewAuthor, type InstagramPreviewVariant, type InstagramTheme, InteractionToggles, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LinkedInPreviewVariant, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, Poll, type PollProps, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, type ReadPostVariant, ReelPreview, type ReelPreviewProps, type ResolvedMedia, TikTokCaptionField, type TikTokCaptionFieldProps, TikTokPostPreview, type TikTokPostPreviewProps, type TikTokPreviewVariant, TikTokPublishPanel, type TikTokPublishPanelProps, type TikTokTheme, type UseConnectParams, type UseConnectResult, type UseMediaUploadOptions, type UseMediaUploadResult, XPoll, type XPollProps, XPostPreview, type XPostPreviewProps, type XPreviewAuthor, type XPreviewMedia, type XPreviewQuotedTweet, type XPreviewVariant, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, toPreviewMedia, 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,13 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createContext, memo, useMemo, useState, useEffect, Fragment as Fragment$1, useRef, useLayoutEffect, useCallback, createElement, useContext, useId } from 'react';
|
|
3
3
|
import { useInfiniteQuery, useQuery, useMutation, QueryClient } from '@tanstack/react-query';
|
|
4
|
-
import { xPollDurationLabel, linkedinPollDurationLabel, 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, audiencePrivacyOptions, audienceUnselected, tiktokPrivacyLabel, parsePrivacyLevel, TIKTOK_AUDIENCE_REQUIRED_HINT, captionMaxFor, commercialLabelNotice, commercialDisclosureIncomplete, setCommercialDisclosure, setBrandKind, TIKTOK_DISCLOSURE_REQUIRED_HINT, TIKTOK_BRANDED_CONTENT_POLICY_URL, TIKTOK_MUSIC_CONFIRMATION_URL, interactionRows, interactionValueKey, toggleInteraction, tiktokOptionsReady, TIKTOK_PROCESSING_NOTICE, brandedContentDeclared, mediaCreate, PostrunError } from '@postrun/js';
|
|
5
|
-
export { TIKTOK_CAPTION_MAX, captionMaxFor } from '@postrun/js';
|
|
4
|
+
import { xPollDurationLabel, linkedinPollDurationLabel, 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, audiencePrivacyOptions, audienceUnselected, tiktokPrivacyLabel, parsePrivacyLevel, TIKTOK_AUDIENCE_REQUIRED_HINT, captionMaxFor, commercialLabelNotice, commercialDisclosureIncomplete, setCommercialDisclosure, setBrandKind, TIKTOK_DISCLOSURE_REQUIRED_HINT, TIKTOK_BRANDED_CONTENT_POLICY_URL, TIKTOK_MUSIC_CONFIRMATION_URL, interactionRows, interactionValueKey, toggleInteraction, tiktokOptionsReady, TIKTOK_PROCESSING_NOTICE, brandedContentDeclared, mediaCreate, uploadToTarget, PostrunError } from '@postrun/js';
|
|
5
|
+
export { TIKTOK_CAPTION_MAX, UploadError, captionMaxFor } from '@postrun/js';
|
|
6
6
|
import Nango, { AuthError } from '@nangohq/frontend';
|
|
7
7
|
import pWaitFor, { TimeoutError } from 'p-wait-for';
|
|
8
8
|
import pLimit from 'p-limit';
|
|
9
|
-
import pRetry, { AbortError } from 'p-retry';
|
|
10
|
-
import axios, { isAxiosError } from 'axios';
|
|
11
9
|
import { enrichTweet, TweetContainer, TweetHeader, TweetInReplyTo, TweetBody, TweetMedia, QuotedTweet } from 'react-tweet';
|
|
12
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
11
|
import { FiMessageCircle, FiRepeat, FiHeart, FiBarChart2, FiShare, FiGlobe, FiUsers, FiThumbsUp, FiMessageSquare, FiSend, FiBookmark, FiMoreHorizontal, FiFileText } from 'react-icons/fi';
|
|
@@ -572,46 +570,6 @@ function Connect({
|
|
|
572
570
|
});
|
|
573
571
|
return children(api);
|
|
574
572
|
}
|
|
575
|
-
var UploadError = class extends Error {
|
|
576
|
-
status;
|
|
577
|
-
constructor(status, message) {
|
|
578
|
-
super(message);
|
|
579
|
-
this.name = "UploadError";
|
|
580
|
-
this.status = status;
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
async function uploadBytes(target, file, options = {}) {
|
|
584
|
-
const { onProgress, signal } = options;
|
|
585
|
-
try {
|
|
586
|
-
await axios.request({
|
|
587
|
-
method: target.method,
|
|
588
|
-
url: target.url,
|
|
589
|
-
data: file,
|
|
590
|
-
headers: target.headers,
|
|
591
|
-
signal,
|
|
592
|
-
onUploadProgress: (event) => {
|
|
593
|
-
if (event.total) {
|
|
594
|
-
onProgress?.(event.loaded / event.total);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
onProgress?.(1);
|
|
599
|
-
} catch (error) {
|
|
600
|
-
if (signal?.aborted) {
|
|
601
|
-
throw error;
|
|
602
|
-
}
|
|
603
|
-
if (isAxiosError(error)) {
|
|
604
|
-
const status = error.response?.status ?? 0;
|
|
605
|
-
throw new UploadError(
|
|
606
|
-
status,
|
|
607
|
-
status ? `Upload failed (HTTP ${status}).` : "Upload failed: network error."
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
throw error;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
// src/media.ts
|
|
615
573
|
var MEDIA_POLL_INTERVAL_MS = 1500;
|
|
616
574
|
var MEDIA_POLL_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
617
575
|
async function pollUntilSettled(client, id, signal, onTick) {
|
|
@@ -645,23 +603,10 @@ async function runUpload(client, file, options, signal, callbacks) {
|
|
|
645
603
|
}
|
|
646
604
|
})).data;
|
|
647
605
|
if (created.upload) {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
await uploadBytes(target, file, {
|
|
653
|
-
onProgress: callbacks.onProgress,
|
|
654
|
-
signal
|
|
655
|
-
});
|
|
656
|
-
} catch (uploadError) {
|
|
657
|
-
if (uploadError instanceof UploadError && uploadError.status >= 400 && uploadError.status < 500) {
|
|
658
|
-
throw new AbortError(uploadError);
|
|
659
|
-
}
|
|
660
|
-
throw uploadError;
|
|
661
|
-
}
|
|
662
|
-
},
|
|
663
|
-
{ retries: 3, signal }
|
|
664
|
-
);
|
|
606
|
+
await uploadToTarget(file, created.upload, {
|
|
607
|
+
onProgress: callbacks.onProgress,
|
|
608
|
+
signal
|
|
609
|
+
});
|
|
665
610
|
}
|
|
666
611
|
callbacks.onProcessing();
|
|
667
612
|
return pollUntilSettled(client, created.id, signal, callbacks.onPoll);
|
|
@@ -3382,6 +3327,6 @@ var postButtonStyle = {
|
|
|
3382
3327
|
transition: "opacity 160ms ease"
|
|
3383
3328
|
};
|
|
3384
3329
|
|
|
3385
|
-
export { ArticleCard, AudienceSelect, CommercialDisclosure, Connect, Declaration, DocumentCard, InstagramPostPreview, InteractionToggles, LinkedInPostPreview, Poll, PostrunProvider, ReelPreview, TikTokCaptionField, TikTokPostPreview, TikTokPublishPanel,
|
|
3330
|
+
export { ArticleCard, AudienceSelect, CommercialDisclosure, Connect, Declaration, DocumentCard, InstagramPostPreview, InteractionToggles, LinkedInPostPreview, Poll, PostrunProvider, ReelPreview, TikTokCaptionField, TikTokPostPreview, TikTokPublishPanel, XPoll, XPostPreview, connectionKeys, mediaKeys, postKeys, profileKeys, tiktokKeys, toPreviewMedia, 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 };
|
|
3386
3331
|
//# sourceMappingURL=index.js.map
|
|
3387
3332
|
//# sourceMappingURL=index.js.map
|