@redocly/theme 0.61.0-next.1 → 0.61.0-next.3

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 (97) hide show
  1. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +5 -0
  2. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +9 -0
  3. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.d.ts +6 -0
  4. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +144 -0
  5. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.d.ts +8 -0
  6. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +161 -0
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.d.ts +8 -0
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.js +67 -0
  9. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.d.ts +9 -0
  10. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +212 -0
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +2 -25
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +12 -1
  13. package/lib/components/Catalog/CatalogEntity/ShowMoreButton.d.ts +8 -0
  14. package/lib/components/Catalog/CatalogEntity/ShowMoreButton.js +35 -0
  15. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +2 -0
  16. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +4 -1
  17. package/lib/components/Catalog/variables.js +112 -0
  18. package/lib/components/ColorModeSwitcher/ColorModeIcon.d.ts +2 -1
  19. package/lib/components/ColorModeSwitcher/ColorModeIcon.js +3 -2
  20. package/lib/components/ColorModeSwitcher/ColorModeSwitcher.js +1 -4
  21. package/lib/components/Menu/variables.js +1 -0
  22. package/lib/components/Product/utils.d.ts +1 -0
  23. package/lib/components/Product/utils.js +10 -0
  24. package/lib/components/Tooltip/Tooltip.js +2 -0
  25. package/lib/core/constants/catalog.d.ts +1 -0
  26. package/lib/core/constants/catalog.js +2 -1
  27. package/lib/core/constants/common.d.ts +4 -0
  28. package/lib/core/constants/common.js +5 -1
  29. package/lib/core/hooks/catalog/use-catalog-entity-details.d.ts +3 -1
  30. package/lib/core/hooks/catalog/use-catalog-entity-details.js +12 -5
  31. package/lib/core/hooks/index.d.ts +1 -0
  32. package/lib/core/hooks/index.js +1 -0
  33. package/lib/core/hooks/search/use-recent-searches.js +14 -41
  34. package/lib/core/hooks/use-color-switcher.d.ts +0 -1
  35. package/lib/core/hooks/use-color-switcher.js +19 -13
  36. package/lib/core/hooks/use-page-actions.js +37 -6
  37. package/lib/core/hooks/use-product-picker.js +12 -2
  38. package/lib/core/hooks/use-store.d.ts +17 -0
  39. package/lib/core/hooks/use-store.js +64 -0
  40. package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
  41. package/lib/core/hooks/use-telemetry-fallback.js +2 -0
  42. package/lib/core/types/catalog.d.ts +33 -4
  43. package/lib/core/types/common.d.ts +2 -0
  44. package/lib/core/types/hooks.d.ts +14 -3
  45. package/lib/core/types/l10n.d.ts +1 -1
  46. package/lib/core/utils/build-revision-url.d.ts +1 -0
  47. package/lib/core/utils/build-revision-url.js +15 -0
  48. package/lib/core/utils/date.d.ts +14 -0
  49. package/lib/core/utils/date.js +39 -0
  50. package/lib/core/utils/index.d.ts +2 -0
  51. package/lib/core/utils/index.js +2 -0
  52. package/lib/core/utils/load-and-navigate.js +7 -2
  53. package/lib/core/utils/transform-revisions-to-version-history.d.ts +8 -0
  54. package/lib/core/utils/transform-revisions-to-version-history.js +110 -0
  55. package/lib/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.d.ts +9 -0
  56. package/lib/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.js +26 -0
  57. package/lib/index.d.ts +2 -0
  58. package/lib/index.js +2 -0
  59. package/package.json +5 -5
  60. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +7 -1
  61. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +12 -0
  62. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +147 -0
  63. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +180 -0
  64. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.tsx +93 -0
  65. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +284 -0
  66. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +3 -25
  67. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +15 -2
  68. package/src/components/Catalog/CatalogEntity/ShowMoreButton.tsx +47 -0
  69. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +6 -1
  70. package/src/components/Catalog/variables.ts +112 -0
  71. package/src/components/ColorModeSwitcher/ColorModeIcon.tsx +5 -3
  72. package/src/components/ColorModeSwitcher/ColorModeSwitcher.tsx +2 -7
  73. package/src/components/Menu/variables.ts +1 -0
  74. package/src/components/Product/utils.ts +6 -0
  75. package/src/components/Tooltip/Tooltip.tsx +2 -0
  76. package/src/core/constants/catalog.ts +2 -0
  77. package/src/core/constants/common.ts +5 -0
  78. package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
  79. package/src/core/hooks/catalog/use-catalog-entity-details.ts +22 -6
  80. package/src/core/hooks/index.ts +1 -0
  81. package/src/core/hooks/search/use-recent-searches.ts +38 -65
  82. package/src/core/hooks/use-color-switcher.ts +29 -15
  83. package/src/core/hooks/use-page-actions.ts +63 -6
  84. package/src/core/hooks/use-product-picker.ts +12 -0
  85. package/src/core/hooks/use-store.ts +95 -0
  86. package/src/core/hooks/use-telemetry-fallback.ts +2 -0
  87. package/src/core/types/catalog.ts +38 -10
  88. package/src/core/types/common.ts +4 -0
  89. package/src/core/types/hooks.ts +23 -4
  90. package/src/core/types/l10n.ts +10 -0
  91. package/src/core/utils/build-revision-url.ts +16 -0
  92. package/src/core/utils/date.ts +33 -0
  93. package/src/core/utils/index.ts +2 -0
  94. package/src/core/utils/load-and-navigate.ts +6 -1
  95. package/src/core/utils/transform-revisions-to-version-history.ts +163 -0
  96. package/src/icons/NavaidMilitaryIcon/NavaidMilitaryIcon.tsx +43 -0
  97. package/src/index.ts +2 -0
