@lukoweb/apitogo-plugin-dev-portal-billing 0.1.90 → 0.1.92
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 +4 -2
- package/dist/index.mjs +10 -24
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -23,7 +23,8 @@ type DevPortalBillingConfig = {
|
|
|
23
23
|
subtitle?: string;
|
|
24
24
|
compareRows?: DevPortalPricingCompareRow[];
|
|
25
25
|
faqs?: DevPortalPricingFaq[];
|
|
26
|
-
}; /**
|
|
26
|
+
}; /** Live gateway URL (publish bake or explicit plugin option). */
|
|
27
|
+
gatewayBaseUrl?: string | null; /** Local preview plan catalog (from `apitogo.config.json` `plans`). */
|
|
27
28
|
previewPlans?: Array<{
|
|
28
29
|
sku: string;
|
|
29
30
|
displayName: string;
|
|
@@ -75,6 +76,7 @@ declare const ApiKeysPanel: ({
|
|
|
75
76
|
//#endregion
|
|
76
77
|
//#region src/paths.d.ts
|
|
77
78
|
declare const PRICING_PATH = "/pricing";
|
|
79
|
+
declare const ACCOUNT_PLANS_PATH = "/account/plans";
|
|
78
80
|
declare const CHECKOUT_PATH = "/checkout";
|
|
79
81
|
declare const SUBSCRIPTIONS_PATH = "/account/subscriptions";
|
|
80
82
|
declare const CREDENTIALS_PATH = "/account/credentials";
|
|
@@ -201,4 +203,4 @@ declare function useCreateApiKey(): _tanstack_react_query0.UseMutationResult<Dev
|
|
|
201
203
|
}, unknown>;
|
|
202
204
|
declare function useRevokeApiKey(): _tanstack_react_query0.UseMutationResult<void, Error, string, unknown>;
|
|
203
205
|
//#endregion
|
|
204
|
-
export { API_KEY_CAP_REACHED, AccountPlansPage, ApiKeysPanel, CHECKOUT_PATH, CREDENTIALS_PATH, OverviewDashboardPage, PRICING_PATH, SUBSCRIPTIONS_PATH, USAGE_PATH, devPortalBillingPlugin, useApiKeys, useCreateApiKey, useRevokeApiKey };
|
|
206
|
+
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") ?? "";
|
|
@@ -1429,7 +1421,8 @@ const CredentialsPage = () => {
|
|
|
1429
1421
|
const isDemoSession = useIsDemoSession();
|
|
1430
1422
|
const { data: credentials, isLoading, error } = useCredentials();
|
|
1431
1423
|
const { data: apiKeys, isLoading: keysLoading, error: keysError } = useApiKeys();
|
|
1432
|
-
const
|
|
1424
|
+
const { gatewayBaseUrl: configuredGatewayBaseUrl } = useDevPortalBillingConfig();
|
|
1425
|
+
const gatewayBaseUrl = credentials?.gatewayBaseUrl?.trim() || apiKeys?.gatewayBaseUrl?.trim() || configuredGatewayBaseUrl?.trim() || zudokuConfig.__meta?.gatewayBaseUrl?.trim() || null;
|
|
1433
1426
|
const header = apiKeys?.header ?? "Ocp-Apim-Subscription-Key";
|
|
1434
1427
|
const plans = apiKeys?.plans ?? [];
|
|
1435
1428
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -1472,7 +1465,7 @@ const CredentialsPage = () => {
|
|
|
1472
1465
|
className: "mt-4",
|
|
1473
1466
|
asChild: true,
|
|
1474
1467
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1475
|
-
to:
|
|
1468
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1476
1469
|
children: "View plans"
|
|
1477
1470
|
})
|
|
1478
1471
|
})]
|
|
@@ -1490,7 +1483,7 @@ const CredentialsPage = () => {
|
|
|
1490
1483
|
className: "mt-4",
|
|
1491
1484
|
asChild: true,
|
|
1492
1485
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1493
|
-
to:
|
|
1486
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1494
1487
|
children: "View plans"
|
|
1495
1488
|
})
|
|
1496
1489
|
})]
|
|
@@ -1506,7 +1499,7 @@ const CredentialsPage = () => {
|
|
|
1506
1499
|
className: "mt-4",
|
|
1507
1500
|
asChild: true,
|
|
1508
1501
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1509
|
-
to:
|
|
1502
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1510
1503
|
children: "View plans"
|
|
1511
1504
|
})
|
|
1512
1505
|
})]
|
|
@@ -1630,23 +1623,16 @@ const DEFAULT_FAQS = [{
|
|
|
1630
1623
|
}];
|
|
1631
1624
|
const PricingPage = () => {
|
|
1632
1625
|
const { pricing, previewPlans } = useDevPortalBillingConfig();
|
|
1633
|
-
const auth = useAuth();
|
|
1634
1626
|
const isPreview = useDevPortalPreviewMode();
|
|
1635
1627
|
const pricingEnabled = isPreviewPricingEnabled() || isPreview;
|
|
1636
1628
|
const livePlans = usePlans();
|
|
1637
1629
|
const catalog = isPreview ? parseManifestPlans(previewPlans) : livePlans.data;
|
|
1638
1630
|
const isLoading = isPreview ? false : livePlans.isLoading;
|
|
1639
1631
|
const isError = isPreview ? false : livePlans.isError;
|
|
1640
|
-
const { data: me } = useMySubscriptions();
|
|
1641
1632
|
if (!pricingEnabled) return /* @__PURE__ */ jsx(Navigate, {
|
|
1642
1633
|
to: "/",
|
|
1643
1634
|
replace: true
|
|
1644
1635
|
});
|
|
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
1636
|
const title = pricing?.title ?? "Pay for what you call";
|
|
1651
1637
|
const subtitle = pricing?.subtitle ?? "Every plan includes the full endpoint catalog. Higher tiers raise your request quota, rate limit, and support level.";
|
|
1652
1638
|
const plans = catalog?.plans ?? [];
|
|
@@ -1702,7 +1688,6 @@ const PricingPage = () => {
|
|
|
1702
1688
|
children: plans.map((plan) => /* @__PURE__ */ jsx(PricingCard, {
|
|
1703
1689
|
plan,
|
|
1704
1690
|
mode: "public",
|
|
1705
|
-
isSubscribed: activeSkus.has(plan.sku),
|
|
1706
1691
|
featured: plan.sku === featuredSku
|
|
1707
1692
|
}, plan.sku))
|
|
1708
1693
|
}) : !isLoading && !isError ? /* @__PURE__ */ jsxs("div", {
|
|
@@ -1904,7 +1889,7 @@ const SubscriptionsPage = () => {
|
|
|
1904
1889
|
className: "mt-4",
|
|
1905
1890
|
asChild: true,
|
|
1906
1891
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1907
|
-
to:
|
|
1892
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1908
1893
|
children: "View plans"
|
|
1909
1894
|
})
|
|
1910
1895
|
})]
|
|
@@ -1943,7 +1928,7 @@ const SubscriptionsPage = () => {
|
|
|
1943
1928
|
variant: "outline",
|
|
1944
1929
|
asChild: true,
|
|
1945
1930
|
children: /* @__PURE__ */ jsx(Link$1, {
|
|
1946
|
-
to:
|
|
1931
|
+
to: ACCOUNT_PLANS_PATH,
|
|
1947
1932
|
children: "Change plan"
|
|
1948
1933
|
})
|
|
1949
1934
|
}),
|
|
@@ -2326,6 +2311,7 @@ const devPortalBillingPlugin = createPlugin((options = {}) => ({
|
|
|
2326
2311
|
}],
|
|
2327
2312
|
getProtectedRoutes: () => [
|
|
2328
2313
|
CHECKOUT_PATH,
|
|
2314
|
+
ACCOUNT_PLANS_PATH,
|
|
2329
2315
|
SUBSCRIPTIONS_PATH,
|
|
2330
2316
|
CREDENTIALS_PATH,
|
|
2331
2317
|
USAGE_PATH
|
|
@@ -2333,4 +2319,4 @@ const devPortalBillingPlugin = createPlugin((options = {}) => ({
|
|
|
2333
2319
|
}));
|
|
2334
2320
|
|
|
2335
2321
|
//#endregion
|
|
2336
|
-
export { API_KEY_CAP_REACHED, AccountPlansPage, ApiKeysPanel, CHECKOUT_PATH, CREDENTIALS_PATH, OverviewDashboardPage, PRICING_PATH, SUBSCRIPTIONS_PATH, USAGE_PATH, devPortalBillingPlugin, useApiKeys, useCreateApiKey, useRevokeApiKey };
|
|
2322
|
+
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.92",
|
|
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.92",
|
|
50
|
+
"@lukoweb/apitogo-module-user-panel": "0.1.92"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"react": ">=19.2.0",
|