tetrons 2.3.36 → 2.3.37
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 +14 -14
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +14 -14
- package/package.json +11 -5
- package/dist/src/index.d.ts +0 -7
- package/dist/src/index.js +0 -51
- package/dist/src/server/usage.d.ts +0 -2
- package/dist/src/server/usage.js +0 -17
package/dist/index.cjs
CHANGED
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// src/server/
|
|
34
|
-
var
|
|
35
|
-
__export(
|
|
33
|
+
// src/server/licenseUtils.ts
|
|
34
|
+
var licenseUtils_exports = {};
|
|
35
|
+
__export(licenseUtils_exports, {
|
|
36
36
|
getOrCreateInstallDate: () => getOrCreateInstallDate,
|
|
37
37
|
getRemainingDays: () => getRemainingDays
|
|
38
38
|
});
|
|
@@ -53,8 +53,8 @@ function getRemainingDays(installedAt, validityDays) {
|
|
|
53
53
|
return validityDays - diff;
|
|
54
54
|
}
|
|
55
55
|
var import_fs, import_path, USAGE_FILE_PATH;
|
|
56
|
-
var
|
|
57
|
-
"src/server/
|
|
56
|
+
var init_licenseUtils = __esm({
|
|
57
|
+
"src/server/licenseUtils.ts"() {
|
|
58
58
|
"use strict";
|
|
59
59
|
import_fs = __toESM(require("fs"));
|
|
60
60
|
import_path = __toESM(require("path"));
|
|
@@ -17035,9 +17035,9 @@ async function initializeTetrons(apiKey) {
|
|
|
17035
17035
|
throw new Error("API Key is not valid.");
|
|
17036
17036
|
}
|
|
17037
17037
|
if (typeof window !== "undefined") {
|
|
17038
|
-
throw new Error("initializeTetrons
|
|
17038
|
+
throw new Error("initializeTetrons must be called server-side");
|
|
17039
17039
|
}
|
|
17040
|
-
const { getOrCreateInstallDate: getOrCreateInstallDate2, getRemainingDays: getRemainingDays2 } = await Promise.resolve().then(() => (
|
|
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();
|
|
17043
17043
|
const remainingDays = getRemainingDays2(installedAt, validityDays);
|
|
@@ -17048,20 +17048,20 @@ async function initializeTetrons(apiKey) {
|
|
|
17048
17048
|
`[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`
|
|
17049
17049
|
);
|
|
17050
17050
|
}
|
|
17051
|
-
function getTetronsVersion() {
|
|
17052
|
-
return API_VERSION;
|
|
17053
|
-
}
|
|
17054
|
-
function isApiKeyValid() {
|
|
17055
|
-
return API_VALID;
|
|
17056
|
-
}
|
|
17057
17051
|
async function getTetronsRemainingDays() {
|
|
17058
17052
|
if (!API_VALID || !API_VERSION) return null;
|
|
17059
17053
|
if (typeof window !== "undefined") return null;
|
|
17060
|
-
const { getOrCreateInstallDate: getOrCreateInstallDate2, getRemainingDays: getRemainingDays2 } = await Promise.resolve().then(() => (
|
|
17054
|
+
const { getOrCreateInstallDate: getOrCreateInstallDate2, getRemainingDays: getRemainingDays2 } = await Promise.resolve().then(() => (init_licenseUtils(), licenseUtils_exports));
|
|
17061
17055
|
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17062
17056
|
const installedAt = getOrCreateInstallDate2();
|
|
17063
17057
|
return getRemainingDays2(installedAt, validityDays);
|
|
17064
17058
|
}
|
|
17059
|
+
function getTetronsVersion() {
|
|
17060
|
+
return API_VERSION;
|
|
17061
|
+
}
|
|
17062
|
+
function isApiKeyValid() {
|
|
17063
|
+
return API_VALID;
|
|
17064
|
+
}
|
|
17065
17065
|
var index_default = EditorContent;
|
|
17066
17066
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17067
17067
|
0 && (module.exports = {
|
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>;
|
|
9
10
|
declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
|
|
10
11
|
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>;
|
|
9
10
|
declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
|
|
10
11
|
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
|
@@ -8,9 +8,9 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// src/server/
|
|
12
|
-
var
|
|
13
|
-
__export(
|
|
11
|
+
// src/server/licenseUtils.ts
|
|
12
|
+
var licenseUtils_exports = {};
|
|
13
|
+
__export(licenseUtils_exports, {
|
|
14
14
|
getOrCreateInstallDate: () => getOrCreateInstallDate,
|
|
15
15
|
getRemainingDays: () => getRemainingDays
|
|
16
16
|
});
|
|
@@ -33,8 +33,8 @@ function getRemainingDays(installedAt, validityDays) {
|
|
|
33
33
|
return validityDays - diff;
|
|
34
34
|
}
|
|
35
35
|
var USAGE_FILE_PATH;
|
|
36
|
-
var
|
|
37
|
-
"src/server/
|
|
36
|
+
var init_licenseUtils = __esm({
|
|
37
|
+
"src/server/licenseUtils.ts"() {
|
|
38
38
|
"use strict";
|
|
39
39
|
USAGE_FILE_PATH = path.join(process.cwd(), ".tetrons-usage.json");
|
|
40
40
|
}
|
|
@@ -17048,9 +17048,9 @@ async function initializeTetrons(apiKey) {
|
|
|
17048
17048
|
throw new Error("API Key is not valid.");
|
|
17049
17049
|
}
|
|
17050
17050
|
if (typeof window !== "undefined") {
|
|
17051
|
-
throw new Error("initializeTetrons
|
|
17051
|
+
throw new Error("initializeTetrons must be called server-side");
|
|
17052
17052
|
}
|
|
17053
|
-
const { getOrCreateInstallDate: getOrCreateInstallDate2, getRemainingDays: getRemainingDays2 } = await Promise.resolve().then(() => (
|
|
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();
|
|
17056
17056
|
const remainingDays = getRemainingDays2(installedAt, validityDays);
|
|
@@ -17061,20 +17061,20 @@ async function initializeTetrons(apiKey) {
|
|
|
17061
17061
|
`[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`
|
|
17062
17062
|
);
|
|
17063
17063
|
}
|
|
17064
|
-
function getTetronsVersion() {
|
|
17065
|
-
return API_VERSION;
|
|
17066
|
-
}
|
|
17067
|
-
function isApiKeyValid() {
|
|
17068
|
-
return API_VALID;
|
|
17069
|
-
}
|
|
17070
17064
|
async function getTetronsRemainingDays() {
|
|
17071
17065
|
if (!API_VALID || !API_VERSION) return null;
|
|
17072
17066
|
if (typeof window !== "undefined") return null;
|
|
17073
|
-
const { getOrCreateInstallDate: getOrCreateInstallDate2, getRemainingDays: getRemainingDays2 } = await Promise.resolve().then(() => (
|
|
17067
|
+
const { getOrCreateInstallDate: getOrCreateInstallDate2, getRemainingDays: getRemainingDays2 } = await Promise.resolve().then(() => (init_licenseUtils(), licenseUtils_exports));
|
|
17074
17068
|
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
17075
17069
|
const installedAt = getOrCreateInstallDate2();
|
|
17076
17070
|
return getRemainingDays2(installedAt, validityDays);
|
|
17077
17071
|
}
|
|
17072
|
+
function getTetronsVersion() {
|
|
17073
|
+
return API_VERSION;
|
|
17074
|
+
}
|
|
17075
|
+
function isApiKeyValid() {
|
|
17076
|
+
return API_VALID;
|
|
17077
|
+
}
|
|
17078
17078
|
var index_default = EditorContent;
|
|
17079
17079
|
export {
|
|
17080
17080
|
EditorContent,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tetrons",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.37",
|
|
4
4
|
"description": "A Next.js project written in TypeScript",
|
|
5
|
-
"main": "dist/index.
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
@@ -70,7 +70,8 @@
|
|
|
70
70
|
"react",
|
|
71
71
|
"web"
|
|
72
72
|
],
|
|
73
|
-
"
|
|
73
|
+
"sideEffects": false,
|
|
74
|
+
"author": "Swastik Jha <swastik.jha@finapsys.co.in>",
|
|
74
75
|
"license": "MIT",
|
|
75
76
|
"exports": {
|
|
76
77
|
".": {
|
|
@@ -101,12 +102,17 @@
|
|
|
101
102
|
"./app/api/validate/route": {
|
|
102
103
|
"import": "./dist/app/api/validate/route.mjs",
|
|
103
104
|
"require": "./dist/app/api/validate/route.cjs"
|
|
105
|
+
},
|
|
106
|
+
"./server/licenseUtils": {
|
|
107
|
+
"import": "./dist/server/licenseUtils.js",
|
|
108
|
+
"require": "./dist/server/licenseUtils.js"
|
|
104
109
|
}
|
|
105
110
|
},
|
|
106
111
|
"files": [
|
|
107
|
-
"dist",
|
|
112
|
+
"dist",
|
|
108
113
|
"dist/styles/tetrons.css",
|
|
109
|
-
"dist/components"
|
|
114
|
+
"dist/components",
|
|
115
|
+
"dist/server"
|
|
110
116
|
],
|
|
111
117
|
"bugs": {
|
|
112
118
|
"url": "https://github.com/Finapsys/Tetrons/issues"
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import EditorContent from "./components/tetrons/EditorContent";
|
|
2
|
-
export declare function initializeTetrons(apiKey: string): Promise<void>;
|
|
3
|
-
export declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
|
|
4
|
-
export declare function isApiKeyValid(): boolean;
|
|
5
|
-
export declare function getTetronsRemainingDays(): Promise<number | null>;
|
|
6
|
-
export { EditorContent };
|
|
7
|
-
export default EditorContent;
|
package/dist/src/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import EditorContent from "./components/tetrons/EditorContent";
|
|
2
|
-
let API_VALID = false;
|
|
3
|
-
let API_VERSION = "";
|
|
4
|
-
export async function initializeTetrons(apiKey) {
|
|
5
|
-
const res = await fetch("https://staging.tetrons.com/api/validate", {
|
|
6
|
-
method: "POST",
|
|
7
|
-
headers: {
|
|
8
|
-
"Content-Type": "application/json",
|
|
9
|
-
},
|
|
10
|
-
body: JSON.stringify({ apiKey }),
|
|
11
|
-
});
|
|
12
|
-
if (!res.ok) {
|
|
13
|
-
const error = await res.json();
|
|
14
|
-
throw new Error(`API Key validation failed: ${error.error}`);
|
|
15
|
-
}
|
|
16
|
-
const data = await res.json();
|
|
17
|
-
API_VALID = data.valid;
|
|
18
|
-
API_VERSION = data.version;
|
|
19
|
-
if (!API_VALID) {
|
|
20
|
-
throw new Error("API Key is not valid.");
|
|
21
|
-
}
|
|
22
|
-
if (typeof window !== "undefined") {
|
|
23
|
-
throw new Error("initializeTetrons() must be called server-side.");
|
|
24
|
-
}
|
|
25
|
-
const { getOrCreateInstallDate, getRemainingDays } = await import("./server/usage.js");
|
|
26
|
-
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
27
|
-
const installedAt = getOrCreateInstallDate();
|
|
28
|
-
const remainingDays = getRemainingDays(installedAt, validityDays);
|
|
29
|
-
if (remainingDays <= 0) {
|
|
30
|
-
throw new Error(`Your ${API_VERSION} license has expired.`);
|
|
31
|
-
}
|
|
32
|
-
console.log(`[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`);
|
|
33
|
-
}
|
|
34
|
-
export function getTetronsVersion() {
|
|
35
|
-
return API_VERSION;
|
|
36
|
-
}
|
|
37
|
-
export function isApiKeyValid() {
|
|
38
|
-
return API_VALID;
|
|
39
|
-
}
|
|
40
|
-
export async function getTetronsRemainingDays() {
|
|
41
|
-
if (!API_VALID || !API_VERSION)
|
|
42
|
-
return null;
|
|
43
|
-
if (typeof window !== "undefined")
|
|
44
|
-
return null;
|
|
45
|
-
const { getOrCreateInstallDate, getRemainingDays } = await import("./server/usage.js");
|
|
46
|
-
const validityDays = API_VERSION === "free" ? 14 : 30;
|
|
47
|
-
const installedAt = getOrCreateInstallDate();
|
|
48
|
-
return getRemainingDays(installedAt, validityDays);
|
|
49
|
-
}
|
|
50
|
-
export { EditorContent };
|
|
51
|
-
export default EditorContent;
|
package/dist/src/server/usage.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
const USAGE_FILE_PATH = path.join(process.cwd(), ".tetrons-usage.json");
|
|
4
|
-
export function getOrCreateInstallDate() {
|
|
5
|
-
if (fs.existsSync(USAGE_FILE_PATH)) {
|
|
6
|
-
const data = JSON.parse(fs.readFileSync(USAGE_FILE_PATH, "utf-8"));
|
|
7
|
-
return new Date(data.installedAt);
|
|
8
|
-
}
|
|
9
|
-
const now = new Date().toISOString();
|
|
10
|
-
fs.writeFileSync(USAGE_FILE_PATH, JSON.stringify({ installedAt: now }));
|
|
11
|
-
return new Date(now);
|
|
12
|
-
}
|
|
13
|
-
export function getRemainingDays(installedAt, validityDays) {
|
|
14
|
-
const now = new Date();
|
|
15
|
-
const diff = Math.floor((now.getTime() - installedAt.getTime()) / (1000 * 60 * 60 * 24));
|
|
16
|
-
return validityDays - diff;
|
|
17
|
-
}
|