@@ -23,6 +23,13 @@ const use_mcp_config_1 = require("./use-mcp-config");
23
23
  const clipboard_service_1 = require("../utils/clipboard-service");
24
24
  const dom_1 = require("../utils/dom");
25
25
  const mcp_1 = require("../utils/mcp");
26
+ function createPageActionResource(pageSlug, pageUrl) {
27
+ return {
28
+ id: pageSlug,
29
+ object: 'page',
30
+ uri: pageUrl,
31
+ };
32
+ }
26
33
  const DEFAULT_ENABLED_ACTIONS = [
27
34
  'copy',
28
35
  'view',
@@ -33,10 +40,11 @@ const DEFAULT_ENABLED_ACTIONS = [
33
40
  ];
34
41
  function usePageActions(pageSlug, mcpUrl, actions) {
35
42
  var _a, _b, _c;
36
- const { useTranslate, usePageData, usePageProps, usePageSharedData } = (0, use_theme_hooks_1.useThemeHooks)();
43
+ const { useTranslate, usePageData, usePageProps, usePageSharedData, useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
37
44
  const { translate } = useTranslate();
38
45
  const themeConfig = (0, use_theme_config_1.useThemeConfig)();
39
46
  const pageProps = usePageProps();
47
+ const telemetry = useTelemetry();
40
48
  const openApiSharedData = usePageSharedData('openAPIDocsStore');
41
49
  const mcpConfig = (0, use_mcp_config_1.useMCPConfig)();
42
50
  const shouldHideAllActions = shouldHidePageActions(pageProps, themeConfig, (_a = openApiSharedData === null || openApiSharedData === void 0 ? void 0 : openApiSharedData.options) === null || _a === void 0 ? void 0 : _a.excludeFromSearch);
@@ -49,8 +57,18 @@ function usePageActions(pageSlug, mcpUrl, actions) {
49
57
  const config = requiresMcpUrl
50
58
  ? { serverName: mcpConfig.serverName, url: mcpUrl || '' }
51
59
  : { serverName: mcpConfig.serverName, url: mcpConfig.serverUrl || '' };
52
- return createMCPAction({ clientType, mcpConfig: config, translate });
53
- }, [mcpUrl, mcpConfig, translate]);
60
+ const isDocsMcp = !requiresMcpUrl;
61
+ const origin = dom_1.IS_BROWSER ? window.location.origin : '';
62
+ const pageUrl = `${origin}${pageSlug}`;
63
+ return createMCPAction({
64
+ clientType,
65
+ mcpConfig: config,
66
+ translate,
67
+ onClickCallback: isDocsMcp
68
+ ? () => telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: `docs-mcp-${clientType}` }))
69
+ : undefined,
70
+ });
71
+ }, [mcpUrl, mcpConfig, translate, telemetry, pageSlug]);
54
72
  const result = (0, react_1.useMemo)(() => {
55
73
  var _a, _b, _c;
56
74
  if (shouldHideAllActions) {
@@ -60,10 +78,11 @@ function usePageActions(pageSlug, mcpUrl, actions) {
60
78
  ? window.location.origin
61
79
  : ((_a = globalThis['SSR_HOSTNAME']) !== null && _a !== void 0 ? _a : '');
62
80
  const normalizedSlug = pageSlug.startsWith('/') ? pageSlug : '/' + pageSlug;
81
+ const pageUrl = `${origin}${normalizedSlug}`;
63
82
  const mdPageUrl = new URL(origin + normalizedSlug + (normalizedSlug === '/' ? 'index.html.md' : '.md')).toString();
64
83
  const actionHandlers = {
65
- 'docs-mcp-cursor': createMCPHandler('cursor'),
66
- 'docs-mcp-vscode': createMCPHandler('vscode'),
84
+ 'docs-mcp-cursor': createMCPHandler('cursor', false),
85
+ 'docs-mcp-vscode': createMCPHandler('vscode', false),
67
86
  'mcp-cursor': createMCPHandler('cursor', true),
68
87
  'mcp-vscode': createMCPHandler('vscode', true),
69
88
  copy: () => ({
@@ -79,6 +98,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
79
98
  }
80
99
  const text = yield result.text();
81
100
  clipboard_service_1.ClipboardService.copyCustom(text);
101
+ telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'copy' }));
82
102
  }
83
103
  catch (error) {
84
104
  console.error(error);
@@ -91,6 +111,9 @@ function usePageActions(pageSlug, mcpUrl, actions) {
91
111
  description: translate('page.actions.viewAsMdDescription', 'Open this page as Markdown'),
92
112
  iconComponent: MarkdownFullIcon_1.MarkdownFullIcon,
93
113
  link: mdPageUrl,
114
+ onClick: () => {
115
+ telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'view' }));
116
+ },
94
117
  }),
