From 3cafce63bcf8ae74bca9822169acb0ecb81c8ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daphn=C3=A9=20Popin?= Date: Thu, 4 Apr 2024 17:13:02 +0200 Subject: [PATCH] =?UTF-8?q?Pok=C3=A9:=20rework=20display=20active=20subscr?= =?UTF-8?q?iption/plan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/pages/poke/[wId]/index.tsx | 241 ++++++++++++++++++++++++++++--- 1 file changed, 223 insertions(+), 18 deletions(-) diff --git a/front/pages/poke/[wId]/index.tsx b/front/pages/poke/[wId]/index.tsx index a0e66231126b..c8e4292a7004 100644 --- a/front/pages/poke/[wId]/index.tsx +++ b/front/pages/poke/[wId]/index.tsx @@ -1,8 +1,14 @@ import { Button, Collapsible, + ConfluenceLogo, DropdownMenu, + GithubLogo, + GoogleLogo, + IntercomLogo, Modal, + NotionLogo, + SlackLogo, Spinner, } from "@dust-tt/sparkle"; import type { @@ -14,7 +20,7 @@ import type { import type { WorkspaceType } from "@dust-tt/types"; import type { PlanType, SubscriptionType } from "@dust-tt/types"; import { DustProdActionRegistry, WHITELISTABLE_FEATURES } from "@dust-tt/types"; -import { JsonViewer } from "@textea/json-viewer"; +import { format } from "date-fns/format"; import { keyBy } from "lodash"; import type { InferGetServerSidePropsType } from "next"; import Link from "next/link"; @@ -25,6 +31,12 @@ import { AssistantsDataTable } from "@app/components/poke/assistants/table"; import { DataSourceDataTable } from "@app/components/poke/data_sources/table"; import { FeatureFlagsDataTable } from "@app/components/poke/features/table"; import PokeNavbar from "@app/components/poke/PokeNavbar"; +import { + PokeTable, + PokeTableBody, + PokeTableCell, + PokeTableRow, +} from "@app/components/poke/shadcn/ui/table"; import { SubscriptionsDataTable } from "@app/components/poke/subscriptions/table"; import { SendNotificationsContext } from "@app/components/sparkle/Notification"; import { getAgentConfigurations } from "@app/lib/api/assistant/configuration"; @@ -247,6 +259,8 @@ const WorkspacePage = ({ (ds) => !!ds.connectorProvider ); + const activePlan = activeSubscription.plan; + return ( <> - {activeSubscription.stripeSubscriptionId && ( -
- - View Stripe Subscription - -
- )}
@@ -329,9 +328,215 @@ const WorkspacePage = ({
+
+
+
+
+

+ Active Subscription: +

+ + + + Plan Name + + {activeSubscription.plan.name} + + + + Plan Code + + {activeSubscription.plan.code} + + + + Is in Trial? + + {activeSubscription.trialing ? "✅" : "❌"} + + + + + Stripe Subscription Id + + + {activeSubscription.stripeSubscriptionId ? ( + + {activeSubscription.stripeSubscriptionId} + + ) : ( + "No subscription id" + )} + + + + Stripe Customer Id + + {activeSubscription.stripeCustomerId ? ( + + {activeSubscription.stripeCustomerId} + + ) : ( + "No customer id" + )} + + + + Start Date + + {activeSubscription.startDate + ? format( + activeSubscription.startDate, + "yyyy-MM-dd" + ) + : "/"} + + + + End Date + + {activeSubscription.endDate + ? format( + activeSubscription.endDate, + "yyyy-MM-dd" + ) + : "/"} + + + + +
+
+ +
+
+

+ Plan limitations: +

+ + + + SlackBot allowed + + {activePlan.limits.assistant.isSlackBotAllowed + ? "✅" + : "❌"} + + + + Websites allowed + + {activePlan.limits.connections.isWebCrawlerAllowed + ? "✅" + : "❌"} + + + + Connections allowed + +
+ {activePlan.limits.connections + .isSlackAllowed ? ( + + ) : null} + {activePlan.limits.connections + .isGoogleDriveAllowed ? ( + + ) : null} + {activePlan.limits.connections + .isGithubAllowed ? ( + + ) : null} + {activePlan.limits.connections + .isNotionAllowed ? ( + + ) : null} + {activePlan.limits.connections + .isIntercomAllowed ? ( + + ) : null} + {activePlan.limits.connections + .isConfluenceAllowed ? ( + + ) : null} +
+
+
+ + + Max number of users + + {activePlan.limits.users.maxUsers === -1 + ? "unlimited" + : activePlan.limits.users.maxUsers} + + -

Plan:

- + + + Max number of messages + + + {activePlan.limits.assistant.maxMessages === -1 + ? "unlimited" + : `${activePlan.limits.assistant.maxMessages} / ${activePlan.limits.assistant.maxMessagesTimeframe}`} + + + + + + Max number of data sources + + + {activePlan.limits.dataSources.count === -1 + ? "unlimited" + : activePlan.limits.dataSources.count} + + + + + + Max number of documents in data sources + + + {activePlan.limits.dataSources.documents.count === + -1 + ? "unlimited" + : activePlan.limits.dataSources.documents.count} + + + + + Max documents size + + {activePlan.limits.dataSources.documents + .sizeMb === -1 + ? "unlimited" + : `${activePlan.limits.dataSources.documents.sizeMb}Mb`} + + +
+
+
+
+
+
{plans && (