Onboarding Survey Step (Survey/index.jsx)

anything-llm · frontend/src/pages/OnboardingFlow/Steps/Survey/index.jsx · javascript · MIT
ui, crm, analytics, fw:react, tag:onboarding

Renders the onboarding questionnaire step and sends collected email, use-case, and comment data to a survey endpoint via sendBeacon or fetch fallback.

// Source: https://github.com/Mintplex-Labs/anything-llm | License: MIT | Copyright Mintplex Labs Inc
// Provided via justclaw.it.com; keep this notice with the code.
import {
  COMPLETE_QUESTIONNAIRE,
  ONBOARDING_SURVEY_URL,
} from "@/utils/constants";
import paths from "@/utils/paths";
import { CheckCircle } from "@phosphor-icons/react";
import React, { useState, useEffect, useRef } from "react";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import Workspace from "@/models/workspace";

async function sendQuestionnaire({ email, useCase, comment }) {
  if (import.meta.env.DEV) {
    console.log("sendQuestionnaire", { email, useCase, comment });
    return;
  }

  const data = JSON.stringify({
    email,
    useCase,
    comment,
    source

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key