95
118
  chatgpt: () => {
96
119
  if (!isPublic) {
@@ -102,6 +125,9 @@ function usePageActions(pageSlug, mcpUrl, actions) {
102
125
  description: translate('page.actions.chatGptDescription', 'Get insights from ChatGPT'),
103
126
  iconComponent: ChatGptIcon_1.ChatGptIcon,
104
127
  link: getExternalAiPromptLink('https://chat.openai.com', mdPageUrl),
128
+ onClick: () => {
129
+ telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'chatgpt' }));
130
+ },
105
131
  };
106
132
  },
107
133
  claude: () => {
@@ -114,6 +140,9 @@ function usePageActions(pageSlug, mcpUrl, actions) {
114
140
  description: translate('page.actions.claudeDescription', 'Get insights from Claude'),
115
141
  iconComponent: ClaudeIcon_1.ClaudeIcon,
116
142
  link: getExternalAiPromptLink('https://claude.ai/new', mdPageUrl),
143
+ onClick: () => {
144
+ telemetry.sendPageActionsButtonClickedMessage(Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'claude' }));
145
+ },
117
146
  };
118
147
  },
119
148
  };
@@ -128,6 +157,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
128
157
  translate,
129
158
  isPublic,
130
159
  createMCPHandler,
160
+ telemetry,
131
161
  ]);
132
162
  return result;
133
163
  }
@@ -137,10 +167,11 @@ function getExternalAiPromptLink(baseUrl, mdPageUrl) {
137
167
  url.searchParams.set('q', externalAiPrompt);
138
168
  return url.toString();
139
169
  }
