Add mailing configuration
This commit is contained in:
parent
4623164b21
commit
261f80ee4f
12 changed files with 56 additions and 13 deletions
|
@ -3767,6 +3767,7 @@ type Shop {
|
|||
defaultDigitalMaxDownloads: Int
|
||||
defaultDigitalUrlValidDays: Int
|
||||
companyAddress: Address
|
||||
customerSetPasswordUrl: String
|
||||
}
|
||||
|
||||
type ShopAddressUpdate {
|
||||
|
@ -3816,6 +3817,7 @@ input ShopSettingsInput {
|
|||
defaultDigitalUrlValidDays: Int
|
||||
defaultMailSenderName: String
|
||||
defaultMailSenderAddress: String
|
||||
customerSetPasswordUrl: String
|
||||
}
|
||||
|
||||
type ShopSettingsTranslate {
|
||||
|
|
|
@ -15,12 +15,14 @@ import { FormErrors } from "@saleor/types";
|
|||
export interface SiteSettingsMailingFormData {
|
||||
defaultMailSenderName: string;
|
||||
defaultMailSenderAddress: string;
|
||||
passwordResetUrl: string;
|
||||
customerSetPasswordUrl: string;
|
||||
}
|
||||
interface SiteSettingsMailingProps {
|
||||
data: SiteSettingsMailingFormData;
|
||||
errors: FormErrors<
|
||||
"defaultMailSenderAddress" | "defaultMailSenderName" | "passwordResetUrl"
|
||||
| "defaultMailSenderAddress"
|
||||
| "defaultMailSenderName"
|
||||
| "customerSetPasswordUrl"
|
||||
>;
|
||||
disabled: boolean;
|
||||
onChange: (event: React.ChangeEvent<any>) => void;
|
||||
|
@ -82,7 +84,7 @@ const SiteSettingsMailing: React.FC<SiteSettingsMailingProps> = props => {
|
|||
disabled={disabled}
|
||||
error={!!errors.defaultMailSenderName}
|
||||
fullWidth
|
||||
name="defaultMailSenderAddress"
|
||||
name="defaultMailSenderName"
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Mailing email sender"
|
||||
})}
|
||||
|
@ -93,7 +95,7 @@ const SiteSettingsMailing: React.FC<SiteSettingsMailingProps> = props => {
|
|||
description: "email sender"
|
||||
})
|
||||
}
|
||||
value={data.defaultMailSenderAddress}
|
||||
value={data.defaultMailSenderName}
|
||||
onChange={onChange}
|
||||
/>
|
||||
<FormSpacer />
|
||||
|
@ -101,20 +103,20 @@ const SiteSettingsMailing: React.FC<SiteSettingsMailingProps> = props => {
|
|||
<FormSpacer />
|
||||
<TextField
|
||||
disabled={disabled}
|
||||
error={!!errors.passwordResetUrl}
|
||||
error={!!errors.customerSetPasswordUrl}
|
||||
fullWidth
|
||||
name="passwordResetUrl"
|
||||
name="customerSetPasswordUrl"
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "URL address"
|
||||
})}
|
||||
helperText={
|
||||
errors.passwordResetUrl ||
|
||||
errors.customerSetPasswordUrl ||
|
||||
intl.formatMessage({
|
||||
defaultMessage:
|
||||
"This URL will be used as a main URL for password resets. It will be sent via email."
|
||||
})
|
||||
}
|
||||
value={data.passwordResetUrl}
|
||||
value={data.customerSetPasswordUrl}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
|
|
|
@ -86,19 +86,25 @@ const SiteSettingsPage: React.FC<SiteSettingsPageProps> = props => {
|
|||
maybe(() => shop.companyAddress.country.code, "")
|
||||
);
|
||||
|
||||
const initialForm: SiteSettingsPageFormData = {
|
||||
const initialFormAddress: SiteSettingsPageAddressFormData = {
|
||||
city: maybe(() => shop.companyAddress.city, ""),
|
||||
companyName: maybe(() => shop.companyAddress.companyName, ""),
|
||||
country: maybe(() => shop.companyAddress.country.code, ""),
|
||||
countryArea: maybe(() => shop.companyAddress.countryArea, ""),
|
||||
description: maybe(() => shop.description, ""),
|
||||
domain: maybe(() => shop.domain.host, ""),
|
||||
name: maybe(() => shop.name, ""),
|
||||
phone: maybe(() => shop.companyAddress.phone, ""),
|
||||
postalCode: maybe(() => shop.companyAddress.postalCode, ""),
|
||||
streetAddress1: maybe(() => shop.companyAddress.streetAddress1, ""),
|
||||
streetAddress2: maybe(() => shop.companyAddress.streetAddress2, "")
|
||||
};
|
||||
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, "")
|
||||
};
|
||||
|
||||
return (
|
||||
<Form
|
||||
|
|
|
@ -17,6 +17,9 @@ export const shopFragment = gql`
|
|||
code
|
||||
country
|
||||
}
|
||||
customerSetPasswordUrl
|
||||
defaultMailSenderAddress
|
||||
defaultMailSenderName
|
||||
description
|
||||
domain {
|
||||
host
|
||||
|
|
|
@ -58,6 +58,9 @@ export interface AuthorizationKeyAdd_authorizationKeyAdd_shop {
|
|||
authorizationKeys: (AuthorizationKeyAdd_authorizationKeyAdd_shop_authorizationKeys | null)[];
|
||||
companyAddress: AuthorizationKeyAdd_authorizationKeyAdd_shop_companyAddress | null;
|
||||
countries: (AuthorizationKeyAdd_authorizationKeyAdd_shop_countries | null)[];
|
||||
customerSetPasswordUrl: string | null;
|
||||
defaultMailSenderAddress: string | null;
|
||||
defaultMailSenderName: string | null;
|
||||
description: string | null;
|
||||
domain: AuthorizationKeyAdd_authorizationKeyAdd_shop_domain;
|
||||
name: string;
|
||||
|
|
|
@ -58,6 +58,9 @@ export interface AuthorizationKeyDelete_authorizationKeyDelete_shop {
|
|||
authorizationKeys: (AuthorizationKeyDelete_authorizationKeyDelete_shop_authorizationKeys | null)[];
|
||||
companyAddress: AuthorizationKeyDelete_authorizationKeyDelete_shop_companyAddress | null;
|
||||
countries: (AuthorizationKeyDelete_authorizationKeyDelete_shop_countries | null)[];
|
||||
customerSetPasswordUrl: string | null;
|
||||
defaultMailSenderAddress: string | null;
|
||||
defaultMailSenderName: string | null;
|
||||
description: string | null;
|
||||
domain: AuthorizationKeyDelete_authorizationKeyDelete_shop_domain;
|
||||
name: string;
|
||||
|
|
|
@ -52,6 +52,9 @@ export interface ShopFragment {
|
|||
authorizationKeys: (ShopFragment_authorizationKeys | null)[];
|
||||
companyAddress: ShopFragment_companyAddress | null;
|
||||
countries: (ShopFragment_countries | null)[];
|
||||
customerSetPasswordUrl: string | null;
|
||||
defaultMailSenderAddress: string | null;
|
||||
defaultMailSenderName: string | null;
|
||||
description: string | null;
|
||||
domain: ShopFragment_domain;
|
||||
name: string;
|
||||
|
|
|
@ -58,6 +58,9 @@ export interface ShopSettingsUpdate_shopSettingsUpdate_shop {
|
|||
authorizationKeys: (ShopSettingsUpdate_shopSettingsUpdate_shop_authorizationKeys | null)[];
|
||||
companyAddress: ShopSettingsUpdate_shopSettingsUpdate_shop_companyAddress | null;
|
||||
countries: (ShopSettingsUpdate_shopSettingsUpdate_shop_countries | null)[];
|
||||
customerSetPasswordUrl: string | null;
|
||||
defaultMailSenderAddress: string | null;
|
||||
defaultMailSenderName: string | null;
|
||||
description: string | null;
|
||||
domain: ShopSettingsUpdate_shopSettingsUpdate_shop_domain;
|
||||
name: string;
|
||||
|
|
|
@ -52,6 +52,9 @@ export interface SiteSettings_shop {
|
|||
authorizationKeys: (SiteSettings_shop_authorizationKeys | null)[];
|
||||
companyAddress: SiteSettings_shop_companyAddress | null;
|
||||
countries: (SiteSettings_shop_countries | null)[];
|
||||
customerSetPasswordUrl: string | null;
|
||||
defaultMailSenderAddress: string | null;
|
||||
defaultMailSenderName: string | null;
|
||||
description: string | null;
|
||||
domain: SiteSettings_shop_domain;
|
||||
name: string;
|
||||
|
|
|
@ -142,6 +142,10 @@ export const SiteSettings: React.StatelessComponent<SiteSettingsProps> = ({
|
|||
name: data.name
|
||||
},
|
||||
shopSettingsInput: {
|
||||
customerSetPasswordUrl: data.customerSetPasswordUrl,
|
||||
defaultMailSenderAddress:
|
||||
data.defaultMailSenderAddress,
|
||||
defaultMailSenderName: data.defaultMailSenderName,
|
||||
description: data.description
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,13 @@ storiesOf("Views / Site settings / Page", module)
|
|||
.add("form errors", () => (
|
||||
<SiteSettingsPage
|
||||
{...props}
|
||||
errors={["description", "domain", "name"].map(field => formError(field))}
|
||||
errors={[
|
||||
"description",
|
||||
"domain",
|
||||
"name",
|
||||
"defaultMailSenderAddress",
|
||||
"defaultMailSenderName",
|
||||
"customerSetPasswordUrl"
|
||||
].map(field => formError(field))}
|
||||
/>
|
||||
));
|
||||
|
|
|
@ -299,6 +299,7 @@ export enum WebhookEventTypeEnum {
|
|||
CUSTOMER_CREATED = "CUSTOMER_CREATED",
|
||||
ORDER_CANCELLED = "ORDER_CANCELLED",
|
||||
ORDER_CREATED = "ORDER_CREATED",
|
||||
ORDER_FULFILLED = "ORDER_FULFILLED",
|
||||
ORDER_FULLY_PAID = "ORDER_FULLY_PAID",
|
||||
ORDER_UPDATED = "ORDER_UPDATED",
|
||||
PRODUCT_CREATED = "PRODUCT_CREATED",
|
||||
|
@ -748,6 +749,9 @@ export interface ShopSettingsInput {
|
|||
automaticFulfillmentDigitalProducts?: boolean | null;
|
||||
defaultDigitalMaxDownloads?: number | null;
|
||||
defaultDigitalUrlValidDays?: number | null;
|
||||
defaultMailSenderName?: string | null;
|
||||
defaultMailSenderAddress?: string | null;
|
||||
customerSetPasswordUrl?: string | null;
|
||||
}
|
||||
|
||||
export interface SiteDomainInput {
|
||||
|
|
Loading…
Reference in a new issue