Add enable cookies field

[MAILPOET-2708]
This commit is contained in:
Amine Ben hammou
2020-04-01 04:59:37 +02:00
committed by Veljko V
parent 0109477597
commit eb8f9ccd2f
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import React from 'react';
import { t, onToggle } from 'common/functions';
import { useSetting } from 'settings/store/hooks';
import { Label, Inputs } from 'settings/components';
export default function EnableCookies() {
const [enabled, setEnabled] = useSetting('woocommerce', 'accept_cookie_revenue_tracking', 'enabled');
return (
<>
<Label
title={t('enableCookiesTitle')}
description={t('enableCookiesDescription')}
htmlFor="mailpoet_accept_cookie_revenue_tracking"
/>
<Inputs>
<input
type="checkbox"
id="mailpoet_accept_cookie_revenue_tracking"
data-automation-id="accept_cookie_revenue_tracking"
checked={enabled === '1'}
onChange={onToggle(setEnabled, '')}
/>
</Inputs>
</>
);
}

View File

@ -3,6 +3,7 @@ import { SaveButton } from 'settings/components';
import EmailCustomizer from './email_customizer'; import EmailCustomizer from './email_customizer';
import CheckoutOptin from './checkout_optin'; import CheckoutOptin from './checkout_optin';
import SubscribeOldCustomers from './subscribe_old_customers'; import SubscribeOldCustomers from './subscribe_old_customers';
import EnableCookies from './enable_cookies';
export default function WooCommerce() { export default function WooCommerce() {
return ( return (
@ -10,6 +11,7 @@ export default function WooCommerce() {
<EmailCustomizer /> <EmailCustomizer />
<CheckoutOptin /> <CheckoutOptin />
<SubscribeOldCustomers /> <SubscribeOldCustomers />
<EnableCookies />
<SaveButton /> <SaveButton />
</div> </div>
); );