tetrons 2.3.81 → 2.3.84

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.
@@ -3,6 +3,7 @@ import { MathInline } from "./extensions/MathExtension";
3
3
  import React, { useEffect, useRef, useState } from "react";
4
4
  import { useEditor, EditorContent as TiptapEditorContent } from "@tiptap/react";
5
5
  import type { AddOn } from "./toolbar/TetronsToolbar";
6
+ import { getActivePlan, Plan } from "../../utils/licenseTracker";
6
7
 
7
8
  import Document from "@tiptap/extension-document";
8
9
  import Paragraph from "@tiptap/extension-paragraph";
@@ -37,7 +38,6 @@ import { createLowlight } from "lowlight";
37
38
 
38
39
  import { useTypo } from "../../utils/useTypo";
39
40
  import { Spellcheck } from "./extensions/Spellcheck";
40
-
41
41
  import { Comment } from "./toolbar/extensions/Comment";
42
42
  import { Subscript } from "./toolbar/marks/Subscript";
43
43
  import { Superscript } from "./toolbar/marks/Superscript";
@@ -87,9 +87,21 @@ export default function EditorContent({ apiKey }: EditorContentProps) {
87
87
 
88
88
  if (!res.ok) throw new Error(data.error || "Invalid API Key");
89
89
 
90
+ const version =
91
+ data.version &&
92
+ ["free", "pro", "premium", "platinum"].includes(data.version)
93
+ ? (data.version as Plan)
94
+ : "free";
95
+
96
+ const activeVersion = getActivePlan(version);
97
+
90
98
  setIsValid(true);
91
- setUserVersion(data.version);
99
+ setUserVersion(activeVersion);
92
100
  setAddOns(data.addOn || []);
101
+
102
+ if (activeVersion === "free" && data.version !== "free") {
103
+ setError("Your paid plan has expired. Downgraded to Free version.");
104
+ }
93
105
  } catch (err: unknown) {
94
106
  setError(err instanceof Error ? err.message : "Invalid API Key");
95
107
  setIsValid(false);
package/dist/index.cjs CHANGED
@@ -263,6 +263,43 @@ var MathInline = import_core.Node.create({
263
263
  var import_react24 = __toESM(require("react"));
264
264
  var import_react25 = require("@tiptap/react");
265
265
 
266
+ // src/utils/licenseTracker.ts
267
+ var getLicenseKey = (plan) => `__tetrons_license_start_${plan}__`;
268
+ var PLAN_DURATIONS = {
269
+ free: Infinity,
270
+ pro: 30,
271
+ premium: 30,
272
+ platinum: 30
273
+ };
274
+ function initLicenseTracking(plan) {
275
+ if (typeof window === "undefined") return;
276
+ const key = getLicenseKey(plan);
277
+ const now = Date.now();
278
+ const stored = localStorage.getItem(key);
279
+ if (!stored) {
280
+ localStorage.setItem(key, now.toString());
281
+ }
282
+ }
283
+ function getActivePlan(plan) {
284
+ if (typeof window === "undefined") return plan;
285
+ if (plan === "free") return "free";
286
+ const key = getLicenseKey(plan);
287
+ const stored = localStorage.getItem(key);
288
+ if (!stored) return "free";
289
+ const startedAt = parseInt(stored, 10);
290
+ const now = Date.now();
291
+ const diffDays = Math.floor((now - startedAt) / (1e3 * 60 * 60 * 24));
292
+ const allowedDays = PLAN_DURATIONS[plan];
293
+ if (diffDays > allowedDays) {
294
+ localStorage.removeItem(key);
295
+ return "free";
296
+ }
297
+ return plan;
298
+ }
299
+ function isLicenseValid(plan) {
300
+ return getActivePlan(plan) === plan;
301
+ }
302
+
266
303
  // node_modules/@tiptap/extension-document/dist/index.js
267
304
  var import_core2 = require("@tiptap/core");
268
305
  var Document = import_core2.Node.create({
@@ -17140,9 +17177,14 @@ function EditorContent({ apiKey }) {
17140
17177
  const res = await fetch(`${API_BASE_URL}/api/api-key?apiKey=${apiKey}`);
17141
17178
  const data = await res.json();
17142
17179
  if (!res.ok) throw new Error(data.error || "Invalid API Key");
17180
+ const version = data.version && ["free", "pro", "premium", "platinum"].includes(data.version) ? data.version : "free";
17181
+ const activeVersion = getActivePlan(version);
17143
17182
  setIsValid(true);
17144
- setUserVersion(data.version);
17183
+ setUserVersion(activeVersion);
17145
17184
  setAddOns(data.addOn || []);
17185
+ if (activeVersion === "free" && data.version !== "free") {
17186
+ setError("Your paid plan has expired. Downgraded to Free version.");
17187
+ }
17146
17188
  } catch (err) {
17147
17189
  setError(err instanceof Error ? err.message : "Invalid API Key");
17148
17190
  setIsValid(false);
@@ -17275,38 +17317,9 @@ function EditorContent({ apiKey }) {
17275
17317
  ));
17276
17318
  }
17277
17319
 
17278
- // src/utils/licenseTracker.ts
17279
- var getLicenseKey = (plan) => `__tetrons_license_start_${plan}__`;
17280
- var PLAN_DURATIONS = {
17281
- free: 14,
17282
- pro: 30,
17283
- premium: 30,
17284
- platinum: 30
17285
- };
17286
- function initLicenseTracking(plan) {
17287
- if (typeof window === "undefined") return;
17288
- const key = getLicenseKey(plan);
17289
- const now = Date.now();
17290
- const stored = localStorage.getItem(key);
17291
- if (!stored) {
17292
- localStorage.setItem(key, now.toString());
17293
- }
17294
- }
17295
- function isLicenseValid(plan) {
17296
- if (typeof window === "undefined") return true;
17297
- const key = getLicenseKey(plan);
17298
- const stored = localStorage.getItem(key);
17299
- if (!stored) return false;
17300
- const startedAt = parseInt(stored, 10);
17301
- const now = Date.now();
17302
- const diffDays = Math.floor((now - startedAt) / (1e3 * 60 * 60 * 24));
17303
- const allowedDays = PLAN_DURATIONS[plan];
17304
- return diffDays <= allowedDays;
17305
- }
17306
-
17307
17320
  // src/index.ts
17308
17321
  var API_VALID = false;
17309
- var API_VERSION = "";
17322
+ var API_VERSION = null;
17310
17323
  var API_ADDONS = [];
17311
17324
  async function initializeTetrons(apiKey) {
17312
17325
  const res = await fetch(
@@ -17318,9 +17331,9 @@ async function initializeTetrons(apiKey) {
17318
17331
  }
17319
17332
  const data = await res.json();
17320
17333
  API_VALID = true;
17321
- API_VERSION = data.version;
17334
+ API_VERSION = data.version && ["free", "pro", "premium", "platinum"].includes(data.version) ? data.version : "free";
17322
17335
  API_ADDONS = data.addOn || [];
17323
- if (typeof window !== "undefined") {
17336
+ if (typeof window !== "undefined" && API_VERSION) {
17324
17337
  initLicenseTracking(API_VERSION);
17325
17338
  }
17326
17339
  }
package/dist/index.d.mts CHANGED
@@ -5,8 +5,10 @@ type EditorContentProps = {
5
5
  };
6
6
  declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Element;
7
7
 
8
+ type Plan = "free" | "pro" | "premium" | "platinum";
9
+
8
10
  declare function initializeTetrons(apiKey: string): Promise<void>;
9
- declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
11
+ declare function getTetronsVersion(): Plan | null;
10
12
  declare function getTetronsAddOns(): string[];
11
13
  declare function isApiKeyValid(): boolean;
12
14
  declare function isTetronsLicenseValid(): boolean;
package/dist/index.d.ts CHANGED
@@ -5,8 +5,10 @@ type EditorContentProps = {
5
5
  };
6
6
  declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Element;
7
7
 
8
+ type Plan = "free" | "pro" | "premium" | "platinum";
9
+
8
10
  declare function initializeTetrons(apiKey: string): Promise<void>;
9
- declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
11
+ declare function getTetronsVersion(): Plan | null;
10
12
  declare function getTetronsAddOns(): string[];
11
13
  declare function isApiKeyValid(): boolean;
12
14
  declare function isTetronsLicenseValid(): boolean;
package/dist/index.mjs CHANGED
@@ -227,6 +227,43 @@ var MathInline = Node.create({
227
227
  import React17, { useEffect as useEffect9, useRef as useRef7, useState as useState11 } from "react";
228
228
  import { useEditor, EditorContent as TiptapEditorContent } from "@tiptap/react";
229
229
 
230
+ // src/utils/licenseTracker.ts
231
+ var getLicenseKey = (plan) => `__tetrons_license_start_${plan}__`;
232
+ var PLAN_DURATIONS = {
233
+ free: Infinity,
234
+ pro: 30,
235
+ premium: 30,
236
+ platinum: 30
237
+ };
238
+ function initLicenseTracking(plan) {
239
+ if (typeof window === "undefined") return;
240
+ const key = getLicenseKey(plan);
241
+ const now = Date.now();
242
+ const stored = localStorage.getItem(key);
243
+ if (!stored) {
244
+ localStorage.setItem(key, now.toString());
245
+ }
246
+ }
247
+ function getActivePlan(plan) {
248
+ if (typeof window === "undefined") return plan;
249
+ if (plan === "free") return "free";
250
+ const key = getLicenseKey(plan);
251
+ const stored = localStorage.getItem(key);
252
+ if (!stored) return "free";
253
+ const startedAt = parseInt(stored, 10);
254
+ const now = Date.now();
255
+ const diffDays = Math.floor((now - startedAt) / (1e3 * 60 * 60 * 24));
256
+ const allowedDays = PLAN_DURATIONS[plan];
257
+ if (diffDays > allowedDays) {
258
+ localStorage.removeItem(key);
259
+ return "free";
260
+ }
261
+ return plan;
262
+ }
263
+ function isLicenseValid(plan) {
264
+ return getActivePlan(plan) === plan;
265
+ }
266
+
230
267
  // node_modules/@tiptap/extension-document/dist/index.js
231
268
  import { Node as Node2 } from "@tiptap/core";
232
269
  var Document = Node2.create({
@@ -17149,9 +17186,14 @@ function EditorContent({ apiKey }) {
17149
17186
  const res = await fetch(`${API_BASE_URL}/api/api-key?apiKey=${apiKey}`);
17150
17187
  const data = await res.json();
17151
17188
  if (!res.ok) throw new Error(data.error || "Invalid API Key");
17189
+ const version = data.version && ["free", "pro", "premium", "platinum"].includes(data.version) ? data.version : "free";
17190
+ const activeVersion = getActivePlan(version);
17152
17191
  setIsValid(true);
17153
- setUserVersion(data.version);
17192
+ setUserVersion(activeVersion);
17154
17193
  setAddOns(data.addOn || []);
17194
+ if (activeVersion === "free" && data.version !== "free") {
17195
+ setError("Your paid plan has expired. Downgraded to Free version.");
17196
+ }
17155
17197
  } catch (err) {
17156
17198
  setError(err instanceof Error ? err.message : "Invalid API Key");
17157
17199
  setIsValid(false);
@@ -17284,38 +17326,9 @@ function EditorContent({ apiKey }) {
17284
17326
  ));
17285
17327
  }
17286
17328
 
17287
- // src/utils/licenseTracker.ts
17288
- var getLicenseKey = (plan) => `__tetrons_license_start_${plan}__`;
17289
- var PLAN_DURATIONS = {
17290
- free: 14,
17291
- pro: 30,
17292
- premium: 30,
17293
- platinum: 30
17294
- };
17295
- function initLicenseTracking(plan) {
17296
- if (typeof window === "undefined") return;
17297
- const key = getLicenseKey(plan);
17298
- const now = Date.now();
17299
- const stored = localStorage.getItem(key);
17300
- if (!stored) {
17301
- localStorage.setItem(key, now.toString());
17302
- }
17303
- }
17304
- function isLicenseValid(plan) {
17305
- if (typeof window === "undefined") return true;
17306
- const key = getLicenseKey(plan);
17307
- const stored = localStorage.getItem(key);
17308
- if (!stored) return false;
17309
- const startedAt = parseInt(stored, 10);
17310
- const now = Date.now();
17311
- const diffDays = Math.floor((now - startedAt) / (1e3 * 60 * 60 * 24));
17312
- const allowedDays = PLAN_DURATIONS[plan];
17313
- return diffDays <= allowedDays;
17314
- }
17315
-
17316
17329
  // src/index.ts
17317
17330
  var API_VALID = false;
17318
- var API_VERSION = "";
17331
+ var API_VERSION = null;
17319
17332
  var API_ADDONS = [];
17320
17333
  async function initializeTetrons(apiKey) {
17321
17334
  const res = await fetch(
@@ -17327,9 +17340,9 @@ async function initializeTetrons(apiKey) {
17327
17340
  }
17328
17341
  const data = await res.json();
17329
17342
  API_VALID = true;
17330
- API_VERSION = data.version;
17343
+ API_VERSION = data.version && ["free", "pro", "premium", "platinum"].includes(data.version) ? data.version : "free";
17331
17344
  API_ADDONS = data.addOn || [];
17332
- if (typeof window !== "undefined") {
17345
+ if (typeof window !== "undefined" && API_VERSION) {
17333
17346
  initLicenseTracking(API_VERSION);
17334
17347
  }
17335
17348
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "tetrons",
3
- "version": "2.3.81",
3
+ "version": "2.3.84",
4
4
  "description": "A Next.js project written in TypeScript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
9
  "dev": "next dev --turbo",
10
- "build": "tsup && copyfiles -u 2 src/styles/*.css dist/styles && copyfiles -u 2 src/components/**/*.tsx dist/components && copyfiles -u 1 public/dictionaries/* dist/dictionaries",
10
+ "build": "tsup && copyfiles -u 2 src/styles/*.css dist/styles && copyfiles -u 2 src/components/**/*.tsx dist/components && copyfiles -u 1 public/dictionaries/* dist/public/dictionaries",
11
11
  "start": "next start",
12
12
  "lint": "next lint"
13
13
  },
@@ -117,7 +117,7 @@
117
117
  "dist",
118
118
  "dist/styles/tetrons.css",
119
119
  "dist/components",
120
- "dist/public/dictionaries"
120
+ "public/dictionaries"
121
121
  ],
122
122
  "bugs": {
123
123
  "url": "https://github.com/Finapsys/Tetrons/issues"
@@ -0,0 +1,205 @@
1
+ SET UTF-8
2
+ TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
3
+ ICONV 1
4
+ ICONV ’ '
5
+ NOSUGGEST !
6
+
7
+ # ordinal numbers
8
+ COMPOUNDMIN 1
9
+ # only in compounds: 1th, 2th, 3th
10
+ ONLYINCOMPOUND c
11
+ # compound rules:
12
+ # 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
13
+ # 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
14
+ COMPOUNDRULE 2
15
+ COMPOUNDRULE n*1t
16
+ COMPOUNDRULE n*mp
17
+ WORDCHARS 0123456789
18
+
19
+ PFX A Y 1
20
+ PFX A 0 re .
21
+
22
+ PFX I Y 1
23
+ PFX I 0 in .
24
+
25
+ PFX U Y 1
26
+ PFX U 0 un .
27
+
28
+ PFX C Y 1
29
+ PFX C 0 de .
30
+
31
+ PFX E Y 1
32
+ PFX E 0 dis .
33
+
34
+ PFX F Y 1
35
+ PFX F 0 con .
36
+
37
+ PFX K Y 1
38
+ PFX K 0 pro .
39
+
40
+ SFX V N 2
41
+ SFX V e ive e
42
+ SFX V 0 ive [^e]
43
+
44
+ SFX N Y 3
45
+ SFX N e ion e
46
+ SFX N y ication y
47
+ SFX N 0 en [^ey]
48
+
49
+ SFX X Y 3
50
+ SFX X e ions e
51
+ SFX X y ications y
52
+ SFX X 0 ens [^ey]
53
+
54
+ SFX H N 2
55
+ SFX H y ieth y
56
+ SFX H 0 th [^y]
57
+
58
+ SFX Y Y 1
59
+ SFX Y 0 ly .
60
+
61
+ SFX G Y 2
62
+ SFX G e ing e
63
+ SFX G 0 ing [^e]
64
+
65
+ SFX J Y 2
66
+ SFX J e ings e
67
+ SFX J 0 ings [^e]
68
+
69
+ SFX D Y 4
70
+ SFX D 0 d e
71
+ SFX D y ied [^aeiou]y
72
+ SFX D 0 ed [^ey]
73
+ SFX D 0 ed [aeiou]y
74
+
75
+ SFX T N 4
76
+ SFX T 0 st e
77
+ SFX T y iest [^aeiou]y
78
+ SFX T 0 est [aeiou]y
79
+ SFX T 0 est [^ey]
80
+
81
+ SFX R Y 4
82
+ SFX R 0 r e
83
+ SFX R y ier [^aeiou]y
84
+ SFX R 0 er [aeiou]y
85
+ SFX R 0 er [^ey]
86
+
87
+ SFX Z Y 4
88
+ SFX Z 0 rs e
89
+ SFX Z y iers [^aeiou]y
90
+ SFX Z 0 ers [aeiou]y
91
+ SFX Z 0 ers [^ey]
92
+
93
+ SFX S Y 4
94
+ SFX S y ies [^aeiou]y
95
+ SFX S 0 s [aeiou]y
96
+ SFX S 0 es [sxzh]
97
+ SFX S 0 s [^sxzhy]
98
+
99
+ SFX P Y 3
100
+ SFX P y iness [^aeiou]y
101
+ SFX P 0 ness [aeiou]y
102
+ SFX P 0 ness [^y]
103
+
104
+ SFX M Y 1
105
+ SFX M 0 's .
106
+
107
+ SFX B Y 3
108
+ SFX B 0 able [^aeiou]
109
+ SFX B 0 able ee
110
+ SFX B e able [^aeiou]e
111
+
112
+ SFX L Y 1
113
+ SFX L 0 ment .
114
+
115
+ REP 90
116
+ REP a ei
117
+ REP ei a
118
+ REP a ey
119
+ REP ey a
120
+ REP ai ie
121
+ REP ie ai
122
+ REP alot a_lot
123
+ REP are air
124
+ REP are ear
125
+ REP are eir
126
+ REP air are
127
+ REP air ere
128
+ REP ere air
129
+ REP ere ear
130
+ REP ere eir
131
+ REP ear are
132
+ REP ear air
133
+ REP ear ere
134
+ REP eir are
135
+ REP eir ere
136
+ REP ch te
137
+ REP te ch
138
+ REP ch ti
139
+ REP ti ch
140
+ REP ch tu
141
+ REP tu ch
142
+ REP ch s
143
+ REP s ch
144
+ REP ch k
145
+ REP k ch
146
+ REP f ph
147
+ REP ph f
148
+ REP gh f
149
+ REP f gh
150
+ REP i igh
151
+ REP igh i
152
+ REP i uy
153
+ REP uy i
154
+ REP i ee
155
+ REP ee i
156
+ REP j di
157
+ REP di j
158
+ REP j gg
159
+ REP gg j
160
+ REP j ge
161
+ REP ge j
162
+ REP s ti
163
+ REP ti s
164
+ REP s ci
165
+ REP ci s
166
+ REP k cc
167
+ REP cc k
168
+ REP k qu
169
+ REP qu k
170
+ REP kw qu
171
+ REP o eau
172
+ REP eau o
173
+ REP o ew
174
+ REP ew o
175
+ REP oo ew
176
+ REP ew oo
177
+ REP ew ui
178
+ REP ui ew
179
+ REP oo ui
180
+ REP ui oo
181
+ REP ew u
182
+ REP u ew
183
+ REP oo u
184
+ REP u oo
185
+ REP u oe
186
+ REP oe u
187
+ REP u ieu
188
+ REP ieu u
189
+ REP ue ew
190
+ REP ew ue
191
+ REP uff ough
192
+ REP oo ieu
193
+ REP ieu oo
194
+ REP ier ear
195
+ REP ear ier
196
+ REP ear air
197
+ REP air ear
198
+ REP w qu
199
+ REP qu w
200
+ REP z ss
201
+ REP ss z
202
+ REP shun tion
203
+ REP shun sion
204
+ REP shun cion
205
+ REP size cise