diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json
index 2f7279e23..3183cd510 100644
--- a/locale/defaultMessages.json
+++ b/locale/defaultMessages.json
@@ -2200,40 +2200,48 @@
"context": "dialog title",
"string": "Add Address"
},
- "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_1090326769": {
- "context": "customer's address book, header",
- "string": "{fullName}'s Address Book"
- },
- "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_1428369222": {
- "string": "This customer doesn’t have any adresses added to his address book. You can add address using the button below."
- },
- "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_1484733755": {
- "string": "There is no address to show for this customer"
- },
- "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_3623935073": {
+ "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_addAddress": {
"context": "button",
"string": "Add address"
},
- "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_489918044": {
+ "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_doesntHaveAddresses": {
+ "string": "This customer doesn’t have any adresses added to his address book. You can add address using the button below."
+ },
+ "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_fullNameAddress": {
+ "context": "customer's address book, header",
+ "string": "{fullName}'s Address Book"
+ },
+ "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_fullNameDetail": {
"context": "customer details, header",
"string": "{fullName} Details"
},
- "src_dot_customers_dot_components_dot_CustomerAddress_dot_1224809208": {
+ "src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_noAddressToShow": {
+ "string": "There is no address to show for this customer"
+ },
+ "src_dot_customers_dot_components_dot_CustomerAddress_dot_defaultAddress": {
"string": "Default Address"
},
- "src_dot_customers_dot_components_dot_CustomerAddress_dot_1578192486": {
+ "src_dot_customers_dot_components_dot_CustomerAddress_dot_defaultBillingAddress": {
"string": "Default Billing Address"
},
- "src_dot_customers_dot_components_dot_CustomerAddress_dot_2131178753": {
- "context": "button",
- "string": "Set as default shipping address"
+ "src_dot_customers_dot_components_dot_CustomerAddress_dot_defaultShippingAddress": {
+ "string": "Default Shipping Address"
},
- "src_dot_customers_dot_components_dot_CustomerAddress_dot_3096438859": {
+ "src_dot_customers_dot_components_dot_CustomerAddress_dot_deleteAddress": {
+ "context": "button",
+ "string": "Delete Address"
+ },
+ "src_dot_customers_dot_components_dot_CustomerAddress_dot_editAddress": {
+ "context": "button",
+ "string": "Edit Address"
+ },
+ "src_dot_customers_dot_components_dot_CustomerAddress_dot_setDefaultBilling": {
"context": "button",
"string": "Set as default billing address"
},
- "src_dot_customers_dot_components_dot_CustomerAddress_dot_4109348993": {
- "string": "Default Shipping Address"
+ "src_dot_customers_dot_components_dot_CustomerAddress_dot_setDefaultShipping": {
+ "context": "button",
+ "string": "Set as default shipping address"
},
"src_dot_customers_dot_components_dot_CustomerAddresses_dot_1967111456": {
"context": "header",
diff --git a/src/components/AddressFormatter/AddressFormatter.tsx b/src/components/AddressFormatter/AddressFormatter.tsx
index a7f7f59ac..86db5e226 100644
--- a/src/components/AddressFormatter/AddressFormatter.tsx
+++ b/src/components/AddressFormatter/AddressFormatter.tsx
@@ -21,6 +21,7 @@ const AddressFormatter: React.FC = ({ address }) => {
{address.firstName} {address.lastName}
+ {address.phone}
{address.companyName && (
{address.companyName}
)}
diff --git a/src/customers/components/CustomerAddress/CustomerAddress.tsx b/src/customers/components/CustomerAddress/CustomerAddress.tsx
index 7a40c0988..900ccb803 100644
--- a/src/customers/components/CustomerAddress/CustomerAddress.tsx
+++ b/src/customers/components/CustomerAddress/CustomerAddress.tsx
@@ -1,15 +1,12 @@
-import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
-import CardActions from "@material-ui/core/CardActions";
import CardContent from "@material-ui/core/CardContent";
import { makeStyles } from "@material-ui/core/styles";
import AddressFormatter from "@saleor/components/AddressFormatter";
import CardMenu from "@saleor/components/CardMenu";
import CardTitle from "@saleor/components/CardTitle";
import Skeleton from "@saleor/components/Skeleton";
-import { buttonMessages } from "@saleor/intl";
import React from "react";
-import { FormattedMessage, useIntl } from "react-intl";
+import { defineMessages, useIntl } from "react-intl";
import { AddressTypeEnum } from "../../../types/globalTypes";
import { CustomerAddresses_user_addresses } from "../../types/CustomerAddresses";
@@ -25,6 +22,34 @@ export interface CustomerAddressProps {
onSetAsDefault: (type: AddressTypeEnum) => void;
}
+const messages = defineMessages({
+ defaultAddress: {
+ defaultMessage: "Default Address"
+ },
+ defaultShippingAddress: {
+ defaultMessage: "Default Shipping Address"
+ },
+ defaultBillingAddress: {
+ defaultMessage: "Default Billing Address"
+ },
+ setDefaultShipping: {
+ defaultMessage: "Set as default shipping address",
+ description: "button"
+ },
+ setDefaultBilling: {
+ defaultMessage: "Set as default billing address",
+ description: "button"
+ },
+ editAddress: {
+ defaultMessage: "Edit Address",
+ description: "button"
+ },
+ deleteAddress: {
+ defaultMessage: "Delete Address",
+ description: "button"
+ }
+});
+
const useStyles = makeStyles(
{
actions: {
@@ -64,17 +89,11 @@ const CustomerAddress: React.FC = props => {
address ? (
<>
{isDefaultBillingAddress && isDefaultShippingAddress
- ? intl.formatMessage({
- defaultMessage: "Default Address"
- })
+ ? intl.formatMessage(messages.defaultAddress)
: isDefaultShippingAddress
- ? intl.formatMessage({
- defaultMessage: "Default Shipping Address"
- })
+ ? intl.formatMessage(messages.defaultShippingAddress)
: isDefaultBillingAddress
- ? intl.formatMessage({
- defaultMessage: "Default Billing Address"
- })
+ ? intl.formatMessage(messages.defaultBillingAddress)
: null}
>
) : (
@@ -87,18 +106,20 @@ const CustomerAddress: React.FC = props => {
disabled={disabled}
menuItems={[
{
- label: intl.formatMessage({
- defaultMessage: "Set as default shipping address",
- description: "button"
- }),
+ label: intl.formatMessage(messages.setDefaultShipping),
onSelect: () => onSetAsDefault(AddressTypeEnum.SHIPPING)
},
{
- label: intl.formatMessage({
- defaultMessage: "Set as default billing address",
- description: "button"
- }),
+ label: intl.formatMessage(messages.setDefaultBilling),
onSelect: () => onSetAsDefault(AddressTypeEnum.BILLING)
+ },
+ {
+ label: intl.formatMessage(messages.editAddress),
+ onSelect: () => onEdit()
+ },
+ {
+ label: intl.formatMessage(messages.deleteAddress),
+ onSelect: () => onRemove()
}
]}
/>
@@ -107,16 +128,6 @@ const CustomerAddress: React.FC = props => {
-
-
-
-
-
-
);
};
diff --git a/src/customers/components/CustomerAddressDialog/CustomerAddressDialog.tsx b/src/customers/components/CustomerAddressDialog/CustomerAddressDialog.tsx
index f60e53dfd..3ca004fa4 100644
--- a/src/customers/components/CustomerAddressDialog/CustomerAddressDialog.tsx
+++ b/src/customers/components/CustomerAddressDialog/CustomerAddressDialog.tsx
@@ -14,7 +14,6 @@ import useAddressValidation from "@saleor/hooks/useAddressValidation";
import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors";
import useStateFromProps from "@saleor/hooks/useStateFromProps";
import { buttonMessages } from "@saleor/intl";
-import { maybe } from "@saleor/misc";
import { AddressInput } from "@saleor/types/globalTypes";
import createSingleAutocompleteSelectHandler from "@saleor/utils/handlers/singleAutocompleteSelectChangeHandler";
import React from "react";
@@ -59,7 +58,7 @@ const CustomerAddressDialog = withStyles(
onConfirm
}: CustomerAddressDialogProps & WithStyles) => {
const [countryDisplayName, setCountryDisplayName] = useStateFromProps(
- maybe(() => address.country.country, "")
+ address?.country.country || ""
);
const {
errors: validationErrors,
@@ -71,27 +70,24 @@ const CustomerAddressDialog = withStyles(
);
const initialForm: AddressTypeInput = {
- city: maybe(() => address.city, ""),
- cityArea: maybe(() => address.cityArea, ""),
- companyName: maybe(() => address.companyName, ""),
- country: maybe(() => address.country.code, ""),
- countryArea: maybe(() => address.countryArea, ""),
- firstName: maybe(() => address.firstName, ""),
- lastName: maybe(() => address.lastName, ""),
- phone: maybe(() => address.phone, ""),
- postalCode: maybe(() => address.postalCode, ""),
- streetAddress1: maybe(() => address.streetAddress1, ""),
- streetAddress2: maybe(() => address.streetAddress2, "")
+ city: address?.city || "",
+ cityArea: address?.cityArea || "",
+ companyName: address?.companyName || "",
+ country: address?.country.code || "",
+ countryArea: address?.countryArea || "",
+ firstName: address?.firstName || "",
+ lastName: address?.lastName || "",
+ phone: address?.phone || "",
+ postalCode: address?.postalCode || "",
+ streetAddress1: address?.streetAddress1 || "",
+ streetAddress2: address?.streetAddress2 || ""
};
- const countryChoices = maybe(
- () =>
- countries.map(country => ({
- label: country.label,
- value: country.code
- })),
- []
- );
+ const countryChoices =
+ countries?.map(country => ({
+ label: country.label,
+ value: country.code
+ })) || [];
return (
+
@@ -56025,6 +56028,9 @@ exports[`Storyshots Views / Customers / Address Book default 1`] = `
>
Elizabeth Vaughn
+
@@ -56044,36 +56050,6 @@ exports[`Storyshots Views / Customers / Address Book default 1`] = `
-
-
-
-
-
-
Timmy Macejkovic
+
+ +41 460-907-9374
+
@@ -56149,36 +56130,6 @@ exports[`Storyshots Views / Customers / Address Book default 1`] = `
-
-
-
-
-
-
@@ -56198,7 +56149,7 @@ exports[`Storyshots Views / Customers / Address Book loading 1`] = `
-
-
-
-
-
-
@@ -59135,6 +59054,9 @@ exports[`Storyshots Views / Customers / Customer details default 1`] = `
>
Elizabeth Vaughn
+
@@ -59814,6 +59736,9 @@ exports[`Storyshots Views / Customers / Customer details different addresses 1`]
>
Elizabeth Vaughn
+
@@ -59851,6 +59776,9 @@ exports[`Storyshots Views / Customers / Customer details different addresses 1`]
>
Elizabeth Vaughn
+
@@ -60545,6 +60473,9 @@ exports[`Storyshots Views / Customers / Customer details form errors 1`] = `
>
Elizabeth Vaughn
+
@@ -61840,6 +61771,9 @@ exports[`Storyshots Views / Customers / Customer details never logged 1`] = `
>
Elizabeth Vaughn
+
@@ -62513,6 +62447,9 @@ exports[`Storyshots Views / Customers / Customer details never placed order 1`]
>
Elizabeth Vaughn
+
@@ -63840,6 +63777,9 @@ exports[`Storyshots Views / Customers / Customer details no default billing addr
>
Elizabeth Vaughn
+
@@ -64519,6 +64459,9 @@ exports[`Storyshots Views / Customers / Customer details no default shipping add
>
Elizabeth Vaughn
+