Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

⚡️ Keep the Stripe SDK and lodash out of the poll page bundle (#3463)

Luke Vella0755440971d0
diff --git a/apps/web/src/app/[locale]/(space)/settings/billing/components/switch-to-yearly-dialog.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/switch-to-yearly-dialog.tsx
index 9d3c72aea..c450e8d89 100644
--- a/apps/web/src/app/[locale]/(space)/settings/billing/components/switch-to-yearly-dialog.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/billing/components/switch-to-yearly-dialog.tsx
@@ -1,7 +1,7 @@
"use client";
import { mutationOptions } from "@next-safe-action/adapter-tanstack-query";
-import { yearlySavingsPercent } from "@rallly/billing";
+import { yearlySavingsPercent } from "@rallly/billing/pricing";
import { Button } from "@rallly/ui/button";
import type { DialogProps } from "@rallly/ui/dialog";
import {
diff --git a/apps/web/src/features/billing/client.tsx b/apps/web/src/features/billing/client.tsx
index 02f78a7e3..f12fdd2ef 100644
--- a/apps/web/src/features/billing/client.tsx
+++ b/apps/web/src/features/billing/client.tsx
@@ -1,7 +1,7 @@
"use client";
import type { PricesByCurrency } from "@rallly/billing";
-import { CURRENCY_COOKIE_NAME } from "@rallly/billing";
+import { CURRENCY_COOKIE_NAME } from "@rallly/billing/pricing";
import { posthog } from "@rallly/posthog/client";
import Cookies from "js-cookie";
import React from "react";
diff --git a/apps/web/src/features/billing/constants.ts b/apps/web/src/features/billing/constants.ts
index 3b44d08a5..0ba430800 100644
--- a/apps/web/src/features/billing/constants.ts
+++ b/apps/web/src/features/billing/constants.ts
@@ -3,8 +3,9 @@ import { isSelfHosted } from "@/lib/constants";
// Billing is Stripe on cloud; self-hosted is licensed at instance level
export const isBillingEnabled = !isSelfHosted;
-// Re-export plan names from the shared billing package
-export { PLAN_NAMES } from "@rallly/billing";
+// Import from /pricing, not the package root: the root re-exports the
+// Stripe SDK and this file is reachable from client components.
+export { PLAN_NAMES } from "@rallly/billing/pricing";
// Flash set by /api/stripe/return after a portal flow; value is the flow name.
export const BILLING_FLASH_KEY = "billing";
diff --git a/apps/web/src/features/poll/components/mobile-poll/grouped-options.tsx b/apps/web/src/features/poll/components/mobile-poll/grouped-options.tsx
index 035192544..e96c4fb43 100644
--- a/apps/web/src/features/poll/components/mobile-poll/grouped-options.tsx
+++ b/apps/web/src/features/poll/components/mobile-poll/grouped-options.tsx
@@ -1,5 +1,4 @@
import { cn } from "@rallly/ui";
-import { groupBy } from "lodash";
import type * as React from "react";
import type { ParsedDateTimeOpton } from "@/lib/utils/date-time-utils";
@@ -21,10 +20,19 @@ const GroupedOptions: React.FunctionComponent<GroupedOptionsProps> = ({
group,
groupClassName,
}) => {
- const grouped = groupBy(options, group);
+ const grouped = new Map<string, ParsedDateTimeOpton[]>();
+ for (const option of options) {
+ const key = group(option);
+ const list = grouped.get(key);
+ if (list) {
+ list.push(option);
+ } else {
+ grouped.set(key, [option]);
+ }
+ }
return (
<div className="select-none divide-y">
- {Object.entries(grouped).map(([day, options]) => {
+ {Array.from(grouped, ([day, options]) => {
return (
<div key={day}>
<div
diff --git a/packages/billing/src/index.ts b/packages/billing/src/index.ts
index a727c0d80..63fce27a9 100644
--- a/packages/billing/src/index.ts
+++ b/packages/billing/src/index.ts
@@ -1,7 +1,2 @@
export * from "./lib/stripe";
export * from "./pricing";
-
-export const PLAN_NAMES = {
- HOBBY: "Hobby",
- PRO: "Pro",
-} as const;
diff --git a/packages/billing/src/pricing.ts b/packages/billing/src/pricing.ts
index 11253d0ed..6b8e80df9 100644
--- a/packages/billing/src/pricing.ts
+++ b/packages/billing/src/pricing.ts
@@ -1,3 +1,8 @@
+export const PLAN_NAMES = {
+ HOBBY: "Hobby",
+ PRO: "Pro",
+} as const;
+
export const pricingData = {
monthly: {
amount: 1000,