@sonnechasser/ntrp 0.1.3 → 0.1.4

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.
@@ -14811,6 +14811,7 @@ import { createHmac } from "crypto";
14811
14811
  // src/license/trial-policy.ts
14812
14812
  var TRIAL_FULL_DAYS = 11;
14813
14813
  var TRIAL_GRACE_END_DAYS = 30;
14814
+ var TRIAL_ACTIVE_NUDGE_FROM_DAY = 8;
14814
14815
  function evaluateTrial(activatedAt, now2 = /* @__PURE__ */ new Date()) {
14815
14816
  const daysSince = Math.floor((now2.getTime() - activatedAt.getTime()) / 864e5);
14816
14817
  if (daysSince >= TRIAL_GRACE_END_DAYS) {
@@ -14818,6 +14819,7 @@ function evaluateTrial(activatedAt, now2 = /* @__PURE__ */ new Date()) {
14818
14819
  phase: "expired",
14819
14820
  daysSinceActivation: daysSince,
14820
14821
  daysUntilLockout: 0,
14822
+ trialDaysRemaining: 0,
14821
14823
  shouldNudge: false
14822
14824
  };
14823
14825
  }
@@ -14826,14 +14828,17 @@ function evaluateTrial(activatedAt, now2 = /* @__PURE__ */ new Date()) {
14826
14828
  phase: "grace",
14827
14829
  daysSinceActivation: daysSince,
14828
14830
  daysUntilLockout: TRIAL_GRACE_END_DAYS - daysSince,
14831
+ trialDaysRemaining: 0,
14829
14832
  shouldNudge: true
14830
14833
  };
14831
14834
  }
14835
+ const trialDaysRemaining = TRIAL_FULL_DAYS - daysSince;
14832
14836
  return {
14833
14837
  phase: "active",
14834
14838
  daysSinceActivation: daysSince,
14835
14839
  daysUntilLockout: TRIAL_GRACE_END_DAYS - daysSince,
14836
- shouldNudge: false
14840
+ trialDaysRemaining,
14841
+ shouldNudge: daysSince >= TRIAL_ACTIVE_NUDGE_FROM_DAY
14837
14842
  };
14838
14843
  }
14839
14844
  function formatTrialActiveMessage(daysSince) {
@@ -14930,7 +14935,8 @@ function applyTrialPolicy(result) {
14930
14935
  message: randomCutoffNudge(),
14931
14936
  trialPhase: "expired",
14932
14937
  shouldNudgeUpgrade: false,
14933
- daysUntilLockout: 0
14938
+ daysUntilLockout: 0,
14939
+ trialDaysRemaining: 0
14934
14940
  };
14935
14941
  }
14936
14942
  const message = trial.phase === "grace" ? `trial license (grace \u2014 ${trial.daysUntilLockout} day${trial.daysUntilLockout === 1 ? "" : "s"} until lockout)` : formatTrialActiveMessage(trial.daysSinceActivation);
@@ -14939,7 +14945,8 @@ function applyTrialPolicy(result) {
14939
14945
  message,
14940
14946
  trialPhase: trial.phase,
14941
14947
  shouldNudgeUpgrade: trial.shouldNudge,
14942
- daysUntilLockout: trial.daysUntilLockout
14948
+ daysUntilLockout: trial.daysUntilLockout,
14949
+ trialDaysRemaining: trial.trialDaysRemaining
14943
14950
  };
14944
14951
  }
14945
14952
  function storedLicenseProvider(key) {