@lukoweb/apitogo-plugin-dev-portal-billing 0.1.89 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.mjs +21 -3
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -2193,8 +2193,11 @@ function withoutLoginNavigation(items) {
2193
2193
 
2194
2194
  //#endregion
2195
2195
  //#region src/utils/navigation-plans.ts
2196
+ function isPricingLink(item) {
2197
+ return typeof item !== "string" && item.to === PRICING_PATH;
2198
+ }
2196
2199
  function hasPricingLink(items) {
2197
- return items.some((item) => typeof item !== "string" && item.type === "link" && item.to === PRICING_PATH);
2200
+ return items.some(isPricingLink);
2198
2201
  }
2199
2202
  function withPricingNavigation(items) {
2200
2203
  const current = items ?? [];
@@ -2205,11 +2208,26 @@ function withPricingNavigation(items) {
2205
2208
  label: "Pricing"
2206
2209
  }];
2207
2210
  }
2211
+ /** Header nav uses `{ label, to }` (no `type`). Insert before Docs when present. */
2212
+ function withHeaderPricingNavigation(items) {
2213
+ const current = [...items ?? []];
2214
+ if (hasPricingLink(current)) return current;
2215
+ const pricingItem = {
2216
+ label: "Pricing",
2217
+ to: PRICING_PATH
2218
+ };
2219
+ const docsIndex = current.findIndex((item) => typeof item !== "string" && (item.to === "/introduction" || item.label === "Docs"));
2220
+ if (docsIndex >= 0) {
2221
+ current.splice(docsIndex, 0, pricingItem);
2222
+ return current;
2223
+ }
2224
+ return [...current, pricingItem];
2225
+ }
2208
2226
  function withoutPricingNavigation(items) {
2209
2227
  if (!items?.length) return [];
2210
2228
  return items.map((item) => {
2211
2229
  if (typeof item === "string") return item;
2212
- if (item.type === "link" && item.to === PRICING_PATH) return null;
2230
+ if (isPricingLink(item)) return null;
2213
2231
  if (item.items?.length) {
2214
2232
  const filteredItems = withoutPricingNavigation(item.items);
2215
2233
  return {
@@ -2225,7 +2243,7 @@ function withoutPricingNavigation(items) {
2225
2243
  //#region src/utils/header-navigation.ts
2226
2244
  function buildDevPortalHeaderNavigation({ navigation, pricingEnabled, authNavEnabled }) {
2227
2245
  let items = [...navigation ?? []];
2228
- if (!pricingEnabled) items = withoutPricingNavigation(items);
2246
+ items = pricingEnabled ? withHeaderPricingNavigation(items) : withoutPricingNavigation(items);
2229
2247
  if (!authNavEnabled) items = withoutLoginNavigation(items);
2230
2248
  return items;
2231
2249
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo-plugin-dev-portal-billing",
3
- "version": "0.1.89",
3
+ "version": "0.1.90",
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.89",
50
- "@lukoweb/apitogo-module-user-panel": "0.1.89"
49
+ "@lukoweb/apitogo": "0.1.90",
50
+ "@lukoweb/apitogo-module-user-panel": "0.1.90"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "react": ">=19.2.0",