Introducing the new Formbricks (#210)
### New Formbricks Release: Complete Rewrite, New Features & Enhanced UI 🚀 We're thrilled to announce the release of the new Formbricks, a complete overhaul of our codebase, packed with powerful features and an improved user experience. #### What's New: 1. **Survey Builder**: Design and customize your in-product micro-surveys with our intuitive survey builder. 2. **Trigger Micro-Surveys**: Set up micro-surveys to appear at specific points within your app, allowing you to gather feedback when it matters most. 3. **JavaScript SDK**: Our new JavaScript SDK makes integration a breeze - just embed it once and you're ready to go. 4. **No-Code Events**: Set up events and triggers without writing a single line of code, making it accessible for everyone on your team. 5. **Revamped UI**: Enjoy an entirely new user interface that enhances usability and provides a smooth, delightful experience. This release marks a major step forward for Formbricks, enabling you to better understand your users and build an outstanding product experience. Please update your Formbricks integration to take advantage of these exciting new features, and let us know in the Discord if you have any questions or feedback! Happy surveying! 🎉
@@ -17,8 +17,11 @@ NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
||||
|
||||
DATABASE_URL='postgresql://postgres:postgres@localhost:5432/postgres?schema=public'
|
||||
|
||||
# For Docker Compose Production Setup use this Database URL:
|
||||
# DATABASE_URL='postgresql://postgres:postgres@postgres:5432/formbricks?schema=public'
|
||||
# Uncomment to enable a dedicated connection pool for Prisma using Prisma Data Proxy
|
||||
# Cold boots will be faster and you'll be able to scale your DB independently of your app.
|
||||
# @see https://www.prisma.io/docs/data-platform/data-proxy/use-data-proxy
|
||||
# PRISMA_GENERATE_DATAPROXY=true
|
||||
PRISMA_GENERATE_DATAPROXY=
|
||||
|
||||
################
|
||||
# Mail Setup #
|
||||
|
||||
679
LICENSE
@@ -1,25 +1,670 @@
|
||||
Copyright (c) 2022 Matthias Nannt, Johannes Dancker
|
||||
Copyright (c) 2023 Matthias Nannt, Johannes Dancker
|
||||
|
||||
Portions of this software are licensed as follows:
|
||||
|
||||
- All content that resides under the "packages/ee/" directory of this repository, if that directory exists, is licensed under the license defined in "packages/ee/LICENSE".
|
||||
- All content that resides under the "packages/js/" directory of this repository, if that directory exists, is licensed under the "MIT" license as defined in "packages/js/LICENSE".
|
||||
- All third party components incorporated into the Formbricks Software are licensed under the original license provided by the owner of the applicable component.
|
||||
- Content outside of the above mentioned directories or restrictions above is available under the "MIT" license as defined below.
|
||||
- Content outside of the above mentioned directories or restrictions above is available under the "AGPLv3" license as defined below.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
30
README.md
@@ -25,35 +25,13 @@
|
||||
|
||||
## About Formbricks
|
||||
|
||||

|
||||
<img width="1527" alt="formbricks-sneak" src="https://user-images.githubusercontent.com/675065/227726212-6ebf930e-6a20-4ffa-b966-56cd41bdf363.png">
|
||||
|
||||
Formbricks productizes best practices for qualitative in-app user discovery. Feedback Management, Onboarding-Segmentation, Product-Market-Fit surveys and much more...
|
||||
Formbricks productizes best practices for qualitative in-app user discovery. Use micro-surveys to target the right users at the right time without making surveys annoying.
|
||||
|
||||
### Mission: Base your decisions on qualitative data.
|
||||
|
||||
Formbricks helps you apply best practices from data-driven work and experience management to make better business decisions. Use Formbricks to collect and manage feedback from your users; run a product market fit survey to know which audience to focus on and whether your value proposition is being recognized. Formrbicks guides you through the process and assists with data analysis and deriving decisions.
|
||||
|
||||
## Our Toolbox
|
||||
|
||||
Use Formbricks in your product on different touchpoints.
|
||||
|
||||
### Feedback Survey
|
||||
|
||||
Embed our feedback survey widget to give your users a channel to get in touch easily. Encourage them to report bugs and feature ideas while they are using their product and start a conversation from there.
|
||||
|
||||

|
||||
|
||||
### Product Market Fit survey (coming soon)
|
||||
|
||||
Formbrick's Product-Market-Fit survey based on the Superhuman-approach helps fast growing early-stage companies measuring their path towards an established company.
|
||||
|
||||
Pre-Segmentation: Integrations for Segment, PostHog, Amplitude allow creating cohorts on usage data.
|
||||
|
||||
Forms: Open source UI components to ask the right questions natively embedded for best possible conversion.
|
||||
|
||||
Engine: Formbricks issues the survey, nudges and follows up on Data Analysis: Formbricks offers specific dashboards for each best practice to enhance understanding of the data to build conviction for product decisions.
|
||||
|
||||
Actions: Formbricks facilitates acting on the insights e.g. by in-app interview prompts, templates to follow up on negative feedback, etc.
|
||||
Formbricks helps you apply best practices from data-driven work and experience management to make better business decisions. Use Formbricks to collect and manage insights from your users; run a product market fit survey to know which audience to focus on and whether your value proposition is being recognized.
|
||||
|
||||
### Built With
|
||||
|
||||
@@ -65,7 +43,7 @@ Actions: Formbricks facilitates acting on the insights e.g. by in-app interview
|
||||
|
||||
## Cloud vs. self-hosted
|
||||
|
||||
Formbricks is available Open-Source under a permissive MIT license. You can host Formbricks on your own servers without a subscription. Check out our [docs](https://formbricks.com/docs/formbricks-hq/self-hosting) to see how to self-host Formbricks.
|
||||
Formbricks is available Open-Source under AGPLv3 license. You can host Formbricks on your own servers without a subscription. Check out our [docs](https://formbricks.com/docs/formbricks-hq/self-hosting) to see how to self-host Formbricks.
|
||||
We will soon offer a cloud version of Formbricks which saves you the hassle of maintaining your own servers. We will update this Readme once the cloud version is available.
|
||||
|
||||
(In the future we may develop additional features that aren't in the free Open-Source version)
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
NEXT_PUBLIC_FORMBRICKS_URL=http://localhost:3000
|
||||
NEXT_PUBLIC_FORMBRICKS_FEEDBACK_FORM_ID=
|
||||
NEXT_PUBLIC_FORMBRICKS_FEEDBACK_CUSTOM_FORM_ID=
|
||||
NEXT_PUBLIC_FORMBRICKS_PMF_FORM_ID=
|
||||
NEXT_PUBLIC_FORMBRICKS_API_HOST=http://localhost:3000
|
||||
NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=YOUR_ENVIRONMENT_ID
|
||||
10
apps/demo/.gitignore
vendored
@@ -23,12 +23,14 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# @formbricks/examples
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [0e946c7]
|
||||
- @formbricks/react@0.0.2
|
||||
@@ -1,30 +1,38 @@
|
||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
||||
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
|
||||
|
||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
|
||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
|
||||
|
||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn/foundations/about-nextjs) - an interactive Next.js tutorial.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
|
||||
@@ -1,582 +0,0 @@
|
||||
import { Dialog, Menu, Transition } from "@headlessui/react";
|
||||
import {
|
||||
BanknotesIcon,
|
||||
BuildingOfficeIcon,
|
||||
CheckCircleIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronRightIcon,
|
||||
MagnifyingGlassIcon,
|
||||
} from "@heroicons/react/20/solid";
|
||||
import {
|
||||
Bars3CenterLeftIcon,
|
||||
BellIcon,
|
||||
ClockIcon,
|
||||
CogIcon,
|
||||
CreditCardIcon,
|
||||
DocumentChartBarIcon,
|
||||
HomeIcon,
|
||||
QuestionMarkCircleIcon,
|
||||
ScaleIcon,
|
||||
ShieldCheckIcon,
|
||||
UserGroupIcon,
|
||||
XMarkIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { Fragment, useState } from "react";
|
||||
|
||||
const navigation = [
|
||||
{ name: "Home", href: "#", icon: HomeIcon, current: true },
|
||||
{ name: "History", href: "#", icon: ClockIcon, current: false },
|
||||
{ name: "Balances", href: "#", icon: ScaleIcon, current: false },
|
||||
{ name: "Cards", href: "#", icon: CreditCardIcon, current: false },
|
||||
{ name: "Recipients", href: "#", icon: UserGroupIcon, current: false },
|
||||
{ name: "Reports", href: "#", icon: DocumentChartBarIcon, current: false },
|
||||
];
|
||||
const secondaryNavigation = [
|
||||
{ name: "Settings", href: "#", icon: CogIcon },
|
||||
{ name: "Help", href: "#", icon: QuestionMarkCircleIcon },
|
||||
{ name: "Privacy", href: "#", icon: ShieldCheckIcon },
|
||||
];
|
||||
const cards = [
|
||||
{ name: "Account balance", href: "#", icon: ScaleIcon, amount: "$30,659.45" },
|
||||
// More items...
|
||||
];
|
||||
const transactions = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Payment to Molly Sanders",
|
||||
href: "#",
|
||||
amount: "$20,000",
|
||||
currency: "USD",
|
||||
status: "success",
|
||||
date: "July 11, 2020",
|
||||
datetime: "2020-07-11",
|
||||
},
|
||||
// More transactions...
|
||||
];
|
||||
const statusStyles = {
|
||||
success: "bg-green-100 text-green-800",
|
||||
processing: "bg-yellow-100 text-yellow-800",
|
||||
failed: "bg-slate-100 text-slate-800",
|
||||
};
|
||||
|
||||
function classNames(...classes) {
|
||||
return classes.filter(Boolean).join(" ");
|
||||
}
|
||||
|
||||
interface AppPageProps {
|
||||
setShowFeedback?: (show: boolean) => void;
|
||||
onClickFeedback?: (args: any) => void;
|
||||
}
|
||||
|
||||
export default function AppPage({ onClickFeedback = () => {} }: AppPageProps) {
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="min-h-full">
|
||||
<Transition.Root show={sidebarOpen} as={Fragment}>
|
||||
<Dialog as="div" className="relative z-40 lg:hidden" onClose={setSidebarOpen}>
|
||||
<Transition.Child
|
||||
as={Fragment}
|
||||
enter="transition-opacity ease-linear duration-300"
|
||||
enterFrom="opacity-0"
|
||||
enterTo="opacity-100"
|
||||
leave="transition-opacity ease-linear duration-300"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0">
|
||||
<div className="fixed inset-0 bg-slate-600 bg-opacity-75" />
|
||||
</Transition.Child>
|
||||
|
||||
<div className="fixed inset-0 z-40 flex">
|
||||
<Transition.Child
|
||||
as={Fragment}
|
||||
enter="transition ease-in-out duration-300 transform"
|
||||
enterFrom="-translate-x-full"
|
||||
enterTo="translate-x-0"
|
||||
leave="transition ease-in-out duration-300 transform"
|
||||
leaveFrom="translate-x-0"
|
||||
leaveTo="-translate-x-full">
|
||||
<Dialog.Panel className="relative flex w-full max-w-xs flex-1 flex-col bg-cyan-700 pt-5 pb-4">
|
||||
<Transition.Child
|
||||
as={Fragment}
|
||||
enter="ease-in-out duration-300"
|
||||
enterFrom="opacity-0"
|
||||
enterTo="opacity-100"
|
||||
leave="ease-in-out duration-300"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0">
|
||||
<div className="absolute top-0 right-0 -mr-12 pt-2">
|
||||
<button
|
||||
type="button"
|
||||
className="ml-1 flex h-10 w-10 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white"
|
||||
onClick={() => setSidebarOpen(false)}>
|
||||
<span className="sr-only">Close sidebar</span>
|
||||
<XMarkIcon className="h-6 w-6 text-white" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</Transition.Child>
|
||||
<div className="flex flex-shrink-0 items-center px-4">
|
||||
<img
|
||||
className="h-8 w-auto"
|
||||
src="https://tailwindui.com/img/logos/mark.svg?color=cyan&shade=300"
|
||||
alt="Easywire logo"
|
||||
/>
|
||||
</div>
|
||||
<nav
|
||||
className="mt-5 h-full flex-shrink-0 divide-y divide-cyan-800 overflow-y-auto"
|
||||
aria-label="Sidebar">
|
||||
<div className="space-y-1 px-2">
|
||||
{navigation.map((item) => (
|
||||
<a
|
||||
key={item.name}
|
||||
href={item.href}
|
||||
className={classNames(
|
||||
item.current
|
||||
? "bg-cyan-800 text-white"
|
||||
: "text-cyan-100 hover:bg-cyan-600 hover:text-white",
|
||||
"group flex items-center rounded-md px-2 py-2 text-base font-medium"
|
||||
)}
|
||||
aria-current={item.current ? "page" : undefined}>
|
||||
<item.icon
|
||||
className="mr-4 h-6 w-6 flex-shrink-0 text-cyan-200"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{item.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
<div className="mt-6 pt-6">
|
||||
<div className="space-y-1 px-2">
|
||||
{secondaryNavigation.map((item) => (
|
||||
<a
|
||||
key={item.name}
|
||||
href={item.href}
|
||||
className="group flex items-center rounded-md px-2 py-2 text-base font-medium text-cyan-100 hover:bg-cyan-600 hover:text-white">
|
||||
<item.icon className="mr-4 h-6 w-6 text-cyan-200" aria-hidden="true" />
|
||||
{item.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</Dialog.Panel>
|
||||
</Transition.Child>
|
||||
<div className="w-14 flex-shrink-0" aria-hidden="true">
|
||||
{/* Dummy element to force sidebar to shrink to fit close icon */}
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
</Transition.Root>
|
||||
|
||||
{/* Static sidebar for desktop */}
|
||||
<div className="hidden lg:fixed lg:inset-y-0 lg:flex lg:w-64 lg:flex-col">
|
||||
{/* Sidebar component, swap this element with another sidebar if you like */}
|
||||
<div className="flex flex-grow flex-col overflow-y-auto bg-cyan-700 pt-5 pb-4">
|
||||
<div className="flex flex-shrink-0 items-center px-4">
|
||||
<img
|
||||
className="h-8 w-auto"
|
||||
src="https://tailwindui.com/img/logos/mark.svg?color=cyan&shade=300"
|
||||
alt="Easywire logo"
|
||||
/>
|
||||
</div>
|
||||
<nav
|
||||
className="mt-5 flex flex-1 flex-col divide-y divide-cyan-800 overflow-y-auto"
|
||||
aria-label="Sidebar">
|
||||
<div className="space-y-1 px-2">
|
||||
{navigation.map((item) => (
|
||||
<a
|
||||
key={item.name}
|
||||
href={item.href}
|
||||
className={classNames(
|
||||
item.current
|
||||
? "bg-cyan-800 text-white"
|
||||
: "text-cyan-100 hover:bg-cyan-600 hover:text-white",
|
||||
"group flex items-center rounded-md px-2 py-2 text-sm font-medium leading-6"
|
||||
)}
|
||||
aria-current={item.current ? "page" : undefined}>
|
||||
<item.icon className="mr-4 h-6 w-6 flex-shrink-0 text-cyan-200" aria-hidden="true" />
|
||||
{item.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
<div className="mt-6 pt-6">
|
||||
<div className="space-y-1 px-2">
|
||||
{secondaryNavigation.map((item) => (
|
||||
<a
|
||||
key={item.name}
|
||||
href={item.href}
|
||||
className="group flex items-center rounded-md px-2 py-2 text-sm font-medium leading-6 text-cyan-100 hover:bg-cyan-600 hover:text-white">
|
||||
<item.icon className="mr-4 h-6 w-6 text-cyan-200" aria-hidden="true" />
|
||||
{item.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-1 flex-col lg:pl-64">
|
||||
<div className="flex h-16 flex-shrink-0 border-b border-slate-200 bg-white lg:border-none">
|
||||
<button
|
||||
type="button"
|
||||
className="border-r border-slate-200 px-4 text-slate-400 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-cyan-500 lg:hidden"
|
||||
onClick={() => setSidebarOpen(true)}>
|
||||
<span className="sr-only">Open sidebar</span>
|
||||
<Bars3CenterLeftIcon className="h-6 w-6" aria-hidden="true" />
|
||||
</button>
|
||||
{/* Search bar */}
|
||||
<div className="flex flex-1 justify-between px-4 sm:px-6 lg:mx-auto lg:max-w-6xl lg:px-8">
|
||||
<div className="flex flex-1">
|
||||
<form className="flex w-full md:ml-0" action="#" method="GET">
|
||||
<label htmlFor="search-field" className="sr-only">
|
||||
Search
|
||||
</label>
|
||||
<div className="relative w-full text-slate-400 focus-within:text-slate-600">
|
||||
<div
|
||||
className="pointer-events-none absolute inset-y-0 left-0 flex items-center"
|
||||
aria-hidden="true">
|
||||
<MagnifyingGlassIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</div>
|
||||
<input
|
||||
id="search-field"
|
||||
name="search-field"
|
||||
className="block h-full w-full border-transparent py-2 pl-8 pr-3 text-slate-900 placeholder-slate-500 focus:border-transparent focus:outline-none focus:ring-0 sm:text-sm"
|
||||
placeholder="Search transactions"
|
||||
type="search"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div className="ml-4 flex items-center md:ml-6">
|
||||
<button
|
||||
onClick={onClickFeedback}
|
||||
className="mr-2 flex max-w-xs items-center rounded-full bg-white text-sm font-medium text-slate-700 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2 lg:rounded-md lg:p-2 lg:hover:bg-slate-50">
|
||||
Feedback
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="rounded-full bg-white p-1 text-slate-400 hover:text-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2">
|
||||
<span className="sr-only">View notifications</span>
|
||||
<BellIcon className="h-6 w-6" aria-hidden="true" />
|
||||
</button>
|
||||
{/* Profile dropdown */}
|
||||
<Menu as="div" className="relative ml-3">
|
||||
<div>
|
||||
<Menu.Button className="flex max-w-xs items-center rounded-full bg-white text-sm focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2 lg:rounded-md lg:p-2 lg:hover:bg-slate-50">
|
||||
<img
|
||||
className="h-8 w-8 rounded-full"
|
||||
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
|
||||
alt=""
|
||||
/>
|
||||
<span className="ml-3 hidden text-sm font-medium text-slate-700 lg:block">
|
||||
<span className="sr-only">Open user menu for </span>Emilia Birch
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="ml-1 hidden h-5 w-5 flex-shrink-0 text-slate-400 lg:block"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Menu.Button>
|
||||
</div>
|
||||
<Transition
|
||||
as={Fragment}
|
||||
enter="transition ease-out duration-100"
|
||||
enterFrom="transform opacity-0 scale-95"
|
||||
enterTo="transform opacity-100 scale-100"
|
||||
leave="transition ease-in duration-75"
|
||||
leaveFrom="transform opacity-100 scale-100"
|
||||
leaveTo="transform opacity-0 scale-95">
|
||||
<Menu.Items className="absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
|
||||
<Menu.Item>
|
||||
{({ active }) => (
|
||||
<a
|
||||
href="#"
|
||||
className={classNames(
|
||||
active ? "bg-slate-100" : "",
|
||||
"block px-4 py-2 text-sm text-slate-700"
|
||||
)}>
|
||||
Your Profile
|
||||
</a>
|
||||
)}
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
{({ active }) => (
|
||||
<a
|
||||
href="#"
|
||||
className={classNames(
|
||||
active ? "bg-slate-100" : "",
|
||||
"block px-4 py-2 text-sm text-slate-700"
|
||||
)}>
|
||||
Settings
|
||||
</a>
|
||||
)}
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
{({ active }) => (
|
||||
<a
|
||||
href="#"
|
||||
className={classNames(
|
||||
active ? "bg-slate-100" : "",
|
||||
"block px-4 py-2 text-sm text-slate-700"
|
||||
)}>
|
||||
Logout
|
||||
</a>
|
||||
)}
|
||||
</Menu.Item>
|
||||
</Menu.Items>
|
||||
</Transition>
|
||||
</Menu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<main className="flex-1 pb-8">
|
||||
{/* Page header */}
|
||||
<div className="bg-white shadow">
|
||||
<div className="px-4 sm:px-6 lg:mx-auto lg:max-w-6xl lg:px-8">
|
||||
<div className="py-6 md:flex md:items-center md:justify-between lg:border-t lg:border-slate-200">
|
||||
<div className="min-w-0 flex-1">
|
||||
{/* Profile */}
|
||||
<div className="flex items-center">
|
||||
<img
|
||||
className="hidden h-16 w-16 rounded-full sm:block"
|
||||
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.6&w=256&h=256&q=80"
|
||||
alt=""
|
||||
/>
|
||||
<div>
|
||||
<div className="flex items-center">
|
||||
<img
|
||||
className="h-16 w-16 rounded-full sm:hidden"
|
||||
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.6&w=256&h=256&q=80"
|
||||
alt=""
|
||||
/>
|
||||
<h1 className="ml-3 text-2xl font-bold leading-7 text-slate-900 sm:truncate sm:leading-9">
|
||||
Good morning, Emilia Birch
|
||||
</h1>
|
||||
</div>
|
||||
<dl className="mt-6 flex flex-col sm:ml-3 sm:mt-1 sm:flex-row sm:flex-wrap">
|
||||
<dt className="sr-only">Company</dt>
|
||||
<dd className="flex items-center text-sm font-medium capitalize text-slate-500 sm:mr-6">
|
||||
<BuildingOfficeIcon
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
Duke street studio
|
||||
</dd>
|
||||
<dt className="sr-only">Account status</dt>
|
||||
<dd className="mt-3 flex items-center text-sm font-medium capitalize text-slate-500 sm:mr-6 sm:mt-0">
|
||||
<CheckCircleIcon
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-green-400"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
Verified account
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-6 flex space-x-3 md:mt-0 md:ml-4">
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2">
|
||||
Add money
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex items-center rounded-md border border-transparent bg-cyan-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-cyan-700 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2">
|
||||
Send money
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-8">
|
||||
<div className="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">
|
||||
<h2 className="text-lg font-medium leading-6 text-slate-900">Overview</h2>
|
||||
<div className="mt-2 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{/* Card */}
|
||||
{cards.map((card) => (
|
||||
<div key={card.name} className="overflow-hidden rounded-lg bg-white shadow">
|
||||
<div className="p-5">
|
||||
<div className="flex items-center">
|
||||
<div className="flex-shrink-0">
|
||||
<card.icon className="h-6 w-6 text-slate-400" aria-hidden="true" />
|
||||
</div>
|
||||
<div className="ml-5 w-0 flex-1">
|
||||
<dl>
|
||||
<dt className="truncate text-sm font-medium text-slate-500">{card.name}</dt>
|
||||
<dd>
|
||||
<div className="text-lg font-medium text-slate-900">{card.amount}</div>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-slate-50 px-5 py-3">
|
||||
<div className="text-sm">
|
||||
<a href={card.href} className="font-medium text-cyan-700 hover:text-cyan-900">
|
||||
View all
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 className="mx-auto mt-8 max-w-6xl px-4 text-lg font-medium leading-6 text-slate-900 sm:px-6 lg:px-8">
|
||||
Recent activity
|
||||
</h2>
|
||||
|
||||
{/* Activity list (smallest breakpoint only) */}
|
||||
<div className="shadow sm:hidden">
|
||||
<ul role="list" className="mt-2 divide-y divide-slate-200 overflow-hidden shadow sm:hidden">
|
||||
{transactions.map((transaction) => (
|
||||
<li key={transaction.id}>
|
||||
<a href={transaction.href} className="block bg-white px-4 py-4 hover:bg-slate-50">
|
||||
<span className="flex items-center space-x-4">
|
||||
<span className="flex flex-1 space-x-2 truncate">
|
||||
<BanknotesIcon
|
||||
className="h-5 w-5 flex-shrink-0 text-slate-400"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="flex flex-col truncate text-sm text-slate-500">
|
||||
<span className="truncate">{transaction.name}</span>
|
||||
<span>
|
||||
<span className="font-medium text-slate-900">{transaction.amount}</span>{" "}
|
||||
{transaction.currency}
|
||||
</span>
|
||||
<time dateTime={transaction.datetime}>{transaction.date}</time>
|
||||
</span>
|
||||
</span>
|
||||
<ChevronRightIcon
|
||||
className="h-5 w-5 flex-shrink-0 text-slate-400"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<nav
|
||||
className="flex items-center justify-between border-t border-slate-200 bg-white px-4 py-3"
|
||||
aria-label="Pagination">
|
||||
<div className="flex flex-1 justify-between">
|
||||
<a
|
||||
href="#"
|
||||
className="relative inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:text-slate-500">
|
||||
Previous
|
||||
</a>
|
||||
<a
|
||||
href="#"
|
||||
className="relative ml-3 inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:text-slate-500">
|
||||
Next
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
{/* Activity table (small breakpoint and up) */}
|
||||
<div className="hidden sm:block">
|
||||
<div className="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="mt-2 flex flex-col">
|
||||
<div className="min-w-full overflow-hidden overflow-x-auto align-middle shadow sm:rounded-lg">
|
||||
<table className="min-w-full divide-y divide-slate-200">
|
||||
<thead>
|
||||
<tr>
|
||||
<th
|
||||
className="bg-slate-50 px-6 py-3 text-left text-sm font-semibold text-slate-900"
|
||||
scope="col">
|
||||
Transaction
|
||||
</th>
|
||||
<th
|
||||
className="bg-slate-50 px-6 py-3 text-right text-sm font-semibold text-slate-900"
|
||||
scope="col">
|
||||
Amount
|
||||
</th>
|
||||
<th
|
||||
className="hidden bg-slate-50 px-6 py-3 text-left text-sm font-semibold text-slate-900 md:block"
|
||||
scope="col">
|
||||
Status
|
||||
</th>
|
||||
<th
|
||||
className="bg-slate-50 px-6 py-3 text-right text-sm font-semibold text-slate-900"
|
||||
scope="col">
|
||||
Date
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-slate-200 bg-white">
|
||||
{transactions.map((transaction) => (
|
||||
<tr key={transaction.id} className="bg-white">
|
||||
<td className="w-full max-w-0 whitespace-nowrap px-6 py-4 text-sm text-slate-900">
|
||||
<div className="flex">
|
||||
<a
|
||||
href={transaction.href}
|
||||
className="group inline-flex space-x-2 truncate text-sm">
|
||||
<BanknotesIcon
|
||||
className="h-5 w-5 flex-shrink-0 text-slate-400 group-hover:text-slate-500"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<p className="truncate text-slate-500 group-hover:text-slate-900">
|
||||
{transaction.name}
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-6 py-4 text-right text-sm text-slate-500">
|
||||
<span className="font-medium text-slate-900">{transaction.amount}</span>
|
||||
{transaction.currency}
|
||||
</td>
|
||||
<td className="hidden whitespace-nowrap px-6 py-4 text-sm text-slate-500 md:block">
|
||||
<span
|
||||
className={classNames(
|
||||
statusStyles[transaction.status],
|
||||
"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium capitalize"
|
||||
)}>
|
||||
{transaction.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-6 py-4 text-right text-sm text-slate-500">
|
||||
<time dateTime={transaction.datetime}>{transaction.date}</time>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{/* Pagination */}
|
||||
<nav
|
||||
className="flex items-center justify-between border-t border-slate-200 bg-white px-4 py-3 sm:px-6"
|
||||
aria-label="Pagination">
|
||||
<div className="hidden sm:block">
|
||||
<p className="text-sm text-slate-700">
|
||||
Showing <span className="font-medium">1</span> to{" "}
|
||||
<span className="font-medium">10</span> of <span className="font-medium">20</span>{" "}
|
||||
results
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-1 justify-between sm:justify-end">
|
||||
<a
|
||||
href="#"
|
||||
className="relative inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">
|
||||
Previous
|
||||
</a>
|
||||
<a
|
||||
href="#"
|
||||
className="relative ml-3 inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">
|
||||
Next
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
13
apps/demo/components/LayoutApp.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import Sidebar from "./Sidebar";
|
||||
|
||||
export default function LayoutApp({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<div className="min-h-full">
|
||||
{/* Static sidebar for desktop */}
|
||||
<div className="hidden lg:fixed lg:inset-y-0 lg:flex lg:w-64 lg:flex-col">
|
||||
<Sidebar />
|
||||
</div>
|
||||
<div className="flex flex-1 flex-col lg:pl-64">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
formbricksPmf: any;
|
||||
}
|
||||
}
|
||||
|
||||
export default function PmfButton() {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const feedbackRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
window.formbricksPmf = {
|
||||
...window.formbricksPmf,
|
||||
config: {
|
||||
formbricksUrl: process.env.NEXT_PUBLIC_FORMBRICKS_URL,
|
||||
formId: process.env.NEXT_PUBLIC_FORMBRICKS_PMF_FORM_ID,
|
||||
containerId: "formbricks",
|
||||
contact: {
|
||||
name: "Jonathan",
|
||||
position: "Co-Founder",
|
||||
imgUrl: "https://avatars.githubusercontent.com/u/41432658?v=4",
|
||||
},
|
||||
customer: {
|
||||
id: "test@crowd.dev",
|
||||
name: "Test Customer",
|
||||
email: "test@crowd.dev",
|
||||
},
|
||||
style: {
|
||||
brandColor: "#e94f2e",
|
||||
headerBGColor: "#F9FAFB",
|
||||
boxBGColor: "#ffffff",
|
||||
textColor: "#140505",
|
||||
buttonHoverColor: "#F9FAFB",
|
||||
},
|
||||
},
|
||||
};
|
||||
require("@formbricks/pmf");
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// Close the feedback form if the user clicks outside of it
|
||||
function handleClickOutside(event: any) {
|
||||
if (feedbackRef.current && !feedbackRef.current.contains(event.target)) {
|
||||
if (isOpen) setIsOpen(false);
|
||||
}
|
||||
}
|
||||
// Bind the event listener
|
||||
document.addEventListener("mousedown", handleClickOutside);
|
||||
return () => {
|
||||
// Unbind the event listener on clean up
|
||||
document.removeEventListener("mousedown", handleClickOutside);
|
||||
};
|
||||
}, [feedbackRef, isOpen]);
|
||||
// xs:translate-x-[21.2rem] translate-y-[21rem]
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
"xs:flex-row xs:right-0 xs:top-1/2 xs:w-[24rem] xs:-translate-y-1/2 fixed bottom-0 z-50 h-fit w-full transition-all duration-500 ease-in-out",
|
||||
isOpen ? "xs:-translate-x-0 translate-y-0" : "xs:translate-x-full xs:-mr-1 translate-y-full"
|
||||
)}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
ref={feedbackRef}>
|
||||
<button
|
||||
className="xs:-rotate-90 xs:top-1/2 xs:-left-[5.8rem] xs:-translate-y-1/2 xs:-translate-x-0 xs:w-32 xs:p-4 absolute left-1/2 w-28 -translate-x-1/2 -translate-y-full rounded-t bg-cyan-600 p-3 font-medium text-white"
|
||||
onClick={() => {
|
||||
if (!isOpen) {
|
||||
if (window) {
|
||||
window.formbricksPmf.init();
|
||||
window.formbricksPmf.reset();
|
||||
}
|
||||
}
|
||||
setIsOpen(!isOpen);
|
||||
}}>
|
||||
{isOpen ? "Close" : "Hey 👋"}
|
||||
</button>
|
||||
<div
|
||||
className="xs:px-2 h-full overflow-hidden rounded-l-lg bg-[#f8fafc] shadow-lg"
|
||||
id="formbricks"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
65
apps/demo/components/Sidebar.tsx
Normal file
@@ -0,0 +1,65 @@
|
||||
import { classNames } from "@/lib/utils";
|
||||
import {
|
||||
ClockIcon,
|
||||
CogIcon,
|
||||
CreditCardIcon,
|
||||
DocumentChartBarIcon,
|
||||
HomeIcon,
|
||||
QuestionMarkCircleIcon,
|
||||
ScaleIcon,
|
||||
ShieldCheckIcon,
|
||||
UserGroupIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
|
||||
const navigation = [
|
||||
{ name: "Home", href: "#", icon: HomeIcon, current: true },
|
||||
{ name: "History", href: "#", icon: ClockIcon, current: false },
|
||||
{ name: "Balances", href: "#", icon: ScaleIcon, current: false },
|
||||
{ name: "Cards", href: "#", icon: CreditCardIcon, current: false },
|
||||
{ name: "Recipients", href: "#", icon: UserGroupIcon, current: false },
|
||||
{ name: "Reports", href: "#", icon: DocumentChartBarIcon, current: false },
|
||||
];
|
||||
const secondaryNavigation = [
|
||||
{ name: "Settings", href: "#", icon: CogIcon },
|
||||
{ name: "Help", href: "#", icon: QuestionMarkCircleIcon },
|
||||
{ name: "Privacy", href: "#", icon: ShieldCheckIcon },
|
||||
];
|
||||
|
||||
export default function Sidebar({}) {
|
||||
return (
|
||||
<div className="flex flex-grow flex-col overflow-y-auto bg-cyan-700 pt-5 pb-4">
|
||||
<nav
|
||||
className="mt-5 flex flex-1 flex-col divide-y divide-cyan-800 overflow-y-auto"
|
||||
aria-label="Sidebar">
|
||||
<div className="space-y-1 px-2">
|
||||
{navigation.map((item) => (
|
||||
<a
|
||||
key={item.name}
|
||||
href={item.href}
|
||||
className={classNames(
|
||||
item.current ? "bg-cyan-800 text-white" : "text-cyan-100 hover:bg-cyan-600 hover:text-white",
|
||||
"group flex items-center rounded-md px-2 py-2 text-sm font-medium leading-6"
|
||||
)}
|
||||
aria-current={item.current ? "page" : undefined}>
|
||||
<item.icon className="mr-4 h-6 w-6 flex-shrink-0 text-cyan-200" aria-hidden="true" />
|
||||
{item.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
<div className="mt-6 pt-6">
|
||||
<div className="space-y-1 px-2">
|
||||
{secondaryNavigation.map((item) => (
|
||||
<a
|
||||
key={item.name}
|
||||
href={item.href}
|
||||
className="group flex items-center rounded-md px-2 py-2 text-sm font-medium leading-6 text-cyan-100 hover:bg-cyan-600 hover:text-white">
|
||||
<item.icon className="mr-4 h-6 w-6 text-cyan-200" aria-hidden="true" />
|
||||
{item.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
import { Form, Nps, sendToHq, Submit, Textarea } from "@formbricks/react";
|
||||
import { Transition } from "@headlessui/react";
|
||||
import { XMarkIcon } from "@heroicons/react/20/solid";
|
||||
import { Fragment } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
|
||||
export default function SimpleFeedbackModal({ show, setShow }) {
|
||||
return (
|
||||
<>
|
||||
{/* Global notification live region, render this permanently at the end of the document */}
|
||||
<div
|
||||
aria-live="assertive"
|
||||
className="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-end sm:p-6">
|
||||
<div className="flex w-full flex-col items-center space-y-4 sm:items-end">
|
||||
{/* Notification panel, dynamically insert this into the live region when it needs to be displayed */}
|
||||
<Transition
|
||||
show={show}
|
||||
as={Fragment}
|
||||
enter="transform ease-out duration-300 transition"
|
||||
enterFrom="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
|
||||
enterTo="translate-y-0 opacity-100 sm:translate-x-0"
|
||||
leave="transition ease-in duration-100"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0">
|
||||
<div className="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5">
|
||||
<div className="p-4">
|
||||
<div className="flex items-start">
|
||||
<div className="ml-3 w-0 flex-1 pt-0.5">
|
||||
<p className="text-sm font-medium text-slate-900">We would like to hear your feedback</p>
|
||||
<div className="mt-3 flex space-x-7">
|
||||
<Form
|
||||
hqUrl={process.env.NEXT_PUBLIC_FORMBRICKS_URL}
|
||||
formId={process.env.NEXT_PUBLIC_FORMBRICKS_FEEDBACK_CUSTOM_FORM_ID}
|
||||
customerId="johannes@formbricks.com"
|
||||
onSubmit={({ submission, schema, event }) => {
|
||||
sendToHq({ submission, schema, event });
|
||||
toast("Thanks a lot for your feedback");
|
||||
setShow(false);
|
||||
}}>
|
||||
<Nps
|
||||
name="nps"
|
||||
label="How likely are you to recommend Formbricks to a friend or colleague?"
|
||||
/>
|
||||
<Textarea name="feedback" label="Your feedback" cols={30} />
|
||||
<Submit label="Submit" />
|
||||
</Form>
|
||||
</div>
|
||||
<hr className="my-2" />
|
||||
<p className="mt-1 text-sm text-slate-500">
|
||||
If you have a specific issue, please contact support directly at email us or visit our
|
||||
docs
|
||||
</p>
|
||||
</div>
|
||||
<div className="ml-4 flex flex-shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex rounded-md bg-white text-slate-400 hover:text-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
|
||||
onClick={() => {
|
||||
setShow(false);
|
||||
}}>
|
||||
<span className="sr-only">Close</span>
|
||||
<XMarkIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
export function BugIconGray(props: any) {
|
||||
return (
|
||||
<svg width={64} height={64} viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M41.8076 2.52761C35.3754 1.69132 28.6257 1.69132 22.1936 2.52762C21.5618 2.60977 20.9542 2.77808 20.3836 3.01442L19.719 3.2897C19.1485 3.52604 18.5998 3.83664 18.095 4.2253C12.9554 8.18209 8.18258 12.9549 4.2258 18.0945C3.83714 18.5993 3.52656 19.148 3.29021 19.7185L3.01494 20.3831C2.7786 20.9537 2.61029 21.5612 2.52813 22.1931C1.6918 28.6251 1.6918 35.3749 2.52813 41.8071C2.61029 42.4388 2.7786 43.0464 3.01494 43.6169L3.29021 44.2815C3.52654 44.8521 3.83714 45.4007 4.2258 45.9056C8.18258 51.0451 12.9555 55.818 18.095 59.7748C18.5998 60.1635 19.1485 60.474 19.719 60.7104L20.3836 60.9856C20.9542 61.222 21.5617 61.3903 22.1936 61.4724C28.6257 62.3088 35.3754 62.3088 41.8076 61.4724C42.4393 61.3903 43.0469 61.222 43.6174 60.9856L44.2821 60.7104C44.8526 60.474 45.4013 60.1635 45.9061 59.7748C51.0457 55.818 55.8185 51.0451 59.7753 45.9056C60.164 45.4008 60.4745 44.8521 60.7109 44.2815L60.9861 43.6169C61.2225 43.0464 61.3908 42.4388 61.4729 41.8071C62.3093 35.3749 62.3093 28.6251 61.4729 22.1931C61.3908 21.5612 61.2225 20.9537 60.9861 20.3831L60.7109 19.7185C60.4745 19.148 60.164 18.5993 59.7753 18.0945C55.8185 12.9549 51.0457 8.1821 45.9061 4.22532C45.4013 3.83665 44.8526 3.52605 44.2821 3.2897L43.6174 3.01442C43.0469 2.77808 42.4393 2.60977 41.8076 2.52761Z"
|
||||
fill="#CBD5E1"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M26.8524 20.1828C26.73 18.4544 27.505 16.7543 29.1856 16.3319C29.9498 16.1397 30.888 16 32.0001 16C33.1122 16 34.0505 16.1397 34.8148 16.3319C36.4952 16.7543 37.2702 18.4544 37.148 20.1828C36.8936 23.7773 36.4081 30.0209 35.8832 33.5205C35.7102 34.6735 35.0161 35.6653 33.8665 35.8592C33.3749 35.942 32.7597 36 32.0001 36C31.2406 36 30.6253 35.942 30.1337 35.8592C28.9842 35.6653 28.29 34.6735 28.117 33.5205C27.5921 30.0209 27.1066 23.7773 26.8524 20.1828ZM32.0001 49.3333C34.5774 49.3333 36.6668 47.244 36.6668 44.6667C36.6668 42.0893 34.5774 40 32.0001 40C29.4228 40 27.3334 42.0893 27.3334 44.6667C27.3334 47.244 29.4228 49.3333 32.0001 49.3333Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
export function ComplimentIconGray(props: any) {
|
||||
return (
|
||||
<svg width={64} height={64} viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
||||
<path
|
||||
d="M32 2C22.1289 2 15.2111 2.31819 10.8579 2.62168C6.50353 2.92524 3.04197 6.21155 2.6552 10.6119C2.32291 14.3924 2 20.0988 2 28C2 35.9012 2.32291 41.6076 2.6552 45.3881C3.04197 49.7884 6.50353 53.0748 10.8579 53.3783C12.7458 53.51 15.1159 53.6443 18 53.7543V59.7677C18 62.6156 21.3404 64.1519 23.5027 62.2985L33.1861 53.9984C42.4277 53.9743 48.9653 53.6695 53.1421 53.3783C57.4964 53.0748 60.958 49.7884 61.3448 45.3881C61.6771 41.6076 62 35.9012 62 28C62 20.0988 61.6771 14.3924 61.3448 10.6119C60.958 6.21155 57.4964 2.92524 53.1421 2.62168C48.7889 2.31819 41.8711 2 32 2Z"
|
||||
fill="#CBD5E1"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M25.3335 18.6667C25.3335 17.1939 24.1396 16 22.6668 16C21.1941 16 20.0001 17.1939 20.0001 18.6667V21.3333C20.0001 22.8061 21.1941 24 22.6668 24C24.1396 24 25.3335 22.8061 25.3335 21.3333V18.6667ZM41.3335 16C42.8063 16 44.0001 17.1939 44.0001 18.6667V21.3333C44.0001 22.8061 42.8063 24 41.3335 24C39.8608 24 38.6668 22.8061 38.6668 21.3333V18.6667C38.6668 17.1939 39.8608 16 41.3335 16ZM23.5629 33.2036C22.7549 31.9723 21.1017 31.6292 19.8704 32.4372C18.6391 33.2452 18.296 34.8984 19.104 36.1297C22.0319 40.5913 27.1375 42.6667 32.0001 42.6667C36.8628 42.6667 41.9684 40.5913 44.8963 36.1297C45.7044 34.8984 45.3612 33.2452 44.1299 32.4372C42.8987 31.6292 41.2455 31.9723 40.4373 33.2036C38.6987 35.8532 35.4708 37.3333 32.0001 37.3333C28.5295 37.3333 25.3017 35.8532 23.5629 33.2036Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
import { Transition } from "@headlessui/react";
|
||||
import { ChevronDownIcon, XMarkIcon } from "@heroicons/react/20/solid";
|
||||
import clsx from "clsx";
|
||||
import Link from "next/link";
|
||||
import { Fragment, useState } from "react";
|
||||
import { BugIconGray } from "./BugIconGray";
|
||||
import { ComplimentIconGray } from "./ComplimentIconGray";
|
||||
import { IdeaIconGray } from "./IdeaIconGray";
|
||||
|
||||
const navigation = [
|
||||
{ id: "idea", name: "I have an idea", icon: IdeaIconGray },
|
||||
{ id: "compliment", name: "I like something", icon: ComplimentIconGray },
|
||||
{ id: "bug", name: "Something’s broken", icon: BugIconGray },
|
||||
];
|
||||
|
||||
interface FeedbackModalProps {
|
||||
show: boolean;
|
||||
setShow: (show: boolean) => void;
|
||||
formId: string;
|
||||
customer?: any;
|
||||
}
|
||||
|
||||
export default function FeedbackModal({ show, setShow, formId, customer }: FeedbackModalProps) {
|
||||
const [feedbackType, setFeedbackType] = useState<any>();
|
||||
const [feedbackSent, setFeedbackSent] = useState(false);
|
||||
return (
|
||||
<>
|
||||
{/* Global notification live region, render this permanently at the end of the document */}
|
||||
<div
|
||||
aria-live="assertive"
|
||||
className="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-end sm:p-6">
|
||||
<div className="flex w-full flex-col items-center space-y-4 sm:items-end">
|
||||
{/* Notification panel, dynamically insert this into the live region when it needs to be displayed */}
|
||||
<Transition
|
||||
show={show}
|
||||
as={Fragment}
|
||||
enter="transform ease-out duration-300 transition"
|
||||
enterFrom="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
|
||||
enterTo="translate-y-0 opacity-100 sm:translate-x-0"
|
||||
leave="transition ease-in duration-100"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0">
|
||||
<div className="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5">
|
||||
{/* Header */}
|
||||
<div className="relative bg-slate-900 p-4 ">
|
||||
<div className="absolute right-4 top-4 ml-4 flex flex-shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex rounded-md bg-white text-slate-400 hover:text-slate-500 focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2"
|
||||
onClick={() => {
|
||||
setShow(false);
|
||||
setTimeout(() => {
|
||||
setFeedbackType(undefined);
|
||||
setFeedbackSent(false);
|
||||
}, 200);
|
||||
}}>
|
||||
<span className="sr-only">Close</span>
|
||||
<XMarkIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex items-start">
|
||||
<div className="w-full text-center text-lg text-white">We ♥ your feedback</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{typeof feedbackType === "undefined" ? (
|
||||
<div className="p-4">
|
||||
<div className="w-full text-center text-xs text-slate-700">What's on your mind?</div>
|
||||
<nav className="mt-3 space-y-1" aria-label="Sidebar">
|
||||
{navigation.map((item) => (
|
||||
<button
|
||||
key={item.name}
|
||||
onClick={() => {
|
||||
setFeedbackType(item);
|
||||
}}
|
||||
className="group flex w-full items-center rounded-md px-3 py-2 text-sm font-medium text-slate-600 hover:bg-slate-50 hover:text-slate-900">
|
||||
<item.icon
|
||||
className={clsx(
|
||||
"text-slate-400 group-hover:text-slate-500",
|
||||
"-ml-1 mr-3 h-7 w-7 flex-shrink-0"
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="truncate">{item.name}</span>
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
) : feedbackSent === false ? (
|
||||
<>
|
||||
<button
|
||||
key={feedbackType.name}
|
||||
onClick={() => setFeedbackType(undefined)}
|
||||
className="group flex w-full items-center justify-center bg-slate-200 px-3 py-2 text-sm font-medium text-slate-600 hover:bg-slate-100 hover:text-slate-900">
|
||||
<feedbackType.icon
|
||||
className="-ml-1 mr-3 h-6 w-6 flex-shrink-0 text-slate-400 group-hover:text-slate-500"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="truncate">{feedbackType.name}</span>
|
||||
<ChevronDownIcon className="h-6 w-6 text-slate-500" />
|
||||
</button>
|
||||
|
||||
<div className="p-4">
|
||||
<div className="group block flex-shrink-0">
|
||||
<div className="flex items-center">
|
||||
<div>
|
||||
<img
|
||||
className="inline-block h-9 w-9 rounded-full"
|
||||
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<p className="text-sm font-medium text-slate-700 group-hover:text-slate-900">
|
||||
Thanks for sharing this!
|
||||
</p>
|
||||
<p className="text-xs font-medium text-slate-500 group-hover:text-slate-700">
|
||||
Tom Cook, CEO
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form
|
||||
onSubmit={(e: any) => {
|
||||
const body = {
|
||||
data: {
|
||||
feedbackType: feedbackType.id,
|
||||
message: e.target.message.value,
|
||||
pageUrl: window.location.href,
|
||||
},
|
||||
};
|
||||
if (customer) {
|
||||
body["customer"] = customer;
|
||||
}
|
||||
e.preventDefault();
|
||||
fetch(`http://localhost:3000/api/capture/forms/${formId}/submissions`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
e.target.reset();
|
||||
setFeedbackSent(true);
|
||||
}}>
|
||||
<textarea
|
||||
rows={5}
|
||||
name="message"
|
||||
id="message"
|
||||
className="mt-5 block w-full rounded-md border-slate-300 shadow-sm focus:border-slate-500 focus:ring-slate-500 sm:text-sm"
|
||||
placeholder={
|
||||
feedbackType.id === "idea"
|
||||
? "I would love to..."
|
||||
: feedbackType.id === "compliment"
|
||||
? "I want to say Thank you for..."
|
||||
: "I tried to do this but it is not working because..."
|
||||
}
|
||||
/>
|
||||
<div className="mt-2 flex w-full justify-end">
|
||||
<button
|
||||
type="submit"
|
||||
className="inline-flex items-center rounded-md border border-transparent bg-slate-800 px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-slate-900 focus:outline-none focus:ring-2 focus:ring-slate-700 focus:ring-offset-2">
|
||||
Send
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="p-4">
|
||||
<div className="w-full text-center font-medium text-slate-600">
|
||||
{feedbackType.id === "bug"
|
||||
? "Feedback received."
|
||||
: feedbackType.id === "compliment"
|
||||
? "Thanks for sharing!"
|
||||
: "Brainstorming in progress..."}
|
||||
</div>
|
||||
<div className="mt-2 w-full text-center text-sm text-slate-500">
|
||||
{feedbackType.id === "bug"
|
||||
? "We are doing our best to fix this asap. Thank you!"
|
||||
: feedbackType.id === "compliment"
|
||||
? "We're working hard on this. Your warm words make it fun!"
|
||||
: "We'll look into it and get back to you. Thank you!"}
|
||||
</div>
|
||||
<div className="group mt-6 block flex-shrink-0">
|
||||
<div className="flex items-center justify-center">
|
||||
<div>
|
||||
<img
|
||||
className="inline-block h-9 w-9 rounded-full"
|
||||
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<p className="text-xs font-medium text-slate-700 group-hover:text-slate-900">
|
||||
Tom Cook
|
||||
</p>
|
||||
<p className="text-xs font-medium text-slate-500 group-hover:text-slate-700">CEO</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-5 mb-2">
|
||||
<div className="text-center text-xs text-slate-600">More to share?</div>
|
||||
<div className="text-center text-xs font-bold text-slate-600">
|
||||
<Link href="https://slack.com" target="_blank">
|
||||
Join Slack
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
export function IdeaIconGray(props: any) {
|
||||
return (
|
||||
<svg width={64} height={64} viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
||||
<path
|
||||
d="M32 15.334C41.9411 15.334 50 23.3929 50 33.334C50 43.2751 41.9411 51.334 32 51.334C22.0589 51.334 14 43.2751 14 33.334C14 23.3929 22.0589 15.334 32 15.334Z"
|
||||
fill="#CBD5E1"
|
||||
/>
|
||||
<path
|
||||
d="M32 45.8086C28.6549 45.8086 26.3454 45.8337 24.8176 45.8613C23.7016 45.8813 22.5061 46.1823 21.5369 46.9145C20.5084 47.6914 19.8413 48.8858 19.8413 50.3483C19.8413 50.8806 19.9301 51.3985 20.1118 51.8865C20.1136 51.8943 20.1166 51.9109 20.1198 51.9369C20.1274 51.9982 20.1321 52.0849 20.1289 52.1933C20.1225 52.4189 20.0856 52.6439 20.0453 52.7919C19.914 53.2755 19.8413 53.8145 19.8413 54.4118C19.8413 55.0091 19.914 55.5482 20.0453 56.0318C20.3776 57.2553 21.2394 57.9963 22.0906 58.391C22.8926 58.7627 23.7534 58.8699 24.4353 58.8861C24.6425 58.8909 24.8722 58.8958 25.1265 58.9006C25.654 60.3158 26.8869 61.4911 28.5544 61.7407C29.4361 61.8727 30.6344 61.9991 32 61.9991C33.3656 61.9991 34.5638 61.8727 35.4456 61.7407C37.113 61.4911 38.346 60.3158 38.8734 58.9006C39.1277 58.8958 39.3574 58.8909 39.5646 58.8861C40.2465 58.8699 41.1073 58.7627 41.9093 58.391C42.7605 57.9963 43.6224 57.2553 43.9546 56.0318C44.086 55.5482 44.1588 55.0091 44.1588 54.4118C44.1588 53.8145 44.086 53.2755 43.9546 52.7919C43.9145 52.6439 43.8774 52.4189 43.871 52.1933C43.868 52.0849 43.8726 51.9982 43.8801 51.9369C43.8833 51.9109 43.8865 51.8943 43.8881 51.8865C44.07 51.3985 44.1588 50.8806 44.1588 50.3483C44.1588 48.8858 43.4916 47.6914 42.463 46.9145C41.4938 46.1823 40.2984 45.8813 39.1825 45.8613C37.6546 45.8337 35.345 45.8086 32 45.8086Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M0.666504 31.9993C0.666504 30.1584 2.15889 28.666 3.99984 28.666H7.99984C9.84078 28.666 11.3332 30.1584 11.3332 31.9993C11.3332 33.8403 9.84078 35.3327 7.99984 35.3327H3.99984C2.15889 35.3327 0.666504 33.8403 0.666504 31.9993Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M52.6665 31.9993C52.6665 30.1584 54.1589 28.666 55.9998 28.666H59.9998C61.8408 28.666 63.3332 30.1584 63.3332 31.9993C63.3332 33.8403 61.8408 35.3327 59.9998 35.3327H55.9998C54.1589 35.3327 52.6665 33.8403 52.6665 31.9993Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M31.9998 0.666016C33.8408 0.666016 35.3332 2.1584 35.3332 3.99935V7.99935C35.3332 9.84029 33.8408 11.3327 31.9998 11.3327C30.1589 11.3327 28.6665 9.84029 28.6665 7.99935V3.99935C28.6665 2.1584 30.1589 0.666016 31.9998 0.666016Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M9.8435 9.8435C11.1452 8.54175 13.2558 8.54175 14.5576 9.8435L17.386 12.6719C18.6877 13.9736 18.6877 16.0842 17.386 17.386C16.0843 18.6878 13.9737 18.6878 12.6719 17.386L9.8435 14.5575C8.54175 13.2558 8.54175 11.1452 9.8435 9.8435Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M54.1565 9.8435C52.8548 8.54175 50.7443 8.54175 49.4424 9.8435L46.614 12.6719C45.3123 13.9736 45.3123 16.0843 46.614 17.386C47.9157 18.6877 50.0263 18.6877 51.3281 17.386L54.1565 14.5575C55.4583 13.2558 55.4583 11.1452 54.1565 9.8435Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M33.3335 26C36.6472 26 39.3335 28.6863 39.3335 32C39.3335 33.1045 40.229 34 41.3335 34C42.438 34 43.3335 33.1045 43.3335 32C43.3335 26.4772 38.8563 22 33.3335 22C32.229 22 31.3335 22.8955 31.3335 24C31.3335 25.1045 32.229 26 33.3335 26Z"
|
||||
fill="#475569"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
3
apps/demo/lib/utils.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function classNames(...classes: any) {
|
||||
return classes.filter(Boolean).join(" ");
|
||||
}
|
||||
@@ -1,6 +1,27 @@
|
||||
module.exports = {
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
experimental: {
|
||||
transpilePackages: ["ui"],
|
||||
async redirects() {
|
||||
return [
|
||||
{
|
||||
source: "/",
|
||||
destination: "/signin",
|
||||
permanent: false,
|
||||
},
|
||||
];
|
||||
},
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: "https",
|
||||
hostname: "tailwindui.com",
|
||||
},
|
||||
{
|
||||
protocol: "https",
|
||||
hostname: "images.unsplash.com",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@formbricks/demo",
|
||||
"version": "1.0.1",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3002",
|
||||
@@ -9,29 +9,22 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@formbricks/charts": "workspace:*",
|
||||
"@formbricks/feedback": "workspace:*",
|
||||
"@formbricks/pmf": "workspace:*",
|
||||
"@formbricks/react": "workspace:*",
|
||||
"@formbricks/ui": "workspace:*",
|
||||
"@formbricks/js": "workspace:*",
|
||||
"@heroicons/react": "^2.0.16",
|
||||
"@tailwindcss/forms": "^0.5.3",
|
||||
"clsx": "^1.2.1",
|
||||
"next": "13.2.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-toastify": "^9.1.1"
|
||||
"@types/node": "18.15.10",
|
||||
"@types/react": "18.0.29",
|
||||
"@types/react-dom": "18.0.11",
|
||||
"eslint": "8.36.0",
|
||||
"eslint-config-formbricks": "workspace:*",
|
||||
"next": "13.2.4",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"typescript": "5.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@formbricks/tailwind-config": "workspace:*",
|
||||
"@formbricks/tsconfig": "workspace:*",
|
||||
"@types/node": "^18.14.1",
|
||||
"@types/react": "^18.0.28",
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"eslint-config-formbricks": "workspace:*",
|
||||
"@tailwindcss/forms": "^0.5.3",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"typescript": "^4.9.5"
|
||||
"tailwindcss": "^3.2.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,31 @@
|
||||
import "@formbricks/react/styles.css";
|
||||
import "react-toastify/dist/ReactToastify.css";
|
||||
import type { AppProps } from "next/app";
|
||||
import formbricks from "@formbricks/js";
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import "../styles/globals.css";
|
||||
|
||||
import type { AppProps } from "next/app";
|
||||
import { ToastContainer } from "react-toastify";
|
||||
|
||||
export default function MyApp({ Component, pageProps }: AppProps) {
|
||||
return (
|
||||
<>
|
||||
<Component {...pageProps} />
|
||||
<ToastContainer />
|
||||
</>
|
||||
);
|
||||
if (typeof window !== "undefined") {
|
||||
if (process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID && process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST) {
|
||||
formbricks.init({
|
||||
environmentId: process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID,
|
||||
apiHost: process.env.NEXT_PUBLIC_FORMBRICKS_API_HOST,
|
||||
logLevel: "debug",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default function App({ Component, pageProps }: AppProps) {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
// Connect next.js router to Formbricks
|
||||
const handleRouteChange = formbricks?.registerRouteChange;
|
||||
router.events.on("routeChangeComplete", handleRouteChange);
|
||||
|
||||
return () => {
|
||||
router.events.off("routeChangeComplete", handleRouteChange);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
|
||||
13
apps/demo/pages/_document.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Html, Head, Main, NextScript } from "next/document";
|
||||
|
||||
export default function Document() {
|
||||
return (
|
||||
<Html lang="en" className="h-full bg-gray-50">
|
||||
<Head />
|
||||
<body className="h-full">
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
export default async function handle(req: NextApiRequest, res: NextApiResponse) {
|
||||
// POST/capture/forms/[formId]/submissions
|
||||
// Create a new form submission
|
||||
// Required fields in body: -
|
||||
// Optional fields in body: customerId, data
|
||||
if (req.method === "GET") {
|
||||
const submissionRequest = await fetch(
|
||||
`http://localhost:3000/api/teams/clbdr4dp10001yztzqa9xdvyy/forms/clbgle5og0001yzltkc6iah7i/submissions`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json", "X-API-Key": "83c7e175fe2155d9f02998396c23ee18" },
|
||||
}
|
||||
);
|
||||
const submissions = await submissionRequest.json();
|
||||
res.json(submissions);
|
||||
}
|
||||
|
||||
// Unknown HTTP Method
|
||||
else {
|
||||
throw new Error(`The HTTP ${req.method} method is not supported by this route.`);
|
||||
}
|
||||
}
|
||||
346
apps/demo/pages/app/index.tsx
Normal file
@@ -0,0 +1,346 @@
|
||||
import LayoutApp from "@/components/LayoutApp";
|
||||
import { classNames } from "@/lib/utils";
|
||||
import { Bars3CenterLeftIcon, BellIcon, ScaleIcon } from "@heroicons/react/24/outline";
|
||||
import {
|
||||
BanknotesIcon,
|
||||
BuildingOfficeIcon,
|
||||
CheckCircleIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronRightIcon,
|
||||
MagnifyingGlassIcon,
|
||||
} from "@heroicons/react/24/solid";
|
||||
import Image from "next/image";
|
||||
|
||||
const cards = [{ name: "Account balance", href: "#", icon: ScaleIcon, amount: "$30,659.45" }];
|
||||
const transactions = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Payment to Molly Sanders",
|
||||
href: "#",
|
||||
amount: "$20,000",
|
||||
currency: "USD",
|
||||
status: "success",
|
||||
date: "July 11, 2020",
|
||||
datetime: "2020-07-11",
|
||||
},
|
||||
];
|
||||
const statusStyles: any = {
|
||||
success: "bg-green-100 text-green-800",
|
||||
processing: "bg-yellow-100 text-yellow-800",
|
||||
failed: "bg-slate-100 text-slate-800",
|
||||
};
|
||||
|
||||
export default function AppPage({}) {
|
||||
return (
|
||||
<LayoutApp>
|
||||
<div className="flex h-16 flex-shrink-0 border-b border-slate-200 bg-white lg:border-none">
|
||||
<button
|
||||
type="button"
|
||||
className="border-r border-slate-200 px-4 text-slate-400 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-cyan-500 lg:hidden">
|
||||
<span className="sr-only">Open sidebar</span>
|
||||
<Bars3CenterLeftIcon className="h-6 w-6" aria-hidden="true" />
|
||||
</button>
|
||||
{/* Search bar */}
|
||||
<div className="flex flex-1 justify-between px-4 sm:px-6 lg:mx-auto lg:max-w-6xl lg:px-8">
|
||||
<div className="flex flex-1">
|
||||
<form className="flex w-full md:ml-0" action="#" method="GET">
|
||||
<label htmlFor="search-field" className="sr-only">
|
||||
Search
|
||||
</label>
|
||||
<div className="relative w-full text-slate-400 focus-within:text-slate-600">
|
||||
<div
|
||||
className="pointer-events-none absolute inset-y-0 left-0 flex items-center"
|
||||
aria-hidden="true">
|
||||
<MagnifyingGlassIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</div>
|
||||
<input
|
||||
id="search-field"
|
||||
name="search-field"
|
||||
className="block h-full w-full border-transparent py-2 pl-8 pr-3 text-slate-900 placeholder-slate-500 focus:border-transparent focus:outline-none focus:ring-0 sm:text-sm"
|
||||
placeholder="Search transactions"
|
||||
type="search"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div className="ml-4 flex items-center md:ml-6">
|
||||
<button className="mr-2 flex max-w-xs items-center rounded-full bg-white text-sm font-medium text-slate-700 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2 lg:rounded-md lg:p-2 lg:hover:bg-slate-50">
|
||||
Feedback
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="rounded-full bg-white p-1 text-slate-400 hover:text-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2">
|
||||
<span className="sr-only">View notifications</span>
|
||||
<BellIcon className="h-6 w-6" aria-hidden="true" />
|
||||
</button>
|
||||
{/* Profile dropdown */}
|
||||
<div className="relative ml-3">
|
||||
<div>
|
||||
<button className="flex max-w-xs items-center rounded-full bg-white text-sm focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2 lg:rounded-md lg:p-2 lg:hover:bg-slate-50">
|
||||
<Image
|
||||
className="h-8 w-8 rounded-full"
|
||||
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
|
||||
width={32}
|
||||
height={32}
|
||||
alt=""
|
||||
/>
|
||||
<span className="ml-3 hidden text-sm font-medium text-slate-700 lg:block">
|
||||
<span className="sr-only">Open user menu for </span>Emilia Birch
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="ml-1 hidden h-5 w-5 flex-shrink-0 text-slate-400 lg:block"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<main className="flex-1 pb-8">
|
||||
{/* Page header */}
|
||||
<div className="bg-white shadow">
|
||||
<div className="px-4 sm:px-6 lg:mx-auto lg:max-w-6xl lg:px-8">
|
||||
<div className="py-6 md:flex md:items-center md:justify-between lg:border-t lg:border-slate-200">
|
||||
<div className="min-w-0 flex-1">
|
||||
{/* Profile */}
|
||||
<div className="flex items-center">
|
||||
<Image
|
||||
className="hidden h-16 w-16 rounded-full sm:block"
|
||||
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.6&w=256&h=256&q=80"
|
||||
alt=""
|
||||
width={32}
|
||||
height={32}
|
||||
/>
|
||||
<div>
|
||||
<div className="flex items-center">
|
||||
<Image
|
||||
className="h-16 w-16 rounded-full sm:hidden"
|
||||
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.6&w=256&h=256&q=80"
|
||||
alt=""
|
||||
width={32}
|
||||
height={32}
|
||||
/>
|
||||
<h1 className="ml-3 text-2xl font-bold leading-7 text-slate-900 sm:truncate sm:leading-9">
|
||||
Good morning, Emilia Birch
|
||||
</h1>
|
||||
</div>
|
||||
<dl className="mt-6 flex flex-col sm:ml-3 sm:mt-1 sm:flex-row sm:flex-wrap">
|
||||
<dt className="sr-only">Company</dt>
|
||||
<dd className="flex items-center text-sm font-medium capitalize text-slate-500 sm:mr-6">
|
||||
<BuildingOfficeIcon
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-slate-400"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
Duke street studio
|
||||
</dd>
|
||||
<dt className="sr-only">Account status</dt>
|
||||
<dd className="mt-3 flex items-center text-sm font-medium capitalize text-slate-500 sm:mr-6 sm:mt-0">
|
||||
<CheckCircleIcon
|
||||
className="mr-1.5 h-5 w-5 flex-shrink-0 text-green-400"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
Verified account
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-6 flex space-x-3 md:mt-0 md:ml-4">
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2">
|
||||
Add money
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex items-center rounded-md border border-transparent bg-cyan-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-cyan-700 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2">
|
||||
Send money
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-8">
|
||||
<div className="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">
|
||||
<h2 className="text-lg font-medium leading-6 text-slate-900">Overview</h2>
|
||||
<div className="mt-2 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{/* Card */}
|
||||
{cards.map((card) => (
|
||||
<div key={card.name} className="overflow-hidden rounded-lg bg-white shadow">
|
||||
<div className="p-5">
|
||||
<div className="flex items-center">
|
||||
<div className="flex-shrink-0">
|
||||
<card.icon className="h-6 w-6 text-slate-400" aria-hidden="true" />
|
||||
</div>
|
||||
<div className="ml-5 w-0 flex-1">
|
||||
<dl>
|
||||
<dt className="truncate text-sm font-medium text-slate-500">{card.name}</dt>
|
||||
<dd>
|
||||
<div className="text-lg font-medium text-slate-900">{card.amount}</div>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-slate-50 px-5 py-3">
|
||||
<div className="text-sm">
|
||||
<a href={card.href} className="font-medium text-cyan-700 hover:text-cyan-900">
|
||||
View all
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 className="mx-auto mt-8 max-w-6xl px-4 text-lg font-medium leading-6 text-slate-900 sm:px-6 lg:px-8">
|
||||
Recent activity
|
||||
</h2>
|
||||
|
||||
{/* Activity list (smallest breakpoint only) */}
|
||||
<div className="shadow sm:hidden">
|
||||
<ul role="list" className="mt-2 divide-y divide-slate-200 overflow-hidden shadow sm:hidden">
|
||||
{transactions.map((transaction) => (
|
||||
<li key={transaction.id}>
|
||||
<a href={transaction.href} className="block bg-white px-4 py-4 hover:bg-slate-50">
|
||||
<span className="flex items-center space-x-4">
|
||||
<span className="flex flex-1 space-x-2 truncate">
|
||||
<BanknotesIcon className="h-5 w-5 flex-shrink-0 text-slate-400" aria-hidden="true" />
|
||||
<span className="flex flex-col truncate text-sm text-slate-500">
|
||||
<span className="truncate">{transaction.name}</span>
|
||||
<span>
|
||||
<span className="font-medium text-slate-900">{transaction.amount}</span>{" "}
|
||||
{transaction.currency}
|
||||
</span>
|
||||
<time dateTime={transaction.datetime}>{transaction.date}</time>
|
||||
</span>
|
||||
</span>
|
||||
<ChevronRightIcon className="h-5 w-5 flex-shrink-0 text-slate-400" aria-hidden="true" />
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<nav
|
||||
className="flex items-center justify-between border-t border-slate-200 bg-white px-4 py-3"
|
||||
aria-label="Pagination">
|
||||
<div className="flex flex-1 justify-between">
|
||||
<a
|
||||
href="#"
|
||||
className="relative inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:text-slate-500">
|
||||
Previous
|
||||
</a>
|
||||
<a
|
||||
href="#"
|
||||
className="relative ml-3 inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:text-slate-500">
|
||||
Next
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
{/* Activity table (small breakpoint and up) */}
|
||||
<div className="hidden sm:block">
|
||||
<div className="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="mt-2 flex flex-col">
|
||||
<div className="min-w-full overflow-hidden overflow-x-auto align-middle shadow sm:rounded-lg">
|
||||
<table className="min-w-full divide-y divide-slate-200">
|
||||
<thead>
|
||||
<tr>
|
||||
<th
|
||||
className="bg-slate-50 px-6 py-3 text-left text-sm font-semibold text-slate-900"
|
||||
scope="col">
|
||||
Transaction
|
||||
</th>
|
||||
<th
|
||||
className="bg-slate-50 px-6 py-3 text-right text-sm font-semibold text-slate-900"
|
||||
scope="col">
|
||||
Amount
|
||||
</th>
|
||||
<th
|
||||
className="hidden bg-slate-50 px-6 py-3 text-left text-sm font-semibold text-slate-900 md:block"
|
||||
scope="col">
|
||||
Status
|
||||
</th>
|
||||
<th
|
||||
className="bg-slate-50 px-6 py-3 text-right text-sm font-semibold text-slate-900"
|
||||
scope="col">
|
||||
Date
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-slate-200 bg-white">
|
||||
{transactions.map((transaction) => (
|
||||
<tr key={transaction.id} className="bg-white">
|
||||
<td className="w-full max-w-0 whitespace-nowrap px-6 py-4 text-sm text-slate-900">
|
||||
<div className="flex">
|
||||
<a
|
||||
href={transaction.href}
|
||||
className="group inline-flex space-x-2 truncate text-sm">
|
||||
<BanknotesIcon
|
||||
className="h-5 w-5 flex-shrink-0 text-slate-400 group-hover:text-slate-500"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<p className="truncate text-slate-500 group-hover:text-slate-900">
|
||||
{transaction.name}
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-6 py-4 text-right text-sm text-slate-500">
|
||||
<span className="font-medium text-slate-900">{transaction.amount}</span>
|
||||
{transaction.currency}
|
||||
</td>
|
||||
<td className="hidden whitespace-nowrap px-6 py-4 text-sm text-slate-500 md:block">
|
||||
<span
|
||||
className={classNames(
|
||||
statusStyles[transaction.status],
|
||||
"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium capitalize"
|
||||
)}>
|
||||
{transaction.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-6 py-4 text-right text-sm text-slate-500">
|
||||
<time dateTime={transaction.datetime}>{transaction.date}</time>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{/* Pagination */}
|
||||
<nav
|
||||
className="flex items-center justify-between border-t border-slate-200 bg-white px-4 py-3 sm:px-6"
|
||||
aria-label="Pagination">
|
||||
<div className="hidden sm:block">
|
||||
<p className="text-sm text-slate-700">
|
||||
Showing <span className="font-medium">1</span> to{" "}
|
||||
<span className="font-medium">10</span> of <span className="font-medium">20</span>{" "}
|
||||
results
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-1 justify-between sm:justify-end">
|
||||
<a
|
||||
href="#"
|
||||
className="relative inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">
|
||||
Previous
|
||||
</a>
|
||||
<a
|
||||
href="#"
|
||||
className="relative ml-3 inline-flex items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">
|
||||
Next
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</LayoutApp>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { useState } from "react";
|
||||
import AppPage from "../../components/AppPage";
|
||||
import SimpleFeedbackModal from "../../components/SimpleFeedbackModal";
|
||||
|
||||
export default function Example() {
|
||||
const [showFeedback, setShowFeedback] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppPage onClickFeedback={() => setShowFeedback(true)} />
|
||||
<SimpleFeedbackModal show={showFeedback} setShow={setShowFeedback} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import { useEffect } from "react";
|
||||
import AppPage from "../../components/AppPage";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
formbricks: any;
|
||||
}
|
||||
}
|
||||
|
||||
export default function Feedback() {
|
||||
useEffect(() => {
|
||||
window.formbricks = {
|
||||
...window.formbricks,
|
||||
config: {
|
||||
formbricksUrl: process.env.NEXT_PUBLIC_FORMBRICKS_URL,
|
||||
formId: process.env.NEXT_PUBLIC_FORMBRICKS_FEEDBACK_FORM_ID,
|
||||
contact: {
|
||||
name: "Matti Nannt",
|
||||
position: "Founder",
|
||||
imgUrl: "https://avatars.githubusercontent.com/u/675065?s=128&v=4",
|
||||
},
|
||||
customer: {
|
||||
name: "Formbricks",
|
||||
email: "johannes@formbricks.com",
|
||||
},
|
||||
},
|
||||
};
|
||||
import("@formbricks/feedback");
|
||||
}, []);
|
||||
return <AppPage onClickFeedback={(event) => window.formbricks.open(event)} />;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import AppPage from "../../components/AppPage";
|
||||
import PmfButton from "../../components/PmfButton";
|
||||
|
||||
export default function Example() {
|
||||
return (
|
||||
<>
|
||||
<AppPage />
|
||||
<PmfButton />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,383 +0,0 @@
|
||||
import { Bar } from "@formbricks/charts";
|
||||
import { Form, Radio, Submit, sendToHq, Textarea } from "@formbricks/react";
|
||||
import { Popover, Transition } from "@headlessui/react";
|
||||
import { Bars3Icon, MegaphoneIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
||||
import { Fragment, useState } from "react";
|
||||
|
||||
const footerNavigation = {
|
||||
solutions: [
|
||||
{ name: "Marketing", href: "#" },
|
||||
{ name: "Analytics", href: "#" },
|
||||
{ name: "Commerce", href: "#" },
|
||||
{ name: "Insights", href: "#" },
|
||||
],
|
||||
support: [
|
||||
{ name: "Pricing", href: "#" },
|
||||
{ name: "Documentation", href: "#" },
|
||||
{ name: "Guides", href: "#" },
|
||||
{ name: "API Status", href: "#" },
|
||||
],
|
||||
company: [
|
||||
{ name: "About", href: "#" },
|
||||
{ name: "Blog", href: "#" },
|
||||
{ name: "Jobs", href: "#" },
|
||||
{ name: "Press", href: "#" },
|
||||
{ name: "Partners", href: "#" },
|
||||
],
|
||||
legal: [
|
||||
{ name: "Claim", href: "#" },
|
||||
{ name: "Privacy", href: "#" },
|
||||
{ name: "Terms", href: "#" },
|
||||
],
|
||||
social: [
|
||||
{
|
||||
name: "Facebook",
|
||||
href: "#",
|
||||
icon: (props) => (
|
||||
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33v6.988C18.343 21.128 22 16.991 22 12z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Instagram",
|
||||
href: "#",
|
||||
icon: (props) => (
|
||||
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M12.315 2c2.43 0 2.784.013 3.808.06 1.064.049 1.791.218 2.427.465a4.902 4.902 0 011.772 1.153 4.902 4.902 0 011.153 1.772c.247.636.416 1.363.465 2.427.048 1.067.06 1.407.06 4.123v.08c0 2.643-.012 2.987-.06 4.043-.049 1.064-.218 1.791-.465 2.427a4.902 4.902 0 01-1.153 1.772 4.902 4.902 0 01-1.772 1.153c-.636.247-1.363.416-2.427.465-1.067.048-1.407.06-4.123.06h-.08c-2.643 0-2.987-.012-4.043-.06-1.064-.049-1.791-.218-2.427-.465a4.902 4.902 0 01-1.772-1.153 4.902 4.902 0 01-1.153-1.772c-.247-.636-.416-1.363-.465-2.427-.047-1.024-.06-1.379-.06-3.808v-.63c0-2.43.013-2.784.06-3.808.049-1.064.218-1.791.465-2.427a4.902 4.902 0 011.153-1.772A4.902 4.902 0 015.45 2.525c.636-.247 1.363-.416 2.427-.465C8.901 2.013 9.256 2 11.685 2h.63zm-.081 1.802h-.468c-2.456 0-2.784.011-3.807.058-.975.045-1.504.207-1.857.344-.467.182-.8.398-1.15.748-.35.35-.566.683-.748 1.15-.137.353-.3.882-.344 1.857-.047 1.023-.058 1.351-.058 3.807v.468c0 2.456.011 2.784.058 3.807.045.975.207 1.504.344 1.857.182.466.399.8.748 1.15.35.35.683.566 1.15.748.353.137.882.3 1.857.344 1.054.048 1.37.058 4.041.058h.08c2.597 0 2.917-.01 3.96-.058.976-.045 1.505-.207 1.858-.344.466-.182.8-.398 1.15-.748.35-.35.566-.683.748-1.15.137-.353.3-.882.344-1.857.048-1.055.058-1.37.058-4.041v-.08c0-2.597-.01-2.917-.058-3.96-.045-.976-.207-1.505-.344-1.858a3.097 3.097 0 00-.748-1.15 3.098 3.098 0 00-1.15-.748c-.353-.137-.882-.3-1.857-.344-1.023-.047-1.351-.058-3.807-.058zM12 6.865a5.135 5.135 0 110 10.27 5.135 5.135 0 010-10.27zm0 1.802a3.333 3.333 0 100 6.666 3.333 3.333 0 000-6.666zm5.338-3.205a1.2 1.2 0 110 2.4 1.2 1.2 0 010-2.4z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Twitter",
|
||||
href: "#",
|
||||
icon: (props) => (
|
||||
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
|
||||
<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>
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "GitHub",
|
||||
href: "#",
|
||||
icon: (props) => (
|
||||
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Dribbble",
|
||||
href: "#",
|
||||
icon: (props) => (
|
||||
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10c5.51 0 10-4.48 10-10S17.51 2 12 2zm6.605 4.61a8.502 8.502 0 011.93 5.314c-.281-.054-3.101-.629-5.943-.271-.065-.141-.12-.293-.184-.445a25.416 25.416 0 00-.564-1.236c3.145-1.28 4.577-3.124 4.761-3.362zM12 3.475c2.17 0 4.154.813 5.662 2.148-.152.216-1.443 1.941-4.48 3.08-1.399-2.57-2.95-4.675-3.189-5A8.687 8.687 0 0112 3.475zm-3.633.803a53.896 53.896 0 013.167 4.935c-3.992 1.063-7.517 1.04-7.896 1.04a8.581 8.581 0 014.729-5.975zM3.453 12.01v-.26c.37.01 4.512.065 8.775-1.215.25.477.477.965.694 1.453-.109.033-.228.065-.336.098-4.404 1.42-6.747 5.303-6.942 5.629a8.522 8.522 0 01-2.19-5.705zM12 20.547a8.482 8.482 0 01-5.239-1.8c.152-.315 1.888-3.656 6.703-5.337.022-.01.033-.01.054-.022a35.318 35.318 0 011.823 6.475 8.4 8.4 0 01-3.341.684zm4.761-1.465c-.086-.52-.542-3.015-1.659-6.084 2.679-.423 5.022.271 5.314.369a8.468 8.468 0 01-3.655 5.715z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default function Demo() {
|
||||
const [submissions, setSubmissions] = useState(null);
|
||||
const [schema, setSchema] = useState(null);
|
||||
const [answered, setAnswered] = useState(false);
|
||||
|
||||
const handleSubmit = async ({ submission, schema }) => {
|
||||
await sendToHq({ submission, schema });
|
||||
const submissionRequest = await fetch(`/api/submissions`, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json", "X-API-Key": "82967fcd502abc9ff213cf9daca9bc43" },
|
||||
});
|
||||
const submissions = await submissionRequest.json();
|
||||
setSchema(schema);
|
||||
setSubmissions(submissions);
|
||||
setAnswered(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="bg-white">
|
||||
<header>
|
||||
<Popover className="relative bg-white">
|
||||
<div className="mx-auto flex max-w-7xl items-center justify-between px-4 py-6 sm:px-6 md:justify-start md:space-x-10 lg:px-8">
|
||||
<div className="flex justify-start lg:w-0 lg:flex-1">
|
||||
<a href="#">
|
||||
<span className="sr-only">Your Company</span>
|
||||
|
||||
<span className="fill-indigo-700 text-3xl font-bold">+ Demo</span>
|
||||
</a>
|
||||
</div>
|
||||
<div className="-my-2 -mr-2 md:hidden">
|
||||
<Popover.Button className="inline-flex items-center justify-center rounded-md bg-white p-2 text-slate-400 hover:bg-slate-100 hover:text-slate-500 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500">
|
||||
<span className="sr-only">Open menu</span>
|
||||
<Bars3Icon className="h-6 w-6" aria-hidden="true" />
|
||||
</Popover.Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Transition
|
||||
as={Fragment}
|
||||
enter="duration-200 ease-out"
|
||||
enterFrom="opacity-0 scale-95"
|
||||
enterTo="opacity-100 scale-100"
|
||||
leave="duration-100 ease-in"
|
||||
leaveFrom="opacity-100 scale-100"
|
||||
leaveTo="opacity-0 scale-95">
|
||||
<Popover.Panel
|
||||
focus
|
||||
className="absolute inset-x-0 top-0 z-30 origin-top-right transform p-2 transition md:hidden">
|
||||
<div className="divide-y-2 divide-slate-50 rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5">
|
||||
<div className="px-5 pt-5 pb-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<img
|
||||
className="h-8 w-auto"
|
||||
src="https://tailwindui.com/img/logos/mark.svg?from-color=purple&from-shade=600&to-color=indigo&to-shade=600&toShade=600"
|
||||
alt="Your Company"
|
||||
/>
|
||||
</div>
|
||||
<div className="-mr-2">
|
||||
<Popover.Button className="inline-flex items-center justify-center rounded-md bg-white p-2 text-slate-400 hover:bg-slate-100 hover:text-slate-500 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500">
|
||||
<span className="sr-only">Close menu</span>
|
||||
<XMarkIcon className="h-6 w-6" aria-hidden="true" />
|
||||
</Popover.Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Popover.Panel>
|
||||
</Transition>
|
||||
</Popover>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
{/* Hero section */}
|
||||
<div className="relative">
|
||||
<div className="absolute inset-x-0 bottom-0 h-1/2 bg-slate-100" />
|
||||
<div className="mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||
<div className="relative shadow-xl sm:overflow-hidden sm:rounded-2xl">
|
||||
<div className="absolute inset-0">
|
||||
<img
|
||||
className="h-full w-full object-cover"
|
||||
src="https://images.unsplash.com/photo-1522202176988-66273c2fd55f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2830&q=80&sat=-100"
|
||||
alt="People working on laptops"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-purple-800 to-indigo-700 mix-blend-multiply" />
|
||||
</div>
|
||||
<div className="relative px-4 py-16 sm:px-6 sm:py-24 lg:py-32 lg:px-8">
|
||||
<h1 className="text-center text-4xl font-bold tracking-tight sm:text-5xl lg:text-6xl">
|
||||
<span className="block text-white">Thank you for</span>
|
||||
<span className="block text-indigo-200">watching our course</span>
|
||||
</h1>
|
||||
<p className="mx-auto mt-6 max-w-lg text-center text-xl text-indigo-200 sm:max-w-3xl">
|
||||
If you have any questions left, just send us an email to contact@example.com
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Alternating Feature Sections */}
|
||||
|
||||
<div className="relative overflow-hidden pl-12 pb-16">
|
||||
<div aria-hidden="true" className="absolute inset-x-0 top-0 h-48 bg-gradient-to-b from-slate-100" />
|
||||
<div className="relative">
|
||||
<hr className="my-24 px-10" />
|
||||
<div className="lg:mx-auto lg:max-w-7xl">
|
||||
<div className="grid grid-cols-2 px-4 sm:px-6 lg:mx-0 lg:max-w-none lg:px-0">
|
||||
<div>
|
||||
<div>
|
||||
<span className="flex h-12 w-12 items-center justify-center rounded-md bg-gradient-to-r from-purple-600 to-indigo-600">
|
||||
<MegaphoneIcon className="h-6 w-6 text-white" aria-hidden="true" />
|
||||
</span>
|
||||
</div>
|
||||
<div className="mt-6">
|
||||
<h2 className="text-3xl font-bold tracking-tight text-slate-900">The door is open</h2>
|
||||
<p className="mt-4 text-lg text-slate-500">
|
||||
Now it‘s up to you to continue! And we are here to support you.
|
||||
<br />
|
||||
<br />
|
||||
Give us some feedback so we can improve our service. In the spirit of transparency,
|
||||
we'll also show you what other users have responded.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/* Feedback Form */}
|
||||
<div className="mt-8 border-l border-slate-200 pl-10">
|
||||
{!answered ? (
|
||||
/* Formbricks Form using React Library */
|
||||
<Form
|
||||
formId="clbgle5og0001yzltkc6iah7i"
|
||||
hqUrl="http://localhost:3000"
|
||||
onSubmit={handleSubmit}>
|
||||
<Radio
|
||||
name="evaluate"
|
||||
label="Evaluate the online course you just completed"
|
||||
legendClassName="mb-3 font-bold text-slate-800 text-xl"
|
||||
labelClassName="font-regular text-slate-500 text-lg"
|
||||
options={[
|
||||
"Perfect",
|
||||
"Very satisfactory",
|
||||
"Satisfactory",
|
||||
"Not very satisfactory",
|
||||
"Useless",
|
||||
]}
|
||||
/>
|
||||
<Textarea
|
||||
name="feedback"
|
||||
label="Would you like to send us a comment, an opinion, a correction?"
|
||||
help="Only you and us can see your answer."
|
||||
labelClassName="font-bold text-slate-800 text-xl"
|
||||
innerClassName="mt-3"
|
||||
cols={50}
|
||||
rows={4}
|
||||
/>
|
||||
<Submit
|
||||
label="Answer"
|
||||
inputClassName="flex items-center justify-center rounded-md border border-transparent bg-gradient-to-r from-purple-600 to-indigo-600 bg-origin-border px-3 py-2 text-base font-medium text-white shadow-sm hover:from-purple-700 hover:to-indigo-700"
|
||||
/>
|
||||
</Form>
|
||||
) : (
|
||||
<>
|
||||
<h2 className="mx-auto mb-3 text-lg font-bold text-slate-800">
|
||||
Thanks a lot for your feedback
|
||||
</h2>
|
||||
<p className="mb-5 text-lg text-slate-500">
|
||||
Here you can see what other people answered.
|
||||
</p>
|
||||
{/* Visualize Submission using Formbricks Graphs Library */}
|
||||
<Bar submissions={submissions} schema={schema} fieldName="evaluate" color="#4f46e5" />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* CTA Section */}
|
||||
<div className="bg-slate-50">
|
||||
<div className="mx-auto max-w-4xl py-16 px-4 sm:px-6 sm:py-24 lg:flex lg:max-w-7xl lg:items-center lg:justify-between lg:px-8">
|
||||
<h2 className="text-4xl font-bold tracking-tight text-slate-900 sm:text-4xl">
|
||||
<span className="block">Ready to get started?</span>
|
||||
<span className="-mb-1 block bg-gradient-to-r from-purple-600 to-indigo-600 bg-clip-text pb-1 text-transparent">
|
||||
Get in touch or create an account.
|
||||
</span>
|
||||
</h2>
|
||||
<div className="mt-6 space-y-4 sm:flex sm:space-y-0 sm:space-x-5">
|
||||
<a
|
||||
href="#"
|
||||
className="flex items-center justify-center rounded-md border border-transparent bg-gradient-to-r from-purple-600 to-indigo-600 bg-origin-border px-4 py-3 text-base font-medium text-white shadow-sm hover:from-purple-700 hover:to-indigo-700">
|
||||
Learn more
|
||||
</a>
|
||||
<a
|
||||
href="#"
|
||||
className="flex items-center justify-center rounded-md border border-transparent bg-indigo-50 px-4 py-3 text-base font-medium text-indigo-800 shadow-sm hover:bg-indigo-100">
|
||||
Get started
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer className="bg-slate-50" aria-labelledby="footer-heading">
|
||||
<h2 id="footer-heading" className="sr-only">
|
||||
Footer
|
||||
</h2>
|
||||
<div className="mx-auto max-w-7xl px-4 pt-16 pb-8 sm:px-6 lg:px-8 lg:pt-24">
|
||||
<div className="xl:grid xl:grid-cols-3 xl:gap-8">
|
||||
<div className="grid grid-cols-2 gap-8 xl:col-span-2">
|
||||
<div className="md:grid md:grid-cols-2 md:gap-8">
|
||||
<div>
|
||||
<h3 className="text-base font-medium text-slate-900">Solutions</h3>
|
||||
<ul role="list" className="mt-4 space-y-4">
|
||||
{footerNavigation.solutions.map((item) => (
|
||||
<li key={item.name}>
|
||||
<a href={item.href} className="text-base text-slate-500 hover:text-slate-900">
|
||||
{item.name}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<div className="mt-12 md:mt-0">
|
||||
<h3 className="text-base font-medium text-slate-900">Support</h3>
|
||||
<ul role="list" className="mt-4 space-y-4">
|
||||
{footerNavigation.support.map((item) => (
|
||||
<li key={item.name}>
|
||||
<a href={item.href} className="text-base text-slate-500 hover:text-slate-900">
|
||||
{item.name}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div className="md:grid md:grid-cols-2 md:gap-8">
|
||||
<div>
|
||||
<h3 className="text-base font-medium text-slate-900">Company</h3>
|
||||
<ul role="list" className="mt-4 space-y-4">
|
||||
{footerNavigation.company.map((item) => (
|
||||
<li key={item.name}>
|
||||
<a href={item.href} className="text-base text-slate-500 hover:text-slate-900">
|
||||
{item.name}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<div className="mt-12 md:mt-0">
|
||||
<h3 className="text-base font-medium text-slate-900">Legal</h3>
|
||||
<ul role="list" className="mt-4 space-y-4">
|
||||
{footerNavigation.legal.map((item) => (
|
||||
<li key={item.name}>
|
||||
<a href={item.href} className="text-base text-slate-500 hover:text-slate-900">
|
||||
{item.name}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-12 xl:mt-0">
|
||||
<h3 className="text-base font-medium text-slate-900">Subscribe to our newsletter</h3>
|
||||
<p className="mt-4 text-base text-slate-500">
|
||||
The latest news, articles, and resources, sent to your inbox weekly.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-12 border-t border-slate-200 pt-8 md:flex md:items-center md:justify-between lg:mt-16">
|
||||
<div className="flex space-x-6 md:order-2">
|
||||
{footerNavigation.social.map((item) => (
|
||||
<a key={item.name} href={item.href} className="text-slate-400 hover:text-slate-500">
|
||||
<span className="sr-only">{item.name}</span>
|
||||
<item.icon className="h-6 w-6" aria-hidden="true" />
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
<p className="mt-8 text-base text-slate-400 md:order-1 md:mt-0">
|
||||
© 2020 Your Company, Inc. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
import Link from "next/link";
|
||||
|
||||
const demos = [
|
||||
{
|
||||
name: "Feedback",
|
||||
description: "Shows Formbricks Feedback Widget in action",
|
||||
href: "/demos/feedback",
|
||||
},
|
||||
{
|
||||
name: "Feedback Custom",
|
||||
description: "Custom-built feedback widget using Formbricks React Library",
|
||||
href: "/demos/feedback-custom",
|
||||
},
|
||||
{
|
||||
name: "Product Market Fit",
|
||||
description: "Shows Formbricks PMF Widget in action",
|
||||
href: "/demos/pmf",
|
||||
},
|
||||
{
|
||||
name: "Poll Results",
|
||||
description:
|
||||
"Shows how you can use Formbricks to build a customer poll and show the results to your users",
|
||||
href: "/demos/poll-results",
|
||||
},
|
||||
];
|
||||
|
||||
export default function DemosOverview() {
|
||||
return (
|
||||
<div className="w-full justify-center py-8 px-8">
|
||||
<h1 className="my-8 text-center text-2xl font-bold leading-4 text-slate-800">Formbricks Demos</h1>
|
||||
<div className="mx-auto grid max-w-lg grid-cols-1 gap-4 sm:grid-cols-1">
|
||||
{demos.map((demo) => (
|
||||
<div
|
||||
key={demo.name}
|
||||
className="relative flex items-center space-x-3 rounded-lg border border-slate-300 bg-white px-6 py-5 shadow-sm focus-within:ring-2 focus-within:ring-teal-500 focus-within:ring-offset-2 hover:border-slate-400">
|
||||
<div className="min-w-0 flex-1">
|
||||
<Link href={demo.href} className="focus:outline-none" target="_blank">
|
||||
<span className="absolute inset-0" aria-hidden="true" />
|
||||
<p className="text-sm font-medium text-slate-900">{demo.name}</p>
|
||||
<p className="truncate text-sm text-slate-500">{demo.description}</p>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
150
apps/demo/pages/signin/index.tsx
Normal file
@@ -0,0 +1,150 @@
|
||||
import formbricks from "@formbricks/js";
|
||||
import { useRouter } from "next/router";
|
||||
import { FormEvent } from "react";
|
||||
|
||||
export default function SiginPage() {
|
||||
const router = useRouter();
|
||||
|
||||
const submitAction = (e: FormEvent) => {
|
||||
e.preventDefault();
|
||||
formbricks.setEmail("matti@example.com");
|
||||
formbricks.setUserId("123456");
|
||||
formbricks.setAttribute("Plan", "Premium");
|
||||
router.push("/app");
|
||||
};
|
||||
return (
|
||||
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
|
||||
<div className="sm:mx-auto sm:w-full sm:max-w-md">
|
||||
<h2 className="mt-6 text-center text-3xl font-bold tracking-tight text-gray-900">
|
||||
Sign in to your account
|
||||
</h2>
|
||||
<p className="mt-2 text-center text-sm text-gray-600">
|
||||
Or{" "}
|
||||
<a href="#" className="font-medium text-indigo-600 hover:text-indigo-500">
|
||||
start your 14-day free trial
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
||||
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
|
||||
<form className="space-y-6" onSubmit={submitAction}>
|
||||
<div>
|
||||
<label htmlFor="email" className="block text-sm font-medium leading-6 text-gray-900">
|
||||
Email address
|
||||
</label>
|
||||
<div className="mt-2">
|
||||
<input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
autoComplete="email"
|
||||
required
|
||||
className="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label htmlFor="password" className="block text-sm font-medium leading-6 text-gray-900">
|
||||
Password
|
||||
</label>
|
||||
<div className="mt-2">
|
||||
<input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
className="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
id="remember-me"
|
||||
name="remember-me"
|
||||
type="checkbox"
|
||||
className="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600"
|
||||
/>
|
||||
<label htmlFor="remember-me" className="ml-2 block text-sm text-gray-900">
|
||||
Remember me
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="text-sm">
|
||||
<a href="#" className="font-medium text-indigo-600 hover:text-indigo-500">
|
||||
Forgot your password?
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button
|
||||
type="submit"
|
||||
className="flex w-full justify-center rounded-md bg-indigo-500 py-2 px-3 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">
|
||||
Sign in
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div className="mt-6">
|
||||
<div className="relative">
|
||||
<div className="absolute inset-0 flex items-center">
|
||||
<div className="w-full border-t border-gray-300" />
|
||||
</div>
|
||||
<div className="relative flex justify-center text-sm">
|
||||
<span className="bg-white px-2 text-gray-500">Or continue with</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 grid grid-cols-3 gap-3">
|
||||
<div>
|
||||
<a
|
||||
href="#"
|
||||
className="inline-flex w-full justify-center rounded-md bg-white py-2 px-4 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:outline-offset-0">
|
||||
<span className="sr-only">Sign in with Facebook</span>
|
||||
<svg className="h-5 w-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M20 10c0-5.523-4.477-10-10-10S0 4.477 0 10c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V10h2.54V7.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V10h2.773l-.443 2.89h-2.33v6.988C16.343 19.128 20 14.991 20 10z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a
|
||||
href="#"
|
||||
className="inline-flex w-full justify-center rounded-md bg-white py-2 px-4 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:outline-offset-0">
|
||||
<span className="sr-only">Sign in with Twitter</span>
|
||||
<svg className="h-5 w-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M6.29 18.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0020 3.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.073 4.073 0 01.8 7.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 010 16.407a11.616 11.616 0 006.29 1.84" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a
|
||||
href="#"
|
||||
className="inline-flex w-full justify-center rounded-md bg-white py-2 px-4 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:outline-offset-0">
|
||||
<span className="sr-only">Sign in with GitHub</span>
|
||||
<svg className="h-5 w-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
BIN
apps/demo/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 25 KiB |
1
apps/demo/public/next.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
apps/demo/public/thirteen.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="31" fill="none"><g opacity=".9"><path fill="url(#a)" d="M13 .4v29.3H7V6.3h-.2L0 10.5V5L7.2.4H13Z"/><path fill="url(#b)" d="M28.8 30.1c-2.2 0-4-.3-5.7-1-1.7-.8-3-1.8-4-3.1a7.7 7.7 0 0 1-1.4-4.6h6.2c0 .8.3 1.4.7 2 .4.5 1 .9 1.7 1.2.7.3 1.6.4 2.5.4 1 0 1.7-.2 2.5-.5.7-.3 1.3-.8 1.7-1.4.4-.6.6-1.2.6-2s-.2-1.5-.7-2.1c-.4-.6-1-1-1.8-1.4-.8-.4-1.8-.5-2.9-.5h-2.7v-4.6h2.7a6 6 0 0 0 2.5-.5 4 4 0 0 0 1.7-1.3c.4-.6.6-1.3.6-2a3.5 3.5 0 0 0-2-3.3 5.6 5.6 0 0 0-4.5 0 4 4 0 0 0-1.7 1.2c-.4.6-.6 1.2-.6 2h-6c0-1.7.6-3.2 1.5-4.5 1-1.3 2.2-2.3 3.8-3C25 .4 26.8 0 28.8 0s3.8.4 5.3 1.1c1.5.7 2.7 1.7 3.6 3a7.2 7.2 0 0 1 1.2 4.2c0 1.6-.5 3-1.5 4a7 7 0 0 1-4 2.2v.2c2.2.3 3.8 1 5 2.2a6.4 6.4 0 0 1 1.6 4.6c0 1.7-.5 3.1-1.4 4.4a9.7 9.7 0 0 1-4 3.1c-1.7.8-3.7 1.1-5.8 1.1Z"/></g><defs><linearGradient id="a" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient><linearGradient id="b" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient></defs></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1
apps/demo/public/vercel.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
||||
|
After Width: | Height: | Size: 629 B |
@@ -1,6 +1,4 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
const colors = require("tailwindcss/colors");
|
||||
|
||||
module.exports = {
|
||||
content: [
|
||||
"./app/**/*.{js,ts,jsx,tsx}",
|
||||
@@ -8,14 +6,7 @@ module.exports = {
|
||||
"./components/**/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
screens: {
|
||||
xs: "430px",
|
||||
},
|
||||
colors: {
|
||||
cyan: colors.cyan,
|
||||
},
|
||||
},
|
||||
extend: {},
|
||||
},
|
||||
plugins: [require("@tailwindcss/forms")],
|
||||
};
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
{
|
||||
"extends": "@formbricks/tsconfig/nextjs.json",
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Button } from "@formbricks/ui";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -8,26 +7,5 @@ declare global {
|
||||
}
|
||||
|
||||
export function FeedbackButton() {
|
||||
useEffect(() => {
|
||||
window.formbricks = {
|
||||
...window.formbricks,
|
||||
config: {
|
||||
formbricksUrl: "https://app.formbricks.com",
|
||||
formId: "cle2pg7no0000nu0hjefwy3w7",
|
||||
contact: {
|
||||
name: "Matti",
|
||||
position: "Co-Founder",
|
||||
imgUrl: "https://avatars.githubusercontent.com/u/675065?s=128&v=4",
|
||||
},
|
||||
},
|
||||
};
|
||||
// @ts-ignore
|
||||
import("@formbricks/feedback");
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Button variant="secondary" onClick={(e) => window.formbricks.open(e)}>
|
||||
Open Feedback
|
||||
</Button>
|
||||
);
|
||||
return <Button variant="secondary">Open Feedback</Button>;
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
formbricksPmf: any;
|
||||
}
|
||||
}
|
||||
|
||||
export default function PmfDummy() {
|
||||
useEffect(() => {
|
||||
window.formbricksPmf = {
|
||||
...window.formbricksPmf,
|
||||
config: {
|
||||
formbricksUrl: "https://app.formbricks.com",
|
||||
formId: "cle2plrty0002nu0hqt83bi8q",
|
||||
containerId: "formbricks",
|
||||
customer: {
|
||||
id: "blog@formbricks.com",
|
||||
name: "Blog Submissions",
|
||||
email: "blog@formbricks.com",
|
||||
},
|
||||
},
|
||||
};
|
||||
require("@formbricks/pmf");
|
||||
window.formbricksPmf.init();
|
||||
}, []);
|
||||
|
||||
return <div className="my-4 overflow-hidden rounded-lg bg-slate-100 shadow-lg" id="formbricks"></div>;
|
||||
}
|
||||
75
apps/formbricks-com/components/dummyUI/AddEventDummy.tsx
Normal file
@@ -0,0 +1,75 @@
|
||||
import { Button } from "@formbricks/ui";
|
||||
import { PlusIcon, TrashIcon } from "@heroicons/react/24/solid";
|
||||
import { useState } from "react";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@formbricks/ui";
|
||||
|
||||
const DummyUI: React.FC = () => {
|
||||
const eventClasses = [
|
||||
{ id: "1", name: "View Dashboard" },
|
||||
{ id: "2", name: "Upgrade to Pro" },
|
||||
{ id: "3", name: "Cancel Plan" },
|
||||
];
|
||||
|
||||
const [triggers, setTriggers] = useState<string[]>([eventClasses[0].id]);
|
||||
|
||||
const setTriggerEvent = (index: number, eventClassId: string) => {
|
||||
setTriggers((prevTriggers) =>
|
||||
prevTriggers.map((trigger, idx) => (idx === index ? eventClassId : trigger))
|
||||
);
|
||||
};
|
||||
|
||||
const addTriggerEvent = () => {
|
||||
setTriggers((prevTriggers) => [...prevTriggers, eventClasses[0].id]);
|
||||
};
|
||||
|
||||
const removeTriggerEvent = (index: number) => {
|
||||
setTriggers((prevTriggers) => prevTriggers.filter((_, idx) => idx !== index));
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{triggers.map((triggerEventClassId, idx) => (
|
||||
<div className="mt-2" key={idx}>
|
||||
<div className="inline-flex items-center">
|
||||
<p className="mr-2 w-14 text-right text-sm text-slate-800 dark:text-slate-300">
|
||||
{idx === 0 ? "When" : "or"}
|
||||
</p>
|
||||
<Select
|
||||
value={triggerEventClassId}
|
||||
onValueChange={(eventClassId) => setTriggerEvent(idx, eventClassId)}>
|
||||
<SelectTrigger className="w-[180px] text-slate-800 dark:border-slate-400 dark:bg-slate-700 dark:text-slate-300">
|
||||
<SelectValue className="" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{eventClasses.map((eventClass) => (
|
||||
<SelectItem
|
||||
key={eventClass.id}
|
||||
className="py-1 px-0.5 text-slate-800 dark:bg-slate-700 dark:text-slate-300 dark:ring-slate-700"
|
||||
value={eventClass.id}>
|
||||
{eventClass.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<button onClick={() => removeTriggerEvent(idx)}>
|
||||
<TrashIcon className="ml-3 h-4 w-4 text-slate-400" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<div className="p-3">
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="dark:bg-slate-700 dark:text-slate-200 dark:hover:bg-slate-600"
|
||||
onClick={() => {
|
||||
addTriggerEvent();
|
||||
}}>
|
||||
<PlusIcon className="mr-2 h-4 w-4" />
|
||||
Add event
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default DummyUI;
|
||||
@@ -0,0 +1,125 @@
|
||||
import Modal from "../shared/Modal";
|
||||
import { Button } from "@formbricks/ui";
|
||||
import { Input } from "@formbricks/ui";
|
||||
import { Label } from "@formbricks/ui";
|
||||
import { RadioGroup, RadioGroupItem } from "@formbricks/ui";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@formbricks/ui";
|
||||
import { CursorArrowRaysIcon } from "@heroicons/react/24/solid";
|
||||
|
||||
interface EventDetailModalProps {
|
||||
open: boolean;
|
||||
setOpen: (v: boolean) => void;
|
||||
}
|
||||
|
||||
export default function AddNoCodeEventModalDummy({ open, setOpen }: EventDetailModalProps) {
|
||||
return (
|
||||
<Modal open={open} setOpen={setOpen} noPadding closeOnOutsideClick={false}>
|
||||
<div className="flex h-full flex-col rounded-lg">
|
||||
<div className="rounded-t-lg bg-slate-100">
|
||||
<div className="flex items-center justify-between p-6">
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="mr-1.5 h-6 w-6 text-slate-500">
|
||||
<CursorArrowRaysIcon />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-xl font-medium text-slate-700">Add No-Code Event</div>
|
||||
<div className="text-sm text-slate-500">
|
||||
Create a new no-code event to filter your user base with.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form>
|
||||
<div className="flex justify-between rounded-lg p-6">
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<Label>Select By</Label>
|
||||
<RadioGroup className="grid grid-cols-2 gap-1 md:grid-cols-3" defaultValue="pageUrl">
|
||||
<div className="flex items-center space-x-2 rounded-lg border border-slate-200 p-3">
|
||||
<RadioGroupItem value="pageUrl" id="pageUrl" className="bg-slate-50" />
|
||||
<Label htmlFor="pageUrl" className="cursor-pointer">
|
||||
Page URL
|
||||
</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2 rounded-lg bg-slate-50 p-3">
|
||||
<RadioGroupItem disabled value="innerHtml" id="innerHtml" className="bg-slate-50" />
|
||||
<Label
|
||||
htmlFor="innerHtml"
|
||||
className="flex cursor-not-allowed items-center text-slate-500">
|
||||
Inner Text
|
||||
</Label>
|
||||
</div>
|
||||
<div className="hidden items-center space-x-2 rounded-lg bg-slate-50 p-3 md:flex">
|
||||
<RadioGroupItem disabled value="cssSelector" id="cssSelector" className="bg-slate-50" />
|
||||
<Label
|
||||
htmlFor="cssSelector"
|
||||
className="flex cursor-not-allowed items-center text-slate-500">
|
||||
CSS Selector
|
||||
</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-x-2">
|
||||
<div>
|
||||
<Label>Name</Label>
|
||||
<Input placeholder="e.g. Dashboard Page View" defaultValue="Dashboard view" />
|
||||
</div>
|
||||
<div>
|
||||
<Label>Description</Label>
|
||||
<Input placeholder="e.g. User visited dashboard" defaultValue="User visited dashboard" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid w-full grid-cols-3 gap-x-8">
|
||||
<div className="col-span-1">
|
||||
<Label>URL</Label>
|
||||
|
||||
<Select defaultValue="endsWith">
|
||||
<SelectTrigger
|
||||
className="w-[110px] md:w-[180px]"
|
||||
onClick={(e) => e.preventDefault()}
|
||||
disabled>
|
||||
<SelectValue placeholder="Select match type" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="exactMatch">Exactly matches</SelectItem>
|
||||
<SelectItem value="contains">Contains</SelectItem>
|
||||
<SelectItem value="startsWith">Starts with</SelectItem>
|
||||
<SelectItem value="endsWith">Ends with</SelectItem>
|
||||
<SelectItem value="notMatch">Does not exactly match</SelectItem>
|
||||
<SelectItem value="notContains">Does not contain</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="col-span-2 flex w-full items-end">
|
||||
<Input type="text" defaultValue="/dashboard" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end border-t border-slate-200 p-6">
|
||||
<div className="flex space-x-2">
|
||||
<Button
|
||||
variant="minimal"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
setOpen(false);
|
||||
}}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
setOpen(false);
|
||||
}}>
|
||||
Add event
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
9
apps/formbricks-com/components/dummyUI/Headline.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
export default function Headline({ headline, questionId }: { headline: string; questionId: string }) {
|
||||
return (
|
||||
<label
|
||||
htmlFor={questionId}
|
||||
className="block text-base font-semibold leading-6 text-slate-900 dark:text-slate-100">
|
||||
{headline}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
23
apps/formbricks-com/components/dummyUI/Modal.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import clsx from "clsx";
|
||||
import { ReactNode, useEffect, useState } from "react";
|
||||
|
||||
export default function Modal({ children, isOpen }: { children: ReactNode; isOpen: boolean }) {
|
||||
const [show, setShow] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setShow(isOpen);
|
||||
}, [isOpen]);
|
||||
return (
|
||||
<div aria-live="assertive" className="pointer-events-none flex items-end px-4 py-6 sm:p-6">
|
||||
<div className="flex w-full flex-col items-center space-y-4 sm:items-end">
|
||||
<div
|
||||
className={clsx(
|
||||
show ? "translate-x-0 opacity-100" : "translate-x-28 opacity-0",
|
||||
"pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white px-4 py-6 shadow-lg ring-1 ring-black ring-opacity-5 transition-all duration-500 ease-in-out dark:bg-slate-700 sm:p-6"
|
||||
)}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import clsx from "clsx";
|
||||
import type { MultipleChoiceSingleQuestion } from "./questionTypes";
|
||||
import { useState } from "react";
|
||||
import Headline from "./Headline";
|
||||
import Subheader from "./Subheader";
|
||||
|
||||
interface MultipleChoiceSingleProps {
|
||||
question: MultipleChoiceSingleQuestion;
|
||||
onSubmit: (data: { [x: string]: any }) => void;
|
||||
lastQuestion: boolean;
|
||||
brandColor: string;
|
||||
}
|
||||
|
||||
export default function MultipleChoiceSingleQuestion({
|
||||
question,
|
||||
onSubmit,
|
||||
lastQuestion,
|
||||
brandColor,
|
||||
}: MultipleChoiceSingleProps) {
|
||||
const [selectedChoice, setSelectedChoice] = useState<string | null>(null);
|
||||
return (
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const data = {
|
||||
[question.id]: e.currentTarget[question.id].value,
|
||||
};
|
||||
console.log(data);
|
||||
e.currentTarget[question.id].value = "";
|
||||
onSubmit(data);
|
||||
// reset form
|
||||
}}>
|
||||
<Headline headline={question.headline} questionId={question.id} />
|
||||
<Subheader subheader={question.subheader} questionId={question.id} />
|
||||
<div className="mt-4">
|
||||
<fieldset>
|
||||
<legend className="sr-only">Choices</legend>
|
||||
<div className="relative space-y-2 rounded-md">
|
||||
{question.choices &&
|
||||
question.choices.map((choice) => (
|
||||
<label
|
||||
key={choice.id}
|
||||
className={clsx(
|
||||
selectedChoice === choice.label
|
||||
? "z-10 border-slate-400 bg-slate-50 dark:border-slate-600 dark:bg-slate-600"
|
||||
: "border-gray-200 dark:border-slate-500",
|
||||
"relative flex cursor-pointer flex-col rounded-md border p-4 hover:bg-slate-50 focus:outline-none dark:hover:bg-slate-600"
|
||||
)}>
|
||||
<span className="flex items-center text-sm">
|
||||
<input
|
||||
type="radio"
|
||||
id={choice.id}
|
||||
name={question.id}
|
||||
value={choice.label}
|
||||
className="h-4 w-4 border border-gray-300 focus:ring-0 focus:ring-offset-0 dark:bg-slate-500"
|
||||
aria-labelledby={`${choice.id}-label`}
|
||||
onChange={(e) => {
|
||||
setSelectedChoice(e.currentTarget.value);
|
||||
}}
|
||||
style={{ borderColor: brandColor, color: brandColor }}
|
||||
/>
|
||||
<span
|
||||
id={`${choice.id}-label`}
|
||||
className="ml-3 font-medium text-slate-800 dark:text-slate-300">
|
||||
{choice.label}
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div className="mt-4 flex w-full justify-between">
|
||||
<div></div>
|
||||
<button
|
||||
type="submit"
|
||||
className="flex items-center rounded-md border border-transparent px-3 py-3 text-base font-medium leading-4 text-white shadow-sm hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2"
|
||||
style={{ backgroundColor: brandColor }}>
|
||||
{question.buttonLabel || (lastQuestion ? "Finish" : "Next")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
48
apps/formbricks-com/components/dummyUI/OpenTextQuestion.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import type { OpenTextQuestion } from "./questionTypes";
|
||||
import Headline from "./Headline";
|
||||
import Subheader from "./Subheader";
|
||||
|
||||
interface OpenTextQuestionProps {
|
||||
question: OpenTextQuestion;
|
||||
onSubmit: (id: string) => void;
|
||||
lastQuestion: boolean;
|
||||
brandColor: string;
|
||||
}
|
||||
|
||||
export default function OpenTextQuestion({
|
||||
question,
|
||||
onSubmit,
|
||||
lastQuestion,
|
||||
brandColor,
|
||||
}: OpenTextQuestionProps) {
|
||||
return (
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const data = "Pupsi";
|
||||
onSubmit(data);
|
||||
// reset form
|
||||
}}>
|
||||
<Headline headline={question.headline} questionId={question.id} />
|
||||
<Subheader subheader={question.subheader} questionId={question.id} />
|
||||
<div className="mt-4">
|
||||
<textarea
|
||||
rows={3}
|
||||
name={question.id}
|
||||
id={question.id}
|
||||
placeholder={question.placeholder}
|
||||
required={question.required}
|
||||
className="block w-full rounded-md border border-slate-100 bg-slate-50 p-2 shadow-sm focus:border-slate-500 focus:ring-0 dark:bg-slate-500 dark:text-white sm:text-sm"></textarea>
|
||||
</div>
|
||||
<div className="mt-4 flex w-full justify-between">
|
||||
<div></div>
|
||||
<button
|
||||
type="submit"
|
||||
className="flex items-center rounded-md border border-transparent px-3 py-3 text-base font-medium leading-4 text-white shadow-sm hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2"
|
||||
style={{ backgroundColor: brandColor }}>
|
||||
{question.buttonLabel || (lastQuestion ? "Finish" : "Next")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
25
apps/formbricks-com/components/dummyUI/PreviewModal.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import clsx from "clsx";
|
||||
import { ReactNode, useEffect, useState } from "react";
|
||||
|
||||
export default function Modal({ children, isOpen }: { children: ReactNode; isOpen: boolean }) {
|
||||
const [show, setShow] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setShow(isOpen);
|
||||
}, [isOpen]);
|
||||
return (
|
||||
<div
|
||||
aria-live="assertive"
|
||||
className="pointer-events-none absolute inset-0 flex items-end px-4 py-6 sm:p-6">
|
||||
<div className="flex w-full flex-col items-center space-y-4 sm:items-end">
|
||||
<div
|
||||
className={clsx(
|
||||
show ? "translate-x-0 opacity-100" : "translate-x-28 opacity-0",
|
||||
"pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white px-4 py-6 shadow-lg ring-1 ring-black ring-opacity-5 transition-all duration-500 ease-in-out sm:p-6"
|
||||
)}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
76
apps/formbricks-com/components/dummyUI/PreviewSurvey.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import Modal from "./Modal";
|
||||
import type { Question } from "./questionTypes";
|
||||
import MultipleChoiceSingleQuestion from "./MultipleChoiceSingleQuestion";
|
||||
import OpenTextQuestion from "./OpenTextQuestion";
|
||||
|
||||
interface PreviewSurveyProps {
|
||||
activeQuestionId?: string | null;
|
||||
questions: Question[];
|
||||
brandColor: string;
|
||||
}
|
||||
|
||||
export default function PreviewSurvey({ activeQuestionId, questions, brandColor }: PreviewSurveyProps) {
|
||||
const [isModalOpen, setIsModalOpen] = useState(true);
|
||||
const [currentQuestion, setCurrentQuestion] = useState<Question | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (activeQuestionId) {
|
||||
if (currentQuestion && currentQuestion.id === activeQuestionId) {
|
||||
setCurrentQuestion(questions.find((q) => q.id === activeQuestionId) || null);
|
||||
return;
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
setTimeout(() => {
|
||||
setCurrentQuestion(questions.find((q) => q.id === activeQuestionId) || null);
|
||||
setIsModalOpen(true);
|
||||
}, 300);
|
||||
} else {
|
||||
if (questions && questions.length > 0) {
|
||||
setCurrentQuestion(questions[0]);
|
||||
}
|
||||
}
|
||||
}, [activeQuestionId, questions]);
|
||||
|
||||
const gotoNextQuestion = () => {
|
||||
if (currentQuestion) {
|
||||
const currentIndex = questions.findIndex((q) => q.id === currentQuestion.id);
|
||||
if (currentIndex < questions.length - 1) {
|
||||
setCurrentQuestion(questions[currentIndex + 1]);
|
||||
} else {
|
||||
// start over
|
||||
setIsModalOpen(false);
|
||||
setTimeout(() => {
|
||||
setCurrentQuestion(questions[0]);
|
||||
setIsModalOpen(true);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (!currentQuestion) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const lastQuestion = currentQuestion.id === questions[questions.length - 1].id;
|
||||
|
||||
return (
|
||||
<Modal isOpen={isModalOpen}>
|
||||
{currentQuestion.type === "openText" ? (
|
||||
<OpenTextQuestion
|
||||
question={currentQuestion}
|
||||
onSubmit={() => gotoNextQuestion()}
|
||||
lastQuestion={lastQuestion}
|
||||
brandColor={brandColor}
|
||||
/>
|
||||
) : currentQuestion.type === "multipleChoiceSingle" ? (
|
||||
<MultipleChoiceSingleQuestion
|
||||
question={currentQuestion}
|
||||
onSubmit={() => gotoNextQuestion()}
|
||||
lastQuestion={lastQuestion}
|
||||
brandColor={brandColor}
|
||||
/>
|
||||
) : null}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
9
apps/formbricks-com/components/dummyUI/Progress.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
export default function Progress({ progress, brandColor }: { progress: number; brandColor: string }) {
|
||||
return (
|
||||
<div className="h-1 w-full rounded-full bg-slate-200">
|
||||
<div
|
||||
className="h-1 rounded-full bg-slate-700"
|
||||
style={{ backgroundColor: brandColor, width: `${Math.floor(progress * 100)}%` }}></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
9
apps/formbricks-com/components/dummyUI/Subheader.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
export default function Subheader({ subheader, questionId }: { subheader?: string; questionId: string }) {
|
||||
return (
|
||||
<label
|
||||
htmlFor={questionId}
|
||||
className="mt-2 block text-sm font-normal leading-6 text-slate-500 dark:text-slate-400">
|
||||
{subheader}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
209
apps/formbricks-com/components/dummyUI/TemplateList.tsx
Normal file
@@ -0,0 +1,209 @@
|
||||
import { OnboardingIcon } from "@formbricks/ui";
|
||||
import { PlusCircleIcon } from "@heroicons/react/24/outline";
|
||||
import { createId } from "@paralleldrive/cuid2";
|
||||
import clsx from "clsx";
|
||||
import { useState } from "react";
|
||||
import PreviewSurvey from "./PreviewSurvey";
|
||||
import { templates } from "./templates";
|
||||
import type { Template } from "./templateTypes";
|
||||
|
||||
export default function TemplateList() {
|
||||
const onboardingSegmentation: Template = {
|
||||
name: "Onboarding Segmentation",
|
||||
icon: OnboardingIcon,
|
||||
category: "Product Management",
|
||||
description: "Learn more about who signed up to your product and why.",
|
||||
preset: {
|
||||
name: "Onboarding Segmentation",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What is your role?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Founder",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Executive",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Product Manager",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Product Owner",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Software Engineer",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What's your company size?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "only me",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "1-5 employees",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "6-10 employees",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "11-100 employees",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "over 100 employees",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How did you hear about us first?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Recommendation",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Social Media",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Ads",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Google Search",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "in a Podcast",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const [activeTemplate, setActiveTemplate] = useState<Template | null>(onboardingSegmentation);
|
||||
const [selectedFilter, setSelectedFilter] = useState("All");
|
||||
const categories = [
|
||||
"All",
|
||||
...(Array.from(new Set(templates.map((template) => template.category))) as string[]),
|
||||
];
|
||||
|
||||
const customSurvey: Template = {
|
||||
name: "Custom Survey",
|
||||
description: "Create your survey from scratch.",
|
||||
icon: null,
|
||||
preset: {
|
||||
name: "New Survey",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "What's poppin?",
|
||||
subheader: "This can help us improve your experience.",
|
||||
placeholder: "Type your answer here...",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="hidden h-full flex-col lg:flex">
|
||||
<div className="relative z-0 flex flex-1 overflow-hidden">
|
||||
<main className="relative z-0 max-h-[90vh] flex-1 overflow-y-auto rounded-l-lg bg-slate-100 py-6 px-6 focus:outline-none dark:bg-slate-700">
|
||||
<div className="mb-6 flex space-x-2">
|
||||
{categories.map((category) => (
|
||||
<button
|
||||
key={category}
|
||||
type="button"
|
||||
onClick={() => setSelectedFilter(category)}
|
||||
className={clsx(
|
||||
selectedFilter === category
|
||||
? "text-brand-dark border-brand-dark font-semibold"
|
||||
: "border-slate-300 text-slate-700 hover:bg-slate-100 dark:border-slate-600 dark:text-slate-400",
|
||||
"rounded border bg-slate-50 px-3 py-1 text-xs transition-all duration-150 dark:bg-slate-800 "
|
||||
)}>
|
||||
{category}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
{templates
|
||||
.filter((template) => selectedFilter === "All" || template.category === selectedFilter)
|
||||
.map((template: Template) => (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setActiveTemplate(template)}
|
||||
key={template.name}
|
||||
className={clsx(
|
||||
activeTemplate?.name === template.name && "ring-brand ring-2",
|
||||
"duration-120 group relative rounded-lg bg-white p-6 shadow transition-all duration-150 hover:scale-105 dark:bg-slate-600"
|
||||
)}>
|
||||
<div className="absolute top-6 right-6 rounded border border-slate-300 bg-slate-50 px-1.5 py-0.5 text-xs text-slate-500 dark:border-slate-500 dark:bg-slate-700 dark:text-slate-300">
|
||||
{template.category}
|
||||
</div>
|
||||
<template.icon className="h-8 w-8" />
|
||||
<h3 className="text-md mt-3 mb-1 text-left font-bold text-slate-700 dark:text-slate-200">
|
||||
{template.name}
|
||||
</h3>
|
||||
<p className="text-left text-xs text-slate-600 dark:text-slate-400">
|
||||
{template.description}
|
||||
</p>
|
||||
</button>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setActiveTemplate(customSurvey)}
|
||||
className={clsx(
|
||||
activeTemplate?.name === customSurvey.name && "ring-brand ring-2",
|
||||
"duration-120 hover:border-brand-dark group relative rounded-lg border-2 border-dashed border-slate-300 bg-transparent p-8 transition-colors duration-150"
|
||||
)}>
|
||||
<PlusCircleIcon className="text-brand-dark h-8 w-8 transition-all duration-150 group-hover:scale-110" />
|
||||
<h3 className="text-md mt-3 mb-1 text-left font-bold text-slate-700 dark:text-slate-200">
|
||||
{customSurvey.name}
|
||||
</h3>
|
||||
<p className="text-left text-xs text-slate-600 dark:text-slate-400">
|
||||
{customSurvey.description}
|
||||
</p>
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
<aside className="group relative hidden max-h-[90vh] flex-1 flex-shrink-0 overflow-hidden rounded-r-lg border-l border-slate-200 bg-slate-200 shadow-inner dark:border-slate-700 dark:bg-slate-800 md:flex md:flex-col">
|
||||
{activeTemplate && (
|
||||
<PreviewSurvey
|
||||
activeQuestionId={null}
|
||||
questions={activeTemplate.preset.questions}
|
||||
brandColor="#00C4B8"
|
||||
/>
|
||||
)}
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
26
apps/formbricks-com/components/dummyUI/questionTypes.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
export type Question = OpenTextQuestion | MultipleChoiceSingleQuestion;
|
||||
|
||||
export interface OpenTextQuestion {
|
||||
id: string;
|
||||
type: "openText";
|
||||
headline: string;
|
||||
subheader?: string;
|
||||
placeholder?: string;
|
||||
buttonLabel?: string;
|
||||
required: boolean;
|
||||
}
|
||||
|
||||
export interface MultipleChoiceSingleQuestion {
|
||||
id: string;
|
||||
type: "multipleChoiceSingle";
|
||||
headline: string;
|
||||
subheader?: string;
|
||||
required: boolean;
|
||||
buttonLabel?: string;
|
||||
choices: Choice[];
|
||||
}
|
||||
|
||||
export interface Choice {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
12
apps/formbricks-com/components/dummyUI/templateTypes.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Question } from "./questionTypes";
|
||||
|
||||
export interface Template {
|
||||
name: string;
|
||||
icon: any;
|
||||
description: string;
|
||||
category?: "Product Management" | "Growth Marketing" | "Increase Revenue";
|
||||
preset: {
|
||||
name: string;
|
||||
questions: Question[];
|
||||
};
|
||||
}
|
||||
704
apps/formbricks-com/components/dummyUI/templates.ts
Normal file
@@ -0,0 +1,704 @@
|
||||
import {
|
||||
AppPieChartIcon,
|
||||
CancelSubscriptionIcon,
|
||||
CashCalculatorIcon,
|
||||
DashboardIcon,
|
||||
DogChaserIcon,
|
||||
DoorIcon,
|
||||
FeedbackIcon,
|
||||
OnboardingIcon,
|
||||
PMFIcon,
|
||||
TaskListSearchIcon,
|
||||
BaseballIcon,
|
||||
CheckMarkIcon,
|
||||
ArrowRightCircleIcon,
|
||||
} from "@formbricks/ui";
|
||||
|
||||
import type { Template } from "./templateTypes";
|
||||
import { createId } from "@paralleldrive/cuid2";
|
||||
|
||||
export const templates: Template[] = [
|
||||
{
|
||||
name: "Onboarding Segmentation",
|
||||
icon: OnboardingIcon,
|
||||
category: "Product Management",
|
||||
description: "Learn more about who signed up to your product and why.",
|
||||
preset: {
|
||||
name: "Onboarding Segmentation",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What is your role?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Founder",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Executive",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Product Manager",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Product Owner",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Software Engineer",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What's your company size?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "only me",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "1-5 employees",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "6-10 employees",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "11-100 employees",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "over 100 employees",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How did you hear about us first?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Recommendation",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Social Media",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Ads",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Google Search",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "in a Podcast",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Product Market Fit Survey",
|
||||
icon: PMFIcon,
|
||||
category: "Product Management",
|
||||
description: "Measure PMF by assessing how disappointed users would be if your product disappeared.",
|
||||
preset: {
|
||||
name: "Product Market Fit Survey",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How disappointed would you be if you could no longer use Formbricks?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Not at all disappointed",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Somewhat disappointed",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Very disappointed",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What is your role?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Founder",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Executive",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Product Manager",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Product Owner",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Software Engineer",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "How can we improve our service for you?",
|
||||
subheader: "Please be as specific as possible.",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Pre-Churn Survey",
|
||||
icon: CancelSubscriptionIcon,
|
||||
category: "Increase Revenue",
|
||||
description: "Find out why people cancel you. These insights are pure gold!",
|
||||
preset: {
|
||||
name: "Churn Survey",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "Why do you cancel your subscription?",
|
||||
subheader: "We're sorry to see you leave. Please help us do better:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "I don't get much value out of it",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It's too expensive",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "I am missing a feature",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Poor customer service",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "I just don't need you anymore",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "Is there something we can do to win you back?",
|
||||
subheader: "Feel free to speak your mind, we do too.",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Feature Chaser",
|
||||
icon: DogChaserIcon,
|
||||
category: "Product Management",
|
||||
description: "Follow up with users who just used a specific feature.",
|
||||
preset: {
|
||||
name: "Feature Chaser",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How easy was it to achieve your goal?",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Extremely difficult",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It took a while, but I got it",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It was alright",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Quite easy",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Very easy, love it!",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "Wanna add something?",
|
||||
subheader: "This really helps us do better!",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "Feedback Box",
|
||||
icon: FeedbackIcon,
|
||||
category: "Product Management",
|
||||
description: "Give your users the chance to seamlessly share what's on their minds.",
|
||||
preset: {
|
||||
name: "Feedback Box",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What's on your mind, boss?",
|
||||
subheader: "Thanks for sharing feedback. We'll get back to you asap.",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Bug report 🐞",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Feature Request 💡",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Share some love 🤍",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "Give us the juicy details:",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "Uncover Strengths & Weaknesses",
|
||||
icon: TaskListSearchIcon,
|
||||
category: "Growth Marketing",
|
||||
description: "Find out what users like and don't like about your product or offering.",
|
||||
preset: {
|
||||
name: "Uncover Strengths & Weaknesses",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What do you value most about our service?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Ease of use",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Good value for money",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It's open-source",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "The founders are pretty",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What should we improve on?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Documentation",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Customizability",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Pricing",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Humbleness of founders",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "Would you like to add something?",
|
||||
subheader: "Feel free to speak your mind, we do too.",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Marketing Attribution",
|
||||
icon: AppPieChartIcon,
|
||||
category: "Growth Marketing",
|
||||
description: "How did you first hear about us?",
|
||||
preset: {
|
||||
name: "Marketing Attribution",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How did you hear about us first?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Recommendation",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Social Media",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Ads",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Google Search",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "in a Podcast",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "Missed Trial Conversion",
|
||||
icon: BaseballIcon,
|
||||
category: "Increase Revenue",
|
||||
description: "Find out why people stopped their trial. These insights help you improve your funnel.",
|
||||
preset: {
|
||||
name: "Missed Trial Conversion",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "Why did you stop your trial?",
|
||||
subheader: "Help us understand you better. Choose one option:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "I didn't get much value out of it",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "I expected something else",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It's too expensive for what it does",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "I am missing a feature",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "I was just looking around",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "Did you find a better alternative? Please name it:",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Changing subscription experience",
|
||||
icon: CashCalculatorIcon,
|
||||
category: "Increase Revenue",
|
||||
description: "Find out what goes through peoples minds when changing their subscriptions.",
|
||||
preset: {
|
||||
name: "Changing subscription experience",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How easy was it to change your plan?",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Extremely difficult",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It took a while, but I got it",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It was alright",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Quite easy",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Very easy, love it!",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "Is the pricing information easy to understand?",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Yes, very clear.",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "I was confused at first, but found what I needed.",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Quite complicated.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Measure Task Accomplishment",
|
||||
icon: CheckMarkIcon,
|
||||
category: "Product Management",
|
||||
description: "See if people get their 'Job To Be Done' done. Successful people are better customers.",
|
||||
preset: {
|
||||
name: "Measure Task Accomplishment",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "Were you able to 'accomplish what you came here to do today'?",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Yes",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Working on it, boss",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "No",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "What did you come here to do today?",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Identify Customer Goals",
|
||||
icon: ArrowRightCircleIcon,
|
||||
category: "Product Management",
|
||||
description:
|
||||
"Better understand if your messaging creates the right expectations of the value your product provides.",
|
||||
preset: {
|
||||
name: "Identify Customer Goals",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What's your primary goal for using Formbricks?",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Understand my user base deeply",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Identify upselling opportunities",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Build the best possible product",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Rule the world to make everyone breakfast brussels sprouts.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "Fake Door Follow-Up",
|
||||
icon: DoorIcon,
|
||||
category: "Product Management",
|
||||
description: "Follow up with users who ran into one of your Fake Door experiments.",
|
||||
preset: {
|
||||
name: "Fake Door Follow-Up",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How important is this feature for you?",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Very important",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Not so important",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "I was just looking around",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "Integration usage survey",
|
||||
icon: DashboardIcon,
|
||||
category: "Product Management",
|
||||
description: "Evaluate how easily users can add integrations to your product. Find blind spots.",
|
||||
preset: {
|
||||
name: "Integration Usage Survey",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How easy was it to set this integration up?",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: createId(),
|
||||
label: "Extremely difficult",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It took a while, but I got it",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "It was alright",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Quite easy",
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
label: "Very easy, love it!",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: createId(),
|
||||
type: "openText",
|
||||
headline: "Which product would you like to integrate next?",
|
||||
subheader: "We keep building integrations. Yours can be next:",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
/* {
|
||||
name: "In-app Interview Prompt",
|
||||
icon: OnboardingIcon,
|
||||
description: "Invite a specific subset of your users to schedule an interview with your product team.",
|
||||
preset: {
|
||||
name: "In-app Interview Prompt",
|
||||
questions: [
|
||||
{
|
||||
id: createId(),
|
||||
type: "prompt",
|
||||
headline: "Wanna do a short 15m interview with Charly?",
|
||||
subheader: "That would really help us",
|
||||
buttonLabel: "Book slot",
|
||||
buttonUrl: "https://cal.com/formbricks",
|
||||
},
|
||||
],
|
||||
},s
|
||||
}, */
|
||||
];
|
||||
@@ -1,28 +0,0 @@
|
||||
import { Button } from "@formbricks/ui";
|
||||
|
||||
interface EngineButtonsProps {
|
||||
allowSkip: boolean;
|
||||
skipAction: () => void;
|
||||
autoSubmit: boolean;
|
||||
}
|
||||
|
||||
export function EngineButtons({ allowSkip, skipAction, autoSubmit }: EngineButtonsProps) {
|
||||
return (
|
||||
<div className="mx-auto mt-8 flex w-full max-w-xl justify-end">
|
||||
{allowSkip && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
type="button"
|
||||
className="transition-all ease-in-out hover:scale-105"
|
||||
onClick={() => skipAction()}>
|
||||
Skip
|
||||
</Button>
|
||||
)}
|
||||
{!autoSubmit && (
|
||||
<Button variant="primary" type="submit" className="ml-2 transition-all ease-in-out hover:scale-105">
|
||||
Next
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
import clsx from "clsx";
|
||||
import { useMemo } from "react";
|
||||
import { EngineButtons } from "./EngineButtons";
|
||||
import { SurveyElement } from "./engineTypes";
|
||||
|
||||
interface FeatureSelectionProps {
|
||||
element: SurveyElement;
|
||||
field: any;
|
||||
register: any;
|
||||
control: any;
|
||||
onSubmit: () => void;
|
||||
disabled: boolean;
|
||||
allowSkip: boolean;
|
||||
skipAction: () => void;
|
||||
autoSubmit: boolean;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export default function FeatureSelection({
|
||||
element,
|
||||
field,
|
||||
register,
|
||||
allowSkip,
|
||||
skipAction,
|
||||
autoSubmit,
|
||||
loading,
|
||||
}: FeatureSelectionProps) {
|
||||
const shuffledOptions = useMemo(
|
||||
() => (element.options ? getShuffledArray(element.options) : []),
|
||||
[element.options]
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={clsx(loading && "formbricks-pulse-animation")}>
|
||||
<div className="flex flex-col justify-center">
|
||||
<label
|
||||
htmlFor={element.id}
|
||||
className="pb-6 text-center text-lg font-bold text-slate-600 dark:text-slate-300 sm:text-xl md:text-2xl">
|
||||
{element.label}
|
||||
</label>
|
||||
<fieldset className="space-y-5">
|
||||
<legend className="sr-only">{element.label}</legend>
|
||||
<div className=" mx-auto grid max-w-5xl grid-cols-1 gap-6 px-2 sm:grid-cols-2">
|
||||
{shuffledOptions.map((option) => (
|
||||
<label htmlFor={`${element.id}-${option.value}`} key={`${element.id}-${option.value}`}>
|
||||
<div className="drop-shadow-card duration-120 relative cursor-default rounded-lg border border-slate-200 bg-white p-6 transition-all ease-in-out hover:scale-105 dark:border-slate-700 dark:bg-slate-700">
|
||||
<div className="absolute right-10">
|
||||
<input
|
||||
id={`${element.id}-${option.value}`}
|
||||
aria-describedby={`${element.id}-${option.value}-description`}
|
||||
type="checkbox"
|
||||
value={option.value}
|
||||
className="text-brand focus:ring-brand border-brand h-5 w-5 rounded border-2 bg-slate-50 dark:bg-slate-600"
|
||||
{...register(element.name!)}
|
||||
/>
|
||||
</div>
|
||||
<div className="h-12 w-12">
|
||||
{option.frontend?.icon && <option.frontend.icon className="text-brand h-10 w-10" />}
|
||||
</div>
|
||||
<span className="text-md mt-3 mb-1 font-bold text-slate-700 dark:text-slate-200">
|
||||
{option.label}
|
||||
</span>
|
||||
<p
|
||||
id={`${element.id}-${option.value}-description`}
|
||||
className="mt-1 text-xs text-slate-600 dark:text-slate-400">
|
||||
{option.frontend.description}
|
||||
</p>
|
||||
</div>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<EngineButtons allowSkip={allowSkip} skipAction={skipAction} autoSubmit={autoSubmit} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function getShuffledArray(array: any[]) {
|
||||
const shuffledArray = [...array];
|
||||
for (let i = shuffledArray.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[shuffledArray[i], shuffledArray[j]] = [shuffledArray[j], shuffledArray[i]];
|
||||
}
|
||||
return shuffledArray;
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
import { RadioGroup } from "@headlessui/react";
|
||||
import { CheckCircleIcon } from "@heroicons/react/20/solid";
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Controller, useForm, useWatch } from "react-hook-form";
|
||||
import { EngineButtons } from "./EngineButtons";
|
||||
import { SurveyElement } from "./engineTypes";
|
||||
|
||||
interface IconRadioProps {
|
||||
element: SurveyElement;
|
||||
field: any;
|
||||
control: any;
|
||||
onSubmit: () => void;
|
||||
disabled: boolean;
|
||||
allowSkip: boolean;
|
||||
skipAction: () => void;
|
||||
autoSubmit: boolean;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export default function IconRadio({
|
||||
element,
|
||||
control,
|
||||
onSubmit,
|
||||
disabled,
|
||||
allowSkip,
|
||||
autoSubmit,
|
||||
skipAction,
|
||||
loading,
|
||||
}: IconRadioProps) {
|
||||
const value = useWatch({
|
||||
control,
|
||||
name: element.name!!,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (value && !disabled) {
|
||||
onSubmit();
|
||||
}
|
||||
}, [value, onSubmit, disabled]);
|
||||
|
||||
return (
|
||||
<div className={clsx(loading && "formbricks-pulse-animation")}>
|
||||
<Controller
|
||||
name={element.name!}
|
||||
control={control}
|
||||
rules={{ required: true }}
|
||||
render={({ field }: { field: any }) => (
|
||||
<RadioGroup className="flex flex-col justify-center" {...field}>
|
||||
<RadioGroup.Label className="pb-6 text-center text-lg font-bold text-slate-600 dark:text-slate-300 sm:text-xl md:text-2xl">
|
||||
{element.label}
|
||||
</RadioGroup.Label>
|
||||
<div className="mx-auto -mt-3 mb-3 text-center text-sm text-slate-500 dark:text-slate-300 md:max-w-lg">
|
||||
{element.help}
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={clsx(
|
||||
element.options && element.options.length >= 4
|
||||
? "lg:grid-cols-4"
|
||||
: element.options?.length === 3
|
||||
? "lg:grid-cols-3"
|
||||
: element.options?.length === 2
|
||||
? "lg:grid-cols-2"
|
||||
: "lg:grid-cols-1",
|
||||
"mt-4 grid w-full gap-y-6 sm:gap-x-4"
|
||||
)}>
|
||||
{element.options &&
|
||||
element.options.map((option) => (
|
||||
<RadioGroup.Option
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
className={({ checked, active }) =>
|
||||
clsx(
|
||||
checked ? "border-transparent" : "border-slate-200 dark:border-slate-700",
|
||||
active ? "border-brand ring-brand ring-2" : "",
|
||||
"relative flex cursor-pointer rounded-lg border bg-white py-8 shadow-sm transition-all ease-in-out hover:scale-105 focus:outline-none dark:bg-slate-700"
|
||||
)
|
||||
}>
|
||||
{({ checked, active }) => (
|
||||
<>
|
||||
<div className="flex flex-1 flex-col justify-center text-slate-500 hover:text-slate-700 dark:text-slate-400 hover:dark:text-slate-200">
|
||||
{option.frontend?.icon && (
|
||||
<option.frontend.icon
|
||||
className="text-brand mx-auto mb-3 h-8 w-8"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)}
|
||||
<RadioGroup.Label as="span" className="mx-auto text-sm font-medium ">
|
||||
{option.label}
|
||||
</RadioGroup.Label>
|
||||
</div>
|
||||
|
||||
<CheckCircleIcon
|
||||
className={clsx(
|
||||
!checked ? "invisible" : "",
|
||||
"text-brand absolute -right-2 -top-2 z-10 h-5 w-5 rounded-full bg-white"
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span
|
||||
className={clsx(
|
||||
active ? "border" : "border-2",
|
||||
checked ? "border-brand" : "border-transparent",
|
||||
"pointer-events-none absolute -inset-px rounded-lg"
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</RadioGroup.Option>
|
||||
))}
|
||||
</div>
|
||||
</RadioGroup>
|
||||
)}
|
||||
/>
|
||||
<EngineButtons allowSkip={allowSkip} skipAction={skipAction} autoSubmit={autoSubmit} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
import clsx from "clsx";
|
||||
import { EngineButtons } from "./EngineButtons";
|
||||
import { SurveyElement } from "./engineTypes";
|
||||
|
||||
interface TextareaProps {
|
||||
element: SurveyElement;
|
||||
field: any;
|
||||
register: any;
|
||||
disabled: boolean;
|
||||
allowSkip: boolean;
|
||||
skipAction: () => void;
|
||||
onSubmit: () => void;
|
||||
autoSubmit: boolean;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export default function Input({
|
||||
element,
|
||||
field,
|
||||
register,
|
||||
disabled,
|
||||
onSubmit,
|
||||
skipAction,
|
||||
allowSkip,
|
||||
autoSubmit,
|
||||
loading,
|
||||
}: TextareaProps) {
|
||||
return (
|
||||
<div className={clsx(loading && "formbricks-pulse-animation")}>
|
||||
<div className="flex flex-col justify-center">
|
||||
<label
|
||||
htmlFor={element.id}
|
||||
className="pb-6 text-center text-lg font-bold text-slate-600 dark:text-slate-300 sm:text-xl md:text-2xl">
|
||||
{element.label}
|
||||
</label>
|
||||
<input
|
||||
type={element.frontend?.type || "text"}
|
||||
onBlur=""
|
||||
className="focus:border-brand focus:ring-brand mx-auto mt-4 block w-full max-w-xl rounded-md border-slate-300 text-slate-700 shadow-sm dark:bg-slate-700 dark:text-slate-200 dark:placeholder:text-slate-400 dark:focus:bg-slate-700 dark:active:bg-slate-700 sm:text-sm"
|
||||
placeholder={element.frontend?.placeholder || ""}
|
||||
required={!!element.frontend?.required}
|
||||
{...register(element.name!)}
|
||||
/>
|
||||
</div>
|
||||
<EngineButtons allowSkip={allowSkip} skipAction={skipAction} autoSubmit={autoSubmit} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
export default function Progressbar({ progress }: { progress: number }) {
|
||||
return (
|
||||
<div className="h-1.5 w-full rounded-full bg-slate-200 dark:bg-slate-700">
|
||||
<div
|
||||
className="h-1.5 rounded-full bg-slate-700 dark:bg-slate-300"
|
||||
style={{ width: `${Math.floor(progress * 100)}%` }}></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
import { RadioGroup } from "@headlessui/react";
|
||||
import { CheckCircleIcon } from "@heroicons/react/20/solid";
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Controller, useForm, useWatch } from "react-hook-form";
|
||||
import { EngineButtons } from "./EngineButtons";
|
||||
import { SurveyElement } from "./engineTypes";
|
||||
|
||||
interface IconRadioProps {
|
||||
element: SurveyElement;
|
||||
field: any;
|
||||
control: any;
|
||||
onSubmit: () => void;
|
||||
disabled: boolean;
|
||||
allowSkip: boolean;
|
||||
skipAction: () => void;
|
||||
autoSubmit: boolean;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export default function Scale({
|
||||
element,
|
||||
control,
|
||||
onSubmit,
|
||||
disabled,
|
||||
allowSkip,
|
||||
skipAction,
|
||||
autoSubmit,
|
||||
loading,
|
||||
}: IconRadioProps) {
|
||||
const value = useWatch({
|
||||
control,
|
||||
name: element.name!!,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (value && !disabled) {
|
||||
onSubmit();
|
||||
}
|
||||
}, [value, onSubmit, disabled]);
|
||||
return (
|
||||
<div className={clsx(loading && "formbricks-pulse-animation")}>
|
||||
<Controller
|
||||
name={element.name!}
|
||||
control={control}
|
||||
rules={{ required: true }}
|
||||
render={({ field }: { field: any }) => (
|
||||
<RadioGroup className="flex flex-col justify-center" {...field}>
|
||||
<RadioGroup.Label className="pb-6 text-center text-lg font-bold text-slate-600 dark:text-slate-300 sm:text-xl md:text-2xl">
|
||||
{element.label}
|
||||
</RadioGroup.Label>
|
||||
<div
|
||||
className={clsx(
|
||||
element.frontend.max &&
|
||||
element.frontend.min &&
|
||||
element.frontend.max - element.frontend.min + 1 >= 11
|
||||
? "grid-cols-11"
|
||||
: element.frontend.max - element.frontend.min + 1 === 10
|
||||
? "grid-cols-10"
|
||||
: element.frontend.max - element.frontend.min + 1 === 9
|
||||
? "grid-cols-9"
|
||||
: element.frontend.max - element.frontend.min + 1 === 8
|
||||
? "grid-cols-8"
|
||||
: element.frontend.max - element.frontend.min + 1 === 7
|
||||
? "grid-cols-7"
|
||||
: element.frontend.max - element.frontend.min + 1 === 6
|
||||
? "grid-cols-6"
|
||||
: element.frontend.max - element.frontend.min + 1 === 5
|
||||
? "grid-cols-5"
|
||||
: element.frontend.max - element.frontend.min + 1 === 4
|
||||
? "grid-cols-4"
|
||||
: element.frontend.max - element.frontend.min + 1 === 3
|
||||
? "grid-cols-3"
|
||||
: element.frontend.max - element.frontend.min + 1 === 2
|
||||
? "grid-cols-2"
|
||||
: "grid-cols-1",
|
||||
"mt-4 grid w-full gap-x-1 sm:gap-x-2"
|
||||
)}>
|
||||
{Array.from(
|
||||
{ length: element.frontend.max - element.frontend.min + 1 },
|
||||
(_, i) => i + element.frontend.min
|
||||
).map((num) => (
|
||||
<RadioGroup.Option
|
||||
key={num}
|
||||
value={num}
|
||||
className={({ checked, active }) =>
|
||||
clsx(
|
||||
checked ? "border-transparent" : "border-slate-200 dark:border-slate-700",
|
||||
active ? "border-brand ring-brand ring-2" : "",
|
||||
"xs:rounded-lg relative flex cursor-pointer rounded-md border bg-white py-3 shadow-sm transition-all ease-in-out hover:scale-105 focus:outline-none dark:bg-slate-700 sm:p-4"
|
||||
)
|
||||
}>
|
||||
{({ checked, active }) => (
|
||||
<>
|
||||
<div className="flex flex-1 flex-col justify-center">
|
||||
<RadioGroup.Label
|
||||
as="span"
|
||||
className="mx-auto text-sm font-medium text-slate-900 dark:text-slate-200">
|
||||
{num}
|
||||
</RadioGroup.Label>
|
||||
</div>
|
||||
|
||||
<CheckCircleIcon
|
||||
className={clsx(
|
||||
!checked ? "invisible" : "",
|
||||
"text-brand absolute -right-2 -top-2 z-10 h-5 w-5 rounded-full bg-white"
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span
|
||||
className={clsx(
|
||||
active ? "border" : "border-2",
|
||||
checked ? "border-brand" : "border-transparent",
|
||||
"pointer-events-none absolute -inset-px rounded-lg"
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</RadioGroup.Option>
|
||||
))}
|
||||
</div>
|
||||
<div className="xs:text-sm mt-2 flex justify-between text-xs text-slate-700 dark:text-slate-400">
|
||||
<p>{element.frontend.minLabel}</p>
|
||||
<p>{element.frontend.maxLabel}</p>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
)}
|
||||
/>
|
||||
<EngineButtons allowSkip={allowSkip} skipAction={skipAction} autoSubmit={autoSubmit} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { Survey } from "./engineTypes";
|
||||
import Progressbar from "./Progressbar";
|
||||
import { SurveyPage } from "./SurveyPage";
|
||||
|
||||
interface SurveyProps {
|
||||
survey: Survey;
|
||||
formbricksUrl: string;
|
||||
formId: string;
|
||||
}
|
||||
|
||||
export function Survey({ survey, formbricksUrl, formId }: SurveyProps) {
|
||||
const [currentPage, setCurrentPage] = useState(survey.pages[0]);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [submission, setSubmission] = useState<any>({});
|
||||
const [finished, setFinished] = useState(false);
|
||||
|
||||
const schema = useMemo(() => generateSchema(survey), [survey]);
|
||||
|
||||
useEffect(() => {
|
||||
// warmup request
|
||||
fetch(`${formbricksUrl}/api/capture/forms/${formId}/submissions`, {
|
||||
method: "OPTIONS",
|
||||
});
|
||||
});
|
||||
|
||||
const navigateToNextPage = (currentSubmission: any) => {
|
||||
const nextPage = calculateNextPage(survey, currentSubmission);
|
||||
setCurrentPage(nextPage);
|
||||
if (nextPage.endScreen) {
|
||||
setFinished(true);
|
||||
setProgress(1);
|
||||
} else {
|
||||
const nextPageIdx = survey.pages.findIndex((p) => p.id === nextPage.id);
|
||||
setProgress(nextPageIdx / survey.pages.length);
|
||||
}
|
||||
};
|
||||
|
||||
const calculateNextPage = (survey: Survey, submission: any) => {
|
||||
if (currentPage.branchingRules) {
|
||||
for (const rule of currentPage.branchingRules) {
|
||||
if (rule.type === "value") {
|
||||
if (rule.value === submission[rule.name]) {
|
||||
const nextPage = survey.pages.find((p) => p.id === rule.nextPageId);
|
||||
if (!nextPage) {
|
||||
throw new Error(`Next page ${rule.nextPageId} not found`);
|
||||
}
|
||||
return nextPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const currentPageIdx = survey.pages.findIndex((p) => p.id === currentPage.id);
|
||||
return survey.pages[currentPageIdx + 1];
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col">
|
||||
{!(survey.config?.progressBar === false) && (
|
||||
<div className="mb-8 h-3">
|
||||
<Progressbar progress={progress} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<SurveyPage
|
||||
page={currentPage}
|
||||
onSkip={() => navigateToNextPage(submission)}
|
||||
onSubmit={(updatedSubmission) => navigateToNextPage(updatedSubmission)}
|
||||
submission={submission}
|
||||
setSubmission={setSubmission}
|
||||
finished={finished}
|
||||
formbricksUrl={formbricksUrl}
|
||||
formId={formId}
|
||||
schema={schema}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function generateSchema(survey: Survey) {
|
||||
const schema: any = JSON.parse(JSON.stringify(survey));
|
||||
deleteProps(schema, "frontend");
|
||||
return schema;
|
||||
}
|
||||
|
||||
function deleteProps(obj: any, propName: string) {
|
||||
if (Array.isArray(obj)) {
|
||||
for (let v of obj) {
|
||||
if (v instanceof Object) {
|
||||
deleteProps(v, propName);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
delete obj[propName];
|
||||
for (let v of Object.values(obj)) {
|
||||
if (v instanceof Object) {
|
||||
deleteProps(v, propName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
import clsx from "clsx";
|
||||
import { usePlausible } from "next-plausible";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { Button } from "@formbricks/ui";
|
||||
import { SurveyPage } from "./engineTypes";
|
||||
|
||||
interface SurveyProps {
|
||||
page: SurveyPage;
|
||||
onSkip: () => void;
|
||||
onSubmit: (submission: any) => void;
|
||||
submission: any;
|
||||
setSubmission: (v: any) => void;
|
||||
finished: boolean;
|
||||
formbricksUrl: string;
|
||||
formId: string;
|
||||
schema: any;
|
||||
}
|
||||
|
||||
export function SurveyPage({
|
||||
page,
|
||||
onSkip,
|
||||
onSubmit,
|
||||
submission,
|
||||
setSubmission,
|
||||
finished,
|
||||
formbricksUrl,
|
||||
formId,
|
||||
schema,
|
||||
}: SurveyProps) {
|
||||
const [submissionId, setSubmissionId] = useState<string>();
|
||||
const {
|
||||
handleSubmit,
|
||||
control,
|
||||
register,
|
||||
reset,
|
||||
formState: { errors },
|
||||
} = useForm();
|
||||
const plausible = usePlausible();
|
||||
const [submittingPage, setSubmittingPage] = useState(false);
|
||||
const formRef = useRef<HTMLFormElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
reset();
|
||||
}, [page, reset]);
|
||||
|
||||
useEffect(() => {
|
||||
if (page.endScreen) {
|
||||
fetch(`${formbricksUrl}/api/capture/forms/${formId}/submissions/${submissionId}`, {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ finished: true }),
|
||||
});
|
||||
plausible("waitlistFinished");
|
||||
}
|
||||
}, [page, formId, formbricksUrl, submissionId, plausible]);
|
||||
|
||||
const sendToFormbricks = async (partialSubmission: any) => {
|
||||
const submissionBody: any = { data: partialSubmission };
|
||||
if (page.config?.addFieldsToCustomer && Array.isArray(page.config?.addFieldsToCustomer)) {
|
||||
for (const field of page.config?.addFieldsToCustomer) {
|
||||
if (field in partialSubmission) {
|
||||
if (!("customer" in submissionBody)) {
|
||||
submissionBody.customer = {};
|
||||
}
|
||||
submissionBody.customer[field] = partialSubmission[field];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!submissionId) {
|
||||
const res = await Promise.all([
|
||||
fetch(`${formbricksUrl}/api/capture/forms/${formId}/submissions`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(submissionBody),
|
||||
}),
|
||||
fetch(`${formbricksUrl}/api/capture/forms/${formId}/schema`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(schema),
|
||||
}),
|
||||
]);
|
||||
if (!res[0].ok || !res[1].ok) {
|
||||
alert("There was an error sending this form. Please contact us at hola@formbricks.com");
|
||||
return;
|
||||
}
|
||||
const submission = await res[0].json();
|
||||
setSubmissionId(submission.id);
|
||||
} else {
|
||||
const res = await fetch(`${formbricksUrl}/api/capture/forms/${formId}/submissions/${submissionId}`, {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(submissionBody),
|
||||
});
|
||||
if (!res.ok) {
|
||||
alert("There was an error sending this form. Please contact us at hola@formbricks.com");
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const submitPage = async (data: any) => {
|
||||
setSubmittingPage(true);
|
||||
const updatedSubmission = { ...submission, ...data };
|
||||
setSubmission(updatedSubmission);
|
||||
try {
|
||||
await sendToFormbricks(data);
|
||||
setSubmittingPage(false);
|
||||
onSubmit(updatedSubmission);
|
||||
plausible(`waitlistSubmitPage-${page.id}`);
|
||||
window.scrollTo(0, 0);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert("There was an error sending this form. Please contact us at hola@formbricks.com");
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmitElement = () => {
|
||||
if (page.config?.autoSubmit && page.elements.length == 1) {
|
||||
formRef.current?.requestSubmit();
|
||||
setSubmittingPage(true);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit(submitPage)} ref={formRef}>
|
||||
<div className="grid grid-cols-1 gap-8">
|
||||
{page.elements.map((element) => {
|
||||
const ElementComponent = element.component;
|
||||
return (
|
||||
<div
|
||||
key={element.id}
|
||||
className={clsx(submittingPage && "animate-[pulse_0.8s_ease-out_infinite]")}>
|
||||
{element.name ? (
|
||||
<ElementComponent
|
||||
element={element}
|
||||
control={control}
|
||||
register={register}
|
||||
onSubmit={() => handleSubmitElement()}
|
||||
disabled={submittingPage}
|
||||
/>
|
||||
) : (
|
||||
<ElementComponent element={element} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{!finished && (
|
||||
<div className="mx-auto mt-8 flex w-full max-w-xl justify-end">
|
||||
{page.config?.allowSkip && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
type="button"
|
||||
className="transition-all ease-in-out hover:scale-105"
|
||||
onClick={() => onSkip()}>
|
||||
Skip
|
||||
</Button>
|
||||
)}
|
||||
{!(page.config?.autoSubmit && page.elements.length == 1) && (
|
||||
<Button
|
||||
variant="primary"
|
||||
type="submit"
|
||||
className="ml-2 transition-all ease-in-out hover:scale-105">
|
||||
Next
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useState } from "react";
|
||||
import { EngineButtons } from "./EngineButtons";
|
||||
import { SurveyElement } from "./engineTypes";
|
||||
|
||||
interface TextareaProps {
|
||||
element: SurveyElement;
|
||||
register: any;
|
||||
onSubmit: () => void;
|
||||
allowSkip: boolean;
|
||||
skipAction: () => void;
|
||||
autoSubmit: boolean;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export default function Textarea({
|
||||
element,
|
||||
register,
|
||||
onSubmit,
|
||||
allowSkip,
|
||||
skipAction,
|
||||
autoSubmit,
|
||||
loading,
|
||||
}: TextareaProps) {
|
||||
return (
|
||||
<div className={clsx(loading && "formbricks-pulse-animation")}>
|
||||
<div className="flex flex-col justify-center">
|
||||
<label
|
||||
htmlFor={element.id}
|
||||
className="pb-6 text-center text-lg font-bold text-slate-600 dark:text-slate-300 sm:text-xl md:text-2xl">
|
||||
{element.label}
|
||||
</label>
|
||||
<textarea
|
||||
rows={element.frontend?.rows || 4}
|
||||
className="focus:border-brand focus:ring-brand mx-auto mt-4 block w-full max-w-xl rounded-md border-slate-300 text-slate-700 shadow-sm dark:bg-slate-700 dark:text-slate-200 dark:placeholder:text-slate-400 sm:text-sm"
|
||||
placeholder={element.frontend?.placeholder || ""}
|
||||
required={!!element.frontend?.required}
|
||||
{...register(element.name!)}
|
||||
/>
|
||||
</div>
|
||||
<EngineButtons allowSkip={allowSkip} skipAction={skipAction} autoSubmit={autoSubmit} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { Confetti } from "@formbricks/ui";
|
||||
import { SurveyElement } from "./engineTypes";
|
||||
|
||||
export default function ThankYouHeading({ element }: { element: SurveyElement }) {
|
||||
return (
|
||||
<div className="text-center">
|
||||
<Confetti />
|
||||
<h2 className="mt-3 text-xl font-bold text-slate-700 dark:text-slate-100 sm:text-2xl ">
|
||||
Thank you! We’re onboarding new users <span className="text-brand">regularly.</span>
|
||||
</h2>
|
||||
<p className="mt-4 text-slate-500 dark:text-slate-300">We will be in touch shortly.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import { Button } from "@formbricks/ui";
|
||||
import { SurveyElement } from "./engineTypes";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export default function ThankYouPlans({ element }: { element: SurveyElement }) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<div className="mx-auto my-10 max-w-md ">
|
||||
{/* <div className="rounded-lg p-6">
|
||||
<div className="flex justify-between text-xl sm:text-2xl">
|
||||
<h3 className="font-bold text-slate-500 dark:text-slate-100">Free Plan</h3>
|
||||
<p className="text-slate-700 dark:text-slate-100">$0</p>
|
||||
</div>
|
||||
<ul className="mt-4 list-inside list-disc text-xs text-slate-500 dark:text-slate-300">
|
||||
<li>100 submissions / month</li>
|
||||
<li>Community support</li>
|
||||
<li>Waitlist</li>
|
||||
</ul>
|
||||
</div> */}
|
||||
<div className="rounded-lg bg-slate-50 p-6 dark:bg-slate-700">
|
||||
<div className="xs:text-xl flex justify-between text-lg sm:text-2xl">
|
||||
<h3 className="font-bold text-slate-500 dark:text-slate-100">Beta User Deal</h3>
|
||||
<p className="font-light text-slate-700 dark:text-slate-100">
|
||||
$49 <span className="line-through">$99</span>
|
||||
</p>
|
||||
</div>
|
||||
<p className="flex justify-end text-xs text-slate-500 dark:text-slate-300">/ Month</p>
|
||||
<ul className=" list-inside list-disc text-xs text-slate-500 dark:text-slate-300">
|
||||
<li className="font-bold">Custom implementation</li>
|
||||
<li>Unlimited submissions</li>
|
||||
<li>Founder onboarding</li>
|
||||
<li>Own support channel</li>
|
||||
<li>Skip waitlist</li>
|
||||
</ul>
|
||||
<div className="mt-4 flex flex-row justify-end sm:mt-0">
|
||||
<Button
|
||||
type="button"
|
||||
target="_blank"
|
||||
onClick={() => router.push("https://buy.stripe.com/28o00R4GDf9qdfa5kp")}>
|
||||
Become Beta User
|
||||
</Button>
|
||||
</div>
|
||||
<div className="mt-2 flex flex-row justify-end">
|
||||
<p className="text-xs text-slate-400 dark:text-slate-300">Cancel anytime</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
export interface SurveyOption {
|
||||
label: string;
|
||||
value: string;
|
||||
frontend?: any;
|
||||
}
|
||||
|
||||
export interface SurveyPage {
|
||||
id: string;
|
||||
endScreen?: boolean;
|
||||
elements: SurveyElement[];
|
||||
config?: {
|
||||
addFieldsToCustomer?: string[];
|
||||
autoSubmit?: boolean;
|
||||
allowSkip?: boolean;
|
||||
};
|
||||
branchingRules?: {
|
||||
type: "value";
|
||||
name: string;
|
||||
value: string;
|
||||
nextPageId: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface SurveyElement {
|
||||
id: string;
|
||||
name?: string;
|
||||
label?: string;
|
||||
help?: string;
|
||||
type: "radio" | "text" | "checkbox" | "html";
|
||||
options?: SurveyOption[];
|
||||
component: React.FC<any>;
|
||||
frontend?: any;
|
||||
}
|
||||
|
||||
export interface Survey {
|
||||
pages: SurveyPage[];
|
||||
config?: {
|
||||
progressBar?: boolean;
|
||||
};
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
import { TabletTouchIcon, UserDeveloperIcon, CodeFileIcon } from "@formbricks/ui";
|
||||
import { EyeIcon, HandPuzzleIcon, CodeFileIcon } from "@formbricks/ui";
|
||||
import HeadingCentered from "../shared/HeadingCentered";
|
||||
|
||||
const features = [
|
||||
{
|
||||
id: "devAttention",
|
||||
name: "Minimal Dev Attention",
|
||||
description: "All you want is building your product. Set it up once, keep insights flowing in.",
|
||||
icon: UserDeveloperIcon,
|
||||
id: "customizable",
|
||||
name: "Fully Customizable",
|
||||
description: "Full customizability and extendability. Integrate with your stack easily.",
|
||||
icon: HandPuzzleIcon,
|
||||
},
|
||||
{
|
||||
id: "nativeLookFeel",
|
||||
name: "Native Look & Feel",
|
||||
description: "No more UX clutter. Use headless forms or highly customizabale UI components.",
|
||||
icon: TabletTouchIcon,
|
||||
id: "compliance",
|
||||
name: "Smoothly Compliant",
|
||||
description: "Self-host the entire product and fly through privacy compliance reviews.",
|
||||
icon: EyeIcon,
|
||||
},
|
||||
{
|
||||
id: "openSourcer",
|
||||
name: "Open Source",
|
||||
description: "Own your data. Run Formbricks on your servers and comply with all regulation.",
|
||||
id: "independent",
|
||||
name: "Stay independent",
|
||||
description: "The code is open-source. Do with it what your organization needs.",
|
||||
icon: CodeFileIcon,
|
||||
},
|
||||
];
|
||||
@@ -27,10 +27,9 @@ export default function Features() {
|
||||
<div className="relative mx-auto max-w-7xl">
|
||||
<HeadingCentered
|
||||
closer
|
||||
teaser="Built for Product-minded founders"
|
||||
heading="Hack your way to Product-Market Fit"
|
||||
subheading="We redesigned experience management for SaaS founding teams:
|
||||
Developer-first, native look & feel, private at heart."
|
||||
teaser="DATA Privacy at heart"
|
||||
heading="The only open-source solution"
|
||||
subheading="Comply with all data privacy regulation with ease. Simply self-host."
|
||||
/>
|
||||
|
||||
<ul role="list" className="grid grid-cols-1 gap-4 pt-8 sm:grid-cols-2 md:grid-cols-3 lg:gap-10">
|
||||
|
||||
@@ -1,41 +1,38 @@
|
||||
import { Button } from "@formbricks/ui";
|
||||
import HeroAnimation from "../shared/HeroAnimation";
|
||||
import { useRouter } from "next/router";
|
||||
import TemplateList from "../dummyUI/TemplateList";
|
||||
|
||||
interface Props {}
|
||||
|
||||
export default function Hero({}: Props) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<div className="relative">
|
||||
<div className="px-4 py-20 text-center sm:px-6 lg:px-8 lg:py-28">
|
||||
<h1 className="text-3xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-4xl md:text-5xl">
|
||||
<span className="xl:inline">Build</span>{" "}
|
||||
<span className="xl:inline">Better experience data.</span>{" "}
|
||||
<span className="from-brand-light to-brand-dark bg-gradient-to-b bg-clip-text text-transparent xl:inline">
|
||||
user research
|
||||
</span>{" "}
|
||||
<span className="inline ">into your product</span>
|
||||
Better business
|
||||
</span>
|
||||
<span className="inline ">.</span>
|
||||
</h1>
|
||||
|
||||
<p className="xs:max-w-none mx-auto mt-3 max-w-xs text-base text-slate-500 dark:text-slate-300 sm:text-lg md:mt-5 md:text-xl">
|
||||
Natively embed qualitative user research into your B2B SaaS.
|
||||
Survey specific customer segments at any point in the user journey.
|
||||
<br />
|
||||
<span className="hidden md:block">
|
||||
Leverage Best Practices for user discovery to increase Product-Market Fit.
|
||||
Continuously measure what your customers think and feel. All open-source.
|
||||
</span>
|
||||
</p>
|
||||
|
||||
{/*
|
||||
<div className="mx-auto mt-5 max-w-md sm:flex sm:justify-center md:mt-8">
|
||||
<Button variant="secondary" onClick={() => router.push("#best-practices")}>
|
||||
<Button variant="secondary" className="" onClick={() => router.push("#best-practices")}>
|
||||
Best practices
|
||||
</Button>
|
||||
<Button variant="highlight" className="ml-3" onClick={() => router.push("/waitlist")}>
|
||||
<Button variant="highlight" className="ml-3 px-6" onClick={() => router.push("/waitlist")}>
|
||||
Get Access
|
||||
</Button>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
|
||||
<HeroAnimation />
|
||||
<TemplateList />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,31 +1,8 @@
|
||||
import ImageAttributesDark from "@/images/attributes-dark.svg";
|
||||
import ImageAttributesLight from "@/images/attributes-light.svg";
|
||||
import ImageEventTriggerDark from "@/images/event-trigger-dark.svg";
|
||||
import ImageEventTriggerLight from "@/images/event-trigger-light.svg";
|
||||
import Image from "next/image";
|
||||
import ImageAnalytics from "@/images/connect-analytics.png";
|
||||
import ImageInsights from "@/images/insights.png";
|
||||
import ImageDarkAnalytics from "@/images/dark-connect-analytics.png";
|
||||
import ImageDarkInsights from "@/images/dark-insights.png";
|
||||
|
||||
const userBase = [
|
||||
{
|
||||
email: "anna@open.com",
|
||||
status: "Signed Up",
|
||||
},
|
||||
{
|
||||
email: "tim@yama.com",
|
||||
status: "Activated",
|
||||
},
|
||||
{
|
||||
email: "beth@lehem.com",
|
||||
status: "Customer",
|
||||
},
|
||||
{
|
||||
email: "pied@piper.com",
|
||||
status: "Customer",
|
||||
},
|
||||
{
|
||||
email: "janice@late.com",
|
||||
status: "Churned",
|
||||
},
|
||||
];
|
||||
|
||||
export default function Highlights({}) {
|
||||
return (
|
||||
@@ -35,18 +12,26 @@ export default function Highlights({}) {
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200">
|
||||
Connect product analytics,
|
||||
Ask at the right moment,
|
||||
<br />
|
||||
<span className="font-light">ask specific user cohorts.</span>
|
||||
<span className="font-light">get the data you need.</span>
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
Email is spammy and ineffective. Create cohorts based on usage data and reach out to specific
|
||||
cohorts in-app.
|
||||
Follow up emails are so 2010. Ask users as they experience your product - and leverage a 3x
|
||||
higher conversion rate.
|
||||
</p>
|
||||
</div>
|
||||
<div className="rounded-lg bg-slate-100 p-4 dark:bg-slate-800 sm:p-8">
|
||||
<Image src={ImageAnalytics} alt="react library" className="block rounded-lg dark:hidden" />
|
||||
<Image src={ImageDarkAnalytics} alt="react library" className="hidden rounded-lg dark:block" />
|
||||
<div className="rounded-lg bg-slate-100 py-6 pr-4 dark:bg-slate-800 sm:py-16 sm:pr-8">
|
||||
<Image
|
||||
src={ImageEventTriggerLight}
|
||||
alt="react library"
|
||||
className="block rounded-lg dark:hidden"
|
||||
/>
|
||||
<Image
|
||||
src={ImageEventTriggerDark}
|
||||
alt="react library"
|
||||
className="hidden rounded-lg dark:block"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -55,53 +40,27 @@ export default function Highlights({}) {
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="order-last rounded-lg bg-slate-100 p-4 dark:bg-slate-800 sm:p-8 md:order-first">
|
||||
<Image src={ImageInsights} alt="react library" className="block rounded-lg dark:hidden" />
|
||||
<Image src={ImageDarkInsights} alt="react library" className="hidden rounded-lg dark:block" />
|
||||
<Image
|
||||
src={ImageAttributesLight}
|
||||
alt="react library"
|
||||
className="block rounded-lg dark:hidden"
|
||||
/>
|
||||
<Image src={ImageAttributesDark} alt="react library" className="hidden rounded-lg dark:block" />
|
||||
</div>
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-3xl">
|
||||
Fill the gaps between
|
||||
‘Spray and pray’ never worked.
|
||||
<br />
|
||||
<span className="font-light">analytics and interviews.</span>
|
||||
<span className="font-light">Segment users, granularly.</span>
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-md leading-7 text-slate-500 dark:text-slate-400">
|
||||
Product analytics tell you WHAT users do, not WHY. Complement user interviews with a constant
|
||||
flow of qualitative user insights.
|
||||
Pre-segment who sees your survey based on custom attributes. Keep the signal, cancel out the
|
||||
noise.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mx-auto mt-8 mb-12 max-w-lg md:mt-32 md:mb-0 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-3xl">
|
||||
From sign up to paid plan:
|
||||
<br />
|
||||
<span className="font-light">Never ask something twice.</span>
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-md leading-7 text-slate-500 dark:text-slate-400">
|
||||
With Formbricks you build a database of everyone who signs up to your product. Enrich their
|
||||
profile at key moments in the user journey.
|
||||
</p>
|
||||
</div>
|
||||
<div className="w-full rounded-lg bg-slate-100 p-8 dark:bg-slate-800">
|
||||
{userBase.map((user) => (
|
||||
<div className="my-2 flex w-full justify-between rounded-lg bg-slate-50 py-2 px-4 text-slate-700 transition-all duration-75 ease-in-out hover:scale-105 dark:bg-slate-700 dark:text-slate-300">
|
||||
{user.email}
|
||||
<p className="xs:max-md:block hidden rounded-full bg-slate-200 px-3 text-sm dark:bg-slate-600 lg:block ">
|
||||
{user.status}
|
||||
</p>
|
||||
<a href={"mailto:" + user.email} className="text-brand font-semibold">
|
||||
Reach Out
|
||||
</a>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
69
apps/formbricks-com/components/home/SetupTabs.tsx
Normal file
@@ -0,0 +1,69 @@
|
||||
import clsx from "clsx";
|
||||
import { useState } from "react";
|
||||
import { IoLogoHtml5, IoLogoNpm } from "react-icons/io5";
|
||||
import CodeBlock from "../shared/CodeBlock";
|
||||
|
||||
interface SecondNavbarProps {
|
||||
tabs: { id: string; label: string; icon?: React.ReactNode }[];
|
||||
activeId: string;
|
||||
setActiveId: (id: string) => void;
|
||||
}
|
||||
|
||||
export function TabBar({ tabs, activeId, setActiveId }: SecondNavbarProps) {
|
||||
return (
|
||||
<div className="flex h-14 items-center justify-center rounded-lg bg-slate-200 dark:bg-slate-700">
|
||||
<nav className="flex h-full items-center space-x-4" aria-label="Tabs">
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
onClick={() => setActiveId(tab.id)}
|
||||
className={clsx(
|
||||
tab.id === activeId
|
||||
? " border-brand-dark border-b-2 font-semibold text-slate-900 dark:text-slate-300"
|
||||
: "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",
|
||||
"flex h-full items-center px-3 text-sm font-medium"
|
||||
)}
|
||||
aria-current={tab.id === activeId ? "page" : undefined}>
|
||||
{tab.icon && <div className="flex h-5 w-5 items-center">{tab.icon}</div>}
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const tabs = [
|
||||
{ id: "npm", label: "NPM", icon: <IoLogoNpm /> },
|
||||
{ id: "html", label: "HTML", icon: <IoLogoHtml5 /> },
|
||||
];
|
||||
|
||||
export default function SetupInstructions({}) {
|
||||
const [activeTab, setActiveTab] = useState(tabs[0].id);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<TabBar tabs={tabs} activeId={activeTab} setActiveId={setActiveTab} />
|
||||
<div className="h-80 max-w-xs px-4 sm:max-w-lg">
|
||||
{activeTab === "npm" ? (
|
||||
<>
|
||||
<CodeBlock>npm install @formbricks/js</CodeBlock>
|
||||
|
||||
<CodeBlock>{`import formbricks from "@formbricks/js";
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
formbricks.init({
|
||||
environmentId: "claV2as2kKAqF28fJ8",
|
||||
apiHost: "https://app.formbricks.com",
|
||||
});
|
||||
}`}</CodeBlock>
|
||||
</>
|
||||
) : activeTab === "html" ? (
|
||||
<CodeBlock>{`<script type="text/javascript">
|
||||
!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="./dist/index.umd.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),setTimeout(function(){window.formbricks.init("claDadXk29dak92dK9","https://app.formbricks.com")},500)}();
|
||||
</script>`}</CodeBlock>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
208
apps/formbricks-com/components/home/Steps.tsx
Normal file
@@ -0,0 +1,208 @@
|
||||
import DashboardMockupDark from "@/images/dashboard-mockup-dark.png";
|
||||
import DashboardMockup from "@/images/dashboard-mockup.png";
|
||||
import PreviewSurvey from "../dummyUI/PreviewSurvey";
|
||||
import { Button } from "@formbricks/ui";
|
||||
import { CursorArrowRaysIcon } from "@heroicons/react/24/solid";
|
||||
import Image from "next/image";
|
||||
import { useState } from "react";
|
||||
import AddNoCodeEventModalDummy from "../dummyUI/AddNoCodeEventModalDummy";
|
||||
import HeadingCentered from "../shared/HeadingCentered";
|
||||
import SetupTabs from "./SetupTabs";
|
||||
import type { Question } from "../dummyUI/questionTypes";
|
||||
import AddEventDummy from "../dummyUI/AddEventDummy";
|
||||
|
||||
const questions: Question[] = [
|
||||
{
|
||||
id: "1",
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "How disappointed would you be if you could no longer use Formbricks?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: "2",
|
||||
label: "Not at all disappointed",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
label: "Somewhat disappointed",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
label: "Very disappointed",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
type: "multipleChoiceSingle",
|
||||
headline: "What is your role?",
|
||||
subheader: "Please select one of the following options:",
|
||||
required: true,
|
||||
choices: [
|
||||
{
|
||||
id: "6",
|
||||
label: "Founder",
|
||||
},
|
||||
{
|
||||
id: "7",
|
||||
label: "Executive",
|
||||
},
|
||||
{
|
||||
id: "8",
|
||||
label: "Product Manager",
|
||||
},
|
||||
{
|
||||
id: "9",
|
||||
label: "Product Owner",
|
||||
},
|
||||
{
|
||||
id: "10",
|
||||
label: "Software Engineer",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "11",
|
||||
type: "openText",
|
||||
headline: "How can we improve Formbricks for you?",
|
||||
subheader: "Please be as specific as possible.",
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
export default function Steps() {
|
||||
const [isAddEventModalOpen, setAddEventModalOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<HeadingCentered
|
||||
closer
|
||||
teaser="Leave your engineers in peace"
|
||||
heading="Set Formbricks up in minutes"
|
||||
subheading="Formbricks is designed for as little dev attention as possible. Here’s how:"
|
||||
/>
|
||||
<div id="howitworks" className="mx-auto mb-12 mt-16 max-w-lg md:mt-8 md:mb-0 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="pb-8 sm:pl-10 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 1</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200">
|
||||
Copy + Paste
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
Simply copy a <script> tag to your HTML head - that’s about it. Or use NPM to install
|
||||
Formbricks for React, Vue, Svelte, etc.
|
||||
</p>
|
||||
</div>
|
||||
<div className="rounded-lg bg-slate-100 dark:bg-slate-800">
|
||||
<SetupTabs />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mx-auto mt-8 mb-12 max-w-lg md:mt-32 md:mb-0 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="order-last w-full rounded-lg bg-slate-100 p-4 dark:bg-slate-800 sm:py-8 md:order-first">
|
||||
<div className="flex h-40 items-center justify-center">
|
||||
<Button
|
||||
variant="primary"
|
||||
className="animate-bounce transition-all duration-150 hover:scale-105"
|
||||
onClick={() => {
|
||||
setAddEventModalOpen(true);
|
||||
}}>
|
||||
<CursorArrowRaysIcon className="mr-2 h-5 w-5 text-white" />
|
||||
Add No-Code Event
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 2</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-3xl">
|
||||
Setup No-Code events
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
Set up an event which can trigger your survey - without writing a single line of code. Surveys
|
||||
can be triggered on specific pages or after an element is clicked.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mx-auto mt-8 mb-12 max-w-lg md:mt-32 md:mb-0 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="pb-8 sm:pl-10 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 3</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-3xl">
|
||||
Create your survey
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
Start from a template - or from scratch. Ask what you want, in any language. You can also
|
||||
adjust the look and feel of your survey.
|
||||
</p>
|
||||
</div>
|
||||
<div className="relative w-full rounded-lg bg-slate-100 p-1 dark:bg-slate-800 sm:p-8">
|
||||
<PreviewSurvey questions={questions} brandColor="#00C4B8" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mx-auto mt-8 mb-12 max-w-lg md:mt-32 md:mb-0 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="order-last w-full rounded-lg bg-slate-100 p-4 dark:bg-slate-800 sm:py-8 md:order-first">
|
||||
<div className="mx-auto md:w-3/4">
|
||||
<AddEventDummy />
|
||||
</div>
|
||||
</div>
|
||||
<div className="pb-8 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 4</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-100 sm:text-3xl">
|
||||
Set segment and trigger
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
Create a custom segment for each survey. Use attributes and past events to only survey the
|
||||
people who have answers. Trigger your survey on any event in your application. Context
|
||||
matters.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mx-auto mt-8 mb-12 max-w-lg md:mt-32 md:mb-0 md:max-w-none">
|
||||
<div className="px-4 sm:max-w-4xl sm:px-6 lg:max-w-7xl lg:px-8">
|
||||
<div className="grid md:grid-cols-2 md:items-center md:gap-16">
|
||||
<div className="pb-8 sm:pl-10 md:pb-0">
|
||||
<h4 className="text-brand-dark font-bold">Step 5</h4>
|
||||
<h2 className="xs:text-3xl text-2xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-3xl">
|
||||
Make better decisions
|
||||
</h2>
|
||||
<p className="text-md mt-6 max-w-lg leading-7 text-slate-500 dark:text-slate-400">
|
||||
Gather all insights you can - including partial submissions. Build conviction for the next
|
||||
product decision. Better data, better business.
|
||||
</p>
|
||||
</div>
|
||||
<div className="sm:scale-125 sm:p-8">
|
||||
<Image
|
||||
src={DashboardMockup}
|
||||
quality="100"
|
||||
alt="Data Pipelines"
|
||||
className="block rounded-lg dark:hidden"
|
||||
/>
|
||||
<Image
|
||||
src={DashboardMockupDark}
|
||||
quality="100"
|
||||
alt="Data Pipelines"
|
||||
className="hidden dark:block"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<AddNoCodeEventModalDummy open={isAddEventModalOpen} setOpen={setAddEventModalOpen} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useState, ChangeEvent } from "react";
|
||||
import { ChevronDownIcon, ChevronRightIcon, ChevronLeftIcon } from "@heroicons/react/20/solid";
|
||||
import { ChevronDownIcon, ChevronRightIcon, ChevronLeftIcon } from "@heroicons/react/24/solid";
|
||||
import clsx from "clsx";
|
||||
|
||||
interface APICallProps {
|
||||
method: "GET" | "POST";
|
||||
url: string;
|
||||
description: string;
|
||||
queries: {
|
||||
headers: {
|
||||
label: string;
|
||||
type: string;
|
||||
description: string;
|
||||
@@ -26,7 +26,7 @@ interface APICallProps {
|
||||
example?: string;
|
||||
}
|
||||
|
||||
export function APILayout({ method, url, description, queries, bodies, responses, example }: APICallProps) {
|
||||
export function APILayout({ method, url, description, headers, bodies, responses, example }: APICallProps) {
|
||||
const [switchState, setSwitchState] = useState(true);
|
||||
function handleOnChange() {
|
||||
setSwitchState(!switchState);
|
||||
@@ -64,14 +64,17 @@ export function APILayout({ method, url, description, queries, bodies, responses
|
||||
<div className={clsx(switchState ? "block" : "hidden", "ml-8")}>
|
||||
<p className="mt-6 mb-2 text-lg font-semibold">Parameters</p>
|
||||
<div>
|
||||
<div className="text-base">
|
||||
<p className="not-prose -mb-1 pt-2 font-bold">Query</p>
|
||||
<div>
|
||||
{queries.map((q) => (
|
||||
<Parameter key={q.label} label={q.label} type={q.type} description={q.description} />
|
||||
))}
|
||||
{headers.length > 0 && (
|
||||
<div className="text-base">
|
||||
<p className="not-prose -mb-1 pt-2 font-bold">Headers</p>
|
||||
<div>
|
||||
{headers.map((q) => (
|
||||
<Parameter key={q.label} label={q.label} type={q.type} description={q.description} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-4 text-base">
|
||||
<p className="not-prose -mb-1 pt-2 font-bold">Body</p>
|
||||
<div>
|
||||
|
||||
24
apps/formbricks-com/components/shared/CodeBlock.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
// components/ui/CodeBlock.tsx
|
||||
import Prism from "prismjs";
|
||||
import "prismjs/themes/prism.css";
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
interface CodeBlockProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const CodeBlock: React.FC<CodeBlockProps> = ({ children }) => {
|
||||
useEffect(() => {
|
||||
Prism.highlightAll();
|
||||
}, [children]);
|
||||
|
||||
return (
|
||||
<div className="group relative mt-4 rounded-md text-sm font-light text-slate-200 sm:text-base">
|
||||
<pre>
|
||||
<code className="language-js">{children}</code>
|
||||
</pre>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CodeBlock;
|
||||
@@ -1,92 +0,0 @@
|
||||
import clsx from "clsx";
|
||||
import { usePlausible } from "next-plausible";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
formbricks: any;
|
||||
}
|
||||
}
|
||||
|
||||
export function FeedbackButton() {
|
||||
const plausible = usePlausible();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const feedbackRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
// Close the feedback form if the user clicks outside of it
|
||||
function handleClickOutside(event: any) {
|
||||
if (feedbackRef.current && !feedbackRef.current.contains(event.target)) {
|
||||
if (isOpen) {
|
||||
setIsOpen(false);
|
||||
if (window) {
|
||||
window.formbricks.clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Bind the event listener
|
||||
document.addEventListener("mousedown", handleClickOutside);
|
||||
return () => {
|
||||
// Unbind the event listener on clean up
|
||||
document.removeEventListener("mousedown", handleClickOutside);
|
||||
};
|
||||
}, [feedbackRef, isOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
window.formbricks = {
|
||||
...window.formbricks,
|
||||
config: {
|
||||
hqUrl: process.env.NEXT_PUBLIC_FORMBRICKS_URL,
|
||||
formId: process.env.NEXT_PUBLIC_FORMBRICKS_FORM_ID,
|
||||
containerId: "formbricks-feedback-wrapper",
|
||||
contact: {
|
||||
name: "Matti",
|
||||
position: "Co-Founder",
|
||||
imgUrl: "https://avatars.githubusercontent.com/u/675065?s=128&v=4",
|
||||
},
|
||||
},
|
||||
};
|
||||
// @ts-ignore
|
||||
import("@formbricks/feedback");
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={clsx(
|
||||
"xs:flex-row xs:right-0 xs:top-1/2 xs:w-[18rem] xs:-translate-y-1/2 fixed bottom-0 z-50 h-[22rem] w-full flex-1 transition-all duration-500 ease-in-out",
|
||||
isOpen ? "xs:-translate-x-0 translate-y-0" : "xs:translate-x-full xs:-mr-1 translate-y-full"
|
||||
)}>
|
||||
<div
|
||||
className="xs:flex-row flex h-full flex-col"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
ref={feedbackRef}>
|
||||
<button
|
||||
className="xs:-rotate-90 xs:top-1/2 xs:-left-[5.75rem] xs:-translate-y-1/2 xs:-translate-x-0 xs:w-32 xs:p-4 bg-brand-dark absolute left-1/2 w-28 -translate-x-1/2 -translate-y-full rounded-t-lg p-3 font-medium text-white"
|
||||
onClick={() => {
|
||||
if (!isOpen) {
|
||||
plausible("openFeedback");
|
||||
if (window) {
|
||||
window.formbricks.render();
|
||||
window.formbricks.resetForm();
|
||||
}
|
||||
} else {
|
||||
if (window) {
|
||||
window.formbricks.clean();
|
||||
}
|
||||
}
|
||||
setIsOpen(!isOpen);
|
||||
}}>
|
||||
{isOpen ? "Close" : "Feedback"}
|
||||
</button>
|
||||
<div
|
||||
className="xs:rounded-bl-lg xs:rounded-tr-none h-full w-full overflow-hidden rounded-bl-none rounded-tr-lg rounded-tl-lg bg-slate-50 shadow-lg"
|
||||
id="formbricks-feedback-wrapper"></div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { FooterLogo } from "./Logo";
|
||||
const navigation = {
|
||||
/* creation: [
|
||||
{ name: "React Form Builder", href: "/react-form-library", status: true },
|
||||
{ name: "No Code Builder", href: "/visual-builder", status: false },
|
||||
{ name: "No-Code Builder", href: "/visual-builder", status: false },
|
||||
{ name: "Templates", href: "#", status: false },
|
||||
],
|
||||
pipelines: [
|
||||
|
||||
@@ -35,6 +35,11 @@ export default function Header() {
|
||||
className="text-base font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300">
|
||||
Blog <p className="bg-brand inline rounded-full px-2 text-xs text-white">1</p>
|
||||
</Link>
|
||||
<Link
|
||||
href="/docs"
|
||||
className="text-base font-medium text-slate-400 hover:text-slate-700 dark:hover:text-slate-300">
|
||||
Docs
|
||||
</Link>
|
||||
</Popover.Group>
|
||||
<div className="hidden flex-1 items-center justify-end md:flex">
|
||||
<ThemeSelector className="relative z-10 mr-5" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Popover, Transition } from "@headlessui/react";
|
||||
import { ChevronDownIcon } from "@heroicons/react/20/solid";
|
||||
import { ChevronDownIcon } from "@heroicons/react/24/solid";
|
||||
import {
|
||||
Bars3Icon,
|
||||
BoltIcon,
|
||||
@@ -30,7 +30,7 @@ const creation = [
|
||||
status: true,
|
||||
},
|
||||
{
|
||||
name: "No Code Builder",
|
||||
name: "No-Code Builder",
|
||||
description: "Notion-like visual builder",
|
||||
href: "/visual-builder",
|
||||
icon: CursorArrowRaysIcon,
|
||||
|
||||
@@ -17,26 +17,26 @@ const BestPractices = [
|
||||
title: "Onboarding Segmentation",
|
||||
description:
|
||||
"Get to know your users right from the start. Ask a few questions early, let us enrich the profile.",
|
||||
category: "In-Moment",
|
||||
category: "Boost Retention",
|
||||
icon: OnboardingIcon,
|
||||
},
|
||||
{
|
||||
title: "Product-Market Fit Survey",
|
||||
description: "Find out how disappointed people would be if they could not use your service any more.",
|
||||
category: "In-Moment",
|
||||
category: "Boost Retention",
|
||||
icon: PMFIcon,
|
||||
href: "/pmf",
|
||||
},
|
||||
{
|
||||
title: "Feature Chaser",
|
||||
description: "Show a survey about a new feature shown only to people who used it.",
|
||||
category: "In-Moment",
|
||||
category: "Boost Retention",
|
||||
icon: DogChaserIcon,
|
||||
},
|
||||
{
|
||||
title: "Cancel Subscription Flow",
|
||||
description: "Request users going through a cancel subscription flow before cancelling.",
|
||||
category: "In-Moment",
|
||||
category: "Boost Retention",
|
||||
icon: CancelSubscriptionIcon,
|
||||
},
|
||||
{
|
||||
@@ -57,29 +57,18 @@ const BestPractices = [
|
||||
category: "Retain Users",
|
||||
icon: FeedbackIcon,
|
||||
},
|
||||
{
|
||||
title: "Bug Report Form",
|
||||
description: "Catch all bugs in your SaaS with easy and accessible bug reports.",
|
||||
category: "Retain Users",
|
||||
icon: BugBlueIcon,
|
||||
},
|
||||
|
||||
{
|
||||
title: "Rage Click Survey",
|
||||
description: "Sometimes things don’t work. Trigger this rage click survey to catch users in rage.",
|
||||
category: "Retain Users",
|
||||
icon: AngryBirdRageIcon,
|
||||
},
|
||||
{
|
||||
title: "Feature Request Widget",
|
||||
description: "Allow users to request features and pipe it to GitHub projects or Linear.",
|
||||
category: "Retain Users",
|
||||
icon: FeatureRequestIcon,
|
||||
},
|
||||
];
|
||||
|
||||
export default function InsightOppos() {
|
||||
return (
|
||||
<div className="pt-12 pb-10 md:pt-40">
|
||||
<div className="pt-12 pb-10 md:pt-20">
|
||||
<div className="px-4 py-20 text-center sm:px-6 lg:px-8" id="best-practices">
|
||||
<h1 className="text-3xl font-bold tracking-tight text-slate-800 dark:text-slate-200 sm:text-4xl md:text-5xl">
|
||||
Get started with{" "}
|
||||
@@ -88,7 +77,7 @@ export default function InsightOppos() {
|
||||
</span>
|
||||
</h1>
|
||||
<p className="mx-auto mt-3 max-w-md text-base text-slate-500 dark:text-slate-300 sm:text-lg md:mt-5 md:max-w-3xl md:text-xl">
|
||||
Proven templates for qualitative user research.
|
||||
Run battle-tested approaches for qualitative user research in minutes.
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
@@ -96,13 +85,13 @@ export default function InsightOppos() {
|
||||
{BestPractices.map((bestPractice) => (
|
||||
<div
|
||||
key={bestPractice.title}
|
||||
className="drop-shadow-card duration-120 relative cursor-default rounded-lg bg-slate-100 p-8 transition-all ease-in-out hover:scale-105 dark:bg-slate-800">
|
||||
className="drop-shadow-card duration-120 relative cursor-pointer rounded-lg bg-slate-100 p-8 transition-all ease-in-out hover:scale-105 dark:bg-slate-800">
|
||||
<div
|
||||
className={clsx(
|
||||
// base styles independent what type of button it is
|
||||
"absolute right-10 rounded-full py-1 px-3",
|
||||
// different styles depending on size
|
||||
bestPractice.category === "In-Moment" &&
|
||||
// different styles depending on type
|
||||
bestPractice.category === "Boost Retention" &&
|
||||
"bg-pink-100 text-pink-500 dark:bg-pink-800 dark:text-pink-200",
|
||||
bestPractice.category === "Exploration" &&
|
||||
"bg-blue-100 text-blue-500 dark:bg-blue-800 dark:text-blue-200",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { FeedbackButton } from "@/components/shared/FeedbackButton";
|
||||
import Footer from "./Footer";
|
||||
import Header from "./Header";
|
||||
import MetaInformation from "./MetaInformation";
|
||||
@@ -14,7 +13,6 @@ export default function Layout({ title, description, children }: LayoutProps) {
|
||||
<div className="flex h-screen flex-col justify-between">
|
||||
<MetaInformation title={title} description={description} />
|
||||
<Header />
|
||||
<FeedbackButton />
|
||||
{
|
||||
<main className="max-w-8xl relative mx-auto mb-auto flex w-full flex-col justify-center sm:px-2 lg:px-8 xl:px-12">
|
||||
{children}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { FeedbackButton } from "@/components/shared/FeedbackButton";
|
||||
import Footer from "./Footer";
|
||||
import Header from "./Header";
|
||||
import MetaInformation from "./MetaInformation";
|
||||
@@ -17,7 +16,6 @@ export default function LayoutMdx({ meta, children }: Props) {
|
||||
<div className="flex h-screen flex-col justify-between">
|
||||
<MetaInformation title={meta.title} description={meta.description} />
|
||||
<Header />
|
||||
<FeedbackButton />
|
||||
<main className="min-w-0 max-w-2xl flex-auto px-4 lg:max-w-none lg:pr-0 lg:pl-8 xl:px-16">
|
||||
<article className="mx-auto my-16 max-w-3xl px-2">
|
||||
{meta.title && (
|
||||
|
||||
75
apps/formbricks-com/components/shared/Modal.tsx
Normal file
@@ -0,0 +1,75 @@
|
||||
import { Dialog, Transition } from "@headlessui/react";
|
||||
import { XMarkIcon } from "@heroicons/react/24/solid";
|
||||
import { Fragment } from "react";
|
||||
import clsx from "clsx";
|
||||
|
||||
type Modal = {
|
||||
open: boolean;
|
||||
setOpen: (v: boolean) => void;
|
||||
children: React.ReactNode;
|
||||
title?: string;
|
||||
noPadding?: boolean;
|
||||
closeOnOutsideClick?: boolean;
|
||||
};
|
||||
|
||||
const Modal: React.FC<Modal> = ({
|
||||
open,
|
||||
setOpen,
|
||||
children,
|
||||
title,
|
||||
noPadding,
|
||||
closeOnOutsideClick = true,
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<Transition.Root show={open} as={Fragment}>
|
||||
<Dialog as="div" className="relative z-20" onClose={() => closeOnOutsideClick && setOpen(false)}>
|
||||
<Transition.Child
|
||||
as={Fragment}
|
||||
enter="ease-out duration-300"
|
||||
enterFrom="opacity-0"
|
||||
enterTo="opacity-100"
|
||||
leave="ease-in duration-200"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0">
|
||||
<div className="fixed inset-0 bg-slate-500 bg-opacity-30 backdrop-blur-md transition-opacity" />
|
||||
</Transition.Child>
|
||||
|
||||
<div className="fixed inset-0 z-10 overflow-y-auto">
|
||||
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
|
||||
<Transition.Child
|
||||
as={Fragment}
|
||||
enter="ease-out duration-300"
|
||||
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
enterTo="opacity-100 translate-y-0 sm:scale-100"
|
||||
leave="ease-in duration-200"
|
||||
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
|
||||
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
|
||||
<Dialog.Panel
|
||||
className={clsx(
|
||||
"relative transform rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-xl ",
|
||||
`${noPadding ? "" : "px-4 pt-5 pb-4 sm:p-6"}`
|
||||
)}>
|
||||
<div className="absolute top-0 right-0 hidden pt-4 pr-4 sm:block">
|
||||
<button
|
||||
type="button"
|
||||
className="rounded-md bg-white text-slate-400 hover:text-slate-500 focus:outline-none focus:ring-0 focus:ring-offset-2"
|
||||
onClick={() => setOpen(false)}>
|
||||
<span className="sr-only">Close</span>
|
||||
<XMarkIcon className="h-6 w-6" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
{title && <h3 className="mb-4 text-xl font-bold text-slate-500">{title}</h3>}
|
||||
|
||||
{children}
|
||||
</Dialog.Panel>
|
||||
</Transition.Child>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
</Transition.Root>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Modal;
|
||||
BIN
apps/formbricks-com/images/attributes-dark.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
129
apps/formbricks-com/images/attributes-dark.svg
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
apps/formbricks-com/images/attributes-light.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
129
apps/formbricks-com/images/attributes-light.svg
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
apps/formbricks-com/images/event-trigger-dark.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
50
apps/formbricks-com/images/event-trigger-dark.svg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
apps/formbricks-com/images/event-trigger-light.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
50
apps/formbricks-com/images/event-trigger-light.svg
Normal file
|
After Width: | Height: | Size: 34 KiB |
@@ -8,86 +8,31 @@ const navigation = [
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Best Practices",
|
||||
title: "Getting Started",
|
||||
links: [
|
||||
{
|
||||
title: "What are Best Practices?",
|
||||
href: "/docs/best-practices/what-are-best-practices",
|
||||
},
|
||||
{
|
||||
title: "Feedback Box",
|
||||
href: "/docs/best-practices/feedback-box",
|
||||
},
|
||||
{
|
||||
title: "Product-Market Fit Survey",
|
||||
href: "/docs/best-practices/pmf-survey",
|
||||
},
|
||||
{
|
||||
title: "Onboarding Segmentation",
|
||||
href: "/docs/best-practices/onboarding-segmentation",
|
||||
},
|
||||
{
|
||||
title: "Waitlist Survey",
|
||||
href: "/docs/best-practices/waitlist-survey",
|
||||
},
|
||||
{
|
||||
title: "Interview Prompt",
|
||||
href: "/docs/best-practices/interview-prompt",
|
||||
},
|
||||
{
|
||||
title: "Custom Survey",
|
||||
href: "/docs/best-practices/custom-survey",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Wrappers",
|
||||
links: [
|
||||
{
|
||||
title: "What are Wrappers?",
|
||||
href: "/docs/wrappers/what-are-wrappers",
|
||||
},
|
||||
{
|
||||
title: "In-app Pop-over",
|
||||
href: "/docs/wrappers/pop-over",
|
||||
},
|
||||
{
|
||||
title: "In-app Slide-out",
|
||||
href: "/docs/wrappers/slide-out",
|
||||
},
|
||||
{
|
||||
title: "Modal",
|
||||
href: "/docs/wrappers/modal",
|
||||
},
|
||||
{
|
||||
title: "Inline",
|
||||
href: "/docs/wrappers/inline",
|
||||
},
|
||||
{
|
||||
title: "Link",
|
||||
href: "/docs/wrappers/link",
|
||||
},
|
||||
{
|
||||
title: "Email",
|
||||
href: "/docs/wrappers/email",
|
||||
},
|
||||
{ title: "Quickstart", href: "/docs/getting-started/quickstart" },
|
||||
{ title: "Setup with Next.js", href: "/docs/getting-started/nextjs" },
|
||||
{ title: "Setup with Vue.js", href: "/docs/getting-started/vuejs" },
|
||||
{ title: "Identify users", href: "/docs/getting-started/identify-users" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "API",
|
||||
links: [
|
||||
{ title: "API Setup", href: "/docs/api/setup" },
|
||||
{ title: "Create Submission", href: "/docs/api/create-submission" },
|
||||
{ title: "Update Submission", href: "/docs/api/update-submission" },
|
||||
{ title: "Update Schema", href: "/docs/api/update-schema" },
|
||||
{ title: "Overview", href: "/docs/api/overview" },
|
||||
{ title: "API Key Setup", href: "/docs/api/api-key-setup" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Client API",
|
||||
links: [
|
||||
{ title: "Create Response", href: "/docs/api/create-response" },
|
||||
{ title: "Update Response", href: "/docs/api/update-response" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Self-hosting",
|
||||
links: [
|
||||
{ title: "Quick Start", href: "/docs/self-hosting/quick-start" },
|
||||
{ title: "Deployment", href: "/docs/self-hosting/deployment" },
|
||||
],
|
||||
links: [{ title: "Deployment", href: "/docs/self-hosting/deployment" }],
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import rehypePrism from "@mapbox/rehype-prism";
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
swcMinify: true,
|
||||
transpilePackages: ["@formbricks/ui"],
|
||||
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
|
||||
async redirects() {
|
||||
return [
|
||||
@@ -64,6 +65,11 @@ const nextConfig = {
|
||||
destination: "https://app.formbricks.com/demo",
|
||||
permanent: false,
|
||||
},
|
||||
{
|
||||
source: "/pmf",
|
||||
destination: "/",
|
||||
permanent: false,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
@@ -11,27 +11,24 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@docsearch/react": "^3.3.3",
|
||||
"@formbricks/engine-react": "workspace:*",
|
||||
"@formbricks/feedback": "workspace:*",
|
||||
"@formbricks/pmf": "workspace:*",
|
||||
"@formbricks/react": "workspace:*",
|
||||
"@formbricks/ui": "workspace:*",
|
||||
"@headlessui/react": "^1.7.11",
|
||||
"@headlessui/react": "^1.7.13",
|
||||
"@heroicons/react": "^2.0.16",
|
||||
"@mapbox/rehype-prism": "^0.8.0",
|
||||
"@mdx-js/loader": "^2.3.0",
|
||||
"@mdx-js/react": "^2.3.0",
|
||||
"@next/mdx": "^13.2.1",
|
||||
"@next/mdx": "^13.2.4",
|
||||
"add": "^2.0.6",
|
||||
"clsx": "^1.2.1",
|
||||
"lottie-web": "^5.10.2",
|
||||
"next": "13.2.1",
|
||||
"next": "13.2.4",
|
||||
"next-plausible": "^3.7.2",
|
||||
"next-sitemap": "^3.1.52",
|
||||
"next-sitemap": "^4.0.5",
|
||||
"prism-react-renderer": "^1.3.5",
|
||||
"prismjs": "^1.29.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-hook-form": "^7.43.2",
|
||||
"react-hook-form": "^7.43.5",
|
||||
"react-responsive-embed": "^2.1.0",
|
||||
"remark-gfm": "^3.0.1",
|
||||
"sharp": "^0.31.3"
|
||||
@@ -39,11 +36,12 @@
|
||||
"devDependencies": {
|
||||
"@tailwindcss/forms": "^0.5.3",
|
||||
"@tailwindcss/typography": "^0.5.9",
|
||||
"@types/node": "18.14.1",
|
||||
"@types/node": "18.15.3",
|
||||
"@types/prismjs": "^1.26.0",
|
||||
"@types/react": "18.0.28",
|
||||
"@types/react-dom": "18.0.11",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"eslint": "8.34.0",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"eslint": "8.36.0",
|
||||
"eslint-config-formbricks": "workspace:*",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
|
||||
@@ -4,7 +4,7 @@ import { APILayout } from "@/components/shared/APILayout.tsx";
|
||||
import { Callout } from "@/components/shared/Callout";
|
||||
|
||||
export const meta = {
|
||||
title: "API Setup",
|
||||
title: "API Key Setup",
|
||||
};
|
||||
|
||||
## Auth: Personal API key
|
||||
@@ -3,74 +3,69 @@ import { Fence } from "@/components/shared/Fence";
|
||||
import { APILayout } from "@/components/shared/APILayout.tsx";
|
||||
|
||||
export const meta = {
|
||||
title: "API: Create submission",
|
||||
title: "API: Create response",
|
||||
};
|
||||
|
||||
<APILayout
|
||||
method="POST"
|
||||
url="/api/capture/forms/{formId}/submissions"
|
||||
url="/api/v1/client/environments/{environmentId}/responses"
|
||||
description="Add a new submission to a form by form ID."
|
||||
queries={[{ label: "apiKey", type: "string", description: "Your API key" }]}
|
||||
headers={[]}
|
||||
bodies={[
|
||||
{
|
||||
label: "customer",
|
||||
type: "JSON",
|
||||
label: "surveyId",
|
||||
type: "string",
|
||||
description: "The customer and metadata you want to link the submission to.",
|
||||
},
|
||||
{
|
||||
label: "customer.email",
|
||||
type: "email",
|
||||
label: "personId",
|
||||
type: "string",
|
||||
description: "Customer or user email. This is the primary key to identify users",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: "customer.prop",
|
||||
type: "string",
|
||||
description:
|
||||
"Pass value to create user property. You can filter / create cohorts for future surveys based on props.",
|
||||
},
|
||||
{
|
||||
label: "data",
|
||||
label: "response",
|
||||
type: "JSON",
|
||||
description: "The content of the submission.",
|
||||
},
|
||||
{
|
||||
label: "data.fieldName",
|
||||
label: "response.data",
|
||||
type: "string",
|
||||
description: "Add value to input field by name.",
|
||||
description: "The data of the response as JSON object.",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: "finished",
|
||||
label: "response.finished",
|
||||
type: "boolean",
|
||||
description: "Determines if submission is marked as complete.",
|
||||
},
|
||||
]}
|
||||
example={`{
|
||||
"data": {
|
||||
"rating": 10,
|
||||
"message": "I love Formbricks"
|
||||
"response": {
|
||||
data: {
|
||||
"clfqjny0v0003yzgscnog1j9i": 10,
|
||||
"clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks"
|
||||
},
|
||||
finished: true, // optional
|
||||
},
|
||||
"customer": {
|
||||
"email": "hola@formbricks.com", //required
|
||||
"name": "Johnny"
|
||||
},
|
||||
"finished": true
|
||||
"personId: "clfqjny0v000ayzgsycx54a2c",
|
||||
"surveyId": "clfqz1esd0000yzah51trddn8"
|
||||
}`}
|
||||
responses={[
|
||||
{
|
||||
color: "green",
|
||||
statusCode: "200",
|
||||
description: "success",
|
||||
example: "{ // Response }",
|
||||
example: "{ // Response Object as JSON }",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
| field name | required | default | description |
|
||||
| ---------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| data | yes | - | The submission object (answers to the form/survey) |
|
||||
| customer | no | - | The customer this submission is connected to. The customer object must contain an email field. All other fields are optional and get saved as user properties. |
|
||||
| finished | no | false | Mark a submission as complete to be able to filter accordingly |
|
||||
| field name | required | default | description |
|
||||
| ---------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| response | yes | - | The response object (answers to the survey). It requires a `data` object. In this object the key is the questionId, the value the answer of the user to this question. |
|
||||
| personId | yes | - | The person this response is connected to. |
|
||||
| surveyId | yes | - | The survey this response is connected to. |
|
||||
| finished | no | false | Mark a response as complete to be able to filter accordingly. |
|
||||
|
||||
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;
|
||||
27
apps/formbricks-com/pages/docs/api/overview/index.mdx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Layout } from "@/components/docs/Layout";
|
||||
import { Fence } from "@/components/shared/Fence";
|
||||
import { APILayout } from "@/components/shared/APILayout.tsx";
|
||||
|
||||
export const meta = {
|
||||
title: "API Overview",
|
||||
};
|
||||
|
||||
Formbricks offers two types of APIs: the Public Client API and the User API. Each API serves a different purpose, has different authentication requirements, and provides access to different data and settings.
|
||||
|
||||
## 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.
|
||||
|
||||
## User API
|
||||
|
||||
The User API provides access to all data and settings that are visible in the Formbricks App. This API requires a personal API Key for authentication, which can be generated in the Settings section of the Formbricks App. With the User API, you can manage your Formbricks account programmatically, accessing and modifying data and settings as needed.
|
||||
|
||||
**Auth:** Personal API Key
|
||||
|
||||
API requests made to the User 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).
|
||||
|
||||
By understanding the differences between these two APIs, you can choose the appropriate one for your needs, ensuring a secure and efficient integration with the Formbricks platform.
|
||||
|
||||
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;
|
||||
@@ -8,9 +8,9 @@ export const meta = {
|
||||
|
||||
<APILayout
|
||||
method="POST"
|
||||
url="/api/capture/forms/{formId}/submissions/{submissionId}"
|
||||
description="Update an existing submission in a form by form ID."
|
||||
queries={[{ label: "apiKey", type: "string", description: "Your API key" }]}
|
||||
url="/api/v1/client/environments/{environmentId}/responses/{responseId}"
|
||||
description="Update an existing response in a survey."
|
||||
headers={[]}
|
||||
bodies={[
|
||||
{
|
||||
label: "customer",
|
||||
@@ -47,14 +47,15 @@ export const meta = {
|
||||
},
|
||||
]}
|
||||
example={`{
|
||||
"data": {
|
||||
"country": "Germany",
|
||||
"response": {
|
||||
data: {
|
||||
"clfqjny0v0003yzgscnog1j9i": 10,
|
||||
"clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks"
|
||||
},
|
||||
finished: true, // optional
|
||||
},
|
||||
"customer": {
|
||||
"email": "hola@formbricks.com", // required
|
||||
"country": "Germany"
|
||||
},
|
||||
"finished": true
|
||||
"personId: "clfqjny0v000ayzgsycx54a2c",
|
||||
"surveyId": "clfqz1esd0000yzah51trddn8"
|
||||
}`}
|
||||
responses={[
|
||||
{
|
||||
@@ -66,10 +67,8 @@ export const meta = {
|
||||
]}
|
||||
/>
|
||||
|
||||
| field name | required | default | description |
|
||||
| ---------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| data | yes | - | The submission object (answers to the form/survey) |
|
||||
| customer | no | - | The customer this submission is connected to. The customer object must contain an email field. All other fields are optional and get saved as user properties. |
|
||||
| finished | no | false | Mark a submission as complete to be able to filter accordingly |
|
||||
| field name | required | default | description |
|
||||
| ---------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| response | yes | - | The response object (answers to the survey). It requires a `data` object. In this object the key is the questionId, the value the answer of the user to this question. |
|
||||
|
||||
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;
|
||||
@@ -1,75 +0,0 @@
|
||||
import { Layout } from "@/components/docs/Layout";
|
||||
import { Fence } from "@/components/shared/Fence";
|
||||
import { APILayout } from "@/components/shared/APILayout.tsx";
|
||||
|
||||
export const meta = {
|
||||
title: "API: Update schema",
|
||||
};
|
||||
|
||||
<APILayout
|
||||
method="POST"
|
||||
url="/api/capture/forms/{formId}/submissions/schema"
|
||||
description="Update the schema of a form in Formbricks."
|
||||
queries={[{ label: "apiKey", type: "string", description: "Your API key" }]}
|
||||
bodies={[
|
||||
{
|
||||
label: "pages",
|
||||
type: "List of JSON",
|
||||
description: "Array of all pages of the form.",
|
||||
},
|
||||
{
|
||||
label: "pages[].id",
|
||||
type: "string",
|
||||
description: "Unique page ID.",
|
||||
},
|
||||
{
|
||||
label: "pages[].elements",
|
||||
type: "List of JSON",
|
||||
description: "Array of all input elements of this page.",
|
||||
},
|
||||
{
|
||||
label: "pages[].elements[].id",
|
||||
type: "string",
|
||||
description: "Unique input ID.",
|
||||
},
|
||||
{
|
||||
label: "pages[].elements[].name",
|
||||
type: "string",
|
||||
description: "Field name.",
|
||||
},
|
||||
{
|
||||
label: "pages[].elements[].type",
|
||||
type: "string",
|
||||
description: "Input type.",
|
||||
},
|
||||
{
|
||||
label: "pages[].elements[].label",
|
||||
type: "string",
|
||||
description: "Input label, usually a question.",
|
||||
},
|
||||
]}
|
||||
example={`{
|
||||
"pages":
|
||||
[{
|
||||
"id": "emailPage",
|
||||
"elements":
|
||||
[{
|
||||
"id": "email",
|
||||
"name": "email",
|
||||
"type": "text",
|
||||
"label": "What's your email address?",
|
||||
}]
|
||||
}]
|
||||
}
|
||||
`}
|
||||
responses={[
|
||||
{
|
||||
color: "green",
|
||||
statusCode: "200",
|
||||
description: "success",
|
||||
example: "{ // Response }",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;
|
||||
@@ -31,7 +31,7 @@ Allow users to share feedback with 2 clicks. A low friction way to gather feedba
|
||||
<ResponsiveEmbed
|
||||
src="/docs/wrappers/slide-out/demo"
|
||||
allowFullScreen
|
||||
className="rounded-lg border-2 border-gray-200"
|
||||
className="rounded-lg border-2 border-slate-200"
|
||||
ratio="8:10"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,6 @@ import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import NewPMF from "@/images/docs/new-pmf.png";
|
||||
import ID from "@/images/docs/copy-id.png";
|
||||
import PmfDummy from "@/components/docs/PmfDummy";
|
||||
|
||||
export const meta = {
|
||||
title: "Product-Market Fit Survey",
|
||||
@@ -36,9 +35,7 @@ Measuring it allows you to optimize it.
|
||||
|
||||
## Preview
|
||||
|
||||
<div className="max-w-md">
|
||||
<PmfDummy />
|
||||
</div>
|
||||
<div className="max-w-md"></div>
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Layout } from "@/components/docs/Layout";
|
||||
|
||||
export const meta = {
|
||||
title: "Identifying Users",
|
||||
};
|
||||
|
||||
At Formbricks, we value user privacy. By default, Formbricks doesn't collect or store any personal information from your users. However, we understand that it can be helpful for you to know which user submitted the feedback and also functionality like recontacting users and controlling the waiting period between surveys requires identifying the users. That's why we provide a way for you to share existing user data from your app, so you can view it in our dashboard.
|
||||
|
||||
Once the Formbricks widget is loaded on your web app, our SDK exposes methods for identifying user attributes. Let's set it up!
|
||||
|
||||
## Setting User ID
|
||||
|
||||
You can use the `setUserId` function to identify a user with any string. It's best to use the default identifier you use in your app (e.g. unique id from database) but you can also anonymize these as long as they are unique for every user. This function can be called multiple times with the same value safely and stores the identifier in local storage. We recommend you set the User ID whenever the user logs in to your website, as well as after the installation snippet (if the user is already logged in).
|
||||
|
||||
```javascript
|
||||
formbricks.setUserId("USER_ID");
|
||||
```
|
||||
|
||||
## Setting User Email
|
||||
|
||||
You can use the setEmail function to set the user's email:
|
||||
|
||||
```javascript
|
||||
formbricks.setEmail("user@example.com");
|
||||
```
|
||||
|
||||
### Setting Custom User Attributes
|
||||
|
||||
You can use the setAttribute function to set any custom attribute for the user (e.g. name, plan, etc.):
|
||||
|
||||
```javascript
|
||||
formbricks.setAttribute("attribute_key", "attribute_value");
|
||||
```
|
||||
|
||||
### Logging Out Users
|
||||
|
||||
When a user logs out of your webpage, make sure to log them out of Formbricks as well. This will prevent new activity from being associated with an incorrect user. Use the logout function:
|
||||
|
||||
```javascript
|
||||
formbricks.logout();
|
||||
```
|
||||
|
||||
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;
|
||||
@@ -0,0 +1,71 @@
|
||||
import { Layout } from "@/components/docs/Layout";
|
||||
|
||||
export const meta = {
|
||||
title: "Quickstart",
|
||||
};
|
||||
|
||||
# Setting up Formbricks SDK with Next.js
|
||||
|
||||
This guide will walk you through the process of integrating the Formbricks SDK into a Next.js application. As the Formbricks SDK only works on the client side, it's essential to ensure proper integration to avoid any issues.
|
||||
|
||||
## Introduction
|
||||
|
||||
Formbricks SDK allows you to seamlessly integrate in-product micro-surveys into your Next.js application. By following the steps outlined in this guide, you'll be able to gather valuable insights from your users and improve your product experience.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before getting started, make sure you have:
|
||||
|
||||
1. A Next.js application set up and running.
|
||||
2. A Formbricks account with access to your environment ID and API host. You can find these in the Setup Checklist in the Settings.
|
||||
|
||||
## Installing Formbricks SDK
|
||||
|
||||
First, you need to install the Formbricks SDK using one of the following commands:
|
||||
|
||||
```bash
|
||||
npm install --save @formbricks/js
|
||||
# or
|
||||
yarn add @formbricks/js
|
||||
# or
|
||||
pnpm add @formbricks/js
|
||||
```
|
||||
|
||||
## Integrating Formbricks SDK with Next.js
|
||||
|
||||
Update your App component in the \_app.ts file.
|
||||
|
||||
```tsx
|
||||
import type { AppProps } from "next/app";
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
formbricks.init({
|
||||
environmentId: "your-environment-id",
|
||||
apiHost: "your-api-host", // e.g. https://app.formbricks.com
|
||||
});
|
||||
}
|
||||
|
||||
export default function App({ Component, pageProps }: AppProps) {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
// Connect next.js router to Formbricks
|
||||
const handleRouteChange = formbricks?.registerRouteChange;
|
||||
router.events.on("routeChangeComplete", handleRouteChange);
|
||||
|
||||
return () => {
|
||||
router.events.off("routeChangeComplete", handleRouteChange);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
```
|
||||
|
||||
First you need to initialize the Formbricks SDK, making sure it only runs on the client side. To connect the Next.js router to Formbricks and ensure the SDK can keep track of every page change, you need to register the route change event.
|
||||
|
||||
That's it! 🎉 You have now successfully integrated the Formbricks SDK into your Next.js application. You can start creating and customizing in-product micro-surveys to gather valuable feedback from your users and improve your product experience.
|
||||
|
||||
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;
|
||||
@@ -0,0 +1,87 @@
|
||||
import { Layout } from "@/components/docs/Layout";
|
||||
|
||||
export const meta = {
|
||||
title: "Quickstart",
|
||||
};
|
||||
|
||||
Welcome to Formbricks! In this quickstart guide, we'll walk you through the initial steps to get up and running with our in-product micro-surveys. Choose between self-hosted and cloud options, create an account, and set up the JavaScript widget. Let's dive in!
|
||||
|
||||
## Step 1: Choose between self-hosted and cloud
|
||||
|
||||
First, you need to decide whether you want to use the self-hosted or cloud version of Formbricks.
|
||||
|
||||
- **Self-hosted**: If you prefer to host Formbricks on your own servers, check out the dedicated [Self-hosted Documentation](/docs/self-hosting/deployment) page.
|
||||
- **Cloud (coming soon)**: For a hassle-free experience, choose our cloud offering, which takes care of server maintenance and updates for you.
|
||||
|
||||
## Step 2: Create an account
|
||||
|
||||
1. Visit the Formbricks Sign up page.
|
||||
2. Enter your email address, choose a password, and click **Sign Up** to create your account. Alternatively you can sign up using your GitHub account.
|
||||
|
||||
## Step 3: Switch to the Development Environment
|
||||
|
||||
In Formbricks, you can work in different environments to manage your surveys and settings. We recommend using the **Development environment** for your local testing and staging environments to keep your Production environment and it's data clean. To get started, switch to the **Development Environment**:
|
||||
|
||||
1. Log in to your Formbricks dashboard.
|
||||
2. Click the your profile picture in the top right corner and in the dropdown under your current Environment select **Development**.
|
||||
3. Select **Development** from the list.
|
||||
|
||||
## Step 4: Set up the JavaScript widget
|
||||
|
||||
You can find all the setup instructions as well as a check if your installation was successful in the **Setup Checklist** in the Formbricks settings.
|
||||
|
||||
### HTML
|
||||
|
||||
Add the following script to the `<head>` tag of your HTML file:
|
||||
|
||||
```html
|
||||
<script type="text/javascript">
|
||||
!(function () {
|
||||
var t = document.createElement("script");
|
||||
(t.type = "text/javascript"), (t.async = !0), (t.src = "https://formbricks.com/widget.js");
|
||||
var e = document.getElementsByTagName("script")[0];
|
||||
e.parentNode.insertBefore(t, e),
|
||||
setTimeout(function () {
|
||||
window.formbricks.init({
|
||||
environmentId: "your-environment-id",
|
||||
apiHost: "https://api.formbricks.com",
|
||||
});
|
||||
}, 500);
|
||||
})();
|
||||
</script>
|
||||
```
|
||||
|
||||
Replace your-environment-id with your actual environment ID. You can find your environment ID in the **Setup Checklist** in the Formbricks settings.
|
||||
|
||||
### Npm
|
||||
|
||||
1. Install the Formbricks package using npm:
|
||||
|
||||
```bash
|
||||
npm install @formbricks/js
|
||||
```
|
||||
|
||||
2. Import Formbricks and initialize the widget in your main component (e.g., App.tsx or App.js):
|
||||
|
||||
```javascript
|
||||
import formbricks from "@formbricks/js";
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
formbricks.init({
|
||||
environmentId: "your-environment-id",
|
||||
apiHost: "https://api.formbricks.com",
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
Replace your-environment-id with your actual environment ID. You can find your environment ID in the **Setup Checklist** in the Formbricks settings.
|
||||
|
||||
For more detailed guides for different frameworks, check out our [Next.js](/docs/getting-started/nextjs) and [Vue.js](/docs/getting-started/vuejs) guides.
|
||||
|
||||
## Step 5: Verify your setup
|
||||
|
||||
After setting up the widget, head back to the Formbricks dashboard: 1. Navigate to **Settings** in the top menubar. 2. Check the **Setup Checklist** to ensure everything is working
|
||||
correctly. If all items in the checklist are marked as complete, congratulations! You've successfully set up
|
||||
Formbricks, and you're ready to start creating and customizing your in-product surveys.
|
||||
|
||||
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;
|
||||
@@ -0,0 +1,81 @@
|
||||
import { Layout } from "@/components/docs/Layout";
|
||||
|
||||
export const meta = {
|
||||
title: "Quickstart",
|
||||
};
|
||||
|
||||
# Setting up Formbricks SDK with Vue.js
|
||||
|
||||
In this guide, we will go through the steps to set up the Formbricks SDK in a Vue.js application. This will allow you to create and customize in-product micro-surveys to gather valuable feedback from your users and improve your product experience.
|
||||
|
||||
## Introduction
|
||||
|
||||
Integrating the Formbricks SDK with Vue.js is a straightforward process. We will make sure the SDK is only loaded and used on the client side, as it's not intended for server-side usage.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before proceeding, ensure you have the following:
|
||||
|
||||
1. A Vue.js application set up and ready to go.
|
||||
2. A Formbricks account with an `environmentId` and `apiHost` for your application. You can find these in the Setup Checklist in the Settings.
|
||||
|
||||
## Installation
|
||||
|
||||
To get started, install the Formbricks SDK using your preferred package manager:
|
||||
|
||||
```bash
|
||||
npm install --save @formbricks/js
|
||||
# or
|
||||
yarn add @formbricks/js
|
||||
# or
|
||||
pnpm add @formbricks/js
|
||||
```
|
||||
|
||||
## Integration
|
||||
|
||||
1. Create a new file called \`formbricks.js\` inside the \`src\` folder of your Vue.js application, and add the following code to initialize the Formbricks SDK:
|
||||
|
||||
```javascript
|
||||
import formbricks from "@formbricks/js";
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
formbricks.init({
|
||||
environmentId: "your-environment-id",
|
||||
apiHost: "your-api-host",
|
||||
});
|
||||
}
|
||||
|
||||
export default formbricks;
|
||||
```
|
||||
|
||||
2. In your main.js or main.ts file, import the formbricks.js module:
|
||||
|
||||
```javascript
|
||||
import formbricks from "@/formbricks";
|
||||
```
|
||||
|
||||
3. To make sure Formbricks SDK registers every page change in your Vue.js application, add a global navigation guard to your Vue Router configuration:
|
||||
|
||||
```javascript
|
||||
import Vue from "vue";
|
||||
import VueRouter from "vue-router";
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
const router = new VueRouter({
|
||||
// Your router configuration here
|
||||
});
|
||||
|
||||
// Add a global navigation guard
|
||||
router.afterEach((to, from) => {
|
||||
if (typeof formbricks !== "undefined") {
|
||||
formbricks.registerRouteChange();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Now, the Formbricks SDK is set up and ready to use in your Vue.js application. You can start creating and customizing in-product micro-surveys for your users.
|
||||
|
||||
For more information on how to use Formbricks SDK, check the rest of the documentation.
|
||||
|
||||
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;
|
||||