Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/product comparison packages core #2595

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e283c08
feat: start sku matrix
ramondorosario-ct Sep 10, 2024
4b3031f
Revert "feat: start sku matrix"
ramondorosario-ct Sep 11, 2024
3ae4e87
Merge branch 'vtex:main' into main
tiago-freire Sep 12, 2024
b75ef32
Merge branch 'vtex:main' into main
tiago-freire Sep 13, 2024
322aa62
Merge branch 'vtex:main' into main
tiago-freire Sep 16, 2024
c052dd5
Merge branch 'vtex:main' into main
tiago-freire Sep 17, 2024
30f6cca
feat: add variant product in api
HiagoMoreiraCubos Sep 18, 2024
6e0a18b
add data in product query
HiagoMoreiraCubos Sep 19, 2024
77282fd
Merge branch 'vtex:main' into main
tiago-freire Sep 30, 2024
9c74c94
Merge branch 'vtex:main' into main
tiago-freire Oct 9, 2024
e63bf7e
Merge branch 'vtex:main' into main
HiagoMoreiraCubos Oct 10, 2024
49a8732
Merge branch 'vtex:main' into main
tiago-freire Oct 14, 2024
50656cc
Merge branch 'vtex:main' into main
HiagoMoreiraCubos Nov 22, 2024
b156ffd
feat: create product comparison component
HiagoMoreiraCubos Dec 11, 2024
6f9f5bb
feat: implement new component on screen
HiagoMoreiraCubos Dec 11, 2024
65abdff
fix: adjust screen
HiagoMoreiraCubos Dec 12, 2024
ad6461c
feat: add labels from headlessCMS
HiagoMoreiraCubos Dec 20, 2024
b1bc5be
fix: fixing properties on toolbar
HiagoMoreiraCubos Dec 20, 2024
836f293
feat: integreation with api
HiagoMoreiraCubos Jan 2, 2025
81251e0
fix: removed console.log
HiagoMoreiraCubos Jan 2, 2025
6f8879b
Delete ProductComparison.tsx
HiagoMoreiraCubos Jan 2, 2025
9a7bb95
fix
HiagoMoreiraCubos Jan 2, 2025
502224e
feat: set dinamic labels in cms
HiagoMoreiraCubos Jan 6, 2025
5817112
feat: add sort options in sidebar
HiagoMoreiraCubos Jan 9, 2025
57c4687
chora: todo list icaro
HiagoMoreiraCubos Jan 9, 2025
2c1b939
refactor: adjust ProductComparisonSidebar component
icaroov Jan 20, 2025
921c196
fix: query on product card
HiagoMoreiraCubos Jan 21, 2025
19d5f50
fix: removed component from package
HiagoMoreiraCubos Jan 21, 2025
a5bac9f
Merge branch 'main' of github.com:cubos-vtex/faststore into feat/prod…
HiagoMoreiraCubos Jan 22, 2025
e6ec38b
fix: adjust product comparison component
HiagoMoreiraCubos Jan 24, 2025
a7ba7d0
fix: typing on product card
HiagoMoreiraCubos Jan 24, 2025
2a1e816
fix: adjust import local
HiagoMoreiraCubos Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/api/src/__generated__/schema.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/api/src/typeDefs/skuVariants.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type SkuVariants {
availableVariations(dominantVariantName: String): FormattedVariants

"""
All possible variant combinations of the current product. It also includes the data for each variant.
All available options for each SKU variant property, indexed by their name.
"""
allVariantProducts: [StoreProduct!]
}
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ export type {
SlideDirection,
} from './useSlider'
export { useSlideVisibility } from './useSlideVisibility'
export { useProductComparison } from './useProductComparison'


13 changes: 13 additions & 0 deletions packages/components/src/hooks/useProductComparison.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useContext } from "react";

import { ProductComparisonContext } from "../organisms/ProductComparison/provider/ProductComparisonProvider";

export function useProductComparison() {
const context = useContext(ProductComparisonContext);

if (context === undefined) {
throw new Error("useProductComparison must be used within a ProductComparisonProvider");
}

return context;
}
3 changes: 3 additions & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ export type {
SlideOverHeaderProps,
} from './organisms/SlideOver'

export { default as ProductComparison, ProductComparisonTrigger, ProductComparisonToolbar, ProductComparisonSidebar } from './organisms/ProductComparison'
export type { ProductComparisonProps, ProductComparisonTriggerProps, ProductComparisonToolbarProps, ProductComparisonSidebarProps } from './organisms/ProductComparison'

