@lukoweb/apitogo-plugin-dev-portal-billing 0.1.89 → 0.1.91
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/index.d.mts +2 -1
- package/dist/index.mjs +29 -26
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -75,6 +75,7 @@ declare const ApiKeysPanel: ({
|
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/paths.d.ts
|
|
77
77
|
declare const PRICING_PATH = "/pricing";
|
|
78
|
+
declare const ACCOUNT_PLANS_PATH = "/account/plans";
|
|
78
79
|
declare const CHECKOUT_PATH = "/checkout";
|
|
79
80
|
declare const SUBSCRIPTIONS_PATH = "/account/subscriptions";
|
|
80
81
|
declare const CREDENTIALS_PATH = "/account/credentials";
|
|
@@ -201,4 +202,4 @@ declare function useCreateApiKey(): _tanstack_react_query0.UseMutationResult<Dev
|
|
|
201
202
|
}, unknown>;
|
|
202
203
|
declare function useRevokeApiKey(): _tanstack_react_query0.UseMutationResult<void, Error, string, unknown>;
|
|
203
204
|
//#endregion
|
|
204
|
-
export { API_KEY_CAP_REACHED, AccountPlansPage, ApiKeysPanel, CHECKOUT_PATH, CREDENTIALS_PATH, OverviewDashboardPage, PRICING_PATH, SUBSCRIPTIONS_PATH, USAGE_PATH, devPortalBillingPlugin, useApiKeys, useCreateApiKey, useRevokeApiKey };
|
|
205
|
+
export { ACCOUNT_PLANS_PATH, API_KEY_CAP_REACHED, AccountPlansPage, ApiKeysPanel, CHECKOUT_PATH, CREDENTIALS_PATH, OverviewDashboardPage, PRICING_PATH, SUBSCRIPTIONS_PATH, USAGE_PATH, devPortalBillingPlugin, useApiKeys, useCreateApiKey, useRevokeApiKey };
|
package/dist/index.mjs
CHANGED
|
@@ -252,14 +252,6 @@ const PricingCard = ({ plan, mode = "public", subscriptionStatus, isSubscribed =
|
|
|
252
252
|
to: `/checkout?planSku=${encodeURIComponent(plan.sku)}`,
|
|
253
253
|
children: isPlanFree(plan) ? "Get started" : "Subscribe"
|
|
254
254
|
})
|
|
255
|
-
}) : isActive ? /* @__PURE__ */ jsx(Button, {
|
|
256
|
-
variant: "secondary",
|
|
257
|
-
className: "w-full",
|
|
258
|
-
asChild: true,
|
|
259
|
-
children: /* @__PURE__ */ jsx(Link$1, {
|
|
260
|
-
to: "/account/subscriptions",
|
|
261
|
-
children: "Manage subscription"
|
|
262
|
-
})
|
|
263
255
|
}) : /* @__PURE__ */ jsx(Button, {
|
|
264
256
|
variant: featured ? "default" : "outline",
|
|
265
257
|
className: "w-full",
|
|
@@ -814,6 +806,7 @@ function useUsageRecent(limit = 20) {
|
|
|
814
806
|
//#endregion
|
|
815
807
|
//#region src/paths.ts
|
|
816
808
|
const PRICING_PATH = "/pricing";
|
|
809
|
+
const ACCOUNT_PLANS_PATH = "/account/plans";
|
|
817
810
|
const CHECKOUT_PATH = "/checkout";
|
|
818
811
|
const SUBSCRIPTIONS_PATH = "/account/subscriptions";
|
|
819
812
|
const CREDENTIALS_PATH = "/account/credentials";
|
|
@@ -1266,7 +1259,6 @@ const RedirectPage = ({ icon: Icon, title, description, url, children }) => {
|
|
|
1266
1259
|
|
|
1267
1260
|
//#endregion
|
|
1268
1261
|
//#region src/pages/CheckoutPage.tsx
|
|
1269
|
-
const ACCOUNT_PLANS_PATH = "/account/plans";
|
|
1270
1262
|
const CheckoutPage = () => {
|
|
1271
1263
|
const [searchParams] = useSearchParams();
|
|
1272
1264
|
const planSku = searchParams.get("planSku") ?? "";
|
|
@@ -1472,7 +1464,7 @@ const CredentialsPage = () => {
|
|
|
1472
1464
|
className: "mt-4",
|
|
1473
1465
|
asChild: true,
|
|
1474
1466
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1475
|
-
to:
|
|
1467
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1476
1468
|
children: "View plans"
|
|
1477
1469
|
})
|
|
1478
1470
|
})]
|
|
@@ -1490,7 +1482,7 @@ const CredentialsPage = () => {
|
|
|
1490
1482
|
className: "mt-4",
|
|
1491
1483
|
asChild: true,
|
|
1492
1484
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1493
|
-
to:
|
|
1485
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1494
1486
|
children: "View plans"
|
|
1495
1487
|
})
|
|
1496
1488
|
})]
|
|
@@ -1506,7 +1498,7 @@ const CredentialsPage = () => {
|
|
|
1506
1498
|
className: "mt-4",
|
|
1507
1499
|
asChild: true,
|
|
1508
1500
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1509
|
-
to:
|
|
1501
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1510
1502
|
children: "View plans"
|
|
1511
1503
|
})
|
|
1512
1504
|
})]
|
|
@@ -1630,23 +1622,16 @@ const DEFAULT_FAQS = [{
|
|
|
1630
1622
|
}];
|
|
1631
1623
|
const PricingPage = () => {
|
|
1632
1624
|
const { pricing, previewPlans } = useDevPortalBillingConfig();
|
|
1633
|
-
const auth = useAuth();
|
|
1634
1625
|
const isPreview = useDevPortalPreviewMode();
|
|
1635
1626
|
const pricingEnabled = isPreviewPricingEnabled() || isPreview;
|
|
1636
1627
|
const livePlans = usePlans();
|
|
1637
1628
|
const catalog = isPreview ? parseManifestPlans(previewPlans) : livePlans.data;
|
|
1638
1629
|
const isLoading = isPreview ? false : livePlans.isLoading;
|
|
1639
1630
|
const isError = isPreview ? false : livePlans.isError;
|
|
1640
|
-
const { data: me } = useMySubscriptions();
|
|
1641
1631
|
if (!pricingEnabled) return /* @__PURE__ */ jsx(Navigate, {
|
|
1642
1632
|
to: "/",
|
|
1643
1633
|
replace: true
|
|
1644
1634
|
});
|
|
1645
|
-
if (auth.sessionChecked && auth.isAuthenticated && !isPreview) return /* @__PURE__ */ jsx(Navigate, {
|
|
1646
|
-
to: "/account/plans",
|
|
1647
|
-
replace: true
|
|
1648
|
-
});
|
|
1649
|
-
const activeSkus = new Set((me?.subscriptions ?? []).filter((sub) => isActiveSubscription(sub.status)).map((sub) => sub.planSku));
|
|
1650
1635
|
const title = pricing?.title ?? "Pay for what you call";
|
|
1651
1636
|
const subtitle = pricing?.subtitle ?? "Every plan includes the full endpoint catalog. Higher tiers raise your request quota, rate limit, and support level.";
|
|
1652
1637
|
const plans = catalog?.plans ?? [];
|
|
@@ -1702,7 +1687,6 @@ const PricingPage = () => {
|
|
|
1702
1687
|
children: plans.map((plan) => /* @__PURE__ */ jsx(PricingCard, {
|
|
1703
1688
|
plan,
|
|
1704
1689
|
mode: "public",
|
|
1705
|
-
isSubscribed: activeSkus.has(plan.sku),
|
|
1706
1690
|
featured: plan.sku === featuredSku
|
|
1707
1691
|
}, plan.sku))
|
|
1708
1692
|
}) : !isLoading && !isError ? /* @__PURE__ */ jsxs("div", {
|
|
@@ -1904,7 +1888,7 @@ const SubscriptionsPage = () => {
|
|
|
1904
1888
|
className: "mt-4",
|
|
1905
1889
|
asChild: true,
|
|
1906
1890
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1907
|
-
to:
|
|
1891
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1908
1892
|
children: "View plans"
|
|
1909
1893
|
})
|
|
1910
1894
|
})]
|
|
@@ -1943,7 +1927,7 @@ const SubscriptionsPage = () => {
|
|
|
1943
1927
|
variant: "outline",
|
|
1944
1928
|
asChild: true,
|
|
1945
1929
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1946
|
-
to:
|
|
1930
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1947
1931
|
children: "Change plan"
|
|
1948
1932
|
})
|
|
1949
1933
|
}),
|
|
@@ -2193,8 +2177,11 @@ function withoutLoginNavigation(items) {
|
|
|
2193
2177
|
|
|
2194
2178
|
//#endregion
|
|
2195
2179
|
//#region src/utils/navigation-plans.ts
|
|
2180
|
+
function isPricingLink(item) {
|
|
2181
|
+
return typeof item !== "string" && item.to === PRICING_PATH;
|
|
2182
|
+
}
|
|
2196
2183
|
function hasPricingLink(items) {
|
|
2197
|
-
return items.some(
|
|
2184
|
+
return items.some(isPricingLink);
|
|
2198
2185
|
}
|
|
2199
2186
|
function withPricingNavigation(items) {
|
|
2200
2187
|
const current = items ?? [];
|
|
@@ -2205,11 +2192,26 @@ function withPricingNavigation(items) {
|
|
|
2205
2192
|
label: "Pricing"
|
|
2206
2193
|
}];
|
|
2207
2194
|
}
|
|
2195
|
+
/** Header nav uses `{ label, to }` (no `type`). Insert before Docs when present. */
|
|
2196
|
+
function withHeaderPricingNavigation(items) {
|
|
2197
|
+
const current = [...items ?? []];
|
|
2198
|
+
if (hasPricingLink(current)) return current;
|
|
2199
|
+
const pricingItem = {
|
|
2200
|
+
label: "Pricing",
|
|
2201
|
+
to: PRICING_PATH
|
|
2202
|
+
};
|
|
2203
|
+
const docsIndex = current.findIndex((item) => typeof item !== "string" && (item.to === "/introduction" || item.label === "Docs"));
|
|
2204
|
+
if (docsIndex >= 0) {
|
|
2205
|
+
current.splice(docsIndex, 0, pricingItem);
|
|
2206
|
+
return current;
|
|
2207
|
+
}
|
|
2208
|
+
return [...current, pricingItem];
|
|
2209
|
+
}
|
|
2208
2210
|
function withoutPricingNavigation(items) {
|
|
2209
2211
|
if (!items?.length) return [];
|
|
2210
2212
|
return items.map((item) => {
|
|
2211
2213
|
if (typeof item === "string") return item;
|
|
2212
|
-
if (item
|
|
2214
|
+
if (isPricingLink(item)) return null;
|
|
2213
2215
|
if (item.items?.length) {
|
|
2214
2216
|
const filteredItems = withoutPricingNavigation(item.items);
|
|
2215
2217
|
return {
|
|
@@ -2225,7 +2227,7 @@ function withoutPricingNavigation(items) {
|
|
|
2225
2227
|
//#region src/utils/header-navigation.ts
|
|
2226
2228
|
function buildDevPortalHeaderNavigation({ navigation, pricingEnabled, authNavEnabled }) {
|
|
2227
2229
|
let items = [...navigation ?? []];
|
|
2228
|
-
|
|
2230
|
+
items = pricingEnabled ? withHeaderPricingNavigation(items) : withoutPricingNavigation(items);
|
|
2229
2231
|
if (!authNavEnabled) items = withoutLoginNavigation(items);
|
|
2230
2232
|
return items;
|
|
2231
2233
|
}
|
|
@@ -2308,6 +2310,7 @@ const devPortalBillingPlugin = createPlugin((options = {}) => ({
|
|
|
2308
2310
|
}],
|
|
2309
2311
|
getProtectedRoutes: () => [
|
|
2310
2312
|
CHECKOUT_PATH,
|
|
2313
|
+
ACCOUNT_PLANS_PATH,
|
|
2311
2314
|
SUBSCRIPTIONS_PATH,
|
|
2312
2315
|
CREDENTIALS_PATH,
|
|
2313
2316
|
USAGE_PATH
|
|
@@ -2315,4 +2318,4 @@ const devPortalBillingPlugin = createPlugin((options = {}) => ({
|
|
|
2315
2318
|
}));
|
|
2316
2319
|
|
|
2317
2320
|
//#endregion
|
|
2318
|
-
export { API_KEY_CAP_REACHED, AccountPlansPage, ApiKeysPanel, CHECKOUT_PATH, CREDENTIALS_PATH, OverviewDashboardPage, PRICING_PATH, SUBSCRIPTIONS_PATH, USAGE_PATH, devPortalBillingPlugin, useApiKeys, useCreateApiKey, useRevokeApiKey };
|
|
2321
|
+
export { ACCOUNT_PLANS_PATH, API_KEY_CAP_REACHED, AccountPlansPage, ApiKeysPanel, CHECKOUT_PATH, CREDENTIALS_PATH, OverviewDashboardPage, PRICING_PATH, SUBSCRIPTIONS_PATH, USAGE_PATH, devPortalBillingPlugin, useApiKeys, useCreateApiKey, useRevokeApiKey };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lukoweb/apitogo-plugin-dev-portal-billing",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.91",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/zuplo/zudoku",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"react": "19.2.4",
|
|
47
47
|
"react-dom": "19.2.4",
|
|
48
48
|
"tsdown": "0.20.3",
|
|
49
|
-
"@lukoweb/apitogo": "0.1.
|
|
50
|
-
"@lukoweb/apitogo-module-user-panel": "0.1.
|
|
49
|
+
"@lukoweb/apitogo": "0.1.91",
|
|
50
|
+
"@lukoweb/apitogo-module-user-panel": "0.1.91"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"react": ">=19.2.0",
|