Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add shipping zones list
dominik-zeglen6dc976db7e4f
diff --git a/saleor/static/dashboard-next/shipping/components/ShippingWeightUnitForm/ShippingWeightUnitForm.tsx b/saleor/static/dashboard-next/shipping/components/ShippingWeightUnitForm/ShippingWeightUnitForm.tsxnew file mode 100644index 0000000000..fa13f25195--- /dev/null+++ b/saleor/static/dashboard-next/shipping/components/ShippingWeightUnitForm/ShippingWeightUnitForm.tsx@@ -0,0 +1,74 @@+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 * as React from "react";++import CardTitle from "../../../components/CardTitle";+import Form from "../../../components/Form";+import Hr from "../../../components/Hr";+import SingleSelectField from "../../../components/SingleSelectField";+import i18n from "../../../i18n";+import { WeightUnitsEnum } from "../../../types/globalTypes";++export interface FormData {+ unit: WeightUnitsEnum;+}++export interface ShippingWeightUnitFormProps {+ defaultWeightUnit: WeightUnitsEnum;+ disabled: boolean;+ onSubmit: (unit: WeightUnitsEnum) => void;+}++const ShippingWeightUnitForm: React.StatelessComponent<+ ShippingWeightUnitFormProps+> = ({ defaultWeightUnit, disabled, onSubmit }) => {+ const initialForm: FormData = {+ unit: defaultWeightUnit+ };+ return (+ <Form initial={initialForm} onSubmit={formData => onSubmit(formData.unit)}>+ {({ change, data, submit }) => (+ <Card>+ <CardTitle+ title={i18n.t("Configuration", {+ context: "header"+ })}+ />+ <CardContent>+ <SingleSelectField+ disabled={disabled}+ choices={Object.keys(WeightUnitsEnum).map(unit => ({+ label: WeightUnitsEnum[unit],+ value: WeightUnitsEnum[unit]+ }))}+ label={i18n.t("Shipping Weight Unit", {+ context: "input label"+ })}+ hint={i18n.t(+ "This unit will be used as default shipping weight",+ {+ context: "input help text"+ }+ )}+ name={"unit" as keyof FormData}+ value={data.unit}+ onChange={change}+ />+ </CardContent>+ <Hr />+ <CardActions>+ <Button color="secondary" onClick={submit}>+ {i18n.t("Save", {+ context: "button"+ })}+ </Button>+ </CardActions>+ </Card>+ )}+ </Form>+ );+};+ShippingWeightUnitForm.displayName = "ShippingWeightUnitForm";+export default ShippingWeightUnitForm;diff --git a/saleor/static/dashboard-next/shipping/components/ShippingWeightUnitForm/index.ts b/saleor/static/dashboard-next/shipping/components/ShippingWeightUnitForm/index.tsnew file mode 100644index 0000000000..8c4dc991f5--- /dev/null+++ b/saleor/static/dashboard-next/shipping/components/ShippingWeightUnitForm/index.ts@@ -0,0 +1,2 @@+export { default } from './ShippingWeightUnitForm';+export * from './ShippingWeightUnitForm';\ No newline at end of filediff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsxnew file mode 100644index 0000000000..f43c1d5b9a--- /dev/null+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx@@ -0,0 +1,136 @@+import Button from "@material-ui/core/Button";+import Card from "@material-ui/core/Card";+import IconButton from "@material-ui/core/IconButton";+import {+ createStyles,+ Theme,+ withStyles,+ WithStyles+} from "@material-ui/core/styles";+import Table from "@material-ui/core/Table";+import TableBody from "@material-ui/core/TableBody";+import TableCell from "@material-ui/core/TableCell";+import TableFooter from "@material-ui/core/TableFooter";+import TableHead from "@material-ui/core/TableHead";+import TableRow from "@material-ui/core/TableRow";+import DeleteIcon from "@material-ui/icons/Delete";+import * as React from "react";++import CardTitle from "../../../components/CardTitle";+import Skeleton from "../../../components/Skeleton";+import TablePagination from "../../../components/TablePagination";+import i18n from "../../../i18n";+import { maybe, renderCollection } from "../../../misc";+import { ICONBUTTON_SIZE } from "../../../theme";+import { ListProps } from "../../../types";+import { ShippingZoneFragment } from "../../types/ShippingZoneFragment";++export interface ShippingZonesListProps extends ListProps {+ shippingZones: ShippingZoneFragment[];+ onAdd: () => void;+ onRemove: (id: string) => void;+}++const styles = (theme: Theme) =>+ createStyles({+ alignRight: {+ "&:last-child": {+ paddingRight: 0+ },+ width: ICONBUTTON_SIZE + theme.spacing.unit / 2+ }+ });+const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(+ ({+ classes,+ disabled,+ onAdd,+ onNextPage,+ onPreviousPage,+ onRemove,+ onRowClick,+ pageInfo,+ shippingZones+ }: ShippingZonesListProps & WithStyles<typeof styles>) => (+ <Card>+ <CardTitle+ title={i18n.t("Shipping by zone")}+ toolbar={+ <Button color="secondary" onClick={onAdd}>+ {i18n.t("Add shipping zone", {+ context: "button"+ })}+ </Button>+ }+ />+ <Table>+ <TableHead>+ <TableRow>+ <TableCell>{i18n.t("Name", { context: "object" })}</TableCell>+ <TableCell>{i18n.t("Countries", { context: "object" })}</TableCell>+ <TableCell />+ </TableRow>+ </TableHead>+ <TableFooter>+ <TableRow>+ <TablePagination+ colSpan={3}+ hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}+ onNextPage={onNextPage}+ hasPreviousPage={+ pageInfo && !disabled ? pageInfo.hasPreviousPage : false+ }+ onPreviousPage={onPreviousPage}+ />+ </TableRow>+ </TableFooter>+ <TableBody>+ {renderCollection(+ shippingZones,+ shippingZone => (+ <TableRow+ hover={!!shippingZone}+ key={shippingZone ? shippingZone.id : "skeleton"}+ onClick={shippingZone && onRowClick(shippingZone.id)}+ >+ <TableCell>+ {maybe<React.ReactNode>(+ () => shippingZone.name,+ <Skeleton />+ )}+ </TableCell>+ <TableCell>+ {maybe<React.ReactNode>(+ () => shippingZone.countries.length,+ <Skeleton />+ )}+ </TableCell>+ <TableCell className={classes.alignRight}>+ <IconButton+ color="secondary"+ disabled={disabled}+ onClick={event => {+ event.stopPropagation();+ onRemove(shippingZone.id);+ }}+ >+ <DeleteIcon />+ </IconButton>+ </TableCell>+ </TableRow>+ ),+ () => (+ <TableRow>+ <TableCell colSpan={3}>+ {i18n.t("No shipping zones found")}+ </TableCell>+ </TableRow>+ )+ )}+ </TableBody>+ </Table>+ </Card>+ )+);+ShippingZonesList.displayName = "ShippingZonesList";+export default ShippingZonesList;diff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/index.ts b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/index.tsnew file mode 100644index 0000000000..f6f03db270--- /dev/null+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/index.ts@@ -0,0 +1,2 @@+export { default } from './ShippingZonesList';+export * from './ShippingZonesList';\ No newline at end of filediff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesListPage/ShippingZonesListPage.tsx b/saleor/static/dashboard-next/shipping/components/ShippingZonesListPage/ShippingZonesListPage.tsxnew file mode 100644index 0000000000..04711da739--- /dev/null+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesListPage/ShippingZonesListPage.tsx@@ -0,0 +1,67 @@+import * as React from "react";++import Container from "../../../components/Container";+import Grid from "../../../components/Grid";+import PageHeader from "../../../components/PageHeader";+import i18n from "../../../i18n";+import { PageListProps } from "../../../types";+import { WeightUnitsEnum } from "../../../types/globalTypes";+import { ShippingZoneFragment } from "../../types/ShippingZoneFragment";+import ShippingWeightUnitForm from "../ShippingWeightUnitForm";+import ShippingZonesList from "../ShippingZonesList";++export interface ShippingZonesListPageProps extends PageListProps {+ defaultWeightUnit: WeightUnitsEnum;+ shippingZones: ShippingZoneFragment[];+ onBack: () => void;+ onRemove: (id: string) => void;+ onSubmit: (unit: WeightUnitsEnum) => void;+}++const ShippingZonesListPage: React.StatelessComponent<+ ShippingZonesListPageProps+> = ({+ defaultWeightUnit,+ disabled,+ onAdd,+ onBack,+ onNextPage,+ onPreviousPage,+ onRemove,+ onRowClick,+ onSubmit,+ pageInfo,+ shippingZones+}) => (+ <Container width="md">+ <PageHeader+ onBack={onBack}+ title={i18n.t("Shipping", {+ context: "page header"+ })}+ />+ <Grid>+ <div>+ <ShippingZonesList+ disabled={disabled}+ onAdd={onAdd}+ onNextPage={onNextPage}+ onPreviousPage={onPreviousPage}+ onRemove={onRemove}+ onRowClick={onRowClick}+ pageInfo={pageInfo}+ shippingZones={shippingZones}+ />+ </div>+ <div>+ <ShippingWeightUnitForm+ defaultWeightUnit={defaultWeightUnit}+ disabled={disabled}+ onSubmit={onSubmit}+ />+ </div>+ </Grid>+ </Container>+);+ShippingZonesListPage.displayName = "ShippingZonesListPage";+export default ShippingZonesListPage;diff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesListPage/index.ts b/saleor/static/dashboard-next/shipping/components/ShippingZonesListPage/index.tsnew file mode 100644index 0000000000..1994206763--- /dev/null+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesListPage/index.ts@@ -0,0 +1,2 @@+export { default } from './ShippingZonesListPage';+export * from './ShippingZonesListPage';\ No newline at end of filediff --git a/saleor/static/dashboard-next/shipping/fixtures.ts b/saleor/static/dashboard-next/shipping/fixtures.tsnew file mode 100644index 0000000000..9ca1d648c2--- /dev/null+++ b/saleor/static/dashboard-next/shipping/fixtures.ts@@ -0,0 +1,1283 @@+import { ShippingZoneFragment } from "./types/ShippingZoneFragment";++export const shippingZones: ShippingZoneFragment[] = [+ {+ __typename: "ShippingZone",+ countries: [+ {+ __typename: "CountryDisplay",+ code: "AX",+ country: "Wyspy Alandzkie"+ },+ {+ __typename: "CountryDisplay",+ code: "AL",+ country: "Albania"+ },+ {+ __typename: "CountryDisplay",+ code: "AD",+ country: "Andora"+ },+ {+ __typename: "CountryDisplay",+ code: "AT",+ country: "Austria"+ },+ {+ __typename: "CountryDisplay",+ code: "BY",+ country: "Białoruś"+ },+ {+ __typename: "CountryDisplay",+ code: "BE",+ country: "Belgia"+ },+ {+ __typename: "CountryDisplay",+ code: "BA",+ country: "Bośnia i Hercegowina"+ },+ {+ __typename: "CountryDisplay",+ code: "BG",+ country: "Bułgaria"+ },+ {+ __typename: "CountryDisplay",+ code: "HR",+ country: "Chorwacja"+ },+ {+ __typename: "CountryDisplay",+ code: "CZ",+ country: "Czechy"+ },+ {+ __typename: "CountryDisplay",+ code: "DK",+ country: "Dania"+ },+ {+ __typename: "CountryDisplay",+ code: "EE",+ country: "Estonia"+ },+ {+ __typename: "CountryDisplay",+ code: "FO",+ country: "Wyspy Owcze"+ },+ {+ __typename: "CountryDisplay",+ code: "FI",+ country: "Finlandia"+ },+ {+ __typename: "CountryDisplay",+ code: "FR",+ country: "Francja"+ },+ {+ __typename: "CountryDisplay",+ code: "DE",+ country: "Niemcy"+ },+ {+ __typename: "CountryDisplay",+ code: "GI",+ country: "Gibraltar"+ },+ {+ __typename: "CountryDisplay",+ code: "GR",+ country: "Grecja"+ },+ {+ __typename: "CountryDisplay",+ code: "GG",+ country: "Guernsey"+ },+ {+ __typename: "CountryDisplay",+ code: "VA",+ country: "Watykan"+ },+ {+ __typename: "CountryDisplay",+ code: "HU",+ country: "Węgry"+ },+ {+ __typename: "CountryDisplay",+ code: "IS",+ country: "Islandia"+ },+ {+ __typename: "CountryDisplay",+ code: "IE",+ country: "Irlandia"+ },+ {+ __typename: "CountryDisplay",+ code: "IM",+ country: "Wyspa Man"+ },+ {+ __typename: "CountryDisplay",+ code: "IT",+ country: "Włochy"+ },+ {+ __typename: "CountryDisplay",+ code: "JE",+ country: "Jersey"+ },+ {+ __typename: "CountryDisplay",+ code: "LV",+ country: "Łotwa"+ },+ {+ __typename: "CountryDisplay",+ code: "LI",+ country: "Liechtenstein"+ },+ {+ __typename: "CountryDisplay",+ code: "LT",+ country: "Litwa"+ },+ {+ __typename: "CountryDisplay",+ code: "LU",+ country: "Luksemburg"+ },+ {+ __typename: "CountryDisplay",+ code: "MK",+ country: "Macedonia"+ },+ {+ __typename: "CountryDisplay",+ code: "MT",+ country: "Malta"+ },+ {+ __typename: "CountryDisplay",+ code: "MD",+ country: "Mołdawia"+ },+ {+ __typename: "CountryDisplay",+ code: "MC",+ country: "Monako"+ },+ {+ __typename: "CountryDisplay",+ code: "ME",+ country: "Czarnogóra"+ },+ {+ __typename: "CountryDisplay",+ code: "NL",+ country: "Holandia"+ },+ {+ __typename: "CountryDisplay",+ code: "NO",+ country: "Norwegia"+ },+ {+ __typename: "CountryDisplay",+ code: "PL",+ country: "Polska"+ },+ {+ __typename: "CountryDisplay",+ code: "PT",+ country: "Portugalia"+ },+ {+ __typename: "CountryDisplay",+ code: "RO",+ country: "Rumunia"+ },+ {+ __typename: "CountryDisplay",+ code: "RU",+ country: "Rosja"+ },+ {+ __typename: "CountryDisplay",+ code: "SM",+ country: "San Marino"+ },+ {+ __typename: "CountryDisplay",+ code: "RS",+ country: "Serbia"+ },+ {+ __typename: "CountryDisplay",+ code: "SK",+ country: "Słowacja"+ },+ {+ __typename: "CountryDisplay",+ code: "SI",+ country: "Słowenia"+ },+ {+ __typename: "CountryDisplay",+ code: "ES",+ country: "Hiszpania"+ },+ {+ __typename: "CountryDisplay",+ code: "SJ",+ country: "Svalbard i Jan Mayen"+ },+ {+ __typename: "CountryDisplay",+ code: "SE",+ country: "Szwecja"+ },+ {+ __typename: "CountryDisplay",+ code: "CH",+ country: "Szwajcaria"+ },+ {+ __typename: "CountryDisplay",+ code: "UA",+ country: "Ukraina"+ },+ {+ __typename: "CountryDisplay",+ code: "GB",+ country: "Wielka Brytania"+ }+ ],+ id: "U2hpcHBpbmdab25lOjE=",+ name: "Europe"+ },+ {+ __typename: "ShippingZone",+ countries: [+ {+ __typename: "CountryDisplay",+ code: "AS",+ country: "Samoa Amerykańskie"+ },+ {+ __typename: "CountryDisplay",+ code: "AU",+ country: "Australia"+ },+ {+ __typename: "CountryDisplay",+ code: "CX",+ country: "Wyspa Bożego Narodzenia"+ },+ {+ __typename: "CountryDisplay",+ code: "CC",+ country: "Wyspy Kokosowe"+ },+ {+ __typename: "CountryDisplay",+ code: "CK",+ country: "Wyspy Cooka"+ },+ {+ __typename: "CountryDisplay",+ code: "FJ",+ country: "Fidżi"+ },+ {+ __typename: "CountryDisplay",+ code: "PF",+ country: "Polinezja Francuska"+ },+ {+ __typename: "CountryDisplay",+ code: "GU",+ country: "Guam"+ },+ {+ __typename: "CountryDisplay",+ code: "HM",+ country: "Wyspy Heard i McDonalda"+ },+ {+ __typename: "CountryDisplay",+ code: "KI",+ country: "Kiribati"+ },+ {+ __typename: "CountryDisplay",+ code: "MH",+ country: "Wyspy Marshalla"+ },+ {+ __typename: "CountryDisplay",+ code: "FM",+ country: "Mikronezja"+ },+ {+ __typename: "CountryDisplay",+ code: "NR",+ country: "Nauru"+ },+ {+ __typename: "CountryDisplay",+ code: "NC",+ country: "Nowa Kaledonia"+ },+ {+ __typename: "CountryDisplay",+ code: "NZ",+ country: "Nowa Zelandia"+ },+ {+ __typename: "CountryDisplay",+ code: "NU",+ country: "Niue"+ },+ {+ __typename: "CountryDisplay",+ code: "NF",+ country: "Norfolk"+ },+ {+ __typename: "CountryDisplay",+ code: "MP",+ country: "Mariany Północne"+ },+ {+ __typename: "CountryDisplay",+ code: "PW",+ country: "Palau"+ },+ {+ __typename: "CountryDisplay",+ code: "PG",+ country: "Papua-Nowa Gwinea"+ },+ {+ __typename: "CountryDisplay",+ code: "PN",+ country: "Pitcairn"+ },+ {+ __typename: "CountryDisplay",+ code: "WS",+ country: "Samoa"+ },+ {+ __typename: "CountryDisplay",+ code: "SB",+ country: "Wyspy Salomona"+ },+ {+ __typename: "CountryDisplay",+ code: "TK",+ country: "Tokelau"+ },+ {+ __typename: "CountryDisplay",+ code: "TO",+ country: "Tonga"+ },+ {+ __typename: "CountryDisplay",+ code: "TV",+ country: "Tuvalu"+ },+ {+ __typename: "CountryDisplay",+ code: "UM",+ country: "Dalekie Wyspy Mniejsze Stanów Zjednoczonych"+ },+ {+ __typename: "CountryDisplay",+ code: "VU",+ country: "Vanuatu"+ },+ {+ __typename: "CountryDisplay",+ code: "WF",+ country: "Wallis i Futuna"+ }+ ],+ id: "U2hpcHBpbmdab25lOjI=",+ name: "Oceania"+ },+ {+ __typename: "ShippingZone",++ countries: [+ {+ __typename: "CountryDisplay",+ code: "AF",+ country: "Afganistan"+ },+ {+ __typename: "CountryDisplay",+ code: "AM",+ country: "Armenia"+ },+ {+ __typename: "CountryDisplay",+ code: "AZ",+ country: "Azerbejdżan"+ },+ {+ __typename: "CountryDisplay",+ code: "BH",+ country: "Bahrajn"+ },+ {+ __typename: "CountryDisplay",+ code: "BD",+ country: "Bangladesz"+ },+ {+ __typename: "CountryDisplay",+ code: "BT",+ country: "Bhutan"+ },+ {+ __typename: "CountryDisplay",+ code: "BN",+ country: "Brunei"+ },+ {+ __typename: "CountryDisplay",+ code: "KH",+ country: "Kambodża"+ },+ {+ __typename: "CountryDisplay",+ code: "CN",+ country: "Chiny"+ },+ {+ __typename: "CountryDisplay",+ code: "CY",+ country: "Cypr"+ },+ {+ __typename: "CountryDisplay",+ code: "GE",+ country: "Gruzja"+ },+ {+ __typename: "CountryDisplay",+ code: "HK",+ country: "Hongkong"+ },+ {+ __typename: "CountryDisplay",+ code: "IN",+ country: "Indie"+ },+ {+ __typename: "CountryDisplay",+ code: "ID",+ country: "Indonezja"+ },+ {+ __typename: "CountryDisplay",+ code: "IR",+ country: "Iran"+ },+ {+ __typename: "CountryDisplay",+ code: "IQ",+ country: "Irak"+ },+ {+ __typename: "CountryDisplay",+ code: "IL",+ country: "Izrael"+ },+ {+ __typename: "CountryDisplay",+ code: "JP",+ country: "Japonia"+ },+ {+ __typename: "CountryDisplay",+ code: "JO",+ country: "Jordania"+ },+ {+ __typename: "CountryDisplay",+ code: "KZ",+ country: "Kazachstan"+ },+ {+ __typename: "CountryDisplay",+ code: "KP",+ country: "Korea Północna"+ },+ {+ __typename: "CountryDisplay",+ code: "KR",+ country: "Korea Południowa"+ },+ {+ __typename: "CountryDisplay",+ code: "KW",+ country: "Kuwejt"+ },+ {+ __typename: "CountryDisplay",+ code: "KG",+ country: "Kirgistan"+ },+ {+ __typename: "CountryDisplay",+ code: "LA",+ country: "Laos"+ },+ {+ __typename: "CountryDisplay",+ code: "LB",+ country: "Liban"+ },+ {+ __typename: "CountryDisplay",+ code: "MO",+ country: "Makau"+ },+ {+ __typename: "CountryDisplay",+ code: "MY",+ country: "Malezja"+ },+ {+ __typename: "CountryDisplay",+ code: "MV",+ country: "Malediwy"+ },+ {+ __typename: "CountryDisplay",+ code: "MN",+ country: "Mongolia"+ },+ {+ __typename: "CountryDisplay",+ code: "MM",+ country: "Mjanma"+ },+ {+ __typename: "CountryDisplay",+ code: "NP",+ country: "Nepal"+ },+ {+ __typename: "CountryDisplay",+ code: "OM",+ country: "Oman"+ },+ {+ __typename: "CountryDisplay",+ code: "PK",+ country: "Pakistan"+ },+ {+ __typename: "CountryDisplay",+ code: "PS",+ country: "Palestyna"+ },+ {+ __typename: "CountryDisplay",+ code: "PH",+ country: "Filipiny"+ },+ {+ __typename: "CountryDisplay",+ code: "QA",+ country: "Katar"+ },+ {+ __typename: "CountryDisplay",+ code: "SA",+ country: "Arabia Saudyjska"+ },+ {+ __typename: "CountryDisplay",+ code: "SG",+ country: "Singapur"+ },+ {+ __typename: "CountryDisplay",+ code: "LK",+ country: "Sri Lanka"+ },+ {+ __typename: "CountryDisplay",+ code: "SY",+ country: "Syria"+ },+ {+ __typename: "CountryDisplay",+ code: "TW",+ country: "Tajwan"+ },+ {+ __typename: "CountryDisplay",+ code: "TJ",+ country: "Tadżykistan"+ },+ {+ __typename: "CountryDisplay",+ code: "TH",+ country: "Tajlandia"+ },+ {+ __typename: "CountryDisplay",+ code: "TL",+ country: "Timor Wschodni"+ },+ {+ __typename: "CountryDisplay",+ code: "TR",+ country: "Turcja"+ },+ {+ __typename: "CountryDisplay",+ code: "TM",+ country: "Turkmenistan"+ },+ {+ __typename: "CountryDisplay",+ code: "AE",+ country: "Zjednoczone Emiraty Arabskie"+ },+ {+ __typename: "CountryDisplay",+ code: "UZ",+ country: "Uzbekistan"+ },+ {+ __typename: "CountryDisplay",+ code: "VN",+ country: "Wietnam"+ },+ {+ __typename: "CountryDisplay",+ code: "YE",+ country: "Jemen"+ }+ ],+ id: "U2hpcHBpbmdab25lOjM=",+ name: "Asia"+ },+ {+ __typename: "ShippingZone",++ countries: [+ {+ __typename: "CountryDisplay",+ code: "AI",+ country: "Anguilla"+ },+ {+ __typename: "CountryDisplay",+ code: "AG",+ country: "Antigua i Barbuda"+ },+ {+ __typename: "CountryDisplay",+ code: "AR",+ country: "Argentyna"+ },+ {+ __typename: "CountryDisplay",+ code: "AW",+ country: "Aruba"+ },+ {+ __typename: "CountryDisplay",+ code: "BS",+ country: "Bahamy"+ },+ {+ __typename: "CountryDisplay",+ code: "BB",+ country: "Barbados"+ },+ {+ __typename: "CountryDisplay",+ code: "BZ",+ country: "Belize"+ },+ {+ __typename: "CountryDisplay",+ code: "BM",+ country: "Bermudy"+ },+ {+ __typename: "CountryDisplay",+ code: "BO",+ country: "Boliwia"+ },+ {+ __typename: "CountryDisplay",+ code: "BQ",+ country: "Bonaire, Sint Eustatius i Saba"+ },+ {+ __typename: "CountryDisplay",+ code: "BV",+ country: "Wyspa Bouveta"+ },+ {+ __typename: "CountryDisplay",+ code: "BR",+ country: "Brazylia"+ },+ {+ __typename: "CountryDisplay",+ code: "CA",+ country: "Kanada"+ },+ {+ __typename: "CountryDisplay",+ code: "KY",+ country: "Kajmany"+ },+ {+ __typename: "CountryDisplay",+ code: "CL",+ country: "Chile"+ },+ {+ __typename: "CountryDisplay",+ code: "CO",+ country: "Kolumbia"+ },+ {+ __typename: "CountryDisplay",+ code: "CR",+ country: "Kostaryka"+ },+ {+ __typename: "CountryDisplay",+ code: "CU",+ country: "Kuba"+ },+ {+ __typename: "CountryDisplay",+ code: "CW",+ country: "Curaçao"+ },+ {+ __typename: "CountryDisplay",+ code: "DM",+ country: "Dominika"+ },+ {+ __typename: "CountryDisplay",+ code: "DO",+ country: "Dominikana"+ },+ {+ __typename: "CountryDisplay",+ code: "EC",+ country: "Ekwador"+ },+ {+ __typename: "CountryDisplay",+ code: "SV",+ country: "Salwador"+ },+ {+ __typename: "CountryDisplay",+ code: "FK",+ country: "Falklandy"+ },+ {+ __typename: "CountryDisplay",+ code: "GF",+ country: "Gujana Francuska"+ },+ {+ __typename: "CountryDisplay",+ code: "GL",+ country: "Grenlandia"+ },+ {+ __typename: "CountryDisplay",+ code: "GD",+ country: "Grenada"+ },+ {+ __typename: "CountryDisplay",+ code: "GP",+ country: "Gwadelupa"+ },+ {+ __typename: "CountryDisplay",+ code: "GT",+ country: "Gwatemala"+ },+ {+ __typename: "CountryDisplay",+ code: "GY",+ country: "Gujana"+ },+ {+ __typename: "CountryDisplay",+ code: "HT",+ country: "Haiti"+ },+ {+ __typename: "CountryDisplay",+ code: "HN",+ country: "Honduras"+ },+ {+ __typename: "CountryDisplay",+ code: "JM",+ country: "Jamajka"+ },+ {+ __typename: "CountryDisplay",+ code: "MQ",+ country: "Martynika"+ },+ {+ __typename: "CountryDisplay",+ code: "MX",+ country: "Meksyk"+ },+ {+ __typename: "CountryDisplay",+ code: "MS",+ country: "Montserrat"+ },+ {+ __typename: "CountryDisplay",+ code: "NI",+ country: "Nikaragua"+ },+ {+ __typename: "CountryDisplay",+ code: "PA",+ country: "Panama"+ },+ {+ __typename: "CountryDisplay",+ code: "PY",+ country: "Paragwaj"+ },+ {+ __typename: "CountryDisplay",+ code: "PE",+ country: "Peru"+ },+ {+ __typename: "CountryDisplay",+ code: "PR",+ country: "Portoryko"+ },+ {+ __typename: "CountryDisplay",+ code: "BL",+ country: "Saint-Barthélemy"+ },+ {+ __typename: "CountryDisplay",+ code: "KN",+ country: "Saint Kitts i Nevis"+ },+ {+ __typename: "CountryDisplay",+ code: "LC",+ country: "Saint Lucia"+ },+ {+ __typename: "CountryDisplay",+ code: "MF",+ country: "Saint-Martin"+ },+ {+ __typename: "CountryDisplay",+ code: "PM",+ country: "Saint-Pierre i Miquelon"+ },+ {+ __typename: "CountryDisplay",+ code: "VC",+ country: "Saint Vincent i Grenadyny"+ },+ {+ __typename: "CountryDisplay",+ code: "SX",+ country: "Sint Maarten"+ },+ {+ __typename: "CountryDisplay",+ code: "GS",+ country: "Georgia Południowa i Sandwich Południowy"+ },+ {+ __typename: "CountryDisplay",+ code: "SR",+ country: "Surinam"+ },+ {+ __typename: "CountryDisplay",+ code: "TT",+ country: "Trynidad i Tobago"+ },+ {+ __typename: "CountryDisplay",+ code: "TC",+ country: "Turks i Caicos"+ },+ {+ __typename: "CountryDisplay",+ code: "US",+ country: "Stany Zjednoczone Ameryki"+ },+ {+ __typename: "CountryDisplay",+ code: "UY",+ country: "Urugwaj"+ },+ {+ __typename: "CountryDisplay",+ code: "VE",+ country: "Wenezuela"+ },+ {+ __typename: "CountryDisplay",+ code: "VG",+ country: "Brytyjskie Wyspy Dziewicze"+ },+ {+ __typename: "CountryDisplay",+ code: "VI",+ country: "Wyspy Dziewicze Stanów Zjednoczonych"+ }+ ],+ id: "U2hpcHBpbmdab25lOjQ=",+ name: "Americas"+ },+ {+ __typename: "ShippingZone",++ countries: [+ {+ __typename: "CountryDisplay",+ code: "DZ",+ country: "Algeria"+ },+ {+ __typename: "CountryDisplay",+ code: "AO",+ country: "Angola"+ },+ {+ __typename: "CountryDisplay",+ code: "BJ",+ country: "Benin"+ },+ {+ __typename: "CountryDisplay",+ code: "BW",+ country: "Botswana"+ },+ {+ __typename: "CountryDisplay",+ code: "IO",+ country: "Brytyjskie Terytorium Oceanu Indyjskiego"+ },+ {+ __typename: "CountryDisplay",+ code: "BF",+ country: "Burkina Faso"+ },+ {+ __typename: "CountryDisplay",+ code: "BI",+ country: "Burundi"+ },+ {+ __typename: "CountryDisplay",+ code: "CV",+ country: "Republika Zielonego Przylądka"+ },+ {+ __typename: "CountryDisplay",+ code: "CM",+ country: "Kamerun"+ },+ {+ __typename: "CountryDisplay",+ code: "CF",+ country: "Republika Środkowoafrykańska"+ },+ {+ __typename: "CountryDisplay",+ code: "TD",+ country: "Czad"+ },+ {+ __typename: "CountryDisplay",+ code: "KM",+ country: "Komory"+ },+ {+ __typename: "CountryDisplay",+ code: "CG",+ country: "Kongo"+ },+ {+ __typename: "CountryDisplay",+ code: "CD",+ country: "Kongo"+ },+ {+ __typename: "CountryDisplay",+ code: "CI",+ country: "Wybrzeże Kości Słoniowej"+ },+ {+ __typename: "CountryDisplay",+ code: "DJ",+ country: "Dżibuti"+ },+ {+ __typename: "CountryDisplay",+ code: "EG",+ country: "Egipt"+ },+ {+ __typename: "CountryDisplay",+ code: "GQ",+ country: "Gwinea Równikowa"+ },+ {+ __typename: "CountryDisplay",+ code: "ER",+ country: "Erytrea"+ },+ {+ __typename: "CountryDisplay",+ code: "SZ",+ country: "Suazi"+ },+ {+ __typename: "CountryDisplay",+ code: "ET",+ country: "Etiopia"+ },+ {+ __typename: "CountryDisplay",+ code: "TF",+ country: "Francuskie Terytoria Południowe i Antarktyczne"+ },+ {+ __typename: "CountryDisplay",+ code: "GA",+ country: "Gabon"+ },+ {+ __typename: "CountryDisplay",+ code: "GM",+ country: "Gambia"+ },+ {+ __typename: "CountryDisplay",+ code: "GH",+ country: "Ghana"+ },+ {+ __typename: "CountryDisplay",+ code: "GN",+ country: "Gwinea"+ },+ {+ __typename: "CountryDisplay",+ code: "GW",+ country: "Gwinea Bissau"+ },+ {+ __typename: "CountryDisplay",+ code: "KE",+ country: "Kenia"+ },+ {+ __typename: "CountryDisplay",+ code: "LS",+ country: "Lesotho"+ },+ {+ __typename: "CountryDisplay",+ code: "LR",+ country: "Liberia"+ },+ {+ __typename: "CountryDisplay",+ code: "LY",+ country: "Libia"+ },+ {+ __typename: "CountryDisplay",+ code: "MG",+ country: "Madagaskar"+ },+ {+ __typename: "CountryDisplay",+ code: "MW",+ country: "Malawi"+ },+ {+ __typename: "CountryDisplay",+ code: "ML",+ country: "Mali"+ },+ {+ __typename: "CountryDisplay",+ code: "MR",+ country: "Mauretania"+ },+ {+ __typename: "CountryDisplay",+ code: "MU",+ country: "Mauritius"+ },+ {+ __typename: "CountryDisplay",+ code: "YT",+ country: "Majotta"+ },+ {+ __typename: "CountryDisplay",+ code: "MA",+ country: "Maroko"+ },+ {+ __typename: "CountryDisplay",+ code: "MZ",+ country: "Mozambik"+ },+ {+ __typename: "CountryDisplay",+ code: "NA",+ country: "Namibia"+ },+ {+ __typename: "CountryDisplay",+ code: "NE",+ country: "Niger"+ },+ {+ __typename: "CountryDisplay",+ code: "NG",+ country: "Nigeria"+ },+ {+ __typename: "CountryDisplay",+ code: "RE",+ country: "Reunion"+ },+ {+ __typename: "CountryDisplay",+ code: "RW",+ country: "Rwanda"+ },+ {+ __typename: "CountryDisplay",+ code: "SH",+ country:+ "Wyspa Świętej Heleny, Wyspa Wniebowstąpienia i Tristan da Cunha"+ },+ {+ __typename: "CountryDisplay",+ code: "ST",+ country: "Wyspy Świętego Tomasza i Książęca"+ },+ {+ __typename: "CountryDisplay",+ code: "SN",+ country: "Senegal"+ },+ {+ __typename: "CountryDisplay",+ code: "SC",+ country: "Seszele"+ },+ {+ __typename: "CountryDisplay",+ code: "SL",+ country: "Sierra Leone"+ },+ {+ __typename: "CountryDisplay",+ code: "SO",+ country: "Somalia"+ },+ {+ __typename: "CountryDisplay",+ code: "ZA",+ country: "Republika Południowej Afryki"+ },+ {+ __typename: "CountryDisplay",+ code: "SS",+ country: "Sudan Południowy"+ },+ {+ __typename: "CountryDisplay",+ code: "SD",+ country: "Sudan"+ },+ {+ __typename: "CountryDisplay",+ code: "TZ",+ country: "Tanzania"+ },+ {+ __typename: "CountryDisplay",+ code: "TG",+ country: "Togo"+ },+ {+ __typename: "CountryDisplay",+ code: "TN",+ country: "Tunezja"+ },+ {+ __typename: "CountryDisplay",+ code: "UG",+ country: "Uganda"+ },+ {+ __typename: "CountryDisplay",+ code: "EH",+ country: "Sahara Zachodnia"+ },+ {+ __typename: "CountryDisplay",+ code: "ZM",+ country: "Zambia"+ },+ {+ __typename: "CountryDisplay",+ code: "ZW",+ country: "Zimbabwe"+ }+ ],+ id: "U2hpcHBpbmdab25lOjU=",+ name: "Africa"+ }+];diff --git a/saleor/static/dashboard-next/shipping/queries.ts b/saleor/static/dashboard-next/shipping/queries.tsnew file mode 100644index 0000000000..2face23bd1--- /dev/null+++ b/saleor/static/dashboard-next/shipping/queries.ts@@ -0,0 +1,37 @@+import gql from "graphql-tag";++import { TypedQuery } from "../queries";+import { ShippingZones, ShippingZonesVariables } from "./types/ShippingZones";++export const shippingZoneFragment = gql`+ fragment ShippingZoneFragment on ShippingZone {+ id+ countries {+ code+ country+ }+ name+ }+`;++const shippingZones = gql`+ ${shippingZoneFragment}+ query ShippingZones(+ $first: Int+ $after: String+ $last: Int+ $before: String+ ) {+ shippingZones(first: $first, after: $after, last: $last, before: $before) {+ edges {+ node {+ ...ShippingZoneFragment+ }+ }+ }+ }+`;+export const TypedShippingZones = TypedQuery<+ ShippingZones,+ ShippingZonesVariables+>(shippingZones);diff --git a/saleor/static/dashboard-next/shipping/types/ShippingZoneFragment.ts b/saleor/static/dashboard-next/shipping/types/ShippingZoneFragment.tsnew file mode 100644index 0000000000..2b83283110--- /dev/null+++ b/saleor/static/dashboard-next/shipping/types/ShippingZoneFragment.ts@@ -0,0 +1,19 @@+/* tslint:disable */+// This file was automatically generated and should not be edited.++// ====================================================+// GraphQL fragment: ShippingZoneFragment+// ====================================================++export interface ShippingZoneFragment_countries {+ __typename: "CountryDisplay";+ code: string;+ country: string;+}++export interface ShippingZoneFragment {+ __typename: "ShippingZone";+ id: string;+ countries: (ShippingZoneFragment_countries | null)[] | null;+ name: string;+}diff --git a/saleor/static/dashboard-next/shipping/types/ShippingZones.ts b/saleor/static/dashboard-next/shipping/types/ShippingZones.tsnew file mode 100644index 0000000000..f61bdefafa--- /dev/null+++ b/saleor/static/dashboard-next/shipping/types/ShippingZones.ts@@ -0,0 +1,40 @@+/* tslint:disable */+// This file was automatically generated and should not be edited.++// ====================================================+// GraphQL query operation: ShippingZones+// ====================================================++export interface ShippingZones_shippingZones_edges_node_countries {+ __typename: "CountryDisplay";+ code: string;+ country: string;+}++export interface ShippingZones_shippingZones_edges_node {+ __typename: "ShippingZone";+ id: string;+ countries: (ShippingZones_shippingZones_edges_node_countries | null)[] | null;+ name: string;+}++export interface ShippingZones_shippingZones_edges {+ __typename: "ShippingZoneCountableEdge";+ node: ShippingZones_shippingZones_edges_node;+}++export interface ShippingZones_shippingZones {+ __typename: "ShippingZoneCountableConnection";+ edges: ShippingZones_shippingZones_edges[];+}++export interface ShippingZones {+ shippingZones: ShippingZones_shippingZones | null;+}++export interface ShippingZonesVariables {+ first?: number | null;+ after?: string | null;+ last?: number | null;+ before?: string | null;+}diff --git a/saleor/static/dashboard-next/storybook/config.js b/saleor/static/dashboard-next/storybook/config.jsindex f2b22b3fd5..d089158966 100644--- a/saleor/static/dashboard-next/storybook/config.js+++ b/saleor/static/dashboard-next/storybook/config.js@@ -111,10 +111,13 @@ function loadStories() {require("./stories/productTypes/ProductTypeDetailsPage");require("./stories/productTypes/ProductTypeListPage");+ // Shipping+ require("./stories/shipping/ShippingZonesListPage");+// Site settingsrequire("./stories/siteSettings/SiteSettingsKeyDialog");require("./stories/siteSettings/SiteSettingsPage");-+// Taxesrequire("./stories/taxes/CountryListPage");require("./stories/taxes/CountryTaxesPage");diff --git a/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx b/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsxnew file mode 100644index 0000000000..6f6ef63611--- /dev/null+++ b/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx@@ -0,0 +1,34 @@+import { storiesOf } from "@storybook/react";+import * as React from "react";++import { pageListProps } from "../../../fixtures";+import ShippingZonesListPage, {+ ShippingZonesListPageProps+} from "../../../shipping/components/ShippingZonesListPage";+import { shippingZones } from "../../../shipping/fixtures";+import { WeightUnitsEnum } from "../../../types/globalTypes";+import Decorator from "../../Decorator";++const props: ShippingZonesListPageProps = {+ ...pageListProps.default,+ defaultWeightUnit: WeightUnitsEnum.kg,+ onAdd: () => undefined,+ onBack: () => undefined,+ onRemove: () => undefined,+ onSubmit: () => undefined,+ shippingZones+};++storiesOf("Views / Shipping / Shipping zones list", module)+ .addDecorator(Decorator)+ .add("default", () => <ShippingZonesListPage {...props} />)+ .add("loading", () => (+ <ShippingZonesListPage+ {...props}+ disabled={true}+ shippingZones={undefined}+ />+ ))+ .add("no data", () => (+ <ShippingZonesListPage {...props} shippingZones={[]} />+ ));