tetrons 2.3.42 → 2.3.44
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
CHANGED
|
@@ -17017,6 +17017,9 @@ function EditorContent({ apiKey }) {
|
|
|
17017
17017
|
var API_VALID = false;
|
|
17018
17018
|
var API_VERSION = "";
|
|
17019
17019
|
async function initializeTetrons(apiKey) {
|
|
17020
|
+
if (typeof window !== "undefined") {
|
|
17021
|
+
throw new Error("initializeTetrons must be called server-side");
|
|
17022
|
+
}
|
|
17020
17023
|
const res = await fetch("https://staging.tetrons.com/api/validate", {
|
|
17021
17024
|
method: "POST",
|
|
17022
17025
|
headers: {
|
|
@@ -17034,9 +17037,6 @@ async function initializeTetrons(apiKey) {
|
|
|
17034
17037
|
if (!API_VALID) {
|
|
17035
17038
|
throw new Error("API Key is not valid.");
|
|
17036
17039
|
}
|
|
17037
|
-
if (typeof window !== "undefined") {
|
|
17038
|
-
throw new Error("initializeTetrons must be called server-side");
|
|
17039
|
-
}
|
|
17040
17040
|
const { getOrCreateInstallDate: getOrCreateInstallDate2, getRemainingDays: getRemainingDays2 } = await Promise.resolve().then(() => (init_licenseUtils(), licenseUtils_exports));
|
|
17041
17041
|
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17042
17042
|
const installedAt = getOrCreateInstallDate2();
|
package/dist/index.mjs
CHANGED
|
@@ -17030,6 +17030,9 @@ function EditorContent({ apiKey }) {
|
|
|
17030
17030
|
var API_VALID = false;
|
|
17031
17031
|
var API_VERSION = "";
|
|
17032
17032
|
async function initializeTetrons(apiKey) {
|
|
17033
|
+
if (typeof window !== "undefined") {
|
|
17034
|
+
throw new Error("initializeTetrons must be called server-side");
|
|
17035
|
+
}
|
|
17033
17036
|
const res = await fetch("https://staging.tetrons.com/api/validate", {
|
|
17034
17037
|
method: "POST",
|
|
17035
17038
|
headers: {
|
|
@@ -17047,9 +17050,6 @@ async function initializeTetrons(apiKey) {
|
|
|
17047
17050
|
if (!API_VALID) {
|
|
17048
17051
|
throw new Error("API Key is not valid.");
|
|
17049
17052
|
}
|
|
17050
|
-
if (typeof window !== "undefined") {
|
|
17051
|
-
throw new Error("initializeTetrons must be called server-side");
|
|
17052
|
-
}
|
|
17053
17053
|
const { getOrCreateInstallDate: getOrCreateInstallDate2, getRemainingDays: getRemainingDays2 } = await Promise.resolve().then(() => (init_licenseUtils(), licenseUtils_exports));
|
|
17054
17054
|
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17055
17055
|
const installedAt = getOrCreateInstallDate2();
|
package/package.json
CHANGED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/server/licenseUtils.ts
|
|
31
|
-
var licenseUtils_exports = {};
|
|
32
|
-
__export(licenseUtils_exports, {
|
|
33
|
-
getOrCreateInstallDate: () => getOrCreateInstallDate,
|
|
34
|
-
getRemainingDays: () => getRemainingDays
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(licenseUtils_exports);
|
|
37
|
-
var import_fs = __toESM(require("fs"));
|
|
38
|
-
var import_path = __toESM(require("path"));
|
|
39
|
-
var USAGE_FILE_PATH = import_path.default.join(process.cwd(), ".tetrons-usage.json");
|
|
40
|
-
function getOrCreateInstallDate() {
|
|
41
|
-
if (import_fs.default.existsSync(USAGE_FILE_PATH)) {
|
|
42
|
-
const data = JSON.parse(import_fs.default.readFileSync(USAGE_FILE_PATH, "utf-8"));
|
|
43
|
-
return new Date(data.installedAt);
|
|
44
|
-
}
|
|
45
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
46
|
-
import_fs.default.writeFileSync(USAGE_FILE_PATH, JSON.stringify({ installedAt: now }));
|
|
47
|
-
return new Date(now);
|
|
48
|
-
}
|
|
49
|
-
function getRemainingDays(installedAt, validityDays) {
|
|
50
|
-
const now = /* @__PURE__ */ new Date();
|
|
51
|
-
const diff = Math.floor(
|
|
52
|
-
(now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
|
|
53
|
-
);
|
|
54
|
-
return validityDays - diff;
|
|
55
|
-
}
|
|
56
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
-
0 && (module.exports = {
|
|
58
|
-
getOrCreateInstallDate,
|
|
59
|
-
getRemainingDays
|
|
60
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/server/licenseUtils.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
|
-
if (fs.existsSync(USAGE_FILE_PATH)) {
|
|
7
|
-
const data = JSON.parse(fs.readFileSync(USAGE_FILE_PATH, "utf-8"));
|
|
8
|
-
return new Date(data.installedAt);
|
|
9
|
-
}
|
|
10
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
11
|
-
fs.writeFileSync(USAGE_FILE_PATH, JSON.stringify({ installedAt: now }));
|
|
12
|
-
return new Date(now);
|
|
13
|
-
}
|
|
14
|
-
function getRemainingDays(installedAt, validityDays) {
|
|
15
|
-
const now = /* @__PURE__ */ new Date();
|
|
16
|
-
const diff = Math.floor(
|
|
17
|
-
(now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
|
|
18
|
-
);
|
|
19
|
-
return validityDays - diff;
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
getOrCreateInstallDate,
|
|
23
|
-
getRemainingDays
|
|
24
|
-
};
|