From 70f855d27ad7c91ea8ab33f7a7bdbda16b701a61 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Wed, 19 Jun 2024 10:47:54 +0200 Subject: [PATCH 01/11] Schema compatibility file --- .../CustomerConfirmation245to247.graphqls | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls diff --git a/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls b/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls new file mode 100644 index 0000000000..aef4a91375 --- /dev/null +++ b/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls @@ -0,0 +1,55 @@ +# This is a commpatibility file: This does not implement any working functionality and only serves as a way to make the schema compatible with Magento 2.4.7 + +extend type StoreConfig { + """ + Indicates if the new accounts need confirmation. + """ + create_account_confirmation: Boolean +} + +""" +List of account confirmation statuses. +""" +enum ConfirmationStatusEnum { + """ + Account confirmed + """ + ACCOUNT_CONFIRMED + """ + Account confirmation not required + """ + ACCOUNT_CONFIRMATION_NOT_REQUIRED +} + +extend type Customer { + """ + The customer's confirmation status. + """ + confirmation_status: ConfirmationStatusEnum! +} + +""" +Contains details about a customer email address to confirm. +""" +input ConfirmEmailInput { + """ + The key to confirm the email address. + """ + confirmation_key: String! + """ + The email address to be confirmed. + """ + email: String! +} + +extend type Mutation { + """ + Confirms the email address for a customer. + """ + confirmEmail( + """ + An input object to identify the customer to confirm the email. + """ + input: ConfirmEmailInput! + ): CustomerOutput +} From 0b95b04cd1493d4cc590012334eeb91ee0e02371 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Wed, 19 Jun 2024 10:53:37 +0200 Subject: [PATCH 02/11] Fix build --- .../schema/CustomerConfirmation245to247.graphqls | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls b/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls index aef4a91375..83c69b32c0 100644 --- a/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls +++ b/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls @@ -1,6 +1,6 @@ # This is a commpatibility file: This does not implement any working functionality and only serves as a way to make the schema compatible with Magento 2.4.7 -extend type StoreConfig { +type StoreConfig { """ Indicates if the new accounts need confirmation. """ @@ -21,7 +21,7 @@ enum ConfirmationStatusEnum { ACCOUNT_CONFIRMATION_NOT_REQUIRED } -extend type Customer { +type Customer { """ The customer's confirmation status. """ @@ -42,7 +42,7 @@ input ConfirmEmailInput { email: String! } -extend type Mutation { +type Mutation { """ Confirms the email address for a customer. """ From c6ac45b8ff41dcaa47f1e5d40d04e120990870aa Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Wed, 19 Jun 2024 11:46:01 +0200 Subject: [PATCH 03/11] Added a magentoVersion configuration value to be able to differentiate features based on the Magento version --- .changeset/swift-fireants-hear.md | 5 +++++ docs/framework/config.md | 6 ++++++ packages/magento-graphql/Config.graphqls | 7 +++++++ .../config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap | 1 + packagesDev/next-config/dist/config/demoConfig.js | 1 + packagesDev/next-config/dist/generated/config.js | 1 + packagesDev/next-config/src/config/demoConfig.ts | 1 + packagesDev/next-config/src/generated/config.ts | 7 +++++++ 8 files changed, 29 insertions(+) create mode 100644 .changeset/swift-fireants-hear.md diff --git a/.changeset/swift-fireants-hear.md b/.changeset/swift-fireants-hear.md new file mode 100644 index 0000000000..27d4f71d36 --- /dev/null +++ b/.changeset/swift-fireants-hear.md @@ -0,0 +1,5 @@ +--- +"@graphcommerce/magento-graphql": patch +--- + +Added a magentoVersion configuration value to be able to differentiate features based on the Magento version diff --git a/docs/framework/config.md b/docs/framework/config.md index 3447f8ed72..6b07a8d402 100644 --- a/docs/framework/config.md +++ b/docs/framework/config.md @@ -109,6 +109,12 @@ GraphQL Magento endpoint. Examples: - https://magento2.test/graphql +#### magentoVersion: number (required) = `245` + +Version of the Magento backend. + +Values: 245, 246, 247 for Magento 2.4.5, 2.4.6, 2.4.7 respectively. + #### storefront: [GraphCommerceStorefrontConfig](#GraphCommerceStorefrontConfig)[] (required) All storefront configuration for the project diff --git a/packages/magento-graphql/Config.graphqls b/packages/magento-graphql/Config.graphqls index 9e74fe3a9a..a26531e9c5 100644 --- a/packages/magento-graphql/Config.graphqls +++ b/packages/magento-graphql/Config.graphqls @@ -6,6 +6,13 @@ extend input GraphCommerceConfig { - https://magento2.test/graphql """ magentoEndpoint: String! + + """ + Version of the Magento backend. + + Values: 245, 246, 247 for Magento 2.4.5, 2.4.6, 2.4.7 respectively. + """ + magentoVersion: Int! = 245 } extend input GraphCommerceStorefrontConfig { diff --git a/packagesDev/next-config/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap b/packagesDev/next-config/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap index 9edfeb88fe..aa9f607763 100644 --- a/packagesDev/next-config/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap +++ b/packagesDev/next-config/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap @@ -58,6 +58,7 @@ exports[`traverses a schema and returns a list of env variables that match 1`] = "GC_HYGRAPH_WRITE_ACCESS_TOKEN", "GC_LIMIT_SSG", "GC_MAGENTO_ENDPOINT", + "GC_MAGENTO_VERSION", "GC_PREVIEW_SECRET", "GC_PRODUCT_FILTERS_LAYOUT", "GC_PRODUCT_FILTERS_PRO", diff --git a/packagesDev/next-config/dist/config/demoConfig.js b/packagesDev/next-config/dist/config/demoConfig.js index 091ddadede..a860d377e7 100644 --- a/packagesDev/next-config/dist/config/demoConfig.js +++ b/packagesDev/next-config/dist/config/demoConfig.js @@ -5,6 +5,7 @@ exports.demoConfig = { canonicalBaseUrl: 'https://graphcommerce.vercel.app', hygraphEndpoint: 'https://eu-central-1.cdn.hygraph.com/content/ckhx7xadya6xs01yxdujt8i80/master', magentoEndpoint: 'https://backend.reachdigital.dev/graphql', + magentoVersion: 246, storefront: [ { locale: 'en', magentoStoreCode: 'en_US', defaultLocale: true }, { diff --git a/packagesDev/next-config/dist/generated/config.js b/packagesDev/next-config/dist/generated/config.js index f8580bd626..4e08ac232b 100644 --- a/packagesDev/next-config/dist/generated/config.js +++ b/packagesDev/next-config/dist/generated/config.js @@ -92,6 +92,7 @@ function GraphCommerceConfigSchema() { hygraphWriteAccessToken: _zod.z.string().nullish(), limitSsg: _zod.z.boolean().nullish(), magentoEndpoint: _zod.z.string().min(1), + magentoVersion: _zod.z.number().default(245), previewSecret: _zod.z.string().nullish(), productFiltersLayout: ProductFiltersLayoutSchema.default("DEFAULT").nullish(), productFiltersPro: _zod.z.boolean().nullish(), diff --git a/packagesDev/next-config/src/config/demoConfig.ts b/packagesDev/next-config/src/config/demoConfig.ts index ea736a2e2a..dc4d3ecfce 100644 --- a/packagesDev/next-config/src/config/demoConfig.ts +++ b/packagesDev/next-config/src/config/demoConfig.ts @@ -7,6 +7,7 @@ export const demoConfig: PartialDeep; /** @@ -482,6 +488,7 @@ export function GraphCommerceConfigSchema(): z.ZodObject Date: Wed, 19 Jun 2024 12:21:49 +0200 Subject: [PATCH 04/11] Solve an issue where an env variable wouldn't be coerced to a Number if a Config.graphqls value is defined as an Int/Float --- .changeset/purple-crabs-tell.md | 5 +++++ .../__tests__/config/utils/mergeEnvIntoConfig.ts | 14 ++++++++++++++ .../dist/config/utils/mergeEnvIntoConfig.js | 7 ++++++- .../src/config/utils/mergeEnvIntoConfig.ts | 8 +++++++- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .changeset/purple-crabs-tell.md diff --git a/.changeset/purple-crabs-tell.md b/.changeset/purple-crabs-tell.md new file mode 100644 index 0000000000..3ea1ae20b3 --- /dev/null +++ b/.changeset/purple-crabs-tell.md @@ -0,0 +1,5 @@ +--- +"@graphcommerce/next-config": patch +--- + +Solve an issue where an env variable wouldn't be coerced to a Number if a Config.graphqls value is defined as an Int/Float diff --git a/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts b/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts index 2aa7ca6182..a670af93e1 100644 --- a/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts +++ b/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts @@ -32,6 +32,20 @@ it('parses an env config object', () => { expect(result).toMatchSnapshot() }) +it('parses an env string value to a number', () => { + const [envSchema] = configToEnvSchema(GraphCommerceConfigSchema()) + const result = envSchema.safeParse({ GC_MAGENTO_VERSION: '247' }) + + expect(result.success).toBe(true) + if (result.success) { + expect(result.data).toMatchInlineSnapshot(` + { + "GC_MAGENTO_VERSION": 247, + } + `) + } +}) + it('correctly validates if a value is JSON', () => { const [envSchema] = configToEnvSchema(GraphCommerceConfigSchema()) const result = envSchema.safeParse({ diff --git a/packagesDev/next-config/dist/config/utils/mergeEnvIntoConfig.js b/packagesDev/next-config/dist/config/utils/mergeEnvIntoConfig.js index 9e775133f3..ba7f4a3472 100644 --- a/packagesDev/next-config/dist/config/utils/mergeEnvIntoConfig.js +++ b/packagesDev/next-config/dist/config/utils/mergeEnvIntoConfig.js @@ -75,7 +75,12 @@ function configToEnvSchema(schema) { }); return; } - if (node instanceof zod_1.ZodString || node instanceof zod_1.ZodNumber || node instanceof zod_1.ZodEnum) { + if (node instanceof zod_1.ZodNumber) { + envSchema[(0, exports.toEnvStr)(path)] = zod_1.z.coerce.number().optional(); + envToDot[(0, exports.toEnvStr)(path)] = (0, exports.dotNotation)(path); + return; + } + if (node instanceof zod_1.ZodString || node instanceof zod_1.ZodEnum) { envSchema[(0, exports.toEnvStr)(path)] = node.optional(); envToDot[(0, exports.toEnvStr)(path)] = (0, exports.dotNotation)(path); return; diff --git a/packagesDev/next-config/src/config/utils/mergeEnvIntoConfig.ts b/packagesDev/next-config/src/config/utils/mergeEnvIntoConfig.ts index a4529802c0..b71ef96373 100644 --- a/packagesDev/next-config/src/config/utils/mergeEnvIntoConfig.ts +++ b/packagesDev/next-config/src/config/utils/mergeEnvIntoConfig.ts @@ -101,7 +101,13 @@ export function configToEnvSchema(schema: ZodNode) { return } - if (node instanceof ZodString || node instanceof ZodNumber || node instanceof ZodEnum) { + if (node instanceof ZodNumber) { + envSchema[toEnvStr(path)] = z.coerce.number().optional() + envToDot[toEnvStr(path)] = dotNotation(path) + return + } + + if (node instanceof ZodString || node instanceof ZodEnum) { envSchema[toEnvStr(path)] = node.optional() envToDot[toEnvStr(path)] = dotNotation(path) return From ac1733a37eee1cd49787ffbaebff150ae878582f Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Wed, 19 Jun 2024 12:23:36 +0200 Subject: [PATCH 05/11] =?UTF-8?q?Rename=20existing=20schema=E2=80=99s=20an?= =?UTF-8?q?d=20add=20247-EstimateShippingMethodsTotals.graphqls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...45.graphqls => 245-CartItemError.graphqls} | 0 ...hqls => 247-CustomerConfirmation.graphqls} | 2 +- ...247-EstimateShippingMethodsTotals.graphqls | 64 +++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) rename packages/magento-graphql/schema/{Magento243to245.graphqls => 245-CartItemError.graphqls} (100%) rename packages/magento-graphql/schema/{CustomerConfirmation245to247.graphqls => 247-CustomerConfirmation.graphqls} (96%) create mode 100644 packages/magento-graphql/schema/247-EstimateShippingMethodsTotals.graphqls diff --git a/packages/magento-graphql/schema/Magento243to245.graphqls b/packages/magento-graphql/schema/245-CartItemError.graphqls similarity index 100% rename from packages/magento-graphql/schema/Magento243to245.graphqls rename to packages/magento-graphql/schema/245-CartItemError.graphqls diff --git a/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls b/packages/magento-graphql/schema/247-CustomerConfirmation.graphqls similarity index 96% rename from packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls rename to packages/magento-graphql/schema/247-CustomerConfirmation.graphqls index 83c69b32c0..83a9c20f57 100644 --- a/packages/magento-graphql/schema/CustomerConfirmation245to247.graphqls +++ b/packages/magento-graphql/schema/247-CustomerConfirmation.graphqls @@ -42,7 +42,7 @@ input ConfirmEmailInput { email: String! } -type Mutation { +type Mutation @doc(description: "Jajaj") { """ Confirms the email address for a customer. """ diff --git a/packages/magento-graphql/schema/247-EstimateShippingMethodsTotals.graphqls b/packages/magento-graphql/schema/247-EstimateShippingMethodsTotals.graphqls new file mode 100644 index 0000000000..7ac39aa451 --- /dev/null +++ b/packages/magento-graphql/schema/247-EstimateShippingMethodsTotals.graphqls @@ -0,0 +1,64 @@ +""" +Contains details about an address. +""" +input EstimateAddressInput { + """ + The two-letter code representing the customer's country. + """ + country_code: CountryCodeEnum! + """ + The customer's ZIP or postal code. + """ + postcode: String + """ + An object containing the region name, region code, and region ID. + """ + region: CustomerAddressRegionInput +} + +input EstimateTotalsInput { + """ + Customer's address to estimate totals. + """ + address: EstimateAddressInput! + """ + The unique ID of the cart to query. + """ + cart_id: String! + """ + Selected shipping method to estimate totals. + """ + shipping_method: ShippingMethodInput +} + +""" +Estimate totals output. +""" +type EstimateTotalsOutput { + """ + Cart after totals estimation + """ + cart: Cart +} + +type Mutation { + """ + Estimate shipping method(s) for cart based on address + """ + estimateShippingMethods( + """ + An input object that specifies details for estimation of available shipping methods + """ + input: EstimateTotalsInput! + ): [AvailableShippingMethod] + + """ + Estimate totals for cart based on the address + """ + estimateTotals( + """ + An input object that specifies details for cart totals estimation + """ + input: EstimateTotalsInput! + ): EstimateTotalsOutput! +} From e6e65d5bc94b07d776a6c82df2c5838f3a431312 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Thu, 20 Jun 2024 14:39:20 +0200 Subject: [PATCH 06/11] Added graphqls files to be forward compatible with 246 and 247 --- .../CurrentCompareUid.graphqls | 0 .../AvailablePaymentMethod.graphqls | 3 + .../CartAddressInput-vat_id.graphqls | 15 ++++ .../Mutation-deleteCustomer.graphqls | 6 ++ .../OrderItem-gift_message.graphqls | 27 +++++++ .../SelectedShippingMethod.graphqls | 4 + .../schema-247/Cart-itemsV2.graphqls | 71 ++++++++++++++++++ .../schema-247/CartAddress.graphqls | 75 +++++++++++++++++++ .../schema-247/CustomAttributesV2.graphqls | 48 ++++++++++++ .../schema-247/Mutation-cancelOrder.graphqls | 34 +++++++++ .../Mutation-confirmEmail.graphqls} | 0 .../schema-247/Mutation-contactUs.graphqls | 40 ++++++++++ .../Mutation-createGuestCart.graphqls | 20 +++++ ...Mutation-estimateShippingMethods.graphqls} | 20 ----- .../Mutation-estimateTotals.graphqls | 21 ++++++ ...buteFilterInput-category_url_path.graphqls | 3 + .../schema-247/Query-guestOrder.graphqls | 31 ++++++++ .../Query-guestOrderByToken.graphqls | 30 ++++++++ .../Query-recaptchaV3Config.graphqls | 39 ++++++++++ .../schema/245-CartItemError.graphqls | 52 ------------- .../PageBuilder.graphqls} | 0 .../BundleProductPage.graphql | 3 - .../ProductPageBundleQueryFragment.graphql | 9 --- .../ConfigurableCartItem.graphql | 2 +- 24 files changed, 468 insertions(+), 85 deletions(-) rename packages/magento-compare/{graphql => schema}/CurrentCompareUid.graphqls (100%) create mode 100644 packages/magento-graphql/schema-246/AvailablePaymentMethod.graphqls create mode 100644 packages/magento-graphql/schema-246/CartAddressInput-vat_id.graphqls create mode 100644 packages/magento-graphql/schema-246/Mutation-deleteCustomer.graphqls create mode 100644 packages/magento-graphql/schema-246/OrderItem-gift_message.graphqls create mode 100644 packages/magento-graphql/schema-246/SelectedShippingMethod.graphqls create mode 100644 packages/magento-graphql/schema-247/Cart-itemsV2.graphqls create mode 100644 packages/magento-graphql/schema-247/CartAddress.graphqls create mode 100644 packages/magento-graphql/schema-247/CustomAttributesV2.graphqls create mode 100644 packages/magento-graphql/schema-247/Mutation-cancelOrder.graphqls rename packages/magento-graphql/{schema/247-CustomerConfirmation.graphqls => schema-247/Mutation-confirmEmail.graphqls} (100%) create mode 100644 packages/magento-graphql/schema-247/Mutation-contactUs.graphqls create mode 100644 packages/magento-graphql/schema-247/Mutation-createGuestCart.graphqls rename packages/magento-graphql/{schema/247-EstimateShippingMethodsTotals.graphqls => schema-247/Mutation-estimateShippingMethods.graphqls} (73%) create mode 100644 packages/magento-graphql/schema-247/Mutation-estimateTotals.graphqls create mode 100644 packages/magento-graphql/schema-247/ProductAttributeFilterInput-category_url_path.graphqls create mode 100644 packages/magento-graphql/schema-247/Query-guestOrder.graphqls create mode 100644 packages/magento-graphql/schema-247/Query-guestOrderByToken.graphqls create mode 100644 packages/magento-graphql/schema-247/Query-recaptchaV3Config.graphqls delete mode 100644 packages/magento-graphql/schema/245-CartItemError.graphqls rename packages/magento-pagebuilder/{mesh/schema.graphqls => schema/PageBuilder.graphqls} (100%) delete mode 100644 packages/magento-product-bundle/BundleProductPage.graphql delete mode 100644 packages/magento-product-bundle/ProductPageBundleQueryFragment.graphql diff --git a/packages/magento-compare/graphql/CurrentCompareUid.graphqls b/packages/magento-compare/schema/CurrentCompareUid.graphqls similarity index 100% rename from packages/magento-compare/graphql/CurrentCompareUid.graphqls rename to packages/magento-compare/schema/CurrentCompareUid.graphqls diff --git a/packages/magento-graphql/schema-246/AvailablePaymentMethod.graphqls b/packages/magento-graphql/schema-246/AvailablePaymentMethod.graphqls new file mode 100644 index 0000000000..251607f68f --- /dev/null +++ b/packages/magento-graphql/schema-246/AvailablePaymentMethod.graphqls @@ -0,0 +1,3 @@ +type AvailablePaymentMethod { + is_deferred: Boolean +} diff --git a/packages/magento-graphql/schema-246/CartAddressInput-vat_id.graphqls b/packages/magento-graphql/schema-246/CartAddressInput-vat_id.graphqls new file mode 100644 index 0000000000..73b0863514 --- /dev/null +++ b/packages/magento-graphql/schema-246/CartAddressInput-vat_id.graphqls @@ -0,0 +1,15 @@ +input CartAddressInput { + vat_id: String +} + +interface CartAddressInteface { + vat_id: String +} + +type ShippingCartAddress implements CartAddressInterface { + vat_id: String +} + +type BillingCartAddress { + vat_id: String +} diff --git a/packages/magento-graphql/schema-246/Mutation-deleteCustomer.graphqls b/packages/magento-graphql/schema-246/Mutation-deleteCustomer.graphqls new file mode 100644 index 0000000000..2484ec2a63 --- /dev/null +++ b/packages/magento-graphql/schema-246/Mutation-deleteCustomer.graphqls @@ -0,0 +1,6 @@ +type Mutation { + """ + Delete customer account + """ + deleteCustomer: Boolean +} diff --git a/packages/magento-graphql/schema-246/OrderItem-gift_message.graphqls b/packages/magento-graphql/schema-246/OrderItem-gift_message.graphqls new file mode 100644 index 0000000000..258c304fc5 --- /dev/null +++ b/packages/magento-graphql/schema-246/OrderItem-gift_message.graphqls @@ -0,0 +1,27 @@ +interface OrderItemInterface { + """ + The selected gift message for the order item + """ + gift_message: GiftMessage +} + +type OrderItem { + """ + The selected gift message for the order item + """ + gift_message: GiftMessage +} + +type BundleOrderItem { + """ + The selected gift message for the order item + """ + gift_message: GiftMessage +} + +type DownloadableOrderItem { + """ + The selected gift message for the order item + """ + gift_message: GiftMessage +} diff --git a/packages/magento-graphql/schema-246/SelectedShippingMethod.graphqls b/packages/magento-graphql/schema-246/SelectedShippingMethod.graphqls new file mode 100644 index 0000000000..2a8af72192 --- /dev/null +++ b/packages/magento-graphql/schema-246/SelectedShippingMethod.graphqls @@ -0,0 +1,4 @@ +type SelectedShippingMethod { + price_excl_tax: Money + price_incl_tax: Money +} diff --git a/packages/magento-graphql/schema-247/Cart-itemsV2.graphqls b/packages/magento-graphql/schema-247/Cart-itemsV2.graphqls new file mode 100644 index 0000000000..378e5cb049 --- /dev/null +++ b/packages/magento-graphql/schema-247/Cart-itemsV2.graphqls @@ -0,0 +1,71 @@ +type CartItems { + """ + An array of products that have been added to the cart. + """ + items: [CartItemInterface]! + """ + Metadata for pagination rendering. + """ + page_info: SearchResultPageInfo + """ + The number of returned cart items. + """ + total_count: Int! +} + +""" +Specifies the field to use for sorting quote items +""" +enum SortQuoteItemsEnum { + ITEM_ID + CREATED_AT + UPDATED_AT + PRODUCT_ID + SKU + NAME + DESCRIPTION + WEIGHT + QTY + PRICE + BASE_PRICE + CUSTOM_PRICE + DISCOUNT_PERCENT + DISCOUNT_AMOUNT + BASE_DISCOUNT_AMOUNT + TAX_PERCENT + TAX_AMOUNT + BASE_TAX_AMOUNT + ROW_TOTAL + BASE_ROW_TOTAL + ROW_TOTAL_WITH_DISCOUNT + ROW_WEIGHT + PRODUCT_TYPE + BASE_TAX_BEFORE_DISCOUNT + TAX_BEFORE_DISCOUNT + ORIGINAL_CUSTOM_PRICE + PRICE_INC_TAX + BASE_PRICE_INC_TAX + ROW_TOTAL_INC_TAX + BASE_ROW_TOTAL_INC_TAX + DISCOUNT_TAX_COMPENSATION_AMOUNT + BASE_DISCOUNT_TAX_COMPENSATION_AMOUNT + FREE_SHIPPING +} + +""" +Specifies the field to use for sorting quote items +""" +input QuoteItemsSortInput { + """ + Specifies the quote items field to sort by + """ + field: SortQuoteItemsEnum! + """ + Specifies the order of quote items' sorting + """ + order: SortEnum! +} + +type Cart { + itemsV2(pageSize: Int = 20, currentPage: Int = 1, sort: QuoteItemsSortInput): CartItems +} diff --git a/packages/magento-graphql/schema-247/CartAddress.graphqls b/packages/magento-graphql/schema-247/CartAddress.graphqls new file mode 100644 index 0000000000..3de9c047f3 --- /dev/null +++ b/packages/magento-graphql/schema-247/CartAddress.graphqls @@ -0,0 +1,75 @@ +input CartAddressInput { + """ + The customer's fax number. + """ + fax: String + """ + The middle name of the person associated with the billing/shipping address. + """ + middlename: String + """ + An honorific, such as Dr., Mr., or Mrs. + """ + prefix: String + """ + A value such as Sr., Jr., or III. + """ + suffix: String +} + +interface CartAddressInterface { + """ + The customer's fax number. + """ + fax: String + """ + The middle name of the person associated with the billing/shipping address. + """ + middlename: String + """ + An honorific, such as Dr., Mr., or Mrs. + """ + prefix: String + """ + A value such as Sr., Jr., or III. + """ + suffix: String +} + +type BillingCartAdress { + """ + The customer's fax number. + """ + fax: String + """ + The middle name of the person associated with the billing/shipping address. + """ + middlename: String + """ + An honorific, such as Dr., Mr., or Mrs. + """ + prefix: String + """ + A value such as Sr., Jr., or III. + """ + suffix: String +} + +type ShippingCartAddress { + """ + The customer's fax number. + """ + fax: String + """ + The middle name of the person associated with the billing/shipping address. + """ + middlename: String + """ + An honorific, such as Dr., Mr., or Mrs. + """ + prefix: String + """ + A value such as Sr., Jr., or III. + """ + suffix: String +} diff --git a/packages/magento-graphql/schema-247/CustomAttributesV2.graphqls b/packages/magento-graphql/schema-247/CustomAttributesV2.graphqls new file mode 100644 index 0000000000..4b95d10c5d --- /dev/null +++ b/packages/magento-graphql/schema-247/CustomAttributesV2.graphqls @@ -0,0 +1,48 @@ +""" +Specifies the value for attribute. +""" +input AttributeValueInput { + """ + The code of the attribute. + """ + attribute_code: String! + """ + An array containing selected options for a select or multiselect attribute. + """ + selected_options: [AttributeInputSelectedOption] + """ + The value assigned to the attribute. + """ + value: String +} + +""" +Specifies selected option for a select or multiselect attribute value. +""" +input AttributeInputSelectedOption { + """ + The attribute option value. + """ + value: String! +} + +input CustomerCreateInput { + """ + The customer's custom attributes. + """ + custom_attributes: [AttributeValueInput] +} + +input CustomerUpdateInput { + """ + The customer's custom attributes. + """ + custom_attributes: [AttributeValueInput] +} + +input CustomerAddressInput { + """ + Custom attributes assigned to the customer address. + """ + custom_attributesV2: [AttributeValueInput] +} diff --git a/packages/magento-graphql/schema-247/Mutation-cancelOrder.graphqls b/packages/magento-graphql/schema-247/Mutation-cancelOrder.graphqls new file mode 100644 index 0000000000..c64e009195 --- /dev/null +++ b/packages/magento-graphql/schema-247/Mutation-cancelOrder.graphqls @@ -0,0 +1,34 @@ +""" +Defines the order to cancel. +""" +input CancelOrderInput { + """ + Order ID. + """ + order_id: ID! + """ + Cancellation reason. + """ + reason: String! +} + +""" +Contains the updated customer order and error message if any. +""" +type CancelOrderOutput { + """ + Error encountered while cancelling the order. + """ + error: String + """ + Updated customer order. + """ + order: CustomerOrder +} + +type Mutation { + """ + Cancel the specified customer order. + """ + cancelOrder(input: CancelOrderInput!): CancelOrderOutput +} diff --git a/packages/magento-graphql/schema/247-CustomerConfirmation.graphqls b/packages/magento-graphql/schema-247/Mutation-confirmEmail.graphqls similarity index 100% rename from packages/magento-graphql/schema/247-CustomerConfirmation.graphqls rename to packages/magento-graphql/schema-247/Mutation-confirmEmail.graphqls diff --git a/packages/magento-graphql/schema-247/Mutation-contactUs.graphqls b/packages/magento-graphql/schema-247/Mutation-contactUs.graphqls new file mode 100644 index 0000000000..b3482327a6 --- /dev/null +++ b/packages/magento-graphql/schema-247/Mutation-contactUs.graphqls @@ -0,0 +1,40 @@ +input ContactUsInput { + """ + The shopper's comment to the merchant. + """ + comment: String! + """ + The email address of the shopper. + """ + email: String! + """ + The full name of the shopper. + """ + name: String! + """ + The shopper's telephone number. + """ + telephone: String +} + +""" +Contains the status of the request. +""" +type ContactUsOutput { + """ + Indicates whether the request was successful. + """ + status: Boolean! +} + +type Mutation { + """ + Send a 'Contact Us' email to the merchant. + """ + contactUs( + """ + An input object that defines shopper information. + """ + input: ContactUsInput! + ): ContactUsOutput +} diff --git a/packages/magento-graphql/schema-247/Mutation-createGuestCart.graphqls b/packages/magento-graphql/schema-247/Mutation-createGuestCart.graphqls new file mode 100644 index 0000000000..f2d1ff4764 --- /dev/null +++ b/packages/magento-graphql/schema-247/Mutation-createGuestCart.graphqls @@ -0,0 +1,20 @@ +input CreateGuestCartInput { + """ + Optional client-generated ID + """ + cart_uid: ID +} + +type CreateGuestCartOutput { + """ + The newly created cart. + """ + cart: Cart +} + +type Mutation { + """ + Create a new shopping cart + """ + createGuestCart(input: CreateGuestCartInput): CreateGuestCartOutput +} diff --git a/packages/magento-graphql/schema/247-EstimateShippingMethodsTotals.graphqls b/packages/magento-graphql/schema-247/Mutation-estimateShippingMethods.graphqls similarity index 73% rename from packages/magento-graphql/schema/247-EstimateShippingMethodsTotals.graphqls rename to packages/magento-graphql/schema-247/Mutation-estimateShippingMethods.graphqls index 7ac39aa451..b25b85eab6 100644 --- a/packages/magento-graphql/schema/247-EstimateShippingMethodsTotals.graphqls +++ b/packages/magento-graphql/schema-247/Mutation-estimateShippingMethods.graphqls @@ -31,16 +31,6 @@ input EstimateTotalsInput { shipping_method: ShippingMethodInput } -""" -Estimate totals output. -""" -type EstimateTotalsOutput { - """ - Cart after totals estimation - """ - cart: Cart -} - type Mutation { """ Estimate shipping method(s) for cart based on address @@ -51,14 +41,4 @@ type Mutation { """ input: EstimateTotalsInput! ): [AvailableShippingMethod] - - """ - Estimate totals for cart based on the address - """ - estimateTotals( - """ - An input object that specifies details for cart totals estimation - """ - input: EstimateTotalsInput! - ): EstimateTotalsOutput! } diff --git a/packages/magento-graphql/schema-247/Mutation-estimateTotals.graphqls b/packages/magento-graphql/schema-247/Mutation-estimateTotals.graphqls new file mode 100644 index 0000000000..72e402892b --- /dev/null +++ b/packages/magento-graphql/schema-247/Mutation-estimateTotals.graphqls @@ -0,0 +1,21 @@ +""" +Estimate totals output. +""" +type EstimateTotalsOutput { + """ + Cart after totals estimation + """ + cart: Cart +} + +type Mutation { + """ + Estimate totals for cart based on the address + """ + estimateTotals( + """ + An input object that specifies details for cart totals estimation + """ + input: EstimateTotalsInput! + ): EstimateTotalsOutput! +} diff --git a/packages/magento-graphql/schema-247/ProductAttributeFilterInput-category_url_path.graphqls b/packages/magento-graphql/schema-247/ProductAttributeFilterInput-category_url_path.graphqls new file mode 100644 index 0000000000..3df718fc0f --- /dev/null +++ b/packages/magento-graphql/schema-247/ProductAttributeFilterInput-category_url_path.graphqls @@ -0,0 +1,3 @@ +input ProductAttributeFilterInput { + category_url_path: FilterEqualTypeInput +} diff --git a/packages/magento-graphql/schema-247/Query-guestOrder.graphqls b/packages/magento-graphql/schema-247/Query-guestOrder.graphqls new file mode 100644 index 0000000000..cdadd24472 --- /dev/null +++ b/packages/magento-graphql/schema-247/Query-guestOrder.graphqls @@ -0,0 +1,31 @@ +type CustomerOrder { + """ + Order customer email. + """ + email: String +} + +""" +Input to retrieve an order based on details. +""" +input OrderInformationInput { + """ + Order billing address email. + """ + email: String! + """ + Order number. + """ + number: String! + """ + Order billing address postcode. + """ + postcode: String! +} + +type Query { + """ + Retrieve guest order details based on number, email and postcode. + """ + guestOrder(input: OrderInformationInput!): CustomerOrder! +} diff --git a/packages/magento-graphql/schema-247/Query-guestOrderByToken.graphqls b/packages/magento-graphql/schema-247/Query-guestOrderByToken.graphqls new file mode 100644 index 0000000000..c284b56bd0 --- /dev/null +++ b/packages/magento-graphql/schema-247/Query-guestOrderByToken.graphqls @@ -0,0 +1,30 @@ +type PlaceOrderOutput { + """ + Full order information. + """ + orderV2: CustomerOrder +} + +type CustomerOrder { + """ + The token that can be used to retrieve the order using order query. + """ + token: String! +} + +""" +Input to retrieve an order based on token. +""" +input OrderTokenInput { + """ + Order token. + """ + token: String! +} + +type Query { + """ + Retrieve guest order details based on token. + """ + guestOrderByToken(input: OrderTokenInput!): CustomerOrder! +} diff --git a/packages/magento-graphql/schema-247/Query-recaptchaV3Config.graphqls b/packages/magento-graphql/schema-247/Query-recaptchaV3Config.graphqls new file mode 100644 index 0000000000..e3dad83ecc --- /dev/null +++ b/packages/magento-graphql/schema-247/Query-recaptchaV3Config.graphqls @@ -0,0 +1,39 @@ +""" +Contains reCAPTCHA V3-Invisible configuration details. +""" +type ReCaptchaConfigurationV3 { + """ + The position of the invisible reCAPTCHA badge on each page. + """ + badge_position: String! + """ + The message that appears to the user if validation fails. + """ + failure_message: String! + """ + A list of forms on the storefront that have been configured to use reCAPTCHA V3. + """ + forms: [ReCaptchaFormEnum]! + """ + Return whether recaptcha is enabled or not + """ + is_enabled: Boolean! + """ + A two-character code that specifies the language that is used for Google reCAPTCHA text and messaging. + """ + language_code: String + """ + The minimum score that identifies a user interaction as a potential risk. + """ + minimum_score: Float! + """ + The website key generated when the Google reCAPTCHA account was registered. + """ + website_key: String! +} +type Query { + """ + Returns details about Google reCAPTCHA V3-Invisible configuration. + """ + recaptchaV3Config: ReCaptchaConfigurationV3 +} diff --git a/packages/magento-graphql/schema/245-CartItemError.graphqls b/packages/magento-graphql/schema/245-CartItemError.graphqls deleted file mode 100644 index b77f5466e4..0000000000 --- a/packages/magento-graphql/schema/245-CartItemError.graphqls +++ /dev/null @@ -1,52 +0,0 @@ -# GraphCommerce 2.4.3 forward compatibility with 2.4.5 -# TODO: Remove forward compatibility layer when dropping support for 2.4.3 - -# Why does this exist? To fix and issue with a nasty bug in 2.4.3: -# When a product becomes out of stock it will return null for the cart line. - -interface CartItemInterface { - "An array of errors encountered while loading the cart item" - errors: [CartItemError] -} - -type BundleCartItem { - "An array of errors encountered while loading the cart item" - errors: [CartItemError] -} - -type ConfigurableCartItem { - "An array of errors encountered while loading the cart item" - errors: [CartItemError] -} - -type DownloadableCartItem { - "An array of errors encountered while loading the cart item" - errors: [CartItemError] -} - -type SimpleCartItem { - "An array of errors encountered while loading the cart item" - errors: [CartItemError] -} - -type VirtualCartItem { - "An array of errors encountered while loading the cart item" - errors: [CartItemError] -} - -type CartItemError { - "An error code that describes the error encountered" - code: CartItemErrorType! - "A localized error message" - message: String! -} - -type CartItemPrices { - price_including_tax: Money -} - -enum CartItemErrorType { - UNDEFINED - ITEM_QTY - ITEM_INCREMENTS -} diff --git a/packages/magento-pagebuilder/mesh/schema.graphqls b/packages/magento-pagebuilder/schema/PageBuilder.graphqls similarity index 100% rename from packages/magento-pagebuilder/mesh/schema.graphqls rename to packages/magento-pagebuilder/schema/PageBuilder.graphqls diff --git a/packages/magento-product-bundle/BundleProductPage.graphql b/packages/magento-product-bundle/BundleProductPage.graphql deleted file mode 100644 index 7df0cd982d..0000000000 --- a/packages/magento-product-bundle/BundleProductPage.graphql +++ /dev/null @@ -1,3 +0,0 @@ -query BundleProductPage($urlKey: String) { - ...ProductPageBundleQueryFragment -} diff --git a/packages/magento-product-bundle/ProductPageBundleQueryFragment.graphql b/packages/magento-product-bundle/ProductPageBundleQueryFragment.graphql deleted file mode 100644 index 56d825b3d4..0000000000 --- a/packages/magento-product-bundle/ProductPageBundleQueryFragment.graphql +++ /dev/null @@ -1,9 +0,0 @@ -fragment ProductPageBundleQueryFragment on Query { - typeProducts: products(filter: { url_key: { eq: $urlKey } }) { - items { - __typename - uid - ...BundleProductOptions - } - } -} diff --git a/packages/magento-product-configurable/ConfigurableCartItem/ConfigurableCartItem.graphql b/packages/magento-product-configurable/ConfigurableCartItem/ConfigurableCartItem.graphql index da4f3d59e4..4770b56bd7 100644 --- a/packages/magento-product-configurable/ConfigurableCartItem/ConfigurableCartItem.graphql +++ b/packages/magento-product-configurable/ConfigurableCartItem/ConfigurableCartItem.graphql @@ -5,7 +5,7 @@ fragment ConfigurableCartItem on ConfigurableCartItem @inject(into: ["CartItem"] option_label value_label } - configurable_customizable: customizable_options { + customizable_options { ...SelectedCustomizableOption } configured_variant { From 232fb9e184299c2c807ba9396528cdcd8394fbff Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Thu, 20 Jun 2024 14:50:08 +0200 Subject: [PATCH 07/11] Load schema files from schema and allow versioned schema loading --- .../{graphql => schema}/PostcodeNL.graphqls | 0 packages/cli/dist/bin/mesh.js | 10 ++++++++-- packages/cli/src/bin/mesh.ts | 13 ++++++++++--- .../schema}/CurrentCartId.graphqls | 0 .../{hooks => schema}/CustomerToken.graphqls | 0 .../AvailablePaymentMethod.graphqls | 3 --- .../schema-247/CartAddress.graphqls | 19 ------------------- .../RecentlyViewedProducts.graphqls | 0 .../{src/directive => schema}/env.graphqls | 0 .../directive => schema}/injectable.graphqls | 0 10 files changed, 18 insertions(+), 27 deletions(-) rename packages/address-fields-nl/{graphql => schema}/PostcodeNL.graphqls (100%) rename packages/{magento-cart/hooks => magento-compare/schema}/CurrentCartId.graphqls (100%) rename packages/magento-customer/{hooks => schema}/CustomerToken.graphqls (100%) delete mode 100644 packages/magento-graphql/schema-246/AvailablePaymentMethod.graphqls rename packages/magento-recently-viewed-products/{graphql => schema}/RecentlyViewedProducts.graphqls (100%) rename packagesDev/graphql-codegen-near-operation-file/{src/directive => schema}/env.graphqls (100%) rename packagesDev/graphql-codegen-near-operation-file/{src/directive => schema}/injectable.graphqls (100%) diff --git a/packages/address-fields-nl/graphql/PostcodeNL.graphqls b/packages/address-fields-nl/schema/PostcodeNL.graphqls similarity index 100% rename from packages/address-fields-nl/graphql/PostcodeNL.graphqls rename to packages/address-fields-nl/schema/PostcodeNL.graphqls diff --git a/packages/cli/dist/bin/mesh.js b/packages/cli/dist/bin/mesh.js index c20dc5761d..9e6ceb3ff6 100755 --- a/packages/cli/dist/bin/mesh.js +++ b/packages/cli/dist/bin/mesh.js @@ -48,6 +48,7 @@ async function cleanup() { } const main = async () => { const conf = (await (0, findConfig_1.findConfig)({})); + const graphCommerce = (0, next_config_1.loadConfig)(root); // We're configuring a custom fetch function conf.customFetch = require.resolve('@graphcommerce/graphql-mesh/customFetch'); conf.serve = { ...conf.serve, endpoint: '/api/graphql' }; @@ -72,8 +73,13 @@ const main = async () => { conf.additionalTypeDefs.push('**/*.graphqls'); const deps = (0, next_config_1.resolveDependenciesSync)(); const packages = [...deps.values()].filter((p) => p !== '.'); + const mV = graphCommerce.magentoVersion ?? 246; (0, next_config_1.packageRoots)(packages).forEach((r) => { - conf.additionalTypeDefs.push(`${r}/**/*.graphqls`); + const alsoScan = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254] + .filter((v) => v > mV) + .map((v) => `${r}/schema-${v}/**/*.graphqls`); + conf.additionalTypeDefs.push(`${r}/*/schema/**/*.graphqls`); + conf.additionalTypeDefs.push(...alsoScan); }); if (!conf.serve) conf.serve = {}; @@ -87,7 +93,7 @@ const main = async () => { }, }, ]; - const yamlString = (0, next_config_1.replaceConfigInString)(yaml_1.default.stringify(conf), (0, next_config_1.loadConfig)(root)); + const yamlString = (0, next_config_1.replaceConfigInString)(yaml_1.default.stringify(conf), graphCommerce); await node_fs_1.promises.writeFile(tmpMeshLocation, yamlString); // Reexport the mesh to is can be used by packages await node_fs_1.promises.writeFile(`${meshDir}/.mesh.ts`, `export * from '${relativePath.split(node_path_1.default.sep).join('/')}.mesh'`, { encoding: 'utf8' }); diff --git a/packages/cli/src/bin/mesh.ts b/packages/cli/src/bin/mesh.ts index af4d2faf67..13fb6c6fab 100755 --- a/packages/cli/src/bin/mesh.ts +++ b/packages/cli/src/bin/mesh.ts @@ -4,7 +4,6 @@ import { promises as fs } from 'node:fs' import path from 'node:path' import { exit } from 'node:process' import { - isMonorepo, loadConfig, packageRoots, replaceConfigInString, @@ -52,6 +51,7 @@ async function cleanup() { const main = async () => { const conf = (await findConfig({})) as YamlConfig.Config + const graphCommerce = loadConfig(root) // We're configuring a custom fetch function conf.customFetch = require.resolve('@graphcommerce/graphql-mesh/customFetch') @@ -83,8 +83,15 @@ const main = async () => { const deps = resolveDependenciesSync() const packages = [...deps.values()].filter((p) => p !== '.') + + const mV = graphCommerce.magentoVersion ?? 246 packageRoots(packages).forEach((r) => { - conf.additionalTypeDefs.push(`${r}/**/*.graphqls`) + const alsoScan = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254] + .filter((v) => v > mV) + .map((v) => `${r}/schema-${v}/**/*.graphqls`) + + conf.additionalTypeDefs.push(`${r}/*/schema/**/*.graphqls`) + conf.additionalTypeDefs.push(...alsoScan) }) if (!conf.serve) conf.serve = {} @@ -99,7 +106,7 @@ const main = async () => { }, ] - const yamlString = replaceConfigInString(yaml.stringify(conf), loadConfig(root)) + const yamlString = replaceConfigInString(yaml.stringify(conf), graphCommerce) await fs.writeFile(tmpMeshLocation, yamlString) // Reexport the mesh to is can be used by packages diff --git a/packages/magento-cart/hooks/CurrentCartId.graphqls b/packages/magento-compare/schema/CurrentCartId.graphqls similarity index 100% rename from packages/magento-cart/hooks/CurrentCartId.graphqls rename to packages/magento-compare/schema/CurrentCartId.graphqls diff --git a/packages/magento-customer/hooks/CustomerToken.graphqls b/packages/magento-customer/schema/CustomerToken.graphqls similarity index 100% rename from packages/magento-customer/hooks/CustomerToken.graphqls rename to packages/magento-customer/schema/CustomerToken.graphqls diff --git a/packages/magento-graphql/schema-246/AvailablePaymentMethod.graphqls b/packages/magento-graphql/schema-246/AvailablePaymentMethod.graphqls deleted file mode 100644 index 251607f68f..0000000000 --- a/packages/magento-graphql/schema-246/AvailablePaymentMethod.graphqls +++ /dev/null @@ -1,3 +0,0 @@ -type AvailablePaymentMethod { - is_deferred: Boolean -} diff --git a/packages/magento-graphql/schema-247/CartAddress.graphqls b/packages/magento-graphql/schema-247/CartAddress.graphqls index 3de9c047f3..e45e0f0881 100644 --- a/packages/magento-graphql/schema-247/CartAddress.graphqls +++ b/packages/magento-graphql/schema-247/CartAddress.graphqls @@ -17,25 +17,6 @@ input CartAddressInput { suffix: String } -interface CartAddressInterface { - """ - The customer's fax number. - """ - fax: String - """ - The middle name of the person associated with the billing/shipping address. - """ - middlename: String - """ - An honorific, such as Dr., Mr., or Mrs. - """ - prefix: String - """ - A value such as Sr., Jr., or III. - """ - suffix: String -} - type BillingCartAdress { """ The customer's fax number. diff --git a/packages/magento-recently-viewed-products/graphql/RecentlyViewedProducts.graphqls b/packages/magento-recently-viewed-products/schema/RecentlyViewedProducts.graphqls similarity index 100% rename from packages/magento-recently-viewed-products/graphql/RecentlyViewedProducts.graphqls rename to packages/magento-recently-viewed-products/schema/RecentlyViewedProducts.graphqls diff --git a/packagesDev/graphql-codegen-near-operation-file/src/directive/env.graphqls b/packagesDev/graphql-codegen-near-operation-file/schema/env.graphqls similarity index 100% rename from packagesDev/graphql-codegen-near-operation-file/src/directive/env.graphqls rename to packagesDev/graphql-codegen-near-operation-file/schema/env.graphqls diff --git a/packagesDev/graphql-codegen-near-operation-file/src/directive/injectable.graphqls b/packagesDev/graphql-codegen-near-operation-file/schema/injectable.graphqls similarity index 100% rename from packagesDev/graphql-codegen-near-operation-file/src/directive/injectable.graphqls rename to packagesDev/graphql-codegen-near-operation-file/schema/injectable.graphqls From 1bbddd9a26b1edfd73b8ef72fc8d18eb4254cc34 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Thu, 20 Jun 2024 14:50:49 +0200 Subject: [PATCH 08/11] Revert change --- .../ConfigurableCartItem/ConfigurableCartItem.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/magento-product-configurable/ConfigurableCartItem/ConfigurableCartItem.graphql b/packages/magento-product-configurable/ConfigurableCartItem/ConfigurableCartItem.graphql index 4770b56bd7..da4f3d59e4 100644 --- a/packages/magento-product-configurable/ConfigurableCartItem/ConfigurableCartItem.graphql +++ b/packages/magento-product-configurable/ConfigurableCartItem/ConfigurableCartItem.graphql @@ -5,7 +5,7 @@ fragment ConfigurableCartItem on ConfigurableCartItem @inject(into: ["CartItem"] option_label value_label } - customizable_options { + configurable_customizable: customizable_options { ...SelectedCustomizableOption } configured_variant { From 77d0033f1e47328037627d42168903dfdf9af26d Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Thu, 20 Jun 2024 14:54:28 +0200 Subject: [PATCH 09/11] Revert --- .../magento-product-bundle/BundleProductPage.graphql | 3 +++ .../ProductPageBundleQueryFragment.graphql | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 packages/magento-product-bundle/BundleProductPage.graphql create mode 100644 packages/magento-product-bundle/ProductPageBundleQueryFragment.graphql diff --git a/packages/magento-product-bundle/BundleProductPage.graphql b/packages/magento-product-bundle/BundleProductPage.graphql new file mode 100644 index 0000000000..7df0cd982d --- /dev/null +++ b/packages/magento-product-bundle/BundleProductPage.graphql @@ -0,0 +1,3 @@ +query BundleProductPage($urlKey: String) { + ...ProductPageBundleQueryFragment +} diff --git a/packages/magento-product-bundle/ProductPageBundleQueryFragment.graphql b/packages/magento-product-bundle/ProductPageBundleQueryFragment.graphql new file mode 100644 index 0000000000..56d825b3d4 --- /dev/null +++ b/packages/magento-product-bundle/ProductPageBundleQueryFragment.graphql @@ -0,0 +1,9 @@ +fragment ProductPageBundleQueryFragment on Query { + typeProducts: products(filter: { url_key: { eq: $urlKey } }) { + items { + __typename + uid + ...BundleProductOptions + } + } +} From e7f941488a5c7c6d4b85e7074cfda87a745ac9d2 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Fri, 21 Jun 2024 14:04:35 +0200 Subject: [PATCH 10/11] Require magentoVersion in config --- docs/framework/config.md | 2 +- packages/magento-graphql/Config.graphqls | 2 +- packagesDev/next-config/dist/generated/config.js | 2 +- packagesDev/next-config/src/generated/config.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/framework/config.md b/docs/framework/config.md index 6b07a8d402..6db63ef425 100644 --- a/docs/framework/config.md +++ b/docs/framework/config.md @@ -109,7 +109,7 @@ GraphQL Magento endpoint. Examples: - https://magento2.test/graphql -#### magentoVersion: number (required) = `245` +#### magentoVersion: number (required) Version of the Magento backend. diff --git a/packages/magento-graphql/Config.graphqls b/packages/magento-graphql/Config.graphqls index a26531e9c5..510c8bc81b 100644 --- a/packages/magento-graphql/Config.graphqls +++ b/packages/magento-graphql/Config.graphqls @@ -12,7 +12,7 @@ extend input GraphCommerceConfig { Values: 245, 246, 247 for Magento 2.4.5, 2.4.6, 2.4.7 respectively. """ - magentoVersion: Int! = 245 + magentoVersion: Int! } extend input GraphCommerceStorefrontConfig { diff --git a/packagesDev/next-config/dist/generated/config.js b/packagesDev/next-config/dist/generated/config.js index 4e08ac232b..a93dc6eb8c 100644 --- a/packagesDev/next-config/dist/generated/config.js +++ b/packagesDev/next-config/dist/generated/config.js @@ -92,7 +92,7 @@ function GraphCommerceConfigSchema() { hygraphWriteAccessToken: _zod.z.string().nullish(), limitSsg: _zod.z.boolean().nullish(), magentoEndpoint: _zod.z.string().min(1), - magentoVersion: _zod.z.number().default(245), + magentoVersion: _zod.z.number(), previewSecret: _zod.z.string().nullish(), productFiltersLayout: ProductFiltersLayoutSchema.default("DEFAULT").nullish(), productFiltersPro: _zod.z.boolean().nullish(), diff --git a/packagesDev/next-config/src/generated/config.ts b/packagesDev/next-config/src/generated/config.ts index 0a058d166b..bee42053ad 100644 --- a/packagesDev/next-config/src/generated/config.ts +++ b/packagesDev/next-config/src/generated/config.ts @@ -282,7 +282,7 @@ export type GraphCommerceConfig = { * * Values: 245, 246, 247 for Magento 2.4.5, 2.4.6, 2.4.7 respectively. */ - magentoVersion?: Scalars['Int']['input']; + magentoVersion: Scalars['Int']['input']; /** To enable next.js' preview mode, configure the secret you'd like to use. */ previewSecret?: InputMaybe; /** @@ -488,7 +488,7 @@ export function GraphCommerceConfigSchema(): z.ZodObject Date: Fri, 21 Jun 2024 14:10:05 +0200 Subject: [PATCH 11/11] Fix test --- .../next-config/__tests__/config/utils/mergeEnvIntoConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts b/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts index a670af93e1..0e3ffb9ff2 100644 --- a/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts +++ b/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts @@ -79,12 +79,12 @@ it('correctly validates if a value is JSON', () => { it('converts an env schema to a config schema', () => { const configFile: GraphCommerceConfig = { storefront: [{ locale: 'en', hygraphLocales: ['en'], magentoStoreCode: 'en_us' }], - customerRequireEmailConfirmation: false, productFiltersPro: false, canonicalBaseUrl: 'https://example.com', hygraphEndpoint: 'https://example.com', magentoEndpoint: 'https://example.com', previewSecret: 'secret', + magentoVersion: 247, } const environmentVariables = {