diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 529d56c259..de7b68f9f0 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -1815,6 +1815,7 @@ "open_dialog_with_element_click": "Open your Cal dialog when someone clicks an element.", "need_help_embedding": "Need help? See our guides for embedding Cal on Wix, Squarespace, or WordPress, check our common questions, or explore advanced embed options.", "book_my_cal": "Book my Cal", + "form_updated_successfully":"Form updated successfully.", "email_not_cal_member_cta": "Join your team", "disable_attendees_confirmation_emails": "Disable default confirmation emails for attendees", "disable_attendees_confirmation_emails_description": "At least one workflow is active on this event type that sends an email to the attendees when the event is booked.", diff --git a/packages/app-store/routing-forms/components/FormActions.tsx b/packages/app-store/routing-forms/components/FormActions.tsx index 256139a305..483e31014f 100644 --- a/packages/app-store/routing-forms/components/FormActions.tsx +++ b/packages/app-store/routing-forms/components/FormActions.tsx @@ -276,6 +276,9 @@ export function FormActionsProvider({ appUrl, children }: { appUrl: string; chil } return { previousValue }; }, + onSuccess: () => { + showToast(t("form_updated_successfully"), "success"); + }, onSettled: (routingForm) => { utils.viewer.appRoutingForms.forms.invalidate(); if (routingForm) { @@ -463,7 +466,7 @@ export const FormAction = forwardRef(function FormAction + {children} ); diff --git a/packages/app-store/routing-forms/components/FormInputFields.tsx b/packages/app-store/routing-forms/components/FormInputFields.tsx index ea37718d72..12d00188b7 100644 --- a/packages/app-store/routing-forms/components/FormInputFields.tsx +++ b/packages/app-store/routing-forms/components/FormInputFields.tsx @@ -1,6 +1,7 @@ import type { App_RoutingForms_Form } from "@prisma/client"; import type { Dispatch, SetStateAction } from "react"; +import getFieldIdentifier from "../lib/getFieldIdentifier"; import { getQueryBuilderConfig } from "../lib/getQueryBuilderConfig"; import isRouterLinkedField from "../lib/isRouterLinkedField"; import type { SerializableForm, Response } from "../types/types"; @@ -52,7 +53,7 @@ export default function FormInputFields(props: Props) { /* @ts-ignore */ required={!!field.required} listValues={options} - data-testid="form-field" + data-testid={`form-field-${getFieldIdentifier(field)}`} setValue={(value) => { setResponse((response) => { response = response || {}; diff --git a/packages/app-store/routing-forms/components/SingleForm.tsx b/packages/app-store/routing-forms/components/SingleForm.tsx index dd11ae07c4..8c1fba94e7 100644 --- a/packages/app-store/routing-forms/components/SingleForm.tsx +++ b/packages/app-store/routing-forms/components/SingleForm.tsx @@ -251,7 +251,7 @@ function SingleForm({ form, appUrl, Page }: SingleFormComponentProps) { const mutation = trpc.viewer.appRoutingForms.formMutation.useMutation({ onSuccess() { - showToast("Form updated successfully.", "success"); + showToast(t("form_updated_successfully"), "success"); }, onError(e) { if (e.message) { diff --git a/packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx b/packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx index 8fec40249a..edfd451df4 100644 --- a/packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx +++ b/packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx @@ -157,7 +157,7 @@ const MultiSelectWidget = ({ }; }); - const defaultValue = selectItems.filter((item) => value?.includes(item.value)); + const optionsFromList = selectItems.filter((item) => value?.includes(item.value)); return ( diff --git a/packages/app-store/routing-forms/pages/form-edit/[...appPages].tsx b/packages/app-store/routing-forms/pages/form-edit/[...appPages].tsx index 6df0cdbfb9..8a5834983b 100644 --- a/packages/app-store/routing-forms/pages/form-edit/[...appPages].tsx +++ b/packages/app-store/routing-forms/pages/form-edit/[...appPages].tsx @@ -134,7 +134,7 @@ function Field({