tetrons 2.3.69 → 2.3.70

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "tetrons",
3
- "version": "2.3.69",
3
+ "version": "2.3.70",
4
4
  "description": "A Next.js project written in TypeScript",
5
- "main": "./dist/index.node.cjs",
6
- "module": "./dist/index.node.mjs",
7
- "types": "./dist/index.d.ts",
5
+ "main": "./dist/node.node.cjs",
6
+ "module": "./dist/node.node.mjs",
7
+ "types": "./dist/browser.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",
@@ -75,13 +75,13 @@
75
75
  "license": "MIT",
76
76
  "exports": {
77
77
  ".": {
78
- "browser": "./dist/index.browser.js",
79
- "import": "./dist/index.node.mjs",
80
- "require": "./dist/index.node.cjs"
78
+ "browser": "./dist/browser.browser.js",
79
+ "import": "./dist/node.node.mjs",
80
+ "require": "./dist/node.node.cjs"
81
81
  },
82
82
  "./browser": {
83
- "import": "./dist/index.browser.js",
84
- "require": "./dist/index.browser.js"
83
+ "import": "./dist/browser.browser.js",
84
+ "require": "./dist/browser.browser.js"
85
85
  },
86
86
  "./style.css": "./dist/styles/tetrons.css",
87
87
  "./app/api/ai-action/route": {
@@ -1,86 +0,0 @@
1
- import {
2
- EditorContent
3
- } from "./chunk-X7AC43AX.browser.js";
4
-
5
- // src/index.ts
6
- var API_VALID = false;
7
- var API_VERSION = "";
8
- var validityMap = {
9
- free: 14,
10
- pro: 30,
11
- premium: 30,
12
- platinum: 30
13
- };
14
- var _installedAt = null;
15
- async function getOrCreateInstallDate() {
16
- if (_installedAt) return _installedAt;
17
- if (typeof window === "undefined") {
18
- const mod = await import("./index.nodeimpl-TWE53STQ.browser.js");
19
- _installedAt = await mod.getOrCreateInstallDate();
20
- } else {
21
- const mod = await import("./index.browserimpl-E7NZTX57.browser.js");
22
- _installedAt = await mod.getOrCreateInstallDate();
23
- }
24
- return _installedAt;
25
- }
26
- function getRemainingDays(installedAt, validityDays) {
27
- const now = /* @__PURE__ */ new Date();
28
- const diff = Math.floor(
29
- (now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
30
- );
31
- return validityDays - diff;
32
- }
33
- async function initializeTetrons(apiKey) {
34
- const res = await fetch("https://staging.tetrons.com/api/validate", {
35
- method: "POST",
36
- headers: {
37
- "Content-Type": "application/json"
38
- },
39
- body: JSON.stringify({ apiKey })
40
- });
41
- if (!res.ok) {
42
- const error = await res.json();
43
- throw new Error(`API Key validation failed: ${error.error}`);
44
- }
45
- const data = await res.json();
46
- API_VALID = data.valid;
47
- if (!API_VALID) {
48
- throw new Error("API Key is not valid.");
49
- }
50
- if (!(data.version in validityMap)) {
51
- throw new Error(`Unsupported license version: ${data.version}`);
52
- }
53
- API_VERSION = data.version;
54
- const validityDays = validityMap[API_VERSION];
55
- const installedAt = await getOrCreateInstallDate();
56
- const remainingDays = getRemainingDays(installedAt, validityDays);
57
- if (remainingDays <= 0) {
58
- throw new Error(
59
- `Your ${API_VERSION} license expired after ${validityDays} days.`
60
- );
61
- }
62
- console.log(
63
- `[TETRONS] Initialized: ${API_VERSION} | Remaining days: ${remainingDays}`
64
- );
65
- }
66
- function getTetronsVersion() {
67
- return API_VERSION;
68
- }
69
- function isApiKeyValid() {
70
- return API_VALID;
71
- }
72
- async function getTetronsRemainingDays() {
73
- if (!API_VALID || API_VERSION === "") return null;
74
- const validityDays = validityMap[API_VERSION];
75
- const installedAt = await getOrCreateInstallDate();
76
- return getRemainingDays(installedAt, validityDays);
77
- }
78
- var index_default = EditorContent;
79
- export {
80
- EditorContent,
81
- index_default as default,
82
- getTetronsRemainingDays,
83
- getTetronsVersion,
84
- initializeTetrons,
85
- isApiKeyValid
86
- };
@@ -1,18 +0,0 @@
1
- // src/index.browserimpl.ts
2
- function getInstallDateKey() {
3
- return "tetrons_installed_at";
4
- }
5
- async function getOrCreateInstallDate() {
6
- const key = getInstallDateKey();
7
- const saved = localStorage.getItem(key);
8
- if (saved) {
9
- const parsed = new Date(saved);
10
- if (!isNaN(parsed.getTime())) return parsed;
11
- }
12
- const now = (/* @__PURE__ */ new Date()).toISOString();
13
- localStorage.setItem(key, now);
14
- return new Date(now);
15
- }
16
- export {
17
- getOrCreateInstallDate
18
- };
package/dist/index.d.mts DELETED
@@ -1,13 +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
- declare function initializeTetrons(apiKey: string): Promise<void>;
9
- declare function getTetronsVersion(): string;
10
- declare function isApiKeyValid(): boolean;
11
- declare function getTetronsRemainingDays(): Promise<number | null>;
12
-
13
- export { EditorContent, EditorContent as default, getTetronsRemainingDays, getTetronsVersion, initializeTetrons, isApiKeyValid };