import type {SettingField, Step} from "../../types"; import {memo} from "@wordpress/element"; import Premium from "./Premium"; import Fields from "../Fields/Fields"; // @ts-ignore import Icon from '@/utils/Icon'; import Accordion from "../Fields/Accordion"; // @ts-ignore import useOnboardingStore from "@/store/useOnboardingStore"; export const ModalContent = memo( ({ step, onFieldChange, }: { step: Step; settings: SettingField[]; onFieldChange: (fieldId: string, value: string | boolean) => void; }) => { const { licenseStatus, isUpdating } = useOnboardingStore(); const isLicenseStep = step.id === "license"; const hasBullets = Array.isArray(step.bullets) && step.bullets.length > 0; const shouldShowBullets = hasBullets && (!isLicenseStep || licenseStatus === "activated"); const shouldShowFields = !isLicenseStep ? true : licenseStatus !== "activated" && !isUpdating; return (
{step.intro_bullets?.length > 0 && (
{step.intro_bullets.map((bullet, index) => (

{bullet.title}

{bullet.desc}

))}
)} {shouldShowBullets && } {shouldShowFields && ( <> { /*Grouped field*/ } {step?.groups?.length > 0 && ( )} {/* Non-grouped field, which are all fields without a group_id. */ } {step?.fields?.some((f) => !f.group_id) && ( !f.group_id)} onChange={onFieldChange} /> )} )}
); } );