Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
✨ Open Google Meet to everyone; gate Zoom and Teams links behind Pro (#3419)
Luke Velladf2aa6f0aeb3
diff --git a/apps/docs/docs.json b/apps/docs/docs.jsonindex 343928009..0bcb10f0a 100644--- a/apps/docs/docs.json+++ b/apps/docs/docs.json@@ -32,6 +32,10 @@"spaces/custom-branding"]},+ {+ "group": "Integrations",+ "pages": ["integrations/google-meet"]+ },{"group": "Guides","pages": ["guide/participant-guide", "guide/content-moderation"]diff --git a/apps/docs/integrations/microsoft-teams.mdx b/apps/docs/integrations/microsoft-teams.mdxindex 957432054..4a15a9f50 100644--- a/apps/docs/integrations/microsoft-teams.mdx+++ b/apps/docs/integrations/microsoft-teams.mdx@@ -6,6 +6,10 @@ description: Connect your Microsoft work or school account so Rallly creates theWith the Microsoft Teams integration, Rallly creates a Teams meeting on your Microsoft account at the moment you finalize a poll. The join link goes into the event, the calendar invite and the confirmation emails, so participants never wait for a link to follow.+<Callout icon="gem" color="#4f46e5">+ Microsoft Teams meeting links require a [Pro subscription](https://rallly.co/pricing) on rallly.co. Connecting your account works on every plan, but choosing Microsoft Teams as the video call for a poll is a Pro feature.+</Callout>+## How it works1. You connect your Microsoft work or school account once, from your settings.@@ -20,7 +24,6 @@ The meeting is created on the Microsoft account you connected, so it follows you- You must have used Teams at least once with that account. An account whose Microsoft 365 plan does not include Teams cannot create meetings.- Your organization must let you approve Rallly, or an administrator must approve it for the organization. See [Admin approval](#admin-approval).- The Microsoft Teams integration must be enabled on the Rallly instance you use. On a self-hosted instance the administrator turns it on.-- Finalizing a poll is a Pro feature on rallly.co. Connecting Microsoft Teams and choosing it for a poll works on every plan; the meeting is created when the poll is finalized.## Adding the appdiff --git a/apps/docs/integrations/zoom.mdx b/apps/docs/integrations/zoom.mdxindex 9235e41a4..a625f2a8c 100644--- a/apps/docs/integrations/zoom.mdx+++ b/apps/docs/integrations/zoom.mdx@@ -6,6 +6,10 @@ description: Connect your Zoom account so Rallly creates the meeting link when yWith the Zoom integration, Rallly creates a Zoom meeting on your account at the moment you finalize a poll. The join link goes into the event, the calendar invite and the confirmation emails, so participants never wait for a link to follow.+<Callout icon="gem" color="#4f46e5">+ Zoom meeting links require a [Pro subscription](https://rallly.co/pricing) on rallly.co. Connecting your account works on every plan, but choosing Zoom as the video call for a poll is a Pro feature.+</Callout>+## How it works1. You connect your Zoom account once, from your settings.@@ -18,7 +22,6 @@ The meeting is created on the Zoom account you connected, so it follows that acc- A Zoom account. A free Zoom plan is enough.- The Zoom integration must be enabled on the Rallly instance you use. On rallly.co it is available to all accounts; on a self-hosted instance the administrator turns it on.-- Finalizing a poll is a Pro feature on rallly.co. Connecting Zoom and choosing it for a poll works on every plan; the meeting is created when the poll is finalized.## Adding the appdiff --git a/apps/web/src/features/billing/client.tsx b/apps/web/src/features/billing/client.tsxindex e6a07567b..3a14f5094 100644--- a/apps/web/src/features/billing/client.tsx+++ b/apps/web/src/features/billing/client.tsx@@ -37,6 +37,7 @@ export function useIsFree() {export type PayWallTrigger = {from:| "poll-settings"+ | "poll-details-form"| "manage-poll"| "custom-branding"| "api-keys"diff --git a/apps/web/src/features/conferencing/components/conferencing-field.tsx b/apps/web/src/features/conferencing/components/conferencing-field.tsxindex fc199d0cc..5a8b7bd71 100644--- a/apps/web/src/features/conferencing/components/conferencing-field.tsx+++ b/apps/web/src/features/conferencing/components/conferencing-field.tsx@@ -17,7 +17,10 @@ import type {ConferencingProvider,PollConferencing,} from "@/features/conferencing/schema";-import { conferencingProviderLabels } from "@/features/conferencing/utils";+import {+ conferencingProviderLabels,+ isProConferencingProvider,+} from "@/features/conferencing/utils";import { Trans, useTranslation } from "@/i18n/client";export type ConferencingOptions = {@@ -66,10 +69,19 @@ export const toConferencingFormValues = (});// Menu entries for the shared "Add location" menu. Renders nothing once a-// choice is made: an event carries one meeting link.+// choice is made: an event carries one meeting link. A caller on a free+// plan passes `upsell` to mark the Pro providers and take the click, so a+// choice that can never be cashed in is not made. Google Meet and a pasted+// link are never gated.export function ConferencingProviderMenuItems({available,-}: Pick<ConferencingOptions, "available">) {+ upsell,+}: Pick<ConferencingOptions, "available"> & {+ upsell?: {+ badge: React.ReactNode;+ onSelect: (provider: ConferencingProvider) => void;+ };+}) {const form = useFormContext<ConferencingFormValues>();const value = form.watch("conferencingProvider");@@ -82,19 +94,27 @@ export function ConferencingProviderMenuItems({<DropdownMenuLabel><Trans i18nKey="videoCall" defaults="Video call" /></DropdownMenuLabel>- {available.map((provider) => (- <DropdownMenuItem- key={provider}- onClick={() => {- form.setValue("conferencingProvider", provider, {- shouldDirty: true,- });- }}- >- <ConferencingProviderIcon provider={provider} size={16} />- {conferencingProviderLabels[provider]}- </DropdownMenuItem>- ))}+ {available.map((provider) => {+ const gate = isProConferencingProvider(provider) ? upsell : undefined;+ return (+ <DropdownMenuItem+ key={provider}+ onClick={() => {+ if (gate) {+ gate.onSelect(provider);+ return;+ }+ form.setValue("conferencingProvider", provider, {+ shouldDirty: true,+ });+ }}+ >+ <ConferencingProviderIcon provider={provider} size={16} />+ {conferencingProviderLabels[provider]}+ {gate?.badge}+ </DropdownMenuItem>+ );+ })}<DropdownMenuItemonClick={() => {form.setValue("conferencingProvider", "custom", {diff --git a/apps/web/src/features/conferencing/utils.ts b/apps/web/src/features/conferencing/utils.tsindex ad723f435..926d939fc 100644--- a/apps/web/src/features/conferencing/utils.ts+++ b/apps/web/src/features/conferencing/utils.ts@@ -33,6 +33,19 @@ export const conferencingProviderLabels: Record<ConferencingProvider, string> =teams: "Microsoft Teams",};+// Which providers a paid plan unlocks. Google Meet stays free: a Gmail+// organizer is the referral engine and rarely converts, so gating Meet+// protects nothing. Zoom and Teams are the tools people have through an+// employer, which is where the upsell lands.+const proConferencingProviders: ReadonlySet<ConferencingProvider> = new Set([+ "zoom",+ "teams",+]);++export function isProConferencingProvider(provider: ConferencingProvider) {+ return proConferencingProviders.has(provider);+}+export const zoomMeetingResponseSchema = z.object({id: z.number(),join_url: z.url(),diff --git a/apps/web/src/features/poll/components/forms/poll-details-form.tsx b/apps/web/src/features/poll/components/forms/poll-details-form.tsxindex 9d42d0fb0..fe263bceb 100644--- a/apps/web/src/features/poll/components/forms/poll-details-form.tsx+++ b/apps/web/src/features/poll/components/forms/poll-details-form.tsx@@ -12,6 +12,8 @@ import { Input } from "@rallly/ui/input";import { BuildingIcon, PlusIcon } from "lucide-react";import * as React from "react";import { Controller, useFormContext } from "react-hook-form";+import { showPayWall, useIsFree } from "@/features/billing/client";+import { ProBadge } from "@/features/billing/components/pro-badge";import type { ConferencingOptions } from "@/features/conferencing/components/conferencing-field";import {ConferencingField,@@ -32,6 +34,7 @@ export const PollDetailsForm = ({}) => {const { t } = useTranslation();const form = useFormContext<NewEventData>();+ const isFree = useIsFree();const { requiredString } = useFormValidation();const { register } = form;@@ -136,6 +139,20 @@ export const PollDetailsForm = ({) : null}<ConferencingProviderMenuItemsavailable={conferencing.available}+ upsell={+ isFree+ ? {+ badge: <ProBadge />,+ onSelect: (provider) => {+ showPayWall({+ from: "poll-details-form",+ action: "conferencing",+ setting: provider,+ });+ },+ }+ : undefined+ }/></DropdownMenuContent></DropdownMenu>diff --git a/apps/web/tests/conferencing.spec.ts b/apps/web/tests/conferencing.spec.tsindex dd39259e4..582869d31 100644--- a/apps/web/tests/conferencing.spec.ts+++ b/apps/web/tests/conferencing.spec.ts@@ -3,7 +3,11 @@ import { expect, test } from "@playwright/test";import { prisma } from "@rallly/database";import { encrypt } from "@rallly/utils/encryption";import { NewPollPage } from "./new-poll-page";-import { createUserInDb, loginWithEmail } from "./test-utils";+import {+ createUserInDb,+ loginWithEmail,+ upgradeSpaceToPro,+} from "./test-utils";const runId = Date.now().toString(36);@@ -85,6 +89,32 @@ test.describeawait expect(page.getByRole("button", { name: "Connect" })).toBeVisible();});+ test("poll form sends a free space to the pay wall for Zoom", async () => {+ const newPollPage = new NewPollPage(page);+ await newPollPage.goto();++ await page.getByRole("button", { name: "Add location" }).click();+ const zoom = page.getByRole("menuitem", { name: "Zoom" });+ await expect(zoom.getByText("Pro")).toBeVisible();+ await zoom.click();++ await expect(page.getByText("Select plan:")).toBeVisible();+ await page.keyboard.press("Escape");+ await expect(page.locator("#create-poll").getByRole("alert")).toHaveCount(+ 0,+ );+ await expect(+ page.locator("#create-poll").getByText("Zoom", { exact: true }),+ ).toHaveCount(0);++ // The remaining tests exercise a Pro organizer. The tier is read from+ // the database on every page load, so no new login is needed.+ const space = await prisma.space.findFirstOrThrow({+ where: { ownerId: userId },+ });+ await upgradeSpaceToPro({ spaceId: space.id, userId, seats: 1 });+ });+test("poll form blocks a provider the organizer has not connected", async () => {const newPollPage = new NewPollPage(page);await newPollPage.goto();