Update types
This commit is contained in:
parent
ffced45d55
commit
1ede1a33b1
28 changed files with 510 additions and 461 deletions
790
schema.graphql
790
schema.graphql
File diff suppressed because it is too large
Load diff
|
@ -15,7 +15,7 @@ export interface SetPassword_setPassword_errors {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SetPassword_setPassword_user_permissions {
|
export interface SetPassword_setPassword_user_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ export interface SetPassword_setPassword_user {
|
||||||
|
|
||||||
export interface SetPassword_setPassword {
|
export interface SetPassword_setPassword {
|
||||||
__typename: "SetPassword";
|
__typename: "SetPassword";
|
||||||
errors: SetPassword_setPassword_errors[] | null;
|
errors: SetPassword_setPassword_errors[];
|
||||||
token: string | null;
|
token: string | null;
|
||||||
user: SetPassword_setPassword_user | null;
|
user: SetPassword_setPassword_user | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ export interface TokenAuth_tokenCreate_errors {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TokenAuth_tokenCreate_user_permissions {
|
export interface TokenAuth_tokenCreate_user_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ export interface TokenAuth_tokenCreate_user {
|
||||||
export interface TokenAuth_tokenCreate {
|
export interface TokenAuth_tokenCreate {
|
||||||
__typename: "CreateToken";
|
__typename: "CreateToken";
|
||||||
token: string | null;
|
token: string | null;
|
||||||
errors: (TokenAuth_tokenCreate_errors | null)[];
|
errors: TokenAuth_tokenCreate_errors[];
|
||||||
user: TokenAuth_tokenCreate_user | null;
|
user: TokenAuth_tokenCreate_user | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { PermissionEnum } from "./../../types/globalTypes";
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface User_permissions {
|
export interface User_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { PermissionEnum } from "./../../types/globalTypes";
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface VerifyToken_tokenVerify_user_permissions {
|
export interface VerifyToken_tokenVerify_user_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ export interface ShopInfo_shop_languages {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShopInfo_shop_permissions {
|
export interface ShopInfo_shop_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,7 +373,7 @@ export const permissions: ShopInfo_shop_permissions[] = [
|
||||||
name: "Manage webhooks."
|
name: "Manage webhooks."
|
||||||
}
|
}
|
||||||
].map(perm => ({
|
].map(perm => ({
|
||||||
__typename: "PermissionDisplay" as "PermissionDisplay",
|
__typename: "Permission" as "Permission",
|
||||||
...perm
|
...perm
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ export interface ProductFragment {
|
||||||
name: string;
|
name: string;
|
||||||
thumbnail: ProductFragment_thumbnail | null;
|
thumbnail: ProductFragment_thumbnail | null;
|
||||||
isAvailable: boolean | null;
|
isAvailable: boolean | null;
|
||||||
|
isPublished: boolean;
|
||||||
basePrice: ProductFragment_basePrice | null;
|
basePrice: ProductFragment_basePrice | null;
|
||||||
productType: ProductFragment_productType;
|
productType: ProductFragment_productType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ export interface ProductList_products_edges_node {
|
||||||
name: string;
|
name: string;
|
||||||
thumbnail: ProductList_products_edges_node_thumbnail | null;
|
thumbnail: ProductList_products_edges_node_thumbnail | null;
|
||||||
isAvailable: boolean | null;
|
isAvailable: boolean | null;
|
||||||
isPublished: boolean | null;
|
isPublished: boolean;
|
||||||
basePrice: ProductList_products_edges_node_basePrice | null;
|
basePrice: ProductList_products_edges_node_basePrice | null;
|
||||||
productType: ProductList_products_edges_node_productType;
|
productType: ProductList_products_edges_node_productType;
|
||||||
attributes: ProductList_products_edges_node_attributes[];
|
attributes: ProductList_products_edges_node_attributes[];
|
||||||
|
|
|
@ -30,7 +30,7 @@ export const service: ServiceDetails_serviceAccount = {
|
||||||
name: "Magento Importer",
|
name: "Magento Importer",
|
||||||
permissions: [
|
permissions: [
|
||||||
{
|
{
|
||||||
__typename: "PermissionDisplay" as "PermissionDisplay",
|
__typename: "Permission" as "Permission",
|
||||||
code: PermissionEnum.MANAGE_PRODUCTS,
|
code: PermissionEnum.MANAGE_PRODUCTS,
|
||||||
name: "Manage products."
|
name: "Manage products."
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { PermissionEnum } from "./../../types/globalTypes";
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface ServiceDetails_serviceAccount_permissions {
|
export interface ServiceDetails_serviceAccount_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { PermissionEnum } from "./../../types/globalTypes";
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface ServiceDetailsFragment_permissions {
|
export interface ServiceDetailsFragment_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ export interface ServiceUpdate_serviceAccountUpdate_errors {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ServiceUpdate_serviceAccountUpdate_serviceAccount_permissions {
|
export interface ServiceUpdate_serviceAccountUpdate_serviceAccount_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ export const TypedUpdateDefaultWeightUnit = TypedMutation<
|
||||||
const createShippingZone = gql`
|
const createShippingZone = gql`
|
||||||
${countryFragment}
|
${countryFragment}
|
||||||
${shippingErrorFragment}
|
${shippingErrorFragment}
|
||||||
mutation CreateShippingZone($input: ShippingZoneInput!) {
|
mutation CreateShippingZone($input: ShippingZoneCreateInput!) {
|
||||||
shippingZoneCreate(input: $input) {
|
shippingZoneCreate(input: $input) {
|
||||||
errors: shippingErrors {
|
errors: shippingErrors {
|
||||||
...ShippingErrorFragment
|
...ShippingErrorFragment
|
||||||
|
@ -122,7 +122,7 @@ export const TypedCreateShippingZone = TypedMutation<
|
||||||
const updateShippingZone = gql`
|
const updateShippingZone = gql`
|
||||||
${countryFragment}
|
${countryFragment}
|
||||||
${shippingErrorFragment}
|
${shippingErrorFragment}
|
||||||
mutation UpdateShippingZone($id: ID!, $input: ShippingZoneInput!) {
|
mutation UpdateShippingZone($id: ID!, $input: ShippingZoneUpdateInput!) {
|
||||||
shippingZoneUpdate(id: $id, input: $input) {
|
shippingZoneUpdate(id: $id, input: $input) {
|
||||||
errors: shippingErrors {
|
errors: shippingErrors {
|
||||||
...ShippingErrorFragment
|
...ShippingErrorFragment
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// This file was automatically generated and should not be edited.
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
import { ShippingZoneInput, ShippingErrorCode } from "./../../types/globalTypes";
|
import { ShippingZoneCreateInput, ShippingErrorCode } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: CreateShippingZone
|
// GraphQL mutation operation: CreateShippingZone
|
||||||
|
@ -39,5 +39,5 @@ export interface CreateShippingZone {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateShippingZoneVariables {
|
export interface CreateShippingZoneVariables {
|
||||||
input: ShippingZoneInput;
|
input: ShippingZoneCreateInput;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// This file was automatically generated and should not be edited.
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
import { ShippingZoneInput, ShippingErrorCode } from "./../../types/globalTypes";
|
import { ShippingZoneUpdateInput, ShippingErrorCode } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: UpdateShippingZone
|
// GraphQL mutation operation: UpdateShippingZone
|
||||||
|
@ -40,5 +40,5 @@ export interface UpdateShippingZone {
|
||||||
|
|
||||||
export interface UpdateShippingZoneVariables {
|
export interface UpdateShippingZoneVariables {
|
||||||
id: string;
|
id: string;
|
||||||
input: ShippingZoneInput;
|
input: ShippingZoneUpdateInput;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,21 +5,19 @@ import DialogContent from "@material-ui/core/DialogContent";
|
||||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import TextField from "@material-ui/core/TextField";
|
import TextField from "@material-ui/core/TextField";
|
||||||
import Typography from "@material-ui/core/Typography";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
|
||||||
import ConfirmButton, {
|
import ConfirmButton, {
|
||||||
ConfirmButtonTransitionState
|
ConfirmButtonTransitionState
|
||||||
} from "@saleor/components/ConfirmButton";
|
} from "@saleor/components/ConfirmButton";
|
||||||
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
|
|
||||||
import Form from "@saleor/components/Form";
|
import Form from "@saleor/components/Form";
|
||||||
import FormSpacer from "@saleor/components/FormSpacer";
|
import FormSpacer from "@saleor/components/FormSpacer";
|
||||||
import { buttonMessages, commonMessages } from "@saleor/intl";
|
import { buttonMessages, commonMessages } from "@saleor/intl";
|
||||||
import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors";
|
import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors";
|
||||||
import { AccountErrorFragment } from "@saleor/customers/types/AccountErrorFragment";
|
|
||||||
import { getFormErrors } from "@saleor/utils/errors";
|
import { getFormErrors } from "@saleor/utils/errors";
|
||||||
import getAccountErrorMessage from "@saleor/utils/errors/account";
|
import { StaffErrorFragment } from "@saleor/staff/types/StaffErrorFragment";
|
||||||
|
import getStaffErrorMessage from "@saleor/utils/errors/staff";
|
||||||
|
|
||||||
export interface FormData {
|
export interface FormData {
|
||||||
email: string;
|
email: string;
|
||||||
|
@ -59,7 +57,7 @@ const useStyles = makeStyles(
|
||||||
|
|
||||||
interface StaffAddMemberDialogProps {
|
interface StaffAddMemberDialogProps {
|
||||||
confirmButtonState: ConfirmButtonTransitionState;
|
confirmButtonState: ConfirmButtonTransitionState;
|
||||||
errors: AccountErrorFragment[];
|
errors: StaffErrorFragment[];
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onConfirm: (data: FormData) => void;
|
onConfirm: (data: FormData) => void;
|
||||||
|
@ -92,10 +90,7 @@ const StaffAddMemberDialog: React.FC<StaffAddMemberDialogProps> = props => {
|
||||||
<div className={classes.textFieldGrid}>
|
<div className={classes.textFieldGrid}>
|
||||||
<TextField
|
<TextField
|
||||||
error={!!formErrors.firstName}
|
error={!!formErrors.firstName}
|
||||||
helperText={getAccountErrorMessage(
|
helperText={getStaffErrorMessage(formErrors.firstName, intl)}
|
||||||
formErrors.firstName,
|
|
||||||
intl
|
|
||||||
)}
|
|
||||||
label={intl.formatMessage(commonMessages.firstName)}
|
label={intl.formatMessage(commonMessages.firstName)}
|
||||||
name="firstName"
|
name="firstName"
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -104,7 +99,7 @@ const StaffAddMemberDialog: React.FC<StaffAddMemberDialogProps> = props => {
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
error={!!formErrors.lastName}
|
error={!!formErrors.lastName}
|
||||||
helperText={getAccountErrorMessage(formErrors.lastName, intl)}
|
helperText={getStaffErrorMessage(formErrors.lastName, intl)}
|
||||||
label={intl.formatMessage(commonMessages.lastName)}
|
label={intl.formatMessage(commonMessages.lastName)}
|
||||||
name="lastName"
|
name="lastName"
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -116,7 +111,7 @@ const StaffAddMemberDialog: React.FC<StaffAddMemberDialogProps> = props => {
|
||||||
<TextField
|
<TextField
|
||||||
error={!!formErrors.email}
|
error={!!formErrors.email}
|
||||||
fullWidth
|
fullWidth
|
||||||
helperText={getAccountErrorMessage(formErrors.email, intl)}
|
helperText={getStaffErrorMessage(formErrors.email, intl)}
|
||||||
label={intl.formatMessage(commonMessages.email)}
|
label={intl.formatMessage(commonMessages.email)}
|
||||||
name="email"
|
name="email"
|
||||||
type="email"
|
type="email"
|
||||||
|
@ -124,23 +119,6 @@ const StaffAddMemberDialog: React.FC<StaffAddMemberDialogProps> = props => {
|
||||||
onChange={change}
|
onChange={change}
|
||||||
/>
|
/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<hr className={classes.hr} />
|
|
||||||
<DialogContent>
|
|
||||||
<Typography className={classes.sectionTitle}>
|
|
||||||
<FormattedMessage defaultMessage="Permissions" />
|
|
||||||
</Typography>
|
|
||||||
<Typography>
|
|
||||||
<FormattedMessage defaultMessage="Expand or restrict user’s permissions to access certain part of saleor system." />
|
|
||||||
</Typography>
|
|
||||||
<ControlledCheckbox
|
|
||||||
checked={data.fullAccess}
|
|
||||||
label={intl.formatMessage({
|
|
||||||
defaultMessage: "User has full access"
|
|
||||||
})}
|
|
||||||
name="fullAccess"
|
|
||||||
onChange={change}
|
|
||||||
/>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={onClose}>
|
<Button onClick={onClose}>
|
||||||
<FormattedMessage {...buttonMessages.back} />
|
<FormattedMessage {...buttonMessages.back} />
|
||||||
|
|
|
@ -26,13 +26,19 @@ import {
|
||||||
ChangeStaffPasswordVariables
|
ChangeStaffPasswordVariables
|
||||||
} from "./types/ChangeStaffPassword";
|
} from "./types/ChangeStaffPassword";
|
||||||
|
|
||||||
|
const staffErrorFragment = gql`
|
||||||
|
fragment StaffErrorFragment on StaffError {
|
||||||
|
code
|
||||||
|
field
|
||||||
|
}
|
||||||
|
`;
|
||||||
const staffMemberAddMutation = gql`
|
const staffMemberAddMutation = gql`
|
||||||
${accountFragmentError}
|
${staffErrorFragment}
|
||||||
${staffMemberDetailsFragment}
|
${staffMemberDetailsFragment}
|
||||||
mutation StaffMemberAdd($input: StaffCreateInput!) {
|
mutation StaffMemberAdd($input: StaffCreateInput!) {
|
||||||
staffCreate(input: $input) {
|
staffCreate(input: $input) {
|
||||||
errors: accountErrors {
|
errors: staffErrors {
|
||||||
...AccountErrorFragment
|
...StaffErrorFragment
|
||||||
}
|
}
|
||||||
user {
|
user {
|
||||||
...StaffMemberDetailsFragment
|
...StaffMemberDetailsFragment
|
||||||
|
@ -48,10 +54,10 @@ export const TypedStaffMemberAddMutation = TypedMutation<
|
||||||
const staffMemberUpdateMutation = gql`
|
const staffMemberUpdateMutation = gql`
|
||||||
${accountFragmentError}
|
${accountFragmentError}
|
||||||
${staffMemberDetailsFragment}
|
${staffMemberDetailsFragment}
|
||||||
mutation StaffMemberUpdate($id: ID!, $input: StaffInput!) {
|
mutation StaffMemberUpdate($id: ID!, $input: StaffUpdateInput!) {
|
||||||
staffUpdate(id: $id, input: $input) {
|
staffUpdate(id: $id, input: $input) {
|
||||||
errors: accountErrors {
|
errors: staffErrors {
|
||||||
...AccountErrorFragment
|
...StaffErrorFragment
|
||||||
}
|
}
|
||||||
user {
|
user {
|
||||||
...StaffMemberDetailsFragment
|
...StaffMemberDetailsFragment
|
||||||
|
@ -65,11 +71,11 @@ export const TypedStaffMemberUpdateMutation = TypedMutation<
|
||||||
>(staffMemberUpdateMutation);
|
>(staffMemberUpdateMutation);
|
||||||
|
|
||||||
const staffMemberDeleteMutation = gql`
|
const staffMemberDeleteMutation = gql`
|
||||||
${accountFragmentError}
|
${staffErrorFragment}
|
||||||
mutation StaffMemberDelete($id: ID!) {
|
mutation StaffMemberDelete($id: ID!) {
|
||||||
staffDelete(id: $id) {
|
staffDelete(id: $id) {
|
||||||
errors: accountErrors {
|
errors: staffErrors {
|
||||||
...AccountErrorFragment
|
...StaffErrorFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
src/staff/types/StaffErrorFragment.ts
Normal file
15
src/staff/types/StaffErrorFragment.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
import { AccountErrorCode } from "./../../types/globalTypes";
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL fragment: StaffErrorFragment
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface StaffErrorFragment {
|
||||||
|
__typename: "StaffError";
|
||||||
|
code: AccountErrorCode;
|
||||||
|
field: string | null;
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ import { StaffCreateInput, AccountErrorCode, PermissionEnum } from "./../../type
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface StaffMemberAdd_staffCreate_errors {
|
export interface StaffMemberAdd_staffCreate_errors {
|
||||||
__typename: "AccountError";
|
__typename: "StaffError";
|
||||||
code: AccountErrorCode;
|
code: AccountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ export interface StaffMemberAdd_staffCreate_user_avatar {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StaffMemberAdd_staffCreate_user_permissions {
|
export interface StaffMemberAdd_staffCreate_user_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { AccountErrorCode } from "./../../types/globalTypes";
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface StaffMemberDelete_staffDelete_errors {
|
export interface StaffMemberDelete_staffDelete_errors {
|
||||||
__typename: "AccountError";
|
__typename: "StaffError";
|
||||||
code: AccountErrorCode;
|
code: AccountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ export interface StaffMemberDetails_user_avatar {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StaffMemberDetails_user_permissions {
|
export interface StaffMemberDetails_user_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ export interface StaffMemberDetailsFragment_avatar {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StaffMemberDetailsFragment_permissions {
|
export interface StaffMemberDetailsFragment_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// This file was automatically generated and should not be edited.
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
import { StaffInput, AccountErrorCode, PermissionEnum } from "./../../types/globalTypes";
|
import { StaffUpdateInput, AccountErrorCode, PermissionEnum } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: StaffMemberUpdate
|
// GraphQL mutation operation: StaffMemberUpdate
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface StaffMemberUpdate_staffUpdate_errors {
|
export interface StaffMemberUpdate_staffUpdate_errors {
|
||||||
__typename: "AccountError";
|
__typename: "StaffError";
|
||||||
code: AccountErrorCode;
|
code: AccountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ export interface StaffMemberUpdate_staffUpdate_user_avatar {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StaffMemberUpdate_staffUpdate_user_permissions {
|
export interface StaffMemberUpdate_staffUpdate_user_permissions {
|
||||||
__typename: "PermissionDisplay";
|
__typename: "Permission";
|
||||||
code: PermissionEnum;
|
code: PermissionEnum;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
@ -48,5 +48,5 @@ export interface StaffMemberUpdate {
|
||||||
|
|
||||||
export interface StaffMemberUpdateVariables {
|
export interface StaffMemberUpdateVariables {
|
||||||
id: string;
|
id: string;
|
||||||
input: StaffInput;
|
input: StaffUpdateInput;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,8 +161,7 @@ export const StaffDetails: React.FC<OrderListProps> = ({ id, params }) => {
|
||||||
email: variables.email,
|
email: variables.email,
|
||||||
firstName: variables.firstName,
|
firstName: variables.firstName,
|
||||||
isActive: variables.isActive,
|
isActive: variables.isActive,
|
||||||
lastName: variables.lastName,
|
lastName: variables.lastName
|
||||||
permissions: variables.permissions
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -141,9 +141,6 @@ export const StaffList: React.FC<StaffListProps> = ({ params }) => {
|
||||||
email: variables.email,
|
email: variables.email,
|
||||||
firstName: variables.firstName,
|
firstName: variables.firstName,
|
||||||
lastName: variables.lastName,
|
lastName: variables.lastName,
|
||||||
permissions: variables.fullAccess
|
|
||||||
? maybe(() => shop.permissions.map(perm => perm.code))
|
|
||||||
: undefined,
|
|
||||||
redirectUrl: urlJoin(
|
redirectUrl: urlJoin(
|
||||||
window.location.origin,
|
window.location.origin,
|
||||||
APP_MOUNT_URI === "/" ? "" : APP_MOUNT_URI,
|
APP_MOUNT_URI === "/" ? "" : APP_MOUNT_URI,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
export enum AccountErrorCode {
|
export enum AccountErrorCode {
|
||||||
ACTIVATE_OWN_ACCOUNT = "ACTIVATE_OWN_ACCOUNT",
|
ACTIVATE_OWN_ACCOUNT = "ACTIVATE_OWN_ACCOUNT",
|
||||||
ACTIVATE_SUPERUSER_ACCOUNT = "ACTIVATE_SUPERUSER_ACCOUNT",
|
ACTIVATE_SUPERUSER_ACCOUNT = "ACTIVATE_SUPERUSER_ACCOUNT",
|
||||||
ASSIGN_NON_STAFF_MEMBER = "ASSIGN_NON_STAFF_MEMBER",
|
CANNOT_ADD_AND_REMOVE = "CANNOT_ADD_AND_REMOVE",
|
||||||
DEACTIVATE_OWN_ACCOUNT = "DEACTIVATE_OWN_ACCOUNT",
|
DEACTIVATE_OWN_ACCOUNT = "DEACTIVATE_OWN_ACCOUNT",
|
||||||
DEACTIVATE_SUPERUSER_ACCOUNT = "DEACTIVATE_SUPERUSER_ACCOUNT",
|
DEACTIVATE_SUPERUSER_ACCOUNT = "DEACTIVATE_SUPERUSER_ACCOUNT",
|
||||||
DELETE_NON_STAFF_USER = "DELETE_NON_STAFF_USER",
|
DELETE_NON_STAFF_USER = "DELETE_NON_STAFF_USER",
|
||||||
|
@ -18,8 +18,13 @@ export enum AccountErrorCode {
|
||||||
DELETE_SUPERUSER_ACCOUNT = "DELETE_SUPERUSER_ACCOUNT",
|
DELETE_SUPERUSER_ACCOUNT = "DELETE_SUPERUSER_ACCOUNT",
|
||||||
GRAPHQL_ERROR = "GRAPHQL_ERROR",
|
GRAPHQL_ERROR = "GRAPHQL_ERROR",
|
||||||
INVALID = "INVALID",
|
INVALID = "INVALID",
|
||||||
|
INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
|
||||||
INVALID_PASSWORD = "INVALID_PASSWORD",
|
INVALID_PASSWORD = "INVALID_PASSWORD",
|
||||||
|
LEFT_NOT_MANAGEABLE_PERMISSION = "LEFT_NOT_MANAGEABLE_PERMISSION",
|
||||||
NOT_FOUND = "NOT_FOUND",
|
NOT_FOUND = "NOT_FOUND",
|
||||||
|
OUT_OF_SCOPE_GROUP = "OUT_OF_SCOPE_GROUP",
|
||||||
|
OUT_OF_SCOPE_PERMISSION = "OUT_OF_SCOPE_PERMISSION",
|
||||||
|
OUT_OF_SCOPE_USER = "OUT_OF_SCOPE_USER",
|
||||||
PASSWORD_ENTIRELY_NUMERIC = "PASSWORD_ENTIRELY_NUMERIC",
|
PASSWORD_ENTIRELY_NUMERIC = "PASSWORD_ENTIRELY_NUMERIC",
|
||||||
PASSWORD_TOO_COMMON = "PASSWORD_TOO_COMMON",
|
PASSWORD_TOO_COMMON = "PASSWORD_TOO_COMMON",
|
||||||
PASSWORD_TOO_SHORT = "PASSWORD_TOO_SHORT",
|
PASSWORD_TOO_SHORT = "PASSWORD_TOO_SHORT",
|
||||||
|
@ -348,6 +353,7 @@ export enum CountryCode {
|
||||||
|
|
||||||
export enum DiscountErrorCode {
|
export enum DiscountErrorCode {
|
||||||
ALREADY_EXISTS = "ALREADY_EXISTS",
|
ALREADY_EXISTS = "ALREADY_EXISTS",
|
||||||
|
GRAPHQL_ERROR = "GRAPHQL_ERROR",
|
||||||
INVALID = "INVALID",
|
INVALID = "INVALID",
|
||||||
NOT_FOUND = "NOT_FOUND",
|
NOT_FOUND = "NOT_FOUND",
|
||||||
REQUIRED = "REQUIRED",
|
REQUIRED = "REQUIRED",
|
||||||
|
@ -633,6 +639,7 @@ export enum ServiceAccountSortField {
|
||||||
|
|
||||||
export enum ShippingErrorCode {
|
export enum ShippingErrorCode {
|
||||||
ALREADY_EXISTS = "ALREADY_EXISTS",
|
ALREADY_EXISTS = "ALREADY_EXISTS",
|
||||||
|
CANNOT_ADD_AND_REMOVE = "CANNOT_ADD_AND_REMOVE",
|
||||||
GRAPHQL_ERROR = "GRAPHQL_ERROR",
|
GRAPHQL_ERROR = "GRAPHQL_ERROR",
|
||||||
INVALID = "INVALID",
|
INVALID = "INVALID",
|
||||||
MAX_LESS_THAN_MIN = "MAX_LESS_THAN_MIN",
|
MAX_LESS_THAN_MIN = "MAX_LESS_THAN_MIN",
|
||||||
|
@ -1247,10 +1254,19 @@ export interface ShippingPriceInput {
|
||||||
shippingZone?: string | null;
|
shippingZone?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShippingZoneInput {
|
export interface ShippingZoneCreateInput {
|
||||||
name?: string | null;
|
name?: string | null;
|
||||||
countries?: (string | null)[] | null;
|
countries?: (string | null)[] | null;
|
||||||
default?: boolean | null;
|
default?: boolean | null;
|
||||||
|
addWarehouses?: (string | null)[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ShippingZoneUpdateInput {
|
||||||
|
name?: string | null;
|
||||||
|
countries?: (string | null)[] | null;
|
||||||
|
default?: boolean | null;
|
||||||
|
addWarehouses?: (string | null)[] | null;
|
||||||
|
removeWarehouses?: (string | null)[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShopSettingsInput {
|
export interface ShopSettingsInput {
|
||||||
|
@ -1280,17 +1296,18 @@ export interface StaffCreateInput {
|
||||||
email?: string | null;
|
email?: string | null;
|
||||||
isActive?: boolean | null;
|
isActive?: boolean | null;
|
||||||
note?: string | null;
|
note?: string | null;
|
||||||
permissions?: (PermissionEnum | null)[] | null;
|
addGroups?: string[] | null;
|
||||||
redirectUrl?: string | null;
|
redirectUrl?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StaffInput {
|
export interface StaffUpdateInput {
|
||||||
firstName?: string | null;
|
firstName?: string | null;
|
||||||
lastName?: string | null;
|
lastName?: string | null;
|
||||||
email?: string | null;
|
email?: string | null;
|
||||||
isActive?: boolean | null;
|
isActive?: boolean | null;
|
||||||
note?: string | null;
|
note?: string | null;
|
||||||
permissions?: (PermissionEnum | null)[] | null;
|
addGroups?: string[] | null;
|
||||||
|
removeGroups?: string[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StaffUserInput {
|
export interface StaffUserInput {
|
||||||
|
|
18
src/utils/errors/staff.ts
Normal file
18
src/utils/errors/staff.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { IntlShape } from "react-intl";
|
||||||
|
import { StaffErrorFragment } from "@saleor/staff/types/StaffErrorFragment";
|
||||||
|
import getAccountErrorMessage from "./account";
|
||||||
|
|
||||||
|
function getStaffErrorMessage(
|
||||||
|
err: StaffErrorFragment,
|
||||||
|
intl: IntlShape
|
||||||
|
): string {
|
||||||
|
return getAccountErrorMessage(
|
||||||
|
err && {
|
||||||
|
...err,
|
||||||
|
__typename: "AccountError"
|
||||||
|
},
|
||||||
|
intl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getStaffErrorMessage;
|
Loading…
Reference in a new issue