From 24609a544ef03744671ae29bae6f175a025ac90c Mon Sep 17 00:00:00 2001 From: Piotr Grundas Date: Tue, 13 Apr 2021 19:29:44 +0200 Subject: [PATCH 01/11] Update schema, types --- package-lock.json | 6 - schema.graphql | 2374 ++++------------- .../ProductExportDialogInfo.tsx | 4 +- .../ProductExportDialog/messages.ts | 4 +- src/types/globalTypes.ts | 41 +- 5 files changed, 535 insertions(+), 1894 deletions(-) diff --git a/package-lock.json b/package-lock.json index fc6252ca779..106da3fe4b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2754,7 +2754,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -2800,7 +2799,6 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, - "optional": true, "requires": { "kind-of": "^3.0.2" } @@ -2810,7 +2808,6 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, - "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -26053,7 +26050,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -26099,7 +26095,6 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, - "optional": true, "requires": { "kind-of": "^3.0.2" } @@ -26109,7 +26104,6 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, - "optional": true, "requires": { "is-buffer": "^1.1.5" } diff --git a/schema.graphql b/schema.graphql index 2ef3ed22b98..34c789e4bf9 100644 --- a/schema.graphql +++ b/schema.graphql @@ -4,40 +4,28 @@ schema { } type AccountAddressCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! address: Address } type AccountAddressDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! address: Address } type AccountAddressUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! address: Address } type AccountDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") accountErrors: [AccountError!]! user: User } @@ -90,10 +78,7 @@ input AccountInput { } type AccountRegister { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") requiresConfirmation: Boolean accountErrors: [AccountError!]! user: User @@ -107,27 +92,18 @@ input AccountRegisterInput { } type AccountRequestDeletion { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") accountErrors: [AccountError!]! } type AccountSetDefaultAddress { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! } type AccountUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") accountErrors: [AccountError!]! user: User } @@ -150,20 +126,14 @@ type Address implements Node { } type AddressCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! address: Address } type AddressDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! address: Address @@ -184,10 +154,7 @@ input AddressInput { } type AddressSetDefault { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! } @@ -198,10 +165,7 @@ enum AddressTypeEnum { } type AddressUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! address: Address @@ -256,10 +220,7 @@ type App implements Node & ObjectWithMetadata { } type AppActivate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") appErrors: [AppError!]! app: App } @@ -276,38 +237,26 @@ type AppCountableEdge { } type AppCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") authToken: String appErrors: [AppError!]! app: App } type AppDeactivate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") appErrors: [AppError!]! app: App } type AppDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") appErrors: [AppError!]! app: App } type AppDeleteFailedInstallation { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") appErrors: [AppError!]! appInstallation: AppInstallation } @@ -336,10 +285,7 @@ enum AppErrorCode { } type AppFetchManifest { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") manifest: Manifest appErrors: [AppError!]! } @@ -357,10 +303,7 @@ input AppInput { } type AppInstall { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") appErrors: [AppError!]! appInstallation: AppInstallation } @@ -383,10 +326,7 @@ type AppInstallation implements Node & Job { } type AppRetryInstall { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") appErrors: [AppError!]! appInstallation: AppInstallation } @@ -408,20 +348,14 @@ type AppToken implements Node { } type AppTokenCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") authToken: String appErrors: [AppError!]! appToken: AppToken } type AppTokenDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") appErrors: [AppError!]! appToken: AppToken } @@ -432,10 +366,7 @@ input AppTokenInput { } type AppTokenVerify { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") valid: Boolean! appErrors: [AppError!]! } @@ -446,37 +377,30 @@ enum AppTypeEnum { } type AppUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") appErrors: [AppError!]! app: App } +enum AreaUnitsEnum { + SQ_CM + SQ_M + SQ_KM + SQ_FT + SQ_YD + SQ_INCH +} + type AssignNavigation { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") menu: Menu menuErrors: [MenuError!]! } type Attribute implements Node & ObjectWithMetadata { id: ID! - productTypes( - before: String - after: String - first: Int - last: Int - ): ProductTypeCountableConnection! - productVariantTypes( - before: String - after: String - first: Int - last: Int - ): ProductTypeCountableConnection! + productTypes(before: String, after: String, first: Int, last: Int): ProductTypeCountableConnection! + productVariantTypes(before: String, after: String, first: Int, last: Int): ProductTypeCountableConnection! privateMetadata: [MetadataItem]! metadata: [MetadataItem]! inputType: AttributeInputTypeEnum @@ -484,6 +408,7 @@ type Attribute implements Node & ObjectWithMetadata { name: String slug: String type: AttributeTypeEnum + unit: MeasurementUnitsEnum values: [AttributeValue] valueRequired: Boolean! visibleInStorefront: Boolean! @@ -495,10 +420,7 @@ type Attribute implements Node & ObjectWithMetadata { } type AttributeBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! attributeErrors: [AttributeError!]! } @@ -515,10 +437,7 @@ type AttributeCountableEdge { } type AttributeCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") attribute: Attribute attributeErrors: [AttributeError!]! } @@ -529,6 +448,7 @@ input AttributeCreateInput { name: String! slug: String type: AttributeTypeEnum! + unit: MeasurementUnitsEnum values: [AttributeValueCreateInput] valueRequired: Boolean isVariantOnly: Boolean @@ -540,10 +460,7 @@ input AttributeCreateInput { } type AttributeDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") attributeErrors: [AttributeError!]! attribute: Attribute } @@ -586,8 +503,8 @@ input AttributeFilterInput { input AttributeInput { slug: String! - value: String values: [String] + valuesRange: IntRangeInput } enum AttributeInputTypeEnum { @@ -595,14 +512,12 @@ enum AttributeInputTypeEnum { MULTISELECT FILE REFERENCE + NUMERIC RICH_TEXT } type AttributeReorderValues { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") attribute: Attribute attributeErrors: [AttributeError!]! } @@ -632,10 +547,7 @@ type AttributeTranslatableContent implements Node { } type AttributeTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! attribute: Attribute } @@ -652,10 +564,7 @@ enum AttributeTypeEnum { } type AttributeUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") attribute: Attribute attributeErrors: [AttributeError!]! } @@ -687,19 +596,13 @@ type AttributeValue implements Node { } type AttributeValueBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! attributeErrors: [AttributeError!]! } type AttributeValueCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") attribute: Attribute attributeErrors: [AttributeError!]! attributeValue: AttributeValue @@ -712,10 +615,7 @@ input AttributeValueCreateInput { } type AttributeValueDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") attribute: Attribute attributeErrors: [AttributeError!]! attributeValue: AttributeValue @@ -738,10 +638,7 @@ type AttributeValueTranslatableContent implements Node { } type AttributeValueTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! attributeValue: AttributeValue } @@ -759,10 +656,7 @@ input AttributeValueTranslationInput { } type AttributeValueUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") attribute: Attribute attributeErrors: [AttributeError!]! attributeValue: AttributeValue @@ -810,40 +704,17 @@ type Category implements Node & ObjectWithMetadata { level: Int! privateMetadata: [MetadataItem]! metadata: [MetadataItem]! - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) - ancestors( - before: String - after: String - first: Int - last: Int - ): CategoryCountableConnection - products( - channel: String - before: String - after: String - first: Int - last: Int - ): ProductCountableConnection - url: String - @deprecated(reason: "This field will be removed after 2020-07-31.") - children( - before: String - after: String - first: Int - last: Int - ): CategoryCountableConnection + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") + ancestors(before: String, after: String, first: Int, last: Int): CategoryCountableConnection + products(channel: String, before: String, after: String, first: Int, last: Int): ProductCountableConnection + url: String @deprecated(reason: "This field will be removed after 2020-07-31.") + children(before: String, after: String, first: Int, last: Int): CategoryCountableConnection backgroundImage(size: Int): Image translation(languageCode: LanguageCodeEnum!): CategoryTranslation } type CategoryBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! productErrors: [ProductError!]! } @@ -860,19 +731,13 @@ type CategoryCountableEdge { } type CategoryCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! category: Category } type CategoryDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! category: Category } @@ -910,19 +775,13 @@ type CategoryTranslatableContent implements Node { id: ID! name: String! description: JSONString - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") translation(languageCode: LanguageCodeEnum!): CategoryTranslation category: Category } type CategoryTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! category: Category } @@ -934,17 +793,11 @@ type CategoryTranslation implements Node { name: String! description: JSONString language: LanguageDisplay! - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") } type CategoryUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! category: Category } @@ -959,19 +812,13 @@ type Channel implements Node { } type ChannelActivate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") channel: Channel channelErrors: [ChannelError!]! } type ChannelCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") channelErrors: [ChannelError!]! channel: Channel } @@ -984,19 +831,13 @@ input ChannelCreateInput { } type ChannelDeactivate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") channel: Channel channelErrors: [ChannelError!]! } type ChannelDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") channelErrors: [ChannelError!]! channel: Channel } @@ -1024,10 +865,7 @@ enum ChannelErrorCode { } type ChannelUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") channelErrors: [ChannelError!]! channel: Channel } @@ -1069,28 +907,19 @@ type Checkout implements Node & ObjectWithMetadata { } type CheckoutAddPromoCode { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } type CheckoutBillingAddressUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } type CheckoutComplete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order confirmationNeeded: Boolean! confirmationData: JSONString @@ -1109,10 +938,7 @@ type CheckoutCountableEdge { } type CheckoutCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") created: Boolean checkoutErrors: [CheckoutError!]! checkout: Checkout @@ -1128,28 +954,19 @@ input CheckoutCreateInput { } type CheckoutCustomerAttach { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } type CheckoutCustomerDetach { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } type CheckoutEmailUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } @@ -1187,10 +1004,7 @@ enum CheckoutErrorCode { } type CheckoutLanguageCodeUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } @@ -1215,10 +1029,7 @@ type CheckoutLineCountableEdge { } type CheckoutLineDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } @@ -1229,56 +1040,38 @@ input CheckoutLineInput { } type CheckoutLinesAdd { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } type CheckoutLinesUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } type CheckoutPaymentCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout payment: Payment paymentErrors: [PaymentError!]! } type CheckoutRemovePromoCode { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } type CheckoutShippingAddressUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } type CheckoutShippingMethodUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") checkout: Checkout checkoutErrors: [CheckoutError!]! } @@ -1297,37 +1090,21 @@ type Collection implements Node & ObjectWithMetadata { slug: String! privateMetadata: [MetadataItem]! metadata: [MetadataItem]! - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) - products( - filter: ProductFilterInput - sortBy: ProductOrder - before: String - after: String - first: Int - last: Int - ): ProductCountableConnection + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") + products(filter: ProductFilterInput, sortBy: ProductOrder, before: String, after: String, first: Int, last: Int): ProductCountableConnection backgroundImage(size: Int): Image translation(languageCode: LanguageCodeEnum!): CollectionTranslation channelListings: [CollectionChannelListing!] } type CollectionAddProducts { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") collection: Collection collectionErrors: [CollectionError!]! } type CollectionBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! collectionErrors: [CollectionError!]! } @@ -1349,10 +1126,7 @@ type CollectionChannelListingError { } type CollectionChannelListingUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") collection: Collection collectionChannelListingErrors: [CollectionChannelListingError!]! } @@ -1374,10 +1148,7 @@ type CollectionCountableEdge { } type CollectionCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") collectionErrors: [CollectionError!]! collection: Collection } @@ -1395,10 +1166,7 @@ input CollectionCreateInput { } type CollectionDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") collectionErrors: [CollectionError!]! collection: Collection } @@ -1445,19 +1213,13 @@ enum CollectionPublished { } type CollectionRemoveProducts { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") collection: Collection collectionErrors: [CollectionError!]! } type CollectionReorderProducts { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") collection: Collection collectionErrors: [CollectionError!]! } @@ -1481,19 +1243,13 @@ type CollectionTranslatableContent implements Node { id: ID! name: String! description: JSONString - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") translation(languageCode: LanguageCodeEnum!): CollectionTranslation collection: Collection } type CollectionTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! collection: Collection } @@ -1505,17 +1261,11 @@ type CollectionTranslation implements Node { name: String! description: JSONString language: LanguageDisplay! - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") } type CollectionUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") collectionErrors: [CollectionError!]! collection: Collection } @@ -1543,19 +1293,13 @@ enum ConfigurationTypeFieldEnum { } type ConfirmAccount { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! } type ConfirmEmailChange { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! } @@ -1820,10 +1564,7 @@ type CountryDisplay { } type CreateToken { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") token: String refreshToken: String csrfToken: String @@ -1840,28 +1581,19 @@ type CreditCard { } type CustomerBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! accountErrors: [AccountError!]! } type CustomerCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") accountErrors: [AccountError!]! user: User } type CustomerDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") accountErrors: [AccountError!]! user: User } @@ -1912,10 +1644,7 @@ input CustomerInput { } type CustomerUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") accountErrors: [AccountError!]! user: User } @@ -1935,27 +1664,18 @@ input DateTimeRangeInput { } type DeactivateAllUserTokens { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") accountErrors: [AccountError!]! } type DeleteMetadata { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") metadataErrors: [MetadataError!]! item: ObjectWithMetadata } type DeletePrivateMetadata { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") metadataErrors: [MetadataError!]! item: ObjectWithMetadata } @@ -1985,20 +1705,14 @@ type DigitalContentCountableEdge { } type DigitalContentCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") variant: ProductVariant content: DigitalContent productErrors: [ProductError!]! } type DigitalContentDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") variant: ProductVariant productErrors: [ProductError!]! } @@ -2011,10 +1725,7 @@ input DigitalContentInput { } type DigitalContentUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") variant: ProductVariant content: DigitalContent productErrors: [ProductError!]! @@ -2038,10 +1749,7 @@ type DigitalContentUrl implements Node { } type DigitalContentUrlCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! digitalContentUrl: DigitalContentUrl } @@ -2080,6 +1788,15 @@ enum DiscountValueTypeEnum { PERCENTAGE } +enum DistanceUnitsEnum { + CM + M + KM + FT + YD + INCH +} + type Domain { host: String! sslEnabled: Boolean! @@ -2087,28 +1804,19 @@ type Domain { } type DraftOrderBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! orderErrors: [OrderError!]! } type DraftOrderComplete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } type DraftOrderCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") orderErrors: [OrderError!]! order: Order } @@ -2128,10 +1836,7 @@ input DraftOrderCreateInput { } type DraftOrderDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") orderErrors: [OrderError!]! order: Order } @@ -2150,19 +1855,13 @@ input DraftOrderInput { } type DraftOrderLinesBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! orderErrors: [OrderError!]! } type DraftOrderUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") orderErrors: [OrderError!]! order: Order } @@ -2252,10 +1951,7 @@ input ExportInfoInput { } type ExportProducts { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") exportFile: ExportFile exportErrors: [ExportError!]! } @@ -2280,28 +1976,19 @@ type ExternalAuthentication { } type ExternalAuthenticationUrl { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") authenticationData: JSONString accountErrors: [AccountError!]! } type ExternalLogout { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") logoutData: JSONString accountErrors: [AccountError!]! } type ExternalObtainAccessTokens { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") token: String refreshToken: String csrfToken: String @@ -2310,10 +1997,7 @@ type ExternalObtainAccessTokens { } type ExternalRefresh { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") token: String refreshToken: String csrfToken: String @@ -2322,10 +2006,7 @@ type ExternalRefresh { } type ExternalVerify { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User isValid: Boolean! verifyData: JSONString @@ -2343,10 +2024,7 @@ enum FileTypesEnum { } type FileUpload { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") uploadedFile: File uploadErrors: [UploadError!]! } @@ -2365,10 +2043,7 @@ type Fulfillment implements Node & ObjectWithMetadata { } type FulfillmentCancel { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") fulfillment: Fulfillment order: Order orderErrors: [OrderError!]! @@ -2385,20 +2060,14 @@ type FulfillmentLine implements Node { } type FulfillmentRefundProducts { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") fulfillment: Fulfillment order: Order orderErrors: [OrderError!]! } type FulfillmentReturnProducts { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") returnFulfillment: Fulfillment replaceFulfillment: Fulfillment order: Order @@ -2416,10 +2085,7 @@ enum FulfillmentStatus { } type FulfillmentUpdateTracking { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") fulfillment: Fulfillment order: Order orderErrors: [OrderError!]! @@ -2452,10 +2118,7 @@ type GiftCard implements Node { } type GiftCardActivate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") giftCard: GiftCard giftCardErrors: [GiftCardError!]! } @@ -2472,10 +2135,7 @@ type GiftCardCountableEdge { } type GiftCardCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") giftCardErrors: [GiftCardError!]! giftCard: GiftCard } @@ -2489,10 +2149,7 @@ input GiftCardCreateInput { } type GiftCardDeactivate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") giftCard: GiftCard giftCardErrors: [GiftCardError!]! } @@ -2513,10 +2170,7 @@ enum GiftCardErrorCode { } type GiftCardUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") giftCardErrors: [GiftCardError!]! giftCard: GiftCard } @@ -2571,10 +2225,7 @@ type Invoice implements ObjectWithMetadata & Job & Node { } type InvoiceCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") invoiceErrors: [InvoiceError!]! invoice: Invoice } @@ -2585,10 +2236,7 @@ input InvoiceCreateInput { } type InvoiceDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") invoiceErrors: [InvoiceError!]! invoice: Invoice } @@ -2610,38 +2258,26 @@ enum InvoiceErrorCode { } type InvoiceRequest { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order invoiceErrors: [InvoiceError!]! invoice: Invoice } type InvoiceRequestDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") invoiceErrors: [InvoiceError!]! invoice: Invoice } type InvoiceSendNotification { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") invoiceErrors: [InvoiceError!]! invoice: Invoice } type InvoiceUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") invoiceErrors: [InvoiceError!]! invoice: Invoice } @@ -2752,6 +2388,38 @@ type Margin { stop: Int } +enum MeasurementUnitsEnum { + CM + M + KM + FT + YD + INCH + SQ_CM + SQ_M + SQ_KM + SQ_FT + SQ_YD + SQ_INCH + CUBIC_MILLIMETER + CUBIC_CENTIMETER + CUBIC_DECIMETER + CUBIC_METER + LITER + CUBIC_FOOT + CUBIC_INCH + CUBIC_YARD + QT + PINT + OZ + ACRE_IN + ACRE_FT + G + LB + KG + TONNE +} + type Menu implements Node & ObjectWithMetadata { id: ID! name: String! @@ -2762,10 +2430,7 @@ type Menu implements Node & ObjectWithMetadata { } type MenuBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! menuErrors: [MenuError!]! } @@ -2782,10 +2447,7 @@ type MenuCountableEdge { } type MenuCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") menuErrors: [MenuError!]! menu: Menu } @@ -2797,10 +2459,7 @@ input MenuCreateInput { } type MenuDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") menuErrors: [MenuError!]! menu: Menu } @@ -2851,10 +2510,7 @@ type MenuItem implements Node & ObjectWithMetadata { } type MenuItemBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! menuErrors: [MenuError!]! } @@ -2871,10 +2527,7 @@ type MenuItemCountableEdge { } type MenuItemCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") menuErrors: [MenuError!]! menuItem: MenuItem } @@ -2890,10 +2543,7 @@ input MenuItemCreateInput { } type MenuItemDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") menuErrors: [MenuError!]! menuItem: MenuItem } @@ -2912,10 +2562,7 @@ input MenuItemInput { } type MenuItemMove { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") menu: Menu menuErrors: [MenuError!]! } @@ -2939,10 +2586,7 @@ type MenuItemTranslatableContent implements Node { } type MenuItemTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! menuItem: MenuItem } @@ -2954,10 +2598,7 @@ type MenuItemTranslation implements Node { } type MenuItemUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") menuErrors: [MenuError!]! menuItem: MenuItem } @@ -2977,10 +2618,7 @@ input MenuSortingInput { } type MenuUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") menuErrors: [MenuError!]! menu: Menu } @@ -3011,10 +2649,7 @@ type MetadataItem { type Money { currency: String! amount: Float! - localized: String! - @deprecated( - reason: "Price formatting according to the current locale should be handled by the frontend client. This field will be removed after 2020-07-31." - ) + localized: String! @deprecated(reason: "Price formatting according to the current locale should be handled by the frontend client. This field will be removed after 2020-07-31.") } type MoneyRange { @@ -3034,233 +2669,99 @@ type Mutation { createWarehouse(input: WarehouseCreateInput!): WarehouseCreate updateWarehouse(id: ID!, input: WarehouseUpdateInput!): WarehouseUpdate deleteWarehouse(id: ID!): WarehouseDelete - assignWarehouseShippingZone( - id: ID! - shippingZoneIds: [ID!]! - ): WarehouseShippingZoneAssign - unassignWarehouseShippingZone( - id: ID! - shippingZoneIds: [ID!]! - ): WarehouseShippingZoneUnassign - staffNotificationRecipientCreate( - input: StaffNotificationRecipientInput! - ): StaffNotificationRecipientCreate - staffNotificationRecipientUpdate( - id: ID! - input: StaffNotificationRecipientInput! - ): StaffNotificationRecipientUpdate + assignWarehouseShippingZone(id: ID!, shippingZoneIds: [ID!]!): WarehouseShippingZoneAssign + unassignWarehouseShippingZone(id: ID!, shippingZoneIds: [ID!]!): WarehouseShippingZoneUnassign + staffNotificationRecipientCreate(input: StaffNotificationRecipientInput!): StaffNotificationRecipientCreate + staffNotificationRecipientUpdate(id: ID!, input: StaffNotificationRecipientInput!): StaffNotificationRecipientUpdate staffNotificationRecipientDelete(id: ID!): StaffNotificationRecipientDelete shopDomainUpdate(input: SiteDomainInput): ShopDomainUpdate shopSettingsUpdate(input: ShopSettingsInput!): ShopSettingsUpdate shopFetchTaxRates: ShopFetchTaxRates - shopSettingsTranslate( - input: ShopSettingsTranslationInput! - languageCode: LanguageCodeEnum! - ): ShopSettingsTranslate + shopSettingsTranslate(input: ShopSettingsTranslationInput!, languageCode: LanguageCodeEnum!): ShopSettingsTranslate shopAddressUpdate(input: AddressInput): ShopAddressUpdate orderSettingsUpdate(input: OrderSettingsUpdateInput!): OrderSettingsUpdate - shippingMethodChannelListingUpdate( - id: ID! - input: ShippingMethodChannelListingInput! - ): ShippingMethodChannelListingUpdate + shippingMethodChannelListingUpdate(id: ID!, input: ShippingMethodChannelListingInput!): ShippingMethodChannelListingUpdate shippingPriceCreate(input: ShippingPriceInput!): ShippingPriceCreate shippingPriceDelete(id: ID!): ShippingPriceDelete shippingPriceBulkDelete(ids: [ID]!): ShippingPriceBulkDelete shippingPriceUpdate(id: ID!, input: ShippingPriceInput!): ShippingPriceUpdate - shippingPriceTranslate( - id: ID! - input: NameTranslationInput! - languageCode: LanguageCodeEnum! - ): ShippingPriceTranslate - shippingPriceExcludeProducts( - id: ID! - input: ShippingPriceExcludeProductsInput! - ): ShippingPriceExcludeProducts - shippingPriceRemoveProductFromExclude( - id: ID! - products: [ID]! - ): ShippingPriceRemoveProductFromExclude + shippingPriceTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): ShippingPriceTranslate + shippingPriceExcludeProducts(id: ID!, input: ShippingPriceExcludeProductsInput!): ShippingPriceExcludeProducts + shippingPriceRemoveProductFromExclude(id: ID!, products: [ID]!): ShippingPriceRemoveProductFromExclude shippingZoneCreate(input: ShippingZoneCreateInput!): ShippingZoneCreate shippingZoneDelete(id: ID!): ShippingZoneDelete shippingZoneBulkDelete(ids: [ID]!): ShippingZoneBulkDelete - shippingZoneUpdate( - id: ID! - input: ShippingZoneUpdateInput! - ): ShippingZoneUpdate - productAttributeAssign( - operations: [ProductAttributeAssignInput]! - productTypeId: ID! - ): ProductAttributeAssign - productAttributeUnassign( - attributeIds: [ID]! - productTypeId: ID! - ): ProductAttributeUnassign + shippingZoneUpdate(id: ID!, input: ShippingZoneUpdateInput!): ShippingZoneUpdate + productAttributeAssign(operations: [ProductAttributeAssignInput]!, productTypeId: ID!): ProductAttributeAssign + productAttributeUnassign(attributeIds: [ID]!, productTypeId: ID!): ProductAttributeUnassign categoryCreate(input: CategoryInput!, parent: ID): CategoryCreate categoryDelete(id: ID!): CategoryDelete categoryBulkDelete(ids: [ID]!): CategoryBulkDelete categoryUpdate(id: ID!, input: CategoryInput!): CategoryUpdate - categoryTranslate( - id: ID! - input: TranslationInput! - languageCode: LanguageCodeEnum! - ): CategoryTranslate - collectionAddProducts( - collectionId: ID! - products: [ID]! - ): CollectionAddProducts + categoryTranslate(id: ID!, input: TranslationInput!, languageCode: LanguageCodeEnum!): CategoryTranslate + collectionAddProducts(collectionId: ID!, products: [ID]!): CollectionAddProducts collectionCreate(input: CollectionCreateInput!): CollectionCreate collectionDelete(id: ID!): CollectionDelete - collectionReorderProducts( - collectionId: ID! - moves: [MoveProductInput]! - ): CollectionReorderProducts + collectionReorderProducts(collectionId: ID!, moves: [MoveProductInput]!): CollectionReorderProducts collectionBulkDelete(ids: [ID]!): CollectionBulkDelete - collectionRemoveProducts( - collectionId: ID! - products: [ID]! - ): CollectionRemoveProducts + collectionRemoveProducts(collectionId: ID!, products: [ID]!): CollectionRemoveProducts collectionUpdate(id: ID!, input: CollectionInput!): CollectionUpdate - collectionTranslate( - id: ID! - input: TranslationInput! - languageCode: LanguageCodeEnum! - ): CollectionTranslate - collectionChannelListingUpdate( - id: ID! - input: CollectionChannelListingUpdateInput! - ): CollectionChannelListingUpdate + collectionTranslate(id: ID!, input: TranslationInput!, languageCode: LanguageCodeEnum!): CollectionTranslate + collectionChannelListingUpdate(id: ID!, input: CollectionChannelListingUpdateInput!): CollectionChannelListingUpdate productCreate(input: ProductCreateInput!): ProductCreate productDelete(id: ID!): ProductDelete productBulkDelete(ids: [ID]!): ProductBulkDelete productUpdate(id: ID!, input: ProductInput!): ProductUpdate - productTranslate( - id: ID! - input: TranslationInput! - languageCode: LanguageCodeEnum! - ): ProductTranslate - productChannelListingUpdate( - id: ID! - input: ProductChannelListingUpdateInput! - ): ProductChannelListingUpdate + productTranslate(id: ID!, input: TranslationInput!, languageCode: LanguageCodeEnum!): ProductTranslate + productChannelListingUpdate(id: ID!, input: ProductChannelListingUpdateInput!): ProductChannelListingUpdate productMediaCreate(input: ProductMediaCreateInput!): ProductMediaCreate - productVariantReorder( - moves: [ReorderInput]! - productId: ID! - ): ProductVariantReorder + productVariantReorder(moves: [ReorderInput]!, productId: ID!): ProductVariantReorder productMediaDelete(id: ID!): ProductMediaDelete productMediaBulkDelete(ids: [ID]!): ProductMediaBulkDelete productMediaReorder(mediaIds: [ID]!, productId: ID!): ProductMediaReorder - productMediaUpdate( - id: ID! - input: ProductMediaUpdateInput! - ): ProductMediaUpdate + productMediaUpdate(id: ID!, input: ProductMediaUpdateInput!): ProductMediaUpdate productTypeCreate(input: ProductTypeInput!): ProductTypeCreate productTypeDelete(id: ID!): ProductTypeDelete productTypeBulkDelete(ids: [ID]!): ProductTypeBulkDelete productTypeUpdate(id: ID!, input: ProductTypeInput!): ProductTypeUpdate - productTypeReorderAttributes( - moves: [ReorderInput]! - productTypeId: ID! - type: ProductAttributeType! - ): ProductTypeReorderAttributes - productReorderAttributeValues( - attributeId: ID! - moves: [ReorderInput]! - productId: ID! - ): ProductReorderAttributeValues - digitalContentCreate( - input: DigitalContentUploadInput! - variantId: ID! - ): DigitalContentCreate + productTypeReorderAttributes(moves: [ReorderInput]!, productTypeId: ID!, type: ProductAttributeType!): ProductTypeReorderAttributes + productReorderAttributeValues(attributeId: ID!, moves: [ReorderInput]!, productId: ID!): ProductReorderAttributeValues + digitalContentCreate(input: DigitalContentUploadInput!, variantId: ID!): DigitalContentCreate digitalContentDelete(variantId: ID!): DigitalContentDelete - digitalContentUpdate( - input: DigitalContentInput! - variantId: ID! - ): DigitalContentUpdate - digitalContentUrlCreate( - input: DigitalContentUrlCreateInput! - ): DigitalContentUrlCreate + digitalContentUpdate(input: DigitalContentInput!, variantId: ID!): DigitalContentUpdate + digitalContentUrlCreate(input: DigitalContentUrlCreateInput!): DigitalContentUrlCreate productVariantCreate(input: ProductVariantCreateInput!): ProductVariantCreate productVariantDelete(id: ID!): ProductVariantDelete - productVariantBulkCreate( - product: ID! - variants: [ProductVariantBulkCreateInput]! - ): ProductVariantBulkCreate + productVariantBulkCreate(product: ID!, variants: [ProductVariantBulkCreateInput]!): ProductVariantBulkCreate productVariantBulkDelete(ids: [ID]!): ProductVariantBulkDelete - productVariantStocksCreate( - stocks: [StockInput!]! - variantId: ID! - ): ProductVariantStocksCreate - productVariantStocksDelete( - variantId: ID! - warehouseIds: [ID!] - ): ProductVariantStocksDelete - productVariantStocksUpdate( - stocks: [StockInput!]! - variantId: ID! - ): ProductVariantStocksUpdate - productVariantUpdate( - id: ID! - input: ProductVariantInput! - ): ProductVariantUpdate - productVariantSetDefault( - productId: ID! - variantId: ID! - ): ProductVariantSetDefault - productVariantTranslate( - id: ID! - input: NameTranslationInput! - languageCode: LanguageCodeEnum! - ): ProductVariantTranslate - productVariantChannelListingUpdate( - id: ID! - input: [ProductVariantChannelListingAddInput!]! - ): ProductVariantChannelListingUpdate - productVariantReorderAttributeValues( - attributeId: ID! - moves: [ReorderInput]! - variantId: ID! - ): ProductVariantReorderAttributeValues + productVariantStocksCreate(stocks: [StockInput!]!, variantId: ID!): ProductVariantStocksCreate + productVariantStocksDelete(variantId: ID!, warehouseIds: [ID!]): ProductVariantStocksDelete + productVariantStocksUpdate(stocks: [StockInput!]!, variantId: ID!): ProductVariantStocksUpdate + productVariantUpdate(id: ID!, input: ProductVariantInput!): ProductVariantUpdate + productVariantSetDefault(productId: ID!, variantId: ID!): ProductVariantSetDefault + productVariantTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): ProductVariantTranslate + productVariantChannelListingUpdate(id: ID!, input: [ProductVariantChannelListingAddInput!]!): ProductVariantChannelListingUpdate + productVariantReorderAttributeValues(attributeId: ID!, moves: [ReorderInput]!, variantId: ID!): ProductVariantReorderAttributeValues variantMediaAssign(mediaId: ID!, variantId: ID!): VariantMediaAssign variantMediaUnassign(mediaId: ID!, variantId: ID!): VariantMediaUnassign paymentCapture(amount: PositiveDecimal, paymentId: ID!): PaymentCapture paymentRefund(amount: PositiveDecimal, paymentId: ID!): PaymentRefund paymentVoid(paymentId: ID!): PaymentVoid - paymentInitialize( - gateway: String! - paymentData: JSONString - ): PaymentInitialize + paymentInitialize(gateway: String!, paymentData: JSONString): PaymentInitialize pageCreate(input: PageCreateInput!): PageCreate pageDelete(id: ID!): PageDelete pageBulkDelete(ids: [ID]!): PageBulkDelete pageBulkPublish(ids: [ID]!, isPublished: Boolean!): PageBulkPublish pageUpdate(id: ID!, input: PageInput!): PageUpdate - pageTranslate( - id: ID! - input: PageTranslationInput! - languageCode: LanguageCodeEnum! - ): PageTranslate + pageTranslate(id: ID!, input: PageTranslationInput!, languageCode: LanguageCodeEnum!): PageTranslate pageTypeCreate(input: PageTypeCreateInput!): PageTypeCreate pageTypeUpdate(id: ID, input: PageTypeUpdateInput!): PageTypeUpdate pageTypeDelete(id: ID!): PageTypeDelete pageTypeBulkDelete(ids: [ID!]!): PageTypeBulkDelete - pageAttributeAssign( - attributeIds: [ID!]! - pageTypeId: ID! - ): PageAttributeAssign - pageAttributeUnassign( - attributeIds: [ID!]! - pageTypeId: ID! - ): PageAttributeUnassign - pageTypeReorderAttributes( - moves: [ReorderInput!]! - pageTypeId: ID! - ): PageTypeReorderAttributes - pageReorderAttributeValues( - attributeId: ID! - moves: [ReorderInput]! - pageId: ID! - ): PageReorderAttributeValues + pageAttributeAssign(attributeIds: [ID!]!, pageTypeId: ID!): PageAttributeAssign + pageAttributeUnassign(attributeIds: [ID!]!, pageTypeId: ID!): PageAttributeUnassign + pageTypeReorderAttributes(moves: [ReorderInput!]!, pageTypeId: ID!): PageTypeReorderAttributes + pageReorderAttributeValues(attributeId: ID!, moves: [ReorderInput]!, pageId: ID!): PageReorderAttributeValues draftOrderComplete(id: ID!): DraftOrderComplete draftOrderCreate(input: DraftOrderCreateInput!): DraftOrderCreate draftOrderDelete(id: ID!): DraftOrderDelete @@ -3272,55 +2773,28 @@ type Mutation { orderCapture(amount: PositiveDecimal!, id: ID!): OrderCapture orderConfirm(id: ID!): OrderConfirm orderFulfill(input: OrderFulfillInput!, order: ID): OrderFulfill - orderFulfillmentCancel( - id: ID! - input: FulfillmentCancelInput! - ): FulfillmentCancel - orderFulfillmentUpdateTracking( - id: ID! - input: FulfillmentUpdateTrackingInput! - ): FulfillmentUpdateTracking - orderFulfillmentRefundProducts( - input: OrderRefundProductsInput! - order: ID! - ): FulfillmentRefundProducts - orderFulfillmentReturnProducts( - input: OrderReturnProductsInput! - order: ID! - ): FulfillmentReturnProducts + orderFulfillmentCancel(id: ID!, input: FulfillmentCancelInput!): FulfillmentCancel + orderFulfillmentUpdateTracking(id: ID!, input: FulfillmentUpdateTrackingInput!): FulfillmentUpdateTracking + orderFulfillmentRefundProducts(input: OrderRefundProductsInput!, order: ID!): FulfillmentRefundProducts + orderFulfillmentReturnProducts(input: OrderReturnProductsInput!, order: ID!): FulfillmentReturnProducts orderLinesCreate(id: ID!, input: [OrderLineCreateInput]!): OrderLinesCreate orderLineDelete(id: ID!): OrderLineDelete orderLineUpdate(id: ID!, input: OrderLineInput!): OrderLineUpdate - orderDiscountAdd( - input: OrderDiscountCommonInput! - orderId: ID! - ): OrderDiscountAdd - orderDiscountUpdate( - discountId: ID! - input: OrderDiscountCommonInput! - ): OrderDiscountUpdate + orderDiscountAdd(input: OrderDiscountCommonInput!, orderId: ID!): OrderDiscountAdd + orderDiscountUpdate(discountId: ID!, input: OrderDiscountCommonInput!): OrderDiscountUpdate orderDiscountDelete(discountId: ID!): OrderDiscountDelete - orderLineDiscountUpdate( - input: OrderDiscountCommonInput! - orderLineId: ID! - ): OrderLineDiscountUpdate + orderLineDiscountUpdate(input: OrderDiscountCommonInput!, orderLineId: ID!): OrderLineDiscountUpdate orderLineDiscountRemove(orderLineId: ID!): OrderLineDiscountRemove orderMarkAsPaid(id: ID!, transactionReference: String): OrderMarkAsPaid orderRefund(amount: PositiveDecimal!, id: ID!): OrderRefund orderUpdate(id: ID!, input: OrderUpdateInput!): OrderUpdate - orderUpdateShipping( - order: ID! - input: OrderUpdateShippingInput - ): OrderUpdateShipping + orderUpdateShipping(order: ID!, input: OrderUpdateShippingInput): OrderUpdateShipping orderVoid(id: ID!): OrderVoid orderBulkCancel(ids: [ID]!): OrderBulkCancel deleteMetadata(id: ID!, keys: [String!]!): DeleteMetadata deletePrivateMetadata(id: ID!, keys: [String!]!): DeletePrivateMetadata updateMetadata(id: ID!, input: [MetadataInput!]!): UpdateMetadata - updatePrivateMetadata( - id: ID! - input: [MetadataInput!]! - ): UpdatePrivateMetadata + updatePrivateMetadata(id: ID!, input: [MetadataInput!]!): UpdatePrivateMetadata assignNavigation(menu: ID, navigationType: NavigationType!): AssignNavigation menuCreate(input: MenuCreateInput!): MenuCreate menuDelete(id: ID!): MenuDelete @@ -3330,11 +2804,7 @@ type Mutation { menuItemDelete(id: ID!): MenuItemDelete menuItemBulkDelete(ids: [ID]!): MenuItemBulkDelete menuItemUpdate(id: ID!, input: MenuItemInput!): MenuItemUpdate - menuItemTranslate( - id: ID! - input: NameTranslationInput! - languageCode: LanguageCodeEnum! - ): MenuItemTranslate + menuItemTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): MenuItemTranslate menuItemMove(menu: ID!, moves: [MenuItemMoveInput]!): MenuItemMove invoiceRequest(number: String, orderId: ID!): InvoiceRequest invoiceRequestDelete(id: ID!): InvoiceRequestDelete @@ -3353,85 +2823,33 @@ type Mutation { saleUpdate(id: ID!, input: SaleInput!): SaleUpdate saleCataloguesAdd(id: ID!, input: CatalogueInput!): SaleAddCatalogues saleCataloguesRemove(id: ID!, input: CatalogueInput!): SaleRemoveCatalogues - saleTranslate( - id: ID! - input: NameTranslationInput! - languageCode: LanguageCodeEnum! - ): SaleTranslate - saleChannelListingUpdate( - id: ID! - input: SaleChannelListingInput! - ): SaleChannelListingUpdate + saleTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): SaleTranslate + saleChannelListingUpdate(id: ID!, input: SaleChannelListingInput!): SaleChannelListingUpdate voucherCreate(input: VoucherInput!): VoucherCreate voucherDelete(id: ID!): VoucherDelete voucherBulkDelete(ids: [ID]!): VoucherBulkDelete voucherUpdate(id: ID!, input: VoucherInput!): VoucherUpdate voucherCataloguesAdd(id: ID!, input: CatalogueInput!): VoucherAddCatalogues - voucherCataloguesRemove( - id: ID! - input: CatalogueInput! - ): VoucherRemoveCatalogues - voucherTranslate( - id: ID! - input: NameTranslationInput! - languageCode: LanguageCodeEnum! - ): VoucherTranslate - voucherChannelListingUpdate( - id: ID! - input: VoucherChannelListingInput! - ): VoucherChannelListingUpdate + voucherCataloguesRemove(id: ID!, input: CatalogueInput!): VoucherRemoveCatalogues + voucherTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): VoucherTranslate + voucherChannelListingUpdate(id: ID!, input: VoucherChannelListingInput!): VoucherChannelListingUpdate exportProducts(input: ExportProductsInput!): ExportProducts fileUpload(file: Upload!): FileUpload - checkoutAddPromoCode( - checkoutId: ID! - promoCode: String! - ): CheckoutAddPromoCode - checkoutBillingAddressUpdate( - billingAddress: AddressInput! - checkoutId: ID! - ): CheckoutBillingAddressUpdate - checkoutComplete( - checkoutId: ID! - paymentData: JSONString - redirectUrl: String - storeSource: Boolean = false - ): CheckoutComplete + checkoutAddPromoCode(checkoutId: ID!, promoCode: String!): CheckoutAddPromoCode + checkoutBillingAddressUpdate(billingAddress: AddressInput!, checkoutId: ID!): CheckoutBillingAddressUpdate + checkoutComplete(checkoutId: ID!, paymentData: JSONString, redirectUrl: String, storeSource: Boolean = false): CheckoutComplete checkoutCreate(input: CheckoutCreateInput!): CheckoutCreate - checkoutCustomerAttach( - checkoutId: ID! - customerId: ID - ): CheckoutCustomerAttach + checkoutCustomerAttach(checkoutId: ID!, customerId: ID): CheckoutCustomerAttach checkoutCustomerDetach(checkoutId: ID!): CheckoutCustomerDetach checkoutEmailUpdate(checkoutId: ID, email: String!): CheckoutEmailUpdate checkoutLineDelete(checkoutId: ID!, lineId: ID): CheckoutLineDelete - checkoutLinesAdd( - checkoutId: ID! - lines: [CheckoutLineInput]! - ): CheckoutLinesAdd - checkoutLinesUpdate( - checkoutId: ID! - lines: [CheckoutLineInput]! - ): CheckoutLinesUpdate - checkoutRemovePromoCode( - checkoutId: ID! - promoCode: String! - ): CheckoutRemovePromoCode - checkoutPaymentCreate( - checkoutId: ID! - input: PaymentInput! - ): CheckoutPaymentCreate - checkoutShippingAddressUpdate( - checkoutId: ID! - shippingAddress: AddressInput! - ): CheckoutShippingAddressUpdate - checkoutShippingMethodUpdate( - checkoutId: ID - shippingMethodId: ID! - ): CheckoutShippingMethodUpdate - checkoutLanguageCodeUpdate( - checkoutId: ID! - languageCode: LanguageCodeEnum! - ): CheckoutLanguageCodeUpdate + checkoutLinesAdd(checkoutId: ID!, lines: [CheckoutLineInput]!): CheckoutLinesAdd + checkoutLinesUpdate(checkoutId: ID!, lines: [CheckoutLineInput]!): CheckoutLinesUpdate + checkoutRemovePromoCode(checkoutId: ID!, promoCode: String!): CheckoutRemovePromoCode + checkoutPaymentCreate(checkoutId: ID!, input: PaymentInput!): CheckoutPaymentCreate + checkoutShippingAddressUpdate(checkoutId: ID!, shippingAddress: AddressInput!): CheckoutShippingAddressUpdate + checkoutShippingMethodUpdate(checkoutId: ID, shippingMethodId: ID!): CheckoutShippingMethodUpdate + checkoutLanguageCodeUpdate(checkoutId: ID!, languageCode: LanguageCodeEnum!): CheckoutLanguageCodeUpdate channelCreate(input: ChannelCreateInput!): ChannelCreate channelUpdate(id: ID!, input: ChannelUpdateInput!): ChannelUpdate channelDelete(id: ID!, input: ChannelDeleteInput): ChannelDelete @@ -3440,31 +2858,14 @@ type Mutation { attributeCreate(input: AttributeCreateInput!): AttributeCreate attributeDelete(id: ID!): AttributeDelete attributeUpdate(id: ID!, input: AttributeUpdateInput!): AttributeUpdate - attributeTranslate( - id: ID! - input: NameTranslationInput! - languageCode: LanguageCodeEnum! - ): AttributeTranslate + attributeTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): AttributeTranslate attributeBulkDelete(ids: [ID]!): AttributeBulkDelete attributeValueBulkDelete(ids: [ID]!): AttributeValueBulkDelete - attributeValueCreate( - attribute: ID! - input: AttributeValueCreateInput! - ): AttributeValueCreate + attributeValueCreate(attribute: ID!, input: AttributeValueCreateInput!): AttributeValueCreate attributeValueDelete(id: ID!): AttributeValueDelete - attributeValueUpdate( - id: ID! - input: AttributeValueCreateInput! - ): AttributeValueUpdate - attributeValueTranslate( - id: ID! - input: AttributeValueTranslationInput! - languageCode: LanguageCodeEnum! - ): AttributeValueTranslate - attributeReorderValues( - attributeId: ID! - moves: [ReorderInput]! - ): AttributeReorderValues + attributeValueUpdate(id: ID!, input: AttributeValueCreateInput!): AttributeValueUpdate + attributeValueTranslate(id: ID!, input: AttributeValueTranslationInput!, languageCode: LanguageCodeEnum!): AttributeValueTranslate + attributeReorderValues(attributeId: ID!, moves: [ReorderInput]!): AttributeReorderValues appCreate(input: AppInput!): AppCreate appUpdate(id: ID!, input: AppInput!): AppUpdate appDelete(id: ID!): AppDelete @@ -3472,10 +2873,7 @@ type Mutation { appTokenDelete(id: ID!): AppTokenDelete appTokenVerify(token: String!): AppTokenVerify appInstall(input: AppInstallInput!): AppInstall - appRetryInstall( - activateAfterInstallation: Boolean = true - id: ID! - ): AppRetryInstall + appRetryInstall(activateAfterInstallation: Boolean = true, id: ID!): AppRetryInstall appDeleteFailedInstallation(id: ID!): AppDeleteFailedInstallation appFetchManifest(manifestUrl: String!): AppFetchManifest appActivate(id: ID!): AppActivate @@ -3484,40 +2882,21 @@ type Mutation { tokenRefresh(csrfToken: String, refreshToken: String): RefreshToken tokenVerify(token: String!): VerifyToken tokensDeactivateAll: DeactivateAllUserTokens - externalAuthenticationUrl( - input: JSONString! - pluginId: String! - ): ExternalAuthenticationUrl - externalObtainAccessTokens( - input: JSONString! - pluginId: String! - ): ExternalObtainAccessTokens + externalAuthenticationUrl(input: JSONString!, pluginId: String!): ExternalAuthenticationUrl + externalObtainAccessTokens(input: JSONString!, pluginId: String!): ExternalObtainAccessTokens externalRefresh(input: JSONString!, pluginId: String!): ExternalRefresh externalLogout(input: JSONString!, pluginId: String!): ExternalLogout externalVerify(input: JSONString!, pluginId: String!): ExternalVerify - requestPasswordReset( - email: String! - redirectUrl: String! - ): RequestPasswordReset + requestPasswordReset(email: String!, redirectUrl: String!): RequestPasswordReset confirmAccount(email: String!, token: String!): ConfirmAccount setPassword(email: String!, password: String!, token: String!): SetPassword passwordChange(newPassword: String!, oldPassword: String!): PasswordChange - requestEmailChange( - newEmail: String! - password: String! - redirectUrl: String! - ): RequestEmailChange + requestEmailChange(newEmail: String!, password: String!, redirectUrl: String!): RequestEmailChange confirmEmailChange(token: String!): ConfirmEmailChange - accountAddressCreate( - input: AddressInput! - type: AddressTypeEnum - ): AccountAddressCreate + accountAddressCreate(input: AddressInput!, type: AddressTypeEnum): AccountAddressCreate accountAddressUpdate(id: ID!, input: AddressInput!): AccountAddressUpdate accountAddressDelete(id: ID!): AccountAddressDelete - accountSetDefaultAddress( - id: ID! - type: AddressTypeEnum! - ): AccountSetDefaultAddress + accountSetDefaultAddress(id: ID!, type: AddressTypeEnum!): AccountSetDefaultAddress accountRegister(input: AccountRegisterInput!): AccountRegister accountUpdate(input: AccountInput!): AccountUpdate accountRequestDeletion(redirectUrl: String!): AccountRequestDeletion @@ -3525,11 +2904,7 @@ type Mutation { addressCreate(input: AddressInput!, userId: ID!): AddressCreate addressUpdate(id: ID!, input: AddressInput!): AddressUpdate addressDelete(id: ID!): AddressDelete - addressSetDefault( - addressId: ID! - type: AddressTypeEnum! - userId: ID! - ): AddressSetDefault + addressSetDefault(addressId: ID!, type: AddressTypeEnum!, userId: ID!): AddressSetDefault customerCreate(input: UserCreateInput!): CustomerCreate customerUpdate(id: ID!, input: CustomerInput!): CustomerUpdate customerDelete(id: ID!): CustomerDelete @@ -3541,13 +2916,8 @@ type Mutation { userAvatarUpdate(image: Upload!): UserAvatarUpdate userAvatarDelete: UserAvatarDelete userBulkSetActive(ids: [ID]!, isActive: Boolean!): UserBulkSetActive - permissionGroupCreate( - input: PermissionGroupCreateInput! - ): PermissionGroupCreate - permissionGroupUpdate( - id: ID! - input: PermissionGroupUpdateInput! - ): PermissionGroupUpdate + permissionGroupCreate(input: PermissionGroupCreateInput!): PermissionGroupCreate + permissionGroupUpdate(id: ID!, input: PermissionGroupUpdateInput!): PermissionGroupUpdate permissionGroupDelete(id: ID!): PermissionGroupDelete } @@ -3617,23 +2987,11 @@ type Order implements Node & ObjectWithMetadata { totalBalance: Money! userEmail: String isShippingRequired: Boolean! - languageCode: String! - @deprecated( - reason: "Use the `languageCodeEnum` field to fetch the language code. This field will be removed in Saleor 4.0." - ) + languageCode: String! @deprecated(reason: "Use the `languageCodeEnum` field to fetch the language code. This field will be removed in Saleor 4.0.") languageCodeEnum: LanguageCodeEnum! - discount: Money - @deprecated( - reason: "Use discounts field. This field will be removed in Saleor 4.0." - ) - discountName: String - @deprecated( - reason: "Use discounts field. This field will be removed in Saleor 4.0." - ) - translatedDiscountName: String - @deprecated( - reason: "Use discounts field. This field will be removed in Saleor 4.0." - ) + discount: Money @deprecated(reason: "Use discounts field. This field will be removed in Saleor 4.0.") + discountName: String @deprecated(reason: "Use discounts field. This field will be removed in Saleor 4.0.") + translatedDiscountName: String @deprecated(reason: "Use discounts field. This field will be removed in Saleor 4.0.") discounts: [OrderDiscount!] } @@ -3645,10 +3003,7 @@ enum OrderAction { } type OrderAddNote { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order event: OrderEvent orderErrors: [OrderError!]! @@ -3659,37 +3014,25 @@ input OrderAddNoteInput { } type OrderBulkCancel { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! orderErrors: [OrderError!]! } type OrderCancel { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } type OrderCapture { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } type OrderConfirm { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } @@ -3722,10 +3065,7 @@ type OrderDiscount implements Node { } type OrderDiscountAdd { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } @@ -3737,10 +3077,7 @@ input OrderDiscountCommonInput { } type OrderDiscountDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } @@ -3751,10 +3088,7 @@ enum OrderDiscountType { } type OrderDiscountUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } @@ -3926,10 +3260,7 @@ input OrderFilterInput { } type OrderFulfill { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") fulfillments: [Fulfillment] order: Order orderErrors: [OrderError!]! @@ -3980,30 +3311,21 @@ input OrderLineCreateInput { } type OrderLineDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderLine: OrderLine orderErrors: [OrderError!]! } type OrderLineDiscountRemove { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") orderLine: OrderLine order: Order orderErrors: [OrderError!]! } type OrderLineDiscountUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") orderLine: OrderLine order: Order orderErrors: [OrderError!]! @@ -4014,39 +3336,27 @@ input OrderLineInput { } type OrderLineUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! orderLine: OrderLine } type OrderLinesCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderLines: [OrderLine!] orderErrors: [OrderError!]! } type OrderMarkAsPaid { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } type OrderRefund { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } @@ -4103,10 +3413,7 @@ enum OrderSettingsErrorCode { } type OrderSettingsUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") orderSettings: OrderSettings orderSettingsErrors: [OrderSettingsError!]! } @@ -4150,10 +3457,7 @@ enum OrderStatusFilter { } type OrderUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") orderErrors: [OrderError!]! order: Order } @@ -4165,10 +3469,7 @@ input OrderUpdateInput { } type OrderUpdateShipping { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } @@ -4178,10 +3479,7 @@ input OrderUpdateShippingInput { } type OrderVoid { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") order: Order orderErrors: [OrderError!]! } @@ -4199,46 +3497,31 @@ type Page implements Node & ObjectWithMetadata { created: DateTime! privateMetadata: [MetadataItem]! metadata: [MetadataItem]! - contentJson: JSONString! - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `content` field instead." - ) + contentJson: JSONString! @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.") translation(languageCode: LanguageCodeEnum!): PageTranslation attributes: [SelectedAttribute!]! } type PageAttributeAssign { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageType: PageType pageErrors: [PageError!]! } type PageAttributeUnassign { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageType: PageType pageErrors: [PageError!]! } type PageBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! pageErrors: [PageError!]! } type PageBulkPublish { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! pageErrors: [PageError!]! } @@ -4255,10 +3538,7 @@ type PageCountableEdge { } type PageCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageErrors: [PageError!]! page: Page } @@ -4275,10 +3555,7 @@ input PageCreateInput { } type PageDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageErrors: [PageError!]! page: Page } @@ -4324,10 +3601,7 @@ input PageInput { } type PageReorderAttributeValues { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") page: Page pageErrors: [PageError!]! } @@ -4351,19 +3625,13 @@ type PageTranslatableContent implements Node { id: ID! title: String! content: JSONString - contentJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `content` field instead." - ) + contentJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.") translation(languageCode: LanguageCodeEnum!): PageTranslation page: Page } type PageTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! page: PageTranslatableContent } @@ -4375,10 +3643,7 @@ type PageTranslation implements Node { title: String! content: JSONString language: LanguageDisplay! - contentJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `content` field instead." - ) + contentJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.") } input PageTranslationInput { @@ -4395,21 +3660,12 @@ type PageType implements Node & ObjectWithMetadata { privateMetadata: [MetadataItem]! metadata: [MetadataItem]! attributes: [Attribute] - availableAttributes( - filter: AttributeFilterInput - before: String - after: String - first: Int - last: Int - ): AttributeCountableConnection + availableAttributes(filter: AttributeFilterInput, before: String, after: String, first: Int, last: Int): AttributeCountableConnection hasPages: Boolean } type PageTypeBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! pageErrors: [PageError!]! } @@ -4426,10 +3682,7 @@ type PageTypeCountableEdge { } type PageTypeCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageErrors: [PageError!]! pageType: PageType } @@ -4441,10 +3694,7 @@ input PageTypeCreateInput { } type PageTypeDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageErrors: [PageError!]! pageType: PageType } @@ -4454,10 +3704,7 @@ input PageTypeFilterInput { } type PageTypeReorderAttributes { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageType: PageType pageErrors: [PageError!]! } @@ -4473,10 +3720,7 @@ input PageTypeSortingInput { } type PageTypeUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageErrors: [PageError!]! pageType: PageType } @@ -4489,19 +3733,13 @@ input PageTypeUpdateInput { } type PageUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") pageErrors: [PageError!]! page: Page } type PasswordChange { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! } @@ -4528,10 +3766,7 @@ type Payment implements Node { } type PaymentCapture { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") payment: Payment paymentErrors: [PaymentError!]! } @@ -4591,10 +3826,7 @@ type PaymentGateway { } type PaymentInitialize { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") initializedPayment: PaymentInitialized paymentErrors: [PaymentError!]! } @@ -4613,10 +3845,7 @@ input PaymentInput { } type PaymentRefund { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") payment: Payment paymentErrors: [PaymentError!]! } @@ -4627,10 +3856,7 @@ type PaymentSource { } type PaymentVoid { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") payment: Payment paymentErrors: [PaymentError!]! } @@ -4661,10 +3887,7 @@ enum PermissionEnum { } type PermissionGroupCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") permissionGroupErrors: [PermissionGroupError!]! group: Group } @@ -4676,10 +3899,7 @@ input PermissionGroupCreateInput { } type PermissionGroupDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") permissionGroupErrors: [PermissionGroupError!]! group: Group } @@ -4717,10 +3937,7 @@ input PermissionGroupSortingInput { } type PermissionGroupUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") permissionGroupErrors: [PermissionGroupError!]! group: Group } @@ -4783,10 +4000,7 @@ input PluginSortingInput { } type PluginUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") plugin: Plugin pluginsErrors: [PluginError!]! } @@ -4824,12 +4038,8 @@ type Product implements Node & ObjectWithMetadata { rating: Float privateMetadata: [MetadataItem]! metadata: [MetadataItem]! - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) - url: String! - @deprecated(reason: "This field will be removed after 2020-07-31.") + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") + url: String! @deprecated(reason: "This field will be removed after 2020-07-31.") thumbnail(size: Int): Image pricing(address: AddressInput): ProductPricingInfo isAvailable(address: AddressInput): Boolean @@ -4837,16 +4047,10 @@ type Product implements Node & ObjectWithMetadata { attributes: [SelectedAttribute!]! channelListings: [ProductChannelListing!] mediaById(id: ID): ProductMedia! - imageById(id: ID): ProductImage - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `mediaById` field instead." - ) + imageById(id: ID): ProductImage @deprecated(reason: "Will be removed in Saleor 4.0. Use the `mediaById` field instead.") variants: [ProductVariant] media: [ProductMedia!] - images: [ProductImage] - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `media` field instead." - ) + images: [ProductImage] @deprecated(reason: "Will be removed in Saleor 4.0. Use the `media` field instead.") collections: [Collection] translation(languageCode: LanguageCodeEnum!): ProductTranslation availableForPurchase: Date @@ -4854,10 +4058,7 @@ type Product implements Node & ObjectWithMetadata { } type ProductAttributeAssign { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productType: ProductType productErrors: [ProductError!]! } @@ -4873,19 +4074,13 @@ enum ProductAttributeType { } type ProductAttributeUnassign { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productType: ProductType productErrors: [ProductError!]! } type ProductBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! productErrors: [ProductError!]! } @@ -4923,10 +4118,7 @@ type ProductChannelListingError { } type ProductChannelListingUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") product: Product productChannelListingErrors: [ProductChannelListingError!]! } @@ -4948,10 +4140,7 @@ type ProductCountableEdge { } type ProductCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! product: Product } @@ -4972,10 +4161,7 @@ input ProductCreateInput { } type ProductDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! product: Product } @@ -5017,10 +4203,10 @@ enum ProductFieldEnum { PRODUCT_WEIGHT COLLECTIONS CHARGE_TAXES - PRODUCT_MEDIA + PRODUCT_IMAGES VARIANT_SKU VARIANT_WEIGHT - VARIANT_MEDIA + VARIANT_IMAGES } input ProductFilterInput { @@ -5072,19 +4258,13 @@ type ProductMedia implements Node { } type ProductMediaBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! productErrors: [ProductError!]! } type ProductMediaCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") product: Product media: ProductMedia productErrors: [ProductError!]! @@ -5098,20 +4278,14 @@ input ProductMediaCreateInput { } type ProductMediaDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") product: Product media: ProductMedia productErrors: [ProductError!]! } type ProductMediaReorder { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") product: Product media: [ProductMedia!] productErrors: [ProductError!]! @@ -5123,10 +4297,7 @@ enum ProductMediaType { } type ProductMediaUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") product: Product media: ProductMedia productErrors: [ProductError!]! @@ -5166,10 +4337,7 @@ type ProductPricingInfo { } type ProductReorderAttributeValues { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") product: Product productErrors: [ProductError!]! } @@ -5185,19 +4353,13 @@ type ProductTranslatableContent implements Node { seoDescription: String name: String! description: JSONString - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") translation(languageCode: LanguageCodeEnum!): ProductTranslation product: Product } type ProductTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! product: Product } @@ -5209,10 +4371,7 @@ type ProductTranslation implements Node { name: String! description: JSONString language: LanguageDisplay! - descriptionJson: JSONString - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `description` field instead." - ) + descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") } type ProductType implements Node & ObjectWithMetadata { @@ -5225,33 +4384,15 @@ type ProductType implements Node & ObjectWithMetadata { weight: Weight privateMetadata: [MetadataItem]! metadata: [MetadataItem]! - products( - channel: String - before: String - after: String - first: Int - last: Int - ): ProductCountableConnection - @deprecated( - reason: "Use the top-level `products` query with the `productTypes` filter." - ) + products(channel: String, before: String, after: String, first: Int, last: Int): ProductCountableConnection @deprecated(reason: "Use the top-level `products` query with the `productTypes` filter.") taxType: TaxType variantAttributes(variantSelection: VariantAttributeScope): [Attribute] productAttributes: [Attribute] - availableAttributes( - filter: AttributeFilterInput - before: String - after: String - first: Int - last: Int - ): AttributeCountableConnection + availableAttributes(filter: AttributeFilterInput, before: String, after: String, first: Int, last: Int): AttributeCountableConnection } type ProductTypeBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! productErrors: [ProductError!]! } @@ -5273,19 +4414,13 @@ type ProductTypeCountableEdge { } type ProductTypeCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! productType: ProductType } type ProductTypeDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! productType: ProductType } @@ -5316,10 +4451,7 @@ input ProductTypeInput { } type ProductTypeReorderAttributes { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productType: ProductType productErrors: [ProductError!]! } @@ -5336,19 +4468,13 @@ input ProductTypeSortingInput { } type ProductTypeUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! productType: ProductType } type ProductUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! product: Product } @@ -5369,10 +4495,7 @@ type ProductVariant implements Node & ObjectWithMetadata { margin: Int quantityOrdered: Int revenue(period: ReportingPeriod): TaxedMoney - images: [ProductImage] - @deprecated( - reason: "Will be removed in Saleor 4.0. Use the `media` instead." - ) + images: [ProductImage] @deprecated(reason: "Will be removed in Saleor 4.0. Use the `media` instead.") media: [ProductMedia!] translation(languageCode: LanguageCodeEnum!): ProductVariantTranslation digitalContent: DigitalContent @@ -5381,10 +4504,7 @@ type ProductVariant implements Node & ObjectWithMetadata { } type ProductVariantBulkCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! productVariants: [ProductVariant!]! bulkProductErrors: [BulkProductError!]! @@ -5400,10 +4520,7 @@ input ProductVariantBulkCreateInput { } type ProductVariantBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! productErrors: [ProductError!]! } @@ -5423,10 +4540,7 @@ input ProductVariantChannelListingAddInput { } type ProductVariantChannelListingUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") variant: ProductVariant productChannelListingErrors: [ProductChannelListingError!]! } @@ -5443,10 +4557,7 @@ type ProductVariantCountableEdge { } type ProductVariantCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! productVariant: ProductVariant } @@ -5461,10 +4572,7 @@ input ProductVariantCreateInput { } type ProductVariantDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! productVariant: ProductVariant } @@ -5483,55 +4591,37 @@ input ProductVariantInput { } type ProductVariantReorder { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") product: Product productErrors: [ProductError!]! } type ProductVariantReorderAttributeValues { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productVariant: ProductVariant productErrors: [ProductError!]! } type ProductVariantSetDefault { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") product: Product productErrors: [ProductError!]! } type ProductVariantStocksCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productVariant: ProductVariant bulkStockErrors: [BulkStockError!]! } type ProductVariantStocksDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productVariant: ProductVariant stockErrors: [StockError!]! } type ProductVariantStocksUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productVariant: ProductVariant bulkStockErrors: [BulkStockError!]! } @@ -5544,10 +4634,7 @@ type ProductVariantTranslatableContent implements Node { } type ProductVariantTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! productVariant: ProductVariant } @@ -5559,10 +4646,7 @@ type ProductVariantTranslation implements Node { } type ProductVariantUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productErrors: [ProductError!]! productVariant: ProductVariant } @@ -5578,297 +4662,73 @@ type Query { webhookEvents: [WebhookEvent] webhookSamplePayload(eventType: WebhookSampleEventTypeEnum!): JSONString warehouse(id: ID!): Warehouse - warehouses( - filter: WarehouseFilterInput - sortBy: WarehouseSortingInput - before: String - after: String - first: Int - last: Int - ): WarehouseCountableConnection - translations( - kind: TranslatableKinds! - before: String - after: String - first: Int - last: Int - ): TranslatableItemConnection + warehouses(filter: WarehouseFilterInput, sortBy: WarehouseSortingInput, before: String, after: String, first: Int, last: Int): WarehouseCountableConnection + translations(kind: TranslatableKinds!, before: String, after: String, first: Int, last: Int): TranslatableItemConnection translation(id: ID!, kind: TranslatableKinds!): TranslatableItem stock(id: ID!): Stock - stocks( - filter: StockFilterInput - before: String - after: String - first: Int - last: Int - ): StockCountableConnection + stocks(filter: StockFilterInput, before: String, after: String, first: Int, last: Int): StockCountableConnection shop: Shop! orderSettings: OrderSettings shippingZone(id: ID!, channel: String): ShippingZone - shippingZones( - channel: String - before: String - after: String - first: Int - last: Int - ): ShippingZoneCountableConnection + shippingZones(channel: String, before: String, after: String, first: Int, last: Int): ShippingZoneCountableConnection digitalContent(id: ID!): DigitalContent - digitalContents( - before: String - after: String - first: Int - last: Int - ): DigitalContentCountableConnection - categories( - filter: CategoryFilterInput - sortBy: CategorySortingInput - level: Int - before: String - after: String - first: Int - last: Int - ): CategoryCountableConnection + digitalContents(before: String, after: String, first: Int, last: Int): DigitalContentCountableConnection + categories(filter: CategoryFilterInput, sortBy: CategorySortingInput, level: Int, before: String, after: String, first: Int, last: Int): CategoryCountableConnection category(id: ID, slug: String): Category collection(id: ID, slug: String, channel: String): Collection - collections( - filter: CollectionFilterInput - sortBy: CollectionSortingInput - channel: String - before: String - after: String - first: Int - last: Int - ): CollectionCountableConnection + collections(filter: CollectionFilterInput, sortBy: CollectionSortingInput, channel: String, before: String, after: String, first: Int, last: Int): CollectionCountableConnection product(id: ID, slug: String, channel: String): Product - products( - filter: ProductFilterInput - sortBy: ProductOrder - stockAvailability: StockAvailability - channel: String - before: String - after: String - first: Int - last: Int - ): ProductCountableConnection + products(filter: ProductFilterInput, sortBy: ProductOrder, stockAvailability: StockAvailability, channel: String, before: String, after: String, first: Int, last: Int): ProductCountableConnection productType(id: ID!): ProductType - productTypes( - filter: ProductTypeFilterInput - sortBy: ProductTypeSortingInput - before: String - after: String - first: Int - last: Int - ): ProductTypeCountableConnection + productTypes(filter: ProductTypeFilterInput, sortBy: ProductTypeSortingInput, before: String, after: String, first: Int, last: Int): ProductTypeCountableConnection productVariant(id: ID, sku: String, channel: String): ProductVariant - productVariants( - ids: [ID] - channel: String - filter: ProductVariantFilterInput - before: String - after: String - first: Int - last: Int - ): ProductVariantCountableConnection - reportProductSales( - period: ReportingPeriod! - channel: String! - before: String - after: String - first: Int - last: Int - ): ProductVariantCountableConnection + productVariants(ids: [ID], channel: String, filter: ProductVariantFilterInput, before: String, after: String, first: Int, last: Int): ProductVariantCountableConnection + reportProductSales(period: ReportingPeriod!, channel: String!, before: String, after: String, first: Int, last: Int): ProductVariantCountableConnection payment(id: ID!): Payment - payments( - filter: PaymentFilterInput - before: String - after: String - first: Int - last: Int - ): PaymentCountableConnection + payments(filter: PaymentFilterInput, before: String, after: String, first: Int, last: Int): PaymentCountableConnection page(id: ID, slug: String): Page - pages( - sortBy: PageSortingInput - filter: PageFilterInput - before: String - after: String - first: Int - last: Int - ): PageCountableConnection + pages(sortBy: PageSortingInput, filter: PageFilterInput, before: String, after: String, first: Int, last: Int): PageCountableConnection pageType(id: ID!): PageType - pageTypes( - sortBy: PageTypeSortingInput - filter: PageTypeFilterInput - before: String - after: String - first: Int - last: Int - ): PageTypeCountableConnection - homepageEvents( - before: String - after: String - first: Int - last: Int - ): OrderEventCountableConnection + pageTypes(sortBy: PageTypeSortingInput, filter: PageTypeFilterInput, before: String, after: String, first: Int, last: Int): PageTypeCountableConnection + homepageEvents(before: String, after: String, first: Int, last: Int): OrderEventCountableConnection order(id: ID!): Order - orders( - sortBy: OrderSortingInput - filter: OrderFilterInput - created: ReportingPeriod - status: OrderStatusFilter - channel: String - before: String - after: String - first: Int - last: Int - ): OrderCountableConnection - draftOrders( - sortBy: OrderSortingInput - filter: OrderDraftFilterInput - created: ReportingPeriod - before: String - after: String - first: Int - last: Int - ): OrderCountableConnection + orders(sortBy: OrderSortingInput, filter: OrderFilterInput, created: ReportingPeriod, status: OrderStatusFilter, channel: String, before: String, after: String, first: Int, last: Int): OrderCountableConnection + draftOrders(sortBy: OrderSortingInput, filter: OrderDraftFilterInput, created: ReportingPeriod, before: String, after: String, first: Int, last: Int): OrderCountableConnection ordersTotal(period: ReportingPeriod, channel: String): TaxedMoney orderByToken(token: UUID!): Order menu(channel: String, id: ID, name: String, slug: String): Menu - menus( - channel: String - sortBy: MenuSortingInput - filter: MenuFilterInput - before: String - after: String - first: Int - last: Int - ): MenuCountableConnection + menus(channel: String, sortBy: MenuSortingInput, filter: MenuFilterInput, before: String, after: String, first: Int, last: Int): MenuCountableConnection menuItem(id: ID!, channel: String): MenuItem - menuItems( - channel: String - sortBy: MenuItemSortingInput - filter: MenuItemFilterInput - before: String - after: String - first: Int - last: Int - ): MenuItemCountableConnection + menuItems(channel: String, sortBy: MenuItemSortingInput, filter: MenuItemFilterInput, before: String, after: String, first: Int, last: Int): MenuItemCountableConnection giftCard(id: ID!): GiftCard - giftCards( - before: String - after: String - first: Int - last: Int - ): GiftCardCountableConnection + giftCards(before: String, after: String, first: Int, last: Int): GiftCardCountableConnection plugin(id: ID!): Plugin - plugins( - filter: PluginFilterInput - sortBy: PluginSortingInput - before: String - after: String - first: Int - last: Int - ): PluginCountableConnection + plugins(filter: PluginFilterInput, sortBy: PluginSortingInput, before: String, after: String, first: Int, last: Int): PluginCountableConnection sale(id: ID!, channel: String): Sale - sales( - filter: SaleFilterInput - sortBy: SaleSortingInput - query: String - channel: String - before: String - after: String - first: Int - last: Int - ): SaleCountableConnection + sales(filter: SaleFilterInput, sortBy: SaleSortingInput, query: String, channel: String, before: String, after: String, first: Int, last: Int): SaleCountableConnection voucher(id: ID!, channel: String): Voucher - vouchers( - filter: VoucherFilterInput - sortBy: VoucherSortingInput - query: String - channel: String - before: String - after: String - first: Int - last: Int - ): VoucherCountableConnection + vouchers(filter: VoucherFilterInput, sortBy: VoucherSortingInput, query: String, channel: String, before: String, after: String, first: Int, last: Int): VoucherCountableConnection exportFile(id: ID!): ExportFile - exportFiles( - filter: ExportFileFilterInput - sortBy: ExportFileSortingInput - before: String - after: String - first: Int - last: Int - ): ExportFileCountableConnection + exportFiles(filter: ExportFileFilterInput, sortBy: ExportFileSortingInput, before: String, after: String, first: Int, last: Int): ExportFileCountableConnection taxTypes: [TaxType] checkout(token: UUID): Checkout - checkouts( - channel: String - before: String - after: String - first: Int - last: Int - ): CheckoutCountableConnection + checkouts(channel: String, before: String, after: String, first: Int, last: Int): CheckoutCountableConnection checkoutLine(id: ID): CheckoutLine - checkoutLines( - before: String - after: String - first: Int - last: Int - ): CheckoutLineCountableConnection + checkoutLines(before: String, after: String, first: Int, last: Int): CheckoutLineCountableConnection channel(id: ID): Channel channels: [Channel!] - attributes( - filter: AttributeFilterInput - sortBy: AttributeSortingInput - before: String - after: String - first: Int - last: Int - ): AttributeCountableConnection + attributes(filter: AttributeFilterInput, sortBy: AttributeSortingInput, before: String, after: String, first: Int, last: Int): AttributeCountableConnection attribute(id: ID, slug: String): Attribute appsInstallations: [AppInstallation!]! - apps( - filter: AppFilterInput - sortBy: AppSortingInput - before: String - after: String - first: Int - last: Int - ): AppCountableConnection + apps(filter: AppFilterInput, sortBy: AppSortingInput, before: String, after: String, first: Int, last: Int): AppCountableConnection app(id: ID): App - addressValidationRules( - countryCode: CountryCode! - countryArea: String - city: String - cityArea: String - ): AddressValidationData + addressValidationRules(countryCode: CountryCode!, countryArea: String, city: String, cityArea: String): AddressValidationData address(id: ID!): Address - customers( - filter: CustomerFilterInput - sortBy: UserSortingInput - before: String - after: String - first: Int - last: Int - ): UserCountableConnection - permissionGroups( - filter: PermissionGroupFilterInput - sortBy: PermissionGroupSortingInput - before: String - after: String - first: Int - last: Int - ): GroupCountableConnection + customers(filter: CustomerFilterInput, sortBy: UserSortingInput, before: String, after: String, first: Int, last: Int): UserCountableConnection + permissionGroups(filter: PermissionGroupFilterInput, sortBy: PermissionGroupSortingInput, before: String, after: String, first: Int, last: Int): GroupCountableConnection permissionGroup(id: ID!): Group me: User - staffUsers( - filter: StaffUserInput - sortBy: UserSortingInput - before: String - after: String - first: Int - last: Int - ): UserCountableConnection + staffUsers(filter: StaffUserInput, sortBy: UserSortingInput, before: String, after: String, first: Int, last: Int): UserCountableConnection user(id: ID, email: String): User _entities(representations: [_Any]): [_Entity] _service: _Service @@ -5880,10 +4740,7 @@ type ReducedRate { } type RefreshToken { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") token: String user: User accountErrors: [AccountError!]! @@ -5900,19 +4757,13 @@ enum ReportingPeriod { } type RequestEmailChange { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! } type RequestPasswordReset { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") accountErrors: [AccountError!]! } @@ -5922,24 +4773,9 @@ type Sale implements Node { type: SaleType! startDate: DateTime! endDate: DateTime - categories( - before: String - after: String - first: Int - last: Int - ): CategoryCountableConnection - collections( - before: String - after: String - first: Int - last: Int - ): CollectionCountableConnection - products( - before: String - after: String - first: Int - last: Int - ): ProductCountableConnection + categories(before: String, after: String, first: Int, last: Int): CategoryCountableConnection + collections(before: String, after: String, first: Int, last: Int): CollectionCountableConnection + products(before: String, after: String, first: Int, last: Int): ProductCountableConnection translation(languageCode: LanguageCodeEnum!): SaleTranslation channelListings: [SaleChannelListing!] discountValue: Float @@ -5947,19 +4783,13 @@ type Sale implements Node { } type SaleAddCatalogues { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") sale: Sale discountErrors: [DiscountError!]! } type SaleBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! discountErrors: [DiscountError!]! } @@ -5982,10 +4812,7 @@ input SaleChannelListingInput { } type SaleChannelListingUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") sale: Sale discountErrors: [DiscountError!]! } @@ -6002,19 +4829,13 @@ type SaleCountableEdge { } type SaleCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") discountErrors: [DiscountError!]! sale: Sale } type SaleDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") discountErrors: [DiscountError!]! sale: Sale } @@ -6038,10 +4859,7 @@ input SaleInput { } type SaleRemoveCatalogues { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") sale: Sale discountErrors: [DiscountError!]! } @@ -6068,10 +4886,7 @@ type SaleTranslatableContent implements Node { } type SaleTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! sale: Sale } @@ -6088,10 +4903,7 @@ enum SaleType { } type SaleUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") discountErrors: [DiscountError!]! sale: Sale } @@ -6107,10 +4919,7 @@ input SeoInput { } type SetPassword { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") token: String refreshToken: String csrfToken: String @@ -6153,12 +4962,7 @@ type ShippingMethod implements Node & ObjectWithMetadata { maximumOrderPrice: Money minimumOrderPrice: Money postalCodeRules: [ShippingMethodPostalCodeRule] - excludedProducts( - before: String - after: String - first: Int - last: Int - ): ProductCountableConnection + excludedProducts(before: String, after: String, first: Int, last: Int): ProductCountableConnection } type ShippingMethodChannelListing implements Node { @@ -6182,10 +4986,7 @@ input ShippingMethodChannelListingInput { } type ShippingMethodChannelListingUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingMethod: ShippingMethod shippingErrors: [ShippingError!]! } @@ -6221,39 +5022,27 @@ input ShippingPostalCodeRulesCreateInputRange { } type ShippingPriceBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! shippingErrors: [ShippingError!]! } type ShippingPriceCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingZone: ShippingZone shippingMethod: ShippingMethod shippingErrors: [ShippingError!]! } type ShippingPriceDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingMethod: ShippingMethod shippingZone: ShippingZone shippingErrors: [ShippingError!]! } type ShippingPriceExcludeProducts { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingMethod: ShippingMethod shippingErrors: [ShippingError!]! } @@ -6276,28 +5065,19 @@ input ShippingPriceInput { } type ShippingPriceRemoveProductFromExclude { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingMethod: ShippingMethod shippingErrors: [ShippingError!]! } type ShippingPriceTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! shippingMethod: ShippingMethod } type ShippingPriceUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingZone: ShippingZone shippingMethod: ShippingMethod shippingErrors: [ShippingError!]! @@ -6317,10 +5097,7 @@ type ShippingZone implements Node & ObjectWithMetadata { } type ShippingZoneBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! shippingErrors: [ShippingError!]! } @@ -6337,10 +5114,7 @@ type ShippingZoneCountableEdge { } type ShippingZoneCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingErrors: [ShippingError!]! shippingZone: ShippingZone } @@ -6354,19 +5128,13 @@ input ShippingZoneCreateInput { } type ShippingZoneDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingErrors: [ShippingError!]! shippingZone: ShippingZone } type ShippingZoneUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shippingErrors: [ShippingError!]! shippingZone: ShippingZone } @@ -6383,10 +5151,7 @@ input ShippingZoneUpdateInput { type Shop { availablePaymentGateways(currency: String): [PaymentGateway!]! availableExternalAuthentications: [ExternalAuthentication!]! - availableShippingMethods( - channel: String! - address: AddressInput - ): [ShippingMethod] + availableShippingMethods(channel: String!, address: AddressInput): [ShippingMethod] countries(languageCode: LanguageCodeEnum): [CountryDisplay!]! defaultCountry: CountryDisplay defaultMailSenderName: String @@ -6395,10 +5160,7 @@ type Shop { domain: Domain! languages: [LanguageDisplay]! name: String! - navigation: Navigation - @deprecated( - reason: "Fetch menus using the `menu` query with `slug` parameter." - ) + navigation: Navigation @deprecated(reason: "Fetch menus using the `menu` query with `slug` parameter.") permissions: [Permission]! phonePrefixes: [String]! headerText: String @@ -6419,19 +5181,13 @@ type Shop { } type ShopAddressUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shop: Shop shopErrors: [ShopError!]! } type ShopDomainUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shop: Shop shopErrors: [ShopError!]! } @@ -6453,10 +5209,7 @@ enum ShopErrorCode { } type ShopFetchTaxRates { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shop: Shop shopErrors: [ShopError!]! } @@ -6478,10 +5231,7 @@ input ShopSettingsInput { } type ShopSettingsTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shop: Shop translationErrors: [TranslationError!]! } @@ -6492,10 +5242,7 @@ input ShopSettingsTranslationInput { } type ShopSettingsUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shop: Shop shopErrors: [ShopError!]! } @@ -6513,19 +5260,13 @@ input SiteDomainInput { } type StaffBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! staffErrors: [StaffError!]! } type StaffCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") staffErrors: [StaffError!]! user: User } @@ -6541,10 +5282,7 @@ input StaffCreateInput { } type StaffDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") staffErrors: [StaffError!]! user: User } @@ -6571,19 +5309,13 @@ type StaffNotificationRecipient implements Node { } type StaffNotificationRecipientCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shopErrors: [ShopError!]! staffNotificationRecipient: StaffNotificationRecipient } type StaffNotificationRecipientDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shopErrors: [ShopError!]! staffNotificationRecipient: StaffNotificationRecipient } @@ -6595,19 +5327,13 @@ input StaffNotificationRecipientInput { } type StaffNotificationRecipientUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") shopErrors: [ShopError!]! staffNotificationRecipient: StaffNotificationRecipient } type StaffUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") staffErrors: [StaffError!]! user: User } @@ -6746,18 +5472,7 @@ enum TransactionKind { CANCEL } -union TranslatableItem = - ProductTranslatableContent - | CollectionTranslatableContent - | CategoryTranslatableContent - | AttributeTranslatableContent - | AttributeValueTranslatableContent - | ProductVariantTranslatableContent - | PageTranslatableContent - | ShippingMethodTranslatableContent - | SaleTranslatableContent - | VoucherTranslatableContent - | MenuItemTranslatableContent +union TranslatableItem = ProductTranslatableContent | CollectionTranslatableContent | CategoryTranslatableContent | AttributeTranslatableContent | AttributeValueTranslatableContent | ProductVariantTranslatableContent | PageTranslatableContent | ShippingMethodTranslatableContent | SaleTranslatableContent | VoucherTranslatableContent | MenuItemTranslatableContent type TranslatableItemConnection { pageInfo: PageInfo! @@ -6811,19 +5526,13 @@ input UpdateInvoiceInput { } type UpdateMetadata { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") metadataErrors: [MetadataError!]! item: ObjectWithMetadata } type UpdatePrivateMetadata { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") metadataErrors: [MetadataError!]! item: ObjectWithMetadata } @@ -6855,27 +5564,11 @@ type User implements Node & ObjectWithMetadata { privateMetadata: [MetadataItem]! metadata: [MetadataItem]! addresses: [Address] - checkout: Checkout - @deprecated( - reason: "Use the `checkout_tokens` field to fetch the user checkouts." - ) + checkout: Checkout @deprecated(reason: "Use the `checkout_tokens` field to fetch the user checkouts.") checkoutTokens(channel: String): [UUID!] - giftCards( - before: String - after: String - first: Int - last: Int - ): GiftCardCountableConnection - orders( - before: String - after: String - first: Int - last: Int - ): OrderCountableConnection - permissions: [Permission] - @deprecated( - reason: "Will be removed in Saleor 2.11.Use the `userPermissions` instead." - ) + giftCards(before: String, after: String, first: Int, last: Int): GiftCardCountableConnection + orders(before: String, after: String, first: Int, last: Int): OrderCountableConnection + permissions: [Permission] @deprecated(reason: "Will be removed in Saleor 2.11.Use the `userPermissions` instead.") userPermissions: [UserPermission] permissionGroups: [Group] editableGroups: [Group] @@ -6886,28 +5579,19 @@ type User implements Node & ObjectWithMetadata { } type UserAvatarDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! } type UserAvatarUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User accountErrors: [AccountError!]! } type UserBulkSetActive { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! accountErrors: [AccountError!]! } @@ -6966,20 +5650,14 @@ enum VariantAttributeScope { } type VariantMediaAssign { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productVariant: ProductVariant media: ProductMedia productErrors: [ProductError!]! } type VariantMediaUnassign { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") productVariant: ProductVariant media: ProductMedia productErrors: [ProductError!]! @@ -6995,16 +5673,29 @@ type VariantPricingInfo { } type VerifyToken { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") user: User isValid: Boolean! payload: GenericScalar accountErrors: [AccountError!]! } +enum VolumeUnitsEnum { + CUBIC_MILLIMETER + CUBIC_CENTIMETER + CUBIC_DECIMETER + CUBIC_METER + LITER + CUBIC_FOOT + CUBIC_INCH + CUBIC_YARD + QT + PINT + OZ + ACRE_IN + ACRE_FT +} + type Voucher implements Node { id: ID! name: String @@ -7018,24 +5709,9 @@ type Voucher implements Node { applyOncePerCustomer: Boolean! discountValueType: DiscountValueTypeEnum! minCheckoutItemsQuantity: Int - categories( - before: String - after: String - first: Int - last: Int - ): CategoryCountableConnection - collections( - before: String - after: String - first: Int - last: Int - ): CollectionCountableConnection - products( - before: String - after: String - first: Int - last: Int - ): ProductCountableConnection + categories(before: String, after: String, first: Int, last: Int): CategoryCountableConnection + collections(before: String, after: String, first: Int, last: Int): CollectionCountableConnection + products(before: String, after: String, first: Int, last: Int): ProductCountableConnection countries: [CountryDisplay] translation(languageCode: LanguageCodeEnum!): VoucherTranslation discountValue: Float @@ -7045,19 +5721,13 @@ type Voucher implements Node { } type VoucherAddCatalogues { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") voucher: Voucher discountErrors: [DiscountError!]! } type VoucherBulkDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") count: Int! discountErrors: [DiscountError!]! } @@ -7082,10 +5752,7 @@ input VoucherChannelListingInput { } type VoucherChannelListingUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") voucher: Voucher discountErrors: [DiscountError!]! } @@ -7102,19 +5769,13 @@ type VoucherCountableEdge { } type VoucherCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") discountErrors: [DiscountError!]! voucher: Voucher } type VoucherDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") discountErrors: [DiscountError!]! voucher: Voucher } @@ -7151,10 +5812,7 @@ input VoucherInput { } type VoucherRemoveCatalogues { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") voucher: Voucher discountErrors: [DiscountError!]! } @@ -7183,10 +5841,7 @@ type VoucherTranslatableContent implements Node { } type VoucherTranslate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") translationErrors: [TranslationError!]! voucher: Voucher } @@ -7204,10 +5859,7 @@ enum VoucherTypeEnum { } type VoucherUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") discountErrors: [DiscountError!]! voucher: Voucher } @@ -7217,12 +5869,7 @@ type Warehouse implements Node & ObjectWithMetadata { name: String! slug: String! companyName: String! - shippingZones( - before: String - after: String - first: Int - last: Int - ): ShippingZoneCountableConnection! + shippingZones(before: String, after: String, first: Int, last: Int): ShippingZoneCountableConnection! address: Address! email: String! privateMetadata: [MetadataItem]! @@ -7252,10 +5899,7 @@ type WarehouseCountableEdge { } type WarehouseCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") warehouseErrors: [WarehouseError!]! warehouse: Warehouse } @@ -7270,10 +5914,7 @@ input WarehouseCreateInput { } type WarehouseDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") warehouseErrors: [WarehouseError!]! warehouse: Warehouse } @@ -7299,19 +5940,13 @@ input WarehouseFilterInput { } type WarehouseShippingZoneAssign { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") warehouseErrors: [WarehouseError!]! warehouse: Warehouse } type WarehouseShippingZoneUnassign { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") warehouseErrors: [WarehouseError!]! warehouse: Warehouse } @@ -7326,10 +5961,7 @@ input WarehouseSortingInput { } type WarehouseUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") warehouseErrors: [WarehouseError!]! warehouse: Warehouse } @@ -7353,10 +5985,7 @@ type Webhook implements Node { } type WebhookCreate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") webhookErrors: [WebhookError!]! webhook: Webhook } @@ -7371,10 +6000,7 @@ input WebhookCreateInput { } type WebhookDelete { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") webhookErrors: [WebhookError!]! webhook: Webhook } @@ -7454,10 +6080,7 @@ enum WebhookSampleEventTypeEnum { } type WebhookUpdate { - errors: [Error!]! - @deprecated( - reason: "Use typed errors with error codes. This field will be removed after 2020-07-31." - ) + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") webhookErrors: [WebhookError!]! webhook: Webhook } @@ -7479,27 +6102,16 @@ type Weight { scalar WeightScalar enum WeightUnitsEnum { - KG + G LB OZ - G + KG + TONNE } scalar _Any -union _Entity = - Address - | User - | Group - | App - | ProductVariant - | Product - | ProductType - | Collection - | Category - | ProductMedia - | ProductImage - | PageType +union _Entity = Address | User | Group | App | ProductVariant | Product | ProductType | Collection | Category | ProductMedia | ProductImage | PageType type _Service { sdl: String diff --git a/src/products/components/ProductExportDialog/ProductExportDialogInfo.tsx b/src/products/components/ProductExportDialog/ProductExportDialogInfo.tsx index f7e14c1d591..7534c82ea3c 100644 --- a/src/products/components/ProductExportDialog/ProductExportDialogInfo.tsx +++ b/src/products/components/ProductExportDialog/ProductExportDialogInfo.tsx @@ -579,8 +579,8 @@ const ProductExportDialogInfo: React.FC = ({ fields={[ ProductFieldEnum.DESCRIPTION, ProductFieldEnum.NAME, - ProductFieldEnum.PRODUCT_MEDIA, - ProductFieldEnum.VARIANT_MEDIA + ProductFieldEnum.PRODUCT_IMAGES, + ProductFieldEnum.VARIANT_IMAGES ]} onChange={handleFieldChange} onToggleAll={handleToggleAllFields} diff --git a/src/products/components/ProductExportDialog/messages.ts b/src/products/components/ProductExportDialog/messages.ts index 2e983fa1058..e5dd38442c4 100644 --- a/src/products/components/ProductExportDialog/messages.ts +++ b/src/products/components/ProductExportDialog/messages.ts @@ -30,7 +30,7 @@ function useProductExportFieldMessages() { description: "product field", id: "productExportFieldName" }), - [ProductFieldEnum.PRODUCT_MEDIA]: intl.formatMessage({ + [ProductFieldEnum.PRODUCT_IMAGES]: intl.formatMessage({ defaultMessage: "Product Images", description: "product field", id: "productExportFieldProductImages" @@ -45,7 +45,7 @@ function useProductExportFieldMessages() { description: "product field", id: "productExportFieldProductWeight" }), - [ProductFieldEnum.VARIANT_MEDIA]: intl.formatMessage({ + [ProductFieldEnum.VARIANT_IMAGES]: intl.formatMessage({ defaultMessage: "Variant Images", description: "product field", id: "productExportFieldVariantImages" diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index a781480ec60..6f635efe42f 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -89,6 +89,7 @@ export enum AttributeInputTypeEnum { DROPDOWN = "DROPDOWN", FILE = "FILE", MULTISELECT = "MULTISELECT", + NUMERIC = "NUMERIC", REFERENCE = "REFERENCE", RICH_TEXT = "RICH_TEXT", } @@ -529,6 +530,38 @@ export enum LanguageCodeEnum { ZH_HANT = "ZH_HANT", } +export enum MeasurementUnitsEnum { + ACRE_FT = "ACRE_FT", + ACRE_IN = "ACRE_IN", + CM = "CM", + CUBIC_CENTIMETER = "CUBIC_CENTIMETER", + CUBIC_DECIMETER = "CUBIC_DECIMETER", + CUBIC_FOOT = "CUBIC_FOOT", + CUBIC_INCH = "CUBIC_INCH", + CUBIC_METER = "CUBIC_METER", + CUBIC_MILLIMETER = "CUBIC_MILLIMETER", + CUBIC_YARD = "CUBIC_YARD", + FT = "FT", + G = "G", + INCH = "INCH", + KG = "KG", + KM = "KM", + LB = "LB", + LITER = "LITER", + M = "M", + OZ = "OZ", + PINT = "PINT", + QT = "QT", + SQ_CM = "SQ_CM", + SQ_FT = "SQ_FT", + SQ_INCH = "SQ_INCH", + SQ_KM = "SQ_KM", + SQ_M = "SQ_M", + SQ_YD = "SQ_YD", + TONNE = "TONNE", + YD = "YD", +} + export enum MenuErrorCode { CANNOT_ASSIGN_NODE = "CANNOT_ASSIGN_NODE", GRAPHQL_ERROR = "GRAPHQL_ERROR", @@ -808,10 +841,10 @@ export enum ProductFieldEnum { COLLECTIONS = "COLLECTIONS", DESCRIPTION = "DESCRIPTION", NAME = "NAME", - PRODUCT_MEDIA = "PRODUCT_MEDIA", + PRODUCT_IMAGES = "PRODUCT_IMAGES", PRODUCT_TYPE = "PRODUCT_TYPE", PRODUCT_WEIGHT = "PRODUCT_WEIGHT", - VARIANT_MEDIA = "VARIANT_MEDIA", + VARIANT_IMAGES = "VARIANT_IMAGES", VARIANT_SKU = "VARIANT_SKU", VARIANT_WEIGHT = "VARIANT_WEIGHT", VISIBLE = "VISIBLE", @@ -1024,6 +1057,7 @@ export enum WeightUnitsEnum { KG = "KG", LB = "LB", OZ = "OZ", + TONNE = "TONNE", } export interface AddressInput { @@ -1075,6 +1109,7 @@ export interface AttributeCreateInput { name: string; slug?: string | null; type: AttributeTypeEnum; + unit?: MeasurementUnitsEnum | null; values?: (AttributeValueCreateInput | null)[] | null; valueRequired?: boolean | null; isVariantOnly?: boolean | null; @@ -1103,8 +1138,8 @@ export interface AttributeFilterInput { export interface AttributeInput { slug: string; - value?: string | null; values?: (string | null)[] | null; + valuesRange?: IntRangeInput | null; } export interface AttributeSortingInput { From 9b5f571763963a301759f02e4a7a45ac5a6f7869 Mon Sep 17 00:00:00 2001 From: Piotr Grundas Date: Thu, 15 Apr 2021 18:50:37 +0200 Subject: [PATCH 02/11] Add numeric unit control --- schema.graphql | 6 +- .../AttributeDetails/AttributeDetails.tsx | 67 ++--- .../AttributeDetails/NumericUnits.tsx | 112 ++++++++ .../components/AttributeDetails/messages.tsx | 261 ++++++++++++++++++ .../components/AttributeDetails/utils.ts | 96 +++++++ .../AttributePage/AttributePage.tsx | 50 ++-- src/attributes/types/AttributeCreate.ts | 3 +- src/attributes/types/AttributeDetails.ts | 3 +- src/attributes/types/AttributeUpdate.ts | 3 +- src/attributes/types/AttributeValueCreate.ts | 3 +- src/attributes/types/AttributeValueDelete.ts | 3 +- src/attributes/types/AttributeValueUpdate.ts | 3 +- .../SingleSelectField/SingleSelectField.tsx | 6 +- src/fragments/attributes.ts | 1 + .../types/AttributeDetailsFragment.ts | 3 +- src/types/globalTypes.ts | 2 + 16 files changed, 533 insertions(+), 89 deletions(-) create mode 100644 src/attributes/components/AttributeDetails/NumericUnits.tsx create mode 100644 src/attributes/components/AttributeDetails/messages.tsx create mode 100644 src/attributes/components/AttributeDetails/utils.ts diff --git a/schema.graphql b/schema.graphql index 34c789e4bf9..9bfc0ddbb3d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -572,6 +572,7 @@ type AttributeUpdate { input AttributeUpdateInput { name: String slug: String + unit: MeasurementUnitsEnum removeValues: [ID] addValues: [AttributeValueCreateInput] valueRequired: Boolean @@ -2411,11 +2412,12 @@ enum MeasurementUnitsEnum { CUBIC_YARD QT PINT - OZ + FL_OZ ACRE_IN ACRE_FT G LB + OZ KG TONNE } @@ -5691,7 +5693,7 @@ enum VolumeUnitsEnum { CUBIC_YARD QT PINT - OZ + FL_OZ ACRE_IN ACRE_FT } diff --git a/src/attributes/components/AttributeDetails/AttributeDetails.tsx b/src/attributes/components/AttributeDetails/AttributeDetails.tsx index d11da34686b..f1d45b4b70f 100644 --- a/src/attributes/components/AttributeDetails/AttributeDetails.tsx +++ b/src/attributes/components/AttributeDetails/AttributeDetails.tsx @@ -1,6 +1,7 @@ import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import TextField from "@material-ui/core/TextField"; +import { NumericUnits } from "@saleor/attributes/components/AttributeDetails/NumericUnits"; import CardTitle from "@saleor/components/CardTitle"; import ControlledCheckbox from "@saleor/components/ControlledCheckbox"; import FormSpacer from "@saleor/components/FormSpacer"; @@ -20,56 +21,7 @@ import slugify from "slugify"; import { getAttributeSlugErrorMessage } from "../../errors"; import { AttributePageFormData } from "../AttributePage"; - -const messages = defineMessages({ - attributeLabel: { - defaultMessage: "Default Label", - description: "attribute's label" - }, - attributeSlug: { - defaultMessage: "Attribute Code", - description: "attribute's slug short code label" - }, - attributeSlugHelperText: { - defaultMessage: "This is used internally. Make sure you don’t use spaces", - description: "attribute slug input field helper text" - }, - entityType: { - defaultMessage: "Entity", - description: "attribute's editor component entity" - }, - inputType: { - defaultMessage: "Catalog Input type for Store Owner", - description: "attribute's editor component" - }, - valueRequired: { - defaultMessage: "Value Required", - description: "check to require attribute to have value" - } -}); - -const inputTypeMessages = defineMessages({ - dropdown: { - defaultMessage: "Dropdown", - description: "product attribute type" - }, - file: { - defaultMessage: "File", - description: "file attribute type" - }, - multiselect: { - defaultMessage: "Multiple Select", - description: "product attribute type" - }, - references: { - defaultMessage: "References", - description: "references attribute type" - }, - text: { - defaultMessage: "Text", - description: "text attribute type" - } -}); +import { inputTypeMessages, messages } from "./messages"; const entityTypeMessages = defineMessages({ page: { @@ -102,10 +54,11 @@ export interface AttributeDetailsProps { disabled: boolean; errors: AttributeErrorFragment[]; onChange: (event: React.ChangeEvent) => void; + set: (data: Partial) => void; } const AttributeDetails: React.FC = props => { - const { canChangeType, data, disabled, errors, onChange } = props; + const { canChangeType, data, disabled, errors, onChange, set } = props; const classes = useStyles(props); const intl = useIntl(); const inputTypeChoices = [ @@ -128,6 +81,10 @@ const AttributeDetails: React.FC = props => { { label: intl.formatMessage(inputTypeMessages.text), value: AttributeInputTypeEnum.RICH_TEXT + }, + { + label: intl.formatMessage(inputTypeMessages.numeric), + value: AttributeInputTypeEnum.NUMERIC } ]; const entityTypeChoices = [ @@ -210,6 +167,14 @@ const AttributeDetails: React.FC = props => { onChange={onChange} disabled={disabled} /> + {data.inputType === AttributeInputTypeEnum.NUMERIC && ( + + )} ); diff --git a/src/attributes/components/AttributeDetails/NumericUnits.tsx b/src/attributes/components/AttributeDetails/NumericUnits.tsx new file mode 100644 index 00000000000..36b56d805b8 --- /dev/null +++ b/src/attributes/components/AttributeDetails/NumericUnits.tsx @@ -0,0 +1,112 @@ +import { AttributePageFormData } from "@saleor/attributes/components/AttributePage"; +import ControlledCheckbox from "@saleor/components/ControlledCheckbox"; +import SingleSelectField from "@saleor/components/SingleSelectField"; +import { makeStyles } from "@saleor/theme"; +import React, { useEffect, useRef, useState } from "react"; + +import * as M from "./messages"; +import { unitChoices, unitSystemChoices, unitTypeChoices } from "./utils"; + +const useStyles = makeStyles( + theme => ({ + unitsRow: { + columnGap: theme.spacing(2) + "px", + display: "flex", + [theme.breakpoints.down("sm")]: { + flexFlow: "wrap", + rowGap: theme.spacing(3) + "px" + } + }, + hr: { + border: "none", + borderTop: `1px solid ${theme.palette.divider}`, + height: 0, + margin: "0.5rem 0", + width: "100%" + } + }), + { name: "NumericUnits" } +); + +interface NumericUnitsProps { + data: AttributePageFormData; + disabled: boolean; + set: (data: Partial) => void; + onChange: (event: React.ChangeEvent) => void; +} + +export const NumericUnits: React.FC = ({ + onChange, + disabled, + data, + set +}) => { + const classes = useStyles(); + const unitRef = useRef(data.unit); + const [system, setSystem] = useState(null); + const [type, setType] = useState(null); + + useEffect(() => { + if (data.unit) { + Object.entries(unitChoices).find(([system, types]) => { + const systemMatch = Object.entries(types).find(([type, units]) => { + const unitMatch = units.find(({ value }) => value === data.unit); + if (unitMatch) { + setType(type); + } + return unitMatch; + }); + if (systemMatch) { + setSystem(system); + } + return systemMatch; + }); + } + }, []); + + return ( +
+
+ + set({ unit: target.value ? unitRef.current ?? undefined : null }) + } + disabled={disabled} + /> + {data.unit !== null && ( + <> +
+ setSystem(target.value)} + value={system} + disabled={disabled} + /> + setType(target.value)} + disabled={!system || disabled} + value={type} + /> + { + onChange(evt); + unitRef.current = evt.target.value; + }} + disabled={!type || disabled} + value={type ? data.unit : undefined} + /> +
+ + )} +
+ ); +}; diff --git a/src/attributes/components/AttributeDetails/messages.tsx b/src/attributes/components/AttributeDetails/messages.tsx new file mode 100644 index 00000000000..db0ce9ee752 --- /dev/null +++ b/src/attributes/components/AttributeDetails/messages.tsx @@ -0,0 +1,261 @@ +import React from "react"; +import { defineMessages, FormattedMessage } from "react-intl"; + +export const messages = defineMessages({ + attributeLabel: { + defaultMessage: "Default Label", + description: "attribute's label" + }, + attributeSlug: { + defaultMessage: "Attribute Code", + description: "attribute's slug short code label" + }, + attributeSlugHelperText: { + defaultMessage: "This is used internally. Make sure you don’t use spaces", + description: "attribute slug input field helper text" + }, + entityType: { + defaultMessage: "Entity", + description: "attribute's editor component entity" + }, + inputType: { + defaultMessage: "Catalog Input type for Store Owner", + description: "attribute's editor component" + }, + valueRequired: { + defaultMessage: "Value Required", + description: "check to require attribute to have value" + } +}); + +export const inputTypeMessages = defineMessages({ + dropdown: { + defaultMessage: "Dropdown", + description: "product attribute type" + }, + file: { + defaultMessage: "File", + description: "file attribute type" + }, + multiselect: { + defaultMessage: "Multiple Select", + description: "product attribute type" + }, + references: { + defaultMessage: "References", + description: "references attribute type" + }, + text: { + defaultMessage: "Text", + description: "text attribute type" + }, + numeric: { + defaultMessage: "Numeric", + description: "numeric attribute type" + } +}); + +export const selectUnit = ( + +); + +export const unitSystem = ( + +); + +export const unitOf = ( + +); + +export const unit = ( + +); + +/** + * Unit System + */ +export const metric = ( + +); + +export const imperial = ( + +); + +/** + * Unit type + */ +export const volume = ( + +); + +export const distance = ( + +); + +export const weight = ( + +); + +export const area = ( + +); + +/** + * Units + */ + +export const cubicCentimeter = ( + +); + +export const cubicDecimeter = ( + +); + +export const cubicMeter = ( + +); + +export const liter = ( + +); + +export const centimeter = ( + +); + +export const meter = ( + +); + +export const kilometer = ( + +); + +export const gram = ( + +); + +export const kilogram = ( + +); + +export const tonne = ( + +); + +export const squareCentimeter = ( + +); + +export const squareMeter = ( + +); + +export const squareKilometer = ( + +); + +export const cubicFoot = ( + +); + +export const cubicInch = ( + +); + +export const cubicYard = ( + +); + +export const qt = ( + +); + +export const flOz = ( + +); + +export const pint = ( + +); + +export const acreInch = ( + +); + +export const acreFt = ( + +); + +export const ft = ( + +); + +export const yd = ( + +); + +export const inch = ( + +); + +export const oz = ( + +); + +export const lbs = ( + +); + +export const squareFt = ( + +); + +export const squareYd = ( + +); + +export const squareInch = ( + +); diff --git a/src/attributes/components/AttributeDetails/utils.ts b/src/attributes/components/AttributeDetails/utils.ts new file mode 100644 index 00000000000..869c5a74dc6 --- /dev/null +++ b/src/attributes/components/AttributeDetails/utils.ts @@ -0,0 +1,96 @@ +import { Choice } from "@saleor/components/SingleSelectField"; +import { MeasurementUnitsEnum } from "@saleor/types/globalTypes"; + +import * as M from "./messages"; + +export type UnitSystem = "imperial" | "metric"; +export type UnitType = "volume" | "weight" | "area" | "distance"; + +export const unitSystemChoices: Array> = [ + { + label: M.metric, + value: "metric" + }, + { + label: M.imperial, + value: "imperial" + } +]; + +export const unitTypeChoices: Array> = [ + { + label: M.volume, + value: "volume" + }, + { + label: M.distance, + value: "distance" + }, + { + label: M.weight, + value: "weight" + }, + { + label: M.area, + value: "area" + } +]; + +export const unitChoices: { + [key in UnitSystem]: { + [key in UnitType]: Array>; + }; +} = { + imperial: { + volume: [ + { label: M.cubicFoot, value: MeasurementUnitsEnum.CUBIC_FOOT }, + { label: M.cubicInch, value: MeasurementUnitsEnum.CUBIC_INCH }, + { label: M.cubicYard, value: MeasurementUnitsEnum.CUBIC_YARD }, + { label: M.qt, value: MeasurementUnitsEnum.QT }, + { label: M.flOz, value: MeasurementUnitsEnum.FL_OZ }, + { label: M.pint, value: MeasurementUnitsEnum.PINT }, + { label: M.acreInch, value: MeasurementUnitsEnum.ACRE_IN }, + { label: M.acreFt, value: MeasurementUnitsEnum.ACRE_FT } + ], + distance: [ + { label: M.ft, value: MeasurementUnitsEnum.FT }, + { label: M.yd, value: MeasurementUnitsEnum.YD }, + { label: M.inch, value: MeasurementUnitsEnum.INCH } + ], + weight: [ + { label: M.lbs, value: MeasurementUnitsEnum.LB }, + { label: M.oz, value: MeasurementUnitsEnum.OZ } + ], + area: [ + { label: M.squareFt, value: MeasurementUnitsEnum.SQ_FT }, + { label: M.squareYd, value: MeasurementUnitsEnum.SQ_YD }, + { label: M.squareInch, value: MeasurementUnitsEnum.SQ_INCH } + ] + }, + metric: { + volume: [ + { + label: M.cubicCentimeter, + value: MeasurementUnitsEnum.CUBIC_CENTIMETER + }, + { label: M.cubicDecimeter, value: MeasurementUnitsEnum.CUBIC_DECIMETER }, + { label: M.cubicMeter, value: MeasurementUnitsEnum.CUBIC_METER }, + { label: M.liter, value: MeasurementUnitsEnum.LITER } + ], + distance: [ + { label: M.centimeter, value: MeasurementUnitsEnum.CM }, + { label: M.meter, value: MeasurementUnitsEnum.M }, + { label: M.kilometer, value: MeasurementUnitsEnum.KM } + ], + weight: [ + { label: M.gram, value: MeasurementUnitsEnum.G }, + { label: M.kilogram, value: MeasurementUnitsEnum.KG }, + { label: M.tonne, value: MeasurementUnitsEnum.TONNE } + ], + area: [ + { label: M.squareCentimeter, value: MeasurementUnitsEnum.SQ_CM }, + { label: M.squareMeter, value: MeasurementUnitsEnum.SQ_M }, + { label: M.squareKilometer, value: MeasurementUnitsEnum.SQ_KM } + ] + } +}; diff --git a/src/attributes/components/AttributePage/AttributePage.tsx b/src/attributes/components/AttributePage/AttributePage.tsx index e8c56cdd4bc..afa68823ba6 100644 --- a/src/attributes/components/AttributePage/AttributePage.tsx +++ b/src/attributes/components/AttributePage/AttributePage.tsx @@ -20,7 +20,8 @@ import { ReorderAction } from "@saleor/types"; import { AttributeEntityTypeEnum, AttributeInputTypeEnum, - AttributeTypeEnum + AttributeTypeEnum, + MeasurementUnitsEnum } from "@saleor/types/globalTypes"; import { mapMetadataItemToInput } from "@saleor/utils/maps"; import useMetadataChangeTrigger from "@saleor/utils/metadata/useMetadataChangeTrigger"; @@ -59,6 +60,8 @@ export interface AttributePageFormData extends MetadataFormData { slug: string; storefrontSearchPosition: string; valueRequired: boolean; + hasNumericUnit?: boolean; + unit: MeasurementUnitsEnum; visibleInStorefront: boolean; } @@ -90,7 +93,8 @@ const AttributePage: React.FC = ({ entityType: null, filterableInDashboard: true, filterableInStorefront: true, - inputType: AttributeInputTypeEnum.DROPDOWN, + // inputType: AttributeInputTypeEnum.DROPDOWN, + inputType: AttributeInputTypeEnum.NUMERIC, metadata: [], name: "", privateMetadata: [], @@ -98,39 +102,32 @@ const AttributePage: React.FC = ({ storefrontSearchPosition: "", type: AttributeTypeEnum.PRODUCT_TYPE, valueRequired: true, - visibleInStorefront: true + hasNumericUnit: true, + visibleInStorefront: true, + unit: undefined } : { - availableInGrid: maybe(() => attribute.availableInGrid, true), + availableInGrid: attribute?.availableInGrid ?? true, entityType: attribute?.entityType ?? null, - filterableInDashboard: maybe( - () => attribute.filterableInDashboard, - true - ), - filterableInStorefront: maybe( - () => attribute.filterableInStorefront, - true - ), - inputType: maybe( - () => attribute.inputType, - AttributeInputTypeEnum.DROPDOWN - ), + filterableInDashboard: attribute?.filterableInDashboard ?? true, + filterableInStorefront: attribute?.filterableInStorefront ?? true, + inputType: attribute?.inputType ?? AttributeInputTypeEnum.DROPDOWN, metadata: attribute?.metadata?.map(mapMetadataItemToInput), - name: maybe(() => attribute.name, ""), + name: attribute?.name ?? "", privateMetadata: attribute?.privateMetadata?.map( mapMetadataItemToInput ), - slug: maybe(() => attribute.slug, ""), - storefrontSearchPosition: maybe( - () => attribute.storefrontSearchPosition.toString(), - "" - ), + slug: attribute?.slug ?? "", + storefrontSearchPosition: + attribute?.storefrontSearchPosition.toString() ?? "", type: attribute?.type || AttributeTypeEnum.PRODUCT_TYPE, - valueRequired: maybe(() => attribute.valueRequired, true), - visibleInStorefront: maybe(() => attribute.visibleInStorefront, true) + valueRequired: attribute?.valueRequired ?? true, + visibleInStorefront: attribute?.visibleInStorefront ?? true, + hasNumericUnit: !!attribute?.unit, + unit: attribute?.unit }; - const handleSubmit = (data: AttributePageFormData) => { + const handleSubmit = ({ hasNumericUnit, ...data }: AttributePageFormData) => { const metadata = !attribute || isMetadataModified ? data.metadata : undefined; const privateMetadata = @@ -150,7 +147,7 @@ const AttributePage: React.FC = ({ return (
- {({ change, data, hasChanged, submit }) => { + {({ change, set, data, hasChanged, submit }) => { const changeMetadata = makeMetadataChangeHandler(change); return ( @@ -176,6 +173,7 @@ const AttributePage: React.FC = ({ disabled={disabled} errors={errors} onChange={change} + set={set} /> {ATTRIBUTE_TYPES_WITH_DEDICATED_VALUES.includes( data.inputType diff --git a/src/attributes/types/AttributeCreate.ts b/src/attributes/types/AttributeCreate.ts index a0fe08feec1..a53215a6199 100644 --- a/src/attributes/types/AttributeCreate.ts +++ b/src/attributes/types/AttributeCreate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeCreateInput, AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; +import { AttributeCreateInput, AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, AttributeErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: AttributeCreate @@ -51,6 +51,7 @@ export interface AttributeCreate_attributeCreate_attribute { availableInGrid: boolean; inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; + unit: MeasurementUnitsEnum | null; storefrontSearchPosition: number; valueRequired: boolean; values: (AttributeCreate_attributeCreate_attribute_values | null)[] | null; diff --git a/src/attributes/types/AttributeDetails.ts b/src/attributes/types/AttributeDetails.ts index a3db039a392..8f76a17add2 100644 --- a/src/attributes/types/AttributeDetails.ts +++ b/src/attributes/types/AttributeDetails.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL query operation: AttributeDetails @@ -51,6 +51,7 @@ export interface AttributeDetails_attribute { availableInGrid: boolean; inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; + unit: MeasurementUnitsEnum | null; storefrontSearchPosition: number; valueRequired: boolean; values: (AttributeDetails_attribute_values | null)[] | null; diff --git a/src/attributes/types/AttributeUpdate.ts b/src/attributes/types/AttributeUpdate.ts index 5b5047c59bb..7968d9a0d74 100644 --- a/src/attributes/types/AttributeUpdate.ts +++ b/src/attributes/types/AttributeUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeUpdateInput, AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; +import { AttributeUpdateInput, AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, AttributeErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: AttributeUpdate @@ -51,6 +51,7 @@ export interface AttributeUpdate_attributeUpdate_attribute { availableInGrid: boolean; inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; + unit: MeasurementUnitsEnum | null; storefrontSearchPosition: number; valueRequired: boolean; values: (AttributeUpdate_attributeUpdate_attribute_values | null)[] | null; diff --git a/src/attributes/types/AttributeValueCreate.ts b/src/attributes/types/AttributeValueCreate.ts index 3e82f3c2c4b..59e02518024 100644 --- a/src/attributes/types/AttributeValueCreate.ts +++ b/src/attributes/types/AttributeValueCreate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeValueCreateInput, AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; +import { AttributeValueCreateInput, AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, AttributeErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: AttributeValueCreate @@ -51,6 +51,7 @@ export interface AttributeValueCreate_attributeValueCreate_attribute { availableInGrid: boolean; inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; + unit: MeasurementUnitsEnum | null; storefrontSearchPosition: number; valueRequired: boolean; values: (AttributeValueCreate_attributeValueCreate_attribute_values | null)[] | null; diff --git a/src/attributes/types/AttributeValueDelete.ts b/src/attributes/types/AttributeValueDelete.ts index ae093610827..21db2f76be4 100644 --- a/src/attributes/types/AttributeValueDelete.ts +++ b/src/attributes/types/AttributeValueDelete.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; +import { AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, AttributeErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: AttributeValueDelete @@ -51,6 +51,7 @@ export interface AttributeValueDelete_attributeValueDelete_attribute { availableInGrid: boolean; inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; + unit: MeasurementUnitsEnum | null; storefrontSearchPosition: number; valueRequired: boolean; values: (AttributeValueDelete_attributeValueDelete_attribute_values | null)[] | null; diff --git a/src/attributes/types/AttributeValueUpdate.ts b/src/attributes/types/AttributeValueUpdate.ts index 6bd36a6c8e6..f51de943da1 100644 --- a/src/attributes/types/AttributeValueUpdate.ts +++ b/src/attributes/types/AttributeValueUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeValueCreateInput, AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; +import { AttributeValueCreateInput, AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, AttributeErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: AttributeValueUpdate @@ -51,6 +51,7 @@ export interface AttributeValueUpdate_attributeValueUpdate_attribute { availableInGrid: boolean; inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; + unit: MeasurementUnitsEnum | null; storefrontSearchPosition: number; valueRequired: boolean; values: (AttributeValueUpdate_attributeValueUpdate_attribute_values | null)[] | null; diff --git a/src/components/SingleSelectField/SingleSelectField.tsx b/src/components/SingleSelectField/SingleSelectField.tsx index 0e35b054ac9..5b83a4ed5d0 100644 --- a/src/components/SingleSelectField/SingleSelectField.tsx +++ b/src/components/SingleSelectField/SingleSelectField.tsx @@ -28,8 +28,8 @@ const useStyles = makeStyles( { name: "SingleSelectField" } ); -export interface Choice { - value: string; +export interface Choice { + value: T; label: string | React.ReactNode; } @@ -41,7 +41,7 @@ interface SingleSelectFieldProps { disabled?: boolean; error?: boolean; hint?: string; - label?: string; + label?: string | React.ReactNode; name?: string; selectProps?: SelectProps; placeholder?: string; diff --git a/src/fragments/attributes.ts b/src/fragments/attributes.ts index b9db3468e2e..92e5d46f41a 100644 --- a/src/fragments/attributes.ts +++ b/src/fragments/attributes.ts @@ -39,6 +39,7 @@ export const attributeDetailsFragment = gql` availableInGrid inputType entityType + unit storefrontSearchPosition valueRequired values { diff --git a/src/fragments/types/AttributeDetailsFragment.ts b/src/fragments/types/AttributeDetailsFragment.ts index fddd5a6c8e8..afa6fe20044 100644 --- a/src/fragments/types/AttributeDetailsFragment.ts +++ b/src/fragments/types/AttributeDetailsFragment.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: AttributeDetailsFragment @@ -51,6 +51,7 @@ export interface AttributeDetailsFragment { availableInGrid: boolean; inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; + unit: MeasurementUnitsEnum | null; storefrontSearchPosition: number; valueRequired: boolean; values: (AttributeDetailsFragment_values | null)[] | null; diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index 6f635efe42f..e13e3ac57f5 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -541,6 +541,7 @@ export enum MeasurementUnitsEnum { CUBIC_METER = "CUBIC_METER", CUBIC_MILLIMETER = "CUBIC_MILLIMETER", CUBIC_YARD = "CUBIC_YARD", + FL_OZ = "FL_OZ", FT = "FT", G = "G", INCH = "INCH", @@ -1150,6 +1151,7 @@ export interface AttributeSortingInput { export interface AttributeUpdateInput { name?: string | null; slug?: string | null; + unit?: MeasurementUnitsEnum | null; removeValues?: (string | null)[] | null; addValues?: (AttributeValueCreateInput | null)[] | null; valueRequired?: boolean | null; From 2e3901ac7f13972ce30c643c80992f920ef6a6c9 Mon Sep 17 00:00:00 2001 From: Piotr Grundas Date: Fri, 16 Apr 2021 00:38:26 +0200 Subject: [PATCH 03/11] Improvements, tests --- .../AttributeDetails/AttributeDetails.tsx | 15 +- .../AttributeDetails/NumericUnits.tsx | 23 +- .../AttributePage/AttributePage.tsx | 9 +- src/attributes/fixtures.ts | 1 + src/attributes/utils/data.ts | 15 +- src/components/Attributes/AttributeRow.tsx | 17 + src/components/Attributes/fixtures.ts | 28 +- src/fragments/products.ts | 2 + src/fragments/types/Product.ts | 3 +- src/fragments/types/ProductVariant.ts | 4 +- .../types/ProductVariantAttributesFragment.ts | 3 +- .../types/SelectedVariantAttributeFragment.ts | 3 +- .../types/VariantAttributeFragment.ts | 3 +- src/products/fixtures.ts | 7 + .../types/CreateMultipleVariantsData.ts | 3 +- .../types/ProductChannelListingUpdate.ts | 3 +- src/products/types/ProductCreate.ts | 3 +- src/products/types/ProductDetails.ts | 3 +- src/products/types/ProductMediaCreate.ts | 3 +- src/products/types/ProductMediaUpdate.ts | 3 +- src/products/types/ProductUpdate.ts | 3 +- .../ProductVariantChannelListingUpdate.ts | 4 +- .../types/ProductVariantCreateData.ts | 4 +- src/products/types/ProductVariantDetails.ts | 4 +- src/products/types/ProductVariantReorder.ts | 3 +- .../types/ProductVariantSetDefault.ts | 3 +- src/products/types/SimpleProductUpdate.ts | 11 +- src/products/types/VariantCreate.ts | 4 +- src/products/types/VariantMediaAssign.ts | 4 +- src/products/types/VariantMediaUnassign.ts | 4 +- src/products/types/VariantUpdate.ts | 6 +- .../__snapshots__/Stories.test.ts.snap | 745 +++++++++--------- 32 files changed, 511 insertions(+), 435 deletions(-) diff --git a/src/attributes/components/AttributeDetails/AttributeDetails.tsx b/src/attributes/components/AttributeDetails/AttributeDetails.tsx index f1d45b4b70f..237490f6a30 100644 --- a/src/attributes/components/AttributeDetails/AttributeDetails.tsx +++ b/src/attributes/components/AttributeDetails/AttributeDetails.tsx @@ -55,10 +55,19 @@ export interface AttributeDetailsProps { errors: AttributeErrorFragment[]; onChange: (event: React.ChangeEvent) => void; set: (data: Partial) => void; + triggerChange: () => void; } const AttributeDetails: React.FC = props => { - const { canChangeType, data, disabled, errors, onChange, set } = props; + const { + canChangeType, + data, + disabled, + errors, + onChange, + set, + triggerChange + } = props; const classes = useStyles(props); const intl = useIntl(); const inputTypeChoices = [ @@ -99,7 +108,7 @@ const AttributeDetails: React.FC = props => { ]; const formErrors = getFormErrors( - ["name", "slug", "inputType", "entityType"], + ["name", "slug", "inputType", "entityType", "unit"], errors ); @@ -173,6 +182,8 @@ const AttributeDetails: React.FC = props => { disabled={disabled} onChange={onChange} set={set} + triggerChange={triggerChange} + error={getAttributeErrorMessage(formErrors.unit, intl)} /> )} diff --git a/src/attributes/components/AttributeDetails/NumericUnits.tsx b/src/attributes/components/AttributeDetails/NumericUnits.tsx index 36b56d805b8..4b96545345b 100644 --- a/src/attributes/components/AttributeDetails/NumericUnits.tsx +++ b/src/attributes/components/AttributeDetails/NumericUnits.tsx @@ -31,15 +31,19 @@ const useStyles = makeStyles( interface NumericUnitsProps { data: AttributePageFormData; disabled: boolean; - set: (data: Partial) => void; + error: string; onChange: (event: React.ChangeEvent) => void; + set: (data: Partial) => void; + triggerChange: () => void; } export const NumericUnits: React.FC = ({ - onChange, - disabled, data, - set + disabled, + onChange, + set, + triggerChange, + error }) => { const classes = useStyles(); const unitRef = useRef(data.unit); @@ -68,12 +72,13 @@ export const NumericUnits: React.FC = ({
- set({ unit: target.value ? unitRef.current ?? undefined : null }) - } + onChange={({ target }) => { + triggerChange(); + set({ unit: target.value ? unitRef.current ?? undefined : null }); + }} disabled={disabled} /> {data.unit !== null && ( @@ -103,6 +108,8 @@ export const NumericUnits: React.FC = ({ }} disabled={!type || disabled} value={type ? data.unit : undefined} + hint={error} + error={!!error} />
diff --git a/src/attributes/components/AttributePage/AttributePage.tsx b/src/attributes/components/AttributePage/AttributePage.tsx index afa68823ba6..e1bc5cef659 100644 --- a/src/attributes/components/AttributePage/AttributePage.tsx +++ b/src/attributes/components/AttributePage/AttributePage.tsx @@ -60,7 +60,6 @@ export interface AttributePageFormData extends MetadataFormData { slug: string; storefrontSearchPosition: string; valueRequired: boolean; - hasNumericUnit?: boolean; unit: MeasurementUnitsEnum; visibleInStorefront: boolean; } @@ -102,7 +101,6 @@ const AttributePage: React.FC = ({ storefrontSearchPosition: "", type: AttributeTypeEnum.PRODUCT_TYPE, valueRequired: true, - hasNumericUnit: true, visibleInStorefront: true, unit: undefined } @@ -123,11 +121,11 @@ const AttributePage: React.FC = ({ type: attribute?.type || AttributeTypeEnum.PRODUCT_TYPE, valueRequired: attribute?.valueRequired ?? true, visibleInStorefront: attribute?.visibleInStorefront ?? true, - hasNumericUnit: !!attribute?.unit, + unit: attribute?.unit }; - const handleSubmit = ({ hasNumericUnit, ...data }: AttributePageFormData) => { + const handleSubmit = (data: AttributePageFormData) => { const metadata = !attribute || isMetadataModified ? data.metadata : undefined; const privateMetadata = @@ -147,7 +145,7 @@ const AttributePage: React.FC = ({ return ( - {({ change, set, data, hasChanged, submit }) => { + {({ change, set, data, hasChanged, submit, triggerChange }) => { const changeMetadata = makeMetadataChangeHandler(change); return ( @@ -174,6 +172,7 @@ const AttributePage: React.FC = ({ errors={errors} onChange={change} set={set} + triggerChange={triggerChange} /> {ATTRIBUTE_TYPES_WITH_DEDICATED_VALUES.includes( data.inputType diff --git a/src/attributes/fixtures.ts b/src/attributes/fixtures.ts index 84a02b28398..eb31a1f775e 100644 --- a/src/attributes/fixtures.ts +++ b/src/attributes/fixtures.ts @@ -28,6 +28,7 @@ export const attribute: AttributeDetailsFragment = { storefrontSearchPosition: 2, type: AttributeTypeEnum.PRODUCT_TYPE, valueRequired: true, + unit: null, values: [ { __typename: "AttributeValue" as "AttributeValue", diff --git a/src/attributes/utils/data.ts b/src/attributes/utils/data.ts index cb52a11fdd7..fe6d65a042d 100644 --- a/src/attributes/utils/data.ts +++ b/src/attributes/utils/data.ts @@ -77,10 +77,19 @@ export function getSelectedAttributeValues( | ProductDetails_product_attributes | SelectedVariantAttributeFragment ) { - if (attribute.attribute.inputType === AttributeInputTypeEnum.REFERENCE) { - return attribute.values.map(value => value.reference); + switch (attribute.attribute.inputType) { + case AttributeInputTypeEnum.REFERENCE: + return attribute.values.map(value => value.reference); + + case AttributeInputTypeEnum.RICH_TEXT: + return [attribute.values[0]?.richText]; + + case AttributeInputTypeEnum.NUMERIC: + return [attribute.values[0]?.name]; + + default: + return attribute.values.map(value => value.slug); } - return attribute.values.map(value => value.slug); } export const isFileValueUnused = ( diff --git a/src/components/Attributes/AttributeRow.tsx b/src/components/Attributes/AttributeRow.tsx index a5da29d7866..de678f4359c 100644 --- a/src/components/Attributes/AttributeRow.tsx +++ b/src/components/Attributes/AttributeRow.tsx @@ -1,3 +1,4 @@ +import { TextField } from "@material-ui/core"; import makeStyles from "@material-ui/core/styles/makeStyles"; import { AttributeInput } from "@saleor/components/Attributes/Attributes"; import BasicAttributeRow from "@saleor/components/Attributes/BasicAttributeRow"; @@ -158,6 +159,22 @@ const AttributeRow: React.FC = ({ /> ); + case AttributeInputTypeEnum.NUMERIC: + return ( + + onChange(attribute.id, event.target.value)} + type="numeric" + value={attribute.value[0]} + /> + + ); default: return ( diff --git a/src/components/Attributes/fixtures.ts b/src/components/Attributes/fixtures.ts index a0126c9d5eb..21a1758338b 100644 --- a/src/components/Attributes/fixtures.ts +++ b/src/components/Attributes/fixtures.ts @@ -193,12 +193,34 @@ const RICH_TEXT_ATTRIBUTE: AttributeInput = { value: [] }; +const NUMERIC_ATTRIBUTE: AttributeInput = { + data: { + inputType: AttributeInputTypeEnum.NUMERIC, + isRequired: true, + values: [ + { + __typename: "AttributeValue", + file: null, + id: "QXR0cmlidXRlVmFsdWU6MTAx", + name: "12cm", + reference: null, + richText: null, + slug: "319_35" + } + ] + }, + id: "QXR0cmlidXRlOjM1", + label: "Numeric Attribute", + value: [] +}; + export const ATTRIBUTES: AttributeInput[] = [ DROPDOWN_ATTRIBUTE, MULTISELECT_ATTRIBUTE, FILE_ATTRIBUTE, REFERENCE_ATTRIBUTE, - RICH_TEXT_ATTRIBUTE + RICH_TEXT_ATTRIBUTE, + NUMERIC_ATTRIBUTE ]; export const ATTRIBUTES_SELECTED: AttributeInput[] = [ @@ -228,5 +250,9 @@ export const ATTRIBUTES_SELECTED: AttributeInput[] = [ { ...RICH_TEXT_ATTRIBUTE, value: [RICH_TEXT_ATTRIBUTE.data.values[0].richText] + }, + { + ...NUMERIC_ATTRIBUTE, + value: [NUMERIC_ATTRIBUTE.data.values[0].name] } ]; diff --git a/src/fragments/products.ts b/src/fragments/products.ts index e2fb2273fd5..75b85b7633c 100644 --- a/src/fragments/products.ts +++ b/src/fragments/products.ts @@ -127,6 +127,7 @@ export const productVariantAttributesFragment = gql` inputType entityType valueRequired + unit values { ...AttributeValueFragment } @@ -236,6 +237,7 @@ export const variantAttributeFragment = gql` inputType entityType valueRequired + unit values { ...AttributeValueFragment } diff --git a/src/fragments/types/Product.ts b/src/fragments/types/Product.ts index 14ef89acd74..561bb6cad51 100644 --- a/src/fragments/types/Product.ts +++ b/src/fragments/types/Product.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: Product @@ -33,6 +33,7 @@ export interface Product_attributes_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (Product_attributes_attribute_values | null)[] | null; } diff --git a/src/fragments/types/ProductVariant.ts b/src/fragments/types/ProductVariant.ts index de5aee4b014..306ea866db0 100644 --- a/src/fragments/types/ProductVariant.ts +++ b/src/fragments/types/ProductVariant.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: ProductVariant @@ -45,6 +45,7 @@ export interface ProductVariant_selectionAttributes_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -94,6 +95,7 @@ export interface ProductVariant_nonSelectionAttributes_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariant_nonSelectionAttributes_attribute_values | null)[] | null; } diff --git a/src/fragments/types/ProductVariantAttributesFragment.ts b/src/fragments/types/ProductVariantAttributesFragment.ts index 94101bc52ed..2cc0c665706 100644 --- a/src/fragments/types/ProductVariantAttributesFragment.ts +++ b/src/fragments/types/ProductVariantAttributesFragment.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: ProductVariantAttributesFragment @@ -33,6 +33,7 @@ export interface ProductVariantAttributesFragment_attributes_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantAttributesFragment_attributes_attribute_values | null)[] | null; } diff --git a/src/fragments/types/SelectedVariantAttributeFragment.ts b/src/fragments/types/SelectedVariantAttributeFragment.ts index 3bca456b461..383ad35a212 100644 --- a/src/fragments/types/SelectedVariantAttributeFragment.ts +++ b/src/fragments/types/SelectedVariantAttributeFragment.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: SelectedVariantAttributeFragment @@ -33,6 +33,7 @@ export interface SelectedVariantAttributeFragment_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SelectedVariantAttributeFragment_attribute_values | null)[] | null; } diff --git a/src/fragments/types/VariantAttributeFragment.ts b/src/fragments/types/VariantAttributeFragment.ts index ec7caa47679..04313d81fce 100644 --- a/src/fragments/types/VariantAttributeFragment.ts +++ b/src/fragments/types/VariantAttributeFragment.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: VariantAttributeFragment @@ -33,5 +33,6 @@ export interface VariantAttributeFragment { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantAttributeFragment_values | null)[] | null; } diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index 6017fe85df6..f3f63e171e9 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -29,6 +29,7 @@ export const product: ( name: "Borders", slug: "Borders", valueRequired: false, + unit: null, values: [ { __typename: "AttributeValue", @@ -72,6 +73,7 @@ export const product: ( name: "Legacy", slug: "Legacy", valueRequired: true, + unit: null, values: [ { __typename: "AttributeValue", @@ -289,6 +291,7 @@ export const product: ( name: "Attachment", slug: "attachment", valueRequired: true, + unit: null, values: [ { __typename: "AttributeValue", @@ -315,6 +318,7 @@ export const product: ( name: "Color", slug: "color", valueRequired: true, + unit: null, values: [ { __typename: "AttributeValue", @@ -2778,6 +2782,7 @@ export const variant = (placeholderImage: string): ProductVariant => ({ name: "Attachment", slug: "attachment", valueRequired: true, + unit: null, values: [ { __typename: "AttributeValue", @@ -3042,6 +3047,7 @@ export const variant = (placeholderImage: string): ProductVariant => ({ name: "Borders", slug: "Borders", valueRequired: true, + unit: null, values: [ { __typename: "AttributeValue", @@ -3085,6 +3091,7 @@ export const variant = (placeholderImage: string): ProductVariant => ({ name: "Legacy", slug: "Legacy", valueRequired: true, + unit: null, values: [ { __typename: "AttributeValue", diff --git a/src/products/types/CreateMultipleVariantsData.ts b/src/products/types/CreateMultipleVariantsData.ts index 7f9618fcbe6..aa904b78438 100644 --- a/src/products/types/CreateMultipleVariantsData.ts +++ b/src/products/types/CreateMultipleVariantsData.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL query operation: CreateMultipleVariantsData @@ -33,6 +33,7 @@ export interface CreateMultipleVariantsData_product_attributes_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (CreateMultipleVariantsData_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductChannelListingUpdate.ts b/src/products/types/ProductChannelListingUpdate.ts index 312fbb71f49..14c33c4c4e4 100644 --- a/src/products/types/ProductChannelListingUpdate.ts +++ b/src/products/types/ProductChannelListingUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductChannelListingUpdateInput, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum, ProductErrorCode } from "./../../types/globalTypes"; +import { ProductChannelListingUpdateInput, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum, ProductErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductChannelListingUpdate @@ -33,6 +33,7 @@ export interface ProductChannelListingUpdate_productChannelListingUpdate_product inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductCreate.ts b/src/products/types/ProductCreate.ts index 387fb71846f..0da590041d8 100644 --- a/src/products/types/ProductCreate.ts +++ b/src/products/types/ProductCreate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductCreateInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductCreateInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductCreate @@ -40,6 +40,7 @@ export interface ProductCreate_productCreate_product_attributes_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductCreate_productCreate_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductDetails.ts b/src/products/types/ProductDetails.ts index 824578fd09e..f1ba2cb1853 100644 --- a/src/products/types/ProductDetails.ts +++ b/src/products/types/ProductDetails.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL query operation: ProductDetails @@ -33,6 +33,7 @@ export interface ProductDetails_product_attributes_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductDetails_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductMediaCreate.ts b/src/products/types/ProductMediaCreate.ts index 192358dcd0d..7c5c24780e7 100644 --- a/src/products/types/ProductMediaCreate.ts +++ b/src/products/types/ProductMediaCreate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductMediaCreate @@ -39,6 +39,7 @@ export interface ProductMediaCreate_productMediaCreate_product_attributes_attrib inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductMediaCreate_productMediaCreate_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductMediaUpdate.ts b/src/products/types/ProductMediaUpdate.ts index 9ec1e8d5648..40c738cb00c 100644 --- a/src/products/types/ProductMediaUpdate.ts +++ b/src/products/types/ProductMediaUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductMediaUpdate @@ -39,6 +39,7 @@ export interface ProductMediaUpdate_productMediaUpdate_product_attributes_attrib inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductMediaUpdate_productMediaUpdate_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductUpdate.ts b/src/products/types/ProductUpdate.ts index 34bcbeef998..5a6686c4fb5 100644 --- a/src/products/types/ProductUpdate.ts +++ b/src/products/types/ProductUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductUpdate @@ -40,6 +40,7 @@ export interface ProductUpdate_productUpdate_product_attributes_attribute { inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductUpdate_productUpdate_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductVariantChannelListingUpdate.ts b/src/products/types/ProductVariantChannelListingUpdate.ts index 34a8db6840e..b108773be84 100644 --- a/src/products/types/ProductVariantChannelListingUpdate.ts +++ b/src/products/types/ProductVariantChannelListingUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductVariantChannelListingAddInput, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum, ProductErrorCode } from "./../../types/globalTypes"; +import { ProductVariantChannelListingAddInput, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum, ProductErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductVariantChannelListingUpdate @@ -45,6 +45,7 @@ export interface ProductVariantChannelListingUpdate_productVariantChannelListing inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute_values | null)[] | null; } @@ -94,6 +95,7 @@ export interface ProductVariantChannelListingUpdate_productVariantChannelListing inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductVariantCreateData.ts b/src/products/types/ProductVariantCreateData.ts index 37396976c54..9abc72fc8f2 100644 --- a/src/products/types/ProductVariantCreateData.ts +++ b/src/products/types/ProductVariantCreateData.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType } from "./../../types/globalTypes"; // ==================================================== // GraphQL query operation: ProductVariantCreateData @@ -52,6 +52,7 @@ export interface ProductVariantCreateData_product_productType_selectionVariantAt inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantCreateData_product_productType_selectionVariantAttributes_values | null)[] | null; } @@ -79,6 +80,7 @@ export interface ProductVariantCreateData_product_productType_nonSelectionVarian inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_values | null)[] | null; } diff --git a/src/products/types/ProductVariantDetails.ts b/src/products/types/ProductVariantDetails.ts index bae241e45f7..d6394838cde 100644 --- a/src/products/types/ProductVariantDetails.ts +++ b/src/products/types/ProductVariantDetails.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL query operation: ProductVariantDetails @@ -45,6 +45,7 @@ export interface ProductVariantDetails_productVariant_selectionAttributes_attrib inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantDetails_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -94,6 +95,7 @@ export interface ProductVariantDetails_productVariant_nonSelectionAttributes_att inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductVariantReorder.ts b/src/products/types/ProductVariantReorder.ts index 7e2410b8028..012f35e1a10 100644 --- a/src/products/types/ProductVariantReorder.ts +++ b/src/products/types/ProductVariantReorder.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ReorderInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ReorderInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductVariantReorder @@ -39,6 +39,7 @@ export interface ProductVariantReorder_productVariantReorder_product_attributes_ inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantReorder_productVariantReorder_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/ProductVariantSetDefault.ts b/src/products/types/ProductVariantSetDefault.ts index 779483e5d5f..25a4850c9b8 100644 --- a/src/products/types/ProductVariantSetDefault.ts +++ b/src/products/types/ProductVariantSetDefault.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductVariantSetDefault @@ -39,6 +39,7 @@ export interface ProductVariantSetDefault_productVariantSetDefault_product_attri inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute_values | null)[] | null; } diff --git a/src/products/types/SimpleProductUpdate.ts b/src/products/types/SimpleProductUpdate.ts index 236938ed1df..9dc93f6a48d 100644 --- a/src/products/types/SimpleProductUpdate.ts +++ b/src/products/types/SimpleProductUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductInput, ProductVariantInput, StockInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum, StockErrorCode } from "./../../types/globalTypes"; +import { ProductInput, ProductVariantInput, StockInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum, StockErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: SimpleProductUpdate @@ -40,6 +40,7 @@ export interface SimpleProductUpdate_productUpdate_product_attributes_attribute inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productUpdate_product_attributes_attribute_values | null)[] | null; } @@ -330,6 +331,7 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_selecti inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -379,6 +381,7 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSele inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } @@ -617,6 +620,7 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_s inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -666,6 +670,7 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_n inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } @@ -903,6 +908,7 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_s inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -952,6 +958,7 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_n inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } @@ -1190,6 +1197,7 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_s inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -1239,6 +1247,7 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_n inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } diff --git a/src/products/types/VariantCreate.ts b/src/products/types/VariantCreate.ts index 12739ce1cd3..cce8e390fdb 100644 --- a/src/products/types/VariantCreate.ts +++ b/src/products/types/VariantCreate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductVariantCreateInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductVariantCreateInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: VariantCreate @@ -52,6 +52,7 @@ export interface VariantCreate_productVariantCreate_productVariant_selectionAttr inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -101,6 +102,7 @@ export interface VariantCreate_productVariantCreate_productVariant_nonSelectionA inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } diff --git a/src/products/types/VariantMediaAssign.ts b/src/products/types/VariantMediaAssign.ts index 0014cb8586c..5dcf68bf743 100644 --- a/src/products/types/VariantMediaAssign.ts +++ b/src/products/types/VariantMediaAssign.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: VariantMediaAssign @@ -51,6 +51,7 @@ export interface VariantMediaAssign_variantMediaAssign_productVariant_selectionA inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantMediaAssign_variantMediaAssign_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -100,6 +101,7 @@ export interface VariantMediaAssign_variantMediaAssign_productVariant_nonSelecti inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantMediaAssign_variantMediaAssign_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } diff --git a/src/products/types/VariantMediaUnassign.ts b/src/products/types/VariantMediaUnassign.ts index 0d688200a73..0fe9dc3176e 100644 --- a/src/products/types/VariantMediaUnassign.ts +++ b/src/products/types/VariantMediaUnassign.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: VariantMediaUnassign @@ -51,6 +51,7 @@ export interface VariantMediaUnassign_variantMediaUnassign_productVariant_select inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantMediaUnassign_variantMediaUnassign_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -100,6 +101,7 @@ export interface VariantMediaUnassign_variantMediaUnassign_productVariant_nonSel inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantMediaUnassign_variantMediaUnassign_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } diff --git a/src/products/types/VariantUpdate.ts b/src/products/types/VariantUpdate.ts index c53afdba66b..d3a3620abf2 100644 --- a/src/products/types/VariantUpdate.ts +++ b/src/products/types/VariantUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { StockInput, AttributeValueInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, ProductMediaType, WeightUnitsEnum, StockErrorCode } from "./../../types/globalTypes"; +import { StockInput, AttributeValueInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum, StockErrorCode } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: VariantUpdate @@ -52,6 +52,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant_selectionAttr inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -101,6 +102,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant_nonSelectionA inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } @@ -339,6 +341,7 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant_selecti inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute_values | null)[] | null; } @@ -388,6 +391,7 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant_nonSele inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; valueRequired: boolean; + unit: MeasurementUnitsEnum | null; values: (VariantUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; } diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 822c6fa3e05..b01eefe0cd5 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -61,7 +61,7 @@ exports[`Storyshots Attributes / Attributes default 1`] = `
- 5 Attributes + 6 Attributes
+
+
+
+
+ Numeric Attribute +
+
+
+
+ +
+ + +
+
+
+
@@ -408,7 +461,7 @@ exports[`Storyshots Attributes / Attributes disabled 1`] = `
- 5 Attributes + 6 Attributes
- - -
-
-
- - - - - - - - - - - - - - - + + + + + +
-
- - - - - -
- - Admin - - Default Store View - -
+
+ + + +
+ + +
- -
-
- -
- - -
-
@@ -31599,123 +31673,6 @@ exports[`Storyshots Views / Attributes / Attribute details create 1`] = `
-
-
- Dashboard Properties -
-
-
- -
-
From 94f70def0c595bcaff9410360574455277dac88c Mon Sep 17 00:00:00 2001 From: Piotr Grundas Date: Fri, 16 Apr 2021 00:48:07 +0200 Subject: [PATCH 04/11] Cleanup --- CHANGELOG.md | 1 + src/attributes/components/AttributeDetails/messages.tsx | 1 - src/attributes/components/AttributePage/AttributePage.tsx | 3 +-- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4888fadf747..0df3bbe7125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ All notable, unreleased changes to this project will be documented in this file. - Add multiline field plugins - #974 by @dominik-zeglen - Handle limit reached error - #990 by @dominik-zeglen - Display Cloud limits - #1004 by @dominik-zeglen +- Introducing numeric attributes - #1065 by @piotrgrundas # 2.11.1 diff --git a/src/attributes/components/AttributeDetails/messages.tsx b/src/attributes/components/AttributeDetails/messages.tsx index db0ce9ee752..98b7ad0fa92 100644 --- a/src/attributes/components/AttributeDetails/messages.tsx +++ b/src/attributes/components/AttributeDetails/messages.tsx @@ -122,7 +122,6 @@ export const area = ( /** * Units */ - export const cubicCentimeter = ( = ({ entityType: null, filterableInDashboard: true, filterableInStorefront: true, - // inputType: AttributeInputTypeEnum.DROPDOWN, - inputType: AttributeInputTypeEnum.NUMERIC, + inputType: AttributeInputTypeEnum.DROPDOWN, metadata: [], name: "", privateMetadata: [], From 8335fa8982a682ad8e442d49658a06279d2c9518 Mon Sep 17 00:00:00 2001 From: Piotr Grundas Date: Fri, 16 Apr 2021 00:58:02 +0200 Subject: [PATCH 05/11] Add messages --- locale/defaultMessages.json | 160 ++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 1af33ea2696..35c16e41722 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -853,6 +853,162 @@ "context": "dialog content", "string": "Are you sure you want to delete {attributeName}?" }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1147307135": { + "context": "tonne unit", + "string": "Tonne" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1221523190": { + "context": "ft unit", + "string": "Ft" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_125992234": { + "context": "numeric attribute unit", + "string": "Unit" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1324086021": { + "context": "pint unit", + "string": "Pint" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1375243004": { + "context": "square-ft unit", + "string": "Square-Ft" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1390397602": { + "context": "numeric attribute unit system", + "string": "System" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1419215975": { + "context": "yd unit", + "string": "Yd" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1452812742": { + "context": "liter unit", + "string": "Liter" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_157021805": { + "context": "numeric attribute units of", + "string": "Units of" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1576912740": { + "context": "area units type", + "string": "Area" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_17940089": { + "context": "kilometer unit", + "string": "Kilometer" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1925361915": { + "context": "square-yd unit", + "string": "Square-Yd" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1938778503": { + "context": "centimeter unit", + "string": "Centimeter" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_1963548912": { + "context": "imperial unit system", + "string": "Imperial" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_2171375311": { + "context": "oz unit", + "string": "Oz" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_2342608399": { + "context": "square kilometer unit", + "string": "Square kilometer" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_2456311770": { + "context": "kilogram unit", + "string": "Kilogram" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_2649599491": { + "context": "lbs unit", + "string": "Lbs" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_2664450042": { + "context": "acre-ft unit", + "string": "Acre-ft" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_2674419647": { + "context": "square centimeter unit", + "string": "Square centimeter" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_2947839983": { + "context": "metric unit system", + "string": "Metric" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3270643849": { + "context": "Cubic decimeter unit", + "string": "Cubic decimeter" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3356185531": { + "context": "gram unit", + "string": "Gram" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3478830201": { + "context": "cubic foot unit", + "string": "Cubic foot" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3508697999": { + "context": "inch unit", + "string": "Inch" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3595883383": { + "context": "volume units types", + "string": "Volume" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3677139172": { + "context": "meter unit", + "string": "Meter" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3689623941": { + "context": "cubic yard unit", + "string": "Cubic yard" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3741974768": { + "context": "Cubic meter unit", + "string": "Cubic meter" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3751057141": { + "context": "qt unit", + "string": "Qt" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3839343241": { + "context": "square-inch unit", + "string": "Square-Inch" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_387759205": { + "context": "cubic inch unit", + "string": "Cubic inch" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_3889193046": { + "context": "distance units type", + "string": "Distance" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_4086814772": { + "context": "acre-inch unit", + "string": "Acre-inch" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_746695941": { + "context": "weight units type", + "string": "Weight" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_76684322": { + "context": "Cubic centimeter unit", + "string": "Cubic centimeter" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_825583211": { + "context": "fl.oz unit", + "string": "Fl.Oz" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_921106469": { + "context": "square meter unit", + "string": "Square meter" + }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_935262293": { + "context": "check to require numeric attribute unit", + "string": "Select unit" + }, "src_dot_attributes_dot_components_dot_AttributeDetails_dot_attributeLabel": { "context": "attribute's label", "string": "Default Label" @@ -885,6 +1041,10 @@ "context": "product attribute type", "string": "Multiple Select" }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_numeric": { + "context": "numeric attribute type", + "string": "Numeric" + }, "src_dot_attributes_dot_components_dot_AttributeDetails_dot_page": { "context": "page attribute entity type", "string": "Pages" From e6da5144f3ceb0812f01e840834d9a062216ff14 Mon Sep 17 00:00:00 2001 From: Piotr Grundas Date: Fri, 16 Apr 2021 09:00:05 +0200 Subject: [PATCH 06/11] Small fixes --- .../AttributeDetails/NumericUnits.tsx | 60 +- .../__snapshots__/Stories.test.ts.snap | 580 ++++++++++++------ 2 files changed, 421 insertions(+), 219 deletions(-) diff --git a/src/attributes/components/AttributeDetails/NumericUnits.tsx b/src/attributes/components/AttributeDetails/NumericUnits.tsx index 4b96545345b..e3cfece04d4 100644 --- a/src/attributes/components/AttributeDetails/NumericUnits.tsx +++ b/src/attributes/components/AttributeDetails/NumericUnits.tsx @@ -82,37 +82,35 @@ export const NumericUnits: React.FC = ({ disabled={disabled} /> {data.unit !== null && ( - <> -
- setSystem(target.value)} - value={system} - disabled={disabled} - /> - setType(target.value)} - disabled={!system || disabled} - value={type} - /> - { - onChange(evt); - unitRef.current = evt.target.value; - }} - disabled={!type || disabled} - value={type ? data.unit : undefined} - hint={error} - error={!!error} - /> -
- +
+ setSystem(target.value)} + value={system} + disabled={disabled} + /> + setType(target.value)} + disabled={!system || disabled} + value={type} + /> + { + onChange(evt); + unitRef.current = evt.target.value; + }} + disabled={!type || disabled} + value={type ? data.unit : undefined} + hint={error} + error={!!error} + /> +
)}
); diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 0371243ab45..814fef7aae0 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -33101,14 +33101,14 @@ exports[`Storyshots Views / Attributes / Attribute details create 1`] = ` role="button" tabindex="0" > - Numeric + Dropdown
-
-
+
+
+
+ + Attribute Values + +
+ +
+
+
+
+
+ + + + + + + + + + + + - -
-
- - ​ - -
- -
+ + + + +
+ + Admin + + Default Store View + +
+ +
+
+ +
+ + +
+
@@ -33753,6 +33840,123 @@ exports[`Storyshots Views / Attributes / Attribute details create 1`] = `
+
+
+ Dashboard Properties +
+
+
+ +
+
From 9ce1736d37539e4a361942864d65e991c16d4dc2 Mon Sep 17 00:00:00 2001 From: Piotr Grundas Date: Fri, 16 Apr 2021 09:11:14 +0200 Subject: [PATCH 07/11] Add test id's --- src/attributes/components/AttributeDetails/NumericUnits.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/attributes/components/AttributeDetails/NumericUnits.tsx b/src/attributes/components/AttributeDetails/NumericUnits.tsx index e3cfece04d4..42fae011db6 100644 --- a/src/attributes/components/AttributeDetails/NumericUnits.tsx +++ b/src/attributes/components/AttributeDetails/NumericUnits.tsx @@ -72,6 +72,7 @@ export const NumericUnits: React.FC = ({
= ({ {data.unit !== null && (
setSystem(target.value)} @@ -91,6 +93,7 @@ export const NumericUnits: React.FC = ({ disabled={disabled} /> setType(target.value)} @@ -98,6 +101,7 @@ export const NumericUnits: React.FC = ({ value={type} /> Date: Sat, 17 Apr 2021 01:05:46 +0200 Subject: [PATCH 08/11] Improve useForm, logic --- .../AttributeDetails/AttributeDetails.tsx | 46 ++++--- .../AttributeDetails/NumericUnits.tsx | 95 +++++++++----- .../components/AttributeDetails/messages.tsx | 3 + .../components/AttributeDetails/utils.ts | 123 ++++++++++++------ .../AttributePage/AttributePage.tsx | 26 ++-- src/attributes/fixtures.ts | 12 ++ src/attributes/types/AttributeCreate.ts | 4 +- src/attributes/types/AttributeDetails.ts | 4 +- src/attributes/types/AttributeList.ts | 3 +- src/attributes/types/AttributeUpdate.ts | 4 +- src/attributes/types/AttributeValueCreate.ts | 4 +- src/attributes/types/AttributeValueDelete.ts | 4 +- src/attributes/types/AttributeValueUpdate.ts | 4 +- src/components/Attributes/AttributeRow.tsx | 12 +- src/components/Attributes/Attributes.tsx | 4 +- .../Attributes/BasicAttributeRow.tsx | 2 +- .../SingleSelectField/SingleSelectField.tsx | 2 +- src/fragments/attributes.ts | 1 + .../types/AttributeDetailsFragment.ts | 4 +- src/fragments/types/AttributeFragment.ts | 3 +- .../types/PageTypeDetailsFragment.ts | 3 +- .../types/ProductTypeDetailsFragment.ts | 4 +- src/hooks/useForm.ts | 32 ++++- src/pageTypes/fixtures.ts | 9 +- src/pageTypes/types/AssignPageAttribute.ts | 3 +- .../types/PageTypeAttributeReorder.ts | 3 +- src/pageTypes/types/PageTypeCreate.ts | 3 +- src/pageTypes/types/PageTypeDetails.ts | 3 +- src/pageTypes/types/PageTypeUpdate.ts | 3 +- src/pageTypes/types/UnassignPageAttribute.ts | 3 +- src/productTypes/fixtures.ts | 15 ++- .../types/AssignProductAttribute.ts | 4 +- .../types/ProductTypeAttributeReorder.ts | 4 +- src/productTypes/types/ProductTypeCreate.ts | 4 +- src/productTypes/types/ProductTypeDetails.ts | 4 +- src/productTypes/types/ProductTypeUpdate.ts | 4 +- .../types/UnassignProductAttribute.ts | 4 +- src/products/utils/data.ts | 2 + .../__snapshots__/Stories.test.ts.snap | 27 ++-- 39 files changed, 342 insertions(+), 152 deletions(-) diff --git a/src/attributes/components/AttributeDetails/AttributeDetails.tsx b/src/attributes/components/AttributeDetails/AttributeDetails.tsx index 237490f6a30..9ff1a46c491 100644 --- a/src/attributes/components/AttributeDetails/AttributeDetails.tsx +++ b/src/attributes/components/AttributeDetails/AttributeDetails.tsx @@ -7,6 +7,7 @@ import ControlledCheckbox from "@saleor/components/ControlledCheckbox"; import FormSpacer from "@saleor/components/FormSpacer"; import SingleSelectField from "@saleor/components/SingleSelectField"; import { AttributeErrorFragment } from "@saleor/fragments/types/AttributeErrorFragment"; +import { UseFormResult } from "@saleor/hooks/useForm"; import { commonMessages } from "@saleor/intl"; import { makeStyles } from "@saleor/theme"; import { @@ -48,25 +49,28 @@ const useStyles = makeStyles( { name: "AttributeDetails" } ); -export interface AttributeDetailsProps { +export interface AttributeDetailsProps + extends Pick< + UseFormResult, + "set" | "setError" | "data" | "clearErrors" | "errors" + > { canChangeType: boolean; - data: AttributePageFormData; disabled: boolean; - errors: AttributeErrorFragment[]; + apiErrors: AttributeErrorFragment[]; onChange: (event: React.ChangeEvent) => void; - set: (data: Partial) => void; - triggerChange: () => void; } const AttributeDetails: React.FC = props => { const { canChangeType, + errors, + clearErrors, + setError, data, disabled, - errors, + apiErrors, onChange, - set, - triggerChange + set } = props; const classes = useStyles(props); const intl = useIntl(); @@ -107,9 +111,9 @@ const AttributeDetails: React.FC = props => { } ]; - const formErrors = getFormErrors( + const formApiErrors = getFormErrors( ["name", "slug", "inputType", "entityType", "unit"], - errors + apiErrors ); return ( @@ -120,24 +124,24 @@ const AttributeDetails: React.FC = props => { = props => { = props => { = props => { {data.inputType === AttributeInputTypeEnum.NUMERIC && ( )} diff --git a/src/attributes/components/AttributeDetails/NumericUnits.tsx b/src/attributes/components/AttributeDetails/NumericUnits.tsx index 42fae011db6..c1697d032dc 100644 --- a/src/attributes/components/AttributeDetails/NumericUnits.tsx +++ b/src/attributes/components/AttributeDetails/NumericUnits.tsx @@ -1,11 +1,20 @@ import { AttributePageFormData } from "@saleor/attributes/components/AttributePage"; import ControlledCheckbox from "@saleor/components/ControlledCheckbox"; import SingleSelectField from "@saleor/components/SingleSelectField"; +import { UseFormResult } from "@saleor/hooks/useForm"; import { makeStyles } from "@saleor/theme"; -import React, { useEffect, useRef, useState } from "react"; +import { MeasurementUnitsEnum } from "@saleor/types/globalTypes"; +import React, { useEffect, useState } from "react"; import * as M from "./messages"; -import { unitChoices, unitSystemChoices, unitTypeChoices } from "./utils"; +import { + unitChoices, + unitMapping, + UnitSystem, + unitSystemChoices, + UnitType, + unitTypeChoices +} from "./utils"; const useStyles = makeStyles( theme => ({ @@ -28,46 +37,68 @@ const useStyles = makeStyles( { name: "NumericUnits" } ); -interface NumericUnitsProps { - data: AttributePageFormData; +interface UnitData { + unit: MeasurementUnitsEnum; + system: UnitSystem; + type: UnitType; +} + +interface NumericUnitsProps + extends Pick< + UseFormResult, + "set" | "setError" | "data" | "errors" | "clearErrors" + > { disabled: boolean; - error: string; - onChange: (event: React.ChangeEvent) => void; - set: (data: Partial) => void; - triggerChange: () => void; } export const NumericUnits: React.FC = ({ data, disabled, - onChange, + errors, set, - triggerChange, - error + setError, + clearErrors }) => { const classes = useStyles(); - const unitRef = useRef(data.unit); - const [system, setSystem] = useState(null); - const [type, setType] = useState(null); + const [unitData, setUnitData] = useState>({ + unit: data.unit + }); + + const { unit, system, type } = unitData; + const errorProps = { error: !!errors.unit, hint: M.required }; + + useEffect(() => set({ unit }), [unit]); useEffect(() => { if (data.unit) { + const initialData = { unit: data.unit } as UnitData; + Object.entries(unitChoices).find(([system, types]) => { const systemMatch = Object.entries(types).find(([type, units]) => { const unitMatch = units.find(({ value }) => value === data.unit); if (unitMatch) { - setType(type); + initialData.type = type as UnitType; } return unitMatch; }); if (systemMatch) { - setSystem(system); + initialData.system = system as UnitSystem; } return systemMatch; }); + setUnitData(initialData); } }, []); + useEffect(() => { + if (unit === undefined && !errors.unit) { + setError("unit", M.required); + } + if (errors.unit && (unit || unit === null)) { + clearErrors("unit"); + } + }, [unitData, errors]); + return (
@@ -76,43 +107,47 @@ export const NumericUnits: React.FC = ({ name="selectUnit" label={M.selectUnit} checked={data.unit !== null} - onChange={({ target }) => { - triggerChange(); - set({ unit: target.value ? unitRef.current ?? undefined : null }); - }} + onChange={({ target }) => + setUnitData({ unit: target.value ? undefined : null }) + } disabled={disabled} /> {data.unit !== null && (
setSystem(target.value)} + onChange={({ target }) => setUnitData({ system: target.value })} value={system} disabled={disabled} /> setType(target.value)} + onChange={({ target }) => + setUnitData(({ system }) => ({ system, type: target.value })) + } disabled={!system || disabled} value={type} /> { - onChange(evt); - unitRef.current = evt.target.value; - }} + onChange={({ target }) => + setUnitData(p => ({ ...p, unit: target.value })) + } disabled={!type || disabled} - value={type ? data.unit : undefined} - hint={error} - error={!!error} + value={ + type && unitMapping[system][type].includes(unit) + ? unit + : undefined + } />
)} diff --git a/src/attributes/components/AttributeDetails/messages.tsx b/src/attributes/components/AttributeDetails/messages.tsx index 98b7ad0fa92..669be9090a1 100644 --- a/src/attributes/components/AttributeDetails/messages.tsx +++ b/src/attributes/components/AttributeDetails/messages.tsx @@ -1,3 +1,4 @@ +import { commonMessages } from "@saleor/intl"; import React from "react"; import { defineMessages, FormattedMessage } from "react-intl"; @@ -83,6 +84,8 @@ export const unit = ( /> ); +export const required = ; + /** * Unit System */ diff --git a/src/attributes/components/AttributeDetails/utils.ts b/src/attributes/components/AttributeDetails/utils.ts index 869c5a74dc6..4f3b880427f 100644 --- a/src/attributes/components/AttributeDetails/utils.ts +++ b/src/attributes/components/AttributeDetails/utils.ts @@ -6,6 +6,39 @@ import * as M from "./messages"; export type UnitSystem = "imperial" | "metric"; export type UnitType = "volume" | "weight" | "area" | "distance"; +export const getMeasurementUnitMessage = (unit: MeasurementUnitsEnum) => + ({ + [MeasurementUnitsEnum.CUBIC_FOOT]: M.cubicFoot, + [MeasurementUnitsEnum.CUBIC_INCH]: M.cubicInch, + [MeasurementUnitsEnum.CUBIC_YARD]: M.cubicYard, + [MeasurementUnitsEnum.QT]: M.qt, + [MeasurementUnitsEnum.FL_OZ]: M.flOz, + [MeasurementUnitsEnum.PINT]: M.pint, + [MeasurementUnitsEnum.ACRE_IN]: M.acreInch, + [MeasurementUnitsEnum.ACRE_FT]: M.acreFt, + [MeasurementUnitsEnum.FT]: M.ft, + [MeasurementUnitsEnum.YD]: M.yd, + [MeasurementUnitsEnum.INCH]: M.inch, + [MeasurementUnitsEnum.LB]: M.lbs, + [MeasurementUnitsEnum.OZ]: M.oz, + [MeasurementUnitsEnum.SQ_FT]: M.squareFt, + [MeasurementUnitsEnum.SQ_YD]: M.squareYd, + [MeasurementUnitsEnum.SQ_INCH]: M.squareInch, + [MeasurementUnitsEnum.CUBIC_CENTIMETER]: M.cubicCentimeter, + [MeasurementUnitsEnum.CUBIC_DECIMETER]: M.cubicDecimeter, + [MeasurementUnitsEnum.CUBIC_METER]: M.cubicMeter, + [MeasurementUnitsEnum.LITER]: M.liter, + [MeasurementUnitsEnum.CM]: M.centimeter, + [MeasurementUnitsEnum.M]: M.meter, + [MeasurementUnitsEnum.KM]: M.kilometer, + [MeasurementUnitsEnum.G]: M.gram, + [MeasurementUnitsEnum.KG]: M.kilogram, + [MeasurementUnitsEnum.TONNE]: M.tonne, + [MeasurementUnitsEnum.SQ_CM]: M.squareCentimeter, + [MeasurementUnitsEnum.SQ_M]: M.squareMeter, + [MeasurementUnitsEnum.SQ_KM]: M.squareKilometer + }[unit]); + export const unitSystemChoices: Array> = [ { label: M.metric, @@ -36,61 +69,73 @@ export const unitTypeChoices: Array> = [ } ]; -export const unitChoices: { - [key in UnitSystem]: { - [key in UnitType]: Array>; - }; -} = { +export const unitMapping = { imperial: { volume: [ - { label: M.cubicFoot, value: MeasurementUnitsEnum.CUBIC_FOOT }, - { label: M.cubicInch, value: MeasurementUnitsEnum.CUBIC_INCH }, - { label: M.cubicYard, value: MeasurementUnitsEnum.CUBIC_YARD }, - { label: M.qt, value: MeasurementUnitsEnum.QT }, - { label: M.flOz, value: MeasurementUnitsEnum.FL_OZ }, - { label: M.pint, value: MeasurementUnitsEnum.PINT }, - { label: M.acreInch, value: MeasurementUnitsEnum.ACRE_IN }, - { label: M.acreFt, value: MeasurementUnitsEnum.ACRE_FT } + MeasurementUnitsEnum.CUBIC_FOOT, + MeasurementUnitsEnum.CUBIC_INCH, + MeasurementUnitsEnum.CUBIC_YARD, + MeasurementUnitsEnum.QT, + MeasurementUnitsEnum.FL_OZ, + MeasurementUnitsEnum.PINT, + MeasurementUnitsEnum.ACRE_IN, + MeasurementUnitsEnum.ACRE_FT ], distance: [ - { label: M.ft, value: MeasurementUnitsEnum.FT }, - { label: M.yd, value: MeasurementUnitsEnum.YD }, - { label: M.inch, value: MeasurementUnitsEnum.INCH } - ], - weight: [ - { label: M.lbs, value: MeasurementUnitsEnum.LB }, - { label: M.oz, value: MeasurementUnitsEnum.OZ } + MeasurementUnitsEnum.FT, + MeasurementUnitsEnum.YD, + MeasurementUnitsEnum.INCH ], + weight: [MeasurementUnitsEnum.LB, MeasurementUnitsEnum.OZ], area: [ - { label: M.squareFt, value: MeasurementUnitsEnum.SQ_FT }, - { label: M.squareYd, value: MeasurementUnitsEnum.SQ_YD }, - { label: M.squareInch, value: MeasurementUnitsEnum.SQ_INCH } + MeasurementUnitsEnum.SQ_FT, + MeasurementUnitsEnum.SQ_YD, + MeasurementUnitsEnum.SQ_INCH ] }, metric: { volume: [ - { - label: M.cubicCentimeter, - value: MeasurementUnitsEnum.CUBIC_CENTIMETER - }, - { label: M.cubicDecimeter, value: MeasurementUnitsEnum.CUBIC_DECIMETER }, - { label: M.cubicMeter, value: MeasurementUnitsEnum.CUBIC_METER }, - { label: M.liter, value: MeasurementUnitsEnum.LITER } + MeasurementUnitsEnum.CUBIC_CENTIMETER, + MeasurementUnitsEnum.CUBIC_DECIMETER, + MeasurementUnitsEnum.CUBIC_METER, + MeasurementUnitsEnum.LITER ], distance: [ - { label: M.centimeter, value: MeasurementUnitsEnum.CM }, - { label: M.meter, value: MeasurementUnitsEnum.M }, - { label: M.kilometer, value: MeasurementUnitsEnum.KM } + MeasurementUnitsEnum.CM, + MeasurementUnitsEnum.M, + MeasurementUnitsEnum.KM ], weight: [ - { label: M.gram, value: MeasurementUnitsEnum.G }, - { label: M.kilogram, value: MeasurementUnitsEnum.KG }, - { label: M.tonne, value: MeasurementUnitsEnum.TONNE } + MeasurementUnitsEnum.G, + MeasurementUnitsEnum.KG, + MeasurementUnitsEnum.TONNE ], area: [ - { label: M.squareCentimeter, value: MeasurementUnitsEnum.SQ_CM }, - { label: M.squareMeter, value: MeasurementUnitsEnum.SQ_M }, - { label: M.squareKilometer, value: MeasurementUnitsEnum.SQ_KM } + MeasurementUnitsEnum.SQ_CM, + MeasurementUnitsEnum.SQ_M, + MeasurementUnitsEnum.SQ_KM ] } }; + +export const unitChoices = (() => + Object.entries(unitMapping).reduce( + (acc, [system, type]) => ({ + ...acc, + [system]: Object.entries(type).reduce( + (acc, [type, units]) => ({ + ...acc, + [type]: units.map(unit => ({ + value: unit, + label: getMeasurementUnitMessage(unit) + })) + }), + {} + ) + }), + {} + ))() as { + [key in UnitSystem]: { + [key in UnitType]: Array>; + }; +}; diff --git a/src/attributes/components/AttributePage/AttributePage.tsx b/src/attributes/components/AttributePage/AttributePage.tsx index 614640e95c4..ea5dbfc5a5f 100644 --- a/src/attributes/components/AttributePage/AttributePage.tsx +++ b/src/attributes/components/AttributePage/AttributePage.tsx @@ -60,14 +60,14 @@ export interface AttributePageFormData extends MetadataFormData { slug: string; storefrontSearchPosition: string; valueRequired: boolean; - unit: MeasurementUnitsEnum; + unit: MeasurementUnitsEnum | null | undefined; visibleInStorefront: boolean; } const AttributePage: React.FC = ({ attribute, disabled, - errors, + errors: apiErrors, saveButtonBarState, values, onBack, @@ -120,8 +120,7 @@ const AttributePage: React.FC = ({ type: attribute?.type || AttributeTypeEnum.PRODUCT_TYPE, valueRequired: attribute?.valueRequired ?? true, visibleInStorefront: attribute?.visibleInStorefront ?? true, - - unit: attribute?.unit + unit: attribute?.unit || null }; const handleSubmit = (data: AttributePageFormData) => { @@ -144,7 +143,16 @@ const AttributePage: React.FC = ({ return ( - {({ change, set, data, hasChanged, submit, triggerChange }) => { + {({ + change, + set, + data, + hasChanged, + submit, + errors, + setError, + clearErrors + }) => { const changeMetadata = makeMetadataChangeHandler(change); return ( @@ -168,10 +176,12 @@ const AttributePage: React.FC = ({ canChangeType={attribute === null} data={data} disabled={disabled} - errors={errors} + apiErrors={apiErrors} onChange={change} set={set} - triggerChange={triggerChange} + errors={errors} + setError={setError} + clearErrors={clearErrors} /> {ATTRIBUTE_TYPES_WITH_DEDICATED_VALUES.includes( data.inputType @@ -201,7 +211,7 @@ const AttributePage: React.FC = ({ diff --git a/src/attributes/fixtures.ts b/src/attributes/fixtures.ts index eb31a1f775e..b0a4fbf8d27 100644 --- a/src/attributes/fixtures.ts +++ b/src/attributes/fixtures.ts @@ -63,6 +63,7 @@ export const attributes: Array = ({ label={intl.formatMessage(messages.valueLabel)} name={`attribute:${attribute.label}`} onChange={event => onChange(attribute.id, event.target.value)} - type="numeric" + type="number" value={attribute.value[0]} + InputProps={{ + endAdornment: ( + + {getMeasurementUnitMessage(attribute.data.unit)} + + ) + }} /> ); diff --git a/src/components/Attributes/Attributes.tsx b/src/components/Attributes/Attributes.tsx index cc70a5f5821..f2bab1ede51 100644 --- a/src/components/Attributes/Attributes.tsx +++ b/src/components/Attributes/Attributes.tsx @@ -13,7 +13,8 @@ import { FormsetAtomicData } from "@saleor/hooks/useFormset"; import { makeStyles } from "@saleor/theme"; import { AttributeEntityTypeEnum, - AttributeInputTypeEnum + AttributeInputTypeEnum, + MeasurementUnitsEnum } from "@saleor/types/globalTypes"; import classNames from "classnames"; import React from "react"; @@ -25,6 +26,7 @@ import { VariantAttributeScope } from "./types"; export interface AttributeInputData { inputType: AttributeInputTypeEnum; entityType?: AttributeEntityTypeEnum; + unit?: MeasurementUnitsEnum | null; variantAttributeScope?: VariantAttributeScope; isRequired: boolean; values: AttributeValueFragment[]; diff --git a/src/components/Attributes/BasicAttributeRow.tsx b/src/components/Attributes/BasicAttributeRow.tsx index 6f2665ffec3..9a5c4efb8f2 100644 --- a/src/components/Attributes/BasicAttributeRow.tsx +++ b/src/components/Attributes/BasicAttributeRow.tsx @@ -20,7 +20,7 @@ const useStyles = makeStyles( ); interface BasicAttributeRowProps { - label: string; + label: string | React.ReactNode; } const BasicAttributeRow: React.FC = props => { diff --git a/src/components/SingleSelectField/SingleSelectField.tsx b/src/components/SingleSelectField/SingleSelectField.tsx index 5b83a4ed5d0..a92ce25cf17 100644 --- a/src/components/SingleSelectField/SingleSelectField.tsx +++ b/src/components/SingleSelectField/SingleSelectField.tsx @@ -40,7 +40,7 @@ interface SingleSelectFieldProps { className?: string; disabled?: boolean; error?: boolean; - hint?: string; + hint?: string | React.ReactNode; label?: string | React.ReactNode; name?: string; selectProps?: SelectProps; diff --git a/src/fragments/attributes.ts b/src/fragments/attributes.ts index 92e5d46f41a..6415a3b4d1d 100644 --- a/src/fragments/attributes.ts +++ b/src/fragments/attributes.ts @@ -26,6 +26,7 @@ export const attributeFragment = gql` visibleInStorefront filterableInDashboard filterableInStorefront + unit } `; diff --git a/src/fragments/types/AttributeDetailsFragment.ts b/src/fragments/types/AttributeDetailsFragment.ts index afa6fe20044..7c9ddb30bac 100644 --- a/src/fragments/types/AttributeDetailsFragment.ts +++ b/src/fragments/types/AttributeDetailsFragment.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, MeasurementUnitsEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: AttributeDetailsFragment @@ -46,12 +46,12 @@ export interface AttributeDetailsFragment { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; metadata: (AttributeDetailsFragment_metadata | null)[]; privateMetadata: (AttributeDetailsFragment_privateMetadata | null)[]; availableInGrid: boolean; inputType: AttributeInputTypeEnum | null; entityType: AttributeEntityTypeEnum | null; - unit: MeasurementUnitsEnum | null; storefrontSearchPosition: number; valueRequired: boolean; values: (AttributeDetailsFragment_values | null)[] | null; diff --git a/src/fragments/types/AttributeFragment.ts b/src/fragments/types/AttributeFragment.ts index f17e015054d..4f580eeb703 100644 --- a/src/fragments/types/AttributeFragment.ts +++ b/src/fragments/types/AttributeFragment.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: AttributeFragment @@ -18,4 +18,5 @@ export interface AttributeFragment { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } diff --git a/src/fragments/types/PageTypeDetailsFragment.ts b/src/fragments/types/PageTypeDetailsFragment.ts index a1412360cf8..5fe34537eb3 100644 --- a/src/fragments/types/PageTypeDetailsFragment.ts +++ b/src/fragments/types/PageTypeDetailsFragment.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: PageTypeDetailsFragment @@ -30,6 +30,7 @@ export interface PageTypeDetailsFragment_attributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface PageTypeDetailsFragment { diff --git a/src/fragments/types/ProductTypeDetailsFragment.ts b/src/fragments/types/ProductTypeDetailsFragment.ts index 44a169ef84e..c4a28ea4489 100644 --- a/src/fragments/types/ProductTypeDetailsFragment.ts +++ b/src/fragments/types/ProductTypeDetailsFragment.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum, WeightUnitsEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, MeasurementUnitsEnum, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL fragment: ProductTypeDetailsFragment @@ -36,6 +36,7 @@ export interface ProductTypeDetailsFragment_productAttributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeDetailsFragment_variantAttributes { @@ -47,6 +48,7 @@ export interface ProductTypeDetailsFragment_variantAttributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeDetailsFragment_weight { diff --git a/src/hooks/useForm.ts b/src/hooks/useForm.ts index 6dfa668310e..ca13f813fdd 100644 --- a/src/hooks/useForm.ts +++ b/src/hooks/useForm.ts @@ -1,5 +1,6 @@ import { toggle } from "@saleor/utils/lists"; import isEqual from "lodash-es/isEqual"; +import React from "react"; import { useState } from "react"; import useStateFromProps from "./useStateFromProps"; @@ -14,15 +15,22 @@ export type SubmitPromise = Promise; export type FormChange = (event: ChangeEvent, cb?: () => void) => void; +export type FormErrors = { + [field in keyof T]?: string | React.ReactNode; +}; + export interface UseFormResult { change: FormChange; data: T; hasChanged: boolean; reset: () => void; - set: (data: T) => void; + set: (data: Partial) => void; submit: () => void; triggerChange: () => void; toggleValue: FormChange; + errors: FormErrors; + setError: (name: keyof T, error: string | React.ReactNode) => void; + clearErrors: (name?: keyof T | Array) => void; } type FormData = Record; @@ -55,6 +63,7 @@ function useForm( onSubmit?: (data: T) => SubmitPromise | void ): UseFormResult { const [hasChanged, setChanged] = useState(false); + const [errors, setErrors] = useState>({}); const [data, setData] = useStateFromProps(initial, { mergeFunc: merge, onRefresh: newData => handleRefresh(data, newData, setChanged) @@ -109,7 +118,7 @@ function useForm( } async function submit() { - if (typeof onSubmit === "function") { + if (typeof onSubmit === "function" && !Object.keys(errors).length) { const result = onSubmit(data); if (result) { const errors = await result; @@ -124,8 +133,27 @@ function useForm( setChanged(true); } + const setError = (field: keyof T, error: string | React.ReactNode) => + setErrors(e => ({ ...e, [field]: error })); + + const clearErrors = (field: keyof T | Array) => { + if (!field) { + setErrors({}); + } else { + setErrors(e => { + (Array.isArray(field) ? field : [field]).forEach(name => { + delete e[name]; + }); + return e; + }); + } + }; + return { + setError, + errors, change, + clearErrors, data, hasChanged, reset, diff --git a/src/pageTypes/fixtures.ts b/src/pageTypes/fixtures.ts index d6ea96ef724..562f31375b0 100644 --- a/src/pageTypes/fixtures.ts +++ b/src/pageTypes/fixtures.ts @@ -46,7 +46,8 @@ export const pageType: PageTypeDetails_pageType = { visibleInStorefront: true, filterableInDashboard: true, filterableInStorefront: true, - type: AttributeTypeEnum.PAGE_TYPE + type: AttributeTypeEnum.PAGE_TYPE, + unit: null }, { __typename: "Attribute" as "Attribute", @@ -56,7 +57,8 @@ export const pageType: PageTypeDetails_pageType = { visibleInStorefront: true, filterableInDashboard: true, filterableInStorefront: true, - type: AttributeTypeEnum.PAGE_TYPE + type: AttributeTypeEnum.PAGE_TYPE, + unit: null }, { __typename: "Attribute" as "Attribute", @@ -66,7 +68,8 @@ export const pageType: PageTypeDetails_pageType = { visibleInStorefront: true, filterableInDashboard: true, filterableInStorefront: true, - type: AttributeTypeEnum.PAGE_TYPE + type: AttributeTypeEnum.PAGE_TYPE, + unit: null } ], privateMetadata: [] diff --git a/src/pageTypes/types/AssignPageAttribute.ts b/src/pageTypes/types/AssignPageAttribute.ts index 866bf5f20ff..6aa92dbf65e 100644 --- a/src/pageTypes/types/AssignPageAttribute.ts +++ b/src/pageTypes/types/AssignPageAttribute.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { PageErrorCode, AttributeTypeEnum } from "./../../types/globalTypes"; +import { PageErrorCode, AttributeTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: AssignPageAttribute @@ -36,6 +36,7 @@ export interface AssignPageAttribute_pageAttributeAssign_pageType_attributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface AssignPageAttribute_pageAttributeAssign_pageType { diff --git a/src/pageTypes/types/PageTypeAttributeReorder.ts b/src/pageTypes/types/PageTypeAttributeReorder.ts index 2141129b917..5b7ecea624a 100644 --- a/src/pageTypes/types/PageTypeAttributeReorder.ts +++ b/src/pageTypes/types/PageTypeAttributeReorder.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ReorderInput, PageErrorCode, AttributeTypeEnum } from "./../../types/globalTypes"; +import { ReorderInput, PageErrorCode, AttributeTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: PageTypeAttributeReorder @@ -36,6 +36,7 @@ export interface PageTypeAttributeReorder_pageTypeReorderAttributes_pageType_att visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface PageTypeAttributeReorder_pageTypeReorderAttributes_pageType { diff --git a/src/pageTypes/types/PageTypeCreate.ts b/src/pageTypes/types/PageTypeCreate.ts index 2d8c0282397..ecd9622ac78 100644 --- a/src/pageTypes/types/PageTypeCreate.ts +++ b/src/pageTypes/types/PageTypeCreate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { PageTypeCreateInput, PageErrorCode, AttributeTypeEnum } from "./../../types/globalTypes"; +import { PageTypeCreateInput, PageErrorCode, AttributeTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: PageTypeCreate @@ -36,6 +36,7 @@ export interface PageTypeCreate_pageTypeCreate_pageType_attributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface PageTypeCreate_pageTypeCreate_pageType { diff --git a/src/pageTypes/types/PageTypeDetails.ts b/src/pageTypes/types/PageTypeDetails.ts index 134c622f4a7..095e3654963 100644 --- a/src/pageTypes/types/PageTypeDetails.ts +++ b/src/pageTypes/types/PageTypeDetails.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL query operation: PageTypeDetails @@ -30,6 +30,7 @@ export interface PageTypeDetails_pageType_attributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface PageTypeDetails_pageType { diff --git a/src/pageTypes/types/PageTypeUpdate.ts b/src/pageTypes/types/PageTypeUpdate.ts index ef53e47b58a..07692e7d220 100644 --- a/src/pageTypes/types/PageTypeUpdate.ts +++ b/src/pageTypes/types/PageTypeUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { PageTypeUpdateInput, PageErrorCode, AttributeTypeEnum } from "./../../types/globalTypes"; +import { PageTypeUpdateInput, PageErrorCode, AttributeTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: PageTypeUpdate @@ -36,6 +36,7 @@ export interface PageTypeUpdate_pageTypeUpdate_pageType_attributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface PageTypeUpdate_pageTypeUpdate_pageType { diff --git a/src/pageTypes/types/UnassignPageAttribute.ts b/src/pageTypes/types/UnassignPageAttribute.ts index cc279509568..e1353d0bfc4 100644 --- a/src/pageTypes/types/UnassignPageAttribute.ts +++ b/src/pageTypes/types/UnassignPageAttribute.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { PageErrorCode, AttributeTypeEnum } from "./../../types/globalTypes"; +import { PageErrorCode, AttributeTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: UnassignPageAttribute @@ -36,6 +36,7 @@ export interface UnassignPageAttribute_pageAttributeUnassign_pageType_attributes visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface UnassignPageAttribute_pageAttributeUnassign_pageType { diff --git a/src/productTypes/fixtures.ts b/src/productTypes/fixtures.ts index 540c17d51eb..cb412f85073 100644 --- a/src/productTypes/fixtures.ts +++ b/src/productTypes/fixtures.ts @@ -703,7 +703,8 @@ export const productType: ProductTypeDetails_productType = { name: "Author", slug: "author", type: AttributeTypeEnum.PRODUCT_TYPE, - visibleInStorefront: true + visibleInStorefront: true, + unit: null }, { __typename: "Attribute" as "Attribute", @@ -713,7 +714,8 @@ export const productType: ProductTypeDetails_productType = { name: "Language", slug: "language", type: AttributeTypeEnum.PRODUCT_TYPE, - visibleInStorefront: true + visibleInStorefront: true, + unit: null }, { __typename: "Attribute" as "Attribute", @@ -723,7 +725,8 @@ export const productType: ProductTypeDetails_productType = { name: "Publisher", slug: "publisher", type: AttributeTypeEnum.PRODUCT_TYPE, - visibleInStorefront: true + visibleInStorefront: true, + unit: null } ], taxType: { @@ -737,14 +740,16 @@ export const productType: ProductTypeDetails_productType = { filterableInDashboard: true, filterableInStorefront: false, type: AttributeTypeEnum.PRODUCT_TYPE, - visibleInStorefront: true + visibleInStorefront: true, + unit: null }, { ...attributes[6], filterableInDashboard: true, filterableInStorefront: false, type: AttributeTypeEnum.PRODUCT_TYPE, - visibleInStorefront: true + visibleInStorefront: true, + unit: null } ], weight: { diff --git a/src/productTypes/types/AssignProductAttribute.ts b/src/productTypes/types/AssignProductAttribute.ts index 598ac6fc60d..40f4a5d187c 100644 --- a/src/productTypes/types/AssignProductAttribute.ts +++ b/src/productTypes/types/AssignProductAttribute.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductAttributeAssignInput, AttributeTypeEnum, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductAttributeAssignInput, AttributeTypeEnum, MeasurementUnitsEnum, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: AssignProductAttribute @@ -42,6 +42,7 @@ export interface AssignProductAttribute_productAttributeAssign_productType_produ visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface AssignProductAttribute_productAttributeAssign_productType_variantAttributes { @@ -53,6 +54,7 @@ export interface AssignProductAttribute_productAttributeAssign_productType_varia visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface AssignProductAttribute_productAttributeAssign_productType_weight { diff --git a/src/productTypes/types/ProductTypeAttributeReorder.ts b/src/productTypes/types/ProductTypeAttributeReorder.ts index 3d75dfe08e2..5ad8b72fe39 100644 --- a/src/productTypes/types/ProductTypeAttributeReorder.ts +++ b/src/productTypes/types/ProductTypeAttributeReorder.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ReorderInput, ProductAttributeType, AttributeTypeEnum, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ReorderInput, ProductAttributeType, AttributeTypeEnum, MeasurementUnitsEnum, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductTypeAttributeReorder @@ -42,6 +42,7 @@ export interface ProductTypeAttributeReorder_productTypeReorderAttributes_produc visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeAttributeReorder_productTypeReorderAttributes_productType_variantAttributes { @@ -53,6 +54,7 @@ export interface ProductTypeAttributeReorder_productTypeReorderAttributes_produc visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeAttributeReorder_productTypeReorderAttributes_productType_weight { diff --git a/src/productTypes/types/ProductTypeCreate.ts b/src/productTypes/types/ProductTypeCreate.ts index fa65f29a8ae..607c88d64af 100644 --- a/src/productTypes/types/ProductTypeCreate.ts +++ b/src/productTypes/types/ProductTypeCreate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductTypeInput, AttributeTypeEnum, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductTypeInput, AttributeTypeEnum, MeasurementUnitsEnum, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductTypeCreate @@ -42,6 +42,7 @@ export interface ProductTypeCreate_productTypeCreate_productType_productAttribut visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeCreate_productTypeCreate_productType_variantAttributes { @@ -53,6 +54,7 @@ export interface ProductTypeCreate_productTypeCreate_productType_variantAttribut visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeCreate_productTypeCreate_productType_weight { diff --git a/src/productTypes/types/ProductTypeDetails.ts b/src/productTypes/types/ProductTypeDetails.ts index 4ebad1be75d..c8e853acf69 100644 --- a/src/productTypes/types/ProductTypeDetails.ts +++ b/src/productTypes/types/ProductTypeDetails.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum, WeightUnitsEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, MeasurementUnitsEnum, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL query operation: ProductTypeDetails @@ -36,6 +36,7 @@ export interface ProductTypeDetails_productType_productAttributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeDetails_productType_variantAttributes { @@ -47,6 +48,7 @@ export interface ProductTypeDetails_productType_variantAttributes { visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeDetails_productType_weight { diff --git a/src/productTypes/types/ProductTypeUpdate.ts b/src/productTypes/types/ProductTypeUpdate.ts index 1fd36e1aade..86a88475cd9 100644 --- a/src/productTypes/types/ProductTypeUpdate.ts +++ b/src/productTypes/types/ProductTypeUpdate.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProductTypeInput, AttributeTypeEnum, WeightUnitsEnum } from "./../../types/globalTypes"; +import { ProductTypeInput, AttributeTypeEnum, MeasurementUnitsEnum, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: ProductTypeUpdate @@ -42,6 +42,7 @@ export interface ProductTypeUpdate_productTypeUpdate_productType_productAttribut visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeUpdate_productTypeUpdate_productType_variantAttributes { @@ -53,6 +54,7 @@ export interface ProductTypeUpdate_productTypeUpdate_productType_variantAttribut visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface ProductTypeUpdate_productTypeUpdate_productType_weight { diff --git a/src/productTypes/types/UnassignProductAttribute.ts b/src/productTypes/types/UnassignProductAttribute.ts index bac630ab972..b8f52939dc6 100644 --- a/src/productTypes/types/UnassignProductAttribute.ts +++ b/src/productTypes/types/UnassignProductAttribute.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AttributeTypeEnum, WeightUnitsEnum } from "./../../types/globalTypes"; +import { AttributeTypeEnum, MeasurementUnitsEnum, WeightUnitsEnum } from "./../../types/globalTypes"; // ==================================================== // GraphQL mutation operation: UnassignProductAttribute @@ -42,6 +42,7 @@ export interface UnassignProductAttribute_productAttributeUnassign_productType_p visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface UnassignProductAttribute_productAttributeUnassign_productType_variantAttributes { @@ -53,6 +54,7 @@ export interface UnassignProductAttribute_productAttributeUnassign_productType_v visibleInStorefront: boolean; filterableInDashboard: boolean; filterableInStorefront: boolean; + unit: MeasurementUnitsEnum | null; } export interface UnassignProductAttribute_productAttributeUnassign_productType_weight { diff --git a/src/products/utils/data.ts b/src/products/utils/data.ts index b1b6d31ec19..b66ac294cfa 100644 --- a/src/products/utils/data.ts +++ b/src/products/utils/data.ts @@ -88,6 +88,7 @@ export function getAttributeInputFromAttributes( inputType: attribute.inputType, isRequired: attribute.valueRequired, values: attribute.values, + unit: attribute.unit, variantAttributeScope }, id: attribute.id, @@ -107,6 +108,7 @@ export function getAttributeInputFromSelectedAttributes( isRequired: attribute.attribute.valueRequired, selectedValues: attribute.values, values: attribute.attribute.values, + unit: attribute.attribute.unit, variantAttributeScope }, id: attribute.attribute.id, diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 814fef7aae0..dad71c31372 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -395,13 +395,16 @@ exports[`Storyshots Attributes / Attributes default 1`] = ` Value
+