Remove mailing settings

This commit is contained in:
dominik-zeglen 2021-03-29 11:24:47 +02:00
parent c7e27fb3d5
commit 5a81878367
5 changed files with 1 additions and 702 deletions

View file

@ -1,141 +0,0 @@
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import TextField from "@material-ui/core/TextField";
import Typography from "@material-ui/core/Typography";
import CardTitle from "@saleor/components/CardTitle";
import FormSpacer from "@saleor/components/FormSpacer";
import Hr from "@saleor/components/Hr";
import { ShopErrorFragment } from "@saleor/fragments/types/ShopErrorFragment";
import { makeStyles } from "@saleor/theme";
import { getFormErrors } from "@saleor/utils/errors";
import getShopErrorMessage from "@saleor/utils/errors/shop";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
export interface SiteSettingsMailingFormData {
defaultMailSenderName: string;
defaultMailSenderAddress: string;
customerSetPasswordUrl: string;
}
interface SiteSettingsMailingProps {
data: SiteSettingsMailingFormData;
errors: ShopErrorFragment[];
disabled: boolean;
onChange: (event: React.ChangeEvent<any>) => void;
}
const useStyles = makeStyles(
theme => ({
cardHelperText: {
position: "relative",
top: -theme.spacing(1)
},
cardHelperTextCaption: {
marginBottom: theme.spacing(2)
}
}),
{
name: "SiteSettingsMailing"
}
);
const SiteSettingsMailing: React.FC<SiteSettingsMailingProps> = props => {
const { data, disabled, errors, onChange } = props;
const classes = useStyles(props);
const intl = useIntl();
const formErrors = getFormErrors(
[
"defaultMailSenderAddress",
"defaultMailSenderName",
"customerSetPasswordUrl"
],
errors
);
return (
<Card>
<CardTitle
title={intl.formatMessage({
defaultMessage: "Mailing Configuration",
description: "section header"
})}
/>
<CardContent>
<Typography className={classes.cardHelperText}>
<FormattedMessage
defaultMessage="Mailing Configuration"
description="helper text"
id="siteSettingsMailingHelperText"
/>
</Typography>
<Typography className={classes.cardHelperTextCaption} variant="body2">
<FormattedMessage defaultMessage="Configurate your email address from which all automatic emails will be sent to your customers." />
</Typography>
<TextField
disabled={disabled}
error={!!formErrors.defaultMailSenderAddress}
fullWidth
name="defaultMailSenderAddress"
label={intl.formatMessage({
defaultMessage: "Mailing email address"
})}
helperText={getShopErrorMessage(
formErrors.defaultMailSenderAddress,
intl
)}
value={data.defaultMailSenderAddress}
onChange={onChange}
/>
<FormSpacer />
<TextField
disabled={disabled}
error={!!formErrors.defaultMailSenderName}
fullWidth
name="defaultMailSenderName"
label={intl.formatMessage({
defaultMessage: "Mailing email sender"
})}
helperText={
getShopErrorMessage(formErrors.defaultMailSenderName, intl) ||
intl.formatMessage({
defaultMessage: 'This will be visible as "from" name',
description: "email sender"
})
}
value={data.defaultMailSenderName}
onChange={onChange}
/>
<FormSpacer />
<Hr />
<FormSpacer />
<TextField
disabled={disabled}
error={!!formErrors.customerSetPasswordUrl}
fullWidth
autoComplete="off"
type="url"
name="customerSetPasswordUrl"
label={intl.formatMessage({
defaultMessage: "Customer password reset URL"
})}
placeholder={intl.formatMessage({
defaultMessage: "URL address"
})}
helperText={
getShopErrorMessage(formErrors.customerSetPasswordUrl, intl) ||
intl.formatMessage({
defaultMessage:
"This URL will be used as a main URL for password resets. It will be sent via email."
})
}
value={data.customerSetPasswordUrl}
onChange={onChange}
/>
</CardContent>
</Card>
);
};
SiteSettingsMailing.displayName = "SiteSettingsMailing";
export default SiteSettingsMailing;

View file

@ -1,2 +0,0 @@
export { default } from "./SiteSettingsMailing";
export * from "./SiteSettingsMailing";

