tetrons 2.3.52 → 2.3.54
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/index.cjs +52 -17
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +52 -17
- package/package.json +5 -2
- package/dist/licenseUtils.server-7MTJIRHQ.mjs +0 -31
- package/dist/licenseUtils.server-UVEGEAXB.cjs +0 -31
package/dist/index.cjs
CHANGED
|
@@ -11504,16 +11504,16 @@ editHandlers.drop = (view, _event) => {
|
|
|
11504
11504
|
tr.deleteSelection();
|
|
11505
11505
|
}
|
|
11506
11506
|
let pos = tr.mapping.map(insertPos);
|
|
11507
|
-
let
|
|
11507
|
+
let isNode2 = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
|
|
11508
11508
|
let beforeInsert = tr.doc;
|
|
11509
|
-
if (
|
|
11509
|
+
if (isNode2)
|
|
11510
11510
|
tr.replaceRangeWith(pos, pos, slice2.content.firstChild);
|
|
11511
11511
|
else
|
|
11512
11512
|
tr.replaceRange(pos, pos, slice2);
|
|
11513
11513
|
if (tr.doc.eq(beforeInsert))
|
|
11514
11514
|
return;
|
|
11515
11515
|
let $pos = tr.doc.resolve(pos);
|
|
11516
|
-
if (
|
|
11516
|
+
if (isNode2 && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
|
|
11517
11517
|
tr.setSelection(new NodeSelection($pos));
|
|
11518
11518
|
} else {
|
|
11519
11519
|
let end = tr.mapping.map(insertPos);
|
|
@@ -16987,10 +16987,45 @@ function EditorContent({ apiKey }) {
|
|
|
16987
16987
|
// src/index.ts
|
|
16988
16988
|
var API_VALID = false;
|
|
16989
16989
|
var API_VERSION = "";
|
|
16990
|
-
|
|
16991
|
-
|
|
16992
|
-
|
|
16990
|
+
var isNode = typeof window === "undefined";
|
|
16991
|
+
var validityMap = {
|
|
16992
|
+
free: 14,
|
|
16993
|
+
pro: 30,
|
|
16994
|
+
premium: 30,
|
|
16995
|
+
platinum: 30
|
|
16996
|
+
};
|
|
16997
|
+
function getInstallDateKey() {
|
|
16998
|
+
return "tetrons_installed_at";
|
|
16999
|
+
}
|
|
17000
|
+
async function getOrCreateInstallDate() {
|
|
17001
|
+
const key = getInstallDateKey();
|
|
17002
|
+
if (isNode) {
|
|
17003
|
+
const fs = await Promise.resolve().then(() => _interopRequireWildcard(require("fs")));
|
|
17004
|
+
const path = await Promise.resolve().then(() => _interopRequireWildcard(require("path")));
|
|
17005
|
+
const usagePath = path.join(process.cwd(), ".tetrons-usage.json");
|
|
17006
|
+
if (fs.existsSync(usagePath)) {
|
|
17007
|
+
const data = JSON.parse(fs.readFileSync(usagePath, "utf-8"));
|
|
17008
|
+
return new Date(data.installedAt);
|
|
17009
|
+
}
|
|
17010
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
17011
|
+
fs.writeFileSync(usagePath, JSON.stringify({ installedAt: now }));
|
|
17012
|
+
return new Date(now);
|
|
17013
|
+
} else {
|
|
17014
|
+
const saved = localStorage.getItem(key);
|
|
17015
|
+
if (saved) return new Date(saved);
|
|
17016
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
17017
|
+
localStorage.setItem(key, now);
|
|
17018
|
+
return new Date(now);
|
|
16993
17019
|
}
|
|
17020
|
+
}
|
|
17021
|
+
function getRemainingDays(installedAt, validityDays) {
|
|
17022
|
+
const now = /* @__PURE__ */ new Date();
|
|
17023
|
+
const diff = Math.floor(
|
|
17024
|
+
(now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
|
|
17025
|
+
);
|
|
17026
|
+
return validityDays - diff;
|
|
17027
|
+
}
|
|
17028
|
+
async function initializeTetrons(apiKey) {
|
|
16994
17029
|
const res = await fetch("https://staging.tetrons.com/api/validate", {
|
|
16995
17030
|
method: "POST",
|
|
16996
17031
|
headers: {
|
|
@@ -17008,9 +17043,11 @@ async function initializeTetrons(apiKey) {
|
|
|
17008
17043
|
if (!API_VALID) {
|
|
17009
17044
|
throw new Error("API Key is not valid.");
|
|
17010
17045
|
}
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
|
|
17046
|
+
if (API_VERSION === "") {
|
|
17047
|
+
throw new Error("No license version provided.");
|
|
17048
|
+
}
|
|
17049
|
+
const validityDays = validityMap[API_VERSION];
|
|
17050
|
+
const installedAt = await getOrCreateInstallDate();
|
|
17014
17051
|
const remainingDays = getRemainingDays(installedAt, validityDays);
|
|
17015
17052
|
if (remainingDays <= 0) {
|
|
17016
17053
|
throw new Error(`Your ${API_VERSION} license has expired.`);
|
|
@@ -17019,20 +17056,18 @@ async function initializeTetrons(apiKey) {
|
|
|
17019
17056
|
`[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`
|
|
17020
17057
|
);
|
|
17021
17058
|
}
|
|
17022
|
-
async function getTetronsRemainingDays() {
|
|
17023
|
-
if (!API_VALID || !API_VERSION) return null;
|
|
17024
|
-
if (typeof window !== "undefined") return null;
|
|
17025
|
-
const { getOrCreateInstallDate, getRemainingDays } = await Promise.resolve().then(() => _interopRequireWildcard(require("./licenseUtils.server-UVEGEAXB.cjs")));
|
|
17026
|
-
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17027
|
-
const installedAt = getOrCreateInstallDate();
|
|
17028
|
-
return getRemainingDays(installedAt, validityDays);
|
|
17029
|
-
}
|
|
17030
17059
|
function getTetronsVersion() {
|
|
17031
17060
|
return API_VERSION;
|
|
17032
17061
|
}
|
|
17033
17062
|
function isApiKeyValid() {
|
|
17034
17063
|
return API_VALID;
|
|
17035
17064
|
}
|
|
17065
|
+
async function getTetronsRemainingDays() {
|
|
17066
|
+
if (!API_VALID || API_VERSION === "") return null;
|
|
17067
|
+
const validityDays = validityMap[API_VERSION];
|
|
17068
|
+
const installedAt = await getOrCreateInstallDate();
|
|
17069
|
+
return getRemainingDays(installedAt, validityDays);
|
|
17070
|
+
}
|
|
17036
17071
|
var index_default = EditorContent;
|
|
17037
17072
|
|
|
17038
17073
|
|
package/dist/index.d.mts
CHANGED
|
@@ -6,8 +6,8 @@ type EditorContentProps = {
|
|
|
6
6
|
declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Element;
|
|
7
7
|
|
|
8
8
|
declare function initializeTetrons(apiKey: string): Promise<void>;
|
|
9
|
-
declare function getTetronsRemainingDays(): Promise<number | null>;
|
|
10
9
|
declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
|
|
11
10
|
declare function isApiKeyValid(): boolean;
|
|
11
|
+
declare function getTetronsRemainingDays(): Promise<number | null>;
|
|
12
12
|
|
|
13
13
|
export { EditorContent, EditorContent as default, getTetronsRemainingDays, getTetronsVersion, initializeTetrons, isApiKeyValid };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ type EditorContentProps = {
|
|
|
6
6
|
declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Element;
|
|
7
7
|
|
|
8
8
|
declare function initializeTetrons(apiKey: string): Promise<void>;
|
|
9
|
-
declare function getTetronsRemainingDays(): Promise<number | null>;
|
|
10
9
|
declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
|
|
11
10
|
declare function isApiKeyValid(): boolean;
|
|
11
|
+
declare function getTetronsRemainingDays(): Promise<number | null>;
|
|
12
12
|
|
|
13
13
|
export { EditorContent, EditorContent as default, getTetronsRemainingDays, getTetronsVersion, initializeTetrons, isApiKeyValid };
|
package/dist/index.mjs
CHANGED
|
@@ -11504,16 +11504,16 @@ editHandlers.drop = (view, _event) => {
|
|
|
11504
11504
|
tr.deleteSelection();
|
|
11505
11505
|
}
|
|
11506
11506
|
let pos = tr.mapping.map(insertPos);
|
|
11507
|
-
let
|
|
11507
|
+
let isNode2 = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
|
|
11508
11508
|
let beforeInsert = tr.doc;
|
|
11509
|
-
if (
|
|
11509
|
+
if (isNode2)
|
|
11510
11510
|
tr.replaceRangeWith(pos, pos, slice2.content.firstChild);
|
|
11511
11511
|
else
|
|
11512
11512
|
tr.replaceRange(pos, pos, slice2);
|
|
11513
11513
|
if (tr.doc.eq(beforeInsert))
|
|
11514
11514
|
return;
|
|
11515
11515
|
let $pos = tr.doc.resolve(pos);
|
|
11516
|
-
if (
|
|
11516
|
+
if (isNode2 && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
|
|
11517
11517
|
tr.setSelection(new NodeSelection($pos));
|
|
11518
11518
|
} else {
|
|
11519
11519
|
let end = tr.mapping.map(insertPos);
|
|
@@ -16987,10 +16987,45 @@ function EditorContent({ apiKey }) {
|
|
|
16987
16987
|
// src/index.ts
|
|
16988
16988
|
var API_VALID = false;
|
|
16989
16989
|
var API_VERSION = "";
|
|
16990
|
-
|
|
16991
|
-
|
|
16992
|
-
|
|
16990
|
+
var isNode = typeof window === "undefined";
|
|
16991
|
+
var validityMap = {
|
|
16992
|
+
free: 14,
|
|
16993
|
+
pro: 30,
|
|
16994
|
+
premium: 30,
|
|
16995
|
+
platinum: 30
|
|
16996
|
+
};
|
|
16997
|
+
function getInstallDateKey() {
|
|
16998
|
+
return "tetrons_installed_at";
|
|
16999
|
+
}
|
|
17000
|
+
async function getOrCreateInstallDate() {
|
|
17001
|
+
const key = getInstallDateKey();
|
|
17002
|
+
if (isNode) {
|
|
17003
|
+
const fs = await import("fs");
|
|
17004
|
+
const path = await import("path");
|
|
17005
|
+
const usagePath = path.join(process.cwd(), ".tetrons-usage.json");
|
|
17006
|
+
if (fs.existsSync(usagePath)) {
|
|
17007
|
+
const data = JSON.parse(fs.readFileSync(usagePath, "utf-8"));
|
|
17008
|
+
return new Date(data.installedAt);
|
|
17009
|
+
}
|
|
17010
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
17011
|
+
fs.writeFileSync(usagePath, JSON.stringify({ installedAt: now }));
|
|
17012
|
+
return new Date(now);
|
|
17013
|
+
} else {
|
|
17014
|
+
const saved = localStorage.getItem(key);
|
|
17015
|
+
if (saved) return new Date(saved);
|
|
17016
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
17017
|
+
localStorage.setItem(key, now);
|
|
17018
|
+
return new Date(now);
|
|
16993
17019
|
}
|
|
17020
|
+
}
|
|
17021
|
+
function getRemainingDays(installedAt, validityDays) {
|
|
17022
|
+
const now = /* @__PURE__ */ new Date();
|
|
17023
|
+
const diff = Math.floor(
|
|
17024
|
+
(now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
|
|
17025
|
+
);
|
|
17026
|
+
return validityDays - diff;
|
|
17027
|
+
}
|
|
17028
|
+
async function initializeTetrons(apiKey) {
|
|
16994
17029
|
const res = await fetch("https://staging.tetrons.com/api/validate", {
|
|
16995
17030
|
method: "POST",
|
|
16996
17031
|
headers: {
|
|
@@ -17008,9 +17043,11 @@ async function initializeTetrons(apiKey) {
|
|
|
17008
17043
|
if (!API_VALID) {
|
|
17009
17044
|
throw new Error("API Key is not valid.");
|
|
17010
17045
|
}
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
|
|
17046
|
+
if (API_VERSION === "") {
|
|
17047
|
+
throw new Error("No license version provided.");
|
|
17048
|
+
}
|
|
17049
|
+
const validityDays = validityMap[API_VERSION];
|
|
17050
|
+
const installedAt = await getOrCreateInstallDate();
|
|
17014
17051
|
const remainingDays = getRemainingDays(installedAt, validityDays);
|
|
17015
17052
|
if (remainingDays <= 0) {
|
|
17016
17053
|
throw new Error(`Your ${API_VERSION} license has expired.`);
|
|
@@ -17019,20 +17056,18 @@ async function initializeTetrons(apiKey) {
|
|
|
17019
17056
|
`[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`
|
|
17020
17057
|
);
|
|
17021
17058
|
}
|
|
17022
|
-
async function getTetronsRemainingDays() {
|
|
17023
|
-
if (!API_VALID || !API_VERSION) return null;
|
|
17024
|
-
if (typeof window !== "undefined") return null;
|
|
17025
|
-
const { getOrCreateInstallDate, getRemainingDays } = await import("./licenseUtils.server-7MTJIRHQ.mjs");
|
|
17026
|
-
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17027
|
-
const installedAt = getOrCreateInstallDate();
|
|
17028
|
-
return getRemainingDays(installedAt, validityDays);
|
|
17029
|
-
}
|
|
17030
17059
|
function getTetronsVersion() {
|
|
17031
17060
|
return API_VERSION;
|
|
17032
17061
|
}
|
|
17033
17062
|
function isApiKeyValid() {
|
|
17034
17063
|
return API_VALID;
|
|
17035
17064
|
}
|
|
17065
|
+
async function getTetronsRemainingDays() {
|
|
17066
|
+
if (!API_VALID || API_VERSION === "") return null;
|
|
17067
|
+
const validityDays = validityMap[API_VERSION];
|
|
17068
|
+
const installedAt = await getOrCreateInstallDate();
|
|
17069
|
+
return getRemainingDays(installedAt, validityDays);
|
|
17070
|
+
}
|
|
17036
17071
|
var index_default = EditorContent;
|
|
17037
17072
|
export {
|
|
17038
17073
|
EditorContent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tetrons",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.54",
|
|
4
4
|
"description": "A Next.js project written in TypeScript",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -75,8 +75,11 @@
|
|
|
75
75
|
"license": "MIT",
|
|
76
76
|
"exports": {
|
|
77
77
|
".": {
|
|
78
|
+
"browser": "./dist/index.browser.js",
|
|
79
|
+
"node": "./dist/index.node.js",
|
|
78
80
|
"import": "./dist/index.mjs",
|
|
79
|
-
"require": "./dist/index.cjs"
|
|
81
|
+
"require": "./dist/index.cjs",
|
|
82
|
+
"default": "./dist/index.browser.js"
|
|
80
83
|
},
|
|
81
84
|
"./style.css": "./dist/styles/tetrons.css",
|
|
82
85
|
"./app/api/ai-action/route": {
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// licenseUtils.server.ts
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import path from "path";
|
|
4
|
-
var USAGE_FILE_PATH = path.join(process.cwd(), ".tetrons-usage.json");
|
|
5
|
-
function getOrCreateInstallDate() {
|
|
6
|
-
try {
|
|
7
|
-
if (!fs.existsSync(USAGE_FILE_PATH)) {
|
|
8
|
-
const installDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
9
|
-
fs.writeFileSync(
|
|
10
|
-
USAGE_FILE_PATH,
|
|
11
|
-
JSON.stringify({ installedAt: installDate })
|
|
12
|
-
);
|
|
13
|
-
return installDate;
|
|
14
|
-
}
|
|
15
|
-
const content = fs.readFileSync(USAGE_FILE_PATH, "utf-8");
|
|
16
|
-
return JSON.parse(content).installedAt;
|
|
17
|
-
} catch {
|
|
18
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function getRemainingDays(installedAt, validityDays) {
|
|
22
|
-
const installed = new Date(installedAt);
|
|
23
|
-
const now = /* @__PURE__ */ new Date();
|
|
24
|
-
const diffMs = now.getTime() - installed.getTime();
|
|
25
|
-
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
26
|
-
return Math.max(0, validityDays - diffDays);
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
getOrCreateInstallDate,
|
|
30
|
-
getRemainingDays
|
|
31
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// licenseUtils.server.ts
|
|
2
|
-
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
3
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
4
|
-
var USAGE_FILE_PATH = _path2.default.join(process.cwd(), ".tetrons-usage.json");
|
|
5
|
-
function getOrCreateInstallDate() {
|
|
6
|
-
try {
|
|
7
|
-
if (!_fs2.default.existsSync(USAGE_FILE_PATH)) {
|
|
8
|
-
const installDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
9
|
-
_fs2.default.writeFileSync(
|
|
10
|
-
USAGE_FILE_PATH,
|
|
11
|
-
JSON.stringify({ installedAt: installDate })
|
|
12
|
-
);
|
|
13
|
-
return installDate;
|
|
14
|
-
}
|
|
15
|
-
const content = _fs2.default.readFileSync(USAGE_FILE_PATH, "utf-8");
|
|
16
|
-
return JSON.parse(content).installedAt;
|
|
17
|
-
} catch (e) {
|
|
18
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function getRemainingDays(installedAt, validityDays) {
|
|
22
|
-
const installed = new Date(installedAt);
|
|
23
|
-
const now = /* @__PURE__ */ new Date();
|
|
24
|
-
const diffMs = now.getTime() - installed.getTime();
|
|
25
|
-
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
26
|
-
return Math.max(0, validityDays - diffDays);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
exports.getOrCreateInstallDate = getOrCreateInstallDate; exports.getRemainingDays = getRemainingDays;
|