@aranova/tracking-next 0.20.0 → 0.20.2

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.
@@ -0,0 +1,23 @@
1
+ /** One table-of-contents entry: an h2/h3 with its rendered anchor id. */
2
+ interface BlogHeading {
3
+ /** Heading rank — a TOC only links section (h2) and subsection (h3) heads. */
4
+ depth: 2 | 3;
5
+ /** Plain-text heading content (formatting stripped, code/emphasis flattened). */
6
+ text: string;
7
+ /** The `id` rehype-slug stamps on the rendered heading element. */
8
+ id: string;
9
+ }
10
+ /**
11
+ * Extract the h2/h3 outline of a blog MDX document with the exact anchor ids
12
+ * `BlogPostView` renders (rehype-slug parity — see the module header). Returns
13
+ * `[]` for unparseable input; feed it the same `mdx` the view receives.
14
+ */
15
+ declare function extractBlogHeadings(mdx: string): BlogHeading[];
16
+ /**
17
+ * Estimated reading time of a blog MDX document, in whole minutes (>= 1).
18
+ * Deliberately crude — strips MDX/markdown syntax and counts words at
19
+ * {@link WORDS_PER_MINUTE}.
20
+ */
21
+ declare function estimateReadingTime(mdx: string): number;
22
+
23
+ export { type BlogHeading as B, extractBlogHeadings as a, estimateReadingTime as e };
@@ -0,0 +1,23 @@
1
+ /** One table-of-contents entry: an h2/h3 with its rendered anchor id. */
2
+ interface BlogHeading {
3
+ /** Heading rank — a TOC only links section (h2) and subsection (h3) heads. */
4
+ depth: 2 | 3;
5
+ /** Plain-text heading content (formatting stripped, code/emphasis flattened). */
6
+ text: string;
7
+ /** The `id` rehype-slug stamps on the rendered heading element. */
8
+ id: string;
9
+ }
10
+ /**
11
+ * Extract the h2/h3 outline of a blog MDX document with the exact anchor ids
12
+ * `BlogPostView` renders (rehype-slug parity — see the module header). Returns
13
+ * `[]` for unparseable input; feed it the same `mdx` the view receives.
14
+ */
15
+ declare function extractBlogHeadings(mdx: string): BlogHeading[];
16
+ /**
17
+ * Estimated reading time of a blog MDX document, in whole minutes (>= 1).
18
+ * Deliberately crude — strips MDX/markdown syntax and counts words at
19
+ * {@link WORDS_PER_MINUTE}.
20
+ */
21
+ declare function estimateReadingTime(mdx: string): number;
22
+
23
+ export { type BlogHeading as B, extractBlogHeadings as a, estimateReadingTime as e };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aranova/tracking-next",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "description": "Next.js tracking utilities for Aranova client sites",
@@ -68,6 +68,36 @@
68
68
  "types": "./dist/phone.d.ts",
69
69
  "default": "./dist/phone.js"
70
70
  }
71
+ },
72
+ "./blog": {
73
+ "import": {
74
+ "types": "./dist/blog.d.mts",
75
+ "default": "./dist/blog.mjs"
76
+ },
77
+ "require": {
78
+ "types": "./dist/blog.d.ts",
79
+ "default": "./dist/blog.js"
80
+ }
81
+ },
82
+ "./blog-server": {
83
+ "import": {
84
+ "types": "./dist/blog-server.d.mts",
85
+ "default": "./dist/blog-server.mjs"
86
+ },
87
+ "require": {
88
+ "types": "./dist/blog-server.d.ts",
89
+ "default": "./dist/blog-server.js"
90
+ }
91
+ },
92
+ "./blog-client": {
93
+ "import": {
94
+ "types": "./dist/blog-client.d.mts",
95
+ "default": "./dist/blog-client.mjs"
96
+ },
97
+ "require": {
98
+ "types": "./dist/blog-client.d.ts",
99
+ "default": "./dist/blog-client.js"
100
+ }
71
101
  }
72
102
  },
73
103
  "scripts": {
@@ -82,8 +112,15 @@
82
112
  "react": ">=18.0.0"
83
113
  },
84
114
  "dependencies": {
115
+ "github-slugger": "^2.0.0",
85
116
  "libphonenumber-js": "^1.11.0",
117
+ "next-mdx-remote": "^6.0.0",
118
+ "rehype-slug": "^6.0.0",
119
+ "remark-gfm": "^4.0.1",
120
+ "remark-mdx": "^3.1.1",
121
+ "remark-parse": "^11.0.0",
86
122
  "server-only": "^0.0.1",
123
+ "unified": "^11.0.5",
87
124
  "zod": "^3.24.1"
88
125
  },
89
126
  "devDependencies": {