Skip to content

Commit

Permalink
⬆️ Upgrade dependencies
Browse files Browse the repository at this point in the history
Closes #198, closes #171
  • Loading branch information
baptisteArno committed Jan 2, 2023
1 parent b9ed50b commit ec7481d
Show file tree
Hide file tree
Showing 22 changed files with 992 additions and 942 deletions.
22 changes: 11 additions & 11 deletions apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"test:report": "pnpm playwright show-report"
},
"dependencies": {
"@chakra-ui/anatomy": "^2.1.0",
"@chakra-ui/css-reset": "2.0.10",
"@chakra-ui/react": "2.4.4",
"@chakra-ui/theme-tools": "^2.0.14",
"@chakra-ui/anatomy": "^2.1.1",
"@chakra-ui/css-reset": "2.0.11",
"@chakra-ui/react": "2.4.6",
"@chakra-ui/theme-tools": "^2.0.16",
"@codemirror/lang-css": "6.0.1",
"@codemirror/lang-html": "6.4.0",
"@codemirror/lang-javascript": "6.1.2",
"@codemirror/lang-json": "6.0.1",
"@codemirror/lint": "6.1.0",
"@codemirror/state": "6.1.4",
"@codemirror/state": "6.2.0",
"@dnd-kit/core": "6.0.6",
"@dnd-kit/sortable": "7.0.1",
"@dnd-kit/utilities": "3.2.1",
Expand Down Expand Up @@ -49,7 +49,7 @@
"@udecode/plate-ui-link": "18.13.0",
"@udecode/plate-ui-toolbar": "18.13.0",
"@use-gesture/react": "^10.2.23",
"aws-sdk": "2.1282.0",
"aws-sdk": "2.1286.0",
"bot-engine": "workspace:*",
"browser-image-compression": "2.0.0",
"canvas-confetti": "1.6.0",
Expand All @@ -73,7 +73,7 @@
"micro-cors": "0.1.1",
"minio": "7.0.32",
"next": "13.1.1",
"next-auth": "4.12.3",
"next-auth": "4.18.7",
"nextjs-cors": "^2.1.2",
"nodemailer": "6.8.0",
"nprogress": "0.2.0",
Expand All @@ -98,24 +98,24 @@
},
"devDependencies": {
"@babel/core": "7.20.7",
"@chakra-ui/styled-system": "2.5.0",
"@chakra-ui/styled-system": "2.5.1",
"@playwright/test": "1.29.1",
"@types/canvas-confetti": "1.6.0",
"@types/google-spreadsheet": "3.3.0",
"@types/jsonwebtoken": "9.0.0",
"@types/micro-cors": "0.1.2",
"@types/minio": "7.0.15",
"@types/node": "18.11.17",
"@types/node": "18.11.18",
"@types/nodemailer": "6.4.7",
"@types/nprogress": "0.2.0",
"@types/papaparse": "5.3.5",
"@types/papaparse": "5.3.7",
"@types/prettier": "2.7.2",
"@types/qs": "6.9.7",
"@types/react": "18.0.26",
"@types/tinycolor2": "1.4.3",
"db": "workspace:*",
"dotenv": "16.0.3",
"eslint": "8.30.0",
"eslint": "8.31.0",
"eslint-config-custom": "workspace:*",
"models": "workspace:*",
"next-transpile-modules": "10.0.0",
Expand Down
12 changes: 8 additions & 4 deletions apps/builder/src/components/icons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IconProps, Icon } from '@chakra-ui/react'
import { IconProps, Icon, useColorModeValue } from '@chakra-ui/react'

