🐛 Remove publicId and customDomain duplication on imported bots
This commit is contained in:
@@ -25,6 +25,7 @@ import { useScopedI18n } from '@/locales'
|
||||
import { TypebotInDashboard } from '@/features/dashboard/types'
|
||||
import { isMobile } from '@/helpers/isMobile'
|
||||
import { trpc, trpcVanilla } from '@/lib/trpc'
|
||||
import { duplicateName } from '@/features/typebot/helpers/duplicateName'
|
||||
|
||||
type Props = {
|
||||
typebot: TypebotInDashboard
|
||||
@@ -221,10 +222,3 @@ export const TypebotButton = ({
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
const duplicateName = (name: string | `${string} (${number})`) => {
|
||||
const match = name.match(/^(.*) \((\d+)\)$/)
|
||||
if (!match) return `${name} (1)`
|
||||
const [, nameWithoutNumber, number] = match
|
||||
return `${nameWithoutNumber} (${Number(number) + 1})`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user