Skip to content

Commit 01ac5fb

Browse files
authored
Warn before the free trial runs out, and shorten the dialog at the end (#2692)
* Warn before the free trial runs out, and shorten the dialog at the end - From 80% of the free trial used, a line under the message box says how much is used, with Add a card where the server sends the way to add one, or "Ask an admin to add a card" for a member. - The used-up dialog says it once: title, one line that also says Bots, conversations and memory are kept, the price ("$5 per member per month") with what it covers, then Not now and Add a card. No full bar and no sentence repeating the button. - A member is told which admins to ask, by name, from the members list. - The Plan row in Settings draws an 8px bar with row-size labels, says what happens at 100%, and offers Add a card beside the bar from 80% where the server sends the way. - The CopilotKit employee dialog is unchanged. * Redesign the free-trial dialog: paused Bots, the bar, a plan card - The person's Bots sit at the top, faded, with a Paused pill: up to four, the rest counted. Left out when there are none or they aren't read yet. - The line says how many runs were used and how many Bots that paused, and that Bots, conversations and memory are kept. - The free trial bar is back, full. - An admin gets a plan card: "Keep your Bots running", $5 per member a month, two lines on what adding the card does, and the organization's monthly total from the members list once it is read. - A member gets the owners and admins to ask as rows with their role, "It's $5 a month for each member.", and Got it. - A failed payment keeps the same shell with no bar and no plan card. - The $5 lives in one place; the other prices are built from it. * Describe the redesigned free-trial dialog in the changelog * Drop the plan card's monthly total, and put Add a card under the Plan bar The plan API sends no billed seat count, and the members list includes people who may not be billed, so a total worked out from it could disagree with the bill. The plan card keeps the price and the two lines on what adding a card does. On the Plan row, Add a card from 80% sits under the bar, as the employee's button does, so the bar keeps its width in a narrow window. * Free-trial dialog: design review fixes - Count and show only the person's own Bots as paused, not Bots shared with them; with none, the line has no Bot part. - Use the shared dialog shell and title as they are. - The plan card is an outline Item, and the admins a member is told to ask are Items with separators. - Both bars use the Progress primitive's own height. - The price reads "$5 per member a month" on the card and in the member's line. - Put the Settings page's imports back in their original order. * Give the plan card's check lines the card's full width The title and the price stay on one row; the two lines sit under them in an ItemFooter, so each fits on one line at the dialog's width. * Take main's CHANGELOG.md: the release note lives in the PR description
1 parent e302771 commit 01ac5fb

7 files changed

Lines changed: 803 additions & 92 deletions

File tree

‎app/src/components/channels/composer/composer.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
} from "react";
3131
import { attachmentModality } from "@/components/channels/chat-messages";
3232
import { IconWaveform } from "@/components/icons/waveform";
33+
import { TrialNote } from "@/components/plan/trial-note";
3334
import { useTouchTyping } from "@/hooks/use-touch-typing";
3435
import {
3536
attachmentAddress,
@@ -2092,6 +2093,8 @@ export function Composer({
20922093
</div>
20932094
</DictationSurface>
20942095
</form>
2096+
{/* Under the box once most of the free trial is used: components/plan/trial-note.tsx. */}
2097+
<TrialNote />
20952098
</div>
20962099
);
20972100
}
@@ -2191,6 +2194,7 @@ export function Composer({
21912194
</div>
21922195
</DictationSurface>
21932196
</form>
2197+
<TrialNote />
21942198
{/* The notice's invisible copy, below the box: see above. Hidden from everyone and inert. */}
21952199
<div
21962200
aria-hidden="true"

‎app/src/components/organizations/organization-settings-page.tsx‎

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import {
7878
employeePaysForOthers,
7979
employeeTrialUsedUp,
8080
organizationNeedsCard,
81+
trialRunningLow,
8182
usePlan,
8283
} from "@/lib/plan/queries";
8384
import {
@@ -86,6 +87,7 @@ import {
8687
OTHERS_NEED_A_CARD,
8788
planSummary,
8889
trialUsed,
90+
WHEN_USED_UP,
8991
} from "@/lib/plan/words";
9092
import { cn } from "@/lib/utils";
9193
import { queryClient } from "@/query-client";
@@ -201,9 +203,10 @@ function NameRow({
201203
* divider, where no plan is needed or while it is read.
202204
*
203205
* On the free trial it shows how much of it is used, as a bar and a percentage
204-
* (`freeRunsUsedPercent`, the person's own share). Never a count or a limit: the server sends
205-
* neither while runs are left. A CopilotKit employee who has used it all keeps the full bar, with
206-
* the line that says their runs are free.
206+
* (`freeRunsUsedPercent`, the person's own share), and a line on what happens at 100%. Never a
207+
* count or a limit: the server sends neither while runs are left. From 80% used it offers the card
208+
* under the bar, where the server sent the way to add one (`addCardUrl`). A CopilotKit employee
209+
* who has used it all keeps the full bar, with the line that says their runs are free.
207210
*/
208211
function PlanRow() {
209212
const plan = usePlan();
@@ -223,15 +226,21 @@ function PlanRow() {
223226
</ItemMedia>
224227
<ItemContent className="min-w-0">
225228
<ItemTitle>Plan</ItemTitle>
226-
<Progress className="mt-0.5 gap-x-3 gap-y-2" value={used}>
227-
<ProgressLabel className="font-normal text-muted-foreground text-xs">
229+
{/* The primitive's own bar, with the row's own text size. */}
230+
<Progress className="mt-1 gap-x-3 gap-y-2" value={used}>
231+
<ProgressLabel className="font-normal text-muted-foreground">
228232
Free trial
229233
</ProgressLabel>
230-
<ProgressValue className="text-xs">
234+
<ProgressValue className="text-foreground">
231235
{() => trialUsed(used)}
232236
</ProgressValue>
233237
</Progress>
234-
{employeeTrialUsedUp(plan) ? (
238+
{/* An employee's runs never pause: they get their own line once it is all used. */}
239+
{plan.copilotKitEmployee !== true ? (
240+
<ItemDescription className="mt-1.5 line-clamp-none">
241+
{WHEN_USED_UP}
242+
</ItemDescription>
243+
) : employeeTrialUsedUp(plan) ? (
235244
<ItemDescription className="mt-1.5 line-clamp-none">
236245
{COPILOTKIT_EMPLOYEE_LINE}
237246
</ItemDescription>
@@ -257,6 +266,21 @@ function PlanRow() {
257266
</a>
258267
</>
259268
) : null}
269+
{/*
270+
* Once most of it is used, where the server sent the way to add a card. Under the bar,
271+
* as the employee's button is, so the bar keeps its width in a narrow window.
272+
*/}
273+
{trialRunningLow(plan) && plan.addCardUrl ? (
274+
<a
275+
className={cn(
276+
buttonVariants({ size: "sm", variant: "outline" }),
277+
"mt-2 self-start",
278+
)}
279+
href={plan.addCardUrl}
280+
>
281+
{cardAction(plan)}
282+
</a>
283+
) : null}
260284
</ItemContent>
261285
</Item>
262286
</>

0 commit comments

Comments
 (0)