Files
webstudio/packages/sdk-components-react/src/webhook-form.template.tsx
T
Oleg Isonen dabaeede02 fix: Hide deprecated components in Builder (#6576)
The Components panel now hides deprecated components by default. The
default-off `deprecatedComponents` feature flag shows all nine
registered deprecated components in a separate **Deprecated** section,
including Webhook Form and RemixForm. Webhook Form keeps its saved
component ID, icon, behavior, navigator label, and `w-webhook-form` CSS
class. The command picker continues to hide deprecated components.

## Checklist
- [ ] Document each feature flag beside its declaration using its
current behavior.
- [x] Keep Webhook Form metadata and picker guidance pointing to Form.
- [x] Preserve the generated `w-webhook-form` class without custom
`presetClassName` metadata.
- [x] Hide deprecated components from the Components panel by default;
show all nine eligible components in a dedicated Deprecated section
behind the default-off `deprecatedComponents` flag.
- [x] Keep deprecated components out of the command picker.
- [x] Add focused tests for default and flagged visibility, section
membership, exclusions, and template insertion data.
- [x] Review documentation impact. Existing Webhook Form docs describe
its default unavailability; the flag is for development, so no docs
change is needed.
- [x] Verify focused tests, typechecks, lint, and fixture generation.
The fixture pipeline passed; its unrelated live fixture path drift was
restored.
- [x] Update the Components panel E2E filter assertion for the flagged
deprecated section and verify the rerun.
- [x] Verify required CI on the latest head.

Focused tests: component catalog 16/16, Builder 3/3. Builder,
project-build, and feature-flags typechecks passed. Lint and the full
fixture pipeline passed. The new section tests failed as expected with
section creation temporarily disabled and passed after restoration.
Latest-head CI: Main workflow, Visual regression, Lint PR, and Check
submodules all passed, including all six Builder E2E shards.

Ref #4093
2026-10-21 21:06:41 +02:00

89 lines
2.3 KiB
TypeScript

/** @jsxImportSource @webstudio-is/template */
import {
ActionValue,
css,
expression,
PlaceholderValue,
setInstanceMeta,
Variable,
type TemplateMeta,
} from "@webstudio-is/template";
import type { ReactNode } from "react";
import { WebhookForm } from "./components";
const formState = new Variable("formState", "initial");
/** @deprecated Use the Form component for new forms. */
export const meta: TemplateMeta = {
category: "data",
order: 1,
label: "Webhook Form (Deprecated)",
description:
"Deprecated. Existing Webhook Forms remain supported through the next release. Use the new Form component in the Forms section instead.",
template: (
<WebhookForm
state={expression`${formState}`}
onStateChange={
new ActionValue(["state"], expression`${formState} = state`)
}
>
{setInstanceMeta(
{ label: "Form content" },
<div
ws:show={expression`${formState} === 'initial' || ${formState} === 'error'`}
>
<label
ws:style={css`
display: block;
`}
>
{new PlaceholderValue("Name") as unknown as ReactNode}
</label>
<input
ws:style={css`
display: block;
`}
name="name"
/>
<label
ws:style={css`
display: block;
`}
>
{new PlaceholderValue("Email") as unknown as ReactNode}
</label>
<input
ws:style={css`
display: block;
`}
name="email"
/>
<button>
{new PlaceholderValue("Submit") as unknown as ReactNode}
</button>
</div>
)}
{setInstanceMeta(
{ label: "Success message" },
<div ws:show={expression`${formState} === 'success'`}>
{
new PlaceholderValue(
"Thank you for getting in touch!"
) as unknown as ReactNode
}
</div>
)}
{setInstanceMeta(
{ label: "Error message" },
<div ws:show={expression`${formState} === 'error'`}>
{
new PlaceholderValue(
"Sorry, something went wrong."
) as unknown as ReactNode
}
</div>
)}
</WebhookForm>
),
};