@postrun/react 2.4.0 → 2.5.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.d.cts CHANGED
@@ -1675,6 +1675,16 @@ interface PreviewMedia {
1675
1675
  }
1676
1676
  /** @deprecated Use {@link PreviewMedia}. Kept as an alias for back-compat. */
1677
1677
  type XPreviewMedia = PreviewMedia;
1678
+ /** A media item with its pixels already resolved to a single URL by the
1679
+ * component (shared by every platform preview's renderer). */
1680
+ interface ResolvedMedia {
1681
+ kind: PreviewMediaKind;
1682
+ src: string;
1683
+ width?: number;
1684
+ height?: number;
1685
+ alt?: string;
1686
+ posterSrc?: string;
1687
+ }
1678
1688
  /**
1679
1689
  * Content for the nested quoted card. Supplied separately because our schema
1680
1690
  * carries only an opaque `quote_tweet_id` (no quoted text/author).
@@ -1736,8 +1746,9 @@ type LinkedInTheme = 'light' | 'dark' | 'auto';
1736
1746
  * with headline + audience icon, an entity-highlighted body with the "…more"
1737
1747
  * fold, the 1/2/3/4/+N image mosaic (or a video), and a static action bar.
1738
1748
  *
1739
- * v1 renders text + images + video. The richer `content_kind`s (article, poll,
1740
- * document) degrade gracefully to the text/media card and arrive next.
1749
+ * Renders every `content_kind`: text, single/multi image, video, plus the rich
1750
+ * units — article share card, poll, and document — each driven from
1751
+ * `settings.{article,poll,document}` (see `renderContent`).
1741
1752
  *
1742
1753
  * Customize via `theme` (light/dark/auto), `className`/`style`, or by overriding
1743
1754
  * the `--pr-li-*` CSS variables the card reads.
@@ -1765,6 +1776,51 @@ declare function LinkedInPostPreviewImpl({ variant, author, media, theme, time,
1765
1776
  * absorbs unstable media arrays). */
1766
1777
  declare const LinkedInPostPreview: react.MemoExoticComponent<typeof LinkedInPostPreviewImpl>;
1767
1778
 
