*/ public $backoff = [2, 5, 10, 30]; public function __construct(public UserLead $lead, public LeadCohort $cohort) { $this->onQueue('emails'); $this->locale($lead->preferredLocale()); } public function envelope(): Envelope { return new Envelope( subject: $this->subjectFor($this->cohort), ); } public function content(): Content { $signupUrl = app(LandingAuthOverrideService::class) ->generateInvitationUrl($this->lead->id, days: 30); return new Content( markdown: $this->viewFor($this->cohort), with: [ 'lead' => $this->lead, 'cohort' => $this->cohort, 'signupUrl' => $signupUrl, 'promoCodeMonthly' => $this->lead->promo_code_monthly, 'promoCodeYearly' => $this->lead->promo_code_yearly, 'monthlyPrice' => (float) config('subscriptions.plans.monthly.price'), 'yearlyPrice' => (float) config('subscriptions.plans.yearly.price'), ], ); } /** * @return array */ public function middleware(): array { return [(new RateLimited('emails'))->releaseAfter(1)]; } private function viewFor(LeadCohort $cohort): string { return match ($cohort) { LeadCohort::Founder => 'mail.invitations.founder', LeadCohort::FounderReferrer => 'mail.invitations.founder-referrer', LeadCohort::EarlyBird => 'mail.invitations.early-bird', LeadCohort::Waitlist => 'mail.invitations.waitlist', }; } private function subjectFor(LeadCohort $cohort): string { return match ($cohort) { LeadCohort::Founder => __("You're a Whisper Money founder — free forever 🎁"), LeadCohort::FounderReferrer => __('Your referral made you a Whisper Money founder — free forever 🎁'), LeadCohort::EarlyBird => __("You're in early — months on us at Whisper Money"), LeadCohort::Waitlist => __('Your Whisper Money invitation is here'), }; } }