Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change plan update banner to new alert and refresh seat count #3778

Merged
merged 5 commits into from
Mar 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -214,7 +214,7 @@ describe('CurrentOrgPlan', () => {
} as z.infer<typeof AccountDetailsSchema>,
})
render(<CurrentOrgPlan />, { wrapper })
const updatedAlert = await screen.findByText('Plan successfully updated.')
const updatedAlert = await screen.findByText('Plan successfully updated')
expect(updatedAlert).toBeInTheDocument()
expect(
screen.getByText(/with a monthly subscription for 34 seats/)
@@ -230,7 +230,7 @@ describe('CurrentOrgPlan', () => {
expect(currentPlanCard).toBeInTheDocument()

expect(
screen.queryByText('Plan successfully updated.')
screen.queryByText('Plan successfully updated')
).not.toBeInTheDocument()
})
})
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ function CurrentOrgPlan() {
<Alert variant={planUpdatedNotification.alertOption}>
{scheduleStart && scheduledPhase?.quantity ? (
<>
<Alert.Title>Plan successfully updated.</Alert.Title>
<Alert.Title>Plan successfully updated</Alert.Title>
<Alert.Description>
The start date is {scheduleStart} with a monthly
subscription for {scheduledPhase.quantity} seats.
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ describe('InfoMessageStripeCallback', () => {
)

await expect(
screen.getByText(/Subscription Update Successful/)
screen.getByText(/Plan successfully updated./)
).toBeInTheDocument()
})
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import qs from 'qs'
import { useLocation } from 'react-router-dom'

import Message from 'old_ui/Message'
import { Alert } from 'ui/Alert'

// Stripe redirects to this page with ?success or ?cancel in the URL
// this component takes care of rendering a message if it is successful
@@ -16,14 +16,12 @@ function InfoMessageStripeCallback({

if ('success' in urlParams && !awaitingInitialPaymentMethodVerification)
return (
<div className="col-start-1 col-end-13 mb-4">
<Message variant="success">
<h2 className="text-lg">Subscription Update Successful</h2>
<p className="text-sm">
Your subscription has been updated successfully. If your plan
details appear incorrect, please refresh the page.
</p>
</Message>
<div className="col-start-1 col-end-13 mb-4 sm:flex-initial md:w-2/3 lg:w-3/4">
<Alert variant="success">
<Alert.Description className="text-sm">
Plan successfully updated.
</Alert.Description>
</Alert>
</div>
)

Original file line number Diff line number Diff line change
@@ -31,8 +31,12 @@ export const useUpgradeControls = () => {
newPlan: newPlan!,
},
{
onSuccess: () => {
queryClient.invalidateQueries(['accountDetails'])
onSuccess: async () => {
// we want to wait here as history.push can disrupt the query invalidation
await Promise.all([
queryClient.refetchQueries({ queryKey: ['accountDetails'] }),
queryClient.refetchQueries({ queryKey: ['GetPlanData'] }),
])
setPlanUpdatedNotification({
alertOption: 'success',
})