From 19b0a9623e2bce87910c1f6ae3ae4c026d917638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20G=C4=99bala?= <5421321+maarcingebala@users.noreply.github.com> Date: Thu, 5 Aug 2021 11:26:17 +0200 Subject: [PATCH] Add translation webhook events (#1273) --- locale/defaultMessages.json | 8 + schema.graphql | 25 +- .../__snapshots__/Stories.test.ts.snap | 512 ++++++++++++++++++ src/types/globalTypes.ts | 20 +- .../WebhookEvents/WebhookEvents.tsx | 8 + 5 files changed, 566 insertions(+), 7 deletions(-) diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index a16e19be1..4f46d0719 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -7257,6 +7257,10 @@ "context": "event", "string": "Order created" }, + "src_dot_webhooks_dot_components_dot_WebhookEvents_dot_36047288": { + "context": "event", + "string": "Translation created" + }, "src_dot_webhooks_dot_components_dot_WebhookEvents_dot_3617444329": { "context": "event", "string": "Order cancelled" @@ -7297,6 +7301,10 @@ "context": "event", "string": "Process payment" }, + "src_dot_webhooks_dot_components_dot_WebhookEvents_dot_482477254": { + "context": "event", + "string": "Translation updated" + }, "src_dot_webhooks_dot_components_dot_WebhookEvents_dot_679080833": { "context": "event", "string": "Page created" diff --git a/schema.graphql b/schema.graphql index 1ef1347d2..ef2c6c3ad 100644 --- a/schema.graphql +++ b/schema.graphql @@ -421,6 +421,7 @@ type Attribute implements Node & ObjectWithMetadata { availableInGrid: Boolean! translation(languageCode: LanguageCodeEnum!): AttributeTranslation storefrontSearchPosition: Int! + withChoices: Boolean! } type AttributeBulkDelete { @@ -512,6 +513,7 @@ input AttributeFilterInput { type: AttributeTypeEnum inCollection: ID inCategory: ID + channel: String } input AttributeInput { @@ -674,6 +676,7 @@ input AttributeValueInput { type AttributeValueTranslatableContent implements Node { id: ID! name: String! + richText: JSONString translation(languageCode: LanguageCodeEnum!): AttributeValueTranslation attributeValue: AttributeValue @deprecated(reason: "Will be removed in Saleor 4.0. Get model fields from the root level.") } @@ -806,6 +809,7 @@ enum CategorySortField { input CategorySortingInput { direction: OrderDirection! + channel: String field: CategorySortField! } @@ -1239,6 +1243,7 @@ input CollectionFilterInput { search: String metadata: [MetadataFilter] ids: [ID] + channel: String } input CollectionInput { @@ -1278,6 +1283,7 @@ enum CollectionSortField { input CollectionSortingInput { direction: OrderDirection! + channel: String field: CollectionSortField! } @@ -1648,6 +1654,7 @@ type CustomerEvent implements Node { date: DateTime type: CustomerEventsEnum user: User + app: App message: String count: Int order: Order @@ -3193,6 +3200,7 @@ type OrderEvent implements Node { date: DateTime type: OrderEventsEnum user: User + app: App message: String email: String emailType: OrderEventsEmailsEnum @@ -3684,6 +3692,7 @@ type PageTranslatableContent implements Node { contentJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.") translation(languageCode: LanguageCodeEnum!): PageTranslation page: Page @deprecated(reason: "Will be removed in Saleor 4.0. Get model fields from the root level.") + attributeValues: [AttributeValueTranslatableContent!]! } type PageTranslate { @@ -3909,6 +3918,7 @@ type PaymentRefund { type PaymentSource { gateway: String! + paymentMethodId: String creditCardInfo: CreditCard } @@ -4299,6 +4309,7 @@ input ProductFilterInput { minimalPrice: PriceRangeInput productTypes: [ID] ids: [ID] + channel: String } type ProductImage { @@ -4383,6 +4394,7 @@ input ProductMediaUpdateInput { input ProductOrder { direction: OrderDirection! + channel: String attributeId: ID field: ProductOrderField } @@ -4429,6 +4441,7 @@ type ProductTranslatableContent implements Node { descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") translation(languageCode: LanguageCodeEnum!): ProductTranslation product: Product @deprecated(reason: "Will be removed in Saleor 4.0. Get model fields from the root level.") + attributeValues: [AttributeValueTranslatableContent!]! } type ProductTranslate { @@ -4703,6 +4716,7 @@ type ProductVariantTranslatableContent implements Node { name: String! translation(languageCode: LanguageCodeEnum!): ProductVariantTranslation productVariant: ProductVariant @deprecated(reason: "Will be removed in Saleor 4.0. Get model fields from the root level.") + attributeValues: [AttributeValueTranslatableContent!]! } type ProductVariantTranslate { @@ -4785,7 +4799,6 @@ type Query { taxTypes: [TaxType] checkout(token: UUID): Checkout 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 channel(id: ID): Channel channels: [Channel!] @@ -4919,6 +4932,7 @@ input SaleFilterInput { saleType: DiscountValueTypeEnum started: DateTimeRangeInput search: String + metadata: [MetadataFilter] } input SaleInput { @@ -4948,6 +4962,7 @@ enum SaleSortField { input SaleSortingInput { direction: OrderDirection! + channel: String field: SaleSortField! } @@ -5858,6 +5873,7 @@ input VoucherFilterInput { discountType: [VoucherDiscountType] started: DateTimeRangeInput search: String + metadata: [MetadataFilter] } input VoucherInput { @@ -5896,6 +5912,7 @@ enum VoucherSortField { input VoucherSortingInput { direction: OrderDirection! + channel: String field: VoucherSortField! } @@ -6110,6 +6127,8 @@ enum WebhookEventTypeEnum { PAYMENT_PROCESS PAYMENT_REFUND PAYMENT_VOID + TRANSLATION_CREATED + TRANSLATION_UPDATED } enum WebhookSampleEventTypeEnum { @@ -6144,6 +6163,8 @@ enum WebhookSampleEventTypeEnum { PAYMENT_PROCESS PAYMENT_REFUND PAYMENT_VOID + TRANSLATION_CREATED + TRANSLATION_UPDATED } type WebhookUpdate { @@ -6178,7 +6199,7 @@ enum WeightUnitsEnum { scalar _Any -union _Entity = Address | User | Group | App | ProductVariant | Product | ProductType | Collection | Category | ProductMedia | ProductImage | PageType +union _Entity = App | Address | User | Group | ProductVariant | Product | ProductType | Collection | Category | ProductMedia | ProductImage | PageType type _Service { sdl: String diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 8b5755f2c..b962199f5 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -26337,6 +26337,78 @@ exports[`Storyshots Views / Apps / Webhooks / Create webhook default 1`] = ` +