@redocly/theme 0.70.0-next.2 → 0.70.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 (82) hide show
  1. package/lib/components/CodeBlock/CodeBlockControls.js +3 -5
  2. package/lib/components/Consent/Consent.d.ts +2 -0
  3. package/lib/components/Consent/Consent.js +17 -0
  4. package/lib/components/Consent/ConsentBanner.d.ts +2 -0
  5. package/lib/components/Consent/ConsentBanner.js +120 -0
  6. package/lib/components/Consent/ConsentDialog.d.ts +2 -0
  7. package/lib/components/Consent/ConsentDialog.js +128 -0
  8. package/lib/components/Consent/ConsentSettingsLink.d.ts +2 -0
  9. package/lib/components/Consent/ConsentSettingsLink.js +35 -0
  10. package/lib/components/Consent/variables.d.ts +1 -0
  11. package/lib/components/Consent/variables.js +31 -0
  12. package/lib/components/Footer/Footer.js +4 -1
  13. package/lib/components/JsonViewer/Helpers.d.ts +10 -2
  14. package/lib/components/JsonViewer/Helpers.js +29 -33
  15. package/lib/components/JsonViewer/JsonViewer.js +15 -18
  16. package/lib/components/Markdown/styles/base-table.js +14 -1
  17. package/lib/components/Markdown/variables.js +1 -0
  18. package/lib/components/Product/utils.js +1 -1
  19. package/lib/components/Search/SearchAiMessage.js +1 -1
  20. package/lib/components/Search/SearchAiResponse.js +1 -0
  21. package/lib/core/constants/consent.d.ts +2 -0
  22. package/lib/core/constants/consent.js +30 -0
  23. package/lib/core/constants/index.d.ts +1 -0
  24. package/lib/core/constants/index.js +1 -0
  25. package/lib/core/hooks/index.d.ts +2 -0
  26. package/lib/core/hooks/index.js +2 -0
  27. package/lib/core/hooks/use-consent-dialog.d.ts +12 -0
  28. package/lib/core/hooks/use-consent-dialog.js +36 -0
  29. package/lib/core/hooks/use-consent-telemetry.d.ts +1 -0
  30. package/lib/core/hooks/use-consent-telemetry.js +42 -0
  31. package/lib/core/hooks/use-theme-hooks.js +14 -0
  32. package/lib/core/styles/global.js +42 -40
  33. package/lib/core/types/consent.d.ts +54 -0
  34. package/lib/core/types/consent.js +3 -0
  35. package/lib/core/types/hooks.d.ts +2 -0
  36. package/lib/core/types/index.d.ts +1 -0
  37. package/lib/core/types/l10n.d.ts +1 -1
  38. package/lib/core/utils/consent-settings-link-placement.d.ts +3 -0
  39. package/lib/core/utils/consent-settings-link-placement.js +15 -0
  40. package/lib/core/utils/index.d.ts +1 -0
  41. package/lib/core/utils/index.js +1 -0
  42. package/lib/core/utils/mcp.js +1 -1
  43. package/lib/core/utils/menu.js +6 -5
  44. package/lib/core/utils/urls.js +3 -1
  45. package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.d.ts +29 -0
  46. package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.js +81 -0
  47. package/lib/index.d.ts +1 -0
  48. package/lib/index.js +1 -0
  49. package/package.json +3 -3
  50. package/src/components/CodeBlock/CodeBlockControls.tsx +4 -7
  51. package/src/components/Consent/Consent.tsx +18 -0
  52. package/src/components/Consent/ConsentBanner.tsx +110 -0
  53. package/src/components/Consent/ConsentDialog.tsx +210 -0
  54. package/src/components/Consent/ConsentSettingsLink.tsx +44 -0
  55. package/src/components/Consent/variables.ts +28 -0
  56. package/src/components/Footer/Footer.tsx +2 -0
  57. package/src/components/JsonViewer/Helpers.tsx +46 -51
  58. package/src/components/JsonViewer/JsonViewer.tsx +23 -25
  59. package/src/components/Markdown/styles/base-table.ts +14 -1
  60. package/src/components/Markdown/variables.ts +1 -0
  61. package/src/components/Product/utils.ts +1 -1
  62. package/src/components/Search/SearchAiMessage.tsx +1 -1
  63. package/src/components/Search/SearchAiResponse.tsx +1 -0
  64. package/src/core/constants/consent.ts +29 -0
  65. package/src/core/constants/index.ts +1 -0
  66. package/src/core/hooks/__mocks__/use-theme-hooks.ts +15 -0
  67. package/src/core/hooks/index.ts +2 -0
  68. package/src/core/hooks/use-consent-dialog.ts +51 -0
  69. package/src/core/hooks/use-consent-telemetry.ts +56 -0
  70. package/src/core/hooks/use-theme-hooks.ts +14 -0
  71. package/src/core/styles/global.ts +2 -0
  72. package/src/core/types/consent.ts +51 -0
  73. package/src/core/types/hooks.ts +2 -0
  74. package/src/core/types/index.ts +1 -0
  75. package/src/core/types/l10n.ts +22 -1
  76. package/src/core/utils/consent-settings-link-placement.ts +18 -0
  77. package/src/core/utils/index.ts +1 -0
  78. package/src/core/utils/mcp.ts +1 -1
  79. package/src/core/utils/menu.ts +5 -6
  80. package/src/core/utils/urls.ts +3 -1
  81. package/src/icons/ExpandCollapseIcon/ExpandCollapseIcon.tsx +56 -0
  82. package/src/index.ts +1 -0
