Chore/Remove Previous Subscription (#5282)
Remove cancel subscription functionality from account controller and UI components; update email background and logo URLs across multiple email templates.
This commit is contained in:
parent
a86f618186
commit
580957e4aa
|
|
@ -2,7 +2,6 @@ import { Request, Response, NextFunction } from 'express'
|
|||
import { StatusCodes } from 'http-status-codes'
|
||||
import { AccountService } from '../services/account.service'
|
||||
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
|
||||
import axios from 'axios'
|
||||
|
||||
export class AccountController {
|
||||
public async register(req: Request, res: Response, next: NextFunction) {
|
||||
|
|
@ -84,30 +83,6 @@ export class AccountController {
|
|||
}
|
||||
}
|
||||
|
||||
public async cancelPreviousCloudSubscrption(req: Request, res: Response, next: NextFunction) {
|
||||
try {
|
||||
const { email } = req.body
|
||||
if (!email) {
|
||||
return res.status(StatusCodes.BAD_REQUEST).json({ message: 'Email is required' })
|
||||
}
|
||||
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json'
|
||||
}
|
||||
|
||||
const response = await axios.post(`${process.env.ENGINE_URL}/cancel-subscription`, { email }, { headers })
|
||||
|
||||
if (response.status === 200) {
|
||||
return res.status(StatusCodes.OK).json(response.data)
|
||||
} else {
|
||||
return res.status(response.status).json(response.data)
|
||||
}
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
public async logout(req: Request, res: Response, next: NextFunction) {
|
||||
try {
|
||||
if (req.user) {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
style='
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -220,7 +220,7 @@
|
|||
<img
|
||||
alt=''
|
||||
width='auto'
|
||||
src='https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png'
|
||||
src='https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png'
|
||||
style='
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@
|
|||
style="
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -338,7 +338,7 @@
|
|||
<img
|
||||
alt=""
|
||||
width="auto"
|
||||
src="https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png"
|
||||
src="https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png"
|
||||
style="
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
style='
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -219,7 +219,7 @@
|
|||
<img
|
||||
alt=''
|
||||
width='auto'
|
||||
src='https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png'
|
||||
src='https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png'
|
||||
style='
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@
|
|||
style="
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -338,7 +338,7 @@
|
|||
<img
|
||||
alt=""
|
||||
width="auto"
|
||||
src="https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png"
|
||||
src="https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png"
|
||||
style="
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
style='
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -219,7 +219,7 @@
|
|||
<img
|
||||
alt=''
|
||||
width='auto'
|
||||
src='https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png'
|
||||
src='https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png'
|
||||
style='
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@
|
|||
style="
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -338,7 +338,7 @@
|
|||
<img
|
||||
alt=""
|
||||
width="auto"
|
||||
src="https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png"
|
||||
src="https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png"
|
||||
style="
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
bgcolor='#000000'
|
||||
>
|
||||
<div
|
||||
style='position: relative;background-color: #151719 !important;background-image:url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);background-position:center top;background-size:contain;background-repeat:no-repeat;'
|
||||
style='position: relative;background-color: #151719 !important;background-image:url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);background-position:center top;background-size:contain;background-repeat:no-repeat;'
|
||||
>
|
||||
|
||||
<div id='illustration' className='relative max-w-6xl mx-auto h-0 pointer-events-none' aria-hidden='true'>
|
||||
|
|
@ -170,7 +170,7 @@
|
|||
<img
|
||||
alt=''
|
||||
width='auto'
|
||||
src='https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png'
|
||||
src='https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png'
|
||||
style='display: block; outline: none; text-decoration: none; height: 40px; font-size: 13px; line-height: 100%; -ms-interpolation-mode: bicubic; border: 0;'
|
||||
/>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@
|
|||
style="
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -338,7 +338,7 @@
|
|||
<img
|
||||
alt=""
|
||||
width="auto"
|
||||
src="https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png"
|
||||
src="https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png"
|
||||
style="
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
style='
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -219,7 +219,7 @@
|
|||
<img
|
||||
alt=''
|
||||
width='auto'
|
||||
src='https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png'
|
||||
src='https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png'
|
||||
style='
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@
|
|||
style="
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -338,7 +338,7 @@
|
|||
<img
|
||||
alt=""
|
||||
width="auto"
|
||||
src="https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png"
|
||||
src="https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png"
|
||||
style="
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
style='
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -219,7 +219,7 @@
|
|||
<img
|
||||
alt=''
|
||||
width='auto'
|
||||
src='https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png'
|
||||
src='https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png'
|
||||
style='
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@
|
|||
style="
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -338,7 +338,7 @@
|
|||
<img
|
||||
alt=""
|
||||
width="auto"
|
||||
src="https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png"
|
||||
src="https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png"
|
||||
style="
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
bgcolor='#000000'
|
||||
>
|
||||
<div
|
||||
style='position: relative;background-color: #151719 !important;background-image:url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);background-position:center top;background-size:contain;background-repeat:no-repeat;'
|
||||
style='position: relative;background-color: #151719 !important;background-image:url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);background-position:center top;background-size:contain;background-repeat:no-repeat;'
|
||||
>
|
||||
|
||||
<div id='illustration' className='relative max-w-6xl mx-auto h-0 pointer-events-none' aria-hidden='true'>
|
||||
|
|
@ -170,7 +170,7 @@
|
|||
<img
|
||||
alt=''
|
||||
width='auto'
|
||||
src='https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png'
|
||||
src='https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png'
|
||||
style='display: block; outline: none; text-decoration: none; height: 40px; font-size: 13px; line-height: 100%; -ms-interpolation-mode: bicubic; border: 0;'
|
||||
/>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@
|
|||
style="
|
||||
position: relative;
|
||||
background-color: #151719 !important;
|
||||
background-image: url(https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_email_bg.svg);
|
||||
background-image: url(https://general-flowise.s3.us-east-1.amazonaws.com/flowise_email_bg.svg);
|
||||
background-position: center top;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
|
@ -338,7 +338,7 @@
|
|||
<img
|
||||
alt=""
|
||||
width="auto"
|
||||
src="https://auth.flowiseai.com/storage/v1/object/public/flowise-static-assets/flowise_logo.png"
|
||||
src="https://general-flowise.s3.us-east-1.amazonaws.com/Flowise+Logo+Cropped+White+High+Res.png"
|
||||
style="
|
||||
display: block;
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ router.post('/forgot-password', accountController.forgotPassword)
|
|||
|
||||
router.post('/reset-password', accountController.resetPassword)
|
||||
|
||||
router.post('/cancel-subscription', accountController.cancelPreviousCloudSubscrption)
|
||||
|
||||
router.post('/billing', accountController.createStripeCustomerPortalSession)
|
||||
|
||||
router.get('/basic-auth', accountController.getBasicAuth)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ const resendVerificationEmail = (body) => client.post('/account/resend-verificat
|
|||
const forgotPassword = (body) => client.post('/account/forgot-password', body)
|
||||
const resetPassword = (body) => client.post('/account/reset-password', body)
|
||||
const getBillingData = () => client.post('/account/billing')
|
||||
const cancelSubscription = (body) => client.post('/account/cancel-subscription', body)
|
||||
const logout = () => client.post('/account/logout')
|
||||
const getBasicAuth = () => client.get('/account/basic-auth')
|
||||
const checkBasicAuth = (body) => client.post('/account/basic-auth', body)
|
||||
|
|
@ -20,7 +19,6 @@ export default {
|
|||
resendVerificationEmail,
|
||||
forgotPassword,
|
||||
resetPassword,
|
||||
cancelSubscription,
|
||||
logout,
|
||||
getBasicAuth,
|
||||
checkBasicAuth
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ const AccountSettings = () => {
|
|||
const [confirmPassword, setConfirmPassword] = useState('')
|
||||
const [usage, setUsage] = useState(null)
|
||||
const [isBillingLoading, setIsBillingLoading] = useState(false)
|
||||
const [isMigrateLoading, setIsMigrateLoading] = useState(false)
|
||||
const [seatsQuantity, setSeatsQuantity] = useState(0)
|
||||
const [prorationInfo, setProrationInfo] = useState(null)
|
||||
const [isUpdatingSeats, setIsUpdatingSeats] = useState(false)
|
||||
|
|
@ -173,45 +172,6 @@ const AccountSettings = () => {
|
|||
return currentPlan?.title || ''
|
||||
}, [getPricingPlansApi.data, currentUser?.activeOrganizationProductId])
|
||||
|
||||
const handleMigrateEmail = async () => {
|
||||
setIsMigrateLoading(true)
|
||||
try {
|
||||
const obj = {
|
||||
email: migrateEmail
|
||||
}
|
||||
const resp = await accountApi.cancelSubscription(obj)
|
||||
if (resp.status === 200) {
|
||||
enqueueSnackbar({
|
||||
message: `Instruction to cancel subscription has been sent to ${migrateEmail}`,
|
||||
options: {
|
||||
key: new Date().getTime() + Math.random(),
|
||||
variant: 'success',
|
||||
action: (key) => (
|
||||
<Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}>
|
||||
<IconX />
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
enqueueSnackbar({
|
||||
message: 'Failed to access billing portal',
|
||||
options: {
|
||||
key: new Date().getTime() + Math.random(),
|
||||
variant: 'error',
|
||||
action: (key) => (
|
||||
<Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}>
|
||||
<IconX />
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
})
|
||||
} finally {
|
||||
setIsMigrateLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleBillingPortalClick = async () => {
|
||||
setIsBillingLoading(true)
|
||||
try {
|
||||
|
|
@ -817,70 +777,6 @@ const AccountSettings = () => {
|
|||
</Box>
|
||||
</SettingsSection>
|
||||
)}
|
||||
<SettingsSection title='Cancel Previous Subscription'>
|
||||
<Box
|
||||
sx={{
|
||||
width: '100%',
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'repeat(3, 1fr)'
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
gridColumn: 'span 2 / span 2',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'start',
|
||||
justifyContent: 'center',
|
||||
gap: 1,
|
||||
px: 2.5,
|
||||
py: 2
|
||||
}}
|
||||
>
|
||||
<Typography variant='body2'>Migrate from existing cloud subscription?</Typography>
|
||||
<Typography variant='body2' color='text.secondary'>
|
||||
{`If you have an existing cloud app like <your-app>.app.flowiseai.com, after finished migrating your work, you can cancel the previous subscription. We'll send you an email with a link to cancel your previous subscription.`}
|
||||
</Typography>
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1, width: '100%' }}>
|
||||
<OutlinedInput
|
||||
id='email'
|
||||
type='string'
|
||||
fullWidth
|
||||
placeholder='Email Address'
|
||||
name='email'
|
||||
onChange={(e) => setMigrateEmail(e.target.value)}
|
||||
value={migrateEmail}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'end',
|
||||
px: 2.5,
|
||||
py: 2,
|
||||
gap: 2
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
variant='outlined'
|
||||
disabled={!currentUser.isOrganizationAdmin || isMigrateLoading}
|
||||
onClick={handleMigrateEmail}
|
||||
sx={{ borderRadius: 2, height: 40 }}
|
||||
>
|
||||
{isMigrateLoading ? (
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
<CircularProgress size={16} color='inherit' />
|
||||
Loading
|
||||
</Box>
|
||||
) : (
|
||||
'Send Instructions'
|
||||
)}
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</SettingsSection>
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
|
|
|
|||
|
|
@ -241,18 +241,6 @@ const SignInPage = () => {
|
|||
Forgot password?
|
||||
</Link>
|
||||
</Typography>
|
||||
{isCloud && (
|
||||
<Typography variant='body2' sx={{ color: theme.palette.grey[600], mt: 1, textAlign: 'right' }}>
|
||||
<a
|
||||
href='https://docs.flowiseai.com/migration-guide/cloud-migration'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
style={{ color: theme.palette.primary.main }}
|
||||
>
|
||||
Migrate from existing account?
|
||||
</a>
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<LoadingButton
|
||||
loading={loading}
|
||||
|
|
|
|||
Loading…
Reference in New Issue