tetrons 2.3.49 → 2.3.50
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
|
@@ -17008,7 +17008,7 @@ async function initializeTetrons(apiKey) {
|
|
|
17008
17008
|
if (!API_VALID) {
|
|
17009
17009
|
throw new Error("API Key is not valid.");
|
|
17010
17010
|
}
|
|
17011
|
-
const { getOrCreateInstallDate, getRemainingDays } = await Promise.resolve().then(() => _interopRequireWildcard(require("./licenseUtils-
|
|
17011
|
+
const { getOrCreateInstallDate, getRemainingDays } = await Promise.resolve().then(() => _interopRequireWildcard(require("./licenseUtils.server-PRZ4NOZQ.cjs")));
|
|
17012
17012
|
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17013
17013
|
const installedAt = getOrCreateInstallDate();
|
|
17014
17014
|
const remainingDays = getRemainingDays(installedAt, validityDays);
|
|
@@ -17022,7 +17022,7 @@ async function initializeTetrons(apiKey) {
|
|
|
17022
17022
|
async function getTetronsRemainingDays() {
|
|
17023
17023
|
if (!API_VALID || !API_VERSION) return null;
|
|
17024
17024
|
if (typeof window !== "undefined") return null;
|
|
17025
|
-
const { getOrCreateInstallDate, getRemainingDays } = await Promise.resolve().then(() => _interopRequireWildcard(require("./licenseUtils-
|
|
17025
|
+
const { getOrCreateInstallDate, getRemainingDays } = await Promise.resolve().then(() => _interopRequireWildcard(require("./licenseUtils.server-PRZ4NOZQ.cjs")));
|
|
17026
17026
|
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17027
17027
|
const installedAt = getOrCreateInstallDate();
|
|
17028
17028
|
return getRemainingDays(installedAt, validityDays);
|
package/dist/index.mjs
CHANGED
|
@@ -17008,7 +17008,7 @@ async function initializeTetrons(apiKey) {
|
|
|
17008
17008
|
if (!API_VALID) {
|
|
17009
17009
|
throw new Error("API Key is not valid.");
|
|
17010
17010
|
}
|
|
17011
|
-
const { getOrCreateInstallDate, getRemainingDays } = await import("./licenseUtils-
|
|
17011
|
+
const { getOrCreateInstallDate, getRemainingDays } = await import("./licenseUtils.server-7LOHNNQ2.mjs");
|
|
17012
17012
|
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17013
17013
|
const installedAt = getOrCreateInstallDate();
|
|
17014
17014
|
const remainingDays = getRemainingDays(installedAt, validityDays);
|
|
@@ -17022,7 +17022,7 @@ async function initializeTetrons(apiKey) {
|
|
|
17022
17022
|
async function getTetronsRemainingDays() {
|
|
17023
17023
|
if (!API_VALID || !API_VERSION) return null;
|
|
17024
17024
|
if (typeof window !== "undefined") return null;
|
|
17025
|
-
const { getOrCreateInstallDate, getRemainingDays } = await import("./licenseUtils-
|
|
17025
|
+
const { getOrCreateInstallDate, getRemainingDays } = await import("./licenseUtils.server-7LOHNNQ2.mjs");
|
|
17026
17026
|
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17027
17027
|
const installedAt = getOrCreateInstallDate();
|
|
17028
17028
|
return getRemainingDays(installedAt, validityDays);
|
|
@@ -0,0 +1,28 @@
|
|
|
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(USAGE_FILE_PATH, JSON.stringify({ installedAt: installDate }));
|
|
10
|
+
return installDate;
|
|
11
|
+
}
|
|
12
|
+
const content = fs.readFileSync(USAGE_FILE_PATH, "utf-8");
|
|
13
|
+
return JSON.parse(content).installedAt;
|
|
14
|
+
} catch {
|
|
15
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function getRemainingDays(installedAt, validityDays) {
|
|
19
|
+
const installed = new Date(installedAt);
|
|
20
|
+
const now = /* @__PURE__ */ new Date();
|
|
21
|
+
const diffMs = now.getTime() - installed.getTime();
|
|
22
|
+
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
23
|
+
return Math.max(0, validityDays - diffDays);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
getOrCreateInstallDate,
|
|
27
|
+
getRemainingDays
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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(USAGE_FILE_PATH, JSON.stringify({ installedAt: installDate }));
|
|
10
|
+
return installDate;
|
|
11
|
+
}
|
|
12
|
+
const content = _fs2.default.readFileSync(USAGE_FILE_PATH, "utf-8");
|
|
13
|
+
return JSON.parse(content).installedAt;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function getRemainingDays(installedAt, validityDays) {
|
|
19
|
+
const installed = new Date(installedAt);
|
|
20
|
+
const now = /* @__PURE__ */ new Date();
|
|
21
|
+
const diffMs = now.getTime() - installed.getTime();
|
|
22
|
+
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
23
|
+
return Math.max(0, validityDays - diffDays);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.getOrCreateInstallDate = getOrCreateInstallDate; exports.getRemainingDays = getRemainingDays;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tetrons",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.50",
|
|
4
4
|
"description": "A Next.js project written in TypeScript",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -104,6 +104,9 @@
|
|
|
104
104
|
"require": "./dist/app/api/validate/route.cjs"
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
+
"browser": {
|
|
108
|
+
"./dist/licenseUtils.server.js": false
|
|
109
|
+
},
|
|
107
110
|
"files": [
|
|
108
111
|
"dist",
|
|
109
112
|
"dist/styles/tetrons.css",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/internal/licenseUtils.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
|
-
if (_fs2.default.existsSync(USAGE_FILE_PATH)) {
|
|
7
|
-
const data = JSON.parse(_fs2.default.readFileSync(USAGE_FILE_PATH, "utf-8"));
|
|
8
|
-
return new Date(data.installedAt);
|
|
9
|
-
}
|
|
10
|
-
const now = /* @__PURE__ */ new Date();
|
|
11
|
-
_fs2.default.writeFileSync(
|
|
12
|
-
USAGE_FILE_PATH,
|
|
13
|
-
JSON.stringify({ installedAt: now.toISOString() })
|
|
14
|
-
);
|
|
15
|
-
return now;
|
|
16
|
-
}
|
|
17
|
-
function getRemainingDays(installedAt, validityDays) {
|
|
18
|
-
const now = /* @__PURE__ */ new Date();
|
|
19
|
-
const diffTime = Math.max(now.getTime() - installedAt.getTime(), 0);
|
|
20
|
-
const diffDays = validityDays - Math.floor(diffTime / (1e3 * 60 * 60 * 24));
|
|
21
|
-
return diffDays;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
exports.getOrCreateInstallDate = getOrCreateInstallDate; exports.getRemainingDays = getRemainingDays;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/internal/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();
|
|
11
|
-
fs.writeFileSync(
|
|
12
|
-
USAGE_FILE_PATH,
|
|
13
|
-
JSON.stringify({ installedAt: now.toISOString() })
|
|
14
|
-
);
|
|
15
|
-
return now;
|
|
16
|
-
}
|
|
17
|
-
function getRemainingDays(installedAt, validityDays) {
|
|
18
|
-
const now = /* @__PURE__ */ new Date();
|
|
19
|
-
const diffTime = Math.max(now.getTime() - installedAt.getTime(), 0);
|
|
20
|
-
const diffDays = validityDays - Math.floor(diffTime / (1e3 * 60 * 60 * 24));
|
|
21
|
-
return diffDays;
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
getOrCreateInstallDate,
|
|
25
|
-
getRemainingDays
|
|
26
|
-
};
|