Skip to content

Commit

Permalink
💄 (js) Make sure lite badge can't be hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 13, 2023
1 parent 5d8c990 commit 1863281
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.0.24",
"version": "0.0.25",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",
Expand Down
26 changes: 26 additions & 0 deletions packages/js/src/assets/immutable.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.lite-badge {
position: absolute !important;
padding: 4px 8px !important;
background-color: white !important;
z-index: 50 !important;
border-radius: 4px !important;
color: rgb(17 24 39) !important;
gap: 8px !important;
font-size: 14px !important;
line-height: 20px !important;
font-weight: 600 !important;
border-width: 1px !important;
/* Make sure the badge is always displayed */
opacity: 1 !important;
visibility: visible !important;
display: flex !important;
top: auto !important;
right: auto !important;
left: auto !important;
bottom: 20px !important;
transition: background-color 0.2s ease-in-out !important;
}

.lite-badge:hover {
background-color: #f7f8ff !important;
}
2 changes: 2 additions & 0 deletions packages/js/src/components/Bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
setResultInSession,
} from '@/utils/sessionStorage'
import { setCssVariablesValue } from '@/utils/setCssVariablesValue'
import immutableCss from '../assets/immutable.css'

export type BotProps = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -100,6 +101,7 @@ export const Bot = (props: BotProps & { class?: string }) => {
return (
<>
<style>{customCss()}</style>
<style>{immutableCss}</style>
<Show when={error()} keyed>
{(error) => <ErrorMessage error={error} />}
</Show>
Expand Down
15 changes: 11 additions & 4 deletions packages/js/src/components/LiteBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { onCleanup, onMount } from 'solid-js'
import { TypebotLogo } from './icons/TypebotLogo'

type Props = {
botContainer: HTMLDivElement | undefined
Expand All @@ -11,8 +12,14 @@ export const LiteBadge = (props: Props) => {
const appendBadgeIfNecessary = (mutations: MutationRecord[]) => {
mutations.forEach((mutation) => {
mutation.removedNodes.forEach((removedNode) => {
if ('id' in removedNode && liteBadge && removedNode.id == 'lite-badge')
if (
'id' in removedNode &&
liteBadge &&
removedNode.id == 'lite-badge'
) {
console.log("Sorry, you can't remove the brand 😅")
props.botContainer?.append(liteBadge)
}
})
})
}
Expand All @@ -36,11 +43,11 @@ export const LiteBadge = (props: Props) => {
href={'https://www.typebot.io/?utm_source=litebadge'}
target="_blank"
rel="noopener noreferrer"
class="absolute py-1 px-2 bg-white z-50 rounded shadow-md lite-badge text-gray-900"
style={{ bottom: '20px', display: 'block' }}
class="lite-badge"
id="lite-badge"
>
Made with <span class="text-blue-500">Typebot</span>.
<TypebotLogo />
<span>Made with Typebot</span>
</a>
)
}
37 changes: 37 additions & 0 deletions packages/js/src/components/icons/TypebotLogo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export const TypebotLogo = () => {
return (
<svg viewBox="0 0 800 800" width={16}>
<rect width="800" height="800" rx="80" fill="#0042DA" />
<rect
x="650"
y="293"
width="85.4704"
height="384.617"
rx="20"
transform="rotate(90 650 293)"
fill="#FF8E20"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M192.735 378.47C216.337 378.47 235.47 359.337 235.47 335.735C235.47 312.133 216.337 293 192.735 293C169.133 293 150 312.133 150 335.735C150 359.337 169.133 378.47 192.735 378.47Z"
fill="#FF8E20"
/>
<rect
x="150"
y="506.677"
width="85.4704"
height="384.617"
rx="20"
transform="rotate(-90 150 506.677)"
fill="white"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M607.265 421.206C583.663 421.206 564.53 440.34 564.53 463.942C564.53 487.544 583.663 506.677 607.265 506.677C630.867 506.677 650 487.544 650 463.942C650 440.34 630.867 421.206 607.265 421.206Z"
fill="white"
/>
</svg>
)
}
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.0.24",
"version": "0.0.25",
"description": "React library to display typebots on your website",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

4 comments on commit 1863281

@vercel
Copy link

@vercel vercel bot commented on 1863281 Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 1863281 Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 1863281 Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

ns8.vn
1stop.au
yobot.me
klujo.com
me.cr8.ai
247987.com
8jours.top
aginap.com
ai.mprs.in
bee.cr8.ai
bot.aws.bj
bot.bbc.bj
cat.cr8.ai
finplex.be
nepkit.com
pig.cr8.ai
sat.cr8.ai
bot.aipr.kr
bot.joof.it
bull.cr8.ai
docs.cr8.ai
minipost.uk
mole.cr8.ai
team.cr8.ai
wolf.cr8.ai
cinecorn.com
help.taxt.co
kusamint.com
rhino.cr8.ai
sheep.cr8.ai
snake.cr8.ai
svhm.mprs.in
tiger.cr8.ai
video.cr8.ai
yoda.riku.ai
zebra.cr8.ai
bergamo.store
bot.krdfy.com
bot.tvbeat.it
cgcassets.com
cnvhub.com.br
facelabko.com
filmylogy.com
goldorayo.com
rabbit.cr8.ai
signup.cr8.ai
start.taxt.co
turkey.cr8.ai
vhpage.cr8.ai
start.taxtree.io
typebot.aloe.bot
voicehelp.cr8.ai
zap.fundviser.in
app.bouclidom.com
app.chatforms.net
bot.hostnation.de
bot.maitempah.com
bot.phuonghub.com
bot.reviewzer.com
bot.rihabilita.it
cares.urlabout.me
chat.gaswadern.de
fmm.wpwakanda.com
gentleman-shop.fr
k1.kandabrand.com
kp.pedroknoll.com
lb.ticketfute.com
ov1.wpwakanda.com
ov2.wpwakanda.com
ov3.wpwakanda.com
support.triplo.ai
viewer.typebot.io
welcome.triplo.ai
1988.bouclidom.com
andreimayer.com.br
bot.danyservice.it
bot.iconicbrows.it
bot.megafox.com.br
bot.neferlopez.com
bots.robomotion.io
cadu.uninta.edu.br
dicanatural.online
digitalhelp.com.au
goalsettingbot.com
pant.maxbot.com.br
positivobra.com.br
survey.digienge.io
this-is-a-test.com
zap.techadviser.in
ai.digitaldaftar.in
bot.boston-voip.com
bot.cabinpromos.com
bot.digitalbled.com
bot.dsignagency.com
bot.eventhub.com.au
bot.jepierre.com.br
bot.leadgenpod.site
bot.ltmidias.com.br
chat.marius.digital
chatbot.matthesv.de

@vercel
Copy link

@vercel vercel bot commented on 1863281 Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app
docs.typebot.io

Please sign in to comment.