tetrons 2.3.72 → 2.3.74

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,9 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ declare function POST(req: NextRequest): Promise<NextResponse<{
4
+ error: any;
5
+ }> | NextResponse<{
6
+ response: any;
7
+ }>>;
8
+
9
+ export { POST };
@@ -0,0 +1,9 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ declare function POST(req: NextRequest): Promise<NextResponse<{
4
+ error: any;
5
+ }> | NextResponse<{
6
+ response: any;
7
+ }>>;
8
+
9
+ export { POST };
@@ -0,0 +1,3 @@
1
+ declare function GET(req: Request): Response;
2
+
3
+ export { GET };
@@ -0,0 +1,3 @@
1
+ declare function GET(req: Request): Response;
2
+
3
+ export { GET };
@@ -0,0 +1,10 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ declare function POST(req: NextRequest): Promise<NextResponse<{
4
+ error: string;
5
+ }> | NextResponse<{
6
+ apiKey: string;
7
+ expiresAt: Date | null;
8
+ }>>;
9
+
10
+ export { POST };
@@ -0,0 +1,10 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ declare function POST(req: NextRequest): Promise<NextResponse<{
4
+ error: string;
5
+ }> | NextResponse<{
6
+ apiKey: string;
7
+ expiresAt: Date | null;
8
+ }>>;
9
+
10
+ export { POST };
@@ -0,0 +1,9 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ declare function POST(request: NextRequest): Promise<NextResponse<{
4
+ message: string;
5
+ }> | NextResponse<{
6
+ error: string;
7
+ }>>;
8
+
9
+ export { POST };
@@ -0,0 +1,9 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ declare function POST(request: NextRequest): Promise<NextResponse<{
4
+ message: string;
5
+ }> | NextResponse<{
6
+ error: string;
7
+ }>>;
8
+
9
+ export { POST };
@@ -0,0 +1,10 @@
1
+ import { NextResponse } from 'next/server';
2
+
3
+ declare const runtime = "edge";
4
+ declare function POST(req: Request): Promise<NextResponse<{
5
+ error: any;
6
+ }> | NextResponse<{
7
+ transcript: any;
8
+ }>>;
9
+
10
+ export { POST, runtime };
@@ -0,0 +1,10 @@
1
+ import { NextResponse } from 'next/server';
2
+
3
+ declare const runtime = "edge";
4
+ declare function POST(req: Request): Promise<NextResponse<{
5
+ error: any;
6
+ }> | NextResponse<{
7
+ transcript: any;
8
+ }>>;
9
+
10
+ export { POST, runtime };
@@ -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 };
@@ -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 };
@@ -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 () => {
@@ -27,34 +27,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/node.ts
31
- var node_exports = {};
32
- __export(node_exports, {
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  EditorContent: () => EditorContent,
34
- getOrCreateInstallDate: () => getOrCreateInstallDate,
35
- getTetronsRemainingDays: () => getTetronsRemainingDays,
34
+ default: () => index_default,
36
35
  getTetronsVersion: () => getTetronsVersion,
37
36
  initializeTetrons: () => initializeTetrons,
38
37
  isApiKeyValid: () => isApiKeyValid
39
38
  });
40
- module.exports = __toCommonJS(node_exports);
41
-
42
- // src/index.nodeimpl.ts
43
- var import_fs = __toESM(require("fs"));
44
- var import_path = __toESM(require("path"));
39
+ module.exports = __toCommonJS(index_exports);
45
40
 
46
41
  // src/components/tetrons/EditorContent.tsx
47
42
  var import_react20 = __toESM(require("react"));
48
43
  var import_react21 = require("@tiptap/react");
49
44
 
50
- // src/utils/getEnv.ts
51
- function getEnv(key, fallback = "") {
52
- if (typeof process !== "undefined") {
53
- return process.env[key] || fallback;
54
- }
55
- return fallback;
56
- }
57
-
58
45
  // node_modules/@tiptap/extension-document/dist/index.js
59
46
  var import_core = require("@tiptap/core");
60
47
  var Document = import_core.Node.create({
@@ -553,7 +540,7 @@ var Fragment = class _Fragment {
553
540
  position in this fragment. The result object will be reused
554
541
  (overwritten) the next time the function is called. @internal
555
542
  */
556
- findIndex(pos, round = -1) {
543
+ findIndex(pos) {
557
544
  if (pos == 0)
558
545
  return retIndex(0, pos);
559
546
  if (pos == this.size)
@@ -563,7 +550,7 @@ var Fragment = class _Fragment {
563
550
  for (let i = 0, curPos = 0; ; i++) {
564
551
  let cur = this.child(i), end = curPos + cur.nodeSize;
565
552
  if (end >= pos) {
566
- if (end == pos || round > 0)
553
+ if (end == pos)
567
554
  return retIndex(i + 1, end);
568
555
  return retIndex(i, curPos);
569
556
  }
@@ -1001,11 +988,11 @@ var ResolvedPos = class _ResolvedPos {
1001
988
  /**
1002
989
  @internal
1003
990
  */
1004
- constructor(pos, path2, parentOffset) {
991
+ constructor(pos, path, parentOffset) {
1005
992
  this.pos = pos;
1006
- this.path = path2;
993
+ this.path = path;
1007
994
  this.parentOffset = parentOffset;
1008
- this.depth = path2.length / 3 - 1;
995
+ this.depth = path.length / 3 - 1;
1009
996
  }
1010
997
  /**
1011
998
  @internal
@@ -1236,12 +1223,12 @@ var ResolvedPos = class _ResolvedPos {
1236
1223
  static resolve(doc3, pos) {
1237
1224
  if (!(pos >= 0 && pos <= doc3.content.size))
1238
1225
  throw new RangeError("Position " + pos + " out of range");
1239
- let path2 = [];
1226
+ let path = [];
1240
1227
  let start = 0, parentOffset = pos;
1241
1228
  for (let node = doc3; ; ) {
1242
1229
  let { index, offset } = node.content.findIndex(parentOffset);
1243
1230
  let rem = parentOffset - offset;
1244
- path2.push(node, index, start + offset);
1231
+ path.push(node, index, start + offset);
1245
1232
  if (!rem)
1246
1233
  break;
1247
1234
  node = node.child(index);
@@ -1250,7 +1237,7 @@ var ResolvedPos = class _ResolvedPos {
1250
1237
  parentOffset = rem - 1;
1251
1238
  start += offset + 1;
1252
1239
  }
1253
- return new _ResolvedPos(pos, path2, parentOffset);
1240
+ return new _ResolvedPos(pos, path, parentOffset);
1254
1241
  }
1255
1242
  /**
1256
1243
  @internal
@@ -1406,7 +1393,7 @@ var Node4 = class _Node {
1406
1393
  `blockSeparator` is given, it will be inserted to separate text
1407
1394
  from different block nodes. If `leafText` is given, it'll be
1408
1395
  inserted for every non-text leaf node encountered, otherwise
1409
- [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.
1396
+ [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
1410
1397
  */
1411
1398
  textBetween(from2, to, blockSeparator, leafText) {
1412
1399
  return this.content.textBetween(from2, to, blockSeparator, leafText);
@@ -2386,7 +2373,7 @@ var DOMParser = class _DOMParser {
2386
2373
  /**
2387
2374
  Construct a DOM parser using the parsing rules listed in a
2388
2375
  schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
2389
- [priority](https://prosemirror.net/docs/ref/#model.ParseRule.priority).
2376
+ [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
2390
2377
  */
2391
2378
  static fromSchema(schema) {
2392
2379
  return schema.cached.domParser || (schema.cached.domParser = new _DOMParser(schema, _DOMParser.schemaRules(schema)));
@@ -3105,6 +3092,8 @@ function renderSpec(doc3, structure, xmlNS, blockArraysIn) {
3105
3092
  let space2 = name.indexOf(" ");
3106
3093
  if (space2 > 0)
3107
3094
  dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
3095
+ else if (name == "style" && dom.style)
3096
+ dom.style.cssText = attrs[name];
3108
3097
  else
3109
3098
  dom.setAttribute(name, attrs[name]);
3110
3099
  }
@@ -8566,7 +8555,7 @@ function posFromCaret(view, node, offset, coords) {
8566
8555
  return null;
8567
8556
  if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && // Ignore elements with zero-size bounding rectangles
8568
8557
  ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
8569
- if (desc.node.isBlock && desc.parent) {
8558
+ if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
8570
8559
  if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
8571
8560
  outsideBlock = desc.posBefore;
8572
8561
  else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
@@ -12599,7 +12588,7 @@ function ruleFromNode(dom) {
12599
12588
  }
12600
12589
  return null;
12601
12590
  }
12602
- var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
12591
+ var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
12603
12592
  function readDOMChange(view, from2, to, typeOver, addedNodes) {
12604
12593
  let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
12605
12594
  view.input.compositionPendingChanges = 0;
@@ -16821,6 +16810,7 @@ function TetronsToolbar({
16821
16810
  }
16822
16811
 
16823
16812
  // src/components/tetrons/EditorContent.tsx
16813
+ var import_meta = {};
16824
16814
  var lowlight = (0, import_lowlight.createLowlight)();
16825
16815
  lowlight.register("js", javascript);
16826
16816
  lowlight.register("ts", typescript);
@@ -16834,10 +16824,16 @@ function EditorContent({ apiKey }) {
16834
16824
  null
16835
16825
  );
16836
16826
  const wrapperRef = (0, import_react20.useRef)(null);
16837
- const API_BASE_URL = getEnv(
16838
- "VITE_TETRONS_API_URL",
16839
- "https://staging.tetrons.com"
16840
- );
16827
+ function getApiBaseUrl() {
16828
+ if (typeof import_meta !== "undefined" && import_meta.env?.VITE_TETRONS_API_URL) {
16829
+ return import_meta.env.VITE_TETRONS_API_URL;
16830
+ }
16831
+ if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_TETRONS_API_URL) {
16832
+ return process.env.NEXT_PUBLIC_TETRONS_API_URL;
16833
+ }
16834
+ return "https://staging.tetrons.com";
16835
+ }
16836
+ const API_BASE_URL = getApiBaseUrl();
16841
16837
  (0, import_react20.useEffect)(() => {
16842
16838
  const validateKey = async () => {
16843
16839
  try {
@@ -16983,57 +16979,9 @@ function EditorContent({ apiKey }) {
16983
16979
  ));
16984
16980
  }
16985
16981
 
16986
- // src/index.nodeimpl.ts
16987
- var USAGE_FILE = import_path.default.join(process.cwd(), ".tetrons-usage.json");
16988
- async function getOrCreateInstallDate() {
16989
- try {
16990
- if (import_fs.default.existsSync(USAGE_FILE)) {
16991
- const raw = import_fs.default.readFileSync(USAGE_FILE, "utf-8");
16992
- try {
16993
- const data = JSON.parse(raw);
16994
- if (typeof data.installedAt === "string") {
16995
- return new Date(data.installedAt);
16996
- }
16997
- } catch {
16998
- console.warn(
16999
- "[TETRONS] Malformed .tetrons-usage.json. Reinitializing..."
17000
- );
17001
- }
17002
- }
17003
- const now = (/* @__PURE__ */ new Date()).toISOString();
17004
- import_fs.default.writeFileSync(USAGE_FILE, JSON.stringify({ installedAt: now }), {
17005
- encoding: "utf-8",
17006
- flag: "w"
17007
- });
17008
- return new Date(now);
17009
- } catch (err) {
17010
- console.error("[TETRONS] Failed to read/write install date:", err);
17011
- throw new Error("Failed to access local usage record.");
17012
- }
17013
- }
17014
-
17015
16982
  // src/index.ts
17016
16983
  var API_VALID = false;
17017
16984
  var API_VERSION = "";
17018
- var validityMap = {
17019
- free: 14,
17020
- pro: 30,
17021
- premium: 30,
17022
- platinum: 30
17023
- };
17024
- var _installedAt = null;
17025
- async function getOrCreateInstallDate2() {
17026
- if (_installedAt) return _installedAt;
17027
- _installedAt = await getOrCreateInstallDate();
17028
- return _installedAt;
17029
- }
17030
- function getRemainingDays(installedAt, validityDays) {
17031
- const now = /* @__PURE__ */ new Date();
17032
- const diff = Math.floor(
17033
- (now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
17034
- );
17035
- return validityDays - diff;
17036
- }
17037
16985
  async function initializeTetrons(apiKey) {
17038
16986
  const res = await fetch("https://staging.tetrons.com/api/validate", {
17039
16987
  method: "POST",
@@ -17048,24 +16996,7 @@ async function initializeTetrons(apiKey) {
17048
16996
  }
17049
16997
  const data = await res.json();
17050
16998
  API_VALID = data.valid;
17051
- if (!API_VALID) {
17052
- throw new Error("API Key is not valid.");
17053
- }
17054
- if (!(data.version in validityMap)) {
17055
- throw new Error(`Unsupported license version: ${data.version}`);
17056
- }
17057
16999
  API_VERSION = data.version;
17058
- const validityDays = validityMap[API_VERSION];
17059
- const installedAt = await getOrCreateInstallDate2();
17060
- const remainingDays = getRemainingDays(installedAt, validityDays);
17061
- if (remainingDays <= 0) {
17062
- throw new Error(
17063
- `Your ${API_VERSION} license expired after ${validityDays} days.`
17064
- );
17065
- }
17066
- console.log(
17067
- `[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`
17068
- );
17069
17000
  }
17070
17001
  function getTetronsVersion() {
17071
17002
  return API_VERSION;
@@ -17073,17 +17004,10 @@ function getTetronsVersion() {
17073
17004
  function isApiKeyValid() {
17074
17005
  return API_VALID;
17075
17006
  }
17076
- async function getTetronsRemainingDays() {
17077
- if (!API_VALID || API_VERSION === "") return null;
17078
- const validityDays = validityMap[API_VERSION];
17079
- const installedAt = await getOrCreateInstallDate2();
17080
- return getRemainingDays(installedAt, validityDays);
17081
- }
17007
+ var index_default = EditorContent;
17082
17008
  // Annotate the CommonJS export names for ESM import in node:
17083
17009
  0 && (module.exports = {
17084
17010
  EditorContent,
17085
- getOrCreateInstallDate,
17086
- getTetronsRemainingDays,
17087
17011
  getTetronsVersion,
17088
17012
  initializeTetrons,
17089
17013
  isApiKeyValid
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ type EditorContentProps = {
4
+ apiKey: string;
5
+ };
6
+ declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Element;
7
+
8
+ declare function initializeTetrons(apiKey: string): Promise<void>;
9
+ declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
10
+ declare function isApiKeyValid(): boolean;
11
+
12
+ export { EditorContent, EditorContent as default, getTetronsVersion, initializeTetrons, isApiKeyValid };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ type EditorContentProps = {
4
+ apiKey: string;
5
+ };
6
+ declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Element;
7
+
8
+ declare function initializeTetrons(apiKey: string): Promise<void>;
9
+ declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
10
+ declare function isApiKeyValid(): boolean;
11
+
12
+ export { EditorContent, EditorContent as default, getTetronsVersion, initializeTetrons, isApiKeyValid };
@@ -5,14 +5,6 @@ import {
5
5
  EditorContent as TiptapEditorContent
6
6
  } from "@tiptap/react";
7
7
 
8
- // src/utils/getEnv.ts
9
- function getEnv(key, fallback = "") {
10
- if (typeof process !== "undefined") {
11
- return process.env[key] || fallback;
12
- }
13
- return fallback;
14
- }
15
-
16
8
  // node_modules/@tiptap/extension-document/dist/index.js
17
9
  import { Node } from "@tiptap/core";
18
10
  var Document = Node.create({
@@ -511,7 +503,7 @@ var Fragment = class _Fragment {
511
503
  position in this fragment. The result object will be reused
512
504
  (overwritten) the next time the function is called. @internal
513
505
  */
514
- findIndex(pos, round = -1) {
506
+ findIndex(pos) {
515
507
  if (pos == 0)
516
508
  return retIndex(0, pos);
517
509
  if (pos == this.size)
@@ -521,7 +513,7 @@ var Fragment = class _Fragment {
521
513
  for (let i = 0, curPos = 0; ; i++) {
522
514
  let cur = this.child(i), end = curPos + cur.nodeSize;
523
515
  if (end >= pos) {
524
- if (end == pos || round > 0)
516
+ if (end == pos)
525
517
  return retIndex(i + 1, end);
526
518
  return retIndex(i, curPos);
527
519
  }
@@ -1364,7 +1356,7 @@ var Node4 = class _Node {
1364
1356
  `blockSeparator` is given, it will be inserted to separate text
1365
1357
  from different block nodes. If `leafText` is given, it'll be
1366
1358
  inserted for every non-text leaf node encountered, otherwise
1367
- [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.
1359
+ [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
1368
1360
  */
1369
1361
  textBetween(from2, to, blockSeparator, leafText) {
1370
1362
  return this.content.textBetween(from2, to, blockSeparator, leafText);
@@ -2344,7 +2336,7 @@ var DOMParser = class _DOMParser {
2344
2336
  /**
2345
2337
  Construct a DOM parser using the parsing rules listed in a
2346
2338
  schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
2347
- [priority](https://prosemirror.net/docs/ref/#model.ParseRule.priority).
2339
+ [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
2348
2340
  */
2349
2341
  static fromSchema(schema) {
2350
2342
  return schema.cached.domParser || (schema.cached.domParser = new _DOMParser(schema, _DOMParser.schemaRules(schema)));
@@ -3063,6 +3055,8 @@ function renderSpec(doc3, structure, xmlNS, blockArraysIn) {
3063
3055
  let space2 = name.indexOf(" ");
3064
3056
  if (space2 > 0)
3065
3057
  dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
3058
+ else if (name == "style" && dom.style)
3059
+ dom.style.cssText = attrs[name];
3066
3060
  else
3067
3061
  dom.setAttribute(name, attrs[name]);
3068
3062
  }
@@ -8524,7 +8518,7 @@ function posFromCaret(view, node, offset, coords) {
8524
8518
  return null;
8525
8519
  if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && // Ignore elements with zero-size bounding rectangles
8526
8520
  ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
8527
- if (desc.node.isBlock && desc.parent) {
8521
+ if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
8528
8522
  if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
8529
8523
  outsideBlock = desc.posBefore;
8530
8524
  else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
@@ -12557,7 +12551,7 @@ function ruleFromNode(dom) {
12557
12551
  }
12558
12552
  return null;
12559
12553
  }
12560
- var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
12554
+ var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
12561
12555
  function readDOMChange(view, from2, to, typeOver, addedNodes) {
12562
12556
  let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
12563
12557
  view.input.compositionPendingChanges = 0;
@@ -16837,10 +16831,16 @@ function EditorContent({ apiKey }) {
16837
16831
  null
16838
16832
  );
16839
16833
  const wrapperRef = useRef7(null);
16840
- const API_BASE_URL = getEnv(
16841
- "VITE_TETRONS_API_URL",
16842
- "https://staging.tetrons.com"
16843
- );
16834
+ function getApiBaseUrl() {
16835
+ if (typeof import.meta !== "undefined" && import.meta.env?.VITE_TETRONS_API_URL) {
16836
+ return import.meta.env.VITE_TETRONS_API_URL;
16837
+ }
16838
+ if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_TETRONS_API_URL) {
16839
+ return process.env.NEXT_PUBLIC_TETRONS_API_URL;
16840
+ }
16841
+ return "https://staging.tetrons.com";
16842
+ }
16843
+ const API_BASE_URL = getApiBaseUrl();
16844
16844
  useEffect8(() => {
16845
16845
  const validateKey = async () => {
16846
16846
  try {
@@ -16986,9 +16986,36 @@ function EditorContent({ apiKey }) {
16986
16986
  ));
16987
16987
  }
16988
16988
 
16989
- // src/browser.ts
16990
- var browser_default = EditorContent;
16989
+ // src/index.ts
16990
+ var API_VALID = false;
16991
+ var API_VERSION = "";
16992
+ async function initializeTetrons(apiKey) {
16993
+ const res = await fetch("https://staging.tetrons.com/api/validate", {
16994
+ method: "POST",
16995
+ headers: {
16996
+ "Content-Type": "application/json"
16997
+ },
16998
+ body: JSON.stringify({ apiKey })
16999
+ });
17000
+ if (!res.ok) {
17001
+ const error = await res.json();
17002
+ throw new Error(`API Key validation failed: ${error.error}`);
17003
+ }
17004
+ const data = await res.json();
17005
+ API_VALID = data.valid;
17006
+ API_VERSION = data.version;
17007
+ }
17008
+ function getTetronsVersion() {
17009
+ return API_VERSION;
17010
+ }
17011
+ function isApiKeyValid() {
17012
+ return API_VALID;
17013
+ }
17014
+ var index_default = EditorContent;
16991
17015
  export {
16992
17016
  EditorContent,
16993
- browser_default as default
17017
+ index_default as default,
17018
+ getTetronsVersion,
17019
+ initializeTetrons,
17020
+ isApiKeyValid
16994
17021
  };
package/package.json CHANGED
@@ -1,20 +1,16 @@
1
1
  {
2
2
  "name": "tetrons",
3
- "version": "2.3.72",
3
+ "version": "2.3.74",
4
4
  "description": "A Next.js project written in TypeScript",
5
- "main": "./dist/node.node.cjs",
6
- "module": "./dist/node.node.mjs",
7
- "types": "./dist/browser.d.ts",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
8
  "scripts": {
9
9
  "dev": "next dev --turbo",
10
10
  "build": "tsup && copyfiles -u 2 src/styles/*.css dist/styles && copyfiles -u 2 src/components/**/*.tsx dist/components",
11
11
  "start": "next start",
12
12
  "lint": "next lint"
13
13
  },
14
- "./browser": {
15
- "import": "./dist/browser.browser.js",
16
- "require": "./dist/browser.browser.js"
17
- },
18
14
  "dependencies": {
19
15
  "@emoji-mart/react": "1.1.1",
20
16
  "@tiptap/core": "2.24.1",
@@ -48,8 +44,8 @@
48
44
  },
49
45
  "peerDependencies": {
50
46
  "next": "15.3.2",
51
- "react": "^18.2.0 || ^19.0.0",
52
- "react-dom": "^18.2.0 || ^19.0.0"
47
+ "react": "^18.2.0",
48
+ "react-dom": "^18.2.0"
53
49
  },
54
50
  "devDependencies": {
55
51
  "@eslint/eslintrc": "3.0.0",
@@ -74,22 +70,12 @@
74
70
  "react",
75
71
  "web"
76
72
  ],
77
- "sideEffects": false,
78
- "author": "Swastik Jha <swastik.jha@finapsys.co.in>",
73
+ "author": "Your Name",
79
74
  "license": "MIT",
80
75
  "exports": {
81
76
  ".": {
82
- "browser": "./dist/browser.browser.js",
83
- "import": "./dist/node.node.mjs",
84
- "require": "./dist/node.node.cjs"
85
- },
86
- "./node": {
87
- "import": "./dist/node.node.mjs",
88
- "require": "./dist/node.node.cjs"
89
- },
90
- "./browser": {
91
- "import": "./dist/browser.browser.js",
92
- "require": "./dist/browser.browser.js"
77
+ "import": "./dist/index.mjs",
78
+ "require": "./dist/index.cjs"
93
79
  },
94
80
  "./style.css": "./dist/styles/tetrons.css",
95
81
  "./app/api/ai-action/route": {
@@ -1,8 +0,0 @@
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 };