Compare commits

..

71 Commits

Author SHA1 Message Date
Matti Nannt
f5110fe9c1 fix: docker build errors (#1762) 2023-12-07 22:24:22 +00:00
Matti Nannt
8244a5fa48 fix: update next-config remotePatterns to work with http (#1761) 2023-12-07 14:37:03 +00:00
Dhruwang Jariwala
59936e54a0 feat: add playwright e2e tests infrastructure (#1742)
Co-authored-by: ShubhamPalriwala <spalriwalau@gmail.com>
2023-12-07 10:51:45 +00:00
Dhruwang Jariwala
5468287f9b fix: Survey editor caution text fix (#1755)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-12-07 09:40:48 +00:00
Anjy Gupta
22e55677ae fix: Gitpod file upload and background overlay (#1756) 2023-12-07 09:28:54 +00:00
Filip Wojda
8d422eeda0 style: tiny BestPractice component styling fix (#1758) 2023-12-07 09:22:26 +00:00
Anshuman Pandey
62dbd9e121 fix: fixes safari in-app preview (#1759) 2023-12-07 09:19:17 +00:00
Shubham Palriwala
c950c96934 fix: code block formatting in self-hosting/configure page (#1750) 2023-12-06 13:30:37 +00:00
Anshuman Pandey
1fa12d473c feat: attributes on initialising formbricks (#1736)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-12-06 12:39:46 +00:00
Matti Nannt
b9def78d2e chore: prepare 1.3.5 release (#1752) 2023-12-06 12:06:50 +00:00
Matti Nannt
626356be55 fix: landing page title typo (#1748) 2023-12-05 15:31:30 +00:00
Matti Nannt
85f5425d89 fix: onboarding ending in endless loop because of validation error (#1745) 2023-12-05 13:56:32 +00:00
Anshuman Pandey
d2c703ef60 fix: adds default values for overlay and click outside close (#1740) 2023-12-05 10:46:17 +00:00
Matti Nannt
4e8e6390b1 docs: minor docs hygiene (#1744) 2023-12-05 10:45:06 +00:00
Anjy Gupta
9271e375af feat: add image/color/animation as survey background (#1515)
Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
Co-authored-by: Johannes <johannes@formbricks.com>
Co-authored-by: Neil Chauhan <neilchauhan2@gmail.com>
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-12-04 18:22:28 +00:00
Matti Nannt
35a9685b71 fix: let report usage cron run with no-cache headers (#1739) 2023-12-04 17:37:24 +00:00
Matti Nannt
723ea558fa fix: remove person validation in syncSurveys for backwards compatibility (#1737) 2023-12-04 15:24:51 +00:00
Matti Nannt
8a4a635ee3 fix: in-app surveys not pulled correctly when user attributes get set (#1735) 2023-12-04 12:58:36 +00:00
Shubham Palriwala
1a30e9fd11 fix: error handling in next-auth (#1734) 2023-12-04 12:52:08 +00:00
Dhruwang Jariwala
dc8e1c764b fix: empty trigger save issue (#1733) 2023-12-04 11:38:08 +00:00
Dhruwang Jariwala
48e9148728 fix: made ttc and userAgent optional (#1727) 2023-12-04 11:36:31 +00:00
Shubham Palriwala
25525e0b03 fix: docker builds to work with node 20 (#1728) 2023-12-04 11:13:56 +00:00
Shubham Palriwala
9720c0ecba fix: remove configuration option for asset prefix URL (#1729) 2023-12-04 11:13:22 +00:00
Dhruwang Jariwala
33cbe7cf22 fix: eliminate empty attribute filter (#1730) 2023-12-04 11:12:41 +00:00
Johannes
4b0eef9c2e feat: community page revamp (#1725) 2023-12-03 19:49:35 +00:00
Naitik Kapadia
6e08a94da7 feat: Show the number of Responses to Respondents (#1720)
Co-authored-by: Johannes <johannes@formbricks.com>
2023-12-03 19:27:05 +00:00
Matti Nannt
c8f621cea2 fix: increase rate limit for client endpoints (#1718) 2023-12-01 13:27:37 +00:00
Shubham Palriwala
6436ec6416 fix: add docs + increase size about increasing size of changing button text (#1714) 2023-12-01 10:49:21 +00:00
Matti Nannt
e7c3d9abee chore: use node 20 in dockerfiles (#1716) 2023-12-01 09:10:05 +00:00
Matti Nannt
c8bc942eb4 chore: prepare 1.3.4 release (#1715) 2023-11-30 17:53:31 +00:00
Dhruwang Jariwala
d4fcaa54ba fix: progress bar (#1698)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-30 15:12:40 +00:00
Dhruwang Jariwala
2118f881f6 feat: Time to complete Metadata (#1416)
Co-authored-by: Johannes <johannes@formbricks.com>
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-30 14:22:33 +00:00
Shubham Palriwala
05884ead56 fix: validate string before fetching survey (#1701) 2023-11-30 08:45:34 +00:00
Dhruwang Jariwala
e53e04ca05 fix: duplicate title tags and meta descriptions (and other titles) (#1683)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-30 08:30:38 +00:00
Dhruwang Jariwala
32b2cd9ef3 chore: added individual eslints (#1710)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-30 08:24:20 +00:00
Anshuman Pandey
f734a76588 fix: team invites (#1699) 2023-11-30 08:23:05 +00:00
Anshuman Pandey
d71b1ee052 fix: fixes encoding of file name (#1712) 2023-11-30 07:41:03 +00:00
Dhruwang Jariwala
6b1d4a249a refactor: Auth options refactor (#1617)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-29 15:24:07 +00:00
Sidi jeddou
6b69d7c9af feat: Add devhunt open source to the list of oss-friends in api route (#1708)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-29 13:55:18 +00:00
Matti Nannt
ff4f4be69c chore: prepare 1.3.3 release (#1709) 2023-11-29 12:54:56 +00:00
Anshuman Pandey
a7f9e8d8eb fix: surveys package tailwind styles (#1707) 2023-11-29 11:54:58 +00:00
Dhruwang Jariwala
163732cea0 chore: blacklisted questionIds (#1700) 2023-11-29 10:51:31 +00:00
Matti Nannt
c35a57d2ca fix: cache not getting revalidated on person update (#1704) 2023-11-28 15:01:58 +00:00
Dhruwang Jariwala
b40ddbf47b chore: adds check for lowercase emails (#1693) 2023-11-28 14:28:02 +00:00
Shubham Palriwala
6be825184a feat: prod script now supports update, delete, uninstall, stop, restart (#1691) 2023-11-28 14:14:15 +00:00
Dhruwang Jariwala
4782195ca5 fix: avoid hidden field preview (#1694)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-28 14:11:57 +00:00
Shubham Palriwala
1280daafe3 feat: update client api docs as per new responses (#1695) 2023-11-28 14:06:01 +00:00
Shubham Palriwala
c05433f4f9 fix: move link surveys above in docs navbar & rename user identification (#1696) 2023-11-28 14:04:02 +00:00
Shubham Palriwala
88567fb056 fix: rename entire self hosting section (#1697) 2023-11-28 14:03:10 +00:00
Dhruwang Jariwala
7c09b66d53 chore: added symbol for welcome card (#1702) 2023-11-28 13:39:28 +00:00
Shubham Palriwala
31853411f3 fix: link survey page title now has survey name (#1692) 2023-11-28 13:37:49 +00:00
Matti Nannt
f036e83894 fix: fix docker build action for github packages (#1690) 2023-11-27 18:31:08 +00:00
Matti Nannt
24a3af210a fix: docker deployment failed because of new nextjs config (#1688) 2023-11-27 17:44:23 +00:00
Matti Nannt
4f8a94bfe7 chore: Prepare Formbricks 1.3.2 release (#1686) 2023-11-27 14:52:36 +00:00
Shubham Palriwala
45fbdd58af fix: simplify redirect of URL in Environment Notice Component (#1598)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-27 13:49:12 +00:00
Shubham Palriwala
b28f6f4bb2 feat: support for make and n8n integration states (#1568)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-27 13:40:51 +00:00
Dhruwang Jariwala
b691a74369 chore: added copy icon to api keys (#1681) 2023-11-27 12:43:52 +00:00
Matti Nannt
b189eb0ffd fix: improve client api by minimizing data output (#1674) 2023-11-27 11:54:19 +00:00
Shubham Palriwala
3e5b16e178 fix: indentations in env in docker compose (#1685) 2023-11-27 11:00:34 +00:00
therecluse26
8017e92a32 fix: Server Actions errors on self-hosting because of missing allowedOrigins (#1621)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-27 10:45:29 +00:00
Shubham Palriwala
652e0bc9c9 feat: endpoint + telemetry for live self hosted instances (#1675)
Signed-off-by: Neil Chauhan <neilchauhan2@gmail.com>
Co-authored-by: Neil Chauhan <neilchauhan2@gmail.com>
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-11-27 10:28:33 +00:00
Anshuman Pandey
2f4797f29f fix: editor adding paragraphs at the top on every render (#1677) 2023-11-27 09:48:20 +00:00
Shubham Palriwala
85c2cb8b7b feat: updated client response endpoint docs (#1656) 2023-11-27 08:20:01 +00:00
Dhruwang Jariwala
5e4702335e fix: broken links (#1682) 2023-11-27 08:13:01 +00:00
Shubham Palriwala
c5183844fb fix: increase rate limiting for auth endpoints (#1684) 2023-11-27 08:11:42 +00:00
Anshuman Pandey
4102dbd0e4 fix: preview file name and content type (#1678) 2023-11-24 16:23:49 +00:00
Shubham Palriwala
8414f3b030 fix: longer team names now do not cut pricing page sub components (#1679) 2023-11-24 13:01:01 +00:00
Anshuman Pandey
8a771222b8 fix: excel conversion (#1680) 2023-11-24 11:51:02 +00:00
Johannes
dda3986190 fix: verify email screen responsiveness (#1676) 2023-11-23 20:17:58 +00:00
Johannes
a3fd6645b6 fix: added images as reusable component, tweaked rating (#1672) 2023-11-23 14:52:39 +00:00
Naitik Kapadia
33919578dd feat: Introduce FileUpload Question (#1277)
Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
Co-authored-by: Johannes <johannes@formbricks.com>
Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
2023-11-23 14:47:48 +00:00
245 changed files with 6778 additions and 5234 deletions

View File

@@ -4,8 +4,8 @@ on:
# "Scheduled workflows run on the latest commit on the default or base branch."
# — https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#schedule
schedule:
# This will run the job at 23:00 UTC every day of every month.
- cron: "0 21 * * *"
# This will run the job at 22:00 UTC every day of every month.
- cron: "0 22 * * *"
jobs:
cron-reportUsageToStripe:
env:
@@ -19,4 +19,5 @@ jobs:
curl ${{ env.APP_URL }}/api/cron/report-usage \
-X POST \
-H 'x-api-key: ${{ env.CRON_SECRET }}' \
-H 'Cache-Control: no-cache' \
--fail

37
.github/workflows/playwright.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: E2E Tests
on:
workflow_call:
jobs:
build:
name: Run E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Docker Compose
run: sudo apt-get update && sudo apt-get install -y docker-compose
- name: Install dependencies
run: npm install -g pnpm && pnpm install
- name: Build Formbricks Image & Run
run: docker-compose up -d
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm test:e2e
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

View File

@@ -27,8 +27,13 @@ jobs:
uses: ./.github/workflows/build-web.yml
secrets: inherit
e2e-test:
name: Run E2E Tests
uses: ./.github/workflows/playwright.yml
secrets: inherit
required:
needs: [lint, test, build]
needs: [lint, test, build, e2e-test]
if: always()
runs-on: ubuntu-latest
steps:

View File

@@ -6,6 +6,7 @@ name: Docker
# documentation.
on:
workflow_dispatch:
push:
tags:
- "v*"
@@ -15,6 +16,9 @@ env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/formbricks?schema=public"
jobs:
build:
@@ -27,6 +31,16 @@ jobs:
id-token: write
steps:
- name: Generate Random NEXTAUTH_SECRET
run: |
SECRET=$(openssl rand -hex 32)
echo "NEXTAUTH_SECRET=$SECRET" >> $GITHUB_ENV
- name: Generate Random ENCRYPTION_KEY
run: |
SECRET=$(openssl rand -hex 32)
echo "ENCRYPTION_KEY=$SECRET" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
@@ -38,17 +52,22 @@ jobs:
with:
cosign-release: "v2.1.1"
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
uses: docker/setup-buildx-action@v3 # v3.0.0
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
uses: docker/login-action@v3 # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@@ -58,7 +77,7 @@ jobs:
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
uses: docker/metadata-action@v5 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
@@ -66,10 +85,11 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
uses: docker/build-push-action@v5 # v5.0.0
with:
context: .
file: ./apps/web/Dockerfile
# platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

8
.gitignore vendored
View File

@@ -44,4 +44,10 @@ packages/database/zod
# nixos stuff
.direnv
Zone.Identifier
Zone.Identifier
# Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/

View File

@@ -13,7 +13,7 @@
"dependencies": {
"@formbricks/js": "workspace:*",
"@heroicons/react": "^2.0.18",
"next": "14.0.0",
"next": "14.0.3",
"react": "18.2.0",
"react-dom": "18.2.0"
},

View File

@@ -22,11 +22,13 @@ export default function AppPage({}) {
if (process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID && process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST) {
const isUserId = window.location.href.includes("userId=true");
const userId = isUserId ? "THIS-IS-A-VERY-LONG-USER-ID-FOR-TESTING" : undefined;
const attributes = isUserId ? { "Init Attribute 1": "eight", "Init Attribute 2": "two" } : undefined;
formbricks.init({
environmentId: process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID,
apiHost: process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST,
userId,
debug: true,
attributes,
});
window.formbricks = formbricks;
}

View File

@@ -45,14 +45,17 @@ Adds an Actions for a given User by their User ID
curl --location --request POST 'https://app.formbricks.com/api/v1/client/<environment-id>/actions' \
--data-raw '{
"userId": "1",
"name": "new_action_v2"
"name": "new_action_v2",
"properties":{}
}'
```
```json {{ title: 'Example Request Body' }}
{
"userId": "1",
"name": "new_action_v2"
"name": "new_action_v3",
"properties":{}
}
```

View File

@@ -65,12 +65,7 @@ This set of API can be used to
```json {{title:'200 Success'}}
{
"data": {
"id": "clp83r8uy000ceyqcbld2ebwj",
"createdAt": "2023-11-21T08:57:23.866Z",
"updatedAt": "2023-11-21T08:57:23.866Z",
"surveyId": "cloqzeuu70000z8khcirufo60",
"responseId": null,
"personId": "cloo25v3e0000z8ptskh030jd"
"id": "clphzz6oo00083zdmc7e0nwzi"
}
}
```
@@ -81,7 +76,7 @@ This set of API can be used to
"message": "Fields are missing or incorrectly formatted",
"details": {
"surveyId": "Required"
}
}
}
```
</CodeGroup>
@@ -129,14 +124,7 @@ This set of API can be used to
```json {{title:'200 Success'}}
{
"data": {
"id": "clp83r8uy000ceyqcbld2ebwj",
"createdAt": "2023-11-21T08:57:23.866Z",
"updatedAt": "2023-11-21T09:05:27.285Z",
"surveyId": "cloqzeuu70000z8khcirufo60",
"responseId": null,
"personId": "cloo25v3e0000z8ptskh030jd"
}
"data": {}
}
```

View File

@@ -10,13 +10,15 @@ export const metadata = {
Formbricks offers two types of APIs: the **Public Client API** and the **Management API**. Each API serves a different purpose, has different authentication requirements, and provides access to different data and settings.
Checkout the [API Key Setup](/docs/api/api-key-setup) - to generate, store, or delete API Keys.
Checkout the [API Key Setup](/docs/api/management/api-key-setup) - to generate, store, or delete API Keys.
## Public Client API
The Public Client API is designed for the JavaScript SDK and does not require authentication. It's primarily used for creating persons, sessions, and responses within the Formbricks platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information.
- [Actions API](/docs/api/client/actions) - Create actions for a person
- [Displays API](/docs/api/client/displays) - Mark Survey as Displayed or Responded for a Person
- [People API](/docs/api/client/people) - Create & update people (e.g. attributes)
- [Responses API](/docs/api/client/responses) - Create & update responses for a survey
## Management API
@@ -27,7 +29,7 @@ The Management API provides access to all data and settings that are visible in
API requests made to the Management API are authorized using a personal API key. This key grants the same rights and access as if you were logged in at formbricks.com. It's essential to keep your API key secure and not share it with others.
To generate, store, or delete an API key, follow the instructions provided on the following page [API Key](/docs/api/api-key-setup).
To generate, store, or delete an API key, follow the instructions provided on the following page [API Key](/docs/api/management/api-key-setup).
- [Action Class API](/docs/api/management/action-classes) - Create, Update, and Delete Action Classes
- [Attribute Class API](/docs/api/management/attribute-classes) - Create, Update, and Delete Attribute Classes

View File

@@ -26,12 +26,6 @@ This set of API can be used to
Create User with your own User ID
### Mandatory Request Body JSON Keys
<Properties>
<Property name="environmentId" type="string">
Environment to create a person in
</Property>
</Properties>
<Properties>
<Property name="userId" type="string">
User ID which you would like to identify the person with
@@ -48,7 +42,6 @@ This set of API can be used to
'https://app.formbricks.com/api/v1/client/<environment-id>/people' \
-H 'Content-Type: application/json' \
-d '{
"environmentId":"clonzr6vc0009z8md7y06hipl",
"userId":"docs_user"
}'
```
@@ -60,15 +53,7 @@ This set of API can be used to
```json {{title:'200 Success'}}
{
"data": {
"status": "success",
"person": {
"id": "clp861gvu0000v7wzr950fqad",
"userId": "docs_user",
"attributes": {},
"environmentId": "clonzr6vc0009z8md7y06hipl",
"createdAt": "2023-11-21T10:01:20.058Z",
"updatedAt": "2023-11-21T10:01:20.058Z"
}
"userId": "docs_user"
}
}
```
@@ -126,16 +111,7 @@ This set of API can be used to
```json {{title:'200 Success'}}
{
"data": {
"id": "clp868htl0003v7wzmy977m15",
"userId": "new_docs_user",
"attributes": {
"welcome_to": "formbricks"
},
"environmentId": "clonzr6vc0009z8md7y06hipl",
"createdAt": "2023-11-21T10:06:47.865Z",
"updatedAt": "2023-11-21T10:06:47.865Z"
}
"data": {}
}
```

View File

@@ -6,15 +6,19 @@ export const metadata = {
"Unlock the full potential of Formbricks' Responses API. From fetching to updating survey responses, our comprehensive guide helps you integrate and manage survey data efficiently without compromising security. Ideal for client-side interactions.",
};
#### Management API
#### Client API
# Responses API
The Public Client API is designed for the JavaScript SDK and does not require authentication. It's primarily used for creating persons, sessions, and responses within the Formbricks platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information.
This set of API can be used to
- [Create Response](#create-response)
- [Update Response](#update-response)
---
## Create a response {{ tag: 'POST', label: '/api/v1/client/responses' }}
## Create Response {{ tag: 'POST', label: '/api/v1/client/<environment-id>/responses' }}
Add a new response to a survey.
@@ -39,8 +43,8 @@ Add a new response to a survey.
### Optional Body Fields
<Properties>
<Property name="personId" type="string" required>
Internal Formbricks id to identify the user sending the response
<Property name="userId" type="string" required>
Pre-existing User ID to identify the user sending the response
</Property>
</Properties>
@@ -49,20 +53,20 @@ Add a new response to a survey.
| field name | required | default | description |
| ---------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| data | yes | - | The response data object (answers to the survey). In this object the key is the questionId, the value the answer of the user to this question. |
| personId | no | - | The person this response is connected to. |
| userId | no | - | The person this response is connected to. |
| surveyId | yes | - | The survey this response is connected to. |
| finished | yes | false | Mark a response as complete to be able to filter accordingly. |
</Col>
<Col sticky>
<CodeGroup title="Request" tag="POST" label="/api/v1/client/responses">
<CodeGroup title="Request" tag="POST" label="/api/v1/client/<environment-id>/responses">
```bash {{ title: 'cURL' }}
curl --location --request POST 'https://app.formbricks.com/api/v1/client/responses' \
curl --location --request POST 'https://app.formbricks.com/api/v1/client/<environment-id>/responses' \
--data-raw '{
"surveyId":"clfqz1esd0000yzah51trddn8",
"personId": "clfqjny0v000ayzgsycx54a2c",
"surveyId":"cloqzeuu70000z8khcirufo60",
"userId": "1",
"finished": true,
"data": {
"clfqjny0v0003yzgscnog1j9i": 10,
@@ -73,8 +77,8 @@ Add a new response to a survey.
```json {{ title: 'Example Request Body' }}
{
"personId": "clfqjny0v000ayzgsycx54a2c",
"surveyId": "clfqz1esd0000yzah51trddn8",
"userId": "1",
"surveyId": "cloqzeuu70000z8khcirufo60",
"finished": true,
"data": {
"clfqjny0v0003yzgscnog1j9i": 10,
@@ -90,19 +94,7 @@ Add a new response to a survey.
```json {{ title: '200 Success' }}
{
"data": {
"id": "clisyqeoi000219t52m5gopke",
"surveyId": "clfqz1esd0000yzah51trddn8",
"finished": true,
"person": {
"id": "clfqjny0v000ayzgsycx54a2c",
"attributes": {
"email": "me@johndoe.com"
}
},
"data": {
"clfqjny0v0003yzgscnog1j9i": 10,
"clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks"
}
"id": "clp84xdld0002px36fkgue5ka",
}
}
```
@@ -124,7 +116,7 @@ Add a new response to a survey.
---
## Update a response {{ tag: 'POST', label: '/api/v1/client/responses/<response-id>' }}
## Update Response {{ tag: 'PUT', label: '/api/v1/client/<environment-id>/responses/<response-id>' }}
Update an existing response in a survey.
@@ -134,6 +126,9 @@ Update an existing response in a survey.
### Mandatory Body Fields
<Properties>
<Property name="finished" type="boolean">
Marks whether the response is complete or not.
</Property>
<Property name="data" type="string">
The data of the response as JSON object (key: questionId, value: answer).
</Property>
@@ -149,27 +144,25 @@ Update an existing response in a survey.
</Col>
<Col sticky>
<CodeGroup title="Request" tag="POST" label="/api/v1/client/responses/<response-id>">
<CodeGroup title="Request" tag="PUT" label="/api/v1/client/<environment-id>/responses/<response-id>">
```bash {{ title: 'cURL' }}
curl --location --request POST 'https://app.formbricks.com/api/v1/client/responses/<response-id>' \
curl --location --request PUT 'https://app.formbricks.com/api/v1/client/<environment-id>/responses/<response-id>' \
--data-raw '{
"personId": "clfqjny0v000ayzgsycx54a2c",
"surveyId": "clfqz1esd0000yzah51trddn8",
"finished": true,
"data": {
"clggpvpvu0009n40g8ikawby8": 5,
"finished":false,
"data": {
"clfqjny0v0003yzgscnog1j9i": 10,
"clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks"
}
}'
```
```json {{ title: 'Example Request Body' }}
{
"personId": "clfqjny0v000ayzgsycx54a2c",
"surveyId": "clfqz1esd0000yzah51trddn8",
"finished": true,
"data": {
"clggpvpvu0009n40g8ikawby8": 5,
"finished":false,
"data": {
"clfqjny0v0003yzgscnog1j9i": 10,
"clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks"
}
}
```
@@ -180,22 +173,7 @@ Update an existing response in a survey.
```json {{ title: '200 Success' }}
{
"data": {
"id": "clisyqeoi000219t52m5gopke",
"surveyId": "clfqz1esd0000yzah51trddn8",
"finished": true,
"person": {
"id": "clfqjny0v000ayzgsycx54a2c",
"attributes": {
"email": "me@johndoe.com"
}
},
"data": {
"clfqjny0v0003yzgscnog1j9i": 10,
"clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks",
"clggpvpvu0009n40g8ikawby8": 5
}
}
"data": {}
}
```

View File

@@ -1,10 +1,6 @@
import { Fence } from "@/components/shared/Fence";
export const metadata = {
title: "Formbricks People API: Fetch or Create Person Overview",
description:
"Dive into Formbricks' People API within the Public Client API suite, designed to work without authentication requirements. Seamlessly fetch or create a person by their userId and environmentId, optimizing client-side interactions while maintaining data privacy.",
};
import {generateManagementApiMetadata} from "@/lib/utils"
export const metadata = generateManagementApiMetadata("Action Class",["Fetch","Create","Delete"])
#### Management API

View File

@@ -1,10 +1,7 @@
import { Fence } from "@/components/shared/Fence";
import {generateManagementApiMetadata} from "@/lib/utils"
export const metadata = {
title: "Formbricks People API: Fetch or Create Person Overview",
description:
"Dive into Formbricks' People API within the Public Client API suite, designed to work without authentication requirements. Seamlessly fetch or create a person by their userId and environmentId, optimizing client-side interAttributes while maintaining data privacy.",
};
export const metadata = generateManagementApiMetadata("Attribute Class",["Fetch","Create","Delete"])
#### Management API

View File

@@ -1,9 +1,9 @@
import { Fence } from "@/components/shared/Fence";
export const metadata = {
title: "Formbricks People API: Fetch or Create Person Overview",
title: "Formbricks Me API: Fetch your environment details",
description:
"Dive into Formbricks' People API within the Public Client API suite, designed to work without authentication requirements. Seamlessly fetch or create a person by their userId and environmentId, optimizing client-side interactions while maintaining data privacy.",
"Dive into Formbricks' Me API within the Public Client API suite. Seamlessly fetch your own current environment details.",
};
#### Management API

View File

@@ -1,10 +1,8 @@
import { Fence } from "@/components/shared/Fence";
import {generateManagementApiMetadata} from "@/lib/utils"
export const metadata = generateManagementApiMetadata("People",["Fetch","Delete"])
export const metadata = {
title: "Formbricks People API: Fetch or Create Person Overview",
description:
"Dive into Formbricks' People API within the Public Client API suite, designed to work without authentication requirements. Seamlessly fetch or create a person by their userId and environmentId, optimizing client-side interactions while maintaining data privacy.",
};
#### Management API

View File

@@ -1,10 +1,7 @@
import { Fence } from "@/components/shared/Fence";
import {generateManagementApiMetadata} from "@/lib/utils"
export const metadata = {
title: "Formbricks Responses API Documentation - Manage Your Survey Data Seamlessly",
description:
"Unlock the full potential of Formbricks' Responses API. From fetching to updating survey responses, our comprehensive guide helps you integrate and manage survey data efficiently without compromising security. Ideal for client-side interactions.",
};
export const metadata = generateManagementApiMetadata("Responses",["Fetch","Delete"])
#### Management API

View File

@@ -1,10 +1,7 @@
import { Fence } from "@/components/shared/Fence";
import {generateManagementApiMetadata} from "@/lib/utils"
export const metadata = {
title: "Formbricks Surveys API Documentation - How to Retrieve All Surveys",
description:
"Explore the comprehensive guide to the Formbricks Surveys API. Learn how to effectively retrieve all the surveys in your environment with the necessary headers and API key setup. Includes sample request and response formats.",
};
export const metadata = generateManagementApiMetadata("Surveys",["Fetch","Create","Update","Delete"])
#### Management API

View File

@@ -1,8 +1,6 @@
export const metadata = {
title: "Formbricks Webhook API Documentation - List, Retrieve, Create, and Delete Webhooks",
description:
"Explore the comprehensive guide to the Formbricks Webhooks API. This is all you need to interact and play with the Formbricks Webhooks and integrate them into any third party app of your choice",
};
import {generateManagementApiMetadata} from "@/lib/utils"
export const metadata = generateManagementApiMetadata("Webhook",["Fetch","Create","Delete"])
#### Management API

View File

@@ -10,9 +10,31 @@ export const metadata = {
One way to send attributes to Formbricks is in your code. In Formbricks, there are two special attributes for [user identification](/docs/attributes/identify-users)(user ID & email) and custom attributes. An example:
## Setting Custom User Attributes
## Setting during Initialization
It's recommended to set custom user attributes directly during the initialization of Formbricks for better user identification.
<Col>
<CodeGroup title="Set custom attributes during initialization">
```javascript
formbricks.init({
environmentId: "<environment-id>",
apiHost: "<api-host>",
userId: "<user_id>",
attributes: {
plan: "free",
},
});
```
</CodeGroup>
</Col>
## Setting independently
You can use the setAttribute function to set any custom attribute for the user (e.g. name, plan, etc.) anywhere in the user journey. Formbricks maintains a state of the current user inside the browser and makes sure attributes aren't sent to the backend twice.
You can use the setAttribute function to set any custom attribute for the user (e.g. name, plan, etc.):
<Col>
<CodeGroup title="Setting Plan to Pro">

View File

@@ -29,6 +29,29 @@ formbricks.init({
</CodeGroup>
</Col>
## Enhanced Initialization with User Attributes
In addition to setting the `userId`, Formbricks allows you to set user attributes right at the initialization. This ensures that your user data is seamlessly integrated from the start. Here's how you can include user attributes in the `init()` function:
<Col>
<CodeGroup title="Enhanced Initialization with User Attributes">
```javascript
formbricks.init({
environmentId: "<environment-id>",
apiHost: "<api-host>",
userId: "<user_id>",
attributes: {
// your custom attributes
Plan: "premium",
},
});
```
</CodeGroup>
</Col>
## Setting User Email
The `userId` is the main identifier used in Formbricks and user identification is only enabled when it is set. In addition to the userId you can also set attributes that describes the user better. The email address can be set using the setEmail function:

View File

@@ -40,7 +40,7 @@ To get this running, you'll need a bit of time. Here are the steps we're going t
3. Connect to API
4. Test
### 1. Setting up Formbricks Cloud
## 1. Setting up Formbricks Cloud
1. To get started, create an account for the [Formbricks Cloud](https://app.formbricks.com/auth/signup).
@@ -74,7 +74,7 @@ To get this running, you'll need a bit of time. Here are the steps we're going t
5. In the same way, you can change the Internal Question ID of the _Please elaborate_ question to **“additionalFeedback”** and the one of the _Page URL_ question to **“pageUrl”**.
<Note>
## Answers need to be identical If you want different answers than “Yes 👍” and “No 👎” you need to update the
Answers need to be identical If you want different answers than “Yes 👍” and “No 👎” you need to update the
choices accordingly. They have to be identical to the frontend we're building in the next step.
</Note>
@@ -108,10 +108,10 @@ To get this running, you'll need a bit of time. Here are the steps we're going t
**Youre all setup in Formbricks Cloud for now 👍**
### 2. Build the frontend
## 2. Build the frontend
<Note>
## Your frontend might work differently Your frontend likely looks and works differently. This is an example
Your frontend might work differently Your frontend likely looks and works differently. This is an example
specific to our tech stack. We want to illustrate what you should consider building yours 😊
</Note>
@@ -311,7 +311,7 @@ return (
</Col>
## 3. Connecting to the Formbricks API
The last step is to hook up your sparkling new frontend to the Formbricks API. To do so, we followed the “[Create Response](/docs/client-api/create-response)” and “[Update Response](/docs/client-api/update-response)” pages in our docs.
The last step is to hook up your sparkling new frontend to the Formbricks API. To do so, we followed the “[Create Response](/docs/api/client/responses#create-a-response)” and “[Update Response](/docs/api/client/responses#update-a-response)” pages in our docs.
Here is the code for the `handleFeedbackSubmit` function with comments:
<Col>

View File

@@ -96,7 +96,7 @@ Click "Create a webhook":
className="rounded-lg max-w-full sm:max-w-3xl"
/>
Enter the Formbricks API key. Learn how to get one from the [API Key tutorial](/docs/api/api-key-setup).
Enter the Formbricks API key. Learn how to get one from the [API Key tutorial](/docs/api/management/api-key-setup).
<Image src={EnterApiKey} alt="Enter API Key" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />

View File

@@ -71,7 +71,7 @@ Click on Create New Credentail button to add your host and API Key
<Image src={AddApiKey} alt="Add host and api key" quality="100" className="rounded-lg max-w-full sm:max-w-3xl" />
Now you need an API key. Please refer to the [API Key Setup](/docs/api/api-key-setup) page to learn how to create one.
Now you need an API key. Please refer to the [API Key Setup](/docs/api/management/api-key-setup) page to learn how to create one.
Once you copied it in the API Key field, hit Save button to test the connection and save the credentials.

View File

@@ -94,7 +94,7 @@ Now, you have to connect Zapier with Formbricks via an API Key:
className="rounded-lg max-w-full sm:max-w-3xl"
/>
Now you need an API key. Please refer to the [API Key Setup](/docs/api/api-key-setup) page to learn how to create one.
Now you need an API key. Please refer to the [API Key Setup](/docs/api/management/api-key-setup) page to learn how to create one.
Once you copied it in the newly opened Zapier window, you will be connected:

View File

@@ -1,5 +1,4 @@
import { GettingStarted } from "@/components/docs/GettingStarted";
import BestPractices from "@/components/docs/BestPractices";
import { HeroPattern } from "@/components/docs/HeroPattern";
import { Button } from "@/components/docs/Button";
@@ -9,10 +8,7 @@ export const metadata = {
"Enhance your product with Formbricks the leading open-source solution for in-product micro-surveys. Dive deep into user research, amplify product-market fit, and uncover the 'why' behind your analytics.",
};
export const sections = [
{ title: "Getting Started", id: "getting-started" },
{ title: "Best Practices", id: "best-practices" },
];
export const sections = [];
<HeroPattern />
@@ -20,7 +16,7 @@ export const sections = [
Welcome to Formbricks, your go-to solution for in-product micro-surveys that will supercharge your product experience! 🚀 {{ className: 'lead' }}
<div className="mb-16 mt-6 flex gap-3">
<div className="mb-16 mt-6 flex gap-3" id="why-formbricks">
<Button href="/docs/getting-started/quickstart-in-app-survey" arrow="right" children="Quickstart" />
</div>

View File

@@ -3,14 +3,14 @@ import Image from "next/image";
import PeopleView from "./people-view.webp";
export const metadata = {
title: "Effective User Identification in Formbricks Link Surveys",
title: "Effective Identify Users in Formbricks Link Surveys",
description:
"Discover how to seamlessly connect responses from Formbricks link surveys to existing users in your database. Learn the intricacies of the userId URL parameter to enhance user tracking, profiling, and segmentation, ensuring more personalized interactions and data-driven decisions.",
};
#### Link Surveys
# User Identification in Link Surveys
# Identify Users in Link Surveys
Identifying users in link features lets you connect responses from link surveys with existing users in your Formbricks database.

View File

@@ -6,7 +6,7 @@ export const metadata = {
#### Self-Hosting
# Running Formbricks with Docker
# Advanced Setup
Quickly set up and start using Formbricks without getting into the technicalities of the build process. You'll be using an image that we've already built for you. The pre-built image is ready-to-run, and it only requires minimal configuration on your part. This approach is perfect for getting a functional instance of Formbricks up and running with minimal hassle. It's as easy as downloading the Docker image and firing up the container.

View File

@@ -1,9 +1,13 @@
export const metadata = {
title: "External auth providers",
title: "Configure Formbricks with External auth providers",
description:
"Set up and integrate multiple external authentication providers with Formbricks. Our step-by-step guide covers Google OAuth and more, ensuring a seamless login experience for your users.",
};
#### Self-Hosting
# Configure
## Google OAuth Authentication
Integrating Google OAuth with your Formbricks instance allows users to log in using their Google credentials, ensuring a secure and streamlined user experience. This guide will walk you through the process of setting up Google OAuth for your Formbricks instance.
@@ -35,17 +39,24 @@ Integrating Google OAuth with your Formbricks instance allows users to log in us
- Select the application type **Web application** for your project and enter any additional information required.
- Ensure to specify authorized JavaScript origins and authorized redirect URIs.
```
<Col>
<CodeGroup title="Configuration URLs">
``` {{ title: 'Redirect & Origin URLs' }}
Authorized JavaScript origins: {WEBAPP_URL}
Authorized redirect URIs: {WEBAPP_URL}/api/auth/callback/google
```
</CodeGroup>
</Col>
5. **Update Environment Variables in Docker**:
- To integrate the Google OAuth, you have two options: either update the environment variables in the docker-compose file or directly add them to the running container.
- In your Docker setup directory, open the `.env` file, and add or update the following lines with the `Client ID` and `Client Secret` obtained from Google Cloud Platform:
- Alternatively, you can add the environment variables directly to the running container using the following commands (replace `container_id` with your actual Docker container ID):
```
<Col>
<CodeGroup title="Set env vars">
```sh {{ title: 'Shell commands' }}
docker exec -it container_id /bin/bash
export GOOGLE_AUTH_ENABLED=1
export GOOGLE_CLIENT_ID=your-client-id-here
@@ -53,12 +64,15 @@ export GOOGLE_CLIENT_SECRET=your-client-secret-here
exit
```
```
```sh {{ title: 'env file' }}
GOOGLE_AUTH_ENABLED=1
GOOGLE_CLIENT_ID=your-client-id-here
GOOGLE_CLIENT_SECRET=your-client-secret-here
```
</CodeGroup>
</Col>
6. **Restart Your Formbricks Instance**:
- **Note:** Restarting your Docker containers may cause a brief period of downtime. Plan accordingly.
- Once the environment variables have been updated, it's crucial to restart your Docker containers to apply the changes. This ensures that your Formbricks instance can utilize the new Google OAuth configuration for user authentication. Here's how you can do it:

View File

@@ -18,7 +18,6 @@ Formbricks v1.2 ships a lot of features targeting our Link Surveys. We have also
| -------------------- | -------- | ------------------------------ | ----------------------------------------------------------- |
| ENCRYPTION_KEY | true | `openssl rand -hex 32` | Needed for 2 Factor Authentication |
| SHORT_URL_BASE | false | `<your-short-base-url>` | Needed if you want to enable shorter links for Link Surveys |
| ASSET_PREFIX_URL | false | `<your-asset-hosted-base-url>` | Needed if you have a separate URL for hosted assets |
### Deprecated / Removed Environment Variables

View File

@@ -6,7 +6,7 @@ export const metadata = {
#### Self-Hosting
# Deploying Formbricks to Production
# One-Click Setup
If you want to quickly set up a production instance of Formbricks on a server running Ubuntu, we've got you covered! This method utilizes a convenient shell script that takes care of everything, including Docker, Postgres DB, and SSL certificate configuration. The shell script will automatically install all the required dependencies and configure your server, making the process a breeze.
@@ -29,7 +29,7 @@ Copy and paste the following command into your terminal:
<CodeGroup title="Single Command to deploy Formbricks">
```bash
/bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/formbricks/formbricks/main/docker/production.sh)"
curl -fsSL https://raw.githubusercontent.com/formbricks/formbricks/main/docker/production.sh -o formbricks.sh && chmod +x formbricks.sh && ./formbricks.sh install
```
</CodeGroup>
@@ -154,6 +154,69 @@ my.hosted.url.com
</CodeGroup>
</Col>
## Update Formbricks
To update Formbricks, simply run the following command:
<Col>
<CodeGroup title="Update Formbricks">
```bash
./formbricks.sh update
```
</CodeGroup>
</Col>
The script will automatically pull the latest version of Formbricks from Dockerhub and restart the containers.
## Stop Formbricks Instance
To stop Formbricks, simply run the following command:
<Col>
<CodeGroup title="Stop Formbricks">
```bash
./formbricks.sh stop
```
</CodeGroup>
</Col>
The script will automatically stop all the Formbricks related containers and brings the entire stack down.
## Restart Formbricks Instance
To restart Formbricks, simply run the following command:
<Col>
<CodeGroup title="Restart Formbricks">
```bash
./formbricks.sh restart
```
</CodeGroup>
</Col>
The script will automatically restart all the Formbricks related containers and brings the entire stack up with the previous configuration.
## Uninstall Formbricks
To uninstall Formbricks, simply run the following command, but keep in mind that this will delete all your data!
<Col>
<CodeGroup title="Uninstall Formbricks">
```bash
./formbricks.sh uninstall
```
</CodeGroup>
</Col>
The script will automatically stop all the Formbricks related containers, remove the Formbricks directory, and delete the Docker network.
## Debugging
If you encounter any issues, you can check the logs of the container with:
@@ -168,6 +231,7 @@ cd formbricks && docker compose logs -f
</Col>
You can close the logs again with `CTRL + C`.
## Troubleshooting
If you encounter any issues, consider the following steps:

View File

@@ -212,6 +212,14 @@ export const navigation: Array<NavGroup> = [
{ title: "Code Actions", href: "/docs/actions/code" },
],
},
{
title: "Link Surveys",
links: [
{ title: "Data Prefilling", href: "/docs/link-surveys/data-prefilling" },
{ title: "Identify Users", href: "/docs/link-surveys/user-identification" },
{ title: "Single Use Links", href: "/docs/link-surveys/single-use-links" },
],
},
{
title: "Best Practices",
links: [
@@ -234,22 +242,14 @@ export const navigation: Array<NavGroup> = [
{ title: "Zapier", href: "/docs/integrations/zapier" },
],
},
{
title: "Link Surveys",
links: [
{ title: "Data Prefilling", href: "/docs/link-surveys/data-prefilling" },
{ title: "User Identification", href: "/docs/link-surveys/user-identification" },
{ title: "Single Use Links", href: "/docs/link-surveys/single-use-links" },
],
},
{
title: "Self-hosting",
links: [
{ title: "Deployment", href: "/docs/self-hosting/deployment" },
{ title: "Production", href: "/docs/self-hosting/production" },
{ title: "Docker", href: "/docs/self-hosting/docker" },
{ title: "Introduction", href: "/docs/self-hosting/deployment" },
{ title: "One-Click Setup", href: "/docs/self-hosting/production" },
{ title: "Advanced Setup", href: "/docs/self-hosting/docker" },
{ title: "Configure", href: "/docs/self-hosting/external-auth-providers" },
{ title: "Migration Guide", href: "/docs/self-hosting/migration-guide" },
{ title: "External auth providers", href: "/docs/self-hosting/external-auth-providers" },
],
},
{

View File

@@ -45,6 +45,15 @@ const FAQ_DATA = [
</>
),
},
{
question: "How can I change Button texts in my survey?",
answer: () => (
<>
For the question that you want to change the button text, click on the <b>Show Advanced Settings</b>{" "}
toggle and change the button label in the <b>Button Text</b> field.
</>
),
},
];
export const faqJsonLdData = FAQ_DATA.map((faq) => ({

View File

@@ -22,9 +22,9 @@ import {
VideoTabletAdjustIcon,
} from "@formbricks/ui/icons";
import { createId } from "@paralleldrive/cuid2";
import { TTemplate } from "@formbricks/types/templates";
import { TSurveyQuestionType } from "@formbricks/types/surveys";
import { TTemplate } from "@formbricks/types/templates";
import { createId } from "@paralleldrive/cuid2";
const thankYouCardDefault = {
enabled: true,
@@ -32,6 +32,12 @@ const thankYouCardDefault = {
subheader: "We appreciate your feedback.",
};
const welcomeCardDefault = {
enabled: true,
timeToFinish: false,
showResponseCount: false,
};
export const customSurvey: TTemplate = {
name: "Start from scratch",
description: "Create a survey without template.",
@@ -51,10 +57,7 @@ export const customSurvey: TTemplate = {
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -150,10 +153,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -260,10 +260,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -340,10 +337,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -389,10 +383,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -447,10 +438,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -513,10 +501,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -582,10 +567,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -640,10 +622,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -685,10 +664,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -723,10 +699,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -752,10 +725,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -803,10 +773,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -848,10 +815,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -905,10 +869,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -961,10 +922,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -1013,10 +971,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -1043,10 +998,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -1071,10 +1023,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -1098,10 +1047,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -1142,10 +1088,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -1179,10 +1122,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -1216,10 +1156,7 @@ export const templates: TTemplate[] = [
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},
@@ -1271,12 +1208,17 @@ export const templates: TTemplate[] = [
buttonUrl: "https://app.formbricks.com/auth/signup",
buttonExternal: true,
},
{
id: createId(),
type: TSurveyQuestionType.FileUpload,
headline: "Upload file",
required: false,
allowMultipleFiles: false,
maxSizeInMB: 10,
},
],
thankYouCard: thankYouCardDefault,
welcomeCard: {
enabled: false,
timeToFinish: false,
},
welcomeCard: welcomeCardDefault,
hiddenFields: {
enabled: false,
},

View File

@@ -1,5 +1,3 @@
import PHIcon from "@/images/formtribe/ph-logo.png";
import Image from "next/image";
import Link from "next/link";
export const GitHubSponsorship: React.FC = () => {
@@ -38,7 +36,7 @@ export const GitHubSponsorship: React.FC = () => {
</p>
</div>
<div className="flex items-center justify-end">
<Image src={PHIcon} alt="Product Hunt Logo" width={80} className="" />
{/* <Image src={PHIcon} alt="Product Hunt Logo" width={80} className="" /> */}
</div>
</div>
</Link>

View File

@@ -27,11 +27,11 @@ export const Hero: React.FC = ({}) => {
<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">
<span className="xl:inline">The Open Source Survey Suite</span>
<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">
Run link surveys, in-app surveys and email surveys in one app {" "}
Turn customer insights into irresistible experiences {" "}
<span className="decoration-brand-dark underline underline-offset-4">all privacy-first.</span>
</p>
@@ -92,7 +92,7 @@ export const Hero: React.FC = ({}) => {
router.push("https://app.formbricks.com/auth/signup");
plausible("Hero_CTA_CreateSurvey");
}}>
Create survey
Get started
</Button>
<Button
variant="secondary"

View File

@@ -83,8 +83,8 @@ export default function BestPracticeNavigation() {
return (
<div className="mx-auto grid grid-cols-1 gap-6 px-2 md:grid-cols-3">
{BestPractices.map((bestPractice) => (
<Link href={bestPractice.href} key={bestPractice.name}>
<div className="drop-shadow-card duration-120 hover:border-brand-dark relative rounded-lg border border-slate-100 bg-slate-100 p-6 transition-all ease-in-out hover:scale-105 hover:cursor-pointer dark:border-slate-600 dark:bg-slate-800">
<Link className="relative block" href={bestPractice.href} key={bestPractice.name}>
<div className="drop-shadow-card duration-120 hover:border-brand-dark relative h-full rounded-lg border border-slate-100 bg-slate-100 p-6 transition-all ease-in-out hover:scale-105 hover:cursor-pointer dark:border-slate-600 dark:bg-slate-800">
<div
className={clsx(
// base styles independent what type of button it is
@@ -105,7 +105,9 @@ export default function BestPracticeNavigation() {
<h3 className="mb-1 mt-3 text-xl font-bold text-slate-700 dark:text-slate-200">
{bestPractice.name}
</h3>
<p className="text-sm text-slate-600 dark:text-slate-400">{bestPractice.description}</p>
<p className="flex self-end text-sm text-slate-600 dark:text-slate-400">
{bestPractice.description}
</p>
</div>
</Link>
))}

View File

@@ -1,6 +1,6 @@
import Link from "next/link";
import { FaDiscord, FaGithub, FaXTwitter } from "react-icons/fa6";
import { FooterLogo } from "./Logo";
import { FaGithub, FaXTwitter, FaDiscord } from "react-icons/fa6";
const navigation = {
other: [
@@ -33,7 +33,7 @@ export default function Footer() {
return (
<footer
className="mt-32 bg-gradient-to-b from-slate-50 to-slate-200 dark:from-slate-900 dark:to-slate-800"
className="bg-gradient-to-b from-slate-50 to-slate-200 pt-32 dark:from-slate-900 dark:to-slate-800"
aria-labelledby="footer-heading">
<h2 id="footer-heading" className="sr-only">
Footer

View File

@@ -278,6 +278,11 @@ export default function Header() {
className="text-sm font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 lg:text-base">
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">
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">
@@ -293,12 +298,6 @@ export default function Header() {
className="text-base font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300">
Careers <p className="bg-brand inline rounded-full px-2 text-xs text-white">1</p>
</Link> */}
<Link
href="/concierge"
className="text-sm font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 lg:text-base">
Concierge
</Link>
</Popover.Group>
<div className="hidden flex-1 items-center justify-end md:flex">
<ThemeSelector className="relative z-10 mr-2 lg:mr-5" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

View File

@@ -6,3 +6,14 @@ export function formatDate(dateString: string) {
timeZone: "UTC",
});
}
export function generateManagementApiMetadata(title, methods) {
// Create a string from the methods array, formatted for title and description
const formattedMethods = methods.join(", ").replace(/, ([^,]*)$/, " or $1");
return {
title: `Formbricks ${title} API: ${
formattedMethods.charAt(0).toUpperCase() + formattedMethods.slice(1)
} ${title}`,
description: `Dive into Formbricks' ${title} API within the Public Client API suite. This API is designed for ${formattedMethods} operations on ${title}, facilitating client-side interactions without the need for authentication, thereby ensuring data privacy and efficiency.`,
};
}

View File

@@ -25,6 +25,11 @@ const nextConfig = {
hostname: "seo-strapi-aws-s3.s3.eu-central-1.amazonaws.com",
port: "",
},
{
protocol: "https",
hostname: "avatars.githubusercontent.com",
port: "",
},
],
},
async redirects() {
@@ -160,6 +165,11 @@ const nextConfig = {
destination: "/docs/contributing/setup#gitpod",
permanent: true,
},
{
source: "/formtribe",
destination: "/community",
permanent: true,
},
];
},
async rewrites() {

View File

@@ -28,6 +28,11 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse)
"Centralize community, product, and customer data to understand which companies are engaging with your open source project.",
href: "https://www.crowd.dev",
},
{
name: "DevHunt",
description: "Find the best Dev Tools upvoted by the community every week.",
href: "https://devhunt.org/",
},
{
name: "Documenso",
description:

View File

@@ -1,101 +0,0 @@
import Layout from "@/components/shared/Layout";
import HeroTitle from "@/components/shared/HeroTitle";
import { Button } from "@formbricks/ui/Button";
import { ArrowTopRightOnSquareIcon } from "@heroicons/react/24/outline";
import { useRouter } from "next/router";
import { ChatBubbleOvalLeftEllipsisIcon, EnvelopeIcon } from "@heroicons/react/24/solid";
const topContributors = [
{
name: "Midka",
href: "https://github.com/kymppi",
},
{
name: "Pandeyman",
href: "https://github.com/pandeymangg",
},
{
name: "Ashu",
href: "https://github.com/Ashutosh-Bhadauriya",
},
{
name: "Timothy",
href: "https://github.com/timothyde",
},
{
name: "Shubhdeep",
href: "https://github.com/Shubhdeep12",
},
];
const CommunityPage = () => {
const router = useRouter();
return (
<Layout
title="Community | Formbricks Open Source Forms & Surveys"
description="You're building open source forms and surveys? So are we! Get support for anything your building - or just say hi!">
<HeroTitle headingPt1="Join the" headingTeal="Formbricks" headingPt2="Community 🤍" />
<div className="mb-32 grid grid-cols-1 px-4 md:grid-cols-2 md:gap-8 md:px-16">
<div className="mb-6 rounded-lg bg-gradient-to-b from-slate-200 to-slate-300 px-10 py-6 dark:from-slate-800 dark:to-slate-700 md:mb-0">
<h2 className="mt-7 text-3xl font-bold text-slate-800 dark:text-slate-200 xl:text-4xl">
Top Contributors
</h2>
<p className="mt-2 text-sm text-slate-500 dark:text-slate-400">
Super thankful to have you guys contribute for Formbricks 🙌
</p>
<ol className="ml-4 mt-10 list-decimal">
{topContributors.map((MVP) => (
<li
key={MVP.name}
className="my-3 text-lg font-bold text-slate-700 hover:text-slate-600 dark:text-slate-300 dark:hover:text-slate-400">
<a href={MVP.href} className="" target="_blank" rel="noreferrer">
{MVP.name}
<ArrowTopRightOnSquareIcon className="text-brand-dark dark:text-brand-light mb-1 ml-1 inline h-5 w-5" />
</a>
</li>
))}
</ol>
</div>
<div>
<div className="rounded-lg bg-gradient-to-b from-slate-200 to-slate-300 px-10 pb-12 pt-6 dark:from-slate-800 dark:to-slate-700">
<h3 className="mt-7 text-3xl font-bold text-slate-800 dark:text-slate-200 xl:text-4xl">
Community Discord
</h3>
<p className="mt-2 text-sm text-slate-500 dark:text-slate-400">
Get support for anything your building - or just say hi 👋
</p>
<Button
className="mt-7 w-full justify-center"
variant="highlight"
onClick={() => router.push("/discord")}>
Join Discord <ChatBubbleOvalLeftEllipsisIcon className="ml-1 inline h-5 w-5" />
</Button>
</div>
<div className="mt-7 flex">
<a
href="https://twitter.com/formbricks"
target="_blank"
rel="noreferrer"
className="delay-50 w-1/2 transition ease-in-out hover:scale-105">
<div className="mr-3 flex justify-center rounded-lg bg-gradient-to-b from-slate-200 to-slate-300 py-6 dark:from-slate-800 dark:to-slate-700">
<svg fill="currentColor" viewBox="0 0 24 24" className="h-20 w-20 text-[#1DA1F2]">
<path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84" />
</svg>
</div>
</a>
<a
href="mailto:hola@formbricks.com"
className="delay-50 w-1/2 transition ease-in-out hover:scale-105">
<div className="ml-3 flex justify-center rounded-lg bg-gradient-to-b from-slate-200 to-slate-300 py-6 dark:from-slate-800 dark:to-slate-700">
<EnvelopeIcon className="ml-1 h-20 w-20 text-slate-400 " />
</div>
</a>
</div>
</div>
</div>
</Layout>
);
};
export default CommunityPage;

View File

@@ -0,0 +1,44 @@
import Image from "next/image";
import Link from "next/link";
import { FaGithub } from "react-icons/fa6";
type Contributor = {
githubId: string;
imgUrl: string;
name: string;
};
type GridComponentProps = {
contributors: Contributor[];
};
const ContributorGrid: React.FC<GridComponentProps> = ({ contributors }) => {
return (
<div className="-mb-64 mt-24 grid scale-105 grid-cols-4 gap-6 md:-mb-32 md:grid-cols-8">
{contributors?.map((contributor, index) => (
<div key={index} className={`col-span-1 ${index % 2 !== 0 ? "-mt-8" : ""}`}>
<Link
href={`https://github.com/${contributor.githubId}`}
target="_blank"
className="group transition-transform">
<div className="bg-brand-dark mx-auto -mb-12 flex w-fit max-w-[90%] items-center justify-center rounded-t-xl px-4 pb-3 pt-1 text-sm text-slate-100 transition-all group-hover:-mt-12 group-hover:mb-0">
<FaGithub className="mr-2 h-4 w-4" />
<p className="max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap">
{contributor.githubId}
</p>
</div>
<Image
src={contributor.imgUrl}
alt={contributor.name}
className="ring-brand-dark rounded-lg ring-offset-4 ring-offset-slate-900 transition-all hover:scale-110 hover:ring-1"
width={500}
height={500}
/>
</Link>
</div>
))}
</div>
);
};
export default ContributorGrid;

View File

@@ -0,0 +1,93 @@
import DeputyBadge from "@/images/formtribe/deputy-batch.png";
import LegendBadge from "@/images/formtribe/legend-batch.png";
import PrimeBadge from "@/images/formtribe/prime-batch.png";
import RookieBadge from "@/images/formtribe/rookie-batch.png";
import Image from "next/image";
import Link from "next/link";
interface Member {
name: string;
githubId: string;
level: string;
imgUrl: string;
}
interface RoadmapProps {
members: Member[];
}
interface BadgeSectionProps {
badgeImage: any;
level: string;
members: Member[];
className: string; // New property for styling
}
const BadgeSection: React.FC<BadgeSectionProps> = ({ badgeImage, level, members, className }) => {
const filteredMembers = members?.filter((member) => member.level === level);
return (
<div className="group flex flex-col items-center space-y-6 pt-12 md:flex-row md:space-x-10 md:px-4">
<Image
src={badgeImage}
alt={`${level} badge`}
className="h-32 w-32 transition-all delay-100 duration-300 group-hover:-rotate-6 group-hover:scale-110"
/>
<div className="grid w-full gap-2 md:grid-cols-3">
{filteredMembers?.length > 0 ? (
filteredMembers?.map((member) => (
<Link
key={member.githubId}
href={`https://github.com/formbricks/formbricks/pulls?q=is:pr+author:${member.githubId}`}
target="_blank"
className={`flex w-full items-center space-x-3 rounded-xl border px-4 py-1 transition-all hover:scale-105 md:px-5 md:py-2 ${className}`}>
<Image
src={member.imgUrl}
alt={member.githubId}
className="mr-3 h-8 w-8 rounded-full md:h-12 md:w-12"
width={100}
height={100}
/>
{member.name}
</Link>
))
) : (
<div className="text-center text-slate-700">No Legends around yet 👀</div>
)}
</div>
</div>
);
};
export const HallOfFame: React.FC<RoadmapProps> = ({ members }) => {
return (
<div className="mx-auto space-y-12 divide-y-2">
<BadgeSection
badgeImage={LegendBadge}
level="legend"
members={members}
className="border-green-300 bg-green-100 text-green-700"
/>
<BadgeSection
badgeImage={PrimeBadge}
level="prime"
members={members}
className="border-indigo-200 bg-indigo-100 text-indigo-700"
/>
<BadgeSection
badgeImage={DeputyBadge}
level="deputy"
members={members}
className="border-orange-200 bg-orange-100 text-orange-700"
/>
<BadgeSection
badgeImage={RookieBadge}
level="rookie"
members={members}
className="border-amber-200 bg-amber-100 text-amber-700"
/>
</div>
);
};
export default HallOfFame;

View File

@@ -1,15 +1,15 @@
import Logo from "@/images/formtribe/formtribe-logo.png";
import { Popover, PopoverContent, PopoverTrigger } from "@formbricks/ui/Popover";
import footerLogoDark from "@/images/logo/footerlogo-dark.svg";
import { Button } from "@formbricks/ui/Button";
import { Popover, PopoverContent, PopoverTrigger } from "@formbricks/ui/Popover";
import { Bars3Icon } from "@heroicons/react/24/solid";
import Image from "next/image";
import Link from "next/link";
import { useState } from "react";
const navigation = [
{ name: "How it works", href: "#how" },
{ name: "Prizes", href: "#prizes" },
{ name: "Leaderboard", href: "#leaderboard" },
{ name: "Roadmap", href: "#roadmap" },
{ name: "Levels", href: "#levels" },
{ name: "Hall of Fame", href: "#hof" },
{ name: "FAQ", href: "#faq" },
];
@@ -17,33 +17,30 @@ export default function HeaderLight() {
const [mobileNavMenuOpen, setMobileNavMenuOpen] = useState(false);
return (
<div className="mx-auto flex w-full items-center justify-between py-6 sm:px-2 ">
<div className="= mx-auto flex w-full max-w-7xl items-center justify-between py-6 sm:px-2 ">
<div className="flex items-center justify-start">
<Link href="/">
<span className="sr-only">FormTribe</span>
<Image alt="Formtribe Logo" src={Logo} className="ml-7 h-8 w-auto sm:h-10" />
<Image alt="Formbricks Logo" src={footerLogoDark} className="h-8 w-auto pl-4 sm:h-10" />
</Link>
<Link
href="https://formbricks.com/github"
target="_blank"
className="ml-6 mt-1 text-sm text-slate-500 hover:scale-105">
className="ml-6 mt-1 text-sm text-slate-300 hover:scale-105">
Star us
</Link>
</div>
{/* Desktop Menu */}
<div className="hidden items-center gap-x-8 text-slate-700 md:flex">
<div className="hidden items-center gap-x-8 text-slate-300 md:flex">
{navigation.map((navItem) => (
<Link key={navItem.name} href={navItem.href} className="hover:scale-105">
{navItem.name}
</Link>
))}
<Button
variant="highlight"
className="font-kablammo ml-2 bg-gradient-to-br from-[#032E1E] via-[#032E1E] to-[#013C27] text-xl"
href="#join">
Join
<Button variant="secondary" size="sm" className="ml-2" href="https://formbricks.com/discord">
Join us!
</Button>
</div>
@@ -52,17 +49,17 @@ export default function HeaderLight() {
<Popover open={mobileNavMenuOpen} onOpenChange={setMobileNavMenuOpen}>
<PopoverTrigger onClick={() => setMobileNavMenuOpen(!mobileNavMenuOpen)}>
<span>
<Bars3Icon className="h-8 w-8 rounded-md bg-slate-200 p-1 text-slate-600" />
<Bars3Icon className="h-8 w-8 rounded-md bg-slate-700 p-1 text-slate-200" />
</span>
</PopoverTrigger>
<PopoverContent className="mr-4 bg-slate-100 shadow">
<PopoverContent className="border-slate-600 bg-slate-700 shadow">
<div className="flex flex-col">
{navigation.map((navItem) => (
<Link key={navItem.name} href={navItem.href}>
<div
onClick={() => setMobileNavMenuOpen(false)}
className="flex items-center space-x-2 rounded-md p-2">
<span className="font-medium text-slate-600">{navItem.name}</span>
<span className="font-medium text-slate-200">{navItem.name}</span>
</div>
</Link>
))}

View File

@@ -10,14 +10,10 @@ interface LayoutProps {
export default function Layout({ title, description, children }: LayoutProps) {
return (
<div className="max-w-8xl mx-auto">
<div className="mx-auto bg-gradient-to-br from-gray-800 via-gray-900 to-gray-900">
<MetaInformation title={title} description={description} />
<HeaderTribe />
{
<main className="relative mx-auto flex w-full max-w-6xl flex-col justify-center px-2 lg:px-8 xl:px-12">
{children}
</main>
}
<main className="">{children}</main>
<Footer />
</div>
);

View File

@@ -0,0 +1,41 @@
import Image from "next/image";
import React from "react";
import { StaticImageData } from "next/image";
type Task = {
title: string;
description: string;
};
type LevelCardProps = {
badgeSrc: StaticImageData; // or string if it's a URL
badgeAlt: string;
title: string;
points: string;
tasks: Task[];
};
const LevelCard: React.FC<LevelCardProps> = ({ badgeSrc, badgeAlt, title, points, tasks }) => (
<div className="group">
<div className="flex w-full flex-col items-center rounded-t-xl bg-slate-700 p-10 transition-colors">
<Image
src={badgeSrc}
alt={badgeAlt}
className="h-32 w-32 transition-all delay-100 duration-300 group-hover:-rotate-6 group-hover:scale-110"
/>
<p className="mt-4 text-lg font-bold text-slate-200">{title}</p>
<p className="text-sm leading-5 text-slate-400">{points}</p>
</div>
<div className="w-full rounded-b-xl bg-slate-600 p-10 text-left">
{tasks?.map((task, index) => (
<React.Fragment key={index}>
<p className="font-bold text-slate-200">{task.title}</p>
<p className="mb-6 leading-5 text-slate-400">{task.description}</p>
</React.Fragment>
))}
</div>
</div>
);
export default LevelCard;

View File

@@ -0,0 +1,45 @@
import Image from "next/image";
import Link from "next/link";
import { FaGithub } from "react-icons/fa6";
type Contributor = {
githubId: string;
imgUrl: string;
name: string;
};
type LevelGridProps = {
contributors: Contributor[];
};
const LevelGrid: React.FC<LevelGridProps> = ({ contributors }) => {
return (
<div className="-mt-64 grid scale-105 grid-cols-4 gap-6 md:-mt-32 md:grid-cols-8">
{contributors?.map((contributor, index) => (
<div key={index} className={`col-span-1 ${index % 2 !== 0 ? "-mt-8" : ""}`}>
<Link
href={`https://github.com/${contributor.githubId}`}
target="_blank"
rel="noopener noreferrer"
className="group transition-transform">
<div className="bg-brand-dark mx-auto -mb-12 flex w-fit max-w-[90%] items-center justify-center rounded-t-xl px-4 pb-3 pt-1 text-sm text-slate-100 transition-all group-hover:-mt-12 group-hover:mb-0">
<FaGithub className="mr-2 h-4 w-4" />
<p className="max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap">
{contributor.githubId}
</p>
</div>
<Image
src={contributor.imgUrl}
alt={contributor.name}
className="ring-brand-dark rounded-lg ring-offset-4 ring-offset-slate-900 transition-all hover:scale-110 hover:ring-1"
width={500}
height={500}
/>
</Link>
</div>
))}
</div>
);
};
export default LevelGrid;

View File

@@ -0,0 +1,67 @@
import { Button } from "@formbricks/ui/Button";
import { ChevronDownIcon } from "@heroicons/react/24/outline";
import Link from "next/link";
import { FaGithub } from "react-icons/fa6";
interface Event {
name: string;
link?: string;
}
interface EventBlock {
id: string;
description: string;
period: string;
events: Event[];
}
interface RoadmapProps {
data: EventBlock[];
}
export const Roadmap: React.FC<RoadmapProps> = ({ data }) => {
return (
<div className="px-6 text-left">
{data?.map((eventblock) => (
<div key={eventblock.id} className="relative mb-6 border-l-2 border-slate-400 pb-2 pl-12">
<h3 className="my-4 hidden pt-2 font-semibold text-slate-800 md:block">
{eventblock.description} <span className="font-normal">{eventblock.period}</span>
</h3>
<h3 className="my-4 block pt-2 font-semibold text-slate-800 md:hidden">
{eventblock.description} <br></br> <span className="font-normal">{eventblock.period}</span>
</h3>
{eventblock?.events?.map((event) => (
<div key={event.name}>
{event.link ? (
<Link
href={event.link}
target="_blank"
className="group mb-2 flex max-w-fit justify-between rounded-xl border border-slate-200 bg-slate-100 px-6 py-3 text-slate-700 transition-all hover:scale-105 hover:border-slate-300 hover:bg-slate-200">
{event.name}
<FaGithub className="ml-0 inline-block h-6 w-0 text-slate-800 opacity-0 transition-all group-hover:ml-6 group-hover:w-6 group-hover:opacity-100" />
</Link>
) : (
<div className="mb-2 block max-w-fit rounded-xl border border-slate-200 bg-slate-100 px-6 py-3 text-slate-700 transition-all">
{event.name}
</div>
)}
</div>
))}
{eventblock.id === "phlaunch" && (
<Button
href="https://formbricks.com/discord"
target="_blank"
variant="darkCTA"
className="rounded-xl px-5 py-2 text-base transition-all hover:scale-105">
Whats next? Request Features
</Button>
)}
<ChevronDownIcon className="absolute -left-[17px] -mt-3 h-8 w-8 text-slate-400" />
</div>
))}
<h3 className="text-xl font-bold">Internet Domination 😇</h3>
</div>
);
};
export default Roadmap;

View File

@@ -0,0 +1,723 @@
import ArrowGift from "@/images/formtribe/arrow-gift.png";
import HoodieSticker from "@/images/formtribe/arrow-hoodie.png";
import ArrowSticker from "@/images/formtribe/arrow-stickers.png";
import DeputyBadge from "@/images/formtribe/deputy-batch.png";
import LegendBadge from "@/images/formtribe/legend-batch.png";
import PrimeBadge from "@/images/formtribe/prime-batch.png";
import RookieBadge from "@/images/formtribe/rookie-batch.png";
import HallOfFame from "@/pages/community/HallOfFame";
import Roadmap from "@/pages/community/Roadmap";
import LoadingSpinner from "@formbricks/ui/LoadingSpinner";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@formbricks/ui/Tooltip";
import Image from "next/image";
import Link from "next/link";
import { useEffect } from "react";
import ContributorGrid from "./ContributorGrid";
import LayoutTribe from "./LayoutTribe";
import LevelCard from "./LevelCard";
import LevelsGrid from "./LevelGrid";
/* const SideQuests = [
{
points: "Spread the Word Tweet (100 Points)",
quest: "Tweet “🧱🚀” on the day of the ProductHunt launch to spread the word.",
proof: "Share the link to the tweet in the “side-quest” channel.",
},
{
points: "Meme Magic (50 Points + up to 100 Points)",
quest:
"Craft a meme where a brick plays a role. For extra points, tweet it, tag us and score +5 for each like.",
proof: "Share meme or link to the tweet in the “side-quest” channel.",
},
{
points: "GIF Magic (100 Points)",
quest:
"Create a branded gif related to Formbricks. Upload it to Giphy. For extra points, tweet it, tag us and score +5 for each like.",
proof: "Share link to Giphy in the “side-quest” channel.",
},
{
points: "Design a background (250 Points)",
quest: "Illustrate a captivating background for survey enthusiasts (more infos on Notion).",
proof: "Share the design in the “side-quest” channel.",
},
{
points: "Starry-eyed Supporter (250 Points)",
quest: "Get five friends to star our repository.",
proof: "Share 5 screenshots of the chats where you asked them and they confirmed + their GitHub names",
},
{
points: "Bug Hunter (100 Points)",
quest:
"Find and report any bugs in our core product. We will close all bugs on the landing page bc we don't have time for that before the launch :)",
proof: "Open a bug issue in our repository.",
},
{
points: "Brickify someone famous with AI (200 Points + up to 100 Points)",
quest:
"Find someone whose name would be funny as a play on words with “brick”. Then, with the help of AI, create a brick version of this person like Brick Astley, Brickj Minaj, etc. For extra points, tweet it, tag us and score +5 for each like.",
proof: "Share your art or link to the tweet in the “side-quest” channel.",
},
{
points: "Community Connector (50 points each, up to 250 points)",
quest:
"Introduce and onboard new members to the community. Have them join Discord and reply to their automated welcome message with your discord handle (in “say-hi” channel).",
proof: "New member joined and commented with your Discord handle",
},
{
points: "Feedback Fanatic (50 Points)",
quest: "Fill out our feedback survey after the hackathon with suggestions for improvement.",
proof: "Submit the survey.",
},
{
points: "Side Quest Babo (500 Points)",
quest: "Complete all side quests.",
proof: "All quests marked as completed.",
},
]; */
const LevelsData = [
{
badgeSrc: RookieBadge,
badgeAlt: "Rookie Badge",
title: "Repository Rookie",
points: "Level 1",
tasks: [
{ title: "Easy issues", description: "Warm up with the repo, get your first PR merged." },
{ title: "DevRel tasks", description: "Write docs and manuals for better understanding." },
],
},
{
badgeSrc: DeputyBadge,
badgeAlt: "Deputy Badge",
title: "Deploy Deputy",
points: "Level 2",
tasks: [
{ title: "Core Contributions", description: "Work on more complex issues. Get guidance." },
{ title: "Work with core team", description: "Work closely with the core team, learn faster." },
],
},
{
badgeSrc: PrimeBadge,
badgeAlt: "Prime Badge",
title: "Pushmaster Prime",
points: "Level 3",
tasks: [
{ title: "Cash Bounties", description: "Get access to issues with $$$ bounties." },
{ title: "Job Listings", description: "We hire top contributors. Hear about new jobs first!" },
],
},
{
badgeSrc: LegendBadge,
badgeAlt: "Legend Badge",
title: "Formbricks Legend",
points: "Special Honor",
tasks: [{ title: "Unconditional Love", description: "Finally. From the community and core team 🤍" }],
},
];
const TheDeal = [
{
os: "100% free",
free: "Unlimited Surveys",
pro: "Custom URL",
},
{
os: "All community features included",
free: "Unlimited Link Survey Submissions",
pro: "Remove Branding",
},
{
os: "It's your storage, go nuts!",
free: "Upload Limit 10 MB",
pro: "Unlimited Uploads",
},
{
os: "Hook up your own Stripe",
free: "Payments with 2% Mark Up",
pro: "Remove Mark Up from Payments",
},
{
os: "Your server, your rules",
free: "Invite Team Members",
pro: "",
},
{
os: "The 'Do what you want' plan",
free: "Verify Email before Submission",
pro: "",
},
{
os: "at this point I'm just filling rows",
free: "Partial Submissions",
pro: "",
},
{
os: "I should stop",
free: "Custom Thank You Page",
pro: "",
},
{
os: "ok one more",
free: "Close Survey after Submission Limit",
pro: "",
},
{
os: "no flavor like free flavor",
free: "Custom Survey Closed Message",
pro: "",
},
{
os: "...",
free: "Close Survey on Date",
pro: "",
},
{
free: "Redirect on Completion",
pro: "",
},
{
free: "+ all upcoming community-built features",
pro: "",
},
];
const FAQ = [
{
question: "Why do I have to sign a CLA?",
answer:
"To assure this project to be financially viable, we have to be able to relicense the code for enterprise customers and governments. To be able to do so, we are legally obliged to have you sign a CLA.",
},
{
question: "Where will this be hosted?",
answer:
"We offer a Formbricks Cloud hosted in Germany with a generous free plan but you can also easily self-host using Docker.",
},
{
question: "Why is there a Commercial plan?",
answer:
"The commercial plan is for features who break the OSS WIN-WIN Loop or incur additional cost. We charge 29$ if you want a custom domain, remove Formbricks branding, collect large files in surveys or collect payments. We think thats fair :)",
},
{
question: "Are your in app surveys also free forever?",
answer:
"The in app surveys you can run with Formbricks are not part of this Deal. We offer a generous free plan but keep full control over the pricing in the long run. In app surveys are really powerful for products with thousands of users and something has to bring in the dollars.",
},
{
question: "Can anyone join?",
answer:
"Yes! Even when you dont know how to write code you can become part of the community completing side quests. As long as you know how to open a PR you are very welcome to take part irrespective of your age, gender, nationality, food preferences, taste in clothing and favorite Pokemon.",
},
{
question: "How do I level up?",
answer:
"Every PR gives you points - doesnt matter if its for code related tasks or non-code ones. With every point, you move closer to levelling up!",
},
];
const roadmapDates = [
{
id: "earlywork",
description: "Previously at Formbricks",
period: "February until September 2023",
events: [{ name: "Formbricks team building out surveying infrastructure" }],
},
{
id: "hackathon",
description: "Hackathon Kick-Off 🔥",
period: "1st October 2023",
events: [
{ name: "✅ Email Embeds", link: "https://github.com/formbricks/formbricks/pull/873" },
{ name: "✅ Hidden Fields", link: "https://github.com/formbricks/formbricks/pull/1144" },
{
name: "✅ Question Type: Picture Choice",
link: "https://github.com/formbricks/formbricks/pull/1388",
},
{ name: "✅ Question Type: Welcome Card", link: "https://github.com/formbricks/formbricks/pull/1073" },
{ name: "✅ Add Image to Question", link: "https://github.com/formbricks/formbricks/pull/1305" },
{ name: "✅ Dynamic Link Previews", link: "https://github.com/formbricks/formbricks/pull/1093" },
{ name: "✅ Fullscreen Previews", link: "https://github.com/formbricks/formbricks/pull/898" },
{ name: "✅ PIN protected surveys", link: "https://github.com/formbricks/formbricks/pull/1142" },
{ name: "✅ Source Tracking", link: "https://github.com/formbricks/formbricks/pull/1486" },
{ name: "✅ Time To Complete Indicator", link: "https://github.com/formbricks/formbricks/pull/1461" },
],
},
{
id: "phlaunch",
description: "Product Hunt Launch 🚀",
period: "31st October 2023",
events: [
{ name: "✅ Question Type: File Upload", link: "https://github.com/formbricks/formbricks/pull/1277" },
{ name: "✅ Notion Integration", link: "https://github.com/formbricks/formbricks/pull/1197" },
{ name: "✅ Media Backgrounds", link: "https://github.com/formbricks/formbricks/pull/1515" },
{ name: "🚧 Custom Styling", link: "https://github.com/formbricks/formbricks/pull/916" },
{ name: "🚧 Recall Information", link: "https://github.com/formbricks/formbricks/issues/884" },
{ name: "⏳ Unsplash Backgrounds" },
{ name: "⏳ Question Type: Matrix" },
{ name: "⏳ Question Type: Collect payment" },
{ name: "⏳Question Type: Schedule a call (Powered by Cal.com)" },
{ name: "⏳ Question Type: Signature (Powered by Documenso)" },
],
},
];
const members = [
{
name: "Shubham Palriwala",
githubId: "ShubhamPalriwala",
points: "100",
level: "prime",
imgUrl: "https://avatars.githubusercontent.com/u/55556994?v=4",
},
{
name: "Rotimi Best",
githubId: "rotimi-best",
points: "100",
level: "prime",
imgUrl: "https://avatars.githubusercontent.com/u/31730715?v=4",
},
{
name: "Dhruwang Jariwala",
githubId: "Dhruwang",
points: "100",
level: "prime",
imgUrl: "https://avatars.githubusercontent.com/u/67850763?v=4",
},
{
name: "Piyush Gupta",
githubId: "gupta-piyush19",
points: "100",
level: "prime",
imgUrl: "https://avatars.githubusercontent.com/u/56182734?v=4",
},
{
name: "Naitik Kapadia",
githubId: "KapadiaNaitik",
points: "100",
level: "deputy",
imgUrl: "https://avatars.githubusercontent.com/u/88614335?v=4",
},
{
name: "Anshuman Pandey",
githubId: "pandeymangg",
points: "100",
level: "prime",
imgUrl: "https://avatars.githubusercontent.com/u/54475686?v=4",
},
{
name: "Midka",
githubId: "kymppi",
points: "100",
level: "deputy",
imgUrl: "https://avatars.githubusercontent.com/u/48528700?v=4",
},
{
name: "Meet Patel",
githubId: "Meetcpatel",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/26919832?v=4",
},
{
name: "Ankur Datta",
githubId: "Ankur-Datta-4",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/75306530?v=4",
},
{
name: "Abhinav Arya",
githubId: "itzabhinavarya",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/95561280?v=4",
},
{
name: "Anjy Gupta",
githubId: "anjy7",
points: "100",
level: "deputy",
imgUrl: "https://avatars.githubusercontent.com/u/92802904?v=4",
},
{
name: "Aditya Deshlahre",
githubId: "adityadeshlahre",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/132184385?v=4",
},
{
name: "Ashutosh Bhadauriya",
githubId: "Ashutosh-Bhadauriya",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/62984427?v=4",
},
{
name: "Bilal Mirza",
githubId: "bilalmirza74",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/84387676?v=4",
},
{
name: "Timothy",
githubId: "timothyde",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/13225886?v=4",
},
{
name: "Jonas Höbenreich",
githubId: "jonas-hoebenreich",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/64426524?v=4",
},
{
name: "Pratik Awaik",
githubId: "PratikAwaik",
points: "100",
level: "deputy",
imgUrl: "https://avatars.githubusercontent.com/u/54103265?v=4",
},
{
name: "Rohan Gupta",
githubId: "rohan9896",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/56235204?v=4",
},
{
name: "Shubham Khunt",
githubId: "shubhamkhunt04",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/55044317?v=4",
},
{
name: "Joe",
githubId: "joe-shajan",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/69904519?v=4",
},
{
name: "Ty Kerr",
githubId: "ty-kerr",
points: "100",
level: "deputy",
imgUrl: "https://avatars.githubusercontent.com/u/17407010?v=4",
},
{
name: "Olasunkanmi Balogun",
githubId: "SiR-PENt",
points: "100",
level: "rookie",
imgUrl: "https://avatars.githubusercontent.com/u/80556643?v=4",
},
{
name: "Ronit Panda",
githubId: "rtpa25",
points: "100",
level: "deputy",
imgUrl: "https://avatars.githubusercontent.com/u/72537293?v=4",
},
{
name: "Nafees Nazik",
githubId: "G3root",
points: "100",
level: "deputy",
imgUrl: "https://avatars.githubusercontent.com/u/84864519?v=4",
},
];
export default function FormTribeHackathon() {
// dark mode fix
useEffect(() => {
document.documentElement.classList.remove("dark");
}, []);
return (
<LayoutTribe
title="Join the FormTribe"
description="We build an Open Source Typeform alternative together and give it to the world. Join us!">
{/* Header */}
<div className="flex h-full w-full flex-col items-center justify-center overflow-clip text-center">
<div className="py-16 md:py-24">
<h1 className="mt-10 px-6 text-3xl font-bold text-slate-100 sm:text-4xl md:text-5xl">
<span className="xl:inline">
Beautiful Open Source Surveys. <br className="hidden md:block"></br>Built as a community, free
forever.
</span>
</h1>
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-300 sm:text-lg md:mt-6 md:text-xl">
The time is ripe, this is needed. So we ship it as a community - and give it back to the world!
<br></br>Join us and build surveying infrastructure for millions - free and open source.
</p>
</div>
<ContributorGrid contributors={members} />
</div>
{/* Roadmap */}
<div
className="flex flex-col items-center justify-center bg-gradient-to-br from-white to-slate-100 pb-12 text-center md:pb-24"
id="roadmap">
<div className="py-16 md:py-24">
<h2 className="mt-10 text-2xl font-bold text-slate-800 sm:text-3xl md:text-4xl">
<span className="xl:inline">
First Things First: <br></br>An Open Source Typeform Alternative
</span>
</h2>
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-600 sm:text-lg md:mt-6 md:text-xl">
It&apos;s been requested many times over, so Typeform-like surveys is where we start.
<br></br>In October, we kicked it off in style with a 30-day hackathon.
</p>
</div>
<Roadmap data={roadmapDates} />
</div>
{/* Levels */}
<div
className="mb-12 flex flex-col items-center justify-center overflow-clip text-center lg:mb-40"
id="levels">
<LevelsGrid contributors={members} />
<div className="py-16 md:py-24">
<h2 className="mt-10 px-8 text-2xl font-bold text-slate-100 sm:text-3xl md:text-4xl">
<span className="xl:inline">Write Code, Level Up and Unlock Benefits</span>
</h2>
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-300 sm:text-lg md:mt-6 md:text-xl">
The more you contribute, the more points you collect.
<br className="hidden md:block"></br> Unlock benefits like cash bounties, limited merch and more!
</p>
</div>
<div className="max-w-8xl grid gap-6 px-8 md:grid-cols-4 lg:px-24">
{LevelsData.map((badge, index) => (
<LevelCard key={index} {...badge} />
))}
</div>
<div className="max-w-8xl mt-8 grid grid-cols-3 gap-4 px-56">
<div className="px-8">
<p className="h-0 text-lg font-bold text-slate-300">+ Sticker Set</p>
<Image src={ArrowSticker} alt="rookie batch" className="" />
</div>
<div className="px-8">
<p className="h-0 text-lg font-bold text-slate-300">+ Hoodie</p>
<Image src={HoodieSticker} alt="rookie batch" className="" />
</div>
<div className="px-8">
<p className="h-0 text-lg font-bold text-slate-300">+ Handmade Gift</p>
<Image src={ArrowGift} alt="rookie batch" className="" />
</div>
</div>
</div>
{/* Become a Legend */}
<div
className="flex flex-col items-center justify-center bg-gradient-to-br from-white to-slate-100 pb-24 text-center"
id="hof">
<div className="py-16 md:py-24">
<h2 className="mt-10 text-2xl font-bold text-slate-800 sm:text-3xl md:text-4xl">
<span className="xl:inline">
Become a<br className="md:hidden"></br> Formbricks Legend
</span>
</h2>
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-600 sm:text-lg md:mt-6 md:text-xl">
This is your wall of fame. Were honoured to be in this together!
</p>
</div>
<HallOfFame members={members} />
</div>
{/* Our values */}
<div className="mb-24 flex flex-col items-center justify-center text-center md:mb-40">
<div className="py-16 md:py-24">
<h2 className="mt-10 text-2xl font-bold text-slate-100 sm:text-3xl md:text-4xl">
<span className="xl:inline">Our values</span>
</h2>
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-300 sm:text-lg md:mt-6 md:text-xl">
Apart from being decent human beings, this is what we value:
</p>
</div>
<div className="max-w-8xl grid gap-x-6 gap-y-6 px-8 md:grid-cols-3 md:px-16">
<ValueCard
emoji="🧘‍♂️"
title="Less is more."
description="Like with friends, were about forming deep and meaningful relationships within our community. If you want to merge a PR with improved punctuation to catch a green square, this is likely not the right place for you :)"
/>
<ValueCard
emoji="🤝"
title="Show up & Pull through."
description="When you pick a task up, please make sure to complete it in timely manner. The longer it floats around, the more merge conflicts arise."
/>
<ValueCard
emoji="🍔"
title="Only bite off what you can chew."
description="Open source is all about learning and so is our community. We love help you learn but have to manage our resources well. Please dont take up tasks far outside your area of competence."
/>
</div>
</div>
{/* Side Quests
<div className="mt-16" id="side-quests">
<h3 className="font-kablammo my-4 text-4xl text-slate-800">🏰 Side Quests: Increase your chances</h3>
<p className="w-3/4 text-slate-600">
While code contributions are what gives the most points, everyone gets to bump up their chance of
winning. Here is a list of side quests you can complete:
</p>
<div className="mt-8">
<TooltipProvider delayDuration={50}>
{SideQuests.map((quest) => (
<div key={quest.points}>
<Tooltip>
<TooltipTrigger>
<div className="mb-2 flex items-center gap-x-6">
<div className="text-2xl">✅</div>
<p className="text-left font-bold text-slate-700">
{quest.points}: <span className="font-normal">{quest.quest}</span>
</p>
</div>
</TooltipTrigger>
<TooltipContent side={"top"}>
<p className="py-2 text-center text-slate-500 dark:text-slate-400">
<p className="mt-1 text-sm text-slate-600">Proof: {quest.proof}</p>
</p>
</TooltipContent>
</Tooltip>
</div>
))}
</TooltipProvider>
</div>
<Button
variant="darkCTA"
href="https://formbricks.notion.site/FormTribe-Side-Quests-4ab3b294cfa04e94b77dfddd66378ea2?pvs=4"
target="_blank"
className="mt-6 bg-gradient-to-br from-[#032E1E] via-[#032E1E] to-[#013C27] text-white ">
Keep track with Notion Template
</Button>
</div> */}
{/* The Promise */}
<div className="flex flex-col items-center justify-center bg-gradient-to-br from-white to-slate-100 pb-24 text-center">
<div className="py-16 md:py-24">
<h2 className="mt-10 text-2xl font-bold text-slate-800 sm:text-3xl md:text-4xl">
<span className="xl:inline">The Deal</span>
</h2>
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-600 sm:text-lg md:mt-6 md:text-xl">
We&apos;re kinda making a handshake agreement here. This is it:
</p>
</div>
<div className="mx-auto max-w-4xl px-4">
<div>
<div className="grid grid-cols-2 items-end rounded-t-lg border border-slate-200 bg-slate-100 px-6 py-3 text-sm font-bold text-slate-800 sm:text-base md:grid-cols-3">
<div>Self-hosted</div>
<div>Formbricks Cloud</div>
<TooltipProvider delayDuration={50}>
<Tooltip>
<TooltipTrigger asChild>
<div className="hidden md:block">
Formbricks Cloud Pro{" "}
<span className="ml-1 hidden rounded-full bg-slate-700 px-2 text-xs font-normal text-white sm:inline">
Why tho?
</span>
</div>
</TooltipTrigger>
<TooltipContent sideOffset={5} className="max-w-lg font-normal">
You can always self-host to get all features free.
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
{TheDeal.map((feature) => (
<div
key={feature.free}
className="grid grid-cols-2 gap-x-2 border-x border-b border-slate-200 px-6 py-3 text-sm text-slate-900 last:rounded-b-lg md:grid-cols-3">
<div>{feature.os}</div>
<div>{feature.free}</div>
<div className="hidden md:block">{feature.pro}</div>
</div>
))}
</div>
<div className="rounded-lg-12 mt-6 grid-cols-6 rounded-lg bg-slate-100 py-12 sm:grid">
<div className="col-span-1 mr-8 flex items-center justify-center sm:justify-end">
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-white text-3xl">
🤓
</div>
</div>
<div className="col-span-5 px-8 text-left sm:px-0">
<h3 className="mt-4 text-lg font-semibold text-slate-700 sm:mt-0">
Are Formbricks in-app surveys also free?
</h3>
<p className="text-slate-500 sm:pr-16">
Just a heads-up: this deal doesn&apos;t cover Formbricks&apos; in-app surveys. We&apos;ve got
a solid free plan, but we&apos;ve gotta keep some control over pricing to keep things running
long-term.
</p>
</div>
</div>
</div>
</div>
{/* Get started */}
<div className=" mb-40 flex flex-col items-center justify-center text-center">
<div className="py-16 md:py-24">
<h2 className="mt-10 text-2xl font-bold text-slate-100 sm:text-3xl md:text-4xl">
<span className="xl:inline">Get started</span>
</h2>
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base italic text-slate-300 sm:text-lg md:mt-6 md:text-xl">
We&apos;re still setting things up,{" "}
<Link
href="https://formbricks.com/discord"
className="decoration-brand-dark underline underline-offset-2">
join our Discord
</Link>{" "}
to stay in the loop :)
</p>
</div>
<LoadingSpinner />
</div>
{/* FAQ */}
<div id="faq" className="bg-gradient-to-br from-white to-slate-100 px-8 pb-24 lg:px-32 ">
<div className="max-w-6xl">
<div className="py-16 md:py-24 ">
<h2 className="mt-10 text-2xl font-bold text-slate-800 sm:text-3xl md:text-4xl">
<span className="xl:inline">FAQ</span>
</h2>
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-600 sm:text-lg md:mt-6 md:text-xl">
Anything unclear?
</p>
</div>
{FAQ.map((question) => (
<div key={question.question} className="">
<div>
<h3 className="mt-6 text-lg font-bold text-slate-700">{question.question} </h3>
<p className="text-slate-600">{question.answer}</p>
</div>
</div>
))}
</div>
</div>
</LayoutTribe>
);
}
const ValueCard = ({ title, description, emoji }) => {
return (
<div className="rounded-xl bg-slate-800 p-3 text-left">
<div className="mb-4 flex h-24 items-center justify-center rounded-xl border border-slate-600 bg-slate-700 text-6xl">
{emoji}
</div>
<div className="px-2">
<h2 className="text-xl font-bold text-slate-300">
<span className="xl:inline">{title}</span>
</h2>
<p className=" leading-6 text-slate-400">{description}</p>
</div>
</div>
);
};

File diff suppressed because it is too large Load Diff

View File

@@ -97,7 +97,7 @@ const linkSurveys = {
{ name: "Custom Styling", free: true, paid: true, comingSoon: true },
{ name: "Recall Information", free: true, paid: true, comingSoon: true },
{ name: "Collect Payments, Signatures and Appointments", free: true, paid: true, comingSoon: true },
{ name: "Custom URL", free: false, paid: true },
{ name: "Custom URL", free: false, paid: true, comingSoon: true },
{ name: "Remove Formbricks Branding", free: false, paid: true },
],

View File

@@ -15,23 +15,23 @@
"@formbricks/ui": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.4.6"
"storybook": "^7.6.3"
},
"devDependencies": {
"@formbricks/tsconfig": "workspace:*",
"@storybook/addon-essentials": "^7.5.0-alpha.5",
"@storybook/addon-interactions": "^7.5.0-alpha.5",
"@storybook/addon-links": "^7.5.0-alpha.5",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/blocks": "^7.5.0-alpha.5",
"@storybook/react": "^7.5.0-alpha.5",
"@storybook/react-vite": "^7.5.0-alpha.5",
"@storybook/addon-essentials": "^7.6.3",
"@storybook/addon-interactions": "^7.6.3",
"@storybook/addon-links": "^7.6.3",
"@storybook/addon-onboarding": "^1.0.9",
"@storybook/blocks": "^7.6.3",
"@storybook/react": "^7.6.3",
"@storybook/react-vite": "^7.6.3",
"@storybook/testing-library": "^0.2.2",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@vitejs/plugin-react": "^4.1.0",
"esbuild": "^0.19.5",
"tsup": "^7.2.0",
"vite": "^4.4.11"
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@vitejs/plugin-react": "^4.2.1",
"esbuild": "^0.19.8",
"tsup": "^8.0.1",
"vite": "^5.0.6"
}
}

View File

@@ -1,6 +1,19 @@
FROM node:18-alpine AS installer
# Installer stage: Building the application
FROM node:20-alpine AS installer
# Enable corepack and prepare pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install necessary build tools and compilers
RUN apk update && apk add --no-cache g++ cmake make gcc python3 openssl-dev
# Install Supercronic (cron for containers without super user privileges)
RUN apk add --no-cache curl \
&& curl -fsSLo /tmp/supercronic \
"https://github.com/aptible/supercronic/releases/download/v0.2.27/supercronic-linux-amd64" \
&& chmod +x /tmp/supercronic
# Set environment variables
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
@@ -10,46 +23,53 @@ ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET
ARG ENCRYPTION_KEY
ENV ENCRYPTION_KEY=$ENCRYPTION_KEY
# Set the working directory
WORKDIR /app
# Copy the application files
COPY . .
# Create a .env file
RUN touch /app/apps/web/.env
# Install the dependencies
RUN pnpm install
# Build the project
RUN pnpm post-install --filter=web...
RUN pnpm turbo run build --filter=web...
FROM node:18-alpine AS runner
# Runner stage: Setting up the runtime environment
FROM node:20-alpine AS runner
RUN corepack enable && corepack prepare pnpm@latest --activate
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
RUN apk add --no-cache curl \
# && addgroup --system --gid 1001 nodejs \
&& adduser --system --uid 1001 nextjs
WORKDIR /home/nextjs
COPY --from=installer /tmp/supercronic /usr/local/bin/supercronic
COPY --from=installer /app/apps/web/next.config.mjs .
COPY --from=installer /app/apps/web/package.json .
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
COPY --from=installer --chown=nextjs:nodejs /app/packages/database/schema.prisma ./packages/database/schema.prisma
COPY --from=installer --chown=nextjs:nodejs /app/packages/database/migrations ./packages/database/migrations
# Leverage output traces to reduce image size
COPY --from=installer --chown=nextjs:nextjs /app/apps/web/.next/standalone ./
COPY --from=installer --chown=nextjs:nextjs /app/apps/web/.next/static ./apps/web/.next/static
COPY --from=installer --chown=nextjs:nextjs /app/apps/web/public ./apps/web/public
COPY --from=installer --chown=nextjs:nextjs /app/packages/database/schema.prisma ./packages/database/schema.prisma
COPY --from=installer --chown=nextjs:nextjs /app/packages/database/migrations ./packages/database/migrations
COPY --from=installer /app/docker/cronjobs /app/docker/cronjobs
EXPOSE 3000
ENV HOSTNAME "0.0.0.0"
USER nextjs
CMD if [ "$NEXTAUTH_SECRET" != "RANDOM_STRING" ]; then \
pnpm dlx prisma migrate deploy && node apps/web/server.js; \
CMD supercronic -quiet /app/docker/cronjobs & \
if [ "$NEXTAUTH_SECRET" != "RANDOM_STRING" ]; then \
pnpm dlx prisma migrate deploy && \
exec node apps/web/server.js; \
else \
echo "ERROR: Please set a value for NEXTAUTH_SECRET in your docker compose variables!"; \
echo "ERROR: Please set a value for NEXTAUTH_SECRET in your docker compose variables!" >&2; \
exit 1; \
fi
fi

View File

@@ -8,6 +8,7 @@ import { createMembership } from "@formbricks/lib/membership/service";
import { createProduct } from "@formbricks/lib/product/service";
import { createShortUrl } from "@formbricks/lib/shortUrl/service";
import { canUserAccessSurvey, verifyUserRoleAccess } from "@formbricks/lib/survey/auth";
import { surveyCache } from "@formbricks/lib/survey/cache";
import { deleteSurvey, duplicateSurvey, getSurvey } from "@formbricks/lib/survey/service";
import { createTeam, getTeamByEnvironmentId } from "@formbricks/lib/team/service";
import { AuthenticationError, AuthorizationError, ResourceNotFoundError } from "@formbricks/types/errors";
@@ -203,8 +204,14 @@ export async function copyToOtherEnvironmentAction(
singleUse: existingSurvey.singleUse ?? prismaClient.JsonNull,
productOverwrites: existingSurvey.productOverwrites ?? prismaClient.JsonNull,
verifyEmail: existingSurvey.verifyEmail ?? prismaClient.JsonNull,
styling: existingSurvey.styling ?? prismaClient.JsonNull,
},
});
surveyCache.revalidate({
id: newSurvey.id,
environmentId: targetEnvironmentId,
});
return newSurvey;
}

View File

@@ -7,7 +7,7 @@ import WebhookLogo from "@/images/webhook.png";
import ZapierLogo from "@/images/zapier-small.png";
import { Card } from "@formbricks/ui/Card";
import Image from "next/image";
import { getCountOfWebhooksBasedOnSource } from "@formbricks/lib/webhook/service";
import { getWebhookCountBySource } from "@formbricks/lib/webhook/service";
import { getEnvironment } from "@formbricks/lib/environment/service";
import { getIntegrations } from "@formbricks/lib/integration/service";
import { getTeamByEnvironmentId } from "@formbricks/lib/team/service";
@@ -20,13 +20,24 @@ import { ErrorComponent } from "@formbricks/ui/ErrorComponent";
export default async function IntegrationsPage({ params }) {
const environmentId = params.environmentId;
const [environment, integrations, userWebhooks, zapierWebhooks, team, session] = await Promise.all([
const [
environment,
integrations,
team,
session,
userWebhookCount,
zapierWebhookCount,
makeWebhookCount,
n8nwebhookCount,
] = await Promise.all([
getEnvironment(environmentId),
getIntegrations(environmentId),
getCountOfWebhooksBasedOnSource(environmentId, "user"),
getCountOfWebhooksBasedOnSource(environmentId, "zapier"),
getTeamByEnvironmentId(params.environmentId),
getServerSession(authOptions),
getWebhookCountBySource(environmentId, "user"),
getWebhookCountBySource(environmentId, "zapier"),
getWebhookCountBySource(environmentId, "make"),
getWebhookCountBySource(environmentId, "n8n"),
]);
if (!session) {
@@ -67,9 +78,13 @@ export default async function IntegrationsPage({ params }) {
label: "Zapier",
description: "Integrate Formbricks with 5000+ apps via Zapier",
icon: <Image src={ZapierLogo} alt="Zapier Logo" />,
connected: zapierWebhooks > 0,
connected: zapierWebhookCount > 0,
statusText:
zapierWebhooks === 1 ? "1 zap" : zapierWebhooks === 0 ? "Not Connected" : `${zapierWebhooks} zaps`,
zapierWebhookCount === 1
? "1 zap"
: zapierWebhookCount === 0
? "Not Connected"
: `${zapierWebhookCount} zaps`,
},
{
connectHref: `/environments/${params.environmentId}/integrations/webhooks`,
@@ -81,9 +96,13 @@ export default async function IntegrationsPage({ params }) {
label: "Webhooks",
description: "Trigger Webhooks based on actions in your surveys",
icon: <Image src={WebhookLogo} alt="Webhook Logo" />,
connected: userWebhooks > 0,
connected: userWebhookCount > 0,
statusText:
userWebhooks === 1 ? "1 webhook" : userWebhooks === 0 ? "Not Connected" : `${userWebhooks} webhooks`,
userWebhookCount === 1
? "1 webhook"
: userWebhookCount === 0
? "Not Connected"
: `${userWebhookCount} webhooks`,
},
{
connectHref: `/environments/${params.environmentId}/integrations/google-sheets`,
@@ -121,6 +140,13 @@ export default async function IntegrationsPage({ params }) {
label: "n8n",
description: "Integrate Formbricks with 350+ apps via n8n",
icon: <Image src={n8nLogo} alt="n8n Logo" />,
connected: n8nwebhookCount > 0,
statusText:
n8nwebhookCount === 1
? "1 integration"
: n8nwebhookCount === 0
? "Not Connected"
: `${n8nwebhookCount} integrations`,
},
{
docsHref: "https://formbricks.com/docs/integrations/make",
@@ -132,6 +158,13 @@ export default async function IntegrationsPage({ params }) {
label: "Make.com",
description: "Integrate Formbricks with 1000+ apps via Make",
icon: <Image src={MakeLogo} alt="Make Logo" />,
connected: makeWebhookCount > 0,
statusText:
makeWebhookCount === 1
? "1 integration"
: makeWebhookCount === 0
? "Not Connected"
: `${makeWebhookCount} integration`,
},
];

View File

@@ -10,6 +10,7 @@ import { useState } from "react";
import toast from "react-hot-toast";
import AddAPIKeyModal from "./AddApiKeyModal";
import { createApiKeyAction, deleteApiKeyAction } from "../actions";
import { FilesIcon } from "lucide-react";
export default function EditAPIKeys({
environmentTypeId,
@@ -59,6 +60,24 @@ export default function EditAPIKeys({
}
};
const ApiKeyDisplay = ({ apiKey }) => {
const copyToClipboard = () => {
navigator.clipboard.writeText(apiKey);
toast.success("API Key copied to clipboard");
};
if (!apiKey) {
return <span className="italic">secret</span>;
}
return (
<div className="flex items-center">
<span>{apiKey}</span>
<FilesIcon className="mx-2 h-4 w-4 cursor-pointer" onClick={copyToClipboard} />
</div>
);
};
return (
<>
<div className="mb-6 text-right">
@@ -72,10 +91,9 @@ export default function EditAPIKeys({
</Button>
</div>
<div className="rounded-lg border border-slate-200">
<div className="grid h-12 grid-cols-9 content-center rounded-t-lg bg-slate-100 px-6 text-left text-sm font-semibold text-slate-900">
<div className="grid h-12 grid-cols-10 content-center rounded-t-lg bg-slate-100 px-6 text-left text-sm font-semibold text-slate-900">
<div className="col-span-4 sm:col-span-2">Label</div>
<div className="col-span-4 hidden sm:col-span-2 sm:block">API Key</div>
<div className="col-span-4 hidden sm:col-span-2 sm:block">Last used</div>
<div className="col-span-4 hidden sm:col-span-5 sm:block">API Key</div>
<div className="col-span-4 sm:col-span-2">Created at</div>
<div className=""></div>
</div>
@@ -88,14 +106,11 @@ export default function EditAPIKeys({
apiKeysLocal &&
apiKeysLocal.map((apiKey) => (
<div
className="grid h-12 w-full grid-cols-9 content-center rounded-lg px-6 text-left text-sm text-slate-900"
className="grid h-12 w-full grid-cols-10 content-center rounded-lg px-6 text-left text-sm text-slate-900"
key={apiKey.hashedKey}>
<div className="col-span-4 font-semibold sm:col-span-2">{apiKey.label}</div>
<div className="col-span-4 hidden sm:col-span-2 sm:block">
{apiKey.apiKey || <span className="italic">secret</span>}
</div>
<div className="col-span-4 hidden sm:col-span-2 sm:block">
{apiKey.lastUsedAt && timeSince(apiKey.lastUsedAt.toString())}
<div className="col-span-4 hidden sm:col-span-5 sm:block">
<ApiKeyDisplay apiKey={apiKey.apiKey} />
</div>
<div className="col-span-4 sm:col-span-2">{timeSince(apiKey.createdAt.toString())}</div>
<div className="col-span-1 text-center">

View File

@@ -34,7 +34,7 @@ export default async function ProfileSettingsPage({ params }) {
return !isViewer ? (
<div>
<SettingsTitle title="API Keys" />
<EnvironmentNotice environmentId={environment.id} />
<EnvironmentNotice environmentId={environment.id} subPageUrl="/settings/api-keys" />
{environment.type === "development" ? (
<SettingsCard
title="Development Env Keys"

View File

@@ -41,7 +41,7 @@ export default async function SettingsLayout({ children, params }) {
membershipRole={currentUserMembership?.role}
/>
<div className="w-full md:ml-64">
<div className="max-w-4xl px-6 pb-6 pt-14 md:pt-6">
<div className="max-w-4xl px-20 pb-6 pt-14 md:pt-6">
<div>{children}</div>
</div>
</div>

View File

@@ -51,12 +51,12 @@ export const handleFileUpload = async (
const { signature, timestamp, uuid } = signingData;
requestHeaders = {
fileType: file.type,
fileName: file.name,
environmentId: environmentId ?? "",
signature,
timestamp,
uuid,
"X-File-Type": file.type,
"X-File-Name": encodeURIComponent(file.name),
"X-Environment-ID": environmentId ?? "",
"X-Signature": signature,
"X-Timestamp": String(timestamp),
"X-UUID": uuid,
};
}

View File

@@ -10,7 +10,7 @@ export default async function ProfileSettingsPage({ params }) {
<>
<div className="space-y-4">
<SettingsTitle title="Setup Checklist" />
<EnvironmentNotice environmentId={params.environmentId} />
<EnvironmentNotice environmentId={params.environmentId} subPageUrl="/settings/setup" />
<SettingsCard
title="Widget Status"
description="Check if the Formbricks widget is alive and kicking.">

View File

@@ -0,0 +1,112 @@
import Headline from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/Headline";
import { questionTypes } from "@/app/lib/questions";
import { getPersonIdentifier } from "@formbricks/lib/person/util";
import { timeSince } from "@formbricks/lib/time";
import type { TSurveyQuestionSummary } from "@formbricks/types/surveys";
import { TSurveyFileUploadQuestion } from "@formbricks/types/surveys";
import { PersonAvatar } from "@formbricks/ui/Avatars";
import { InboxStackIcon } from "@heroicons/react/24/solid";
import { DownloadIcon, FileIcon } from "lucide-react";
import Link from "next/link";
interface FileUploadSummaryProps {
questionSummary: TSurveyQuestionSummary<TSurveyFileUploadQuestion>;
environmentId: string;
}
export default function FileUploadSummary({ questionSummary, environmentId }: FileUploadSummaryProps) {
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} required={questionSummary.question.required} />
<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="col-span-2 grid">
{response.value === "skipped" && (
<div className="flex w-full flex-col items-center justify-center p-2">
<p className="mt-2 text-sm font-semibold text-slate-500 dark:text-slate-400">skipped</p>
</div>
)}
{Array.isArray(response.value) &&
(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">
<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" />
</div>
</div>
</a>
<div className="flex flex-col items-center justify-center p-2">
<FileIcon className="h-6 text-slate-500" />
<p className="mt-2 text-sm text-slate-500 dark:text-slate-400">
{fileUrl.split("/").pop()}
</p>
</div>
</div>
))
) : (
<div className="flex w-full flex-col items-center justify-center p-2">
<p className="mt-2 text-sm font-semibold text-slate-500 dark:text-slate-400">skipped</p>
</div>
))}
</div>
<div className="px-4 text-slate-500 md:px-6">{timeSince(response.updatedAt.toISOString())}</div>
</div>
);
})}
</div>
</div>
);
}

View File

@@ -1,7 +1,9 @@
import { evaluateCondition } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/evaluateLogic";
import { TResponse } from "@formbricks/types/responses";
import { TSurvey } from "@formbricks/types/surveys";
import { useMemo } from "react";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@formbricks/ui/Tooltip";
import { TimerIcon } from "lucide-react";
import { useCallback, useEffect, useMemo, useState } from "react";
interface SummaryDropOffsProps {
survey: TSurvey;
@@ -10,12 +12,45 @@ interface SummaryDropOffsProps {
}
export default function SummaryDropOffs({ responses, survey, displayCount }: SummaryDropOffsProps) {
const getDropoff = () => {
const initialAvgTtc = useMemo(
() =>
survey.questions.reduce((acc, question) => {
acc[question.id] = 0;
return acc;
}, {}),
[survey.questions]
);
const [avgTtc, setAvgTtc] = useState(initialAvgTtc);
interface DropoffMetricsType {
dropoffCount: number[];
viewsCount: number[];
dropoffPercentage: number[];
}
const [dropoffMetrics, setDropoffMetrics] = useState<DropoffMetricsType>({
dropoffCount: [],
viewsCount: [],
dropoffPercentage: [],
});
const calculateMetrics = useCallback(() => {
let totalTtc = { ...initialAvgTtc };
let responseCounts = { ...initialAvgTtc };
let dropoffArr = new Array(survey.questions.length).fill(0);
let viewsArr = new Array(survey.questions.length).fill(0);
let dropoffPercentageArr = new Array(survey.questions.length).fill(0);
responses.forEach((response) => {
// Calculate total time-to-completion
Object.keys(avgTtc).forEach((questionId) => {
if (response.ttc && response.ttc[questionId]) {
totalTtc[questionId] += response.ttc[questionId];
responseCounts[questionId]++;
}
});
let currQuesIdx = 0;
while (currQuesIdx < survey.questions.length) {
@@ -84,6 +119,13 @@ export default function SummaryDropOffs({ responses, survey, displayCount }: Sum
}
});
// Calculate the average time for each question
Object.keys(totalTtc).forEach((questionId) => {
totalTtc[questionId] =
responseCounts[questionId] > 0 ? totalTtc[questionId] / responseCounts[questionId] : 0;
});
// Calculate drop-off percentages
dropoffPercentageArr[0] = (dropoffArr[0] / displayCount) * 100 || 0;
for (let i = 1; i < survey.questions.length; i++) {
if (viewsArr[i - 1] !== 0) {
@@ -91,28 +133,54 @@ export default function SummaryDropOffs({ responses, survey, displayCount }: Sum
}
}
return [dropoffArr, viewsArr, dropoffPercentageArr];
};
return {
newAvgTtc: totalTtc,
dropoffCount: dropoffArr,
viewsCount: viewsArr,
dropoffPercentage: dropoffPercentageArr,
};
}, [responses, survey.questions, displayCount, initialAvgTtc, avgTtc]);
const [dropoffCount, viewsCount, dropoffPercentage] = useMemo(() => getDropoff(), [responses]);
useEffect(() => {
const { newAvgTtc, dropoffCount, viewsCount, dropoffPercentage } = calculateMetrics();
setAvgTtc(newAvgTtc);
setDropoffMetrics({ dropoffCount, viewsCount, dropoffPercentage });
}, [responses]);
return (
<div className="rounded-lg border border-slate-200 bg-slate-50 shadow-sm">
<div className="rounded-b-lg bg-white ">
<div className="grid h-10 grid-cols-5 items-center border-y border-slate-200 bg-slate-100 text-sm font-bold text-slate-600">
<div className="grid h-10 grid-cols-6 items-center border-y border-slate-200 bg-slate-100 text-sm font-semibold text-slate-600">
<div className="col-span-3 pl-4 md:pl-6">Questions</div>
<div className="pl-4 text-center md:pl-6">Views</div>
<div className="px-4 text-center md:px-6">Drop-off</div>
<div className="flex justify-center">
<TooltipProvider delayDuration={50}>
<Tooltip>
<TooltipTrigger>
<TimerIcon className="h-5 w-5" />
</TooltipTrigger>
<TooltipContent side={"top"}>
<p className="text-center font-normal">Average time to complete each question.</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<div className="px-4 text-center md:px-6">Views</div>
<div className="pr-6 text-center md:pl-6">Drop Offs</div>
</div>
{survey.questions.map((question, i) => (
<div
key={question.id}
className="grid grid-cols-5 items-center border-b border-slate-100 py-2 text-sm text-slate-800 md:text-base">
className="grid grid-cols-6 items-center border-b border-slate-100 py-2 text-sm text-slate-800 md:text-base">
<div className="col-span-3 pl-4 md:pl-6">{question.headline}</div>
<div className="whitespace-pre-wrap pl-6 text-center font-semibold">{viewsCount[i]}</div>
<div className="px-4 text-center md:px-6">
<span className="font-semibold">{dropoffCount[i]} </span>
<span>({Math.round(dropoffPercentage[i])}%)</span>
<div className="whitespace-pre-wrap text-center font-semibold">
{avgTtc[question.id] !== undefined ? (avgTtc[question.id] / 1000).toFixed(2) + "s" : "N/A"}
</div>
<div className="whitespace-pre-wrap text-center font-semibold">
{dropoffMetrics.viewsCount[i]}
</div>
<div className=" pl-6 text-center md:px-6">
<span className="font-semibold">{dropoffMetrics.dropoffCount[i]} </span>
<span>({Math.round(dropoffMetrics.dropoffPercentage[i])}%)</span>
</div>
</div>
))}

View File

@@ -3,7 +3,11 @@ import ConsentSummary from "@/app/(app)/environments/[environmentId]/surveys/[su
import HiddenFieldsSummary from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/HiddenFieldsSummary";
import EmptySpaceFiller from "@formbricks/ui/EmptySpaceFiller";
import { TSurveyQuestionType } from "@formbricks/types/surveys";
import type { TSurveyPictureSelectionQuestion, TSurveyQuestionSummary } from "@formbricks/types/surveys";
import type {
TSurveyFileUploadQuestion,
TSurveyPictureSelectionQuestion,
TSurveyQuestionSummary,
} from "@formbricks/types/surveys";
import { TEnvironment } from "@formbricks/types/environment";
import { TResponse } from "@formbricks/types/responses";
import {
@@ -22,7 +26,8 @@ import MultipleChoiceSummary from "./MultipleChoiceSummary";
import NPSSummary from "./NPSSummary";
import OpenTextSummary from "./OpenTextSummary";
import RatingSummary from "./RatingSummary";
import PictureChoiceSummary from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/PictureChoiceSummary";
import FileUploadSummary from "./FileUploadSummary";
import PictureChoiceSummary from "./PictureChoiceSummary";
interface SummaryListProps {
environment: TEnvironment;
@@ -122,6 +127,15 @@ export default function SummaryList({ environment, survey, responses, responsesP
/>
);
}
if (questionSummary.question.type === TSurveyQuestionType.FileUpload) {
return (
<FileUploadSummary
key={questionSummary.question.id}
questionSummary={questionSummary as TSurveyQuestionSummary<TSurveyFileUploadQuestion>}
environmentId={environment.id}
/>
);
}
if (questionSummary.question.type === TSurveyQuestionType.PictureSelection) {
return (
<PictureChoiceSummary

View File

@@ -1,9 +1,10 @@
import { timeSinceConditionally } from "@formbricks/lib/time";
import { Button } from "@formbricks/ui/Button";
import { TResponse } from "@formbricks/types/responses";
import { TSurvey } from "@formbricks/types/surveys";
import { Button } from "@formbricks/ui/Button";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@formbricks/ui/Tooltip";
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid";
import { useMemo, useState } from "react";
interface SummaryMetadataProps {
responses: TResponse[];
@@ -34,6 +35,21 @@ const StatCard = ({ label, percentage, value, tooltipText }) => (
</TooltipProvider>
);
function formatTime(ttc, totalResponses) {
const seconds = ttc / (1000 * totalResponses);
let formattedValue;
if (seconds >= 60) {
const minutes = Math.floor(seconds / 60);
const remainingSeconds = seconds % 60;
formattedValue = `${minutes}m ${remainingSeconds.toFixed(2)}s`;
} else {
formattedValue = `${seconds.toFixed(2)}s`;
}
return formattedValue;
}
export default function SummaryMetadata({
responses,
survey,
@@ -41,13 +57,28 @@ export default function SummaryMetadata({
setShowDropOffs,
showDropOffs,
}: SummaryMetadataProps) {
const completedResponses = responses.filter((r) => r.finished).length;
const completedResponsesCount = useMemo(() => responses.filter((r) => r.finished).length, [responses]);
const [validTtcResponsesCount, setValidResponsesCount] = useState(0);
const ttc = useMemo(() => {
let validTtcResponsesCountAcc = 0; //stores the count of responses that contains a _total value
const ttc = responses.reduce((acc, response) => {
if (response.ttc?._total) {
validTtcResponsesCountAcc++;
return acc + response.ttc._total;
}
return acc;
}, 0);
setValidResponsesCount(validTtcResponsesCountAcc);
return ttc;
}, [responses]);
const totalResponses = responses.length;
return (
<div className="mb-4">
<div className="flex flex-col-reverse gap-y-2 lg:grid lg:grid-cols-2 lg:gap-x-2">
<div className="grid grid-cols-2 gap-4 md:grid md:grid-cols-4 md:gap-x-2">
<div className="flex flex-col-reverse gap-y-2 lg:grid lg:grid-cols-3 lg:gap-x-2">
<div className="grid grid-cols-2 gap-4 md:grid-cols-5 md:gap-x-2 lg:col-span-2">
<div className="flex flex-col justify-between space-y-2 rounded-lg border border-slate-200 bg-white p-4 shadow-sm">
<p className="text-sm text-slate-600">Displays</p>
<p className="text-2xl font-bold text-slate-800">
@@ -62,16 +93,24 @@ export default function SummaryMetadata({
/>
<StatCard
label="Responses"
percentage={`${Math.round((completedResponses / displayCount) * 100)}%`}
value={responses.length === 0 ? <span>-</span> : completedResponses}
percentage={`${Math.round((completedResponsesCount / displayCount) * 100)}%`}
value={responses.length === 0 ? <span>-</span> : completedResponsesCount}
tooltipText="People who completed the survey."
/>
<StatCard
label="Drop Offs"
percentage={`${Math.round(((totalResponses - completedResponses) / totalResponses) * 100)}%`}
value={responses.length === 0 ? <span>-</span> : totalResponses - completedResponses}
percentage={`${Math.round(((totalResponses - completedResponsesCount) / totalResponses) * 100)}%`}
value={responses.length === 0 ? <span>-</span> : totalResponses - completedResponsesCount}
tooltipText="People who started but not completed the survey."
/>
<StatCard
label="Time to Complete"
percentage={null}
value={
validTtcResponsesCount === 0 ? <span>-</span> : `${formatTime(ttc, validTtcResponsesCount)}`
}
tooltipText="Average time to complete the survey."
/>
</div>
<div className="flex flex-col justify-between gap-2 lg:col-span-1">
<div className="text-right text-xs text-slate-400">

View File

@@ -3,11 +3,11 @@
import { AuthenticationError } from "@formbricks/types/errors";
import { Button } from "@formbricks/ui/Button";
import CodeBlock from "@formbricks/ui/CodeBlock";
import LoadingSpinner from "@formbricks/ui/LoadingSpinner";
import { CodeBracketIcon, DocumentDuplicateIcon, EnvelopeIcon } from "@heroicons/react/24/solid";
import { useEffect, useMemo, useState } from "react";
import toast from "react-hot-toast";
import { getEmailHtmlAction, sendEmailAction } from "../../actions";
import LoadingSpinner from "@formbricks/ui/LoadingSpinner";
interface EmailTabProps {
surveyId: string;

View File

@@ -60,6 +60,7 @@ export default function LinkTab({ surveyUrl, survey, brandColor }: EmailTabProps
autoFocus={false}
isRedirectDisabled={false}
key={survey.id}
onFileUpload={async () => ""}
/>
<Button

View File

@@ -7,7 +7,7 @@ interface AnimatedSurveyBgProps {
}
export default function AnimatedSurveyBg({ localSurvey, handleBgChange }: AnimatedSurveyBgProps) {
const [color, setColor] = useState(localSurvey?.surveyBackground?.bg || "#ffff");
const [color, setColor] = useState(localSurvey?.styling?.background?.bg || "#ffff");
const [hoveredVideo, setHoveredVideo] = useState<number | null>(null);
const animationFiles = {

View File

@@ -9,7 +9,7 @@ interface ColorSurveyBgBgProps {
}
export default function ColorSurveyBg({ localSurvey, handleBgChange, colours }: ColorSurveyBgBgProps) {
const [color, setColor] = useState(localSurvey?.surveyBackground?.bg || "#ffff");
const [color, setColor] = useState(localSurvey?.styling?.background?.bg || "#ffff");
const handleBg = (x: string) => {
setColor(x);

View File

@@ -177,6 +177,28 @@ export default function EditWelcomeCard({
</div>
</div>
</div>
{localSurvey?.type === "link" && (
<div className="mt-6 flex items-center">
<div className="mr-2">
<Switch
id="showResponseCount"
name="showResponseCount"
checked={localSurvey?.welcomeCard?.showResponseCount}
onCheckedChange={() =>
updateSurvey({ showResponseCount: !localSurvey.welcomeCard.showResponseCount })
}
/>
</div>
<div className="flex-column">
<Label htmlFor="showResponseCount" className="">
Show Response Count
</Label>
<div className="text-sm text-gray-500 dark:text-gray-400">
Display number of responses for survey
</div>
</div>
</div>
)}
</form>
</Collapsible.CollapsibleContent>
</Collapsible.Root>

View File

@@ -0,0 +1,234 @@
"use client";
import { useGetBillingInfo } from "@formbricks/lib/team/hooks/useGetBillingInfo";
import { TAllowedFileExtension, ZAllowedFileExtension } from "@formbricks/types/common";
import { TProduct } from "@formbricks/types/product";
import { TSurvey, TSurveyFileUploadQuestion } from "@formbricks/types/surveys";
import { AdvancedOptionToggle } from "@formbricks/ui/AdvancedOptionToggle";
import { Button } from "@formbricks/ui/Button";
import { Input } from "@formbricks/ui/Input";
import { Label } from "@formbricks/ui/Label";
import { PlusIcon, TrashIcon, XCircleIcon } from "@heroicons/react/24/solid";
import { useMemo, useState } from "react";
import { toast } from "react-hot-toast";
interface FileUploadFormProps {
localSurvey: TSurvey;
product?: TProduct;
question: TSurveyFileUploadQuestion;
questionIdx: number;
updateQuestion: (questionIdx: number, updatedAttributes: any) => void;
lastQuestion: boolean;
isInValid: boolean;
}
export default function FileUploadQuestionForm({
question,
questionIdx,
updateQuestion,
isInValid,
product,
}: FileUploadFormProps): JSX.Element {
const [showSubheader, setShowSubheader] = useState(!!question.subheader);
const [extension, setExtension] = useState("");
const {
billingInfo,
error: billingInfoError,
isLoading: billingInfoLoading,
} = useGetBillingInfo(product?.teamId ?? "");
const handleInputChange = (event) => {
setExtension(event.target.value);
};
const addExtension = (event) => {
event.preventDefault();
event.stopPropagation();
let modifiedExtension = extension.trim();
// Remove the dot at the start if it exists
if (modifiedExtension.startsWith(".")) {
modifiedExtension = modifiedExtension.substring(1);
}
if (!modifiedExtension) {
toast.error("Please enter a file extension.");
return;
}
const parsedExtensionResult = ZAllowedFileExtension.safeParse(modifiedExtension);
if (!parsedExtensionResult.success) {
toast.error("This file type is not supported.");
return;
}
if (question.allowedFileExtensions) {
if (!question.allowedFileExtensions.includes(modifiedExtension as TAllowedFileExtension)) {
updateQuestion(questionIdx, {
allowedFileExtensions: [...question.allowedFileExtensions, modifiedExtension],
});
setExtension("");
} else {
toast.error("This extension is already added.");
}
} else {
updateQuestion(questionIdx, { allowedFileExtensions: [modifiedExtension] });
setExtension("");
}
};
const removeExtension = (event, index: number) => {
event.preventDefault();
if (question.allowedFileExtensions) {
const updatedExtensions = [...question?.allowedFileExtensions];
updatedExtensions.splice(index, 1);
updateQuestion(questionIdx, { allowedFileExtensions: updatedExtensions });
}
};
const maxSizeInMBLimit = useMemo(() => {
if (billingInfoError || billingInfoLoading || !billingInfo) {
return 10;
}
if (billingInfo.features.linkSurvey.status === "active") {
// 1GB in MB
return 1024;
}
return 10;
}, [billingInfo, billingInfoError, billingInfoLoading]);
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>
<div className="mb-8 mt-6 space-y-6">
<AdvancedOptionToggle
isChecked={question.allowMultipleFiles}
onToggle={() => updateQuestion(questionIdx, { allowMultipleFiles: !question.allowMultipleFiles })}
htmlId="allowMultipleFile"
title="Allow Multiple Files"
description="Let people upload up to 10 files at the same time."
childBorder
customContainerClass="p-0"></AdvancedOptionToggle>
<AdvancedOptionToggle
isChecked={!!question.maxSizeInMB}
onToggle={(checked) => updateQuestion(questionIdx, { maxSizeInMB: checked ? 10 : undefined })}
htmlId="maxFileSize"
title="Max file size"
description="Limit the maximum file size."
childBorder
customContainerClass="p-0">
<label htmlFor="autoCompleteResponses" className="cursor-pointer bg-slate-50 p-4">
<p className="text-sm font-semibold text-slate-700">
Limit upload file size to
<Input
autoFocus
type="number"
id="fileSizeLimit"
value={question.maxSizeInMB}
onChange={(e) => {
const parsedValue = parseInt(e.target.value, 10);
if (parsedValue > maxSizeInMBLimit) {
toast.error(`Max file size limit is ${maxSizeInMBLimit} MB`);
updateQuestion(questionIdx, { maxSizeInMB: maxSizeInMBLimit });
return;
}
updateQuestion(questionIdx, { maxSizeInMB: parseInt(e.target.value, 10) });
}}
className="ml-2 mr-2 inline w-20 bg-white text-center text-sm"
/>
MB
</p>
</label>
</AdvancedOptionToggle>
<AdvancedOptionToggle
isChecked={!!question.allowedFileExtensions}
onToggle={(checked) =>
updateQuestion(questionIdx, { allowedFileExtensions: checked ? [] : undefined })
}
htmlId="limitFileType"
title="Limit file types"
description="Control which file types can be uploaded."
childBorder
customContainerClass="p-0">
<div className="p-4">
<div className="flex flex-row flex-wrap gap-2">
{question.allowedFileExtensions &&
question.allowedFileExtensions.map((item, index) => (
<div className="mb-2 flex h-8 items-center space-x-2 rounded-full bg-slate-200 px-2">
<p className="text-sm text-slate-800">{item}</p>
<Button
className="inline-flex px-0"
variant="minimal"
onClick={(e) => removeExtension(e, index)}>
<XCircleIcon className="h-4 w-4" />
</Button>
</div>
))}
</div>
<div className="flex items-center">
<Input
autoFocus
className="mr-2 w-20 rounded-md bg-white placeholder:text-sm"
placeholder=".pdf"
value={extension}
onChange={handleInputChange}
type="text"
/>
<Button size="sm" variant="secondary" onClick={(e) => addExtension(e)}>
Allow file type
</Button>
</div>
</div>
</AdvancedOptionToggle>
</div>
</form>
);
}

View File

@@ -162,7 +162,10 @@ const validateHiddenField = (
return "Question already exists";
}
// no key words -- userId & suid & existing question ids
if (["userId", "suid"].includes(field) || existingQuestions.findIndex((q) => q.id === field) !== -1) {
if (
["userId", "source", "suid", "end", "start", "welcomeCard", "hidden"].includes(field) ||
existingQuestions.findIndex((q) => q.id === field) !== -1
) {
return "Question not allowed";
}
// no spaced words --> should be valid query param on url

View File

@@ -16,8 +16,8 @@ export default function ImageSurveyBg({ localSurvey, handleBgChange }: ImageSurv
}
};
const fileUrl = isUrl(localSurvey?.surveyBackground?.bg ?? "")
? localSurvey?.surveyBackground?.bg ?? ""
const fileUrl = isUrl(localSurvey?.styling?.background?.bg ?? "")
? localSurvey?.styling?.background?.bg ?? ""
: "";
return (

View File

@@ -81,6 +81,7 @@ export default function LogicEditor({
cta: ["clicked", "skipped"],
consent: ["skipped", "accepted"],
pictureSelection: ["submitted", "skipped"],
fileUpload: ["uploaded", "notUploaded"],
};
const logicConditions: LogicConditions = {
@@ -99,6 +100,16 @@ 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,
@@ -242,7 +253,7 @@ export default function LogicEditor({
<SelectContent>
{conditions[question.type].map(
(condition) =>
!(question.required && condition === "skipped") && (
!(question.required && (condition === "skipped" || condition === "notUploaded")) && (
<SelectItem
key={condition}
value={condition}

View File

@@ -18,11 +18,13 @@ import {
PresentationChartBarIcon,
QueueListIcon,
StarIcon,
ArrowUpTrayIcon,
PhotoIcon,
} from "@heroicons/react/24/solid";
import * as Collapsible from "@radix-ui/react-collapsible";
import { useState } from "react";
import { Draggable } from "react-beautiful-dnd";
import FileUploadQuestionForm from "./FileUploadQuestionForm";
import CTAQuestionForm from "./CTAQuestionForm";
import ConsentQuestionForm from "./ConsentQuestionForm";
import MultipleChoiceMultiForm from "./MultipleChoiceMultiForm";
@@ -32,9 +34,11 @@ import OpenQuestionForm from "./OpenQuestionForm";
import QuestionDropdown from "./QuestionMenu";
import RatingQuestionForm from "./RatingQuestionForm";
import PictureSelectionForm from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/edit/components/PictureSelectionForm";
import { TProduct } from "@formbricks/types/product";
interface QuestionCardProps {
localSurvey: TSurvey;
product?: TProduct;
questionIdx: number;
moveQuestion: (questionIndex: number, up: boolean) => void;
updateQuestion: (questionIdx: number, updatedAttributes: any) => void;
@@ -74,6 +78,7 @@ export function BackButtonInput({
export default function QuestionCard({
localSurvey,
product,
questionIdx,
moveQuestion,
updateQuestion,
@@ -123,7 +128,9 @@ export default function QuestionCard({
<div>
<div className="inline-flex">
<div className="-ml-0.5 mr-3 h-6 w-6 text-slate-400">
{question.type === TSurveyQuestionType.OpenText ? (
{question.type === TSurveyQuestionType.FileUpload ? (
<ArrowUpTrayIcon />
) : question.type === TSurveyQuestionType.OpenText ? (
<ChatBubbleBottomCenterTextIcon />
) : question.type === TSurveyQuestionType.MultipleChoiceSingle ? (
<QueueListIcon />
@@ -236,10 +243,20 @@ export default function QuestionCard({
lastQuestion={lastQuestion}
isInValid={isInValid}
/>
) : question.type === TSurveyQuestionType.FileUpload ? (
<FileUploadQuestionForm
localSurvey={localSurvey}
product={product}
question={question}
questionIdx={questionIdx}
updateQuestion={updateQuestion}
lastQuestion={lastQuestion}
isInValid={isInValid}
/>
) : null}
<div className="mt-4">
<Collapsible.Root open={openAdvanced} onOpenChange={setOpenAdvanced} className="mt-5">
<Collapsible.CollapsibleTrigger className="flex items-center text-xs text-slate-700">
<Collapsible.CollapsibleTrigger className="flex items-center text-sm text-slate-700">
{openAdvanced ? (
<ChevronDownIcon className="mr-1 h-4 w-3" />
) : (

View File

@@ -202,6 +202,7 @@ export default function QuestionsView({
<QuestionCard
key={internalQuestionIdMap[question.id]}
localSurvey={localSurvey}
product={product}
questionIdx={questionIdx}
moveQuestion={moveQuestion}
updateQuestion={updateQuestion}

View File

@@ -1,7 +1,7 @@
"use client";
import { TPlacement } from "@formbricks/types/common";
import { TSurvey } from "@formbricks/types/surveys";
import { TSurvey, TSurveyBackgroundBgType } from "@formbricks/types/surveys";
import { ColorPicker } from "@formbricks/ui/ColorPicker";
import { Label } from "@formbricks/ui/Label";
import { Switch } from "@formbricks/ui/Switch";
@@ -20,10 +20,10 @@ interface StylingCardProps {
export default function StylingCard({ localSurvey, setLocalSurvey, colours }: StylingCardProps) {
const [open, setOpen] = useState(false);
const { type, productOverwrites, surveyBackground } = localSurvey;
const { type, productOverwrites, styling } = localSurvey;
const { brandColor, clickOutsideClose, darkOverlay, placement, highlightBorderColor } =
productOverwrites ?? {};
const { bg, bgType, brightness } = surveyBackground ?? {};
const { bg, bgType, brightness } = styling?.background ?? {};
const [inputValue, setInputValue] = useState(100);
@@ -38,6 +38,8 @@ export default function StylingCard({ localSurvey, setLocalSurvey, colours }: St
productOverwrites: {
...localSurvey.productOverwrites,
placement: !!placement ? null : "bottomRight",
clickOutsideClose: false,
darkOverlay: false,
},
});
};
@@ -55,10 +57,13 @@ export default function StylingCard({ localSurvey, setLocalSurvey, colours }: St
const toggleBackgroundColor = () => {
setLocalSurvey({
...localSurvey,
surveyBackground: {
...localSurvey.surveyBackground,
bg: !!bg ? undefined : "#ffff",
bgType: !!bg ? undefined : "color",
styling: {
...localSurvey.styling,
background: {
...localSurvey.styling?.background,
bg: !!bg ? undefined : "#ffff",
bgType: !!bg ? undefined : "color",
},
},
});
};
@@ -66,9 +71,12 @@ export default function StylingCard({ localSurvey, setLocalSurvey, colours }: St
const toggleBrightness = () => {
setLocalSurvey({
...localSurvey,
surveyBackground: {
...localSurvey.surveyBackground,
brightness: !!brightness ? undefined : 100,
styling: {
...localSurvey.styling,
background: {
...localSurvey.styling?.background,
brightness: !!brightness ? undefined : 100,
},
},
});
setInputValue(100);
@@ -94,15 +102,18 @@ export default function StylingCard({ localSurvey, setLocalSurvey, colours }: St
});
};
const handleBgChange = (color: string, type: string) => {
const handleBgChange = (color: string, type: TSurveyBackgroundBgType) => {
setInputValue(100);
setLocalSurvey({
...localSurvey,
surveyBackground: {
...localSurvey.surveyBackground,
bg: color,
bgType: type,
brightness: brightness !== undefined ? 100 : brightness,
styling: {
...localSurvey.styling,
background: {
...localSurvey.styling?.background,
bg: color,
bgType: type,
brightness: undefined,
},
},
});
};
@@ -110,9 +121,12 @@ export default function StylingCard({ localSurvey, setLocalSurvey, colours }: St
const handleBrightnessChange = (percent: number) => {
setLocalSurvey({
...localSurvey,
surveyBackground: {
...localSurvey.surveyBackground,
brightness: percent,
styling: {
...(localSurvey.styling || {}),
background: {
...localSurvey.styling?.background,
brightness: percent,
},
},
});
};
@@ -299,9 +313,9 @@ export default function StylingCard({ localSurvey, setLocalSurvey, colours }: St
/>
<Label htmlFor="autoComplete" className="cursor-pointer">
<div className="ml-2">
<h3 className="text-sm font-semibold text-slate-700">Overwrite border highlight</h3>
<h3 className="text-sm font-semibold text-slate-700">Overwrite Highlight Border</h3>
<p className="text-xs font-normal text-slate-500">
Change the border highlight for this survey.
Change the highlight border for this survey.
</p>
</div>
</Label>

View File

@@ -113,6 +113,7 @@ export default function SurveyEditor({
product={product}
environment={environment}
previewType={localSurvey.type === "web" ? "modal" : "fullwidth"}
onFileUpload={async (file) => file.name}
/>
</aside>
</div>

View File

@@ -16,6 +16,7 @@ import toast from "react-hot-toast";
import { validateQuestion } from "./Validation";
import { deleteSurveyAction, updateSurveyAction } from "../actions";
import SurveyStatusDropdown from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/SurveyStatusDropdown";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@formbricks/ui/Tooltip";
interface SurveyMenuBarProps {
localSurvey: TSurvey;
@@ -48,6 +49,7 @@ export default function SurveyMenuBar({
const [isSurveySaving, setIsSurveySaving] = useState(false);
const [isDeleting, setIsDeleting] = useState(false);
const [isSaving, setIsSaving] = useState(false);
const cautionText = "This survey received responses, make changes with caution.";
let faultyQuestions: String[] = [];
@@ -222,6 +224,11 @@ export default function SurveyMenuBar({
const { isDraft, ...rest } = question;
return rest;
}),
attributeFilters: localSurvey.attributeFilters.filter((attributeFilter) => {
if (attributeFilter.attributeClassId && attributeFilter.value) {
return true;
}
}),
};
if (!validateSurvey(localSurvey)) {
@@ -252,6 +259,14 @@ export default function SurveyMenuBar({
}
};
function containsEmptyTriggers() {
return (
localSurvey.type === "web" &&
localSurvey.triggers &&
(localSurvey.triggers[0] === "" || localSurvey.triggers.length === 0)
);
}
return (
<>
{environment?.type === "development" && (
@@ -282,11 +297,20 @@ export default function SurveyMenuBar({
/>
</div>
{responseCount > 0 && (
<div className="mx-auto flex items-center rounded-full border border-amber-200 bg-amber-100 p-2 text-amber-700 shadow-sm">
<ExclamationTriangleIcon className=" h-5 w-5 text-amber-400" />
<p className=" pl-1 text-xs lg:text-sm">
This survey received responses, make changes with caution.
</p>
<div className="ju flex items-center rounded-lg border border-amber-200 bg-amber-100 p-2 text-amber-700 shadow-sm lg:mx-auto">
<TooltipProvider delayDuration={50}>
<Tooltip>
<TooltipTrigger>
<ExclamationTriangleIcon className=" h-5 w-5 text-amber-400" />
</TooltipTrigger>
<TooltipContent side={"top"} className="lg:hidden">
<p className="py-2 text-center text-xs text-slate-500 dark:text-slate-400 ">
{cautionText}
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<p className=" hidden pl-1 text-xs md:text-sm lg:block">{cautionText}</p>
</div>
)}
<div className="mt-3 flex sm:ml-4 sm:mt-0">
@@ -298,7 +322,7 @@ export default function SurveyMenuBar({
/>
</div>
<Button
disabled={isSurveyPublishing}
disabled={isSurveyPublishing || containsEmptyTriggers()}
variant={localSurvey.status === "draft" ? "secondary" : "darkCTA"}
className="mr-3"
loading={isSurveySaving}
@@ -318,11 +342,7 @@ export default function SurveyMenuBar({
)}
{localSurvey.status === "draft" && !audiencePrompt && (
<Button
disabled={
localSurvey.type === "web" &&
localSurvey.triggers &&
(localSurvey.triggers[0] === "" || localSurvey.triggers.length === 0 || isSurveySaving)
}
disabled={isSurveySaving || containsEmptyTriggers()}
variant="darkCTA"
loading={isSurveyPublishing}
onClick={async () => {

View File

@@ -40,10 +40,10 @@ export default function UpdateQuestionId({
updateQuestion(questionIdx, { id: prevValue });
toast.error("ID should not be empty.");
return;
} else if (currentValue === "source" || currentValue === "suID" || currentValue === "userId") {
} else if (["userId", "source", "suid", "end", "start", "welcomeCard", "hidden"].includes(currentValue)) {
setCurrentValue(prevValue);
updateQuestion(questionIdx, { id: prevValue });
toast.error("ID cannot used reserved words.");
toast.error("Reserved words cannot be used as question ID");
return;
} else {
setIsInputInvalid(false);

View File

@@ -56,7 +56,7 @@ export default function Modal({
ref={modalRef}
style={highlightBorderColorStyle}
className={cn(
"pointer-events-auto absolute h-fit max-h-[90%] w-full max-w-sm overflow-y-auto rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5 transition-all duration-500 ease-in-out ",
"pointer-events-auto absolute h-auto max-h-[90%] w-full max-w-sm overflow-y-auto rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5 transition-all duration-500 ease-in-out ",
previewMode === "desktop" ? getPlacementStyle(placement) : "max-w-full ",
slidingAnimationClass
)}>

Some files were not shown because too many files have changed in this diff Show More