Skip to content

Beautiful Open-Source Form Builder

33.1 KB
Raw Blame
<template>
  <div>
    <section class="bg-white">
      <div class="relative">
        <div class="px-8 lg:px-12 py-14 sm:py-28 text-center relative z-2">
          <h1
            class="text-4xl sm:text-[56px] sm:leading-16 tracking-[-1%] font-semibold text-gray-950"
          >
            Simple pricing
            <br class="hidden sm:block" />
            based on your needs
          </h1>
          <p
            class="text-lg sm:text-xl leading-7 tracking-[-1.5%] sm:leading-8 font-normal text-gray-600"
          >
            No locked-in contracts. Upgrade or cancel anytime.
          </p>
        </div>
        <div
          class="pointer-events-none w-full h-full bg-linear-to-b from-white from-20% via-blue-50 via-50% to-white to-80% absolute inset-0"
        ></div>
      </div>
      <div class="px-8 lg:px-12">
        <div class="flex justify-center">
          <MonthlyYearlySelector v-model="pricingIsYearly" />
        </div>

        <div
          class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mt-6 max-w-266 mx-auto"
        >
          <!-- Free -->
          <div
            class="p-6 sm:p-8 bg-white border shadow-sm rounded-3xl border-gray-200"
          >
            <div class="flex items-center gap-4">
              <span class="inline-flex items-center justify-center w-5 h-5">
                <Icon
                  class="w-3.75 h-[17.76px] text-blue-500"
                  name="heroicons:bolt-20-solid"
                />
              </span>
              <h3 class="text-xl leading-7 font-medium text-gray-950">Free</h3>
            </div>

            <p
              class="mt-4 text-sm font-medium leading-5 tracking-[-0.6%] text-gray-600"
            >
              Start collecting unlimited responses with no friction.
            </p>

            <div class="mt-6">
              <p class="flex items-center gap-2">
                <span
                  class="text-3xl sm:text-[40px] sm:leading-12 font-medium tracking-[-1%] text-gray-950"
                  >$0</span
                >
              </p>
            </div>

            <div class="mt-6 flex justify-center sm:block sm:justify-normal">
              <UButton
                v-if="!authenticated"
                class="w-fit sm:w-full justify-center px-4 py-2.5 rounded-[12px] text-base leading-7 tracking-[-1.1%] font-medium"
                variant="outline"
                :to="{ name: 'register' }"
                label="Get started free"
                color="neutral"
              />
              <UButton
                v-else
                color="neutral"
                class="w-fit sm:w-full justify-center px-4 py-2.5 rounded-[12px] text-base leading-7 tracking-[-1.1%] font-medium"
                :to="{ name: 'home' }"
                label="Go to app"
              />
            </div>

            <div class="mt-6">
              <p
                class="text-sm leading-5 tracking-[-0.6%] font-medium text-gray-950"
              >
                Includes
              </p>
              <ul
                class="mt-4 space-y-4 text-sm leading-5 tracking-[-0.6%] font-medium text-gray-700"
              >
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Unlimited forms & submissions
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  File uploads (basic quota)
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Form logic & validation
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Computed fields (calculations)
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Pre-fills, URL parameters
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Multi-user access (all admins, no roles)
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  1 workspace only
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Branding required
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Community support
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  API access
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Basic integrations & webhooks
                </li>
              </ul>
            </div>
          </div>

          <!-- Pro (Most popular) -->
          <div
            class="relative p-6 sm:p-8 bg-white border-2 shadow-sm rounded-3xl border-blue-500"
          >
            <div class="absolute top-6 right-6">
              <span
                class="inline-flex items-center px-3 py-1 text-xs font-semibold text-blue-700 bg-blue-50 rounded-full ring-1 ring-blue-200"
              >
                Most popular
              </span>
            </div>

            <div class="flex items-center gap-4">
              <span class="inline-flex items-center justify-center w-5 h-5">
                <Icon
                  class="w-3.75 h-[17.76px] text-blue-500"
                  name="heroicons:sparkles-20-solid"
                />
              </span>
              <h3 class="text-xl leading-7 font-medium text-gray-950">Pro</h3>
            </div>

            <p
              class="mt-4 text-sm font-medium leading-5 tracking-[-0.6%] text-gray-600"
            >
              A polished, professional experience for serious work.
            </p>

            <div class="mt-6">
              <p class="flex items-center gap-2">
                <span
                  class="text-3xl sm:text-[40px] sm:leading-12 font-medium tracking-[-1%] text-gray-950"
                >
                  {{ formatAnimatedPlanPrice("pro") }}
                </span>
                <span
                  class="text-base leading-7 tracking-[-1.1%] font-medium text-gray-600"
                  >/mo</span
                >
              </p>
            </div>

            <div class="mt-6 flex justify-center sm:block sm:justify-normal">
              <UButton
                class="w-fit sm:w-full justify-center px-4 py-2.5 rounded-[12px] text-base leading-7 tracking-[-1.1%] font-medium"
                label="Get started free"
                @click.prevent="handleProCta"
              />
            </div>

            <div class="mt-6">
              <p
                class="text-sm leading-5 tracking-[-0.6%] font-medium text-gray-950"
              >
                Everything in Free, plus
              </p>
              <ul
                class="mt-4 space-y-4 text-sm leading-5 tracking-[-0.6%] font-medium text-gray-700"
              >
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Remove branding
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Custom domains
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Custom SEO, link previews &amp; favicon
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Custom SMTP
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Discord, Slack, Telegram
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Password-protected forms
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Form expiration
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Captcha
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Analytics dashboard
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  AI form generation
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Editable submissions
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Unique submission IDs
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Multiple workspaces
                </li>
              </ul>
            </div>
          </div>

          <!-- Business -->
          <div
            class="p-6 sm:p-8 bg-white border shadow-sm rounded-3xl border-gray-200"
          >
            <div class="flex items-center gap-4">
              <span class="inline-flex items-center justify-center w-5 h-5">
                <Icon
                  class="w-3.75 h-[17.76px] text-blue-500"
                  name="heroicons:building-office-20-solid"
                />
              </span>
              <h3 class="text-xl leading-7 font-medium text-gray-950">
                Business
              </h3>
            </div>

            <p
              class="mt-4 text-sm font-medium leading-5 tracking-[-0.6%] text-gray-600"
            >
              Built for teams and agencies managing forms at scale.
            </p>

            <div class="mt-6">
              <p class="flex items-center gap-2">
                <span
                  class="text-3xl sm:text-[40px] sm:leading-12 font-medium tracking-[-1%] text-gray-950"
                >
                  {{ formatAnimatedPlanPrice("business") }}
                </span>
                <span
                  class="text-base leading-7 tracking-[-1.1%] font-medium text-gray-600"
                  >/mo</span
                >
              </p>
            </div>

            <div class="mt-6 flex justify-center sm:block sm:justify-normal">
              <UButton
                class="w-fit sm:w-full justify-center px-4 py-2.5 rounded-[12px] text-base leading-7 tracking-[-1.1%] font-medium"
                variant="outline"
                label="Get started free"
                color="neutral"
                @click.prevent="handleBusinessCta"
              />
            </div>

            <div class="mt-6">
              <p
                class="text-sm leading-5 tracking-[-0.6%] font-medium text-gray-950"
              >
                Everything in Pro, plus
              </p>
              <ul
                class="mt-4 space-y-4 text-sm leading-5 tracking-[-0.6%] font-medium text-gray-700"
              >
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Multi-user with roles & permissions
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Advanced branding (CSS, fonts)
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Higher file upload size limits
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Priority support
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Partial submissions
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Versioning
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Advanced integrations
                </li>
              </ul>
            </div>
          </div>

          <!-- Enterprise -->
          <div
            class="p-6 sm:p-8 bg-white border shadow-sm rounded-3xl border-gray-200"
          >
            <div class="flex items-center gap-4">
              <span class="inline-flex items-center justify-center w-5 h-5">
                <Icon
                  class="w-3.75 h-[17.76px] text-blue-500"
                  name="heroicons:globe-alt-20-solid"
                />
              </span>
              <h3 class="text-xl leading-7 font-medium text-gray-950">
                Enterprise
              </h3>
            </div>

            <p
              class="mt-4 text-sm font-medium leading-5 tracking-[-0.6%] text-gray-600"
            >
              Enterprise-grade security, compliance, and control.
            </p>

            <div class="mt-6">
              <p class="flex items-center gap-2">
                <span
                  class="text-3xl sm:text-[40px] sm:leading-12 font-medium tracking-[-1%] text-gray-950"
                >
                  {{ formatAnimatedPlanPrice("enterprise") }}
                </span>
                <span
                  class="text-base leading-7 tracking-[-1.1%] font-medium text-gray-600"
                  >/mo</span
                >
              </p>
            </div>

            <div class="mt-6 flex justify-center sm:block sm:justify-normal">
              <UButton
                class="w-fit sm:w-full justify-center px-4 py-2.5 rounded-[12px] text-base leading-7 tracking-[-1.1%] font-medium"
                variant="outline"
                label="Get started free"
                color="neutral"
                @click.prevent="handleEnterpriseCta"
              />
            </div>

            <div class="mt-6">
              <p
                class="text-sm leading-5 tracking-[-0.6%] font-medium text-gray-950"
              >
                Everything in Business, plus
              </p>
              <ul
                class="mt-4 space-y-4 text-sm leading-5 tracking-[-0.6%] font-medium text-gray-700"
              >
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  SAML / LDAP SSO
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  Audit logs & compliance features
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  External storage support
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  White-label hosting option
                </li>
                <li class="flex items-center gap-2.5">
                  <Icon
                    class="w-4 h-5 text-emerald-600"
                    name="heroicons:check-20-solid"
                  />
                  SLA & onboarding support
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- <section class="py-12 bg-white">
      <div
        class="flex items-start gap-4 max-w-3xl p-6 mx-auto bg-yellow-50 ring ring-inset ring-yellow-200 rounded-3xl"
      >
        <UIcon
          name="i-heroicons-shield-check"
          class="h-8 w-8 shrink-0 text-yellow-500"
        />
        <div>
          <p class="text-lg font-semibold text-yellow-600">
            Nonprofit & Student Discount — 50%
          </p>
          <p class="mt-1 text-base font-medium leading-7 text-yellow-600">
            Whether your nonprofit is large or small, OpnForm's online Form
            Builder helps your organization help others. It takes just a few
            minutes to create and publish your forms online. As an exclusive
            benefit, we offer nonprofits & students a 50-percent discount!
          </p>
        </div>
      </div>
    </section> -->

    <section class="pt-16 bg-white">
      <TrustedTeams />
    </section>

    <section class="py-14 sm:py-28 px-8 lg:px-12 bg-white">
      <FeatureComparison :yearly="pricingIsYearly" />
    </section>

    <section class="pt-10 pb-4 sm:pt-12 sm:pb-6 px-8 lg:px-12 bg-white">
      <Testimonials />
    </section>

    <section class="pt-4 pb-14 sm:pt-6 sm:pb-28 px-8 lg:px-12 bg-white">
      <div class="mx-auto max-w-266">
        <div class="text-center">
          <h2
            class="text-4xl sm:text-5xl sm:leading-14 tracking-[-1%] font-semibold text-gray-950"
          >
            Self-host OpnForm
          </h2>
          <p
            class="mt-4 text-base font-normal tracking-[-1.1%] leading-7 text-gray-600"
          >
            Self-host the core product for free. Upgrade to a self-hosted
            Enterprise license when you need more users, advanced identity
            controls, branding, and support.
          </p>
        </div>

        <div class="mt-12 sm:mt-16 space-y-6">
          <div
            class="p-6 sm:p-8 bg-white border shadow-sm rounded-3xl border-gray-200"
          >
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
              <div>
                <div class="flex items-center gap-4">
                  <span class="inline-flex items-center justify-center w-5 h-5">
                    <Icon
                      class="w-5 h-5 text-blue-500"
                      name="heroicons:users-20-solid"
                    />
                  </span>
                  <h3 class="text-xl leading-7 font-medium text-gray-950">
                    Community Edition
                  </h3>
                </div>

                <p
                  class="mt-4 text-base font-medium tracking-[-1.1%] leading-7 text-gray-600"
                >
                  Perfect for individuals and teams who want full control and
                  community-driven software.
                </p>

                <div class="mt-6">
                  <p
                    class="text-3xl sm:text-[40px] sm:leading-12 font-medium tracking-[-1%] text-gray-950"
                  >
                    Free OSS
                  </p>
                </div>

                <div class="mt-6">
                  <UButton
                    size="lg"
                    variant="outline"
                    color="neutral"
                    label="View self-hosting docs"
                    href="https://docs.opnform.com/deployment/docker"
                    target="_blank"
                    class="px-4 py-2.5 rounded-[12px] text-base leading-7 tracking-[-1.1%] font-medium"
                  />
                </div>
              </div>

              <div>
                <ul
                  class="space-y-4 text-base leading-7 tracking-[-1.1%] font-medium text-gray-700"
                >
                  <li
                    v-for="feature in communityEditionFeatures"
                    :key="feature"
                    class="flex items-center gap-3"
                  >
                    <Icon
                      class="w-4 h-5 text-emerald-600"
                      name="heroicons:check-20-solid"
                    />
                    {{ feature }}
                  </li>
                </ul>
              </div>
            </div>
          </div>

          <div
            class="p-6 sm:p-8 bg-white border shadow-sm rounded-3xl border-gray-200"
          >
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
              <div>
                <div class="flex items-center gap-4">
                  <span class="inline-flex items-center justify-center w-5 h-5">
                    <Icon
                      class="w-5 h-5 text-blue-600"
                      name="heroicons:shield-check-20-solid"
                    />
                  </span>
                  <h3 class="text-xl leading-7 font-medium text-gray-950">
                    Enterprise License
                  </h3>
                </div>

                <p
                  class="mt-4 text-base font-medium tracking-[-1.1%] leading-7 text-gray-600"
                >
                  Built for organizations that need governance, customization,
                  and long-term reliability.
                </p>

                <div class="mt-6">
                  <p class="flex items-center gap-3">
                    <span
                      class="text-3xl sm:text-[40px] sm:leading-12 font-medium tracking-[-1%] text-gray-950"
                    >
                      $1,999
                    </span>
                    <span
                      class="text-base leading-7 tracking-[-1.1%] font-medium text-gray-600"
                    >
                      /year per instance
                    </span>
                  </p>
                </div>

                <div class="mt-6">
                  <UButton
                    size="lg"
                    label="Buy license"
                    :to="{ name: 'self-hosted-license' }"
                    class="px-4 py-2.5 rounded-[12px] text-base leading-7 tracking-[-1.1%] font-medium"
                  />
                  <p class="mt-3 text-sm leading-5 tracking-[-0.6%] font-medium text-gray-600">
                    Self-service checkout. License key delivered by email.
                  </p>
                  <UButton
                    size="sm"
                    variant="link"
                    color="neutral"
                    label="Need invoice or procurement?"
                    class="mt-1 p-0 text-sm font-medium"
                    @click.prevent="contactUs"
                  />
                </div>
              </div>

              <div>
                <ul
                  class="space-y-4 text-base leading-7 tracking-[-1.1%] font-medium text-gray-700"
                >
                  <li
                    v-for="feature in enterpriseLicenseFeatures"
                    :key="feature"
                    class="flex items-center gap-3"
                  >
                    <Icon
                      class="w-5 h-5 text-emerald-600"
                      name="heroicons:check-20-solid"
                    />
                    {{ feature }}
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <FaqSection
      :faqs="faqs"
      :title-lines="['Everything you need to', 'know']"
      description="Find answers about plans, onboarding, roles, and how teams use our tool every day."
      :default-open-index="2"
      id-prefix="pricing-faq-answer"
      @contact="contactUs"
    />

    <OpenFormFooter />
  </div>
