feat(stripe): enable Stripe integration and update UI components (#1159)
* feat(stripe): enable Stripe integration and update UI components * refactor(import): streamline user ID and sandbox status fetching logic
This commit is contained in:
@@ -1955,13 +1955,12 @@ const StripePanel = getSettingsPanel('stripe')
|
||||
type ImportMode = null | 'psd2' | 'stripe' | 'bank' | 'sie' | 'csv_data' | 'migration'
|
||||
|
||||
export default function ImportPage() {
|
||||
const { company } = useCompany()
|
||||
const { isSandbox } = useCompany()
|
||||
const [mode, setMode] = useState<ImportMode>(null)
|
||||
const [view, setView] = useState<'import' | 'export'>('import')
|
||||
const [sieDialogOpen, setSieDialogOpen] = useState(false)
|
||||
const [cloudOpen, setCloudOpen] = useState(false)
|
||||
const [userId, setUserId] = useState('')
|
||||
const [isSandbox, setIsSandbox] = useState(false)
|
||||
const [exportPeriodId, setExportPeriodId] = useState<string | null>(null)
|
||||
const [exportExcludeClosing, setExportExcludeClosing] = useState(true)
|
||||
const t = useTranslations('import')
|
||||
@@ -1969,21 +1968,11 @@ export default function ImportPage() {
|
||||
const hasCloudBackup = ENABLED_EXTENSION_IDS.has('cloud-backup')
|
||||
const hasBankSync = useCapability(CAPABILITY.bank_sync)
|
||||
|
||||
// Fetch authenticated user ID and sandbox status
|
||||
// Fetch authenticated user ID (used by the migration wizard)
|
||||
useEffect(() => {
|
||||
const supabase = createClient()
|
||||
supabase.auth.getUser().then(({ data: { user } }) => {
|
||||
if (!user) return
|
||||
setUserId(user.id)
|
||||
if (!company) return
|
||||
supabase
|
||||
.from('company_settings')
|
||||
.select('is_sandbox')
|
||||
.eq('company_id', company.id)
|
||||
.single()
|
||||
.then(({ data }) => {
|
||||
if (data?.is_sandbox) setIsSandbox(true)
|
||||
})
|
||||
if (user) setUserId(user.id)
|
||||
})
|
||||
}, [])
|
||||
|
||||
@@ -2039,10 +2028,8 @@ export default function ImportPage() {
|
||||
const hasBankingExtension = ENABLED_EXTENSION_IDS.has('enable-banking')
|
||||
const hasMigrationExtension = ENABLED_EXTENSION_IDS.has('arcim-migration')
|
||||
const hasStripeExtension = ENABLED_EXTENSION_IDS.has('stripe')
|
||||
// Hosted: Stripe Connect has not launched, so the card is "coming soon".
|
||||
// The panel carries the same gate internally for ?mode=stripe deep links.
|
||||
const isSelfHosted = process.env.NEXT_PUBLIC_SELF_HOSTED === 'true'
|
||||
const stripeDisabled = isSandbox || !isSelfHosted
|
||||
// Stripe is enabled everywhere (hosted + self-hosted); only the sandbox blocks it.
|
||||
const stripeDisabled = isSandbox
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
@@ -2109,13 +2096,7 @@ export default function ImportPage() {
|
||||
<ImportRow
|
||||
title={t('stripe_title')}
|
||||
sub={t('stripe_description')}
|
||||
chip={
|
||||
!isSelfHosted ? (
|
||||
<span className="rounded-full bg-secondary px-2 py-0.5 text-[11px] font-medium leading-none text-muted-foreground">
|
||||
{t('stripe_coming_soon')}
|
||||
</span>
|
||||
) : undefined
|
||||
}
|
||||
chips={<LogoChip src="/logos/stripe.svg" name="Stripe" />}
|
||||
disabled={stripeDisabled}
|
||||
onClick={() => setMode('stripe')}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user