@automattic/social-previews 3.2.2 → 3.2.4

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.mjs CHANGED
@@ -1275,8 +1275,6 @@ var DEFAULT_MASTODON_INSTANCE = "mastodon.social";
1275
1275
  // src/mastodon-preview/helpers.ts
1276
1276
  var TITLE_LENGTH4 = 200;
1277
1277
  var BODY_LENGTH = 500;
1278
- var URL_LENGTH2 = 30;
1279
- var BODY_CHAR_LIMIT = BODY_LENGTH - URL_LENGTH2;
1280
1278
  var ADDRESS_PATTERN = /^@([^@]*)@([^@]*)$/i;
1281
1279
  var mastodonTitle = (text) => firstValid(
1282
1280
  shortEnough(TITLE_LENGTH4),
@@ -1286,11 +1284,10 @@ var mastodonBody = (text, options) => {
1286
1284
  const { instance, offset } = options;
1287
1285
  return preparePreviewText(text, {
1288
1286
  platform: "mastodon",
1289
- maxChars: BODY_LENGTH - URL_LENGTH2 - offset,
1287
+ maxChars: BODY_LENGTH - offset,
1290
1288
  hashtagDomain: instance
1291
1289
  });
1292
1290
  };
1293
- var mastodonUrl = (text) => firstValid(shortEnough(URL_LENGTH2), hardTruncation(URL_LENGTH2))(stripHtmlTags(text)) || "";
1294
1291
  var getMastodonAddressDetails = (address) => {
1295
1292
  const matches = address.match(ADDRESS_PATTERN);
1296
1293
  return {
@@ -1393,7 +1390,7 @@ import clsx4 from "clsx";
1393
1390
  // src/mastodon-preview/post/body/index.tsx
1394
1391
  import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
1395
1392
  var MastonPostBody = (props) => {
1396
- const { title, description, customText, url, user, children } = props;
1393
+ const { title, description, customText, user, children } = props;
1397
1394
  const instance = user?.address ? getMastodonAddressDetails(user.address).instance : "";
1398
1395
  const options = {
1399
1396
  instance,
@@ -1418,7 +1415,6 @@ var MastonPostBody = (props) => {
1418
1415
  }
1419
1416
  return /* @__PURE__ */ jsxs29("div", { className: "mastodon-preview__body", children: [
1420
1417
  bodyTxt,
1421
- /* @__PURE__ */ jsx40("a", { href: url, target: "_blank", rel: "noreferrer noopener", children: mastodonUrl(url.replace(/^https?:\/\//, "")) }),
1422
1418
  children
1423
1419
  ] });
1424
1420
  };
@@ -1817,8 +1813,8 @@ var actions_default4 = BlueskyPostActions;
1817
1813
  // src/bluesky-preview/helpers.ts
1818
1814
  var TITLE_LENGTH5 = 200;
1819
1815
  var BODY_LENGTH2 = 300;
1820
- var URL_LENGTH3 = 40;
1821
- var BODY_CHAR_LIMIT2 = BODY_LENGTH2 - URL_LENGTH3;
1816
+ var URL_LENGTH2 = 40;
1817
+ var BODY_CHAR_LIMIT = BODY_LENGTH2 - URL_LENGTH2;
1822
1818
  var blueskyTitle = (text) => firstValid(
1823
1819
  shortEnough(TITLE_LENGTH5),
1824
1820
  hardTruncation(TITLE_LENGTH5)
@@ -1827,10 +1823,10 @@ var blueskyBody = (text, options = {}) => {
1827
1823
  const { offset = 0, reserveUrlSpace = true } = options;
1828
1824
  return preparePreviewText(text, {
1829
1825
  platform: "bluesky",
1830
- maxChars: BODY_LENGTH2 - (reserveUrlSpace ? URL_LENGTH3 : 0) - offset
1826
+ maxChars: BODY_LENGTH2 - (reserveUrlSpace ? URL_LENGTH2 : 0) - offset
1831
1827
  });
1832
1828
  };
1833
- var blueskyUrl = (text) => firstValid(shortEnough(URL_LENGTH3), hardTruncation(URL_LENGTH3))(stripHtmlTags(text)) || "";
1829
+ var blueskyUrl = (text) => firstValid(shortEnough(URL_LENGTH2), hardTruncation(URL_LENGTH2))(stripHtmlTags(text)) || "";
1834
1830
 
1835
1831
  // src/bluesky-preview/post/body/index.tsx
1836
1832
  import { Fragment as Fragment6, jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";