View file

@ -22,9 +22,6 @@ import { FormattedMessage, useIntl } from "react-intl";
import { maybe } from "../../../misc";
import { SiteSettings_shop } from "../../types/SiteSettings";
import SiteSettingsDetails from "../SiteSettingsDetails/SiteSettingsDetails";
import SiteSettingsMailing, {
SiteSettingsMailingFormData
} from "../SiteSettingsMailing";
export interface SiteSettingsPageAddressFormData {
city: string;
@ -38,8 +35,7 @@ export interface SiteSettingsPageAddressFormData {
}
export interface SiteSettingsPageFormData
extends SiteSettingsPageAddressFormData,
SiteSettingsMailingFormData {
extends SiteSettingsPageAddressFormData {
description: string;
domain: string;
name: string;
@ -114,9 +110,6 @@ const SiteSettingsPage: React.FC<SiteSettingsPageProps> = props => {
};
const initialForm: SiteSettingsPageFormData = {
...initialFormAddress,
customerSetPasswordUrl: maybe(() => shop.customerSetPasswordUrl, ""),
defaultMailSenderAddress: maybe(() => shop.defaultMailSenderAddress, ""),
defaultMailSenderName: maybe(() => shop.defaultMailSenderName, ""),
description: maybe(() => shop.description, ""),
domain: maybe(() => shop.domain.host, ""),
name: maybe(() => shop.name, "")
@ -165,24 +158,6 @@ const SiteSettingsPage: React.FC<SiteSettingsPageProps> = props => {
onChange={change}
/>
<Hr className={classes.hr} />
<div>
<Typography>
<FormattedMessage
defaultMessage="Mailing Configuration"
description="section header"
/>
</Typography>
<Typography variant="body2">
<FormattedMessage defaultMessage="This where you will find all of the settings determining your stores e-mails. You can determine main email address and some of the contents of your emails." />
</Typography>
</div>
<SiteSettingsMailing
data={data}
errors={errors}
disabled={disabled}
onChange={change}
/>
<Hr className={classes.hr} />
<div>
<Typography>
<FormattedMessage

View file

@ -77,9 +77,6 @@ export const SiteSettings: React.FC<SiteSettingsProps> = () => {
name: data.name
},
shopSettingsInput: {
customerSetPasswordUrl: data.customerSetPasswordUrl,
defaultMailSenderAddress: data.defaultMailSenderAddress,
defaultMailSenderName: data.defaultMailSenderName,
description: data.description
}
}

View file

@ -214086,180 +214086,6 @@ exports[`Storyshots Views / Site settings / Page default 1`] = `
<hr
class="Hr-root-id SiteSettingsPage-hr-id"
/>
<div>
<div
class="MuiTypography-root-id MuiTypography-body1-id"
>
Mailing Configuration
</div>
<div
class="MuiTypography-root-id MuiTypography-body2-id"
>
This where you will find all of the settings determining your stores e-mails. You can determine main email address and some of the contents of your emails.
</div>
</div>
<div
class="MuiPaper-root-id MuiCard-root-id MuiPaper-elevation0-id MuiPaper-rounded-id"
>
<div
class="CardTitle-root-id"
>
<span
class="MuiTypography-root-id CardTitle-title-id MuiTypography-h5-id"
>
Mailing Configuration
</span>
<div
class="CardTitle-toolbar-id"
/>
</div>
<div
class="CardTitle-children-id"
/>
<hr
class="CardTitle-hr-id"
/>
<div
class="MuiCardContent-root-id"
>
<div
class="MuiTypography-root-id SiteSettingsMailing-cardHelperText-id MuiTypography-body1-id"
>
Mailing Configuration
</div>
<div
class="MuiTypography-root-id SiteSettingsMailing-cardHelperTextCaption-id MuiTypography-body2-id"
>
Configurate your email address from which all automatic emails will be sent to your customers.
</div>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
data-shrink="true"
>
Mailing email address
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="false"
class="MuiInputBase-input-id MuiOutlinedInput-input-id"
name="defaultMailSenderAddress"
type="text"
value="noreply@example.com"
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id PrivateNotchedOutline-legendNotched-id"
>
<span>
Mailing email address
</span>
</legend>
</fieldset>
</div>
</div>
<div
class="FormSpacer-spacer-id"
/>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
data-shrink="true"
>
Mailing email sender
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="false"
class="MuiInputBase-input-id MuiOutlinedInput-input-id"
name="defaultMailSenderName"
type="text"
value="Saleor"
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id PrivateNotchedOutline-legendNotched-id"
>
<span>
Mailing email sender
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root-id MuiFormHelperText-contained-id MuiFormHelperText-filled-id"
>
This will be visible as "from" name
</p>
</div>
<div
class="FormSpacer-spacer-id"
/>
<hr
class="Hr-root-id"
/>
<div
class="FormSpacer-spacer-id"
/>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-filled-id"
data-shrink="true"
>
Customer password reset URL
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="false"
autocomplete="off"
class="MuiInputBase-input-id MuiOutlinedInput-input-id"
name="customerSetPasswordUrl"
placeholder="URL address"
type="url"
value="https://example.com/reset-password"
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id PrivateNotchedOutline-legendNotched-id"
>
<span>
Customer password reset URL
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root-id MuiFormHelperText-contained-id MuiFormHelperText-filled-id"
>
This URL will be used as a main URL for password resets. It will be sent via email.
</p>
</div>
</div>
</div>
<hr
class="Hr-root-id SiteSettingsPage-hr-id"
/>
<div>
<div
class="MuiTypography-root-id MuiTypography-body1-id"
@ -214805,185 +214631,6 @@ exports[`Storyshots Views / Site settings / Page form errors 1`] = `
<hr
class="Hr-root-id SiteSettingsPage-hr-id"
/>
<div>
<div
class="MuiTypography-root-id MuiTypography-body1-id"
>
Mailing Configuration
</div>
<div
class="MuiTypography-root-id MuiTypography-body2-id"
>
This where you will find all of the settings determining your stores e-mails. You can determine main email address and some of the contents of your emails.
</div>
</div>
<div
class="MuiPaper-root-id MuiCard-root-id MuiPaper-elevation0-id MuiPaper-rounded-id"
>
<div
class="CardTitle-root-id"
>
<span
class="MuiTypography-root-id CardTitle-title-id MuiTypography-h5-id"
>
Mailing Configuration
</span>
<div
class="CardTitle-toolbar-id"
/>
</div>
<div
class="CardTitle-children-id"
/>
<hr
class="CardTitle-hr-id"
/>
<div
class="MuiCardContent-root-id"
>
<div
class="MuiTypography-root-id SiteSettingsMailing-cardHelperText-id MuiTypography-body1-id"
>
Mailing Configuration
</div>
<div
class="MuiTypography-root-id SiteSettingsMailing-cardHelperTextCaption-id MuiTypography-body2-id"
>
Configurate your email address from which all automatic emails will be sent to your customers.
</div>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-error-id MuiInputLabel-error-id MuiFormLabel-filled-id"
data-shrink="true"
>
Mailing email address
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-error-id MuiOutlinedInput-error-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="true"
class="MuiInputBase-input-id MuiOutlinedInput-input-id"
name="defaultMailSenderAddress"
type="text"
value="noreply@example.com"
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id PrivateNotchedOutline-legendNotched-id"
>
<span>
Mailing email address
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root-id MuiFormHelperText-contained-id MuiFormHelperText-error-id MuiFormHelperText-filled-id"
>
Invalid value
</p>
</div>
<div
class="FormSpacer-spacer-id"
/>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-error-id MuiInputLabel-error-id MuiFormLabel-filled-id"
data-shrink="true"
>
Mailing email sender
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-error-id MuiOutlinedInput-error-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="true"
class="MuiInputBase-input-id MuiOutlinedInput-input-id"
name="defaultMailSenderName"
type="text"
value="Saleor"
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id PrivateNotchedOutline-legendNotched-id"
>
<span>
Mailing email sender
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root-id MuiFormHelperText-contained-id MuiFormHelperText-error-id MuiFormHelperText-filled-id"
>
Invalid value
</p>
</div>
<div
class="FormSpacer-spacer-id"
/>
<hr
class="Hr-root-id"
/>
<div
class="FormSpacer-spacer-id"
/>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id MuiFormLabel-error-id MuiInputLabel-error-id MuiFormLabel-filled-id"
data-shrink="true"
>
Customer password reset URL
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-error-id MuiOutlinedInput-error-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="true"
autocomplete="off"
class="MuiInputBase-input-id MuiOutlinedInput-input-id"
name="customerSetPasswordUrl"
placeholder="URL address"
type="url"
value="https://example.com/reset-password"
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id PrivateNotchedOutline-legendNotched-id"
>
<span>
Customer password reset URL
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root-id MuiFormHelperText-contained-id MuiFormHelperText-error-id MuiFormHelperText-filled-id"
>
Invalid value
</p>
</div>
</div>
</div>
<hr
class="Hr-root-id SiteSettingsPage-hr-id"
/>
<div>
<div
class="MuiTypography-root-id MuiTypography-body1-id"
@ -215527,183 +215174,6 @@ exports[`Storyshots Views / Site settings / Page loading 1`] = `
<hr
class="Hr-root-id SiteSettingsPage-hr-id"
/>
<div>
<div
class="MuiTypography-root-id MuiTypography-body1-id"
>
Mailing Configuration
</div>
<div
class="MuiTypography-root-id MuiTypography-body2-id"
>
This where you will find all of the settings determining your stores e-mails. You can determine main email address and some of the contents of your emails.
</div>
</div>
<div
class="MuiPaper-root-id MuiCard-root-id MuiPaper-elevation0-id MuiPaper-rounded-id"
>
<div
class="CardTitle-root-id"
>
<span
class="MuiTypography-root-id CardTitle-title-id MuiTypography-h5-id"
>
Mailing Configuration
</span>
<div
class="CardTitle-toolbar-id"
/>
</div>
<div
class="CardTitle-children-id"
/>
<hr
class="CardTitle-hr-id"
/>
<div
class="MuiCardContent-root-id"
>
<div
class="MuiTypography-root-id SiteSettingsMailing-cardHelperText-id MuiTypography-body1-id"
>
Mailing Configuration
</div>
<div
class="MuiTypography-root-id SiteSettingsMailing-cardHelperTextCaption-id MuiTypography-body2-id"
>
Configurate your email address from which all automatic emails will be sent to your customers.
</div>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
data-shrink="false"
>
Mailing email address
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="false"
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id"
disabled=""
name="defaultMailSenderAddress"
type="text"
value=""
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id"
>
<span>
Mailing email address
</span>
</legend>
</fieldset>
</div>
</div>
<div
class="FormSpacer-spacer-id"
/>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
data-shrink="false"
>
Mailing email sender
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="false"
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id"
disabled=""
name="defaultMailSenderName"
type="text"
value=""
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id"
>
<span>
Mailing email sender
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root-id MuiFormHelperText-contained-id MuiFormHelperText-disabled-id"
>
This will be visible as "from" name
</p>
</div>
<div
class="FormSpacer-spacer-id"
/>
<hr
class="Hr-root-id"
/>
<div
class="FormSpacer-spacer-id"
/>
<div
class="MuiFormControl-root-id MuiTextField-root-id MuiFormControl-fullWidth-id"
>
<label
class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id"
data-shrink="false"
>
Customer password reset URL
</label>
<div
class="MuiInputBase-root-id MuiOutlinedInput-root-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id MuiInputBase-fullWidth-id MuiInputBase-formControl-id"
>
<input
aria-invalid="false"
autocomplete="off"
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-disabled-id MuiOutlinedInput-disabled-id"
disabled=""
name="customerSetPasswordUrl"
placeholder="URL address"
type="url"
value=""
/>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-id MuiOutlinedInput-notchedOutline-id"
>
<legend
class="PrivateNotchedOutline-legendLabelled-id"
>
<span>
Customer password reset URL
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root-id MuiFormHelperText-contained-id MuiFormHelperText-disabled-id"
>
This URL will be used as a main URL for password resets. It will be sent via email.
</p>
</div>
</div>
</div>
<hr
class="Hr-root-id SiteSettingsPage-hr-id"
/>
<div>
<div
class="MuiTypography-root-id MuiTypography-body1-id"