Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
✨ Remember the currency picked in the pay wall (#3211)
Luke Vella2875e7e44255
diff --git a/apps/web/src/features/billing/client.tsx b/apps/web/src/features/billing/client.tsxindex fae58e484..60df4aede 100644--- a/apps/web/src/features/billing/client.tsx+++ b/apps/web/src/features/billing/client.tsx@@ -1,7 +1,9 @@"use client";import type { PricesByCurrency } from "@rallly/billing";+import { CURRENCY_COOKIE_NAME } from "@rallly/billing";import { posthog } from "@rallly/posthog/client";+import Cookies from "js-cookie";import React from "react";import { create } from "zustand";import type { SpaceTier } from "@/features/space/schema";@@ -77,3 +79,14 @@ export type PayWallPricing = {prices: PricesByCurrency;defaultCurrency: string;};++// Same cookie the pricing page writes, so a currency picked in either place+// is what the other opens in. Shared across subdomains via the cookie domain.+export function setCurrencyCookie(currency: string) {+ Cookies.set(CURRENCY_COOKIE_NAME, currency, {+ path: "/",+ sameSite: "lax",+ domain: process.env.NEXT_PUBLIC_COOKIE_DOMAIN,+ expires: 365,+ });+}diff --git a/apps/web/src/features/billing/components/pay-wall-dialog.tsx b/apps/web/src/features/billing/components/pay-wall-dialog.tsxindex 912bab14a..a1139a818 100644--- a/apps/web/src/features/billing/components/pay-wall-dialog.tsx+++ b/apps/web/src/features/billing/components/pay-wall-dialog.tsx@@ -41,7 +41,7 @@ import { spaceTierSchema } from "@/features/space/schema";import { Trans, useTranslation } from "@/i18n/client";import { useDateTimeConfig } from "@/lib/datetime/client";import type { PayWallPricing, PayWallTrigger } from "../client";-import { usePayWallStore } from "../client";+import { setCurrencyCookie, usePayWallStore } from "../client";import { PLAN_NAMES } from "../constants";function KeyBenefits({ children }: { children?: React.ReactNode }) {@@ -265,9 +265,10 @@ export function PayWallDialog({onOpenChange={(open) => {onOpenChange(open);if (!open) {+ // Plan and interval are per attempt; the currency is a persisted+ // preference (cookie) and must survive close and reopen.setSelectedPlan("pro");setIsAnnual(true);- setSelectedCurrency(defaultCurrency);}}}>@@ -297,6 +298,7 @@ export function PayWallDialog({onValueChange={(value) => {if (value) {setSelectedCurrency(value);+ setCurrencyCookie(value);}}}>