@opinly/next 0.1.14 → 0.1.16

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 (153) hide show
  1. package/dist/components/author-page/_helpers/json-ld.cjs +2 -0
  2. package/dist/components/author-page/_helpers/json-ld.js +0 -1
  3. package/dist/components/author-page/index.cjs +84 -0
  4. package/dist/components/author-page/{index.mjs.map → index.cjs.map} +1 -1
  5. package/dist/components/author-page/index.js +23 -57
  6. package/dist/components/author-page/index.js.map +1 -1
  7. package/dist/components/authors-page/index.cjs +105 -0
  8. package/dist/components/authors-page/{index.mjs.map → index.cjs.map} +1 -1
  9. package/dist/components/authors-page/index.js +29 -63
  10. package/dist/components/authors-page/index.js.map +1 -1
  11. package/dist/components/blog-post/_components/content.cjs +160 -0
  12. package/dist/components/blog-post/_components/{content.mjs.map → content.cjs.map} +1 -1
  13. package/dist/components/blog-post/_components/content.js +29 -63
  14. package/dist/components/blog-post/_components/content.js.map +1 -1
  15. package/dist/components/blog-post/_components/faq.cjs +39 -0
  16. package/dist/components/blog-post/_components/{faq.mjs.map → faq.cjs.map} +1 -1
  17. package/dist/components/blog-post/_components/faq.js +8 -32
  18. package/dist/components/blog-post/_components/faq.js.map +1 -1
  19. package/dist/components/blog-post/_components/share.cjs +100 -0
  20. package/dist/components/blog-post/_components/{share.mjs.map → share.cjs.map} +1 -1
  21. package/dist/components/blog-post/_components/share.js +24 -58
  22. package/dist/components/blog-post/_components/share.js.map +1 -1
  23. package/dist/components/blog-post/_components/table-of-contents.cjs +82 -0
  24. package/dist/components/blog-post/_components/{table-of-contents.mjs.map → table-of-contents.cjs.map} +1 -1
  25. package/dist/components/blog-post/_components/table-of-contents.js +24 -58
  26. package/dist/components/blog-post/_components/table-of-contents.js.map +1 -1
  27. package/dist/components/blog-post/_helpers/calc-reading-time.cjs +2 -0
  28. package/dist/components/blog-post/_helpers/calc-reading-time.js +0 -1
  29. package/dist/components/blog-post/_helpers/extract-headings.cjs +44 -0
  30. package/dist/components/blog-post/_helpers/{extract-headings.mjs.map → extract-headings.cjs.map} +1 -1
  31. package/dist/components/blog-post/_helpers/extract-headings.js +2 -26
  32. package/dist/components/blog-post/_helpers/extract-headings.js.map +1 -1
  33. package/dist/components/blog-post/_helpers/{json-ld.mjs → json-ld.cjs} +39 -12
  34. package/dist/components/blog-post/_helpers/{json-ld.mjs.map → json-ld.cjs.map} +1 -1
  35. package/dist/components/blog-post/_helpers/json-ld.js +11 -38
  36. package/dist/components/blog-post/_helpers/json-ld.js.map +1 -1
  37. package/dist/components/blog-post/_helpers/reading-time.cjs +50 -0
  38. package/dist/components/blog-post/_helpers/{reading-time.mjs.map → reading-time.cjs.map} +1 -1
  39. package/dist/components/blog-post/_helpers/reading-time.js +2 -27
  40. package/dist/components/blog-post/_helpers/reading-time.js.map +1 -1
  41. package/dist/components/blog-post/_types/blog-post.cjs +17 -0
  42. package/dist/components/blog-post/_types/blog-post.cjs.map +1 -0
  43. package/dist/components/blog-post/_types/blog-post.js +0 -16
  44. package/dist/components/blog-post/_types/blog-post.js.map +1 -1
  45. package/dist/components/blog-post/_types/class-names.cjs +17 -0
  46. package/dist/components/blog-post/_types/class-names.cjs.map +1 -0
  47. package/dist/components/blog-post/_types/class-names.js +0 -16
  48. package/dist/components/blog-post/_types/class-names.js.map +1 -1
  49. package/dist/components/blog-post/index.cjs +148 -0
  50. package/dist/components/blog-post/{index.mjs.map → index.cjs.map} +1 -1
  51. package/dist/components/blog-post/index.js +47 -77
  52. package/dist/components/blog-post/index.js.map +1 -1
  53. package/dist/components/bread-crumbs.cjs +60 -0
  54. package/dist/components/{bread-crumbs.mjs.map → bread-crumbs.cjs.map} +1 -1
  55. package/dist/components/bread-crumbs.js +13 -47
  56. package/dist/components/bread-crumbs.js.map +1 -1
  57. package/dist/components/folder-page/index.cjs +61 -0
  58. package/dist/components/folder-page/{index.mjs.map → index.cjs.map} +1 -1
  59. package/dist/components/folder-page/index.js +12 -36
  60. package/dist/components/folder-page/index.js.map +1 -1
  61. package/dist/components/home-page/folders.cjs +98 -0
  62. package/dist/components/home-page/{folders.mjs.map → folders.cjs.map} +1 -1
  63. package/dist/components/home-page/folders.js +29 -64
  64. package/dist/components/home-page/folders.js.map +1 -1
  65. package/dist/components/home-page/index.cjs +44 -0
  66. package/dist/components/home-page/{index.mjs.map → index.cjs.map} +1 -1
  67. package/dist/components/home-page/index.js +11 -35
  68. package/dist/components/home-page/index.js.map +1 -1
  69. package/dist/components/home-page/pagination.cjs +91 -0
  70. package/dist/components/home-page/{pagination.mjs.map → pagination.cjs.map} +1 -1
  71. package/dist/components/home-page/pagination.js +9 -43
  72. package/dist/components/home-page/pagination.js.map +1 -1
  73. package/dist/components/home-page/top-posts.cjs +52 -0
  74. package/dist/components/home-page/{top-posts.mjs.map → top-posts.cjs.map} +1 -1
  75. package/dist/components/home-page/top-posts.js +10 -34
  76. package/dist/components/home-page/top-posts.js.map +1 -1
  77. package/dist/components/not-found.cjs +60 -0
  78. package/dist/components/{not-found.mjs.map → not-found.cjs.map} +1 -1
  79. package/dist/components/not-found.js +15 -49
  80. package/dist/components/not-found.js.map +1 -1
  81. package/dist/components/opinly-blog.cjs +57 -0
  82. package/dist/components/{opinly-blog.mjs.map → opinly-blog.cjs.map} +1 -1
  83. package/dist/components/opinly-blog.js +15 -39
  84. package/dist/components/opinly-blog.js.map +1 -1
  85. package/dist/components/post-preview.cjs +112 -0
  86. package/dist/components/{post-preview.mjs.map → post-preview.cjs.map} +1 -1
  87. package/dist/components/post-preview.js +42 -77
  88. package/dist/components/post-preview.js.map +1 -1
  89. package/dist/index.cjs +25 -0
  90. package/dist/index.cjs.map +1 -0
  91. package/dist/index.d.cts +3 -0
  92. package/dist/index.d.ts +3 -0
  93. package/dist/index.js +2 -22
  94. package/dist/index.js.map +1 -1
  95. package/dist/utils/dates.cjs +33 -0
  96. package/dist/utils/{dates.mjs.map → dates.cjs.map} +1 -1
  97. package/dist/utils/dates.js +2 -26
  98. package/dist/utils/dates.js.map +1 -1
  99. package/dist/utils/generate-metadata.cjs +62 -0
  100. package/dist/utils/generate-metadata.cjs.map +1 -0
  101. package/dist/utils/generate-metadata.js +9 -31
  102. package/dist/utils/generate-metadata.js.map +1 -1
  103. package/dist/utils/merge.cjs +33 -0
  104. package/dist/utils/{merge.mjs.map → merge.cjs.map} +1 -1
  105. package/dist/utils/merge.js +5 -29
  106. package/dist/utils/merge.js.map +1 -1
  107. package/dist/utils/sdk-config.cjs +51 -0
  108. package/dist/utils/sdk-config.cjs.map +1 -0
  109. package/dist/utils/sdk-config.d.cts +10 -2
  110. package/dist/utils/sdk-config.d.ts +10 -2
  111. package/dist/utils/sdk-config.js +3 -34
  112. package/dist/utils/sdk-config.js.map +1 -1
  113. package/dist/utils/with-opinly-config.cjs +115 -0
  114. package/dist/utils/with-opinly-config.cjs.map +1 -0
  115. package/dist/utils/with-opinly-config.d.cts +39 -0
  116. package/dist/utils/with-opinly-config.d.ts +39 -0
  117. package/dist/utils/with-opinly-config.js +91 -0
  118. package/dist/utils/with-opinly-config.js.map +1 -0
  119. package/package.json +3 -2
  120. package/dist/components/author-page/_helpers/json-ld.mjs +0 -1
  121. package/dist/components/author-page/index.mjs +0 -50
  122. package/dist/components/authors-page/index.mjs +0 -71
  123. package/dist/components/blog-post/_components/content.mjs +0 -126
  124. package/dist/components/blog-post/_components/faq.mjs +0 -15
  125. package/dist/components/blog-post/_components/share.mjs +0 -66
  126. package/dist/components/blog-post/_components/table-of-contents.mjs +0 -48
  127. package/dist/components/blog-post/_helpers/calc-reading-time.mjs +0 -1
  128. package/dist/components/blog-post/_helpers/extract-headings.mjs +0 -20
  129. package/dist/components/blog-post/_helpers/reading-time.mjs +0 -25
  130. package/dist/components/blog-post/_types/blog-post.mjs +0 -1
  131. package/dist/components/blog-post/_types/blog-post.mjs.map +0 -1
  132. package/dist/components/blog-post/_types/class-names.mjs +0 -1
  133. package/dist/components/blog-post/_types/class-names.mjs.map +0 -1
  134. package/dist/components/blog-post/index.mjs +0 -118
  135. package/dist/components/bread-crumbs.mjs +0 -26
  136. package/dist/components/folder-page/index.mjs +0 -37
  137. package/dist/components/home-page/folders.mjs +0 -63
  138. package/dist/components/home-page/index.mjs +0 -20
  139. package/dist/components/home-page/pagination.mjs +0 -57
  140. package/dist/components/home-page/top-posts.mjs +0 -28
  141. package/dist/components/not-found.mjs +0 -26
  142. package/dist/components/opinly-blog.mjs +0 -33
  143. package/dist/components/post-preview.mjs +0 -77
  144. package/dist/index.mjs +0 -2
  145. package/dist/index.mjs.map +0 -1
  146. package/dist/utils/dates.mjs +0 -9
  147. package/dist/utils/generate-metadata.mjs +0 -36
  148. package/dist/utils/generate-metadata.mjs.map +0 -1
  149. package/dist/utils/merge.mjs +0 -9
  150. package/dist/utils/sdk-config.mjs +0 -32
  151. package/dist/utils/sdk-config.mjs.map +0 -1
  152. /package/dist/components/author-page/_helpers/{json-ld.mjs.map → json-ld.cjs.map} +0 -0
  153. /package/dist/components/blog-post/_helpers/{calc-reading-time.mjs.map → calc-reading-time.cjs.map} +0 -0
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var content_exports = {};
30
+ __export(content_exports, {
31
+ Content: () => Content
32
+ });
33
+ module.exports = __toCommonJS(content_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_merge = require("../../../utils/merge");
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);
40
+ function renderTiptapContent(content, classNames) {
41
+ if (!content?.content) return [];
42
+ return content.content.map((node, index) => {
43
+ switch (node.type) {
44
+ case "paragraph":
45
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: classNames.paragraph || "mb-4", children: renderChildren(node.content, classNames) }, index);
46
+ case "heading": {
47
+ const text = node.content?.[0]?.text ?? "";
48
+ const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
49
+ const Tag = `h${node.attrs?.level || 1}`;
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
51
+ Tag,
52
+ {
53
+ id: slug,
54
+ className: classNames.heading || "mt-8 mb-4 font-bold text-gray-800",
55
+ children: renderChildren(node.content, classNames)
56
+ },
57
+ index
58
+ );
59
+ }
60
+ case "image":
61
+ const fileKey = node.attrs?.fileKey;
62
+ if (!fileKey) {
63
+ return null;
64
+ }
65
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
+ "div",
67
+ {
68
+ className: (0, import_merge.cn)(
69
+ "relative w-full max-w-[800px] my-6",
70
+ classNames.image
71
+ ),
72
+ style: { aspectRatio: "2 / 1" },
73
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_image.default,
75
+ {
76
+ unoptimized: import_sdk_config.opinlyConfig.unoptimizedImages,
77
+ src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${fileKey}`,
78
+ title: node.attrs?.title || "",
79
+ alt: node.attrs?.alt || "",
80
+ fill: true,
81
+ className: "object-contain rounded-lg",
82
+ sizes: "(max-width: 800px) 100vw, 800px"
83
+ }
84
+ )
85
+ },
86
+ index
87
+ );
88
+ case "bulletList":
89
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
+ "ul",
91
+ {
92
+ className: (0, import_merge.cn)("list-disc pl-6 my-4", classNames.bulletList),
93
+ children: renderTiptapContent(node, classNames)
94
+ },
95
+ index
96
+ );
97
+ case "orderedList":
98
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
+ "ol",
100
+ {
101
+ className: (0, import_merge.cn)("list-decimal pl-6 my-4", classNames.orderedList),
102
+ children: renderTiptapContent(node, classNames)
103
+ },
104
+ index
105
+ );
106
+ case "listItem":
107
+ if (node.content && node.content.length === 1 && node.content[0].type === "paragraph") {
108
+ 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);
109
+ }
110
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: (0, import_merge.cn)("my-1", classNames.listItem), children: renderChildren(node.content, classNames) }, index);
111
+ default:
112
+ return null;
113
+ }
114
+ }).filter(Boolean);
115
+ }
116
+ const Content = ({
117
+ content,
118
+ classNames
119
+ }) => {
120
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
121
+ };
122
+ function renderChildren(nodes, classNames) {
123
+ if (!nodes) {
124
+ console.log("no nodes");
125
+ return [];
126
+ }
127
+ return nodes.map((child, idx) => {
128
+ if (child.type === "text") {
129
+ let text = child.text;
130
+ if (child.marks) {
131
+ child.marks.forEach((mark) => {
132
+ if (mark.type === "bold") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: text }, idx);
133
+ if (mark.type === "italic") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", { children: text }, idx);
134
+ if (mark.type === "link")
135
+ text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
136
+ import_link.default,
137
+ {
138
+ href: mark.attrs?.href,
139
+ className: classNames.link || "text-blue-600 underline",
140
+ children: text
141
+ },
142
+ idx
143
+ );
144
+ });
145
+ }
146
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }, idx);
147
+ } else {
148
+ console.log("child", child);
149
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.default.Fragment, { children: renderTiptapContent(
150
+ { ...child, content: child.content },
151
+ classNames
152
+ ) }, idx);
153
+ }
154
+ }).filter(Boolean);
155
+ }
156
+ // Annotate the CommonJS export names for ESM import in node:
157
+ 0 && (module.exports = {
158
+ Content
159
+ });
160
+ //# sourceMappingURL=content.cjs.map
@@ -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\";\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 unoptimized={opinlyConfig.unoptimizedImages}\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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,EACA,OAAO,OAAO;AACnB;AAEO,MAAM,UAAU,CAAC;AAAA,EACtB;AAAA,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":[]}
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 unoptimized={opinlyConfig.unoptimizedImages}\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,KADl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;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,53 +1,20 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var content_exports = {};
30
- __export(content_exports, {
31
- Content: () => Content
32
- });
33
- module.exports = __toCommonJS(content_exports);
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var import_merge = require("../../../utils/merge");
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);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../../utils/merge";
3
+ import Link from "next/link";
4
+ import Image from "next/image";
5
+ import { opinlyConfig } from "../../../utils/sdk-config";
6
+ import React from "react";
40
7
  function renderTiptapContent(content, classNames) {
41
8
  if (!content?.content) return [];
42
9
  return content.content.map((node, index) => {
43
10
  switch (node.type) {
44
11
  case "paragraph":
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: classNames.paragraph || "mb-4", children: renderChildren(node.content, classNames) }, index);
12
+ return /* @__PURE__ */ jsx("p", { className: classNames.paragraph || "mb-4", children: renderChildren(node.content, classNames) }, index);
46
13
  case "heading": {
47
14
  const text = node.content?.[0]?.text ?? "";
48
15
  const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
49
16
  const Tag = `h${node.attrs?.level || 1}`;
50
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
17
+ return /* @__PURE__ */ jsx(
51
18
  Tag,
52
19
  {
53
20
  id: slug,
@@ -62,19 +29,19 @@ function renderTiptapContent(content, classNames) {
62
29
  if (!fileKey) {
63
30
  return null;
64
31
  }
65
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
32
+ return /* @__PURE__ */ jsx(
66
33
  "div",
67
34
  {
68
- className: (0, import_merge.cn)(
35
+ className: cn(
69
36
  "relative w-full max-w-[800px] my-6",
70
37
  classNames.image
71
38
  ),
72
39
  style: { aspectRatio: "2 / 1" },
73
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
- import_image.default,
40
+ children: /* @__PURE__ */ jsx(
41
+ Image,
75
42
  {
76
- unoptimized: import_sdk_config.opinlyConfig.unoptimizedImages,
77
- src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${fileKey}`,
43
+ unoptimized: opinlyConfig.unoptimizedImages,
44
+ src: `${opinlyConfig.imagesPrefix}/${fileKey}`,
78
45
  title: node.attrs?.title || "",
79
46
  alt: node.attrs?.alt || "",
80
47
  fill: true,
@@ -86,28 +53,28 @@ function renderTiptapContent(content, classNames) {
86
53
  index
87
54
  );
88
55
  case "bulletList":
89
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
+ return /* @__PURE__ */ jsx(
90
57
  "ul",
91
58
  {
92
- className: (0, import_merge.cn)("list-disc pl-6 my-4", classNames.bulletList),
59
+ className: cn("list-disc pl-6 my-4", classNames.bulletList),
93
60
  children: renderTiptapContent(node, classNames)
94
61
  },
95
62
  index
96
63
  );
97
64
  case "orderedList":
98
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ return /* @__PURE__ */ jsx(
99
66
  "ol",
100
67
  {
101
- className: (0, import_merge.cn)("list-decimal pl-6 my-4", classNames.orderedList),
68
+ className: cn("list-decimal pl-6 my-4", classNames.orderedList),
102
69
  children: renderTiptapContent(node, classNames)
103
70
  },
104
71
  index
105
72
  );
106
73
  case "listItem":
107
74
  if (node.content && node.content.length === 1 && node.content[0].type === "paragraph") {
108
- 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);
75
+ return /* @__PURE__ */ jsx("li", { className: cn("my-1", classNames.listItem), children: renderChildren(node.content[0].content, classNames) }, index);
109
76
  }
110
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: (0, import_merge.cn)("my-1", classNames.listItem), children: renderChildren(node.content, classNames) }, index);
77
+ return /* @__PURE__ */ jsx("li", { className: cn("my-1", classNames.listItem), children: renderChildren(node.content, classNames) }, index);
111
78
  default:
112
79
  return null;
113
80
  }
@@ -117,7 +84,7 @@ const Content = ({
117
84
  content,
118
85
  classNames
119
86
  }) => {
120
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
87
+ return /* @__PURE__ */ jsx("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
121
88
  };
122
89
  function renderChildren(nodes, classNames) {
123
90
  if (!nodes) {
@@ -129,11 +96,11 @@ function renderChildren(nodes, classNames) {
129
96
  let text = child.text;
130
97
  if (child.marks) {
131
98
  child.marks.forEach((mark) => {
132
- if (mark.type === "bold") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: text }, idx);
133
- if (mark.type === "italic") text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", { children: text }, idx);
99
+ if (mark.type === "bold") text = /* @__PURE__ */ jsx("strong", { children: text }, idx);
100
+ if (mark.type === "italic") text = /* @__PURE__ */ jsx("em", { children: text }, idx);
134
101
  if (mark.type === "link")
135
- text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
136
- import_link.default,
102
+ text = /* @__PURE__ */ jsx(
103
+ Link,
137
104
  {
138
105
  href: mark.attrs?.href,
139
106
  className: classNames.link || "text-blue-600 underline",
@@ -143,18 +110,17 @@ function renderChildren(nodes, classNames) {
143
110
  );
144
111
  });
145
112
  }
146
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }, idx);
113
+ return /* @__PURE__ */ jsx("span", { children: text }, idx);
147
114
  } else {
148
115
  console.log("child", child);
149
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.default.Fragment, { children: renderTiptapContent(
116
+ return /* @__PURE__ */ jsx(React.Fragment, { children: renderTiptapContent(
150
117
  { ...child, content: child.content },
151
118
  classNames
152
119
  ) }, idx);
153
120
  }
154
121
  }).filter(Boolean);
155
122
  }
156
- // Annotate the CommonJS export names for ESM import in node:
157
- 0 && (module.exports = {
123
+ export {
158
124
  Content
159
- });
125
+ };
160
126
  //# sourceMappingURL=content.js.map
@@ -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\";\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 unoptimized={opinlyConfig.unoptimizedImages}\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,WA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AK;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
+ {"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 unoptimized={opinlyConfig.unoptimizedImages}\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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O,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":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var faq_exports = {};
20
+ __export(faq_exports, {
21
+ FAQS: () => FAQS
22
+ });
23
+ module.exports = __toCommonJS(faq_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ const FAQS = ({ faqs }) => {
26
+ if (!faqs) return null;
27
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
28
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-lg font-semibold mb-2", children: "FAQS" }),
29
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: faqs.map((faq) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
30
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-lg font-semibold mb-2", children: faq.question }),
31
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-gray-700", children: faq.answer })
32
+ ] }, faq.question)) })
33
+ ] });
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ FAQS
38
+ });
39
+ //# sourceMappingURL=faq.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blog-post/_components/faq.tsx"],"sourcesContent":["import { BlogPostRes } from \"../_types/blog-post\";\n\nexport const FAQS = ({ faqs }: { faqs: BlogPostRes[\"faqs\"] }) => {\n if (!faqs) return null;\n return (\n <div>\n <h2 className=\"text-lg font-semibold mb-2\">FAQS</h2>\n <ul>\n {faqs.map((faq) => (\n <li key={faq.question}>\n <h3 className=\"text-lg font-semibold mb-2\">{faq.question}</h3>\n <p className=\"text-sm text-gray-700\">{faq.answer}</p>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"mappings":"AAMM,cAGI,YAHJ;AAJC,MAAM,OAAO,CAAC,EAAE,KAAK,MAAqC;AAC/D,MAAI,CAAC,KAAM,QAAO;AAClB,SACE,qBAAC,SACC;AAAA,wBAAC,QAAG,WAAU,8BAA6B,kBAAI;AAAA,IAC/C,oBAAC,QACE,eAAK,IAAI,CAAC,QACT,qBAAC,QACC;AAAA,0BAAC,QAAG,WAAU,8BAA8B,cAAI,UAAS;AAAA,MACzD,oBAAC,OAAE,WAAU,yBAAyB,cAAI,QAAO;AAAA,SAF1C,IAAI,QAGb,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/blog-post/_components/faq.tsx"],"sourcesContent":["import { BlogPostRes } from \"../_types/blog-post\";\n\nexport const FAQS = ({ faqs }: { faqs: BlogPostRes[\"faqs\"] }) => {\n if (!faqs) return null;\n return (\n <div>\n <h2 className=\"text-lg font-semibold mb-2\">FAQS</h2>\n <ul>\n {faqs.map((faq) => (\n <li key={faq.question}>\n <h3 className=\"text-lg font-semibold mb-2\">{faq.question}</h3>\n <p className=\"text-sm text-gray-700\">{faq.answer}</p>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMM;AAJC,MAAM,OAAO,CAAC,EAAE,KAAK,MAAqC;AAC/D,MAAI,CAAC,KAAM,QAAO;AAClB,SACE,6CAAC,SACC;AAAA,gDAAC,QAAG,WAAU,8BAA6B,kBAAI;AAAA,IAC/C,4CAAC,QACE,eAAK,IAAI,CAAC,QACT,6CAAC,QACC;AAAA,kDAAC,QAAG,WAAU,8BAA8B,cAAI,UAAS;AAAA,MACzD,4CAAC,OAAE,WAAU,yBAAyB,cAAI,QAAO;AAAA,SAF1C,IAAI,QAGb,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
@@ -1,39 +1,15 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var faq_exports = {};
20
- __export(faq_exports, {
21
- FAQS: () => FAQS
22
- });
23
- module.exports = __toCommonJS(faq_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
1
+ import { jsx, jsxs } from "react/jsx-runtime";
25
2
  const FAQS = ({ faqs }) => {
26
3
  if (!faqs) return null;
27
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
28
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-lg font-semibold mb-2", children: "FAQS" }),
29
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: faqs.map((faq) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
30
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-lg font-semibold mb-2", children: faq.question }),
31
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-gray-700", children: faq.answer })
4
+ return /* @__PURE__ */ jsxs("div", { children: [
5
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-2", children: "FAQS" }),
6
+ /* @__PURE__ */ jsx("ul", { children: faqs.map((faq) => /* @__PURE__ */ jsxs("li", { children: [
7
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-2", children: faq.question }),
8
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-700", children: faq.answer })
32
9
  ] }, faq.question)) })
33
10
  ] });
34
11
  };
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
12
+ export {
37
13
  FAQS
38
- });
14
+ };
39
15
  //# sourceMappingURL=faq.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blog-post/_components/faq.tsx"],"sourcesContent":["import { BlogPostRes } from \"../_types/blog-post\";\n\nexport const FAQS = ({ faqs }: { faqs: BlogPostRes[\"faqs\"] }) => {\n if (!faqs) return null;\n return (\n <div>\n <h2 className=\"text-lg font-semibold mb-2\">FAQS</h2>\n <ul>\n {faqs.map((faq) => (\n <li key={faq.question}>\n <h3 className=\"text-lg font-semibold mb-2\">{faq.question}</h3>\n <p className=\"text-sm text-gray-700\">{faq.answer}</p>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMM;AAJC,MAAM,OAAO,CAAC,EAAE,KAAK,MAAqC;AAC/D,MAAI,CAAC,KAAM,QAAO;AAClB,SACE,6CAAC,SACC;AAAA,gDAAC,QAAG,WAAU,8BAA6B,kBAAI;AAAA,IAC/C,4CAAC,QACE,eAAK,IAAI,CAAC,QACT,6CAAC,QACC;AAAA,kDAAC,QAAG,WAAU,8BAA8B,cAAI,UAAS;AAAA,MACzD,4CAAC,OAAE,WAAU,yBAAyB,cAAI,QAAO;AAAA,SAF1C,IAAI,QAGb,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/blog-post/_components/faq.tsx"],"sourcesContent":["import { BlogPostRes } from \"../_types/blog-post\";\n\nexport const FAQS = ({ faqs }: { faqs: BlogPostRes[\"faqs\"] }) => {\n if (!faqs) return null;\n return (\n <div>\n <h2 className=\"text-lg font-semibold mb-2\">FAQS</h2>\n <ul>\n {faqs.map((faq) => (\n <li key={faq.question}>\n <h3 className=\"text-lg font-semibold mb-2\">{faq.question}</h3>\n <p className=\"text-sm text-gray-700\">{faq.answer}</p>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"],"mappings":"AAMM,cAGI,YAHJ;AAJC,MAAM,OAAO,CAAC,EAAE,KAAK,MAAqC;AAC/D,MAAI,CAAC,KAAM,QAAO;AAClB,SACE,qBAAC,SACC;AAAA,wBAAC,QAAG,WAAU,8BAA6B,kBAAI;AAAA,IAC/C,oBAAC,QACE,eAAK,IAAI,CAAC,QACT,qBAAC,QACC;AAAA,0BAAC,QAAG,WAAU,8BAA8B,cAAI,UAAS;AAAA,MACzD,oBAAC,OAAE,WAAU,yBAAyB,cAAI,QAAO;AAAA,SAF1C,IAAI,QAGb,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var share_exports = {};
