@lukoweb/apitogo-plugin-dev-portal-billing 0.2.86 → 0.2.88
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/dist/{AccountPlansPage-B4gb0WvB.mjs → AccountPlansPage-DOKNdfsT.mjs} +4 -4
- package/dist/{CheckoutPage-Bom6gjGC.mjs → CheckoutPage-DlbQUHUl.mjs} +2 -2
- package/dist/{ContactSalesPage-DvqVqsuC.mjs → ContactSalesPage-cdJA7B-J.mjs} +2 -2
- package/dist/{CredentialsPage-BH8xLVnt.mjs → CredentialsPage-CZRT8Wx8.mjs} +3 -3
- package/dist/{PricingCard-CRH9rxT3.mjs → PricingCard-1t_3YoIl.mjs} +1 -1
- package/dist/{PricingPage-DJwl2XAp.mjs → PricingPage-ffIoVEQf.mjs} +5 -5
- package/dist/{SubscriptionsPage-d5gWSBMr.mjs → SubscriptionsPage-BFGL0Ruo.mjs} +7 -7
- package/dist/{UsagePage-lPOEWUOG.mjs → UsagePage-F-39QBHy.mjs} +4 -4
- package/dist/{account-links-QGu5q_vP.mjs → account-links-CabbpN7u.mjs} +1 -1
- package/dist/{billing-period-C2PIOhfT.mjs → billing-period-d5mtqePH.mjs} +1 -1
- package/dist/{billing-state-Dal_UzOQ.mjs → billing-state-Dxiqz95K.mjs} +15 -8
- package/dist/index.mjs +15 -15
- package/dist/{useApiKeys-CS2SmfJc.mjs → useApiKeys-BbGhwIcK.mjs} +1 -1
- package/dist/{useDevPortalApiBaseUrl-DwObxX8r.mjs → useDevPortalApiBaseUrl-yoRfy0c_.mjs} +57 -1
- package/dist/{useMySubscriptions-CfZPpul6.mjs → useMySubscriptions-B0gv3zwT.mjs} +1 -1
- package/dist/{usePlans-CRFHBOqz.mjs → usePlans-BpZhGMU-.mjs} +1 -1
- package/dist/{useUsage-DqizlLwt.mjs → useUsage-lRPa-4sI.mjs} +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
|
-
import { l as isActiveSubscription, m as parseManifestPlans, n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl
|
|
3
|
-
import { t as PricingCard } from "./PricingCard-
|
|
2
|
+
import { S as withPlanFeatures, l as isActiveSubscription, m as parseManifestPlans, n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
3
|
+
import { t as PricingCard } from "./PricingCard-1t_3YoIl.mjs";
|
|
4
4
|
import { n as readProblemDetail } from "./problem-details-n20-dy3w.mjs";
|
|
5
|
-
import { t as useMySubscriptions } from "./useMySubscriptions-
|
|
6
|
-
import { t as usePlans } from "./usePlans-
|
|
5
|
+
import { t as useMySubscriptions } from "./useMySubscriptions-B0gv3zwT.mjs";
|
|
6
|
+
import { t as usePlans } from "./usePlans-BpZhGMU-.mjs";
|
|
7
7
|
import { n as readPendingCheckout, t as clearPendingCheckout } from "./pending-checkout-DpVaNnTu.mjs";
|
|
8
8
|
import { Head } from "@lukoweb/apitogo/components";
|
|
9
9
|
import { CreditCardIcon } from "@lukoweb/apitogo/icons";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as ALREADY_SUBSCRIBED_PARAM, s as PRICING_PATH, t as ACCOUNT_PLANS_PATH } from "./paths-DBr3Dj_q.mjs";
|
|
2
|
-
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-
|
|
2
|
+
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
3
3
|
import { n as readProblemDetail, t as isAlreadySubscribedMessage } from "./problem-details-n20-dy3w.mjs";
|
|
4
4
|
import { r as rememberPendingCheckout } from "./pending-checkout-DpVaNnTu.mjs";
|
|
5
|
-
import { t as FREE_CHECKOUT_MARKER } from "./billing-state-
|
|
5
|
+
import { t as FREE_CHECKOUT_MARKER } from "./billing-state-Dxiqz95K.mjs";
|
|
6
6
|
import { ShieldIcon } from "@lukoweb/apitogo/icons";
|
|
7
7
|
import { Link, useNavigate, useSearchParams } from "@lukoweb/apitogo/router";
|
|
8
8
|
import { useEffect } from "react";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
2
|
import { s as PRICING_PATH } from "./paths-DBr3Dj_q.mjs";
|
|
3
|
-
import { d as isPlanCustomPriced, n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-
|
|
3
|
+
import { d as isPlanCustomPriced, n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
4
4
|
import { n as readProblemDetail } from "./problem-details-n20-dy3w.mjs";
|
|
5
|
-
import { t as usePlans } from "./usePlans-
|
|
5
|
+
import { t as usePlans } from "./usePlans-BpZhGMU-.mjs";
|
|
6
6
|
import { Link, useSearchParams } from "@lukoweb/apitogo/router";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
2
|
import { t as ACCOUNT_PLANS_PATH } from "./paths-DBr3Dj_q.mjs";
|
|
3
|
-
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-
|
|
3
|
+
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
4
4
|
import { r as createDemoCredentials, t as DEMO_GATEWAY_KEY_HEADER } from "./demo-session-yK9qEqV-.mjs";
|
|
5
|
-
import { n as useApiKeys } from "./useApiKeys-
|
|
6
|
-
import { n as apiReferencePath, r as ApiKeysPanel } from "./account-links-
|
|
5
|
+
import { n as useApiKeys } from "./useApiKeys-BbGhwIcK.mjs";
|
|
6
|
+
import { n as apiReferencePath, r as ApiKeysPanel } from "./account-links-CabbpN7u.mjs";
|
|
7
7
|
import { i as ChoosePlanNotice, r as keyPlanNote, t as apiKeysPageState } from "./page-state-Cmo0FPLl.mjs";
|
|
8
8
|
import { Head } from "@lukoweb/apitogo/components";
|
|
9
9
|
import { KeyRoundIcon } from "@lukoweb/apitogo/icons";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
2
|
import { i as CONTACT_SALES_PATH, r as CHECKOUT_PATH } from "./paths-DBr3Dj_q.mjs";
|
|
3
|
-
import { a as formatMoney, c as formatPlanPriceUnit, d as isPlanCustomPriced, f as isPlanFree, i as formatBillingPeriod, l as isActiveSubscription, o as formatPlanDisplayPrice, p as listPlanFeatureLines } from "./useDevPortalApiBaseUrl-
|
|
3
|
+
import { a as formatMoney, c as formatPlanPriceUnit, d as isPlanCustomPriced, f as isPlanFree, i as formatBillingPeriod, l as isActiveSubscription, o as formatPlanDisplayPrice, p as listPlanFeatureLines } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
4
4
|
import { Button } from "@lukoweb/apitogo/components";
|
|
5
5
|
import { Link as Link$1 } from "@lukoweb/apitogo/router";
|
|
6
6
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@lukoweb/apitogo/ui/AlertDialog.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
|
-
import { _ as pickFeaturedPlanSku, a as formatMoney, f as isPlanFree, i as formatBillingPeriod, m as parseManifestPlans, n as useDevPortalPreviewMode
|
|
3
|
-
import { t as PricingCard } from "./PricingCard-
|
|
4
|
-
import { t as usePlans } from "./usePlans-
|
|
2
|
+
import { S as withPlanFeatures, _ as pickFeaturedPlanSku, a as formatMoney, f as isPlanFree, i as formatBillingPeriod, m as parseManifestPlans, n as useDevPortalPreviewMode } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
3
|
+
import { t as PricingCard } from "./PricingCard-1t_3YoIl.mjs";
|
|
4
|
+
import { t as usePlans } from "./usePlans-BpZhGMU-.mjs";
|
|
5
5
|
import { t as isPreviewPricingEnabled } from "./pricing-config-Bc6eWFUO.mjs";
|
|
6
|
-
import { a as isPricingLoading, n as buildCompareRows } from "./billing-state-
|
|
7
|
-
import { a as featuredSkuForPeriod, i as discountFor, n as addOnPriceFor, o as plansForPeriod, r as availablePeriods, s as savingsLabel, t as PERIOD_LABELS } from "./billing-period-
|
|
6
|
+
import { a as isPricingLoading, n as buildCompareRows } from "./billing-state-Dxiqz95K.mjs";
|
|
7
|
+
import { a as featuredSkuForPeriod, i as discountFor, n as addOnPriceFor, o as plansForPeriod, r as availablePeriods, s as savingsLabel, t as PERIOD_LABELS } from "./billing-period-d5mtqePH.mjs";
|
|
8
8
|
import { Head, Heading } from "@lukoweb/apitogo/components";
|
|
9
9
|
import { Navigate } from "@lukoweb/apitogo/router";
|
|
10
10
|
import { useState } from "react";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
2
|
import { a as CREDENTIALS_PATH, n as ALREADY_SUBSCRIBED_PARAM, t as ACCOUNT_PLANS_PATH } from "./paths-DBr3Dj_q.mjs";
|
|
3
|
-
import { a as formatMoney, f as isPlanFree, h as parseMonthlyQuotaCalls, i as formatBillingPeriod, l as isActiveSubscription, n as useDevPortalPreviewMode, r as useIsDemoSession, s as formatPlanPrice, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-
|
|
3
|
+
import { a as formatMoney, f as isPlanFree, h as parseMonthlyQuotaCalls, i as formatBillingPeriod, l as isActiveSubscription, n as useDevPortalPreviewMode, r as useIsDemoSession, s as formatPlanPrice, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
4
4
|
import { n as readProblemDetail } from "./problem-details-n20-dy3w.mjs";
|
|
5
|
-
import { t as useMySubscriptions } from "./useMySubscriptions-
|
|
6
|
-
import { t as usePlans } from "./usePlans-
|
|
5
|
+
import { t as useMySubscriptions } from "./useMySubscriptions-B0gv3zwT.mjs";
|
|
6
|
+
import { t as usePlans } from "./usePlans-BpZhGMU-.mjs";
|
|
7
7
|
import { n as readPendingCheckout, t as clearPendingCheckout } from "./pending-checkout-DpVaNnTu.mjs";
|
|
8
|
-
import { n as useApiKeys } from "./useApiKeys-
|
|
9
|
-
import { t as useUsage } from "./useUsage-
|
|
10
|
-
import { i as hasPaymentProvider, r as checkoutConfirmingText } from "./billing-state-
|
|
8
|
+
import { n as useApiKeys } from "./useApiKeys-BbGhwIcK.mjs";
|
|
9
|
+
import { t as useUsage } from "./useUsage-lRPa-4sI.mjs";
|
|
10
|
+
import { i as hasPaymentProvider, r as checkoutConfirmingText } from "./billing-state-Dxiqz95K.mjs";
|
|
11
11
|
import { i as ChoosePlanNotice, n as billingPageState, r as keyPlanNote } from "./page-state-Cmo0FPLl.mjs";
|
|
12
|
-
import { n as addOnPriceFor } from "./billing-period-
|
|
12
|
+
import { n as addOnPriceFor } from "./billing-period-d5mtqePH.mjs";
|
|
13
13
|
import { Head, Spinner } from "@lukoweb/apitogo/components";
|
|
14
14
|
import { Link as Link$1, useSearchParams } from "@lukoweb/apitogo/router";
|
|
15
15
|
import { useEffect } from "react";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
|
-
import { g as parseQuotaPeriodDays, h as parseMonthlyQuotaCalls, l as isActiveSubscription } from "./useDevPortalApiBaseUrl-
|
|
3
|
-
import { t as useMySubscriptions } from "./useMySubscriptions-
|
|
4
|
-
import { t as usePlans } from "./usePlans-
|
|
5
|
-
import { n as useUsageRecent, t as useUsage } from "./useUsage-
|
|
2
|
+
import { g as parseQuotaPeriodDays, h as parseMonthlyQuotaCalls, l as isActiveSubscription } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
3
|
+
import { t as useMySubscriptions } from "./useMySubscriptions-B0gv3zwT.mjs";
|
|
4
|
+
import { t as usePlans } from "./usePlans-BpZhGMU-.mjs";
|
|
5
|
+
import { n as useUsageRecent, t as useUsage } from "./useUsage-lRPa-4sI.mjs";
|
|
6
6
|
import { Head } from "@lukoweb/apitogo/components";
|
|
7
7
|
import { Link as Link$1 } from "@lukoweb/apitogo/router";
|
|
8
8
|
import { useState } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as useRevokeApiKey, r as useCreateApiKey, t as API_KEY_CAP_REACHED } from "./useApiKeys-
|
|
1
|
+
import { i as useRevokeApiKey, r as useCreateApiKey, t as API_KEY_CAP_REACHED } from "./useApiKeys-BbGhwIcK.mjs";
|
|
2
2
|
import { Spinner } from "@lukoweb/apitogo/components";
|
|
3
3
|
import { KeyRoundIcon, TrashIcon } from "@lukoweb/apitogo/icons";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as quotaCell, y as rateLimitCell } from "./useDevPortalApiBaseUrl-
|
|
1
|
+
import { v as quotaCell, x as tokenLimitCell, y as rateLimitCell } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/billing-state.ts
|
|
4
4
|
/** Whether the pricing page has no plans to show yet because the answer is still on its way. */
|
|
@@ -31,13 +31,20 @@ const FREE_CHECKOUT_MARKER = "paid=0";
|
|
|
31
31
|
function buildCompareRows(input) {
|
|
32
32
|
if (input.configuredRows && input.configuredRows.length > 0) return input.configuredRows;
|
|
33
33
|
if (input.plans.length === 0) return input.isPreview ? input.sampleRows : [];
|
|
34
|
-
return [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
label: "Request quota",
|
|
37
|
+
values: input.plans.map((plan) => quotaCell(plan.limitsJson) ?? "—")
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "Rate limit",
|
|
41
|
+
values: input.plans.map((plan) => rateLimitCell(plan.limitsJson) ?? "—")
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "AI token limit",
|
|
45
|
+
values: input.plans.map((plan) => tokenLimitCell(plan.limitsJson) ?? "—")
|
|
46
|
+
}
|
|
47
|
+
].filter((row) => row.values.some((value) => value !== "—"));
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { t as AccountPlansPage } from "./AccountPlansPage-
|
|
1
|
+
import { t as AccountPlansPage } from "./AccountPlansPage-DOKNdfsT.mjs";
|
|
2
2
|
import { n as registerDevPortalBillingOptions, r as useDevPortalBillingConfig, t as DevPortalBillingProvider } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
3
3
|
import { a as CREDENTIALS_PATH, c as SUBSCRIPTIONS_PATH, i as CONTACT_SALES_PATH, l as USAGE_PATH, o as LOGIN_NAV_PATH, r as CHECKOUT_PATH, s as PRICING_PATH, t as ACCOUNT_PLANS_PATH } from "./paths-DBr3Dj_q.mjs";
|
|
4
|
-
import { _ as pickFeaturedPlanSku, b as resolveDevPortalApiBaseUrl, c as formatPlanPriceUnit, l as isActiveSubscription, m as parseManifestPlans, o as formatPlanDisplayPrice, p as listPlanFeatureLines } from "./useDevPortalApiBaseUrl-
|
|
5
|
-
import "./PricingCard-
|
|
4
|
+
import { _ as pickFeaturedPlanSku, b as resolveDevPortalApiBaseUrl, c as formatPlanPriceUnit, l as isActiveSubscription, m as parseManifestPlans, o as formatPlanDisplayPrice, p as listPlanFeatureLines } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
5
|
+
import "./PricingCard-1t_3YoIl.mjs";
|
|
6
6
|
import { t as DEMO_GATEWAY_KEY_HEADER } from "./demo-session-yK9qEqV-.mjs";
|
|
7
|
-
import { t as useMySubscriptions } from "./useMySubscriptions-
|
|
8
|
-
import { n as startPlansPrefetch, t as usePlans } from "./usePlans-
|
|
7
|
+
import { t as useMySubscriptions } from "./useMySubscriptions-B0gv3zwT.mjs";
|
|
8
|
+
import { n as startPlansPrefetch, t as usePlans } from "./usePlans-BpZhGMU-.mjs";
|
|
9
9
|
import "./pending-checkout-DpVaNnTu.mjs";
|
|
10
|
-
import { a as playgroundKeyIdentities, i as useRevokeApiKey, n as useApiKeys, r as useCreateApiKey, t as API_KEY_CAP_REACHED } from "./useApiKeys-
|
|
11
|
-
import { n as useUsageRecent, t as useUsage } from "./useUsage-
|
|
12
|
-
import { r as ApiKeysPanel, t as accountLayoutProps } from "./account-links-
|
|
10
|
+
import { a as playgroundKeyIdentities, i as useRevokeApiKey, n as useApiKeys, r as useCreateApiKey, t as API_KEY_CAP_REACHED } from "./useApiKeys-BbGhwIcK.mjs";
|
|
11
|
+
import { n as useUsageRecent, t as useUsage } from "./useUsage-lRPa-4sI.mjs";
|
|
12
|
+
import { r as ApiKeysPanel, t as accountLayoutProps } from "./account-links-CabbpN7u.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";
|
|
@@ -367,13 +367,13 @@ async function getSignedInIdentities(apiBaseUrl, fetchImpl = fetch) {
|
|
|
367
367
|
|
|
368
368
|
//#endregion
|
|
369
369
|
//#region src/DevPortalBillingPlugin.tsx
|
|
370
|
-
const AccountPlansPage$1 = lazy(() => import("./AccountPlansPage-
|
|
371
|
-
const CheckoutPage = lazy(() => import("./CheckoutPage-
|
|
372
|
-
const ContactSalesPage = lazy(() => import("./ContactSalesPage-
|
|
373
|
-
const CredentialsPage = lazy(() => import("./CredentialsPage-
|
|
374
|
-
const PricingPage = lazy(() => import("./PricingPage-
|
|
375
|
-
const SubscriptionsPage = lazy(() => import("./SubscriptionsPage-
|
|
376
|
-
const UsagePage = lazy(() => import("./UsagePage-
|
|
370
|
+
const AccountPlansPage$1 = lazy(() => import("./AccountPlansPage-DOKNdfsT.mjs").then((n) => n.n));
|
|
371
|
+
const CheckoutPage = lazy(() => import("./CheckoutPage-DlbQUHUl.mjs"));
|
|
372
|
+
const ContactSalesPage = lazy(() => import("./ContactSalesPage-cdJA7B-J.mjs"));
|
|
373
|
+
const CredentialsPage = lazy(() => import("./CredentialsPage-CZRT8Wx8.mjs"));
|
|
374
|
+
const PricingPage = lazy(() => import("./PricingPage-ffIoVEQf.mjs"));
|
|
375
|
+
const SubscriptionsPage = lazy(() => import("./SubscriptionsPage-BFGL0Ruo.mjs"));
|
|
376
|
+
const UsagePage = lazy(() => import("./UsagePage-F-39QBHy.mjs"));
|
|
377
377
|
function resolvePricingEnabled(config) {
|
|
378
378
|
if (config.__meta?.pricingEnabled !== void 0) return config.__meta.pricingEnabled;
|
|
379
379
|
return isPreviewPricingEnabled();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
|
-
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-
|
|
2
|
+
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
3
3
|
import { n as readProblemDetail } from "./problem-details-n20-dy3w.mjs";
|
|
4
4
|
import { n as createDemoApiKeys, t as DEMO_GATEWAY_KEY_HEADER } from "./demo-session-yK9qEqV-.mjs";
|
|
5
5
|
import { useMutation, useQuery, useQueryClient } from "@lukoweb/apitogo/react-query";
|
|
@@ -2,6 +2,55 @@ import manifestCatalog from "virtual:apitogo-local-manifest";
|
|
|
2
2
|
import zudokuConfig from "virtual:zudoku-config";
|
|
3
3
|
import { useAuth } from "@lukoweb/apitogo/hooks";
|
|
4
4
|
|
|
5
|
+
//#region src/utils/token-limits.ts
|
|
6
|
+
const PERIOD_WORD = {
|
|
7
|
+
hour: "hour",
|
|
8
|
+
day: "day",
|
|
9
|
+
week: "week",
|
|
10
|
+
month: "month",
|
|
11
|
+
year: "year"
|
|
12
|
+
};
|
|
13
|
+
function endpoint(actionKey) {
|
|
14
|
+
const separator = actionKey.indexOf(":");
|
|
15
|
+
return separator <= 0 ? actionKey : `${actionKey.slice(0, separator).toUpperCase()} ${actionKey.slice(separator + 1)}`;
|
|
16
|
+
}
|
|
17
|
+
function operationsOf(limits) {
|
|
18
|
+
const tokenLimit = limits?.tokenLimit;
|
|
19
|
+
if (!tokenLimit || typeof tokenLimit !== "object") return [];
|
|
20
|
+
const operations = tokenLimit.operations;
|
|
21
|
+
if (!operations || typeof operations !== "object") return [];
|
|
22
|
+
return Object.entries(operations).filter((entry) => !!entry[1] && typeof entry[1] === "object").sort(([a], [b]) => a.localeCompare(b));
|
|
23
|
+
}
|
|
24
|
+
function parts(limit, style) {
|
|
25
|
+
const out = [];
|
|
26
|
+
if (typeof limit.tokensPerMinute === "number" && limit.tokensPerMinute > 0) {
|
|
27
|
+
const n = limit.tokensPerMinute.toLocaleString("en-US");
|
|
28
|
+
out.push(style === "line" ? `${n} tokens per minute` : `${n} / min`);
|
|
29
|
+
}
|
|
30
|
+
if (typeof limit.tokenQuota === "number" && limit.tokenQuota > 0) {
|
|
31
|
+
const n = limit.tokenQuota.toLocaleString("en-US");
|
|
32
|
+
const period = PERIOD_WORD[(limit.tokenQuotaPeriod ?? "").toLowerCase()];
|
|
33
|
+
const per = period ? ` / ${period}` : "";
|
|
34
|
+
out.push(style === "line" ? `${n} tokens${per}` : `${n}${per}`);
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
/** One card line per limited endpoint: "20,000 tokens per minute and 2,000,000 tokens / month on POST /chat". */
|
|
39
|
+
function tokenLimitLines(limits) {
|
|
40
|
+
return operationsOf(limits).flatMap(([actionKey, limit]) => {
|
|
41
|
+
const text = parts(limit, "line");
|
|
42
|
+
return text.length === 0 ? [] : [`${text.join(" and ")} on ${endpoint(actionKey)}`];
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** The token limits as a short table cell ("20,000 / min, 2,000,000 / month"), naming the endpoint when there are several. */
|
|
46
|
+
function tokenLimitCellOf(limits) {
|
|
47
|
+
const cells = operationsOf(limits).map(([actionKey, limit]) => [actionKey, parts(limit, "cell")]).filter(([, text]) => text.length > 0);
|
|
48
|
+
if (cells.length === 0) return null;
|
|
49
|
+
if (cells.length === 1) return cells[0][1].join(", ");
|
|
50
|
+
return cells.map(([actionKey, text]) => `${endpoint(actionKey)}: ${text.join(", ")}`).join("; ");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
5
54
|
//#region src/utils/dev-portal-api.ts
|
|
6
55
|
const DEV_PORTAL_PLACEHOLDER_API_URL = "https://dp-example.azurecontainerapps.io";
|
|
7
56
|
function resolveDevPortalApiBaseUrl(configuredUrl) {
|
|
@@ -158,9 +207,11 @@ function formatQuota(quota) {
|
|
|
158
207
|
const limit = quota;
|
|
159
208
|
const calls = limit.calls;
|
|
160
209
|
const renewalPeriodDays = limit.renewalPeriodDays ?? limit.periodDays;
|
|
210
|
+
const renewalPeriodHours = limit.renewalPeriodHours ?? limit.periodHours;
|
|
161
211
|
if (calls == null) return null;
|
|
162
212
|
if (calls < 0) return "Unlimited requests";
|
|
163
213
|
const formatted = calls.toLocaleString();
|
|
214
|
+
if (renewalPeriodHours != null && renewalPeriodHours > 0) return renewalPeriodHours === 1 ? `${formatted} requests / hour` : `${formatted} requests / ${renewalPeriodHours} hours`;
|
|
164
215
|
if (renewalPeriodDays === 30 || renewalPeriodDays === 31) return `${formatted} requests / month`;
|
|
165
216
|
if (renewalPeriodDays === 1) return `${formatted} requests / day`;
|
|
166
217
|
if (renewalPeriodDays != null) return `${formatted} requests / ${renewalPeriodDays} days`;
|
|
@@ -191,6 +242,10 @@ function rateLimitCell(limitsJson) {
|
|
|
191
242
|
if (renewalPeriodSeconds === 3600) return `${formatted} / hour`;
|
|
192
243
|
return `${formatted} / ${renewalPeriodSeconds} sec`;
|
|
193
244
|
}
|
|
245
|
+
/** The LLM token limits of a plan as a short table cell, or null when the plan has none. */
|
|
246
|
+
function tokenLimitCell(limitsJson) {
|
|
247
|
+
return tokenLimitCellOf(parseLimits(limitsJson));
|
|
248
|
+
}
|
|
194
249
|
function parseLimits(limitsJson) {
|
|
195
250
|
if (!limitsJson?.trim()) return null;
|
|
196
251
|
try {
|
|
@@ -228,6 +283,7 @@ function listPlanFeatureLines(plan, options = {}) {
|
|
|
228
283
|
if (quotaLine) lines.push(quotaLine);
|
|
229
284
|
const rateLine = formatRateLimit(limits.rateLimit);
|
|
230
285
|
if (rateLine) lines.push(rateLine);
|
|
286
|
+
lines.push(...tokenLimitLines(limits));
|
|
231
287
|
} catch {}
|
|
232
288
|
for (const feature of plan.features ?? []) if (!lines.includes(feature)) lines.push(feature);
|
|
233
289
|
const extras = plan.features?.length ? void 0 : SAMPLE_PLAN_FEATURE_EXTRAS[plan.sku.toLowerCase()];
|
|
@@ -287,4 +343,4 @@ function useDevPortalPreviewMode() {
|
|
|
287
343
|
}
|
|
288
344
|
|
|
289
345
|
//#endregion
|
|
290
|
-
export { pickFeaturedPlanSku as _, formatMoney as a, resolveDevPortalApiBaseUrl as b, formatPlanPriceUnit as c, isPlanCustomPriced as d, isPlanFree as f, parseQuotaPeriodDays as g, parseMonthlyQuotaCalls as h, formatBillingPeriod as i, isActiveSubscription as l, parseManifestPlans as m, useDevPortalPreviewMode as n, formatPlanDisplayPrice as o, listPlanFeatureLines as p, useIsDemoSession as r, formatPlanPrice as s, useDevPortalApiBaseUrl as t, isPlaceholderDevPortalApiUrl as u, quotaCell as v,
|
|
346
|
+
export { withPlanFeatures as S, pickFeaturedPlanSku as _, formatMoney as a, resolveDevPortalApiBaseUrl as b, formatPlanPriceUnit as c, isPlanCustomPriced as d, isPlanFree as f, parseQuotaPeriodDays as g, parseMonthlyQuotaCalls as h, formatBillingPeriod as i, isActiveSubscription as l, parseManifestPlans as m, useDevPortalPreviewMode as n, formatPlanDisplayPrice as o, listPlanFeatureLines as p, useIsDemoSession as r, formatPlanPrice as s, useDevPortalApiBaseUrl as t, isPlaceholderDevPortalApiUrl as u, quotaCell as v, tokenLimitCell as x, rateLimitCell as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
|
-
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-
|
|
2
|
+
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
3
3
|
import { i as createDemoMeResponse } from "./demo-session-yK9qEqV-.mjs";
|
|
4
4
|
import { useQuery } from "@lukoweb/apitogo/react-query";
|
|
5
5
|
import { useAuth } from "@lukoweb/apitogo/hooks";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as useDevPortalBillingConfig } from "./DevPortalBillingContext-BUQPLoyk.mjs";
|
|
2
|
-
import { m as parseManifestPlans, n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl, u as isPlaceholderDevPortalApiUrl
|
|
2
|
+
import { S as withPlanFeatures, m as parseManifestPlans, n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl, u as isPlaceholderDevPortalApiUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
3
3
|
import { useQuery } from "@lukoweb/apitogo/react-query";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/plans-prefetch.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-
|
|
1
|
+
import { n as useDevPortalPreviewMode, r as useIsDemoSession, t as useDevPortalApiBaseUrl } from "./useDevPortalApiBaseUrl-yoRfy0c_.mjs";
|
|
2
2
|
import { useQuery } from "@lukoweb/apitogo/react-query";
|
|
3
3
|
import { useAuth } from "@lukoweb/apitogo/hooks";
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lukoweb/apitogo-plugin-dev-portal-billing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.88",
|
|
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.
|
|
46
|
-
"@lukoweb/apitogo-module-user-panel": "0.2.
|
|
45
|
+
"@lukoweb/apitogo": "0.2.88",
|
|
46
|
+
"@lukoweb/apitogo-module-user-panel": "0.2.88"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": ">=19.2.0",
|