@@ -5,6 +5,6 @@ function getProductClassName(productName) {
5
5
  return `product-${productName
6
6
  .toLowerCase()
7
7
  .replace(/[^a-z0-9]+/g, '-')
8
- .replace(/^-+|-+$/g, '')}`;
8
+ .replace(/^-+|(?<!-)-+$/g, '')}`;
9
9
  }
10
10
  //# sourceMappingURL=utils.js.map
@@ -251,7 +251,7 @@ const ResourceTagsWrapper = styled_components_1.default.div `
251
251
  flex-wrap: wrap;
252
252
  gap: var(--search-ai-resource-tags-gap);
253
253
  `;
254
- const ResourceTag = (0, styled_components_1.default)(Tag_1.Tag) `
254
+ const ResourceTag = (0, styled_components_1.default)(Tag_1.Tag).attrs({ textTransform: 'none' }) `
255
255
  .tag-default {
256
256
  --tag-color: var(--search-ai-resource-tag-text-color);
257
257
  max-width: 100%;
@@ -141,6 +141,7 @@ const ResourceTags = styled_components_1.default.div `
141
141
  `;
142
142
  const ResourceTag = (0, styled_components_1.default)(Tag_1.Tag).attrs({
143
143
  className: 'tag-resource',
144
+ textTransform: 'none',
144
145
  }) `
