Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 2 additions & 7 deletions packages/shared/src/components/CustomFeedEmptyScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@ import {
} from './typography/Typography';
import { LogEvent, TargetId } from '../lib/log';
import { Button } from './buttons/Button';
import { useConditionalFeature, usePlusSubscription } from '../hooks';
import { usePlusSubscription } from '../hooks';
import { IconSize } from './Icon';
import { featurePlusApiLanding } from '../lib/featureManagement';
import Link from './utilities/Link';

export const CustomFeedEmptyScreen = (): ReactElement => {
const { logSubscriptionEvent, isPlus } = usePlusSubscription();
const { value: isApiLanding } = useConditionalFeature({
feature: featurePlusApiLanding,
shouldEvaluate: !isPlus,
});
const plusCta = isApiLanding ? 'Get API Access' : 'Level Up with Plus';
const plusCta = 'Get API Access';
const [selectedAlgo, setSelectedAlgo] = usePersistentContext(
DEFAULT_ALGORITHM_KEY,
DEFAULT_ALGORITHM_INDEX,
Expand Down
8 changes: 1 addition & 7 deletions packages/shared/src/components/PlusUserBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import { DateFormat } from './utilities';
import { TimeFormatType } from '../lib/dateFormat';
import { usePlusSubscription } from '../hooks/usePlusSubscription';
import { LogEvent, TargetId } from '../lib/log';
import { featurePlusApiLanding } from '../lib/featureManagement';
import { useConditionalFeature } from '../hooks';
import { IconSize } from './Icon';

export type Props = {
Expand All @@ -31,11 +29,7 @@ export const PlusUserBadge = ({
size = IconSize.Size16,
}: Props): ReactElement | null => {
const { isPlus, logSubscriptionEvent } = usePlusSubscription();
const { value: isApiLanding } = useConditionalFeature({
feature: featurePlusApiLanding,
shouldEvaluate: !isPlus,
});
const plusCta = isApiLanding ? 'Get API Access' : 'Level Up with Plus';
const plusCta = 'Get API Access';

if (!user.isPlus) {
return null;
Expand Down
13 changes: 3 additions & 10 deletions packages/shared/src/components/UpgradeToPlus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import { ButtonColor, Button, ButtonVariant } from './buttons/Button';
import { DevPlusIcon } from './icons';
import Link from './utilities/Link';
import { plusUrl } from '../lib/constants';
import { useConditionalFeature, useViewSize, ViewSize } from '../hooks';
import { useViewSize, ViewSize } from '../hooks';
import { usePlusSubscription } from '../hooks/usePlusSubscription';
import type { TargetId } from '../lib/log';
import { LogEvent } from '../lib/log';
import { useAuthContext } from '../contexts/AuthContext';
import { AuthTriggers } from '../lib/auth';
import type { WithClassNameProps } from './utilities';
import { featurePlusApiLanding } from '../lib/featureManagement';

type Props = {
iconOnly?: boolean;
Expand All @@ -37,15 +36,9 @@ export const UpgradeToPlus = ({
const isLaptopXL = useViewSize(ViewSize.LaptopXL);
const isFullCTAText = !isLaptop || isLaptopXL;
const { isPlus, logSubscriptionEvent } = usePlusSubscription();
const { value: isApiLanding } = useConditionalFeature({
feature: featurePlusApiLanding,
shouldEvaluate: !isPlus,
});
const ctaCopy = isApiLanding
? { full: 'Get API Access', short: 'API access' }
: { full: 'Level Up with Plus', short: 'Upgrade' };
const ctaCopy = { full: 'Get API Access', short: 'API access' };
const content = isFullCTAText ? ctaCopy.full : ctaCopy.short;
const defaultColor = isApiLanding ? ButtonColor.Bacon : ButtonColor.Avocado;
const defaultColor = ButtonColor.Bacon;

const onClick = useCallback(
(e: React.MouseEvent) => {
Expand Down
5 changes: 1 addition & 4 deletions packages/shared/src/components/cards/plus/PlusGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { useBoot } from '../../../hooks';
import { LogEvent, TargetType } from '../../../lib/log';
import { useLogContext } from '../../../contexts/LogContext';
import { PlusItemStatus, PlusListItem } from '../../plus/PlusListItem';
import { useFeature } from '../../GrowthBookProvider';
import { featurePlusApiLanding } from '../../../lib/featureManagement';

const bulletPointsControl = [
{
Expand Down Expand Up @@ -42,13 +40,12 @@ const bulletPointsControl = [
const PlusGrid = ({ flags, campaignId }: MarketingCta) => {
const { logEvent } = useLogContext();
const { clearMarketingCta } = useBoot();
const isApiLanding = useFeature(featurePlusApiLanding);

if (!flags) {
return null;
}
const { title, description, ctaText, ctaUrl } = flags;
const ctaColor = isApiLanding ? ButtonColor.Bacon : ButtonColor.Avocado;
const ctaColor = ButtonColor.Bacon;

const handleClose = () => {
logEvent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import type { TargetType } from '../../../lib/log';
import { LogEvent } from '../../../lib/log';
import { useLogContext } from '../../../contexts/LogContext';
import { useBoot } from '../../../hooks';
import { useFeature } from '../../GrowthBookProvider';
import { featurePlusApiLanding } from '../../../lib/featureManagement';

type PlusBannerProps = Omit<MarketingCta, 'flags'> & {
targetType: TargetType;
Expand All @@ -33,12 +31,11 @@ const PlusMobileEntryBanner = ({
}: PlusBannerProps): ReactElement | null => {
const { logEvent } = useLogContext();
const { clearMarketingCta } = useBoot();
const isApiLanding = useFeature(featurePlusApiLanding);
if (!flags) {
return null;
}
const { leadIn, description, ctaText, ctaUrl } = flags;
const ctaColor = isApiLanding ? ButtonColor.Bacon : ButtonColor.Avocado;
const ctaColor = ButtonColor.Bacon;

const handleClose = () => {
logEvent({
Expand Down
5 changes: 1 addition & 4 deletions packages/shared/src/components/plus/PlusDesktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { usePlusSubscription } from '../../hooks';

import { PurchaseType } from '../../graphql/paddle';
import { PlusProductToggle } from './PlusProductToggle';
import { useFeature } from '../GrowthBookProvider';
import { featurePlusApiLanding } from '../../lib/featureManagement';

const PlusFAQs = dynamic(() => import('./PlusFAQ').then((mod) => mod.PlusFAQ));
const PlusApiShowcase = dynamic(() =>
Expand All @@ -37,7 +35,6 @@ export const PlusDesktop = ({
query: { selectedPlan },
} = useRouter();
const { isPlus } = usePlusSubscription();
const isApiLanding = useFeature(featurePlusApiLanding);
const initialPaymentOption = selectedPlan ? `${selectedPlan}` : null;
const [selectedOption, setSelectedOption] = useState<string | null>(null);
const ref = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -126,7 +123,7 @@ export const PlusDesktop = ({
)}
</div>
</div>
{isApiLanding && !isOrganization && !giftToUser && <PlusApiShowcase />}
{!isOrganization && !giftToUser && <PlusApiShowcase />}
<PlusFAQs />
</>
);
Expand Down
12 changes: 2 additions & 10 deletions packages/shared/src/components/plus/PlusFAQ.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ import {
import { Accordion } from '../accordion';
import { anchorDefaultRel } from '../../lib/strings';
import { feedback } from '../../lib/constants';
import { plusFAQItemsApi, plusFAQItemsControl } from './common';
import { plusFAQItemsApi } from './common';
import { useLogContext } from '../../contexts/LogContext';
import { LogEvent } from '../../lib/log';
import { useConditionalFeature } from '../../hooks';
import { featurePlusApiLanding } from '../../lib/featureManagement';
import { usePlusSubscription } from '../../hooks/usePlusSubscription';

interface FAQ {
question: string;
Expand Down Expand Up @@ -53,12 +50,7 @@ const FAQItem = ({ item }: { item: FAQ }): ReactElement => {
export const PlusFAQ = (): ReactElement => {
const id = useId();
const titleId = `${id}-title`;
const { isPlus } = usePlusSubscription();
const { value: isApiLanding } = useConditionalFeature({
feature: featurePlusApiLanding,
shouldEvaluate: !isPlus,
});
const items = isApiLanding ? plusFAQItemsApi : plusFAQItemsControl;
const items = plusFAQItemsApi;
return (
<section aria-labelledby={titleId} className="my-10">
<Typography
Expand Down
17 changes: 4 additions & 13 deletions packages/shared/src/components/plus/PlusInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import {
plusFeatureListApiFirst,
plusOrganizationFeatureList,
} from './PlusList';
import { useConditionalFeature, usePlusSubscription } from '../../hooks';
import { featurePlusApiLanding } from '../../lib/featureManagement';
import { usePlusSubscription } from '../../hooks';
import { usePaymentContext } from '../../contexts/payment/context';
import type { OpenCheckoutFn } from '../../contexts/payment/context';
import { Button, ButtonSize, ButtonVariant } from '../buttons/Button';
Expand Down Expand Up @@ -149,24 +148,16 @@ export const PlusInfo = ({
const { giftOneYear, isOrganization, checkoutItemsLoading } =
usePaymentContext();
const { openModal } = useLazyModal();
const { isPlus, logSubscriptionEvent } = usePlusSubscription();
const { logSubscriptionEvent } = usePlusSubscription();
const { giftToUser } = useGiftUserContext();

const [itemQuantity, setItemQuantity] = useState<number>(1);

const { value: isApiLanding } = useConditionalFeature({
feature: featurePlusApiLanding,
shouldEvaluate: !isPlus,
});

const plusType = getPlusType({
isGift: !!giftToUser,
isOrganization,
});
const copySource = isApiLanding
? plusInfoCopyApi
: defaultPlusInfoCopyControl;
const defaultCopy = copySource[plusType];
const defaultCopy = plusInfoCopyApi[plusType];
const titleCopy = title || defaultCopy.title;
const descriptionCopy = description || defaultCopy.description;
const subtitleCopy = subtitle || defaultCopy.subtitle;
Expand All @@ -177,7 +168,7 @@ export const PlusInfo = ({
let plusListContent: ReactElement;
if (isOrganization) {
plusListContent = <PlusList items={plusOrganizationFeatureList} />;
} else if (isApiLanding && plusType === PlusType.Self) {
} else if (plusType === PlusType.Self) {
plusListContent = <PlusList items={plusFeatureListApiFirst} />;
} else {
plusListContent = <PlusList />;
Expand Down
5 changes: 1 addition & 4 deletions packages/shared/src/components/plus/PlusMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { plusUrl } from '../../lib/constants';
import { objectToQueryParams } from '../../lib';
import { PlusProductToggle } from './PlusProductToggle';
import { PurchaseType } from '../../graphql/paddle';
import { useFeature } from '../GrowthBookProvider';
import { featurePlusApiLanding } from '../../lib/featureManagement';

const PlusTrustRefund = dynamic(() =>
import('./PlusTrustRefund').then((mod) => mod.PlusTrustRefund),
Expand All @@ -29,7 +27,6 @@ export const PlusMobile = ({
const router = useRouter();
const { giftToUser } = useGiftUserContext();
const { productOptions, isOrganization } = usePaymentContext();
const isApiLanding = useFeature(featurePlusApiLanding);
const [selectedOption, setSelectedOption] = useState<string | null>(null);

const selectionChange: OpenCheckoutFn = useCallback(({ priceId }) => {
Expand Down Expand Up @@ -83,7 +80,7 @@ export const PlusMobile = ({
shouldShowPlusHeader={shouldShowPlusHeader}
/>
<PlusTrustRefund className="mt-6" />
{isApiLanding && !isOrganization && !giftToUser && <PlusApiShowcase />}
{!isOrganization && !giftToUser && <PlusApiShowcase />}
<PlusFAQs />
</div>
);
Expand Down
22 changes: 4 additions & 18 deletions packages/shared/src/components/sidebar/sections/MainSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ import useCustomDefaultFeed from '../../../hooks/feed/useCustomDefaultFeed';
import { SharedFeedPage } from '../../utilities';
import { isExtension } from '../../../lib/func';
import { useConditionalFeature } from '../../../hooks';
import {
featurePlusApiLanding,
featureYearInReview,
} from '../../../lib/featureManagement';
import { featureYearInReview } from '../../../lib/featureManagement';
import { useQuestDashboard } from '../../../hooks/useQuestDashboard';
import { Typography, TypographyColor } from '../../typography/Typography';

Expand All @@ -41,13 +38,7 @@ export const MainSection = ({
const { user, isLoggedIn } = useAuthContext();
const { isCustomDefaultFeed } = useCustomDefaultFeed();
const isPlus = user?.isPlus;
const { value: isApiLanding } = useConditionalFeature({
feature: featurePlusApiLanding,
shouldEvaluate: !isPlus,
});
const ctaCopy = isApiLanding
? { full: 'Get API Access', short: 'API access' }
: { full: 'Level Up with Plus', short: 'Upgrade' };
const ctaCopy = { full: 'Get API Access', short: 'API access' };
const { value: showYearInReview } = useConditionalFeature({
feature: featureYearInReview,
shouldEvaluate: isLoggedIn,
Expand Down Expand Up @@ -96,12 +87,8 @@ export const MainSection = ({
path: plusUrl,
isForcedLink: true,
requiresLogin: true,
color: isApiLanding
? 'text-action-plus-default'
: 'text-accent-avocado-default',
itemClassName: isApiLanding
? 'bg-action-plus-float/50 hover:bg-action-plus-float'
: 'bg-action-upvote-float/50 hover:bg-action-upvote-float',
color: 'text-action-plus-default',
itemClassName: 'bg-action-plus-float/50 hover:bg-action-plus-float',
disableDefaultBackground: true,
}
: undefined;
Expand Down Expand Up @@ -192,7 +179,6 @@ export const MainSection = ({
}, [
claimableMilestoneCount,
ctaCopy.full,
isApiLanding,
isCustomDefaultFeed,
isLoggedIn,
isPlus,
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/src/lib/featureManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ export const featurePlusCtaCopy = new Feature('plus_cta_copy', {
short: 'Upgrade',
});

export const featurePlusApiLanding = new Feature('plus_api_landing_v2', false);

export const featureInlineLogin = new Feature('inline_login', false);

export const featureLuckyButton = new Feature('lucky_button', false);
Expand Down
Loading