From 6fdfcfe9438e71164ee8817a5560bd066e704942 Mon Sep 17 00:00:00 2001 From: Maciej Korycinski Date: Wed, 31 Mar 2021 14:15:05 +0200 Subject: [PATCH 1/3] Fix failing translations (#1035) --- src/translations/utils.ts | 2 +- src/translations/views/TranslationsPages.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/translations/utils.ts b/src/translations/utils.ts index b92d417b7..1ab2e02a7 100644 --- a/src/translations/utils.ts +++ b/src/translations/utils.ts @@ -19,7 +19,7 @@ export const getParsedTranslationInputData = ({ if (fieldsToParse.includes(fieldName)) { return { - description: getParsedDataForJsonStringField(data as OutputData) + [fieldName]: getParsedDataForJsonStringField(data as OutputData) }; } diff --git a/src/translations/views/TranslationsPages.tsx b/src/translations/views/TranslationsPages.tsx index 1d2e43f49..a6f98bae1 100644 --- a/src/translations/views/TranslationsPages.tsx +++ b/src/translations/views/TranslationsPages.tsx @@ -10,7 +10,7 @@ import { LanguageCodeEnum } from "../../types/globalTypes"; import TranslationsPagesPage from "../components/TranslationsPagesPage"; import { TypedUpdatePageTranslations } from "../mutations"; import { usePageTranslationDetails } from "../queries"; -import { TranslationInputFieldName } from "../types"; +import { PageTranslationInputFieldName } from "../types"; import { UpdatePageTranslations } from "../types/UpdatePageTranslations"; import { languageEntitiesUrl, @@ -68,7 +68,7 @@ const TranslationsPages: React.FC = ({ {(updateTranslations, updateTranslationsOpts) => { const handleSubmit = ( - fieldName: TranslationInputFieldName, + fieldName: PageTranslationInputFieldName, data: string ) => { updateTranslations({ From c1159861a940eadf0c2cdbb51e470e5324d7125c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20=C5=BBegle=C5=84?= Date: Wed, 31 Mar 2021 15:11:58 +0200 Subject: [PATCH 2/3] Update schema (#1029) * Update schema * Update stories and changelog * Update messages --- CHANGELOG.md | 1 + locale/defaultMessages.json | 4 + schema.graphql | 24 +- src/orders/mutations.ts | 2 +- src/orders/types/InvoiceEmailSend.ts | 14 +- .../OrderDetails/OrderDetailsMessages.tsx | 2 +- src/orders/views/OrderDetails/index.tsx | 2 +- .../__snapshots__/Stories.test.ts.snap | 291 ++++++++++++++++++ src/types/globalTypes.ts | 4 + .../WebhookEvents/WebhookEvents.tsx | 4 + 10 files changed, 335 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c46553e28..5f5e87e6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ All notable, unreleased changes to this project will be documented in this file. - Use default sort for search products list - #997 by @orzechdev - Update CollectionBulkDelete error type - #1030 by @d-wysocki - Remove mailing settings - #1027 by @dominik-zeglen +- Update schema to contain email plugin changes - #1029 by @dominik-zeglen # 2.11.1 diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 25702c5a5..dfcb7e670 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -6829,6 +6829,10 @@ "context": "event", "string": "Order updated" }, + "src_dot_webhooks_dot_components_dot_WebhookEvents_dot_1616635110": { + "context": "event", + "string": "User notified" + }, "src_dot_webhooks_dot_components_dot_WebhookEvents_dot_2126893364": { "context": "event", "string": "Product variant updated" diff --git a/schema.graphql b/schema.graphql index f67636b9f..59e399b18 100644 --- a/schema.graphql +++ b/schema.graphql @@ -74,6 +74,7 @@ input AccountInput { lastName: String defaultBillingAddress: AddressInput defaultShippingAddress: AddressInput + languageCode: LanguageCodeEnum } type AccountRegister { @@ -87,6 +88,7 @@ input AccountRegisterInput { email: String! password: String! redirectUrl: String + languageCode: LanguageCodeEnum } type AccountRequestDeletion { @@ -879,6 +881,7 @@ type Checkout implements Node & ObjectWithMetadata { subtotalPrice: TaxedMoney token: UUID! totalPrice: TaxedMoney + languageCode: LanguageCodeEnum! } type CheckoutAddPromoCode { @@ -925,6 +928,7 @@ input CheckoutCreateInput { email: String shippingAddress: AddressInput billingAddress: AddressInput + languageCode: LanguageCodeEnum } type CheckoutCustomerAttach { @@ -977,6 +981,12 @@ enum CheckoutErrorCode { CHANNEL_INACTIVE } +type CheckoutLanguageCodeUpdate { + errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") + checkout: Checkout + checkoutErrors: [CheckoutError!]! +} + type CheckoutLine implements Node { id: ID! variant: ProductVariant! @@ -1253,6 +1263,7 @@ input ConfigurationItemInput { enum ConfigurationTypeFieldEnum { STRING + MULTILINE BOOLEAN SECRET PASSWORD @@ -1607,6 +1618,7 @@ input CustomerInput { email: String isActive: Boolean note: String + languageCode: LanguageCodeEnum } type CustomerUpdate { @@ -2248,7 +2260,7 @@ type InvoiceRequestDelete { invoice: Invoice } -type InvoiceSendEmail { +type InvoiceSendNotification { errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") invoiceErrors: [InvoiceError!]! invoice: Invoice @@ -2757,7 +2769,7 @@ type Mutation { invoiceCreate(input: InvoiceCreateInput!, orderId: ID!): InvoiceCreate invoiceDelete(id: ID!): InvoiceDelete invoiceUpdate(id: ID!, input: UpdateInvoiceInput!): InvoiceUpdate - invoiceSendEmail(id: ID!): InvoiceSendEmail + invoiceSendNotification(id: ID!): InvoiceSendNotification giftCardActivate(id: ID!): GiftCardActivate giftCardCreate(input: GiftCardCreateInput!): GiftCardCreate giftCardDeactivate(id: ID!): GiftCardDeactivate @@ -2795,6 +2807,7 @@ type Mutation { 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 @@ -2894,7 +2907,6 @@ type Order implements Node & ObjectWithMetadata { created: DateTime! status: OrderStatus! user: User - languageCode: String! trackingClientId: String! billingAddress: Address shippingAddress: Address @@ -2933,6 +2945,8 @@ 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.") + 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.") @@ -5497,6 +5511,7 @@ type User implements Node & ObjectWithMetadata { avatar(size: Int): Image events: [CustomerEvent] storedPaymentSources: [PaymentSource] + languageCode: LanguageCodeEnum! } type UserAvatarDelete { @@ -5536,6 +5551,7 @@ input UserCreateInput { email: String isActive: Boolean note: String + languageCode: LanguageCodeEnum redirectUrl: String } @@ -5950,6 +5966,7 @@ enum WebhookEventTypeEnum { CHECKOUT_CREATED CHECKOUT_UPDATED FULFILLMENT_CREATED + NOTIFY_USER PAGE_CREATED PAGE_UPDATED PAGE_DELETED @@ -5976,6 +5993,7 @@ enum WebhookSampleEventTypeEnum { CHECKOUT_CREATED CHECKOUT_UPDATED FULFILLMENT_CREATED + NOTIFY_USER PAGE_CREATED PAGE_UPDATED PAGE_DELETED diff --git a/src/orders/mutations.ts b/src/orders/mutations.ts index 6b2c20705..1591ce60e 100644 --- a/src/orders/mutations.ts +++ b/src/orders/mutations.ts @@ -687,7 +687,7 @@ const invoiceEmailSendMutation = gql` ${invoiceErrorFragment} ${invoiceFragment} mutation InvoiceEmailSend($id: ID!) { - invoiceSendEmail(id: $id) { + invoiceSendNotification(id: $id) { errors: invoiceErrors { ...InvoiceErrorFragment } diff --git a/src/orders/types/InvoiceEmailSend.ts b/src/orders/types/InvoiceEmailSend.ts index cda8f9897..5a4c094ba 100644 --- a/src/orders/types/InvoiceEmailSend.ts +++ b/src/orders/types/InvoiceEmailSend.ts @@ -9,13 +9,13 @@ import { InvoiceErrorCode, JobStatusEnum } from "./../../types/globalTypes"; // GraphQL mutation operation: InvoiceEmailSend // ==================================================== -export interface InvoiceEmailSend_invoiceSendEmail_errors { +export interface InvoiceEmailSend_invoiceSendNotification_errors { __typename: "InvoiceError"; code: InvoiceErrorCode; field: string | null; } -export interface InvoiceEmailSend_invoiceSendEmail_invoice { +export interface InvoiceEmailSend_invoiceSendNotification_invoice { __typename: "Invoice"; id: string; number: string | null; @@ -24,14 +24,14 @@ export interface InvoiceEmailSend_invoiceSendEmail_invoice { status: JobStatusEnum; } -export interface InvoiceEmailSend_invoiceSendEmail { - __typename: "InvoiceSendEmail"; - errors: InvoiceEmailSend_invoiceSendEmail_errors[]; - invoice: InvoiceEmailSend_invoiceSendEmail_invoice | null; +export interface InvoiceEmailSend_invoiceSendNotification { + __typename: "InvoiceSendNotification"; + errors: InvoiceEmailSend_invoiceSendNotification_errors[]; + invoice: InvoiceEmailSend_invoiceSendNotification_invoice | null; } export interface InvoiceEmailSend { - invoiceSendEmail: InvoiceEmailSend_invoiceSendEmail | null; + invoiceSendNotification: InvoiceEmailSend_invoiceSendNotification | null; } export interface InvoiceEmailSendVariables { diff --git a/src/orders/views/OrderDetails/OrderDetailsMessages.tsx b/src/orders/views/OrderDetails/OrderDetailsMessages.tsx index 25067ffea..eee5aa870 100644 --- a/src/orders/views/OrderDetails/OrderDetailsMessages.tsx +++ b/src/orders/views/OrderDetails/OrderDetailsMessages.tsx @@ -271,7 +271,7 @@ export const OrderDetailsMessages: React.FC = ({ } }; const handleInvoiceSend = (data: InvoiceEmailSend) => { - const errs = data.invoiceSendEmail?.errors; + const errs = data.invoiceSendNotification?.errors; if (errs.length === 0) { pushMessage({ text: intl.formatMessage({ diff --git a/src/orders/views/OrderDetails/index.tsx b/src/orders/views/OrderDetails/index.tsx index 7ccf9ed47..c89cc027a 100644 --- a/src/orders/views/OrderDetails/index.tsx +++ b/src/orders/views/OrderDetails/index.tsx @@ -432,7 +432,7 @@ export const OrderDetails: React.FC = ({ id, params }) => { +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +