@opinly/next 0.1.14 → 0.1.15

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 (141) 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 +23 -0
  90. package/dist/index.cjs.map +1 -0
  91. package/dist/index.js +1 -22
  92. package/dist/index.js.map +1 -1
  93. package/dist/utils/dates.cjs +33 -0
  94. package/dist/utils/{dates.mjs.map → dates.cjs.map} +1 -1
  95. package/dist/utils/dates.js +2 -26
  96. package/dist/utils/dates.js.map +1 -1
  97. package/dist/utils/generate-metadata.cjs +62 -0
  98. package/dist/utils/generate-metadata.cjs.map +1 -0
  99. package/dist/utils/generate-metadata.js +9 -31
  100. package/dist/utils/generate-metadata.js.map +1 -1
  101. package/dist/utils/merge.cjs +33 -0
  102. package/dist/utils/{merge.mjs.map → merge.cjs.map} +1 -1
  103. package/dist/utils/merge.js +5 -29
  104. package/dist/utils/merge.js.map +1 -1
  105. package/dist/utils/{sdk-config.mjs → sdk-config.cjs} +28 -3
  106. package/dist/utils/{sdk-config.mjs.map → sdk-config.cjs.map} +1 -1
  107. package/dist/utils/sdk-config.js +2 -27
  108. package/dist/utils/sdk-config.js.map +1 -1
  109. package/package.json +2 -2
  110. package/dist/components/author-page/_helpers/json-ld.mjs +0 -1
  111. package/dist/components/author-page/index.mjs +0 -50
  112. package/dist/components/authors-page/index.mjs +0 -71
  113. package/dist/components/blog-post/_components/content.mjs +0 -126
  114. package/dist/components/blog-post/_components/faq.mjs +0 -15
  115. package/dist/components/blog-post/_components/share.mjs +0 -66
  116. package/dist/components/blog-post/_components/table-of-contents.mjs +0 -48
  117. package/dist/components/blog-post/_helpers/calc-reading-time.mjs +0 -1
  118. package/dist/components/blog-post/_helpers/extract-headings.mjs +0 -20
  119. package/dist/components/blog-post/_helpers/reading-time.mjs +0 -25
  120. package/dist/components/blog-post/_types/blog-post.mjs +0 -1
  121. package/dist/components/blog-post/_types/blog-post.mjs.map +0 -1
  122. package/dist/components/blog-post/_types/class-names.mjs +0 -1
  123. package/dist/components/blog-post/_types/class-names.mjs.map +0 -1
  124. package/dist/components/blog-post/index.mjs +0 -118
  125. package/dist/components/bread-crumbs.mjs +0 -26
  126. package/dist/components/folder-page/index.mjs +0 -37
  127. package/dist/components/home-page/folders.mjs +0 -63
  128. package/dist/components/home-page/index.mjs +0 -20
  129. package/dist/components/home-page/pagination.mjs +0 -57
  130. package/dist/components/home-page/top-posts.mjs +0 -28
  131. package/dist/components/not-found.mjs +0 -26
  132. package/dist/components/opinly-blog.mjs +0 -33
  133. package/dist/components/post-preview.mjs +0 -77
  134. package/dist/index.mjs +0 -2
  135. package/dist/index.mjs.map +0 -1
  136. package/dist/utils/dates.mjs +0 -9
  137. package/dist/utils/generate-metadata.mjs +0 -36
  138. package/dist/utils/generate-metadata.mjs.map +0 -1
  139. package/dist/utils/merge.mjs +0 -9
  140. /package/dist/components/author-page/_helpers/{json-ld.mjs.map → json-ld.cjs.map} +0 -0
  141. /package/dist/components/blog-post/_helpers/{calc-reading-time.mjs.map → calc-reading-time.cjs.map} +0 -0
@@ -1,27 +1,3 @@
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 sdk_config_exports = {};
20
- __export(sdk_config_exports, {
21
- opinlyConfig: () => opinlyConfig,
22
- setOpinlyConfig: () => setOpinlyConfig
23
- });
24
- module.exports = __toCommonJS(sdk_config_exports);
25
1
  const siteUrl = process.env.OPINLY_SITE_URL;
