tetrons 2.3.47 → 2.3.49

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(new URL("./internal/licenseUtils.ts", import.meta.url).href)));
17011
+ const { getOrCreateInstallDate, getRemainingDays } = await Promise.resolve().then(() => _interopRequireWildcard(require("./licenseUtils-2F6HALFV.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-L7MYHDVW.cjs")));
17025
+ const { getOrCreateInstallDate, getRemainingDays } = await Promise.resolve().then(() => _interopRequireWildcard(require("./licenseUtils-2F6HALFV.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(new URL("./internal/licenseUtils.ts", import.meta.url).href);
17011
+ const { getOrCreateInstallDate, getRemainingDays } = await import("./licenseUtils-FRSC7JAY.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-NQMXVD6S.mjs");
17025
+ const { getOrCreateInstallDate, getRemainingDays } = await import("./licenseUtils-FRSC7JAY.mjs");
17026
17026
  const validityDays = API_VERSION === "free" ? 14 : 30;
17027
17027
  const installedAt = getOrCreateInstallDate();
17028
17028
  return getRemainingDays(installedAt, validityDays);
@@ -7,16 +7,18 @@ function getOrCreateInstallDate() {
7
7
  const data = JSON.parse(_fs2.default.readFileSync(USAGE_FILE_PATH, "utf-8"));
8
8
  return new Date(data.installedAt);
9
9
  }
10
- const now = (/* @__PURE__ */ new Date()).toISOString();
11
- _fs2.default.writeFileSync(USAGE_FILE_PATH, JSON.stringify({ installedAt: now }));
12
- return new Date(now);
10
+ const now = /* @__PURE__ */ new Date();
11
+ _fs2.default.writeFileSync(
12
+ USAGE_FILE_PATH,
13
+ JSON.stringify({ installedAt: now.toISOString() })
14
+ );
15
+ return now;
13
16
  }
14
17
  function getRemainingDays(installedAt, validityDays) {
15
18
  const now = /* @__PURE__ */ new Date();
16
- const diff = Math.floor(
17
- (now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
18
- );
19
- return validityDays - diff;
19
+ const diffTime = Math.max(now.getTime() - installedAt.getTime(), 0);
20
+ const diffDays = validityDays - Math.floor(diffTime / (1e3 * 60 * 60 * 24));
21
+ return diffDays;
20
22
  }
21
23
 
22
24
 
@@ -7,16 +7,18 @@ function getOrCreateInstallDate() {
7
7
  const data = JSON.parse(fs.readFileSync(USAGE_FILE_PATH, "utf-8"));
8
8
  return new Date(data.installedAt);
9
9
  }
10
- const now = (/* @__PURE__ */ new Date()).toISOString();
11
- fs.writeFileSync(USAGE_FILE_PATH, JSON.stringify({ installedAt: now }));
12
- return new Date(now);
10
+ const now = /* @__PURE__ */ new Date();
11
+ fs.writeFileSync(
12
+ USAGE_FILE_PATH,
13
+ JSON.stringify({ installedAt: now.toISOString() })
14
+ );
15
+ return now;
13
16
  }
14
17
  function getRemainingDays(installedAt, validityDays) {
15
18
  const now = /* @__PURE__ */ new Date();
16
- const diff = Math.floor(
17
- (now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
18
- );
19
- return validityDays - diff;
19
+ const diffTime = Math.max(now.getTime() - installedAt.getTime(), 0);
20
+ const diffDays = validityDays - Math.floor(diffTime / (1e3 * 60 * 60 * 24));
21
+ return diffDays;
20
22
  }
21
23
  export {
22
24
  getOrCreateInstallDate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tetrons",
3
- "version": "2.3.47",
3
+ "version": "2.3.49",
4
4
  "description": "A Next.js project written in TypeScript",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",