From 3d5b633d25ecbf00b38f7c6f9eb130a8d8b9ec19 Mon Sep 17 00:00:00 2001 From: Arthur Andrade Date: Fri, 10 May 2024 15:50:15 -0300 Subject: [PATCH] feat: add taxes in ProductCard and set default usePriceWithTaxes to false --- packages/core/@generated/gql.ts | 4 ++-- packages/core/@generated/graphql.ts | 12 ++++++++++-- .../src/components/cart/CartItem/CartItem.tsx | 4 ++-- .../components/cart/CartSidebar/CartSidebar.tsx | 4 ++-- .../product/ProductCard/ProductCard.tsx | 15 +++++++++++++-- .../sections/ProductDetails/ProductDetails.tsx | 2 +- .../ui/ProductDetails/ProductDetailsSettings.tsx | 8 ++++---- 7 files changed, 34 insertions(+), 15 deletions(-) diff --git a/packages/core/@generated/gql.ts b/packages/core/@generated/gql.ts index bd2d6b8ffb..64de31c172 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 offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\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\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': 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, @@ -64,7 +64,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 offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\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\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' ): 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 6b4d2f4a8d..49abd0ba95 100644 --- a/packages/core/@generated/graphql.ts +++ b/packages/core/@generated/graphql.ts @@ -1109,10 +1109,12 @@ export type ProductSummary_ProductFragment = { image: Array<{ url: string; alternateName: string }> offers: { lowPrice: number + lowPriceWithTaxes: number offers: Array<{ availability: string price: number listPrice: number + listPriceWithTaxes: number quantity: number seller: { identifier: string } }> @@ -1417,10 +1419,12 @@ export type ClientManyProductsQueryQuery = { image: Array<{ url: string; alternateName: string }> offers: { lowPrice: number + lowPriceWithTaxes: number offers: Array<{ availability: string price: number listPrice: number + listPriceWithTaxes: number quantity: number seller: { identifier: string } }> @@ -1546,10 +1550,12 @@ export type ClientSearchSuggestionsQueryQuery = { image: Array<{ url: string; alternateName: string }> offers: { lowPrice: number + lowPriceWithTaxes: number offers: Array<{ availability: string price: number listPrice: number + listPriceWithTaxes: number quantity: number seller: { identifier: string } }> @@ -1676,10 +1682,12 @@ export const ProductSummary_ProductFragmentDoc = new TypedDocumentString( } offers { lowPrice + lowPriceWithTaxes offers { availability price listPrice + listPriceWithTaxes quantity seller { identifier @@ -2054,7 +2062,7 @@ export const SubscribeToNewsletterDocument = { export const ClientManyProductsQueryDocument = { __meta__: { operationName: 'ClientManyProductsQuery', - operationHash: 'c0d7d2ae1d5aaae5d50eea683b389377c36fb57d', + operationHash: '99012563e9885c3b27a716ca212a2c317e7ec12f', }, } as unknown as TypedDocumentString< ClientManyProductsQueryQuery, @@ -2081,7 +2089,7 @@ export const ClientProductQueryDocument = { export const ClientSearchSuggestionsQueryDocument = { __meta__: { operationName: 'ClientSearchSuggestionsQuery', - operationHash: 'a8a27661f6a032e086c047339e0d0f180f0e0161', + operationHash: '47af7b9c9e0fb18b01050767daf3e765f67819ac', }, } as unknown as TypedDocumentString< ClientSearchSuggestionsQueryQuery, diff --git a/packages/core/src/components/cart/CartItem/CartItem.tsx b/packages/core/src/components/cart/CartItem/CartItem.tsx index 6233c7af7c..f0b1f721b3 100644 --- a/packages/core/src/components/cart/CartItem/CartItem.tsx +++ b/packages/core/src/components/cart/CartItem/CartItem.tsx @@ -62,8 +62,8 @@ function useCartItemEvent() { interface Props { item: ICartItem - useUnitMultiplier: boolean - usePriceWithTaxes: boolean + useUnitMultiplier?: boolean + usePriceWithTaxes?: boolean } function CartItem({ diff --git a/packages/core/src/components/cart/CartSidebar/CartSidebar.tsx b/packages/core/src/components/cart/CartSidebar/CartSidebar.tsx index d81fdc5c61..ffc76abbac 100644 --- a/packages/core/src/components/cart/CartSidebar/CartSidebar.tsx +++ b/packages/core/src/components/cart/CartSidebar/CartSidebar.tsx @@ -87,7 +87,7 @@ function CartSidebar({ icon: { icon: checkoutButtonIcon, alt: checkoutButtonIconAlt }, }, quantitySelector, - usePriceWithTaxes = true, + usePriceWithTaxes = false, }: CartSidebarProps) { const btnProps = useCheckoutButton() const { @@ -136,8 +136,8 @@ function CartSidebar({ {items.map((item) => (
  • > notAvailableButtonTitle: string - useUnitMultiplier: boolean - usePriceWithTaxes: boolean + useUnitMultiplier?: boolean + usePriceWithTaxes?: boolean } function ProductDetailsSettings({ @@ -35,8 +35,8 @@ function ProductDetailsSettings({ setQuantity, buyButtonIcon: { icon: buyButtonIconName, alt: buyButtonIconAlt }, notAvailableButtonTitle, - useUnitMultiplier, - usePriceWithTaxes, + useUnitMultiplier = false, + usePriceWithTaxes = false, }: ProductDetailsSettingsProps) { const { BuyButton,