From 8e692c95b0d28e8289c672cbbed9e7fb776a033b Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 11:55:15 +0200 Subject: [PATCH 01/11] Fix story --- src/storybook/stories/categories/CategoryUpdatePage.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/storybook/stories/categories/CategoryUpdatePage.tsx b/src/storybook/stories/categories/CategoryUpdatePage.tsx index 86d508e79..6bcd78919 100644 --- a/src/storybook/stories/categories/CategoryUpdatePage.tsx +++ b/src/storybook/stories/categories/CategoryUpdatePage.tsx @@ -53,7 +53,13 @@ storiesOf("Views / Categories / Update category", module) /> )) .add("no background", () => ( - + )) .add("no subcategories", () => ( From 3c82164340a42aa836d80fd2e43f12969f2f67d2 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 11:55:21 +0200 Subject: [PATCH 02/11] Fix theme --- src/components/ImageUpload/ImageUpload.tsx | 4 +++- src/theme.ts | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/ImageUpload/ImageUpload.tsx b/src/components/ImageUpload/ImageUpload.tsx index 431b96186..5ffc05d7f 100644 --- a/src/components/ImageUpload/ImageUpload.tsx +++ b/src/components/ImageUpload/ImageUpload.tsx @@ -54,6 +54,8 @@ const styles = (theme: Theme) => }, uploadText: { color: theme.typography.body2.color, + fontSize: 12, + fontWeight: 600, textTransform: "uppercase" } }); @@ -93,7 +95,7 @@ export const ImageUpload = withStyles(styles, { name: "ImageUpload" })( > - + fontFamily }, body1: { - fontSize: "0.75rem", - fontWeight: 600 as 600 + fontSize: 14 }, body2: { fontSize: "1rem" From 68a4efdf49a64519f3bfebb976d3c49587d9dc44 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 12:13:23 +0200 Subject: [PATCH 03/11] Add mailing configuration --- .../SiteSettingsMailing.tsx | 100 +++++++++++++++++ .../components/SiteSettingsMailing/index.ts | 2 + .../SiteSettingsPage/SiteSettingsPage.tsx | 101 ++++++++++++++---- 3 files changed, 184 insertions(+), 19 deletions(-) create mode 100644 src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx create mode 100644 src/siteSettings/components/SiteSettingsMailing/index.ts diff --git a/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx b/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx new file mode 100644 index 000000000..69d817967 --- /dev/null +++ b/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx @@ -0,0 +1,100 @@ +import Card from "@material-ui/core/Card"; +import CardContent from "@material-ui/core/CardContent"; +import { Theme } from "@material-ui/core/styles"; +import TextField from "@material-ui/core/TextField"; +import Typography from "@material-ui/core/Typography"; +import { makeStyles } from "@material-ui/styles"; +import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; + +import CardTitle from "@saleor/components/CardTitle"; +import FormSpacer from "@saleor/components/FormSpacer"; +import Hr from "@saleor/components/Hr"; +import { FormErrors } from "@saleor/types"; +import { SiteSettingsPageFormData } from "../SiteSettingsPage"; + +interface SiteSettingsMailingProps { + data: SiteSettingsPageFormData; + errors: FormErrors<"email" | "passwordResetUrl">; + disabled: boolean; + onChange: (event: React.ChangeEvent) => void; +} + +const useStyles = makeStyles( + (theme: Theme) => ({ + cardHelperText: { + position: "relative", + top: -theme.spacing.unit + }, + cardHelperTextCaption: { + marginBottom: theme.spacing.unit * 2 + } + }), + { + name: "SiteSettingsMailing" + } +); + +const SiteSettingsMailing: React.FC = props => { + const { data, disabled, errors, onChange } = props; + const classes = useStyles(props); + const intl = useIntl(); + + return ( + + + + + + + + + + + +
+ + +
+
+ ); +}; +SiteSettingsMailing.displayName = "SiteSettingsMailing"; +export default SiteSettingsMailing; diff --git a/src/siteSettings/components/SiteSettingsMailing/index.ts b/src/siteSettings/components/SiteSettingsMailing/index.ts new file mode 100644 index 000000000..424ec5bea --- /dev/null +++ b/src/siteSettings/components/SiteSettingsMailing/index.ts @@ -0,0 +1,2 @@ +export { default } from "./SiteSettingsMailing"; +export * from "./SiteSettingsMailing"; diff --git a/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx b/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx index 6b90808de..890874836 100644 --- a/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx +++ b/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx @@ -1,4 +1,6 @@ +import { Theme } from "@material-ui/core/styles"; import Typography from "@material-ui/core/Typography"; +import { makeStyles } from "@material-ui/styles"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -7,6 +9,7 @@ import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton"; import Container from "@saleor/components/Container"; import Form from "@saleor/components/Form"; import Grid from "@saleor/components/Grid"; +import Hr from "@saleor/components/Hr"; import PageHeader from "@saleor/components/PageHeader"; import SaveButtonBar from "@saleor/components/SaveButtonBar"; import useStateFromProps from "@saleor/hooks/useStateFromProps"; @@ -20,6 +23,7 @@ import { SiteSettings_shop } from "../../types/SiteSettings"; import SiteSettingsAddress from "../SiteSettingsAddress/SiteSettingsAddress"; import SiteSettingsDetails from "../SiteSettingsDetails/SiteSettingsDetails"; import SiteSettingsKeys from "../SiteSettingsKeys/SiteSettingsKeys"; +import SiteSettingsMailing from "../SiteSettingsMailing"; export interface SiteSettingsPageAddressFormData { city: string; @@ -36,7 +40,9 @@ export interface SiteSettingsPageFormData extends SiteSettingsPageAddressFormData { description: string; domain: string; + email: string; name: string; + passwordResetUrl: string; } export interface SiteSettingsPageProps { @@ -50,16 +56,30 @@ export interface SiteSettingsPageProps { onSubmit: (data: SiteSettingsPageFormData) => void; } -const SiteSettingsPage: React.StatelessComponent = ({ - disabled, - errors, - saveButtonBarState, - shop, - onBack, - onKeyAdd, - onKeyRemove, - onSubmit -}) => { +const useStyles = makeStyles( + (theme: Theme) => ({ + hr: { + gridColumnEnd: "span 2", + margin: `${theme.spacing.unit}px 0` + } + }), + { + name: "SiteSettingsPage" + } +); + +const SiteSettingsPage: React.FC = props => { + const { + disabled, + errors, + saveButtonBarState, + shop, + onBack, + onKeyAdd, + onKeyRemove, + onSubmit + } = props; + const classes = useStyles(props); const intl = useIntl(); const [displayCountry, setDisplayCountry] = useStateFromProps( maybe(() => shop.companyAddress.country.code, "") @@ -105,18 +125,51 @@ const SiteSettingsPage: React.StatelessComponent = ({ title={intl.formatMessage(commonMessages.generalInformations)} /> - - {intl.formatMessage(sectionNames.siteSettings)} - +
+ + {intl.formatMessage(sectionNames.siteSettings)} + + + + +
- - - +
+
+ + + + + + +
+ +
+
+ + + + + + + +
= ({ onChange={change} onCountryChange={handleCountryChange} /> - - - +
+
+ + + + + + +
shop.authorizationKeys)} @@ -148,5 +210,6 @@ const SiteSettingsPage: React.StatelessComponent = ({ ); }; + SiteSettingsPage.displayName = "SiteSettingsPage"; export default SiteSettingsPage; From cc32a2fda534392353daae079245367f9f8deb0d Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 12:13:31 +0200 Subject: [PATCH 04/11] Update schema --- schema.graphql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/schema.graphql b/schema.graphql index 89b27f930..a845ef15b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -3327,6 +3327,8 @@ type ProductVariantUpdatePrivateMeta { type Query { webhook(id: ID!): Webhook webhooks(filter: WebhookFilterInput, before: String, after: String, first: Int, last: Int): WebhookCountableConnection + webhookEvents: [WebhookEvent] + webhookSamplePayload(eventType: WebhookEventTypeEnum!): JSONString translations(kind: TranslatableKinds!, before: String, after: String, first: Int, last: Int): TranslatableItemConnection shop: Shop shippingZone(id: ID!): ShippingZone @@ -3744,6 +3746,8 @@ type Shop { currencies: [String]! defaultCurrency: String! defaultCountry: CountryDisplay + defaultMailSenderName: String + defaultMailSenderAddress: String description: String domain: Domain! homepageCollection: Collection @@ -3810,6 +3814,8 @@ input ShopSettingsInput { automaticFulfillmentDigitalProducts: Boolean defaultDigitalMaxDownloads: Int defaultDigitalUrlValidDays: Int + defaultMailSenderName: String + defaultMailSenderAddress: String } type ShopSettingsTranslate { @@ -4317,6 +4323,7 @@ enum WebhookErrorCode { type WebhookEvent { eventType: WebhookEventTypeEnum + name: String } enum WebhookEventTypeEnum { From 4623164b21beea78dc9138fedff2e56a2c530f28 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 13:11:05 +0200 Subject: [PATCH 05/11] Fix types --- .../SiteSettingsMailing.tsx | 41 +++++++++++++++---- .../SiteSettingsPage/SiteSettingsPage.tsx | 9 ++-- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx b/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx index 69d817967..3a619ed58 100644 --- a/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx +++ b/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx @@ -11,11 +11,17 @@ import CardTitle from "@saleor/components/CardTitle"; import FormSpacer from "@saleor/components/FormSpacer"; import Hr from "@saleor/components/Hr"; import { FormErrors } from "@saleor/types"; -import { SiteSettingsPageFormData } from "../SiteSettingsPage"; +export interface SiteSettingsMailingFormData { + defaultMailSenderName: string; + defaultMailSenderAddress: string; + passwordResetUrl: string; +} interface SiteSettingsMailingProps { - data: SiteSettingsPageFormData; - errors: FormErrors<"email" | "passwordResetUrl">; + data: SiteSettingsMailingFormData; + errors: FormErrors< + "defaultMailSenderAddress" | "defaultMailSenderName" | "passwordResetUrl" + >; disabled: boolean; onChange: (event: React.ChangeEvent) => void; } @@ -61,14 +67,33 @@ const SiteSettingsMailing: React.FC = props => {
+ + @@ -89,7 +114,7 @@ const SiteSettingsMailing: React.FC = props => { "This URL will be used as a main URL for password resets. It will be sent via email." }) } - value={data.domain} + value={data.passwordResetUrl} onChange={onChange} /> diff --git a/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx b/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx index 890874836..4f7d77524 100644 --- a/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx +++ b/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx @@ -23,7 +23,9 @@ import { SiteSettings_shop } from "../../types/SiteSettings"; import SiteSettingsAddress from "../SiteSettingsAddress/SiteSettingsAddress"; import SiteSettingsDetails from "../SiteSettingsDetails/SiteSettingsDetails"; import SiteSettingsKeys from "../SiteSettingsKeys/SiteSettingsKeys"; -import SiteSettingsMailing from "../SiteSettingsMailing"; +import SiteSettingsMailing, { + SiteSettingsMailingFormData +} from "../SiteSettingsMailing"; export interface SiteSettingsPageAddressFormData { city: string; @@ -37,12 +39,11 @@ export interface SiteSettingsPageAddressFormData { } export interface SiteSettingsPageFormData - extends SiteSettingsPageAddressFormData { + extends SiteSettingsPageAddressFormData, + SiteSettingsMailingFormData { description: string; domain: string; - email: string; name: string; - passwordResetUrl: string; } export interface SiteSettingsPageProps { From 261f80ee4f8e128ba5cfeb0d308adb5a865e2375 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 16:14:28 +0200 Subject: [PATCH 06/11] Add mailing configuration --- schema.graphql | 2 ++ .../SiteSettingsMailing.tsx | 18 ++++++++++-------- .../SiteSettingsPage/SiteSettingsPage.tsx | 14 ++++++++++---- src/siteSettings/queries.ts | 3 +++ src/siteSettings/types/AuthorizationKeyAdd.ts | 3 +++ .../types/AuthorizationKeyDelete.ts | 3 +++ src/siteSettings/types/ShopFragment.ts | 3 +++ src/siteSettings/types/ShopSettingsUpdate.ts | 3 +++ src/siteSettings/types/SiteSettings.ts | 3 +++ src/siteSettings/views/index.tsx | 4 ++++ .../stories/siteSettings/SiteSettingsPage.tsx | 9 ++++++++- src/types/globalTypes.ts | 4 ++++ 12 files changed, 56 insertions(+), 13 deletions(-) diff --git a/schema.graphql b/schema.graphql index a845ef15b..a2c53e4fc 100644 --- a/schema.graphql +++ b/schema.graphql @@ -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 { diff --git a/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx b/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx index 3a619ed58..748c35b6d 100644 --- a/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx +++ b/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.tsx @@ -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) => void; @@ -82,7 +84,7 @@ const SiteSettingsMailing: React.FC = 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 = props => { description: "email sender" }) } - value={data.defaultMailSenderAddress} + value={data.defaultMailSenderName} onChange={onChange} /> @@ -101,20 +103,20 @@ const SiteSettingsMailing: React.FC = props => { diff --git a/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx b/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx index 4f7d77524..cddd97e51 100644 --- a/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx +++ b/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx @@ -86,19 +86,25 @@ const SiteSettingsPage: React.FC = 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 (
= ({ name: data.name }, shopSettingsInput: { + customerSetPasswordUrl: data.customerSetPasswordUrl, + defaultMailSenderAddress: + data.defaultMailSenderAddress, + defaultMailSenderName: data.defaultMailSenderName, description: data.description } } diff --git a/src/storybook/stories/siteSettings/SiteSettingsPage.tsx b/src/storybook/stories/siteSettings/SiteSettingsPage.tsx index 66c3e62ee..51925caa0 100644 --- a/src/storybook/stories/siteSettings/SiteSettingsPage.tsx +++ b/src/storybook/stories/siteSettings/SiteSettingsPage.tsx @@ -29,6 +29,13 @@ storiesOf("Views / Site settings / Page", module) .add("form errors", () => ( formError(field))} + errors={[ + "description", + "domain", + "name", + "defaultMailSenderAddress", + "defaultMailSenderName", + "customerSetPasswordUrl" + ].map(field => formError(field))} /> )); diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index 029e1ff9d..e282a14af 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -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 { From 589df18030bc7436d1e9ffcd6a1e21ad18b38a9d Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 16:18:09 +0200 Subject: [PATCH 07/11] Update fixtures --- src/siteSettings/fixtures.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/siteSettings/fixtures.ts b/src/siteSettings/fixtures.ts index 59e41ca41..78bbd3a72 100644 --- a/src/siteSettings/fixtures.ts +++ b/src/siteSettings/fixtures.ts @@ -36,6 +36,9 @@ export const shop: SiteSettings_shop = { country: "United Arab Emirates" } ], + customerSetPasswordUrl: "https://example.com/reset-password", + defaultMailSenderAddress: "noreply@example.com", + defaultMailSenderName: "Saleor", description: "Lorem ipsum dolor sit amet", domain: { __typename: "Domain", From 457e786dd3d7852fb5442c49fa395148ed03ae16 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 16:19:56 +0200 Subject: [PATCH 08/11] Update messages and snapshots --- locale/messages.pot | 140 ++- .../__snapshots__/Stories.test.ts.snap | 995 +++++++++++++++--- 2 files changed, 966 insertions(+), 169 deletions(-) diff --git a/locale/messages.pot b/locale/messages.pot index 4f579a4ac..02c9bcb72 100644 --- a/locale/messages.pot +++ b/locale/messages.pot @@ -1,6 +1,6 @@ msgid "" msgstr "" -"POT-Creation-Date: 2019-10-24T12:11:32.946Z\n" +"POT-Creation-Date: 2019-10-24T13:15:53.475Z\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "MIME-Version: 1.0\n" @@ -1467,6 +1467,14 @@ msgctxt "section header" msgid "Authentication Keys" msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.json +#. [src.siteSettings.components.SiteSettingsPage.4088830385] - section header +#. defaultMessage is: +#. Authentication Methods +msgctxt "section header" +msgid "Authentication Methods" +msgstr "" + #: build/locale/src/siteSettings/components/SiteSettingsKeys/SiteSettingsKeys.json #. [src.siteSettings.components.SiteSettingsKeys.1270286507] - authentication provider name #. defaultMessage is: @@ -1476,11 +1484,11 @@ msgid "Authentication Type" msgstr "" #: build/locale/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.json -#. [src.siteSettings.components.SiteSettingsPage.2824577864] +#. [src.siteSettings.components.SiteSettingsPage.3619898341] #. defaultMessage is: -#. Authentication keys +#. Authentication method defines additional ways that customers can log in to your ecommerce. msgctxt "description" -msgid "Authentication keys" +msgid "Authentication method defines additional ways that customers can log in to your ecommerce." msgstr "" #: build/locale/src/siteSettings/components/SiteSettingsKeyDialog/SiteSettingsKeyDialog.json @@ -1992,11 +2000,11 @@ msgid "Company" msgstr "" #: build/locale/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.json -#. [src.siteSettings.components.SiteSettingsPage.3817101936] +#. [src.siteSettings.components.SiteSettingsPage.2768400497] - section header #. defaultMessage is: -#. Company information -msgctxt "description" -msgid "Company information" +#. Company Information +msgctxt "section header" +msgid "Company Information" msgstr "" #: build/locale/src/translations/components/TranslationsEntitiesList/TranslationsEntitiesList.json @@ -2023,6 +2031,14 @@ msgctxt "product type" msgid "Configurable" msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.json +#. [src.siteSettings.components.SiteSettingsMailing.297689661] +#. defaultMessage is: +#. Configurate your email address from which all automatic emails will be sent to your customers. +msgctxt "description" +msgid "Configurate your email address from which all automatic emails will be sent to your customers." +msgstr "" + #: build/locale/src/intl.json #. [src.configuration] - configuration section name #. defaultMessage is: @@ -3603,6 +3619,14 @@ msgctxt "description" msgid "Email Address" msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.json +#. [src.siteSettings.components.SiteSettingsPage.3657173399] +#. defaultMessage is: +#. Email adress you provide here will be used as a contact adress for your customers. +msgctxt "description" +msgid "Email adress you provide here will be used as a contact adress for your customers." +msgstr "" + #: build/locale/src/intl.json #. [src.endDate] #. defaultMessage is: @@ -4351,6 +4375,42 @@ msgctxt "button" msgid "Login" msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.json +#. [src.siteSettings.components.SiteSettingsMailing.280712237] - section header +#. defaultMessage is: +#. Mailing Configuration +#: build/locale/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.json +#. [src.siteSettings.components.SiteSettingsPage.280712237] - section header +#. defaultMessage is: +#. Mailing Configuration +msgctxt "section header" +msgid "Mailing Configuration" +msgstr "" + +#: build/locale/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.json +#. [siteSettingsMailingHelperText] - helper text +#. defaultMessage is: +#. Mailing Configuration +msgctxt "helper text" +msgid "Mailing Configuration" +msgstr "" + +#: build/locale/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.json +#. [src.siteSettings.components.SiteSettingsMailing.1124962330] +#. defaultMessage is: +#. Mailing email address +msgctxt "description" +msgid "Mailing email address" +msgstr "" + +#: build/locale/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.json +#. [src.siteSettings.components.SiteSettingsMailing.70179174] +#. defaultMessage is: +#. Mailing email sender +msgctxt "description" +msgid "Mailing email sender" +msgstr "" + #: build/locale/src/intl.json #. [src.manage] - button #. defaultMessage is: @@ -8051,6 +8111,22 @@ msgctxt "description" msgid "These are general information about your store. They define what is the URL of your store and what is shown in brow sers taskbar." msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.json +#. [src.siteSettings.components.SiteSettingsPage.3799756739] +#. defaultMessage is: +#. These are general information about your store. They define what is the URL of your store and what is shown in browsers taskbar. +msgctxt "description" +msgid "These are general information about your store. They define what is the URL of your store and what is shown in browsers taskbar." +msgstr "" + +#: build/locale/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.json +#. [src.siteSettings.components.SiteSettingsMailing.3447841451] +#. defaultMessage is: +#. This URL will be used as a main URL for password resets. It will be sent via email. +msgctxt "description" +msgid "This URL will be used as a main URL for password resets. It will be sent via email." +msgstr "" + #: build/locale/src/webhooks/components/WebhookInfo/WebhookInfo.json #. [src.webhooks.components.WebhookInfo.3763861707] - webhook target url help text #. defaultMessage is: @@ -8059,6 +8135,14 @@ msgctxt "webhook target url help text" msgid "This URL will receive webhook POST requests" msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.json +#. [src.siteSettings.components.SiteSettingsPage.1004240342] +#. defaultMessage is: +#. This adress will be used to generate invoices and calculate shipping rates. +msgctxt "description" +msgid "This adress will be used to generate invoices and calculate shipping rates." +msgstr "" + #: build/locale/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.json #. [src.plugins.components.PluginsDetailsPage.4241018152] #. defaultMessage is: @@ -8159,6 +8243,14 @@ msgctxt "product attribute error" msgid "This variant already exists" msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.json +#. [src.siteSettings.components.SiteSettingsPage.866304242] +#. defaultMessage is: +#. 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. +msgctxt "description" +msgid "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." +msgstr "" + #: build/locale/src/shipping/components/ShippingZoneRateDialog/ShippingZoneRateDialog.json #. [src.shipping.components.ShippingZoneRateDialog.1486599614] #. defaultMessage is: @@ -8167,6 +8259,14 @@ msgctxt "description" msgid "This will be shown to customers at checkout" msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.json +#. [src.siteSettings.components.SiteSettingsMailing.1672275992] - email sender +#. defaultMessage is: +#. This will be visible as "from" name +msgctxt "email sender" +msgid "This will be visible as \"from\" name" +msgstr "" + #: build/locale/src/pages/components/PageInfo/PageInfo.json #. [src.pages.components.PageInfo.1124600214] - page title #. defaultMessage is: @@ -8443,6 +8543,14 @@ msgctxt "description" msgid "URL Linked" msgstr "" +#: build/locale/src/siteSettings/components/SiteSettingsMailing/SiteSettingsMailing.json +#. [src.siteSettings.components.SiteSettingsMailing.50742153] +#. defaultMessage is: +#. URL address +msgctxt "description" +msgid "URL address" +msgstr "" + #: build/locale/src/siteSettings/components/SiteSettingsDetails/SiteSettingsDetails.json #. [src.siteSettings.components.SiteSettingsDetails.3808773492] #. defaultMessage is: @@ -8735,6 +8843,14 @@ msgctxt "voucher value requirement" msgid "Usage Limit" msgstr "" +#: build/locale/src/attributes/components/AttributeProperties/AttributeProperties.json +#. [src.attributes.components.AttributeProperties.1318123158] - attribute is filterable in storefront +#. defaultMessage is: +#. Use in Faceted Navigation +msgctxt "attribute is filterable in storefront" +msgid "Use in Faceted Navigation" +msgstr "" + #: build/locale/src/attributes/components/AttributeProperties/AttributeProperties.json #. [src.attributes.components.AttributeProperties.714335445] - use attribute in filtering #. defaultMessage is: @@ -8743,14 +8859,6 @@ msgctxt "use attribute in filtering" msgid "Use in Filtering" msgstr "" -#: build/locale/src/attributes/components/AttributeProperties/AttributeProperties.json -#. [src.attributes.components.AttributeProperties.1564730914] - attribute is filterable in storefront -#. defaultMessage is: -#. Use in faceted navigation -msgctxt "attribute is filterable in storefront" -msgid "Use in faceted navigation" -msgstr "" - #: build/locale/src/attributes/components/AttributeList/AttributeList.json #. [src.attributes.components.AttributeList.2186555805] - attribute can be searched in storefront #. defaultMessage is: diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 50452b961..f07705c5c 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -18587,118 +18587,54 @@ Ctrl + K" class="CardTitle-hr-id" />
-
-
- -
-
- -
-
-
-
-
- -
- -
- - -
-
+ + + + +

- (Optional) + Drop here to upload

@@ -27859,7 +27795,7 @@ Ctrl + K"

Drop here to upload

@@ -28568,7 +28504,7 @@ Ctrl + K"

Drop here to upload

@@ -91946,7 +91882,7 @@ Ctrl + K"

Drop here to upload

@@ -93436,7 +93372,7 @@ Ctrl + K"

Drop here to upload

@@ -95193,7 +95129,7 @@ Ctrl + K"

Drop here to upload

@@ -98008,7 +97944,7 @@ Ctrl + K"

Drop here to upload

@@ -99672,7 +99608,7 @@ Ctrl + K"

Drop here to upload

@@ -116326,11 +116262,18 @@ exports[`Storyshots Views / Site settings / Page default 1`] = `
-
- Site Settings -
+
+

+ Site Settings +

+

+ These are general information about your store. They define what is the URL of your store and what is shown in browsers taskbar. +

+
@@ -116478,11 +116421,199 @@ exports[`Storyshots Views / Site settings / Page default 1`] = `
-
+
+

+ Mailing Configuration +

+

+ 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. +

+
+
- Company information -
+
+ + Mailing Configuration + +
+
+
+
+
+

+ Mailing Configuration +

+

+ Configurate your email address from which all automatic emails will be sent to your customers. +

+
+ +
+ + +
+
+
+
+ +
+ + +
+

+ This will be visible as "from" name +

+
+
+
+
+
+ +
+ + +
+

+ This URL will be used as a main URL for password resets. It will be sent via email. +

+
+
+
+
+
+

+ Company Information +

+

+ This adress will be used to generate invoices and calculate shipping rates.Email adress you provide here will be used as a contact adress for your customers. +

+
@@ -116834,11 +116965,21 @@ exports[`Storyshots Views / Site settings / Page default 1`] = `
-
- Authentication keys -
+
+
+

+ Authentication Methods +

+

+ Authentication method defines additional ways that customers can log in to your ecommerce. +

+
@@ -116981,11 +117122,18 @@ exports[`Storyshots Views / Site settings / Page form errors 1`] = `
-
- Site Settings -
+
+

+ Site Settings +

+

+ These are general information about your store. They define what is the URL of your store and what is shown in browsers taskbar. +

+
@@ -117138,11 +117286,204 @@ exports[`Storyshots Views / Site settings / Page form errors 1`] = `
-
+
+

+ Mailing Configuration +

+

+ 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. +

+
+
- Company information -
+
+ + Mailing Configuration + +
+
+
+
+
+

+ Mailing Configuration +

+

+ Configurate your email address from which all automatic emails will be sent to your customers. +

+
+ +
+ + +
+

+ Generic form error +

+
+
+
+ +
+ + +
+

+ Generic form error +

+
+
+
+
+
+ +
+ + +
+

+ Generic form error +

+
+
+
+
+
+

+ Company Information +

+

+ This adress will be used to generate invoices and calculate shipping rates.Email adress you provide here will be used as a contact adress for your customers. +

+
@@ -117494,11 +117835,21 @@ exports[`Storyshots Views / Site settings / Page form errors 1`] = `
-
- Authentication keys -
+
+
+

+ Authentication Methods +

+

+ Authentication method defines additional ways that customers can log in to your ecommerce. +

+
@@ -117641,11 +117992,18 @@ exports[`Storyshots Views / Site settings / Page loading 1`] = `
-
- Site Settings -
+
+

+ Site Settings +

+

+ These are general information about your store. They define what is the URL of your store and what is shown in browsers taskbar. +

+
@@ -117796,11 +118154,202 @@ exports[`Storyshots Views / Site settings / Page loading 1`] = `
-
+
+

+ Mailing Configuration +

+

+ 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. +

+
+
- Company information -
+
+ + Mailing Configuration + +
+
+
+
+
+

+ Mailing Configuration +

+

+ Configurate your email address from which all automatic emails will be sent to your customers. +

+
+ +
+ + +
+
+
+
+ +
+ + +
+

+ This will be visible as "from" name +

+
+
+
+
+
+ +
+ + +
+

+ This URL will be used as a main URL for password resets. It will be sent via email. +

+
+
+
+
+
+

+ Company Information +

+

+ This adress will be used to generate invoices and calculate shipping rates.Email adress you provide here will be used as a contact adress for your customers. +

+
@@ -118162,11 +118711,21 @@ exports[`Storyshots Views / Site settings / Page loading 1`] = `
-
- Authentication keys -
+
+
+

+ Authentication Methods +

+

+ Authentication method defines additional ways that customers can log in to your ecommerce. +

+
@@ -123206,6 +123765,27 @@ exports[`Storyshots Views / Webhooks / Create webhook default 1`] = `
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
@@ -117434,7 +117435,7 @@ exports[`Storyshots Views / Site settings / Page form errors 1`] = ` class="MuiFormLabel-root-id MuiFormLabel-error-id MuiInputLabel-error-id MuiFormLabel-filled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id MuiInputLabel-outlined-id" data-shrink="true" > - URL address + Customer password reset URL
@@ -118299,7 +118301,7 @@ exports[`Storyshots Views / Site settings / Page loading 1`] = ` class="MuiFormLabel-root-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - URL address + Customer password reset URL
From 9cb5c4cb7b31d3842fd5e17378645798b7eb4451 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Thu, 24 Oct 2019 14:25:42 +0200 Subject: [PATCH 11/11] Add ability to remove company address --- src/siteSettings/mutations.ts | 2 +- src/siteSettings/views/index.tsx | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/siteSettings/mutations.ts b/src/siteSettings/mutations.ts index 048217b7a..09f7ef0f0 100644 --- a/src/siteSettings/mutations.ts +++ b/src/siteSettings/mutations.ts @@ -63,7 +63,7 @@ const shopSettingsUpdate = gql` mutation ShopSettingsUpdate( $shopDomainInput: SiteDomainInput! $shopSettingsInput: ShopSettingsInput! - $addressInput: AddressInput! + $addressInput: AddressInput ) { shopSettingsUpdate(input: $shopSettingsInput) { errors { diff --git a/src/siteSettings/views/index.tsx b/src/siteSettings/views/index.tsx index ac57bf824..4ed3cfb05 100644 --- a/src/siteSettings/views/index.tsx +++ b/src/siteSettings/views/index.tsx @@ -13,6 +13,7 @@ import SiteSettingsKeyDialog, { SiteSettingsKeyDialogForm } from "../components/SiteSettingsKeyDialog"; import SiteSettingsPage, { + SiteSettingsPageAddressFormData, SiteSettingsPageFormData } from "../components/SiteSettingsPage"; import { @@ -124,10 +125,21 @@ export const SiteSettings: React.StatelessComponent = ({ }); const handleUpdateShopSettings = ( data: SiteSettingsPageFormData - ) => - updateShopSettings({ - variables: { - addressInput: { + ) => { + const areAddressInputFieldsModified = ([ + "city", + "companyName", + "country", + "countryArea", + "phone", + "postalCode", + "streetAddress1", + "streetAddress2" + ] as Array) + .map(key => data[key]) + .some(field => field !== ""); + const addressInput = areAddressInputFieldsModified + ? { city: data.city, companyName: data.companyName, country: data.country, @@ -136,7 +148,11 @@ export const SiteSettings: React.StatelessComponent = ({ postalCode: data.postalCode, streetAddress1: data.streetAddress1, streetAddress2: data.streetAddress2 - }, + } + : null; + updateShopSettings({ + variables: { + addressInput, shopDomainInput: { domain: data.domain, name: data.name @@ -150,6 +166,7 @@ export const SiteSettings: React.StatelessComponent = ({ } } }); + }; const formTransitionState = getMutationState( updateShopSettingsOpts.called,