tetrons 2.3.75 → 2.3.76
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 +40 -2
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +38 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -34,7 +34,8 @@ __export(index_exports, {
|
|
|
34
34
|
default: () => index_default,
|
|
35
35
|
getTetronsVersion: () => getTetronsVersion,
|
|
36
36
|
initializeTetrons: () => initializeTetrons,
|
|
37
|
-
isApiKeyValid: () => isApiKeyValid
|
|
37
|
+
isApiKeyValid: () => isApiKeyValid,
|
|
38
|
+
isTetronsLicenseValid: () => isTetronsLicenseValid
|
|
38
39
|
});
|
|
39
40
|
module.exports = __toCommonJS(index_exports);
|
|
40
41
|
|
|
@@ -16979,6 +16980,35 @@ function EditorContent({ apiKey }) {
|
|
|
16979
16980
|
));
|
|
16980
16981
|
}
|
|
16981
16982
|
|
|
16983
|
+
// src/utils/licenseTracker.ts
|
|
16984
|
+
var getLicenseKey = (plan) => `__tetrons_license_start_${plan}__`;
|
|
16985
|
+
var PLAN_DURATIONS = {
|
|
16986
|
+
free: 14,
|
|
16987
|
+
pro: 30,
|
|
16988
|
+
premium: 30,
|
|
16989
|
+
platinum: 30
|
|
16990
|
+
};
|
|
16991
|
+
function initLicenseTracking(plan) {
|
|
16992
|
+
if (typeof window === "undefined") return;
|
|
16993
|
+
const key = getLicenseKey(plan);
|
|
16994
|
+
const now = Date.now();
|
|
16995
|
+
const stored = localStorage.getItem(key);
|
|
16996
|
+
if (!stored) {
|
|
16997
|
+
localStorage.setItem(key, now.toString());
|
|
16998
|
+
}
|
|
16999
|
+
}
|
|
17000
|
+
function isLicenseValid(plan) {
|
|
17001
|
+
if (typeof window === "undefined") return true;
|
|
17002
|
+
const key = getLicenseKey(plan);
|
|
17003
|
+
const stored = localStorage.getItem(key);
|
|
17004
|
+
if (!stored) return false;
|
|
17005
|
+
const startedAt = parseInt(stored, 10);
|
|
17006
|
+
const now = Date.now();
|
|
17007
|
+
const diffDays = Math.floor((now - startedAt) / (1e3 * 60 * 60 * 24));
|
|
17008
|
+
const allowedDays = PLAN_DURATIONS[plan];
|
|
17009
|
+
return diffDays <= allowedDays;
|
|
17010
|
+
}
|
|
17011
|
+
|
|
16982
17012
|
// src/index.ts
|
|
16983
17013
|
var API_VALID = false;
|
|
16984
17014
|
var API_VERSION = "";
|
|
@@ -16997,6 +17027,9 @@ async function initializeTetrons(apiKey) {
|
|
|
16997
17027
|
const data = await res.json();
|
|
16998
17028
|
API_VALID = data.valid;
|
|
16999
17029
|
API_VERSION = data.version;
|
|
17030
|
+
if (API_VALID && typeof window !== "undefined") {
|
|
17031
|
+
initLicenseTracking(API_VERSION);
|
|
17032
|
+
}
|
|
17000
17033
|
}
|
|
17001
17034
|
function getTetronsVersion() {
|
|
17002
17035
|
return API_VERSION;
|
|
@@ -17004,11 +17037,16 @@ function getTetronsVersion() {
|
|
|
17004
17037
|
function isApiKeyValid() {
|
|
17005
17038
|
return API_VALID;
|
|
17006
17039
|
}
|
|
17040
|
+
function isTetronsLicenseValid() {
|
|
17041
|
+
if (!API_VALID || !API_VERSION) return false;
|
|
17042
|
+
return isLicenseValid(API_VERSION);
|
|
17043
|
+
}
|
|
17007
17044
|
var index_default = EditorContent;
|
|
17008
17045
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17009
17046
|
0 && (module.exports = {
|
|
17010
17047
|
EditorContent,
|
|
17011
17048
|
getTetronsVersion,
|
|
17012
17049
|
initializeTetrons,
|
|
17013
|
-
isApiKeyValid
|
|
17050
|
+
isApiKeyValid,
|
|
17051
|
+
isTetronsLicenseValid
|
|
17014
17052
|
});
|
package/dist/index.d.mts
CHANGED
|
@@ -8,5 +8,6 @@ declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Elemen
|
|
|
8
8
|
declare function initializeTetrons(apiKey: string): Promise<void>;
|
|
9
9
|
declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
|
|
10
10
|
declare function isApiKeyValid(): boolean;
|
|
11
|
+
declare function isTetronsLicenseValid(): boolean;
|
|
11
12
|
|
|
12
|
-
export { EditorContent, EditorContent as default, getTetronsVersion, initializeTetrons, isApiKeyValid };
|
|
13
|
+
export { EditorContent, EditorContent as default, getTetronsVersion, initializeTetrons, isApiKeyValid, isTetronsLicenseValid };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ declare function EditorContent({ apiKey }: EditorContentProps): React.JSX.Elemen
|
|
|
8
8
|
declare function initializeTetrons(apiKey: string): Promise<void>;
|
|
9
9
|
declare function getTetronsVersion(): "" | "free" | "pro" | "premium" | "platinum";
|
|
10
10
|
declare function isApiKeyValid(): boolean;
|
|
11
|
+
declare function isTetronsLicenseValid(): boolean;
|
|
11
12
|
|
|
12
|
-
export { EditorContent, EditorContent as default, getTetronsVersion, initializeTetrons, isApiKeyValid };
|
|
13
|
+
export { EditorContent, EditorContent as default, getTetronsVersion, initializeTetrons, isApiKeyValid, isTetronsLicenseValid };
|
package/dist/index.mjs
CHANGED
|
@@ -16986,6 +16986,35 @@ function EditorContent({ apiKey }) {
|
|
|
16986
16986
|
));
|
|
16987
16987
|
}
|
|
16988
16988
|
|
|
16989
|
+
// src/utils/licenseTracker.ts
|
|
16990
|
+
var getLicenseKey = (plan) => `__tetrons_license_start_${plan}__`;
|
|
16991
|
+
var PLAN_DURATIONS = {
|
|
16992
|
+
free: 14,
|
|
16993
|
+
pro: 30,
|
|
16994
|
+
premium: 30,
|
|
16995
|
+
platinum: 30
|
|
16996
|
+
};
|
|
16997
|
+
function initLicenseTracking(plan) {
|
|
16998
|
+
if (typeof window === "undefined") return;
|
|
16999
|
+
const key = getLicenseKey(plan);
|
|
17000
|
+
const now = Date.now();
|
|
17001
|
+
const stored = localStorage.getItem(key);
|
|
17002
|
+
if (!stored) {
|
|
17003
|
+
localStorage.setItem(key, now.toString());
|
|
17004
|
+
}
|
|
17005
|
+
}
|
|
17006
|
+
function isLicenseValid(plan) {
|
|
17007
|
+
if (typeof window === "undefined") return true;
|
|
17008
|
+
const key = getLicenseKey(plan);
|
|
17009
|
+
const stored = localStorage.getItem(key);
|
|
17010
|
+
if (!stored) return false;
|
|
17011
|
+
const startedAt = parseInt(stored, 10);
|
|
17012
|
+
const now = Date.now();
|
|
17013
|
+
const diffDays = Math.floor((now - startedAt) / (1e3 * 60 * 60 * 24));
|
|
17014
|
+
const allowedDays = PLAN_DURATIONS[plan];
|
|
17015
|
+
return diffDays <= allowedDays;
|
|
17016
|
+
}
|
|
17017
|
+
|
|
16989
17018
|
// src/index.ts
|
|
16990
17019
|
var API_VALID = false;
|
|
16991
17020
|
var API_VERSION = "";
|
|
@@ -17004,6 +17033,9 @@ async function initializeTetrons(apiKey) {
|
|
|
17004
17033
|
const data = await res.json();
|
|
17005
17034
|
API_VALID = data.valid;
|
|
17006
17035
|
API_VERSION = data.version;
|
|
17036
|
+
if (API_VALID && typeof window !== "undefined") {
|
|
17037
|
+
initLicenseTracking(API_VERSION);
|
|
17038
|
+
}
|
|
17007
17039
|
}
|
|
17008
17040
|
function getTetronsVersion() {
|
|
17009
17041
|
return API_VERSION;
|
|
@@ -17011,11 +17043,16 @@ function getTetronsVersion() {
|
|
|
17011
17043
|
function isApiKeyValid() {
|
|
17012
17044
|
return API_VALID;
|
|
17013
17045
|
}
|
|
17046
|
+
function isTetronsLicenseValid() {
|
|
17047
|
+
if (!API_VALID || !API_VERSION) return false;
|
|
17048
|
+
return isLicenseValid(API_VERSION);
|
|
17049
|
+
}
|
|
17014
17050
|
var index_default = EditorContent;
|
|
17015
17051
|
export {
|
|
17016
17052
|
EditorContent,
|
|
17017
17053
|
index_default as default,
|
|
17018
17054
|
getTetronsVersion,
|
|
17019
17055
|
initializeTetrons,
|
|
17020
|
-
isApiKeyValid
|
|
17056
|
+
isApiKeyValid,
|
|
17057
|
+
isTetronsLicenseValid
|
|
17021
17058
|
};
|