diff --git a/web/app/(humanInputLayout)/form/[token]/form-status-card.tsx b/web/app/(humanInputLayout)/form/[token]/form-status-card.tsx index 6b7813402d..03efebe1e3 100644 --- a/web/app/(humanInputLayout)/form/[token]/form-status-card.tsx +++ b/web/app/(humanInputLayout)/form/[token]/form-status-card.tsx @@ -8,6 +8,7 @@ type FormStatusCardProps = { title: ReactNode subtitle?: ReactNode submissionID?: string + removeWebappBrand?: boolean } const FormStatusCard = ({ @@ -15,6 +16,7 @@ const FormStatusCard = ({ title, subtitle, submissionID, + removeWebappBrand, }: FormStatusCardProps) => { const { t } = useTranslation() @@ -37,12 +39,14 @@ const FormStatusCard = ({ )} -
-
-
{t('chat.poweredBy', { ns: 'share' })}
- + {!removeWebappBrand && ( +
+
+
{t('chat.poweredBy', { ns: 'share' })}
+ +
-
+ )}
) diff --git a/web/app/(humanInputLayout)/form/[token]/form.tsx b/web/app/(humanInputLayout)/form/[token]/form.tsx index 55491462ce..ca78b135f9 100644 --- a/web/app/(humanInputLayout)/form/[token]/form.tsx +++ b/web/app/(humanInputLayout)/form/[token]/form.tsx @@ -1,6 +1,6 @@ 'use client' import type { FormInputItem, UserAction } from '@/app/components/workflow/nodes/human-input/types' -import type { SiteInfo } from '@/models/share' +import type { CustomConfigValueType, SiteInfo } from '@/models/share' import type { HumanInputFormError } from '@/service/use-share' import type { HumanInputResolvedValue } from '@/types/workflow' import * as React from 'react' @@ -14,7 +14,10 @@ import LoadedFormContent from './loaded-form-content' import { useFormSubmit } from './use-form-submit' export type FormData = { - site: { site: SiteInfo } + site: { + site: SiteInfo + custom_config?: Record | null + } form_content: string inputs: FormInputItem[] resolved_default_values: Record @@ -31,6 +34,8 @@ const FormContent = () => { const { data: formData, isLoading, error } = useGetHumanInputForm(token) const { isSubmitting, submit, success } = useFormSubmit(token) + const removeWebappBrand = formData?.site?.custom_config?.remove_webapp_brand === true + const expired = (error as HumanInputFormError | null)?.code === 'human_input_form_expired' const submitted = (error as HumanInputFormError | null)?.code === 'human_input_form_submitted' const rateLimitExceeded = (error as HumanInputFormError | null)?.code === 'web_form_rate_limit_exceeded' @@ -48,6 +53,7 @@ const FormContent = () => { title={t('humanInput.thanks', { ns: 'share' })} subtitle={t('humanInput.recorded', { ns: 'share' })} submissionID={token} + removeWebappBrand={removeWebappBrand} /> ) } @@ -98,6 +104,7 @@ const FormContent = () => { formData={formData} isSubmitting={isSubmitting} onSubmit={submit} + removeWebappBrand={removeWebappBrand} /> ) } diff --git a/web/app/(humanInputLayout)/form/[token]/loaded-form-content.tsx b/web/app/(humanInputLayout)/form/[token]/loaded-form-content.tsx index 00ab0ac1b7..304e1c625d 100644 --- a/web/app/(humanInputLayout)/form/[token]/loaded-form-content.tsx +++ b/web/app/(humanInputLayout)/form/[token]/loaded-form-content.tsx @@ -17,12 +17,14 @@ type LoadedFormContentProps = { formData: FormData isSubmitting: boolean onSubmit: (inputs: Record, actionID: string, formInputs: FormData['inputs']) => void + removeWebappBrand?: boolean } const LoadedFormContent = ({ formData, isSubmitting, onSubmit, + removeWebappBrand, }: LoadedFormContentProps) => { const { t } = useTranslation() const renderedFormInputs = getRenderedFormInputs(formData.inputs, formData.form_content) @@ -84,12 +86,14 @@ const LoadedFormContent = ({ -
-
-
{t('chat.poweredBy', { ns: 'share' })}
- + {!removeWebappBrand && ( +
+
+
{t('chat.poweredBy', { ns: 'share' })}
+ +
-
+ )}
)