26
2
  const opinlyEnvVars = {
27
3
  OPINLY_IMAGES_PREFIX: process.env.OPINLY_IMAGES_PREFIX,
@@ -49,9 +25,8 @@ let opinlyConfig = {
49
25
  function setOpinlyConfig(newConfig) {
50
26
  opinlyConfig = { ...opinlyConfig, ...newConfig };
51
27
  }
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
28
+ export {
54
29
  opinlyConfig,
55
30
  setOpinlyConfig
56
- });
31
+ };
57
32
  //# sourceMappingURL=sdk-config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/sdk-config.ts"],"sourcesContent":["const siteUrl = process.env.OPINLY_SITE_URL;\n\nconst opinlyEnvVars = {\n OPINLY_IMAGES_PREFIX: process.env.OPINLY_IMAGES_PREFIX as string,\n OPINLY_SITE_URL: process.env.OPINLY_SITE_URL as string,\n OPINLY_BLOG_PREFIX: process.env.OPINLY_BLOG_PREFIX as string,\n OPINLY_CDN_URL: process.env.OPINLY_CDN_URL as string,\n OPINLY_SITE_NAME: process.env.OPINLY_SITE_NAME as string,\n OPINLY_UNOPTIMIZED_IMAGES: process.env.OPINLY_UNOPTIMIZED_IMAGES as string,\n};\n\nObject.entries(opinlyEnvVars).forEach(([key, value]) => {\n if (!value) {\n throw new Error(`OPINLY ERROR: env var ${key} is not set`);\n }\n});\n\nexport let opinlyConfig: {\n cdnUrl: string;\n imagesPrefix: string;\n imagesUrl: string;\n siteUrl: string;\n blogPrefix: string;\n blogUrl: string;\n siteName: string;\n unoptimizedImages: boolean;\n} = {\n cdnUrl: process.env.OPINLY_CDN_URL || \"https://cdn.opinly.ai\",\n siteUrl: process.env.OPINLY_SITE_URL as string,\n imagesPrefix: process.env.OPINLY_IMAGES_PREFIX as string,\n imagesUrl: `${process.env.OPINLY_SITE_URL as string}${process.env.OPINLY_IMAGES_PREFIX as string}`,\n blogPrefix: process.env.OPINLY_BLOG_PREFIX as string,\n blogUrl: `${process.env.OPINLY_SITE_URL as string}${process.env.OPINLY_BLOG_PREFIX as string}`,\n siteName: process.env.OPINLY_SITE_NAME as string,\n unoptimizedImages: process.env.OPINLY_UNOPTIMIZED_IMAGES === \"true\",\n};\n\nexport function setOpinlyConfig(newConfig: typeof opinlyConfig) {\n opinlyConfig = { ...opinlyConfig, ...newConfig };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,UAAU,QAAQ,IAAI;AAE5B,MAAM,gBAAgB;AAAA,EACpB,sBAAsB,QAAQ,IAAI;AAAA,EAClC,iBAAiB,QAAQ,IAAI;AAAA,EAC7B,oBAAoB,QAAQ,IAAI;AAAA,EAChC,gBAAgB,QAAQ,IAAI;AAAA,EAC5B,kBAAkB,QAAQ,IAAI;AAAA,EAC9B,2BAA2B,QAAQ,IAAI;AACzC;AAEA,OAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACtD,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,yBAAyB,GAAG,aAAa;AAAA,EAC3D;AACF,CAAC;AAEM,IAAI,eASP;AAAA,EACF,QAAQ,QAAQ,IAAI,kBAAkB;AAAA,EACtC,SAAS,QAAQ,IAAI;AAAA,EACrB,cAAc,QAAQ,IAAI;AAAA,EAC1B,WAAW,GAAG,QAAQ,IAAI,eAAyB,GAAG,QAAQ,IAAI,oBAA8B;AAAA,EAChG,YAAY,QAAQ,IAAI;AAAA,EACxB,SAAS,GAAG,QAAQ,IAAI,eAAyB,GAAG,QAAQ,IAAI,kBAA4B;AAAA,EAC5F,UAAU,QAAQ,IAAI;AAAA,EACtB,mBAAmB,QAAQ,IAAI,8BAA8B;AAC/D;AAEO,SAAS,gBAAgB,WAAgC;AAC9D,iBAAe,EAAE,GAAG,cAAc,GAAG,UAAU;AACjD;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/sdk-config.ts"],"sourcesContent":["const siteUrl = process.env.OPINLY_SITE_URL;\n\nconst opinlyEnvVars = {\n OPINLY_IMAGES_PREFIX: process.env.OPINLY_IMAGES_PREFIX as string,\n OPINLY_SITE_URL: process.env.OPINLY_SITE_URL as string,\n OPINLY_BLOG_PREFIX: process.env.OPINLY_BLOG_PREFIX as string,\n OPINLY_CDN_URL: process.env.OPINLY_CDN_URL as string,\n OPINLY_SITE_NAME: process.env.OPINLY_SITE_NAME as string,\n OPINLY_UNOPTIMIZED_IMAGES: process.env.OPINLY_UNOPTIMIZED_IMAGES as string,\n};\n\nObject.entries(opinlyEnvVars).forEach(([key, value]) => {\n if (!value) {\n throw new Error(`OPINLY ERROR: env var ${key} is not set`);\n }\n});\n\nexport let opinlyConfig: {\n cdnUrl: string;\n imagesPrefix: string;\n imagesUrl: string;\n siteUrl: string;\n blogPrefix: string;\n blogUrl: string;\n siteName: string;\n unoptimizedImages: boolean;\n} = {\n cdnUrl: process.env.OPINLY_CDN_URL || \"https://cdn.opinly.ai\",\n siteUrl: process.env.OPINLY_SITE_URL as string,\n imagesPrefix: process.env.OPINLY_IMAGES_PREFIX as string,\n imagesUrl: `${process.env.OPINLY_SITE_URL as string}${process.env.OPINLY_IMAGES_PREFIX as string}`,\n blogPrefix: process.env.OPINLY_BLOG_PREFIX as string,\n blogUrl: `${process.env.OPINLY_SITE_URL as string}${process.env.OPINLY_BLOG_PREFIX as string}`,\n siteName: process.env.OPINLY_SITE_NAME as string,\n unoptimizedImages: process.env.OPINLY_UNOPTIMIZED_IMAGES === \"true\",\n};\n\nexport function setOpinlyConfig(newConfig: typeof opinlyConfig) {\n opinlyConfig = { ...opinlyConfig, ...newConfig };\n}\n"],"mappings":"AAAA,MAAM,UAAU,QAAQ,IAAI;AAE5B,MAAM,gBAAgB;AAAA,EACpB,sBAAsB,QAAQ,IAAI;AAAA,EAClC,iBAAiB,QAAQ,IAAI;AAAA,EAC7B,oBAAoB,QAAQ,IAAI;AAAA,EAChC,gBAAgB,QAAQ,IAAI;AAAA,EAC5B,kBAAkB,QAAQ,IAAI;AAAA,EAC9B,2BAA2B,QAAQ,IAAI;AACzC;AAEA,OAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACtD,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,yBAAyB,GAAG,aAAa;AAAA,EAC3D;AACF,CAAC;AAEM,IAAI,eASP;AAAA,EACF,QAAQ,QAAQ,IAAI,kBAAkB;AAAA,EACtC,SAAS,QAAQ,IAAI;AAAA,EACrB,cAAc,QAAQ,IAAI;AAAA,EAC1B,WAAW,GAAG,QAAQ,IAAI,eAAyB,GAAG,QAAQ,IAAI,oBAA8B;AAAA,EAChG,YAAY,QAAQ,IAAI;AAAA,EACxB,SAAS,GAAG,QAAQ,IAAI,eAAyB,GAAG,QAAQ,IAAI,kBAA4B;AAAA,EAC5F,UAAU,QAAQ,IAAI;AAAA,EACtB,mBAAmB,QAAQ,IAAI,8BAA8B;AAC/D;AAEO,SAAS,gBAAgB,WAAgC;AAC9D,iBAAe,EAAE,GAAG,cAAc,GAAG,UAAU;AACjD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opinly/next",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "dist/index.cjs",
