feat(newsletter): add signup modal with HubSpot integration#1758
Open
feat(newsletter): add signup modal with HubSpot integration#1758
Conversation
…lers, and HubSpot CSP
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a startup newsletter signup modal integrated with HubSpot, with persisted “subscribed” / “dismissed” state stored via electron-store and dual-written to SQLite, exposed to the renderer via IPC/preload APIs.
Changes:
- Implement newsletter state persistence in the main process (electron-store + SQLite dual-write + reconcile-on-startup).
- Expose newsletter state getters/setters over IPC and add renderer modal UI + HubSpot submission flow.
- Update CSP to allow connecting to HubSpot submissions endpoint, and add renderer/main tests for the new functionality.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| renderer/src/routes/__root.tsx | Mounts NewsletterModal in the root layout (hidden on shutdown/CLI issue routes). |
| renderer/src/common/mocks/electronAPI.ts | Extends Electron API test stub with newsletter state methods. |
| renderer/src/common/components/newsletter-modal.tsx | New modal UI + HubSpot submission + persistence calls via window.electronAPI. |
| renderer/src/common/components/tests/newsletter-modal.test.tsx | New component tests covering visibility, validation, submit, and dismiss behavior. |
| preload/src/api/app.ts | Adds preload IPC API surface for newsletter state get/set methods. |
| main/src/tests/newsletter.test.ts | New unit tests for main-process newsletter store behavior and dual-write. |
| main/src/newsletter.ts | New main-process newsletter store module + SQLite read flag support + dual-write setters. |
| main/src/ipc-handlers/app.ts | Registers IPC handlers for newsletter state operations. |
| main/src/db/reconcile-from-store.ts | Adds newsletter keys to reconcile flow from electron-store to SQLite. |
| main/src/db/tests/reconcile-from-store.test.ts | Extends reconcile tests to assert newsletter keys are synced. |
| main/src/csp.ts | Allows https://api.hsforms.com in connect-src for HubSpot submissions. |
You can also share your feedback on Copilot code review. Take the survey.
renderer/src/common/components/__tests__/newsletter-modal.test.tsx
Outdated
Show resolved
Hide resolved
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Still WIP, we are fine tuning some things
Adds a one-time newsletter signup modal shown on startup. Subscribing persists the state permanently, dismissing suppresses it for 15 days.
newsletterelectron-store and SQLite dual-write fornewsletterSubscribedandnewsletterDismissedAt, reconciled on startupgetNewsletterState,setNewsletterSubscribed,setNewsletterDismissedAtvia IPC and preload APIhttps://api.hsforms.comin CSP for HubSpot form submissionsNewsletterModalcomponent with Zod email validation, HubSpot v3 API submission, success message display, Sentry error capture, and analytics tracking/shutdownand/cli-issueroutesKapture.2026-03-18.at.18.35.24.mp4