145
146
  .tag-default {
146
147
  --tag-color: --search-ai-resource-tag-text-color;
@@ -0,0 +1,2 @@
1
+ import type { ConsentCategory } from '../types/consent';
2
+ export declare const CONSENT_CATEGORIES: readonly ConsentCategory[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONSENT_CATEGORIES = void 0;
4
+ exports.CONSENT_CATEGORIES = [
5
+ {
6
+ id: 'necessary',
7
+ locked: true,
8
+ titleTranslationKey: 'consent.category.necessary.title',
9
+ descriptionTranslationKey: 'consent.category.necessary.description',
10
+ titleDefault: 'Necessary',
11
+ descriptionDefault: 'Needed for the site to work: your consent choice, your color mode, and anonymous usage data.',
12
+ },
13
+ {
14
+ id: 'analytics',
15
+ locked: false,
16
+ titleTranslationKey: 'consent.category.analytics.title',
17
+ descriptionTranslationKey: 'consent.category.analytics.description',
18
+ titleDefault: 'Analytics',
19
+ descriptionDefault: 'Helps us understand which pages are useful.',
20
+ },
21
+ {
22
+ id: 'marketing',
23
+ locked: false,
24
+ titleTranslationKey: 'consent.category.marketing.title',
25
+ descriptionTranslationKey: 'consent.category.marketing.description',
26
+ titleDefault: 'Marketing',
27
+ descriptionDefault: 'Lets us measure which campaigns bring visitors to this site.',
28
+ },
29
+ ];
30
+ //# sourceMappingURL=consent.js.map
@@ -10,3 +10,4 @@ export * from './mcp';
10
10
  export * from './feedback';
11
11
  export * from './heading';
12
12
  export * from './markdown';
13
+ export * from './consent';
@@ -26,4 +26,5 @@ __exportStar(require("./mcp"), exports);
26
26
  __exportStar(require("./feedback"), exports);
27
27
  __exportStar(require("./heading"), exports);
28
28
  __exportStar(require("./markdown"), exports);
29
+ __exportStar(require("./consent"), exports);
29
30
  //# sourceMappingURL=index.js.map
@@ -22,6 +22,8 @@ export * from './menu/use-collapse';
22
22
  export * from './feedback/use-report-dialog';
23
23
  export * from './use-tabs';
24
24
  export * from './use-focus-trap';
25
+ export * from './use-consent-dialog';
26
+ export * from './use-consent-telemetry';
25
27
  export * from './use-language-picker';
26
28
  export * from './use-product-picker';
27
29
  export * from './search/use-search-dialog';
@@ -38,6 +38,8 @@ __exportStar(require("./menu/use-collapse"), exports);
38
38
  __exportStar(require("./feedback/use-report-dialog"), exports);
39
39
  __exportStar(require("./use-tabs"), exports);
40
40
  __exportStar(require("./use-focus-trap"), exports);
41
+ __exportStar(require("./use-consent-dialog"), exports);
42
+ __exportStar(require("./use-consent-telemetry"), exports);
41
43
  __exportStar(require("./use-language-picker"), exports);
42
44
  __exportStar(require("./use-product-picker"), exports);
43
45
  __exportStar(require("./search/use-search-dialog"), exports);
@@ -0,0 +1,12 @@
1
+ import type { RefObject } from 'react';
2
+ import type { ConsentCategory, ConsentCategoryId, UseConsentResult } from '../types/consent';
3
+ export type ConsentDraft = Record<Exclude<ConsentCategoryId, 'necessary'>, boolean>;
4
+ export type UseConsentDialogResult = {
5
+ draft: ConsentDraft;
6
+ setCategory: (id: keyof ConsentDraft, value: boolean) => void;
7
+ dialogRef: RefObject<HTMLDivElement | null>;
8
+ close: () => void;
9
+ save: () => void;
10
+ categories: readonly ConsentCategory[];
11
+ };
12
+ export declare function useConsentDialog(consent: UseConsentResult): UseConsentDialogResult;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useConsentDialog = useConsentDialog;
4
+ const react_1 = require("react");
5
+ const consent_1 = require("../constants/consent");
6
+ const use_focus_trap_1 = require("./use-focus-trap");
7
+ function useConsentDialog(consent) {
8
+ const [draft, setDraft] = (0, react_1.useState)(() => { var _a, _b; var _c, _d; return ({
9
+ analytics: (_c = (_a = consent.state) === null || _a === void 0 ? void 0 : _a.analytics) !== null && _c !== void 0 ? _c : consent.mode === 'opt-out',
10
+ marketing: ((_d = (_b = consent.state) === null || _b === void 0 ? void 0 : _b.marketing) !== null && _d !== void 0 ? _d : consent.mode === 'opt-out') && !consent.gpc,
11
+ }); });
12
+ const dialogRef = (0, react_1.useRef)(null);
13
+ const close = consent.closeDialog;
14
+ const closeRef = (0, react_1.useRef)(close);
15
+ closeRef.current = close;
16
+ (0, react_1.useEffect)(() => {
17
+ const previous = document.activeElement;
18
+ const onKeyDown = (event) => {
19
+ if (event.key === 'Escape')
20
+ closeRef.current();
21
+ };
22
+ document.addEventListener('keydown', onKeyDown);
23
+ return () => {
24
+ var _a;
25
+ document.removeEventListener('keydown', onKeyDown);
26
+ (_a = previous === null || previous === void 0 ? void 0 : previous.focus) === null || _a === void 0 ? void 0 : _a.call(previous);
27
+ };
28
+ }, []);
29
+ (0, use_focus_trap_1.useFocusTrap)(dialogRef);
30
+ const setCategory = (id, value) => {
31
+ setDraft((current) => (Object.assign(Object.assign({}, current), { [id]: value })));
32
+ };
33
+ const save = () => consent.save(draft);
34
+ return { draft, setCategory, dialogRef, close, save, categories: consent_1.CONSENT_CATEGORIES };
35
+ }
36
+ //# sourceMappingURL=use-consent-dialog.js.map
@@ -0,0 +1 @@
1
+ export declare function useConsentTelemetry(): void;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useConsentTelemetry = useConsentTelemetry;
4
+ const react_1 = require("react");
5
+ const use_theme_hooks_1 = require("./use-theme-hooks");
6
+ const get_base_data_attributes_1 = require("../utils/telemetry/get-base-data-attributes");
7
+ function isRealmOwned(runtime) {
8
+ return runtime.region.source !== 'provider';
9
+ }
10
+ function getConsentRuntime() {
11
+ var _a;
12
+ if (typeof window === 'undefined')
13
+ return undefined;
14
+ return (_a = window.redocly) === null || _a === void 0 ? void 0 : _a.consent;
15
+ }
16
+ // Sends one consent.changed event per visitor choice in the modes Realm owns.
17
+ function useConsentTelemetry() {
18
+ const { useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
19
+ const telemetry = useTelemetry();
20
+ const telemetryRef = (0, react_1.useRef)(telemetry);
21
+ telemetryRef.current = telemetry;
22
+ (0, react_1.useEffect)(() => {
23
+ const found = getConsentRuntime();
24
+ const runtime = found && isRealmOwned(found) ? found : null;
25
+ if (!runtime)
26
+ return;
27
+ return runtime.on('change', (state) => {
28
+ const choice = state.analytics && state.marketing
29
+ ? 'accept'
30
+ : !state.analytics && !state.marketing
31
+ ? 'reject'
32
+ : 'partial';
33
+ const { origin, pathname, search, hash } = window.location;
34
+ const uri = `${origin}${pathname}${search}${hash}`;
35
+ telemetryRef.current.sendConsentChangedMessage([
36
+ Object.assign(Object.assign({}, (0, get_base_data_attributes_1.getBaseDataAttributes)('consent', 'consent')), { choice, mode: runtime.mode, configuredMode: runtime.configuredMode, regionSource: runtime.region.source, gpc: runtime.gpc }),
37
+ (0, get_base_data_attributes_1.getBaseDataAttributes)(uri, 'page', uri),
38
+ ]);
39
+ });
40
+ }, []);
41
+ }
42
+ //# sourceMappingURL=use-consent-telemetry.js.map
@@ -17,6 +17,20 @@ const fallbacks = {
17
17
  useOtelTelemetry: () => ({ send: () => { } }),
18
18
  useBreadcrumbs: () => ({ breadcrumbs: [], siblings: undefined }),
19
19
  useBanner: () => ({ banner: undefined, dismissBanner: () => { } }),
20
+ useConsent: () => ({
21
+ enabled: false,
22
+ config: undefined,
23
+ mode: undefined,
24
+ state: undefined,
25
+ decided: false,
26
+ gpc: false,
27
+ isDialogOpen: false,
28
+ openDialog: () => { },
29
+ closeDialog: () => { },
30
+ accept: () => { },
31
+ reject: () => { },
32
+ save: () => { },
33
+ }),
20
34
  useCodeHighlight: () => ({ highlight: (rawContent) => rawContent }),
21
35
  useUserMenu: () => ({}),
22
36
  usePageData: () => null,
@@ -30,26 +30,27 @@ const variables_25 = require("../../components/CodeBlock/variables");
30
30
  const variables_26 = require("../../components/Product/variables");
31
31
  const variables_27 = require("../../components/Markdown/variables");
32
32
  const variables_28 = require("../../components/Banner/variables");
33
- const variables_29 = require("../../markdoc/components/Accordion/variables");
34
- const variables_30 = require("../../markdoc/components/Tabs/variables");
35
- const variables_31 = require("../../markdoc/components/NumberedList/variables");
36
- const variables_32 = require("../../markdoc/components/Diagram/variables");
37
- const variables_33 = require("../../components/LastUpdated/variables");
38
- const variables_34 = require("../../components/Logo/variables");
39
- const variables_35 = require("../../components/StatusCode/variables");
40
- const variables_36 = require("../../components/Segmented/variables");
41
- const variables_37 = require("../../components/UserMenu/variables");
42
- const variables_38 = require("../../components/Tags/variables");
43
- const variables_39 = require("../../components/VersionPicker/variables");
44
- const variables_40 = require("../../components/DatePicker/variables");
45
- const variables_41 = require("../../components/Switch/variables");
46
- const variables_42 = require("../../markdoc/components/Cards/variables");
47
- const variables_43 = require("../../markdoc/components/CodeWalkthrough/variables");
48
- const variables_44 = require("../../components/SkipContent/variables");
49
- const variables_45 = require("../../components/PageActions/variables");
50
- const variables_46 = require("../../components/SvgViewer/variables");
51
- const variables_47 = require("../../components/Toast/variables");
52
- const variables_48 = require("../../components/PageNavigation/variables");
33
+ const variables_29 = require("../../components/Consent/variables");
34
+ const variables_30 = require("../../markdoc/components/Accordion/variables");
35
+ const variables_31 = require("../../markdoc/components/Tabs/variables");
36
+ const variables_32 = require("../../markdoc/components/NumberedList/variables");
37
+ const variables_33 = require("../../markdoc/components/Diagram/variables");
38
+ const variables_34 = require("../../components/LastUpdated/variables");
39
+ const variables_35 = require("../../components/Logo/variables");
40
+ const variables_36 = require("../../components/StatusCode/variables");
41
+ const variables_37 = require("../../components/Segmented/variables");
42
+ const variables_38 = require("../../components/UserMenu/variables");
43
+ const variables_39 = require("../../components/Tags/variables");
44
+ const variables_40 = require("../../components/VersionPicker/variables");
45
+ const variables_41 = require("../../components/DatePicker/variables");
46
+ const variables_42 = require("../../components/Switch/variables");
47
+ const variables_43 = require("../../markdoc/components/Cards/variables");
48
+ const variables_44 = require("../../markdoc/components/CodeWalkthrough/variables");
49
+ const variables_45 = require("../../components/SkipContent/variables");
50
+ const variables_46 = require("../../components/PageActions/variables");
51
+ const variables_47 = require("../../components/SvgViewer/variables");
52
+ const variables_48 = require("../../components/Toast/variables");
53
+ const variables_49 = require("../../components/PageNavigation/variables");
53
54
  const palette_1 = require("./palette");
54
55
  const dark_1 = require("./dark");
55
56
  const themeColors = (0, styled_components_1.css) `
@@ -1313,33 +1314,34 @@ exports.styles = (0, styled_components_1.css) `
1313
1314
  ${badges}
1314
1315
  ${variables_28.banner}
1315
1316
  ${borders}
1317
+ ${variables_29.consent}
1316
1318
  ${variables_5.breadcrumbs}
1317
1319
  ${variables_20.button}
1318
1320
  ${variables_21.aiAssistantButton}
1319
- ${variables_42.cards}
1321
+ ${variables_43.cards}
1320
1322
  ${variables_8.catalog}
1321
1323
  ${variables_11.catalogClassic}
1322
1324
  ${variables_25.code}
1323
- ${variables_43.codeWalkthrough}
1325
+ ${variables_44.codeWalkthrough}
1324
1326
  ${docsDropdown}
1325
1327
  ${variables_15.dropdown}
1326
1328
  ${error}
1327
1329
  ${variables_10.filter}
1328
1330
  ${variables_19.footer}
1329
1331
  ${headingsTypography}
1330
- ${variables_38.httpTag}
1332
+ ${variables_39.httpTag}
1331
1333
  ${variables_9.image}
1332
1334
  ${inputs}
1333
1335
  ${variables_1.languagePicker}
1334
- ${variables_33.lastUpdated}
1336
+ ${variables_34.lastUpdated}
1335
1337
  ${links}
1336
1338
  ${loadProgressBar}
1337
- ${variables_34.logo}
1339
+ ${variables_35.logo}
1338
1340
  ${variables_27.markdown}
1339
- ${variables_29.markdownAccordion}
1340
- ${variables_30.markdownTabs}
1341
- ${variables_31.markdownNumberedList}
1342
- ${variables_32.diagram}
1341
+ ${variables_30.markdownAccordion}
1342
+ ${variables_31.markdownTabs}
1343
+ ${variables_32.markdownNumberedList}
1344
+ ${variables_33.diagram}
1343
1345
  ${variables_24.menu}
1344
1346
  ${variables_24.mobileMenu}
1345
1347
  ${modal}
@@ -1358,26 +1360,26 @@ exports.styles = (0, styled_components_1.css) `
1358
1360
  ${variables_7.toc}
1359
1361
  ${variables_16.tooltip}
1360
1362
  ${typography}
1361
- ${variables_37.userMenu}
1362
- ${variables_39.versionPicker}
1363
+ ${variables_38.userMenu}
1364
+ ${variables_40.versionPicker}
1363
1365
  ${zIndexDepth}
1364
1366
  ${scorecardColors}
1365
- ${variables_35.statusCode}
1367
+ ${variables_36.statusCode}
1366
1368
  ${tab}
1367
1369
  ${icon}
1368
1370
  ${tree}
1369
- ${variables_36.segmented}
1370
- ${variables_41.switcher}
1371
+ ${variables_37.segmented}
1372
+ ${variables_42.switcher}
1371
1373
  ${variables_17.checkbox}
1372
1374
  ${variables_3.feedback}
1373
1375
  ${variables_2.scorecard}
1374
- ${variables_40.datePicker}
1376
+ ${variables_41.datePicker}
1375
1377
  ${replay}
1376
- ${variables_44.skipContent}
1377
- ${variables_45.pageActions}
1378
- ${variables_46.svgViewer}
1379
- ${variables_47.toast}
1380
- ${variables_48.pageNavigation}
1378
+ ${variables_45.skipContent}
1379
+ ${variables_46.pageActions}
1380
+ ${variables_47.svgViewer}
1381
+ ${variables_48.toast}
1382
+ ${variables_49.pageNavigation}
1381
1383
 
1382
1384
  background-color: var(--bg-color);
1383
1385
  color: var(--text-color-primary);
@@ -0,0 +1,54 @@
1
+ import type { ConsentConfig } from '@redocly/config';
2
+ import type { TranslationKey } from './l10n';
3
+ export type ConsentCategoryId = 'necessary' | 'analytics' | 'marketing';
4
+ export type ConsentCategory = {
5
+ id: ConsentCategoryId;
6
+ locked: boolean;
7
+ titleTranslationKey: TranslationKey;
8
+ descriptionTranslationKey: TranslationKey;
9
+ titleDefault: string;
10
+ descriptionDefault: string;
11
+ };
12
+ export type ConsentState = {
13
+ necessary: true;
14
+ analytics: boolean;
15
+ marketing: boolean;
16
+ };
17
+ export type ConsentChoice = {
18
+ analytics?: boolean;
19
+ marketing?: boolean;
20
+ };
21
+ export type ConsentProvider = 'onetrust' | 'cookiebot' | 'trustarc' | 'tcf';
22
+ export type ConsentRuntime = {
23
+ configuredMode: 'auto' | 'opt-in' | 'opt-out' | ConsentProvider;
24
+ mode: 'opt-in' | 'opt-out' | ConsentProvider;
25
+ state: ConsentState;
26
+ decided: boolean;
27
+ gpc: boolean;
28
+ dialogOpen: boolean;
29
+ region: {
30
+ source: 'timezone' | 'config' | 'none' | 'provider';
31
+ timeZone: string | null;
32
+ };
33
+ accept: () => void;
34
+ reject: () => void;
35
+ save: (next: ConsentChoice) => void;
36
+ open: () => void;
37
+ close: () => void;
38
+ reload: () => void;
39
+ on: (event: 'change' | 'open' | 'close', fn: (state: ConsentState) => void) => () => void;
40
+ };
41
+ export type UseConsentResult = {
42
+ enabled: boolean;
43
+ config: ConsentConfig | undefined;
44
+ mode: ConsentRuntime['mode'] | undefined;
45
+ state: ConsentState | undefined;
46
+ decided: boolean;
47
+ gpc: boolean;
48
+ isDialogOpen: boolean;
49
+ openDialog: () => void;
50
+ closeDialog: () => void;
51
+ accept: () => void;
52
+ reject: () => void;
53
+ save: (next: ConsentChoice) => void;
54
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=consent.js.map
@@ -12,6 +12,7 @@ import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, A
12
12
  import type { SubmitFeedbackParams } from './feedback';
13
13
  import type { TFunction } from './l10n';
14
14
  import type { BreadcrumbItem } from './breadcrumb';
15
+ import type { UseConsentResult } from './consent';
15
16
  import type { AiSearchError } from '../constants/search';
16
17
  export type ThemeHooks = {
17
18
  useTranslate: () => {
@@ -64,6 +65,7 @@ export type ThemeHooks = {
64
65
  banner: ResolvedBannerConfig | undefined;
65
66
  dismissBanner: (content: string) => void;
66
67
  };
68
+ useConsent: () => UseConsentResult;
67
69
  useSearch: (product?: string, autoSearchDisabled?: boolean) => {
68
70
  query: string;
69
71
  setQuery: React.Dispatch<React.SetStateAction<string>>;
@@ -1,5 +1,6 @@
1
1
  export type * from './breadcrumb';
2
2
  export type * from './catalog';
3
+ export type * from './consent';
3
4
  export type * from './l10n';
4
5
  export type * from './mcp';
5
6
  export type * from './feedback';
@@ -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.create.app.dialog.callbackUrls' | 'dev.create.app.dialog.callbackUrls.placeholder' | 'dev.create.app.dialog.callbackUrls.hint' | 'dev.app.callbackUrls.title' | 'dev.edit.callbackUrls.dialog.title' | 'dev.edit.callbackUrls.dialog.placeholder' | 'dev.edit.callbackUrls.dialog.hint' | 'dev.edit.callbackUrls.dialog.save' | 'dev.edit.callbackUrls.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.error.title' | 'search.error.button' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.assistant' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.send' | '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.toolCall.executed' | 'search.ai.toolCall.executing' | 'search.ai.toolCall.withArgs' | '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.searchItem.enum' | 'search.searchItem.example' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | 'page.notFound.title' | 'page.notFound.description' | 'page.apiNotFound.title' | 'page.apiNotFound.description' | 'page.apiNotFound.hint' | 'page.apiNotFound.backButton' | 'page.mcpNotAllowed.title' | 'page.mcpNotAllowed.description' | 'page.mcpNotAllowed.publicNote' | 'page.mcpNotAllowed.publicEndpointHint' | 'page.mcpNotAllowed.mainEndpointHint' | 'page.mcpNotAllowed.snippets.terminal.hint' | 'page.mcpNotAllowed.snippets.claudeCode.headline' | 'page.mcpNotAllowed.snippets.claudeDesktop.headline' | 'page.mcpNotAllowed.snippets.claudeDesktop.instruction' | 'page.mcpNotAllowed.snippets.chatgptApp.headline' | 'page.mcpNotAllowed.snippets.chatgptApp.instruction' | 'page.mcpNotAllowed.snippets.codexCli.headline' | 'page.mcpNotAllowed.snippets.prompt.headline' | 'page.mcpNotAllowed.snippets.prompt.hint' | 'page.mcpNotAllowed.snippets.json.hint' | 'page.mcpNotAllowed.tabs.claude' | 'page.mcpNotAllowed.tabs.chatgpt' | 'page.mcpNotAllowed.tabs.json' | '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.notConnected' | '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.filters.close' | '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.maxLength' | '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' | 'jsonViewer.showMore' | 'jsonViewer.showLess' | '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.claudeCode' | 'page.actions.connectMcp.claudeCodeDescription' | 'page.actions.connectMcp.codex' | 'page.actions.connectMcp.codexDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'page.actions.connectMcp.moreOptions' | 'page.actions.moreActions' | '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' | 'graphql.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.languages.moreButton.tooltipText' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.schemas' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.querystring' | '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.property' | 'openapi.properties' | 'openapi.details' | '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.noRequestData' | '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' | 'openapi.mcp.exampleTitle' | 'openapi.mcp.argumentsExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'asyncapi.info.contact.url' | 'asyncapi.info.contact.name' | 'asyncapi.info.license' | 'asyncapi.info.termsOfService' | 'asyncapi.key' | 'asyncapi.value' | 'asyncapi.variables' | 'asyncapi.required' | 'asyncapi.requiredScopes' | 'asyncapi.viewSecurityDetails' | '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.actions.show' | 'graphql.actions.hide' | 'graphql.actions.more' | 'graphql.fields' | 'graphql.inputFields' | 'graphql.values' | '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.implementedBy' | 'graphql.nonNull' | 'graphql.required' | 'asyncapi.badges.deprecated' | 'graphql.badges.deprecated' | 'asyncapi.actions.show' | 'asyncapi.actions.hide' | 'asyncapi.actions.more' | 'asyncapi.payload' | 'asyncapi.parameters' | 'asyncapi.messages' | 'asyncapi.contentType' | 'asyncapi.moreDetails' | 'asyncapi.property' | 'asyncapi.properties' | 'asyncapi.details' | 'asyncapi.reply' | 'asyncapi.servers.title' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'button.download.tooltipText' | 'button.externalLink.tooltipText' | 'button.email.tooltipText' | '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' | 'diagram.openFullscreen' | 'diagram.zoomIn' | 'diagram.zoomOut' | 'diagram.reset' | 'diagram.close' | 'diagram.viewer';
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.create.app.dialog.callbackUrls' | 'dev.create.app.dialog.callbackUrls.placeholder' | 'dev.create.app.dialog.callbackUrls.hint' | 'dev.app.callbackUrls.title' | 'dev.edit.callbackUrls.dialog.title' | 'dev.edit.callbackUrls.dialog.placeholder' | 'dev.edit.callbackUrls.dialog.hint' | 'dev.edit.callbackUrls.dialog.save' | 'dev.edit.callbackUrls.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.error.title' | 'search.error.button' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.assistant' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.send' | '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.toolCall.executed' | 'search.ai.toolCall.executing' | 'search.ai.toolCall.withArgs' | '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.searchItem.enum' | 'search.searchItem.example' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | 'page.notFound.title' | 'page.notFound.description' | 'page.apiNotFound.title' | 'page.apiNotFound.description' | 'page.apiNotFound.hint' | 'page.apiNotFound.backButton' | 'page.mcpNotAllowed.title' | 'page.mcpNotAllowed.description' | 'page.mcpNotAllowed.publicNote' | 'page.mcpNotAllowed.publicEndpointHint' | 'page.mcpNotAllowed.mainEndpointHint' | 'page.mcpNotAllowed.snippets.terminal.hint' | 'page.mcpNotAllowed.snippets.claudeCode.headline' | 'page.mcpNotAllowed.snippets.claudeDesktop.headline' | 'page.mcpNotAllowed.snippets.claudeDesktop.instruction' | 'page.mcpNotAllowed.snippets.chatgptApp.headline' | 'page.mcpNotAllowed.snippets.chatgptApp.instruction' | 'page.mcpNotAllowed.snippets.codexCli.headline' | 'page.mcpNotAllowed.snippets.prompt.headline' | 'page.mcpNotAllowed.snippets.prompt.hint' | 'page.mcpNotAllowed.snippets.json.hint' | 'page.mcpNotAllowed.tabs.claude' | 'page.mcpNotAllowed.tabs.chatgpt' | 'page.mcpNotAllowed.tabs.json' | '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.notConnected' | '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.filters.close' | '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.maxLength' | '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' | 'jsonViewer.showMore' | 'jsonViewer.showLess' | '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.claudeCode' | 'page.actions.connectMcp.claudeCodeDescription' | 'page.actions.connectMcp.codex' | 'page.actions.connectMcp.codexDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'page.actions.connectMcp.moreOptions' | 'page.actions.moreActions' | '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' | 'graphql.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.languages.moreButton.tooltipText' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.schemas' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.querystring' | '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.property' | 'openapi.properties' | 'openapi.details' | '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.noRequestData' | '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' | 'openapi.mcp.exampleTitle' | 'openapi.mcp.argumentsExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'asyncapi.info.contact.url' | 'asyncapi.info.contact.name' | 'asyncapi.info.license' | 'asyncapi.info.termsOfService' | 'asyncapi.key' | 'asyncapi.value' | 'asyncapi.variables' | 'asyncapi.required' | 'asyncapi.requiredScopes' | 'asyncapi.viewSecurityDetails' | '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.actions.show' | 'graphql.actions.hide' | 'graphql.actions.more' | 'graphql.fields' | 'graphql.inputFields' | 'graphql.values' | '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.implementedBy' | 'graphql.nonNull' | 'graphql.required' | 'asyncapi.badges.deprecated' | 'graphql.badges.deprecated' | 'asyncapi.actions.show' | 'asyncapi.actions.hide' | 'asyncapi.actions.more' | 'asyncapi.payload' | 'asyncapi.parameters' | 'asyncapi.messages' | 'asyncapi.contentType' | 'asyncapi.moreDetails' | 'asyncapi.property' | 'asyncapi.properties' | 'asyncapi.details' | 'asyncapi.reply' | 'asyncapi.servers.title' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'button.download.tooltipText' | 'button.externalLink.tooltipText' | 'button.email.tooltipText' | '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' | 'diagram.openFullscreen' | 'diagram.zoomIn' | 'diagram.zoomOut' | 'diagram.reset' | 'diagram.close' | 'diagram.viewer' | 'consent.title' | 'consent.message' | 'consent.privacyPolicy' | 'consent.customize' | 'consent.rejectAll' | 'consent.acceptAll' | 'consent.acceptAllCookies' | 'consent.savePreferences' | 'consent.dialog.title' | 'consent.dialog.description' | 'consent.dialog.close' | 'consent.alwaysOn' | 'consent.alwaysOff' | 'consent.gpcNotice' | 'consent.category.necessary.title' | 'consent.category.necessary.description' | 'consent.category.analytics.title' | 'consent.category.analytics.description' | 'consent.category.marketing.title' | 'consent.category.marketing.description' | 'consent.settingsLink';
3
3
  export type Locale = {
4
4
  code: string;
5
5
  name: string;
@@ -0,0 +1,3 @@
1
+ import type { ConsentConfig, RedoclyConfig } from '@redocly/config';
2
+ export type SettingsLinkPlacement = 'footer' | 'none';
3
+ export declare function resolveSettingsLinkPlacement(consent: ConsentConfig | undefined, footer: RedoclyConfig['footer'] | undefined): SettingsLinkPlacement;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveSettingsLinkPlacement = resolveSettingsLinkPlacement;
4
+ function resolveSettingsLinkPlacement(consent, footer) {
5
+ var _a;
6
+ const choice = (_a = consent === null || consent === void 0 ? void 0 : consent.settingsLink) !== null && _a !== void 0 ? _a : 'auto';
7
+ if (choice !== 'auto') {
8
+ return choice;
9
+ }
10
+ const footerShown = Boolean(footer) &&
11
+ !(footer === null || footer === void 0 ? void 0 : footer.hide) &&
12
+ (Boolean(footer === null || footer === void 0 ? void 0 : footer.copyrightText) || (Array.isArray(footer === null || footer === void 0 ? void 0 : footer.items) && footer.items.length > 0));
13
+ return footerShown ? 'footer' : 'none';
14
+ }
15
+ //# sourceMappingURL=consent-settings-link-placement.js.map
@@ -49,3 +49,4 @@ export * from './tooltip-placement';
49
49
  export * from './telemetry/get-base-data-attributes';
50
50
  export * from './telemetry/generate-before-after-context';
51
51
  export * from './RenderWithLink';
52
+ export * from './consent-settings-link-placement';
@@ -65,4 +65,5 @@ __exportStar(require("./tooltip-placement"), exports);
65
65
  __exportStar(require("./telemetry/get-base-data-attributes"), exports);
66
66
  __exportStar(require("./telemetry/generate-before-after-context"), exports);
67
67
  __exportStar(require("./RenderWithLink"), exports);
68
+ __exportStar(require("./consent-settings-link-placement"), exports);
68
69
  //# sourceMappingURL=index.js.map
@@ -38,7 +38,7 @@ function slugifyMcpServerName(name) {
38
38
  return name
39
39
  .toLowerCase()
40
40
  .replace(/[^a-z0-9_-]+/g, '-')
41
- .replace(/^-+|-+$/g, '');
41
+ .replace(/^-+|(?<!-)-+$/g, '');
42
42
  }
43
43
  function generateClaudeCodeCommand(config) {
44
44
  return `claude mcp add --transport http ${slugifyMcpServerName(config.serverName)} ${config.url}`;
@@ -8,17 +8,18 @@ const TRANSLATION_KEYS = {
8
8
  version: 'mobileMenu.version',
9
9
  };
10
10
  const mapNavbarItems = (items, defaultLocale, currentLocale, locales, location) => {
11
- return items.map((navItem) => { var _a; return (Object.assign(Object.assign(Object.assign(Object.assign({}, navItem), (navItem.items && {
11
+ return items.map((navItem) => { var _a; return (Object.assign(Object.assign(Object.assign({}, navItem), (navItem.items && {
12
12
  items: (0, exports.mapNavbarItems)(navItem.items, defaultLocale, currentLocale, locales, location),
13
- })), ('link' in navItem && { link: navItem.link || '/' })), { active: 'link' in navItem &&
14
- (0, exports.isItemActive)(navItem, defaultLocale, currentLocale, locales, location), hasActiveSubItem: !!((_a = navItem.items) === null || _a === void 0 ? void 0 : _a.find((item) => (0, exports.isItemActive)(item, defaultLocale, currentLocale, locales, location))) })); });
13
+ })), { active: (0, exports.isItemActive)(navItem, defaultLocale, currentLocale, locales, location), hasActiveSubItem: !!((_a = navItem.items) === null || _a === void 0 ? void 0 : _a.find((item) => (0, exports.isItemActive)(item, defaultLocale, currentLocale, locales, location))) })); });
15
14
  };
16
15
  exports.mapNavbarItems = mapNavbarItems;
17
16
  const isItemActive = (item, defaultLocale, currentLocale, locales, location) => {
17
+ if (!item.link)
18
+ return false;
18
19
  const pathHash = location.pathname + location.hash;
19
20
  const link = item.languageInsensitive
20
- ? item.link || ''
21
- : (0, urls_1.getPathnameForLocale)(item.link || '/', defaultLocale, currentLocale, locales);
21
+ ? item.link
22
+ : (0, urls_1.getPathnameForLocale)(item.link, defaultLocale, currentLocale, locales);
22
23
  return pathHash === (0, urls_1.withPathPrefix)(link);
23
24
  };
24
25
  exports.isItemActive = isItemActive;
@@ -18,7 +18,9 @@ const common_1 = require("../constants/common");
18
18
  function combineUrls(baseURL, ...relativeURLs) {
19
19
  let res = baseURL;
20
20
  for (let relativeURL of relativeURLs) {
21
- res = relativeURL ? res.replace(/[/\\]+$/, '') + '/' + relativeURL.replace(/^[/\\]+/, '') : res;
21
+ res = relativeURL
22
+ ? res.replace(/(?<![/\\])[/\\]+$/, '') + '/' + relativeURL.replace(/^[/\\]+/, '')
23
+ : res;
22
24
  }
23
25
  return res;
24
26
  }