Add a component for # of opens
[MAILPOET-3224]
This commit is contained in:
@@ -9,8 +9,10 @@ import {
|
||||
} from '../types';
|
||||
|
||||
import { EmailStatisticsFields } from './email_statistics';
|
||||
import { EmailOpensAbsoluteCountFields } from './email_opens_absolute_count';
|
||||
|
||||
export const EmailSegmentOptions = [
|
||||
{ value: 'opensAbsoluteCount', label: MailPoet.I18n.t('emailActionOpensAbsoluteCount'), group: SegmentTypes.Email },
|
||||
{ value: 'opened', label: MailPoet.I18n.t('emailActionOpened'), group: SegmentTypes.Email },
|
||||
{ value: 'notOpened', label: MailPoet.I18n.t('emailActionNotOpened'), group: SegmentTypes.Email },
|
||||
{ value: 'clicked', label: MailPoet.I18n.t('emailActionClicked'), group: SegmentTypes.Email },
|
||||
@@ -33,9 +35,23 @@ interface Props {
|
||||
item: EmailFormItem;
|
||||
}
|
||||
|
||||
export const EmailFields: React.FunctionComponent<Props> = ({ onChange, item }) => (
|
||||
<EmailStatisticsFields
|
||||
item={item}
|
||||
onChange={onChange}
|
||||
/>
|
||||
);
|
||||
const componentsMap = {
|
||||
[EmailActionTypes.OPENS_ABSOLUTE_COUNT]: EmailOpensAbsoluteCountFields,
|
||||
[EmailActionTypes.CLICKED]: EmailStatisticsFields,
|
||||
[EmailActionTypes.NOT_CLICKED]: EmailStatisticsFields,
|
||||
[EmailActionTypes.OPENED]: EmailStatisticsFields,
|
||||
[EmailActionTypes.NOT_OPENED]: EmailStatisticsFields,
|
||||
};
|
||||
|
||||
export const EmailFields: React.FunctionComponent<Props> = ({ onChange, item }) => {
|
||||
const Component = componentsMap[item.action];
|
||||
|
||||
if (!Component) return null;
|
||||
|
||||
return (
|
||||
<Component
|
||||
item={item}
|
||||
onChange={onChange}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
EmailFormItem,
|
||||
OnFilterChange,
|
||||
} from '../types';
|
||||
|
||||
interface Props {
|
||||
onChange: OnFilterChange;
|
||||
item: EmailFormItem;
|
||||
}
|
||||
|
||||
export const EmailOpensAbsoluteCountFields: React.FunctionComponent<Props> = ({
|
||||
onChange,
|
||||
item,
|
||||
}) => (
|
||||
<>
|
||||
<div className="mailpoet-form-field">
|
||||
{item.name}
|
||||
</div>
|
||||
</>
|
||||
);
|
@@ -134,6 +134,7 @@
|
||||
'selectActionPlaceholder': __('Select action'),
|
||||
'selectUserRolePlaceholder': __('Select user role'),
|
||||
'emailActionOpened': _x('opened', 'Dynamic segment creation: when newsletter was opened'),
|
||||
'emailActionOpensAbsoluteCount': __('# of opens'),
|
||||
'emailActionNotOpened': _x('not opened', 'Dynamic segment creation: when newsletter was not opened'),
|
||||
'emailActionClicked': _x('clicked', 'Dynamic segment creation: when a newsletter link was clicked'),
|
||||
'emailActionNotClicked': _x('not clicked', 'Dynamic segment creation: when a newsletter link was not clicked'),
|
||||
|
Reference in New Issue
Block a user