brew-tui 0.5.0 → 0.5.1

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/build/index.js CHANGED
@@ -719,6 +719,10 @@ function validateLicenseKey(key) {
719
719
  throw new Error("Invalid license key format");
720
720
  }
721
721
  }
722
+ function detectPlan(key) {
723
+ const upper = key.toUpperCase();
724
+ return upper.startsWith("BTUI-T-") || upper.startsWith("BTUI-T_") ? "team" : "pro";
725
+ }
722
726
  async function activate(key) {
723
727
  validateLicenseKey(key);
724
728
  checkRateLimit();
@@ -734,7 +738,7 @@ async function activate(key) {
734
738
  status: "active",
735
739
  customerEmail: res.meta.customer_email,
736
740
  customerName: res.meta.customer_name,
737
- plan: "pro",
741
+ plan: detectPlan(key),
738
742
  activatedAt: (/* @__PURE__ */ new Date()).toISOString(),
739
743
  expiresAt: res.license_key.expires_at,
740
744
  lastValidatedAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -847,7 +851,7 @@ var useLicenseStore = create2((set, get) => ({
847
851
  set({ status: "expired", license, degradation: "expired" });
848
852
  return;
849
853
  }
850
- set({ status: "pro", license, degradation: level });
854
+ set({ status: license.plan, license, degradation: level });
851
855
  if (needsRevalidation(license)) {
852
856
  if (!_revalidatingPromise) {
853
857
  _revalidatingPromise = doRevalidation(license, set).finally(() => {
@@ -859,7 +863,8 @@ var useLicenseStore = create2((set, get) => ({
859
863
  if (_revalidationInterval) clearInterval(_revalidationInterval);
860
864
  _revalidationInterval = setInterval(() => {
861
865
  const current = get().license;
862
- if (!current || get().status !== "pro") return;
866
+ const status = get().status;
867
+ if (!current || status !== "pro" && status !== "team") return;
863
868
  if (!needsRevalidation(current)) return;
864
869
  if (_revalidatingPromise) return;
865
870
  _revalidatingPromise = doRevalidation(current, set).finally(() => {
@@ -872,7 +877,7 @@ var useLicenseStore = create2((set, get) => ({
872
877
  set({ error: null });
873
878
  try {
874
879
  const license = await activate(key);
875
- set({ status: "pro", license, degradation: "none" });
880
+ set({ status: license.plan, license, degradation: "none" });
876
881
  return true;
877
882
  } catch (err) {
878
883
  const msg = err instanceof Error ? err.message : String(err);
@@ -891,15 +896,13 @@ var useLicenseStore = create2((set, get) => ({
891
896
  }
892
897
  set({ status: "free", license: null, degradation: "none", error: null });
893
898
  },
894
- // Team is a superset of Pro — team users have full Pro access plus team features
899
+ // Team is a superset of Pro — team users have full Pro access plus team features.
900
+ // Pro users do NOT get Team features (Compliance) without paying for the Team tier.
895
901
  isPro: () => {
896
902
  const s = get().status;
897
903
  return s === "pro" || s === "team";
898
904
  },
899
- isTeam: () => {
900
- const s = get().status;
901
- return s === "team" || s === "pro";
902
- }
905
+ isTeam: () => get().status === "team"
903
906
  }));
904
907
 
905
908
  // src/hooks/use-keyboard.ts
@@ -4597,7 +4600,7 @@ function AccountView() {
4597
4600
  /* @__PURE__ */ jsx30(Box28, { marginTop: 1, children: /* @__PURE__ */ jsxs29(Text29, { color: COLORS.textSecondary, children: [
4598
4601
  status === "pro" ? `d ${t("hint_deactivate")}` : "",
4599
4602
  " ",
4600
- t("app_version", { version: "0.5.0" })
4603
+ t("app_version", { version: "0.5.1" })
4601
4604
  ] }) })
4602
4605
  ] });
4603
4606
  }