Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

1.4 KB
Raw Blame
/** Identifies a managed ResourceForm without accepting destinations from the visitor. */
export const managedFormIdFieldName = `ws--managed-form-id`;
/** Query marker lets the server apply managed-only parsing limits before parsing. */
export const managedFormRequestParamName = `ws--managed-form-request`;
/** Resource route prefix for JSON Form submissions on dynamic sites. */
export const managedFormEndpointPrefix = "/__ws-form";
/** Names whose submitted values are lists, including empty checkbox groups. */
export const managedFormArrayNamesFieldName = `ws--managed-form-array-names`;
/** Bot field shared by deprecated Webhook Form and managed Form; keep for Form. */
export const formBotFieldName = `ws--form-bot`;

/**
 * Detects if the browser is Brave for both deprecated Webhook Form and managed Form.
 * Brave Shields blocks our bot protection mechanism (matchMedia fingerprinting detection),
 * causing form submissions to silently fail.
 * @see https://github.com/brave/brave-browser/issues/46541
 */
export const isBraveBrowser = (): boolean => {
  if (typeof navigator === "undefined") {
    return false;
  }
  // @ts-expect-error - brave is a non-standard property
  return navigator.brave?.isBrave?.() === true || navigator.brave !== undefined;
};

/** @deprecated Identifies deprecated Webhook Form submissions. Use managedFormIdFieldName for new Forms. */
export const formIdFieldName = `ws--form-id`;