export const featherIconsBaseProps: IconProps = {
fill: 'none',
Expand Down Expand Up @@ -353,9 +353,13 @@ export const SendEmailIcon = (props: IconProps) => (
)

export const GithubIcon = (props: IconProps) => (
<Icon viewBox="0 0 512 512" {...props}>
<title>{'Logo Github'}</title>
<path d="M256 32C132.3 32 32 134.9 32 261.7c0 101.5 64.2 187.5 153.2 217.9a17.56 17.56 0 003.8.4c8.3 0 11.5-6.1 11.5-11.4 0-5.5-.2-19.9-.3-39.1a102.4 102.4 0 01-22.6 2.7c-43.1 0-52.9-33.5-52.9-33.5-10.2-26.5-24.9-33.6-24.9-33.6-19.5-13.7-.1-14.1 1.4-14.1h.1c22.5 2 34.3 23.8 34.3 23.8 11.2 19.6 26.2 25.1 39.6 25.1a63 63 0 0025.6-6c2-14.8 7.8-24.9 14.2-30.7-49.7-5.8-102-25.5-102-113.5 0-25.1 8.7-45.6 23-61.6-2.3-5.8-10-29.2 2.2-60.8a18.64 18.64 0 015-.5c8.1 0 26.4 3.1 56.6 24.1a208.21 208.21 0 01112.2 0c30.2-21 48.5-24.1 56.6-24.1a18.64 18.64 0 015 .5c12.2 31.6 4.5 55 2.2 60.8 14.3 16.1 23 36.6 23 61.6 0 88.2-52.4 107.6-102.3 113.3 8 7.1 15.2 21.1 15.2 42.5 0 30.7-.3 55.5-.3 63 0 5.4 3.1 11.5 11.4 11.5a19.35 19.35 0 004-.4C415.9 449.2 480 363.1 480 261.7 480 134.9 379.7 32 256 32z" />
<Icon viewBox="0 0 98 96" xmlns="http://www.w3.org/2000/svg" {...props}>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"
fill={useColorModeValue('#24292f', 'white')}
/>
</Icon>
)

Expand Down
6 changes: 0 additions & 6 deletions apps/builder/src/features/account/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const userContext = createContext<{
isLoading: boolean
isSaving: boolean
hasUnsavedChanges: boolean
isOAuthProvider: boolean
currentWorkspaceId?: string
updateUser: (newUser: Partial<User>) => void
saveUser: (newUser?: Partial<User>) => Promise<void>
Expand All @@ -36,10 +35,6 @@ export const UserProvider = ({ children }: { children: ReactNode }) => {
const [currentWorkspaceId, setCurrentWorkspaceId] = useState<string>()

const [isSaving, setIsSaving] = useState(false)
const isOAuthProvider = useMemo(
() => (session?.providerType as boolean | undefined) ?? false,
[session?.providerType]
)

const hasUnsavedChanges = useMemo(
() => !dequal(session?.user, user),
Expand Down Expand Up @@ -97,7 +92,6 @@ export const UserProvider = ({ children }: { children: ReactNode }) => {
isSaving,
isLoading: status === 'loading',
hasUnsavedChanges,
isOAuthProvider,
currentWorkspaceId,
updateUser,
saveUser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@ import { UploadButton } from '@/components/ImageUploadContent/UploadButton'
import { useUser } from '@/features/account'

export const MyAccountForm = () => {
const {
user,
updateUser,
saveUser,
hasUnsavedChanges,
isSaving,
isOAuthProvider,
} = useUser()
const { user, updateUser, saveUser, hasUnsavedChanges, isSaving } = useUser()

const handleFileUploaded = async (url: string) => {
updateUser({ image: url })
Expand Down Expand Up @@ -74,12 +67,7 @@ export const MyAccountForm = () => {
hasArrow
>
<FormControl>
<FormLabel
htmlFor="email"
color={isOAuthProvider ? 'gray.500' : 'current'}
>
Email address
</FormLabel>
<FormLabel htmlFor="email">Email address</FormLabel>
<Input
id="email"
type="email"
Expand Down
1 change: 1 addition & 0 deletions apps/builder/src/features/auth/components/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const SignInForm = ({
})
setAuthLoading(false)
}

if (isLoadingProviders) return <Spinner />
if (hasNoAuthProvider)
return (
Expand Down
67 changes: 41 additions & 26 deletions apps/builder/src/features/auth/components/SocialLoginButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useSession,
} from 'next-auth/react'
import { useRouter } from 'next/router'
import React from 'react'
import React, { useState } from 'react'
import { stringify } from 'qs'
import { BuiltInProviderType } from 'next-auth/providers'
import { GoogleLogo } from '@/components/GoogleLogo'
Expand All @@ -22,31 +22,28 @@ type Props = {
export const SocialLoginButtons = ({ providers }: Props) => {
const { query } = useRouter()
const { status } = useSession()
const [authLoading, setAuthLoading] =
useState<LiteralUnion<BuiltInProviderType, string>>()

const handleGitHubClick = async () =>
signIn('github', {
const handleSignIn = async (provider: string) => {
setAuthLoading(provider)
await signIn(provider, {
callbackUrl: `/typebots?${stringify(query)}`,
})
setTimeout(() => setAuthLoading(undefined), 3000)
}

const handleGoogleClick = async () =>
signIn('google', {
callbackUrl: `/typebots?${stringify(query)}`,
})
const handleGitHubClick = () => handleSignIn('github')

const handleFacebookClick = async () =>
signIn('facebook', {
callbackUrl: `/typebots?${stringify(query)}`,
})
const handleGoogleClick = () => handleSignIn('google')

const handleGitlabClick = async () =>
signIn('gitlab', {
callbackUrl: `/typebots?${stringify(query)}`,
})
const handleFacebookClick = () => handleSignIn('facebook')

const handleAzureAdClick = async () =>
signIn('azure-ad', {
callbackUrl: `/typebots?${stringify(query)}`,
})
const handleGitlabClick = () => handleSignIn('gitlab')

const handleAzureAdClick = () => handleSignIn('azure-ad')

const handleCustomOAuthClick = () => handleSignIn('custom-oauth')

return (
<Stack>
Expand All @@ -55,7 +52,10 @@ export const SocialLoginButtons = ({ providers }: Props) => {
leftIcon={<GithubIcon />}
onClick={handleGitHubClick}
data-testid="github"
isLoading={['loading', 'authenticated'].includes(status)}
isLoading={
['loading', 'authenticated'].includes(status) ||
authLoading === 'github'
}
variant="outline"
>
Continue with GitHub
Expand All @@ -66,7 +66,10 @@ export const SocialLoginButtons = ({ providers }: Props) => {
leftIcon={<GoogleLogo />}
onClick={handleGoogleClick}
data-testid="google"
isLoading={['loading', 'authenticated'].includes(status)}
isLoading={
['loading', 'authenticated'].includes(status) ||
authLoading === 'google'
}
variant="outline"
>
Continue with Google
Expand All @@ -77,7 +80,10 @@ export const SocialLoginButtons = ({ providers }: Props) => {
leftIcon={<FacebookLogo />}
onClick={handleFacebookClick}
data-testid="facebook"
isLoading={['loading', 'authenticated'].includes(status)}
isLoading={
['loading', 'authenticated'].includes(status) ||
authLoading === 'facebook'
}
variant="outline"
>
Continue with Facebook
Expand All @@ -88,7 +94,10 @@ export const SocialLoginButtons = ({ providers }: Props) => {
leftIcon={<GitlabLogo />}
onClick={handleGitlabClick}
data-testid="gitlab"
isLoading={['loading', 'authenticated'].includes(status)}
isLoading={
['loading', 'authenticated'].includes(status) ||
authLoading === 'gitlab'
}
variant="outline"
>
Continue with {providers.gitlab.name}
Expand All @@ -99,16 +108,22 @@ export const SocialLoginButtons = ({ providers }: Props) => {
leftIcon={<AzureAdLogo />}
onClick={handleAzureAdClick}
data-testid="azure-ad"
isLoading={['loading', 'authenticated'].includes(status)}
isLoading={
['loading', 'authenticated'].includes(status) ||
authLoading === 'azure-ad'
}
variant="outline"
>
Continue with {providers['azure-ad'].name}
</Button>
)}
{providers?.['custom-oauth'] && (
<Button
onClick={handleAzureAdClick}
isLoading={['loading', 'authenticated'].includes(status)}
onClick={handleCustomOAuthClick}
isLoading={
['loading', 'authenticated'].includes(status) ||
authLoading === 'custom-oauth'
}
variant="outline"
>
Continue with {providers['custom-oauth'].name}
Expand Down
10 changes: 8 additions & 2 deletions apps/builder/src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,14 @@ const handler = (req: NextApiRequest, res: NextApiResponse) => {
}
},
signIn: async ({ account, user }) => {
const userExists = user?.graphNavigation !== undefined
if (!account || (process.env.DISABLE_SIGNUP === 'true' && !userExists))
const userExists =
'graphNavigation' in user && user.graphNavigation !== undefined
if (
!account ||
(process.env.DISABLE_SIGNUP === 'true' &&
!userExists &&
user.email !== process.env.ADMIN_EMAIL)
)
return false
const requiredGroups = getRequiredGroups(account.provider)
if (requiredGroups.length > 0) {
Expand Down
19 changes: 12 additions & 7 deletions apps/builder/src/pages/api/auth/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Plan,
WorkspaceRole,
WorkspaceInvitation,
Session,
} from 'db'
import type { Adapter, AdapterUser } from 'next-auth/adapters'
import cuid from 'cuid'
Expand Down Expand Up @@ -74,19 +75,23 @@ export function CustomAdapter(p: PrismaClient): Adapter {
await convertInvitationsToCollaborations(p, user, invitations)
if (workspaceInvitations.length > 0)
await joinWorkspaces(p, user, workspaceInvitations)
return createdUser
return createdUser as AdapterUser
},
getUser: (id) => p.user.findUnique({ where: { id } }),
getUserByEmail: (email) => p.user.findUnique({ where: { email } }),
getUser: async (id) =>
(await p.user.findUnique({ where: { id } })) as AdapterUser,
getUserByEmail: async (email) =>
(await p.user.findUnique({ where: { email } })) as AdapterUser,
async getUserByAccount(provider_providerAccountId) {
const account = await p.account.findUnique({
where: { provider_providerAccountId },
select: { user: true },
})
return account?.user ?? null
return (account?.user ?? null) as AdapterUser | null
},
updateUser: (data) => p.user.update({ where: { id: data.id }, data }),
deleteUser: (id) => p.user.delete({ where: { id } }),
updateUser: async (data) =>
(await p.user.update({ where: { id: data.id }, data })) as AdapterUser,
deleteUser: async (id) =>
(await p.user.delete({ where: { id } })) as AdapterUser,
linkAccount: async (data) => {
await p.account.create({
data: {
Expand Down Expand Up @@ -117,7 +122,7 @@ export function CustomAdapter(p: PrismaClient): Adapter {
})
if (!userAndSession) return null
const { user, ...session } = userAndSession
return { user, session }
return { user, session } as { user: AdapterUser; session: Session }
},
createSession: (data) => p.session.create({ data }),
updateSession: (data) =>
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/test/utils/databaseActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const addSubscriptionToWorkspace = async (
card: {
number: '4242424242424242',
exp_month: 12,
exp_year: 2022,
exp_year: 2024,
cvc: '123',
},
type: 'card',
Expand Down
3 changes: 3 additions & 0 deletions apps/docs/openapi/chat/_spec_.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@
"type": "string"
}
},
"required": [
"retryMessageContent"
],
"additionalProperties": false
}
]
Expand Down
10 changes: 5 additions & 5 deletions apps/landing-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"analyze": "cross-env ANALYZE=true next build"
},
"dependencies": {
"@chakra-ui/icon": "3.0.13",
"@chakra-ui/react": "2.4.4",
"@chakra-ui/icon": "3.0.14",
"@chakra-ui/react": "2.4.6",
"@emotion/react": "11.10.5",
"@emotion/styled": "11.10.5",
"@vercel/analytics": "0.1.6",
Expand All @@ -28,14 +28,14 @@
},
"devDependencies": {
"@babel/core": "7.20.7",
"@chakra-ui/styled-system": "2.5.0",
"@chakra-ui/styled-system": "2.5.1",
"@next/bundle-analyzer": "13.1.1",
"@types/aos": "3.0.4",
"@types/node": "18.11.17",
"@types/node": "18.11.18",
"@types/react": "18.0.26",
"autoprefixer": "10.4.13",
"cross-env": "7.0.3",
"eslint": "8.30.0",
"eslint": "8.31.0",
"eslint-config-custom": "workspace:*",
"next-transpile-modules": "10.0.0",
"postcss": "8.4.20",
Expand Down
Loading

0 comments on commit ec7481d

Please sign in to comment.