SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat: updated the cancel subscription banner styles and message (#11181)
SagarRajput-71118136b6989
diff --git a/frontend/src/container/BillingContainer/BillingContainer.test.tsx b/frontend/src/container/BillingContainer/BillingContainer.test.tsxindex d36a13123f..3a480541aa 100644--- a/frontend/src/container/BillingContainer/BillingContainer.test.tsx+++ b/frontend/src/container/BillingContainer/BillingContainer.test.tsx@@ -107,7 +107,7 @@ describe('BillingContainer', () => {).resolves.toBeInTheDocument();await expect(- screen.findByText('Cancel Subscription', { selector: 'span' }),+ screen.findByText('Cancel your subscription', { selector: 'span' }),).resolves.toBeInTheDocument();});@@ -150,7 +150,7 @@ describe('BillingContainer', () => {expect(dayRemainingInBillingPeriod).toBeInTheDocument();await expect(- screen.findByText('Cancel Subscription', { selector: 'span' }),+ screen.findByText('Cancel your subscription', { selector: 'span' }),).resolves.toBeInTheDocument();});});@@ -162,7 +162,7 @@ describe('BillingContainer', () => {it('should render when license is ACTIVATED and platform is CLOUD', async () => {render(<BillingContainer />);await expect(- screen.findByText('Cancel Subscription', { selector: 'span' }),+ screen.findByText('Cancel your subscription', { selector: 'span' }),).resolves.toBeInTheDocument();});@@ -186,7 +186,7 @@ describe('BillingContainer', () => {);await screen.findByText('billing');expect(- screen.queryByText('Cancel Subscription', { selector: 'span' }),+ screen.queryByText('Cancel your subscription', { selector: 'span' }),).not.toBeInTheDocument();});@@ -225,7 +225,7 @@ describe('BillingContainer', () => {render(<BillingContainer />, {}, { appContextOverrides: overrides });await screen.findByText('billing');expect(- screen.queryByText('Cancel Subscription', { selector: 'span' }),+ screen.queryByText('Cancel your subscription', { selector: 'span' }),).not.toBeInTheDocument();});});diff --git a/frontend/src/container/BillingContainer/CancelSubscriptionBanner.module.scss b/frontend/src/container/BillingContainer/CancelSubscriptionBanner.module.scssindex 6fa299d0bf..6860a6dfe8 100644--- a/frontend/src/container/BillingContainer/CancelSubscriptionBanner.module.scss+++ b/frontend/src/container/BillingContainer/CancelSubscriptionBanner.module.scss@@ -1,11 +1,11 @@.banner {display: flex;justify-content: space-between;- align-items: center;+ align-items: flex-start;padding: var(--padding-4);border-radius: 4px;- border: 1px solid var(--callout-error-border);- background-color: var(--callout-error-background);+ border: 1px solid var(--l1-border);+ background-color: var(--l2-background);margin: var(--spacing-4) 0 var(--spacing-12);}@@ -15,21 +15,55 @@gap: var(--spacing-2);}+.titleRow {+ display: flex;+ align-items: center;+ gap: var(--spacing-3);+}+.title {- font-size: var(--font-size-sm);- font-weight: var(--font-weight-medium);- color: var(--callout-error-title);+ font-size: var(--paragraph-base-500-font-size);+ font-weight: var(--paragraph-base-500-font-weight);+ line-height: var(--paragraph-base-500-line-height);+ color: var(--l1-foreground);}.subtitle {font-size: var(--paragraph-base-400-font-size);font-weight: var(--paragraph-base-400-font-weight);line-height: var(--paragraph-base-400-line-height);- color: var(--callout-error-icon);+ color: var(--l2-foreground);+ padding-left: 20px;}.dialogBody {- font-size: var(--font-size-sm);- line-height: var(--line-height-relaxed);+ display: flex;+ flex-direction: column;+ gap: var(--spacing-4);+}++.dialogDescription {+ font-size: var(--paragraph-base-400-font-size);+ font-weight: var(--paragraph-base-400-font-weight);+ line-height: var(--paragraph-base-400-line-height);color: var(--l2-foreground);+ margin: 0;+}++.dialogConfirmLabel {+ font-size: var(--paragraph-base-400-font-size);+ font-weight: var(--paragraph-base-400-font-weight);+ line-height: var(--paragraph-base-400-line-height);+ color: var(--l2-foreground);+ margin: 0;++ code {+ font-family: var(--font-mono);+ color: var(--l1-foreground);+ }+}++.cancelButton {+ background: var(--secondary-background);+ border: 1px solid var(--l1-border);}diff --git a/frontend/src/container/BillingContainer/CancelSubscriptionBanner.test.tsx b/frontend/src/container/BillingContainer/CancelSubscriptionBanner.test.tsxindex 6aa61a9810..cb3d482b3e 100644--- a/frontend/src/container/BillingContainer/CancelSubscriptionBanner.test.tsx+++ b/frontend/src/container/BillingContainer/CancelSubscriptionBanner.test.tsx@@ -1,4 +1,4 @@-import { render, screen, userEvent } from 'tests/test-utils';+import { render, screen, userEvent, waitFor } from 'tests/test-utils';import CancelSubscriptionBanner from './CancelSubscriptionBanner';@@ -13,14 +13,16 @@ describe('CancelSubscriptionBanner', () => {it('renders banner with title and subtitle', () => {render(<CancelSubscriptionBanner />);expect(- screen.getByText('Cancel Subscription', { selector: 'span' }),+ screen.getByText('Cancel your subscription', { selector: 'span' }),).toBeInTheDocument();expect(- screen.getByText('Cancel your SigNoz subscription.'),+ screen.getByText(+ /When you cancel your SigNoz subscription, all your data will be deleted/i,+ ),).toBeInTheDocument();});- it('opens dialog with correct content when Cancel Subscription is clicked', async () => {+ it('opens dialog with content when Cancel Subscription is clicked', async () => {const user = userEvent.setup({ pointerEventsCheck: 0 });render(<CancelSubscriptionBanner />);@@ -30,17 +32,62 @@ describe('CancelSubscriptionBanner', () => {expect(screen.getByRole('dialog')).toBeInTheDocument();expect(- screen.getByText(/reach out to our support team/i),+ screen.getByText(/Cancelling your subscription would stop your data/i),).toBeInTheDocument();+ expect(screen.getByText(/Type/i)).toBeInTheDocument();expect(- screen.getByRole('button', { name: /keep subscription/i }),+ screen.getByPlaceholderText(/Enter the word cancel/i),).toBeInTheDocument();+ expect(screen.getByRole('button', { name: /go back/i })).toBeInTheDocument();expect(- screen.getByRole('button', { name: /contact support/i }),+ screen.getByRole('button', { name: /cancel subscription/i }),).toBeInTheDocument();});- it('sends mailto to cloud-support with correct subject on Contact Support', async () => {+ it('keeps Cancel subscription button disabled until "cancel" is typed', async () => {+ const user = userEvent.setup({ pointerEventsCheck: 0 });+ render(<CancelSubscriptionBanner />);++ await user.click(+ screen.getByRole('button', { name: /cancel subscription/i }),+ );++ const confirmButton = screen.getByRole('button', {+ name: /cancel subscription/i,+ });+ expect(confirmButton).toBeDisabled();++ const input = screen.getByPlaceholderText(/Enter the word cancel/i);+ await user.type(input, 'canc');+ expect(confirmButton).toBeDisabled();++ await user.type(input, 'el');+ expect(confirmButton).toBeEnabled();+ });++ it('closes dialog and resets input when Go back is clicked', async () => {+ const user = userEvent.setup({ pointerEventsCheck: 0 });+ render(<CancelSubscriptionBanner />);++ await user.click(+ screen.getByRole('button', { name: /cancel subscription/i }),+ );++ const input = screen.getByPlaceholderText(/Enter the word cancel/i);+ await user.type(input, 'cancel');++ await user.click(screen.getByRole('button', { name: /go back/i }));+ await waitFor(() =>+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument(),+ );++ await user.click(+ screen.getByRole('button', { name: /cancel subscription/i }),+ );+ expect(screen.getByPlaceholderText(/Enter the word cancel/i)).toHaveValue('');+ });++ it('sends mailto to cloud-support with correct subject after typing "cancel"', async () => {const realCreateElement = document.createElement.bind(document);const mockClick = jest.fn();const mockAnchor = { href: '', click: mockClick };@@ -57,7 +104,13 @@ describe('CancelSubscriptionBanner', () => {await user.click(screen.getByRole('button', { name: /cancel subscription/i }),);- await user.click(screen.getByRole('button', { name: /contact support/i }));++ const input = screen.getByPlaceholderText(/Enter the word cancel/i);+ await user.type(input, 'cancel');++ await user.click(+ screen.getByRole('button', { name: /cancel subscription/i }),+ );expect(mockAnchor.href).toContain('mailto:[email protected]');expect(mockAnchor.href).toContain('Cancel%20My%20SigNoz%20Subscription');diff --git a/frontend/src/container/BillingContainer/CancelSubscriptionBanner.tsx b/frontend/src/container/BillingContainer/CancelSubscriptionBanner.tsxindex 771094d964..f988a9a485 100644--- a/frontend/src/container/BillingContainer/CancelSubscriptionBanner.tsx+++ b/frontend/src/container/BillingContainer/CancelSubscriptionBanner.tsx@@ -1,15 +1,17 @@import { useState } from 'react';-import { X } from '@signozhq/icons';-import { Button, DialogWrapper } from '@signozhq/ui';+import { SolidInfoCircle, Undo2, X } from '@signozhq/icons';+import { Button, DialogWrapper, Input } from '@signozhq/ui';import logEvent from 'api/common/logEvent';import { pick } from 'lodash-es';import { useAppContext } from 'providers/App/App';import { getBaseUrl } from 'utils/basePath';import styles from './CancelSubscriptionBanner.module.scss';+import { Color } from '@signozhq/design-tokens';function CancelSubscriptionBanner(): JSX.Element {const [open, setOpen] = useState(false);+ const [confirmText, setConfirmText] = useState('');const { user, org } = useAppContext();const handleOpenCancelDialog = (): void => {@@ -53,6 +55,12 @@ function CancelSubscriptionBanner(): JSX.Element {link.href = `mailto:[email protected]?subject=${subject}&body=${body}`;link.click();setOpen(false);+ setConfirmText('');+ };++ const handleClose = (): void => {+ setOpen(false);+ setConfirmText('');};const footer = (@@ -60,12 +68,19 @@ function CancelSubscriptionBanner(): JSX.Element {<Buttonvariant="solid"color="secondary"- onClick={(): void => setOpen(false)}+ prefix={<Undo2 size={14} />}+ onClick={handleClose}>- Keep Subscription+ Go back</Button>- <Button variant="solid" color="destructive" onClick={handleContactSupport}>- Contact Support+ <Button+ variant="solid"+ color="destructive"+ prefix={<X size={14} />}+ disabled={confirmText !== 'cancel'}+ onClick={handleContactSupport}+ >+ Cancel subscription</Button></>);@@ -74,30 +89,47 @@ function CancelSubscriptionBanner(): JSX.Element {<><div className={styles.banner}><div className={styles.info}>- <span className={styles.title}>Cancel Subscription</span>- <span className={styles.subtitle}>Cancel your SigNoz subscription.</span>+ <div className={styles.titleRow}>+ <SolidInfoCircle color={Color.BG_SAKURA_500} size={12} />+ <span className={styles.title}>Cancel your subscription</span>+ </div>+ <span className={styles.subtitle}>+ When you cancel your SigNoz subscription, all your data will be deleted+ immediately and removed from our servers.+ </span></div><Buttonvariant="solid"- color="destructive"+ color="secondary"prefix={<X size={12} />}onClick={handleOpenCancelDialog}+ className={styles.cancelButton}>Cancel Subscription</Button></div><DialogWrapperopen={open}- onOpenChange={setOpen}- title="Cancel your subscription"+ onOpenChange={handleClose}+ title="Cancel your subscription?"width="narrow"showCloseButton={false}footer={footer}>- <p className={styles.dialogBody}>- To cancel your SigNoz subscription, please reach out to our support team.- We'll be happy to assist you.- </p>+ <div className={styles.dialogBody}>+ <p className={styles.dialogDescription}>+ Cancelling your subscription would stop your data from being ingested to+ SigNoz. All the data that has been already sent will also be deleted.+ </p>+ <p className={styles.dialogConfirmLabel}>+ Type <code>cancel</code> to confirm the cancellation.+ </p>+ <Input+ placeholder="Enter the word cancel..."+ value={confirmText}+ onChange={(e): void => setConfirmText(e.target.value)}+ />+ </div></DialogWrapper></>);