Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tall-groups-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@devgateway/dvz-ui-react": patch
---

Fix newsletter request body to include the list and tag
1 change: 0 additions & 1 deletion packages/dvz-ui/src/embeddable/newsletter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ An embeddable React component that renders a Mailchimp newsletter subscription f
| `successmessage` | string | `"Thanks"` | Message displayed on successful subscription |
| `failuremessage` | string | `"Something didn't go well"` | Message displayed on failed subscription |
| `editing` | boolean | — | When truthy, shows both success and error messages simultaneously (editor preview) |
| `email` *(Redux)* | string | — | Current email input value (managed via Redux store) |
| `status` *(Redux)* | string | — | Subscription status: `"OK"` or `"ERROR"` |

## Usage Example
Expand Down
22 changes: 10 additions & 12 deletions packages/dvz-ui/src/embeddable/newsletter/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ const expresion = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;


const Index = (props) => {

const submit = () => {
const list = props["data-list"];
const tag = props["data-tag"];
const {email} = props;
props.onSubmit({email, list, tag})
}

const {
status,
editing,
Expand All @@ -24,9 +16,15 @@ const Index = (props) => {
"data-failure-message": failuremessage = "Something didn't go well",
"data-label": label = "Send",
"data-tag": tag,
email,
onChange
} = props
} = props;
Comment thread
timothygachengo marked this conversation as resolved.

const [email, setEmail] = React.useState("")

Comment thread
timothygachengo marked this conversation as resolved.
const submit = () => {
if (!expresion.test(email)) return
props.onSubmit({email, list, tag})
}
Comment thread
Copilot marked this conversation as resolved.


let message = ""

Expand All @@ -46,7 +44,7 @@ const Index = (props) => {
return <div className="viz newsLetter">
<div className="viz newsLetter form">
<Input icon='envelope' name="email" value={email}
onChange={(e, target) => onChange(target.value)}
onChange={(e, target) => setEmail(target.value)}
Comment thread
timothygachengo marked this conversation as resolved.
iconPosition='left'
placeholder={placeholder}/>
<Button disabled={!valid} primary onClick={e => submit()}>{label}</Button>
Expand Down
Loading