-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81bc074
commit e293cb0
Showing
70 changed files
with
918 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Publish @typebot.io/nextjs package to NPM | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'nextjs-v*' | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: pnpm/action-setup@v2.2.2 | ||
- run: pnpm i --frozen-lockfile | ||
- run: pnpm turbo build --filter=@typebot.io/nextjs... | ||
- run: cd packages/embeds/nextjs && pnpm publish --no-git-checks --access public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/builder/src/features/dashboard/components/OnboardingModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
apps/builder/src/features/publish/components/embeds/logos/NextjsLogo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Icon, IconProps } from '@chakra-ui/react' | ||
|
||
export const NextjsLogo = (props: IconProps) => ( | ||
<Icon | ||
aria-label="Next.js logomark" | ||
height="80" | ||
role="img" | ||
viewBox="0 0 180 180" | ||
width="80" | ||
{...props} | ||
> | ||
<mask | ||
height="180" | ||
id=":R0:mask0_408_134" | ||
maskUnits="userSpaceOnUse" | ||
style={{ maskType: 'alpha' }} | ||
width="180" | ||
x="0" | ||
y="0" | ||
> | ||
<circle cx="90" cy="90" fill="black" r="90"></circle> | ||
</mask> | ||
<g mask="url(#:R0:mask0_408_134)"> | ||
<circle cx="90" cy="90" data-circle="true" fill="black" r="90"></circle> | ||
<path | ||
d="M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z" | ||
fill="url(#:R0:paint0_linear_408_134)" | ||
></path> | ||
<rect | ||
fill="url(#:R0:paint1_linear_408_134)" | ||
height="72" | ||
width="12" | ||
x="115" | ||
y="54" | ||
></rect> | ||
</g> | ||
<defs> | ||
<linearGradient | ||
gradientUnits="userSpaceOnUse" | ||
id=":R0:paint0_linear_408_134" | ||
x1="109" | ||
x2="144.5" | ||
y1="116.5" | ||
y2="160.5" | ||
> | ||
<stop stop-color="white"></stop> | ||
<stop offset="1" stop-color="white" stop-opacity="0"></stop> | ||
</linearGradient> | ||
<linearGradient | ||
gradientUnits="userSpaceOnUse" | ||
id=":R0:paint1_linear_408_134" | ||
x1="121" | ||
x2="120.799" | ||
y1="54" | ||
y2="106.875" | ||
> | ||
<stop stop-color="white"></stop> | ||
<stop offset="1" stop-color="white" stop-opacity="0"></stop> | ||
</linearGradient> | ||
</defs> | ||
</Icon> | ||
) |
2 changes: 1 addition & 1 deletion
2
...features/publish/components/embeds/modals/GtmModal/instructions/GtmBubbleInstructions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...publish/components/embeds/modals/Javascript/instructions/JavascriptBubbleInstructions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...lder/src/features/publish/components/embeds/modals/Nextjs/InstallNextjsPackageSnippet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { CodeEditor } from '@/components/inputs/CodeEditor' | ||
|
||
export const InstallNextjsPackageSnippet = () => { | ||
return ( | ||
<CodeEditor | ||
value={`npm install @typebot.io/nextjs`} | ||
isReadOnly | ||
lang="shell" | ||
/> | ||
) | ||
} |
31 changes: 31 additions & 0 deletions
31
apps/builder/src/features/publish/components/embeds/modals/Nextjs/NextjsBubbleSnippet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { CodeEditor } from '@/components/inputs/CodeEditor' | ||
import { useTypebot } from '@/features/editor/providers/TypebotProvider' | ||
import { BubbleProps } from '@typebot.io/nextjs' | ||
import parserBabel from 'prettier/parser-babel' | ||
import prettier from 'prettier/standalone' | ||
import { parseReactBubbleProps } from '../../snippetParsers' | ||
|
||
export const NextjsBubbleSnippet = ({ | ||
theme, | ||
previewMessage, | ||
}: Pick<BubbleProps, 'theme' | 'previewMessage'>) => { | ||
const { typebot } = useTypebot() | ||
|
||
const snippet = prettier.format( | ||
`import { Bubble } from "@typebot.io/nextjs"; | ||
const App = () => { | ||
return <Bubble ${parseReactBubbleProps({ | ||
typebot: typebot?.publicId ?? '', | ||
theme, | ||
previewMessage, | ||
})}/> | ||
}`, | ||
{ | ||
parser: 'babel', | ||
plugins: [parserBabel], | ||
} | ||
) | ||
|
||
return <CodeEditor value={snippet} lang="javascript" isReadOnly /> | ||
} |
25 changes: 25 additions & 0 deletions
25
apps/builder/src/features/publish/components/embeds/modals/Nextjs/NextjsModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, { useState } from 'react' | ||
import { ModalProps } from '../../EmbedButton' | ||
import { EmbedModal } from '../../EmbedModal' | ||
import { isDefined } from '@udecode/plate-common' | ||
import { NextjsInstructions } from './instructions/NextjsInstructions' | ||
|
||
export const NextjsModal = ({ isOpen, onClose, isPublished }: ModalProps) => { | ||
const [selectedEmbedType, setSelectedEmbedType] = useState< | ||
'standard' | 'popup' | 'bubble' | undefined | ||
>() | ||
return ( | ||
<EmbedModal | ||
titlePrefix="Next.js" | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
isPublished={isPublished} | ||
onSelectEmbedType={setSelectedEmbedType} | ||
selectedEmbedType={selectedEmbedType} | ||
> | ||
{isDefined(selectedEmbedType) && ( | ||
<NextjsInstructions type={selectedEmbedType} /> | ||
)} | ||
</EmbedModal> | ||
) | ||
} |
29 changes: 29 additions & 0 deletions
29
apps/builder/src/features/publish/components/embeds/modals/Nextjs/NextjsPopupSnippet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { CodeEditor } from '@/components/inputs/CodeEditor' | ||
import { useTypebot } from '@/features/editor/providers/TypebotProvider' | ||
import { PopupProps } from '@typebot.io/nextjs' | ||
import parserBabel from 'prettier/parser-babel' | ||
import prettier from 'prettier/standalone' | ||
import { parseReactPopupProps } from '../../snippetParsers' | ||
|
||
export const NextjsPopupSnippet = ({ | ||
autoShowDelay, | ||
}: Pick<PopupProps, 'autoShowDelay'>) => { | ||
const { typebot } = useTypebot() | ||
|
||
const snippet = prettier.format( | ||
`import { Popup } from "@typebot.io/nextjs"; | ||
const App = () => { | ||
return <Popup ${parseReactPopupProps({ | ||
typebot: typebot?.publicId ?? '', | ||
autoShowDelay, | ||
})}/>; | ||
}`, | ||
{ | ||
parser: 'babel', | ||
plugins: [parserBabel], | ||
} | ||
) | ||
|
||
return <CodeEditor value={snippet} lang="javascript" isReadOnly /> | ||
} |
28 changes: 28 additions & 0 deletions
28
apps/builder/src/features/publish/components/embeds/modals/Nextjs/NextjsStandardSnippet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { CodeEditor } from '@/components/inputs/CodeEditor' | ||
import { useTypebot } from '@/features/editor/providers/TypebotProvider' | ||
import parserBabel from 'prettier/parser-babel' | ||
import prettier from 'prettier/standalone' | ||
import { parseReactBotProps } from '../../snippetParsers' | ||
|
||
type Props = { widthLabel?: string; heightLabel: string } | ||
|
||
export const NextjsStandardSnippet = ({ | ||
widthLabel, | ||
heightLabel, | ||
}: Props) => { | ||
const { typebot } = useTypebot() | ||
const snippet = prettier.format( | ||
`import { Standard } from "@typebot.io/nextjs"; | ||
const App = () => { | ||
return <Standard ${parseReactBotProps({ | ||
typebot: typebot?.publicId ?? '', | ||
})} style={{width: "${widthLabel}", height: "${heightLabel}"}} /> | ||
}`, | ||
{ | ||
parser: 'babel', | ||
plugins: [parserBabel], | ||
} | ||
) | ||
return <CodeEditor value={snippet} lang="javascript" isReadOnly /> | ||
} |
42 changes: 42 additions & 0 deletions
42
...eatures/publish/components/embeds/modals/Nextjs/instructions/NextjsBubbleInstructions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { useTypebot } from '@/features/editor/providers/TypebotProvider' | ||
import { ListItem, OrderedList, Stack, Text } from '@chakra-ui/react' | ||
import { BubbleProps } from '@typebot.io/nextjs' | ||
import { useState } from 'react' | ||
import { BubbleSettings } from '../../../settings/BubbleSettings/BubbleSettings' | ||
import { InstallNextjsPackageSnippet } from '../InstallNextjsPackageSnippet' | ||
import { NextjsBubbleSnippet } from '../NextjsBubbleSnippet' | ||
import { parseDefaultBubbleTheme } from '../../Javascript/instructions/JavascriptBubbleInstructions' | ||
|
||
export const NextjsBubbleInstructions = () => { | ||
const { typebot } = useTypebot() | ||
const [theme, setTheme] = useState<BubbleProps['theme']>( | ||
parseDefaultBubbleTheme(typebot) | ||
) | ||
const [previewMessage, setPreviewMessage] = | ||
useState<BubbleProps['previewMessage']>() | ||
|
||
return ( | ||
<OrderedList spacing={4} pl={5}> | ||
<ListItem> | ||
<Stack spacing={4}> | ||
<Text>Install the packages</Text> | ||
<InstallNextjsPackageSnippet /> | ||
</Stack> | ||
</ListItem> | ||
<ListItem> | ||
<Stack spacing={4}> | ||
<BubbleSettings | ||
theme={theme} | ||
previewMessage={previewMessage} | ||
defaultPreviewMessageAvatar={ | ||
typebot?.theme.chat.hostAvatar?.url ?? '' | ||
} | ||
onThemeChange={setTheme} | ||
onPreviewMessageChange={setPreviewMessage} | ||
/> | ||
<NextjsBubbleSnippet theme={theme} previewMessage={previewMessage} /> | ||
</Stack> | ||
</ListItem> | ||
</OrderedList> | ||
) | ||
} |
21 changes: 21 additions & 0 deletions
21
.../src/features/publish/components/embeds/modals/Nextjs/instructions/NextjsInstructions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NextjsBubbleInstructions } from './NextjsBubbleInstructions' | ||
import { NextjsPopupInstructions } from './NextjsPopupInstructions' | ||
import { NextjsStandardInstructions } from './NextjsStandardInstructions' | ||
|
||
type Props = { | ||
type: 'standard' | 'popup' | 'bubble' | ||
} | ||
|
||
export const NextjsInstructions = ({ type }: Props) => { | ||
switch (type) { | ||
case 'standard': { | ||
return <NextjsStandardInstructions /> | ||
} | ||
case 'popup': { | ||
return <NextjsPopupInstructions /> | ||
} | ||
case 'bubble': { | ||
return <NextjsBubbleInstructions /> | ||
} | ||
} | ||
} |
Oops, something went wrong.
e293cb0
There was a problem hiding this comment.
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-typebot-io.vercel.app
docs.typebot.io
docs-git-main-typebot-io.vercel.app
e293cb0
There was a problem hiding this comment.
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:
landing-page-v2 – ./apps/landing-page
landing-page-v2-typebot-io.vercel.app
get-typebot.com
landing-page-v2-git-main-typebot-io.vercel.app
www.typebot.io
home.typebot.io
www.get-typebot.com
e293cb0
There was a problem hiding this comment.
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