tetrons 2.2.5 → 2.2.6
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/app/api/export/{route.js → route.ts} +2 -2
- package/dist/app/api/register/route.ts +36 -0
- package/dist/app/api/save/route.ts +18 -0
- package/dist/app/api/validate/route.ts +26 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +17214 -4
- package/package.json +3 -4
- package/dist/app/api/export/route.d.ts +0 -1
- package/dist/app/api/register/route.d.ts +0 -6
- package/dist/app/api/register/route.js +0 -26
- package/dist/app/api/save/route.d.ts +0 -6
- package/dist/app/api/save/route.js +0 -15
- package/dist/app/api/validate/route.d.ts +0 -7
- package/dist/app/api/validate/route.js +0 -18
- package/dist/app/layout.d.ts +0 -6
- package/dist/app/layout.jsx +0 -30
- package/dist/app/page.d.ts +0 -2
- package/dist/app/page.jsx +0 -62
- package/dist/components/UI/Button.d.ts +0 -0
- package/dist/components/UI/Button.jsx +0 -1
- package/dist/components/UI/Dropdown.d.ts +0 -0
- package/dist/components/UI/Dropdown.jsx +0 -1
- package/dist/components/tetrons/EditorContent.d.ts +0 -6
- package/dist/components/tetrons/EditorContent.jsx +0 -193
- package/dist/components/tetrons/ResizableImage.d.ts +0 -1
- package/dist/components/tetrons/ResizableImage.js +0 -40
- package/dist/components/tetrons/ResizableImageComponent.d.ts +0 -11
- package/dist/components/tetrons/ResizableImageComponent.jsx +0 -37
- package/dist/components/tetrons/ResizableVideo.d.ts +0 -12
- package/dist/components/tetrons/ResizableVideo.js +0 -61
- package/dist/components/tetrons/ResizableVideoComponent.d.ts +0 -4
- package/dist/components/tetrons/ResizableVideoComponent.jsx +0 -32
- package/dist/components/tetrons/helpers.d.ts +0 -0
- package/dist/components/tetrons/helpers.js +0 -1
- package/dist/components/tetrons/toolbar/ActionGroup.d.ts +0 -7
- package/dist/components/tetrons/toolbar/ActionGroup.jsx +0 -167
- package/dist/components/tetrons/toolbar/ClipboardGroup.d.ts +0 -5
- package/dist/components/tetrons/toolbar/ClipboardGroup.jsx +0 -36
- package/dist/components/tetrons/toolbar/FileGroup.d.ts +0 -7
- package/dist/components/tetrons/toolbar/FileGroup.jsx +0 -40
- package/dist/components/tetrons/toolbar/FontStyleGroup.d.ts +0 -7
- package/dist/components/tetrons/toolbar/FontStyleGroup.jsx +0 -104
- package/dist/components/tetrons/toolbar/InsertGroup.d.ts +0 -5
- package/dist/components/tetrons/toolbar/InsertGroup.jsx +0 -163
- package/dist/components/tetrons/toolbar/ListAlignGroup.d.ts +0 -5
- package/dist/components/tetrons/toolbar/ListAlignGroup.jsx +0 -16
- package/dist/components/tetrons/toolbar/MiscGroup.d.ts +0 -7
- package/dist/components/tetrons/toolbar/MiscGroup.jsx +0 -31
- package/dist/components/tetrons/toolbar/TableContextMenu.d.ts +0 -7
- package/dist/components/tetrons/toolbar/TableContextMenu.jsx +0 -52
- package/dist/components/tetrons/toolbar/TetronsToolbar.d.ts +0 -5
- package/dist/components/tetrons/toolbar/TetronsToolbar.jsx +0 -44
- package/dist/components/tetrons/toolbar/ToolbarButton.d.ts +0 -12
- package/dist/components/tetrons/toolbar/ToolbarButton.jsx +0 -8
- package/dist/components/tetrons/toolbar/extensions/Comment.d.ts +0 -17
- package/dist/components/tetrons/toolbar/extensions/Comment.js +0 -45
- package/dist/components/tetrons/toolbar/extensions/Embed.d.ts +0 -2
- package/dist/components/tetrons/toolbar/extensions/Embed.js +0 -90
- package/dist/components/tetrons/toolbar/extensions/FontFamily.d.ts +0 -9
- package/dist/components/tetrons/toolbar/extensions/FontFamily.js +0 -28
- package/dist/components/tetrons/toolbar/extensions/FontSize.d.ts +0 -9
- package/dist/components/tetrons/toolbar/extensions/FontSize.js +0 -28
- package/dist/components/tetrons/toolbar/extensions/ResizableTable.d.ts +0 -1
- package/dist/components/tetrons/toolbar/extensions/ResizableTable.js +0 -11
- package/dist/components/tetrons/toolbar/marks/Subscript.d.ts +0 -2
- package/dist/components/tetrons/toolbar/marks/Subscript.js +0 -35
- package/dist/components/tetrons/toolbar/marks/Superscript.d.ts +0 -2
- package/dist/components/tetrons/toolbar/marks/Superscript.js +0 -35
- package/dist/lib/db.d.ts +0 -1
- package/dist/lib/db.js +0 -15
- package/dist/lib/export.d.ts +0 -0
- package/dist/lib/export.js +0 -1
- package/dist/lib/tiptap-extensions.d.ts +0 -0
- package/dist/lib/tiptap-extensions.js +0 -1
- package/dist/models/ApiKey.d.ts +0 -2
- package/dist/models/ApiKey.js +0 -14
- package/dist/styles/styles/tetrons.css +0 -371
- package/dist/utils/apiKeyUtils.d.ts +0 -11
- package/dist/utils/apiKeyUtils.js +0 -17
- package/dist/utils/loadEmojiPicker.d.ts +0 -1
- package/dist/utils/loadEmojiPicker.js +0 -12
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
+
import { connectDB } from "../../../lib/db";
|
|
3
|
+
import { ApiKey } from "../../../models/ApiKey";
|
|
4
|
+
import { generateApiKey } from "../../../utils/apiKeyUtils";
|
|
5
|
+
|
|
6
|
+
export async function POST(req: NextRequest) {
|
|
7
|
+
const { email, organization, version } = await req.json();
|
|
8
|
+
|
|
9
|
+
if (!email || !organization || !version)
|
|
10
|
+
return NextResponse.json({ error: "Missing fields" }, { status: 400 });
|
|
11
|
+
|
|
12
|
+
await connectDB();
|
|
13
|
+
|
|
14
|
+
if (version === "free") {
|
|
15
|
+
const expiresAt = new Date(Date.now() + 14 * 24 * 60 * 60 * 1000);
|
|
16
|
+
const apiKey = generateApiKey(48);
|
|
17
|
+
|
|
18
|
+
await ApiKey.deleteMany({ email, version });
|
|
19
|
+
|
|
20
|
+
await ApiKey.create({
|
|
21
|
+
email,
|
|
22
|
+
organization,
|
|
23
|
+
version,
|
|
24
|
+
apiKey,
|
|
25
|
+
expiresAt,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return NextResponse.json({ apiKey, expiresAt });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const apiKey = generateApiKey(48);
|
|
33
|
+
await ApiKey.create({ email, organization, version, apiKey });
|
|
34
|
+
|
|
35
|
+
return NextResponse.json({ apiKey });
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
|
|
5
|
+
export async function POST(request: NextRequest) {
|
|
6
|
+
try {
|
|
7
|
+
const json = await request.json();
|
|
8
|
+
|
|
9
|
+
const publicDir = path.join(process.cwd(), "public");
|
|
10
|
+
const filePath = path.join(publicDir, "editor-content.json");
|
|
11
|
+
|
|
12
|
+
await fs.writeFile(filePath, JSON.stringify(json, null, 2), "utf-8");
|
|
13
|
+
|
|
14
|
+
return NextResponse.json({ message: "File saved successfully" });
|
|
15
|
+
} catch {
|
|
16
|
+
return NextResponse.json({ error: "Failed to save file" }, { status: 500 });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
+
import { connectDB } from "../../../lib/db";
|
|
3
|
+
import { ApiKey } from "../../../models/ApiKey";
|
|
4
|
+
|
|
5
|
+
export async function POST(req: NextRequest) {
|
|
6
|
+
const { apiKey } = await req.json();
|
|
7
|
+
|
|
8
|
+
if (!apiKey)
|
|
9
|
+
return NextResponse.json({ error: "API key required" }, { status: 400 });
|
|
10
|
+
|
|
11
|
+
await connectDB();
|
|
12
|
+
|
|
13
|
+
const keyEntry = await ApiKey.findOne({ apiKey });
|
|
14
|
+
if (!keyEntry)
|
|
15
|
+
return NextResponse.json({ error: "Invalid key" }, { status: 401 });
|
|
16
|
+
|
|
17
|
+
if (
|
|
18
|
+
keyEntry.version === "free" &&
|
|
19
|
+
keyEntry.expiresAt &&
|
|
20
|
+
new Date() > new Date(keyEntry.expiresAt)
|
|
21
|
+
) {
|
|
22
|
+
return NextResponse.json({ error: "Free trial expired" }, { status: 403 });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return NextResponse.json({ valid: true, version: keyEntry.version });
|
|
26
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type EditorContentProps = {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
};
|
|
6
|
+
declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { EditorContent, EditorContent as default };
|