</template>

<script setup>
import FeatureComparison from "~/components/pages/pricing/FeatureComparison.vue"
import FaqSection from "~/components/pages/FaqSection.vue"
import { useIsAuthenticated } from "~/composables/useIsAuthenticated.js"

definePageMeta({
  layout: "default",
  middleware: ["self-hosted"],
})

useOpnSeoMeta({
  title: "Pricing",
  description:
    "All of our core features are free, and there is no quantity limit. You can also created more advanced and customized forms with OpnForms Pro.",
})

const { openSubscriptionModal } = useAppModals()
const { isAuthenticated: authenticated } = useIsAuthenticated()
const { getPlanPrice } = useBillingUpsell()

const pricingIsYearly = ref(true)
const displayedPlanPrices = ref({
  pro: 0,
  business: 0,
  enterprise: 0,
})
const activePriceAnimationFrame = ref(null)
let hasInitializedDisplayedPrices = false

const planPriceValues = computed(() => ({
  pro: getPlanPrice("pro", pricingIsYearly.value) ?? 0,
  business: getPlanPrice("business", pricingIsYearly.value) ?? 0,
  enterprise: getPlanPrice("enterprise", pricingIsYearly.value) ?? 0,
}))

function easeOutCubic(progress) {
  return 1 - (1 - progress) ** 3
}

