Update types
This commit is contained in:
parent
041f8e9963
commit
9b542e7837
15 changed files with 153 additions and 60 deletions
|
@ -1509,6 +1509,20 @@ input DigitalContentUrlCreateInput {
|
||||||
content: ID!
|
content: ID!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DiscountError {
|
||||||
|
field: String
|
||||||
|
message: String
|
||||||
|
code: DiscountErrorCode!
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DiscountErrorCode {
|
||||||
|
ALREADY_EXISTS
|
||||||
|
INVALID
|
||||||
|
NOT_FOUND
|
||||||
|
REQUIRED
|
||||||
|
UNIQUE
|
||||||
|
}
|
||||||
|
|
||||||
enum DiscountStatusEnum {
|
enum DiscountStatusEnum {
|
||||||
ACTIVE
|
ACTIVE
|
||||||
EXPIRED
|
EXPIRED
|
||||||
|
@ -3816,6 +3830,7 @@ type Sale implements Node {
|
||||||
type SaleAddCatalogues {
|
type SaleAddCatalogues {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
sale: Sale
|
sale: Sale
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
type SaleBulkDelete {
|
type SaleBulkDelete {
|
||||||
|
@ -3836,11 +3851,13 @@ type SaleCountableEdge {
|
||||||
|
|
||||||
type SaleCreate {
|
type SaleCreate {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
sale: Sale
|
sale: Sale
|
||||||
}
|
}
|
||||||
|
|
||||||
type SaleDelete {
|
type SaleDelete {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
sale: Sale
|
sale: Sale
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3865,6 +3882,7 @@ input SaleInput {
|
||||||
type SaleRemoveCatalogues {
|
type SaleRemoveCatalogues {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
sale: Sale
|
sale: Sale
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SaleSortField {
|
enum SaleSortField {
|
||||||
|
@ -3905,6 +3923,7 @@ enum SaleType {
|
||||||
|
|
||||||
type SaleUpdate {
|
type SaleUpdate {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
sale: Sale
|
sale: Sale
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3920,15 +3939,15 @@ input SeoInput {
|
||||||
|
|
||||||
type ServiceAccount implements Node & ObjectWithMetadata {
|
type ServiceAccount implements Node & ObjectWithMetadata {
|
||||||
id: ID!
|
id: ID!
|
||||||
|
name: String
|
||||||
created: DateTime
|
created: DateTime
|
||||||
isActive: Boolean
|
isActive: Boolean
|
||||||
|
permissions: [PermissionDisplay]
|
||||||
tokens: [ServiceAccountToken]
|
tokens: [ServiceAccountToken]
|
||||||
privateMetadata: [MetadataItem]!
|
privateMetadata: [MetadataItem]!
|
||||||
metadata: [MetadataItem]!
|
metadata: [MetadataItem]!
|
||||||
privateMeta: [MetaStore]! @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.11. use the `privetaMetadata` field instead. ")
|
privateMeta: [MetaStore]! @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.11. use the `privetaMetadata` field instead. ")
|
||||||
meta: [MetaStore]! @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.11. use the `metadata` field instead. ")
|
meta: [MetaStore]! @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.11. use the `metadata` field instead. ")
|
||||||
permissions: [PermissionDisplay]
|
|
||||||
name: String
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServiceAccountClearPrivateMeta {
|
type ServiceAccountClearPrivateMeta {
|
||||||
|
@ -4701,6 +4720,7 @@ type Voucher implements Node {
|
||||||
type VoucherAddCatalogues {
|
type VoucherAddCatalogues {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
voucher: Voucher
|
voucher: Voucher
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
type VoucherBulkDelete {
|
type VoucherBulkDelete {
|
||||||
|
@ -4721,11 +4741,13 @@ type VoucherCountableEdge {
|
||||||
|
|
||||||
type VoucherCreate {
|
type VoucherCreate {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
voucher: Voucher
|
voucher: Voucher
|
||||||
}
|
}
|
||||||
|
|
||||||
type VoucherDelete {
|
type VoucherDelete {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
voucher: Voucher
|
voucher: Voucher
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4765,6 +4787,7 @@ input VoucherInput {
|
||||||
type VoucherRemoveCatalogues {
|
type VoucherRemoveCatalogues {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
voucher: Voucher
|
voucher: Voucher
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
enum VoucherSortField {
|
enum VoucherSortField {
|
||||||
|
@ -4808,6 +4831,7 @@ enum VoucherTypeEnum {
|
||||||
|
|
||||||
type VoucherUpdate {
|
type VoucherUpdate {
|
||||||
errors: [Error!]!
|
errors: [Error!]!
|
||||||
|
discountErrors: [DiscountError!]!
|
||||||
voucher: Voucher
|
voucher: Voucher
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,13 +38,20 @@ import { VoucherCreate, VoucherCreateVariables } from "./types/VoucherCreate";
|
||||||
import { VoucherDelete, VoucherDeleteVariables } from "./types/VoucherDelete";
|
import { VoucherDelete, VoucherDeleteVariables } from "./types/VoucherDelete";
|
||||||
import { VoucherUpdate, VoucherUpdateVariables } from "./types/VoucherUpdate";
|
import { VoucherUpdate, VoucherUpdateVariables } from "./types/VoucherUpdate";
|
||||||
|
|
||||||
|
const discountErrorFragment = gql`
|
||||||
|
fragment DiscountErrorFragment on DiscountError {
|
||||||
|
code
|
||||||
|
field
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const saleUpdate = gql`
|
const saleUpdate = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
${saleFragment}
|
${saleFragment}
|
||||||
mutation SaleUpdate($input: SaleInput!, $id: ID!) {
|
mutation SaleUpdate($input: SaleInput!, $id: ID!) {
|
||||||
saleUpdate(id: $id, input: $input) {
|
saleUpdate(id: $id, input: $input) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
sale {
|
sale {
|
||||||
...SaleFragment
|
...SaleFragment
|
||||||
|
@ -57,6 +64,7 @@ export const TypedSaleUpdate = TypedMutation<SaleUpdate, SaleUpdateVariables>(
|
||||||
);
|
);
|
||||||
|
|
||||||
const saleCataloguesAdd = gql`
|
const saleCataloguesAdd = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
${saleDetailsFragment}
|
${saleDetailsFragment}
|
||||||
mutation SaleCataloguesAdd(
|
mutation SaleCataloguesAdd(
|
||||||
$input: CatalogueInput!
|
$input: CatalogueInput!
|
||||||
|
@ -67,9 +75,8 @@ const saleCataloguesAdd = gql`
|
||||||
$last: Int
|
$last: Int
|
||||||
) {
|
) {
|
||||||
saleCataloguesAdd(id: $id, input: $input) {
|
saleCataloguesAdd(id: $id, input: $input) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
sale {
|
sale {
|
||||||
...SaleDetailsFragment
|
...SaleDetailsFragment
|
||||||
|
@ -83,6 +90,7 @@ export const TypedSaleCataloguesAdd = TypedMutation<
|
||||||
>(saleCataloguesAdd);
|
>(saleCataloguesAdd);
|
||||||
|
|
||||||
const saleCataloguesRemove = gql`
|
const saleCataloguesRemove = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
${saleDetailsFragment}
|
${saleDetailsFragment}
|
||||||
mutation SaleCataloguesRemove(
|
mutation SaleCataloguesRemove(
|
||||||
$input: CatalogueInput!
|
$input: CatalogueInput!
|
||||||
|
@ -93,9 +101,8 @@ const saleCataloguesRemove = gql`
|
||||||
$last: Int
|
$last: Int
|
||||||
) {
|
) {
|
||||||
saleCataloguesRemove(id: $id, input: $input) {
|
saleCataloguesRemove(id: $id, input: $input) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
sale {
|
sale {
|
||||||
...SaleDetailsFragment
|
...SaleDetailsFragment
|
||||||
|
@ -109,12 +116,12 @@ export const TypedSaleCataloguesRemove = TypedMutation<
|
||||||
>(saleCataloguesRemove);
|
>(saleCataloguesRemove);
|
||||||
|
|
||||||
const saleCreate = gql`
|
const saleCreate = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
${saleFragment}
|
${saleFragment}
|
||||||
mutation SaleCreate($input: SaleInput!) {
|
mutation SaleCreate($input: SaleInput!) {
|
||||||
saleCreate(input: $input) {
|
saleCreate(input: $input) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
sale {
|
sale {
|
||||||
...SaleFragment
|
...SaleFragment
|
||||||
|
@ -127,11 +134,11 @@ export const TypedSaleCreate = TypedMutation<SaleCreate, SaleCreateVariables>(
|
||||||
);
|
);
|
||||||
|
|
||||||
const saleDelete = gql`
|
const saleDelete = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
mutation SaleDelete($id: ID!) {
|
mutation SaleDelete($id: ID!) {
|
||||||
saleDelete(id: $id) {
|
saleDelete(id: $id) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,12 +163,12 @@ export const TypedSaleBulkDelete = TypedMutation<
|
||||||
>(saleBulkDelete);
|
>(saleBulkDelete);
|
||||||
|
|
||||||
const voucherUpdate = gql`
|
const voucherUpdate = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
${voucherFragment}
|
${voucherFragment}
|
||||||
mutation VoucherUpdate($input: VoucherInput!, $id: ID!) {
|
mutation VoucherUpdate($input: VoucherInput!, $id: ID!) {
|
||||||
voucherUpdate(id: $id, input: $input) {
|
voucherUpdate(id: $id, input: $input) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
voucher {
|
voucher {
|
||||||
...VoucherFragment
|
...VoucherFragment
|
||||||
|
@ -175,6 +182,7 @@ export const TypedVoucherUpdate = TypedMutation<
|
||||||
>(voucherUpdate);
|
>(voucherUpdate);
|
||||||
|
|
||||||
const voucherCataloguesAdd = gql`
|
const voucherCataloguesAdd = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
${voucherDetailsFragment}
|
${voucherDetailsFragment}
|
||||||
mutation VoucherCataloguesAdd(
|
mutation VoucherCataloguesAdd(
|
||||||
$input: CatalogueInput!
|
$input: CatalogueInput!
|
||||||
|
@ -185,9 +193,8 @@ const voucherCataloguesAdd = gql`
|
||||||
$last: Int
|
$last: Int
|
||||||
) {
|
) {
|
||||||
voucherCataloguesAdd(id: $id, input: $input) {
|
voucherCataloguesAdd(id: $id, input: $input) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
voucher {
|
voucher {
|
||||||
...VoucherDetailsFragment
|
...VoucherDetailsFragment
|
||||||
|
@ -201,6 +208,7 @@ export const TypedVoucherCataloguesAdd = TypedMutation<
|
||||||
>(voucherCataloguesAdd);
|
>(voucherCataloguesAdd);
|
||||||
|
|
||||||
const voucherCataloguesRemove = gql`
|
const voucherCataloguesRemove = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
${voucherDetailsFragment}
|
${voucherDetailsFragment}
|
||||||
mutation VoucherCataloguesRemove(
|
mutation VoucherCataloguesRemove(
|
||||||
$input: CatalogueInput!
|
$input: CatalogueInput!
|
||||||
|
@ -211,9 +219,8 @@ const voucherCataloguesRemove = gql`
|
||||||
$last: Int
|
$last: Int
|
||||||
) {
|
) {
|
||||||
voucherCataloguesRemove(id: $id, input: $input) {
|
voucherCataloguesRemove(id: $id, input: $input) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
voucher {
|
voucher {
|
||||||
...VoucherDetailsFragment
|
...VoucherDetailsFragment
|
||||||
|
@ -227,12 +234,12 @@ export const TypedVoucherCataloguesRemove = TypedMutation<
|
||||||
>(voucherCataloguesRemove);
|
>(voucherCataloguesRemove);
|
||||||
|
|
||||||
const voucherCreate = gql`
|
const voucherCreate = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
${voucherFragment}
|
${voucherFragment}
|
||||||
mutation VoucherCreate($input: VoucherInput!) {
|
mutation VoucherCreate($input: VoucherInput!) {
|
||||||
voucherCreate(input: $input) {
|
voucherCreate(input: $input) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
voucher {
|
voucher {
|
||||||
...VoucherFragment
|
...VoucherFragment
|
||||||
|
@ -246,11 +253,11 @@ export const TypedVoucherCreate = TypedMutation<
|
||||||
>(voucherCreate);
|
>(voucherCreate);
|
||||||
|
|
||||||
const voucherDelete = gql`
|
const voucherDelete = gql`
|
||||||
|
${discountErrorFragment}
|
||||||
mutation VoucherDelete($id: ID!) {
|
mutation VoucherDelete($id: ID!) {
|
||||||
voucherDelete(id: $id) {
|
voucherDelete(id: $id) {
|
||||||
errors {
|
errors: discountErrors {
|
||||||
field
|
...DiscountErrorFragment
|
||||||
message
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
src/discounts/types/DiscountErrorFragment.ts
Normal file
15
src/discounts/types/DiscountErrorFragment.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
import { DiscountErrorCode } from "./../../types/globalTypes";
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL fragment: DiscountErrorFragment
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface DiscountErrorFragment {
|
||||||
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
|
field: string | null;
|
||||||
|
}
|
|
@ -2,16 +2,16 @@
|
||||||
/* 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 { CatalogueInput, SaleType } from "./../../types/globalTypes";
|
import { CatalogueInput, DiscountErrorCode, SaleType } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: SaleCataloguesAdd
|
// GraphQL mutation operation: SaleCataloguesAdd
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface SaleCataloguesAdd_saleCataloguesAdd_errors {
|
export interface SaleCataloguesAdd_saleCataloguesAdd_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaleCataloguesAdd_saleCataloguesAdd_sale_products_edges_node_productType {
|
export interface SaleCataloguesAdd_saleCataloguesAdd_sale_products_edges_node_productType {
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
/* 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 { CatalogueInput, SaleType } from "./../../types/globalTypes";
|
import { CatalogueInput, DiscountErrorCode, SaleType } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: SaleCataloguesRemove
|
// GraphQL mutation operation: SaleCataloguesRemove
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface SaleCataloguesRemove_saleCataloguesRemove_errors {
|
export interface SaleCataloguesRemove_saleCataloguesRemove_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaleCataloguesRemove_saleCataloguesRemove_sale_products_edges_node_productType {
|
export interface SaleCataloguesRemove_saleCataloguesRemove_sale_products_edges_node_productType {
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
/* 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 { SaleInput, SaleType } from "./../../types/globalTypes";
|
import { SaleInput, DiscountErrorCode, SaleType } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: SaleCreate
|
// GraphQL mutation operation: SaleCreate
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface SaleCreate_saleCreate_errors {
|
export interface SaleCreate_saleCreate_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaleCreate_saleCreate_sale {
|
export interface SaleCreate_saleCreate_sale {
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
/* 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 { DiscountErrorCode } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: SaleDelete
|
// GraphQL mutation operation: SaleDelete
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface SaleDelete_saleDelete_errors {
|
export interface SaleDelete_saleDelete_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaleDelete_saleDelete {
|
export interface SaleDelete_saleDelete {
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
/* 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 { SaleInput, SaleType } from "./../../types/globalTypes";
|
import { SaleInput, DiscountErrorCode, SaleType } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: SaleUpdate
|
// GraphQL mutation operation: SaleUpdate
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface SaleUpdate_saleUpdate_errors {
|
export interface SaleUpdate_saleUpdate_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaleUpdate_saleUpdate_sale {
|
export interface SaleUpdate_saleUpdate_sale {
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
/* 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 { CatalogueInput, DiscountValueTypeEnum, VoucherTypeEnum } from "./../../types/globalTypes";
|
import { CatalogueInput, DiscountErrorCode, DiscountValueTypeEnum, VoucherTypeEnum } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: VoucherCataloguesAdd
|
// GraphQL mutation operation: VoucherCataloguesAdd
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface VoucherCataloguesAdd_voucherCataloguesAdd_errors {
|
export interface VoucherCataloguesAdd_voucherCataloguesAdd_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VoucherCataloguesAdd_voucherCataloguesAdd_voucher_countries {
|
export interface VoucherCataloguesAdd_voucherCataloguesAdd_voucher_countries {
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
/* 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 { CatalogueInput, DiscountValueTypeEnum, VoucherTypeEnum } from "./../../types/globalTypes";
|
import { CatalogueInput, DiscountErrorCode, DiscountValueTypeEnum, VoucherTypeEnum } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: VoucherCataloguesRemove
|
// GraphQL mutation operation: VoucherCataloguesRemove
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface VoucherCataloguesRemove_voucherCataloguesRemove_errors {
|
export interface VoucherCataloguesRemove_voucherCataloguesRemove_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VoucherCataloguesRemove_voucherCataloguesRemove_voucher_countries {
|
export interface VoucherCataloguesRemove_voucherCataloguesRemove_voucher_countries {
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
/* 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 { VoucherInput, DiscountValueTypeEnum } from "./../../types/globalTypes";
|
import { VoucherInput, DiscountErrorCode, DiscountValueTypeEnum } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: VoucherCreate
|
// GraphQL mutation operation: VoucherCreate
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface VoucherCreate_voucherCreate_errors {
|
export interface VoucherCreate_voucherCreate_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VoucherCreate_voucherCreate_voucher_countries {
|
export interface VoucherCreate_voucherCreate_voucher_countries {
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
/* 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 { DiscountErrorCode } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: VoucherDelete
|
// GraphQL mutation operation: VoucherDelete
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface VoucherDelete_voucherDelete_errors {
|
export interface VoucherDelete_voucherDelete_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VoucherDelete_voucherDelete {
|
export interface VoucherDelete_voucherDelete {
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
/* 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 { VoucherInput, DiscountValueTypeEnum } from "./../../types/globalTypes";
|
import { VoucherInput, DiscountErrorCode, DiscountValueTypeEnum } from "./../../types/globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL mutation operation: VoucherUpdate
|
// GraphQL mutation operation: VoucherUpdate
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface VoucherUpdate_voucherUpdate_errors {
|
export interface VoucherUpdate_voucherUpdate_errors {
|
||||||
__typename: "Error";
|
__typename: "DiscountError";
|
||||||
|
code: DiscountErrorCode;
|
||||||
field: string | null;
|
field: string | null;
|
||||||
message: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VoucherUpdate_voucherUpdate_voucher_countries {
|
export interface VoucherUpdate_voucherUpdate_voucher_countries {
|
||||||
|
|
|
@ -346,6 +346,14 @@ export enum CountryCode {
|
||||||
ZW = "ZW",
|
ZW = "ZW",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum DiscountErrorCode {
|
||||||
|
ALREADY_EXISTS = "ALREADY_EXISTS",
|
||||||
|
INVALID = "INVALID",
|
||||||
|
NOT_FOUND = "NOT_FOUND",
|
||||||
|
REQUIRED = "REQUIRED",
|
||||||
|
UNIQUE = "UNIQUE",
|
||||||
|
}
|
||||||
|
|
||||||
export enum DiscountStatusEnum {
|
export enum DiscountStatusEnum {
|
||||||
ACTIVE = "ACTIVE",
|
ACTIVE = "ACTIVE",
|
||||||
EXPIRED = "EXPIRED",
|
EXPIRED = "EXPIRED",
|
||||||
|
|
35
src/utils/errors/discounts.ts
Normal file
35
src/utils/errors/discounts.ts
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { IntlShape, defineMessages } from "react-intl";
|
||||||
|
|
||||||
|
import { DiscountErrorFragment } from "@saleor/discounts/types/DiscountErrorFragment";
|
||||||
|
import { DiscountErrorCode } from "@saleor/types/globalTypes";
|
||||||
|
import { commonMessages } from "@saleor/intl";
|
||||||
|
import commonErrorMessages from "./common";
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
alreadyExists: {
|
||||||
|
defaultMessage: "Promo code already exists",
|
||||||
|
description: "error message"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function getDiscountErrorMessage(
|
||||||
|
err: Omit<DiscountErrorFragment, "__typename"> | undefined,
|
||||||
|
intl: IntlShape
|
||||||
|
): string {
|
||||||
|
if (err) {
|
||||||
|
switch (err.code) {
|
||||||
|
case DiscountErrorCode.ALREADY_EXISTS:
|
||||||
|
return intl.formatMessage(messages.alreadyExists);
|
||||||
|
case DiscountErrorCode.REQUIRED:
|
||||||
|
return intl.formatMessage(commonMessages.requiredField);
|
||||||
|
case DiscountErrorCode.INVALID:
|
||||||
|
return intl.formatMessage(commonErrorMessages.invalid);
|
||||||
|
default:
|
||||||
|
return intl.formatMessage(commonErrorMessages.unknownError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getDiscountErrorMessage;
|
Loading…
Reference in a new issue