@postrun/react 0.2.0 → 1.0.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/README.md +59 -5
- package/dist/index.cjs +374 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +232 -82
- package/dist/index.d.ts +232 -82
- package/dist/index.js +372 -111
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
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
|
-
import { PostrunClient, ListProfilesQuery, ConnectionKind, ConnectionStatus, ListMediaQuery, ListPostsQuery, ConnectablePlatform, MediaTarget, MediaKind, Metadata,
|
|
5
|
+
import { PostrunClient, ListProfilesQuery, DiscoverableAccountList, Connection, ConnectionKind, ConnectionStatus, ListMediaQuery, ListPostsQuery, ConnectablePlatform, MediaResource, MediaTarget, MediaKind, Metadata, ComposePostInput, XPostVariant, LinkedInPostVariant } from '@postrun/js';
|
|
6
6
|
import { TwitterComponents } from 'react-tweet';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -191,6 +191,45 @@ declare function useDeleteProfile(): _tanstack_react_query.UseMutationResult<{
|
|
|
191
191
|
deleted: true;
|
|
192
192
|
}, Error, string, unknown>;
|
|
193
193
|
|
|
194
|
+
/**
|
|
195
|
+
* The pure orchestration behind the embedded (no-redirect) connect flow. It is
|
|
196
|
+
* the in-app twin of the hosted `/connect` runner's machine, sharing its exact
|
|
197
|
+
* shape — grant → correlate by the Nango `connectionId` → discover → pick →
|
|
198
|
+
* select — and its two invariants:
|
|
199
|
+
*
|
|
200
|
+
* 1. It NEVER throws: every path resolves to one typed `ConnectOutcome`, so the
|
|
201
|
+
* hook can map it straight to a UI state and a seam can't crash a host app.
|
|
202
|
+
* 2. Correlation is EXACT: `nango.auth()` resolves with the Nango `connectionId`,
|
|
203
|
+
* the SAME value the auth webhook stores as `nango_connection_id`. We poll the
|
|
204
|
+
* connections list filtered by that id, so the row this grant produced is found
|
|
205
|
+
* unambiguously — a concurrent connect on the same profile can't be mis-picked.
|
|
206
|
+
*
|
|
207
|
+
* All seams (the Nango grant, the host's account picker, the four API calls) are
|
|
208
|
+
* INJECTED, so the whole machine unit-tests without a DOM, a network, or a real
|
|
209
|
+
* `nango.auth()`. The hook (`useConnect`) wires the real seams onto it.
|
|
210
|
+
*/
|
|
211
|
+
/** One account offered for selection — the element type of the accounts list. */
|
|
212
|
+
type DiscoverableAccount = DiscoverableAccountList['data'][number];
|
|
213
|
+
/** Why a connect attempt ended in `error` — actionable reasons for the host. */
|
|
214
|
+
type ConnectErrorReason = 'popup_blocked' | 'auth_failed' | 'connection_not_found' | 'select_failed' | 'reauth_required';
|
|
215
|
+
/**
|
|
216
|
+
* The single outcome of a connect attempt. `active` carries the activated
|
|
217
|
+
* connection (so the host can call `onConnected`); `connected_pending` means the
|
|
218
|
+
* grant succeeded but no account is bound yet (slow webhook, out-of-band binding,
|
|
219
|
+
* or no reachable accounts) — the host refetches its list, it is NOT an error.
|
|
220
|
+
*/
|
|
221
|
+
type ConnectOutcome = {
|
|
222
|
+
status: 'active';
|
|
223
|
+
connection: Connection;
|
|
224
|
+
} | {
|
|
225
|
+
status: 'connected_pending';
|
|
226
|
+
} | {
|
|
227
|
+
status: 'cancelled';
|
|
228
|
+
} | {
|
|
229
|
+
status: 'error';
|
|
230
|
+
reason: ConnectErrorReason;
|
|
231
|
+
};
|
|
232
|
+
|
|
194
233
|
/** The connection-list filter that keys the cache (social/ads + lifecycle). */
|
|
195
234
|
interface ConnectionsFilter {
|
|
196
235
|
kind?: ConnectionKind;
|
|
@@ -294,24 +333,71 @@ declare const connectionKeys: {
|
|
|
294
333
|
accounts: (id: string) => readonly ["postrun", "connections", "accounts", string];
|
|
295
334
|
};
|
|
296
335
|
|
|
297
|
-
interface
|
|
336
|
+
interface UseConnectParams {
|
|
298
337
|
/** The profile to attach the new connection to. */
|
|
299
338
|
profileId: string;
|
|
300
339
|
/** The platform to connect (X, LinkedIn, Meta, …). */
|
|
301
340
|
platform: ConnectablePlatform;
|
|
341
|
+
/** Called once a connection is fully ACTIVE (an account is bound). */
|
|
342
|
+
onConnected?: (connection: Connection) => void;
|
|
302
343
|
}
|
|
303
344
|
/**
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* On return, the new connection appears via `useConnections`.
|
|
345
|
+
* The connect flow's UI state. `connected_pending` is a TERMINAL success state —
|
|
346
|
+
* the grant landed but no account is bound yet (a slow webhook, an out-of-band
|
|
347
|
+
* binding, or no reachable accounts); the host shows "almost there" and refetches
|
|
348
|
+
* its connections list. It is NOT an error and must not hang in `connecting`.
|
|
309
349
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
350
|
+
type ConnectState = {
|
|
351
|
+
phase: 'preparing';
|
|
352
|
+
} | {
|
|
353
|
+
phase: 'idle';
|
|
354
|
+
} | {
|
|
355
|
+
phase: 'connecting';
|
|
356
|
+
} | {
|
|
357
|
+
phase: 'picking';
|
|
358
|
+
accounts: DiscoverableAccount[];
|
|
359
|
+
} | {
|
|
360
|
+
phase: 'active';
|
|
361
|
+
connection: Connection;
|
|
362
|
+
} | {
|
|
363
|
+
phase: 'connected_pending';
|
|
364
|
+
} | {
|
|
365
|
+
phase: 'cancelled';
|
|
366
|
+
} | {
|
|
367
|
+
phase: 'error';
|
|
368
|
+
reason: ConnectErrorReason;
|
|
369
|
+
};
|
|
370
|
+
interface UseConnectResult {
|
|
371
|
+
/** The current flow state — drive your button + picker + status off `phase`. */
|
|
372
|
+
state: ConnectState;
|
|
373
|
+
/**
|
|
374
|
+
* Start the OAuth flow. MUST be called directly in the user's click handler
|
|
375
|
+
* (no `await` before it): it opens the OAuth popup synchronously, so the
|
|
376
|
+
* browser keeps it inside the user gesture. A no-op until the session is ready
|
|
377
|
+
* (state `preparing`) — disable the button until `phase` is `idle`.
|
|
378
|
+
*/
|
|
379
|
+
start: () => void;
|
|
380
|
+
/** When `phase` is `picking`, activate the connection with the chosen account. */
|
|
381
|
+
select: (externalAccountId: string) => void;
|
|
382
|
+
/** Return to a fresh, ready state (re-mints the session) — e.g. a "try again". */
|
|
383
|
+
reset: () => void;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Embedded one-click connect — the customer's OWN button drives the whole OAuth
|
|
387
|
+
* flow IN-APP (no redirect to our hosted page). `nango.auth()` opens a popup that
|
|
388
|
+
* resolves in-page, then the account picker (for multi-account platforms) renders
|
|
389
|
+
* inside the host app via `state.accounts` + `select()`. White-label, one click.
|
|
390
|
+
*
|
|
391
|
+
* The Plaid pattern: the Nango session is PRE-MINTED on mount (and on `reset`),
|
|
392
|
+
* because `nango.auth()` opens its popup synchronously — minting in the click
|
|
393
|
+
* would push `window.open` out of the user gesture and the browser would block
|
|
394
|
+
* the popup. `start()` therefore fires `nango.auth()` with the already-held token
|
|
395
|
+
* and zero `await` before it.
|
|
396
|
+
*
|
|
397
|
+
* The hosted `/connect` page remains the fallback for callers NOT using this SDK
|
|
398
|
+
* (a plain link to `hosted_connect_url`); this hook never redirects.
|
|
399
|
+
*/
|
|
400
|
+
declare function useConnect({ profileId, platform, onConnected, }: UseConnectParams): UseConnectResult;
|
|
315
401
|
/**
|
|
316
402
|
* List a profile's connected accounts. Pass a `filter` to narrow by `kind`
|
|
317
403
|
* (`posting` = social, `ads`) or `status` — e.g. a composer fetches
|
|
@@ -404,15 +490,77 @@ declare function useDisconnect(): _tanstack_react_query.UseMutationResult<{
|
|
|
404
490
|
deleted: true;
|
|
405
491
|
}, Error, string, unknown>;
|
|
406
492
|
|
|
493
|
+
/** The flow state + actions handed to your render-prop. */
|
|
494
|
+
interface ConnectRenderApi {
|
|
495
|
+
/** The current flow state — switch on `state.phase` to render your UI. */
|
|
496
|
+
state: ConnectState;
|
|
497
|
+
/**
|
|
498
|
+
* Begin connecting. Call this DIRECTLY from your button's `onClick` — it opens
|
|
499
|
+
* the OAuth popup synchronously, so don't `await` anything before it. A no-op
|
|
500
|
+
* until the session is ready (`state.phase === 'preparing'`).
|
|
501
|
+
*/
|
|
502
|
+
start: () => void;
|
|
503
|
+
/** When `state.phase === 'picking'`, activate with the chosen account id. */
|
|
504
|
+
select: (externalAccountId: string) => void;
|
|
505
|
+
/** Reset to a fresh, ready state (e.g. a "try again" after an error/cancel). */
|
|
506
|
+
reset: () => void;
|
|
507
|
+
}
|
|
508
|
+
interface ConnectProps {
|
|
509
|
+
/** The profile to attach the new connection to. */
|
|
510
|
+
profileId: string;
|
|
511
|
+
/** The platform to connect (X, LinkedIn, Meta, …). */
|
|
512
|
+
platform: ConnectablePlatform;
|
|
513
|
+
/** Called once a connection is fully ACTIVE (an account is bound). */
|
|
514
|
+
onConnected?: (connection: Connection) => void;
|
|
515
|
+
/** Render your own button + picker + status from the flow state. */
|
|
516
|
+
children: (api: ConnectRenderApi) => ReactNode;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Headless one-click connect. Wraps `useConnect` and hands you the flow state +
|
|
520
|
+
* actions via a render-prop, so you own EVERY pixel (your button, your account
|
|
521
|
+
* picker, your brand marks, your styling) while the SDK runs the embedded OAuth
|
|
522
|
+
* popup + account binding — no redirect, no second click.
|
|
523
|
+
*
|
|
524
|
+
* ```tsx
|
|
525
|
+
* <Connect profileId={id} platform="x" onConnected={refetch}>
|
|
526
|
+
* {({ state, start, select }) =>
|
|
527
|
+
* state.phase === 'picking' ? (
|
|
528
|
+
* <ul>
|
|
529
|
+
* {state.accounts.map((a) => (
|
|
530
|
+
* <li key={a.external_account_id}>
|
|
531
|
+
* <button onClick={() => select(a.external_account_id)}>
|
|
532
|
+
* {a.name ?? a.external_account_id}
|
|
533
|
+
* </button>
|
|
534
|
+
* </li>
|
|
535
|
+
* ))}
|
|
536
|
+
* </ul>
|
|
537
|
+
* ) : (
|
|
538
|
+
* <button onClick={start} disabled={state.phase !== 'idle'}>
|
|
539
|
+
* Connect X
|
|
540
|
+
* </button>
|
|
541
|
+
* )
|
|
542
|
+
* }
|
|
543
|
+
* </Connect>
|
|
544
|
+
* ```
|
|
545
|
+
*
|
|
546
|
+
* The trigger MUST call `start()` directly in the click (it opens the popup
|
|
547
|
+
* synchronously). Mount `<Connect>` inside a `<PostrunProvider>`.
|
|
548
|
+
*/
|
|
549
|
+
declare function Connect({ profileId, platform, onConnected, children, }: ConnectProps): ReactNode;
|
|
550
|
+
|
|
407
551
|
type MediaUploadStatus = 'idle' | 'uploading' | 'processing' | 'ready' | 'failed';
|
|
408
552
|
interface MediaUploadOptions {
|
|
409
553
|
/** Profile that owns the asset. */
|
|
410
554
|
profileId: string;
|
|
411
555
|
/** Platforms to validate + render for (omit to add later via useUpdateMedia). */
|
|
412
556
|
targets?: MediaTarget[];
|
|
413
|
-
/**
|
|
557
|
+
/** Optional override — omit and the API auto-detects the kind from the bytes. */
|
|
414
558
|
kind?: MediaKind;
|
|
415
|
-
/**
|
|
559
|
+
/**
|
|
560
|
+
* Optional override — omit and the API auto-detects the MIME from the bytes.
|
|
561
|
+
* Still useful for a legacy Office binary (.doc/.ppt) whose magic bytes can't be
|
|
562
|
+
* disambiguated by the server sniff.
|
|
563
|
+
*/
|
|
416
564
|
contentType?: string;
|
|
417
565
|
/** Store as-is with zero processing. */
|
|
418
566
|
raw?: boolean;
|
|
@@ -420,74 +568,60 @@ interface MediaUploadOptions {
|
|
|
420
568
|
externalId?: string;
|
|
421
569
|
metadata?: Metadata;
|
|
422
570
|
}
|
|
423
|
-
/**
|
|
424
|
-
*
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
cancel: () => void | undefined;
|
|
433
|
-
reset: () => void;
|
|
434
|
-
status: MediaUploadStatus;
|
|
571
|
+
/** One file's slot in an upload — its own live status, progress, and settled
|
|
572
|
+
* asset. `status` is never `idle` (an item exists only once uploading). */
|
|
573
|
+
interface MediaUploadItem {
|
|
574
|
+
/** Stable local id (NOT the asset id) — use as the React key and for `remove`. */
|
|
575
|
+
id: string;
|
|
576
|
+
file: File;
|
|
577
|
+
status: Exclude<MediaUploadStatus, 'idle'>;
|
|
578
|
+
/** 0–1 client-side BYTE-upload bar. `media.progress.{stage,percent}` is the
|
|
579
|
+
* live SERVER pipeline bar. */
|
|
435
580
|
progress: number;
|
|
436
|
-
media:
|
|
437
|
-
id: string;
|
|
438
|
-
object: "media";
|
|
439
|
-
profile_id: string;
|
|
440
|
-
kind: "image" | "video" | "gif" | "document" | null;
|
|
441
|
-
content_type: string | null;
|
|
442
|
-
status: "uploading" | "processing" | "ready" | "failed";
|
|
443
|
-
raw: boolean;
|
|
444
|
-
error: {
|
|
445
|
-
code: "media_unprobeable" | "media_format_indeterminate" | "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_unsupported";
|
|
446
|
-
message: string;
|
|
447
|
-
hint?: string;
|
|
448
|
-
allowed?: Array<string>;
|
|
449
|
-
got?: string;
|
|
450
|
-
} | null;
|
|
451
|
-
source: {
|
|
452
|
-
format: string;
|
|
453
|
-
bytes: number;
|
|
454
|
-
width: number | null;
|
|
455
|
-
height: number | null;
|
|
456
|
-
duration_ms: number | null;
|
|
457
|
-
} | null;
|
|
458
|
-
alt_text: string | null;
|
|
459
|
-
per_platform: {
|
|
460
|
-
[key: string]: {
|
|
461
|
-
status: "processing" | "ready" | "failed";
|
|
462
|
-
url: string | null;
|
|
463
|
-
width: number | null;
|
|
464
|
-
height: number | null;
|
|
465
|
-
bytes: number | null;
|
|
466
|
-
warnings: Array<{
|
|
467
|
-
code: "media_unprobeable" | "media_format_indeterminate" | "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_unsupported";
|
|
468
|
-
message: string;
|
|
469
|
-
hint?: string;
|
|
470
|
-
allowed?: Array<string>;
|
|
471
|
-
got?: string;
|
|
472
|
-
}>;
|
|
473
|
-
errors: Array<{
|
|
474
|
-
code: "media_unprobeable" | "media_format_indeterminate" | "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_unsupported";
|
|
475
|
-
message: string;
|
|
476
|
-
hint?: string;
|
|
477
|
-
allowed?: Array<string>;
|
|
478
|
-
got?: string;
|
|
479
|
-
}>;
|
|
480
|
-
};
|
|
481
|
-
};
|
|
482
|
-
external_id: string | null;
|
|
483
|
-
metadata: {
|
|
484
|
-
[key: string]: string | number | boolean;
|
|
485
|
-
};
|
|
486
|
-
created_at: string;
|
|
487
|
-
updated_at: string;
|
|
488
|
-
} | null;
|
|
581
|
+
media: MediaResource | null;
|
|
489
582
|
error: unknown;
|
|
490
|
-
}
|
|
583
|
+
}
|
|
584
|
+
interface UseMediaUploadResult {
|
|
585
|
+
/** Every file added, in add-order, with its live state. */
|
|
586
|
+
items: readonly MediaUploadItem[];
|
|
587
|
+
/** The settled-ready assets, in item order — what you attach to a post. */
|
|
588
|
+
ready: readonly MediaResource[];
|
|
589
|
+
/** True while any item is still uploading or processing. */
|
|
590
|
+
isUploading: boolean;
|
|
591
|
+
/**
|
|
592
|
+
* Upload ONE file or MANY under `options`, gated by `concurrency`. The reactive
|
|
593
|
+
* `items` update live for UI; the returned promise is for imperative flows —
|
|
594
|
+
* it resolves to the settled (`ready`|`failed`) resources for THIS batch, in
|
|
595
|
+
* add-order, EXCLUDING any item removed/aborted mid-flight. Single-file usage:
|
|
596
|
+
* `const [asset] = await add(file, opts)`.
|
|
597
|
+
*/
|
|
598
|
+
add: (files: File | FileList | readonly File[], options: MediaUploadOptions) => Promise<MediaResource[]>;
|
|
599
|
+
/** Drop an item by local id — aborts it if still in flight. */
|
|
600
|
+
remove: (id: string) => void;
|
|
601
|
+
/** Abort everything and clear the list. */
|
|
602
|
+
reset: () => void;
|
|
603
|
+
}
|
|
604
|
+
interface UseMediaUploadOptions {
|
|
605
|
+
/**
|
|
606
|
+
* How many files upload at once; the rest queue (default 3). Fixed for the
|
|
607
|
+
* hook's lifetime — set it once when you call the hook.
|
|
608
|
+
*/
|
|
609
|
+
concurrency?: number;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Upload one OR many files and get back platform-validated assets. The hook owns
|
|
613
|
+
* the whole journey per file: create the asset (the API auto-detects
|
|
614
|
+
* kind/content_type from the bytes), PUT the bytes with live `progress` + retry,
|
|
615
|
+
* poll until processing settles, and expose `media.per_platform` (per-target
|
|
616
|
+
* status, url, warnings,
|
|
617
|
+
* errors). Every file gets its own `MediaUploadItem` slot in `items`; `ready` is
|
|
618
|
+
* the settled assets to attach to a post; `remove`/`reset` abort in-flight work.
|
|
619
|
+
* Uploads run through ONE shared `p-limit` gate so only `concurrency` (default 3)
|
|
620
|
+
* are in flight at once — global across `add` calls, not per-call.
|
|
621
|
+
*
|
|
622
|
+
* Single-file usage: `const [asset] = await add(file, opts)` (or read `ready[0]`).
|
|
623
|
+
*/
|
|
624
|
+
declare function useMediaUpload(options?: UseMediaUploadOptions): UseMediaUploadResult;
|
|
491
625
|
/** Retrieve a media asset; auto-polls while it is still uploading/processing. */
|
|
492
626
|
declare function useMedia(id: string): _tanstack_react_query.UseQueryResult<NoInfer<{
|
|
493
627
|
id: string;
|
|
@@ -496,6 +630,10 @@ declare function useMedia(id: string): _tanstack_react_query.UseQueryResult<NoIn
|
|
|
496
630
|
kind: "image" | "video" | "gif" | "document" | null;
|
|
497
631
|
content_type: string | null;
|
|
498
632
|
status: "uploading" | "processing" | "ready" | "failed";
|
|
633
|
+
progress: {
|
|
634
|
+
stage: "queued" | "analyzing" | "transcoding" | "done";
|
|
635
|
+
percent: number;
|
|
636
|
+
};
|
|
499
637
|
raw: boolean;
|
|
500
638
|
error: {
|
|
501
639
|
code: "media_unprobeable" | "media_format_indeterminate" | "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_unsupported";
|
|
@@ -557,6 +695,10 @@ declare function useMediaList(query?: ListMediaQuery): _tanstack_react_query.Use
|
|
|
557
695
|
kind: "image" | "video" | "gif" | "document" | null;
|
|
558
696
|
content_type: string | null;
|
|
559
697
|
status: "uploading" | "processing" | "ready" | "failed";
|
|
698
|
+
progress: {
|
|
699
|
+
stage: "queued" | "analyzing" | "transcoding" | "done";
|
|
700
|
+
percent: number;
|
|
701
|
+
};
|
|
560
702
|
raw: boolean;
|
|
561
703
|
error: {
|
|
562
704
|
code: "media_unprobeable" | "media_format_indeterminate" | "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_unsupported";
|
|
@@ -622,6 +764,10 @@ declare function useMediaInfinite(filters?: Omit<ListMediaQuery, 'limit' | 'offs
|
|
|
622
764
|
kind: "image" | "video" | "gif" | "document" | null;
|
|
623
765
|
content_type: string | null;
|
|
624
766
|
status: "uploading" | "processing" | "ready" | "failed";
|
|
767
|
+
progress: {
|
|
768
|
+
stage: "queued" | "analyzing" | "transcoding" | "done";
|
|
769
|
+
percent: number;
|
|
770
|
+
};
|
|
625
771
|
raw: boolean;
|
|
626
772
|
error: {
|
|
627
773
|
code: "media_unprobeable" | "media_format_indeterminate" | "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_unsupported";
|
|
@@ -676,6 +822,10 @@ declare function useUpdateMedia(): _tanstack_react_query.UseMutationResult<{
|
|
|
676
822
|
kind: "image" | "video" | "gif" | "document" | null;
|
|
677
823
|
content_type: string | null;
|
|
678
824
|
status: "uploading" | "processing" | "ready" | "failed";
|
|
825
|
+
progress: {
|
|
826
|
+
stage: "queued" | "analyzing" | "transcoding" | "done";
|
|
827
|
+
percent: number;
|
|
828
|
+
};
|
|
679
829
|
raw: boolean;
|
|
680
830
|
error: {
|
|
681
831
|
code: "media_unprobeable" | "media_format_indeterminate" | "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_unsupported";
|
|
@@ -1089,7 +1239,7 @@ declare function useCreatePost(profileId: string): {
|
|
|
1089
1239
|
} | undefined;
|
|
1090
1240
|
reset: () => void;
|
|
1091
1241
|
isReady: boolean;
|
|
1092
|
-
connectedChannels: ("x" | "linkedin" | "facebook_page" | "
|
|
1242
|
+
connectedChannels: ("x" | "linkedin" | "facebook_page" | "instagram" | "tiktok")[];
|
|
1093
1243
|
};
|
|
1094
1244
|
/**
|
|
1095
1245
|
* Update a post by id. Pass a light edit directly (`{ schedule_at }`,
|
|
@@ -1443,4 +1593,4 @@ declare function LinkedInPostPreviewImpl({ variant, author, media, theme, time,
|
|
|
1443
1593
|
* absorbs unstable media arrays). */
|
|
1444
1594
|
declare const LinkedInPostPreview: react.MemoExoticComponent<typeof LinkedInPostPreviewImpl>;
|
|
1445
1595
|
|
|
1446
|
-
export { type CalendarFilters, type
|
|
1596
|
+
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 };
|