From bbc95b0221c51ea1665ccdc34149fb44b465c1d7 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Wed, 16 Oct 2024 16:24:56 -0400 Subject: [PATCH] feat: removed payments and limits --- .env | 2 - CODEOWNERS | 2 - components/ListHeader/list-header.tsx | 21 -- components/Workspaces/InsightUpgradeModal.tsx | 218 ------------------ components/Workspaces/WorkspaceBanner.tsx | 21 -- .../InsightHeader/insight-header.tsx | 6 - components/organisms/Reports/reports.tsx | 38 ++- .../stripe-checkout-button.tsx | 44 ---- .../UserSettingsPage/user-settings-page.tsx | 2 +- interfaces/global-state-types.ts | 1 - layouts/hub-page.tsx | 3 - layouts/lists.tsx | 3 - lib/hooks/api/useIsWorkspaceUpgraded.ts | 11 - lib/hooks/useGetOrgRepos.ts | 7 +- lib/hooks/useSession.ts | 2 - lib/hooks/useUserConnections.ts | 12 +- lib/utils/stripe-client.ts | 13 -- lib/utils/workspace-utils.ts | 11 - next-types.d.ts | 2 - package.json | 2 - pages/workspaces/[workspaceId]/activity.tsx | 28 +-- .../[listId]/activity.tsx | 25 +- .../contributor-insights/[listId]/edit.tsx | 19 -- .../[listId]/highlights.tsx | 25 +- .../[listId]/overview.tsx | 28 +-- pages/workspaces/[workspaceId]/index.tsx | 35 +-- pages/workspaces/[workspaceId]/issues.tsx | 27 +-- .../[insightId]/activity.tsx | 27 +-- .../[insightId]/contributors.tsx | 26 +-- .../[insightId]/dashboard.tsx | 27 +-- .../repository-insights/[insightId]/edit.tsx | 24 -- pages/workspaces/[workspaceId]/settings.tsx | 98 +------- 32 files changed, 35 insertions(+), 775 deletions(-) delete mode 100644 components/Workspaces/InsightUpgradeModal.tsx delete mode 100644 components/Workspaces/WorkspaceBanner.tsx delete mode 100644 components/organisms/StripeCheckoutButton/stripe-checkout-button.tsx delete mode 100644 lib/hooks/api/useIsWorkspaceUpgraded.ts delete mode 100644 lib/utils/stripe-client.ts diff --git a/.env b/.env index 0102e354f..fa501f3de 100644 --- a/.env +++ b/.env @@ -4,8 +4,6 @@ NEXT_PUBLIC_API_URL=https://beta.api.opensauced.pizza/v2 NEXT_PUBLIC_EXP_API_URL=https://beta.api.opensauced.pizza/v2 NEXT_PUBLIC_POSTHOG_ID=phc_Y0xz6nK55MEwWjobJsI2P8rsiomZJ6eZLoXehmMy9tt NEXT_PUBLIC_CLOUD_NAME=dgxgziswe -NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=test -NEXT_PUBLIC_STRIPE_SUB_CANCEL_URL=https://billing.stripe.com/p/login/test_bIY8xy3iy6fpeHu3cc SENTRY_DSN=https://3f5bb9023ff0407299dd22a6454558f9@o4504872488927232.ingest.sentry.io/4505082236960768 NEXT_PUBLIC_SENTRY_DSN=https://3f5bb9023ff0407299dd22a6454558f9@o4504872488927232.ingest.sentry.io/4505082236960768 diff --git a/CODEOWNERS b/CODEOWNERS index bc0459326..3081355ba 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -51,7 +51,6 @@ components/StarSearch/SuggestedPrompts.tsx @zeucapua @nickytonline @brandonrober components/TabList/tab-list.tsx @zeucapua @jpmcb @brandonroberts components/Tables/ContributorsGrid.tsx @zeucapua @brandonroberts @nickytonline components/Tables/ContributorsTable.tsx @zeucapua @zeucapua @brandonroberts -components/Workspaces/InsightUpgradeModal.tsx @brandonroberts components/Workspaces/TrackedRepoWizard/PasteReposStep.tsx @brandonroberts @nickytonline @zeucapua components/Workspaces/TrackedReposTable.tsx @nickytonline @brandonroberts components/Workspaces/WorkspaceCard.tsx @brandonroberts @zeucapua @@ -84,7 +83,6 @@ components/molecules/DevProfile/dev-profile.tsx @nickytonline @zeucapua @brandon components/molecules/FilterHeader/filter-header.tsx @brandonroberts components/molecules/HighlightInput/highlight-input-form.tsx @zeucapua components/molecules/HoverCardWrapper/hover-card-wrapper.tsx @nickytonline @zeucapua -components/molecules/InsightHeader/insight-header.tsx @zeucapua @zeucapua @brandonroberts components/molecules/ListCard/list-card.tsx @nickytonline @brandonroberts components/molecules/NewsletterForm/newsletter-form.stories.tsx @brandonroberts @jpmcb @zeucapua components/molecules/NewsletterForm/newsletter-form.tsx @brandonroberts @zeucapua @nickytonline diff --git a/components/ListHeader/list-header.tsx b/components/ListHeader/list-header.tsx index f738488a7..a893a2f84 100644 --- a/components/ListHeader/list-header.tsx +++ b/components/ListHeader/list-header.tsx @@ -2,8 +2,6 @@ import { FaEdit } from "react-icons/fa"; import { FiCopy } from "react-icons/fi"; import { usePostHog } from "posthog-js/react"; -import dynamic from "next/dynamic"; -import { useState } from "react"; import { useRouter } from "next/router"; import Button from "components/shared/Button/button"; import Title from "components/atoms/Typography/title"; @@ -16,8 +14,6 @@ import StackedOwners from "components/Workspaces/StackedOwners"; import { shortenUrl } from "lib/utils/shorten-url"; import { writeToClipboard } from "lib/utils/write-to-clipboard"; -const InsightUpgradeModal = dynamic(() => import("components/Workspaces/InsightUpgradeModal")); - interface ListHeaderProps { name: string; listId: string; @@ -26,7 +22,6 @@ interface ListHeaderProps { isOwner: boolean; numberOfContributors: number; owners?: string[]; - overLimit?: boolean; } const ListHeader = ({ @@ -37,12 +32,10 @@ const ListHeader = ({ isOwner, numberOfContributors, owners, - overLimit, }: ListHeaderProps): JSX.Element => { const { toast } = useToast(); const posthog = usePostHog(); const router = useRouter(); - const [isInsightUpgradeModalOpen, setIsInsightUpgradeModalOpen] = useState(false); const handleCopyToClipboard = async () => { const url = new URL(window.location.href).toString(); @@ -90,11 +83,6 @@ const ListHeader = ({ )} - {workspaceId && ( - setIsInsightUpgradeModalOpen(false)} - overLimit={0} - /> - )} ); }; diff --git a/components/Workspaces/InsightUpgradeModal.tsx b/components/Workspaces/InsightUpgradeModal.tsx deleted file mode 100644 index 64d48c444..000000000 --- a/components/Workspaces/InsightUpgradeModal.tsx +++ /dev/null @@ -1,218 +0,0 @@ -import { ReactNode, useEffect } from "react"; -import { FaRegCheckCircle } from "react-icons/fa"; -import { usePostHog } from "posthog-js/react"; -import { useRouter } from "next/router"; -import { Dialog, DialogTitle, DialogContent, DialogCloseButton } from "components/molecules/Dialog/dialog"; -import Button from "components/shared/Button/button"; -import Card from "components/atoms/Card/card"; -import { useMediaQuery } from "lib/hooks/useMediaQuery"; -import { Drawer } from "components/shared/Drawer"; - -type InsightUpgradeModalProps = { - workspaceId: string; - overLimit?: number; - variant: "repositories" | "contributors" | "workspace" | "all"; - isOpen: boolean; - onClose: () => void; -}; - -export default function InsightUpgradeModal({ workspaceId, variant, isOpen, onClose }: InsightUpgradeModalProps) { - const posthog = usePostHog(); - const isMobile = useMediaQuery("(max-width: 768px)"); - const router = useRouter(); - - const title = variant !== "workspace" ? "This Workspace is over the free limit" : "Upgrade to a PRO Workspace"; - const description = - variant !== "workspace" - ? `Your workspace has exceeded the limit for free usage. Free Workspaces only allow for 20 repositories - and 10 contributors tracked per insight page and 100 workspace repositories. Don't worry, your insights won't be deleted. If you want to - continue using OpenSauced you should upgrade your Workspace to a PRO Account.` - : `Setting your workspace to private is a PRO feature. Upgrade your Workspace and get exclusive access to - your work for you and your team!`; - useEffect(() => { - if (isOpen) { - posthog.capture("clicked: Upgrade Workspace Modal", { workspaceId }); - } - }, [isOpen]); - - return isMobile ? ( - -
- -
-
-