140
- function createMCPAction({ clientType, mcpConfig, translate }) {
170
+ function createMCPAction({ clientType, mcpConfig, translate, onClickCallback, }) {
141
171
  const url = (0, mcp_1.generateMCPDeepLink)(clientType, mcpConfig);
142
172
  const sharedProps = {
143
173
  onClick: () => {
174
+ onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
144
175
  window.open(url, '_blank');
145
176
  },
146
177
  };
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useProductPicker = useProductPicker;
4
4
  const react_router_dom_1 = require("react-router-dom");
5
+ const utils_1 = require("../../components/Product/utils");
5
6
  const use_theme_hooks_1 = require("./use-theme-hooks");
6
- const utils_1 = require("../utils");
7
+ const utils_2 = require("../utils");
7
8
  function useProductPicker() {
8
9
  const { useCurrentProduct, useProducts, useTelemetry, useLoadAndNavigate } = (0, use_theme_hooks_1.useThemeHooks)();
9
10
  const currentProduct = useCurrentProduct();
@@ -15,7 +16,16 @@ function useProductPicker() {
15
16
  if (!product)
16
17
  return;
17
18
  telemetry.sendProductPickedMessage({ product: product.slug });
18
- loadAndNavigate({ navigate, to: (0, utils_1.withPathPrefix)(product.link) });
19
+ if (typeof document === 'undefined')
20
+ return;
21
+ if (product.name) {
22
+ const root = document.documentElement;
23
+ Array.from(root.classList)
24
+ .filter((c) => c.startsWith('product-'))
25
+ .forEach((c) => root.classList.remove(c));
26
+ root.classList.add((0, utils_1.getProductClassName)(product.name));
27
+ }
28
+ loadAndNavigate({ navigate, to: (0, utils_2.withPathPrefix)(product.link) });
19
29
  }
20
30
  return {
21
31
  currentProduct,
@@ -0,0 +1,17 @@
1
+ type Store<T> = {
2
+ getValue: (defaultValue: T) => T;
3
+ setValue: (next: T) => void;
4
+ subscribe: (callback: () => void) => Unsubscribe;
5
+ };
6
+ type Unsubscribe = () => void;
7
+ type CreateStoreProps<T> = {
8
+ storageKey: string;
9
+ storageType?: 'localStorage' | 'sessionStorage';
10
+ serializer?: {
11
+ parse: (value: string) => T;
12
+ serialize: (value: T) => string;
13
+ };
14
+ };
15
+ export declare function createStore<T>({ storageKey, storageType, serializer, }: CreateStoreProps<T>): Store<T>;
16
+ export declare function useStore<T>(store: Store<T>, defaultValue: T): readonly [T, (next: T) => void];
17
+ export {};
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createStore = createStore;
4
+ exports.useStore = useStore;
5
+ const react_1 = require("react");
6
+ const js_utils_1 = require("../utils/js-utils");
7
+ function createStore({ storageKey, storageType = 'localStorage', serializer = {
8
+ parse: (value) => JSON.parse(value),
9
+ serialize: (value) => JSON.stringify(value),
10
+ }, }) {
11
+ const subscribers = new Set();
12
+ let cachedValue;
13
+ const shouldSerialize = (value) => typeof value !== 'string';
14
+ const getValue = (defaultValue) => {
15
+ if (!(0, js_utils_1.isBrowser)())
16
+ return defaultValue;
17
+ if (cachedValue !== undefined)
18
+ return cachedValue;
19
+ const value = window[storageType].getItem(storageKey);
20
+ if (!value) {
21
+ cachedValue = defaultValue;
22
+ return cachedValue;
23
+ }
24
+ if (!shouldSerialize(defaultValue)) {
25
+ cachedValue = value;
26
+ return cachedValue;
27
+ }
28
+ try {
29
+ cachedValue = JSON.parse(value);
30
+ }
31
+ catch (_a) {
32
+ cachedValue = defaultValue;
33
+ }
34
+ return cachedValue;
35
+ };
36
+ const setValue = (next) => {
37
+ if (!(0, js_utils_1.isBrowser)())
38
+ return;
39
+ try {
40
+ window[storageType].setItem(storageKey, shouldSerialize(next) ? serializer.serialize(next) : next);
41
+ cachedValue = next;
42
+ subscribers.forEach((callback) => callback());
43
+ }
44
+ catch (_a) {
45
+ return;
46
+ }
47
+ };
48
+ const subscribe = (callback) => {
49
+ subscribers.add(callback);
50
+ return () => {
51
+ subscribers.delete(callback);
52
+ };
53
+ };
54
+ return {
55
+ getValue,
56
+ setValue,
57
+ subscribe,
58
+ };
59
+ }
60
+ function useStore(store, defaultValue) {
61
+ const value = (0, react_1.useSyncExternalStore)(store.subscribe, () => store.getValue(defaultValue), () => defaultValue);
62
+ return [value, store.setValue];
63
+ }
64
+ //# sourceMappingURL=use-store.js.map
@@ -1,6 +1,7 @@
1
1
  export declare const useTelemetryFallback: () => {
2
2
  send: () => void;
3
3
  sendPageViewedMessage: () => void;
4
+ sendPageActionsButtonClickedMessage: () => void;
4
5
  sendErrorMessage: () => void;
5
6
  sendClientErrorMessage: () => void;
6
7
  sendBreadcrumbClickedMessage: () => void;
@@ -61,6 +62,7 @@ export declare const useTelemetryFallback: () => {
61
62
  sendAsyncapiDocsMessageClickedMessage: () => void;
62
63
  sendAsyncapiDocsServerModalOpenedMessage: () => void;
63
64
  sendAsyncapiDocsDownloadDefinitionClickedMessage: () => void;
65
+ sendAsyncapiDocsReferencedInClickedMessage: () => void;
64
66
  sendGraphqlDocsViewedMessage: () => void;
65
67
  sendGraphqlDocsPerformanceMetricsMessage: () => void;
66
68
  sendGraphqlDocsReferencedInLinkClickedMessage: () => void;
@@ -6,6 +6,7 @@ exports.useTelemetryFallback = void 0;
6
6
  const useTelemetryFallback = () => ({
7
7
  send: () => { },
8
8
  sendPageViewedMessage: () => { },
9
+ sendPageActionsButtonClickedMessage: () => { },
9
10
  sendErrorMessage: () => { },
10
11
  sendClientErrorMessage: () => { },
11
12
  sendBreadcrumbClickedMessage: () => { },
@@ -66,6 +67,7 @@ const useTelemetryFallback = () => ({
66
67
  sendAsyncapiDocsMessageClickedMessage: () => { },
67
68
  sendAsyncapiDocsServerModalOpenedMessage: () => { },
68
69
  sendAsyncapiDocsDownloadDefinitionClickedMessage: () => { },
70
+ sendAsyncapiDocsReferencedInClickedMessage: () => { },
69
71
  sendGraphqlDocsViewedMessage: () => { },
70
72
  sendGraphqlDocsPerformanceMetricsMessage: () => { },
71
73
  sendGraphqlDocsReferencedInLinkClickedMessage: () => { },
@@ -33,10 +33,6 @@ export type UseCatalogResponse = {
33
33
  layout: LayoutVariant;
34
34
  collapsedSidebar: boolean;
35
35
  };
36
- export type UseCatalogFetchCatalogEntities = (params: CatalogApiParams, initialData?: BffCatalogEntityList) => CatalogApiResults<BffCatalogEntity>;
37
- export type UseCatalogFetchCatalogEntitiesRelations = (params: CatalogApiParams & {
38
- entityKey: string;
39
- }, initialData?: BffCatalogRelatedEntityList) => CatalogApiResults<BffCatalogRelatedEntity>;
40
36
  export type UseCatalogSortResponse = {
41
37
  sortOption: SortOption | null;
42
38
  setSortOption: (option: SortOption | null) => void;
@@ -109,6 +105,7 @@ export type CatalogApiParams = {
109
105
  filter?: string;
110
106
  sort?: string;
111
107
  search?: string;
108
+ entityVersion?: string | null;
112
109
  };
113
110
  export type UseCatalogEntitiesProps = {
114
111
  entitiesTypes: string[];
@@ -136,6 +133,7 @@ export type BffCatalogRelatedEntity = {
136
133
  sourceFile?: string | null;
137
134
  metadata?: Record<string, any>;
138
135
  version?: string | null;
136
+ revision?: string | null;
139
137
  readonly createdAt: string | null;
140
138
  readonly updatedAt: string | null;
141
139
  };
@@ -171,6 +169,7 @@ export type BffCatalogEntity = {
171
169
  readonly revision: string;
172
170
  readonly isCurrent?: boolean | null;
173
171
  readonly isDefaultVersion?: boolean | null;
172
+ readonly isDeleted?: boolean | null;
174
173
  readonly createdAt: string;
175
174
  readonly updatedAt: string;
176
175
  };
@@ -189,5 +188,35 @@ export type Page = {
189
188
  limit: number;
190
189
  total: number;
191
190
  };
191
+ export type BffCatalogEntityRevision = {
192
+ readonly version: string | null;
193
+ readonly revision: string | null;
194
+ readonly isCurrent: boolean | null;
195
+ readonly isDefaultVersion: boolean | null;
196
+ readonly createdAt: string | null;
197
+ readonly updatedAt: string | null;
198
+ };
199
+ export type BffCatalogEntityRevisionList = BffCatalogList<BffCatalogEntityRevision>;
192
200
  export type EntityRelationType = (typeof ENTITY_RELATION_TYPES)[number];
193
201
  export type ListType = 'default' | 'team' | 'api-operation' | 'data-schema';
202
+ export type CatalogEntityRevision = {
203
+ name: string;
204
+ date: string;
205
+ revisionDate: string | null;
206
+ isActive?: boolean;
207
+ isCurrent?: boolean;
208
+ };
209
+ export type CatalogEntityVersionHistoryGroup = {
210
+ version: string;
211
+ date: string;
212
+ isCurrent?: boolean;
213
+ isExpanded?: boolean;
214
+ revisions?: CatalogEntityRevision[];
215
+ singleRevisionDate?: string | null;
216
+ hasCurrentRevisionFromBackend?: boolean;
217
+ isDefaultVersion?: boolean;
218
+ };
219
+ export type SidebarConnectedEntity = {
220
+ key: string;
221
+ version?: string;
222
+ };
@@ -1 +1,3 @@
1
+ import { DEFAULT_COLOR_MODES } from '../constants';
1
2
  export type Plural<T extends string> = `${T}s`;
3
+ export type ColorMode = (typeof DEFAULT_COLOR_MODES)[keyof typeof DEFAULT_COLOR_MODES];
@@ -3,8 +3,9 @@ import type { BannerConfig, PageData, PageProps, ResolvedNavItemWithLink, Versio
3
3
  import type { ShikiTransformer } from '@shikijs/types';
4
4
  import type { Callback, TFunction as TFunc } from 'i18next';
5
5
  import type { To, Location, NavigateFunction } from 'react-router-dom';
6
+ import type { UseQueryResult } from '@tanstack/react-query';
6
7
  import type { CatalogConfig, ProductUiConfig } from '../../config';
7
- import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps, UseCatalogFetchCatalogEntities, UseCatalogFetchCatalogEntitiesRelations } from './catalog';
8
+ import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps, CatalogApiParams, CatalogApiResults } from './catalog';
8
9
  import type { UserMenuData } from './user-menu';
9
10
  import type { ItemState } from './sidebar';
10
11
  import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem } from './search';
@@ -12,6 +13,7 @@ import type { SubmitFeedbackParams } from './feedback';
12
13
  import type { TFunction } from './l10n';
13
14
  import type { BreadcrumbItem } from './breadcrumb';
14
15
  import type { DrilldownMenuItemDetails } from './sidebar';
16
+ import { BffCatalogEntity, BffCatalogEntityList, BffCatalogRelatedEntity, BffCatalogRelatedEntityList, BffCatalogEntityRevision, BffCatalogEntityRevisionList } from './catalog';
15
17
  import { AiSearchError } from '../constants/search';
16
18
  export type ThemeHooks = {
17
19
  useTranslate: () => {
@@ -124,8 +126,17 @@ export type ThemeHooks = {
124
126
  useCatalog: (props?: UseCatalogProps) => UseCatalogResponse;
125
127
  useCatalogSort: () => UseCatalogSortResponse;
126
128
  useCatalogSearch: () => UseCatalogSearchResponse;
127
- useFetchCatalogEntities: UseCatalogFetchCatalogEntities;
128
- useFetchCatalogEntitiesRelations: UseCatalogFetchCatalogEntitiesRelations;
129
+ useFetchCatalogEntities: (params: CatalogApiParams, initialData?: BffCatalogEntityList) => CatalogApiResults<BffCatalogEntity>;
130
+ useFetchCatalogEntitiesRelations: (params: CatalogApiParams & {
131
+ entityKey: string;
132
+ }, initialData?: BffCatalogRelatedEntityList) => CatalogApiResults<BffCatalogRelatedEntity>;
133
+ useFetchCatalogEntityRevisions: (params: {
134
+ entityKey: string;
135
+ version?: string | null;
136
+ }) => {
137
+ query: UseQueryResult<BffCatalogEntityRevisionList, Error>;
138
+ items: BffCatalogEntityRevision[];
139
+ };
129
140
  useCatalogClassic: (config: CatalogConfig) => FilteredCatalog;
130
141
  useTelemetry: () => Omit<AsyncApiRealmUI.Telemetry, 'init' | 'updateCloudEventData' | 'forceFlush' | 'startSpan' | 'constructCloudEvent' | 'sendToOtelService'>;
131
142
  useUserTeams: () => string[];
@@ -1,5 +1,5 @@
1
1
  import type { TOptions } from 'i18next';
2
- export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to';
2
+ export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to';
3
3
  export type Locale = {
4
4
  code: string;
5
5
  name: string;
@@ -0,0 +1 @@
1
+ export declare function buildRevisionUrl(basePath: string, revisionDate: string | null | undefined, version?: string | null): string | undefined;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildRevisionUrl = buildRevisionUrl;
4
+ function buildRevisionUrl(basePath, revisionDate, version) {
5
+ if (!revisionDate) {
6
+ return undefined;
7
+ }
8
+ const params = new URLSearchParams();
9
+ params.set('revision', revisionDate);
10
+ if (version) {
11
+ params.set('version', version);
12
+ }
13
+ return `${basePath}?${params.toString()}`;
14
+ }
15
+ //# sourceMappingURL=build-revision-url.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Formats a date string to localized short date format (e.g., "Dec 12, 2025")
3
+ * @param dateString - ISO date string or null
4
+ * @param locale - Locale string (e.g., "en-US")
5
+ * @returns Formatted date string or empty string if dateString is null
6
+ */
7
+ export declare function toLocalizedShortDate(dateString: string | null, locale: string): string;
8
+ /**
9
+ * Formats a date string to localized short date-time format (e.g., "Dec 12, 3:45 PM")
10
+ * @param dateString - ISO date string or null
11
+ * @param locale - Locale string (e.g., "en-US")
12
+ * @returns Formatted date-time string or empty string if dateString is null
13
+ */
14
+ export declare function toLocalizedShortDateTime(dateString: string | null, locale: string): string;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toLocalizedShortDate = toLocalizedShortDate;
4
+ exports.toLocalizedShortDateTime = toLocalizedShortDateTime;
5
+ /**
6
+ * Formats a date string to localized short date format (e.g., "Dec 12, 2025")
7
+ * @param dateString - ISO date string or null
8
+ * @param locale - Locale string (e.g., "en-US")
9
+ * @returns Formatted date string or empty string if dateString is null
10
+ */
11
+ function toLocalizedShortDate(dateString, locale) {
12
+ if (!dateString)
13
+ return '';
14
+ const date = new Date(dateString);
15
+ return date.toLocaleDateString(locale, {
16
+ month: 'short',
17
+ day: 'numeric',
18
+ year: 'numeric',
19
+ });
20
+ }
21
+ /**
22
+ * Formats a date string to localized short date-time format (e.g., "Dec 12, 3:45 PM")
23
+ * @param dateString - ISO date string or null
24
+ * @param locale - Locale string (e.g., "en-US")
25
+ * @returns Formatted date-time string or empty string if dateString is null
26
+ */
27
+ function toLocalizedShortDateTime(dateString, locale) {
28
+ if (!dateString)
29
+ return '';
30
+ const date = new Date(dateString);
31
+ return date.toLocaleString(locale, {
32
+ month: 'short',
33
+ day: 'numeric',
34
+ hour: 'numeric',
35
+ minute: '2-digit',
36
+ hour12: true,
37
+ });
38
+ }
39
+ //# sourceMappingURL=date.js.map
@@ -41,3 +41,5 @@ export * from './Dynamic';
41
41
  export * from './tabs';
42
42
  export * from './get-operation-color';
43
43
  export * from './frontmatter-translate';
44
+ export * from './transform-revisions-to-version-history';
45
+ export * from './build-revision-url';
@@ -57,4 +57,6 @@ __exportStar(require("./Dynamic"), exports);
57
57
  __exportStar(require("./tabs"), exports);
58
58
  __exportStar(require("./get-operation-color"), exports);
59
59
  __exportStar(require("./frontmatter-translate"), exports);
60
+ __exportStar(require("./transform-revisions-to-version-history"), exports);
61
+ __exportStar(require("./build-revision-url"), exports);
60
62
  //# sourceMappingURL=index.js.map
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.loadAndNavigate = loadAndNavigate;
13
+ const get_navbar_element_1 = require("./get-navbar-element");
13
14
  const with_load_progress_1 = require("./with-load-progress");
14
15
  let lastNavigatedPath;
15
16
  // this is copy from portal/src/client/app/utils/loadAndNavigate.ts, for case when we need to run Redoc without Realm
16
17
  function loadAndNavigate(_a) {
17
18
  return __awaiter(this, arguments, void 0, function* ({ navigate, to, origin = 'browser', options, }) {
18
- var _b;
19
+ var _b, _c;
19
20
  lastNavigatedPath = to;
20
21
  const { pathname, hash, search } = new URL(to, window.location.origin + window.location.pathname);
21
22
  // use window-shared loader instead of importing to prevent circular import issue
@@ -38,7 +39,11 @@ function loadAndNavigate(_a) {
38
39
  if (hash) {
39
40
  const el = document.getElementById(hash.slice(1));
40
41
  if (el) {
41
- el.scrollIntoView();
42
+ const navbar = (0, get_navbar_element_1.getNavbarElement)();
43
+ const navbarHeight = (_c = navbar === null || navbar === void 0 ? void 0 : navbar.offsetHeight) !== null && _c !== void 0 ? _c : 0;
44
+ const elementTop = el.getBoundingClientRect().top + window.scrollY;
45
+ const scrollPosition = elementTop - navbarHeight;
46
+ window.scrollTo({ top: scrollPosition, behavior: 'smooth' });
42
47
  }
43
48
  }
44
49
  else {
@@ -0,0 +1,8 @@
1
+ import type { BffCatalogEntityRevision, CatalogEntityVersionHistoryGroup } from '../../core/types';
2
+ export type TransformRevisionsToVersionHistoryParams = {
3
+ revisions: BffCatalogEntityRevision[];
4
+ currentRevisionDate?: string;
5
+ currentVersion?: string | null;
6
+ locale?: string;
7
+ };
8
+ export declare function transformRevisionsToVersionHistory({ revisions, currentRevisionDate, currentVersion, locale, }: TransformRevisionsToVersionHistoryParams): CatalogEntityVersionHistoryGroup[];