@@ -29,7 +29,7 @@
29
29
  "react-syntax-highlighter": "^15.6.1",
30
30
  "schema-dts": "^1.1.5",
31
31
  "tailwind-merge": "^1.14.0",
32
- "@opinly/backend": "0.1.14"
32
+ "@opinly/backend": "0.1.15"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=16"
@@ -1 +0,0 @@
1
- //# sourceMappingURL=json-ld.mjs.map
@@ -1,50 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import Image from "next/image";
3
- import { opinlyConfig } from "../../utils/sdk-config";
4
- import { PostPreview } from "../post-preview";
5
- import { BreadCrumbs } from "../bread-crumbs";
6
- const AuthorPage = ({
7
- author
8
- }) => {
9
- return /* @__PURE__ */ jsxs("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
10
- /* @__PURE__ */ jsx(
11
- BreadCrumbs,
12
- {
13
- breadcrumbs: [
14
- {
15
- name: "Authors",
16
- url: `${opinlyConfig.blogPrefix}/authors`
17
- }
18
- ]
19
- }
20
- ),
21
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 mb-10", children: [
22
- author.image.fileKey && /* @__PURE__ */ jsx(
23
- Image,
24
- {
25
- unoptimized: opinlyConfig.unoptimizedImages,
26
- src: `${opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
27
- alt: author.image.alt || author.name,
28
- width: 150,
29
- height: 150,
30
- className: "rounded-full border"
31
- }
32
- ),
33
- /* @__PURE__ */ jsxs("div", { children: [
34
- /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold mb-1", children: author.name }),
35
- author.bio && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
36
- ] })
37
- ] }),
38
- /* @__PURE__ */ jsxs("h2", { className: "text-xl font-semibold mb-6", children: [
39
- "Posts by ",
40
- author.name
41
- ] }),
42
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8", children: author.posts && author.posts.length > 0 ? author.posts.map(
43
- (post) => post && /* @__PURE__ */ jsx(PostPreview, { post }, post.slug)
44
- ) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) })
45
- ] });
46
- };
47
- export {
48
- AuthorPage
49
- };
50
- //# sourceMappingURL=index.mjs.map
@@ -1,71 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import Image from "next/image";
3
- import { opinlyConfig } from "../../utils/sdk-config";
4
- import { PostPreview } from "../post-preview";
5
- import { BreadCrumbs } from "../bread-crumbs";
6
- import Link from "next/link";
7
- const AuthorsPage = ({
8
- authors
9
- }) => {
10
- return /* @__PURE__ */ jsxs("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
11
- /* @__PURE__ */ jsx(
12
- BreadCrumbs,
13
- {
14
- breadcrumbs: [
15
- {
16
- name: "Authors"
17
- }
18
- ]
19
- }
20
- ),
21
- /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold mb-10", children: "Authors" }),
22
- /* @__PURE__ */ jsx("div", { className: "space-y-16", children: authors.map((author, idx) => {
23
- const authorSlug = `${opinlyConfig.blogPrefix}/authors/${author.slug}`;
24
- return /* @__PURE__ */ jsxs(
25
- "div",
26
- {
27
- className: "rounded-lg p-6 flex flex-col gap-6",
28
- children: [
29
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 mb-4", children: [
30
- author.image?.fileKey && /* @__PURE__ */ jsx(Link, { href: authorSlug, children: /* @__PURE__ */ jsx(
31
- Image,
32
- {
33
- src: `${opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
34
- alt: author.image.alt || author.name,
35
- width: 100,
36
- height: 100,
37
- className: "rounded-full border"
38
- }
39
- ) }),
40
- /* @__PURE__ */ jsxs("div", { children: [
41
- /* @__PURE__ */ jsx(Link, { href: authorSlug, children: /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-1", children: author.name }) }),
42
- author.bio && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
43
- ] })
44
- ] }),
45
- /* @__PURE__ */ jsxs("div", { children: [
46
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mb-4", children: author.posts && author.posts.length > 0 ? author.posts.map(
47
- (post) => post && /* @__PURE__ */ jsx(PostPreview, { post }, post.slug)
48
- ) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) }),
49
- /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(
50
- Link,
51
- {
52
- href: `${opinlyConfig.blogPrefix}/authors/${author.slug}`,
53
- className: "text-bold",
54
- children: [
55
- "View more posts from ",
56
- author.name
57
- ]
58
- }
59
- ) })
60
- ] })
61
- ]
62
- },
63
- author.name + idx
64
- );
65
- }) })
66
- ] });
67
- };
68
- export {
69
- AuthorsPage
70
- };
71
- //# sourceMappingURL=index.mjs.map
@@ -1,126 +0,0 @@
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";
7
- function renderTiptapContent(content, classNames) {
8
- if (!content?.content) return [];
9
- return content.content.map((node, index) => {
10
- switch (node.type) {
11
- case "paragraph":
12
- return /* @__PURE__ */ jsx("p", { className: classNames.paragraph || "mb-4", children: renderChildren(node.content, classNames) }, index);
13
- case "heading": {
14
- const text = node.content?.[0]?.text ?? "";
15
- const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
16
- const Tag = `h${node.attrs?.level || 1}`;
17
- return /* @__PURE__ */ jsx(
18
- Tag,
19
- {
20
- id: slug,
21
- className: classNames.heading || "mt-8 mb-4 font-bold text-gray-800",
22
- children: renderChildren(node.content, classNames)
23
- },
24
- index
25
- );
26
- }
27
- case "image":
28
- const fileKey = node.attrs?.fileKey;
29
- if (!fileKey) {
30
- return null;
31
- }
32
- return /* @__PURE__ */ jsx(
33
- "div",
34
- {
35
- className: cn(
36
- "relative w-full max-w-[800px] my-6",
37
- classNames.image
38
- ),
39
- style: { aspectRatio: "2 / 1" },
40
- children: /* @__PURE__ */ jsx(
41
- Image,
42
- {
43
- unoptimized: opinlyConfig.unoptimizedImages,
44
- src: `${opinlyConfig.imagesPrefix}/${fileKey}`,
45
- title: node.attrs?.title || "",
46
- alt: node.attrs?.alt || "",
47
- fill: true,
48
- className: "object-contain rounded-lg",
49
- sizes: "(max-width: 800px) 100vw, 800px"
50
- }
51
- )
52
- },
53
- index
54
- );
55
- case "bulletList":
56
- return /* @__PURE__ */ jsx(
57
- "ul",
58
- {
59
- className: cn("list-disc pl-6 my-4", classNames.bulletList),
60
- children: renderTiptapContent(node, classNames)
61
- },
62
- index
63
- );
64
- case "orderedList":
65
- return /* @__PURE__ */ jsx(
66
- "ol",
67
- {
68
- className: cn("list-decimal pl-6 my-4", classNames.orderedList),
69
- children: renderTiptapContent(node, classNames)
70
- },
71
- index
72
- );
73
- case "listItem":
74
- if (node.content && node.content.length === 1 && node.content[0].type === "paragraph") {
75
- return /* @__PURE__ */ jsx("li", { className: cn("my-1", classNames.listItem), children: renderChildren(node.content[0].content, classNames) }, index);
76
- }
77
- return /* @__PURE__ */ jsx("li", { className: cn("my-1", classNames.listItem), children: renderChildren(node.content, classNames) }, index);
78
- default:
79
- return null;
80
- }
81
- }).filter(Boolean);
82
- }
83
- const Content = ({
84
- content,
85
- classNames
86
- }) => {
87
- return /* @__PURE__ */ jsx("div", { className: "prose min-w-full", children: renderTiptapContent(content, classNames) });
88
- };
89
- function renderChildren(nodes, classNames) {
90
- if (!nodes) {
91
- console.log("no nodes");
92
- return [];
93
- }
94
- return nodes.map((child, idx) => {
95
- if (child.type === "text") {
96
- let text = child.text;
97
- if (child.marks) {
98
- child.marks.forEach((mark) => {
99
- if (mark.type === "bold") text = /* @__PURE__ */ jsx("strong", { children: text }, idx);
100
- if (mark.type === "italic") text = /* @__PURE__ */ jsx("em", { children: text }, idx);
101
- if (mark.type === "link")
102
- text = /* @__PURE__ */ jsx(
103
- Link,
104
- {
105
- href: mark.attrs?.href,
106
- className: classNames.link || "text-blue-600 underline",
107
- children: text
108
- },
109
- idx
110
- );
111
- });
112
- }
113
- return /* @__PURE__ */ jsx("span", { children: text }, idx);
114
- } else {
115
- console.log("child", child);
116
- return /* @__PURE__ */ jsx(React.Fragment, { children: renderTiptapContent(
117
- { ...child, content: child.content },
118
- classNames
119
- ) }, idx);
120
- }
121
- }).filter(Boolean);
122
- }
123
- export {
124
- Content
125
- };
126
- //# sourceMappingURL=content.mjs.map
@@ -1,15 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- const FAQS = ({ faqs }) => {
3
- if (!faqs) return null;
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 })
9
- ] }, faq.question)) })
10
- ] });
11
- };
12
- export {
13
- FAQS
14
- };
15
- //# sourceMappingURL=faq.mjs.map
@@ -1,66 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Facebook, Linkedin, Mail, Twitter } from "lucide-react";
3
- import Link from "next/link";
4
- import { opinlyConfig } from "../../../utils/sdk-config";
5
- const Share = ({ post }) => {
6
- const postUrl = encodeURIComponent(`${opinlyConfig.blogUrl}/${post.slug}`);
7
- return /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mb-6", children: [
8
- /* @__PURE__ */ jsxs(
9
- Link,
10
- {
11
- href: `https://linkedin.com/sharing/share-offsite?url=${postUrl}`,
12
- target: "_blank",
13
- rel: "noopener noreferrer",
14
- className: "border p-1 rounded flex items-center justify-center w-8 h-8",
15
- children: [
16
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on LinkedIn" }),
17
- /* @__PURE__ */ jsx(Linkedin, { className: "w-4 h-4" })
18
- ]
19
- }
20
- ),
21
- /* @__PURE__ */ jsxs(
22
- Link,
23
- {
24
- href: `https://twitter.com/intent/tweet?url=${postUrl}&text=${encodeURIComponent(
25
- `Check out this article by ${post.author?.name}`
26
- )}`,
27
- target: "_blank",
28
- rel: "noopener noreferrer",
29
- className: "border p-1 rounded flex items-center justify-center w-8 h-8",
30
- children: [
31
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on Twitter" }),
32
- /* @__PURE__ */ jsx(Twitter, {})
33
- ]
34
- }
35
- ),
36
- /* @__PURE__ */ jsxs(
37
- Link,
38
- {
39
- href: `https://facebook.com/sharer/sharer.php?u=${postUrl}`,
40
- target: "_blank",
41
- rel: "noopener noreferrer",
42
- className: "border p-1 rounded flex items-center justify-center w-8 h-8",
43
- children: [
44
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share on Facebook" }),
45
- /* @__PURE__ */ jsx(Facebook, {})
46
- ]
47
- }
48
- ),
49
- /* @__PURE__ */ jsxs(
50
- Link,
51
- {
52
- href: `mailto:?body=${encodeURIComponent(`${post.title}
53
- ${postUrl}`)}`,
54
- className: "border p-1 rounded flex items-center justify-center w-8 h-8",
55
- children: [
56
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Share via Email" }),
57
- /* @__PURE__ */ jsx(Mail, { className: "w-4 h-4" })
58
- ]
59
- }
60
- )
61
- ] });
62
- };
63
- export {
64
- Share
65
- };
66
- //# sourceMappingURL=share.mjs.map
@@ -1,48 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { cn } from "../../../utils/merge";
3
- import Image from "next/image";
4
- import { opinlyConfig } from "../../../utils/sdk-config";
5
- import { extractHeadings } from "../_helpers/extract-headings";
6
- import { Share } from "./share";
7
- import Link from "next/link";
8
- const TableOfContents = ({
9
- content,
10
- author,
11
- post
12
- }) => {
13
- return /* @__PURE__ */ jsxs("aside", { className: cn("w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start"), children: [
14
- author && /* @__PURE__ */ jsx("div", { className: "w-full mb-6 border p-4 rounded-md text-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-3", children: [
15
- author.fileKey && /* @__PURE__ */ jsx(
16
- Image,
17
- {
18
- unoptimized: opinlyConfig.unoptimizedImages,
19
- src: `${opinlyConfig.imagesPrefix}/${author.fileKey}`,
20
- alt: author.name,
21
- width: 48,
22
- height: 48,
23
- className: "rounded-full"
24
- }
25
- ),
26
- /* @__PURE__ */ jsxs("div", { children: [
27
- /* @__PURE__ */ jsx(
28
- Link,
29
- {
30
- href: `${opinlyConfig.blogPrefix}/authors/${author.slug}`,
31
- className: "text-xs uppercase text-muted-foreground font-medium",
32
- children: author.name
33
- }
34
- ),
35
- /* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-sm", children: author.bio })
36
- ] })
37
- ] }) }),
38
- /* @__PURE__ */ jsx(Share, { post }),
39
- /* @__PURE__ */ jsxs("div", { className: "border-l-4 border-opinlyAccent pl-4 mb-4", children: [
40
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-2", children: "TABLE OF CONTENTS" }),
41
- /* @__PURE__ */ jsx("ul", { className: "text-sm text-gray-700 space-y-1", children: (extractHeadings(content) || []).map((heading) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: `#${heading.slug}`, className: "hover:underline", children: heading.text }) }, heading.slug)) })
42
- ] })
43
- ] });
44
- };
45
- export {
46
- TableOfContents
47
- };
48
- //# sourceMappingURL=table-of-contents.mjs.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=calc-reading-time.mjs.map
@@ -1,20 +0,0 @@
1
- function extractHeadings(content) {
2
- const headings = [];
3
- if (!content?.content) return headings;
4
- const walk = (nodes) => {
5
- for (const node of nodes) {
6
- if (node.type === "heading" && node.content?.[0]?.text) {
7
- const text = node.content[0].text;
8
- const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
9
- headings.push({ text, slug });
10
- }
11
- if (node.content) walk(node.content);
12
- }
13
- };
14
- walk(content.content);
15
- return headings;
16
- }
17
- export {
18
- extractHeadings
19
- };
20
- //# sourceMappingURL=extract-headings.mjs.map
@@ -1,25 +0,0 @@
1
- const countWords = (content) => {
2
- if (!content?.content) return 0;
3
- let wordCount = 0;
4
- const countWords2 = (nodes) => {
5
- for (const node of nodes) {
6
- if (node.type === "text" && node.text) {
7
- const words = node.text.trim().split(/\s+/).filter(Boolean);
8
- wordCount += words.length;
9
- }
10
- if (node.content) countWords2(node.content);
11
- }
12
- };
13
- countWords2(content.content);
14
- return wordCount;
15
- };
16
- function calculateReadingTime(content) {
17
- const wordCount = countWords(content.content);
18
- const readingTimeMinutes = Math.ceil(wordCount / 200);
19
- return readingTimeMinutes;
20
- }
21
- export {
22
- calculateReadingTime,
23
- countWords
24
- };
25
- //# sourceMappingURL=reading-time.mjs.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=blog-post.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=class-names.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,118 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import Link from "next/link";
3
- import { cn } from "../../utils/merge";
4
- import { opinlyConfig } from "../../utils/sdk-config";
5
- import {
6
- genBlogPostingJSONLD,
7
- genBreadcrumbJSONLD,
8
- genFaqJSONLD
9
- } from "./_helpers/json-ld";
10
- import { FAQS } from "./_components/faq";
11
- import { calculateReadingTime } from "./_helpers/reading-time";
12
- import { Content } from "./_components/content";
13
- import { TableOfContents } from "./_components/table-of-contents";
14
- import { BreadCrumbs } from "../bread-crumbs";
15
- import { formatDate } from "../../utils/dates";
16
- import Script from "next/script";
17
- const BlogPost = ({
18
- post,
19
- classNames = {}
20
- }) => {
21
- const content = post.content;
22
- return /* @__PURE__ */ jsxs(Fragment, { children: [
23
- post.faqs && /* @__PURE__ */ jsx(
24
- Script,
25
- {
26
- strategy: "beforeInteractive",
27
- type: "application/ld+json",
28
- dangerouslySetInnerHTML: {
29
- __html: JSON.stringify(genFaqJSONLD(post.faqs)).replace(
30
- /</g,
31
- "\\u003c"
32
- )
33
- }
34
- }
35
- ),
36
- /* @__PURE__ */ jsx(
37
- Script,
38
- {
39
- strategy: "beforeInteractive",
40
- type: "application/ld+json",
41
- dangerouslySetInnerHTML: {
42
- __html: JSON.stringify(genBlogPostingJSONLD(post))
43
- }
44
- }
45
- ),
46
- /* @__PURE__ */ jsx(
47
- Script,
48
- {
49
- strategy: "beforeInteractive",
50
- type: "application/ld+json",
51
- dangerouslySetInnerHTML: {
52
- __html: JSON.stringify(genBreadcrumbJSONLD(post))
53
- }
54
- }
55
- ),
56
- /* @__PURE__ */ jsx("div", { className: "max-w-7xl mx-auto px-4 py-24 flex items-start space-x-8", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-12 w-full", children: [
57
- /* @__PURE__ */ jsxs("div", { className: "bg-orange-600", children: [
58
- /* @__PURE__ */ jsx(
59
- BreadCrumbs,
60
- {
61
- breadcrumbs: [
62
- post.folder && {
63
- url: `${opinlyConfig.blogPrefix}/${post.folder.slug}`,
64
- name: post.folder.name
65
- }
66
- ]
67
- }
68
- ),
69
- /* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold mb-2 leading-tight", children: post.title }),
70
- /* @__PURE__ */ jsxs("div", { className: "text-sm mb-4", children: [
71
- "Author:",
72
- " ",
73
- /* @__PURE__ */ jsx(
74
- Link,
75
- {
76
- href: `${opinlyConfig.blogPrefix}/authors/${post.author?.slug}`,
77
- className: "font-medium",
78
- children: post.author?.name
79
- }
80
- ),
81
- " ",
82
- "\xB7 ",
83
- calculateReadingTime(content),
84
- " min read \xB7",
85
- " ",
86
- formatDate(post.firstPublishedAt) || "Today"
87
- ] })
88
- ] }),
89
- /* @__PURE__ */ jsxs(
90
- "div",
91
- {
92
- className: cn(
93
- "flex flex-col-reverse md:flex-row mx-auto mt-10 gap-12 relative w-full ",
94
- classNames.container
95
- ),
96
- children: [
97
- /* @__PURE__ */ jsx("article", { className: "w-full lg:w-2/3 order-2 lg:order-1 flex items-start space-x-4", children: /* @__PURE__ */ jsxs("div", { className: "prose w-full", children: [
98
- /* @__PURE__ */ jsx(Content, { content, classNames }),
99
- /* @__PURE__ */ jsx(FAQS, { faqs: post.faqs })
100
- ] }) }),
101
- /* @__PURE__ */ jsx("div", { className: "block md:min-w-72 md:sticky md:top-20 md:self-start", children: /* @__PURE__ */ jsx(
102
- TableOfContents,
103
- {
104
- content,
105
- author: post.author,
106
- post
107
- }
108
- ) })
109
- ]
110
- }
111
- )
112
- ] }) })
113
- ] });
114
- };
115
- export {
116
- BlogPost
117
- };
118
- //# sourceMappingURL=index.mjs.map
@@ -1,26 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import Link from "next/link";
3
- import { Fragment } from "react";
4
- import { opinlyConfig } from "../utils/sdk-config";
5
- const BreadCrumbs = ({
6
- breadcrumbs
7
- }) => {
8
- return /* @__PURE__ */ jsx("nav", { className: "text-sm text-orange-100 text-muted-foreground mb-4", children: /* @__PURE__ */ jsxs("ol", { className: "list-reset flex space-x-2", children: [
9
- /* @__PURE__ */ jsx(Link, { href: "/", className: "font-bold", children: opinlyConfig.siteName }),
10
- /* @__PURE__ */ jsx("span", { children: "/" }),
11
- /* @__PURE__ */ jsx(Link, { href: opinlyConfig.blogPrefix, className: "font-bold", children: "Blog" }),
12
- breadcrumbs?.map((breadcrumb, index) => {
13
- if (!breadcrumb) {
14
- return null;
15
- }
16
- return /* @__PURE__ */ jsxs(Fragment, { children: [
17
- /* @__PURE__ */ jsx("span", { children: "/" }),
18
- breadcrumb.url ? /* @__PURE__ */ jsx(Link, { href: breadcrumb.url, className: "font-bold", children: breadcrumb.name }) : /* @__PURE__ */ jsx("span", { className: "font-bold", children: breadcrumb.name })
19
- ] }, index);
20
- })
21
- ] }) });
22
- };
23
- export {
24
- BreadCrumbs
25
- };
26
- //# sourceMappingURL=bread-crumbs.mjs.map