tetrons 2.3.72 → 2.3.73

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,13 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ declare function OPTIONS(): Promise<Response>;
4
+ declare function POST(req: NextRequest): Promise<NextResponse<{
5
+ error: string;
6
+ }> | NextResponse<{
7
+ valid: boolean;
8
+ version: any;
9
+ email: any;
10
+ organization: any;
11
+ }>>;
12
+
13
+ export { OPTIONS, POST };
@@ -1,39 +1,10 @@
1
- // src/app/api/validate/route.ts
2
- import { NextResponse } from "next/server";
3
-
4
- // src/lib/db.js
5
- import mongoose from "mongoose";
6
- var MONGO_URL = process.env.MONGO_URL;
7
- var connectDB = async () => {
8
- if (mongoose.connection.readyState >= 1) {
9
- return;
10
- }
11
- try {
12
- await mongoose.connect(MONGO_URL);
13
- console.log("Connected to MongoDB \u{1F44D}");
14
- } catch (error) {
15
- console.error("MongoDB connection failed \u274C", error);
16
- process.exit(1);
17
- }
18
- };
19
-
20
- // src/models/ApiKey.ts
21
- import mongoose2 from "mongoose";
22
- var ApiKeySchema = new mongoose2.Schema({
23
- email: { type: String, required: true },
24
- organization: { type: String, required: true },
25
- version: {
26
- type: String,
27
- enum: ["free", "pro", "premium", "platinum"],
28
- required: true
29
- },
30
- apiKey: { type: String, required: true, unique: true },
31
- createdAt: { type: Date, default: Date.now },
32
- expiresAt: { type: Date }
33
- });
34
- var ApiKey = mongoose2.models.ApiKey || mongoose2.model("ApiKey", ApiKeySchema);
1
+ import {
2
+ ApiKey,
3
+ connectDB
4
+ } from "../../../chunk-M2F2EU6B.mjs";
35
5
 
36
6
  // src/app/api/validate/route.ts
7
+ import { NextResponse } from "next/server";
37
8
  var corsHeaders = {
38
9
  "Access-Control-Allow-Origin": "*",
39
10
  "Access-Control-Allow-Methods": "POST, OPTIONS",
@@ -0,0 +1,36 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/lib/db.js
2
+ var _mongoose = require('mongoose'); var _mongoose2 = _interopRequireDefault(_mongoose);
3
+ var MONGO_URL = process.env.MONGO_URL;
4
+ var connectDB = async () => {
5
+ if (_mongoose2.default.connection.readyState >= 1) {
6
+ return;
7
+ }
8
+ try {
9
+ await _mongoose2.default.connect(MONGO_URL);
10
+ console.log("Connected to MongoDB \u{1F44D}");
11
+ } catch (error) {
12
+ console.error("MongoDB connection failed \u274C", error);
13
+ process.exit(1);
14
+ }
15
+ };
16
+
17
+ // src/models/ApiKey.ts
18
+
19
+ var ApiKeySchema = new _mongoose2.default.Schema({
20
+ email: { type: String, required: true },
21
+ organization: { type: String, required: true },
22
+ version: {
23
+ type: String,
24
+ enum: ["free", "pro", "premium", "platinum"],
25
+ required: true
26
+ },
27
+ apiKey: { type: String, required: true, unique: true },
28
+ createdAt: { type: Date, default: Date.now },
29
+ expiresAt: { type: Date }
30
+ });
31
+ var ApiKey = _mongoose2.default.models.ApiKey || _mongoose2.default.model("ApiKey", ApiKeySchema);
32
+
33
+
34
+
35
+
36
+ exports.connectDB = connectDB; exports.ApiKey = ApiKey;
@@ -0,0 +1,36 @@
1
+ // src/lib/db.js
2
+ import mongoose from "mongoose";
3
+ var MONGO_URL = process.env.MONGO_URL;
4
+ var connectDB = async () => {
5
+ if (mongoose.connection.readyState >= 1) {
6
+ return;
7
+ }
8
+ try {
9
+ await mongoose.connect(MONGO_URL);
10
+ console.log("Connected to MongoDB \u{1F44D}");
11
+ } catch (error) {
12
+ console.error("MongoDB connection failed \u274C", error);
13
+ process.exit(1);
14
+ }
15
+ };
16
+
17
+ // src/models/ApiKey.ts
18
+ import mongoose2 from "mongoose";
19
+ var ApiKeySchema = new mongoose2.Schema({
20
+ email: { type: String, required: true },
21
+ organization: { type: String, required: true },
22
+ version: {
23
+ type: String,
24
+ enum: ["free", "pro", "premium", "platinum"],
25
+ required: true
26
+ },
27
+ apiKey: { type: String, required: true, unique: true },
28
+ createdAt: { type: Date, default: Date.now },
29
+ expiresAt: { type: Date }
30
+ });
31
+ var ApiKey = mongoose2.models.ApiKey || mongoose2.model("ApiKey", ApiKeySchema);
32
+
33
+ export {
34
+ connectDB,
35
+ ApiKey
36
+ };
@@ -6,7 +6,6 @@ import {
6
6
  EditorContent as TiptapEditorContent,
7
7
  } from "@tiptap/react";
8
8
 
9
- import { getEnv } from "../../utils/getEnv";
10
9
  import Document from "@tiptap/extension-document";
11
10
  import Paragraph from "@tiptap/extension-paragraph";
12
11
  import Text from "@tiptap/extension-text";
@@ -76,10 +75,23 @@ export default function EditorContent({ apiKey }: EditorContentProps) {
76
75
 
77
76
  const wrapperRef = useRef<HTMLDivElement>(null);
78
77
 
79
- const API_BASE_URL = getEnv(
80
- "VITE_TETRONS_API_URL",
81
- "https://staging.tetrons.com"
82
- );
78
+ function getApiBaseUrl(): string {
79
+ if (
80
+ typeof import.meta !== "undefined" &&
81
+ import.meta.env?.VITE_TETRONS_API_URL
82
+ ) {
83
+ return import.meta.env.VITE_TETRONS_API_URL;
84
+ }
85
+ if (
86
+ typeof process !== "undefined" &&
87
+ process.env?.NEXT_PUBLIC_TETRONS_API_URL
88
+ ) {
89
+ return process.env.NEXT_PUBLIC_TETRONS_API_URL;
90
+ }
91
+ return "https://staging.tetrons.com";
92
+ }
93
+
94
+ const API_BASE_URL = getApiBaseUrl();
83
95
 
84
96
  useEffect(() => {
85
97
  const validateKey = async () => {