@opinly/next 0.1.9 → 0.1.11

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.
Files changed (78) hide show
  1. package/dist/components/author-page/index.cjs +1 -2
  2. package/dist/components/author-page/index.cjs.map +1 -1
  3. package/dist/components/author-page/index.js +1 -2
  4. package/dist/components/author-page/index.js.map +1 -1
  5. package/dist/components/authors-page/index.cjs +1 -2
  6. package/dist/components/authors-page/index.cjs.map +1 -1
  7. package/dist/components/authors-page/index.js +1 -2
  8. package/dist/components/authors-page/index.js.map +1 -1
  9. package/dist/components/blog-post/_components/content.cjs +37 -8
  10. package/dist/components/blog-post/_components/content.cjs.map +1 -1
  11. package/dist/components/blog-post/_components/content.js +37 -8
  12. package/dist/components/blog-post/_components/content.js.map +1 -1
  13. package/dist/components/blog-post/_components/table-of-contents.cjs +1 -2
  14. package/dist/components/blog-post/_components/table-of-contents.cjs.map +1 -1
  15. package/dist/components/blog-post/_components/table-of-contents.js +1 -2
  16. package/dist/components/blog-post/_components/table-of-contents.js.map +1 -1
  17. package/dist/components/blog-post/_helpers/json-ld.cjs +1 -2
  18. package/dist/components/blog-post/_helpers/json-ld.cjs.map +1 -1
  19. package/dist/components/blog-post/_helpers/json-ld.js +1 -2
  20. package/dist/components/blog-post/_helpers/json-ld.js.map +1 -1
  21. package/dist/components/blog-post/index.cjs +0 -1
  22. package/dist/components/blog-post/index.cjs.map +1 -1
  23. package/dist/components/blog-post/index.js +0 -1
  24. package/dist/components/blog-post/index.js.map +1 -1
  25. package/dist/components/home-page/folders.cjs +98 -0
  26. package/dist/components/home-page/folders.cjs.map +1 -0
  27. package/dist/components/home-page/folders.d.cts +9 -0
  28. package/dist/components/home-page/folders.d.ts +9 -0
  29. package/dist/components/home-page/folders.js +63 -0
  30. package/dist/components/home-page/folders.js.map +1 -0
  31. package/dist/components/home-page/index.cjs +44 -0
  32. package/dist/components/home-page/index.cjs.map +1 -0
  33. package/dist/components/home-page/index.d.cts +11 -0
  34. package/dist/components/home-page/index.d.ts +11 -0
  35. package/dist/components/home-page/index.js +20 -0
  36. package/dist/components/home-page/index.js.map +1 -0
  37. package/dist/components/{home-page.cjs → home-page/pagination.cjs} +48 -28
  38. package/dist/components/home-page/pagination.cjs.map +1 -0
  39. package/dist/components/home-page/pagination.d.cts +10 -0
  40. package/dist/components/home-page/pagination.d.ts +10 -0
  41. package/dist/components/home-page/pagination.js +57 -0
  42. package/dist/components/home-page/pagination.js.map +1 -0
  43. package/dist/components/home-page/top-posts.cjs +52 -0
  44. package/dist/components/home-page/top-posts.cjs.map +1 -0
  45. package/dist/components/home-page/top-posts.d.cts +9 -0
  46. package/dist/components/home-page/top-posts.d.ts +9 -0
  47. package/dist/components/home-page/top-posts.js +28 -0
  48. package/dist/components/home-page/top-posts.js.map +1 -0
  49. package/dist/components/opinly-blog.cjs +3 -2
  50. package/dist/components/opinly-blog.cjs.map +1 -1
  51. package/dist/components/opinly-blog.d.cts +5 -2
  52. package/dist/components/opinly-blog.d.ts +5 -2
  53. package/dist/components/opinly-blog.js +3 -2
  54. package/dist/components/opinly-blog.js.map +1 -1
  55. package/dist/components/post-preview.cjs +25 -7
  56. package/dist/components/post-preview.cjs.map +1 -1
  57. package/dist/components/post-preview.d.cts +3 -4
  58. package/dist/components/post-preview.d.ts +3 -4
  59. package/dist/components/post-preview.js +23 -6
  60. package/dist/components/post-preview.js.map +1 -1
  61. package/dist/index.cjs +1 -3
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.d.cts +0 -1
  64. package/dist/index.d.ts +0 -1
  65. package/dist/index.js +0 -1
  66. package/dist/index.js.map +1 -1
  67. package/package.json +3 -2
  68. package/dist/components/home-page.cjs.map +0 -1
  69. package/dist/components/home-page.d.cts +0 -12
  70. package/dist/components/home-page.d.ts +0 -12
  71. package/dist/components/home-page.js +0 -37
  72. package/dist/components/home-page.js.map +0 -1
  73. package/dist/utils/images.cjs +0 -35
  74. package/dist/utils/images.cjs.map +0 -1
  75. package/dist/utils/images.d.cts +0 -3
  76. package/dist/utils/images.d.ts +0 -3
  77. package/dist/utils/images.js +0 -11
  78. package/dist/utils/images.js.map +0 -1