Pro Workspace

-

Ideal for teams

-
- -
-

- $9/mth -

-

charged per Workspace

-
-
- -
    - Private or public Workspaces, you choose! - - Up to 1,000 workspace repositories - - - Up to 100 contributors per insight page - - - Up to 100 repositories per insight page - -
- - -
- - -
-
-

Free Workspace

-

Ideal for individuals

-
- -

- $0/mth -

-
- -
    - Public Workspaces only! - - Up to 100 workspace repositories - - - Up to 10 contributors per insight page - - - Up to 20 repositories per insight page - -
- - -
-
-
- ) : ( - - - -
- -
- {title} -

{description}

-
- -
- -
-
-

Free Workspace

-

Ideal for individuals

-
- -

- $0/mth -

-
- -
    - Public Workspaces only! - - Up to 100 workspace repositories - - - Up to 10 contributors per insight page - - - Up to 20 repositories per insight page - -
- - -
- - -
-
-

Pro Workspace

-

Ideal for teams

-
- -
-

- $9/mth -

-

charged per Workspace

-
-
- -
    - Private or public Workspaces, you choose! - - Up to 1,000 workspace repositories - - - Up to 100 contributors per insight page - - - Up to 100 repositories per insight page - -
- - -
-
-
-
-
-
- ); -} - -function ChecklistItem({ color, children }: { color: "orange" | "green"; children: ReactNode }) { - return ( -
  • - -

    {children}

    -
  • - ); -} diff --git a/components/Workspaces/WorkspaceBanner.tsx b/components/Workspaces/WorkspaceBanner.tsx deleted file mode 100644 index 0178c6e3c..000000000 --- a/components/Workspaces/WorkspaceBanner.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { usePostHog } from "posthog-js/react"; -import { useEffect } from "react"; - -type WorkspaceBannerProps = { - workspaceId: string; - openModal: () => void; -}; - -export default function WorkspaceBanner({ workspaceId, openModal }: WorkspaceBannerProps) { - const posthog = usePostHog(); - - useEffect(() => { - posthog.capture("shown: Upgrade Workspace Banner", { workspaceId }); - }, []); - - return ( - - ); -} diff --git a/components/molecules/InsightHeader/insight-header.tsx b/components/molecules/InsightHeader/insight-header.tsx index 2d749b403..041882ae9 100644 --- a/components/molecules/InsightHeader/insight-header.tsx +++ b/components/molecules/InsightHeader/insight-header.tsx @@ -5,7 +5,6 @@ import { usePostHog } from "posthog-js/react"; import { FiCopy } from "react-icons/fi"; import { useRouter } from "next/router"; -import dynamic from "next/dynamic"; import getRepoInsights from "lib/utils/get-repo-insights"; import Button from "components/shared/Button/button"; import Title from "components/atoms/Typography/title"; @@ -21,8 +20,6 @@ import { useMediaQuery } from "lib/hooks/useMediaQuery"; import CardRepoList from "../CardRepoList/card-repo-list"; import ComponentDateFilter from "../ComponentDateFilter/component-date-filter"; -const InsightUpgradeModal = dynamic(() => import("components/Workspaces/InsightUpgradeModal")); - interface InsightHeaderProps { insight?: DbUserInsight; repositories?: number[]; @@ -30,7 +27,6 @@ interface InsightHeaderProps { canEdit: boolean | undefined; workspaceId?: string; owners?: string[]; - overLimit?: boolean; } const InsightHeader = ({ @@ -40,14 +36,12 @@ const InsightHeader = ({ canEdit, workspaceId, owners, - overLimit, }: InsightHeaderProps): JSX.Element => { const router = useRouter(); const { range } = router.query; const { data: repoData, meta: repoMeta } = useRepositories(repositories); const { repoList } = getRepoInsights(repoData); const [insightPageLink, setInsightPageLink] = useState(""); - const [isInsightUpgradeModalOpen, setIsInsightUpgradeModalOpen] = useState(false); const { toast } = useToast(); const posthog = usePostHog(); const isMobile = useMediaQuery("(max-width: 768px)"); diff --git a/components/organisms/Reports/reports.tsx b/components/organisms/Reports/reports.tsx index 13a1a3ba9..a89b91848 100644 --- a/components/organisms/Reports/reports.tsx +++ b/components/organisms/Reports/reports.tsx @@ -6,10 +6,8 @@ import GitHubIcon from "img/icons/github-icon.svg"; import Button from "components/shared/Button/button"; import Icon from "components/atoms/Icon/icon"; import Title from "components/atoms/Typography/title"; -import Text from "components/atoms/Typography/text"; import ReportsHistory from "components/molecules/ReportsHistory/reports-history"; import SelectReportsFilter from "components/molecules/SelectReportsFilter/select-reports-filter"; -import StripeCheckoutButton from "components/organisms/StripeCheckoutButton/stripe-checkout-button"; import { Report } from "interfaces/report-type"; @@ -20,12 +18,11 @@ import getCurrentDate from "lib/utils/get-current-date"; const USERDEVICESTORAGENAME = "reportState"; interface ReportsProps { - hasReports?: boolean; waitlisted?: boolean; repositories?: number[]; } -const Reports = ({ hasReports, repositories }: ReportsProps): JSX.Element => { +const Reports = ({ repositories }: ReportsProps): JSX.Element => { const userDeviceState = localStorage.getItem(USERDEVICESTORAGENAME); const initialState = userDeviceState ? JSON.parse(userDeviceState as string) : []; const [reports, setReports] = useState(initialState); @@ -64,28 +61,19 @@ const Reports = ({ hasReports, repositories }: ReportsProps): JSX.Element => {
    {user ? ( - hasReports ? ( - <> - + <> + - {reports.length > 0 && ( - <> - - Download History - -
    - - - )} - - ) : ( - <> - Upgrade to a subscription to gain access to generate custom reports! -

    - -

    - - ) + {reports.length > 0 && ( + <> + + Download History + +
    + + + )} + ) : (
    - - ); -}; - -export default StripeCheckoutButton; diff --git a/components/organisms/UserSettingsPage/user-settings-page.tsx b/components/organisms/UserSettingsPage/user-settings-page.tsx index aae923507..a9421e2d1 100644 --- a/components/organisms/UserSettingsPage/user-settings-page.tsx +++ b/components/organisms/UserSettingsPage/user-settings-page.tsx @@ -337,7 +337,7 @@ const UserSettingsPage = ({ user }: UserSettingsPageProps) => {
    -
    +