@postrun/react 2.2.1 → 2.4.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 +990 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +170 -24
- package/dist/index.d.ts +170 -24
- package/dist/index.js +978 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,8 @@ var fi = require('react-icons/fi');
|
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
var twitterText = require('twitter-text');
|
|
16
16
|
var lu = require('react-icons/lu');
|
|
17
|
+
var useEmblaCarousel = require('embla-carousel-react');
|
|
18
|
+
var io5 = require('react-icons/io5');
|
|
17
19
|
|
|
18
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
21
|
|
|
@@ -23,6 +25,7 @@ var pLimit__default = /*#__PURE__*/_interopDefault(pLimit);
|
|
|
23
25
|
var pRetry__default = /*#__PURE__*/_interopDefault(pRetry);
|
|
24
26
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
25
27
|
var twitterText__default = /*#__PURE__*/_interopDefault(twitterText);
|
|
28
|
+
var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
|
|
26
29
|
|
|
27
30
|
// src/context.tsx
|
|
28
31
|
function createDefaultQueryClient() {
|
|
@@ -644,8 +647,6 @@ async function runUpload(client, file, options, signal, callbacks) {
|
|
|
644
647
|
client,
|
|
645
648
|
body: {
|
|
646
649
|
profile_id: options.profileId,
|
|
647
|
-
kind: options.kind,
|
|
648
|
-
content_type: options.contentType,
|
|
649
650
|
targets: options.targets,
|
|
650
651
|
raw: options.raw,
|
|
651
652
|
alt_text: options.altText,
|
|
@@ -1054,7 +1055,7 @@ var ACTIONS = [
|
|
|
1054
1055
|
{ label: "Share", Icon: fi.FiShare }
|
|
1055
1056
|
];
|
|
1056
1057
|
function XPreviewActions() {
|
|
1057
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: ROW, children: ACTIONS.map(({ label, Icon }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1058
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: ROW, children: ACTIONS.map(({ label, Icon: Icon2 }) => /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 18, "aria-label": label, role: "img" }, label)) });
|
|
1058
1059
|
}
|
|
1059
1060
|
var {
|
|
1060
1061
|
extractCashtagsWithIndices,
|
|
@@ -1364,8 +1365,8 @@ var ACTIONS2 = [
|
|
|
1364
1365
|
{ label: "Send", Icon: fi.FiSend }
|
|
1365
1366
|
];
|
|
1366
1367
|
function EngagementBar() {
|
|
1367
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: ROW2, children: ACTIONS2.map(({ label, Icon }) => /* @__PURE__ */ jsxRuntime.jsxs("span", { style: ITEM, children: [
|
|
1368
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1368
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: ROW2, children: ACTIONS2.map(({ label, Icon: Icon2 }) => /* @__PURE__ */ jsxRuntime.jsxs("span", { style: ITEM, children: [
|
|
1369
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 20, "aria-hidden": true }),
|
|
1369
1370
|
label
|
|
1370
1371
|
] }, label)) });
|
|
1371
1372
|
}
|
|
@@ -1671,7 +1672,7 @@ function LinkedInPostPreviewImpl({
|
|
|
1671
1672
|
accent: varRef(LI_VAR.accent),
|
|
1672
1673
|
muted: varRef(LI_VAR.muted)
|
|
1673
1674
|
};
|
|
1674
|
-
const
|
|
1675
|
+
const cardStyle2 = {
|
|
1675
1676
|
...paletteVars(dark),
|
|
1676
1677
|
background: varRef(LI_VAR.bg),
|
|
1677
1678
|
color: varRef(LI_VAR.text),
|
|
@@ -1682,7 +1683,7 @@ function LinkedInPostPreviewImpl({
|
|
|
1682
1683
|
fontFamily: FONT_STACK,
|
|
1683
1684
|
...style
|
|
1684
1685
|
};
|
|
1685
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style:
|
|
1686
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: cardStyle2, children: [
|
|
1686
1687
|
/* @__PURE__ */ jsxRuntime.jsx(Header, { author, visibility, time }),
|
|
1687
1688
|
variant.body ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "8px 16px 0" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1688
1689
|
PostBody,
|
|
@@ -1697,10 +1698,992 @@ function LinkedInPostPreviewImpl({
|
|
|
1697
1698
|
] });
|
|
1698
1699
|
}
|
|
1699
1700
|
var LinkedInPostPreview = react.memo(LinkedInPostPreviewImpl);
|
|
1701
|
+
var LINK_COLOR = "#8ab4ff";
|
|
1702
|
+
var TOKEN = /([#@][\p{L}\p{N}_.]+)/gu;
|
|
1703
|
+
var IS_TOKEN = /^[#@][\p{L}\p{N}_.]+$/u;
|
|
1704
|
+
function Caption({ body }) {
|
|
1705
|
+
const [expanded, setExpanded] = react.useState(false);
|
|
1706
|
+
const [overflowing, setOverflowing] = react.useState(false);
|
|
1707
|
+
const ref = react.useRef(null);
|
|
1708
|
+
react.useLayoutEffect(() => {
|
|
1709
|
+
const el = ref.current;
|
|
1710
|
+
if (!el || expanded) {
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
setOverflowing(el.scrollHeight > el.clientHeight + 1);
|
|
1714
|
+
}, [body, expanded]);
|
|
1715
|
+
const parts = body.split(TOKEN);
|
|
1716
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapStyle, children: [
|
|
1717
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref, style: expanded ? expandedTextStyle : clampedTextStyle, children: parts.map(
|
|
1718
|
+
(part, i) => IS_TOKEN.test(part) ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: LINK_COLOR }, children: part }, i) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: part }, i)
|
|
1719
|
+
) }),
|
|
1720
|
+
overflowing || expanded ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1721
|
+
"button",
|
|
1722
|
+
{
|
|
1723
|
+
type: "button",
|
|
1724
|
+
"aria-expanded": expanded,
|
|
1725
|
+
"aria-label": expanded ? "Collapse caption" : "Expand caption",
|
|
1726
|
+
onClick: () => setExpanded((v) => !v),
|
|
1727
|
+
style: moreStyle,
|
|
1728
|
+
children: expanded ? "less" : "more"
|
|
1729
|
+
}
|
|
1730
|
+
) : null
|
|
1731
|
+
] });
|
|
1732
|
+
}
|
|
1733
|
+
var wrapStyle = {
|
|
1734
|
+
fontSize: 14,
|
|
1735
|
+
lineHeight: 1.35
|
|
1736
|
+
};
|
|
1737
|
+
var clampedTextStyle = {
|
|
1738
|
+
display: "-webkit-box",
|
|
1739
|
+
WebkitLineClamp: 2,
|
|
1740
|
+
WebkitBoxOrient: "vertical",
|
|
1741
|
+
overflow: "hidden",
|
|
1742
|
+
whiteSpace: "pre-wrap",
|
|
1743
|
+
wordBreak: "break-word"
|
|
1744
|
+
};
|
|
1745
|
+
var expandedTextStyle = {
|
|
1746
|
+
maxHeight: 180,
|
|
1747
|
+
overflowY: "auto",
|
|
1748
|
+
whiteSpace: "pre-wrap",
|
|
1749
|
+
wordBreak: "break-word",
|
|
1750
|
+
overscrollBehavior: "contain"
|
|
1751
|
+
};
|
|
1752
|
+
var moreStyle = {
|
|
1753
|
+
display: "inline-block",
|
|
1754
|
+
marginTop: 2,
|
|
1755
|
+
padding: 0,
|
|
1756
|
+
border: 0,
|
|
1757
|
+
background: "transparent",
|
|
1758
|
+
color: "rgba(255,255,255,0.82)",
|
|
1759
|
+
fontSize: 13,
|
|
1760
|
+
fontWeight: 600,
|
|
1761
|
+
cursor: "pointer",
|
|
1762
|
+
fontFamily: "inherit"
|
|
1763
|
+
};
|
|
1764
|
+
function Media2({
|
|
1765
|
+
media,
|
|
1766
|
+
pending = false
|
|
1767
|
+
}) {
|
|
1768
|
+
const [first] = media;
|
|
1769
|
+
if (!first) {
|
|
1770
|
+
return pending ? /* @__PURE__ */ jsxRuntime.jsx(ProcessingMedia, {}) : /* @__PURE__ */ jsxRuntime.jsx(EmptyMedia, {});
|
|
1771
|
+
}
|
|
1772
|
+
if (first.kind === "video") {
|
|
1773
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1774
|
+
"video",
|
|
1775
|
+
{
|
|
1776
|
+
src: first.src,
|
|
1777
|
+
poster: first.posterSrc,
|
|
1778
|
+
autoPlay: true,
|
|
1779
|
+
muted: true,
|
|
1780
|
+
loop: true,
|
|
1781
|
+
playsInline: true,
|
|
1782
|
+
style: coverStyle
|
|
1783
|
+
}
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PhotoCarousel, { media });
|
|
1787
|
+
}
|
|
1788
|
+
function PhotoCarousel({ media }) {
|
|
1789
|
+
const [emblaRef, emblaApi] = useEmblaCarousel__default.default({
|
|
1790
|
+
loop: false,
|
|
1791
|
+
align: "start",
|
|
1792
|
+
containScroll: "trimSnaps"
|
|
1793
|
+
});
|
|
1794
|
+
const [selected, setSelected] = react.useState(0);
|
|
1795
|
+
const sync = react.useCallback((api) => {
|
|
1796
|
+
setSelected(api.selectedScrollSnap());
|
|
1797
|
+
}, []);
|
|
1798
|
+
react.useEffect(() => {
|
|
1799
|
+
if (!emblaApi) {
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1802
|
+
sync(emblaApi);
|
|
1803
|
+
emblaApi.on("select", sync).on("reInit", sync);
|
|
1804
|
+
return () => {
|
|
1805
|
+
emblaApi.off("select", sync).off("reInit", sync);
|
|
1806
|
+
};
|
|
1807
|
+
}, [emblaApi, sync]);
|
|
1808
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "absolute", inset: 0 }, children: [
|
|
1809
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: emblaRef, style: viewportStyle, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: containerStyle, children: media.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: slideStyle, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: m.src, alt: m.alt ?? "", style: coverStyle }) }, `${m.src}-${i}`)) }) }),
|
|
1810
|
+
media.length > 1 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: dotsStyle, children: media.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1811
|
+
"span",
|
|
1812
|
+
{
|
|
1813
|
+
style: { ...dotStyle, opacity: i === selected ? 1 : 0.4 }
|
|
1814
|
+
},
|
|
1815
|
+
`dot-${m.src}-${i}`
|
|
1816
|
+
)) }) : null
|
|
1817
|
+
] });
|
|
1818
|
+
}
|
|
1819
|
+
function EmptyMedia() {
|
|
1820
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: emptyStyle, children: "No media yet" });
|
|
1821
|
+
}
|
|
1822
|
+
function ProcessingMedia() {
|
|
1823
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: emptyStyle, children: [
|
|
1824
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: shimmerStyle }),
|
|
1825
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { position: "relative", zIndex: 1 }, children: "Processing media\u2026" })
|
|
1826
|
+
] });
|
|
1827
|
+
}
|
|
1828
|
+
var coverStyle = {
|
|
1829
|
+
position: "absolute",
|
|
1830
|
+
inset: 0,
|
|
1831
|
+
width: "100%",
|
|
1832
|
+
height: "100%",
|
|
1833
|
+
objectFit: "cover"
|
|
1834
|
+
};
|
|
1835
|
+
var viewportStyle = {
|
|
1836
|
+
position: "absolute",
|
|
1837
|
+
inset: 0,
|
|
1838
|
+
overflow: "hidden"
|
|
1839
|
+
};
|
|
1840
|
+
var containerStyle = {
|
|
1841
|
+
display: "flex",
|
|
1842
|
+
height: "100%"
|
|
1843
|
+
};
|
|
1844
|
+
var slideStyle = {
|
|
1845
|
+
position: "relative",
|
|
1846
|
+
flex: "0 0 100%",
|
|
1847
|
+
minWidth: 0,
|
|
1848
|
+
height: "100%"
|
|
1849
|
+
};
|
|
1850
|
+
var dotsStyle = {
|
|
1851
|
+
position: "absolute",
|
|
1852
|
+
bottom: 124,
|
|
1853
|
+
left: "50%",
|
|
1854
|
+
transform: "translateX(-50%)",
|
|
1855
|
+
display: "flex",
|
|
1856
|
+
gap: 5,
|
|
1857
|
+
alignItems: "center"
|
|
1858
|
+
};
|
|
1859
|
+
var dotStyle = {
|
|
1860
|
+
width: 6,
|
|
1861
|
+
height: 6,
|
|
1862
|
+
borderRadius: "50%",
|
|
1863
|
+
background: "#fff",
|
|
1864
|
+
transition: "opacity 160ms ease"
|
|
1865
|
+
};
|
|
1866
|
+
var emptyStyle = {
|
|
1867
|
+
position: "absolute",
|
|
1868
|
+
inset: 0,
|
|
1869
|
+
display: "flex",
|
|
1870
|
+
alignItems: "center",
|
|
1871
|
+
justifyContent: "center",
|
|
1872
|
+
color: "rgba(255,255,255,0.55)",
|
|
1873
|
+
fontSize: 13,
|
|
1874
|
+
background: "linear-gradient(180deg,#1c1c20,#101013)",
|
|
1875
|
+
overflow: "hidden"
|
|
1876
|
+
};
|
|
1877
|
+
var shimmerStyle = {
|
|
1878
|
+
position: "absolute",
|
|
1879
|
+
inset: 0,
|
|
1880
|
+
background: "linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0) 100%)",
|
|
1881
|
+
backgroundSize: "200% 100%",
|
|
1882
|
+
animation: "pr-tt-shimmer 1.4s ease-in-out infinite"
|
|
1883
|
+
};
|
|
1884
|
+
var Icon = ({
|
|
1885
|
+
size = 24,
|
|
1886
|
+
viewBox,
|
|
1887
|
+
children,
|
|
1888
|
+
...rest
|
|
1889
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1890
|
+
"svg",
|
|
1891
|
+
{
|
|
1892
|
+
width: size,
|
|
1893
|
+
height: size,
|
|
1894
|
+
viewBox,
|
|
1895
|
+
fill: "currentColor",
|
|
1896
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1897
|
+
...rest,
|
|
1898
|
+
children
|
|
1899
|
+
}
|
|
1900
|
+
);
|
|
1901
|
+
var HeartIcon = (p) => /* @__PURE__ */ jsxRuntime.jsx(Icon, { viewBox: "0 0 24 24", ...p, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1902
|
+
"path",
|
|
1903
|
+
{
|
|
1904
|
+
fillRule: "evenodd",
|
|
1905
|
+
clipRule: "evenodd",
|
|
1906
|
+
d: "M7.5 2.25C10.5 2.25 12 4.25 12 4.25C12 4.25 13.5 2.25 16.5 2.25C20 2.25 22.5 4.99999 22.5 8.5C22.5 12.5 19.2311 16.0657 16.25 18.75C14.4095 20.4072 13 21.5 12 21.5C11 21.5 9.55051 20.3989 7.75 18.75C4.81949 16.0662 1.5 12.5 1.5 8.5C1.5 4.99999 4 2.25 7.5 2.25Z"
|
|
1907
|
+
}
|
|
1908
|
+
) });
|
|
1909
|
+
var CommentIcon = (p) => /* @__PURE__ */ jsxRuntime.jsx(Icon, { viewBox: "0 0 48 48", ...p, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1910
|
+
"path",
|
|
1911
|
+
{
|
|
1912
|
+
fillRule: "evenodd",
|
|
1913
|
+
clipRule: "evenodd",
|
|
1914
|
+
d: "M2 21.5c0-10.22 9.88-18 22-18s22 7.78 22 18c0 5.63-3.19 10.74-7.32 14.8a43.6 43.6 0 0 1-14.14 9.1A1.5 1.5 0 0 1 22.5 44v-5.04C11.13 38.4 2 31.34 2 21.5M14 25a3 3 0 1 0 0-6 3 3 0 0 0 0 6m10 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13-3a3 3 0 1 1-6 0 3 3 0 0 1 6 0"
|
|
1915
|
+
}
|
|
1916
|
+
) });
|
|
1917
|
+
var BookmarkIcon = (p) => /* @__PURE__ */ jsxRuntime.jsx(Icon, { viewBox: "0 0 24 24", ...p, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4.5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v15.13a1 1 0 0 1-1.555.831l-6.167-4.12a.5.5 0 0 0-.556 0l-6.167 4.12A1 1 0 0 1 4 19.63z" }) });
|
|
1918
|
+
var ShareIcon = (p) => /* @__PURE__ */ jsxRuntime.jsx(Icon, { viewBox: "0 0 20 20", ...p, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1919
|
+
"path",
|
|
1920
|
+
{
|
|
1921
|
+
fillRule: "evenodd",
|
|
1922
|
+
clipRule: "evenodd",
|
|
1923
|
+
d: "M10.938 3.175a.674.674 0 0 1 1.138-.488l6.526 6.215c.574.547.554 1.47-.043 1.991l-6.505 5.676a.674.674 0 0 1-1.116-.508V13.49s-6.985-1.258-9.225 2.854c-.209.384-1.023.518-.857-1.395.692-3.52 2.106-9.017 10.082-9.017z"
|
|
1924
|
+
}
|
|
1925
|
+
) });
|
|
1926
|
+
var PlusIcon = (p) => /* @__PURE__ */ jsxRuntime.jsx(Icon, { viewBox: "0 0 48 48", ...p, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M26 7a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v15H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h15v15a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V26h15a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H26V7Z" }) });
|
|
1927
|
+
var DASH = "\u2011\u2011\u2011";
|
|
1928
|
+
function commercialLabel(settings) {
|
|
1929
|
+
if (settings?.brand_content_toggle) {
|
|
1930
|
+
return "Paid partnership";
|
|
1931
|
+
}
|
|
1932
|
+
if (settings?.brand_organic_toggle) {
|
|
1933
|
+
return "Promotional content";
|
|
1934
|
+
}
|
|
1935
|
+
return null;
|
|
1936
|
+
}
|
|
1937
|
+
function TikTokPostPreviewImpl({
|
|
1938
|
+
variant,
|
|
1939
|
+
creatorInfo,
|
|
1940
|
+
media,
|
|
1941
|
+
className,
|
|
1942
|
+
style
|
|
1943
|
+
}) {
|
|
1944
|
+
const resolvedMedia = useResolvedMedia(
|
|
1945
|
+
media,
|
|
1946
|
+
variant.media,
|
|
1947
|
+
altSignatureOf(variant.media)
|
|
1948
|
+
);
|
|
1949
|
+
const { creator } = creatorInfo;
|
|
1950
|
+
const handle = creator.username || creator.nickname;
|
|
1951
|
+
const label = commercialLabel(variant.settings);
|
|
1952
|
+
const isAigc = Boolean(variant.settings?.is_aigc);
|
|
1953
|
+
const pending = (media?.length ?? 0) > 0 && resolvedMedia.length === 0;
|
|
1954
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...cardStyle, ...style }, children: [
|
|
1955
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: KEYFRAMES }),
|
|
1956
|
+
/* @__PURE__ */ jsxRuntime.jsx(Media2, { media: resolvedMedia, pending }),
|
|
1957
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: scrimStyle }),
|
|
1958
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: infoStyle, children: [
|
|
1959
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: usernameStyle, children: handle }),
|
|
1960
|
+
variant.body ? /* @__PURE__ */ jsxRuntime.jsx(Caption, { body: variant.body }) : null,
|
|
1961
|
+
label || isAigc ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: labelsStyle, children: [
|
|
1962
|
+
label ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: pillStyle, children: label }) : null,
|
|
1963
|
+
isAigc ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: pillStyle, children: "Creator labeled as AI-generated" }) : null
|
|
1964
|
+
] }) : null,
|
|
1965
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: musicRowStyle, children: [
|
|
1966
|
+
/* @__PURE__ */ jsxRuntime.jsx(io5.IoMusicalNotes, { size: 13 }),
|
|
1967
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1968
|
+
"Original sound - ",
|
|
1969
|
+
creator.nickname
|
|
1970
|
+
] })
|
|
1971
|
+
] })
|
|
1972
|
+
] }),
|
|
1973
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: railStyle, children: [
|
|
1974
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: avatarWrapStyle, children: [
|
|
1975
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { url: creator.avatar_url, name: creator.nickname }),
|
|
1976
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: followBadgeStyle, children: /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, { size: 14 }) })
|
|
1977
|
+
] }),
|
|
1978
|
+
/* @__PURE__ */ jsxRuntime.jsx(RailAction, { icon: /* @__PURE__ */ jsxRuntime.jsx(HeartIcon, { size: 30 }), count: DASH }),
|
|
1979
|
+
/* @__PURE__ */ jsxRuntime.jsx(RailAction, { icon: /* @__PURE__ */ jsxRuntime.jsx(CommentIcon, { size: 30 }), count: DASH }),
|
|
1980
|
+
/* @__PURE__ */ jsxRuntime.jsx(RailAction, { icon: /* @__PURE__ */ jsxRuntime.jsx(BookmarkIcon, { size: 28 }), count: DASH }),
|
|
1981
|
+
/* @__PURE__ */ jsxRuntime.jsx(RailAction, { icon: /* @__PURE__ */ jsxRuntime.jsx(ShareIcon, { size: 28 }), count: DASH }),
|
|
1982
|
+
/* @__PURE__ */ jsxRuntime.jsx(Disc, { url: creator.avatar_url })
|
|
1983
|
+
] })
|
|
1984
|
+
] });
|
|
1985
|
+
}
|
|
1986
|
+
function RailAction({ icon, count }) {
|
|
1987
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: railActionStyle, children: [
|
|
1988
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: railIconStyle, children: icon }),
|
|
1989
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: railCountStyle, children: count })
|
|
1990
|
+
] });
|
|
1991
|
+
}
|
|
1992
|
+
function Avatar({ url, name }) {
|
|
1993
|
+
if (url) {
|
|
1994
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: name, style: avatarStyle });
|
|
1995
|
+
}
|
|
1996
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...avatarStyle, ...avatarFallbackStyle }, children: name.slice(0, 1).toUpperCase() });
|
|
1997
|
+
}
|
|
1998
|
+
function Disc({ url }) {
|
|
1999
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: discStyle, children: url ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: "", style: discImgStyle }) : null });
|
|
2000
|
+
}
|
|
2001
|
+
var cardStyle = {
|
|
2002
|
+
position: "relative",
|
|
2003
|
+
width: "100%",
|
|
2004
|
+
maxWidth: 320,
|
|
2005
|
+
aspectRatio: "9 / 16",
|
|
2006
|
+
borderRadius: 16,
|
|
2007
|
+
overflow: "hidden",
|
|
2008
|
+
background: "#000",
|
|
2009
|
+
color: "#fff",
|
|
2010
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
|
|
2011
|
+
};
|
|
2012
|
+
var scrimStyle = {
|
|
2013
|
+
position: "absolute",
|
|
2014
|
+
inset: 0,
|
|
2015
|
+
background: "linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%)",
|
|
2016
|
+
pointerEvents: "none"
|
|
2017
|
+
};
|
|
2018
|
+
var infoStyle = {
|
|
2019
|
+
position: "absolute",
|
|
2020
|
+
left: 14,
|
|
2021
|
+
right: 70,
|
|
2022
|
+
bottom: 14,
|
|
2023
|
+
display: "flex",
|
|
2024
|
+
flexDirection: "column",
|
|
2025
|
+
gap: 6,
|
|
2026
|
+
textShadow: "0 1px 3px rgba(0,0,0,0.5)"
|
|
2027
|
+
};
|
|
2028
|
+
var usernameStyle = {
|
|
2029
|
+
fontWeight: 600,
|
|
2030
|
+
fontSize: 16
|
|
2031
|
+
};
|
|
2032
|
+
var labelsStyle = {
|
|
2033
|
+
display: "flex",
|
|
2034
|
+
flexDirection: "column",
|
|
2035
|
+
alignItems: "flex-start",
|
|
2036
|
+
gap: 4,
|
|
2037
|
+
marginTop: 2
|
|
2038
|
+
};
|
|
2039
|
+
var pillStyle = {
|
|
2040
|
+
display: "inline-flex",
|
|
2041
|
+
alignItems: "center",
|
|
2042
|
+
background: "rgba(255,255,255,0.18)",
|
|
2043
|
+
color: "#fff",
|
|
2044
|
+
fontSize: 11,
|
|
2045
|
+
fontWeight: 500,
|
|
2046
|
+
padding: "2px 7px",
|
|
2047
|
+
borderRadius: 4
|
|
2048
|
+
};
|
|
2049
|
+
var musicRowStyle = {
|
|
2050
|
+
display: "flex",
|
|
2051
|
+
alignItems: "center",
|
|
2052
|
+
gap: 6,
|
|
2053
|
+
fontSize: 13,
|
|
2054
|
+
marginTop: 4
|
|
2055
|
+
};
|
|
2056
|
+
var railStyle = {
|
|
2057
|
+
position: "absolute",
|
|
2058
|
+
right: 8,
|
|
2059
|
+
bottom: 14,
|
|
2060
|
+
display: "flex",
|
|
2061
|
+
flexDirection: "column",
|
|
2062
|
+
alignItems: "center",
|
|
2063
|
+
gap: 16,
|
|
2064
|
+
color: "#fff"
|
|
2065
|
+
};
|
|
2066
|
+
var avatarWrapStyle = {
|
|
2067
|
+
position: "relative",
|
|
2068
|
+
marginBottom: 8
|
|
2069
|
+
};
|
|
2070
|
+
var avatarStyle = {
|
|
2071
|
+
width: 46,
|
|
2072
|
+
height: 46,
|
|
2073
|
+
borderRadius: "50%",
|
|
2074
|
+
objectFit: "cover",
|
|
2075
|
+
display: "block",
|
|
2076
|
+
border: "1px solid rgba(255,255,255,0.2)"
|
|
2077
|
+
};
|
|
2078
|
+
var avatarFallbackStyle = {
|
|
2079
|
+
display: "grid",
|
|
2080
|
+
placeItems: "center",
|
|
2081
|
+
background: "#3a3a40",
|
|
2082
|
+
color: "#fff",
|
|
2083
|
+
fontSize: 18,
|
|
2084
|
+
fontWeight: 700
|
|
2085
|
+
};
|
|
2086
|
+
var followBadgeStyle = {
|
|
2087
|
+
position: "absolute",
|
|
2088
|
+
bottom: -9,
|
|
2089
|
+
left: "50%",
|
|
2090
|
+
transform: "translateX(-50%)",
|
|
2091
|
+
width: 19,
|
|
2092
|
+
height: 19,
|
|
2093
|
+
borderRadius: "50%",
|
|
2094
|
+
background: "#fe2c55",
|
|
2095
|
+
color: "#fff",
|
|
2096
|
+
display: "grid",
|
|
2097
|
+
placeItems: "center"
|
|
2098
|
+
};
|
|
2099
|
+
var railActionStyle = {
|
|
2100
|
+
display: "flex",
|
|
2101
|
+
flexDirection: "column",
|
|
2102
|
+
alignItems: "center",
|
|
2103
|
+
gap: 3
|
|
2104
|
+
};
|
|
2105
|
+
var railIconStyle = {
|
|
2106
|
+
display: "grid",
|
|
2107
|
+
placeItems: "center",
|
|
2108
|
+
filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.4))"
|
|
2109
|
+
};
|
|
2110
|
+
var railCountStyle = {
|
|
2111
|
+
fontSize: 12,
|
|
2112
|
+
fontWeight: 600,
|
|
2113
|
+
textShadow: "0 1px 2px rgba(0,0,0,0.4)"
|
|
2114
|
+
};
|
|
2115
|
+
var discStyle = {
|
|
2116
|
+
width: 44,
|
|
2117
|
+
height: 44,
|
|
2118
|
+
borderRadius: "50%",
|
|
2119
|
+
background: "radial-gradient(circle, #555 0 36%, #111 37% 100%)",
|
|
2120
|
+
display: "grid",
|
|
2121
|
+
placeItems: "center",
|
|
2122
|
+
marginTop: 2,
|
|
2123
|
+
animation: "pr-tt-spin 4s linear infinite"
|
|
2124
|
+
};
|
|
2125
|
+
var discImgStyle = {
|
|
2126
|
+
width: 22,
|
|
2127
|
+
height: 22,
|
|
2128
|
+
borderRadius: "50%",
|
|
2129
|
+
objectFit: "cover"
|
|
2130
|
+
};
|
|
2131
|
+
var KEYFRAMES = `@keyframes pr-tt-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pr-tt-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}`;
|
|
2132
|
+
var TikTokPostPreview = react.memo(TikTokPostPreviewImpl);
|
|
2133
|
+
var TT_VAR = {
|
|
2134
|
+
text: "--pr-tt-text",
|
|
2135
|
+
muted: "--pr-tt-muted",
|
|
2136
|
+
border: "--pr-tt-border",
|
|
2137
|
+
accent: "--pr-tt-accent",
|
|
2138
|
+
switchOff: "--pr-tt-switch-off"
|
|
2139
|
+
};
|
|
2140
|
+
var LIGHT2 = {
|
|
2141
|
+
text: "rgba(0,0,0,0.9)",
|
|
2142
|
+
muted: "rgba(0,0,0,0.55)",
|
|
2143
|
+
border: "rgba(0,0,0,0.12)",
|
|
2144
|
+
accent: "#fe2c55",
|
|
2145
|
+
switchOff: "rgba(0,0,0,0.18)"
|
|
2146
|
+
};
|
|
2147
|
+
var DARK2 = {
|
|
2148
|
+
text: "rgba(255,255,255,0.92)",
|
|
2149
|
+
muted: "#8a8a92",
|
|
2150
|
+
border: "rgba(255,255,255,0.14)",
|
|
2151
|
+
accent: "#fe2c55",
|
|
2152
|
+
switchOff: "rgba(255,255,255,0.22)"
|
|
2153
|
+
};
|
|
2154
|
+
function varRef2(name) {
|
|
2155
|
+
return `var(${name})`;
|
|
2156
|
+
}
|
|
2157
|
+
function paletteVars2(dark) {
|
|
2158
|
+
const p = dark ? DARK2 : LIGHT2;
|
|
2159
|
+
return {
|
|
2160
|
+
[TT_VAR.text]: p.text,
|
|
2161
|
+
[TT_VAR.muted]: p.muted,
|
|
2162
|
+
[TT_VAR.border]: p.border,
|
|
2163
|
+
[TT_VAR.accent]: p.accent,
|
|
2164
|
+
[TT_VAR.switchOff]: p.switchOff
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
function usePrefersDark2() {
|
|
2168
|
+
const [dark, setDark] = react.useState(false);
|
|
2169
|
+
react.useEffect(() => {
|
|
2170
|
+
if (typeof window === "undefined" || !window.matchMedia) {
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2174
|
+
setDark(mq.matches);
|
|
2175
|
+
const onChange = (event) => setDark(event.matches);
|
|
2176
|
+
mq.addEventListener("change", onChange);
|
|
2177
|
+
return () => mq.removeEventListener("change", onChange);
|
|
2178
|
+
}, []);
|
|
2179
|
+
return dark;
|
|
2180
|
+
}
|
|
2181
|
+
function useIsDark2(theme) {
|
|
2182
|
+
const prefersDark = usePrefersDark2();
|
|
2183
|
+
if (theme === "auto") {
|
|
2184
|
+
return prefersDark;
|
|
2185
|
+
}
|
|
2186
|
+
return theme === "dark";
|
|
2187
|
+
}
|
|
2188
|
+
var MUTED = varRef2(TT_VAR.muted);
|
|
2189
|
+
var BORDER = varRef2(TT_VAR.border);
|
|
2190
|
+
var ACCENT = varRef2(TT_VAR.accent);
|
|
2191
|
+
var SWITCH_OFF = varRef2(TT_VAR.switchOff);
|
|
2192
|
+
var ON = "#34c759";
|
|
2193
|
+
function Row({
|
|
2194
|
+
label,
|
|
2195
|
+
sublabel,
|
|
2196
|
+
control,
|
|
2197
|
+
htmlFor
|
|
2198
|
+
}) {
|
|
2199
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: rowStyle, children: [
|
|
2200
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor, style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
2201
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 14 }, children: label }),
|
|
2202
|
+
sublabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: MUTED }, children: sublabel }) : null
|
|
2203
|
+
] }),
|
|
2204
|
+
control
|
|
2205
|
+
] });
|
|
2206
|
+
}
|
|
2207
|
+
function Switch({
|
|
2208
|
+
checked,
|
|
2209
|
+
onChange,
|
|
2210
|
+
disabled,
|
|
2211
|
+
id,
|
|
2212
|
+
ariaLabel
|
|
2213
|
+
}) {
|
|
2214
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2215
|
+
"button",
|
|
2216
|
+
{
|
|
2217
|
+
type: "button",
|
|
2218
|
+
role: "switch",
|
|
2219
|
+
id,
|
|
2220
|
+
"aria-label": ariaLabel,
|
|
2221
|
+
"aria-checked": checked,
|
|
2222
|
+
disabled,
|
|
2223
|
+
onClick: () => onChange(!checked),
|
|
2224
|
+
style: {
|
|
2225
|
+
...switchTrackStyle,
|
|
2226
|
+
background: checked ? ON : SWITCH_OFF,
|
|
2227
|
+
opacity: disabled ? 0.4 : 1,
|
|
2228
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
2229
|
+
},
|
|
2230
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2231
|
+
"span",
|
|
2232
|
+
{
|
|
2233
|
+
style: {
|
|
2234
|
+
...switchKnobStyle,
|
|
2235
|
+
transform: checked ? "translateX(16px)" : "translateX(0)"
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
)
|
|
2239
|
+
}
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2242
|
+
function SectionLabel({ children }) {
|
|
2243
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: sectionLabelStyle, children });
|
|
2244
|
+
}
|
|
2245
|
+
function Hint({ children }) {
|
|
2246
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle, children });
|
|
2247
|
+
}
|
|
2248
|
+
function Notice({ children }) {
|
|
2249
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { style: noticeStyle, children });
|
|
2250
|
+
}
|
|
2251
|
+
function CheckRow({
|
|
2252
|
+
label,
|
|
2253
|
+
checked,
|
|
2254
|
+
onChange
|
|
2255
|
+
}) {
|
|
2256
|
+
const id = react.useId();
|
|
2257
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, style: checkRowStyle, children: [
|
|
2258
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2259
|
+
"input",
|
|
2260
|
+
{
|
|
2261
|
+
id,
|
|
2262
|
+
type: "checkbox",
|
|
2263
|
+
checked,
|
|
2264
|
+
onChange: (e) => onChange(e.target.checked),
|
|
2265
|
+
style: { accentColor: ACCENT, width: 16, height: 16 }
|
|
2266
|
+
}
|
|
2267
|
+
),
|
|
2268
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 14 }, children: label })
|
|
2269
|
+
] });
|
|
2270
|
+
}
|
|
2271
|
+
var rowStyle = {
|
|
2272
|
+
display: "flex",
|
|
2273
|
+
alignItems: "center",
|
|
2274
|
+
justifyContent: "space-between",
|
|
2275
|
+
gap: 12,
|
|
2276
|
+
minHeight: 36
|
|
2277
|
+
};
|
|
2278
|
+
var switchTrackStyle = {
|
|
2279
|
+
position: "relative",
|
|
2280
|
+
width: 40,
|
|
2281
|
+
height: 24,
|
|
2282
|
+
borderRadius: 999,
|
|
2283
|
+
border: 0,
|
|
2284
|
+
padding: 2,
|
|
2285
|
+
flex: "0 0 auto",
|
|
2286
|
+
transition: "background 160ms ease"
|
|
2287
|
+
};
|
|
2288
|
+
var switchKnobStyle = {
|
|
2289
|
+
display: "block",
|
|
2290
|
+
width: 20,
|
|
2291
|
+
height: 20,
|
|
2292
|
+
borderRadius: "50%",
|
|
2293
|
+
background: "#fff",
|
|
2294
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.3)",
|
|
2295
|
+
transition: "transform 160ms ease"
|
|
2296
|
+
};
|
|
2297
|
+
var sectionLabelStyle = {
|
|
2298
|
+
fontSize: 13,
|
|
2299
|
+
fontWeight: 600
|
|
2300
|
+
};
|
|
2301
|
+
var hintStyle = {
|
|
2302
|
+
margin: 0,
|
|
2303
|
+
fontSize: 12,
|
|
2304
|
+
color: ACCENT,
|
|
2305
|
+
lineHeight: 1.4
|
|
2306
|
+
};
|
|
2307
|
+
var noticeStyle = {
|
|
2308
|
+
margin: 0,
|
|
2309
|
+
fontSize: 12,
|
|
2310
|
+
color: MUTED,
|
|
2311
|
+
lineHeight: 1.4
|
|
2312
|
+
};
|
|
2313
|
+
var checkRowStyle = {
|
|
2314
|
+
display: "flex",
|
|
2315
|
+
alignItems: "center",
|
|
2316
|
+
gap: 10,
|
|
2317
|
+
cursor: "pointer"
|
|
2318
|
+
};
|
|
2319
|
+
var TOKENS = { MUTED, BORDER, ACCENT};
|
|
2320
|
+
function AudienceSelect({
|
|
2321
|
+
creatorInfo,
|
|
2322
|
+
value,
|
|
2323
|
+
onChange
|
|
2324
|
+
}) {
|
|
2325
|
+
const id = react.useId();
|
|
2326
|
+
const options = js.audiencePrivacyOptions(creatorInfo.privacy_options, value);
|
|
2327
|
+
const unselected = js.audienceUnselected(value);
|
|
2328
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
2329
|
+
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: "Who can view this post" }),
|
|
2330
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2331
|
+
"select",
|
|
2332
|
+
{
|
|
2333
|
+
id,
|
|
2334
|
+
value: value.privacy_level ?? "",
|
|
2335
|
+
onChange: (e) => onChange({
|
|
2336
|
+
...value,
|
|
2337
|
+
// Validate against the OFFERED (filtered) options, not the full set —
|
|
2338
|
+
// so a manipulated value (e.g. SELF_ONLY while branded) can't slip in.
|
|
2339
|
+
privacy_level: js.parsePrivacyLevel(e.target.value, options)
|
|
2340
|
+
}),
|
|
2341
|
+
style: selectStyle,
|
|
2342
|
+
children: [
|
|
2343
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, children: "Select who can view this post" }),
|
|
2344
|
+
options.map((level) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: level, children: js.tiktokPrivacyLabel(level) }, level))
|
|
2345
|
+
]
|
|
2346
|
+
}
|
|
2347
|
+
),
|
|
2348
|
+
unselected ? /* @__PURE__ */ jsxRuntime.jsx(Hint, { children: js.TIKTOK_AUDIENCE_REQUIRED_HINT }) : null
|
|
2349
|
+
] });
|
|
2350
|
+
}
|
|
2351
|
+
var selectStyle = {
|
|
2352
|
+
width: "100%",
|
|
2353
|
+
appearance: "none",
|
|
2354
|
+
background: "transparent",
|
|
2355
|
+
color: "inherit",
|
|
2356
|
+
border: `1px solid ${TOKENS.BORDER}`,
|
|
2357
|
+
borderRadius: 10,
|
|
2358
|
+
padding: "10px 12px",
|
|
2359
|
+
fontSize: 14,
|
|
2360
|
+
fontFamily: "inherit",
|
|
2361
|
+
outline: "none",
|
|
2362
|
+
cursor: "pointer"
|
|
2363
|
+
};
|
|
2364
|
+
function TikTokCaptionField({
|
|
2365
|
+
value,
|
|
2366
|
+
onChange,
|
|
2367
|
+
postType,
|
|
2368
|
+
placeholder = "Describe your post\u2026",
|
|
2369
|
+
className,
|
|
2370
|
+
style
|
|
2371
|
+
}) {
|
|
2372
|
+
const id = react.useId();
|
|
2373
|
+
const max = js.captionMaxFor(postType);
|
|
2374
|
+
const count = value.length;
|
|
2375
|
+
const over = count > max;
|
|
2376
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...wrapStyle2, ...style }, children: [
|
|
2377
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: labelRowStyle, children: [
|
|
2378
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, style: labelStyle, children: "Caption" }),
|
|
2379
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2380
|
+
"span",
|
|
2381
|
+
{
|
|
2382
|
+
style: {
|
|
2383
|
+
...countStyle,
|
|
2384
|
+
color: over ? varRef2(TT_VAR.accent) : varRef2(TT_VAR.muted)
|
|
2385
|
+
},
|
|
2386
|
+
children: [
|
|
2387
|
+
count.toLocaleString(),
|
|
2388
|
+
" / ",
|
|
2389
|
+
max.toLocaleString()
|
|
2390
|
+
]
|
|
2391
|
+
}
|
|
2392
|
+
)
|
|
2393
|
+
] }),
|
|
2394
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2395
|
+
"textarea",
|
|
2396
|
+
{
|
|
2397
|
+
id,
|
|
2398
|
+
value,
|
|
2399
|
+
onChange: (e) => onChange(e.target.value),
|
|
2400
|
+
placeholder,
|
|
2401
|
+
rows: 4,
|
|
2402
|
+
style: {
|
|
2403
|
+
...textareaStyle,
|
|
2404
|
+
borderColor: over ? varRef2(TT_VAR.accent) : varRef2(TT_VAR.border)
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
)
|
|
2408
|
+
] });
|
|
2409
|
+
}
|
|
2410
|
+
var wrapStyle2 = {
|
|
2411
|
+
display: "flex",
|
|
2412
|
+
flexDirection: "column",
|
|
2413
|
+
gap: 6,
|
|
2414
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
|
|
2415
|
+
};
|
|
2416
|
+
var labelRowStyle = {
|
|
2417
|
+
display: "flex",
|
|
2418
|
+
alignItems: "baseline",
|
|
2419
|
+
justifyContent: "space-between"
|
|
2420
|
+
};
|
|
2421
|
+
var labelStyle = {
|
|
2422
|
+
fontSize: 13,
|
|
2423
|
+
fontWeight: 600,
|
|
2424
|
+
color: "inherit"
|
|
2425
|
+
};
|
|
2426
|
+
var countStyle = {
|
|
2427
|
+
fontSize: 12,
|
|
2428
|
+
fontVariantNumeric: "tabular-nums"
|
|
2429
|
+
};
|
|
2430
|
+
var textareaStyle = {
|
|
2431
|
+
width: "100%",
|
|
2432
|
+
resize: "vertical",
|
|
2433
|
+
background: "transparent",
|
|
2434
|
+
color: "inherit",
|
|
2435
|
+
border: "1px solid rgba(255,255,255,0.14)",
|
|
2436
|
+
borderRadius: 10,
|
|
2437
|
+
padding: "10px 12px",
|
|
2438
|
+
fontSize: 14,
|
|
2439
|
+
lineHeight: 1.4,
|
|
2440
|
+
fontFamily: "inherit",
|
|
2441
|
+
outline: "none",
|
|
2442
|
+
boxSizing: "border-box"
|
|
2443
|
+
};
|
|
2444
|
+
function CommercialDisclosure({
|
|
2445
|
+
value,
|
|
2446
|
+
onChange
|
|
2447
|
+
}) {
|
|
2448
|
+
const labelNotice = js.commercialLabelNotice(value);
|
|
2449
|
+
const incomplete = js.commercialDisclosureIncomplete(value);
|
|
2450
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
2451
|
+
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: "Disclose post content" }),
|
|
2452
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2453
|
+
Row,
|
|
2454
|
+
{
|
|
2455
|
+
label: "Disclose commercial content",
|
|
2456
|
+
sublabel: "Turn on if this post promotes a brand, product, or service.",
|
|
2457
|
+
control: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2458
|
+
Switch,
|
|
2459
|
+
{
|
|
2460
|
+
checked: value.commercial_disclosure,
|
|
2461
|
+
ariaLabel: "Disclose commercial content",
|
|
2462
|
+
onChange: (next) => onChange(js.setCommercialDisclosure(value, next))
|
|
2463
|
+
}
|
|
2464
|
+
)
|
|
2465
|
+
}
|
|
2466
|
+
),
|
|
2467
|
+
value.commercial_disclosure ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8, paddingLeft: 2 }, children: [
|
|
2468
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2469
|
+
CheckRow,
|
|
2470
|
+
{
|
|
2471
|
+
label: "Your brand",
|
|
2472
|
+
checked: value.your_brand,
|
|
2473
|
+
onChange: (next) => onChange(js.setBrandKind(value, "your_brand", next))
|
|
2474
|
+
}
|
|
2475
|
+
),
|
|
2476
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2477
|
+
CheckRow,
|
|
2478
|
+
{
|
|
2479
|
+
label: "Branded content",
|
|
2480
|
+
checked: value.branded_content,
|
|
2481
|
+
onChange: (next) => onChange(js.setBrandKind(value, "branded_content", next))
|
|
2482
|
+
}
|
|
2483
|
+
),
|
|
2484
|
+
incomplete ? /* @__PURE__ */ jsxRuntime.jsx(Hint, { children: js.TIKTOK_DISCLOSURE_REQUIRED_HINT }) : null,
|
|
2485
|
+
labelNotice ? /* @__PURE__ */ jsxRuntime.jsx(Notice, { children: labelNotice }) : null
|
|
2486
|
+
] }) : null
|
|
2487
|
+
] });
|
|
2488
|
+
}
|
|
2489
|
+
function Declaration({ brandedContent }) {
|
|
2490
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("p", { style: declarationStyle, children: [
|
|
2491
|
+
"By posting, you agree to TikTok's",
|
|
2492
|
+
" ",
|
|
2493
|
+
brandedContent ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2494
|
+
/* @__PURE__ */ jsxRuntime.jsx(DeclarationLink, { href: js.TIKTOK_BRANDED_CONTENT_POLICY_URL, children: "Branded Content Policy" }),
|
|
2495
|
+
" ",
|
|
2496
|
+
"and",
|
|
2497
|
+
" "
|
|
2498
|
+
] }) : null,
|
|
2499
|
+
/* @__PURE__ */ jsxRuntime.jsx(DeclarationLink, { href: js.TIKTOK_MUSIC_CONFIRMATION_URL, children: "Music Usage Confirmation" }),
|
|
2500
|
+
"."
|
|
2501
|
+
] });
|
|
2502
|
+
}
|
|
2503
|
+
function DeclarationLink({ href, children }) {
|
|
2504
|
+
return /* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noreferrer", style: linkStyle2, children });
|
|
2505
|
+
}
|
|
2506
|
+
var declarationStyle = {
|
|
2507
|
+
margin: 0,
|
|
2508
|
+
fontSize: 12,
|
|
2509
|
+
color: TOKENS.MUTED,
|
|
2510
|
+
lineHeight: 1.45
|
|
2511
|
+
};
|
|
2512
|
+
var linkStyle2 = {
|
|
2513
|
+
color: "inherit",
|
|
2514
|
+
textDecoration: "underline"
|
|
2515
|
+
};
|
|
2516
|
+
function InteractionToggles({
|
|
2517
|
+
creatorInfo,
|
|
2518
|
+
value,
|
|
2519
|
+
onChange,
|
|
2520
|
+
isVideo
|
|
2521
|
+
}) {
|
|
2522
|
+
const rows = js.interactionRows(creatorInfo, isVideo);
|
|
2523
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
2524
|
+
/* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: "Allow users to" }),
|
|
2525
|
+
rows.map((row) => {
|
|
2526
|
+
const on = Boolean(value[js.interactionValueKey(row.key)]);
|
|
2527
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2528
|
+
Row,
|
|
2529
|
+
{
|
|
2530
|
+
label: row.label,
|
|
2531
|
+
sublabel: row.disabled ? "Turned off by this creator" : void 0,
|
|
2532
|
+
control: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2533
|
+
Switch,
|
|
2534
|
+
{
|
|
2535
|
+
checked: !row.disabled && on,
|
|
2536
|
+
disabled: row.disabled,
|
|
2537
|
+
ariaLabel: `Allow ${row.label}`,
|
|
2538
|
+
onChange: (next) => onChange(js.toggleInteraction(value, row.key, next))
|
|
2539
|
+
}
|
|
2540
|
+
)
|
|
2541
|
+
},
|
|
2542
|
+
row.key
|
|
2543
|
+
);
|
|
2544
|
+
})
|
|
2545
|
+
] });
|
|
2546
|
+
}
|
|
2547
|
+
function mediaCountValid(postType, count) {
|
|
2548
|
+
if (postType === "carousel") {
|
|
2549
|
+
return count >= 2 && count <= 35;
|
|
2550
|
+
}
|
|
2551
|
+
return count === 1;
|
|
2552
|
+
}
|
|
2553
|
+
function TikTokPublishPanel({
|
|
2554
|
+
variant,
|
|
2555
|
+
creatorInfo,
|
|
2556
|
+
caption,
|
|
2557
|
+
onCaptionChange,
|
|
2558
|
+
options,
|
|
2559
|
+
onOptionsChange,
|
|
2560
|
+
onPost,
|
|
2561
|
+
posting = false,
|
|
2562
|
+
theme = "auto",
|
|
2563
|
+
className,
|
|
2564
|
+
style
|
|
2565
|
+
}) {
|
|
2566
|
+
const dark = useIsDark2(theme);
|
|
2567
|
+
const isVideo = variant.post_type === "video";
|
|
2568
|
+
const captionOver = caption.length > js.captionMaxFor(variant.post_type);
|
|
2569
|
+
const mediaOk = mediaCountValid(variant.post_type, variant.media?.length ?? 0);
|
|
2570
|
+
const ready = !captionOver && mediaOk && js.tiktokOptionsReady(options);
|
|
2571
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2572
|
+
"div",
|
|
2573
|
+
{
|
|
2574
|
+
className,
|
|
2575
|
+
style: {
|
|
2576
|
+
...paletteVars2(dark),
|
|
2577
|
+
...panelStyle,
|
|
2578
|
+
color: varRef2(TT_VAR.text),
|
|
2579
|
+
...style
|
|
2580
|
+
},
|
|
2581
|
+
children: [
|
|
2582
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2583
|
+
TikTokCaptionField,
|
|
2584
|
+
{
|
|
2585
|
+
value: caption,
|
|
2586
|
+
onChange: onCaptionChange,
|
|
2587
|
+
postType: variant.post_type
|
|
2588
|
+
}
|
|
2589
|
+
),
|
|
2590
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
|
|
2591
|
+
/* @__PURE__ */ jsxRuntime.jsx(AudienceSelect, { creatorInfo, value: options, onChange: onOptionsChange }),
|
|
2592
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
|
|
2593
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2594
|
+
InteractionToggles,
|
|
2595
|
+
{
|
|
2596
|
+
creatorInfo,
|
|
2597
|
+
value: options,
|
|
2598
|
+
onChange: onOptionsChange,
|
|
2599
|
+
isVideo
|
|
2600
|
+
}
|
|
2601
|
+
),
|
|
2602
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
|
|
2603
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommercialDisclosure, { value: options, onChange: onOptionsChange }),
|
|
2604
|
+
isVideo ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2605
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
|
|
2606
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2607
|
+
Row,
|
|
2608
|
+
{
|
|
2609
|
+
label: "AI-generated content",
|
|
2610
|
+
sublabel: "Disclose if this video was created or substantially edited with AI.",
|
|
2611
|
+
control: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2612
|
+
Switch,
|
|
2613
|
+
{
|
|
2614
|
+
checked: options.aigc,
|
|
2615
|
+
ariaLabel: "AI-generated content",
|
|
2616
|
+
onChange: (next) => onOptionsChange({ ...options, aigc: next })
|
|
2617
|
+
}
|
|
2618
|
+
)
|
|
2619
|
+
}
|
|
2620
|
+
)
|
|
2621
|
+
] }) : null,
|
|
2622
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
|
|
2623
|
+
/* @__PURE__ */ jsxRuntime.jsx(Notice, { children: js.TIKTOK_PROCESSING_NOTICE }),
|
|
2624
|
+
/* @__PURE__ */ jsxRuntime.jsx(Declaration, { brandedContent: js.brandedContentDeclared(options) }),
|
|
2625
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2626
|
+
"button",
|
|
2627
|
+
{
|
|
2628
|
+
type: "button",
|
|
2629
|
+
disabled: !ready || posting,
|
|
2630
|
+
onClick: onPost,
|
|
2631
|
+
style: {
|
|
2632
|
+
...postButtonStyle,
|
|
2633
|
+
opacity: !ready || posting ? 0.5 : 1,
|
|
2634
|
+
cursor: !ready || posting ? "not-allowed" : "pointer"
|
|
2635
|
+
},
|
|
2636
|
+
children: posting ? "Posting\u2026" : "Post"
|
|
2637
|
+
}
|
|
2638
|
+
)
|
|
2639
|
+
]
|
|
2640
|
+
}
|
|
2641
|
+
);
|
|
2642
|
+
}
|
|
2643
|
+
function Divider() {
|
|
2644
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: dividerStyle });
|
|
2645
|
+
}
|
|
2646
|
+
var panelStyle = {
|
|
2647
|
+
display: "flex",
|
|
2648
|
+
flexDirection: "column",
|
|
2649
|
+
gap: 16,
|
|
2650
|
+
width: "100%",
|
|
2651
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'
|
|
2652
|
+
};
|
|
2653
|
+
var dividerStyle = {
|
|
2654
|
+
height: 1,
|
|
2655
|
+
background: TOKENS.BORDER
|
|
2656
|
+
};
|
|
2657
|
+
var postButtonStyle = {
|
|
2658
|
+
width: "100%",
|
|
2659
|
+
border: 0,
|
|
2660
|
+
borderRadius: 10,
|
|
2661
|
+
background: TOKENS.ACCENT,
|
|
2662
|
+
color: "#fff",
|
|
2663
|
+
fontSize: 15,
|
|
2664
|
+
fontWeight: 600,
|
|
2665
|
+
padding: "12px 16px",
|
|
2666
|
+
transition: "opacity 160ms ease"
|
|
2667
|
+
};
|
|
1700
2668
|
|
|
2669
|
+
Object.defineProperty(exports, "TIKTOK_CAPTION_MAX", {
|
|
2670
|
+
enumerable: true,
|
|
2671
|
+
get: function () { return js.TIKTOK_CAPTION_MAX; }
|
|
2672
|
+
});
|
|
2673
|
+
Object.defineProperty(exports, "captionMaxFor", {
|
|
2674
|
+
enumerable: true,
|
|
2675
|
+
get: function () { return js.captionMaxFor; }
|
|
2676
|
+
});
|
|
2677
|
+
exports.AudienceSelect = AudienceSelect;
|
|
2678
|
+
exports.CommercialDisclosure = CommercialDisclosure;
|
|
1701
2679
|
exports.Connect = Connect;
|
|
2680
|
+
exports.Declaration = Declaration;
|
|
2681
|
+
exports.InteractionToggles = InteractionToggles;
|
|
1702
2682
|
exports.LinkedInPostPreview = LinkedInPostPreview;
|
|
1703
2683
|
exports.PostrunProvider = PostrunProvider;
|
|
2684
|
+
exports.TikTokCaptionField = TikTokCaptionField;
|
|
2685
|
+
exports.TikTokPostPreview = TikTokPostPreview;
|
|
2686
|
+
exports.TikTokPublishPanel = TikTokPublishPanel;
|
|
1704
2687
|
exports.UploadError = UploadError;
|
|
1705
2688
|
exports.XPostPreview = XPostPreview;
|
|
1706
2689
|
exports.connectionKeys = connectionKeys;
|