diff --git a/framework/saleor/schema.d.ts b/framework/saleor/schema.d.ts index 0acff9c65..13f675509 100644 --- a/framework/saleor/schema.d.ts +++ b/framework/saleor/schema.d.ts @@ -680,7 +680,7 @@ export enum WebhookEventTypeEnum { AnyEvents = 'ANY_EVENTS', /** A new order is placed. */ OrderCreated = 'ORDER_CREATED', - /** An order is confirmed (status change unconfirmed -> unfulfilled) by staff user using OrderConfirm mutation. Also triggers when user finish checkout and shop setting `automatically_confirm_all_new_orders` is enabled. */ + /** An order is confirmed (status change unconfirmed -> unfulfilled) by a staff user using the OrderConfirm mutation. It also triggers when the user completes the checkout and the shop setting `automatically_confirm_all_new_orders` is enabled. */ OrderConfirmed = 'ORDER_CONFIRMED', /** Payment is made and an order is fully paid. */ OrderFullyPaid = 'ORDER_FULLY_PAID', @@ -714,7 +714,7 @@ export enum WebhookEventTypeEnum { ProductVariantDeleted = 'PRODUCT_VARIANT_DELETED', /** A new checkout is created. */ CheckoutCreated = 'CHECKOUT_CREATED', - /** A checkout is updated. Also triggers for all updates related to a checkout. */ + /** A checkout is updated. It also triggers all updates related to the checkout. */ CheckoutUpdated = 'CHECKOUT_UPDATED', /** A new fulfillment is created. */ FulfillmentCreated = 'FULFILLMENT_CREATED', @@ -1035,6 +1035,7 @@ export type ShippingMethod = Node & /** The ID of the object. */ id: Scalars['ID'] name: Scalars['String'] + description?: Maybe minimumOrderWeight?: Maybe maximumOrderWeight?: Maybe maximumDeliveryDays?: Maybe @@ -1102,6 +1103,7 @@ export type ShippingMethodTranslation = Node & { /** The ID of the object. */ id: Scalars['ID'] name?: Maybe + description?: Maybe /** Translation language. */ language: LanguageDisplay } @@ -2779,6 +2781,7 @@ export type ShippingMethodTranslatableContent = Node & { /** The ID of the object. */ id: Scalars['ID'] name: Scalars['String'] + description?: Maybe /** Returns translated shipping method fields for the given language code. */ translation?: Maybe /** Shipping method are the methods you'll use to get customer's orders to them. They are directly exposed to the customers. */ @@ -5614,7 +5617,7 @@ export type MutationShippingPriceUpdateArgs = { export type MutationShippingPriceTranslateArgs = { id: Scalars['ID'] - input: NameTranslationInput + input: ShippingPriceTranslationInput languageCode: LanguageCodeEnum } @@ -7211,6 +7214,8 @@ export type ShippingPriceCreate = { export type ShippingPriceInput = { /** Name of the shipping method. */ name?: Maybe + /** Shipping method description (JSON). */ + description?: Maybe /** Minimum order weight to use this shipping method. */ minimumOrderWeight?: Maybe /** Maximum order weight to use this shipping method. */ @@ -7292,8 +7297,10 @@ export type ShippingPriceTranslate = { shippingMethod?: Maybe } -export type NameTranslationInput = { +export type ShippingPriceTranslationInput = { name?: Maybe + /** Translated shipping method description (JSON). */ + description?: Maybe } /** Exclude products from shipping price. */ @@ -8495,6 +8502,10 @@ export type ProductVariantTranslate = { productVariant?: Maybe } +export type NameTranslationInput = { + name?: Maybe +} + /** Manage product variant prices in channels. */ export type ProductVariantChannelListingUpdate = { __typename?: 'ProductVariantChannelListingUpdate' @@ -11678,6 +11689,8 @@ export type AccountRegisterInput = { redirectUrl?: Maybe /** User language code. */ languageCode?: Maybe + /** User public metadata. */ + metadata?: Maybe> } /** Updates the account of the logged-in user. */ diff --git a/framework/saleor/schema.graphql b/framework/saleor/schema.graphql index 375d5c940..f111333e9 100644 --- a/framework/saleor/schema.graphql +++ b/framework/saleor/schema.graphql @@ -1634,7 +1634,7 @@ enum WebhookEventTypeEnum { ORDER_CREATED """ - An order is confirmed (status change unconfirmed -> unfulfilled) by staff user using OrderConfirm mutation. Also triggers when user finish checkout and shop setting `automatically_confirm_all_new_orders` is enabled. + An order is confirmed (status change unconfirmed -> unfulfilled) by a staff user using the OrderConfirm mutation. It also triggers when the user completes the checkout and the shop setting `automatically_confirm_all_new_orders` is enabled. """ ORDER_CONFIRMED @@ -1719,7 +1719,7 @@ enum WebhookEventTypeEnum { CHECKOUT_CREATED """ - A checkout is updated. Also triggers for all updates related to a checkout. + A checkout is updated. It also triggers all updates related to the checkout. """ CHECKOUT_UPDATED @@ -2254,6 +2254,7 @@ type ShippingMethod implements Node & ObjectWithMetadata { """ id: ID! name: String! + description: JSONString minimumOrderWeight: Weight maximumOrderWeight: Weight maximumDeliveryDays: Int @@ -2374,6 +2375,7 @@ type ShippingMethodTranslation implements Node { """ id: ID! name: String + description: JSONString """ Translation language. @@ -4929,6 +4931,7 @@ type ShippingMethodTranslatableContent implements Node { """ id: ID! name: String! + description: JSONString """ Returns translated shipping method fields for the given language code. @@ -8927,7 +8930,7 @@ type Mutation { Shipping method ID. """ id: ID! - input: NameTranslationInput! + input: ShippingPriceTranslationInput! """ Translation language code. @@ -12791,6 +12794,11 @@ input ShippingPriceInput { """ name: String + """ + Shipping method description (JSON). + """ + description: JSONString + """ Minimum order weight to use this shipping method. """ @@ -12929,8 +12937,13 @@ type ShippingPriceTranslate { shippingMethod: ShippingMethod } -input NameTranslationInput { +input ShippingPriceTranslationInput { name: String + + """ + Translated shipping method description (JSON). + """ + description: JSONString } """ @@ -14859,6 +14872,10 @@ type ProductVariantTranslate { productVariant: ProductVariant } +input NameTranslationInput { + name: String +} + """ Manage product variant prices in channels. """ @@ -19721,6 +19738,11 @@ input AccountRegisterInput { User language code. """ languageCode: LanguageCodeEnum + + """ + User public metadata. + """ + metadata: [MetadataInput!] } """ diff --git a/framework/saleor/utils/normalize.ts b/framework/saleor/utils/normalize.ts index 62c3eeccd..b439327ea 100644 --- a/framework/saleor/utils/normalize.ts +++ b/framework/saleor/utils/normalize.ts @@ -14,6 +14,9 @@ import { import type { Cart, LineItem } from '../types' +// TODO: Check nextjs-commerce bug if no images are added for a product +const placeholderImg = '/product-img-placeholder.svg' + const money = ({ amount, currency }: Money) => { return { value: +amount, @@ -97,7 +100,8 @@ export function normalizeProduct(productNode: SaleorProduct): Product { path: `/${slug}`, slug: slug?.replace(/^\/+|\/+$/g, ''), price: money(pricing?.priceRange?.start?.net) || 0, - images: media, + // TODO: Check nextjs-commerce bug if no images are added for a product + images: media?.length ? media : [{ url: placeholderImg }], variants: variants ? normalizeProductVariants(variants) : [], options: variants ? normalizeProductOptions(variants) : [], ...rest,