Skip to content

Commit

Permalink
Fix New Subscriber Email (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-gordon authored Nov 1, 2023
1 parent d614ba7 commit bec285c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/lib/sendLoopsEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ export function sendLoopsEvent(body: { email: string; eventName: string }) {
body: JSON.stringify(body),
});
}

export function loopsNewSubscriber(email: string) {
sendLoopsEvent({
email,
eventName: "new_subscriber",
});
}
11 changes: 11 additions & 0 deletions app/src/pages/Success.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ import { FileCsv, FloppyDisk, MagicWand, TreeStructure } from "phosphor-react";
import classNames from "classnames";
import { Trans, t } from "@lingui/macro";
import { Link, useNavigate } from "react-router-dom";
import { useSession } from "../lib/hooks";
import { loopsNewSubscriber } from "../lib/sendLoopsEvent";
const Confetti = lazy(() => import("react-confetti"));

export default function Success() {
const [windowSize, setWindowSize] = useState<[number, number] | null>(null);
const [numPieces, setNumPieces] = useState(200);
const session = useSession();

// Wait until the email is present then send welcome email
useEffect(() => {
if (session?.user?.email) {
loopsNewSubscriber(session.user.email);
}
}, [session?.user?.email]);

useEffect(() => {
setWindowSize([window.innerWidth, window.innerHeight]);
// reduce the num pieces by 50 every 2 seconds
Expand Down

0 comments on commit bec285c

Please sign in to comment.