quotacap 0.0.53 → 0.0.54

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.
@@ -1,5 +1,5 @@
1
1
  import type { ProviderSnapshot } from "../advisory/types.js";
2
- export type StateWord = "On track" | "Behind pace" | "Ahead of pace" | "Cap risk" | "Watch" | "Measuring" | "Not reporting" | "Monthly exhausted";
2
+ export type StateWord = "On track" | "Behind pace" | "Ahead of pace" | "Cap risk" | "Watch" | "Measuring" | "Not reporting" | "Monthly exhausted" | "Quota exhausted";
3
3
  export type RailCell = "used" | "tick" | "unused";
4
4
  export type SortKey = "recommended" | "reset-asc" | "reset-desc" | "used-desc" | "used-asc";
5
5
  export type CompactSuffix = "" | "!" | "~" | "?";
@@ -171,6 +171,12 @@ export function stateWord(ps) {
171
171
  // spent until the month resets.
172
172
  if (adv.bindingWindow === "monthly" && adv.bindingRemaining === 0)
173
173
  return "Monthly exhausted";
174
+ const u = bindingUsedPct(ps);
175
+ const isExhausted = (typeof adv.bindingRemaining === "number" && adv.bindingRemaining <= 0) ||
176
+ (typeof adv.remaining === "number" && adv.remaining <= 0) ||
177
+ (typeof u === "number" && u >= 100);
178
+ if (isExhausted)
179
+ return "Quota exhausted";
174
180
  if (adv.status === "at risk")
175
181
  return "Cap risk";
176
182
  if (adv.status === "watch")
@@ -30,6 +30,7 @@ const STATE_COLORS = {
30
30
  "Ahead of pace": "\x1b[93m",
31
31
  "Watch": "\x1b[38;5;214m",
32
32
  "Cap risk": "\x1b[31m",
33
+ "Quota exhausted": "\x1b[31m",
33
34
  "Measuring": "\x1b[90m",
34
35
  "Not reporting": "\x1b[90m",
35
36
  "Monthly exhausted": "\x1b[31m",
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by scripts/build-embed.mjs — do not edit
2
- export const VERSION = "0.0.53";
2
+ export const VERSION = "0.0.54";
@@ -5,6 +5,7 @@ import { PACE_TIPS, PaceStats, barGeometry, isMonthlyBound, paceBadge, paceFigur
5
5
  export function burnTone(provider) {
6
6
  const badge = paceBadge(provider);
7
7
  switch (badge) {
8
+ case "Quota exhausted":
8
9
  case "Cap risk":
9
10
  case "Monthly exhausted":
10
11
  case "Watch":
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import type { ExclusionReason, ProviderView } from "../state.js";
3
- export type PaceBadge = "Not reporting" | "Cap risk" | "Watch" | "Behind pace" | "Ahead of pace" | "On track" | "Measuring" | "Monthly exhausted";
3
+ export type PaceBadge = "Not reporting" | "Cap risk" | "Watch" | "Behind pace" | "Ahead of pace" | "On track" | "Measuring" | "Monthly exhausted" | "Quota exhausted";
4
4
  /**
5
5
  * Pace-state badge from the mapping table. Exclusion always wins; a blocked
6
6
  * month next; otherwise status "at risk" wins, then "watch", then "unknown";
@@ -14,6 +14,12 @@ export function paceBadge(provider) {
14
14
  return "Not reporting";
15
15
  if (advisory.bindingWindow === "monthly" && advisory.bindingRemaining === 0)
16
16
  return "Monthly exhausted";
17
+ const quotaUsed = quotaUsedPct(provider);
18
+ const isExhausted = (typeof advisory.bindingRemaining === "number" && advisory.bindingRemaining <= 0) ||
19
+ (typeof advisory.remaining === "number" && advisory.remaining <= 0) ||
20
+ (quotaUsed !== null && quotaUsed >= 100);
21
+ if (isExhausted)
22
+ return "Quota exhausted";
17
23
  if (advisory.status === "at risk")
18
24
  return "Cap risk";
19
25
  if (advisory.status === "watch")
@@ -399,6 +405,7 @@ export function badgeColor(badge) {
399
405
  return "var(--ahead)";
400
406
  case "Watch":
401
407
  return "var(--watch)";
408
+ case "Quota exhausted":
402
409
  case "Monthly exhausted":
403
410
  case "Cap risk":
404
411
  return "var(--danger)";
@@ -418,6 +425,7 @@ export function fillToken(badge) {
418
425
  return "var(--fill-ahead)";
419
426
  case "Watch":
420
427
  return "var(--fill-watch)";
428
+ case "Quota exhausted":
421
429
  case "Monthly exhausted":
422
430
  case "Cap risk":
423
431
  return "var(--fill-cap)";
@@ -437,6 +445,7 @@ export function edgeToken(badge) {
437
445
  return "var(--edge-ahead)";
438
446
  case "Watch":
439
447
  return "var(--edge-watch)";
448
+ case "Quota exhausted":
440
449
  case "Monthly exhausted":
441
450
  case "Cap risk":
442
451
  return "var(--edge-cap)";
@@ -452,6 +461,7 @@ export function outKind(badge) {
452
461
  return "behind";
453
462
  case "Watch":
454
463
  return "watch";
464
+ case "Quota exhausted":
455
465
  case "Monthly exhausted":
456
466
  case "Cap risk":
457
467
  return "cap";
@@ -474,7 +484,13 @@ export function hatchGradient(_badge) {
474
484
  */
475
485
  export function badgeTitle(badge, estimated) {
476
486
  let title;
477
- if (badge === "Cap risk") {
487
+ if (badge === "Quota exhausted") {
488
+ title = "Quota fully used until reset";
489
+ }
490
+ else if (badge === "Monthly exhausted") {
491
+ title = "Monthly quota fully used until reset";
492
+ }
493
+ else if (badge === "Cap risk") {
478
494
  title = "Burning faster than the window allows and ahead of elapsed time";
479
495
  }
480
496
  else if (badge === "Watch") {
@@ -495,7 +511,7 @@ export function Badge({ provider, compact = false, }) {
495
511
  ? "pace-ahead"
496
512
  : badge === "Watch"
497
513
  ? "pace-watch"
498
- : badge === "Cap risk" || badge === "Monthly exhausted"
514
+ : badge === "Cap risk" || badge === "Monthly exhausted" || badge === "Quota exhausted"
499
515
  ? "pace-cap"
500
516
  : "pace-out"; // Not reporting and Measuring share the neutral style
501
517
  const title = compact && detail
@@ -5,6 +5,7 @@ const STATES = [
5
5
  { label: "Behind pace", cls: "pace-behind", meaning: "Burning slow; risk of unused quota waste" },
6
6
  { label: "Ahead of pace", cls: "pace-ahead", meaning: "Burning faster than time; monitor usage" },
7
7
  { label: "Cap risk", cls: "pace-cap", meaning: "Will hit cap before reset window closes" },
8
+ { label: "Quota exhausted", cls: "pace-cap", meaning: "Quota is 100% consumed until next reset" },
8
9
  { label: "Watch", cls: "pace-watch", meaning: "Pace points at the cap, but position or the reset clock is uncertain" },
9
10
  { label: "Measuring", cls: "pace-out", meaning: "Not enough data yet; pace appears after 6h" },
10
11
  { label: "Not reporting", cls: "pace-out", meaning: "No usable reading; excluded from ranking" },
@@ -239,6 +239,7 @@ function pinPace(provider) {
239
239
  return { cls: "pace-ahead", color: "var(--ahead)" };
240
240
  case "Watch":
241
241
  return { cls: "pace-watch", color: "var(--watch)" };
242
+ case "Quota exhausted":
242
243
  case "Monthly exhausted":
243
244
  case "Cap risk":
244
245
  return { cls: "pace-cap", color: "var(--danger)" };