Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs-yml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,16 @@
}
]
},
"feedback": {
"oneOf": [
{
"$ref": "#/definitions/docs.FeedbackConfig"
},
{
"type": "null"
}
]
},
"settings": {
"oneOf": [
{
Expand Down Expand Up @@ -5956,6 +5966,35 @@
"grouped"
]
},
"docs.FeedbackConfig": {
"type": "object",
"properties": {
"hide-feedback": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"description": "If `hide-feedback` is set to true, the feedback widget will not be rendered.\nIf either this property or `layout.hide-feedback` is true, feedback is hidden.\n\n@default: false"
},
"require-email": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"description": "If `require-email` is set to true, the email field in the feedback form will be required.\nUsers can still click submit, but an inline validation error will appear if the email is empty.\n\n@default: false"
}
},
"additionalProperties": false,
"description": "Configuration for the feedback widget displayed on documentation pages."
},
"docs.DocsSettingsConfig": {
"type": "object",
"properties": {
Expand Down
20 changes: 20 additions & 0 deletions fern/apis/docs-yml/definition/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ types:
colors: optional<ColorsConfiguration>
typography: optional<DocsTypographyConfig>
layout: optional<LayoutConfig>
feedback: optional<FeedbackConfig>
settings: optional<DocsSettingsConfig>
theme: optional<ThemeConfig>

Expand Down Expand Up @@ -910,6 +911,25 @@ types:
docs: |
If `mobile-toc` is set to true, a sticky collapsible table of contents bar will be shown on mobile viewports for guide and overview layout pages.

FeedbackConfig:
docs: |
Configuration for the feedback widget displayed on documentation pages.
properties:
hide-feedback:
type: optional<boolean>
docs: |
If `hide-feedback` is set to true, the feedback widget will not be rendered.
If either this property or `layout.hide-feedback` is true, feedback is hidden.

@default: false
require-email:
type: optional<boolean>
docs: |
If `require-email` is set to true, the email field in the feedback form will be required.
Users can still click submit, but an inline validation error will appear if the email is empty.

@default: false

DocsSettingsConfig:
properties:
search-text:
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/cli/changes/unreleased/add-feedback-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- summary: |
Add support for `feedback` configuration object in `docs.yml` with `hide-feedback` and `require-email` properties.
type: feat
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export async function parseDocsConfiguration({
colors,
typography: rawTypography,
layout,
feedback,
/* integrations */
integrations,

Expand Down Expand Up @@ -258,6 +259,7 @@ export async function parseDocsConfiguration({
colors: convertColorsConfiguration(colors, context),
typography,
layout: convertLayoutConfig(layout, tabsObj?.alignment, tabsObj?.placement),
feedback: convertFeedbackConfig(feedback),
settings: convertSettingsConfig(rawDocsConfiguration.settings),
context7File,
llmsTxtFile,
Expand Down Expand Up @@ -630,6 +632,19 @@ function convertLayoutConfig(
} as unknown as docsYml.ParsedDocsConfiguration["layout"];
}

function convertFeedbackConfig(
feedback: docsYml.RawSchemas.FeedbackConfig | undefined
): docsYml.ParsedDocsConfiguration["feedback"] {
if (feedback == null) {
return undefined;
}

return {
hideFeedback: feedback.hideFeedback ?? false,
requireEmail: feedback.requireEmail ?? false
};
}

function parseSizeConfig(sizeAsString: string | undefined): CjsFdrSdk.docs.v1.commons.SizeConfig | undefined {
if (sizeAsString == null) {
return undefined;
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/configuration/src/docs-yml/DocsYmlSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ export const LayoutConfig = z.object({
"mobile-toc": z.boolean().optional()
});

// ===== Feedback =====

export const FeedbackConfig = z.object({
"hide-feedback": z.boolean().optional(),
"require-email": z.boolean().optional()
});

// ===== Settings =====

export const DocsSettingsConfig = z.object({
Expand Down Expand Up @@ -1010,6 +1017,7 @@ export const DocsConfiguration = z.object({
colors: ColorsConfiguration.optional(),
typography: DocsTypographyConfig.optional(),
layout: LayoutConfig.optional(),
feedback: FeedbackConfig.optional(),
settings: DocsSettingsConfig.optional(),
theme: ThemeConfig.optional(),
"global-theme": z.string().optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export interface ParsedPageActionsConfig {
};
}

export interface ParsedFeedbackConfig {
hideFeedback: boolean;
requireEmail: boolean;
}

// TODO(kafkas): Remove this when we upgrade the fdr-sdk to latest
interface ParsedDocsSettingsConfig extends Omit<CjsFdrSdk.docs.v1.commons.DocsSettingsConfig, "language"> {
language: string | undefined;
Expand Down Expand Up @@ -83,6 +88,7 @@ export interface ParsedDocsConfiguration {
colors: CjsFdrSdk.docs.v1.write.ColorsConfigV3 | undefined;
typography: TypographyConfig | undefined;
layout: CjsFdrSdk.docs.v1.commons.DocsLayoutConfig | undefined;
feedback: ParsedFeedbackConfig | undefined;
settings: ParsedDocsSettingsConfig | undefined;
context7File: AbsoluteFilePath | undefined;
llmsTxtFile: AbsoluteFilePath | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface DocsConfiguration {
colors?: FernDocsConfig.ColorsConfiguration;
typography?: FernDocsConfig.DocsTypographyConfig;
layout?: FernDocsConfig.LayoutConfig;
feedback?: FernDocsConfig.FeedbackConfig;
settings?: FernDocsConfig.DocsSettingsConfig;
theme?: FernDocsConfig.ThemeConfig;
integrations?: FernDocsConfig.IntegrationsConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This file was auto-generated by Fern from our API Definition.

export interface FeedbackConfig {
/**
* If `hide-feedback` is set to true, the feedback widget will not be rendered.
* If either this property or `layout.hide-feedback` is true, feedback is hidden.
*
* @default: false
*/
hideFeedback?: boolean;
/**
* If `require-email` is set to true, the email field in the feedback form will be required.
* Users can still click submit, but an inline validation error will appear if the email is empty.
*
* @default: false
*/
requireEmail?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export * from "./EditThisPageConfig.js";
export * from "./EditThisPageLaunch.js";
export * from "./ExperimentalConfig.js";
export * from "./ExternalProduct.js";
export * from "./FeedbackConfig.js";
export * from "./FeatureFlag.js";
export * from "./FeatureFlagConfiguration.js";
export * from "./FolderConfiguration.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { CssConfig } from "./CssConfig.js";
import { DocsInstance } from "./DocsInstance.js";
import { DocsSettingsConfig } from "./DocsSettingsConfig.js";
import { DocsTypographyConfig } from "./DocsTypographyConfig.js";
import { FeedbackConfig } from "./FeedbackConfig.js";
import { ExperimentalConfig } from "./ExperimentalConfig.js";
import { FooterLinksConfig } from "./FooterLinksConfig.js";
import { IntegrationsConfig } from "./IntegrationsConfig.js";
Expand Down Expand Up @@ -74,6 +75,7 @@ export const DocsConfiguration: core.serialization.ObjectSchema<
colors: ColorsConfiguration.optional(),
typography: DocsTypographyConfig.optional(),
layout: LayoutConfig.optional(),
feedback: FeedbackConfig.optional(),
settings: DocsSettingsConfig.optional(),
theme: ThemeConfig.optional(),
integrations: IntegrationsConfig.optional(),
Expand Down Expand Up @@ -117,6 +119,7 @@ export declare namespace DocsConfiguration {
colors?: ColorsConfiguration.Raw | null;
typography?: DocsTypographyConfig.Raw | null;
layout?: LayoutConfig.Raw | null;
feedback?: FeedbackConfig.Raw | null;
settings?: DocsSettingsConfig.Raw | null;
theme?: ThemeConfig.Raw | null;
integrations?: IntegrationsConfig.Raw | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This file was auto-generated by Fern from our API Definition.

import type * as FernDocsConfig from "../../../../api/index.js";
import * as core from "../../../../core/index.js";
import type * as serializers from "../../../index.js";

export const FeedbackConfig: core.serialization.ObjectSchema<
serializers.FeedbackConfig.Raw,
FernDocsConfig.FeedbackConfig
> = core.serialization.object({
hideFeedback: core.serialization.property("hide-feedback", core.serialization.boolean().optional()),
requireEmail: core.serialization.property("require-email", core.serialization.boolean().optional()),
});

export declare namespace FeedbackConfig {
export interface Raw {
"hide-feedback"?: boolean | null;
"require-email"?: boolean | null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export * from "./EditThisPageConfig.js";
export * from "./EditThisPageLaunch.js";
export * from "./ExperimentalConfig.js";
export * from "./ExternalProduct.js";
export * from "./FeedbackConfig.js";
export * from "./FeatureFlag.js";
export * from "./FeatureFlagConfiguration.js";
export * from "./FolderConfiguration.js";
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/docs-resolver/src/DocsDefinitionResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,13 @@ export class DocsDefinitionResolver {
}),
typographyV2: this.convertDocsTypographyConfiguration(),
layout: this.parsedDocsConfig.layout,
feedback:
this.parsedDocsConfig.feedback != null
? {
hideFeedback: this.parsedDocsConfig.feedback.hideFeedback,
requireEmail: this.parsedDocsConfig.feedback.requireEmail
}
: undefined,
settings: this.parsedDocsConfig.settings,
css: this.parsedDocsConfig.css,
js: this.convertJavascriptConfiguration(),
Expand Down
Loading