Compare commits
32 Commits
feature/ar
...
v1.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12d995465a | ||
|
|
f9861cf772 | ||
|
|
8857c971d6 | ||
|
|
7ea79df145 | ||
|
|
ac12ddaafb | ||
|
|
9dc47c6a27 | ||
|
|
e0e4a637e2 | ||
|
|
b9259116e1 | ||
|
|
83ffd7a371 | ||
|
|
b3d772c463 | ||
|
|
12d600093e | ||
|
|
51cec0184f | ||
|
|
4c85fcb3cd | ||
|
|
782b3e0974 | ||
|
|
fee2517009 | ||
|
|
2e16e046f1 | ||
|
|
b275cce7ad | ||
|
|
45f02fd3c2 | ||
|
|
368df47035 | ||
|
|
2ce759c023 | ||
|
|
ddc06b19bf | ||
|
|
17410ba14c | ||
|
|
9b34833bdd | ||
|
|
89c614fafb | ||
|
|
6f552886d0 | ||
|
|
6a7b66aaaa | ||
|
|
f28bb9b82a | ||
|
|
8dd67ec484 | ||
|
|
aa43d0a94c | ||
|
|
d648762f4f | ||
|
|
f8c0021346 | ||
|
|
8fd78bc08f |
@@ -1,5 +1,5 @@
|
||||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
||||
ARG VARIANT=18-bullseye
|
||||
ARG VARIANT=20
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
@@ -13,4 +13,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
||||
|
||||
RUN su node -c "npm install -g pnpm"
|
||||
RUN su node -c "npm install -g pnpm"
|
||||
|
||||
@@ -2,29 +2,27 @@
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/javascript-node-postgres
|
||||
// Update the VARIANT arg in docker-compose.yml to pick a Node.js version
|
||||
{
|
||||
"name": "Node.js & PostgreSQL",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspace",
|
||||
"name": "Node.js & PostgreSQL",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspace",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint"
|
||||
]
|
||||
}
|
||||
},
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": ["dbaeumer.vscode-eslint"]
|
||||
}
|
||||
},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// This can be used to network with other containers or with the host.
|
||||
"forwardPorts": [3000, 5432, 8025],
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// This can be used to network with other containers or with the host.
|
||||
"forwardPorts": [3000, 5432, 8025],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "pnpm install",
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "cp .env.example .env && sed -i '/^ENCRYPTION_KEY=/c\\ENCRYPTION_KEY='$(openssl rand -hex 32) .env && sed -i '/^NEXTAUTH_SECRET=/c\\NEXTAUTH_SECRET='$(openssl rand -hex 32) .env && pnpm install && pnpm db:migrate:dev",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "node"
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "node"
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ services:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
# Update 'VARIANT' to pick an LTS version of Node.js: 18, 16, 14.
|
||||
# Update 'VARIANT' to pick an LTS version of Node.js: 20, 18, 16, 14.
|
||||
# Append -bullseye or -buster to pin to an OS version.
|
||||
# Use -bullseye variants on local arm64/Apple Silicon.
|
||||
VARIANT: "18"
|
||||
VARIANT: "20"
|
||||
|
||||
volumes:
|
||||
- ..:/workspace:cached
|
||||
@@ -33,7 +33,7 @@ services:
|
||||
environment:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
POSTGRES_DB: formbricks
|
||||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ SMTP_PASSWORD=smtpPassword
|
||||
#####################
|
||||
|
||||
# Email Verification. If you enable Email Verification you have to setup SMTP-Settings, too.
|
||||
# EMAIL_VERIFICATION_DISABLED=1
|
||||
EMAIL_VERIFICATION_DISABLED=1
|
||||
|
||||
# Password Reset. If you enable Password Reset functionality you have to setup SMTP-Settings, too.
|
||||
# PASSWORD_RESET_DISABLED=1
|
||||
PASSWORD_RESET_DISABLED=1
|
||||
|
||||
# Signup. Disable the ability for new users to create an account.
|
||||
# SIGNUP_DISABLED=1
|
||||
@@ -106,6 +106,10 @@ CRON_SECRET=
|
||||
# Configure this when you want to ship JS & CSS files from a complete URL instead of the current domain
|
||||
# ASSET_PREFIX_URL=
|
||||
|
||||
# Oauth credentials for Notion Integration
|
||||
NOTION_OAUTH_CLIENT_ID=
|
||||
NOTION_OAUTH_CLIENT_SECRET=
|
||||
|
||||
# Stripe Billing Variables
|
||||
STRIPE_SECRET_KEY=
|
||||
STRIPE_WEBHOOK_SECRET=
|
||||
|
||||
2
.github/workflows/lint.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
- name: create .env
|
||||
run: cp .env.example .env
|
||||
|
||||
- name: Generate Random NEXTAUTH_SECRET
|
||||
- name: Generate Random ENCRYPTION_KEY
|
||||
run: |
|
||||
SECRET=$(openssl rand -hex 32)
|
||||
echo "ENCRYPTION_KEY=$SECRET" >> $GITHUB_ENV
|
||||
|
||||
3
.github/workflows/playwright.yml
vendored
@@ -20,6 +20,9 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm install -g pnpm && pnpm install
|
||||
|
||||
- name: Build Formricks JS package
|
||||
run: pnpm build --filter=js
|
||||
|
||||
- name: Build Formbricks Image & Run
|
||||
run: docker-compose up -d
|
||||
|
||||
|
||||
2
.github/workflows/release-docker-github.yml
vendored
@@ -89,7 +89,7 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
file: ./apps/web/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
# platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
5
.github/workflows/test.yml
vendored
@@ -29,6 +29,11 @@ jobs:
|
||||
- name: create .env
|
||||
run: cp .env.example .env
|
||||
|
||||
- name: Generate Random ENCRYPTION_KEY
|
||||
run: |
|
||||
SECRET=$(openssl rand -hex 32)
|
||||
echo "ENCRYPTION_KEY=$SECRET" >> $GITHUB_ENV
|
||||
|
||||
- name: Build formbricks-js dependencies
|
||||
run: pnpm build --filter=js
|
||||
|
||||
|
||||
22
README.md
@@ -11,55 +11,35 @@
|
||||
<h3 align="center">Formbricks</h3>
|
||||
|
||||
<p align="center">
|
||||
|
||||
Harvest user-insights, build irresistible experiences.
|
||||
|
||||
<br />
|
||||
|
||||
<a href="https://formbricks.com/">Website</a> | <a href="https://formbricks.com/discord">Join Discord community</a>
|
||||
|
||||
</p>
|
||||
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
|
||||
<a href="https://github.com/formbricks/formbricks/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-AGPL-purple" alt="License"></a> <a href="https://formbricks.com/discord"><img src="https://img.shields.io/discord/979077669410979880?label=Discord&logo=discord&logoColor=%23fff" alt="Join Formbricks Discord"></a> <a href="https://github.com/formbricks/formbricks/stargazers"><img src="https://img.shields.io/github/stars/formbricks/formbricks?logo=github" alt="Github Stars"></a>
|
||||
|
||||
<a href="https://news.ycombinator.com/item?id=32303986"><img src="https://img.shields.io/badge/Hacker%20News-122-%23FF6600" alt="Hacker News"></a>
|
||||
|
||||
<a href="[https://www.producthunt.com/products/formbricks](https://www.producthunt.com/posts/formbricks)"><img src="https://img.shields.io/badge/Product%20Hunt-455-orange?logo=producthunt&logoColor=%23fff" alt="Product Hunt"></a>
|
||||
|
||||
<a href="https://github.blog/2023-04-12-github-accelerator-our-first-cohort-and-whats-next/"><img src="https://img.shields.io/badge/2023-blue?logo=github&label=Github%20Accelerator" alt="Github Accelerator"></a>
|
||||
|
||||
<a href="https://github.com/formbricks/formbricks/issues?q=is:issue+is:open+label:%22%F0%9F%99%8B%F0%9F%8F%BB%E2%80%8D%E2%99%82%EF%B8%8Fhelp+wanted%22"><img src="https://img.shields.io/badge/Help%20Wanted-Contribute-blue"></a>
|
||||
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
||||
<div style="background-color:#f8fafc; border-radius:5px;">
|
||||
<p align="center">
|
||||
|
||||
<i>Trusted by</i>
|
||||
|
||||
<a href="https://flixbus.com"><img src="https://github.com/formbricks/formbricks/assets/72809645/d6c91d89-7633-4845-ae1e-03bbd2ce0946" height="35px"></a>
|
||||
|
||||
<a href="https://flixbus.com"><img src="https://github.com/formbricks/formbricks/assets/72809645/d6c91d89-7633-4845-ae1e-03bbd2ce0946" height="35px"></a>
|
||||
<a href="https://github.com/calcom/cal.com/"><img src="https://github.com/formbricks/formbricks/assets/675065/1a8763cf-f47e-4960-90f6-334f6dc12a17#gh-light-mode-only" height="20px"></a>
|
||||
|
||||
<a href="https://github.com/CrowdDotDev/crowd.dev"><img src="https://github.com/formbricks/formbricks/assets/675065/59b1a4d4-25e4-4ef3-b0bf-4426446fbfd0#gh-light-mode-only" height="20px"></a>
|
||||
|
||||
<a href="https://neverinstall.com/"><img src="https://github.com/formbricks/formbricks/assets/675065/72e5e37b-8ef7-4340-b06e-f1d12a05330f#gh-light-mode-only" height="20px"></a>
|
||||
|
||||
<a href="https://clovyr.io/"><img src="https://github.com/formbricks/formbricks/assets/675065/9291c8df-9aac-423a-a430-a9a581240075" height="20px"></a>
|
||||
|
||||
</p>
|
||||
<div>
|
||||
|
||||
<p align="center">
|
||||
|
||||
<a href="https://trendshift.io/repositories/2570" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2570" alt="Trendshift Badge for formbricks/formbricks" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||
|
||||
</p>
|
||||
|
||||
## ✨ About Formbricks
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@formbricks/js": "workspace:*",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@heroicons/react": "^2.1.1",
|
||||
"next": "14.0.4",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
|
||||
@@ -74,7 +74,7 @@ export default function AppPage({}) {
|
||||
</p>
|
||||
<Image src={fbsetup} alt="fb setup" className="mt-4 rounded" priority />
|
||||
|
||||
<div className="mt-4 flex-col items-start text-sm text-slate-700 dark:text-slate-300 sm:flex sm:items-center sm:text-base">
|
||||
<div className="mt-4 flex-col items-start text-sm text-slate-700 sm:flex sm:items-center sm:text-base dark:text-slate-300">
|
||||
<p className="mb-1 sm:mb-0 sm:mr-2">You're connected with env:</p>
|
||||
<div className="flex items-center">
|
||||
<strong className="w-32 truncate sm:w-auto">
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import Image from "next/image";
|
||||
import GitpodPorts from "./gitpod/ports.webp";
|
||||
|
||||
import GitpodAuth from "./gitpod/auth.webp";
|
||||
import GitpodNewWorkspace from "./gitpod/new-workspace.webp";
|
||||
import GitpodPorts from "./gitpod/ports.webp";
|
||||
import GitpodPreparing from "./gitpod/preparing.webp";
|
||||
import GitpodRunning from "./gitpod/running.webp";
|
||||
|
||||
import GithubCodespaceNew from "./github-codespaces/new.webp";
|
||||
import GithubCodespaceLoading from "./github-codespaces/loading.webp";
|
||||
import GithubCodespaceEnvFile from "./github-codespaces/env.webp";
|
||||
import GithubCodespaceTerminal from "./github-codespaces/terminal.webp";
|
||||
import GithubCodespaceRun from "./github-codespaces/run.webp";
|
||||
import GithubCodespaceLoading from "./github-codespaces/loading.webp";
|
||||
import GithubCodespaceNew from "./github-codespaces/new.webp";
|
||||
import GithubCodespacePorts from "./github-codespaces/ports.webp";
|
||||
import GithubCodespaceRun from "./github-codespaces/run.webp";
|
||||
import GithubCodespaceTerminal from "./github-codespaces/terminal.webp";
|
||||
|
||||
export const metadata = {
|
||||
title: "Formbricks Development Setup: Complete Guide to Local Environment Configuration for Dev",
|
||||
description:
|
||||
"Step-by-step guide to setting up a development environment for Formbricks. We officially support Gitpod and Github Codespaces for quick setup.",
|
||||
"Step-by-step guide to setting up a development environment for Formbricks. We officially support Gitpod and Github Codespaces for quick setup. Our advanced users can also setup Formbricks locally on their machine.",
|
||||
};
|
||||
|
||||
#### Contributing
|
||||
@@ -25,28 +26,29 @@ export const metadata = {
|
||||
We currently officially support the below methods to set up your development environment for Formbricks.
|
||||
|
||||
<Note>
|
||||
Both the below cloud IDEs have a **generous free tier** to explore and develop! But make sure to
|
||||
not overuse the machines as Formbricks will not be responsible for any charges incurred.
|
||||
Both the below cloud IDEs have a **generous free tier** to explore and develop! But make sure to not overuse
|
||||
the machines as Formbricks will not be responsible for any charges incurred.
|
||||
</Note>
|
||||
|
||||
### [GitPod](#gitpod)
|
||||
This will open a fully configured workspace in your browser with all the necessary dependencies already installed. Click the button below to open this project in Gitpod:
|
||||
|
||||
This will open a fully configured workspace in your browser with all the necessary dependencies already installed. Click the button below to open this project in Gitpod. For a detailed guide, visit the [Gitpod Setup Guide](#gitpod-guide) section below.
|
||||
|
||||
[](https://gitpod.io/#https://Github.com/formbricks/formbricks)
|
||||
|
||||
For a detailed guide, visit the [Gitpod Setup Guide](#gitpod-guide) section below.
|
||||
|
||||
### [Github Codespaces](#Github-codespaces)
|
||||
This will open a Github VSCode Interface on the cloud for you. This setup will have the Formbricks codebase and all the dependencies installed. Click the button below to configure your instance and open the project in Github Codespaces:
|
||||
|
||||
This will open a Github VSCode Interface on the cloud for you. This setup will have the Formbricks codebase and all the dependencies installed. Click the button below to configure your instance and open the project in Github Codespaces. For a detailed guide, visit the [Github Codespaces Setup Guide](#github-codespaces-guide) section below.
|
||||
|
||||
[](https://Github.com/codespaces/new?machine=standardLinux32gb&repo=500289888&ref=main&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=EastUs2)
|
||||
|
||||
### [Local Machine](#local-machine-setup)
|
||||
|
||||
For a detailed guide, visit the [Github Codespaces Setup Guide](#github-codespaces-guide) section below.
|
||||
This will install the Formbricks codebase and all the dependencies on your local machine. Note that this method is recommended **only for advanced users**. If you're an advanced user, access the steps for [Local Machine Setup here](#local-machine-setup).
|
||||
|
||||
<Note>
|
||||
For a smooth experience, we suggest the above recommended methods.
|
||||
Assistance with setup issues on your local machine may be limited due to varying factors like OS and permissions.
|
||||
For a smooth experience, we suggest the above cloud IDE methods. Assistance with setup issues on your local
|
||||
machine may be limited due to varying factors like OS and permissions.
|
||||
</Note>
|
||||
|
||||
## Gitpod Guide
|
||||
@@ -54,16 +56,16 @@ Assistance with setup issues on your local machine may be limited due to varying
|
||||
**Building custom image for the workspace:**
|
||||
- This includes : Installing `yq` and `turbo` globally before the workspace starts. This is accomplished within the `.gitpod.Dockerfile` along with starting upon a base custom image building on [workspace-full](https://hub.docker.com/r/gitpod/workspace-full/dockerfile).
|
||||
|
||||
**Initialization of Formbricks:**
|
||||
**Initialization of Formbricks:**
|
||||
- During the prebuilds phase, we initialize Formbricks by performing the following tasks:
|
||||
1. Setting up environment variables.
|
||||
2. Installing monorepo dependencies.
|
||||
3. Installing Docker images by extracting them from the `packages/database/docker-compose.yml` file.
|
||||
4. Building the @formbricks/js component.
|
||||
- When the workspace starts:
|
||||
1. Wait for the web and demo apps to launch on Gitpod. This automatically opens the `apps/demo/.env` file. Utilize dynamic localhost URLs (e.g., `localhost:3000` for signup and `localhost:8025` for email confirmation) to configure `NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID`. After creating your account and finding the `ID` in the URL at `localhost:3000`, replace `YOUR_ENVIRONMENT_ID` in the `.env` file located in `app/demo`.
|
||||
1. Wait for the web and demo apps to launch on Gitpod. This automatically opens the `apps/demo/.env` file. Utilize dynamic localhost URLs (e.g., `localhost:3000` for signup and `localhost:8025` for email confirmation) to configure `NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID`. After creating your account and finding the `ID` in the URL at `localhost:3000`, replace `YOUR_ENVIRONMENT_ID` in the `.env` file located in `app/demo`.
|
||||
|
||||
**Web Component Initialization:**
|
||||
**Web Component Initialization:**
|
||||
- we initialize the @formbricks/web component during prebuilds. This involves:
|
||||
1. Installing build dependencies for the `@formbricks/web#go` task from turbo.json in prebuilds to save time.
|
||||
2. Starting PostgreSQL and Mailhog containers for running migrations in prebuilds.
|
||||
@@ -73,95 +75,131 @@ Assistance with setup issues on your local machine may be limited due to varying
|
||||
2. Replacing `NEXT_PUBLIC_WEBAPP_URL` and `NEXTAUTH_URL` to take in Gitpod URL's ports when running on VSCode browser.
|
||||
3. Starting the `@formbricks/web` dev environment.
|
||||
|
||||
**Demo Component Initialization:**
|
||||
**Demo Component Initialization:**
|
||||
- Similar to the web component, the demo component is also initialized during prebuilds. This includes:
|
||||
1. Installing build dependencies for the `formbricks/demo#go` task from turbo.json in prebuilds to save time.
|
||||
2. Caching hits and replaying builds from the `@formbricks/js` component.
|
||||
- When the workspace starts:
|
||||
- When the workspace starts:
|
||||
1. Initializing environment variables.
|
||||
2. Replaces `NEXT_PUBLIC_FORMBRICKS_API_HOST` to take in Gitpod URL's ports when running on VSCode browser.
|
||||
3. Starting the `@formbricks/demo` dev environment.
|
||||
|
||||
**Github Prebuilds Configuration:**
|
||||
**Github Prebuilds Configuration:**
|
||||
- This configures Github Prebuilds for the master branch, pull requests, and adding comments. This helps automate the prebuild process for the specified branches and actions.
|
||||
|
||||
**VSCode Extensions:**
|
||||
**VSCode Extensions:**
|
||||
- This includes a list of VSCode extensions that are added to the configuration when using Gitpod. These extensions can enhance the development experience within Gitpod.
|
||||
|
||||
|
||||
|
||||
### 1. Browser Redirection
|
||||
|
||||
After clicking the one-click setup button, Gitpod will open a new tab or window. Please ensure that your browser allows redirection to successfully access the services:
|
||||
|
||||
### 2. Authorizing in Gitpod
|
||||
<Image src={GitpodAuth} alt="Gitpod Auth Page" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
- This is the Gitpod Authentication Page. It appears when you click the "Open in GitPod" button and Gitpod needs to authenticate your access to the workspace. Click on 'Continue With Github' to authorize your GitPod session.
|
||||
|
||||
<Image src={GitpodAuth} alt="Gitpod Auth Page" quality="100" className="max-w-full rounded-lg sm:max-w-3xl" />-
|
||||
This is the Gitpod Authentication Page. It appears when you click the "Open in GitPod" button and Gitpod needs
|
||||
to authenticate your access to the workspace. Click on 'Continue With Github' to authorize your GitPod session.
|
||||
|
||||
### 3. Creating a New Workspace
|
||||
<Image src={GitpodNewWorkspace} alt="Gitpod New workspace Page" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
- After authentication, Gitpod asks to create a new workspace for you. This page displays the configurations of your workspace.
|
||||
- You can use either choose either VS Code Browser or VS Code Desktop editor with the 'Standard Class' for your workspace class.
|
||||
- If you opt for the VS Code Desktop, follow the following steps
|
||||
1. Gitpod will prompt you to grant access to the VSCode app. Once approved, install the GitPod extension from the VSCode Marketplace and follow the prompts to authorize the integration.
|
||||
2. Change the `WEBAPP_URL` and the `NEXTAUTH_URL` to `https://localhost:3000`
|
||||
|
||||
<Image
|
||||
src={GitpodNewWorkspace}
|
||||
alt="Gitpod New workspace Page"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
- After authentication, Gitpod asks to create a new workspace for you. This page displays the configurations of
|
||||
your workspace. - You can use either choose either VS Code Browser or VS Code Desktop editor with the 'Standard
|
||||
Class' for your workspace class. - If you opt for the VS Code Desktop, follow the following steps 1. Gitpod will
|
||||
prompt you to grant access to the VSCode app. Once approved, install the GitPod extension from the VSCode Marketplace
|
||||
and follow the prompts to authorize the integration. 2. Change the `WEBAPP_URL` and the `NEXTAUTH_URL` to `https://localhost:3000`
|
||||
|
||||
### 4. Gitpod preparing the created Workspace
|
||||
<Image src={GitpodPreparing} alt="Gitpod Preparing workspace Page" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
- Gitpod is preparing your workspace with all the necessary dependencies and configurations. You will see this page while Gitpod sets up your development environment.
|
||||
|
||||
<Image
|
||||
src={GitpodPreparing}
|
||||
alt="Gitpod Preparing workspace Page"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
- Gitpod is preparing your workspace with all the necessary dependencies and configurations. You will see this
|
||||
page while Gitpod sets up your development environment.
|
||||
|
||||
### 5. Gitpod running the Workspace
|
||||
<Image src={GitpodRunning} alt="Gitpod Running Workspace Page" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
- Once the workspace is fully prepared, voila, it enters the running state. You can start working on your project in this environment.
|
||||
|
||||
<Image
|
||||
src={GitpodRunning}
|
||||
alt="Gitpod Running Workspace Page"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
- Once the workspace is fully prepared, voila, it enters the running state. You can start working on your project
|
||||
in this environment.
|
||||
|
||||
### Ports and Services
|
||||
|
||||
Here are the ports and corresponding URLs for the services within your Gitpod environment:
|
||||
|
||||
- **Port 3000**:
|
||||
- **Service**: Demo App
|
||||
- **Description**: This port hosts the demo application of your project. You can access and interact with your application's demo by navigating to this port.
|
||||
|
||||
- **Service**: Demo App
|
||||
- **Description**: This port hosts the demo application of your project. You can access and interact with your application's demo by navigating to this port.
|
||||
|
||||
- **Port 3001**:
|
||||
- **Service**: Formbricks website
|
||||
- **Description**: This port hosts the [Formbricks](https://formbricks.com) website, which contains documents, pricing, blogs, best practices, and concierge service.
|
||||
|
||||
- **Service**: Formbricks website
|
||||
- **Description**: This port hosts the [Formbricks](https://formbricks.com) website, which contains documents, pricing, blogs, best practices, and concierge service.
|
||||
|
||||
- **Port 3002**:
|
||||
- **Service**: Formbricks In-product Survey Demo App
|
||||
- **Description**: This app helps you test your in-app surveys. You can create and test user actions, create and update user attributes, etc.
|
||||
|
||||
- **Service**: Formbricks In-product Survey Demo App
|
||||
- **Description**: This app helps you test your in-app surveys. You can create and test user actions, create and update user attributes, etc.
|
||||
|
||||
- **Port 5432**:
|
||||
- **Service**: PostgreSQL Database Server
|
||||
- **Description**: The PostgreSQL DB is hosted on this port.
|
||||
|
||||
- **Service**: PostgreSQL Database Server
|
||||
- **Description**: The PostgreSQL DB is hosted on this port.
|
||||
|
||||
- **Port 1025**:
|
||||
- **Service**: SMPT server
|
||||
- **Description**: SMTP Server for sending and receiving email messages. This server is responsible for handling email communication.
|
||||
|
||||
- **Service**: SMPT server
|
||||
- **Description**: SMTP Server for sending and receiving email messages. This server is responsible for handling email communication.
|
||||
|
||||
- **Port 8025**:
|
||||
- **Service**: Mailhog
|
||||
- **Service**: Mailhog
|
||||
|
||||
### Accessing port URLs
|
||||
1. **Direct URL Composition**:
|
||||
- You can access the dedicated port URL by pre-pending the port number to the workspace URL.
|
||||
- For example, if you want to access port 3000, you can use the URL format: `3000-yourworkspace.ws-eu45.gitpod.io`.
|
||||
|
||||
2. **Using [gp CLI](https://www.gitpod.io/docs/references/gitpod-cli)**:
|
||||
- Gitpod provides a convenient command, `gp url`, to quickly retrieve the URL for a specific port.
|
||||
- Simply use the command followed by the desired port number. For example, to get the URL for port 3000, run: `gp url 3000`.
|
||||
1. **Direct URL Composition**:
|
||||
|
||||
3. **Listing All Open Port URLs**:
|
||||
- If you prefer to see a list of all open port URLs at once, you can use the `gp ports list` command.
|
||||
- Running this command will display a list of ports along with their corresponding URLs.
|
||||
- You can access the dedicated port URL by pre-pending the port number to the workspace URL.
|
||||
- For example, if you want to access port 3000, you can use the URL format: `3000-yourworkspace.ws-eu45.gitpod.io`.
|
||||
|
||||
4. **Viewing All Ports in Panel**:
|
||||
- Gitpod also offers a user-friendly 'Ports' tab in the Gitpod panel.
|
||||
- Click on the 'Ports' tab to view a list of all open ports and their respective URLs.
|
||||
2. **Using [gp CLI](https://www.gitpod.io/docs/references/gitpod-cli)**:
|
||||
|
||||
<Image src={GitpodPorts} alt="Gitpod Ports tab" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
- Gitpod provides a convenient command, `gp url`, to quickly retrieve the URL for a specific port.
|
||||
- Simply use the command followed by the desired port number. For example, to get the URL for port 3000, run: `gp url 3000`.
|
||||
|
||||
These URLs and port numbers represent various services and endpoints within your Gitpod environment. You can access and interact with these services by the Port URL for the respective service.
|
||||
3. **Listing All Open Port URLs**:
|
||||
|
||||
- If you prefer to see a list of all open port URLs at once, you can use the `gp ports list` command.
|
||||
- Running this command will display a list of ports along with their corresponding URLs.
|
||||
|
||||
4. **Viewing All Ports in Panel**:
|
||||
|
||||
- Gitpod also offers a user-friendly 'Ports' tab in the Gitpod panel.
|
||||
- Click on the 'Ports' tab to view a list of all open ports and their respective URLs.
|
||||
|
||||
{" "}
|
||||
|
||||
<Image
|
||||
src={GitpodPorts}
|
||||
alt="Gitpod Ports tab"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
These URLs and port numbers represent various services and endpoints within your Gitpod environment. You can access and interact with these services by the Port URL for the respective service.
|
||||
|
||||
---
|
||||
|
||||
@@ -169,21 +207,41 @@ Here are the ports and corresponding URLs for the services within your Gitpod en
|
||||
|
||||
1. After clicking the one-click setup button, you will be redirected to the Github Codespaces page. Review the configuration and click on the 'Create Codespace' button to create a new Codespace.
|
||||
|
||||
<Image src={GithubCodespaceNew} alt="New Github Codespace" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
<Image
|
||||
src={GithubCodespaceNew}
|
||||
alt="New Github Codespace"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
2. This will start loading the Codespace. Keep in mind this might take a few minutes to complete depending on your internet connection and the instance availability.
|
||||
|
||||
<Image src={GithubCodespaceLoading} alt="Loading Github Codespace" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
<Image
|
||||
src={GithubCodespaceLoading}
|
||||
alt="Loading Github Codespace"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
3. Once the Codespace is loaded, you will be redirected to the VSCode editor. You can start working on your project in this environment.
|
||||
|
||||
4. Make the changes you want to, and now, to run the app, we first need to configure the .env file. Copy the .env.example and edit the variables as mentioned in the file itself.
|
||||
|
||||
<Image src={GithubCodespaceEnvFile} alt="Github Codespace Env File" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
<Image
|
||||
src={GithubCodespaceEnvFile}
|
||||
alt="Github Codespace Env File"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
5. Once you have configured the .env, it's now time to run the app and see the changes. Lets open the terminal first
|
||||
|
||||
<Image src={GithubCodespaceTerminal} alt="Github Codespace Open Terminal" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
<Image
|
||||
src={GithubCodespaceTerminal}
|
||||
alt="Github Codespace Open Terminal"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
6. Now, run the following command to run the app
|
||||
|
||||
@@ -197,7 +255,12 @@ pnpm dev
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
|
||||
<Image src={GithubCodespaceRun} alt="Run on Github Codespace" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
<Image
|
||||
src={GithubCodespaceRun}
|
||||
alt="Run on Github Codespace"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
7. Monitor the logs in the terminal and once you see the following, you are good to go!
|
||||
|
||||
@@ -210,7 +273,7 @@ pnpm dev
|
||||
@formbricks/web:dev: - Environments: .env
|
||||
@formbricks/web:dev: - Experiments (use at your own risk):
|
||||
@formbricks/web:dev: · serverActions
|
||||
@formbricks/web:dev:
|
||||
@formbricks/web:dev:
|
||||
@formbricks/web:dev: ✓ Ready in 9.4s
|
||||
```
|
||||
|
||||
@@ -219,10 +282,123 @@ pnpm dev
|
||||
|
||||
8. Right next to the Terminal, you will see a **Ports** tab, click on it to see the ports and their respective URLs. Now access the Forwarded Address for port 3000 and you should be able to visit your Formbricks App!
|
||||
|
||||
<Image src={GithubCodespacePorts} alt="Github Codespace Ports" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
|
||||
<Image
|
||||
src={GithubCodespacePorts}
|
||||
alt="Github Codespace Ports"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
Now make the changes you want to and see them live in action!
|
||||
|
||||
---
|
||||
|
||||
Still can’t figure it out? Join our [Discord](https://discord.com/invite/3YFcABF2Ts)!
|
||||
## Local Machine Setup
|
||||
|
||||
<Note>
|
||||
The below only works for **Mac**, **Linux** & **WSL2** on Windows (not on pure Windows)!
|
||||
|
||||
This method is recommended **only for advanced users** & we won't be able to provide official support for this.
|
||||
|
||||
</Note>
|
||||
|
||||
To get the project running locally on your machine you need to have the following development tools installed:
|
||||
|
||||
- Node.JS (we recommend v20)
|
||||
- [pnpm](https://pnpm.io/)
|
||||
- [Docker](https://www.docker.com/) (to run PostgreSQL / MailHog)
|
||||
|
||||
1. Clone the project & move into the directory:
|
||||
|
||||
<Col>
|
||||
<CodeGroup title="Git clone Formbricks monorepo">
|
||||
|
||||
```bash
|
||||
git clone https://github.com/formbricks/formbricks && cd formbricks
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
|
||||
2. Install Node.JS packages via pnpm. Don't have pnpm? Get it [here](https://pnpm.io/installation)
|
||||
|
||||
<Col>
|
||||
<CodeGroup title="Install dependencies via pnpm">
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
|
||||
3. Create a `.env` file based on `.env.example`. It's already preset to work with the local development setup but you can also change values if needed.
|
||||
|
||||
<Col>
|
||||
<CodeGroup title="Define environment variables">
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
|
||||
4. Generate & set some secret values mandatory for the ENCRYPTION_KEY & NEXTAUTH_SECRET in the .env file. You can use the following command to generate the random string of required length:
|
||||
|
||||
<Col>
|
||||
<CodeGroup title="Set value of ENCRYPTION_KEY">
|
||||
|
||||
```bash
|
||||
sed -i '/^ENCRYPTION_KEY=/c\ENCRYPTION_KEY='$(openssl rand -hex 32) .env
|
||||
sed -i '/^NEXTAUTH_SECRET=/c\NEXTAUTH_SECRET='$(openssl rand -hex 32) .env
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
|
||||
5. Make sure you have [`Docker`](https://docs.docker.com/compose/) & [`docker-compose`](https://docs.docker.com/compose/) installed and running on your machine. Then run the following command to start the Formbricks dev setup:
|
||||
|
||||
<Col>
|
||||
<CodeGroup title="Start Formbricks Dev Setup">
|
||||
|
||||
```bash
|
||||
pnpm go
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
This starts the Formbricks main app (plus all its dependencies) as well as the following services using Docker:
|
||||
|
||||
- a `postgres` container for hosting your database,
|
||||
- a `mailhog` container that acts as a mock SMTP server and shows received mails in a web UI (forwarded to your host's `localhost:8025`)
|
||||
- Demo App at [http://localhost:3002](http://localhost:3002)
|
||||
- Landing Page at [http://localhost:3001](http://localhost:3001)
|
||||
|
||||
**You can now access the Formbricks app on [http://localhost:3000](http://localhost:3000)**. You will be automatically redirected to the login. To use your local installation of formbricks, create a new account.
|
||||
|
||||
{" "}
|
||||
|
||||
<Note>
|
||||
A fresh setup does not have a default account. Please create a new account and proceed accordingly.
|
||||
</Note>
|
||||
|
||||
For viewing the emails sent by the system, you can access mailhog at [http://localhost:8025](http://localhost:8025)
|
||||
|
||||
### Build
|
||||
|
||||
To build all apps and packages and check for build errors, run the following command:
|
||||
|
||||
<Col>
|
||||
<CodeGroup title="Build Formbricks stack">
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
|
||||
---
|
||||
|
||||
Still can’t figure it out? Join our [Discord](https://discord.com/invite/3YFcABF2Ts)!
|
||||
|
||||
@@ -45,7 +45,7 @@ All you need to do is copy a `<script>` tag to your HTML head, and that’s abou
|
||||
```html {{ title: 'index.html' }}
|
||||
<!-- START Formbricks Surveys -->
|
||||
<script type="text/javascript">
|
||||
!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://unpkg.com/@formbricks/js@^1.2.0/dist/index.umd.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),setTimeout(function(){window.formbricks.init({environmentId: "<your-environment-id>", apiHost: "<api-host>"})},500)}();
|
||||
!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://unpkg.com/@formbricks/js@^1.4.0/dist/index.umd.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),setTimeout(function(){window.formbricks.init({environmentId: "<your-environment-id>", apiHost: "<api-host>"})},500)}();
|
||||
</script>
|
||||
<!-- END Formbricks Surveys -->
|
||||
```
|
||||
|
||||
@@ -10,8 +10,9 @@ import DeleteConnection from "./delete-connection.webp";
|
||||
import Image from "next/image";
|
||||
|
||||
export const metadata = {
|
||||
title: "n8n Setup",
|
||||
description: "Wire up Formbricks with n8n and 350+ other apps",
|
||||
title: "Google Sheets",
|
||||
description:
|
||||
"The Google Sheets integration allows you to automatically send responses to a Google Sheet of your choice.",
|
||||
};
|
||||
|
||||
#### Integrations
|
||||
@@ -62,7 +63,7 @@ Before the next step, make sure that you have a Formbricks Survey with at least
|
||||
|
||||
</Note>
|
||||
|
||||
6. Now click on the "Link New Sheet" button to link a new Google Sheet with Formbricks and a modal will open up.
|
||||
5. Now click on the "Link New Sheet" button to link a new Google Sheet with Formbricks and a modal will open up.
|
||||
|
||||
<Image
|
||||
src={LinkSurveyWithSheet}
|
||||
@@ -71,17 +72,16 @@ Before the next step, make sure that you have a Formbricks Survey with at least
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
7. Select the Google Sheet you want to link with Formbricks and the Survey. On doing so, you will be asked with what questions' responses you want to feed in the Google Sheet. Select the questions and click on the "Link Sheet" button.
|
||||
6. Select the Google Sheet you want to link with Formbricks and the Survey. On doing so, you will be asked with what questions' responses you want to feed in the Google Sheet. Select the questions and click on the "Link Sheet" button.
|
||||
|
||||
<Image
|
||||
src={LinkWithQuestions}
|
||||
alt="Select question to link with Google Sheet"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
|
||||
/>
|
||||
|
||||
8. On submitting, the modal will close and you will see the linked Google Sheet in the list of linked Google Sheets.
|
||||
7. On submitting, the modal will close and you will see the linked Google Sheet in the list of linked Google Sheets.
|
||||
|
||||
<Image
|
||||
src={ListLinkedSurveys}
|
||||
|
||||
|
After Width: | Height: | Size: 653 KiB |
|
After Width: | Height: | Size: 498 KiB |
|
After Width: | Height: | Size: 386 KiB |
|
After Width: | Height: | Size: 836 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 384 KiB |
|
After Width: | Height: | Size: 462 KiB |
126
apps/formbricks-com/app/docs/integrations/notion/page.mdx
Normal file
@@ -0,0 +1,126 @@
|
||||
import IntegrationsTab from "./images/integrations-tab.png";
|
||||
import ConnectWithNotion from "./images/connect-with-notion.png";
|
||||
import NotionConnected from "./images/notion-connected.png";
|
||||
import LinkSurveyWithDatabase from "./images/link-survey-with-database.png";
|
||||
import LinkWithDatabases from "./images/link-with-databases.png";
|
||||
import ListLinkedDatabases from "./images/list-linked-databases.png";
|
||||
import DeleteConnection from "./images/delete-connection.png";
|
||||
import Image from "next/image";
|
||||
|
||||
export const metadata = {
|
||||
title: "Notion",
|
||||
description:
|
||||
"The notion integration allows you to automatically send responses to a Notion database of your choice.",
|
||||
};
|
||||
|
||||
#### Integrations
|
||||
|
||||
# Notion
|
||||
|
||||
The notion integration allows you to automatically send responses to a Notion database of your choice.
|
||||
|
||||
<Note>
|
||||
This feature is enabled by default in Formbricks Cloud but needs to be self-configured when running a
|
||||
self-hosted version of Formbricks.
|
||||
</Note>
|
||||
|
||||
## Formbricks Cloud
|
||||
|
||||
1. Go to the Integrations tab in your [Formbricks Cloud dashboard](https://app.formbricks.com/) and click on the "Connect" button under Notion integration.
|
||||
|
||||
<Image
|
||||
src={IntegrationsTab}
|
||||
alt="Formbricks Integrations Tab"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
2. Now click on the "Connect with Notion" button to authenticate yourself with Notion.
|
||||
|
||||
<Image
|
||||
src={ConnectWithNotion}
|
||||
alt="Connect Formbricks with your Notion account"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
3. You will now be taken to the Notion OAuth page where you can select the Notion account you want to use for the integration
|
||||
|
||||
4. Once you have selected the account and databases and completed the authentication and authorization process, you will be taken back to Formbricks Cloud and see the connected status as below:
|
||||
|
||||
<Image
|
||||
src={NotionConnected}
|
||||
alt="Formbricks is now connected with Notion"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
<Note>
|
||||
Before the next step, make sure that you have a Formbricks Survey with at least one question and a Notion
|
||||
database in the Notion account you integrated.
|
||||
</Note>
|
||||
|
||||
5. Now click on the "Link New Database" button to link a new Notion database with Formbricks and a modal will open up.
|
||||
|
||||
<Image
|
||||
src={LinkSurveyWithDatabase}
|
||||
alt="Link Formbricks with a Notion database"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
6. Select the Notion database you want to link with Formbricks and the Survey. On doing so, you will be asked to map formbricks' survey questions with selected databases' column. Complete the mapping and click on the "Link Database" button.
|
||||
|
||||
<Image
|
||||
src={LinkWithDatabases}
|
||||
alt="Question to notion database column mapping"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
7. On submitting, the modal will close and you will see the linked Notion database in the list of linked Notion databases.
|
||||
|
||||
<Image
|
||||
src={ListLinkedDatabases}
|
||||
alt="List of linked notion databases"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
Congratulations! You have successfully linked a Notion database with Formbricks. Now whenever a response is submitted for the linked Survey, it will be automatically added to the linked Notion database.
|
||||
|
||||
## Setup in self-hosted Formbricks
|
||||
|
||||
Enabling the Notion Integration in a self-hosted environment requires a setup using Notion account and changing the environment variables of your Formbricks instance.
|
||||
|
||||
1. Sign up for a [Notion](https://www.notion.so/) account, if you don't have one already.
|
||||
2. Go to the [my integrations](https://www.notion.so/my-integrations) page and click on **New integration**.
|
||||
3. Fill up the basic information like **Name**, **Logo** and click on **Submit**.
|
||||
4. Now, click on **Distribution** tab on the sidebar. A text will appear which will ask you to make the integration public. Click on that toggle button. A form will appear below the text.
|
||||
5. Now provide it the details such as requested. Under **Redirect URIs** field:
|
||||
- If you are running formbricks locally, you can enter `http://localhost:3000/api/v1/integrations/notion/callback`.
|
||||
- Or, you can enter `https://<your-public-facing-url>/api/v1/integrations/notion/callback`
|
||||
6. Once you've filled all the necessary details, click on **Submit**.
|
||||
7. A screen will appear which will have **Client ID**, **Client secret** and **Authorization URL**. Copy them and set them as the environment variables in your Formbricks instance as:
|
||||
- `NOTION_OAUTH_CLIENT_ID` - OAuth Client ID
|
||||
- `NOTION_OAUTH_CLIENT_SECRET` - OAuth Client Secret
|
||||
|
||||
Voila! You have successfully enabled the Notion integration in your self-hosted Formbricks instance. Now you can follow the steps mentioned in the [Formbricks Cloud](#formbricks-cloud) section to link a Notion database with Formbricks.
|
||||
|
||||
## Remove Integration with Notion Account
|
||||
|
||||
To remove the integration with Notion Account,
|
||||
|
||||
1. Visit the Integrations tab in your Formbricks Cloud dashboard.
|
||||
2. Select "Manage" button in the Notion card.
|
||||
3. Click on the "Connected with `<your-workspace-name-here`> Workspace" just before the "Link new Database" button.
|
||||
4. It will now ask for a confirmation to remove the integration. Click on the "Delete" button to remove the integration. You can always come back and connect again with the same Notion Account.
|
||||
|
||||
<Image
|
||||
src={DeleteConnection}
|
||||
alt="Delete Notion Integration with Formbricks"
|
||||
quality="100"
|
||||
className="max-w-full rounded-lg sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
Still struggling or something not working as expected? [Join our Discord!](https://formbricks.com/discord) and we'd be glad to assist you!
|
||||
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 36 KiB |
@@ -1,3 +1,11 @@
|
||||
import Image from "next/image";
|
||||
|
||||
import FormBuilder from "./form-builder.webp";
|
||||
import Targeting from "./targeting.webp";
|
||||
import Trigger from "./trigger.webp";
|
||||
import integrations from "./integrations.webp";
|
||||
import Analytics from "./analytics.webp";
|
||||
|
||||
export const metadata = {
|
||||
title: "Inside Look: Formbricks In-Product Micro-Surveys",
|
||||
description:
|
||||
@@ -21,14 +29,49 @@ Formbricks is a powerful platform designed to help you create and manage in-prod
|
||||
|
||||
The Form Builder is where you create and customize your micro-surveys. With its intuitive drag-and-drop interface, you can easily add different question types, set response options, and apply your branding to the survey forms. The Form Builder allows you to preview your survey in real-time, ensuring it looks and feels perfect for your users.
|
||||
|
||||
<Image
|
||||
src={FormBuilder}
|
||||
alt="Create & Customize Surveys No Code with Formbricks"
|
||||
quality="100"
|
||||
className="rounded-lg max-w-full sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
## Targeting & Triggers
|
||||
|
||||
Formbricks offers fine-grained user targeting and event-based triggers to help you display your surveys to the most relevant audience. Using the platform, you can define user segments based on attributes and behaviors, and set up triggers to show your surveys at specific moments within your product. This ensures that you're capturing the most accurate and valuable feedback possible.
|
||||
|
||||
<Image
|
||||
src={Targeting}
|
||||
alt="Targeting & Triggers with Formbricks"
|
||||
quality="100"
|
||||
className="rounded-lg w-full sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
<Image
|
||||
src={Trigger}
|
||||
alt="Targeting & Triggers with Formbricks"
|
||||
quality="100"
|
||||
className="rounded-lg max-w-full sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
## Integration
|
||||
|
||||
Integrating Formbricks into your web or mobile application is a breeze. With SDKs for popular web frameworks like React, and an HTML snippet for non-framework based websites, you can quickly add Formbricks to your project. The provided code snippets make it easy to initialize the Formbricks widget and configure it to communicate with your backend.
|
||||
|
||||
<Image
|
||||
src={integrations}
|
||||
alt="Integrations with Formbricks"
|
||||
quality="100"
|
||||
className="rounded-lg max-w-full sm:max-w-3xl"
|
||||
/>
|
||||
|
||||
## Analytics & Insights
|
||||
|
||||
Formbricks provides powerful analytics and insights to help you understand user responses and make data-driven decisions. The platform aggregates survey results and presents them in an easy-to-understand format, enabling you to identify trends, spot issues, and uncover opportunities for improvement. With Formbricks, you're always one step ahead in understanding your users and optimizing your product experience.
|
||||
|
||||
<Image
|
||||
src={Analytics}
|
||||
alt="Analytics & Insights with Formbricks"
|
||||
quality="100"
|
||||
className="rounded-lg max-w-full sm:max-w-3xl"
|
||||
/>
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 35 KiB |
@@ -73,7 +73,7 @@ const bestPractices: Array<BestPractice> = [
|
||||
|
||||
function BestPracticeIcon({ icon: Icon }: { icon: BestPractice["icon"] }) {
|
||||
return (
|
||||
<div className="dark:bg-white/7.5 dark:ring-white/15 flex h-7 w-7 items-center justify-center rounded-full bg-slate-900/5 ring-1 ring-slate-900/25 backdrop-blur-[2px] transition duration-300 group-hover:bg-white/50 group-hover:ring-slate-900/25 dark:group-hover:bg-emerald-300/10 dark:group-hover:ring-emerald-400">
|
||||
<div className="dark:bg-white/7.5 flex h-7 w-7 items-center justify-center rounded-full bg-slate-900/5 ring-1 ring-slate-900/25 backdrop-blur-[2px] transition duration-300 group-hover:bg-white/50 group-hover:ring-slate-900/25 dark:ring-white/15 dark:group-hover:bg-emerald-300/10 dark:group-hover:ring-emerald-400">
|
||||
<Icon className="h-5 w-5 fill-slate-700/10 stroke-slate-700 transition-colors duration-300 group-hover:stroke-slate-900 dark:fill-white/10 dark:stroke-slate-400 dark:group-hover:fill-emerald-300/10 dark:group-hover:stroke-emerald-400" />
|
||||
</div>
|
||||
);
|
||||
@@ -157,7 +157,7 @@ export default function BestPractices() {
|
||||
<Heading level={2} id="resources">
|
||||
Best Practices
|
||||
</Heading>
|
||||
<div className="not-prose mt-4 grid grid-cols-1 gap-8 border-t border-slate-900/5 pt-10 dark:border-white/5 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div className="not-prose mt-4 grid grid-cols-1 gap-8 border-t border-slate-900/5 pt-10 sm:grid-cols-2 xl:grid-cols-4 dark:border-white/5">
|
||||
{bestPractices.map((resource) => (
|
||||
<BestPractice key={resource.href} resource={resource} />
|
||||
))}
|
||||
|
||||
@@ -89,7 +89,7 @@ function SmallPrint() {
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-between gap-5 border-t border-slate-900/5 pt-8 dark:border-white/5 sm:flex-row">
|
||||
<div className="flex flex-col items-center justify-between gap-5 border-t border-slate-900/5 pt-8 sm:flex-row dark:border-white/5">
|
||||
<p className="text-xs text-slate-600 dark:text-slate-400">
|
||||
Formbricks GmbH © {currentYear}. All rights reserved.
|
||||
</p>
|
||||
|
||||
@@ -31,7 +31,7 @@ export function GettingStarted() {
|
||||
<Heading level={2} id="getting-started">
|
||||
Quick Resources
|
||||
</Heading>
|
||||
<div className="not-prose mt-4 grid grid-cols-1 gap-8 border-t border-slate-900/5 pt-10 dark:border-white/5 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div className="not-prose mt-4 grid grid-cols-1 gap-8 border-t border-slate-900/5 pt-10 sm:grid-cols-2 xl:grid-cols-4 dark:border-white/5">
|
||||
{gettingStarted.map((guide) => (
|
||||
<div key={guide.href}>
|
||||
<h3 className="text-sm font-semibold text-slate-900 dark:text-white">{guide.name}</h3>
|
||||
|
||||
@@ -40,7 +40,7 @@ export const Header = forwardRef<React.ElementRef<"div">, { className?: string }
|
||||
className={clsx(
|
||||
className,
|
||||
"fixed inset-x-0 top-0 z-50 flex h-20 items-center justify-between gap-12 px-4 transition sm:px-6 lg:left-72 lg:z-30 lg:px-8 xl:left-80",
|
||||
!isInsideMobileNavigation && "backdrop-blur-sm dark:backdrop-blur lg:left-72 xl:left-80",
|
||||
!isInsideMobileNavigation && "backdrop-blur-sm lg:left-72 xl:left-80 dark:backdrop-blur",
|
||||
isInsideMobileNavigation
|
||||
? "bg-white dark:bg-slate-900"
|
||||
: "bg-white/[var(--bg-opacity-light)] dark:bg-slate-900/[var(--bg-opacity-dark)]"
|
||||
@@ -73,7 +73,7 @@ export const Header = forwardRef<React.ElementRef<"div">, { className?: string }
|
||||
<TopLevelNavItem href="https://formbricks.com/discord">Join our Discord</TopLevelNavItem>
|
||||
</ul>
|
||||
</nav>
|
||||
<div className="md:dark:bg-white/15 hidden md:block md:h-5 md:w-px md:bg-slate-900/10" />
|
||||
<div className="hidden md:block md:h-5 md:w-px md:bg-slate-900/10 md:dark:bg-white/15" />
|
||||
<div className="flex gap-4">
|
||||
<MobileSearch />
|
||||
<ThemeToggle />
|
||||
|
||||
@@ -25,7 +25,7 @@ export function Layout({
|
||||
<motion.header
|
||||
layoutScroll
|
||||
className="contents lg:pointer-events-none lg:fixed lg:inset-0 lg:z-40 lg:flex">
|
||||
<div className="contents lg:pointer-events-auto lg:block lg:w-72 lg:overflow-y-auto lg:border-r lg:border-slate-900/10 lg:px-6 lg:pb-8 lg:pt-4 lg:dark:border-white/10 xl:w-80">
|
||||
<div className="contents lg:pointer-events-auto lg:block lg:w-72 lg:overflow-y-auto lg:border-r lg:border-slate-900/10 lg:px-6 lg:pb-8 lg:pt-4 xl:w-80 lg:dark:border-white/10">
|
||||
<div className="hidden lg:flex">
|
||||
<Link href="/" aria-label="Home">
|
||||
<FooterLogo className="h-8" />
|
||||
|
||||
@@ -37,7 +37,7 @@ const libraries = [
|
||||
export function Libraries() {
|
||||
return (
|
||||
<div className="my-16 xl:max-w-none">
|
||||
<div className="not-prose mt-4 grid grid-cols-1 gap-x-6 gap-y-10 border-slate-900/5 dark:border-white/5 sm:grid-cols-2 xl:max-w-none xl:grid-cols-3">
|
||||
<div className="not-prose mt-4 grid grid-cols-1 gap-x-6 gap-y-10 border-slate-900/5 sm:grid-cols-2 xl:max-w-none xl:grid-cols-3 dark:border-white/5">
|
||||
{libraries.map((library) => (
|
||||
<a
|
||||
key={library.name}
|
||||
|
||||
@@ -90,7 +90,7 @@ function MobileNavigationDialog({ isOpen, close }: { isOpen: boolean; close: ()
|
||||
leaveTo="-translate-x-full">
|
||||
<motion.div
|
||||
layoutScroll
|
||||
className="ring-slate-900/7.5 fixed bottom-0 left-0 top-14 w-full overflow-y-auto bg-white px-4 pb-4 pt-6 shadow-lg shadow-slate-900/10 ring-1 dark:bg-slate-900 dark:ring-slate-800 min-[416px]:max-w-sm sm:px-6 sm:pb-10">
|
||||
className="ring-slate-900/7.5 fixed bottom-0 left-0 top-14 w-full overflow-y-auto bg-white px-4 pb-4 pt-6 shadow-lg shadow-slate-900/10 ring-1 min-[416px]:max-w-sm sm:px-6 sm:pb-10 dark:bg-slate-900 dark:ring-slate-800">
|
||||
<Navigation />
|
||||
</motion.div>
|
||||
</Transition.Child>
|
||||
|
||||
@@ -237,6 +237,7 @@ export const navigation: Array<NavGroup> = [
|
||||
links: [
|
||||
{ title: "Airtable", href: "/docs/integrations/airtable" },
|
||||
{ title: "Google Sheets", href: "/docs/integrations/google-sheets" },
|
||||
{ title: "Notion", href: "/docs/integrations/notion" },
|
||||
{ title: "Make.com", href: "/docs/integrations/make" },
|
||||
{ title: "n8n", href: "/docs/integrations/n8n" },
|
||||
{ title: "Zapier", href: "/docs/integrations/zapier" },
|
||||
|
||||
@@ -243,7 +243,7 @@ const SearchInput = forwardRef<
|
||||
<input
|
||||
ref={inputRef}
|
||||
className={clsx(
|
||||
"flex-auto appearance-none bg-transparent pl-10 text-slate-900 outline-none placeholder:text-slate-500 focus:w-full focus:flex-none dark:text-white sm:text-sm [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden",
|
||||
"flex-auto appearance-none bg-transparent pl-10 text-slate-900 outline-none placeholder:text-slate-500 focus:w-full focus:flex-none sm:text-sm dark:text-white [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden",
|
||||
autocompleteState.status === "stalled" ? "pr-11" : "pr-4"
|
||||
)}
|
||||
{...inputProps}
|
||||
@@ -336,7 +336,7 @@ function SearchDialog({
|
||||
leave="ease-in duration-200"
|
||||
leaveFrom="opacity-100 scale-100"
|
||||
leaveTo="opacity-0 scale-95">
|
||||
<Dialog.Panel className="ring-slate-900/7.5 mx-auto transform-gpu overflow-hidden rounded-lg bg-slate-50 shadow-xl ring-1 dark:bg-slate-900 dark:ring-slate-800 sm:max-w-xl">
|
||||
<Dialog.Panel className="ring-slate-900/7.5 mx-auto transform-gpu overflow-hidden rounded-lg bg-slate-50 shadow-xl ring-1 sm:max-w-xl dark:bg-slate-900 dark:ring-slate-800">
|
||||
<div {...autocomplete.getRootProps({})}>
|
||||
<form
|
||||
ref={formRef}
|
||||
@@ -409,7 +409,7 @@ export function Search() {
|
||||
<div className="hidden lg:block lg:max-w-md lg:flex-auto">
|
||||
<button
|
||||
type="button"
|
||||
className="ui-not-focus-visible:outline-none hidden h-8 w-full items-center gap-2 rounded-full bg-white pl-2 pr-3 text-sm text-slate-500 ring-1 ring-slate-900/10 transition hover:ring-slate-900/20 dark:bg-white/5 dark:text-slate-400 dark:ring-inset dark:ring-white/10 dark:hover:ring-white/20 lg:flex"
|
||||
className="ui-not-focus-visible:outline-none hidden h-8 w-full items-center gap-2 rounded-full bg-white pl-2 pr-3 text-sm text-slate-500 ring-1 ring-slate-900/10 transition hover:ring-slate-900/20 lg:flex dark:bg-white/5 dark:text-slate-400 dark:ring-inset dark:ring-white/10 dark:hover:ring-white/20"
|
||||
{...buttonProps}>
|
||||
<SearchIcon className="h-5 w-5 stroke-current" />
|
||||
Find something...
|
||||
@@ -432,7 +432,7 @@ export function MobileSearch() {
|
||||
<div className="contents lg:hidden">
|
||||
<button
|
||||
type="button"
|
||||
className="ui-not-focus-visible:outline-none flex h-6 w-6 items-center justify-center rounded-md transition hover:bg-slate-900/5 dark:hover:bg-white/5 lg:hidden"
|
||||
className="ui-not-focus-visible:outline-none flex h-6 w-6 items-center justify-center rounded-md transition hover:bg-slate-900/5 lg:hidden dark:hover:bg-white/5"
|
||||
aria-label="Find something..."
|
||||
{...buttonProps}>
|
||||
<SearchIcon className="h-5 w-5 stroke-slate-900 dark:stroke-white" />
|
||||
|
||||
@@ -55,7 +55,7 @@ export const AddNoCodeEventModalDummy: React.FC<EventDetailModalProps> = ({ open
|
||||
Inner Text
|
||||
</Label>
|
||||
</div>
|
||||
<div className="hidden items-center space-x-2 rounded-lg bg-slate-50 p-3 dark:bg-slate-600 md:flex">
|
||||
<div className="hidden items-center space-x-2 rounded-lg bg-slate-50 p-3 md:flex dark:bg-slate-600">
|
||||
<RadioGroupItem disabled value="cssSelector" id="cssSelector" className="bg-slate-50" />
|
||||
<Label
|
||||
htmlFor="cssSelector"
|
||||
@@ -80,7 +80,7 @@ export const AddNoCodeEventModalDummy: React.FC<EventDetailModalProps> = ({ open
|
||||
<Label>URL</Label>
|
||||
<Select defaultValue="endsWith">
|
||||
<SelectTrigger
|
||||
className="w-[110px] dark:text-slate-200 md:w-[180px]"
|
||||
className="w-[110px] md:w-[180px] dark:text-slate-200"
|
||||
onClick={(e) => e.preventDefault()}
|
||||
disabled>
|
||||
<SelectValue placeholder="Select match type" />
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function SurveyTemplatesPage({}) {
|
||||
setActiveTemplate(template);
|
||||
}}
|
||||
/>
|
||||
<aside className="group relative h-full flex-1 flex-shrink-0 overflow-hidden rounded-r-lg bg-slate-200 shadow-inner dark:bg-slate-700 md:flex md:flex-col">
|
||||
<aside className="group relative h-full flex-1 flex-shrink-0 overflow-hidden rounded-r-lg bg-slate-200 shadow-inner md:flex md:flex-col dark:bg-slate-700">
|
||||
{activeTemplate && (
|
||||
<PreviewSurvey
|
||||
activeQuestionId={activeQuestionId}
|
||||
|
||||
@@ -22,7 +22,7 @@ export default function Modal({
|
||||
<div
|
||||
className={cn(
|
||||
show ? "translate-x-0 opacity-100" : "translate-x-28 opacity-0",
|
||||
"pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white px-4 py-6 shadow-lg ring-1 ring-black ring-opacity-5 transition-all duration-500 ease-in-out dark:bg-slate-900 sm:p-6"
|
||||
"pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white px-4 py-6 shadow-lg ring-1 ring-black ring-opacity-5 transition-all duration-500 ease-in-out sm:p-6 dark:bg-slate-900"
|
||||
)}>
|
||||
{children}
|
||||
</div>
|
||||
|
||||
@@ -42,7 +42,7 @@ export default function OpenTextQuestion({
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
placeholder={question.placeholder}
|
||||
required={question.required}
|
||||
className="block w-full rounded-md border border-slate-100 bg-slate-50 p-2 shadow-sm focus:border-slate-500 focus:ring-0 dark:border-slate-500 dark:bg-slate-700 dark:text-white sm:text-sm"></textarea>
|
||||
className="block w-full rounded-md border border-slate-100 bg-slate-50 p-2 shadow-sm focus:border-slate-500 focus:ring-0 sm:text-sm dark:border-slate-500 dark:bg-slate-700 dark:text-white"></textarea>
|
||||
</div>
|
||||
<div className="mt-4 flex w-full justify-between">
|
||||
<div></div>
|
||||
|
||||
@@ -20,7 +20,7 @@ export const GitHubSponsorship: React.FC = () => {
|
||||
/> */}
|
||||
|
||||
<div className="col-span-2">
|
||||
<h2 className="text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200 lg:text-2xl">
|
||||
<h2 className="text-2xl font-bold tracking-tight text-slate-800 lg:text-2xl dark:text-slate-200">
|
||||
We are live on ProductHunt today 🚀
|
||||
</h2>
|
||||
<p className="lg:text-md mt-2 max-w-3xl text-slate-500 dark:text-slate-400">
|
||||
|
||||
@@ -28,17 +28,17 @@ export const Hero: React.FC = ({}) => {
|
||||
We're Open Source - Star us on GitHub
|
||||
<ChevronRightIcon className="mb-1 ml-1 inline h-4 w-4 text-slate-300" />
|
||||
</a>
|
||||
<h1 className="mt-10 text-3xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-4xl md:text-5xl">
|
||||
<h1 className="mt-10 text-3xl font-bold tracking-tight text-slate-800 sm:text-4xl md:text-5xl dark:text-slate-200">
|
||||
<span className="xl:inline">Privacy-first Experience Management</span>
|
||||
</h1>
|
||||
|
||||
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-500 dark:text-slate-400 sm:text-lg md:mt-5 md:text-xl">
|
||||
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-500 sm:text-lg md:mt-5 md:text-xl dark:text-slate-400">
|
||||
Turn customer insights into irresistible experiences —{" "}
|
||||
<span className="decoration-brand-dark underline underline-offset-4">all privacy-first.</span>
|
||||
</p>
|
||||
|
||||
<div className="mx-auto mt-5 max-w-2xl items-center px-4 sm:flex sm:justify-center md:mt-6 md:space-x-8 md:px-0">
|
||||
<p className="hidden whitespace-nowrap pt-3 text-xs text-slate-400 dark:text-slate-500 md:block">
|
||||
<p className="hidden whitespace-nowrap pt-3 text-xs text-slate-400 md:block dark:text-slate-500">
|
||||
Trusted by
|
||||
</p>
|
||||
<div className="grid grid-cols-4 items-center gap-6 pt-2 md:gap-8">
|
||||
@@ -51,37 +51,37 @@ export const Hero: React.FC = ({}) => {
|
||||
<Image
|
||||
src={CalLogoLight}
|
||||
alt="Cal Logo"
|
||||
className="block rounded-lg hover:opacity-100 dark:hidden md:opacity-50"
|
||||
className="block rounded-lg hover:opacity-100 md:opacity-50 dark:hidden"
|
||||
width={170}
|
||||
/>
|
||||
<Image
|
||||
src={CalLogoDark}
|
||||
alt="Cal Logo"
|
||||
className="hidden rounded-lg hover:opacity-100 dark:block md:opacity-50"
|
||||
className="hidden rounded-lg hover:opacity-100 md:opacity-50 dark:block"
|
||||
width={170}
|
||||
/>
|
||||
<Image
|
||||
src={CrowdLogoLight}
|
||||
alt="Crowd.dev Logo"
|
||||
className="block rounded-lg pb-1 hover:opacity-100 dark:hidden md:opacity-50"
|
||||
className="block rounded-lg pb-1 hover:opacity-100 md:opacity-50 dark:hidden"
|
||||
width={200}
|
||||
/>
|
||||
<Image
|
||||
src={CrowdLogoDark}
|
||||
alt="Crowd.dev Logo"
|
||||
className="hidden rounded-lg pb-1 hover:opacity-100 dark:block md:opacity-50"
|
||||
className="hidden rounded-lg pb-1 hover:opacity-100 md:opacity-50 dark:block"
|
||||
width={200}
|
||||
/>
|
||||
<Image
|
||||
src={NILogoDark}
|
||||
alt="Neverinstall Logo"
|
||||
className="block pb-1 hover:opacity-100 dark:hidden md:opacity-50"
|
||||
className="block pb-1 hover:opacity-100 md:opacity-50 dark:hidden"
|
||||
width={200}
|
||||
/>
|
||||
<Image
|
||||
src={NILogoLight}
|
||||
alt="Neverinstall Logo"
|
||||
className="hidden pb-1 hover:opacity-100 dark:block md:opacity-50"
|
||||
className="hidden pb-1 hover:opacity-100 md:opacity-50 dark:block"
|
||||
width={200}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ export const Highlights: React.FC = ({}) => {
|
||||
significantly higher conversion rate.
|
||||
</p>
|
||||
</div>
|
||||
<div className="rounded-lg bg-slate-100 py-6 pr-4 dark:bg-slate-800 sm:py-16 sm:pr-8">
|
||||
<div className="rounded-lg bg-slate-100 py-6 pr-4 sm:py-16 sm:pr-8 dark:bg-slate-800">
|
||||
<Image
|
||||
src={ImageEventTriggerLight}
|
||||
alt="react library"
|
||||
@@ -39,7 +39,7 @@ export const Highlights: React.FC = ({}) => {
|
||||
<div className="mx-auto mb-12 mt-8 max-w-lg md:mb-0 md:mt-32 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="order-last rounded-lg bg-slate-100 p-4 dark:bg-slate-800 sm:p-8 md:order-first">
|
||||
<div className="order-last rounded-lg bg-slate-100 p-4 sm:p-8 md:order-first dark:bg-slate-800">
|
||||
<Image
|
||||
src={ImageAttributesLight}
|
||||
alt="react library"
|
||||
@@ -48,7 +48,7 @@ export const Highlights: React.FC = ({}) => {
|
||||
<Image src={ImageAttributesDark} alt="react library" className="hidden rounded-lg dark:block" />
|
||||
</div>
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold leading-7 tracking-tight text-slate-800 dark:text-slate-100 sm:text-3xl">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold leading-7 tracking-tight text-slate-800 sm:text-3xl dark:text-slate-100">
|
||||
Don't ‘Spray and pray’.
|
||||
<br />
|
||||
<span className="font-light">Pre-segment granularly.</span>
|
||||
|
||||
@@ -61,7 +61,7 @@ if (typeof window !== "undefined") {
|
||||
</>
|
||||
) : activeTab === "html" ? (
|
||||
<CodeBlock>{`<script type="text/javascript">
|
||||
!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://unpkg.com/@formbricks/js@^1.2.0/dist/index.umd.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),setTimeout(function(){window.formbricks.init("claDadXk29dak92dK9","https://app.formbricks.com")},500)}();
|
||||
!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://unpkg.com/@formbricks/js@^1.4.0/dist/index.umd.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),setTimeout(function(){window.formbricks.init("claDadXk29dak92dK9","https://app.formbricks.com")},500)}();
|
||||
</script>`}</CodeBlock>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -45,7 +45,7 @@ export const Steps: React.FC = () => {
|
||||
<div className="mx-auto mb-12 mt-8 max-w-lg md:mb-0 md:mt-32 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="order-last w-full rounded-lg bg-slate-100 p-4 dark:bg-slate-800 sm:py-8 md:order-first">
|
||||
<div className="order-last w-full rounded-lg bg-slate-100 p-4 sm:py-8 md:order-first dark:bg-slate-800">
|
||||
<div className="flex h-40 items-center justify-center">
|
||||
<Button
|
||||
variant="primary"
|
||||
@@ -60,7 +60,7 @@ export const Steps: React.FC = () => {
|
||||
</div>
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 2</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-3xl">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 sm:text-3xl dark:text-slate-100">
|
||||
No-Code: Track User Actions
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
@@ -76,7 +76,7 @@ export const Steps: React.FC = () => {
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="pb-8 sm:pl-10 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 3</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-3xl">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 sm:text-3xl dark:text-slate-200">
|
||||
Create your survey
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
@@ -84,7 +84,7 @@ export const Steps: React.FC = () => {
|
||||
adjust the look and feel of your survey.
|
||||
</p>
|
||||
</div>
|
||||
<div className="relative w-full rounded-lg p-1 dark:bg-slate-800 sm:p-8">
|
||||
<div className="relative w-full rounded-lg p-1 sm:p-8 dark:bg-slate-800">
|
||||
<DemoPreview template="Product Market Fit Survey (short)" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -93,14 +93,14 @@ export const Steps: React.FC = () => {
|
||||
<div className="mx-auto mb-12 mt-8 max-w-lg md:mb-0 md:mt-32 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="order-last w-full rounded-lg bg-slate-100 p-4 dark:bg-slate-800 sm:py-8 md:order-first">
|
||||
<div className="order-last w-full rounded-lg bg-slate-100 p-4 sm:py-8 md:order-first dark:bg-slate-800">
|
||||
<div className="mx-auto flex flex-col items-center justify-center md:w-3/4">
|
||||
<AddEventDummy />
|
||||
</div>
|
||||
</div>
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 4</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-3xl">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 sm:text-3xl dark:text-slate-100">
|
||||
Set segment and trigger
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
@@ -116,7 +116,7 @@ export const Steps: React.FC = () => {
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="pb-8 sm:pl-10 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 5</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-3xl">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 sm:text-3xl dark:text-slate-200">
|
||||
Make better decisions
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
|
||||
@@ -4,13 +4,13 @@ export default function InsightOppos() {
|
||||
return (
|
||||
<div className="pb-10 pt-12 md:pt-20">
|
||||
<div className="px-4 py-20 text-center sm:px-6 lg:px-8" id="best-practices">
|
||||
<h1 className="text-3xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-4xl md:text-5xl">
|
||||
<h1 className="text-3xl font-bold tracking-tight text-slate-800 sm:text-4xl md:text-5xl dark:text-slate-200">
|
||||
Get started with{" "}
|
||||
<span className="from-brand-light to-brand-dark bg-gradient-to-b bg-clip-text text-transparent xl:inline">
|
||||
Best Practices
|
||||
</span>
|
||||
</h1>
|
||||
<p className="mx-auto mt-3 max-w-md text-base text-slate-500 dark:text-slate-300 sm:text-lg md:mt-5 md:max-w-3xl md:text-xl">
|
||||
<p className="mx-auto mt-3 max-w-md text-base text-slate-500 sm:text-lg md:mt-5 md:max-w-3xl md:text-xl dark:text-slate-300">
|
||||
Run battle-tested approaches for qualitative user research in minutes.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function CTA() {
|
||||
<HeadingCentered closer teaser="Get started" heading="Ready for the last form tool you need?" />
|
||||
|
||||
<div className="mt-12 grid grid-cols-1 content-center md:grid-cols-2">
|
||||
<div className="-mb-4 rounded-t-xl bg-gradient-to-br from-slate-300 to-slate-200 px-8 py-24 text-center text-slate-900 dark:from-slate-800 dark:to-slate-900 dark:text-slate-100 md:-mr-5 md:mb-0 md:ml-2.5 md:rounded-l-xl lg:p-24">
|
||||
<div className="-mb-4 rounded-t-xl bg-gradient-to-br from-slate-300 to-slate-200 px-8 py-24 text-center text-slate-900 md:-mr-5 md:mb-0 md:ml-2.5 md:rounded-l-xl lg:p-24 dark:from-slate-800 dark:to-slate-900 dark:text-slate-100">
|
||||
<h3 className="text-3xl font-bold">Self-hosted</h3>
|
||||
<p className="mb-4 mt-2">Run locally e.g. with docker-compose.</p>
|
||||
<Button variant="secondary" onClick={() => router.push("/docs")} className="mt-3">
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function FeatureHighlights({
|
||||
<div className="mx-auto max-w-md px-4 sm:max-w-3xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="md:grid-cols-2 lg:grid lg:items-center lg:gap-24">
|
||||
<div className={clsx(isImgLeft ? "order-last" : "")}>
|
||||
<h2 className="text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-3xl">
|
||||
<h2 className="text-2xl font-bold tracking-tight text-slate-800 sm:text-3xl dark:text-slate-200">
|
||||
{featureTitle}
|
||||
</h2>
|
||||
<div className="text-md mt-6 whitespace-pre-line leading-7 text-slate-500 dark:text-slate-400">
|
||||
|
||||
@@ -170,7 +170,7 @@ export default function Header() {
|
||||
leaveTo="opacity-0 translate-y-1">
|
||||
<Popover.Panel className="absolute z-10 -ml-4 mt-3 w-screen max-w-lg transform lg:left-1/2 lg:ml-0 lg:max-w-4xl lg:-translate-x-1/2">
|
||||
<div className="overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5">
|
||||
<div className="relative grid gap-6 bg-white px-5 py-6 dark:bg-slate-700 sm:gap-6 sm:p-8 lg:grid-cols-3">
|
||||
<div className="relative grid gap-6 bg-white px-5 py-6 sm:gap-6 sm:p-8 lg:grid-cols-3 dark:bg-slate-700">
|
||||
<div>
|
||||
<h4 className="mb-6 ml-16 text-sm text-slate-400 dark:text-slate-300">
|
||||
Understand Users
|
||||
@@ -276,22 +276,22 @@ export default function Header() {
|
||||
*/}
|
||||
<Link
|
||||
href="/pricing"
|
||||
className="text-sm font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 lg:text-base">
|
||||
className="text-sm font-medium text-slate-400 hover:text-slate-700 lg:text-base dark:hover:text-slate-300">
|
||||
Pricing
|
||||
</Link>
|
||||
<Link
|
||||
href="/concierge"
|
||||
className="text-sm font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 lg:text-base">
|
||||
className="text-sm font-medium text-slate-400 hover:text-slate-700 lg:text-base dark:hover:text-slate-300">
|
||||
Concierge
|
||||
</Link>
|
||||
<Link
|
||||
href="/docs"
|
||||
className="text-sm font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 lg:text-base">
|
||||
className="text-sm font-medium text-slate-400 hover:text-slate-700 lg:text-base dark:hover:text-slate-300">
|
||||
Docs
|
||||
</Link>
|
||||
<Link
|
||||
href="/blog"
|
||||
className="text-sm font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 lg:text-base">
|
||||
className="text-sm font-medium text-slate-400 hover:text-slate-700 lg:text-base dark:hover:text-slate-300">
|
||||
Blog {/* <p className="bg-brand inline rounded-full px-2 text-xs text-white">1</p> */}
|
||||
</Link>
|
||||
{/* <Link
|
||||
|
||||
@@ -13,10 +13,10 @@ export default function HeadingCentered({ teaser, heading, subheading, closer }:
|
||||
<p className="text-md text-brand-dark dark:text-brand-light mx-auto mb-3 max-w-2xl font-semibold uppercase sm:mt-4">
|
||||
{teaser}
|
||||
</p>
|
||||
<h2 className="text-3xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-4xl">
|
||||
<h2 className="text-3xl font-bold tracking-tight text-slate-800 sm:text-4xl dark:text-slate-100">
|
||||
{heading}
|
||||
</h2>
|
||||
<p className="mx-auto mt-3 max-w-3xl text-xl text-slate-500 dark:text-slate-300 sm:mt-4">
|
||||
<p className="mx-auto mt-3 max-w-3xl text-xl text-slate-500 sm:mt-4 dark:text-slate-300">
|
||||
{subheading}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -9,14 +9,14 @@ interface Props {
|
||||
export default function HeroTitle({ headingPt1, headingTeal, headingPt2, subheading, children }: Props) {
|
||||
return (
|
||||
<div className="px-4 py-20 text-center sm:px-6 lg:px-8 lg:py-28">
|
||||
<h1 className="text-3xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-4xl md:text-5xl">
|
||||
<h1 className="text-3xl font-bold tracking-tight text-slate-800 sm:text-4xl md:text-5xl dark:text-slate-200">
|
||||
<span className="xl:inline">{headingPt1}</span>{" "}
|
||||
<span className="from-brand-light to-brand-dark bg-gradient-to-b bg-clip-text text-transparent xl:inline">
|
||||
{headingTeal}
|
||||
</span>{" "}
|
||||
<span className="inline ">{headingPt2}</span>
|
||||
</h1>
|
||||
<p className="mx-auto mt-3 max-w-md text-base text-slate-500 dark:text-slate-300 sm:text-lg md:mt-5 md:max-w-2xl md:text-xl">
|
||||
<p className="mx-auto mt-3 max-w-md text-base text-slate-500 sm:text-lg md:mt-5 md:max-w-2xl md:text-xl dark:text-slate-300">
|
||||
{subheading}
|
||||
</p>
|
||||
<div className="mx-auto mt-5 max-w-md sm:flex sm:justify-center md:mt-8">{children}</div>
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function CTA() {
|
||||
Try Formbricks right now!
|
||||
</p>
|
||||
<div className="mt-12 grid grid-cols-1 content-center md:grid-cols-2">
|
||||
<div className="-mb-2 rounded-t-xl bg-gradient-to-br from-slate-300 to-slate-200 text-center text-slate-900 dark:from-slate-800 dark:to-slate-900 dark:text-slate-200 md:-mr-5 md:mb-0 md:ml-2.5 md:rounded-l-xl">
|
||||
<div className="-mb-2 rounded-t-xl bg-gradient-to-br from-slate-300 to-slate-200 text-center text-slate-900 md:-mr-5 md:mb-0 md:ml-2.5 md:rounded-l-xl dark:from-slate-800 dark:to-slate-900 dark:text-slate-200">
|
||||
<h3 className="text-3xl font-bold">Self-hosted</h3>
|
||||
<p className="mb-4 mt-2 dark:text-slate-400">Run locally with docker-compose.</p>
|
||||
<Button variant="secondary" onClick={() => router.push("/docs")} className="mb-8 mt-3 md:mb-0">
|
||||
|
||||
@@ -26,7 +26,7 @@ export function Navigation({ navigation, className, preserveScroll, linkRef }: N
|
||||
<h2 className="font-display font-medium text-slate-800 dark:text-slate-100">{section.title}</h2>
|
||||
<ul
|
||||
role="list"
|
||||
className="mt-2 space-y-2 border-l-2 border-slate-100 dark:border-slate-800 lg:mt-4 lg:space-y-4 lg:border-slate-200">
|
||||
className="mt-2 space-y-2 border-l-2 border-slate-100 lg:mt-4 lg:space-y-4 lg:border-slate-200 dark:border-slate-800">
|
||||
{section.links.map((link) => (
|
||||
<li key={link.href} className="relative" ref={linkRef}>
|
||||
<Link
|
||||
|
||||
@@ -4,8 +4,8 @@ export const OpenSourceInfo = () => {
|
||||
return (
|
||||
<div className="my-8 md:my-20">
|
||||
<div className="px-8 md:px-16">
|
||||
<div className=" rounded-xl bg-slate-100 px-4 py-8 dark:bg-slate-800 md:px-12">
|
||||
<h2 className="text-lg font-semibold leading-7 tracking-tight text-slate-800 dark:text-slate-200 md:text-2xl">
|
||||
<div className=" rounded-xl bg-slate-100 px-4 py-8 md:px-12 dark:bg-slate-800">
|
||||
<h2 className="text-lg font-semibold leading-7 tracking-tight text-slate-800 md:text-2xl dark:text-slate-200">
|
||||
Open Source
|
||||
</h2>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const LinkSurveySlider = ({ label, usersCount, price, onSliderChange }) => (
|
||||
<div className="md:text-md w-2/6 text-center text-sm font-medium text-slate-700 dark:text-slate-200">
|
||||
{Math.round(usersCount).toLocaleString()} Submissions
|
||||
</div>
|
||||
<div className="md:text-md flex w-1/6 items-center justify-end text-center text-sm font-medium text-slate-700 dark:text-slate-200 md:justify-center">
|
||||
<div className="md:text-md flex w-1/6 items-center justify-end text-center text-sm font-medium text-slate-700 md:justify-center dark:text-slate-200">
|
||||
<span>${price.toFixed(2)}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,7 +43,7 @@ const InAppSlider = ({ label, usersCount, price, onSliderChange }) => (
|
||||
<div className="md:text-md w-2/6 text-center text-sm font-medium text-slate-700 dark:text-slate-200">
|
||||
{Math.round(usersCount).toLocaleString()} Submissions
|
||||
</div>
|
||||
<div className="md:text-md flex w-1/6 items-center justify-end text-center text-sm font-medium text-slate-700 dark:text-slate-200 md:justify-center">
|
||||
<div className="md:text-md flex w-1/6 items-center justify-end text-center text-sm font-medium text-slate-700 md:justify-center dark:text-slate-200">
|
||||
<span>${price.toFixed(2)}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,7 +76,7 @@ const UserSegmentationSlider = ({ label, usersCount, price, onSliderChange }) =>
|
||||
<div className="md:text-md w-2/6 text-center text-sm font-medium text-slate-700 dark:text-slate-200">
|
||||
{Math.round(usersCount).toLocaleString()} Submissions
|
||||
</div>
|
||||
<div className="md:text-md flex w-1/6 items-center justify-end text-center text-sm font-medium text-slate-700 dark:text-slate-200 md:justify-center">
|
||||
<div className="md:text-md flex w-1/6 items-center justify-end text-center text-sm font-medium text-slate-700 md:justify-center dark:text-slate-200">
|
||||
<span>${price.toFixed(2)}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -102,8 +102,8 @@ const UserSegmentationSlider = ({ label, usersCount, price, onSliderChange }) =>
|
||||
|
||||
const Headers = () => (
|
||||
<div className="mb-4 flex justify-between">
|
||||
<h3 className="text-base font-semibold text-slate-700 dark:text-slate-200 md:text-lg">Product</h3>
|
||||
<h3 className="w-1/6 text-center text-base font-semibold text-slate-700 dark:text-slate-200 md:text-lg">
|
||||
<h3 className="text-base font-semibold text-slate-700 md:text-lg dark:text-slate-200">Product</h3>
|
||||
<h3 className="w-1/6 text-center text-base font-semibold text-slate-700 md:text-lg dark:text-slate-200">
|
||||
Subtotal
|
||||
</h3>
|
||||
</div>
|
||||
@@ -111,14 +111,14 @@ const Headers = () => (
|
||||
|
||||
const MonthlyEstimate = ({ price }) => (
|
||||
<div className="mt-2 flex justify-between">
|
||||
<span className="text-base font-semibold text-slate-700 dark:text-slate-200 md:text-lg">
|
||||
<span className="text-base font-semibold text-slate-700 md:text-lg dark:text-slate-200">
|
||||
Monthly estimate:
|
||||
</span>
|
||||
<div className="w-1/6 text-center">
|
||||
<span className="w-1/6 text-base text-slate-700 dark:text-slate-200 md:text-lg md:font-semibold">
|
||||
<span className="w-1/6 text-base text-slate-700 md:text-lg md:font-semibold dark:text-slate-200">
|
||||
${price.toFixed(2)}
|
||||
</span>
|
||||
<span className="hidden text-sm text-slate-400 dark:text-slate-500 md:block md:text-base">
|
||||
<span className="hidden text-sm text-slate-400 md:block md:text-base dark:text-slate-500">
|
||||
{" "}
|
||||
/ month
|
||||
</span>
|
||||
@@ -145,11 +145,11 @@ export const PricingCalculator = () => {
|
||||
|
||||
return (
|
||||
<div className="px-4 md:px-16">
|
||||
<h2 className="px-4 py-4 text-lg font-semibold leading-7 tracking-tight text-slate-800 dark:text-slate-200 md:px-12 md:text-2xl">
|
||||
<h2 className="px-4 py-4 text-lg font-semibold leading-7 tracking-tight text-slate-800 md:px-12 md:text-2xl dark:text-slate-200">
|
||||
Pricing Calculator
|
||||
</h2>
|
||||
|
||||
<div className="rounded-xl bg-slate-100 px-4 py-4 dark:bg-slate-800 md:px-12">
|
||||
<div className="rounded-xl bg-slate-100 px-4 py-4 md:px-12 dark:bg-slate-800">
|
||||
<div className="rounded-xl px-4">
|
||||
<Headers />
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const GetStartedWithPricing = ({ showDetailed }: { showDetailed: boolean
|
||||
<p className="text-base font-semibold">Free</p>
|
||||
|
||||
{showDetailed && (
|
||||
<p className="leading text-xs text-slate-500 dark:text-slate-400 md:text-base">
|
||||
<p className="leading text-xs text-slate-500 md:text-base dark:text-slate-400">
|
||||
General free usage on every product. Best for early stage startups and hobbyists
|
||||
</p>
|
||||
)}
|
||||
@@ -26,7 +26,7 @@ export const GetStartedWithPricing = ({ showDetailed }: { showDetailed: boolean
|
||||
<div className="w-1/3 text-left text-sm text-slate-800 dark:text-slate-100">
|
||||
<p className="text-base font-semibold"> Paid</p>
|
||||
{showDetailed && (
|
||||
<p className="leading text-xs text-slate-500 dark:text-slate-400 md:text-base">
|
||||
<p className="leading text-xs text-slate-500 md:text-base dark:text-slate-400">
|
||||
Formbricks with the next-generation features, Pay only for the tracked users.
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -7,26 +7,26 @@ export const PricingTable = ({ leadRow, pricing, endRow }) => {
|
||||
<div className="grid grid-cols-1 px-4 md:gap-4 md:px-16 ">
|
||||
<div className="rounded-xl px-4 md:px-12">
|
||||
<div className="flex items-center gap-x-4">
|
||||
<div className="w-1/3 text-left font-semibold text-slate-700 dark:text-slate-200 md:text-xl">
|
||||
<div className="w-1/3 text-left font-semibold text-slate-700 md:text-xl dark:text-slate-200">
|
||||
{leadRow.title}
|
||||
<span className="pl-2 text-sm font-normal text-slate-600">{leadRow.comparison}</span>
|
||||
</div>
|
||||
<div
|
||||
className="flex w-1/3 items-center justify-center text-center text-sm font-semibold
|
||||
text-slate-500 dark:text-slate-200 md:text-lg">
|
||||
text-slate-500 md:text-lg dark:text-slate-200">
|
||||
{leadRow.free}
|
||||
</div>
|
||||
|
||||
<div className="w-1/3 text-center font-semibold text-slate-700 dark:text-slate-200 md:text-lg">
|
||||
<div className="w-1/3 text-center font-semibold text-slate-700 md:text-lg dark:text-slate-200">
|
||||
{leadRow.paid}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="rounded-xl bg-slate-100 px-4 py-4 dark:bg-slate-800 md:px-12 ">
|
||||
<div className="rounded-xl bg-slate-100 px-4 py-4 md:px-12 dark:bg-slate-800 ">
|
||||
{pricing.map((feature) => (
|
||||
<div key={feature.name} className="mb-8 flex items-center gap-x-4">
|
||||
<div className="w-1/3 text-left text-sm text-slate-700 dark:text-slate-200 md:text-base">
|
||||
<div className="w-1/3 text-left text-sm text-slate-700 md:text-base dark:text-slate-200">
|
||||
{feature.name}
|
||||
{feature.addOnText && (
|
||||
<span className=" mx-3 rounded-full bg-emerald-200 px-2 text-xs text-slate-800 dark:bg-slate-700 dark:text-teal-500">
|
||||
@@ -93,14 +93,14 @@ export const PricingTable = ({ leadRow, pricing, endRow }) => {
|
||||
|
||||
<div className="rounded-xl px-4 md:px-12">
|
||||
<div className="flex items-center gap-x-4">
|
||||
<div className="w-1/3 text-left text-sm font-semibold text-slate-700 dark:text-slate-200 md:text-base">
|
||||
<div className="w-1/3 text-left text-sm font-semibold text-slate-700 md:text-base dark:text-slate-200">
|
||||
{endRow.title}
|
||||
</div>
|
||||
<div className="flex w-1/3 items-center justify-center text-center text-sm font-semibold text-slate-700 dark:text-slate-200 md:text-base">
|
||||
<div className="flex w-1/3 items-center justify-center text-center text-sm font-semibold text-slate-700 md:text-base dark:text-slate-200">
|
||||
<span>{endRow.free}</span>
|
||||
</div>
|
||||
|
||||
<div className="w-1/3 text-center text-sm font-semibold text-slate-700 dark:text-slate-200 md:text-base">
|
||||
<div className="w-1/3 text-center text-sm font-semibold text-slate-700 md:text-base dark:text-slate-200">
|
||||
{endRow.paid}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,14 +49,14 @@ export function Search() {
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className="group flex h-6 w-6 items-center justify-center sm:justify-start md:h-auto md:w-60 md:flex-none md:rounded-lg md:py-2.5 md:pl-4 md:pr-3.5 md:text-sm md:ring-1 md:ring-slate-200 md:hover:ring-slate-300 dark:md:bg-slate-800/75 dark:md:ring-inset dark:md:ring-white/5 dark:md:hover:bg-slate-700/40 dark:md:hover:ring-slate-500 xl:w-80"
|
||||
className="group flex h-6 w-6 items-center justify-center sm:justify-start md:h-auto md:w-60 md:flex-none md:rounded-lg md:py-2.5 md:pl-4 md:pr-3.5 md:text-sm md:ring-1 md:ring-slate-200 md:hover:ring-slate-300 xl:w-80 dark:md:bg-slate-800/75 dark:md:ring-inset dark:md:ring-white/5 dark:md:hover:bg-slate-700/40 dark:md:hover:ring-slate-500"
|
||||
onClick={onOpen}>
|
||||
<SearchIcon className="h-5 w-5 flex-none fill-slate-400 group-hover:fill-slate-500 dark:fill-slate-500 md:group-hover:fill-slate-400" />
|
||||
<SearchIcon className="h-5 w-5 flex-none fill-slate-400 group-hover:fill-slate-500 md:group-hover:fill-slate-400 dark:fill-slate-500" />
|
||||
<span className="sr-only md:not-sr-only md:pl-2 md:text-slate-500 md:dark:text-slate-400">
|
||||
Search docs
|
||||
</span>
|
||||
{modifierKey && (
|
||||
<kbd className="ml-auto hidden font-medium text-slate-400 dark:text-slate-500 md:block">
|
||||
<kbd className="ml-auto hidden font-medium text-slate-400 md:block dark:text-slate-500">
|
||||
<kbd className="font-sans">{modifierKey}</kbd>
|
||||
<kbd className="font-sans">K</kbd>
|
||||
</kbd>
|
||||
|
||||
@@ -11,10 +11,10 @@ export default function HeadingCentered() {
|
||||
<p className="text-md text-brand-dark dark:text-brand-light mb-3 font-semibold uppercase">
|
||||
What are you waiting for?
|
||||
</p>
|
||||
<h2 className="text-3xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-4xl">
|
||||
<h2 className="text-3xl font-bold tracking-tight text-slate-800 sm:text-4xl dark:text-slate-100">
|
||||
Try it right now!
|
||||
</h2>
|
||||
<p className="my-3 text-slate-500 dark:text-slate-300 sm:mb-6 sm:mt-4 md:text-lg">
|
||||
<p className="my-3 text-slate-500 sm:mb-6 sm:mt-4 md:text-lg dark:text-slate-300">
|
||||
Dive right in or browse docs for examples.
|
||||
<br />
|
||||
Questions? Join our Discord, we’re happy to help!
|
||||
|
||||
@@ -42,7 +42,7 @@ const features = [
|
||||
|
||||
export default function FeatureTable({}) {
|
||||
return (
|
||||
<div className="mt-32 rounded-xl bg-gradient-to-br from-slate-900 via-slate-900 to-slate-800 dark:from-slate-200 dark:to-slate-300 lg:mt-56">
|
||||
<div className="mt-32 rounded-xl bg-gradient-to-br from-slate-900 via-slate-900 to-slate-800 lg:mt-56 dark:from-slate-200 dark:to-slate-300">
|
||||
<div className="mx-auto max-w-4xl px-4 py-8 sm:px-6 sm:pb-12 sm:pt-8 lg:max-w-7xl lg:px-8 lg:pt-12">
|
||||
<p className="text-md dark:text-brand-dark text-brand-light mb-3 max-w-2xl font-semibold uppercase sm:mt-4">
|
||||
Why Formbricks?
|
||||
|
||||
@@ -30,12 +30,12 @@ export default function DocsFeedbackPage() {
|
||||
</p>
|
||||
<UseCaseCTA href="/docs/best-practices/docs-feedback" />
|
||||
</div>
|
||||
<div className="mx-6 my-6 flex flex-col items-center justify-center rounded-xl border-2 border-slate-300 bg-slate-200 p-4 pb-36 transition-transform duration-150 dark:border-slate-500 dark:bg-slate-700 md:mx-0">
|
||||
<div className="mx-6 my-6 flex flex-col items-center justify-center rounded-xl border-2 border-slate-300 bg-slate-200 p-4 pb-36 transition-transform duration-150 md:mx-0 dark:border-slate-500 dark:bg-slate-700">
|
||||
<p className="my-3 text-sm text-slate-500">Preview</p>
|
||||
<DocsFeedback />
|
||||
</div>
|
||||
</div>
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 dark:text-slate-400 md:mt-0">
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 md:mt-0 dark:text-slate-400">
|
||||
Other Best Practices
|
||||
</h2>
|
||||
<BestPracticeNavigation />
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function FeatureChaserPage() {
|
||||
|
||||
<DemoPreview template="Feature Chaser" />
|
||||
</div>
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 dark:text-slate-400 md:mt-0">
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 md:mt-0 dark:text-slate-400">
|
||||
Other Best Practices
|
||||
</h2>
|
||||
<BestPracticeNavigation />
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function FeedbackBoxPage() {
|
||||
|
||||
<DemoPreview template="Feedback Box" />
|
||||
</div>
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 dark:text-slate-400 md:mt-0">
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 md:mt-0 dark:text-slate-400">
|
||||
Other Best Practices
|
||||
</h2>
|
||||
<BestPracticeNavigation />
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function MissedTrialPagePage() {
|
||||
</div>
|
||||
<DemoPreview template="Improve Trial Conversion" />
|
||||
</div>
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 dark:text-slate-400 md:mt-0">
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 md:mt-0 dark:text-slate-400">
|
||||
Other Best Practices
|
||||
</h2>
|
||||
<BestPracticeNavigation />
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function InterviewPromptPage() {
|
||||
</div>
|
||||
<DemoPreview template="Interview Prompt" />
|
||||
</div>
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 dark:text-slate-400 md:mt-0">
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 md:mt-0 dark:text-slate-400">
|
||||
Other Best Practices
|
||||
</h2>
|
||||
<BestPracticeNavigation />
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function LearnFromChurnPage() {
|
||||
</div>
|
||||
<DemoPreview template="Churn Survey" />
|
||||
</div>
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 dark:text-slate-400 md:mt-0">
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 md:mt-0 dark:text-slate-400">
|
||||
Other Best Practices
|
||||
</h2>
|
||||
<BestPracticeNavigation />
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function MeasurePMFPage() {
|
||||
<strong>only survey the right subset</strong> of your user base.
|
||||
</p>
|
||||
</div>
|
||||
<div className="rounded-lg bg-slate-100 p-4 dark:bg-slate-800 sm:p-8">
|
||||
<div className="rounded-lg bg-slate-100 p-4 sm:p-8 dark:bg-slate-800">
|
||||
<Image
|
||||
src={PreSegmentation}
|
||||
quality="100"
|
||||
@@ -81,7 +81,7 @@ export default function MeasurePMFPage() {
|
||||
</div>
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 2</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-3xl">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 sm:text-3xl dark:text-slate-100">
|
||||
Survey users in-app
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
@@ -97,7 +97,7 @@ export default function MeasurePMFPage() {
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="pb-8 sm:pl-10 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 3</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-3xl">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 sm:text-3xl dark:text-slate-200">
|
||||
Loop in your team
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
@@ -136,7 +136,7 @@ export default function MeasurePMFPage() {
|
||||
</div>
|
||||
<div className="pb-8 pl-4 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 4</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-3xl">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 sm:text-3xl dark:text-slate-100">
|
||||
Make better decisions
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function OnboardingSegmentationPage() {
|
||||
|
||||
<DemoPreview template="Onboarding Segmentation" />
|
||||
</div>
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 dark:text-slate-400 md:mt-0">
|
||||
<h2 className="mb-6 ml-4 mt-12 text-2xl font-semibold text-slate-700 md:mt-0 dark:text-slate-400">
|
||||
Other Best Practices
|
||||
</h2>
|
||||
<BestPracticeNavigation />
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "storybook dev -p 6006",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
CodeBracketIcon,
|
||||
CreditCardIcon,
|
||||
DocumentCheckIcon,
|
||||
EnvelopeIcon,
|
||||
HeartIcon,
|
||||
LinkIcon,
|
||||
PaintBrushIcon,
|
||||
@@ -479,17 +480,27 @@ export default function Navigation({
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuGroup>
|
||||
{isFormbricksCloud && (
|
||||
<DropdownMenuItem>
|
||||
<button
|
||||
onClick={() => {
|
||||
formbricks.track("Top Menu: Product Feedback");
|
||||
}}>
|
||||
<div className="flex items-center">
|
||||
<ChatBubbleBottomCenterTextIcon className="mr-2 h-4 w-4" />
|
||||
<span>Product Feedback</span>
|
||||
</div>
|
||||
</button>
|
||||
</DropdownMenuItem>
|
||||
<>
|
||||
<DropdownMenuItem>
|
||||
<a href="mailto:johannes@formbricks.com">
|
||||
<div className="flex items-center">
|
||||
<EnvelopeIcon className="mr-2 h-4 w-4" />
|
||||
<span>Email us!</span>
|
||||
</div>
|
||||
</a>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>
|
||||
<button
|
||||
onClick={() => {
|
||||
formbricks.track("Top Menu: Product Feedback");
|
||||
}}>
|
||||
<div className="flex items-center">
|
||||
<ChatBubbleBottomCenterTextIcon className="mr-2 h-4 w-4" />
|
||||
<span>Product Feedback</span>
|
||||
</div>
|
||||
</button>
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
<DropdownMenuItem
|
||||
onClick={async () => {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
"use server";
|
||||
|
||||
import { getServerSession } from "next-auth";
|
||||
|
||||
import { authOptions } from "@formbricks/lib/authOptions";
|
||||
import { hasUserEnvironmentAccess } from "@formbricks/lib/environment/auth";
|
||||
import { getNotionDatabases } from "@formbricks/lib/notion/service";
|
||||
import { AuthorizationError } from "@formbricks/types/errors";
|
||||
|
||||
export async function refreshDatabasesAction(environmentId: string) {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session) throw new AuthorizationError("Not authorized");
|
||||
|
||||
const isAuthorized = await hasUserEnvironmentAccess(session.user.id, environmentId);
|
||||
if (!isAuthorized) throw new AuthorizationError("Not authorized");
|
||||
|
||||
return await getNotionDatabases(environmentId);
|
||||
}
|
||||
@@ -0,0 +1,589 @@
|
||||
import { createOrUpdateIntegrationAction } from "@/app/(app)/environments/[environmentId]/integrations/actions";
|
||||
import {
|
||||
ERRORS,
|
||||
TYPE_MAPPING,
|
||||
UNSUPPORTED_TYPES_BY_NOTION,
|
||||
} from "@/app/(app)/environments/[environmentId]/integrations/notion/constants";
|
||||
import { questionTypes } from "@/app/lib/questions";
|
||||
import NotionLogo from "@/images/notion.png";
|
||||
import { ArrowPathIcon, ChevronDownIcon, PlusIcon, XMarkIcon } from "@heroicons/react/24/solid";
|
||||
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
||||
import Image from "next/image";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
import { TIntegrationInput } from "@formbricks/types/integration";
|
||||
import {
|
||||
TIntegrationNotion,
|
||||
TIntegrationNotionConfigData,
|
||||
TIntegrationNotionDatabase,
|
||||
} from "@formbricks/types/integration/notion";
|
||||
import { TSurvey, TSurveyQuestionType } from "@formbricks/types/surveys";
|
||||
import { Button } from "@formbricks/ui/Button";
|
||||
import { Label } from "@formbricks/ui/Label";
|
||||
import { Modal } from "@formbricks/ui/Modal";
|
||||
|
||||
interface AddIntegrationModalProps {
|
||||
environmentId: string;
|
||||
surveys: TSurvey[];
|
||||
open: boolean;
|
||||
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
notionIntegration: TIntegrationNotion;
|
||||
databases: TIntegrationNotionDatabase[];
|
||||
selectedIntegration: (TIntegrationNotionConfigData & { index: number }) | null;
|
||||
}
|
||||
|
||||
export default function AddIntegrationModal({
|
||||
environmentId,
|
||||
surveys,
|
||||
open,
|
||||
setOpen,
|
||||
notionIntegration,
|
||||
databases,
|
||||
selectedIntegration,
|
||||
}: AddIntegrationModalProps) {
|
||||
const { handleSubmit } = useForm();
|
||||
const [selectedDatabase, setSelectedDatabase] = useState<TIntegrationNotionDatabase | null>();
|
||||
const [selectedSurvey, setSelectedSurvey] = useState<TSurvey | null>(null);
|
||||
const [mapping, setMapping] = useState<
|
||||
{
|
||||
column: { id: string; name: string; type: string };
|
||||
question: { id: string; name: string; type: string };
|
||||
error?: {
|
||||
type: string;
|
||||
msg: React.ReactNode | string;
|
||||
} | null;
|
||||
}[]
|
||||
>([
|
||||
{
|
||||
column: { id: "", name: "", type: "" },
|
||||
question: { id: "", name: "", type: "" },
|
||||
},
|
||||
]);
|
||||
const [isDeleting, setIsDeleting] = useState<any>(null);
|
||||
const [isLinkingDatabase, setIsLinkingDatabase] = useState(false);
|
||||
const integrationData = {
|
||||
databaseId: "",
|
||||
databaseName: "",
|
||||
surveyId: "",
|
||||
surveyName: "",
|
||||
mapping: [
|
||||
{
|
||||
column: { id: "", name: "", type: "" },
|
||||
question: { id: "", name: "", type: "" },
|
||||
},
|
||||
],
|
||||
createdAt: new Date(),
|
||||
};
|
||||
|
||||
const notionIntegrationData: TIntegrationInput = {
|
||||
type: "notion",
|
||||
config: {
|
||||
key: notionIntegration?.config?.key,
|
||||
data: notionIntegration.config?.data || [],
|
||||
},
|
||||
};
|
||||
|
||||
const hasMatchingId = notionIntegration.config.data.some((configData) => {
|
||||
if (!selectedDatabase) {
|
||||
return false;
|
||||
}
|
||||
return configData.databaseId === selectedDatabase.id;
|
||||
});
|
||||
|
||||
const dbItems = useMemo(() => {
|
||||
const dbProperties = (selectedDatabase as any)?.properties;
|
||||
return (
|
||||
Object.keys(dbProperties || {}).map((fieldKey: string) => ({
|
||||
id: dbProperties[fieldKey].id,
|
||||
name: dbProperties[fieldKey].name,
|
||||
type: dbProperties[fieldKey].type,
|
||||
})) || []
|
||||
);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedDatabase?.id]);
|
||||
|
||||
const questionItems = useMemo(() => {
|
||||
const questions =
|
||||
selectedSurvey?.questions.map((q) => ({
|
||||
id: q.id,
|
||||
name: q.headline,
|
||||
type: q.type,
|
||||
})) || [];
|
||||
|
||||
const hiddenFields = selectedSurvey?.hiddenFields.enabled
|
||||
? selectedSurvey?.hiddenFields.fieldIds?.map((fId) => ({
|
||||
id: fId,
|
||||
name: fId,
|
||||
type: TSurveyQuestionType.OpenText,
|
||||
})) || []
|
||||
: [];
|
||||
return [...questions, ...hiddenFields];
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedSurvey?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedIntegration) {
|
||||
const selectedDB = databases.find((db) => db.id === selectedIntegration.databaseId)!;
|
||||
if (selectedDB) {
|
||||
setSelectedDatabase({
|
||||
id: selectedDB.id,
|
||||
name: (selectedDB as any).title?.[0]?.plain_text,
|
||||
properties: selectedDB.properties,
|
||||
});
|
||||
}
|
||||
setSelectedSurvey(
|
||||
surveys.find((survey) => {
|
||||
return survey.id === selectedIntegration.surveyId;
|
||||
})!
|
||||
);
|
||||
setMapping(selectedIntegration.mapping);
|
||||
return;
|
||||
}
|
||||
resetForm();
|
||||
}, [selectedIntegration, surveys, databases]);
|
||||
|
||||
const linkDatabase = async () => {
|
||||
try {
|
||||
if (!selectedDatabase) {
|
||||
throw new Error("Please select a database");
|
||||
}
|
||||
if (!selectedSurvey) {
|
||||
throw new Error("Please select a survey");
|
||||
}
|
||||
|
||||
if (mapping.length === 1 && (!mapping[0].question.id || !mapping[0].column.id)) {
|
||||
throw new Error("Please select at least one mapping");
|
||||
}
|
||||
|
||||
if (mapping.filter((m) => m.error).length > 0) {
|
||||
throw new Error("Please resolve the mapping errors");
|
||||
}
|
||||
|
||||
if (
|
||||
mapping.filter((m) => m.column.id && !m.question.id).length >= 1 ||
|
||||
mapping.filter((m) => m.question.id && !m.column.id).length >= 1
|
||||
) {
|
||||
throw new Error("Please complete mapping fields with notion property");
|
||||
}
|
||||
|
||||
setIsLinkingDatabase(true);
|
||||
|
||||
integrationData.databaseId = selectedDatabase.id;
|
||||
integrationData.databaseName = selectedDatabase.name;
|
||||
integrationData.surveyId = selectedSurvey.id;
|
||||
integrationData.surveyName = selectedSurvey.name;
|
||||
integrationData.mapping = mapping.map((m) => {
|
||||
delete m.error;
|
||||
return m;
|
||||
});
|
||||
integrationData.createdAt = new Date();
|
||||
|
||||
if (selectedIntegration) {
|
||||
// update action
|
||||
notionIntegrationData.config!.data[selectedIntegration.index] = integrationData;
|
||||
} else {
|
||||
// create action
|
||||
notionIntegrationData.config!.data.push(integrationData);
|
||||
}
|
||||
|
||||
await createOrUpdateIntegrationAction(environmentId, notionIntegrationData);
|
||||
toast.success(`Integration ${selectedIntegration ? "updated" : "added"} successfully`);
|
||||
resetForm();
|
||||
setOpen(false);
|
||||
} catch (e) {
|
||||
toast.error(e.message);
|
||||
} finally {
|
||||
setIsLinkingDatabase(false);
|
||||
}
|
||||
};
|
||||
|
||||
const deleteLink = async () => {
|
||||
notionIntegrationData.config!.data.splice(selectedIntegration!.index, 1);
|
||||
try {
|
||||
setIsDeleting(true);
|
||||
await createOrUpdateIntegrationAction(environmentId, notionIntegrationData);
|
||||
toast.success("Integration removed successfully");
|
||||
setOpen(false);
|
||||
} catch (error) {
|
||||
toast.error(error.message);
|
||||
} finally {
|
||||
setIsDeleting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const resetForm = () => {
|
||||
setIsLinkingDatabase(false);
|
||||
setSelectedDatabase(null);
|
||||
setSelectedSurvey(null);
|
||||
};
|
||||
const getFilteredQuestionItems = (selectedIdx) => {
|
||||
const selectedQuestionIds = mapping.filter((_, idx) => idx !== selectedIdx).map((m) => m.question.id);
|
||||
|
||||
return questionItems.filter((q) => !selectedQuestionIds.includes(q.id));
|
||||
};
|
||||
|
||||
const createCopy = (item) => JSON.parse(JSON.stringify(item));
|
||||
|
||||
const MappingRow = ({ idx }: { idx: number }) => {
|
||||
const filteredQuestionItems = getFilteredQuestionItems(idx);
|
||||
|
||||
const addRow = () => {
|
||||
setMapping((prev) => [
|
||||
...prev,
|
||||
{
|
||||
column: { id: "", name: "", type: "" },
|
||||
question: { id: "", name: "", type: "" },
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
const deleteRow = () => {
|
||||
setMapping((prev) => {
|
||||
return prev.filter((_, i) => i !== idx);
|
||||
});
|
||||
};
|
||||
|
||||
const ErrorMsg = ({ error, col, ques }) => {
|
||||
const showErrorMsg = useMemo(() => {
|
||||
switch (error?.type) {
|
||||
case ERRORS.UNSUPPORTED_TYPE:
|
||||
return (
|
||||
<>
|
||||
- <i>{col.name}</i> of type <b>{col.type}</b> is not supported by notion API. The data
|
||||
won't be reflected in your notion database.
|
||||
</>
|
||||
);
|
||||
case ERRORS.MAPPING:
|
||||
return (
|
||||
<>
|
||||
- <i>"{ques.name}"</i> of type{" "}
|
||||
<b>{questionTypes.find((qt) => qt.id === ques.type)?.label}</b> can't be mapped to the
|
||||
column <i>"{col.name}"</i> of type <b>{col.type}</b>
|
||||
</>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [error]);
|
||||
|
||||
if (!error) return null;
|
||||
|
||||
return (
|
||||
<div className="my-4 w-full rounded-lg bg-red-100 p-4 text-sm text-red-800">
|
||||
<span className="mb-2 block">{error.type}</span>
|
||||
{showErrorMsg}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const getFilteredDbItems = () => {
|
||||
const colMapping = mapping.map((m) => m.column.id);
|
||||
return dbItems.filter((item) => !colMapping.includes(item.id));
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<ErrorMsg
|
||||
key={idx}
|
||||
error={mapping[idx]?.error}
|
||||
col={mapping[idx].column}
|
||||
ques={mapping[idx].question}
|
||||
/>
|
||||
<div className="flex w-full items-center gap-3">
|
||||
<div className="flex w-full items-center">
|
||||
<div className="w-[340px] max-w-full">
|
||||
<DropdownSelector
|
||||
placeholder="Select a survey question"
|
||||
items={filteredQuestionItems}
|
||||
selectedItem={mapping?.[idx]?.question}
|
||||
setSelectedItem={(item) => {
|
||||
setMapping((prev) => {
|
||||
const copy = createCopy(prev);
|
||||
const col = copy[idx].column;
|
||||
if (col.id) {
|
||||
if (UNSUPPORTED_TYPES_BY_NOTION.includes(col.type)) {
|
||||
copy[idx] = {
|
||||
...copy[idx],
|
||||
error: {
|
||||
type: ERRORS.UNSUPPORTED_TYPE,
|
||||
},
|
||||
question: item,
|
||||
};
|
||||
return copy;
|
||||
}
|
||||
|
||||
const isValidColType = TYPE_MAPPING[item.type].includes(col.type);
|
||||
if (!isValidColType) {
|
||||
copy[idx] = {
|
||||
...copy[idx],
|
||||
error: {
|
||||
type: ERRORS.MAPPING,
|
||||
},
|
||||
question: item,
|
||||
};
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
copy[idx] = {
|
||||
...copy[idx],
|
||||
question: item,
|
||||
error: null,
|
||||
};
|
||||
return copy;
|
||||
});
|
||||
}}
|
||||
disabled={questionItems.length === 0}
|
||||
/>
|
||||
</div>
|
||||
<div className="h-px w-4 border-t border-t-slate-300" />
|
||||
<div className="w-[340px] max-w-full">
|
||||
<DropdownSelector
|
||||
placeholder="Select a field to map"
|
||||
items={getFilteredDbItems()}
|
||||
selectedItem={mapping?.[idx]?.column}
|
||||
setSelectedItem={(item) => {
|
||||
setMapping((prev) => {
|
||||
const copy = createCopy(prev);
|
||||
const ques = copy[idx].question;
|
||||
if (ques.id) {
|
||||
const isValidQuesType = TYPE_MAPPING[ques.type].includes(item.type);
|
||||
|
||||
if (UNSUPPORTED_TYPES_BY_NOTION.includes(item.type)) {
|
||||
copy[idx] = {
|
||||
...copy[idx],
|
||||
error: {
|
||||
type: ERRORS.UNSUPPORTED_TYPE,
|
||||
},
|
||||
column: item,
|
||||
};
|
||||
return copy;
|
||||
}
|
||||
|
||||
if (!isValidQuesType) {
|
||||
copy[idx] = {
|
||||
...copy[idx],
|
||||
error: {
|
||||
type: ERRORS.MAPPING,
|
||||
},
|
||||
column: item,
|
||||
};
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
copy[idx] = {
|
||||
...copy[idx],
|
||||
column: item,
|
||||
error: null,
|
||||
};
|
||||
return copy;
|
||||
});
|
||||
}}
|
||||
disabled={dbItems.length === 0}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className={`rounded-md p-1 hover:bg-slate-300 ${
|
||||
idx === mapping.length - 1 ? "visible" : "invisible"
|
||||
}`}
|
||||
onClick={addRow}>
|
||||
<PlusIcon className="h-5 w-5 font-bold text-gray-500" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={`flex-1 rounded-md p-1 hover:bg-red-100 ${
|
||||
mapping.length > 1 ? "visible" : "invisible"
|
||||
}`}
|
||||
onClick={deleteRow}>
|
||||
<XMarkIcon className="h-5 w-5 text-red-500" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal open={open} setOpen={setOpen} noPadding closeOnOutsideClick={false} size="lg">
|
||||
<div className="flex h-full flex-col rounded-lg">
|
||||
<div className="rounded-t-lg bg-slate-100">
|
||||
<div className="flex w-full items-center justify-between p-6">
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="mr-1.5 h-6 w-6 text-slate-500">
|
||||
<Image className="w-12" src={NotionLogo} alt="Google Sheet logo" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-xl font-medium text-slate-700">Link Notion Database</div>
|
||||
<div className="text-sm text-slate-500">Sync responses with a Notion Database</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form onSubmit={handleSubmit(linkDatabase)} className="w-full">
|
||||
<div className="flex justify-between rounded-lg p-6">
|
||||
<div className="w-full space-y-4">
|
||||
<div>
|
||||
<div className="mb-4">
|
||||
<DropdownSelector
|
||||
label="Select Database"
|
||||
items={databases.map((d) => ({
|
||||
id: d.id,
|
||||
name: (d as any).title?.[0]?.plain_text,
|
||||
properties: d.properties,
|
||||
}))}
|
||||
selectedItem={selectedDatabase}
|
||||
setSelectedItem={setSelectedDatabase}
|
||||
disabled={databases.length === 0}
|
||||
/>
|
||||
{selectedDatabase && hasMatchingId && (
|
||||
<p className="text-xs text-amber-700">
|
||||
<strong>Warning:</strong> A connection with this database is live. Please make changes
|
||||
with caution.
|
||||
</p>
|
||||
)}
|
||||
<p className="m-1 text-xs text-slate-500">
|
||||
{databases.length === 0 &&
|
||||
"You have to create at least one database to be able to setup this integration"}
|
||||
</p>
|
||||
</div>
|
||||
<div className="mb-4">
|
||||
<DropdownSelector
|
||||
label="Select Survey"
|
||||
items={surveys}
|
||||
selectedItem={selectedSurvey}
|
||||
setSelectedItem={setSelectedSurvey}
|
||||
disabled={surveys.length === 0}
|
||||
/>
|
||||
<p className="m-1 text-xs text-slate-500">
|
||||
{surveys.length === 0 &&
|
||||
"You have to create a survey to be able to setup this integration"}
|
||||
</p>
|
||||
</div>
|
||||
{selectedDatabase && selectedSurvey && (
|
||||
<div>
|
||||
<Label>Map Formbricks fields to Notion property</Label>
|
||||
<div className="mt-4">
|
||||
{mapping.map((_, idx) => (
|
||||
<MappingRow idx={idx} key={idx} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end border-t border-slate-200 p-6">
|
||||
<div className="flex space-x-2">
|
||||
{selectedIntegration ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="warn"
|
||||
loading={isDeleting}
|
||||
onClick={() => {
|
||||
deleteLink();
|
||||
}}>
|
||||
Delete
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
type="button"
|
||||
variant="minimal"
|
||||
onClick={() => {
|
||||
setOpen(false);
|
||||
resetForm();
|
||||
setMapping([]);
|
||||
}}>
|
||||
Cancel
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="darkCTA"
|
||||
type="submit"
|
||||
loading={isLinkingDatabase}
|
||||
disabled={mapping.filter((m) => m.error).length > 0}>
|
||||
{selectedIntegration ? "Update" : "Link Database"}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
interface DropdownSelectorProps {
|
||||
label?: string;
|
||||
items: Array<any>;
|
||||
selectedItem: any;
|
||||
setSelectedItem: React.Dispatch<React.SetStateAction<any>>;
|
||||
disabled: boolean;
|
||||
placeholder?: string;
|
||||
refetch?: () => void;
|
||||
}
|
||||
|
||||
const DropdownSelector = ({
|
||||
label,
|
||||
items,
|
||||
selectedItem,
|
||||
setSelectedItem,
|
||||
disabled,
|
||||
placeholder,
|
||||
refetch,
|
||||
}: DropdownSelectorProps) => {
|
||||
return (
|
||||
<div className="col-span-1">
|
||||
{label && <Label htmlFor={label}>{label}</Label>}
|
||||
<div className="mt-1 flex items-center gap-3">
|
||||
<DropdownMenu.Root>
|
||||
<DropdownMenu.Trigger asChild>
|
||||
<button
|
||||
disabled={disabled ? disabled : false}
|
||||
type="button"
|
||||
className="flex h-10 w-full rounded-md border border-slate-300 bg-transparent px-3 py-2 text-sm text-slate-800 placeholder:text-slate-400 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-500 dark:text-slate-300">
|
||||
<span className="flex w-4/5 flex-1">
|
||||
<span className="w-full truncate text-left">
|
||||
{selectedItem ? selectedItem.name || placeholder || label : `${placeholder || label}`}
|
||||
</span>
|
||||
</span>
|
||||
<span className="flex h-full items-center border-l pl-3">
|
||||
<ChevronDownIcon className="h-4 w-4 text-gray-500" />
|
||||
</span>
|
||||
</button>
|
||||
</DropdownMenu.Trigger>
|
||||
|
||||
{!disabled && (
|
||||
<DropdownMenu.Portal>
|
||||
<DropdownMenu.Content
|
||||
className="z-50 max-h-64 min-w-[220px] overflow-auto rounded-md bg-white text-sm text-slate-800 shadow-md"
|
||||
align="start">
|
||||
{items &&
|
||||
items.map((item) => (
|
||||
<DropdownMenu.Item
|
||||
key={item.id}
|
||||
className="flex cursor-pointer items-center p-3 hover:bg-gray-100 hover:outline-none data-[disabled]:cursor-default data-[disabled]:opacity-50"
|
||||
onSelect={() => setSelectedItem(item)}>
|
||||
{item.name}
|
||||
</DropdownMenu.Item>
|
||||
))}
|
||||
</DropdownMenu.Content>
|
||||
</DropdownMenu.Portal>
|
||||
)}
|
||||
</DropdownMenu.Root>
|
||||
{refetch && (
|
||||
<button
|
||||
type="button"
|
||||
className="rounded-md p-1 hover:bg-slate-300"
|
||||
onClick={() => {
|
||||
refetch();
|
||||
}}>
|
||||
<ArrowPathIcon className="h-5 w-5 font-bold text-gray-500" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
import FormbricksLogo from "@/images/logo.svg";
|
||||
import NotionLogo from "@/images/notion.png";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
import { Button } from "@formbricks/ui/Button";
|
||||
|
||||
import { authorize } from "../lib/notion";
|
||||
|
||||
interface ConnectProps {
|
||||
enabled: boolean;
|
||||
environmentId: string;
|
||||
webAppUrl: string;
|
||||
}
|
||||
|
||||
export default function Connect({ enabled, environmentId, webAppUrl }: ConnectProps) {
|
||||
const [isConnecting, setIsConnecting] = useState(false);
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
useEffect(() => {
|
||||
const error = searchParams?.get("error");
|
||||
if (error) {
|
||||
toast.error("Connecting integration failed. Please try again!");
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const handleAuthorizeNotion = async () => {
|
||||
setIsConnecting(true);
|
||||
authorize(environmentId, webAppUrl).then((url: string) => {
|
||||
if (url) {
|
||||
window.location.replace(url);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-[75vh] w-full items-center justify-center">
|
||||
<div className="flex w-1/2 flex-col items-center justify-center rounded-lg bg-white p-8 shadow">
|
||||
<div className="flex w-1/2 justify-center -space-x-4">
|
||||
<div className="flex h-32 w-32 items-center justify-center rounded-full bg-white p-4 shadow-md">
|
||||
<Image className="w-1/2" src={FormbricksLogo} alt="Formbricks Logo" />
|
||||
</div>
|
||||
<div className="flex h-32 w-32 items-center justify-center rounded-full bg-white p-4 shadow-md">
|
||||
<Image className="w-1/2" src={NotionLogo} alt="Google Sheet logo" />
|
||||
</div>
|
||||
</div>
|
||||
<p className="my-8">Sync responses directly with your Notion database.</p>
|
||||
{!enabled && (
|
||||
<p className="mb-8 rounded border-gray-200 bg-gray-100 p-3 text-sm">
|
||||
Notion Integration is not configured in your instance of Formbricks.
|
||||
<br />
|
||||
Please follow the{" "}
|
||||
<Link href="https://formbricks.com/docs/integrations/google-sheets" className="underline">
|
||||
docs
|
||||
</Link>{" "}
|
||||
to configure it.
|
||||
</p>
|
||||
)}
|
||||
<Button variant="darkCTA" loading={isConnecting} onClick={handleAuthorizeNotion} disabled={!enabled}>
|
||||
Connect with Notion
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/integrations/actions";
|
||||
import React, { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
import { timeSince } from "@formbricks/lib/time";
|
||||
import { TEnvironment } from "@formbricks/types/environment";
|
||||
import { TIntegrationNotion, TIntegrationNotionConfigData } from "@formbricks/types/integration/notion";
|
||||
import { Button } from "@formbricks/ui/Button";
|
||||
import { DeleteDialog } from "@formbricks/ui/DeleteDialog";
|
||||
import EmptySpaceFiller from "@formbricks/ui/EmptySpaceFiller";
|
||||
|
||||
interface HomeProps {
|
||||
environment: TEnvironment;
|
||||
notionIntegration: TIntegrationNotion;
|
||||
setOpenAddIntegrationModal: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
setIsConnected: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
setSelectedIntegration: (v: (TIntegrationNotionConfigData & { index: number }) | null) => void;
|
||||
}
|
||||
|
||||
export default function Home({
|
||||
environment,
|
||||
notionIntegration,
|
||||
setOpenAddIntegrationModal,
|
||||
setIsConnected,
|
||||
setSelectedIntegration,
|
||||
}: HomeProps) {
|
||||
const [isDeleteIntegrationModalOpen, setIsDeleteIntegrationModalOpen] = useState(false);
|
||||
const [isDeleting, setisDeleting] = useState(false);
|
||||
const integrationArray = notionIntegration
|
||||
? notionIntegration.config.data
|
||||
? notionIntegration.config.data
|
||||
: []
|
||||
: [];
|
||||
|
||||
const handleDeleteIntegration = async () => {
|
||||
try {
|
||||
setisDeleting(true);
|
||||
await deleteIntegrationAction(notionIntegration.id);
|
||||
setIsConnected(false);
|
||||
toast.success("Integration removed successfully");
|
||||
} catch (error) {
|
||||
toast.error(error.message);
|
||||
} finally {
|
||||
setisDeleting(false);
|
||||
setIsDeleteIntegrationModalOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
const editIntegration = (index: number) => {
|
||||
setSelectedIntegration({
|
||||
...notionIntegration.config.data[index],
|
||||
index: index,
|
||||
});
|
||||
setOpenAddIntegrationModal(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mt-6 flex w-full flex-col items-center justify-center p-6">
|
||||
<div className="flex w-full justify-end">
|
||||
<div className="mr-6 flex items-center">
|
||||
<span className="mr-4 h-4 w-4 rounded-full bg-green-600"></span>
|
||||
<span
|
||||
className="cursor-pointer text-slate-500"
|
||||
onClick={() => {
|
||||
setIsDeleteIntegrationModalOpen(true);
|
||||
}}>
|
||||
Connected with {notionIntegration.config.key.workspace_name} workspace
|
||||
</span>
|
||||
</div>
|
||||
<Button
|
||||
variant="darkCTA"
|
||||
onClick={() => {
|
||||
setSelectedIntegration(null);
|
||||
setOpenAddIntegrationModal(true);
|
||||
}}>
|
||||
Link new database
|
||||
</Button>
|
||||
</div>
|
||||
{!integrationArray || integrationArray.length === 0 ? (
|
||||
<div className="mt-4 w-full">
|
||||
<EmptySpaceFiller
|
||||
type="table"
|
||||
environment={environment}
|
||||
noWidgetRequired={true}
|
||||
emptyMessage="Your Notion integrations will appear here as soon as you add them. ⏲️"
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="mt-4 flex w-full flex-col items-center justify-center">
|
||||
<div className="mt-6 w-full rounded-lg border border-slate-200">
|
||||
<div className="grid h-12 grid-cols-6 content-center rounded-lg bg-slate-100 text-left text-sm font-semibold text-slate-900">
|
||||
<div className="col-span-2 hidden text-center sm:block">Survey</div>
|
||||
<div className="col-span-2 hidden text-center sm:block">Database Name</div>
|
||||
<div className="col-span-2 hidden text-center sm:block">Updated At</div>
|
||||
</div>
|
||||
{integrationArray &&
|
||||
integrationArray.map((data, index) => {
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className="m-2 grid h-16 cursor-pointer grid-cols-6 content-center rounded-lg hover:bg-slate-100"
|
||||
onClick={() => {
|
||||
editIntegration(index);
|
||||
}}>
|
||||
<div className="col-span-2 text-center">{data.surveyName}</div>
|
||||
<div className="col-span-2 text-center">{data.databaseName}</div>
|
||||
<div className="col-span-2 text-center">{timeSince(data.createdAt.toString())}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<DeleteDialog
|
||||
open={isDeleteIntegrationModalOpen}
|
||||
setOpen={setIsDeleteIntegrationModalOpen}
|
||||
deleteWhat="Notion Connection"
|
||||
onDelete={handleDeleteIntegration}
|
||||
text="Are you sure? Your integrations will break."
|
||||
isDeleting={isDeleting}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
"use client";
|
||||
|
||||
import AddIntegrationModal from "@/app/(app)/environments/[environmentId]/integrations/notion/components/AddIntegrationModal";
|
||||
import Connect from "@/app/(app)/environments/[environmentId]/integrations/notion/components/Connect";
|
||||
import Home from "@/app/(app)/environments/[environmentId]/integrations/notion/components/Home";
|
||||
import { useState } from "react";
|
||||
|
||||
import { TEnvironment } from "@formbricks/types/environment";
|
||||
import {
|
||||
TIntegrationNotion,
|
||||
TIntegrationNotionConfigData,
|
||||
TIntegrationNotionDatabase,
|
||||
} from "@formbricks/types/integration/notion";
|
||||
import { TSurvey } from "@formbricks/types/surveys";
|
||||
|
||||
interface NotionWrapperProps {
|
||||
notionIntegration: TIntegrationNotion | undefined;
|
||||
enabled: boolean;
|
||||
environment: TEnvironment;
|
||||
webAppUrl: string;
|
||||
surveys: TSurvey[];
|
||||
databasesArray: TIntegrationNotionDatabase[];
|
||||
}
|
||||
|
||||
export default function NotionWrapper({
|
||||
notionIntegration,
|
||||
enabled,
|
||||
environment,
|
||||
webAppUrl,
|
||||
surveys,
|
||||
databasesArray,
|
||||
}: NotionWrapperProps) {
|
||||
const [isModalOpen, setModalOpen] = useState(false);
|
||||
const [isConnected, setIsConnected] = useState(
|
||||
notionIntegration ? notionIntegration.config.key?.bot_id : false
|
||||
);
|
||||
const [selectedIntegration, setSelectedIntegration] = useState<
|
||||
(TIntegrationNotionConfigData & { index: number }) | null
|
||||
>(null);
|
||||
|
||||
return (
|
||||
<>
|
||||
{isConnected && notionIntegration ? (
|
||||
<>
|
||||
<AddIntegrationModal
|
||||
environmentId={environment.id}
|
||||
surveys={surveys}
|
||||
open={isModalOpen}
|
||||
setOpen={setModalOpen}
|
||||
notionIntegration={notionIntegration}
|
||||
databases={databasesArray}
|
||||
selectedIntegration={selectedIntegration}
|
||||
/>
|
||||
<Home
|
||||
environment={environment}
|
||||
notionIntegration={notionIntegration}
|
||||
setOpenAddIntegrationModal={setModalOpen}
|
||||
setIsConnected={setIsConnected}
|
||||
setSelectedIntegration={setSelectedIntegration}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<Connect enabled={enabled} environmentId={environment.id} webAppUrl={webAppUrl} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { TSurveyQuestionType } from "@formbricks/types/surveys";
|
||||
|
||||
export const TYPE_MAPPING = {
|
||||
[TSurveyQuestionType.CTA]: ["checkbox"],
|
||||
[TSurveyQuestionType.MultipleChoiceMulti]: ["multi_select"],
|
||||
[TSurveyQuestionType.MultipleChoiceSingle]: ["select", "status"],
|
||||
[TSurveyQuestionType.OpenText]: [
|
||||
"created_by",
|
||||
"created_time",
|
||||
"date",
|
||||
"email",
|
||||
"last_edited_by",
|
||||
"last_edited_time",
|
||||
"number",
|
||||
"phone_number",
|
||||
"rich_text",
|
||||
"title",
|
||||
"url",
|
||||
],
|
||||
[TSurveyQuestionType.NPS]: ["number"],
|
||||
[TSurveyQuestionType.Consent]: ["checkbox"],
|
||||
[TSurveyQuestionType.Rating]: ["number"],
|
||||
[TSurveyQuestionType.PictureSelection]: ["url"],
|
||||
[TSurveyQuestionType.FileUpload]: ["url"],
|
||||
};
|
||||
|
||||
export const UNSUPPORTED_TYPES_BY_NOTION = [
|
||||
"rollup",
|
||||
"created_by",
|
||||
"created_time",
|
||||
"last_edited_by",
|
||||
"last_edited_time",
|
||||
];
|
||||
|
||||
export const ERRORS = {
|
||||
MAPPING: "Mapping Error",
|
||||
UNSUPPORTED_TYPE: "Unsupported type by Notion",
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
export const authorize = async (environmentId: string, apiHost: string): Promise<string> => {
|
||||
const res = await fetch(`${apiHost}/api/v1/integrations/notion`, {
|
||||
method: "GET",
|
||||
headers: { environmentId: environmentId },
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
console.error(res.text);
|
||||
throw new Error("Could not create response");
|
||||
}
|
||||
const resJSON = await res.json();
|
||||
const authUrl = resJSON.data.authUrl;
|
||||
return authUrl;
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
import { Button } from "@formbricks/ui/Button";
|
||||
import GoBackButton from "@formbricks/ui/GoBackButton";
|
||||
|
||||
export default function Loading() {
|
||||
return (
|
||||
<div className="mt-6 p-6">
|
||||
<GoBackButton />
|
||||
<div className="mb-6 text-right">
|
||||
<Button
|
||||
variant="darkCTA"
|
||||
className="pointer-events-none animate-pulse cursor-not-allowed select-none bg-gray-200">
|
||||
Link new database
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="rounded-lg border border-slate-200">
|
||||
<div className="grid h-12 grid-cols-6 content-center rounded-lg bg-slate-100 text-left text-sm font-semibold text-slate-900">
|
||||
<div className="col-span-2 text-center ">Survey</div>
|
||||
<div className="col-span-2 text-center">Database Name</div>
|
||||
<div className="col-span-2 text-center">Updated At</div>
|
||||
</div>
|
||||
<div className="grid-cols-7">
|
||||
{[...Array(3)].map((_, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="mt-2 grid h-16 grid-cols-12 content-center rounded-lg hover:bg-slate-100">
|
||||
<div className="col-span-3 flex items-center pl-6 text-sm">
|
||||
<div className="text-left">
|
||||
<div className="font-medium text-slate-900">
|
||||
<div className="mt-0 h-4 w-48 animate-pulse rounded-full bg-gray-200"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-1 my-auto flex items-center justify-center text-center text-sm text-slate-500">
|
||||
<div className="font-medium text-slate-500">
|
||||
<div className="mt-0 h-4 w-24 animate-pulse rounded-full bg-gray-200"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-4 my-auto flex items-center justify-center text-center text-sm text-slate-500">
|
||||
<div className="font-medium text-slate-500">
|
||||
<div className="mt-0 h-4 w-36 animate-pulse rounded-full bg-gray-200"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-2 my-auto flex items-center justify-center text-center text-sm text-slate-500">
|
||||
<div className="font-medium text-slate-500">
|
||||
<div className="mt-0 h-4 w-24 animate-pulse rounded-full bg-gray-200"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-2 my-auto flex items-center justify-center whitespace-nowrap text-center text-sm text-slate-500">
|
||||
<div className="h-4 w-16 animate-pulse rounded-full bg-gray-200"></div>
|
||||
</div>
|
||||
<div className="text-center"></div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import NotionWrapper from "@/app/(app)/environments/[environmentId]/integrations/notion/components/NotionWrapper";
|
||||
|
||||
import {
|
||||
NOTION_AUTH_URL,
|
||||
NOTION_OAUTH_CLIENT_ID,
|
||||
NOTION_OAUTH_CLIENT_SECRET,
|
||||
NOTION_REDIRECT_URI,
|
||||
WEBAPP_URL,
|
||||
} from "@formbricks/lib/constants";
|
||||
import { getEnvironment } from "@formbricks/lib/environment/service";
|
||||
import { getIntegrationByType } from "@formbricks/lib/integration/service";
|
||||
import { getNotionDatabases } from "@formbricks/lib/notion/service";
|
||||
import { getSurveys } from "@formbricks/lib/survey/service";
|
||||
import { TIntegrationNotion, TIntegrationNotionDatabase } from "@formbricks/types/integration/notion";
|
||||
import GoBackButton from "@formbricks/ui/GoBackButton";
|
||||
|
||||
export default async function Notion({ params }) {
|
||||
const enabled = !!(
|
||||
NOTION_OAUTH_CLIENT_ID &&
|
||||
NOTION_OAUTH_CLIENT_SECRET &&
|
||||
NOTION_AUTH_URL &&
|
||||
NOTION_REDIRECT_URI
|
||||
);
|
||||
const [surveys, notionIntegration, environment] = await Promise.all([
|
||||
getSurveys(params.environmentId),
|
||||
getIntegrationByType(params.environmentId, "notion"),
|
||||
getEnvironment(params.environmentId),
|
||||
]);
|
||||
|
||||
if (!environment) {
|
||||
throw new Error("Environment not found");
|
||||
}
|
||||
|
||||
let databasesArray: TIntegrationNotionDatabase[] = [];
|
||||
if (notionIntegration && (notionIntegration as TIntegrationNotion).config.key?.bot_id) {
|
||||
databasesArray = await getNotionDatabases(environment.id);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<GoBackButton url={`${WEBAPP_URL}/environments/${params.environmentId}/integrations`} />
|
||||
<NotionWrapper
|
||||
enabled={enabled}
|
||||
surveys={surveys}
|
||||
environment={environment}
|
||||
notionIntegration={notionIntegration as TIntegrationNotion}
|
||||
webAppUrl={WEBAPP_URL}
|
||||
databasesArray={databasesArray}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import JsLogo from "@/images/jslogo.png";
|
||||
import MakeLogo from "@/images/make-small.png";
|
||||
import n8nLogo from "@/images/n8n.png";
|
||||
import notionLogo from "@/images/notion.png";
|
||||
import WebhookLogo from "@/images/webhook.png";
|
||||
import ZapierLogo from "@/images/zapier-small.png";
|
||||
import { getServerSession } from "next-auth";
|
||||
@@ -13,6 +14,7 @@ import { getMembershipByUserIdTeamId } from "@formbricks/lib/membership/service"
|
||||
import { getAccessFlags } from "@formbricks/lib/membership/utils";
|
||||
import { getTeamByEnvironmentId } from "@formbricks/lib/team/service";
|
||||
import { getWebhookCountBySource } from "@formbricks/lib/webhook/service";
|
||||
import { TIntegrationType } from "@formbricks/types/integration";
|
||||
import { Card } from "@formbricks/ui/Card";
|
||||
import { ErrorComponent } from "@formbricks/ui/ErrorComponent";
|
||||
|
||||
@@ -42,6 +44,8 @@ export default async function IntegrationsPage({ params }) {
|
||||
getWebhookCountBySource(environmentId, "n8n"),
|
||||
]);
|
||||
|
||||
const isIntegrationConnected = (type: TIntegrationType) =>
|
||||
integrations.some((integration) => integration.type === type);
|
||||
if (!session) {
|
||||
throw new Error("Session not found");
|
||||
}
|
||||
@@ -53,11 +57,10 @@ export default async function IntegrationsPage({ params }) {
|
||||
const currentUserMembership = await getMembershipByUserIdTeamId(session?.user.id, team.id);
|
||||
const { isViewer } = getAccessFlags(currentUserMembership?.role);
|
||||
|
||||
const containsGoogleSheetIntegration = integrations.some(
|
||||
(integration) => integration.type === "googleSheets"
|
||||
);
|
||||
|
||||
const containsAirtableIntegration = integrations.some((integration) => integration.type === "airtable");
|
||||
const isGoogleSheetsIntegrationConnected = isIntegrationConnected("googleSheets");
|
||||
const isNotionIntegrationConnected = isIntegrationConnected("notion");
|
||||
const isAirtableIntegrationConnected = isIntegrationConnected("airtable");
|
||||
const isN8nIntegrationConnected = isIntegrationConnected("n8n");
|
||||
|
||||
const integrationCards = [
|
||||
{
|
||||
@@ -108,7 +111,7 @@ export default async function IntegrationsPage({ params }) {
|
||||
},
|
||||
{
|
||||
connectHref: `/environments/${params.environmentId}/integrations/google-sheets`,
|
||||
connectText: `${containsGoogleSheetIntegration ? "Manage Sheets" : "Connect"}`,
|
||||
connectText: `${isGoogleSheetsIntegrationConnected ? "Manage Sheets" : "Connect"}`,
|
||||
connectNewTab: false,
|
||||
docsHref: "https://formbricks.com/docs/integrations/google-sheets",
|
||||
docsText: "Docs",
|
||||
@@ -116,12 +119,12 @@ export default async function IntegrationsPage({ params }) {
|
||||
label: "Google Sheets",
|
||||
description: "Instantly populate your spreadsheets with survey data",
|
||||
icon: <Image src={GoogleSheetsLogo} alt="Google sheets Logo" />,
|
||||
connected: containsGoogleSheetIntegration ? true : false,
|
||||
statusText: containsGoogleSheetIntegration ? "Connected" : "Not Connected",
|
||||
connected: isGoogleSheetsIntegrationConnected,
|
||||
statusText: isGoogleSheetsIntegrationConnected ? "Connected" : "Not Connected",
|
||||
},
|
||||
{
|
||||
connectHref: `/environments/${params.environmentId}/integrations/airtable`,
|
||||
connectText: `${containsAirtableIntegration ? "Manage Table" : "Connect"}`,
|
||||
connectText: `${isAirtableIntegrationConnected ? "Manage Table" : "Connect"}`,
|
||||
connectNewTab: false,
|
||||
docsHref: "https://formbricks.com/docs/integrations/airtable",
|
||||
docsText: "Docs",
|
||||
@@ -129,15 +132,15 @@ export default async function IntegrationsPage({ params }) {
|
||||
label: "Airtable",
|
||||
description: "Instantly populate your airtable table with survey data",
|
||||
icon: <Image src={AirtableLogo} alt="Airtable Logo" />,
|
||||
connected: containsAirtableIntegration ? true : false,
|
||||
statusText: containsAirtableIntegration ? "Connected" : "Not Connected",
|
||||
connected: isAirtableIntegrationConnected,
|
||||
statusText: isAirtableIntegrationConnected ? "Connected" : "Not Connected",
|
||||
},
|
||||
{
|
||||
docsHref: "https://formbricks.com/docs/integrations/n8n",
|
||||
connectText: `${isN8nIntegrationConnected ? "Manage" : "Connect"}`,
|
||||
docsText: "Docs",
|
||||
docsNewTab: true,
|
||||
connectHref: "https://n8n.io",
|
||||
connectText: "Connect",
|
||||
connectNewTab: true,
|
||||
label: "n8n",
|
||||
description: "Integrate Formbricks with 350+ apps via n8n",
|
||||
@@ -168,6 +171,19 @@ export default async function IntegrationsPage({ params }) {
|
||||
? "Not Connected"
|
||||
: `${makeWebhookCount} integration`,
|
||||
},
|
||||
{
|
||||
connectHref: `/environments/${params.environmentId}/integrations/notion`,
|
||||
connectText: `${isNotionIntegrationConnected ? "Manage" : "Connect"}`,
|
||||
connectNewTab: false,
|
||||
docsHref: "https://formbricks.com/docs/integrations/notion",
|
||||
docsText: "Docs",
|
||||
docsNewTab: true,
|
||||
label: "Notion",
|
||||
description: "Send data to your Notion database",
|
||||
icon: <Image src={notionLogo} alt="Notion Logo" />,
|
||||
connected: isNotionIntegrationConnected,
|
||||
statusText: isNotionIntegrationConnected ? "Connected" : "Not Connected",
|
||||
},
|
||||
];
|
||||
|
||||
if (isViewer) return <ErrorComponent />;
|
||||
|
||||
@@ -28,8 +28,10 @@ const MembersLoading = () => (
|
||||
</div>
|
||||
|
||||
<div className="p-4">
|
||||
{[1, 2, 3].map((_) => (
|
||||
<div className="grid-cols-20 grid h-12 content-center rounded-t-lg bg-white p-4 text-left text-sm font-semibold text-slate-900">
|
||||
{[1, 2, 3].map((i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="grid-cols-20 grid h-12 content-center rounded-t-lg bg-white p-4 text-left text-sm font-semibold text-slate-900">
|
||||
<Skeleton className="col-span-2 h-10 w-10 rounded-full" />
|
||||
<Skeleton className="col-span-5 h-8 w-24" />
|
||||
<Skeleton className="col-span-5 h-8 w-24" />
|
||||
|
||||
@@ -109,7 +109,7 @@ if (typeof window !== "undefined") {
|
||||
</p>
|
||||
<CodeBlock language="js">{`<!-- START Formbricks Surveys -->
|
||||
<script type="text/javascript">
|
||||
!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://unpkg.com/@formbricks/js@^1.2.0/dist/index.umd.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),setTimeout(function(){window.formbricks.init({environmentId: "${environmentId}", apiHost: "${window.location.protocol}//${window.location.host}"})},500)}();
|
||||
!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://unpkg.com/@formbricks/js@^1.4.0/dist/index.umd.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),setTimeout(function(){window.formbricks.init({environmentId: "${environmentId}", apiHost: "${window.location.protocol}//${window.location.host}"})},500)}();
|
||||
</script>
|
||||
<!-- END Formbricks Surveys -->`}</CodeBlock>
|
||||
<p className="text-lg font-semibold text-slate-800">You're done 🎉</p>
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function CTASummary({ questionSummary }: CTASummaryProps) {
|
||||
return (
|
||||
<div className=" rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className=" flex items-center rounded-lg bg-slate-100 p-2 ">
|
||||
@@ -43,6 +43,9 @@ export default function CTASummary({ questionSummary }: CTASummaryProps) {
|
||||
<InboxStackIcon className="mr-2 h-4 w-4 " />
|
||||
{ctr.count} responses
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-5 rounded-b-lg bg-white px-4 pb-6 pt-4 text-sm md:px-6 md:text-base">
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import Headline from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/Headline";
|
||||
import { questionTypes } from "@/app/lib/questions";
|
||||
import { InboxStackIcon } from "@heroicons/react/24/solid";
|
||||
import Link from "next/link";
|
||||
|
||||
import { getPersonIdentifier } from "@formbricks/lib/person/util";
|
||||
import { timeSince } from "@formbricks/lib/time";
|
||||
import { TSurveyCalQuestion, TSurveyQuestionSummary } from "@formbricks/types/surveys";
|
||||
import { PersonAvatar } from "@formbricks/ui/Avatars";
|
||||
|
||||
interface CalSummaryProps {
|
||||
questionSummary: TSurveyQuestionSummary<TSurveyCalQuestion>;
|
||||
environmentId: string;
|
||||
}
|
||||
|
||||
export default function CalSummary({ questionSummary, environmentId }: CalSummaryProps) {
|
||||
const questionTypeInfo = questionTypes.find((type) => type.id === questionSummary.question.type);
|
||||
|
||||
return (
|
||||
<div className="rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2 ">
|
||||
{questionTypeInfo && <questionTypeInfo.icon className="mr-2 h-4 w-4 " />}
|
||||
{questionTypeInfo ? questionTypeInfo.label : "Unknown Question Type"} Question
|
||||
</div>
|
||||
<div className=" flex items-center rounded-lg bg-slate-100 p-2">
|
||||
<InboxStackIcon className="mr-2 h-4 w-4" />
|
||||
{questionSummary.responses.length} Responses
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded-b-lg bg-white ">
|
||||
<div className="grid h-10 grid-cols-4 items-center border-y border-slate-200 bg-slate-100 text-sm font-bold text-slate-600">
|
||||
<div className="pl-4 md:pl-6">User</div>
|
||||
<div className="col-span-2 pl-4 md:pl-6">Response</div>
|
||||
<div className="px-4 md:px-6">Time</div>
|
||||
</div>
|
||||
{questionSummary.responses.map((response) => {
|
||||
const displayIdentifier = response.person ? getPersonIdentifier(response.person) : null;
|
||||
return (
|
||||
<div
|
||||
key={response.id}
|
||||
className="grid grid-cols-4 items-center border-b border-slate-100 py-2 text-sm text-slate-800 md:text-base">
|
||||
<div className="pl-4 md:pl-6">
|
||||
{response.person ? (
|
||||
<Link
|
||||
className="ph-no-capture group flex items-center"
|
||||
href={`/environments/${environmentId}/people/${response.person.id}`}>
|
||||
<div className="hidden md:flex">
|
||||
<PersonAvatar personId={response.person.id} />
|
||||
</div>
|
||||
<p className="ph-no-capture break-all text-slate-600 group-hover:underline md:ml-2">
|
||||
{displayIdentifier}
|
||||
</p>
|
||||
</Link>
|
||||
) : (
|
||||
<div className="group flex items-center">
|
||||
<div className="hidden md:flex">
|
||||
<PersonAvatar personId="anonymous" />
|
||||
</div>
|
||||
<p className="break-all text-slate-600 md:ml-2">Anonymous</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="ph-no-capture col-span-2 whitespace-pre-wrap pl-6 font-semibold capitalize">
|
||||
{response.value}
|
||||
</div>
|
||||
<div className="px-4 text-slate-500 md:px-6">{timeSince(response.updatedAt.toISOString())}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export default function ConsentSummary({ questionSummary }: ConsentSummaryProps)
|
||||
return (
|
||||
<div className=" rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className=" flex items-center rounded-lg bg-slate-100 p-2">
|
||||
{questionTypeInfo && <questionTypeInfo.icon className="mr-2 h-4 w-4 " />}
|
||||
@@ -50,6 +50,9 @@ export default function ConsentSummary({ questionSummary }: ConsentSummaryProps)
|
||||
<InboxStackIcon className="mr-2 h-4 w-4 " />
|
||||
{ctr.count} responses
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-5 rounded-b-lg bg-white px-4 pb-6 pt-4 text-sm md:px-6 md:text-base">
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function DateQuestionSummary({
|
||||
return (
|
||||
<div className="rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2 ">
|
||||
@@ -38,6 +38,9 @@ export default function DateQuestionSummary({
|
||||
<InboxStackIcon className="mr-2 h-4 w-4" />
|
||||
{questionSummary.responses.length} Responses
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded-b-lg bg-white ">
|
||||
@@ -81,15 +84,15 @@ export default function DateQuestionSummary({
|
||||
);
|
||||
})}
|
||||
|
||||
<div className="my-1 flex justify-center">
|
||||
{displayCount < questionSummary.responses.length && (
|
||||
{displayCount < questionSummary.responses.length && (
|
||||
<div className="my-1 flex justify-center">
|
||||
<button
|
||||
onClick={() => setDisplayCount((prevCount) => prevCount + responsesPerPage)}
|
||||
className="my-2 flex h-8 items-center justify-center rounded-lg border border-gray-300 bg-white px-3 text-sm text-gray-500 hover:bg-gray-100 hover:text-gray-700">
|
||||
Show more
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function FileUploadSummary({ questionSummary, environmentId }: Fi
|
||||
return (
|
||||
<div className="rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2 ">
|
||||
@@ -32,6 +32,9 @@ export default function FileUploadSummary({ questionSummary, environmentId }: Fi
|
||||
<InboxStackIcon className="mr-2 h-4 w-4" />
|
||||
{questionSummary.responses.length} Responses
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded-b-lg bg-white ">
|
||||
@@ -80,7 +83,12 @@ export default function FileUploadSummary({ questionSummary, environmentId }: Fi
|
||||
(response.value.length > 0 ? (
|
||||
response.value.map((fileUrl, index) => (
|
||||
<div className="relative m-2 rounded-lg bg-slate-200" key={fileUrl}>
|
||||
<a href={fileUrl as string} key={index} download target="_blank">
|
||||
<a
|
||||
href={fileUrl as string}
|
||||
key={index}
|
||||
download
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
<div className="absolute right-0 top-0 m-2">
|
||||
<div className="flex h-8 w-8 items-center justify-center rounded-lg bg-slate-50 hover:bg-white">
|
||||
<DownloadIcon className="h-6 text-slate-500" />
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
interface HeadlineProps {
|
||||
headline: string;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
export default function Headline({ headline, required = true }: HeadlineProps) {
|
||||
export default function Headline({ headline }: HeadlineProps) {
|
||||
return (
|
||||
<div className={"align-center flex justify-between gap-4 "}>
|
||||
<h3 className="pb-1 text-lg font-semibold text-slate-900 md:text-xl">{headline}</h3>
|
||||
{!required && (
|
||||
<span className="text-md pb-1 font-light leading-7 text-gray-500" tabIndex={-1}>
|
||||
Optional
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ export default function MultipleChoiceSummary({
|
||||
return (
|
||||
<div className=" rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">
|
||||
@@ -142,6 +142,9 @@ export default function MultipleChoiceSummary({
|
||||
<InboxStackIcon className="mr-2 h-4 w-4 " />
|
||||
{totalResponses} responses
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
{/* <div className=" flex items-center rounded-lg bg-slate-100 p-2">
|
||||
<ArrowTrendingUpIcon className="mr-2 h-4 w-4" />
|
||||
2.8 average
|
||||
|
||||
@@ -80,7 +80,7 @@ export default function NPSSummary({ questionSummary }: NPSSummaryProps) {
|
||||
return (
|
||||
<div className=" rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">
|
||||
@@ -91,6 +91,9 @@ export default function NPSSummary({ questionSummary }: NPSSummaryProps) {
|
||||
<InboxStackIcon className="mr-2 h-4 w-4 " />
|
||||
{result.total} responses
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-5 rounded-b-lg bg-white px-4 pb-6 pt-4 text-sm md:px-6 md:text-base">
|
||||
|
||||
@@ -27,8 +27,7 @@ export default function OpenTextSummary({
|
||||
return (
|
||||
<div className="rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2 ">
|
||||
{questionTypeInfo && <questionTypeInfo.icon className="mr-2 h-4 w-4 " />}
|
||||
@@ -38,6 +37,9 @@ export default function OpenTextSummary({
|
||||
<InboxStackIcon className="mr-2 h-4 w-4" />
|
||||
{questionSummary.responses.length} Responses
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded-b-lg bg-white ">
|
||||
@@ -81,15 +83,15 @@ export default function OpenTextSummary({
|
||||
);
|
||||
})}
|
||||
|
||||
<div className="my-1 flex justify-center">
|
||||
{displayCount < questionSummary.responses.length && (
|
||||
{displayCount < questionSummary.responses.length && (
|
||||
<div className="flex justify-center py-1">
|
||||
<button
|
||||
onClick={() => setDisplayCount((prevCount) => prevCount + responsesPerPage)}
|
||||
className="my-2 flex h-8 items-center justify-center rounded-lg border border-gray-300 bg-white px-3 text-sm text-gray-500 hover:bg-gray-100 hover:text-gray-700">
|
||||
Show more
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -74,7 +74,7 @@ export default function PictureChoiceSummary({ questionSummary }: PictureChoiceS
|
||||
return (
|
||||
<div className=" rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">
|
||||
@@ -88,6 +88,9 @@ export default function PictureChoiceSummary({ questionSummary }: PictureChoiceS
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">
|
||||
{isMulti ? "Multi" : "Single"} Select
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-5 rounded-b-lg bg-white px-4 pb-6 pt-4 text-sm md:px-6 md:text-base">
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function RatingSummary({ questionSummary }: RatingSummaryProps) {
|
||||
return (
|
||||
<div className=" rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
|
||||
<div className="space-y-2 px-4 pb-5 pt-6 md:px-6">
|
||||
<Headline headline={questionSummary.question.headline} required={questionSummary.question.required} />
|
||||
<Headline headline={questionSummary.question.headline} />
|
||||
|
||||
<div className="flex space-x-2 text-xs font-semibold text-slate-600 md:text-sm">
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">
|
||||
@@ -93,9 +93,12 @@ export default function RatingSummary({ questionSummary }: RatingSummaryProps) {
|
||||
<InboxStackIcon className="mr-2 h-4 w-4 " />
|
||||
{totalResponses} responses
|
||||
</div>
|
||||
{!questionSummary.question.required && (
|
||||
<div className="flex items-center rounded-lg bg-slate-100 p-2">Optional</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-5 bg-white px-4 pb-6 pt-4 text-sm md:px-6 md:text-base">
|
||||
<div className="space-y-5 rounded-b-lg bg-white px-4 pb-6 pt-4 text-sm md:px-6 md:text-base">
|
||||
{results.map((result: any) => (
|
||||
<div key={result.label}>
|
||||
<div className="text flex justify-between px-2 pb-2">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import EmptyInAppSurveys from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/EmptyInAppSurveys";
|
||||
import CalSummary from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CalSummary";
|
||||
import ConsentSummary from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ConsentSummary";
|
||||
import HiddenFieldsSummary from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/HiddenFieldsSummary";
|
||||
|
||||
@@ -6,6 +7,7 @@ import { TEnvironment } from "@formbricks/types/environment";
|
||||
import { TResponse } from "@formbricks/types/responses";
|
||||
import { TSurveyQuestionType } from "@formbricks/types/surveys";
|
||||
import type {
|
||||
TSurveyCalQuestion,
|
||||
TSurveyDateQuestion,
|
||||
TSurveyFileUploadQuestion,
|
||||
TSurveyPictureSelectionQuestion,
|
||||
@@ -159,6 +161,16 @@ export default function SummaryList({ environment, survey, responses, responsesP
|
||||
);
|
||||
}
|
||||
|
||||
if (questionSummary.question.type === TSurveyQuestionType.Cal) {
|
||||
return (
|
||||
<CalSummary
|
||||
key={questionSummary.question.id}
|
||||
questionSummary={questionSummary as TSurveyQuestionSummary<TSurveyCalQuestion>}
|
||||
environmentId={environment.id}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
})}
|
||||
|
||||
|
||||
@@ -284,6 +284,18 @@ const EmailTemplate = ({ survey, surveyUrl, brandColor }: EmailTemplateProps) =>
|
||||
<EmailFooter />
|
||||
</EmailTemplateWrapper>
|
||||
);
|
||||
case TSurveyQuestionType.Cal:
|
||||
return (
|
||||
<EmailTemplateWrapper surveyUrl={url} brandColor={brandColor}>
|
||||
<Text className="m-0 mb-2 block p-0 text-sm font-normal leading-6 text-slate-500">
|
||||
{firstQuestion.subheader}
|
||||
</Text>
|
||||
<Text className="m-0 mb-2 block p-0 text-sm font-normal leading-6 text-slate-500">
|
||||
You have been invited to schedule a meet via cal.com Open Survey to continue{" "}
|
||||
</Text>
|
||||
<EmailFooter />
|
||||
</EmailTemplateWrapper>
|
||||
);
|
||||
case TSurveyQuestionType.Date:
|
||||
return (
|
||||
<EmailTemplateWrapper surveyUrl={url} brandColor={brandColor}>
|
||||
|
||||
@@ -5,11 +5,7 @@ import {
|
||||
useResponseFilter,
|
||||
} from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext";
|
||||
import { fetchFile } from "@/app/lib/fetchFile";
|
||||
import {
|
||||
generateQuestionAndFilterOptions,
|
||||
generateQuestionsAndAttributes,
|
||||
getTodayDate,
|
||||
} from "@/app/lib/surveys/surveys";
|
||||
import { generateQuestionAndFilterOptions, getTodayDate } from "@/app/lib/surveys/surveys";
|
||||
import { createId } from "@paralleldrive/cuid2";
|
||||
import { differenceInDays, format, subDays } from "date-fns";
|
||||
import { ChevronDown, ChevronUp, DownloadIcon } from "lucide-react";
|
||||
@@ -91,7 +87,7 @@ const CustomFilter = ({ environmentTags, responses, survey, totalResponses }: Cu
|
||||
|
||||
const datePickerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const getMatchQandA = (responses: any, survey: any) => {
|
||||
const getMatchQandA = (responses: TResponse[], survey: TSurvey) => {
|
||||
if (survey && responses) {
|
||||
// Create a mapping of question IDs to their headlines
|
||||
const questionIdToHeadline = {};
|
||||
@@ -145,20 +141,58 @@ const CustomFilter = ({ environmentTags, responses, survey, totalResponses }: Cu
|
||||
return "my_survey_responses";
|
||||
}, [survey]);
|
||||
|
||||
function extracMetadataKeys(obj, parentKey = "") {
|
||||
let keys: string[] = [];
|
||||
|
||||
for (let key in obj) {
|
||||
if (typeof obj[key] === "object" && obj[key] !== null) {
|
||||
keys = keys.concat(extracMetadataKeys(obj[key], parentKey + key + " - "));
|
||||
} else {
|
||||
keys.push(parentKey + key);
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
const downloadResponses = useCallback(
|
||||
async (filter: FilterDownload, filetype: "csv" | "xlsx") => {
|
||||
const downloadResponse = filter === FilterDownload.ALL ? totalResponses : responses;
|
||||
const { attributeMap, questionNames } = generateQuestionsAndAttributes(survey, downloadResponse);
|
||||
const questionNames = survey.questions?.map((question) => question.headline);
|
||||
const hiddenFieldIds = survey.hiddenFields.fieldIds;
|
||||
const hiddenFieldResponse = {};
|
||||
let metaDataFields = extracMetadataKeys(downloadResponse[0].meta);
|
||||
const userAttributes = ["Init Attribute 1", "Init Attribute 2"];
|
||||
const matchQandA = getMatchQandA(downloadResponse, survey);
|
||||
const jsonData = matchQandA.map((response) => {
|
||||
const fileResponse = {
|
||||
const basicInfo = {
|
||||
"Response ID": response.id,
|
||||
Timestamp: response.createdAt,
|
||||
Finished: response.finished,
|
||||
"Survey ID": response.surveyId,
|
||||
"Formbricks User ID": response.person?.id ?? "",
|
||||
};
|
||||
const metaDataKeys = extracMetadataKeys(response.meta);
|
||||
let metaData = {};
|
||||
metaDataKeys.forEach((key) => {
|
||||
if (!metaDataFields.includes(key)) metaDataFields.push(key);
|
||||
if (response.meta) {
|
||||
if (key.includes("-")) {
|
||||
const nestedKeyArray = key.split("-");
|
||||
metaData[key] = response.meta[nestedKeyArray[0].trim()][nestedKeyArray[1].trim()] ?? "";
|
||||
} else {
|
||||
metaData[key] = response.meta[key] ?? "";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const personAttributes = response.personAttributes;
|
||||
if (hiddenFieldIds && hiddenFieldIds.length > 0) {
|
||||
hiddenFieldIds.forEach((hiddenFieldId) => {
|
||||
hiddenFieldResponse[hiddenFieldId] = response.data[hiddenFieldId] ?? "";
|
||||
});
|
||||
}
|
||||
const fileResponse = { ...basicInfo, ...metaData, ...personAttributes, ...hiddenFieldResponse };
|
||||
// Map each question name to its corresponding answer
|
||||
questionNames.forEach((questionName: string) => {
|
||||
const matchingQuestion = response.responses.find((question) => question.question === questionName);
|
||||
@@ -177,18 +211,6 @@ const CustomFilter = ({ environmentTags, responses, survey, totalResponses }: Cu
|
||||
return fileResponse;
|
||||
});
|
||||
|
||||
// Add attribute columns to the file
|
||||
Object.keys(attributeMap).forEach((attributeName) => {
|
||||
const attributeValues = attributeMap[attributeName];
|
||||
Object.keys(attributeValues).forEach((personId) => {
|
||||
const value = attributeValues[personId];
|
||||
const matchingResponse = jsonData.find((response) => response["Formbricks User ID"] === personId);
|
||||
if (matchingResponse) {
|
||||
matchingResponse[attributeName] = value;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Fields which will be used as column headers in the file
|
||||
const fields = [
|
||||
"Response ID",
|
||||
@@ -196,8 +218,10 @@ const CustomFilter = ({ environmentTags, responses, survey, totalResponses }: Cu
|
||||
"Finished",
|
||||
"Survey ID",
|
||||
"Formbricks User ID",
|
||||
...Object.keys(attributeMap),
|
||||
...metaDataFields,
|
||||
...questionNames,
|
||||
...(hiddenFieldIds ?? []),
|
||||
...(survey.type === "web" ? userAttributes : []),
|
||||
];
|
||||
|
||||
let response;
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import { PlusIcon, TrashIcon } from "@heroicons/react/24/solid";
|
||||
import { useState } from "react";
|
||||
|
||||
import { TSurveyCalQuestion } from "@formbricks/types/surveys";
|
||||
import { Button } from "@formbricks/ui/Button";
|
||||
import { Input } from "@formbricks/ui/Input";
|
||||
import { Label } from "@formbricks/ui/Label";
|
||||
|
||||
interface CalQuestionFormProps {
|
||||
question: TSurveyCalQuestion;
|
||||
questionIdx: number;
|
||||
updateQuestion: (questionIdx: number, updatedAttributes: any) => void;
|
||||
lastQuestion: boolean;
|
||||
isInValid: boolean;
|
||||
}
|
||||
|
||||
export default function CalQuestionForm({
|
||||
question,
|
||||
questionIdx,
|
||||
updateQuestion,
|
||||
isInValid,
|
||||
}: CalQuestionFormProps): JSX.Element {
|
||||
const [showSubheader, setShowSubheader] = useState(!!question.subheader);
|
||||
|
||||
return (
|
||||
<form>
|
||||
<div className="mt-3">
|
||||
<Label htmlFor="headline">Question</Label>
|
||||
<div className="mt-2">
|
||||
<Input
|
||||
autoFocus
|
||||
id="headline"
|
||||
name="headline"
|
||||
value={question.headline}
|
||||
onChange={(e) => updateQuestion(questionIdx, { headline: e.target.value })}
|
||||
isInvalid={isInValid && question.headline.trim() === ""}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
{showSubheader && (
|
||||
<>
|
||||
<Label htmlFor="subheader">Description</Label>
|
||||
<div className="mt-2 inline-flex w-full items-center">
|
||||
<Input
|
||||
id="subheader"
|
||||
name="subheader"
|
||||
value={question.subheader}
|
||||
onChange={(e) => updateQuestion(questionIdx, { subheader: e.target.value })}
|
||||
/>
|
||||
<TrashIcon
|
||||
className="ml-2 h-4 w-4 cursor-pointer text-slate-400 hover:text-slate-500"
|
||||
onClick={() => {
|
||||
setShowSubheader(false);
|
||||
updateQuestion(questionIdx, { subheader: "" });
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{!showSubheader && (
|
||||
<Button size="sm" variant="minimal" type="button" onClick={() => setShowSubheader(true)}>
|
||||
<PlusIcon className="mr-1 h-4 w-4" />
|
||||
Add Description
|
||||
</Button>
|
||||
)}
|
||||
<div className="mt-3">
|
||||
<Label htmlFor="calUserName">Add your Cal.com username or username/event</Label>
|
||||
<div className="mt-2">
|
||||
<Input
|
||||
id="calUserName"
|
||||
name="calUserName"
|
||||
value={question.calUserName}
|
||||
onChange={(e) => updateQuestion(questionIdx, { calUserName: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -83,6 +83,7 @@ export default function LogicEditor({
|
||||
consent: ["skipped", "accepted"],
|
||||
pictureSelection: ["submitted", "skipped"],
|
||||
fileUpload: ["uploaded", "notUploaded"],
|
||||
cal: ["skipped", "booked"],
|
||||
};
|
||||
|
||||
const logicConditions: LogicConditions = {
|
||||
@@ -101,16 +102,6 @@ export default function LogicEditor({
|
||||
values: null,
|
||||
unique: true,
|
||||
},
|
||||
uploaded: {
|
||||
label: "has uploaded file",
|
||||
values: null,
|
||||
unique: true,
|
||||
},
|
||||
notUploaded: {
|
||||
label: "has not uploaded file",
|
||||
values: null,
|
||||
unique: true,
|
||||
},
|
||||
clicked: {
|
||||
label: "is clicked",
|
||||
values: null,
|
||||
@@ -150,6 +141,21 @@ export default function LogicEditor({
|
||||
values: questionValues,
|
||||
multiSelect: true,
|
||||
},
|
||||
uploaded: {
|
||||
label: "has uploaded file",
|
||||
values: null,
|
||||
unique: true,
|
||||
},
|
||||
notUploaded: {
|
||||
label: "has not uploaded file",
|
||||
values: null,
|
||||
unique: true,
|
||||
},
|
||||
booked: {
|
||||
label: "has a call booked",
|
||||
values: null,
|
||||
unique: true,
|
||||
},
|
||||
};
|
||||
|
||||
const addLogic = () => {
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
ChevronRightIcon,
|
||||
CursorArrowRippleIcon,
|
||||
ListBulletIcon,
|
||||
PhoneIcon,
|
||||
PhotoIcon,
|
||||
PresentationChartBarIcon,
|
||||
QueueListIcon,
|
||||
@@ -31,6 +32,7 @@ import { Label } from "@formbricks/ui/Label";
|
||||
import { Switch } from "@formbricks/ui/Switch";
|
||||
|
||||
import CTAQuestionForm from "./CTAQuestionForm";
|
||||
import CalQuestionForm from "./CalQuestionForm";
|
||||
import ConsentQuestionForm from "./ConsentQuestionForm";
|
||||
import FileUploadQuestionForm from "./FileUploadQuestionForm";
|
||||
import MultipleChoiceMultiForm from "./MultipleChoiceMultiForm";
|
||||
@@ -152,6 +154,8 @@ export default function QuestionCard({
|
||||
<PhotoIcon />
|
||||
) : question.type === TSurveyQuestionType.Date ? (
|
||||
<CalendarDaysIcon />
|
||||
) : question.type === TSurveyQuestionType.Cal ? (
|
||||
<PhoneIcon />
|
||||
) : null}
|
||||
</div>
|
||||
<div>
|
||||
@@ -268,6 +272,14 @@ export default function QuestionCard({
|
||||
lastQuestion={lastQuestion}
|
||||
isInValid={isInValid}
|
||||
/>
|
||||
) : question.type === TSurveyQuestionType.Cal ? (
|
||||
<CalQuestionForm
|
||||
question={question}
|
||||
questionIdx={questionIdx}
|
||||
updateQuestion={updateQuestion}
|
||||
lastQuestion={lastQuestion}
|
||||
isInValid={isInValid}
|
||||
/>
|
||||
) : null}
|
||||
<div className="mt-4">
|
||||
<Collapsible.Root open={openAdvanced} onOpenChange={setOpenAdvanced} className="mt-5">
|
||||
|
||||