function formatAnimatedPlanPrice(plan) {
  const price = displayedPlanPrices.value[plan]
  if (price == null) return null
  return `$${Math.round(price)}`
}

function animatePlanPrices(nextPrices) {
  if (activePriceAnimationFrame.value) {
    cancelAnimationFrame(activePriceAnimationFrame.value)
  }

  const startPrices = { ...displayedPlanPrices.value }
  const duration = 450
  const startTime = performance.now()

  const tick = (currentTime) => {
    const progress = Math.min((currentTime - startTime) / duration, 1)
    const easedProgress = easeOutCubic(progress)

    displayedPlanPrices.value = Object.keys(nextPrices).reduce((prices, plan) => {
      const startPrice = startPrices[plan] ?? 0
      const endPrice = nextPrices[plan] ?? 0

      prices[plan] = startPrice + (endPrice - startPrice) * easedProgress
      return prices
    }, {})

    if (progress < 1) {
      activePriceAnimationFrame.value = requestAnimationFrame(tick)
      return
    }

    displayedPlanPrices.value = { ...nextPrices }
    activePriceAnimationFrame.value = null
  }

  activePriceAnimationFrame.value = requestAnimationFrame(tick)
}

watch(
  planPriceValues,
  (nextPrices) => {
    if (!import.meta.client || !hasInitializedDisplayedPrices) {
      displayedPlanPrices.value = { ...nextPrices }
      hasInitializedDisplayedPrices = true
      return
    }

    animatePlanPrices(nextPrices)
  },
  { immediate: true },
)

