Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@TWilson023
Copy link
Collaborator

@TWilson023 TWilson023 commented Oct 16, 2025

Screenshot 2025-10-16 at 1 29 36 PM Screenshot 2025-10-16 at 1 29 45 PM

Summary by CodeRabbit

  • New Features
    • Partner invitation emails now include available rewards and active bounties so recipients see incentives up front.
    • Email templates updated with program details, partner names, personalized greetings, and improved layout for rewards/bounties.
    • Invitation flows (standard and network) send enriched notifications, preserving existing enrollment and logging behavior while improving recipient-facing content.

@vercel
Copy link
Contributor

vercel bot commented Oct 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
dub Ready Ready Preview Oct 16, 2025 6:03pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Walkthrough

Adds a new API to aggregate partner invite rewards and bounties, updates partner-invite flows to include this data when sending emails, and updates/introduces email templates to render rewards and bounties in invitation messages.

Changes

Cohort / File(s) Summary
Partner Invitation API Handler
apps/web/lib/api/partners/get-partner-invite-rewards-and-bounties.ts
New export getPartnerInviteRewardsAndBounties({ programId, groupId }) that fetches group data and active bounties, filters by time/group visibility, orders and deduplicates rewards, and returns rewards: {label,icon}[] and bounties: {label,icon}[].
Partner Invitation Actions
apps/web/lib/actions/partners/create-program.ts, apps/web/lib/actions/partners/invite-partner.ts, apps/web/lib/actions/partners/resend-program-invite.ts
Email sends wrapped in async IIFEs to await rewards data; payloads extended with partner name, program details, and rewards/bounties from the new API; non-blocking flows preserved (Promise.allSettled) and audit/enrollment logic unchanged.
Network Partner Invitation
apps/web/lib/actions/partners/invite-partner-from-network.ts
Reworked invite path to short-circuit when no email, compute groupId (enrolledPartner.groupId or program.defaultGroupId), fetch rewards/bounties, and send ProgramNetworkInvite (replacing ProgramInvite) with enriched payload.
Updated Email Template
packages/email/src/templates/program-invite.tsx
PartnerInvite props extended: name?: string, `rewards: {icon,label}[]
New Email Template
packages/email/src/templates/program-network-invite.tsx
New default export ProgramNetworkInvite({ email, name?, program, rewards?, bounties? }) rendering personalized network invite with Accept Invite link and conditional two-column rewards/bounties sections.

Sequence Diagram

sequenceDiagram
    participant Action as Partner Action
    participant API as getPartnerInviteRewardsAndBounties
    participant DB as Prisma DB
    participant EmailSvc as Email Service
    participant Template as Email Template

    Action->>API: request rewards/bounties (programId, groupId)
    API->>DB: getGroupOrThrow(groupId)
    API->>DB: query active bounties (time + group filters)
    DB-->>API: group + bounties
    API-->>Action: { rewards: [...], bounties: [...] }

    rect rgba(200,220,255,0.25)
      Note over Action,Template: Build email payload with program, partner name, rewards, bounties
      Action->>Template: render(payload)
      Template-->>EmailSvc: formatted message
    end

    EmailSvc->>Action: send result (non-blocking)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • steven-tey

Poem

🐰 I hopped through code to fetch prizes bright,
Invites now sparkle with rewards in sight.
Bounties and badges in rows two-by-two,
Partners will see what good work can do. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely indicates that the pull request makes updates to partner invite emails, which aligns with the primary changes of enriching invite templates with rewards and bounties across related flows. It is specific enough for a reviewer to understand the focus without unnecessary detail.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch partner-invite-emails

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c38f18 and e517ea5.

📒 Files selected for processing (3)
  • apps/web/lib/actions/partners/create-program.ts (2 hunks)
  • packages/email/src/templates/program-invite.tsx (4 hunks)
  • packages/email/src/templates/program-network-invite.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/email/src/templates/program-network-invite.tsx (1)
packages/ui/src/footer.tsx (1)
  • Footer (106-344)
apps/web/lib/actions/partners/create-program.ts (2)
packages/email/src/index.ts (1)
  • sendEmail (6-29)
apps/web/lib/api/partners/get-partner-invite-rewards-and-bounties.ts (1)
  • getPartnerInviteRewardsAndBounties (19-99)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1a33b2 and 0c38f18.

📒 Files selected for processing (7)
  • apps/web/lib/actions/partners/create-program.ts (2 hunks)
  • apps/web/lib/actions/partners/invite-partner-from-network.ts (2 hunks)
  • apps/web/lib/actions/partners/invite-partner.ts (2 hunks)
  • apps/web/lib/actions/partners/resend-program-invite.ts (2 hunks)
  • apps/web/lib/api/partners/get-partner-invite-rewards-and-bounties.ts (1 hunks)
  • packages/email/src/templates/program-invite.tsx (4 hunks)
  • packages/email/src/templates/program-network-invite.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
apps/web/lib/actions/partners/create-program.ts (2)
packages/email/src/index.ts (1)
  • sendEmail (6-29)
apps/web/lib/api/partners/get-partner-invite-rewards-and-bounties.ts (1)
  • getPartnerInviteRewardsAndBounties (19-99)
apps/web/lib/actions/partners/resend-program-invite.ts (2)
packages/email/src/index.ts (1)
  • sendEmail (6-29)
apps/web/lib/api/partners/get-partner-invite-rewards-and-bounties.ts (1)
  • getPartnerInviteRewardsAndBounties (19-99)
apps/web/lib/actions/partners/invite-partner-from-network.ts (3)
packages/email/src/index.ts (1)
  • sendEmail (6-29)
packages/email/src/templates/program-network-invite.tsx (1)
  • ProgramNetworkInvite (19-148)
apps/web/lib/api/partners/get-partner-invite-rewards-and-bounties.ts (1)
  • getPartnerInviteRewardsAndBounties (19-99)
apps/web/lib/actions/partners/invite-partner.ts (2)
packages/email/src/index.ts (1)
  • sendEmail (6-29)
apps/web/lib/api/partners/get-partner-invite-rewards-and-bounties.ts (1)
  • getPartnerInviteRewardsAndBounties (19-99)
apps/web/lib/api/partners/get-partner-invite-rewards-and-bounties.ts (1)
apps/web/lib/api/groups/get-group-or-throw.ts (1)
  • getGroupOrThrow (4-52)
packages/email/src/templates/program-network-invite.tsx (1)
packages/ui/src/footer.tsx (1)
  • Footer (106-344)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

@steven-tey steven-tey merged commit 74d77fe into main Oct 16, 2025
7 of 8 checks passed
@steven-tey steven-tey deleted the partner-invite-emails branch October 16, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants