Skip to content

Commit

Permalink
chore: lower min credit purchase to 3000 (#25958)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
zlwaterfield and github-actions[bot] authored Nov 4, 2024
1 parent 8c1fb07 commit 79dc03b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 22 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ export const FEATURE_FLAGS = {
WEB_ANALYTICS_REPLAY: 'web-analytics-replay', // owner: @robbie-c
BATCH_EXPORTS_POSTHOG_HTTP: 'posthog-http-batch-exports',
EXPERIMENT_MAKE_DECISION: 'experiment-make-decision', // owner: @jurajmajerik #team-feature-success
PURCHASE_CREDITS: 'purchase-credits', // owner: @zach
DATA_MODELING: 'data-modeling', // owner: @EDsCODE #team-data-warehouse
WEB_ANALYTICS_CONVERSION_GOALS: 'web-analytics-conversion-goals', // owner: @robbie-c
WEB_ANALYTICS_LAST_CLICK: 'web-analytics-last-click', // owner: @robbie-c
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/scenes/billing/Billing.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Meta } from '@storybook/react'
import { FEATURE_FLAGS } from 'lib/constants'

import { mswDecorator, setFeatureFlags, useStorybookMocks } from '~/mocks/browser'
import { mswDecorator, useStorybookMocks } from '~/mocks/browser'
import { billingJson } from '~/mocks/fixtures/_billing'
import billingJsonWith100PercentDiscount from '~/mocks/fixtures/_billing_with_100_percent_discount.json'
import billingJsonWithCredits from '~/mocks/fixtures/_billing_with_credits.json'
Expand Down Expand Up @@ -72,7 +71,6 @@ export const BillingWithCredits = (): JSX.Element => {
}

export const BillingWithCreditCTA = (): JSX.Element => {
setFeatureFlags([FEATURE_FLAGS.PURCHASE_CREDITS])
useStorybookMocks({
get: {
'/api/billing/': {
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/scenes/billing/CreditCTAHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { IconX } from '@posthog/icons'
import { LemonButton, LemonDivider } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { BurningMoneyHog } from 'lib/components/hedgehogs'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import useResizeObserver from 'use-resize-observer'

import { billingLogic } from './billingLogic'
Expand All @@ -15,14 +13,10 @@ export const CreditCTAHero = (): JSX.Element | null => {
const { creditOverview, isPurchaseCreditsModalOpen, isCreditCTAHeroDismissed, computedDiscount } =
useValues(billingLogic)
const { showPurchaseCreditsModal, toggleCreditCTAHeroDismissed } = useActions(billingLogic)
const { featureFlags } = useValues(featureFlagLogic)

if (!creditOverview.eligible || creditOverview.status === 'paid') {
return null
}
if (!featureFlags[FEATURE_FLAGS.PURCHASE_CREDITS]) {
return null
}

if (isCreditCTAHeroDismissed) {
return (
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/billing/PurchaseCreditsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ export const PurchaseCreditsModal = (): JSX.Element | null => {
{
type: BillingGaugeItemKind.FreeTier,
text:
creditInputValue >= 6000 && creditInputValue < 20000 ? (
creditInputValue >= 3000 && creditInputValue < 20000 ? (
<>
<IconCheckCircle className="text-success" /> 10% off
</>
) : (
'10% off'
),
value: 6000,
value: 3000,
prefix: '$',
top: true,
},
Expand Down
15 changes: 5 additions & 10 deletions frontend/src/scenes/billing/billingLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { FieldNamePath, forms } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
import api, { getJSONOrNull } from 'lib/api'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { LemonBannerAction } from 'lib/lemon-ui/LemonBanner/LemonBanner'
import { lemonBannerLogic } from 'lib/lemon-ui/LemonBanner/lemonBannerLogic'
Expand Down Expand Up @@ -345,11 +344,7 @@ export const billingLogic = kea<billingLogicType>([
)
}

if (
response.eligible &&
response.status === 'none' &&
values.featureFlags[FEATURE_FLAGS.PURCHASE_CREDITS]
) {
if (response.eligible && response.status === 'none') {
actions.reportCreditsCTAShown(response)
}
return response
Expand Down Expand Up @@ -503,9 +498,9 @@ export const billingLogic = kea<billingLogicType>([
errors: ({ creditInput, collectionMethod }) => ({
creditInput: !creditInput
? 'Please enter the amount of credits you want to purchase'
: // This value is used because 6667 - 10% = 6000
+creditInput < 6667
? 'Please enter a credit amount greater than $6,666'
: // This value is used because 3333 - 10% = 3000
+creditInput < 3333
? 'Please enter a credit amount of at least $3,333'
: undefined,
collectionMethod: !collectionMethod ? 'Please select a collection method' : undefined,
}),
Expand Down Expand Up @@ -650,7 +645,7 @@ export const billingLogic = kea<billingLogicType>([
discount = 0.25
} else if (spend >= 20000) {
discount = 0.2
} else if (spend >= 6000) {
} else if (spend >= 3000) {
discount = 0.1
}
actions.setComputedDiscount(discount)
Expand Down

0 comments on commit 79dc03b

Please sign in to comment.