Skip to content

Commit

Permalink
chore: remove billing ff (#1610)
Browse files Browse the repository at this point in the history
* remove billing ff

* adjust tracking categories

---------

Co-authored-by: Jake Loo <[email protected]>
  • Loading branch information
assimovt and jakeloo authored Sep 6, 2023
1 parent 4589391 commit 9b3f46e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 65 deletions.
21 changes: 4 additions & 17 deletions components/onboarding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,24 @@ import { AccountForm } from "components/settings/Account/AccountForm";
import { useEffect, useState } from "react";
import { Heading, Text } from "tw-components";
import { OnboardingModal } from "./Modal";
import { useRouter } from "next/router";

export const Onboarding: React.FC = () => {
const meQuery = useAccount();
const { isLoggedIn } = useUser();
const { isOpen, onOpen, onClose } = useDisclosure();
const [saved, setSaved] = useState(false);
const router = useRouter();

const handleSave = () => {
setSaved(true);
onClose();
};

useEffect(() => {
// FIXME: Remove when ff is lifted
if (router.isReady) {
const { smartWalletsBeta } = router.query;

// open modal only when user hasn't onboarded and not saved already
if (
smartWalletsBeta &&
!saved &&
isLoggedIn &&
meQuery?.data &&
!meQuery.data.onboardedAt
) {
onOpen();
}
// open modal only when user hasn't onboarded and not saved already
if (!saved && isLoggedIn && meQuery?.data && !meQuery.data.onboardedAt) {
onOpen();
}
}, [router, isLoggedIn, meQuery, onOpen, saved]);
}, [isLoggedIn, meQuery, onOpen, saved]);

return (
<OnboardingModal isOpen={isOpen} onClose={handleSave}>
Expand Down
7 changes: 3 additions & 4 deletions components/settings/Account/AccountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const AccountForm: React.FC<AccountFormProps> = ({
account,
onSave,
buttonProps,
trackingCategory = "account",
buttonText = "Save",
horizontal = false,
previewEnabled = false,
Expand Down Expand Up @@ -82,7 +81,7 @@ export const AccountForm: React.FC<AccountFormProps> = ({
}

trackEvent({
category: trackingCategory,
category: "account",
action: "update",
label: "attempt",
data: values,
Expand All @@ -100,7 +99,7 @@ export const AccountForm: React.FC<AccountFormProps> = ({
}

trackEvent({
category: trackingCategory,
category: "account",
action: "update",
label: "success",
data,
Expand All @@ -113,7 +112,7 @@ export const AccountForm: React.FC<AccountFormProps> = ({
}

trackEvent({
category: trackingCategory,
category: "account",
action: "update",
label: "error",
error: err,
Expand Down
2 changes: 1 addition & 1 deletion components/settings/Account/BillingPlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const BillingPlan: React.FC<BillingPlanProps> = ({

<TrackedLink
href="/pricing"
category="billing"
category="billingAccount"
label="learn-more-pricing"
color="blue.500"
>
Expand Down
34 changes: 1 addition & 33 deletions core-ui/sidebar/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { useRouter } from "next/router";
import { SidebarNav } from "./nav";
import { Route } from "./types";
import { useEffect } from "react";
import { useLocalStorage } from "hooks/useLocalStorage";

type SettingsSidebarProps = {
activePage: "apiKeys" | "devices" | "usage" | "billing";
Expand All @@ -22,34 +19,5 @@ const links: Route[] = [
export const SettingsSidebar: React.FC<SettingsSidebarProps> = ({
activePage,
}) => {
const router = useRouter();
const [isSmartWalletsBeta, setIsSmartWalletsBeta] = useLocalStorage(
"beta-smart-wallets-v1",
false,
true,
);

// FIXME: Remove when ff is lifted
useEffect(() => {
if (router.isReady) {
const { smartWalletsBeta } = router.query;
if (smartWalletsBeta && !isSmartWalletsBeta) {
setIsSmartWalletsBeta(true);
}
}
}, [isSmartWalletsBeta, router, setIsSmartWalletsBeta]);

if (isSmartWalletsBeta) {
return (
<SidebarNav links={links} activePage={activePage} title="Settings" />
);
}

return (
<SidebarNav
links={links.slice(0, 2)}
activePage={activePage}
title="Settings"
/>
);
return <SidebarNav links={links} activePage={activePage} title="Settings" />;
};
5 changes: 1 addition & 4 deletions pages/dashboard/settings/api-keys.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useAccount, useApiKeys } from "@3rdweb-sdk/react/hooks/useApi";
import { Flex } from "@chakra-ui/react";
import { useLocalStorage } from "@solana/wallet-adapter-react";
import { useAddress } from "@thirdweb-dev/react";
import { AppLayout } from "components/app-layouts/app";
import { ApiKeyTable } from "components/settings/ApiKeyTable";
Expand All @@ -14,8 +13,6 @@ import { Heading, Link, Text } from "tw-components";
import { ThirdwebNextPage } from "utils/types";

const SettingsApiKeysPage: ThirdwebNextPage = () => {
// FIXME: Remove when ff is lifted
const [isSmartWalletsBeta] = useLocalStorage("beta-smart-wallets-v1", false);
const address = useAddress();
const keysQuery = useApiKeys();
const meQuery = useAccount();
Expand Down Expand Up @@ -69,7 +66,7 @@ const SettingsApiKeysPage: ThirdwebNextPage = () => {
</Text>
</Flex>

{isSmartWalletsBeta && hasSmartWalletsWithoutBilling && (
{hasSmartWalletsWithoutBilling && (
<SmartWalletsBillingAlert dismissable />
)}

Expand Down
7 changes: 1 addition & 6 deletions pages/dashboard/wallets/smart-wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { useRouter } from "next/router";
import { ContractCard } from "components/explore/contract-card";
import { SiGithub } from "@react-icons/all-files/si/SiGithub";
import { SmartWalletsBillingAlert } from "components/settings/ApiKeyTable/Alerts";
import { useLocalStorage } from "@solana/wallet-adapter-react";

type ContractWithExtensions = {
contract: ContractWithMetadata;
Expand Down Expand Up @@ -205,8 +204,6 @@ const DashboardWalletsSmartWallet: ThirdwebNextPage = () => {
const factories = useFactories();
const keysQuery = useApiKeys();
const meQuery = useAccount();
// FIXME: Remove when ff is lifted
const [isSmartWalletsBeta] = useLocalStorage("beta-smart-wallets-v1", false);
const form = useForm<SmartWalletFormData>();
const [selectedLanguage, setSelectedLanguage] =
useState<CodeEnvironment>("javascript");
Expand All @@ -231,9 +228,7 @@ const DashboardWalletsSmartWallet: ThirdwebNextPage = () => {

return (
<Flex flexDir="column" gap={12} mt={{ base: 2, md: 6 }}>
{isSmartWalletsBeta && hasSmartWalletsWithoutBilling && (
<SmartWalletsBillingAlert />
)}
{hasSmartWalletsWithoutBilling && <SmartWalletsBillingAlert />}
<Flex flexDir="column" gap={4}>
<SimpleGrid columns={{ base: 1, md: 2 }} gap={12}>
<Flex flexDir="column" gap={4}>
Expand Down

0 comments on commit 9b3f46e

Please sign in to comment.