@lukoweb/apitogo-plugin-dev-portal-billing 0.2.73 → 0.2.75

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.
@@ -3,7 +3,7 @@ import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalA
3
3
  import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-WcoincpU.mjs";
4
4
  import { r as createDemoCredentials, t as DEMO_GATEWAY_KEY_HEADER } from "./demo-session-yK9qEqV-.mjs";
5
5
  import { n as useApiKeys } from "./useApiKeys-BrYWVXE9.mjs";
6
- import { n as apiReferencePath, r as ApiKeysPanel } from "./account-links-kIj72Vb2.mjs";
6
+ import { n as apiReferencePath, r as ApiKeysPanel } from "./account-links-CgPPM43_.mjs";
7
7
  import { i as ChoosePlanNotice, r as keyPlanNote, t as apiKeysPageState } from "./page-state-BLL2JJBc.mjs";
8
8
  import { Head } from "@lukoweb/apitogo/components";
9
9
  import { KeyRoundIcon } from "@lukoweb/apitogo/icons";
@@ -71,6 +71,7 @@ const SubscriptionsPage = () => {
71
71
  const activeSubscriptions = subscriptions.filter((sub) => isActiveSubscription(sub.status));
72
72
  const earlierSubscriptions = subscriptions.filter((sub) => !isActiveSubscription(sub.status));
73
73
  const hasActivePlan = activeSubscriptions.length > 0;
74
+ const planName = (sku) => planBySku.get(sku)?.displayName ?? (subscriptions.find((sub) => sub.planSku === sku && sub.displayName)?.displayName || sku);
74
75
  const singlePlan = activeSubscriptions.length === 1 ? planBySku.get(activeSubscriptions[0].planSku) : void 0;
75
76
  const pendingSku = checkoutSuccess ? readPendingCheckout() : void 0;
76
77
  const pendingActive = pendingSku !== void 0 && activeSubscriptions.some((sub) => sub.planSku === pendingSku);
@@ -107,11 +108,9 @@ const SubscriptionsPage = () => {
107
108
  role: "status",
108
109
  className: "mb-6 rounded-xl border border-primary/30 bg-primary/5 p-4 text-sm",
109
110
  children: [
110
- "You're already on the",
111
- " ",
112
- planBySku.get(alreadySubscribedSku)?.displayName ?? alreadySubscribedSku,
113
- " ",
114
- "plan. Go to",
111
+ "You're already on the ",
112
+ planName(alreadySubscribedSku),
113
+ " plan. Go to",
115
114
  " ",
116
115
  /* @__PURE__ */ jsx(Link$1, {
117
116
  to: CREDENTIALS_PATH,
@@ -173,7 +172,7 @@ const SubscriptionsPage = () => {
173
172
  children: [
174
173
  /* @__PURE__ */ jsx("h2", {
175
174
  className: "text-2xl font-bold",
176
- children: plan?.displayName ?? subscription.planSku
175
+ children: planName(subscription.planSku)
177
176
  }),
178
177
  plan ? /* @__PURE__ */ jsx("p", {
179
178
  className: "mt-1 text-sm text-muted-foreground",
@@ -194,7 +193,7 @@ const SubscriptionsPage = () => {
194
193
  className: "mt-5",
195
194
  children: [/* @__PURE__ */ jsxs("div", {
196
195
  className: "mb-1.5 flex justify-between text-xs text-muted-foreground",
197
- children: [/* @__PURE__ */ jsx("span", { children: "Monthly requests" }), /* @__PURE__ */ jsxs("span", { children: [
196
+ children: [/* @__PURE__ */ jsx("span", { children: "Requests in the last 30 days" }), /* @__PURE__ */ jsxs("span", { children: [
198
197
  usedRequests.toLocaleString(),
199
198
  " /",
200
199
  " ",
@@ -230,7 +229,7 @@ const SubscriptionsPage = () => {
230
229
  className: "divide-y rounded-xl border bg-card text-sm",
231
230
  children: earlierSubscriptions.map((subscription) => /* @__PURE__ */ jsxs("li", {
232
231
  className: "flex items-center justify-between gap-4 px-5 py-3",
233
- children: [/* @__PURE__ */ jsx("span", { children: planBySku.get(subscription.planSku)?.displayName ?? subscription.planSku }), /* @__PURE__ */ jsx("span", {
232
+ children: [/* @__PURE__ */ jsx("span", { children: planName(subscription.planSku) }), /* @__PURE__ */ jsx("span", {
234
233
  className: "text-xs text-muted-foreground",
235
234
  children: subscriptionStatusLabel(subscription.status)
236
235
  })]
@@ -1,7 +1,7 @@
1
1
  import { i as useRevokeApiKey, r as useCreateApiKey, t as API_KEY_CAP_REACHED } from "./useApiKeys-BrYWVXE9.mjs";
2
2
  import { Spinner } from "@lukoweb/apitogo/components";
3
3
  import { KeyRoundIcon, TrashIcon } from "@lukoweb/apitogo/icons";
4
- import { useState } from "react";
4
+ import { useEffect, useState } from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Button as Button$1 } from "@lukoweb/apitogo/ui/Button.js";
7
7
  import { Alert, AlertTitle } from "@lukoweb/apitogo/ui/Alert.js";
@@ -9,6 +9,25 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, D
9
9
  import { Input } from "@lukoweb/apitogo/ui/Input.js";
10
10
  import { Secret } from "@lukoweb/apitogo/ui/Secret.js";
11
11
 
12
+ //#region src/hooks/useSlowAfter.ts
13
+ /**
14
+ * True once `pending` has lasted `delayMs`, and false again as soon as it ends. Lets a page explain a wait only when it
15
+ * is long enough to need it (API-88), without a flash of text on a quick answer.
16
+ */
17
+ function useSlowAfter(pending, delayMs) {
18
+ const [slow, setSlow] = useState(false);
19
+ useEffect(() => {
20
+ if (!pending) {
21
+ setSlow(false);
22
+ return;
23
+ }
24
+ const timer = setTimeout(() => setSlow(true), delayMs);
25
+ return () => clearTimeout(timer);
26
+ }, [pending, delayMs]);
27
+ return pending && slow;
28
+ }
29
+
30
+ //#endregion
12
31
  //#region src/components/ApiKeysPanel.tsx
13
32
  /**
14
33
  * Lists gateway API keys for one plan with create and revoke. The plaintext key is returned by the
@@ -16,6 +35,7 @@ import { Secret } from "@lukoweb/apitogo/ui/Secret.js";
16
35
  */
17
36
  const ApiKeysPanel = ({ plan, header, readOnly = false }) => {
18
37
  const createKey = useCreateApiKey();
38
+ const creatingSlowly = useSlowAfter(createKey.isPending, 4e3);
19
39
  const revokeKey = useRevokeApiKey();
20
40
  const [name, setName] = useState("");
21
41
  const [newKey, setNewKey] = useState(null);
@@ -179,6 +199,11 @@ const ApiKeysPanel = ({ plan, header, readOnly = false }) => {
179
199
  children: createKey.isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Spinner, { size: 14 }), "Creating…"] }) : "Create API key"
180
200
  })]
181
201
  }),
202
+ creatingSlowly ? /* @__PURE__ */ jsx("p", {
203
+ role: "status",
204
+ className: "text-sm text-muted-foreground",
205
+ children: "Setting up your key at the gateway. This can take a few more seconds; the key is shown here once it is ready."
206
+ }) : null,
182
207
  plan && !plan.canCreate && !readOnly ? /* @__PURE__ */ jsx("p", {
183
208
  className: "text-sm text-muted-foreground",
184
209
  children: plan.maxKeys == null ? "API key creation is currently disabled for this API." : `You have reached this plan's limit of ${plan.maxKeys} API keys. Revoke a key to create a new one.`
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import { n as startPlansPrefetch, t as usePlans } from "./usePlans-c8s0gfOq.mjs"
9
9
  import "./pending-checkout-DpVaNnTu.mjs";
10
10
  import { a as playgroundKeyIdentities, i as useRevokeApiKey, n as useApiKeys, r as useCreateApiKey, t as API_KEY_CAP_REACHED } from "./useApiKeys-BrYWVXE9.mjs";
11
11
  import { n as useUsageRecent, t as useUsage } from "./useUsage-DeEDgDdj.mjs";
12
- import { r as ApiKeysPanel, t as accountLayoutProps } from "./account-links-kIj72Vb2.mjs";
12
+ import { r as ApiKeysPanel, t as accountLayoutProps } from "./account-links-CgPPM43_.mjs";
13
13
  import { t as isPreviewPricingEnabled } from "./pricing-config-Bc6eWFUO.mjs";
14
14
  import { Head, Link } from "@lukoweb/apitogo/components";
15
15
  import { ArrowRightIcon, KeyRoundIcon, StarsIcon } from "@lukoweb/apitogo/icons";
@@ -370,9 +370,9 @@ async function getSignedInIdentities(apiBaseUrl, fetchImpl = fetch) {
370
370
  const AccountPlansPage$1 = lazy(() => import("./AccountPlansPage-DW3DhOfi.mjs").then((n) => n.n));
371
371
  const CheckoutPage = lazy(() => import("./CheckoutPage-CZ9NXp8z.mjs"));
372
372
  const ContactSalesPage = lazy(() => import("./ContactSalesPage-CNx7qTyo.mjs"));
373
- const CredentialsPage = lazy(() => import("./CredentialsPage-CZeYg5Bd.mjs"));
373
+ const CredentialsPage = lazy(() => import("./CredentialsPage-505PrHN8.mjs"));
374
374
  const PricingPage = lazy(() => import("./PricingPage-CmeLQeEx.mjs"));
375
- const SubscriptionsPage = lazy(() => import("./SubscriptionsPage-CfG0q5dL.mjs"));
375
+ const SubscriptionsPage = lazy(() => import("./SubscriptionsPage-hCO41YWD.mjs"));
376
376
  const UsagePage = lazy(() => import("./UsagePage-CFZTZMvk.mjs"));
377
377
  function resolvePricingEnabled(config) {
378
378
  if (config.__meta?.pricingEnabled !== void 0) return config.__meta.pricingEnabled;
package/package.json CHANGED
@@ -1,11 +1,7 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo-plugin-dev-portal-billing",
3
- "version": "0.2.73",
4
- "repository": {
5
- "type": "git",
6
- "url": "https://github.com/zuplo/zudoku",
7
- "directory": "packages/plugin-dev-portal-billing"
8
- },
3
+ "version": "0.2.75",
4
+ "homepage": "https://docs.apitogo.com",
9
5
  "type": "module",
10
6
  "main": "./dist/index.mjs",
11
7
  "types": "./dist/index.d.mts",
@@ -46,8 +42,8 @@
46
42
  "react": "19.2.4",
47
43
  "react-dom": "19.2.4",
48
44
  "tsdown": "0.20.3",
49
- "@lukoweb/apitogo": "0.2.73",
50
- "@lukoweb/apitogo-module-user-panel": "0.2.73"
45
+ "@lukoweb/apitogo": "0.2.75",
46
+ "@lukoweb/apitogo-module-user-panel": "0.2.75"
51
47
  },
52
48
  "peerDependencies": {
53
49
  "react": ">=19.2.0",