-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/whats-new
- Loading branch information
Showing
27 changed files
with
266 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+3.22 KB
(110%)
frontend/__snapshots__/scenes-app-experiments--experiments-list-pay-gate--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.03 KB
(110%)
...tend/__snapshots__/scenes-app-experiments--experiments-list-pay-gate--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.44 KB
(110%)
frontend/__snapshots__/scenes-app-experiments--view-experiment-pay-gate--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.28 KB
(110%)
frontend/__snapshots__/scenes-app-experiments--view-experiment-pay-gate--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import { useValues } from 'kea' | |
import { FEATURE_MINIMUM_PLAN, POSTHOG_CLOUD_STANDARD_PLAN } from 'lib/constants' | ||
import { IconEmojiPeople, IconLightBulb, IconLock, IconPremium } from 'lib/lemon-ui/icons' | ||
import { LemonButton } from 'lib/lemon-ui/LemonButton' | ||
import { capitalizeFirstLetter } from 'lib/utils' | ||
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic' | ||
import { userLogic } from 'scenes/userLogic' | ||
|
||
|
@@ -102,21 +103,22 @@ export function PayGateMini({ | |
children, | ||
overrideShouldShowGate, | ||
}: PayGateMiniProps): JSX.Element | null { | ||
const { preflight } = useValues(preflightLogic) | ||
const { preflight, isCloudOrDev } = useValues(preflightLogic) | ||
const { hasAvailableFeature } = useValues(userLogic) | ||
|
||
const featureSummary = FEATURE_SUMMARIES[feature] | ||
const planRequired = FEATURE_MINIMUM_PLAN[feature] | ||
let gateVariant: 'add-card' | 'contact-sales' | 'subscribe' | null = null | ||
|
||
let gateVariant: 'add-card' | 'contact-sales' | 'move-to-cloud' | null = null | ||
if (!overrideShouldShowGate && !hasAvailableFeature(feature)) { | ||
if (preflight?.cloud) { | ||
if (isCloudOrDev) { | ||
if (planRequired === POSTHOG_CLOUD_STANDARD_PLAN) { | ||
gateVariant = 'add-card' | ||
} else { | ||
gateVariant = 'contact-sales' | ||
} | ||
} else { | ||
gateVariant = 'subscribe' | ||
gateVariant = 'move-to-cloud' | ||
} | ||
} | ||
|
||
|
@@ -129,7 +131,11 @@ export function PayGateMini({ | |
<div className="PayGateMini__icon">{featureSummary.icon || <IconPremium />}</div> | ||
<div className="PayGateMini__description">{featureSummary.description}</div> | ||
<div className="PayGateMini__cta"> | ||
Subscribe to gain {featureSummary.umbrella}. | ||
{gateVariant === 'move-to-cloud' ? ( | ||
<>{capitalizeFirstLetter(featureSummary.umbrella)} is available on PostHog Cloud.</> | ||
) : ( | ||
<>Subscribe to gain {featureSummary.umbrella}.</> | ||
)} | ||
{featureSummary.docsHref && ( | ||
<> | ||
{' '} | ||
|
@@ -145,8 +151,8 @@ export function PayGateMini({ | |
? '/organization/billing' | ||
: gateVariant === 'contact-sales' | ||
? `mailto:[email protected]?subject=Inquiring about ${featureSummary.umbrella}` | ||
: gateVariant === 'subscribe' | ||
? '/organization/billing' | ||
: gateVariant === 'move-to-cloud' | ||
? 'https://us.posthog.com/signup?utm_medium=in-product&utm_campaign=move-to-cloud' | ||
: undefined | ||
} | ||
type="primary" | ||
|
@@ -156,7 +162,7 @@ export function PayGateMini({ | |
? 'Subscribe now' | ||
: gateVariant === 'contact-sales' | ||
? 'Contact sales' | ||
: 'Subscribe'} | ||
: 'Move to PostHog Cloud'} | ||
</LemonButton> | ||
</div> | ||
) : ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function apiHostOrigin(): string { | ||
let apiHost = window.location.origin | ||
// similar to https://github.com/PostHog/posthog-js/blob/b79315b7a4fa0caded7026bda2fec01defb0ba73/src/posthog-core.ts#L1742 | ||
if (apiHost === 'https://us.posthog.com') { | ||
apiHost = 'https://app.posthog.com' | ||
} | ||
return apiHost | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { LemonButton, LemonDivider, LemonInput, Link } from '@posthog/lemon-ui' | |
import clsx from 'clsx' | ||
import { useActions, useValues } from 'kea' | ||
import { Field, Form } from 'kea-forms' | ||
import { router } from 'kea-router' | ||
import { SurprisedHog } from 'lib/components/hedgehogs' | ||
import { PageHeader } from 'lib/components/PageHeader' | ||
import { supportLogic } from 'lib/components/Support/supportLogic' | ||
|
@@ -14,10 +15,10 @@ import { LemonBanner } from 'lib/lemon-ui/LemonBanner' | |
import { LemonLabel } from 'lib/lemon-ui/LemonLabel/LemonLabel' | ||
import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner' | ||
import { Tooltip } from 'lib/lemon-ui/Tooltip' | ||
import { capitalizeFirstLetter } from 'lib/utils' | ||
import { useEffect } from 'react' | ||
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic' | ||
import { SceneExport } from 'scenes/sceneTypes' | ||
import { urls } from 'scenes/urls' | ||
|
||
import { BillingHero } from './BillingHero' | ||
import { billingLogic } from './billingLogic' | ||
|
@@ -45,10 +46,13 @@ export function Billing(): JSX.Element { | |
isAnnualPlan, | ||
} = useValues(billingLogic) | ||
const { reportBillingV2Shown } = useActions(billingLogic) | ||
const { preflight } = useValues(preflightLogic) | ||
const cloudOrDev = preflight?.cloud || preflight?.is_debug | ||
const { preflight, isCloudOrDev } = useValues(preflightLogic) | ||
const { openSupportForm } = useActions(supportLogic) | ||
|
||
if (preflight && !isCloudOrDev) { | ||
router.actions.push(urls.default()) | ||
} | ||
|
||
useEffect(() => { | ||
if (billing) { | ||
reportBillingV2Shown() | ||
|
@@ -155,7 +159,7 @@ export function Billing(): JSX.Element { | |
You are currently on a free trial until <b>{billing.free_trial_until.format('LL')}</b> | ||
</LemonBanner> | ||
) : null} | ||
{!billing?.has_active_subscription && cloudOrDev && ( | ||
{!billing?.has_active_subscription && ( | ||
<> | ||
<div className="my-8"> | ||
<BillingHero /> | ||
|
@@ -238,35 +242,6 @@ export function Billing(): JSX.Element { | |
</div> | ||
</div> | ||
)} | ||
|
||
{!cloudOrDev && (billing?.license?.plan || !billing?.has_active_subscription) && ( | ||
<div | ||
className={clsx('space-y-2', { | ||
'p-4': size === 'medium', | ||
})} | ||
// eslint-disable-next-line react/forbid-dom-props | ||
style={{ width: size === 'medium' ? '20rem' : undefined }} | ||
> | ||
{!cloudOrDev && billing?.license?.plan ? ( | ||
<div className="bg-primary-alt-highlight text-primary-alt rounded p-2 px-4"> | ||
<div className="text-center font-bold"> | ||
{capitalizeFirstLetter(billing.license.plan)} license | ||
</div> | ||
<span> | ||
Please contact <Link to="mailto:[email protected]">[email protected]</Link>{' '} | ||
if you would like to make any changes to your license. | ||
</span> | ||
</div> | ||
) : null} | ||
|
||
{!cloudOrDev && !billing?.has_active_subscription ? ( | ||
<p> | ||
Self-hosted licenses are no longer available for purchase. Please contact{' '} | ||
<Link to="mailto:[email protected]">[email protected]</Link> to discuss options. | ||
</p> | ||
) : null} | ||
</div> | ||
)} | ||
</div> | ||
|
||
{!isOnboarding && billing?.has_active_subscription && ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.