30
+ __export(share_exports, {
31
+ Share: () => Share
32
+ });
33
+ module.exports = __toCommonJS(share_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_lucide_react = require("lucide-react");
36
+ var import_link = __toESM(require("next/link"), 1);
37
+ var import_sdk_config = require("../../../utils/sdk-config");
38
+ const Share = ({ post }) => {
39
+ const postUrl = encodeURIComponent(`${import_sdk_config.opinlyConfig.blogUrl}/${post.slug}`);
40
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2 mb-6", children: [
41
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
42
+ import_link.default,
43
+ {
44
+ href: `https://linkedin.com/sharing/share-offsite?url=${postUrl}`,
45
+ target: "_blank",
46
+ rel: "noopener noreferrer",
47
+ className: "border p-1 rounded flex items-center justify-center w-8 h-8",
48
+ children: [
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Share on LinkedIn" }),
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Linkedin, { className: "w-4 h-4" })
51
+ ]
52
+ }
53
+ ),
54
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
55
+ import_link.default,
56
+ {
57
+ href: `https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(
58
+ `Check out this article by ${post.author?.name}`
59
+ )}`,
60
+ target: "_blank",
61
+ rel: "noopener noreferrer",
62
+ className: "border p-1 rounded flex items-center justify-center w-8 h-8",
63
+ children: [
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Share on Twitter" }),
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Twitter, {})
66
+ ]
67
+ }
68
+ ),
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
70
+ import_link.default,
71
+ {
72
+ href: `https://facebook.com/sharer/sharer.php?u=${postUrl}`,
73
+ target: "_blank",
74
+ rel: "noopener noreferrer",
75
+ className: "border p-1 rounded flex items-center justify-center w-8 h-8",
76
+ children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Share on Facebook" }),
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Facebook, {})
79
+ ]
80
+ }
81
+ ),
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
83
+ import_link.default,
84
+ {
85
+ href: `mailto:?body=${encodeURIComponent(`${post.title}
86
+ ${postUrl}`)}`,
87
+ className: "border p-1 rounded flex items-center justify-center w-8 h-8",
88
+ children: [
89
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Share via Email" }),
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Mail, { className: "w-4 h-4" })
91
+ ]
92
+ }
93
+ )
94
+ ] });
95
+ };
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ Share
99
+ });
100
+ //# sourceMappingURL=share.cjs.map