@lukoweb/apitogo-plugin-dev-portal-billing 0.2.88 → 0.2.90

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.
@@ -48,6 +48,13 @@ function endpointLabel(label) {
48
48
  function blockedCount(byStatus) {
49
49
  return byStatus.filter((item) => item.label === "429").reduce((sum, item) => sum + item.count, 0);
50
50
  }
51
+ /**
52
+ * Calls that count toward the plan's quota: every call except those the gateway refused with 429. The gateway's quota
53
+ * leaves 429s out (a customer who keeps calling past the rate limit does not use it up), so the quota card must too.
54
+ */
55
+ function quotaCountedCalls(usage) {
56
+ return Math.max(0, usage.requestCount - blockedCount(usage.byStatus));
57
+ }
51
58
  /** The middle latency of the given calls, or null without any. A slow outlier moves it less than an average. */
52
59
  function medianLatency(latencies) {
53
60
  const values = latencies.filter((value) => typeof value === "number").sort((a, b) => a - b);
@@ -96,7 +103,7 @@ const UsagePage = () => {
96
103
  const plan = subscription ? catalog?.plans.find((item) => item.sku === subscription.planSku) : void 0;
97
104
  const quota = plan ? parseMonthlyQuotaCalls(plan.limitsJson) : null;
98
105
  const periodDays = plan ? parseQuotaPeriodDays(plan.limitsJson) : null;
99
- const summary = quota != null && periodDays != null ? quotaSummary(quotaUsage?.requestCount ?? 0, quota, periodDays, subscription?.currentPeriodEnd) : null;
106
+ const summary = quota != null && periodDays != null ? quotaSummary(quotaUsage ? quotaCountedCalls(quotaUsage) : 0, quota, periodDays, subscription?.currentPeriodEnd) : null;
100
107
  const maxBar = Math.max(1, ...data?.series.map((point) => point.requestCount) ?? [1]);
101
108
  const endpointTotal = data?.byEndpoint.reduce((sum, item) => sum + item.count, 0) ?? 0;
102
109
  if (!auth.isAuthenticated) return /* @__PURE__ */ jsxs("div", {
package/dist/index.mjs CHANGED
@@ -373,7 +373,7 @@ const ContactSalesPage = lazy(() => import("./ContactSalesPage-cdJA7B-J.mjs"));
373
373
  const CredentialsPage = lazy(() => import("./CredentialsPage-CZRT8Wx8.mjs"));
374
374
  const PricingPage = lazy(() => import("./PricingPage-ffIoVEQf.mjs"));
375
375
  const SubscriptionsPage = lazy(() => import("./SubscriptionsPage-BFGL0Ruo.mjs"));
376
- const UsagePage = lazy(() => import("./UsagePage-F-39QBHy.mjs"));
376
+ const UsagePage = lazy(() => import("./UsagePage-BtB0OSOP.mjs"));
377
377
  function resolvePricingEnabled(config) {
378
378
  if (config.__meta?.pricingEnabled !== void 0) return config.__meta.pricingEnabled;
379
379
  return isPreviewPricingEnabled();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo-plugin-dev-portal-billing",
3
- "version": "0.2.88",
3
+ "version": "0.2.90",
4
4
  "homepage": "https://docs.apitogo.com",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -42,8 +42,8 @@
42
42
  "react": "19.2.4",
43
43
  "react-dom": "19.2.4",
44
44
  "tsdown": "0.20.3",
45
- "@lukoweb/apitogo": "0.2.88",
46
- "@lukoweb/apitogo-module-user-panel": "0.2.88"
45
+ "@lukoweb/apitogo": "0.2.90",
46
+ "@lukoweb/apitogo-module-user-panel": "0.2.90"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": ">=19.2.0",