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