@quanta-intellect/vessel-browser 0.1.103 → 0.1.104

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.
Files changed (2) hide show
  1. package/out/main/index.js +33 -10
  2. package/package.json +1 -1
package/out/main/index.js CHANGED
@@ -4593,16 +4593,17 @@ const PREMIUM_TOOLS = /* @__PURE__ */ new Set([
4593
4593
  ]);
4594
4594
  function isPremium() {
4595
4595
  const { premium } = loadSettings();
4596
- if (premium.status === "active" || premium.status === "trialing") {
4596
+ if (premium.status !== "active" && premium.status !== "trialing") {
4597
+ return false;
4598
+ }
4599
+ if (!premium.validatedAt) {
4597
4600
  return true;
4598
4601
  }
4599
- if (premium.validatedAt && premium.status !== "free") {
4600
- const lastValidated = new Date(premium.validatedAt).getTime();
4601
- if (Date.now() - lastValidated < OFFLINE_GRACE_PERIOD_MS) {
4602
- return true;
4603
- }
4602
+ const lastValidated = new Date(premium.validatedAt).getTime();
4603
+ if (!Number.isFinite(lastValidated)) {
4604
+ return false;
4604
4605
  }
4605
- return false;
4606
+ return Date.now() - lastValidated < OFFLINE_GRACE_PERIOD_MS;
4606
4607
  }
4607
4608
  function getPremiumState() {
4608
4609
  return { ...loadSettings().premium };
@@ -4647,9 +4648,31 @@ async function getCheckoutUrl(email) {
4647
4648
  }
4648
4649
  }
4649
4650
  async function getPortalUrl() {
4650
- return errorResult(
4651
- "Billing portal access is temporarily disabled until authenticated customer access is implemented."
4652
- );
4651
+ const current = loadSettings().premium;
4652
+ const identifier = current.verificationToken;
4653
+ if (!identifier) {
4654
+ return errorResult(
4655
+ "Verify your Premium subscription before opening billing management."
4656
+ );
4657
+ }
4658
+ try {
4659
+ const res = await fetch(`${VERIFICATION_API}/portal`, {
4660
+ method: "POST",
4661
+ headers: { "Content-Type": "application/json" },
4662
+ body: JSON.stringify({ identifier })
4663
+ });
4664
+ if (!res.ok) {
4665
+ const detail = await readApiErrorDetail(res);
4666
+ return errorResult(detail || `HTTP ${res.status}`);
4667
+ }
4668
+ const { url } = await res.json();
4669
+ if (typeof url !== "string" || !url.trim()) {
4670
+ return errorResult("Billing portal did not return a valid URL.");
4671
+ }
4672
+ return okResult({ url });
4673
+ } catch (err) {
4674
+ return errorResult(getErrorMessage(err, "Failed to open billing portal"));
4675
+ }
4653
4676
  }
4654
4677
  async function verifySubscription$1(identifier) {
4655
4678
  const current = loadSettings().premium;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quanta-intellect/vessel-browser",
3
3
  "mcpName": "io.github.unmodeled-tyler/vessel-browser",
4
- "version": "0.1.103",
4
+ "version": "0.1.104",
5
5
  "description": "AI-native web browser runtime for autonomous agents with human supervision",
6
6
  "main": "./out/main/index.js",
7
7
  "bin": {