1779
+ /**
1780
+ * A LinkedIn article share card (`content_kind: 'article'`) — the link unit
1781
+ * LinkedIn renders below the commentary: an optional thumbnail, then a panel with
1782
+ * the source domain (muted), the headline (bold), and the optional description.
1783
+ * Driven straight from `settings.article`; the thumbnail pixels (resolved from
1784
+ * `article.thumbnail_media_id`) are passed in by the host.
1785
+ */
1786
+ /** The article settings shape — derived from the contract, never re-declared. */
1787
+ type LinkedInArticle = NonNullable<NonNullable<LinkedInPostVariant['settings']>['article']>;
1788
+ interface ArticleCardProps {
1789
+ article: LinkedInArticle;
1790
+ /** Resolved thumbnail pixels (from `article.thumbnail_media_id`), if any. */
1791
+ thumbnail?: ResolvedMedia;
1792
+ }
1793
+ declare function ArticleCard({ article, thumbnail }: ArticleCardProps): react.JSX.Element;
1794
+
1795
+ /**
1796
+ * A LinkedIn poll (`content_kind: 'poll'`) — the question, the 2–4 option rows
1797
+ * (rendered as the pre-vote outlined buttons LinkedIn shows), and the footer
1798
+ * ("0 votes • <duration>"). A fresh poll has no votes, so we never fabricate
1799
+ * counts. Driven straight from `settings.poll`.
1800
+ */
1801
+ /** The poll settings shape — derived from the contract, never re-declared. */
1802
+ type LinkedInPoll = NonNullable<NonNullable<LinkedInPostVariant['settings']>['poll']>;
1803
+ interface PollProps {
1804
+ poll: LinkedInPoll;
1805
+ }
1806
+ declare function Poll({ poll }: PollProps): react.JSX.Element;
1807
+
1808
+ /**
1809
+ * A LinkedIn document post (`content_kind: 'document'`) — the PDF/slide unit
1810
+ * LinkedIn renders as a page preview with a dark caption bar (title + "Document").
1811
+ * The document asset rides on the variant `media[]`; if the host resolves a
1812
+ * first-page image it shows here, otherwise a clean document affordance. Title is
1813
+ * required by the contract, so it always renders. Driven by `settings.document`.
1814
+ */
1815
+ /** The document settings shape — derived from the contract, never re-declared. */
1816
+ type LinkedInDocument = NonNullable<NonNullable<LinkedInPostVariant['settings']>['document']>;
1817
+ interface DocumentCardProps {
1818
+ document: LinkedInDocument;
1819
+ /** Resolved first-page pixels (from the document asset on media[]), if any. */
1820
+ cover?: ResolvedMedia;
1821
+ }
1822
+ declare function DocumentCard({ document, cover }: DocumentCardProps): react.JSX.Element;
1823
+
1768
1824
  /**
1769
1825
  * Public props for the TikTok post preview — a faithful render of how a post will
1770
1826
  * look on TikTok, driven straight from our Post object plus the live creator info
@@ -1897,4 +1953,4 @@ declare function Declaration({ brandedContent }: {
1897
1953
  brandedContent: boolean;
1898
1954
  }): react.JSX.Element;
1899
1955
 
1900
- export { AudienceSelect, type CalendarFilters, CommercialDisclosure, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionsFilter, Declaration, type DiscoverableAccount, type InfiniteList, InteractionToggles, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, TikTokCaptionField, type TikTokCaptionFieldProps, TikTokPostPreview, type TikTokPostPreviewProps, TikTokPublishPanel, type TikTokPublishPanelProps, type TikTokTheme, 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 };
1956
+ export { ArticleCard, type ArticleCardProps, AudienceSelect, type CalendarFilters, CommercialDisclosure, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionsFilter, Declaration, type DiscoverableAccount, DocumentCard, type DocumentCardProps, type InfiniteList, InteractionToggles, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, Poll, type PollProps, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, TikTokCaptionField, type TikTokCaptionFieldProps, TikTokPostPreview, type TikTokPostPreviewProps, TikTokPublishPanel, type TikTokPublishPanelProps, type TikTokTheme, 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
@@ -1675,6 +1675,16 @@ interface PreviewMedia {
1675
1675
  }
1676
1676
  /** @deprecated Use {@link PreviewMedia}. Kept as an alias for back-compat. */
1677
1677
  type XPreviewMedia = PreviewMedia;
1678
+ /** A media item with its pixels already resolved to a single URL by the
1679
+ * component (shared by every platform preview's renderer). */
1680
+ interface ResolvedMedia {
1681
+ kind: PreviewMediaKind;
1682
+ src: string;
1683
+ width?: number;
1684
+ height?: number;
1685
+ alt?: string;
1686
+ posterSrc?: string;
1687
+ }
1678
1688
  /**
1679
1689
  * Content for the nested quoted card. Supplied separately because our schema
1680
1690
  * carries only an opaque `quote_tweet_id` (no quoted text/author).
@@ -1736,8 +1746,9 @@ type LinkedInTheme = 'light' | 'dark' | 'auto';
1736
1746
  * with headline + audience icon, an entity-highlighted body with the "…more"
1737
1747
  * fold, the 1/2/3/4/+N image mosaic (or a video), and a static action bar.
1738
1748
  *
1739
- * v1 renders text + images + video. The richer `content_kind`s (article, poll,
1740
- * document) degrade gracefully to the text/media card and arrive next.
1749
+ * Renders every `content_kind`: text, single/multi image, video, plus the rich
1750
+ * units — article share card, poll, and document — each driven from
1751
+ * `settings.{article,poll,document}` (see `renderContent`).
1741
1752
  *
1742
1753
  * Customize via `theme` (light/dark/auto), `className`/`style`, or by overriding
1743
1754
  * the `--pr-li-*` CSS variables the card reads.
@@ -1765,6 +1776,51 @@ declare function LinkedInPostPreviewImpl({ variant, author, media, theme, time,
1765
1776
  * absorbs unstable media arrays). */
