From 63a7ef0d511bd20ab444f9ea56cc731346b64298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramon=20do=20Ros=C3=A1rio?= Date: Wed, 6 Nov 2024 16:41:55 -0300 Subject: [PATCH] feat: quick order settings --- packages/core/@generated/gql.ts | 4 +- packages/core/@generated/graphql.ts | 51 +++++++++++++++++-- packages/core/cms/faststore/sections.json | 6 +++ .../components/navigation/Navbar/Navbar.tsx | 2 + .../product/ProductCard/ProductCard.tsx | 8 +++ .../search/SearchDropdown/SearchDropdown.tsx | 8 ++- .../search/SearchInput/SearchInput.tsx | 7 ++- .../SearchProductItem/SearchProductItem.tsx | 5 ++ .../src/components/sections/Navbar/Navbar.tsx | 1 + 9 files changed, 83 insertions(+), 9 deletions(-) diff --git a/packages/core/@generated/gql.ts b/packages/core/@generated/gql.ts index acc84a5177..83c76c764f 100644 --- a/packages/core/@generated/gql.ts +++ b/packages/core/@generated/gql.ts @@ -12,7 +12,7 @@ import * as types from './graphql' * Therefore it is highly recommended to use the babel or swc plugin for production. */ const documents = { - '\n fragment ProductSummary_product on StoreProduct {\n id: productID\n slug\n sku\n brand {\n brandName: name\n }\n name\n gtin\n\n isVariantOf {\n productGroupID\n name\n }\n\n image {\n url\n alternateName\n }\n\n brand {\n name\n }\n\n offers {\n lowPrice\n lowPriceWithTaxes\n offers {\n availability\n price\n listPrice\n listPriceWithTaxes\n quantity\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n advertisement {\n adId\n adResponseId\n }\n }\n': + '\n fragment ProductSummary_product on StoreProduct {\n id: productID\n slug\n sku\n brand {\n brandName: name\n }\n name\n gtin\n\t\tunitMultiplier\n\n isVariantOf {\n productGroupID\n name\n\t\t\tskuVariants {\n\t\t\t\tallVariantsByName\n\t\t\t\tactiveVariations\n\t\t\t\tslugsMap\n\t\t\t\tavailableVariations\n\t\t\t}\n }\n\n image {\n url\n alternateName\n }\n\n brand {\n name\n }\n\n offers {\n lowPrice\n lowPriceWithTaxes\n offers {\n availability\n price\n listPrice\n listPriceWithTaxes\n\t\t\t\tpriceWithTaxes\n quantity\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n advertisement {\n adId\n adResponseId\n }\n }\n': types.ProductSummary_ProductFragmentDoc, '\n fragment Filter_facets on StoreFacet {\n ... on StoreFacetRange {\n key\n label\n\n min {\n selected\n absolute\n }\n\n max {\n selected\n absolute\n }\n\n __typename\n }\n ... on StoreFacetBoolean {\n key\n label\n values {\n label\n value\n selected\n quantity\n }\n\n __typename\n }\n }\n': types.Filter_FacetsFragmentDoc, @@ -62,7 +62,7 @@ const documents = { * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function gql( - source: '\n fragment ProductSummary_product on StoreProduct {\n id: productID\n slug\n sku\n brand {\n brandName: name\n }\n name\n gtin\n\n isVariantOf {\n productGroupID\n name\n }\n\n image {\n url\n alternateName\n }\n\n brand {\n name\n }\n\n offers {\n lowPrice\n lowPriceWithTaxes\n offers {\n availability\n price\n listPrice\n listPriceWithTaxes\n quantity\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n advertisement {\n adId\n adResponseId\n }\n }\n' + source: '\n fragment ProductSummary_product on StoreProduct {\n id: productID\n slug\n sku\n brand {\n brandName: name\n }\n name\n gtin\n\t\tunitMultiplier\n\n isVariantOf {\n productGroupID\n name\n\t\t\tskuVariants {\n\t\t\t\tallVariantsByName\n\t\t\t\tactiveVariations\n\t\t\t\tslugsMap\n\t\t\t\tavailableVariations\n\t\t\t}\n }\n\n image {\n url\n alternateName\n }\n\n brand {\n name\n }\n\n offers {\n lowPrice\n lowPriceWithTaxes\n offers {\n availability\n price\n listPrice\n listPriceWithTaxes\n\t\t\t\tpriceWithTaxes\n quantity\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n advertisement {\n adId\n adResponseId\n }\n }\n' ): typeof import('./graphql').ProductSummary_ProductFragmentDoc /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. diff --git a/packages/core/@generated/graphql.ts b/packages/core/@generated/graphql.ts index feeba2639b..986e3aae3d 100644 --- a/packages/core/@generated/graphql.ts +++ b/packages/core/@generated/graphql.ts @@ -1129,9 +1129,19 @@ export type ProductSummary_ProductFragment = { sku: string name: string gtin: string + unitMultiplier: number | null id: string brand: { name: string; brandName: string } - isVariantOf: { productGroupID: string; name: string } + isVariantOf: { + productGroupID: string + name: string + skuVariants: { + allVariantsByName: any | null + activeVariations: any | null + slugsMap: any | null + availableVariations: any | null + } | null + } image: Array<{ url: string; alternateName: string }> offers: { lowPrice: number @@ -1141,6 +1151,7 @@ export type ProductSummary_ProductFragment = { price: number listPrice: number listPriceWithTaxes: number + priceWithTaxes: number quantity: number seller: { identifier: string } }> @@ -1440,9 +1451,19 @@ export type ClientManyProductsQueryQuery = { sku: string name: string gtin: string + unitMultiplier: number | null id: string brand: { name: string; brandName: string } - isVariantOf: { productGroupID: string; name: string } + isVariantOf: { + productGroupID: string + name: string + skuVariants: { + allVariantsByName: any | null + activeVariations: any | null + slugsMap: any | null + availableVariations: any | null + } | null + } image: Array<{ url: string; alternateName: string }> offers: { lowPrice: number @@ -1452,6 +1473,7 @@ export type ClientManyProductsQueryQuery = { price: number listPrice: number listPriceWithTaxes: number + priceWithTaxes: number quantity: number seller: { identifier: string } }> @@ -1568,9 +1590,19 @@ export type ClientSearchSuggestionsQueryQuery = { sku: string name: string gtin: string + unitMultiplier: number | null id: string brand: { name: string; brandName: string } - isVariantOf: { productGroupID: string; name: string } + isVariantOf: { + productGroupID: string + name: string + skuVariants: { + allVariantsByName: any | null + activeVariations: any | null + slugsMap: any | null + availableVariations: any | null + } | null + } image: Array<{ url: string; alternateName: string }> offers: { lowPrice: number @@ -1580,6 +1612,7 @@ export type ClientSearchSuggestionsQueryQuery = { price: number listPrice: number listPriceWithTaxes: number + priceWithTaxes: number quantity: number seller: { identifier: string } }> @@ -1691,9 +1724,16 @@ export const ProductSummary_ProductFragmentDoc = new TypedDocumentString( } name gtin + unitMultiplier isVariantOf { productGroupID name + skuVariants { + allVariantsByName + activeVariations + slugsMap + availableVariations + } } image { url @@ -1710,6 +1750,7 @@ export const ProductSummary_ProductFragmentDoc = new TypedDocumentString( price listPrice listPriceWithTaxes + priceWithTaxes quantity seller { identifier @@ -2087,7 +2128,7 @@ export const SubscribeToNewsletterDocument = { export const ClientManyProductsQueryDocument = { __meta__: { operationName: 'ClientManyProductsQuery', - operationHash: 'ad2eb78cfccb9dbd5a9f2d1e150cc70fea5da99a', + operationHash: 'e7bbfcfafb21aa4bd6da4214051cd8f16aa1327a', }, } as unknown as TypedDocumentString< ClientManyProductsQueryQuery, @@ -2114,7 +2155,7 @@ export const ClientProductQueryDocument = { export const ClientSearchSuggestionsQueryDocument = { __meta__: { operationName: 'ClientSearchSuggestionsQuery', - operationHash: '4d9f934764d8578aea08673b8ba57e8bf738f534', + operationHash: 'b1f6ae39a92bcb3aab858edfecb283b71ff9fb27', }, } as unknown as TypedDocumentString< ClientSearchSuggestionsQueryQuery, diff --git a/packages/core/cms/faststore/sections.json b/packages/core/cms/faststore/sections.json index ca97d868e3..212fc0cad0 100644 --- a/packages/core/cms/faststore/sections.json +++ b/packages/core/cms/faststore/sections.json @@ -221,6 +221,12 @@ "discount_desc", "score_desc" ] + }, + "quickOrder": { + "title": "Enable Quick Order?", + "description": "Allows adding products directly to the cart through search terms, streamlining the purchase.", + "type": "boolean", + "default": false } } }, diff --git a/packages/core/src/components/navigation/Navbar/Navbar.tsx b/packages/core/src/components/navigation/Navbar/Navbar.tsx index 8392603180..452b98ac89 100644 --- a/packages/core/src/components/navigation/Navbar/Navbar.tsx +++ b/packages/core/src/components/navigation/Navbar/Navbar.tsx @@ -142,6 +142,7 @@ function Navbar({