onBeforeUnmount(() => {
  if (activePriceAnimationFrame.value) {
    cancelAnimationFrame(activePriceAnimationFrame.value)
  }
})

const communityEditionFeatures = [
  "Unlimited forms & submissions",
  "File uploads, logic, computed fields",
  "Pre-fills, URL parameters",
  "Up to 2 users across the instance",
  "Core workspace management",
  "OIDC SSO within the 2-user limit",
  "Branding required",
  "Community support",
]

const enterpriseLicenseFeatures = [
  "Branding removal",
  "Custom SMTP",
  "Advanced integrations (when ready)",
  "Multi-workspace support",
  "Multi-user with roles & permissions",
  "SSO, audit logs, compliance features",
  "White-labeling & theming",
  "Packaged updates + migration tooling",
  "Priority support",
]

const faqs = [
  {
    question: "Is there any submission limit?",
    answer:
      "No — submissions are unlimited on all plans. The Free plan gives you access to most features without restrictive usage caps.",
  },
  {
    question: "Are integrations included in the Free plan?",
    answer:
      "Yes — basic integrations like webhooks and API access are available on the Free plan. Some advanced integrations are available on higher tiers.",
  },
  {
    question: "Can I hide the OpnForm branding?",
    answer:
      "Yes. You can remove the “Made with OpnForm” footer and add your own branding on the Pro plan or higher.",
  },
  {
    question: "Can I customize my form's SEO and link preview?",
    answer:
      "Yes. Pro and higher plans include a custom page title, description, link preview image, and favicon. These settings work on both OpnForm URLs and custom domains.",
  },
  {
    question: "Is there a difference between monthly and yearly billing?",
    answer:
      "Yearly billing is discounted compared to paying monthly. You’ll be billed once per year and save versus the monthly plan.",
  },
  {
    question: "How can I pay for my subscription?",
    answer:
      "We support card payments via Stripe. You’ll get invoices/receipts automatically for your records.",
  },
  {
    question: "Do you offer discounts for non-profits or education?",
    answer:
      "Yes — we offer discounted pricing for non-profits and students. Contact us and we’ll help you get set up.",
  },
  {
    question: "Can I cancel my subscription anytime?",
    answer:
      "Yes. You can cancel anytime from the billing portal. Your subscription remains active until the end of the current billing period.",
  },
  {
    question: "Can I switch between plans?",
    answer:
      "Yes — you can upgrade or downgrade at any time. Changes apply immediately, and billing adjusts accordingly.",
  },
  {
    question: "Do you offer refunds?",
    answer:
      "If something isn’t working as expected, reach out and we’ll do our best to help. Refunds are handled case-by-case.",
  },
  {
    question: "What’s included when I self-host OpnForm?",
    answer:
      "Self-hosting includes the core OpnForm app and lets you run it on your own infrastructure. Some hosted-only services (like managed billing) may not apply.",
  },
  {
    question: "Do you offer a free trial of paid features?",
    answer:
      "We don’t currently offer an automated trial, but you can contact us if you’d like to evaluate a paid plan for your team.",
  },
  {
    question: "Is there an API, and is it free?",
    answer:
      "Yes — OpnForm has an API and API access tokens. They’re available on the Free plan, with higher tiers unlocking more advanced capabilities.",
  },
  {
    question: "Can I collaborate with my team?",
    answer:
      "Yes — multi-user collaboration is supported. Higher tiers add roles and permissions for larger teams.",
  },
]

const handlePlanCta = (plan) => {
  if (!authenticated.value) {
    return navigateTo({ name: "register" })
  }
  openSubscriptionModal({ plan, yearly: pricingIsYearly.value })
}

const handleProCta = () => handlePlanCta("pro")
const handleBusinessCta = () => handlePlanCta("business")
const handleEnterpriseCta = () => handlePlanCta("enterprise")

const contactUs = () => {
  useCrisp().openAndShowChat()
}
</script>