@@ -34,7 +34,6 @@ module.exports = __toCommonJS(author_page_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_image = __toESM(require("next/image"), 1);
36
36
  var import_sdk_config = require("../../utils/sdk-config");
37
- var import_images = require("../../utils/images");
38
37
  var import_post_preview = require("../post-preview");
39
38
  var import_bread_crumbs = require("../bread-crumbs");
40
39
  const AuthorPage = ({
@@ -56,7 +55,7 @@ const AuthorPage = ({
56
55
  author.image.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
57
56
  import_image.default,
58
57
  {
59
- src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${(0, import_images.replaceImageNameSpace)(author.image.fileKey)}`,
58
+ src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
60
59
  alt: author.image.alt || author.name,
61
60
  width: 150,
62
61
  height: 150,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/author-page/index.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\nimport { replaceImageNameSpace } from \"../../utils/images\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\n\nexport const AuthorPage = ({\n author,\n}: {\n author: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"author\" }\n >[\"data\"];\n}) => {\n return (\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n url: `${opinlyConfig.blogPrefix}/authors`,\n },\n ]}\n />\n {/* Author Header */}\n <div className=\"flex items-center gap-6 mb-10\">\n {author.image.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.image.fileKey)}`}\n alt={author.image.alt || author.name}\n width={150}\n height={150}\n className=\"rounded-full border\"\n />\n )}\n <div>\n <h1 className=\"text-3xl font-bold mb-1\">{author.name}</h1>\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n\n {/* Posts Grid */}\n <h2 className=\"text-xl font-semibold mb-6\">Posts by {author.name}</h2>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) => post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBM;AAhBN,mBAAkB;AAClB,wBAA6B;AAC7B,oBAAsC;AACtC,0BAA4B;AAC5B,0BAA4B;AAErB,MAAM,aAAa,CAAC;AAAA,EACzB;AACF,MAKM;AACJ,SACE,6CAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,YACN,KAAK,GAAG,+BAAa,UAAU;AAAA,UACjC;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAEA,6CAAC,SAAI,WAAU,iCACZ;AAAA,aAAO,MAAM,WACZ;AAAA,QAAC,aAAAA;AAAA,QAAA;AAAA,UACC,KAAK,GAAG,+BAAa,YAAY,QAAI,qCAAsB,OAAO,MAAM,OAAO,CAAC;AAAA,UAChF,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,UAChC,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,6CAAC,SACC;AAAA,oDAAC,QAAG,WAAU,2BAA2B,iBAAO,MAAK;AAAA,QACpD,OAAO,OACN,4CAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,SAEJ;AAAA,OACF;AAAA,IAGA,6CAAC,QAAG,WAAU,8BAA6B;AAAA;AAAA,MAAU,OAAO;AAAA,OAAK;AAAA,IACjE,4CAAC,SAAI,WAAU,wDACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,MACX,CAAC,SAAS,QAAQ,4CAAC,mCAA4B,QAAX,KAAK,IAAkB;AAAA,IAC7D,IAEA,4CAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,KACF;AAEJ;","names":["Image"]}
1
+ {"version":3,"sources":["../../../src/components/author-page/index.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\n\nexport const AuthorPage = ({\n author,\n}: {\n author: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"author\" }\n >[\"data\"];\n}) => {\n return (\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n url: `${opinlyConfig.blogPrefix}/authors`,\n },\n ]}\n />\n {/* Author Header */}\n <div className=\"flex items-center gap-6 mb-10\">\n {author.image.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.image.fileKey}`}\n alt={author.image.alt || author.name}\n width={150}\n height={150}\n className=\"rounded-full border\"\n />\n )}\n <div>\n <h1 className=\"text-3xl font-bold mb-1\">{author.name}</h1>\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n\n {/* Posts Grid */}\n <h2 className=\"text-xl font-semibold mb-6\">Posts by {author.name}</h2>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) => post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBM;AAfN,mBAAkB;AAClB,wBAA6B;AAC7B,0BAA4B;AAC5B,0BAA4B;AAErB,MAAM,aAAa,CAAC;AAAA,EACzB;AACF,MAKM;AACJ,SACE,6CAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,YACN,KAAK,GAAG,+BAAa,UAAU;AAAA,UACjC;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAEA,6CAAC,SAAI,WAAU,iCACZ;AAAA,aAAO,MAAM,WACZ;AAAA,QAAC,aAAAA;AAAA,QAAA;AAAA,UACC,KAAK,GAAG,+BAAa,YAAY,IAAI,OAAO,MAAM,OAAO;AAAA,UACzD,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,UAChC,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,6CAAC,SACC;AAAA,oDAAC,QAAG,WAAU,2BAA2B,iBAAO,MAAK;AAAA,QACpD,OAAO,OACN,4CAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,SAEJ;AAAA,OACF;AAAA,IAGA,6CAAC,QAAG,WAAU,8BAA6B;AAAA;AAAA,MAAU,OAAO;AAAA,OAAK;AAAA,IACjE,4CAAC,SAAI,WAAU,wDACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,MACX,CAAC,SAAS,QAAQ,4CAAC,mCAA4B,QAAX,KAAK,IAAkB;AAAA,IAC7D,IAEA,4CAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,KACF;AAEJ;","names":["Image"]}
@@ -1,7 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import Image from "next/image";
3
3
  import { opinlyConfig } from "../../utils/sdk-config";
4
- import { replaceImageNameSpace } from "../../utils/images";
5
4
  import { PostPreview } from "../post-preview";
6
5
  import { BreadCrumbs } from "../bread-crumbs";
7
6
  const AuthorPage = ({
@@ -23,7 +22,7 @@ const AuthorPage = ({
23
22
  author.image.fileKey && /* @__PURE__ */ jsx(
24
23
  Image,
25
24
  {
26
- src: `${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.image.fileKey)}`,
25
+ src: `${opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
27
26
  alt: author.image.alt || author.name,
28
27
  width: 150,
29
28
  height: 150,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/author-page/index.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\nimport { replaceImageNameSpace } from \"../../utils/images\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\n\nexport const AuthorPage = ({\n author,\n}: {\n author: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"author\" }\n >[\"data\"];\n}) => {\n return (\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n url: `${opinlyConfig.blogPrefix}/authors`,\n },\n ]}\n />\n {/* Author Header */}\n <div className=\"flex items-center gap-6 mb-10\">\n {author.image.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.image.fileKey)}`}\n alt={author.image.alt || author.name}\n width={150}\n height={150}\n className=\"rounded-full border\"\n />\n )}\n <div>\n <h1 className=\"text-3xl font-bold mb-1\">{author.name}</h1>\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n\n {/* Posts Grid */}\n <h2 className=\"text-xl font-semibold mb-6\">Posts by {author.name}</h2>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) => post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":"AAiBM,cAmBE,YAnBF;AAhBN,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAErB,MAAM,aAAa,CAAC;AAAA,EACzB;AACF,MAKM;AACJ,SACE,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,YACN,KAAK,GAAG,aAAa,UAAU;AAAA,UACjC;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAEA,qBAAC,SAAI,WAAU,iCACZ;AAAA,aAAO,MAAM,WACZ;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,GAAG,aAAa,YAAY,IAAI,sBAAsB,OAAO,MAAM,OAAO,CAAC;AAAA,UAChF,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,UAChC,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,qBAAC,SACC;AAAA,4BAAC,QAAG,WAAU,2BAA2B,iBAAO,MAAK;AAAA,QACpD,OAAO,OACN,oBAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,SAEJ;AAAA,OACF;AAAA,IAGA,qBAAC,QAAG,WAAU,8BAA6B;AAAA;AAAA,MAAU,OAAO;AAAA,OAAK;AAAA,IACjE,oBAAC,SAAI,WAAU,wDACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,MACX,CAAC,SAAS,QAAQ,oBAAC,eAA4B,QAAX,KAAK,IAAkB;AAAA,IAC7D,IAEA,oBAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/author-page/index.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\n\nexport const AuthorPage = ({\n author,\n}: {\n author: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"author\" }\n >[\"data\"];\n}) => {\n return (\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n url: `${opinlyConfig.blogPrefix}/authors`,\n },\n ]}\n />\n {/* Author Header */}\n <div className=\"flex items-center gap-6 mb-10\">\n {author.image.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.image.fileKey}`}\n alt={author.image.alt || author.name}\n width={150}\n height={150}\n className=\"rounded-full border\"\n />\n )}\n <div>\n <h1 className=\"text-3xl font-bold mb-1\">{author.name}</h1>\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n\n {/* Posts Grid */}\n <h2 className=\"text-xl font-semibold mb-6\">Posts by {author.name}</h2>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) => post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":"AAgBM,cAmBE,YAnBF;AAfN,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAErB,MAAM,aAAa,CAAC;AAAA,EACzB;AACF,MAKM;AACJ,SACE,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,YACN,KAAK,GAAG,aAAa,UAAU;AAAA,UACjC;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IAEA,qBAAC,SAAI,WAAU,iCACZ;AAAA,aAAO,MAAM,WACZ;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,GAAG,aAAa,YAAY,IAAI,OAAO,MAAM,OAAO;AAAA,UACzD,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,UAChC,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,qBAAC,SACC;AAAA,4BAAC,QAAG,WAAU,2BAA2B,iBAAO,MAAK;AAAA,QACpD,OAAO,OACN,oBAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,SAEJ;AAAA,OACF;AAAA,IAGA,qBAAC,QAAG,WAAU,8BAA6B;AAAA;AAAA,MAAU,OAAO;AAAA,OAAK;AAAA,IACjE,oBAAC,SAAI,WAAU,wDACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,MACX,CAAC,SAAS,QAAQ,oBAAC,eAA4B,QAAX,KAAK,IAAkB;AAAA,IAC7D,IAEA,oBAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,KACF;AAEJ;","names":[]}
@@ -34,7 +34,6 @@ module.exports = __toCommonJS(authors_page_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_image = __toESM(require("next/image"), 1);
36
36
  var import_sdk_config = require("../../utils/sdk-config");
37
- var import_images = require("../../utils/images");
38
37
  var import_post_preview = require("../post-preview");
39
38
  var import_bread_crumbs = require("../bread-crumbs");
40
39
  var import_link = __toESM(require("next/link"), 1);
@@ -64,7 +63,7 @@ const AuthorsPage = ({
64
63
  author.image?.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: authorSlug, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
64
  import_image.default,
66
65
  {
67
- src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${(0, import_images.replaceImageNameSpace)(author.image.fileKey)}`,
66
+ src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
68
67
  alt: author.image.alt || author.name,
69
68
  width: 100,
70
69
  height: 100,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/authors-page/index.tsx"],"sourcesContent":["import type { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\nimport { replaceImageNameSpace } from \"../../utils/images\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport Link from \"next/link\";\n\nexport const AuthorsPage = ({\n authors,\n}: {\n authors: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"authors\" }\n >[\"data\"];\n}) => {\n return (\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n },\n ]}\n />\n <h1 className=\"text-3xl font-bold mb-10\">Authors</h1>\n <div className=\"space-y-16\">\n {authors.map((author, idx) => {\n const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;\n\n return (\n <div\n key={author.name + idx}\n className=\"rounded-lg p-6 flex flex-col gap-6\"\n >\n <div className=\"flex items-center gap-6 mb-4\">\n {author.image?.fileKey && (\n <Link href={authorSlug}>\n <Image\n src={`${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.image.fileKey)}`}\n alt={author.image.alt || author.name}\n width={100}\n height={100}\n className=\"rounded-full border\"\n />\n </Link>\n )}\n <div>\n <Link href={authorSlug}>\n <h2 className=\"text-2xl font-semibold mb-1\">\n {author.name}\n </h2>\n </Link>\n\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n <div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) =>\n post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n <div className=\"flex justify-end\">\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-bold\"\n >\n View more posts from {author.name}\n </Link>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBM;AAjBN,mBAAkB;AAClB,wBAA6B;AAC7B,oBAAsC;AACtC,0BAA4B;AAC5B,0BAA4B;AAC5B,kBAAiB;AAEV,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAKM;AACJ,SACE,6CAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,UACR;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,4CAAC,QAAG,WAAU,4BAA2B,qBAAO;AAAA,IAChD,4CAAC,SAAI,WAAU,cACZ,kBAAQ,IAAI,CAAC,QAAQ,QAAQ;AAC5B,YAAM,aAAa,GAAG,+BAAa,UAAU,YAAY,OAAO,IAAI;AAEpE,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UAEV;AAAA,yDAAC,SAAI,WAAU,gCACZ;AAAA,qBAAO,OAAO,WACb,4CAAC,YAAAA,SAAA,EAAK,MAAM,YACV;AAAA,gBAAC,aAAAC;AAAA,gBAAA;AAAA,kBACC,KAAK,GAAG,+BAAa,YAAY,QAAI,qCAAsB,OAAO,MAAM,OAAO,CAAC;AAAA,kBAChF,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,kBAChC,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,WAAU;AAAA;AAAA,cACZ,GACF;AAAA,cAEF,6CAAC,SACC;AAAA,4DAAC,YAAAD,SAAA,EAAK,MAAM,YACV,sDAAC,QAAG,WAAU,+BACX,iBAAO,MACV,GACF;AAAA,gBAEC,OAAO,OACN,4CAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,iBAEJ;AAAA,eACF;AAAA,YACA,6CAAC,SACC;AAAA,0DAAC,SAAI,WAAU,6DACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,gBACX,CAAC,SACC,QAAQ,4CAAC,mCAA4B,QAAX,KAAK,IAAkB;AAAA,cACrD,IAEA,4CAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,cACA,4CAAC,SAAI,WAAU,oBACb;AAAA,gBAAC,YAAAA;AAAA,gBAAA;AAAA,kBACC,MAAM,GAAG,+BAAa,UAAU,YAAY,OAAO,IAAI;AAAA,kBACvD,WAAU;AAAA,kBACX;AAAA;AAAA,oBACuB,OAAO;AAAA;AAAA;AAAA,cAC/B,GACF;AAAA,eACF;AAAA;AAAA;AAAA,QAlDK,OAAO,OAAO;AAAA,MAmDrB;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;","names":["Link","Image"]}
1
+ {"version":3,"sources":["../../../src/components/authors-page/index.tsx"],"sourcesContent":["import type { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\n\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport Link from \"next/link\";\n\nexport const AuthorsPage = ({\n authors,\n}: {\n authors: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"authors\" }\n >[\"data\"];\n}) => {\n return (\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n },\n ]}\n />\n <h1 className=\"text-3xl font-bold mb-10\">Authors</h1>\n <div className=\"space-y-16\">\n {authors.map((author, idx) => {\n const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;\n\n return (\n <div\n key={author.name + idx}\n className=\"rounded-lg p-6 flex flex-col gap-6\"\n >\n <div className=\"flex items-center gap-6 mb-4\">\n {author.image?.fileKey && (\n <Link href={authorSlug}>\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.image.fileKey}`}\n alt={author.image.alt || author.name}\n width={100}\n height={100}\n className=\"rounded-full border\"\n />\n </Link>\n )}\n <div>\n <Link href={authorSlug}>\n <h2 className=\"text-2xl font-semibold mb-1\">\n {author.name}\n </h2>\n </Link>\n\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n <div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) =>\n post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n <div className=\"flex justify-end\">\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-bold\"\n >\n View more posts from {author.name}\n </Link>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBM;AAjBN,mBAAkB;AAClB,wBAA6B;AAE7B,0BAA4B;AAC5B,0BAA4B;AAC5B,kBAAiB;AAEV,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAKM;AACJ,SACE,6CAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;A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AAAA;AAAA;AAAA,QAlDK,OAAO,OAAO;AAAA,MAmDrB;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;","names":["Link","Image"]}
@@ -1,7 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import Image from "next/image";
3
3
  import { opinlyConfig } from "../../utils/sdk-config";
4
- import { replaceImageNameSpace } from "../../utils/images";
5
4
  import { PostPreview } from "../post-preview";
6
5
  import { BreadCrumbs } from "../bread-crumbs";
7
6
  import Link from "next/link";
@@ -31,7 +30,7 @@ const AuthorsPage = ({
31
30
  author.image?.fileKey && /* @__PURE__ */ jsx(Link, { href: authorSlug, children: /* @__PURE__ */ jsx(
32
31
  Image,
33
32
  {
34
- src: `${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.image.fileKey)}`,
33
+ src: `${opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
35
34
  alt: author.image.alt || author.name,
36
35
  width: 100,
37
36
  height: 100,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/authors-page/index.tsx"],"sourcesContent":["import type { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\nimport { replaceImageNameSpace } from \"../../utils/images\";\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport Link from \"next/link\";\n\nexport const AuthorsPage = ({\n authors,\n}: {\n authors: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"authors\" }\n >[\"data\"];\n}) => {\n return (\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n },\n ]}\n />\n <h1 className=\"text-3xl font-bold mb-10\">Authors</h1>\n <div className=\"space-y-16\">\n {authors.map((author, idx) => {\n const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;\n\n return (\n <div\n key={author.name + idx}\n className=\"rounded-lg p-6 flex flex-col gap-6\"\n >\n <div className=\"flex items-center gap-6 mb-4\">\n {author.image?.fileKey && (\n <Link href={authorSlug}>\n <Image\n src={`${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.image.fileKey)}`}\n alt={author.image.alt || author.name}\n width={100}\n height={100}\n className=\"rounded-full border\"\n />\n </Link>\n )}\n <div>\n <Link href={authorSlug}>\n <h2 className=\"text-2xl font-semibold mb-1\">\n {author.name}\n </h2>\n </Link>\n\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n <div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) =>\n post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n <div className=\"flex justify-end\">\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-bold\"\n >\n View more posts from {author.name}\n </Link>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n"],"mappings":"AAkBM,cA6BU,YA7BV;AAjBN,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,OAAO,UAAU;AAEV,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAKM;AACJ,SACE,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,aAAa;AAAA,UACX;AAAA,YACE,MAAM;AAAA,UACR;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,QAAG,WAAU,4BAA2B,qBAAO;AAAA,IAChD,oBAAC,SAAI,WAAU,cACZ,kBAAQ,IAAI,CAAC,QAAQ,QAAQ;AAC5B,YAAM,aAAa,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAEpE,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,WAAU;AAAA,UAEV;AAAA,iCAAC,SAAI,WAAU,gCACZ;AAAA,qBAAO,OAAO,WACb,oBAAC,QAAK,MAAM,YACV;AAAA,gBAAC;AAAA;AAAA,kBACC,KAAK,GAAG,aAAa,YAAY,IAAI,sBAAsB,OAAO,MAAM,OAAO,CAAC;AAAA,kBAChF,KAAK,OAAO,MAAM,OAAO,OAAO;AAAA,kBAChC,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,WAAU;AAAA;AAAA,cACZ,GACF;AAAA,cAEF,qBAAC,SACC;AAAA,oCAAC,QAAK,MAAM,YACV,8BAAC,QAAG,WAAU,+BACX,iBAAO,MACV,GACF;AAAA,gBAEC,OAAO,OACN,oBAAC,OAAE,WAAU,6CACV,iBAAO,KACV;AAAA,iBAEJ;AAAA,eACF;AAAA,YACA,qBAAC,SACC;AAAA,kCAAC,SAAI,WAAU,6DACZ,iBAAO,SAAS,OAAO,MAAM,SAAS,IACrC,OAAO,MAAM;AAAA,gBACX,CAAC,SACC,QAAQ,oBAAC,eAA4B,QAAX,KAAK,IAAkB;AAAA,cACrD,IAEA,oBAAC,SAAI,WAAU,uCAAsC,2BAErD,GAEJ;AAAA,cACA,oBAAC,SAAI,WAAU,oBACb;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAAA,kBACvD,WAAU;AAAA,kBACX;AAAA;AAAA,oBACuB,OAAO;AAAA;AAAA;AAAA,cAC/B,GACF;AAAA,eACF;AAAA;AAAA;AAAA,QAlDK,OAAO,OAAO;AAAA,MAmDrB;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/authors-page/index.tsx"],"sourcesContent":["import type { Opinly } from \"@opinly/backend\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../utils/sdk-config\";\n\nimport { PostPreview } from \"../post-preview\";\nimport { BreadCrumbs } from \"../bread-crumbs\";\nimport Link from \"next/link\";\n\nexport const AuthorsPage = ({\n authors,\n}: {\n authors: Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"authors\" }\n >[\"data\"];\n}) => {\n return (\n <div className=\"max-w-5xl mx-auto px-4 py-10\">\n <BreadCrumbs\n breadcrumbs={[\n {\n name: \"Authors\",\n },\n ]}\n />\n <h1 className=\"text-3xl font-bold mb-10\">Authors</h1>\n <div className=\"space-y-16\">\n {authors.map((author, idx) => {\n const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;\n\n return (\n <div\n key={author.name + idx}\n className=\"rounded-lg p-6 flex flex-col gap-6\"\n >\n <div className=\"flex items-center gap-6 mb-4\">\n {author.image?.fileKey && (\n <Link href={authorSlug}>\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.image.fileKey}`}\n alt={author.image.alt || author.name}\n width={100}\n height={100}\n className=\"rounded-full border\"\n />\n </Link>\n )}\n <div>\n <Link href={authorSlug}>\n <h2 className=\"text-2xl font-semibold mb-1\">\n {author.name}\n </h2>\n </Link>\n\n {author.bio && (\n <p className=\"text-muted-foreground text-base max-w-2xl\">\n {author.bio}\n </p>\n )}\n </div>\n </div>\n <div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4\">\n {author.posts && author.posts.length > 0 ? (\n author.posts.map(\n (post) =>\n post && <PostPreview key={post.slug} post={post} />\n )\n ) : (\n <div className=\"text-muted-foreground col-span-full\">\n No posts yet.\n </div>\n )}\n </div>\n <div className=\"flex justify-end\">\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-bold\"\n >\n View more posts from {author.name}\n </Link>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n"],"mappings":"AAkBM,cA6BU,YA7BV;AAjBN,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAE7B,SAAS,mBA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MAAM,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAAA,kBACvD,WAAU;AAAA,kBACX;AAAA;AAAA,oBACuB,OAAO;AAAA;AAAA;AAAA,cAC/B,GACF;AAAA,eACF;AAAA;AAAA;AAAA,QAlDK,OAAO,OAAO;AAAA,MAmDrB;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;","names":[]}
@@ -34,6 +34,9 @@ module.exports = __toCommonJS(content_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_merge = require("../../../utils/merge");
36
36
  var import_link = __toESM(require("next/link"), 1);
37
+ var import_image = __toESM(require("next/image"), 1);
38
+ var import_sdk_config = require("../../../utils/sdk-config");
39
+ var import_react2 = __toESM(require("react"), 1);
37
40
  function renderTiptapContent(content, classNames) {
38
41
  if (!content?.content) return [];
39
42
  return content.content.map((node, index) => {
@@ -55,6 +58,10 @@ function renderTiptapContent(content, classNames) {
55
58
  );
56
59
  }
57
60
  case "image":
61
+ const fileKey = node.attrs?.fileKey;
62
+ if (!fileKey) {
63
+ return null;
64
+ }
58
65
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
66
  "div",
60
67
  {
@@ -62,7 +69,18 @@ function renderTiptapContent(content, classNames) {
62
69
  "relative w-full max-w-[800px] my-6",
63
70
  classNames.image
64
71
  ),
65
- style: { aspectRatio: "2 / 1" }
72
+ style: { aspectRatio: "2 / 1" },
73
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_image.default,
75
+ {
76
+ src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${fileKey}`,
77
+ title: node.attrs?.title || "",
78
+ alt: node.attrs?.alt || "",
79
+ fill: true,
80
+ className: "object-contain rounded-lg",
81
+ sizes: "(max-width: 800px) 100vw, 800px"
82
+ }
83
+ )
66
84
  },
67
85
  index
68
86
  );
@@ -70,8 +88,8 @@ function renderTiptapContent(content, classNames) {
70
88
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
89
  "ul",
72
90
  {
73
- className: classNames.bulletList || "list-disc pl-6 my-4",
74
- children: renderChildren(node.content, classNames)
91
+ className: (0, import_merge.cn)("list-disc pl-6 my-4", classNames.bulletList),
92
+ children: renderTiptapContent(node, classNames)
75
93
  },
76
94
  index
77
95
  );
@@ -79,13 +97,16 @@ function renderTiptapContent(content, classNames) {
79
97
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
98
  "ol",
81
99
  {
82
- className: classNames.orderedList || "list-decimal pl-6 my-4",
83
- children: renderChildren(node.content, classNames)
100
+ className: (0, import_merge.cn)("list-decimal pl-6 my-4", classNames.orderedList),
101
+ children: renderTiptapContent(node, classNames)
84
102
  },
85
103
  index
86
104
  );
87
105
  case "listItem":
88
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: classNames.listItem || "my-1", children: renderChildren(node.content, classNames) }, index);
106
+ if (node.content && node.content.length === 1 && node.content[0].type === "paragraph") {
107
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: (0, import_merge.cn)("my-1", classNames.listItem), children: renderChildren(node.content[0].content, classNames) }, index);
108
+ }
109
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: (0, import_merge.cn)("my-1", classNames.listItem), children: renderChildren(node.content, classNames) }, index);
89
110
  default:
90
111
  return null;
91
112
  }
@@ -98,7 +119,10 @@ const Content = ({
98
119
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
99
120
  };
100
121
  function renderChildren(nodes, classNames) {
101
- if (!nodes) return [];
122
+ if (!nodes) {
123
+ console.log("no nodes");
124
+ return [];
125
+ }
102
126
  return nodes.map((child, idx) => {
103
127
  if (child.type === "text") {
104
128
  let text = child.text;
@@ -119,8 +143,13 @@ function renderChildren(nodes, classNames) {
119
143
  });
120
144
  }
121
145
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }, idx);
146
+ } else {
147
+ console.log("child", child);
148
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.default.Fragment, { children: renderTiptapContent(
149
+ { ...child, content: child.content },
150
+ classNames
151
+ ) }, idx);
122
152
  }
123
- return null;
124
153
  }).filter(Boolean);
125
154
  }
126
155
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blog-post/_components/content.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/core\";\nimport { BlogComponentClassNames } from \"../_types/class-names\";\nimport { cn } from \"../../../utils/merge\";\nimport Link from \"next/link\";\nimport { JSX } from \"react\";\n\nfunction renderTiptapContent(\n content: JSONContent,\n classNames: BlogComponentClassNames\n): React.ReactNode[] {\n if (!content?.content) return [];\n\n return content.content\n .map((node, index) => {\n switch (node.type) {\n case \"paragraph\":\n return (\n <p key={index} className={classNames.paragraph || \"mb-4\"}>\n {renderChildren(node.content, classNames)}\n </p>\n );\n case \"heading\": {\n const text = node.content?.[0]?.text ?? \"\";\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n const Tag = `h${\n node.attrs?.level || 1\n }` as keyof JSX.IntrinsicElements;\n return (\n <Tag\n key={index}\n id={slug}\n className={\n classNames.heading || \"mt-8 mb-4 font-bold text-gray-800\"\n }\n >\n {renderChildren(node.content, classNames)}\n </Tag>\n );\n }\n case \"image\":\n return (\n <div\n key={index}\n className={cn(\n \"relative w-full max-w-[800px] my-6\",\n classNames.image\n )}\n style={{ aspectRatio: \"2 / 1\" }}\n >\n {/* <Image\n src={replaceImageHostname(\n node.attrs?.src || \"\",\n opinlyConfig.imagesPrefix\n )}\n alt={node.attrs?.alt || \"\"}\n fill\n className=\"object-contain rounded-lg\"\n sizes=\"(max-width: 800px) 100vw, 800px\"\n /> */}\n </div>\n );\n case \"bulletList\":\n return (\n <ul\n key={index}\n className={classNames.bulletList || \"list-disc pl-6 my-4\"}\n >\n {renderChildren(node.content, classNames)}\n </ul>\n );\n case \"orderedList\":\n return (\n <ol\n key={index}\n className={classNames.orderedList || \"list-decimal pl-6 my-4\"}\n >\n {renderChildren(node.content, classNames)}\n </ol>\n );\n case \"listItem\":\n return (\n <li key={index} className={classNames.listItem || \"my-1\"}>\n {renderChildren(node.content, classNames)}\n </li>\n );\n default:\n return null;\n }\n })\n .filter(Boolean);\n}\n\nexport const Content = ({\n content,\n classNames,\n}: {\n content: JSONContent;\n classNames: BlogComponentClassNames;\n}) => {\n return (\n <div className=\"prose min-w-full\">\n {renderTiptapContent(content, classNames)}\n </div>\n );\n};\n\nfunction renderChildren(\n nodes: JSONContent[\"content\"] | undefined,\n classNames: BlogComponentClassNames\n): JSX.Element[] {\n if (!nodes) return [];\n\n return nodes\n .map((child, idx) => {\n if (child.type === \"text\") {\n let text: React.ReactNode = child.text;\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = <strong key={idx}>{text}</strong>;\n if (mark.type === \"italic\") text = <em key={idx}>{text}</em>;\n if (mark.type === \"link\")\n text = (\n <Link\n key={idx}\n href={mark.attrs?.href}\n className={classNames.link || \"text-blue-600 underline\"}\n >\n {text}\n </Link>\n );\n });\n }\n return <span key={idx}>{text}</span>;\n }\n return null;\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBY;AAfZ,mBAAmB;AACnB,kBAAiB;AAGjB,SAAS,oBACP,SACA,YACmB;AACnB,MAAI,CAAC,SAAS,QAAS,QAAO,CAAC;AAE/B,SAAO,QAAQ,QACZ,IAAI,CAAC,MAAM,UAAU;AACpB,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,eACE,4CAAC,OAAc,WAAW,WAAW,aAAa,QAC/C,yBAAe,KAAK,SAAS,UAAU,KADlC,KAER;AAAA,MAEJ,KAAK,WAAW;AACd,cAAM,OAAO,KAAK,UAA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MAAM;AAClC,UAAI,MAAM,OAAO;AACf,cAAM,MAAM,QAAQ,CAAC,SAAS;AAC5B,cAAI,KAAK,SAAS,OAAQ,QAAO,4CAAC,YAAkB,kBAAN,GAAW;AACzD,cAAI,KAAK,SAAS,SAAU,QAAO,4CAAC,QAAc,kBAAN,GAAW;AACvD,cAAI,KAAK,SAAS;AAChB,mBACE;AAAA,cAAC,YAAAA;AAAA,cAAA;AAAA,gBAEC,MAAM,KAAK,OAAO;AAAA,gBAClB,WAAW,WAAW,QAAQ;AAAA,gBAE7B;AAAA;AAAA,cAJI;AAAA,YAKP;AAAA,QAEN,CAAC;AAAA,MACH;AACA,aAAO,4CAAC,UAAgB,kBAAN,GAAW;AAAA,IAC/B;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,OAAO;AACnB;","names":["Link"]}
1
+ {"version":3,"sources":["../../../../src/components/blog-post/_components/content.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/core\";\nimport { BlogComponentClassNames } from \"../_types/class-names\";\nimport { cn } from \"../../../utils/merge\";\nimport Link from \"next/link\";\nimport { JSX } from \"react\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport React from \"react\";\n\nfunction renderTiptapContent(\n content: JSONContent,\n classNames: BlogComponentClassNames\n): React.ReactNode[] {\n if (!content?.content) return [];\n\n return content.content\n .map((node, index) => {\n switch (node.type) {\n case \"paragraph\":\n return (\n <p key={index} className={classNames.paragraph || \"mb-4\"}>\n {renderChildren(node.content, classNames)}\n </p>\n );\n case \"heading\": {\n const text = node.content?.[0]?.text ?? \"\";\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n const Tag = `h${\n node.attrs?.level || 1\n }` as keyof JSX.IntrinsicElements;\n return (\n <Tag\n key={index}\n id={slug}\n className={\n classNames.heading || \"mt-8 mb-4 font-bold text-gray-800\"\n }\n >\n {renderChildren(node.content, classNames)}\n </Tag>\n );\n }\n case \"image\":\n const fileKey = node.attrs?.fileKey;\n\n if (!fileKey) {\n return null;\n }\n\n return (\n <div\n key={index}\n className={cn(\n \"relative w-full max-w-[800px] my-6\",\n classNames.image\n )}\n style={{ aspectRatio: \"2 / 1\" }}\n >\n <Image\n src={`${opinlyConfig.imagesPrefix}/${fileKey}`}\n title={node.attrs?.title || \"\"}\n alt={node.attrs?.alt || \"\"}\n fill\n className=\"object-contain rounded-lg\"\n sizes=\"(max-width: 800px) 100vw, 800px\"\n />\n </div>\n );\n case \"bulletList\":\n return (\n <ul\n key={index}\n className={cn(\"list-disc pl-6 my-4\", classNames.bulletList)}\n >\n {renderTiptapContent(node, classNames)}\n </ul>\n );\n case \"orderedList\":\n return (\n <ol\n key={index}\n className={cn(\"list-decimal pl-6 my-4\", classNames.orderedList)}\n >\n {renderTiptapContent(node, classNames)}\n </ol>\n );\n case \"listItem\":\n if (\n node.content &&\n node.content.length === 1 &&\n node.content[0].type === \"paragraph\"\n ) {\n return (\n <li key={index} className={cn(\"my-1\", classNames.listItem)}>\n {renderChildren(node.content[0].content, classNames)}\n </li>\n );\n }\n return (\n <li key={index} className={cn(\"my-1\", classNames.listItem)}>\n {renderChildren(node.content, classNames)}\n </li>\n );\n default:\n return null;\n }\n })\n .filter(Boolean);\n}\n\nexport const Content = ({\n content,\n classNames,\n}: {\n content: JSONContent;\n classNames: BlogComponentClassNames;\n}) => {\n return (\n <div className=\"prose min-w-full\">\n {renderTiptapContent(content, classNames)}\n </div>\n );\n};\n\nfunction renderChildren(\n nodes: JSONContent[\"content\"] | undefined,\n classNames: BlogComponentClassNames\n): JSX.Element[] {\n if (!nodes) {\n console.log(\"no nodes\");\n return [];\n }\n\n return nodes\n .map((child, idx) => {\n if (child.type === \"text\") {\n let text: React.ReactNode = child.text;\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = <strong key={idx}>{text}</strong>;\n if (mark.type === \"italic\") text = <em key={idx}>{text}</em>;\n if (mark.type === \"link\")\n text = (\n <Link\n key={idx}\n href={mark.attrs?.href}\n className={classNames.link || \"text-blue-600 underline\"}\n >\n {text}\n </Link>\n );\n });\n }\n return <span key={idx}>{text}</span>;\n } else {\n console.log(\"child\", child);\n\n // Recursively render non-text nodes (e.g., paragraph, listItem, etc.)\n return (\n <React.Fragment key={idx}>\n {renderTiptapContent(\n { ...child, content: child.content },\n classNames\n )}\n </React.Fragment>\n );\n }\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBY;AAlBZ,mBAAmB;AACnB,kBAAiB;AAEjB,mBAAkB;AAClB,wBAA6B;AAC7B,IAAAA,gBAAkB;AAElB,SAAS,oBACP,SACA,YACmB;AACnB,MAAI,CAAC,SAAS,QAAS,QAAO,CAAC;AAE/B,SAAO,QAAQ,QACZ,IAAI,CAAC,MAAM,UAAU;AACpB,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,eACE,4CAAC,OAAc,WAAW,WAAW,aAAa,QAC/C,yBAAe,KAAK,SAAS,UAAU,KADlC,KAER;AAAA,MAEJ,KAAK,WAAW;AACd,cAAM,OAAO,KAAK,UAAU,CAAC,GAAG,QAAQ;AACxC,cAAM,OAAO,KACV,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AACzB,cAAM,MAAM,IACV,KAAK,OAAO,SAAS,CACvB;AACA,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,IAAI;AAAA,YACJ,WACE,WAAW,WAAW;AAAA,YAGvB,yBAAe,KAAK,SAAS,UAAU;AAAA;AAAA,UANnC;AAAA,QAOP;AAAA,MAEJ;AAAA,MACA,KAAK;AACH,cAAM,UAAU,KAAK,OAAO;AAE5B,YAAI,CAAC,SAAS;AACZ,iBAAO;AAAA,QACT;AAEA,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,eAAW;AAAA,cACT;AAAA,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AO;AACV,YAAQ,IAAI,UAAU;AACtB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MACJ,IAAI,CAAC,OAAO,QAAQ;AACnB,QAAI,MAAM,SAAS,QAAQ;AACzB,UAAI,OAAwB,MAAM;AAClC,UAAI,MAAM,OAAO;AACf,cAAM,MAAM,QAAQ,CAAC,SAAS;AAC5B,cAAI,KAAK,SAAS,OAAQ,QAAO,4CAAC,YAAkB,kBAAN,GAAW;AACzD,cAAI,KAAK,SAAS,SAAU,QAAO,4CAAC,QAAc,kBAAN,GAAW;AACvD,cAAI,KAAK,SAAS;AAChB,mBACE;AAAA,cAAC,YAAAC;AAAA,cAAA;AAAA,gBAEC,MAAM,KAAK,OAAO;AAAA,gBAClB,WAAW,WAAW,QAAQ;AAAA,gBAE7B;AAAA;AAAA,cAJI;AAAA,YAKP;AAAA,QAEN,CAAC;AAAA,MACH;AACA,aAAO,4CAAC,UAAgB,kBAAN,GAAW;AAAA,IAC/B,OAAO;AACL,cAAQ,IAAI,SAAS,KAAK;AAG1B,aACE,4CAAC,cAAAC,QAAM,UAAN,EACE;AAAA,QACC,EAAE,GAAG,OAAO,SAAS,MAAM,QAAQ;AAAA,QACnC;AAAA,MACF,KAJmB,GAKrB;AAAA,IAEJ;AAAA,EACF,CAAC,EACA,OAAO,OAAO;AACnB;","names":["import_react","Image","Link","React"]}
@@ -1,6 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../../utils/merge";
3
3
  import Link from "next/link";
4
+ import Image from "next/image";
5
+ import { opinlyConfig } from "../../../utils/sdk-config";
6
+ import React from "react";
4
7
  function renderTiptapContent(content, classNames) {
5
8
  if (!content?.content) return [];
6
9
  return content.content.map((node, index) => {
@@ -22,6 +25,10 @@ function renderTiptapContent(content, classNames) {
22
25
  );
23
26
  }
24
27
  case "image":
28
+ const fileKey = node.attrs?.fileKey;
29
+ if (!fileKey) {
30
+ return null;
31
+ }
25
32
  return /* @__PURE__ */ jsx(
26
33
  "div",
27
34
  {
@@ -29,7 +36,18 @@ function renderTiptapContent(content, classNames) {
29
36
  "relative w-full max-w-[800px] my-6",
30
37
  classNames.image
31
38
  ),
32
- style: { aspectRatio: "2 / 1" }
39
+ style: { aspectRatio: "2 / 1" },
40
+ children: /* @__PURE__ */ jsx(
41
+ Image,
42
+ {
43
+ src: `${opinlyConfig.imagesPrefix}/${fileKey}`,
44
+ title: node.attrs?.title || "",
45
+ alt: node.attrs?.alt || "",
46
+ fill: true,
47
+ className: "object-contain rounded-lg",
48
+ sizes: "(max-width: 800px) 100vw, 800px"
49
+ }
50
+ )
33
51
  },
34
52
  index
35
53
  );
@@ -37,8 +55,8 @@ function renderTiptapContent(content, classNames) {
37
55
  return /* @__PURE__ */ jsx(
38
56
  "ul",
39
57
  {
40
- className: classNames.bulletList || "list-disc pl-6 my-4",
41
- children: renderChildren(node.content, classNames)
58
+ className: cn("list-disc pl-6 my-4", classNames.bulletList),
59
+ children: renderTiptapContent(node, classNames)
42
60
  },
43
61
  index
44
62
  );
@@ -46,13 +64,16 @@ function renderTiptapContent(content, classNames) {
46
64
  return /* @__PURE__ */ jsx(
47
65
  "ol",
48
66
  {
49
- className: classNames.orderedList || "list-decimal pl-6 my-4",
50
- children: renderChildren(node.content, classNames)
67
+ className: cn("list-decimal pl-6 my-4", classNames.orderedList),
68
+ children: renderTiptapContent(node, classNames)
51
69
  },
52
70
  index
53
71
  );
54
72
  case "listItem":
55
- return /* @__PURE__ */ jsx("li", { className: classNames.listItem || "my-1", children: renderChildren(node.content, classNames) }, index);
73
+ if (node.content && node.content.length === 1 && node.content[0].type === "paragraph") {
74
+ return /* @__PURE__ */ jsx("li", { className: cn("my-1", classNames.listItem), children: renderChildren(node.content[0].content, classNames) }, index);
75
+ }
76
+ return /* @__PURE__ */ jsx("li", { className: cn("my-1", classNames.listItem), children: renderChildren(node.content, classNames) }, index);
56
77
  default:
57
78
  return null;
58
79
  }
@@ -65,7 +86,10 @@ const Content = ({
65
86
  return /* @__PURE__ */ jsx("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
66
87
  };
67
88
  function renderChildren(nodes, classNames) {
68
- if (!nodes) return [];
89
+ if (!nodes) {
90
+ console.log("no nodes");
91
+ return [];
92
+ }
69
93
  return nodes.map((child, idx) => {
70
94
  if (child.type === "text") {
71
95
  let text = child.text;
@@ -86,8 +110,13 @@ function renderChildren(nodes, classNames) {
86
110
  });
87
111
  }
88
112
  return /* @__PURE__ */ jsx("span", { children: text }, idx);
113
+ } else {
114
+ console.log("child", child);
115
+ return /* @__PURE__ */ jsx(React.Fragment, { children: renderTiptapContent(
116
+ { ...child, content: child.content },
117
+ classNames
118
+ ) }, idx);
89
119
  }
90
- return null;
91
120
  }).filter(Boolean);
92
121
  }
93
122
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blog-post/_components/content.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/core\";\nimport { BlogComponentClassNames } from \"../_types/class-names\";\nimport { cn } from \"../../../utils/merge\";\nimport Link from \"next/link\";\nimport { JSX } from \"react\";\n\nfunction renderTiptapContent(\n content: JSONContent,\n classNames: BlogComponentClassNames\n): React.ReactNode[] {\n if (!content?.content) return [];\n\n return content.content\n .map((node, index) => {\n switch (node.type) {\n case \"paragraph\":\n return (\n <p key={index} className={classNames.paragraph || \"mb-4\"}>\n {renderChildren(node.content, classNames)}\n </p>\n );\n case \"heading\": {\n const text = node.content?.[0]?.text ?? \"\";\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n const Tag = `h${\n node.attrs?.level || 1\n }` as keyof JSX.IntrinsicElements;\n return (\n <Tag\n key={index}\n id={slug}\n className={\n classNames.heading || \"mt-8 mb-4 font-bold text-gray-800\"\n }\n >\n {renderChildren(node.content, classNames)}\n </Tag>\n );\n }\n case \"image\":\n return (\n <div\n key={index}\n className={cn(\n \"relative w-full max-w-[800px] my-6\",\n classNames.image\n )}\n style={{ aspectRatio: \"2 / 1\" }}\n >\n {/* <Image\n src={replaceImageHostname(\n node.attrs?.src || \"\",\n opinlyConfig.imagesPrefix\n )}\n alt={node.attrs?.alt || \"\"}\n fill\n className=\"object-contain rounded-lg\"\n sizes=\"(max-width: 800px) 100vw, 800px\"\n /> */}\n </div>\n );\n case \"bulletList\":\n return (\n <ul\n key={index}\n className={classNames.bulletList || \"list-disc pl-6 my-4\"}\n >\n {renderChildren(node.content, classNames)}\n </ul>\n );\n case \"orderedList\":\n return (\n <ol\n key={index}\n className={classNames.orderedList || \"list-decimal pl-6 my-4\"}\n >\n {renderChildren(node.content, classNames)}\n </ol>\n );\n case \"listItem\":\n return (\n <li key={index} className={classNames.listItem || \"my-1\"}>\n {renderChildren(node.content, classNames)}\n </li>\n );\n default:\n return null;\n }\n })\n .filter(Boolean);\n}\n\nexport const Content = ({\n content,\n classNames,\n}: {\n content: JSONContent;\n classNames: BlogComponentClassNames;\n}) => {\n return (\n <div className=\"prose min-w-full\">\n {renderTiptapContent(content, classNames)}\n </div>\n );\n};\n\nfunction renderChildren(\n nodes: JSONContent[\"content\"] | undefined,\n classNames: BlogComponentClassNames\n): JSX.Element[] {\n if (!nodes) return [];\n\n return nodes\n .map((child, idx) => {\n if (child.type === \"text\") {\n let text: React.ReactNode = child.text;\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = <strong key={idx}>{text}</strong>;\n if (mark.type === \"italic\") text = <em key={idx}>{text}</em>;\n if (mark.type === \"link\")\n text = (\n <Link\n key={idx}\n href={mark.attrs?.href}\n className={classNames.link || \"text-blue-600 underline\"}\n >\n {text}\n </Link>\n );\n });\n }\n return <span key={idx}>{text}</span>;\n }\n return null;\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":"AAiBY;AAfZ,SAAS,UAAU;AACnB,OAAO,UAAU;AAGjB,SAAS,oBACP,SACA,YACmB;AACnB,MAAI,CAAC,SAAS,QAAS,QAAO,CAAC;AAE/B,SAA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,oBAAC,SAAI,WAAU,oBACZ,8BAAoB,SAAS,UAAU,GAC1C;AAEJ;AAEA,SAAS,eACP,OACA,YACe;AACf,MAAI,CAAC,MAAO,QAAO,CAAC;AAEpB,SAAO,MACJ,IAAI,CAAC,OAAO,QAAQ;AACnB,QAAI,MAAM,SAAS,QAAQ;AACzB,UAAI,OAAwB,MAAM;AAClC,UAAI,MAAM,OAAO;AACf,cAAM,MAAM,QAAQ,CAAC,SAAS;AAC5B,cAAI,KAAK,SAAS,OAAQ,QAAO,oBAAC,YAAkB,kBAAN,GAAW;AACzD,cAAI,KAAK,SAAS,SAAU,QAAO,oBAAC,QAAc,kBAAN,GAAW;AACvD,cAAI,KAAK,SAAS;AAChB,mBACE;AAAA,cAAC;AAAA;AAAA,gBAEC,MAAM,KAAK,OAAO;AAAA,gBAClB,WAAW,WAAW,QAAQ;AAAA,gBAE7B;AAAA;AAAA,cAJI;AAAA,YAKP;AAAA,QAEN,CAAC;AAAA,MACH;AACA,aAAO,oBAAC,UAAgB,kBAAN,GAAW;AAAA,IAC/B;AACA,WAAO;AAAA,EACT,CAAC,EACA,OAAO,OAAO;AACnB;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/blog-post/_components/content.tsx"],"sourcesContent":["import type { JSONContent } from \"@tiptap/core\";\nimport { BlogComponentClassNames } from \"../_types/class-names\";\nimport { cn } from \"../../../utils/merge\";\nimport Link from \"next/link\";\nimport { JSX } from \"react\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport React from \"react\";\n\nfunction renderTiptapContent(\n content: JSONContent,\n classNames: BlogComponentClassNames\n): React.ReactNode[] {\n if (!content?.content) return [];\n\n return content.content\n .map((node, index) => {\n switch (node.type) {\n case \"paragraph\":\n return (\n <p key={index} className={classNames.paragraph || \"mb-4\"}>\n {renderChildren(node.content, classNames)}\n </p>\n );\n case \"heading\": {\n const text = node.content?.[0]?.text ?? \"\";\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n const Tag = `h${\n node.attrs?.level || 1\n }` as keyof JSX.IntrinsicElements;\n return (\n <Tag\n key={index}\n id={slug}\n className={\n classNames.heading || \"mt-8 mb-4 font-bold text-gray-800\"\n }\n >\n {renderChildren(node.content, classNames)}\n </Tag>\n );\n }\n case \"image\":\n const fileKey = node.attrs?.fileKey;\n\n if (!fileKey) {\n return null;\n }\n\n return (\n <div\n key={index}\n className={cn(\n \"relative w-full max-w-[800px] my-6\",\n classNames.image\n )}\n style={{ aspectRatio: \"2 / 1\" }}\n >\n <Image\n src={`${opinlyConfig.imagesPrefix}/${fileKey}`}\n title={node.attrs?.title || \"\"}\n alt={node.attrs?.alt || \"\"}\n fill\n className=\"object-contain rounded-lg\"\n sizes=\"(max-width: 800px) 100vw, 800px\"\n />\n </div>\n );\n case \"bulletList\":\n return (\n <ul\n key={index}\n className={cn(\"list-disc pl-6 my-4\", classNames.bulletList)}\n >\n {renderTiptapContent(node, classNames)}\n </ul>\n );\n case \"orderedList\":\n return (\n <ol\n key={index}\n className={cn(\"list-decimal pl-6 my-4\", classNames.orderedList)}\n >\n {renderTiptapContent(node, classNames)}\n </ol>\n );\n case \"listItem\":\n if (\n node.content &&\n node.content.length === 1 &&\n node.content[0].type === \"paragraph\"\n ) {\n return (\n <li key={index} className={cn(\"my-1\", classNames.listItem)}>\n {renderChildren(node.content[0].content, classNames)}\n </li>\n );\n }\n return (\n <li key={index} className={cn(\"my-1\", classNames.listItem)}>\n {renderChildren(node.content, classNames)}\n </li>\n );\n default:\n return null;\n }\n })\n .filter(Boolean);\n}\n\nexport const Content = ({\n content,\n classNames,\n}: {\n content: JSONContent;\n classNames: BlogComponentClassNames;\n}) => {\n return (\n <div className=\"prose min-w-full\">\n {renderTiptapContent(content, classNames)}\n </div>\n );\n};\n\nfunction renderChildren(\n nodes: JSONContent[\"content\"] | undefined,\n classNames: BlogComponentClassNames\n): JSX.Element[] {\n if (!nodes) {\n console.log(\"no nodes\");\n return [];\n }\n\n return nodes\n .map((child, idx) => {\n if (child.type === \"text\") {\n let text: React.ReactNode = child.text;\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = <strong key={idx}>{text}</strong>;\n if (mark.type === \"italic\") text = <em key={idx}>{text}</em>;\n if (mark.type === \"link\")\n text = (\n <Link\n key={idx}\n href={mark.attrs?.href}\n className={classNames.link || \"text-blue-600 underline\"}\n >\n {text}\n </Link>\n );\n });\n }\n return <span key={idx}>{text}</span>;\n } else {\n console.log(\"child\", child);\n\n // Recursively render non-text nodes (e.g., paragraph, listItem, etc.)\n return (\n <React.Fragment key={idx}>\n {renderTiptapContent(\n { ...child, content: child.content },\n classNames\n )}\n </React.Fragment>\n );\n }\n })\n .filter(Boolean) as JSX.Element[];\n}\n"],"mappings":"AAoBY;AAlBZ,SAAS,UAAU;AACnB,OAAO,UAAU;AAEjB,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,OAAO,WAAW;AAElB,SAAS,oBACP,SACA,YACmB;AACnB,MAAI,CAAC,SAAS,QAAS,QAAO,CAAC;AAE/B,SAAO,QAAQ,QACZ,IAAI,CAAC,MAAM,UAAU;AACpB,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,eACE,oBAAC,OAAc,WAAW,WAAW,aAAa,QAC/C,yBAAe,KAAK,SAAS,UAAU,KADlC,KAER;AAAA,MAEJ,KAAK,WAAW;AACd,cAAM,OAAO,KAAK,UAAU,CAAC,GAAG,QAAQ;AACxC,cAAM,OAAO,KACV,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AACzB,cAAM,MAAM,IACV,KAAK,OAAO,SAAS,CACvB;AACA,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,IAAI;AAAA,YACJ,WACE,WAAW,WAAW;AAAA,YAGvB,yBAAe,KAAK,SAAS,UAAU;AAAA;AAAA,UANnC;AAAA,QAOP;AAAA,MAEJ;AAAA,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EACA;AACF,MAGM;AACJ,SACE,oBAAC,SAAI,WAAU,oBACZ,8BAAoB,SAAS,UAAU,GAC1C;AAEJ;AAEA,SAAS,eACP,OACA,YACe;AACf,MAAI,CAAC,OAAO;AACV,YAAQ,IAAI,UAAU;AACtB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MACJ,IAAI,CAAC,OAAO,QAAQ;AACnB,QAAI,MAAM,SAAS,QAAQ;AACzB,UAAI,OAAwB,MAAM;AAClC,UAAI,MAAM,OAAO;AACf,cAAM,MAAM,QAAQ,CAAC,SAAS;AAC5B,cAAI,KAAK,SAAS,OAAQ,QAAO,oBAAC,YAAkB,kBAAN,GAAW;AACzD,cAAI,KAAK,SAAS,SAAU,QAAO,oBAAC,QAAc,kBAAN,GAAW;AACvD,cAAI,KAAK,SAAS;AAChB,mBACE;AAAA,cAAC;AAAA;AAAA,gBAEC,MAAM,KAAK,OAAO;AAAA,gBAClB,WAAW,WAAW,QAAQ;AAAA,gBAE7B;AAAA;AAAA,cAJI;AAAA,YAKP;AAAA,QAEN,CAAC;AAAA,MACH;AACA,aAAO,oBAAC,UAAgB,kBAAN,GAAW;AAAA,IAC/B,OAAO;AACL,cAAQ,IAAI,SAAS,KAAK;AAG1B,aACE,oBAAC,MAAM,UAAN,EACE;AAAA,QACC,EAAE,GAAG,OAAO,SAAS,MAAM,QAAQ;AAAA,QACnC;AAAA,MACF,KAJmB,GAKrB;AAAA,IAEJ;AAAA,EACF,CAAC,EACA,OAAO,OAAO;AACnB;","names":[]}
@@ -35,7 +35,6 @@ var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_merge = require("../../../utils/merge");
36
36
  var import_image = __toESM(require("next/image"), 1);
37
37
  var import_sdk_config = require("../../../utils/sdk-config");
38
- var import_images = require("../../../utils/images");
39
38
  var import_extract_headings = require("../_helpers/extract-headings");
40
39
  var import_share = require("./share");
41
40
  var import_link = __toESM(require("next/link"), 1);
@@ -49,7 +48,7 @@ const TableOfContents = ({
49
48
  author.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
49
  import_image.default,
51
50
  {
52
- src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${(0, import_images.replaceImageNameSpace)(author.fileKey)}`,
51
+ src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${author.fileKey}`,
53
52
  alt: author.name,
54
53
  width: 48,
55
54
  height: 48,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blog-post/_components/table-of-contents.tsx"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { cn } from \"../../../utils/merge\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { replaceImageNameSpace } from \"../../../utils/images\";\nimport { extractHeadings } from \"../_helpers/extract-headings\";\nimport { Share } from \"./share\";\nimport Link from \"next/link\";\n\ntype TableOfContentsProps = {\n content: JSONContent;\n author: BlogPostRes[\"author\"] | null;\n post: BlogPostRes;\n};\n\nexport const TableOfContents = ({\n content,\n author,\n post,\n}: TableOfContentsProps) => {\n return (\n <aside className={cn(\"w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start\")}>\n {author && (\n <div className=\"w-full mb-6 border p-4 rounded-md text-sm\">\n <div className=\"flex items-center gap-3 mb-3\">\n {author.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.fileKey)}`}\n alt={author.name}\n width={48}\n height={48}\n className=\"rounded-full\"\n />\n )}\n <div>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-xs uppercase text-muted-foreground font-medium\"\n >\n {author.name}\n </Link>\n <div className=\"text-muted-foreground text-sm\">{author.bio}</div>\n </div>\n </div>\n </div>\n )}\n <Share post={post} />\n <div className=\"border-l-4 border-opinlyAccent pl-4 mb-4\">\n <h2 className=\"text-lg font-semibold mb-2\">TABLE OF CONTENTS</h2>\n <ul className=\"text-sm text-gray-700 space-y-1\">\n {(extractHeadings(content) || []).map((heading) => (\n <li key={heading.slug}>\n <a href={`#${heading.slug}`} className=\"hover:underline\">\n {heading.text}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </aside>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2Bc;AAzBd,mBAAmB;AACnB,mBAAkB;AAClB,wBAA6B;AAC7B,oBAAsC;AACtC,8BAAgC;AAChC,mBAAsB;AACtB,kBAAiB;AAQV,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,MAA4B;AAC1B,SACE,6CAAC,WAAM,eAAW,iBAAG,mDAAmD,GACrE;AAAA,cACC,4CAAC,SAAI,WAAU,6CACb,uDAAC,SAAI,WAAU,gCACZ;AAAA,aAAO,WACN;AAAA,QAAC,aAAAA;AAAA,QAAA;AAAA,UACC,KAAK,GAAG,+BAAa,YAAY,QAAI,qCAAsB,OAAO,OAAO,CAAC;AAAA,UAC1E,KAAK,OAAO;AAAA,UACZ,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,6CAAC,SACC;AAAA;AAAA,UAAC,YAAAC;AAAA,UAAA;AAAA,YACC,MAAM,GAAG,+BAAa,UAAU,YAAY,OAAO,IAAI;AAAA,YACvD,WAAU;AAAA,YAET,iBAAO;AAAA;AAAA,QACV;AAAA,QACA,4CAAC,SAAI,WAAU,iCAAiC,iBAAO,KAAI;AAAA,SAC7D;AAAA,OACF,GACF;AAAA,IAEF,4CAAC,sBAAM,MAAY;AAAA,IACnB,6CAAC,SAAI,WAAU,4CACb;AAAA,kDAAC,QAAG,WAAU,8BAA6B,+BAAiB;AAAA,MAC5D,4CAAC,QAAG,WAAU,mCACV,wDAAgB,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,YACrC,4CAAC,QACC,sDAAC,OAAE,MAAM,IAAI,QAAQ,IAAI,IAAI,WAAU,mBACpC,kBAAQ,MACX,KAHO,QAAQ,IAIjB,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Image","Link"]}
1
+ {"version":3,"sources":["../../../../src/components/blog-post/_components/table-of-contents.tsx"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { cn } from \"../../../utils/merge\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { extractHeadings } from \"../_helpers/extract-headings\";\nimport { Share } from \"./share\";\nimport Link from \"next/link\";\n\ntype TableOfContentsProps = {\n content: JSONContent;\n author: BlogPostRes[\"author\"] | null;\n post: BlogPostRes;\n};\n\nexport const TableOfContents = ({\n content,\n author,\n post,\n}: TableOfContentsProps) => {\n return (\n <aside className={cn(\"w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start\")}>\n {author && (\n <div className=\"w-full mb-6 border p-4 rounded-md text-sm\">\n <div className=\"flex items-center gap-3 mb-3\">\n {author.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.fileKey}`}\n alt={author.name}\n width={48}\n height={48}\n className=\"rounded-full\"\n />\n )}\n <div>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-xs uppercase text-muted-foreground font-medium\"\n >\n {author.name}\n </Link>\n <div className=\"text-muted-foreground text-sm\">{author.bio}</div>\n </div>\n </div>\n </div>\n )}\n <Share post={post} />\n <div className=\"border-l-4 border-opinlyAccent pl-4 mb-4\">\n <h2 className=\"text-lg font-semibold mb-2\">TABLE OF CONTENTS</h2>\n <ul className=\"text-sm text-gray-700 space-y-1\">\n {(extractHeadings(content) || []).map((heading) => (\n <li key={heading.slug}>\n <a href={`#${heading.slug}`} className=\"hover:underline\">\n {heading.text}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </aside>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0Bc;AAxBd,mBAAmB;AACnB,mBAAkB;AAClB,wBAA6B;AAC7B,8BAAgC;AAChC,mBAAsB;AACtB,kBAAiB;AAQV,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,MAA4B;AAC1B,SACE,6CAAC,WAAM,eAAW,iBAAG,mDAAmD,GACrE;AAAA,cACC,4CAAC,SAAI,WAAU,6CACb,uDAAC,SAAI,WAAU,gCACZ;AAAA,aAAO,WACN;AAAA,QAAC,aAAAA;AAAA,QAAA;AAAA,UACC,KAAK,GAAG,+BAAa,YAAY,IAAI,OAAO,OAAO;AAAA,UACnD,KAAK,OAAO;AAAA,UACZ,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,6CAAC,SACC;AAAA;AAAA,UAAC,YAAAC;AAAA,UAAA;AAAA,YACC,MAAM,GAAG,+BAAa,UAAU,YAAY,OAAO,IAAI;AAAA,YACvD,WAAU;AAAA,YAET,iBAAO;AAAA;AAAA,QACV;AAAA,QACA,4CAAC,SAAI,WAAU,iCAAiC,iBAAO,KAAI;AAAA,SAC7D;AAAA,OACF,GACF;AAAA,IAEF,4CAAC,sBAAM,MAAY;AAAA,IACnB,6CAAC,SAAI,WAAU,4CACb;AAAA,kDAAC,QAAG,WAAU,8BAA6B,+BAAiB;AAAA,MAC5D,4CAAC,QAAG,WAAU,mCACV,wDAAgB,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,YACrC,4CAAC,QACC,sDAAC,OAAE,MAAM,IAAI,QAAQ,IAAI,IAAI,WAAU,mBACpC,kBAAQ,MACX,KAHO,QAAQ,IAIjB,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Image","Link"]}
@@ -2,7 +2,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../../../utils/merge";
3
3
  import Image from "next/image";
4
4
  import { opinlyConfig } from "../../../utils/sdk-config";
5
- import { replaceImageNameSpace } from "../../../utils/images";
6
5
  import { extractHeadings } from "../_helpers/extract-headings";
7
6
  import { Share } from "./share";
8
7
  import Link from "next/link";
@@ -16,7 +15,7 @@ const TableOfContents = ({
16
15
  author.fileKey && /* @__PURE__ */ jsx(
17
16
  Image,
18
17
  {
19
- src: `${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.fileKey)}`,
18
+ src: `${opinlyConfig.imagesPrefix}/${author.fileKey}`,
20
19
  alt: author.name,
21
20
  width: 48,
22
21
  height: 48,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blog-post/_components/table-of-contents.tsx"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { cn } from \"../../../utils/merge\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { replaceImageNameSpace } from \"../../../utils/images\";\nimport { extractHeadings } from \"../_helpers/extract-headings\";\nimport { Share } from \"./share\";\nimport Link from \"next/link\";\n\ntype TableOfContentsProps = {\n content: JSONContent;\n author: BlogPostRes[\"author\"] | null;\n post: BlogPostRes;\n};\n\nexport const TableOfContents = ({\n content,\n author,\n post,\n}: TableOfContentsProps) => {\n return (\n <aside className={cn(\"w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start\")}>\n {author && (\n <div className=\"w-full mb-6 border p-4 rounded-md text-sm\">\n <div className=\"flex items-center gap-3 mb-3\">\n {author.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${replaceImageNameSpace(author.fileKey)}`}\n alt={author.name}\n width={48}\n height={48}\n className=\"rounded-full\"\n />\n )}\n <div>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-xs uppercase text-muted-foreground font-medium\"\n >\n {author.name}\n </Link>\n <div className=\"text-muted-foreground text-sm\">{author.bio}</div>\n </div>\n </div>\n </div>\n )}\n <Share post={post} />\n <div className=\"border-l-4 border-opinlyAccent pl-4 mb-4\">\n <h2 className=\"text-lg font-semibold mb-2\">TABLE OF CONTENTS</h2>\n <ul className=\"text-sm text-gray-700 space-y-1\">\n {(extractHeadings(content) || []).map((heading) => (\n <li key={heading.slug}>\n <a href={`#${heading.slug}`} className=\"hover:underline\">\n {heading.text}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </aside>\n );\n};\n"],"mappings":"AA2Bc,cAQF,YARE;AAzBd,SAAS,UAAU;AACnB,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,OAAO,UAAU;AAQV,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,MAA4B;AAC1B,SACE,qBAAC,WAAM,WAAW,GAAG,mDAAmD,GACrE;AAAA,cACC,oBAAC,SAAI,WAAU,6CACb,+BAAC,SAAI,WAAU,gCACZ;AAAA,aAAO,WACN;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,GAAG,aAAa,YAAY,IAAI,sBAAsB,OAAO,OAAO,CAAC;AAAA,UAC1E,KAAK,OAAO;AAAA,UACZ,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,qBAAC,SACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAAA,YACvD,WAAU;AAAA,YAET,iBAAO;AAAA;AAAA,QACV;AAAA,QACA,oBAAC,SAAI,WAAU,iCAAiC,iBAAO,KAAI;AAAA,SAC7D;AAAA,OACF,GACF;AAAA,IAEF,oBAAC,SAAM,MAAY;AAAA,IACnB,qBAAC,SAAI,WAAU,4CACb;AAAA,0BAAC,QAAG,WAAU,8BAA6B,+BAAiB;AAAA,MAC5D,oBAAC,QAAG,WAAU,mCACV,2BAAgB,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,YACrC,oBAAC,QACC,8BAAC,OAAE,MAAM,IAAI,QAAQ,IAAI,IAAI,WAAU,mBACpC,kBAAQ,MACX,KAHO,QAAQ,IAIjB,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/blog-post/_components/table-of-contents.tsx"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { cn } from \"../../../utils/merge\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { extractHeadings } from \"../_helpers/extract-headings\";\nimport { Share } from \"./share\";\nimport Link from \"next/link\";\n\ntype TableOfContentsProps = {\n content: JSONContent;\n author: BlogPostRes[\"author\"] | null;\n post: BlogPostRes;\n};\n\nexport const TableOfContents = ({\n content,\n author,\n post,\n}: TableOfContentsProps) => {\n return (\n <aside className={cn(\"w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start\")}>\n {author && (\n <div className=\"w-full mb-6 border p-4 rounded-md text-sm\">\n <div className=\"flex items-center gap-3 mb-3\">\n {author.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.fileKey}`}\n alt={author.name}\n width={48}\n height={48}\n className=\"rounded-full\"\n />\n )}\n <div>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-xs uppercase text-muted-foreground font-medium\"\n >\n {author.name}\n </Link>\n <div className=\"text-muted-foreground text-sm\">{author.bio}</div>\n </div>\n </div>\n </div>\n )}\n <Share post={post} />\n <div className=\"border-l-4 border-opinlyAccent pl-4 mb-4\">\n <h2 className=\"text-lg font-semibold mb-2\">TABLE OF CONTENTS</h2>\n <ul className=\"text-sm text-gray-700 space-y-1\">\n {(extractHeadings(content) || []).map((heading) => (\n <li key={heading.slug}>\n <a href={`#${heading.slug}`} className=\"hover:underline\">\n {heading.text}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </aside>\n );\n};\n"],"mappings":"AA0Bc,cAQF,YARE;AAxBd,SAAS,UAAU;AACnB,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,OAAO,UAAU;AAQV,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,MAA4B;AAC1B,SACE,qBAAC,WAAM,WAAW,GAAG,mDAAmD,GACrE;AAAA,cACC,oBAAC,SAAI,WAAU,6CACb,+BAAC,SAAI,WAAU,gCACZ;AAAA,aAAO,WACN;AAAA,QAAC;AAAA;AAAA,UACC,KAAK,GAAG,aAAa,YAAY,IAAI,OAAO,OAAO;AAAA,UACnD,KAAK,OAAO;AAAA,UACZ,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,qBAAC,SACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAAA,YACvD,WAAU;AAAA,YAET,iBAAO;AAAA;AAAA,QACV;AAAA,QACA,oBAAC,SAAI,WAAU,iCAAiC,iBAAO,KAAI;AAAA,SAC7D;AAAA,OACF,GACF;AAAA,IAEF,oBAAC,SAAM,MAAY;AAAA,IACnB,qBAAC,SAAI,WAAU,4CACb;AAAA,0BAAC,QAAG,WAAU,8BAA6B,+BAAiB;AAAA,MAC5D,oBAAC,QAAG,WAAU,mCACV,2BAAgB,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,YACrC,oBAAC,QACC,8BAAC,OAAE,MAAM,IAAI,QAAQ,IAAI,IAAI,WAAU,mBACpC,kBAAQ,MACX,KAHO,QAAQ,IAIjB,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -25,7 +25,6 @@ __export(json_ld_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(json_ld_exports);
27
27
  var import_sdk_config = require("../../../utils/sdk-config");
28
- var import_images = require("../../../utils/images");
29
28
  function generateArticleBodyHtml(content) {
30
29
  if (!content?.content) return "";
31
30
  let htmlString = "";
@@ -106,7 +105,7 @@ const genBlogPostingJSONLD = (post) => {
106
105
  dateModified: post.modifiedAt || void 0,
107
106
  image: post.titleFile?.fileKey ? {
108
107
  "@type": "ImageObject",
109
- url: `${import_sdk_config.opinlyConfig.imagesUrl}/${(0, import_images.replaceImageNameSpace)(post.titleFile.fileKey)}`
108
+ url: `${import_sdk_config.opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`
110
109
  } : void 0,
111
110
  author: post.author ? {
112
111
  "@type": "Person",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blog-post/_helpers/json-ld.ts"],"sourcesContent":["import {\n BlogPosting,\n BreadcrumbList,\n FAQPage,\n WithContext,\n ListItem,\n} from \"schema-dts\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { JSONContent } from \"@tiptap/core\";\nimport { replaceImageNameSpace } from \"../../../utils/images\";\n\n// Add this function somewhere in your BlogPost component file\nexport function generateArticleBodyHtml(content: JSONContent): string {\n if (!content?.content) return \"\";\n\n let htmlString = \"\";\n\n content.content.forEach((node) => {\n switch (node.type) {\n case \"paragraph\":\n htmlString += `<p>${generateChildrenHtml(node.content)}</p>`;\n break;\n case \"heading\":\n const headingLevel = node.attrs?.level || 1;\n htmlString += `<h${headingLevel}>${generateChildrenHtml(node.content)}</h${headingLevel}>`;\n break;\n case \"bulletList\":\n htmlString += `<ul>${generateChildrenHtml(node.content)}</ul>`;\n break;\n case \"orderedList\":\n htmlString += `<ol>${generateChildrenHtml(node.content)}</ol>`;\n break;\n case \"listItem\":\n htmlString += `<li>${generateChildrenHtml(node.content)}</li>`;\n break;\n // Add other node types if they contain text content relevant for articleBody\n // For images, you might just skip them or include an <img> tag if semantic\n // For example:\n // case \"image\":\n // if (node.attrs?.src) {\n // htmlString += `<img src=\"${replaceImageHostname(node.attrs.src, opinlyConfig.imagesPrefix)}\" alt=\"${node.attrs?.alt || ''}\" />`;\n // }\n // break;\n default:\n // Handle other block types or just ignore them for articleBody\n break;\n }\n });\n\n return htmlString;\n}\n\nfunction generateChildrenHtml(\n nodes: JSONContent[\"content\"] | undefined\n): string {\n if (!nodes) return \"\";\n\n let childrenHtml = \"\";\n nodes.forEach((child) => {\n if (child.type === \"text\") {\n let text = child.text || \"\";\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = `<strong>${text}</strong>`;\n if (mark.type === \"italic\") text = `<em>${text}</em>`;\n if (mark.type === \"link\" && mark.attrs?.href) {\n text = `<a href=\"${mark.attrs.href}\">${text}</a>`;\n }\n });\n }\n childrenHtml += text;\n }\n // If you have nested content within child nodes, you might need a recursive call here\n // For example, if a list item can contain paragraphs\n // if (child.content) {\n // childrenHtml += generateChildrenHtml(child.content);\n // }\n });\n return childrenHtml;\n}\n\nexport const genFaqJSONLD = (\n faqs: NonNullable<BlogPostRes[\"faqs\"]>\n): WithContext<FAQPage> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"FAQPage\",\n mainEntity: faqs.map((faq) => ({\n \"@type\": \"Question\",\n name: faq.question,\n acceptedAnswer: {\n \"@type\": \"Answer\",\n text: faq.answer,\n },\n })),\n };\n};\n\nexport const genBlogPostingJSONLD = (\n post: BlogPostRes\n): WithContext<BlogPosting> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BlogPosting\",\n headline: post.title,\n description: post.description || undefined,\n url: `${opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + \"/\"}${post.slug}` : post.slug}`,\n datePublished: post.firstPublishedAt || undefined,\n dateModified: post.modifiedAt || undefined,\n image: post.titleFile?.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${replaceImageNameSpace(post.titleFile.fileKey)}`,\n }\n : undefined,\n author: post.author\n ? {\n \"@type\": \"Person\",\n name: post.author.name,\n url: `${opinlyConfig.blogUrl}/author/${post.author.slug}`,\n description: post.author.bio || undefined,\n }\n : undefined,\n isAccessibleForFree: true,\n articleBody: generateArticleBodyHtml(post.content as JSONContent),\n };\n};\n\nexport const genBreadcrumbJSONLD = (\n post: BlogPostRes\n): WithContext<BreadcrumbList> => {\n const itemListElement = [\n {\n \"@type\": \"ListItem\",\n position: 1,\n name: \"Company Name\",\n item: opinlyConfig.siteUrl,\n },\n {\n \"@type\": \"ListItem\",\n position: 2,\n name: post.folder?.name || \"Blog\",\n item: `${opinlyConfig.blogUrl}/blog`,\n },\n ];\n\n if (post.folder) {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.folder.name,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}`,\n });\n\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 4,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`,\n });\n } else {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.slug}`,\n });\n }\n\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BreadcrumbList\",\n itemListElement: itemListElement as ListItem[],\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,wBAA6B;AAE7B,oBAAsC;AAG/B,SAAS,wBAAwB,SAA8B;AACpE,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,MAAI,aAAa;AAEjB,UAAQ,QAAQ,QAAQ,CAAC,SAAS;AAChC,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,sBAAc,MAAM,qBAAqB,KAAK,OAAO,CAAC;AACtD;AAAA,MACF,KAAK;AACH,cAAM,eAAe,KAAK,OAAO,SAAS;AAC1C,sBAAc,KAAK,YAAY,IAAI,qBAAqB,KAAK,OAAO,CAAC,MAAM,YAAY;AACvF;AAAA,MACF,KAAK;AACH,sBAAc,OAAO,qBAAqB,KAAK,OA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B,KAAK;AAAA,MACnB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM,KAAK;AAAA,MACX,MAAM,GAAG,+BAAa,OAAO,SAAS,KAAK,IAAI;AAAA,IACjD,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,SAAS;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/blog-post/_helpers/json-ld.ts"],"sourcesContent":["import {\n BlogPosting,\n BreadcrumbList,\n FAQPage,\n WithContext,\n ListItem,\n} from \"schema-dts\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { JSONContent } from \"@tiptap/core\";\n\n// Add this function somewhere in your BlogPost component file\nexport function generateArticleBodyHtml(content: JSONContent): string {\n if (!content?.content) return \"\";\n\n let htmlString = \"\";\n\n content.content.forEach((node) => {\n switch (node.type) {\n case \"paragraph\":\n htmlString += `<p>${generateChildrenHtml(node.content)}</p>`;\n break;\n case \"heading\":\n const headingLevel = node.attrs?.level || 1;\n htmlString += `<h${headingLevel}>${generateChildrenHtml(node.content)}</h${headingLevel}>`;\n break;\n case \"bulletList\":\n htmlString += `<ul>${generateChildrenHtml(node.content)}</ul>`;\n break;\n case \"orderedList\":\n htmlString += `<ol>${generateChildrenHtml(node.content)}</ol>`;\n break;\n case \"listItem\":\n htmlString += `<li>${generateChildrenHtml(node.content)}</li>`;\n break;\n // Add other node types if they contain text content relevant for articleBody\n // For images, you might just skip them or include an <img> tag if semantic\n // For example:\n // case \"image\":\n // if (node.attrs?.src) {\n // htmlString += `<img src=\"${replaceImageHostname(node.attrs.src, opinlyConfig.imagesPrefix)}\" alt=\"${node.attrs?.alt || ''}\" />`;\n // }\n // break;\n default:\n // Handle other block types or just ignore them for articleBody\n break;\n }\n });\n\n return htmlString;\n}\n\nfunction generateChildrenHtml(\n nodes: JSONContent[\"content\"] | undefined\n): string {\n if (!nodes) return \"\";\n\n let childrenHtml = \"\";\n nodes.forEach((child) => {\n if (child.type === \"text\") {\n let text = child.text || \"\";\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = `<strong>${text}</strong>`;\n if (mark.type === \"italic\") text = `<em>${text}</em>`;\n if (mark.type === \"link\" && mark.attrs?.href) {\n text = `<a href=\"${mark.attrs.href}\">${text}</a>`;\n }\n });\n }\n childrenHtml += text;\n }\n // If you have nested content within child nodes, you might need a recursive call here\n // For example, if a list item can contain paragraphs\n // if (child.content) {\n // childrenHtml += generateChildrenHtml(child.content);\n // }\n });\n return childrenHtml;\n}\n\nexport const genFaqJSONLD = (\n faqs: NonNullable<BlogPostRes[\"faqs\"]>\n): WithContext<FAQPage> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"FAQPage\",\n mainEntity: faqs.map((faq) => ({\n \"@type\": \"Question\",\n name: faq.question,\n acceptedAnswer: {\n \"@type\": \"Answer\",\n text: faq.answer,\n },\n })),\n };\n};\n\nexport const genBlogPostingJSONLD = (\n post: BlogPostRes\n): WithContext<BlogPosting> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BlogPosting\",\n headline: post.title,\n description: post.description || undefined,\n url: `${opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + \"/\"}${post.slug}` : post.slug}`,\n datePublished: post.firstPublishedAt || undefined,\n dateModified: post.modifiedAt || undefined,\n image: post.titleFile?.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`,\n }\n : undefined,\n author: post.author\n ? {\n \"@type\": \"Person\",\n name: post.author.name,\n url: `${opinlyConfig.blogUrl}/author/${post.author.slug}`,\n description: post.author.bio || undefined,\n }\n : undefined,\n isAccessibleForFree: true,\n articleBody: generateArticleBodyHtml(post.content as JSONContent),\n };\n};\n\nexport const genBreadcrumbJSONLD = (\n post: BlogPostRes\n): WithContext<BreadcrumbList> => {\n const itemListElement = [\n {\n \"@type\": \"ListItem\",\n position: 1,\n name: \"Company Name\",\n item: opinlyConfig.siteUrl,\n },\n {\n \"@type\": \"ListItem\",\n position: 2,\n name: post.folder?.name || \"Blog\",\n item: `${opinlyConfig.blogUrl}/blog`,\n },\n ];\n\n if (post.folder) {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.folder.name,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}`,\n });\n\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 4,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`,\n });\n } else {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.slug}`,\n });\n }\n\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BreadcrumbList\",\n itemListElement: itemListElement as ListItem[],\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,wBAA6B;AAItB,SAAS,wBAAwB,SAA8B;AACpE,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,MAAI,aAAa;AAEjB,UAAQ,QAAQ,QAAQ,CAAC,SAAS;AAChC,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,sBAAc,MAAM,qBAAqB,KAAK,OAAO,CAAC;AACtD;AAAA,MACF,KAAK;AACH,cAAM,eAAe,KAAK,OAAO,SAAS;AAC1C,sBAAc,KAAK,YAAY,IAAI,qBAAqB,KAAK,OAAO,CAAC,MAAM,YAAY;AACvF;AAAA,MACF,KAAK;AACH,sBAAc,OAAO,qBAAqB,KAAK,OAAO,CAAC;AACvD;AAAA,MACF,KAAK;AACH,sBAAc,OAAO,qBAAqB,KAAK,OAAO,CAAC;AACvD;AAAA,MACF,KAAK;AACH,sBAAc,OAAO,qBAAqB,KAAK,OAAO,CAAC;AACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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,IACT;AAAA,EACF;AACF;","names":[]}
@@ -1,5 +1,4 @@
1
1
  import { opinlyConfig } from "../../../utils/sdk-config";
2
- import { replaceImageNameSpace } from "../../../utils/images";
3
2
  function generateArticleBodyHtml(content) {
4
3
  if (!content?.content) return "";
5
4
  let htmlString = "";
@@ -80,7 +79,7 @@ const genBlogPostingJSONLD = (post) => {
80
79
  dateModified: post.modifiedAt || void 0,
81
80
  image: post.titleFile?.fileKey ? {
82
81
  "@type": "ImageObject",
83
- url: `${opinlyConfig.imagesUrl}/${replaceImageNameSpace(post.titleFile.fileKey)}`
82
+ url: `${opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`
84
83
  } : void 0,
85
84
  author: post.author ? {
86
85
  "@type": "Person",