1766
1777
  declare const LinkedInPostPreview: react.MemoExoticComponent<typeof LinkedInPostPreviewImpl>;
1767
1778
 
1779
+ /**
1780
+ * A LinkedIn article share card (`content_kind: 'article'`) — the link unit
1781
+ * LinkedIn renders below the commentary: an optional thumbnail, then a panel with
1782
+ * the source domain (muted), the headline (bold), and the optional description.
1783
+ * Driven straight from `settings.article`; the thumbnail pixels (resolved from
1784
+ * `article.thumbnail_media_id`) are passed in by the host.
1785
+ */
1786
+ /** The article settings shape — derived from the contract, never re-declared. */
1787
+ type LinkedInArticle = NonNullable<NonNullable<LinkedInPostVariant['settings']>['article']>;
1788
+ interface ArticleCardProps {
1789
+ article: LinkedInArticle;
1790
+ /** Resolved thumbnail pixels (from `article.thumbnail_media_id`), if any. */
1791
+ thumbnail?: ResolvedMedia;
1792
+ }
1793
+ declare function ArticleCard({ article, thumbnail }: ArticleCardProps): react.JSX.Element;
1794
+
1795
+ /**
1796
+ * A LinkedIn poll (`content_kind: 'poll'`) — the question, the 2–4 option rows
1797
+ * (rendered as the pre-vote outlined buttons LinkedIn shows), and the footer
1798
+ * ("0 votes • <duration>"). A fresh poll has no votes, so we never fabricate
1799
+ * counts. Driven straight from `settings.poll`.
1800
+ */
1801
+ /** The poll settings shape — derived from the contract, never re-declared. */
1802
+ type LinkedInPoll = NonNullable<NonNullable<LinkedInPostVariant['settings']>['poll']>;
1803
+ interface PollProps {
1804
+ poll: LinkedInPoll;
1805
+ }
1806
+ declare function Poll({ poll }: PollProps): react.JSX.Element;
1807
+
1808
+ /**
1809
+ * A LinkedIn document post (`content_kind: 'document'`) — the PDF/slide unit
1810
+ * LinkedIn renders as a page preview with a dark caption bar (title + "Document").
1811
+ * The document asset rides on the variant `media[]`; if the host resolves a
1812
+ * first-page image it shows here, otherwise a clean document affordance. Title is
1813
+ * required by the contract, so it always renders. Driven by `settings.document`.
1814
+ */
1815
+ /** The document settings shape — derived from the contract, never re-declared. */
1816
+ type LinkedInDocument = NonNullable<NonNullable<LinkedInPostVariant['settings']>['document']>;
1817
+ interface DocumentCardProps {
1818
+ document: LinkedInDocument;
1819
+ /** Resolved first-page pixels (from the document asset on media[]), if any. */
1820
+ cover?: ResolvedMedia;
1821
+ }
1822
+ declare function DocumentCard({ document, cover }: DocumentCardProps): react.JSX.Element;
1823
+
1768
1824
  /**
1769
1825
  * Public props for the TikTok post preview — a faithful render of how a post will
1770
1826
  * look on TikTok, driven straight from our Post object plus the live creator info
@@ -1897,4 +1953,4 @@ declare function Declaration({ brandedContent }: {
1897
1953
  brandedContent: boolean;
1898
1954
  }): react.JSX.Element;
1899
1955
 
1900
- export { AudienceSelect, type CalendarFilters, CommercialDisclosure, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionsFilter, Declaration, type DiscoverableAccount, type InfiniteList, InteractionToggles, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, TikTokCaptionField, type TikTokCaptionFieldProps, TikTokPostPreview, type TikTokPostPreviewProps, TikTokPublishPanel, type TikTokPublishPanelProps, type TikTokTheme, 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 };
1956
+ export { ArticleCard, type ArticleCardProps, AudienceSelect, type CalendarFilters, CommercialDisclosure, Connect, type ConnectErrorReason, type ConnectOutcome, type ConnectProps, type ConnectRenderApi, type ConnectState, type ConnectionsFilter, Declaration, type DiscoverableAccount, DocumentCard, type DocumentCardProps, type InfiniteList, InteractionToggles, LinkedInPostPreview, type LinkedInPostPreviewProps, type LinkedInPreviewAuthor, type LiveOptions, type MediaUploadItem, type MediaUploadOptions, type MediaUploadStatus, Poll, type PollProps, type PostrunContextValue, PostrunProvider, type PostrunProviderProps, type PreviewMedia, type PreviewMediaKind, TikTokCaptionField, type TikTokCaptionFieldProps, TikTokPostPreview, type TikTokPostPreviewProps, TikTokPublishPanel, type TikTokPublishPanelProps, type TikTokTheme, 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, useRef, useLayoutEffect, Fragment as Fragment$1, useCallback, createElement, useContext, useId } 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, 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';
4
+ import { 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
5
  export { TIKTOK_CAPTION_MAX, captionMaxFor } from '@postrun/js';
6
6
  import Nango, { AuthError } from '@nangohq/frontend';
7
7
  import pWaitFor, { TimeoutError } from 'p-wait-for';
@@ -9,7 +9,7 @@ import pLimit from 'p-limit';
9
9
  import pRetry, { AbortError } from 'p-retry';
10
10
  import axios, { isAxiosError } from 'axios';
11
11
  import { enrichTweet, TweetContainer, TweetHeader, TweetInReplyTo, TweetBody, TweetMedia, QuotedTweet } from 'react-tweet';
12
- import { FiMessageCircle, FiRepeat, FiHeart, FiBarChart2, FiShare, FiGlobe, FiUsers, FiThumbsUp, FiMessageSquare, FiSend } from 'react-icons/fi';
12
+ import { FiMessageCircle, FiRepeat, FiHeart, FiBarChart2, FiShare, FiGlobe, FiUsers, FiThumbsUp, FiMessageSquare, FiSend, FiFileText } from 'react-icons/fi';
13
13
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
14
  import twitterText from 'twitter-text';
15
15
  import { LuBadgeCheck } from 'react-icons/lu';
@@ -1331,6 +1331,111 @@ function useIsDark(theme) {
1331
1331
  }
1332
1332
  return theme === "dark";
1333
1333
  }
1334
+ function domainOf(source) {
1335
+ try {
1336
+ return new URL(source).hostname.replace(/^www\./, "");
1337
+ } catch {
1338
+ return source;
1339
+ }
1340
+ }
1341
+ function ArticleCard({ article, thumbnail }) {
1342
+ return /* @__PURE__ */ jsxs("div", { style: cardStyle, children: [
1343
+ thumbnail ? /* @__PURE__ */ jsx("img", { src: thumbnail.src, alt: thumbnail.alt ?? "", style: thumbStyle }) : null,
1344
+ /* @__PURE__ */ jsxs("div", { style: metaStyle, children: [
1345
+ /* @__PURE__ */ jsx("div", { style: domainStyle, children: domainOf(article.source) }),
1346
+ article.title ? /* @__PURE__ */ jsx("div", { style: titleStyle, children: article.title }) : null,
1347
+ article.description ? /* @__PURE__ */ jsx("div", { style: descStyle, children: article.description }) : null
1348
+ ] })
1349
+ ] });
1350
+ }
1351
+ var cardStyle = {
1352
+ border: `1px solid ${varRef(LI_VAR.border)}`,
1353
+ borderRadius: 8,
1354
+ overflow: "hidden"
1355
+ };
1356
+ var thumbStyle = {
1357
+ width: "100%",
1358
+ display: "block",
1359
+ aspectRatio: "1.91 / 1",
1360
+ objectFit: "cover"
1361
+ };
1362
+ var metaStyle = {
1363
+ padding: "8px 12px",
1364
+ display: "flex",
1365
+ flexDirection: "column",
1366
+ gap: 2
1367
+ };
1368
+ var domainStyle = {
1369
+ fontSize: 12,
1370
+ color: varRef(LI_VAR.muted)
1371
+ };
1372
+ var titleStyle = {
1373
+ fontSize: 14,
1374
+ fontWeight: 600,
1375
+ color: varRef(LI_VAR.text),
1376
+ lineHeight: 1.3,
1377
+ display: "-webkit-box",
1378
+ WebkitLineClamp: 2,
1379
+ WebkitBoxOrient: "vertical",
1380
+ overflow: "hidden"
1381
+ };
1382
+ var descStyle = {
1383
+ fontSize: 12,
1384
+ color: varRef(LI_VAR.muted),
1385
+ lineHeight: 1.3,
1386
+ display: "-webkit-box",
1387
+ WebkitLineClamp: 1,
1388
+ WebkitBoxOrient: "vertical",
1389
+ overflow: "hidden"
1390
+ };
1391
+ function DocumentCard({ document, cover }) {
1392
+ return /* @__PURE__ */ jsxs("div", { style: cardStyle2, children: [
1393
+ /* @__PURE__ */ jsx("div", { style: pageStyle, children: cover ? /* @__PURE__ */ jsx("img", { src: cover.src, alt: cover.alt ?? "", style: coverStyle }) : /* @__PURE__ */ jsx(FiFileText, { size: 56, "aria-hidden": true, style: { opacity: 0.5 } }) }),
1394
+ /* @__PURE__ */ jsxs("div", { style: barStyle, children: [
1395
+ /* @__PURE__ */ jsx("div", { style: titleStyle2, children: document.title }),
1396
+ /* @__PURE__ */ jsx("div", { style: kindStyle, children: "Document" })
1397
+ ] })
1398
+ ] });
1399
+ }
1400
+ var cardStyle2 = {
1401
+ border: `1px solid ${varRef(LI_VAR.border)}`,
1402
+ borderRadius: 8,
1403
+ overflow: "hidden"
1404
+ };
1405
+ var pageStyle = {
1406
+ position: "relative",
1407
+ aspectRatio: "4 / 3",
1408
+ background: "rgba(127,127,127,0.12)",
1409
+ display: "grid",
1410
+ placeItems: "center",
1411
+ color: varRef(LI_VAR.muted)
1412
+ };
1413
+ var coverStyle = {
1414
+ width: "100%",
1415
+ height: "100%",
1416
+ objectFit: "cover"
1417
+ };
1418
+ var barStyle = {
1419
+ background: "rgba(0,0,0,0.85)",
1420
+ color: "#fff",
1421
+ padding: "10px 14px",
1422
+ display: "flex",
1423
+ flexDirection: "column",
1424
+ gap: 1
1425
+ };
1426
+ var titleStyle2 = {
1427
+ fontSize: 14,
1428
+ fontWeight: 600,
1429
+ lineHeight: 1.3,
1430
+ display: "-webkit-box",
1431
+ WebkitLineClamp: 2,
1432
+ WebkitBoxOrient: "vertical",
1433
+ overflow: "hidden"
1434
+ };
1435
+ var kindStyle = {
1436
+ fontSize: 12,
1437
+ color: "rgba(255,255,255,0.7)"
1438
+ };
1334
1439
  var ROW2 = {
1335
1440
  display: "flex",
1336
1441
  justifyContent: "space-around",
@@ -1484,11 +1589,11 @@ function Tile({
1484
1589
  ] });
