@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.
- package/dist/components/author-page/_helpers/json-ld.cjs +2 -0
- package/dist/components/author-page/_helpers/json-ld.js +0 -1
- package/dist/components/author-page/index.cjs +84 -0
- package/dist/components/author-page/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/author-page/index.js +23 -57
- package/dist/components/author-page/index.js.map +1 -1
- package/dist/components/authors-page/index.cjs +105 -0
- package/dist/components/authors-page/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/authors-page/index.js +29 -63
- package/dist/components/authors-page/index.js.map +1 -1
- package/dist/components/blog-post/_components/content.cjs +160 -0
- package/dist/components/blog-post/_components/{content.mjs.map → content.cjs.map} +1 -1
- package/dist/components/blog-post/_components/content.js +29 -63
- package/dist/components/blog-post/_components/content.js.map +1 -1
- package/dist/components/blog-post/_components/faq.cjs +39 -0
- package/dist/components/blog-post/_components/{faq.mjs.map → faq.cjs.map} +1 -1
- package/dist/components/blog-post/_components/faq.js +8 -32
- package/dist/components/blog-post/_components/faq.js.map +1 -1
- package/dist/components/blog-post/_components/share.cjs +100 -0
- package/dist/components/blog-post/_components/{share.mjs.map → share.cjs.map} +1 -1
- package/dist/components/blog-post/_components/share.js +24 -58
- package/dist/components/blog-post/_components/share.js.map +1 -1
- package/dist/components/blog-post/_components/table-of-contents.cjs +82 -0
- package/dist/components/blog-post/_components/{table-of-contents.mjs.map → table-of-contents.cjs.map} +1 -1
- package/dist/components/blog-post/_components/table-of-contents.js +24 -58
- package/dist/components/blog-post/_components/table-of-contents.js.map +1 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs +2 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.js +0 -1
- package/dist/components/blog-post/_helpers/extract-headings.cjs +44 -0
- package/dist/components/blog-post/_helpers/{extract-headings.mjs.map → extract-headings.cjs.map} +1 -1
- package/dist/components/blog-post/_helpers/extract-headings.js +2 -26
- package/dist/components/blog-post/_helpers/extract-headings.js.map +1 -1
- package/dist/components/blog-post/_helpers/{json-ld.mjs → json-ld.cjs} +39 -12
- package/dist/components/blog-post/_helpers/{json-ld.mjs.map → json-ld.cjs.map} +1 -1
- package/dist/components/blog-post/_helpers/json-ld.js +11 -38
- package/dist/components/blog-post/_helpers/json-ld.js.map +1 -1
- package/dist/components/blog-post/_helpers/reading-time.cjs +50 -0
- package/dist/components/blog-post/_helpers/{reading-time.mjs.map → reading-time.cjs.map} +1 -1
- package/dist/components/blog-post/_helpers/reading-time.js +2 -27
- package/dist/components/blog-post/_helpers/reading-time.js.map +1 -1
- package/dist/components/blog-post/_types/blog-post.cjs +17 -0
- package/dist/components/blog-post/_types/blog-post.cjs.map +1 -0
- package/dist/components/blog-post/_types/blog-post.js +0 -16
- package/dist/components/blog-post/_types/blog-post.js.map +1 -1
- package/dist/components/blog-post/_types/class-names.cjs +17 -0
- package/dist/components/blog-post/_types/class-names.cjs.map +1 -0
- package/dist/components/blog-post/_types/class-names.js +0 -16
- package/dist/components/blog-post/_types/class-names.js.map +1 -1
- package/dist/components/blog-post/index.cjs +148 -0
- package/dist/components/blog-post/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/blog-post/index.js +47 -77
- package/dist/components/blog-post/index.js.map +1 -1
- package/dist/components/bread-crumbs.cjs +60 -0
- package/dist/components/{bread-crumbs.mjs.map → bread-crumbs.cjs.map} +1 -1
- package/dist/components/bread-crumbs.js +13 -47
- package/dist/components/bread-crumbs.js.map +1 -1
- package/dist/components/folder-page/index.cjs +61 -0
- package/dist/components/folder-page/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/folder-page/index.js +12 -36
- package/dist/components/folder-page/index.js.map +1 -1
- package/dist/components/home-page/folders.cjs +98 -0
- package/dist/components/home-page/{folders.mjs.map → folders.cjs.map} +1 -1
- package/dist/components/home-page/folders.js +29 -64
- package/dist/components/home-page/folders.js.map +1 -1
- package/dist/components/home-page/index.cjs +44 -0
- package/dist/components/home-page/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/components/home-page/index.js +11 -35
- package/dist/components/home-page/index.js.map +1 -1
- package/dist/components/home-page/pagination.cjs +91 -0
- package/dist/components/home-page/{pagination.mjs.map → pagination.cjs.map} +1 -1
- package/dist/components/home-page/pagination.js +9 -43
- package/dist/components/home-page/pagination.js.map +1 -1
- package/dist/components/home-page/top-posts.cjs +52 -0
- package/dist/components/home-page/{top-posts.mjs.map → top-posts.cjs.map} +1 -1
- package/dist/components/home-page/top-posts.js +10 -34
- package/dist/components/home-page/top-posts.js.map +1 -1
- package/dist/components/not-found.cjs +60 -0
- package/dist/components/{not-found.mjs.map → not-found.cjs.map} +1 -1
- package/dist/components/not-found.js +15 -49
- package/dist/components/not-found.js.map +1 -1
- package/dist/components/opinly-blog.cjs +57 -0
- package/dist/components/{opinly-blog.mjs.map → opinly-blog.cjs.map} +1 -1
- package/dist/components/opinly-blog.js +15 -39
- package/dist/components/opinly-blog.js.map +1 -1
- package/dist/components/post-preview.cjs +112 -0
- package/dist/components/{post-preview.mjs.map → post-preview.cjs.map} +1 -1
- package/dist/components/post-preview.js +42 -77
- package/dist/components/post-preview.js.map +1 -1
- package/dist/index.cjs +25 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -22
- package/dist/index.js.map +1 -1
- package/dist/utils/dates.cjs +33 -0
- package/dist/utils/{dates.mjs.map → dates.cjs.map} +1 -1
- package/dist/utils/dates.js +2 -26
- package/dist/utils/dates.js.map +1 -1
- package/dist/utils/generate-metadata.cjs +62 -0
- package/dist/utils/generate-metadata.cjs.map +1 -0
- package/dist/utils/generate-metadata.js +9 -31
- package/dist/utils/generate-metadata.js.map +1 -1
- package/dist/utils/merge.cjs +33 -0
- package/dist/utils/{merge.mjs.map → merge.cjs.map} +1 -1
- package/dist/utils/merge.js +5 -29
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/sdk-config.cjs +51 -0
- package/dist/utils/sdk-config.cjs.map +1 -0
- package/dist/utils/sdk-config.d.cts +10 -2
- package/dist/utils/sdk-config.d.ts +10 -2
- package/dist/utils/sdk-config.js +3 -34
- package/dist/utils/sdk-config.js.map +1 -1
- package/dist/utils/with-opinly-config.cjs +115 -0
- package/dist/utils/with-opinly-config.cjs.map +1 -0
- package/dist/utils/with-opinly-config.d.cts +39 -0
- package/dist/utils/with-opinly-config.d.ts +39 -0
- package/dist/utils/with-opinly-config.js +91 -0
- package/dist/utils/with-opinly-config.js.map +1 -0
- package/package.json +3 -2
- package/dist/components/author-page/_helpers/json-ld.mjs +0 -1
- package/dist/components/author-page/index.mjs +0 -50
- package/dist/components/authors-page/index.mjs +0 -71
- package/dist/components/blog-post/_components/content.mjs +0 -126
- package/dist/components/blog-post/_components/faq.mjs +0 -15
- package/dist/components/blog-post/_components/share.mjs +0 -66
- package/dist/components/blog-post/_components/table-of-contents.mjs +0 -48
- package/dist/components/blog-post/_helpers/calc-reading-time.mjs +0 -1
- package/dist/components/blog-post/_helpers/extract-headings.mjs +0 -20
- package/dist/components/blog-post/_helpers/reading-time.mjs +0 -25
- package/dist/components/blog-post/_types/blog-post.mjs +0 -1
- package/dist/components/blog-post/_types/blog-post.mjs.map +0 -1
- package/dist/components/blog-post/_types/class-names.mjs +0 -1
- package/dist/components/blog-post/_types/class-names.mjs.map +0 -1
- package/dist/components/blog-post/index.mjs +0 -118
- package/dist/components/bread-crumbs.mjs +0 -26
- package/dist/components/folder-page/index.mjs +0 -37
- package/dist/components/home-page/folders.mjs +0 -63
- package/dist/components/home-page/index.mjs +0 -20
- package/dist/components/home-page/pagination.mjs +0 -57
- package/dist/components/home-page/top-posts.mjs +0 -28
- package/dist/components/not-found.mjs +0 -26
- package/dist/components/opinly-blog.mjs +0 -33
- package/dist/components/post-preview.mjs +0 -77
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +0 -1
- package/dist/utils/dates.mjs +0 -9
- package/dist/utils/generate-metadata.mjs +0 -36
- package/dist/utils/generate-metadata.mjs.map +0 -1
- package/dist/utils/merge.mjs +0 -9
- package/dist/utils/sdk-config.mjs +0 -32
- package/dist/utils/sdk-config.mjs.map +0 -1
- /package/dist/components/author-page/_helpers/{json-ld.mjs.map → json-ld.cjs.map} +0 -0
- /package/dist/components/blog-post/_helpers/{calc-reading-time.mjs.map → calc-reading-time.cjs.map} +0 -0
|
@@ -1,112 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 post_preview_exports = {};
|
|
30
|
-
__export(post_preview_exports, {
|
|
31
|
-
PostPreview: () => PostPreview,
|
|
32
|
-
PostPreviewSkeleton: () => PostPreviewSkeleton
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(post_preview_exports);
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
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_dates = require("../utils/dates");
|
|
40
|
-
const PostPreviewSkeleton = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full h-full ", children: [
|
|
41
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse mb-5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg" }) }),
|
|
42
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center space-x-2 text-sm text-muted-foreground mb-3", children: [
|
|
43
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
44
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-4 w-1 bg-gray-200 dark:bg-gray-700 rounded-full" }),
|
|
45
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-pulse h-4 w-16 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import Image from "next/image";
|
|
4
|
+
import { opinlyConfig } from "../utils/sdk-config";
|
|
5
|
+
import { formatDate } from "../utils/dates";
|
|
6
|
+
const PostPreviewSkeleton = () => /* @__PURE__ */ jsxs("div", { className: "w-full h-full ", children: [
|
|
7
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse mb-5", children: /* @__PURE__ */ jsx("div", { className: "w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg" }) }),
|
|
8
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2 text-sm text-muted-foreground mb-3", children: [
|
|
9
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
10
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-1 bg-gray-200 dark:bg-gray-700 rounded-full" }),
|
|
11
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-16 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
46
12
|
] }),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded mb-2" }),
|
|
14
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 mt-1 pr-4", children: [
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-full bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
16
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-4 w-10/12 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
51
17
|
] }),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
18
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2 text-xs text-gray-500 mt-2", children: [
|
|
19
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-3 w-24 bg-gray-200 dark:bg-gray-700 rounded" }),
|
|
20
|
+
/* @__PURE__ */ jsx("div", { className: "animate-pulse h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded" })
|
|
55
21
|
] })
|
|
56
22
|
] });
|
|
57
23
|
const PostPreview = ({
|
|
58
24
|
post
|
|
59
25
|
}) => {
|
|
60
|
-
const postSlug = `${
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
post.image?.fileKey && /* @__PURE__ */
|
|
63
|
-
|
|
26
|
+
const postSlug = `${opinlyConfig.blogPrefix}/${post.folder?.slug ? `${post.folder.slug}/` : ""}${post.slug}`;
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full ", children: [
|
|
28
|
+
post.image?.fileKey && /* @__PURE__ */ jsx(Link, { href: postSlug, className: "group", children: /* @__PURE__ */ jsx("div", { className: "relative w-full h-48 mb-4", children: /* @__PURE__ */ jsx(
|
|
29
|
+
Image,
|
|
64
30
|
{
|
|
65
|
-
unoptimized:
|
|
66
|
-
src: `${
|
|
31
|
+
unoptimized: opinlyConfig.unoptimizedImages,
|
|
32
|
+
src: `${opinlyConfig.imagesPrefix}/${post.image.fileKey}`,
|
|
67
33
|
alt: post.title,
|
|
68
34
|
fill: true,
|
|
69
35
|
className: "object-cover rounded-lg"
|
|
70
36
|
}
|
|
71
37
|
) }) }),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
post.folder?.name && /* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
38
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground mb-1", children: [
|
|
39
|
+
post.folder?.name && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
Link,
|
|
76
42
|
{
|
|
77
|
-
href: `${
|
|
43
|
+
href: `${opinlyConfig.blogPrefix}/${post.folder.slug}`,
|
|
78
44
|
className: "hover:underline",
|
|
79
45
|
children: post.folder.name
|
|
80
46
|
}
|
|
81
47
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: "mx-1", children: "\xB7" })
|
|
83
49
|
] }),
|
|
84
50
|
" ",
|
|
85
|
-
|
|
51
|
+
formatDate(post.firstPublishedAt)
|
|
86
52
|
] }),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
post.description && /* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
post.author && /* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
53
|
+
/* @__PURE__ */ jsx(Link, { href: postSlug, className: "group", children: /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold leading-snug group-hover:underline", children: post.title }) }),
|
|
54
|
+
post.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mt-1 line-clamp-2", children: post.description }),
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500 mt-2", children: [
|
|
56
|
+
post.author && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Link,
|
|
93
59
|
{
|
|
94
|
-
href: `${
|
|
60
|
+
href: `${opinlyConfig.blogPrefix}/authors/${post.author.slug}`,
|
|
95
61
|
className: "font-medium hover:underline",
|
|
96
62
|
children: post.author?.name
|
|
97
63
|
}
|
|
98
64
|
),
|
|
99
65
|
" ",
|
|
100
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ jsx("span", { className: "mx-1", children: "\xB7" })
|
|
101
67
|
] }),
|
|
102
68
|
" ",
|
|
103
|
-
|
|
69
|
+
formatDate(post.firstPublishedAt)
|
|
104
70
|
] })
|
|
105
71
|
] });
|
|
106
72
|
};
|
|
107
|
-
|
|
108
|
-
0 && (module.exports = {
|
|
73
|
+
export {
|
|
109
74
|
PostPreview,
|
|
110
75
|
PostPreviewSkeleton
|
|
111
|
-
}
|
|
76
|
+
};
|
|
112
77
|
//# sourceMappingURL=post-preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/post-preview.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../utils/sdk-config\";\nimport { formatDate } from \"../utils/dates\";\n\nexport const PostPreviewSkeleton: React.FC = () => (\n <div className=\"w-full h-full \">\n {/* Image placeholder (with same mb-4 as real) */}\n <div className=\"animate-pulse mb-5\">\n <div className=\"w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg\" />\n </div>\n\n {/* Folder · dot · date (text-sm text-muted-foreground mb-1) */}\n <div className=\"flex items-center space-x-2 text-sm text-muted-foreground mb-3\">\n <div className=\"animate-pulse h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-4 w-1 bg-gray-200 dark:bg-gray-700 rounded-full\" />\n <div className=\"animate-pulse h-4 w-16 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n\n {/* Title (text-lg font-semibold leading-snug) */}\n <div className=\"animate-pulse h-5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded mb-2\" />\n\n {/* Description (text-sm mt-1 line-clamp-2) */}\n <div className=\"space-y-1 mt-1 pr-4\">\n <div className=\"animate-pulse h-4 w-full bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-4 w-10/12 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n\n {/* Author · date (text-xs text-gray-500 mt-2 flex items-center space-x-2) */}\n <div className=\"flex items-center space-x-2 text-xs text-gray-500 mt-2\">\n <div className=\"animate-pulse h-3 w-24 bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n </div>\n);\nexport const PostPreview = ({\n post,\n}: {\n post: NonNullable<\n NonNullable<\n Awaited<\n ReturnType<Opinly[\"client\"][\"content\"][\"authorPage\"][\"query\"]>\n >[\"data\"]\n >[\"posts\"][number]\n >;\n}) => {\n const postSlug = `${opinlyConfig.blogPrefix}/${post.folder?.slug ? `${post.folder.slug}/` : \"\"}${post.slug}`;\n\n return (\n <div className=\"w-full h-full \">\n {post.image?.fileKey && (\n <Link href={postSlug} className=\"group\">\n <div className=\"relative w-full h-48 mb-4\">\n <Image\n unoptimized={opinlyConfig.unoptimizedImages}\n src={`${opinlyConfig.imagesPrefix}/${post.image.fileKey}`}\n alt={post.title}\n fill\n className=\"object-cover rounded-lg\"\n />\n </div>\n </Link>\n )}\n <div className=\"text-sm text-muted-foreground mb-1\">\n {post.folder?.name && (\n <>\n <Link\n href={`${opinlyConfig.blogPrefix}/${post.folder.slug}`}\n className=\"hover:underline\"\n >\n {post.folder.name}\n </Link>\n <span className=\"mx-1\">·</span>\n </>\n )}{\" \"}\n {formatDate(post.firstPublishedAt as string)}\n </div>\n <Link href={postSlug} className=\"group\">\n <h2 className=\"text-lg font-semibold leading-snug group-hover:underline\">\n {post.title}\n </h2>\n </Link>\n\n {post.description && (\n <p className=\"text-sm text-gray-600 mt-1 line-clamp-2\">\n {post.description}\n </p>\n )}\n <div className=\"text-xs text-gray-500 mt-2\">\n {post.author && (\n <>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${post.author.slug}`}\n className=\"font-medium hover:underline\"\n >\n {post.author?.name}\n </Link>{\" \"}\n <span className=\"mx-1\">·</span>\n </>\n )}{\" \"}\n {formatDate(post.firstPublishedAt as string)}\n </div>\n </div>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/post-preview.tsx"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../utils/sdk-config\";\nimport { formatDate } from \"../utils/dates\";\n\nexport const PostPreviewSkeleton: React.FC = () => (\n <div className=\"w-full h-full \">\n {/* Image placeholder (with same mb-4 as real) */}\n <div className=\"animate-pulse mb-5\">\n <div className=\"w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg\" />\n </div>\n\n {/* Folder · dot · date (text-sm text-muted-foreground mb-1) */}\n <div className=\"flex items-center space-x-2 text-sm text-muted-foreground mb-3\">\n <div className=\"animate-pulse h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-4 w-1 bg-gray-200 dark:bg-gray-700 rounded-full\" />\n <div className=\"animate-pulse h-4 w-16 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n\n {/* Title (text-lg font-semibold leading-snug) */}\n <div className=\"animate-pulse h-5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded mb-2\" />\n\n {/* Description (text-sm mt-1 line-clamp-2) */}\n <div className=\"space-y-1 mt-1 pr-4\">\n <div className=\"animate-pulse h-4 w-full bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-4 w-10/12 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n\n {/* Author · date (text-xs text-gray-500 mt-2 flex items-center space-x-2) */}\n <div className=\"flex items-center space-x-2 text-xs text-gray-500 mt-2\">\n <div className=\"animate-pulse h-3 w-24 bg-gray-200 dark:bg-gray-700 rounded\" />\n <div className=\"animate-pulse h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded\" />\n </div>\n </div>\n);\nexport const PostPreview = ({\n post,\n}: {\n post: NonNullable<\n NonNullable<\n Awaited<\n ReturnType<Opinly[\"client\"][\"content\"][\"authorPage\"][\"query\"]>\n >[\"data\"]\n >[\"posts\"][number]\n >;\n}) => {\n const postSlug = `${opinlyConfig.blogPrefix}/${post.folder?.slug ? `${post.folder.slug}/` : \"\"}${post.slug}`;\n\n return (\n <div className=\"w-full h-full \">\n {post.image?.fileKey && (\n <Link href={postSlug} className=\"group\">\n <div className=\"relative w-full h-48 mb-4\">\n <Image\n unoptimized={opinlyConfig.unoptimizedImages}\n src={`${opinlyConfig.imagesPrefix}/${post.image.fileKey}`}\n alt={post.title}\n fill\n className=\"object-cover rounded-lg\"\n />\n </div>\n </Link>\n )}\n <div className=\"text-sm text-muted-foreground mb-1\">\n {post.folder?.name && (\n <>\n <Link\n href={`${opinlyConfig.blogPrefix}/${post.folder.slug}`}\n className=\"hover:underline\"\n >\n {post.folder.name}\n </Link>\n <span className=\"mx-1\">·</span>\n </>\n )}{\" \"}\n {formatDate(post.firstPublishedAt as string)}\n </div>\n <Link href={postSlug} className=\"group\">\n <h2 className=\"text-lg font-semibold leading-snug group-hover:underline\">\n {post.title}\n </h2>\n </Link>\n\n {post.description && (\n <p className=\"text-sm text-gray-600 mt-1 line-clamp-2\">\n {post.description}\n </p>\n )}\n <div className=\"text-xs text-gray-500 mt-2\">\n {post.author && (\n <>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${post.author.slug}`}\n className=\"font-medium hover:underline\"\n >\n {post.author?.name}\n </Link>{\" \"}\n <span className=\"mx-1\">·</span>\n </>\n )}{\" \"}\n {formatDate(post.firstPublishedAt as string)}\n </div>\n </div>\n );\n};\n"],"mappings":"AAUM,SAwDI,UAxDJ,KAIF,YAJE;AATN,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAEpB,MAAM,sBAAgC,MAC3C,qBAAC,SAAI,WAAU,kBAEb;AAAA,sBAAC,SAAI,WAAU,sBACb,8BAAC,SAAI,WAAU,uDAAsD,GACvE;AAAA,EAGA,qBAAC,SAAI,WAAU,kEACb;AAAA,wBAAC,SAAI,WAAU,+DAA8D;AAAA,IAC7E,oBAAC,SAAI,WAAU,mEAAkE;AAAA,IACjF,oBAAC,SAAI,WAAU,+DAA8D;AAAA,KAC/E;AAAA,EAGA,oBAAC,SAAI,WAAU,qEAAoE;AAAA,EAGnF,qBAAC,SAAI,WAAU,uBACb;AAAA,wBAAC,SAAI,WAAU,iEAAgE;AAAA,IAC/E,oBAAC,SAAI,WAAU,kEAAiE;AAAA,KAClF;AAAA,EAGA,qBAAC,SAAI,WAAU,0DACb;AAAA,wBAAC,SAAI,WAAU,+DAA8D;AAAA,IAC7E,oBAAC,SAAI,WAAU,+DAA8D;AAAA,KAC/E;AAAA,GACF;AAEK,MAAM,cAAc,CAAC;AAAA,EAC1B;AACF,MAQM;AACJ,QAAM,WAAW,GAAG,aAAa,UAAU,IAAI,KAAK,QAAQ,OAAO,GAAG,KAAK,OAAO,IAAI,MAAM,EAAE,GAAG,KAAK,IAAI;AAE1G,SACE,qBAAC,SAAI,WAAU,kBACZ;AAAA,SAAK,OAAO,WACX,oBAAC,QAAK,MAAM,UAAU,WAAU,SAC9B,8BAAC,SAAI,WAAU,6BACb;AAAA,MAAC;AAAA;AAAA,QACC,aAAa,aAAa;AAAA,QAC1B,KAAK,GAAG,aAAa,YAAY,IAAI,KAAK,MAAM,OAAO;AAAA,QACvD,KAAK,KAAK;AAAA,QACV,MAAI;AAAA,QACJ,WAAU;AAAA;AAAA,IACZ,GACF,GACF;AAAA,IAEF,qBAAC,SAAI,WAAU,sCACZ;AAAA,WAAK,QAAQ,QACZ,iCACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,GAAG,aAAa,UAAU,IAAI,KAAK,OAAO,IAAI;AAAA,YACpD,WAAU;AAAA,YAET,eAAK,OAAO;AAAA;AAAA,QACf;AAAA,QACA,oBAAC,UAAK,WAAU,QAAO,kBAAC;AAAA,SAC1B;AAAA,MACC;AAAA,MACF,WAAW,KAAK,gBAA0B;AAAA,OAC7C;AAAA,IACA,oBAAC,QAAK,MAAM,UAAU,WAAU,SAC9B,8BAAC,QAAG,WAAU,4DACX,eAAK,OACR,GACF;AAAA,IAEC,KAAK,eACJ,oBAAC,OAAE,WAAU,2CACV,eAAK,aACR;AAAA,IAEF,qBAAC,SAAI,WAAU,8BACZ;AAAA,WAAK,UACJ,iCACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,GAAG,aAAa,UAAU,YAAY,KAAK,OAAO,IAAI;AAAA,YAC5D,WAAU;AAAA,YAET,eAAK,QAAQ;AAAA;AAAA,QAChB;AAAA,QAAQ;AAAA,QACR,oBAAC,UAAK,WAAU,QAAO,kBAAC;AAAA,SAC1B;AAAA,MACC;AAAA,MACF,WAAW,KAAK,gBAA0B;AAAA,OAC7C;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var index_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(index_exports);
|
|
18
|
+
__reExport(index_exports, require("./components/opinly-blog"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./utils/with-opinly-config"), module.exports);
|
|
20
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
+
0 && (module.exports = {
|
|
22
|
+
...require("./components/opinly-blog"),
|
|
23
|
+
...require("./utils/with-opinly-config")
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components/opinly-blog\";\n\nexport * from \"./utils/with-opinly-config\";\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,qCAAd;AAEA,0BAAc,uCAFd;","names":[]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var index_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(index_exports);
|
|
18
|
-
__reExport(index_exports, require("./components/opinly-blog"), module.exports);
|
|
19
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
-
0 && (module.exports = {
|
|
21
|
-
...require("./components/opinly-blog")
|
|
22
|
-
});
|
|
1
|
+
export * from "./components/opinly-blog";
|
|
2
|
+
export * from "./utils/with-opinly-config";
|
|
23
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components/opinly-blog\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components/opinly-blog\";\n\nexport * from \"./utils/with-opinly-config\";\n"],"mappings":"AAAA,cAAc;AAEd,cAAc;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 dates_exports = {};
|
|
20
|
+
__export(dates_exports, {
|
|
21
|
+
formatDate: () => formatDate
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(dates_exports);
|
|
24
|
+
const formatDate = (iso) => new Date(iso).toLocaleDateString("en-US", {
|
|
25
|
+
month: "short",
|
|
26
|
+
day: "2-digit",
|
|
27
|
+
year: "numeric"
|
|
28
|
+
});
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
formatDate
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=dates.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/dates.ts"],"sourcesContent":["export const formatDate = (iso: string) =>\n new Date(iso).toLocaleDateString(\"en-US\", {\n month: \"short\",\n day: \"2-digit\",\n year: \"numeric\",\n });\n"],"mappings":"AAAO,MAAM,aAAa,CAAC,QACzB,IAAI,KAAK,GAAG,EAAE,mBAAmB,SAAS;AAAA,EACxC,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/dates.ts"],"sourcesContent":["export const formatDate = (iso: string) =>\n new Date(iso).toLocaleDateString(\"en-US\", {\n month: \"short\",\n day: \"2-digit\",\n year: \"numeric\",\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa,CAAC,QACzB,IAAI,KAAK,GAAG,EAAE,mBAAmB,SAAS;AAAA,EACxC,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC;","names":[]}
|
package/dist/utils/dates.js
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
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 dates_exports = {};
|
|
20
|
-
__export(dates_exports, {
|
|
21
|
-
formatDate: () => formatDate
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(dates_exports);
|
|
24
1
|
const formatDate = (iso) => new Date(iso).toLocaleDateString("en-US", {
|
|
25
2
|
month: "short",
|
|
26
3
|
day: "2-digit",
|
|
27
4
|
year: "numeric"
|
|
28
5
|
});
|
|
29
|
-
|
|
30
|
-
0 && (module.exports = {
|
|
6
|
+
export {
|
|
31
7
|
formatDate
|
|
32
|
-
}
|
|
8
|
+
};
|
|
33
9
|
//# sourceMappingURL=dates.js.map
|
package/dist/utils/dates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/dates.ts"],"sourcesContent":["export const formatDate = (iso: string) =>\n new Date(iso).toLocaleDateString(\"en-US\", {\n month: \"short\",\n day: \"2-digit\",\n year: \"numeric\",\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/dates.ts"],"sourcesContent":["export const formatDate = (iso: string) =>\n new Date(iso).toLocaleDateString(\"en-US\", {\n month: \"short\",\n day: \"2-digit\",\n year: \"numeric\",\n });\n"],"mappings":"AAAO,MAAM,aAAa,CAAC,QACzB,IAAI,KAAK,GAAG,EAAE,mBAAmB,SAAS;AAAA,EACxC,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC;","names":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 generate_metadata_exports = {};
|
|
20
|
+
__export(generate_metadata_exports, {
|
|
21
|
+
generateOpinlyMetadata: () => generateOpinlyMetadata
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(generate_metadata_exports);
|
|
24
|
+
var import_sdk_config = require("./sdk-config");
|
|
25
|
+
const generateOpinlyMetadata = async (client, params, parent) => {
|
|
26
|
+
const blog = await client.content.blog({ params: await params });
|
|
27
|
+
if (blog.type === "not-found") {
|
|
28
|
+
return parent;
|
|
29
|
+
}
|
|
30
|
+
const previousImages = (await parent).openGraph?.images || [];
|
|
31
|
+
if (blog.type === "post") {
|
|
32
|
+
const openGraphImageKey = blog.data?.titleFile?.fileKey;
|
|
33
|
+
const images = openGraphImageKey ? [`${import_sdk_config.opinlyConfig.imagesPrefix}/${openGraphImageKey}`, ...previousImages] : previousImages;
|
|
34
|
+
return {
|
|
35
|
+
...parent,
|
|
36
|
+
title: blog.data.title,
|
|
37
|
+
description: blog.data.description,
|
|
38
|
+
openGraph: {
|
|
39
|
+
images,
|
|
40
|
+
type: "article",
|
|
41
|
+
authors: blog.data.author && [
|
|
42
|
+
`${import_sdk_config.opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`
|
|
43
|
+
],
|
|
44
|
+
title: blog.data.title
|
|
45
|
+
},
|
|
46
|
+
// keywords: [blog.data.keywords],
|
|
47
|
+
authors: blog.data.author && [
|
|
48
|
+
{
|
|
49
|
+
name: blog.data.author.name,
|
|
50
|
+
url: `${import_sdk_config.opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
other: {}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return parent;
|
|
57
|
+
};
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
generateOpinlyMetadata
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=generate-metadata.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/generate-metadata.ts"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport type { Metadata, ResolvingMetadata } from \"next\";\nimport { opinlyConfig } from \"./sdk-config\";\n\nexport const generateOpinlyMetadata = async (\n client: Opinly,\n params: Promise<{\n slug: string[];\n }>,\n parent: ResolvingMetadata\n): Promise<Metadata> => {\n const blog = await client.content.blog({ params: await params });\n\n if (blog.type === \"not-found\") {\n return parent as Metadata;\n }\n\n const previousImages = (await parent).openGraph?.images || [];\n\n if (blog.type === \"post\") {\n const openGraphImageKey = blog.data?.titleFile?.fileKey;\n\n const images = openGraphImageKey\n ? [`${opinlyConfig.imagesPrefix}/${openGraphImageKey}`, ...previousImages]\n : previousImages;\n\n return {\n ...(parent as Metadata),\n title: blog.data.title,\n description: blog.data.description,\n openGraph: {\n images: images,\n type: \"article\",\n authors: blog.data.author && [\n `${opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`,\n ],\n title: blog.data.title,\n },\n // keywords: [blog.data.keywords],\n\n authors: blog.data.author && [\n {\n name: blog.data.author.name,\n url: `${opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`,\n },\n ],\n other: {},\n };\n }\n\n return parent as Metadata;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wBAA6B;AAEtB,MAAM,yBAAyB,OACpC,QACA,QAGA,WACsB;AACtB,QAAM,OAAO,MAAM,OAAO,QAAQ,KAAK,EAAE,QAAQ,MAAM,OAAO,CAAC;AAE/D,MAAI,KAAK,SAAS,aAAa;AAC7B,WAAO;AAAA,EACT;AAEA,QAAM,kBAAkB,MAAM,QAAQ,WAAW,UAAU,CAAC;AAE5D,MAAI,KAAK,SAAS,QAAQ;AACxB,UAAM,oBAAoB,KAAK,MAAM,WAAW;AAEhD,UAAM,SAAS,oBACX,CAAC,GAAG,+BAAa,YAAY,IAAI,iBAAiB,IAAI,GAAG,cAAc,IACvE;AAEJ,WAAO;AAAA,MACL,GAAI;AAAA,MACJ,OAAO,KAAK,KAAK;AAAA,MACjB,aAAa,KAAK,KAAK;AAAA,MACvB,WAAW;AAAA,QACT;AAAA,QACA,MAAM;AAAA,QACN,SAAS,KAAK,KAAK,UAAU;AAAA,UAC3B,GAAG,+BAAa,YAAY,YAAY,KAAK,KAAK,OAAO,IAAI;AAAA,QAC/D;AAAA,QACA,OAAO,KAAK,KAAK;AAAA,MACnB;AAAA;AAAA,MAGA,SAAS,KAAK,KAAK,UAAU;AAAA,QAC3B;AAAA,UACE,MAAM,KAAK,KAAK,OAAO;AAAA,UACvB,KAAK,GAAG,+BAAa,YAAY,YAAY,KAAK,KAAK,OAAO,IAAI;AAAA,QACpE;AAAA,MACF;AAAA,MACA,OAAO,CAAC;AAAA,IACV;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
|
|
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 generate_metadata_exports = {};
|
|
20
|
-
__export(generate_metadata_exports, {
|
|
21
|
-
generateOpinlyMetadata: () => generateOpinlyMetadata
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(generate_metadata_exports);
|
|
24
|
-
var import_sdk_config = require("./sdk-config");
|
|
1
|
+
import { opinlyConfig } from "./sdk-config";
|
|
25
2
|
const generateOpinlyMetadata = async (client, params, parent) => {
|
|
26
3
|
const blog = await client.content.blog({ params: await params });
|
|
27
4
|
if (blog.type === "not-found") {
|
|
@@ -30,22 +7,24 @@ const generateOpinlyMetadata = async (client, params, parent) => {
|
|
|
30
7
|
const previousImages = (await parent).openGraph?.images || [];
|
|
31
8
|
if (blog.type === "post") {
|
|
32
9
|
const openGraphImageKey = blog.data?.titleFile?.fileKey;
|
|
33
|
-
const images = openGraphImageKey ? [`${
|
|
10
|
+
const images = openGraphImageKey ? [`${opinlyConfig.imagesPrefix}/${openGraphImageKey}`, ...previousImages] : previousImages;
|
|
34
11
|
return {
|
|
35
12
|
...parent,
|
|
36
13
|
title: blog.data.title,
|
|
14
|
+
description: blog.data.description,
|
|
37
15
|
openGraph: {
|
|
38
16
|
images,
|
|
39
17
|
type: "article",
|
|
40
18
|
authors: blog.data.author && [
|
|
41
|
-
`${
|
|
42
|
-
]
|
|
19
|
+
`${opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`
|
|
20
|
+
],
|
|
21
|
+
title: blog.data.title
|
|
43
22
|
},
|
|
44
23
|
// keywords: [blog.data.keywords],
|
|
45
24
|
authors: blog.data.author && [
|
|
46
25
|
{
|
|
47
26
|
name: blog.data.author.name,
|
|
48
|
-
url: `${
|
|
27
|
+
url: `${opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`
|
|
49
28
|
}
|
|
50
29
|
],
|
|
51
30
|
other: {}
|
|
@@ -53,8 +32,7 @@ const generateOpinlyMetadata = async (client, params, parent) => {
|
|
|
53
32
|
}
|
|
54
33
|
return parent;
|
|
55
34
|
};
|
|
56
|
-
|
|
57
|
-
0 && (module.exports = {
|
|
35
|
+
export {
|
|
58
36
|
generateOpinlyMetadata
|
|
59
|
-
}
|
|
37
|
+
};
|
|
60
38
|
//# sourceMappingURL=generate-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/generate-metadata.ts"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport type { Metadata, ResolvingMetadata } from \"next\";\nimport { opinlyConfig } from \"./sdk-config\";\n\nexport const generateOpinlyMetadata = async (\n client: Opinly,\n params: Promise<{\n slug: string[];\n }>,\n parent: ResolvingMetadata\n): Promise<Metadata> => {\n const blog = await client.content.blog({ params: await params });\n\n if (blog.type === \"not-found\") {\n return parent as Metadata;\n }\n\n const previousImages = (await parent).openGraph?.images || [];\n\n if (blog.type === \"post\") {\n const openGraphImageKey = blog.data?.titleFile?.fileKey;\n\n const images = openGraphImageKey\n ? [`${opinlyConfig.
|
|
1
|
+
{"version":3,"sources":["../../src/utils/generate-metadata.ts"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport type { Metadata, ResolvingMetadata } from \"next\";\nimport { opinlyConfig } from \"./sdk-config\";\n\nexport const generateOpinlyMetadata = async (\n client: Opinly,\n params: Promise<{\n slug: string[];\n }>,\n parent: ResolvingMetadata\n): Promise<Metadata> => {\n const blog = await client.content.blog({ params: await params });\n\n if (blog.type === \"not-found\") {\n return parent as Metadata;\n }\n\n const previousImages = (await parent).openGraph?.images || [];\n\n if (blog.type === \"post\") {\n const openGraphImageKey = blog.data?.titleFile?.fileKey;\n\n const images = openGraphImageKey\n ? [`${opinlyConfig.imagesPrefix}/${openGraphImageKey}`, ...previousImages]\n : previousImages;\n\n return {\n ...(parent as Metadata),\n title: blog.data.title,\n description: blog.data.description,\n openGraph: {\n images: images,\n type: \"article\",\n authors: blog.data.author && [\n `${opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`,\n ],\n title: blog.data.title,\n },\n // keywords: [blog.data.keywords],\n\n authors: blog.data.author && [\n {\n name: blog.data.author.name,\n url: `${opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`,\n },\n ],\n other: {},\n };\n }\n\n return parent as Metadata;\n};\n"],"mappings":"AAEA,SAAS,oBAAoB;AAEtB,MAAM,yBAAyB,OACpC,QACA,QAGA,WACsB;AACtB,QAAM,OAAO,MAAM,OAAO,QAAQ,KAAK,EAAE,QAAQ,MAAM,OAAO,CAAC;AAE/D,MAAI,KAAK,SAAS,aAAa;AAC7B,WAAO;AAAA,EACT;AAEA,QAAM,kBAAkB,MAAM,QAAQ,WAAW,UAAU,CAAC;AAE5D,MAAI,KAAK,SAAS,QAAQ;AACxB,UAAM,oBAAoB,KAAK,MAAM,WAAW;AAEhD,UAAM,SAAS,oBACX,CAAC,GAAG,aAAa,YAAY,IAAI,iBAAiB,IAAI,GAAG,cAAc,IACvE;AAEJ,WAAO;AAAA,MACL,GAAI;AAAA,MACJ,OAAO,KAAK,KAAK;AAAA,MACjB,aAAa,KAAK,KAAK;AAAA,MACvB,WAAW;AAAA,QACT;AAAA,QACA,MAAM;AAAA,QACN,SAAS,KAAK,KAAK,UAAU;AAAA,UAC3B,GAAG,aAAa,YAAY,YAAY,KAAK,KAAK,OAAO,IAAI;AAAA,QAC/D;AAAA,QACA,OAAO,KAAK,KAAK;AAAA,MACnB;AAAA;AAAA,MAGA,SAAS,KAAK,KAAK,UAAU;AAAA,QAC3B;AAAA,UACE,MAAM,KAAK,KAAK,OAAO;AAAA,UACvB,KAAK,GAAG,aAAa,YAAY,YAAY,KAAK,KAAK,OAAO,IAAI;AAAA,QACpE;AAAA,MACF;AAAA,MACA,OAAO,CAAC;AAAA,IACV;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 merge_exports = {};
|
|
20
|
+
__export(merge_exports, {
|
|
21
|
+
cn: () => cn
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(merge_exports);
|
|
24
|
+
var import_clsx = require("clsx");
|
|
25
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
26
|
+
const cn = (...inputs) => {
|
|
27
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
cn
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=merge.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/merge.ts"],"sourcesContent":["import { ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]) => {\n return twMerge(clsx(inputs));\n};\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/merge.ts"],"sourcesContent":["import { ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]) => {\n return twMerge(clsx(inputs));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AACjC,4BAAwB;AAEjB,MAAM,KAAK,IAAI,WAAyB;AAC7C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;","names":[]}
|
package/dist/utils/merge.js
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 merge_exports = {};
|
|
20
|
-
__export(merge_exports, {
|
|
21
|
-
cn: () => cn
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(merge_exports);
|
|
24
|
-
var import_clsx = require("clsx");
|
|
25
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
26
3
|
const cn = (...inputs) => {
|
|
27
|
-
return
|
|
4
|
+
return twMerge(clsx(inputs));
|
|
28
5
|
};
|
|
29
|
-
|
|
30
|
-
0 && (module.exports = {
|
|
6
|
+
export {
|
|
31
7
|
cn
|
|
32
|
-
}
|
|
8
|
+
};
|
|
33
9
|
//# sourceMappingURL=merge.js.map
|
package/dist/utils/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/merge.ts"],"sourcesContent":["import { ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]) => {\n return twMerge(clsx(inputs));\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/merge.ts"],"sourcesContent":["import { ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport const cn = (...inputs: ClassValue[]) => {\n return twMerge(clsx(inputs));\n};\n"],"mappings":"AAAA,SAAqB,YAAY;AACjC,SAAS,eAAe;AAEjB,MAAM,KAAK,IAAI,WAAyB;AAC7C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;","names":[]}
|