export {
default as SKUMatrix,
SKUMatrixTrigger,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/@generated/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\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 priceWithTaxes\n quantity\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n hasSpecifications\n\n unitMultiplier\n\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n allVariantProducts {\n name\n productID\n }\n }\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,
Expand Down Expand Up @@ -66,7 +66,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\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 priceWithTaxes\n quantity\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n hasSpecifications\n\n unitMultiplier\n\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n allVariantProducts {\n name\n productID\n }\n }\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.
Expand Down
123 changes: 115 additions & 8 deletions packages/core/@generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1136,9 +1136,20 @@ export type ProductSummary_ProductFragment = {
sku: string
name: string
gtin: string
hasSpecifications: boolean | null
unitMultiplier: number | null
id: string
brand: { name: string; brandName: string }
isVariantOf: { productGroupID: string; name: string }
isVariantOf: {
productGroupID: string
name: string
skuVariants: {
activeVariations: any | null
slugsMap: any | null
availableVariations: any | null
allVariantProducts: Array<{ name: string; productID: string }> | null
} | null
}
image: Array<{ url: string; alternateName: string }>
offers: {
lowPrice: number
Expand All @@ -1148,6 +1159,7 @@ export type ProductSummary_ProductFragment = {
price: number
listPrice: number
listPriceWithTaxes: number
priceWithTaxes: number
quantity: number
seller: { identifier: string }
}>
Expand Down Expand Up @@ -1193,12 +1205,54 @@ export type ProductDetailsFragment_ProductFragment = {
unitMultiplier: number | null
id: string
isVariantOf: {
productGroupID: string
name: string
skuVariants: {
activeVariations: any | null
slugsMap: any | null
availableVariations: any | null
allVariantProducts: Array<{ name: string; productID: string }> | null
} | null
}
image: Array<{ url: string; alternateName: string }>
brand: { name: string }
offers: {
lowPrice: number
lowPriceWithTaxes: number
offers: Array<{
availability: string
price: number
priceWithTaxes: number
listPrice: number
listPriceWithTaxes: number
seller: { identifier: string }
}>
}
additionalProperty: Array<{
propertyID: string
name: string
value: any
valueReference: any
}>
}

export type ProductComparisonFragment_ProductFragment = {
sku: string
slug: string
name: string
gtin: string
description: string
unitMultiplier: number | null
hasSpecifications: boolean | null
id: string
isVariantOf: {
productGroupID: string
name: string
skuVariants: {
activeVariations: any | null
slugsMap: any | null
availableVariations: any | null
allVariantProducts: Array<{ name: string; productID: string }> | null
} | null
}
image: Array<{ url: string; alternateName: string }>
Expand All @@ -1211,6 +1265,7 @@ export type ProductDetailsFragment_ProductFragment = {
price: number
priceWithTaxes: number
listPrice: number
quantity: number
listPriceWithTaxes: number
seller: { identifier: string }
}>
Expand Down Expand Up @@ -1344,12 +1399,13 @@ export type ServerProductQueryQuery = {
}>
}
isVariantOf: {
name: string
productGroupID: string
name: string
skuVariants: {
activeVariations: any | null
slugsMap: any | null
availableVariations: any | null
allVariantProducts: Array<{ name: string; productID: string }> | null
} | null
}
additionalProperty: Array<{
Expand Down Expand Up @@ -1541,9 +1597,23 @@ export type ClientManyProductsQueryQuery = {
sku: string
name: string
gtin: string
hasSpecifications: boolean | null
unitMultiplier: number | null
id: string
brand: { name: string; brandName: string }
isVariantOf: { productGroupID: string; name: string }
isVariantOf: {
productGroupID: string
name: string
skuVariants: {
activeVariations: any | null
slugsMap: any | null
availableVariations: any | null
allVariantProducts: Array<{
name: string
productID: string
}> | null
} | null
}
image: Array<{ url: string; alternateName: string }>
offers: {
lowPrice: number
Expand All @@ -1553,6 +1623,7 @@ export type ClientManyProductsQueryQuery = {
price: number
listPrice: number
listPriceWithTaxes: number
priceWithTaxes: number
quantity: number
seller: { identifier: string }
}>
Expand Down Expand Up @@ -1629,12 +1700,13 @@ export type ClientProductQueryQuery = {
unitMultiplier: number | null
id: string
isVariantOf: {
name: string
productGroupID: string
name: string
skuVariants: {
activeVariations: any | null
slugsMap: any | null
availableVariations: any | null
allVariantProducts: Array<{ name: string; productID: string }> | null
} | null
}
image: Array<{ url: string; alternateName: string }>
Expand Down Expand Up @@ -1674,9 +1746,23 @@ export type ClientSearchSuggestionsQueryQuery = {
sku: string
name: string
gtin: string
hasSpecifications: boolean | null
unitMultiplier: number | null
id: string
brand: { name: string; brandName: string }
isVariantOf: { productGroupID: string; name: string }
isVariantOf: {
productGroupID: string
name: string
skuVariants: {
activeVariations: any | null
slugsMap: any | null
availableVariations: any | null
allVariantProducts: Array<{
name: string
productID: string
}> | null
} | null
}
image: Array<{ url: string; alternateName: string }>
offers: {
lowPrice: number
Expand All @@ -1686,6 +1772,7 @@ export type ClientSearchSuggestionsQueryQuery = {
price: number
listPrice: number
listPriceWithTaxes: number
priceWithTaxes: number
quantity: number
seller: { identifier: string }
}>
Expand Down Expand Up @@ -1820,6 +1907,7 @@ export const ProductSummary_ProductFragmentDoc = new TypedDocumentString(
price
listPrice
listPriceWithTaxes
priceWithTaxes
quantity
seller {
identifier
Expand All @@ -1832,6 +1920,21 @@ export const ProductSummary_ProductFragmentDoc = new TypedDocumentString(
value
valueReference
}
hasSpecifications
unitMultiplier
isVariantOf {
productGroupID
name
skuVariants {
activeVariations
slugsMap
availableVariations
allVariantProducts {
name
productID
}
}
}
advertisement {
adId
adResponseId
Expand Down Expand Up @@ -1921,6 +2024,10 @@ export const ProductDetailsFragment_ProductFragmentDoc =
activeVariations
slugsMap
availableVariations
allVariantProducts {
name
productID
}
}
}
image {
Expand Down Expand Up @@ -2226,7 +2333,7 @@ export const ServerCollectionPageQueryDocument = {
export const ServerProductQueryDocument = {
__meta__: {
operationName: 'ServerProductQuery',
operationHash: '46103bee661405bde706d72126fdbf9b0a0c9e6e',
operationHash: 'e855903879c6504e90269e6e010549bc6de933eb',
},
} as unknown as TypedDocumentString<
ServerProductQueryQuery,
Expand Down Expand Up @@ -2280,7 +2387,7 @@ export const ClientProductGalleryQueryDocument = {
export const ClientProductQueryDocument = {
__meta__: {
operationName: 'ClientProductQuery',
operationHash: '7d121ef8d4dc99174e64e4429a9b977b8bbebed8',
operationHash: '47aa22eb750cb2c529e5eeafb921bfeadb67db71',
},
} as unknown as TypedDocumentString<
ClientProductQueryQuery,
Expand All @@ -2289,7 +2396,7 @@ export const ClientProductQueryDocument = {
export const ClientSearchSuggestionsQueryDocument = {
__meta__: {
operationName: 'ClientSearchSuggestionsQuery',
operationHash: '47e48eaee91d16a4237eb2c1241bc2ed3e2ad9bb',
operationHash: '061bbf200ec29ac0b235d1eb40ebdce9cda7bcf0',
},
} as unknown as TypedDocumentString<
ClientSearchSuggestionsQueryQuery,
Expand Down
48 changes: 48 additions & 0 deletions packages/core/cms/faststore/sections.json
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,54 @@
}
}
}
},
"productComparison": {
"title": "Product Comparison",
"type": "object",
"properties": {
"enabled": {
"title": "Enable Product Comparison",
"type": "boolean",
"default": false
},
"labels": {
"title": "Labels",
"type": "object",
"properties": {
"compareButton": {
"title": "Compare Button",
"type": "string",
"default": "Compare"
},
"clearSelectionButton": {
"title": "Clear Selection Button",
"type": "string",
"default": "Clear Selection"
},
"selectionWarning": {
"title": "Selection Warning",
"type": "string",
"default": "Select at least"
},
"technicalInformation": {
"title": "Technical Information",
"type": "object",
"properties": {
"title": {
"title": "Title",
"type": "string",
"default": "Technical Information"
},
"description": {
"title": "Description",
"type": "string",
"default": "Technical facts and information about the product."
}
}
}
}
}
}
}
}
}
Expand Down
Loading
Loading