1485
1590
  }
1486
1591
  function ImageMosaic({ media }) {
1487
- if (media.length === 0) {
1592
+ const [only] = media;
1593
+ if (!only) {
1488
1594
  return null;
1489
1595
  }
1490
1596
  if (media.length === 1) {
1491
- const only = media[0];
1492
1597
  return /* @__PURE__ */ jsx(
1493
1598
  "img",
1494
1599
  {
@@ -1534,6 +1639,48 @@ function Media({ media }) {
1534
1639
  const images = media.filter((item) => item.kind === "image");
1535
1640
  return /* @__PURE__ */ jsx(ImageMosaic, { media: images });
1536
1641
  }
1642
+ function Poll({ poll }) {
1643
+ return /* @__PURE__ */ jsxs("div", { style: wrapStyle, children: [
1644
+ /* @__PURE__ */ jsx("div", { style: questionStyle, children: poll.question }),
1645
+ /* @__PURE__ */ jsx("div", { style: optionsStyle, children: poll.options.map((option, i) => /* @__PURE__ */ jsx("div", { style: optionStyle, children: option }, `${option}-${i}`)) }),
1646
+ /* @__PURE__ */ jsxs("div", { style: footerStyle, children: [
1647
+ "0 votes \u2022 ",
1648
+ linkedinPollDurationLabel(poll.duration)
1649
+ ] })
1650
+ ] });
1651
+ }
1652
+ var wrapStyle = {
1653
+ border: `1px solid ${varRef(LI_VAR.border)}`,
1654
+ borderRadius: 8,
1655
+ padding: 12,
1656
+ display: "flex",
1657
+ flexDirection: "column",
1658
+ gap: 10
1659
+ };
1660
+ var questionStyle = {
1661
+ fontSize: 14,
1662
+ fontWeight: 600,
1663
+ color: varRef(LI_VAR.text),
1664
+ lineHeight: 1.35
1665
+ };
1666
+ var optionsStyle = {
1667
+ display: "flex",
1668
+ flexDirection: "column",
1669
+ gap: 8
1670
+ };
1671
+ var optionStyle = {
1672
+ border: `1px solid ${varRef(LI_VAR.accent)}`,
1673
+ borderRadius: 999,
1674
+ padding: "8px 16px",
1675
+ textAlign: "center",
1676
+ fontSize: 14,
1677
+ fontWeight: 600,
1678
+ color: varRef(LI_VAR.accent)
1679
+ };
1680
+ var footerStyle = {
1681
+ fontSize: 12,
1682
+ color: varRef(LI_VAR.muted)
1683
+ };
1537
1684
  var FOLD_CHARS = 200;
1538
1685
  var BODY_STYLE = {
1539
1686
  whiteSpace: "pre-wrap",
@@ -1661,7 +1808,7 @@ function LinkedInPostPreviewImpl({
1661
1808
  accent: varRef(LI_VAR.accent),
1662
1809
  muted: varRef(LI_VAR.muted)
1663
1810
  };
1664
- const cardStyle2 = {
1811
+ const cardStyle4 = {
1665
1812
  ...paletteVars(dark),
1666
1813
  background: varRef(LI_VAR.bg),
1667
1814
  color: varRef(LI_VAR.text),
@@ -1672,7 +1819,7 @@ function LinkedInPostPreviewImpl({
1672
1819
  fontFamily: FONT_STACK,
1673
1820
  ...style
1674
1821
  };
1675
- return /* @__PURE__ */ jsxs("div", { className, style: cardStyle2, children: [
1822
+ return /* @__PURE__ */ jsxs("div", { className, style: cardStyle4, children: [
1676
1823
  /* @__PURE__ */ jsx(Header, { author, visibility, time }),
1677
1824
  variant.body ? /* @__PURE__ */ jsx("div", { style: { padding: "8px 16px 0" }, children: /* @__PURE__ */ jsx(
1678
1825
  PostBody,
@@ -1682,10 +1829,26 @@ function LinkedInPostPreviewImpl({
1682
1829
  colors: bodyColors
1683
1830
  }
1684
1831
  ) }) : null,
1685
- resolvedMedia.length > 0 ? /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(Media, { media: resolvedMedia }) }) : null,
1832
+ renderContent(variant, resolvedMedia),
1686
1833
  showActions ? /* @__PURE__ */ jsx(EngagementBar, {}) : null
1687
1834
  ] });
1688
1835
  }
1836
+ function renderContent(variant, media) {
1837
+ const settings = variant.settings;
1838
+ const kind = settings?.content_kind;
1839
+ const [firstMedia] = media;
1840
+ if (kind === "article" && settings?.article) {
1841
+ return /* @__PURE__ */ jsx("div", { style: INSET, children: /* @__PURE__ */ jsx(ArticleCard, { article: settings.article, thumbnail: firstMedia }) });
1842
+ }
1843
+ if (kind === "poll" && settings?.poll) {
1844
+ return /* @__PURE__ */ jsx("div", { style: INSET, children: /* @__PURE__ */ jsx(Poll, { poll: settings.poll }) });
1845
+ }
1846
+ if (kind === "document" && settings?.document) {
1847
+ return /* @__PURE__ */ jsx("div", { style: INSET, children: /* @__PURE__ */ jsx(DocumentCard, { document: settings.document, cover: firstMedia }) });
1848
+ }
1849
+ return media.length > 0 ? /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(Media, { media }) }) : null;
1850
+ }
1851
+ var INSET = { padding: "12px 16px 0" };
1689
1852
  var LinkedInPostPreview = memo(LinkedInPostPreviewImpl);
1690
1853
  var LINK_COLOR = "#8ab4ff";
1691
1854
  var TOKEN = /([#@][\p{L}\p{N}_.]+)/gu;
@@ -1702,7 +1865,7 @@ function Caption({ body }) {
1702
1865
  setOverflowing(el.scrollHeight > el.clientHeight + 1);
1703
1866
  }, [body, expanded]);
1704
1867
  const parts = body.split(TOKEN);
1705
- return /* @__PURE__ */ jsxs("div", { style: wrapStyle, children: [
1868
+ return /* @__PURE__ */ jsxs("div", { style: wrapStyle2, children: [
1706
1869
  /* @__PURE__ */ jsx("div", { ref, style: expanded ? expandedTextStyle : clampedTextStyle, children: parts.map(
1707
1870
  (part, i) => IS_TOKEN.test(part) ? /* @__PURE__ */ jsx("span", { style: { color: LINK_COLOR }, children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i)
1708
1871
  ) }),
@@ -1719,7 +1882,7 @@ function Caption({ body }) {
1719
1882
  ) : null
1720
1883
  ] });
1721
1884
  }
1722
- var wrapStyle = {
1885
+ var wrapStyle2 = {
1723
1886
  fontSize: 14,
1724
1887
  lineHeight: 1.35
1725
1888
  };
@@ -1768,7 +1931,7 @@ function Media2({
1768
1931
  muted: true,
1769
1932
  loop: true,
1770
1933
  playsInline: true,
1771
- style: coverStyle
1934
+ style: coverStyle2
1772
1935
  }
1773
1936
  );
1774
1937
  }
@@ -1795,7 +1958,7 @@ function PhotoCarousel({ media }) {
1795
1958
  };
1796
1959
  }, [emblaApi, sync]);
1797
1960
  return /* @__PURE__ */ jsxs("div", { style: { position: "absolute", inset: 0 }, children: [
1798
- /* @__PURE__ */ jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsx("div", { style: slideStyle, children: /* @__PURE__ */ jsx("img", { src: m.src, alt: m.alt ?? "", style: coverStyle }) }, `${m.src}-${i}`)) }) }),
1961
+ /* @__PURE__ */ jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsx("div", { style: slideStyle, children: /* @__PURE__ */ jsx("img", { src: m.src, alt: m.alt ?? "", style: coverStyle2 }) }, `${m.src}-${i}`)) }) }),
1799
1962
  media.length > 1 ? /* @__PURE__ */ jsx("div", { style: dotsStyle, children: media.map((m, i) => /* @__PURE__ */ jsx(
1800
1963
  "span",
1801
1964
  {
@@ -1814,7 +1977,7 @@ function ProcessingMedia() {
1814
1977
  /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children: "Processing media\u2026" })
1815
1978
  ] });
1816
1979
  }
1817
- var coverStyle = {
1980
+ var coverStyle2 = {
1818
1981
  position: "absolute",
1819
1982
  inset: 0,
1820
1983
  width: "100%",
@@ -1940,7 +2103,7 @@ function TikTokPostPreviewImpl({
1940
2103
  const label = commercialLabel(variant.settings);
1941
2104
  const isAigc = Boolean(variant.settings?.is_aigc);
1942
2105
  const pending = (media?.length ?? 0) > 0 && resolvedMedia.length === 0;
1943
- return /* @__PURE__ */ jsxs("div", { className, style: { ...cardStyle, ...style }, children: [
2106
+ return /* @__PURE__ */ jsxs("div", { className, style: { ...cardStyle3, ...style }, children: [
1944
2107
  /* @__PURE__ */ jsx("style", { children: KEYFRAMES }),
1945
2108
  /* @__PURE__ */ jsx(Media2, { media: resolvedMedia, pending }),
1946
2109
  /* @__PURE__ */ jsx("div", { style: scrimStyle }),
@@ -1987,7 +2150,7 @@ function Avatar({ url, name }) {
1987
2150
  function Disc({ url }) {
1988
2151
  return /* @__PURE__ */ jsx("div", { style: discStyle, children: url ? /* @__PURE__ */ jsx("img", { src: url, alt: "", style: discImgStyle }) : null });
1989
2152
  }
1990
- var cardStyle = {
2153
+ var cardStyle3 = {
1991
2154
  position: "relative",
1992
2155
  width: "100%",
1993
2156
  maxWidth: 320,
@@ -2362,7 +2525,7 @@ function TikTokCaptionField({
2362
2525
  const max = captionMaxFor(postType);
2363
2526
  const count = value.length;
2364
2527
  const over = count > max;
2365
- return /* @__PURE__ */ jsxs("div", { className, style: { ...wrapStyle2, ...style }, children: [
2528
+ return /* @__PURE__ */ jsxs("div", { className, style: { ...wrapStyle3, ...style }, children: [
2366
2529
  /* @__PURE__ */ jsxs("div", { style: labelRowStyle, children: [
2367
2530
  /* @__PURE__ */ jsx("label", { htmlFor: id, style: labelStyle, children: "Caption" }),
2368
2531
  /* @__PURE__ */ jsxs(
@@ -2396,7 +2559,7 @@ function TikTokCaptionField({
2396
2559
  )
2397
2560
  ] });
2398
2561
  }
2399
- var wrapStyle2 = {
2562
+ var wrapStyle3 = {
2400
2563
  display: "flex",
2401
2564
  flexDirection: "column",
2402
2565
  gap: 6,
@@ -2655,6 +2818,6 @@ var postButtonStyle = {
2655
2818
  transition: "opacity 160ms ease"
2656
2819
  };
2657
2820
 
2658
- export { AudienceSelect, CommercialDisclosure, Connect, Declaration, InteractionToggles, LinkedInPostPreview, PostrunProvider, TikTokCaptionField, TikTokPostPreview, TikTokPublishPanel, 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 };
2821
+ export { ArticleCard, AudienceSelect, CommercialDisclosure, Connect, Declaration, DocumentCard, InteractionToggles, LinkedInPostPreview, Poll, PostrunProvider, TikTokCaptionField, TikTokPostPreview, TikTokPublishPanel, 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 };
2659
2822
  //# sourceMappingURL=index.js.map
2660
2823
  //# sourceMappingURL=index.js.map