Skip to content

Commit d84c6c8

Browse files
authored
feat: add messaging for the $250 credit experiment (#4430)
1 parent 796cf75 commit d84c6c8

File tree

5 files changed

+75
-16
lines changed

5 files changed

+75
-16
lines changed

src/cloud/components/RateLimitAlert.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
extractRateLimitStatus,
2525
} from 'src/cloud/utils/limits'
2626
import {event} from 'src/cloud/utils/reporting'
27+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
2728

2829
// Constants
2930
import {CLOUD} from 'src/shared/constants'
@@ -89,11 +90,16 @@ const RateLimitAlert: FC<Props> = ({alertOnly, className, location}) => {
8990
)
9091
}
9192
}
92-
}, [showUpgrade, status])
93+
}, [showUpgrade, status]) // eslint-disable-line react-hooks/exhaustive-deps
94+
9395
const rateLimitAlertClass = classnames('rate-alert', {
9496
[`${className}`]: className,
9597
})
9698

99+
const icon = isFlagEnabled('credit250Experiment')
100+
? IconFont.Stop
101+
: IconFont.Cloud
102+
97103
if (CLOUD && status === 'exceeded' && resources.includes('cardinality')) {
98104
return (
99105
<FlexBox
@@ -105,7 +111,7 @@ const RateLimitAlert: FC<Props> = ({alertOnly, className, location}) => {
105111
<BannerPanel
106112
size={ComponentSize.ExtraSmall}
107113
gradient={Gradients.PolarExpress}
108-
icon={IconFont.Cloud}
114+
icon={icon}
109115
hideMobileIcon={true}
110116
textColor={InfluxColors.Yeti}
111117
>

src/cloud/components/RateLimitAlertContent.tsx

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import {shouldShowUpgradeButton} from 'src/me/selectors'
2020
// reporting
2121
import {event} from 'src/cloud/utils/reporting'
2222

23+
// Utils
24+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
25+
2326
interface Props {
2427
className?: string
2528
location?: string
@@ -33,17 +36,17 @@ interface UpgradeProps {
3336
location?: string
3437
}
3538

36-
export const UpgradeContent: FC<UpgradeProps> = ({
37-
type,
38-
link,
39-
className,
40-
limitText,
41-
location,
42-
}) => {
43-
return (
44-
<div className={`${className} rate-alert--content__free`}>
45-
<span>
46-
Oh no! You hit the{' '}
39+
interface UpgradeMessageProps {
40+
limitText: string
41+
link: string
42+
type: string
43+
}
44+
45+
const UpgradeMessage: FC<UpgradeMessageProps> = ({limitText, link, type}) => {
46+
if (isFlagEnabled('credit250Experiment')) {
47+
return (
48+
<span className="upgrade-message">
49+
You hit the{' '}
4750
<a
4851
href={link}
4952
className="rate-alert--docs-link"
@@ -52,13 +55,42 @@ export const UpgradeContent: FC<UpgradeProps> = ({
5255
>
5356
{type === 'series cardinality' ? 'series cardinality' : 'query write'}
5457
</a>{' '}
55-
limit {limitText ?? ''} and your data stopped writing. Don’t lose
56-
important metrics.
58+
limit {limitText ?? ''} and your data stopped writing. Upgrade to get a
59+
free $250 credit for the first 30 days.
5760
</span>
61+
)
62+
}
63+
return (
64+
<span className="upgrade-message">
65+
Oh no! You hit the{' '}
66+
<a
67+
href={link}
68+
className="rate-alert--docs-link"
69+
target="_blank"
70+
rel="noreferrer"
71+
>
72+
{type === 'series cardinality' ? 'series cardinality' : 'query write'}
73+
</a>{' '}
74+
limit {limitText ?? ''} and your data stopped writing. Don't lose
75+
important metrics.
76+
</span>
77+
)
78+
}
79+
80+
export const UpgradeContent: FC<UpgradeProps> = ({
81+
type,
82+
link,
83+
className,
84+
limitText,
85+
location,
86+
}) => {
87+
return (
88+
<div className={`${className} rate-alert--content__free`}>
5889
<FlexBox
5990
justifyContent={JustifyContent.Center}
6091
className="rate-alert--button"
6192
>
93+
<UpgradeMessage {...{limitText, link, type}} />
6294
<CloudUpgradeButton
6395
className="upgrade-payg--button__rate-alert"
6496
metric={() => event(`user.limits.${type}.upgrade`, {location})}

src/shared/components/cloud/CloudOnly.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
}
1919
}
2020

21+
.flex-upgrade-content.rate-alert--content__free {
22+
margin: $cf-marg-a;
23+
}
24+
25+
.upgrade-message {
26+
padding: $cf-marg-b;
27+
}
28+
2129
.cf-page--title {
2230
flex-shrink: 0;
2331
}

src/shared/components/notifications/Notifications.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const Notifications: FC = () => {
5252
style={{maxWidth: '600px', alignItems: 'center'}}
5353
>
5454
<span style={styles}>
55-
<span className="notification--message">{message}</span>
55+
{message && (
56+
<span className="notification--message">{message}</span>
57+
)}
5658
{buttonElement && buttonElement(handleDismiss)}
5759
</span>
5860
</Notification>

src/shared/copy/notifications/categories/limits.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ import {
44
defaultErrorNotification,
55
defaultSuccessNotification,
66
} from 'src/shared/copy/notifications'
7+
import {IconFont} from '@influxdata/clockface'
8+
9+
// Constants
10+
import {CLOUD} from 'src/shared/constants'
11+
12+
// Utils
13+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
714

815
// Limits
916
export const readWriteCardinalityLimitReached = (
@@ -38,6 +45,10 @@ export const writeLimitReached = (
3845
duration?: number
3946
) => ({
4047
...defaultErrorNotification,
48+
icon:
49+
CLOUD && isFlagEnabled('credit250Experiment')
50+
? IconFont.Stop
51+
: defaultErrorNotification.icon,
4152
message,
4253
duration: duration ?? TEN_SECONDS,
4354
type: 'writeLimitReached',

0 commit comments

Comments
 (0)