-
-
Notifications
You must be signed in to change notification settings - Fork 4
[codex] Add 508 members newsletter sync #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3c1183a
6780a01
e6dce19
224a385
8e1ce53
8c434d4
cfacfe4
7345a8f
32c9e5f
54304cf
75fac4d
32155a7
482d537
0f33bbf
a4252e5
aeb4ac0
19a831c
9786246
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,6 +116,11 @@ const configurationGroups: ConfigurationGroupMetadata[] = [ | |
| description: | ||
| "Editable onboarding integrations such as DocuSeal, Outline, and onboarding email SMTP.", | ||
| }, | ||
| { | ||
| category: "Newsletter", | ||
| label: "Newsletter", | ||
| description: "Brevo, Keila, and recurring 508 members audience sync settings.", | ||
| }, | ||
| { | ||
| category: "AI", | ||
| label: "AI Providers", | ||
|
|
@@ -1939,6 +1944,32 @@ function App() { | |
| } | ||
| } | ||
|
|
||
| async function syncNewsletters() { | ||
| setBusy("syncNewsletters", true) | ||
| showToast("Queueing newsletter sync") | ||
| try { | ||
| const payload = await requestJson<{ | ||
| job_id?: string | ||
| dry_run?: boolean | ||
| would_enqueue?: { job_type?: string } | ||
| }>("/dashboard/api/sync/newsletters", { | ||
| method: "POST", | ||
|
Comment on lines
+1955
to
+1956
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In deployments that serve the committed dashboard bundle, this new source-only handler is not reachable: the API mounts Useful? React with 👍 / 👎. |
||
| }) | ||
| if (payload.dry_run) { | ||
| showToast( | ||
| `Dry run only: would queue ${payload.would_enqueue?.job_type || "newsletter sync"}`, | ||
| "warning", | ||
| ) | ||
| } else { | ||
| showToast(`Queued newsletter sync ${payload.job_id}`, "ok") | ||
| } | ||
| } catch (error) { | ||
| showError(error, "Unable to queue newsletter sync") | ||
| } finally { | ||
| setBusy("syncNewsletters", false) | ||
| } | ||
| } | ||
|
|
||
| async function assignOnboarder(contactId: string | undefined, onboarder: string) { | ||
| const normalizedContactId = String(contactId || "").trim() | ||
| const normalizedOnboarder = onboarder.trim() | ||
|
|
@@ -2454,6 +2485,7 @@ function App() { | |
| people={sortedPeople} | ||
| sort={sort.people} | ||
| canSync={canUse("people:sync")} | ||
| canSyncNewsletters={canUse("people:sync")} | ||
| loading={loading} | ||
| peopleQuery={peopleQuery} | ||
| peopleMember={peopleMember} | ||
|
|
@@ -2463,6 +2495,7 @@ function App() { | |
| peopleFilterKeys={peopleFilterKeys} | ||
| onSearch={loadPeople} | ||
| onSync={syncPeople} | ||
| onSyncNewsletters={syncNewsletters} | ||
| onSort={(key) => handleSort("people", key)} | ||
| setPeopleQuery={setPeopleQuery} | ||
| setPeopleMember={setPeopleMember} | ||
|
|
@@ -5492,6 +5525,7 @@ function PeopleView(props: { | |
| people: Person[] | ||
| sort: { key: string; direction: SortDirection } | ||
| canSync: boolean | ||
| canSyncNewsletters: boolean | ||
| loading: Record<string, boolean> | ||
| peopleQuery: string | ||
| peopleMember: string | ||
|
|
@@ -5501,6 +5535,7 @@ function PeopleView(props: { | |
| peopleFilterKeys: PeopleFilterKey[] | ||
| onSearch: () => void | ||
| onSync: () => void | ||
| onSyncNewsletters: () => void | ||
| onSort: (key: string) => void | ||
| setPeopleQuery: (value: string) => void | ||
| setPeopleMember: (value: string) => void | ||
|
|
@@ -5529,6 +5564,19 @@ function PeopleView(props: { | |
| Sync people | ||
| </Button> | ||
| ) : null} | ||
| {props.canSyncNewsletters ? ( | ||
| <Button | ||
| id="syncNewsletters" | ||
| data-permission="people:sync" | ||
| type="button" | ||
| variant="secondary" | ||
| onClick={props.onSyncNewsletters} | ||
| disabled={props.loading.syncNewsletters} | ||
| > | ||
| <RefreshCw /> | ||
| Sync newsletters | ||
| </Button> | ||
| ) : null} | ||
| {props.crmBaseUrl ? ( | ||
| <a | ||
| id="crmHomeLink" | ||
|
|
||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.