id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_vtex-ads_351cee4c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/Pixel.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { canUseDOM } from 'vtex.render-runtime'\n\nif (canUseDOM) {\n window.newtailMedia.isReady = true\n}\n\n```"
}
] |
code_vtex-ads_2bbe38ff
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/SponsoredBrands.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-console */\nimport React from 'react'\nimport type { PropsWithChildren } from 'react'\nimport { defineMessages } from 'react-intl'\n\nimport SponsoredBrandsComponent from './components/SponsoredBrands'\nimport { VTEXAdsProvider } from './hooks/useAds'\nimport { useDebug } from './utils/debug'\n\nfunction SponsoredBrands(\n props: PropsWithChildren<VTEXAdsSponsoredBrandsProps>\n) {\n useDebug({\n name: 'Sponsored Brands',\n props,\n template: 'primary',\n })\n\n const isActive = props.active ?? true\n\n if (!isActive) return <></>\n\n return (\n <VTEXAdsProvider adType=\"sponsored_brand\" {...props}>\n <SponsoredBrandsComponent\n hideHeader={props.hideHeader}\n hideLogo={props.hideLogo}\n hideBrandName={props.hideBrandName}\n hideHeadline={props.hideHeadline}\n hideDescription={props.hideDescription}\n template={props.template}\n />\n </VTEXAdsProvider>\n )\n}\n\nconst messages = defineMessages({\n 'sponsoredBrand.title': {\n id: 'admin/vtex-vtex-ads.sponsoredBrand.title',\n defaultMessage: '',\n },\n 'common.active.title': {\n id: 'admin/vtex-vtex-ads.common.active.title',\n defaultMessage: '',\n },\n 'common.placementNameAdmin.title': {\n id: 'admin/vtex-vtex-ads.common.placementNameAdmin.title',\n defaultMessage: '',\n },\n 'sponsoredBrand.placementNameAdmin.description': {\n id: 'admin/vtex-vtex-ads.sponsoredBrand.placementNameAdmin.description',\n defaultMessage: '',\n },\n 'common.quantityAdmin.title': {\n id: 'admin/vtex-vtex-ads.common.quantityAdmin.title',\n defaultMessage: '',\n },\n 'common.quantityAdmin.product.description': {\n id: 'admin/vtex-vtex-ads.common.quantityAdmin.product.description',\n defaultMessage: '',\n },\n 'common.categoryNameAdmin.title': {\n id: 'admin/vtex-vtex-ads.common.categoryNameAdmin.title',\n defaultMessage: '',\n },\n 'common.categoryNameAdmin.description': {\n id: 'admin/vtex-vtex-ads.common.categoryNameAdmin.description',\n defaultMessage: '',\n },\n})\n\nSponsoredBrands.schema = {\n title: messages['sponsoredBrand.title'].id,\n type: 'object',\n properties: {\n placementName: {\n default: 'placement_sb_default',\n isLayout: true,\n type: 'string',\n },\n quantity: {\n default: 20,\n isLayout: true,\n type: 'string',\n },\n categoryName: {\n default: null,\n isLayout: true,\n type: 'string',\n },\n },\n}\n\nexport default SponsoredBrands\n\n```"
}
] |
code_vtex-ads_d159c3b1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/package.json from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"version\": \"0.0.1\",\n \"name\": \"vtex-ads\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"@types/styled-components\": \"^5.1.26\",\n \"apollo-client\": \"^2.6.8\",\n \"axios\": \"^1.3.4\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-content-loader\": \"^6.2.1\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"3\",\n \"state-pool\": \"^0.10.0\",\n \"styled-components\": \"^5.3.9\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/axios\": \"^0.14.0\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.9.8\",\n \"@types/react\": \"^16.9.31\",\n \"@types/react-intl\": \"3\",\n \"@vtex/test-tools\": \"^3.4.3\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.6.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.1/public/@types/vtex.css-handles\",\n \"vtex.device-detector\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.device-detector@0.2.6/public/@types/vtex.device-detector\",\n \"vtex.flex-layout\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.21.5/public/@types/vtex.flex-layout\",\n \"vtex.order-items\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-items@0.14.0/public/@types/vtex.order-items\",\n \"vtex.order-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.12.0/public/@types/vtex.order-manager\",\n \"vtex.pixel-interfaces\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.pixel-interfaces@1.1.1/public/_types/react\",\n \"vtex.pixel-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.pixel-manager@1.9.0/public/@types/vtex.pixel-manager\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.10.1/public/@types/vtex.product-context\",\n \"vtex.product-highlights\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-highlights@2.3.2/public/@types/vtex.product-highlights\",\n \"vtex.product-list-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-list-context@0.4.1/public/@types/vtex.product-list-context\",\n \"vtex.product-price\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-price@1.32.1/public/@types/vtex.product-price\",\n \"vtex.product-summary\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-summary@2.90.7/public/@types/vtex.product-summary\",\n \"vtex.product-summary-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-summary-context@0.13.0/public/@types/vtex.product-summary-context\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.136.1/public/@types/vtex.render-runtime\",\n \"vtex.rich-text\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.rich-text@0.16.0/public/@types/vtex.rich-text\",\n \"vtex.search-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-graphql@0.69.2/public/@types/vtex.search-graphql\",\n \"vtex.search-page-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-page-context@0.2.0/public/@types/vtex.search-page-context\",\n \"vtex.session-client\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.session-client@1.0.4/public/@types/vtex.session-client\",\n \"vtex.slider-layout\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.slider-layout@0.24.8/public/@types/vtex.slider-layout\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.13/public/@types/vtex.styleguide\"\n },\n \"resolutions\": {\n \"graphql\": \"14.6.0\",\n \"expect\": \"28.1.3\",\n \"pretty-format\": \"28.1.3\"\n }\n}\n\n```"
}
] |
code_vtex-ads_fc2d9569
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/Shelf.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-console */\nimport React from 'react'\nimport type { PropsWithChildren } from 'react'\nimport { defineMessages } from 'react-intl'\n\nimport ShelfComponent from './components/Shelf'\nimport { VTEXAdsProvider } from './hooks/useAds'\nimport { useDebug } from './utils/debug'\n\nfunction Shelf(props: PropsWithChildren<NewtailMediaShelfProps>) {\n useDebug({\n name: 'Shelf - Sponsored products',\n props,\n template: 'primary',\n })\n\n const isActive = props.active ?? true\n\n if (!isActive) return <></>\n\n return (\n <VTEXAdsProvider adType=\"product\" {...props}>\n <ShelfComponent />\n </VTEXAdsProvider>\n )\n}\n\nconst messages = defineMessages({\n 'shelf.title': {\n id: 'admin/vtex-vtex-ads.shelf.title',\n defaultMessage: '',\n },\n 'common.active.title': {\n id: 'admin/vtex-vtex-ads.common.active.title',\n defaultMessage: '',\n },\n 'common.placementNameAdmin.title': {\n id: 'admin/vtex-vtex-ads.common.placementNameAdmin.title',\n defaultMessage: '',\n },\n 'shelf.placementNameAdmin.description': {\n id: 'admin/vtex-vtex-ads.shelf.placementNameAdmin.description',\n defaultMessage: '',\n },\n 'common.quantityAdmin.title': {\n id: 'admin/vtex-vtex-ads.common.quantityAdmin.title',\n defaultMessage: '',\n },\n 'common.quantityAdmin.product.description': {\n id: 'admin/vtex-vtex-ads.common.quantityAdmin.product.description',\n defaultMessage: '',\n },\n 'common.categoryNameAdmin.title': {\n id: 'admin/vtex-vtex-ads.common.categoryNameAdmin.title',\n defaultMessage: '',\n },\n 'common.categoryNameAdmin.description': {\n id: 'admin/vtex-vtex-ads.common.categoryNameAdmin.description',\n defaultMessage: '',\n },\n})\n\nShelf.schema = {\n title: messages['shelf.title'].id,\n type: 'object',\n properties: {\n placementName: {\n default: 'products',\n isLayout: true,\n type: 'string',\n },\n quantity: {\n default: 20,\n isLayout: true,\n type: 'string',\n },\n categoryName: {\n default: null,\n isLayout: true,\n type: 'string',\n },\n },\n}\n\nexport default Shelf\n\n```"
}
] |
code_vtex-ads_a249569b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/store/contentSchemas.json from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"definitions\": {\n \"Banner\": {\n \"type\": \"object\",\n \"properties\": {\n \"active\": {\n \"title\": \"admin/vtex-vtex-ads.common.active.title\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"placementNameAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.placementNameAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.banner.placementNameAdmin.description\",\n \"type\": \"string\"\n },\n \"sizeAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.banner.sizeAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.banner.sizeAdmin.description\",\n \"type\": \"string\"\n },\n \"sizeMobileAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.banner.sizeMobileAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.banner.sizeMobileAdmin.description\",\n \"type\": \"string\"\n },\n \"quantityAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.quantityAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.common.quantityAdmin.banner.description\",\n \"type\": \"string\"\n },\n \"categoryNameAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.categoryNameAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.common.categoryNameAdmin.description\",\n \"type\": \"string\"\n }\n }\n },\n \"Shelf\": {\n \"type\": \"object\",\n \"properties\": {\n \"active\": {\n \"title\": \"admin/vtex-vtex-ads.common.active.title\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"placementNameAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.placementNameAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.shelf.placementNameAdmin.description\",\n \"type\": \"string\"\n },\n \"quantityAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.quantityAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.common.quantityAdmin.product.description\",\n \"type\": \"string\"\n },\n \"categoryNameAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.categoryNameAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.common.categoryNameAdmin.description\",\n \"type\": \"string\"\n }\n }\n },\n \"SponsoredBrands\": {\n \"type\": \"object\",\n \"properties\": {\n \"active\": {\n \"title\": \"admin/vtex-vtex-ads.common.active.title\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"placementNameAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.placementNameAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.shelf.placementNameAdmin.description\",\n \"type\": \"string\"\n },\n \"quantityAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.quantityAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.common.quantityAdmin.product.description\",\n \"type\": \"string\"\n },\n \"categoryNameAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.categoryNameAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.common.categoryNameAdmin.description\",\n \"type\": \"string\"\n }\n }\n },\n \"SponsoredProducts\": {\n \"type\": \"object\",\n \"properties\": {\n \"active\": {\n \"title\": \"admin/vtex-vtex-ads.common.active.title\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"placementNameAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.placementNameAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.shelf.placementNameAdmin.description\",\n \"type\": \"string\"\n },\n \"quantityAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.quantityAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.common.quantityAdmin.product.description\",\n \"type\": \"string\"\n },\n \"categoryNameAdmin\": {\n \"title\": \"admin/vtex-vtex-ads.common.categoryNameAdmin.title\",\n \"description\": \"admin/vtex-vtex-ads.common.categoryNameAdmin.description\",\n \"type\": \"string\"\n }\n }\n }\n }\n}\n\n```"
}
] |
code_vtex-ads_e48d24bb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/store/blocks.json from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.col#product-image\": {\n \"children\": [\"product-summary-image#shelf\"]\n },\n\n \"product-summary-image#shelf\": {\n \"props\": {\n \"showBadge\": true,\n \"aspectRatio\": \"1:1\",\n \"maxHeight\": 300\n }\n },\n\n \"product-list-price#summary\": {\n \"props\": {\n \"blockClass\": \"summary\"\n }\n },\n \"product-selling-price#summary\": {\n \"props\": {\n \"blockClass\": \"summary\"\n }\n },\n\n \"product-price-savings#summary\": {\n \"props\": {\n \"markers\": [\"discount\"],\n \"blockClass\": \"summary\"\n }\n },\n\n \"flex-layout.row#selling-price-savings\": {\n \"props\": {\n \"colGap\": 1,\n \"preserveLayoutOnMobile\": true,\n \"preventHorizontalStretch\": true,\n \"marginBottom\": 1,\n \"horizontalAlign\": \"center\"\n },\n \"children\": [\"product-list-price#summary\", \"product-selling-price#summary\"]\n },\n\n \"product-sponsored-tag\": {},\n\n \"product-summary.shelf\": {\n \"children\": [\n \"product-summary-image#shelf\",\n \"product-summary-name\",\n \"flex-layout.row#selling-price-savings\",\n \"product-price-savings#summary\",\n \"product-sponsored-tag\"\n ]\n },\n\n \"slider-layout#newtail-shelf\": {\n \"props\": {\n \"itemsPerPage\": {\n \"desktop\": 4,\n \"tablet\": 1,\n \"phone\": 1\n },\n \"blockClass\": \"shelf\",\n \"navigationStep\": 1,\n \"infinite\": true,\n \"fullWidth\": false,\n \"showNavigationArrows\": \"desktopOnly\",\n \"showPaginationDots\": \"mobileOnly\"\n }\n },\n\n \"list-context.product-list-static\": {\n \"blocks\": [\"product-summary.shelf\"],\n \"children\": [\"slider-layout#newtail-shelf\"]\n },\n\n \"slider-layout#newtail-shelf-with-video\": {\n \"props\": {\n \"itemsPerPage\": {\n \"desktop\": 2,\n \"tablet\": 1,\n \"phone\": 1\n },\n \"blockClass\": \"shelf\",\n \"navigationStep\": 1,\n \"infinite\": true,\n \"fullWidth\": false,\n \"showNavigationArrows\": \"desktopOnly\",\n \"showPaginationDots\": \"mobileOnly\"\n }\n },\n\n \"list-context.product-list-static#with-video\": {\n \"blocks\": [\"product-summary.shelf\"],\n \"children\": [\"slider-layout#newtail-shelf-with-video\"]\n }\n}\n\n```"
}
] |
code_vtex-ads_0f0a7365
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/store/interfaces.json from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"vtex-ads-pixel-event\": {\n \"component\": \"PixelEvent\"\n },\n\n \"vtex-ads-banner\": {\n \"component\": \"Banner\",\n \"content\": {\n \"$ref\": \"#/definitions/Banner\"\n }\n },\n\n \"vtex-ads-sponsored-brands\": {\n \"component\": \"SponsoredBrands\",\n \"required\": [\"list-context.product-list-static\"],\n \"allowed\": [\"product-summary.shelf\", \"rich-text\"],\n \"content\": {\n \"$ref\": \"#/definitions/SponsoredBrands\"\n }\n },\n\n \"vtex-ads-shelf\": {\n \"required\": [\"list-context.product-list-static\"],\n \"allowed\": [\"product-summary.shelf\", \"rich-text\"],\n \"component\": \"Shelf\",\n \"content\": {\n \"$ref\": \"#/definitions/Shelf\"\n }\n },\n\n \"vtex-ads-products\": {\n \"required\": [\"product-summary.shelf\"],\n \"component\": \"SponsoredProducts\",\n \"content\": {\n \"$ref\": \"#/definitions/SponsoredProducts\"\n }\n },\n\n \"vtex-ads-conversion\": {\n \"component\": \"Conversion\"\n },\n\n \"pixel.vtex-ads\": {\n \"component\": \"Pixel\"\n },\n\n \"product-sponsored-tag\": {\n \"component\": \"ProductSponsoredTag\"\n },\n\n \"pixel.newtail-media\": {\n \"component\": \"Pixel\"\n },\n\n \"newtail-media-pixel-event\": {\n \"component\": \"PixelEvent\"\n },\n\n \"newtail-media-banner\": {\n \"component\": \"Banner\",\n \"content\": {\n \"$ref\": \"#/definitions/Banner\"\n }\n },\n\n \"newtail-media-sponsored-brands\": {\n \"component\": \"SponsoredBrands\",\n \"required\": [\"list-context.product-list-static\"],\n \"allowed\": [\"product-summary.shelf\", \"rich-text\"],\n \"content\": {\n \"$ref\": \"#/definitions/SponsoredBrands\"\n }\n },\n\n \"newtail-media-shelf\": {\n \"required\": [\"list-context.product-list-static\"],\n \"allowed\": [\"product-summary.shelf\", \"rich-text\"],\n \"component\": \"Shelf\",\n \"content\": {\n \"$ref\": \"#/definitions/Shelf\"\n }\n },\n\n \"newtail-media-products\": {\n \"required\": [\"product-summary.shelf\"],\n \"component\": \"SponsoredProducts\",\n \"content\": {\n \"$ref\": \"#/definitions/SponsoredProducts\"\n }\n }\n}\n\n```"
}
] |
code_vtex-ads_fcc7450a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/docs/public/README.md from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\nContent for https://newtail-media.readme.io/reference/vtex\n```"
}
] |
code_vtex-ads_05058b53
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/examples/store-theme/manifest.json from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"vtex.vtex-ads\": \"0.x\"\n }\n}\n\n```"
}
] |
code_vtex-ads_a81bf6a7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/examples/store-theme/styles/css/vtex.vtex-ads.css from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n/**\n* VTEX Ads - CSS Handles\n*\n* This file contains the CSS handles for the VTEX Ads app.\n* It is used to style the components of the app.\n*\n* @author VTEX\n* @version 0.0.1\n*/\n\n/**\n* vtex-ads-shelf\n*/\n.shelf-container {}\n\n/**\n* vtex-ads-banner\n*/\n.banner-container {}\n.banner-item {}\n.banner-image {}\n\n\n/**\n* vtex-ads-sponsored-brands\n*/\n\n.sponsored-brands-container {}\n\n.sponsored-brands-header {}\n\n.sponsored-brands-header-container {}\n\n.sponsored-brands-header-content {}\n\n.sponsored-brands-header-headline {}\n\n.sponsored-brands-header-description {}\n\n.sponsored-brands-header-button {}\n\n.sponsored-brands-content {}\n\n.sponsored-brands-label-container {}\n\n.sponsored-brands-label-text {}\n\n.sponsored-brands-logo-container {}\n\n.sponsored-brands-logo {}\n\n.sponsored-brands-banner-container {}\n\n.sponsored-brands-products-container {}\n\n.sponsored-brands-banner-image {}\n\n.sponsored-brands-banner-item {}\n\n/**\n* vtex-ads-pixel-event\n*/\n\n.product-pixel-event {}\n\n```"
}
] |
code_vtex-ads_81200f3a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/examples/store-theme/store/blocks/vtexads/site-pdp-middle-product.jsonc from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n /**\n * AD Block\n * [en] Here is called the block that builds the sponsored products carousel\n */\n \"vtex-ads-shelf#pdp-middle\": {\n \"title\": \"VTEX Ads - Product shelf middle PDP\",\n \"blocks\": [\n \"rich-text#vtex-ads-sponsored-title\", // Optional\n \"list-context.product-list-static#vtex-ads\"\n ],\n \"props\": {\n \"placementName\": \"site_pdp_middle_product\", // {channel}_{context}_ {position}_{type}\n \"quantity\": 10 // Optional, default is 20\n }\n },\n\n /**\n * UI Blocks\n * [en] From here, we will have examples of auxiliary layout blocks\n */\n\n /**\n * Responsive layout\n * [en] Not all are required, you can use according to your customization needs\n */\n\n // Desktop\n \"flex-layout.col#vtex-ads-pdp-middle-product.desktop\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"vtex-ads-shelf#pdp-middle\"]\n },\n\n \"flex-layout.row#vtex-ads-pdp-middle-product.desktop\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"flex-layout.col#vtex-ads-pdp-middle-product.desktop\"]\n },\n\n \"responsive-layout.desktop#vtex-ads-pdp-middle-product\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.responsive-layout\n \"children\": [\"flex-layout.row#vtex-ads-pdp-middle-product.desktop\"]\n },\n\n // Mobile\n \"flex-layout.col#vtex-ads-pdp-middle-product.mobile\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"vtex-ads-shelf#pdp-middle\"]\n },\n\n \"flex-layout.row#vtex-ads-pdp-middle-product.mobile\": {\n \"children\": [\"flex-layout.col#vtex-ads-pdp-middle-product.mobile\"]\n },\n\n \"responsive-layout.mobile#vtex-ads-pdp-middle-product\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.responsive-layout\n \"children\": [\"flex-layout.row#vtex-ads-pdp-middle-product.mobile\"]\n },\n\n /**\n * Group responsive\n */\n \"flex-layout.col#vtex-ads-pdp-middle-product\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\n \"responsive-layout.desktop#vtex-ads-pdp-middle-product\",\n \"responsive-layout.mobile#vtex-ads-pdp-middle-product\"\n ]\n },\n\n /**\n * Final component\n * This block will be called in the PDP of your theme in the position you want to insert ads.\n */\n \"flex-layout.row#vtex-ads-pdp-middle-product\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"flex-layout.col#vtex-ads-pdp-middle-product\"]\n }\n}\n\n```"
}
] |
code_vtex-ads_0be05ee2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/examples/store-theme/store/blocks/vtexads/site-pdp-top-banner.jsonc from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n /**\n * Ad Block\n * [en] Here is called the block that builds the sponsored banner\n */\n \"vtex-ads-banner#pdp-top\": {\n \"title\": \"VTEX Ads - Banner top PDP\",\n \"props\": {\n \"placementName\": \"site_pdp_top_banner\", // {channel}_{context}_ {position}_{type}\n \"size\": \"1280x176\", // Same size registered in the ad platform\n \"sizeMobile\": \"634x300\" // Same size registered in the ad platform\n }\n },\n\n /**\n * UI Blocks\n * [en] From here, we will have examples of auxiliary layout blocks\n */\n\n /**\n * Responsive layout\n * [en] Not all are required, you can use according to your customization needs\n */\n\n // Desktop\n\n \"flex-layout.col#vtex-ads-pdp-top-banner.desktop\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"vtex-ads-banner#pdp-top\"]\n },\n \"flex-layout.row#vtex-ads-pdp-top-banner.desktop\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"flex-layout.col#vtex-ads-pdp-top-banner.desktop\"]\n },\n\n \"responsive-layout.desktop#vtex-ads-pdp-top-banner\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.responsive-layout\n \"children\": [\"flex-layout.row#vtex-ads-pdp-top-banner.desktop\"]\n },\n\n // Mobile\n \"flex-layout.col#vtex-ads-pdp-top-banner.mobile\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"vtex-ads-banner#pdp-top\"]\n },\n \"flex-layout.row#vtex-ads-pdp-top-banner.mobile\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"flex-layout.col#vtex-ads-pdp-top-banner.mobile\"]\n },\n\n \"responsive-layout.mobile#vtex-ads-pdp-top-banner\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.responsive-layout\n \"children\": [\"flex-layout.row#vtex-ads-pdp-top-banner.mobile\"]\n },\n\n /**\n * Group responsive\n */\n \"flex-layout.col#vtex-ads-pdp-top-banner\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\n \"responsive-layout.desktop#vtex-ads-pdp-top-banner\",\n \"responsive-layout.mobile#vtex-ads-pdp-top-banner\"\n ]\n },\n\n /**\n * Final component\n * This block will be called in the PDP of your theme in the position you want to insert ads.\n */\n \"flex-layout.row#vtex-ads-pdp-top-banner\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"flex-layout.col#vtex-ads-pdp-top-banner\"]\n }\n}\n\n```"
}
] |
code_vtex-ads_704b1bd3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/examples/store-theme/store/blocks/vtexads/site-search-top-sponsored-brands.jsonc from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n /**\n * AD Block\n * [en] Here is called the block that builds the sponsored products carousel\n */\n \"vtex-ads-sponsored-brands#search-top\": {\n \"title\": \"VTEX Ads - Sponsored brand\",\n \"blocks\": [\"list-context.product-list-static#vtex-ads\"],\n \"props\": {\n \"placementName\": \"site_search_top_sb\", // {channel}_{context}_ {position}_{type}\n \"sizeMobile\": \"450x150\", // Same size registered in the ad platform\n \"size\": \"450x225\", // Same size registered in the ad platform\n \"hideHeader\": true // Optional\n }\n },\n\n /**\n * UI Blocks\n * [en] From here, we will have examples of auxiliary layout blocks\n */\n\n /**\n * Responsive layout\n * [en] Not all are required, you can use according to your customization needs\n */\n\n // Desktop\n \"flex-layout.col#vtex-ads-search-sb-top.desktop\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"vtex-ads-sponsored-brands#search-top\"]\n },\n\n \"flex-layout.row#vtex-ads-search-sb-top.desktop\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"flex-layout.col#vtex-ads-search-sb-top.desktop\"]\n },\n\n \"responsive-layout.desktop#vtex-ads-search-sb-top\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.responsive-layout\n \"children\": [\"flex-layout.row#vtex-ads-search-sb-top.desktop\"]\n },\n\n // Mobile\n \"flex-layout.col#vtex-ads-search-sb-top.mobile\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"vtex-ads-sponsored-brands#search-top\"]\n },\n\n \"flex-layout.row#vtex-ads-search-sb-top.mobile\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"flex-layout.col#vtex-ads-search-sb-top.mobile\"]\n },\n\n \"responsive-layout.mobile#vtex-ads-search-sb-top\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.responsive-layout\n \"children\": [\"flex-layout.row#vtex-ads-search-sb-top.mobile\"]\n },\n\n /**\n * export components\n */\n\n \"flex-layout.col#vtex-ads-search-sb-top\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\n \"responsive-layout.desktop#vtex-ads-search-sb-top\",\n \"responsive-layout.mobile#vtex-ads-search-sb-top\"\n ]\n },\n\n \"flex-layout.row#vtex-ads-search-sb-top\": {\n // [DOC] https://developers.vtex.com/docs/apps/vtex.flex-layout\n \"children\": [\"flex-layout.col#vtex-ads-search-sb-top\"]\n }\n}\n\n```"
}
] |
code_vtex-ads_ab6aacf9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/examples/store-theme/store/blocks/vtexads/common.jsonc from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n/**\n * Common blocks for VTEX Ads\n * These blocks will be used in the vtex-ads blocks. Required and optional dependencies.\n */\n{\n /**\n * Optional title - `rich-text`\n * Allowed by vtex-ads-shelf\n */\n \"rich-text#vtex-ads-sponsored-title\": {\n \"title\": \"VTEX Ads - Sponsored title\",\n \"props\": {\n \"text\": \"Separados para você\"\n }\n },\n /**\n * Product card\n * Optional - If you don't want to customize, use the default card from the theme.\n * Just an example of how to customize the product card. Should be a copy of your default product card.\n */\n \"product-summary.shelf#product-custom-ads\": {\n \"children\": [\n \"vtex-ads-pixel-event\",\n \"add-to-list-btn#shelf\",\n \"flex-layout.row#image\",\n \"product-summary-name\",\n \"new-price-pbm-shelf\",\n \"flex-layout.row#shelf-default-buy\"\n ],\n \"props\": {\n \"blockClass\": [\"shelf-default\"]\n }\n },\n\n /**\n * Slider layout\n * Optional - If you don't want to customize, use the default slider-layout from the theme.\n */\n \"slider-layout#vtex-ads\": {\n \"title\": \"VTEX Ads - Slider layout\",\n \"props\": {\n \"itemsPerPage\": {\n \"desktop\": 4,\n \"tablet\": 2,\n \"mobile\": 1\n }\n }\n },\n\n /**\n * Product list\n */\n \"list-context.product-list-static#vtex-ads\": {\n \"blocks\": [\"product-summary.shelf#product-custom-ads\"],\n \"children\": [\"slider-layout#vtex-ads\"],\n \"title\": \"VTEX Ads - Product shelf - Wrapper context\"\n }\n}\n\n```"
}
] |
code_vtex-ads_27dca0e4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/examples/store-theme/store/blocks/product/product.example.jsonc from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.product\": {\n \"children\": [\n \"responsive-layout.desktop#pdp\",\n \"responsive-layout.tablet#pdp\",\n \"responsive-layout.phone#pdp\"\n ]\n },\n \"responsive-layout.desktop#pdp\": {\n \"children\": [\n \"flex-layout.row#vtex-ads-pdp-top-banner\", // ./store-theme/store/blocks/vtexads/site-pdp-top-banner.jsonc\n \"flex-layout.row#pdp-desktop-main\",\n \"flex-layout.row#vtex-ads-pdp-middle-product\", // ./store-theme/store/blocks/vtexads/site-pdp-middle-product.jsonc\n \"flex-layout.row#pdp-desktop-info\"\n ]\n },\n \"responsive-layout.tablet#pdp\": {\n \"children\": [\n \"flex-layout.row#vtex-ads-pdp-top-banner\", // ./store-theme/store/blocks/vtexads/site-pdp-top-banner.jsonc\n \"flex-layout.row#pdp-desktop-main\",\n \"flex-layout.row#vtex-ads-pdp-middle-product\", // ./store-theme/store/blocks/vtexads/site-pdp-middle-product.jsonc\n \"flex-layout.row#pdp-desktop-info\"\n ]\n },\n \"responsive-layout.phone#pdp\": {\n \"children\": [\n \"flex-layout.row#vtex-ads-pdp-top-banner\", // ./store-theme/store/blocks/vtexads/site-pdp-top-banner.jsonc\n \"flex-layout.row#pdp-desktop-main\",\n \"flex-layout.row#vtex-ads-pdp-middle-product\", // ./store-theme/store/blocks/vtexads/site-pdp-middle-product.jsonc\n \"flex-layout.row#pdp-desktop-info\"\n ]\n }\n}\n\n```"
}
] |
code_vtex-ads_5feac993
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/examples/store-theme/store/blocks/search/search.example.jsonc from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.search\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"store.search#brand\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"store.search#department\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"store.search#category\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"store.search#subcategory\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"search-result-layout\": {\n \"blocks\": [\n \"search-result-layout.desktop\",\n \"search-result-layout.mobile\",\n \"search-not-found-layout\"\n ]\n },\n\n \"search-result-layout.desktop\": {\n \"children\": [\n \"flex-layout.row#vtex-ads-search-sb-top\", // ./store-theme/store/blocks/vtexads/site-search-top-sponsored-brands.jsonc\n \"flex-layout.row#result\"\n ]\n },\n\n \"search-result-layout.mobile\": {\n \"children\": [\n \"flex-layout.row#vtex-ads-search-sb-top\", // ./store-theme/store/blocks/vtexads/site-search-top-sponsored-brands.jsonc\n \"flex-layout.row#result\"\n ]\n },\n\n \"search-not-found-layout\": {\n \"children\": [\"flex-layout.row#page-not-found\", \"tag-not-found\"]\n }\n}\n\n```"
}
] |
code_vtex-ads_0bde9cda
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/settings/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nexport const tagClassnameDefault = 'newtail-sponsored-tag'\n\n// Default\nexport const searchSelectorDefault =\n '.vtex-search-result-3-x-searchResultContainer #gallery-layout-container'\n\n// Locatel\n// export const searchSelectorDefault =\n// '.vtex-search-result-3-x-searchResultContainer .vtex-search-result-3-x-gallery--gallery-main-search'\n\n// Zona sul\n// export const searchSelectorDefault =\n// '.vtex-search-result-3-x-searchResultContainer .vtex-search-result-3-x-gallery'\n\n```"
}
] |
code_vtex-ads_4f2ac44f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/vtex.render.runtime.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// /* Typings for `render-runtime` */\n// declare module 'vtex.render-runtime' {\n// import type { ComponentType, ReactElement, ReactType } from 'react'\n\n// export interface NavigationOptions {\n// page: string\n// params?: any\n// }\n\n// export interface RenderContextProps {\n// runtime: {\n// navigate: (options: NavigationOptions) => void\n// }\n// }\n\n// interface ExtensionPointProps {\n// id: string\n// [key: string]: any\n// }\n\n// export const ExtensionPoint: ComponentType<ExtensionPointProps>\n\n// interface ChildBlockProps {\n// id: string\n// }\n\n// export const ChildBlock: ComponentType<ChildBlockProps>\n// export const useChildBlock = function (data: ChildBlockProps): ChildBlock {}\n\n// type UseTreePath = () => Record<string, unknown>\n\n// export const useTreePath: UseTreePath\n// export const Helmet: ReactElement\n// export const Link: ReactType\n// export const NoSSR: ReactElement\n// export const RenderContextConsumer: ReactElement\n// export const canUseDOM: boolean\n// export const withRuntimeContext: <TOriginalProps>(\n// Component: ComponentType<TOriginalProps & RenderContextProps>\n// ) => ComponentType<TOriginalProps>\n// }\n\n```"
}
] |
code_vtex-ads_f1c11b13
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/vtex.search-page-context.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.search-page-context/SearchPageContext' {\n type DispatchFunction = (payload: {\n type: string\n args?: Record<string, unknown>\n }) => void\n\n export const useSearchPage: () => any\n export const useSearchPageState: () => SearchPageState\n export const useSearchPageStateDispatch: () => DispatchFunction\n\n export interface SearchPageState {\n galleryLayout?: string\n searchQuery: any\n }\n}\n\n```"
}
] |
code_vtex-ads_5dc7cd73
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/events.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface VtexEvent extends MessageEvent {\n data:\n | ProductViewData\n | ProductClickData\n | OrderPlacedData\n | OrderPlacedTrackedData\n | PageViewData\n | ProductImpressionData\n | AddToCartData\n | RemoveToCartData\n | CartChangedData\n | HomePageInfo\n | ProductPageInfoData\n | SearchPageInfoData\n | UserData\n | CartIdData\n | CartData\n | PromoViewData\n | PromotionClickData\n}\ninterface PixelMessage extends MessageEvent {\n data:\n | ProductViewData\n | ProductClickData\n | OrderPlacedData\n | OrderPlacedTrackedData\n | PageViewData\n | ProductImpressionData\n | AddToCartData\n | RemoveToCartData\n | CartChangedData\n | HomePageInfo\n | ProductPageInfoData\n | SearchPageInfoData\n | UserData\n | CartIdData\n | CartData\n | PromoViewData\n | PromotionClickData\n}\n\ninterface EventData {\n event: string\n eventName: string\n currency: string\n}\n\ninterface PageInfoData extends EventData {\n event: 'pageInfo'\n eventName: 'vtex:pageInfo'\n accountName: string\n pageTitle: string\n pageUrl: string\n}\n\ninterface UserData extends PageInfoData {\n eventType: 'userData'\n eventName: 'vtex:userData'\n firstName?: string\n lastName?: string\n document?: string\n id?: string\n email?: string\n phone?: string\n isAuthenticated: boolean\n}\n\ninterface CartIdData extends PageInfoData {\n eventType: 'cartId'\n eventName: 'vtex:cartId'\n cartId: string\n}\n\ninterface HomePageInfo extends PageInfoData {\n eventType: 'homeView'\n}\n\ninterface ProductPageInfoData extends PageInfoData {\n eventType: 'productPageInfo'\n}\n\ninterface SearchPageInfoData extends PageInfoData {\n eventType:\n | 'internalSiteSearchView'\n | 'categoryView'\n | 'departmentView'\n | 'emptySearchView'\n category?: CategoryMetaData\n department?: DepartmentMetaData\n search?: SearchMetaData\n}\n\ninterface CategoryMetaData {\n id: string\n name: string\n}\n\ninterface DepartmentMetaData {\n id: string\n name: string\n}\n\ninterface SearchMetaData {\n term: string\n category: CategoryMetaData\n results: number\n}\n\ninterface PageViewData extends EventData {\n event: 'pageView'\n eventName: 'vtex:pageView'\n pageTitle: string\n pageUrl: string\n referrer: string\n}\n\ninterface AddToCartData extends EventData {\n event: 'addToCart'\n eventName: 'vtex:addToCart'\n items: CartItem[]\n}\n\ninterface RemoveToCartData extends EventData {\n event: 'removeFromCart'\n eventName: 'vtex:removeFromCart'\n items: CartItem[]\n}\n\ninterface CartChangedData extends EventData {\n event: 'cartChanged'\n eventName: 'vtex:cartChanged'\n items: CartItem[]\n}\n\ninterface OrderPlacedData extends Order, EventData {\n event: 'orderPlaced'\n eventName: 'vtex:orderPlaced'\n}\n\ninterface OrderPlacedTrackedData extends Order, EventData {\n event: 'orderPlacedTracked'\n eventName: 'vtex:orderPlacedTracked'\n}\n\ninterface ProductViewData extends EventData {\n event: 'productView'\n eventName: 'vtex:productView'\n product: ProductSummary\n list?: string\n}\n\ninterface ProductClickData extends EventData {\n event: 'productClick'\n eventName: 'vtex:productClick'\n product: ProductSummary\n position: number\n list?: string\n}\n\ninterface ProductImpressionData extends EventData {\n event: 'productImpression'\n eventName: 'vtex:productImpression'\n impressions: Impression[]\n product?: ProductSummary // deprecated, use impressions list!\n position?: number // deprecated, use impressions list!\n list: string\n}\n\ninterface CartLoadedData extends EventData {\n event: 'cartLoaded'\n eventName: 'vtex:cartLoaded'\n orderForm: OrderForm\n}\n\ninterface PromoViewData extends EventData {\n event: 'promoView'\n eventType: 'vtex:promoView'\n promotions: Promotion[]\n}\n\ninterface PromotionClickData extends EventData {\n event: 'promotionClick'\n eventType: 'vtex:promotionClick'\n promotions: Promotion[]\n}\n\ninterface Promotion {\n id?: string\n name?: string\n creative?: string\n position?: string\n}\n\ninterface CartItemAdditionalInfo {\n brandName: string\n brandId: string\n}\n\ninterface CartItem {\n id: string\n productCategories: Record<string, string> | null\n additionalInfo: CartItemAdditionalInfo | null\n brand: string\n ean: string\n category: string\n detailUrl: string\n imageUrl: string\n name: string\n skuName: string\n price: number\n priceIsInt?: boolean\n sellingPrice: number\n productId: string\n productRefId: string\n quantity: number\n skuId: string\n referenceId: string // SKU reference id\n variant: string\n}\n\ninterface Totalizer {\n id: string\n name: string\n value: number\n}\n\ninterface Seller {\n id: string\n name: string\n logo: string\n}\n\ninterface ClientProfileData {\n email: string\n firstName: string\n lastName: string\n}\n\ninterface Address {\n addressId: string\n postalCode: string\n street: string\n number: string\n neighborhood: string\n complement: string\n city: string\n state: string\n}\n\ninterface DeliveryOption {\n id: string\n price: number\n estimate: string\n isSelected: boolean\n}\n\ninterface Shipping {\n selectedAddress: Address\n deliveryOptions?: DeliveryOption[]\n}\n\ninterface MarketingData {\n coupon: string\n utmCampaign: string\n utmSource: string\n utmMedium: string\n utmiCampaign: string\n utmiPage: string\n utmiPart: string\n}\n\ninterface OrderForm {\n id: string\n totalizers: Totalizer[]\n sellers: Seller[]\n salesChannel: string\n items: CartItem[]\n canEditData: boolean\n loggedIn: boolean\n clientProfileData?: ClientProfileData\n shipping?: Shipping\n value: number\n marketingData?: MarketingData\n}\n\ninterface Order {\n accountName: string\n corporateName: string\n coupon: string\n currency: string\n openTextField: string\n orderGroup: string\n ordersInOrderGroup: string[]\n salesChannel: string\n visitorAddressCity: string\n visitorAddressComplement: string\n visitorAddressCountry: string\n visitorAddressNeighborhood: string\n visitorAddressNumber: string\n visitorAddressPostalCode: string\n visitorAddressState: string\n visitorAddressStreet: string\n visitorContactInfo: string[]\n visitorContactPhone: string\n visitorType: string\n transactionId: string\n transactionDate: string\n transactionAffiliation: string\n transactionTotal: number\n transactionShipping: number\n transactionSubtotal: number\n transactionDiscounts: number\n transactionTax: number\n transactionCurrency: string\n transactionPaymentType: PaymentType[]\n transactionShippingMethod: ShippingMethod[]\n transactionLatestShippingEstimate: Date\n transactionProducts: ProductOrder[]\n transactionPayment: {\n id: string\n }\n}\n\ninterface Impression {\n product: ProductSummary\n position: number\n}\n\ninterface PaymentType {\n group: string\n paymentSystemName: string\n installments: number\n value: number\n}\n\ninterface ShippingMethod {\n itemId: string\n selectedSla: string\n}\n\ninterface ProductOrder {\n id: string\n name: string\n sku: string\n skuRefId: string\n skuName: string\n productRefId: string\n ean: string\n slug: string\n brand: string\n brandId: string\n seller: string\n sellerId: string\n category: string\n categoryId: string\n categoryTree: string[]\n categoryIdTree: string[]\n priceTags: PriceTag[]\n originalPrice: number\n price: number\n sellingPrice: number\n tax: number\n quantity: number\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n components: any[]\n measurementUnit: string\n unitMultiplier: number\n}\n\ninterface PriceTag {\n identifier: string\n isPercentual: boolean\n value: number\n}\n\ninterface Product {\n brand: string\n brandId: string\n categories: string[]\n categoryId: string\n categoryTree: Array<{ id: string; name: string }>\n detailUrl: string\n items: Item[]\n linkText: string\n productId: string\n productName: string\n productReference: string\n selectedSku: Item\n}\n\ninterface ProductSummary {\n brand: string\n brandId: string\n categories: string[]\n items: ItemSummary[]\n linkText: string\n productId: string\n productName: string\n productReference: string\n sku: ItemSummary\n}\n\ntype Item = ItemSummary\n\ninterface ItemSummary {\n itemId: string\n ean: string\n name: string\n referenceId: { Key: string; Value: string }\n seller?: Seller\n sellers: Seller[]\n imageUrl?: string\n}\n\ninterface Seller {\n commertialOffer: CommertialOffer\n sellerId: string\n sellerDefault: boolean\n}\n\ninterface CommertialOffer {\n Price: number\n ListPrice: number\n AvailableQuantity: number\n}\n\ntype ProductViewReferenceId = Array<Item['referenceId']>\n\n```"
}
] |
code_vtex-ads_398b6222
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/vtex.session-client.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport interface SessionSuccess {\n id: string\n namespaces: {\n [key: string]: Record<\n string,\n {\n value: string\n }\n >\n public: Record<\n string,\n {\n value: string\n }\n >\n }\n}\n\n```"
}
] |
code_vtex-ads_0843b0bb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/gql.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.gql' {\n import type { DocumentNode } from 'graphql'\n\n const Schema: DocumentNode\n\n export default Schema\n}\n\ndeclare module '*.graphql' {\n import type { DocumentNode } from 'graphql'\n\n const schema: DocumentNode\n\n export default schema\n}\n\n```"
}
] |
code_vtex-ads_028e4b3f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/ProductSummaryCustom.json from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"product\": {\n \"title\": \"Produto\",\n \"type\": \"object\"\n },\n \"actionOnClick\": {\n \"title\": \"Ação ao clicar\",\n \"type\": \"funcition\"\n }\n }\n}\n\n```"
}
] |
code_vtex-ads_313813cf
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/ProductContextValue.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport interface ProductContextValue {\n loadingItem: boolean\n product: Product\n selectedItem: Item\n selectedQuantity: number\n skuSelector: SkuSelector\n buyButton: BuyButton\n assemblyOptions: AssemblyOptions\n}\n\ninterface AssemblyOptions {\n items: Items\n inputValues: Items\n areGroupsValid: Items\n}\n\ninterface BuyButton {\n clicked: boolean\n}\n\ninterface SkuSelector {\n selectedImageVariationSKU?: string\n isVisible: boolean\n areAllVariationsSelected: boolean\n}\n\ninterface Product {\n brand: string\n brandId: number\n cacheId: string\n categoryTree: CategoryTree[]\n description: string\n items: string[]\n link: string\n linkText: string\n priceRange: PriceRange\n productClusters: ProductCluster[]\n productId: string\n productName: string\n productReference: string\n properties: string[]\n specificationGroups: string[]\n __typename: string\n sku: Sku\n}\n\ninterface Sku {\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n sellers: Seller[]\n unitMultiplier: number\n variations: string[]\n __typename: string\n seller: Seller\n referenceId: ReferenceId\n image: Image\n}\n\ninterface ReferenceId {\n Value: string\n}\n\ninterface ProductCluster {\n id: string\n name: string\n __typename: string\n}\n\ninterface PriceRange {\n listPrice: ListPrice\n sellingPrice: ListPrice\n __typename: string\n}\n\ninterface ListPrice {\n highPrice: number\n lowPrice?: number\n __typename: string\n}\n\ninterface Item {\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n sellers: Seller[]\n unitMultiplier: number\n variations: string[]\n __typename: string\n}\n\ninterface Seller {\n commertialOffer: CommertialOffer\n sellerId: string\n __typename: string\n}\n\ninterface CommertialOffer {\n AvailableQuantity: number\n Installments: Installment[]\n ListPrice: number\n Price: number\n PriceWithoutDiscount: number\n Tax: number\n discountHighlights: DiscountHighlight[]\n taxPercentage: number\n teasers: string[]\n __typename: string\n}\n\ninterface DiscountHighlight {\n name: string\n __typename: string\n}\n\ninterface Installment {\n InterestRate: number\n Name: string\n NumberOfInstallments: number\n TotalValuePlusInterestRate: number\n Value: number\n __typename: string\n}\n\ninterface Image {\n imageLabel: string\n imageTag: string\n imageUrl: string\n __typename: string\n}\n\ninterface CategoryTree {\n slug: string\n __typename: string\n}\n\n```"
}
] |
code_vtex-ads_96bf5bcd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/vtex-styleguide.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.styleguide' {\n import type { ElementType, JSXElementConstructor } from 'react'\n\n export const Button: ElementType | JSXElementConstructor\n export const NumericStepper: ElementType | JSXElementConstructor\n export const Spinner: ElementType | JSXElementConstructor\n}\n\n```"
}
] |
code_vtex-ads_cecb9f86
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/global.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { FunctionComponent } from 'react'\n\ndeclare global {\n interface Window {\n newtailMedia: {\n publisherId: string\n brandCode?: string\n isReady: boolean\n }\n }\n\n interface StorefrontFunctionComponent<P = Record<string, unknown>>\n extends FunctionComponent<P> {\n schema?: Record<string, unknown>\n getSchema?(props?: P): Record<string, unknown>\n }\n\n interface Product {\n brand: string\n brandId: number\n cacheId: string\n categories?: string[]\n clusterHighlights?: Array<{ id: string; name: string }>\n categoryTree?: Array<{ slug: string }>\n description?: string\n items: SKU[]\n link: string\n linkText: string\n priceRange: ProductPriceRange\n productClusters?: Array<{ id: string; name: string }>\n productId: string\n productName: string\n productReference: string\n properties?: Array<{ name: string; values: string[] }>\n sku?: SKU\n specificationGroups: SpecificationGroup[]\n }\n\n interface ProductPriceRange {\n sellingPrice: PriceRange\n listPrice: PriceRange\n }\n\n interface PriceRange {\n highPrice: number\n lowPrice: number\n }\n\n interface SpecificationGroupProperty {\n originalName: string\n name: string\n values: string[]\n }\n\n interface SpecificationGroup {\n name?: string\n originalName?: string\n specifications?: SpecificationGroupProperty[]\n }\n\n interface Item {\n quantity: number\n product: Product\n selectedItem: SKU\n }\n\n interface CartItem {\n id: string\n productId: string\n quantity: number\n uniqueId: string\n detailUrl: string\n name: string\n brand: string\n category: string\n productRefId: string\n seller: string\n variant: string\n skuName: string\n price: number\n listPrice: number\n sellingPrice: number\n sellingPriceWithAssemblies: number\n measurementUnit: string\n skuSpecifications: string[]\n imageUrl: string\n options: string[]\n assemblyOptions: {\n added: string[]\n removed: string[]\n parentPrice: number\n }\n referenceId: Array<{\n Key: string\n Value: string\n }> | null\n }\n\n interface SKU {\n complementName?: string\n ean?: string\n image?: Image\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n nameComplete?: string\n referenceId: Array<{\n Key: string\n Value: string\n }> | null\n seller?: Seller\n sellers: Seller[]\n unitMultiplier?: number\n variations: Array<{ name: string; values: string[] }>\n }\n\n interface Image {\n cacheId?: string\n imageId?: string\n imageLabel: string | null\n imageTag?: string\n imageUrl: string\n imageText?: string | null\n }\n\n interface Seller {\n addToCartLink?: string\n commertialOffer: CommertialOffer\n sellerId: string\n sellerDefault?: boolean\n sellerName?: string\n }\n\n interface CommertialOffer {\n AvailableQuantity: number\n Installments: Installment[]\n ListPrice: number\n Price: number\n PriceWithoutDiscount: number\n RewardValue?: number\n Tax: number\n discountHighlights?: Array<{ name: string }>\n spotPrice?: number\n taxPercentage: number\n teasers?: Array<{ name: string }>\n }\n\n interface Installment {\n InterestRate: number\n Name: string\n NumberOfInstallments: number\n PaymentSystemName?: string\n TotalValuePlusInterestRate: number\n Value: number\n }\n\n interface SpecificationFilter {\n id: string\n value: string\n }\n\n interface SuggestedProductsList {\n baseProductId: string\n suggestedProductsIds?: string\n category?: string\n specificationFilters?: SpecificationFilter[]\n collection?: string\n orderBy?: string\n hideUnavailableItems?: boolean\n maxItems?: number\n skusFilter?: string\n installmentCriteria?: string\n }\n\n interface RecommendedList {\n base: Product[]\n recommended: Product[]\n }\n\n interface SuggestedList {\n products: Product[]\n hidden: boolean\n current: number\n }\n}\n\n```"
}
] |
code_vtex-ads_09d2fc91
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/css.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.css' {\n type Styles = {\n [selector: string]: string\n }\n\n const styles: Styles\n\n export default styles\n}\n\n```"
}
] |
code_vtex-ads_71d8e5b4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/graphql.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.gql' {\n import type { DocumentNode } from 'graphql'\n\n const query: DocumentNode\n export default query\n}\n\n```"
}
] |
code_vtex-ads_c8609337
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/vtex.product-summary.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// declare module 'vtex.product-summary/ProductSummaryCustom' {\n// export const mapCatalogProductToProductSummary: (product: any) => any\n// }\n\n// declare module 'vtex.product-summary' {\n// export const ProductSummaryList\n// export const ProductSummaryListWithoutQuery\n// }\n\n```"
}
] |
code_vtex-ads_f4018b16
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/queries/productsByIdentifier.gql from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery productsByIdentifier(\n $field: ProductUniqueIdentifierField!\n $values: [ID!]\n) {\n productsByIdentifier(field: $field, values: $values)\n @context(provider: \"vtex.search-graphql\") {\n brand\n brandId\n cacheId\n categoryId\n categories\n clusterHighlights {\n id\n name\n }\n description\n items {\n attachments {\n id\n name\n required\n }\n complementName\n ean\n images(quantity: 10) {\n imageId\n imageLabel\n imageTag\n imageText\n imageUrl\n }\n itemId\n kitItems {\n amount\n itemId\n product {\n brand\n categoryId\n description\n linkText \n productId\n productName\n properties {\n name\n values\n }\n }\n sku {\n images {\n imageId\n imageLabel\n imageTag\n imageText\n imageUrl\n }\n itemId\n name\n referenceId {\n Key\n Value\n }\n sellers {\n addToCartLink\n commertialOffer {\n AvailableQuantity\n CacheVersionUsedToCallCheckout\n Installments(criteria: MAX) {\n InterestRate\n Name\n NumberOfInstallments\n TotalValuePlusInterestRate\n Value\n }\n ListPrice\n Price\n PriceValidUntil\n PriceWithoutDiscount\n RewardValue\n Tax\n discountHighlights {\n name\n }\n }\n sellerDefault\n sellerId\n sellerName\n }\n }\n }\n measurementUnit\n name\n nameComplete\n referenceId {\n Key\n Value\n }\n sellers {\n addToCartLink\n commertialOffer {\n AvailableQuantity\n CacheVersionUsedToCallCheckout\n Installments {\n InterestRate\n Name\n NumberOfInstallments\n TotalValuePlusInterestRate\n Value\n }\n ListPrice\n Price\n PriceValidUntil\n PriceWithoutDiscount\n RewardValue\n Tax\n discountHighlights {\n name\n }\n teasers {\n conditions {\n minimumQuantity\n parameters {\n name\n value\n }\n }\n effects {\n parameters {\n name\n value\n }\n }\n name\n }\n }\n sellerDefault\n sellerId\n sellerName\n }\n unitMultiplier\n variations {\n name\n values\n }\n videos {\n videoUrl\n }\n }\n link\n linkText\n metaTagDescription\n priceRange {\n listPrice {\n highPrice\n lowPrice\n }\n sellingPrice {\n highPrice\n lowPrice\n }\n }\n productClusters {\n id\n name\n }\n productId\n productName\n productReference\n properties {\n name\n values\n }\n specificationGroups {\n name\n specifications {\n name\n values\n }\n }\n titleTag\n benefits {\n featured\n id\n name\n teaserType\n }\n }\n}\n```"
}
] |
code_vtex-ads_54e84c65
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/utils/push.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-console */\nexport default function push(\n rawEvent: Record<string, unknown>,\n eventName?: string\n) {\n console.log('⭐', rawEvent, eventName)\n}\n\n```"
}
] |
code_vtex-ads_a5aa878d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/utils/debug.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-console */\nimport { useMemo } from 'react'\nimport { useRuntime } from 'vtex.render-runtime'\n\nexport const debugTemplates = {\n primary: 'color:white;background:#E31C58;padding:4px;border-radius:4px;',\n}\n\ntype UseDebugProps = {\n name: string\n template: keyof typeof debugTemplates\n props: Record<string, unknown>\n}\n\nexport const useDebug = ({ name, template, props }: UseDebugProps) => {\n const { query: queryRaw } = useRuntime()\n\n const safeTemplate = debugTemplates?.[template] || debugTemplates.primary\n\n const debugModeOn = useMemo(() => {\n const query = queryRaw?.debug ?? null\n\n return query === 'vtexads'\n }, [queryRaw])\n\n if (debugModeOn) {\n console.log(`%c 🚀 VTEX Ads :: ${name}}`, safeTemplate)\n console.log('%c 🚀 ~ props:', safeTemplate, props)\n }\n}\n\n```"
}
] |
code_vtex-ads_5016c54b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/utils/hash.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function hashEmail(email: string): Promise<string> {\n const encoder = new TextEncoder()\n const data = encoder.encode(email.trim().toLowerCase())\n\n const hashBuffer = await crypto.subtle.digest('SHA-256', data)\n\n // ArrayBuffer → byte array\n const hashArray = Array.from(new Uint8Array(hashBuffer))\n\n // byte array → hex string\n const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join('')\n\n return hashHex\n}\n\n```"
}
] |
code_vtex-ads_fcc9dcfb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/utils/events.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-fallthrough */\n/* eslint-disable no-console */\nimport { canUseDOM } from 'vtex.render-runtime'\n\nimport push from './push'\n\n// export default function () {\n// return null\n// } // no-op for extension point\n\nexport function handleEvents(e: PixelMessage) {\n if (e.data.eventName) {\n console.log('handleEvents', e.data.eventName, { ...e.data })\n }\n\n switch (e.data.eventName) {\n case 'vtex:productImpression': {\n // console.log('🔮 vtex:productImpression', e.data)\n const { currency, list, impressions } = e.data\n\n const parsedImpressions = (impressions || []).map(\n getProductImpressionObjectData(list)\n )\n\n const data = {\n event: 'productImpression',\n ecommerce: {\n currencyCode: currency,\n impressions: parsedImpressions,\n },\n }\n\n push(data, 'productImpression')\n\n return\n }\n\n case 'vtex:productView': {\n const { selectedSku, productName, brand, categories } = e.data.product\n\n let price\n\n try {\n price = e.data.product.items[0].sellers[0].commertialOffer.Price\n } catch {\n price = undefined\n }\n\n const data = {\n ecommerce: {\n detail: {\n products: [\n {\n brand,\n category: getCategory(categories),\n id: selectedSku.itemId,\n name: productName,\n variant: selectedSku.name,\n price,\n },\n ],\n },\n },\n event: 'productDetail',\n }\n\n push(data)\n\n return\n }\n\n case 'vtex:productClick': {\n const { productName, brand, categories, sku } = e.data.product\n\n let price\n\n try {\n price = e.data.product.items[0].sellers[0].commertialOffer.Price\n } catch {\n price = undefined\n }\n\n const data = {\n event: 'productClick',\n ecommerce: {\n click: {\n products: [\n {\n brand,\n category: getCategory(categories),\n id: sku.itemId,\n name: productName,\n variant: sku.name,\n price,\n },\n ],\n },\n },\n }\n\n push(data)\n }\n\n default:\n break\n }\n}\n\nfunction getCategory(rawCategories: string[]) {\n if (!rawCategories || !rawCategories.length) {\n return\n }\n\n return removeStartAndEndSlash(rawCategories[0])\n}\n\n// Transform this: \"/Apparel & Accessories/Clothing/Tops/\"\n// To this: \"Apparel & Accessories/Clothing/Tops\"\nfunction removeStartAndEndSlash(category?: string) {\n return category?.replace(/^\\/|\\/$/g, '')\n}\n\nfunction getProductImpressionObjectData(list: string) {\n return ({ product, position }: Impression) => ({\n brand: product.brand,\n category: getCategory(product.categories),\n id: product.productId, // Product id\n variant: product.sku.itemId, // SKU id\n list,\n name: product.productName,\n position,\n price: `${product?.sku?.seller?.commertialOffer.Price}`,\n dimension1: product.productReference ?? '',\n dimension2: product.sku.referenceId?.Value ?? '',\n dimension3: product.sku.name, // SKU name (variation only)\n })\n}\n\nif (canUseDOM) {\n window.addEventListener('message', handleEvents)\n}\n\n```"
}
] |
code_vtex-ads_44ef3ec2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/usePageContext.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-console */\nimport { useMemo } from 'react'\nimport { useRuntime } from 'vtex.render-runtime'\nimport { useProduct } from 'vtex.product-context'\n\nconst AdContextKeys = {\n home: 'home',\n category: 'category',\n search: 'search',\n product_page: 'product_page',\n brand_page: 'brand_page',\n} as { [key in AdContext]: AdContext }\n\nexport const usePageContext = () => {\n const { query: queryRaw, route } = useRuntime()\n\n const debug = useMemo(() => queryRaw?.debug ?? null, [queryRaw])\n\n const term = useMemo(\n () => queryRaw?._q ?? queryRaw?.termo ?? null,\n [queryRaw]\n )\n\n const type = route?.pageContext?.type as PageDataContextType\n const pageContextId = route?.pageContext?.id as string\n\n /**\n * GET Sku ID from product context\n */\n const productContext = useProduct()\n const firstProductSKU = productContext?.product?.items?.[0]?.itemId\n const productSKU = (route?.queryString?.skuId || firstProductSKU) as string\n\n const queryStringMap = route?.queryString?.map as string\n\n const context = useMemo(() => {\n const isHome = pageContextId === 'store.home'\n const isSearch = pageContextId === 'search'\n const isCategorySearch = isSearch && queryStringMap === 'category-1'\n\n switch (type) {\n case 'brand':\n return term ? AdContextKeys.search : AdContextKeys.brand_page\n\n case 'product':\n return AdContextKeys.product_page\n\n case 'subcategory':\n return AdContextKeys.category\n\n case 'department':\n return AdContextKeys.category\n\n default:\n if (isHome) return AdContextKeys.home\n if (isCategorySearch) return AdContextKeys.category\n\n return type in AdContextKeys\n ? (type as AdContext)\n : AdContextKeys.search\n }\n }, [pageContextId, queryStringMap, term, type])\n\n const categoryName = useMemo(() => {\n const departmentRaw = route.params?.department || route.params?.term\n const categoryRaw = route?.params?.category\n const subcategoryRaw = route?.params?.subcategory\n const isMissingCategory =\n !route?.params?.subcategory && queryStringMap === 'category-1,category-3'\n\n const categoryPath = () => {\n let path = ''\n\n if (departmentRaw) {\n path = departmentRaw.replace(/-/g, ' ')\n\n if (categoryRaw && !isMissingCategory) {\n path += ` > ${categoryRaw.replace(/-/g, ' ')}`\n\n if (subcategoryRaw) {\n path += ` > ${subcategoryRaw.replace(/-/g, ' ')}`\n }\n }\n\n if (isMissingCategory && categoryRaw) {\n path += ` > Undefined category`\n\n if (categoryRaw) {\n path += ` > ${categoryRaw.replace(/-/g, ' ')}`\n }\n }\n }\n\n return path\n }\n\n return categoryPath() || null\n }, [route, queryStringMap])\n\n if (debug === 'vtexads') {\n console.log(\n '%c 🚧 🚧 🚧 🚧 VTEX Ads :: usePageContext :: Context 🚧 🚧 🚧 🚧',\n 'color:#E31C58;background:white;',\n route?.pageContext\n )\n\n console.log(\n '%c 🚧 🚧 🚧 🚧 VTEX Ads :: usePageContext :: Route 🚧 🚧 🚧 🚧',\n 'color:#E31C58;background:white;',\n route\n )\n\n console.log(\n `%c 🚧 🚧 🚧 🚀 VTEX Ads :: usePageContext :: Formatted category`,\n 'color:#E31C58;background:white;',\n categoryName\n )\n }\n\n const brandName = useMemo(() => route?.params?.brand || null, [route])\n\n return { context, term, brandName, categoryName, productSKU }\n}\n\n```"
}
] |
code_vtex-ads_da90b4d7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useSessionData.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useMemo } from 'react'\nimport type { SessionSuccess } from 'vtex.session-client'\nimport { useRenderSession } from 'vtex.session-client'\nimport { canUseDOM } from 'vtex.render-runtime'\n\n\nfunction getCookie(name:string) {\n if(!canUseDOM) return null\n\n const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));\n \n if (match) return match[2];\n\n return null;\n}\n\nexport const useSessionData = () => {\n const { session } = useRenderSession() as { session: SessionSuccess }\n\n const vtexRCMacId = getCookie('VtexRCMacIdv7');\n\n const sessionId = useMemo(() => vtexRCMacId || session?.id || null, [session])\n \n const userId = useMemo(\n () => session?.namespaces?.profile?.id?.value || null,\n [session]\n )\n\n return { sessionId, userId }\n}\n\n```"
}
] |
code_vtex-ads_84a2988a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useDeviceType.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useMemo } from 'react'\nimport { useDevice } from 'vtex.device-detector'\n\nexport const useDeviceType = () => {\n const { isMobile } = useDevice()\n\n return useMemo(() => (isMobile ? 'mobile' : 'desktop'), [isMobile])\n}\n\n```"
}
] |
code_vtex-ads_b64abbd2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useOnView.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/** Code borrowed from vtex.render-runtime */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport { useEffect, useRef } from 'react'\nimport type { MutableRefObject } from 'react'\n\ninterface IntersectionEvent {\n entry: IntersectionObserverEntry\n unobserve: () => void\n}\n\ninterface HookOptions {\n ref: MutableRefObject<HTMLElement | null>\n onView?: (event: IntersectionEvent) => void\n threshold?: number\n once?: boolean\n bailOut?: boolean\n initializeOnInteraction?: boolean\n}\n\n/** Hook for detecting when an element is inside the viewport.\n * Differs from react-intersection-observer (https://www.npmjs.com/package/react-intersection-observer)\n * in that this hook doesn't use setState, using a callback approach instead, to improve\n * performance by preventing re-rendering.\n */\nconst useOnView = ({\n ref,\n onView,\n threshold = 0,\n once = false,\n bailOut = false,\n initializeOnInteraction = false,\n}: HookOptions) => {\n const isObserving = useRef(false)\n const didIntersect = useRef(false)\n\n useEffect(() => {\n const initializeObserver = () => {\n const element = ref.current\n\n if (\n bailOut ||\n isObserving.current ||\n !element ||\n !onView ||\n (once && didIntersect.current)\n ) {\n return () => {}\n }\n\n isObserving.current = true\n\n const unobserve = () => {\n if (isObserving.current) {\n observer.unobserve(element)\n isObserving.current = false\n }\n }\n\n const observer = new IntersectionObserver(([entry]) => {\n if (!entry.isIntersecting) {\n return\n }\n\n if (entry.intersectionRatio < threshold) {\n return\n }\n\n if (once) {\n unobserve()\n }\n\n didIntersect.current = true\n onView({ entry, unobserve })\n })\n\n observer.observe(element)\n\n return unobserve\n }\n\n if (initializeOnInteraction) {\n const cleanUpEvents = () => {\n window?.document?.removeEventListener('scroll', handleInteraction)\n window?.document?.removeEventListener('mouseover', handleInteraction)\n }\n\n let unobserve = () => {\n cleanUpEvents()\n }\n\n const handleInteraction = () => {\n cleanUpEvents()\n unobserve = initializeObserver()\n }\n\n window?.document?.addEventListener('scroll', handleInteraction)\n window?.document?.addEventListener('mouseover', handleInteraction)\n\n return unobserve\n }\n\n return initializeObserver()\n }, [bailOut, initializeOnInteraction, onView, once, ref, threshold])\n}\n\nexport { useOnView }\n\n```"
}
] |
code_vtex-ads_781d4aa6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/helpers/availableitems.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nfunction sumAvailableQuantity(items: Item[]) {\n let totalQuantity = 0\n\n items.forEach((item) => {\n item.sellers.forEach((seller) => {\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n totalQuantity += seller.commertialOffer.AvailableQuantity || 0\n })\n })\n\n return totalQuantity\n}\n\nexport const handleAvailableItems = (products: Product[]) => {\n const filteredProducts = products.filter(\n (item) => !!sumAvailableQuantity(item.items)\n )\n\n return filteredProducts\n}\n\n```"
}
] |
code_vtex-ads_03b2cb81
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/helpers/getUserId.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport axios from 'axios'\n\nexport const getUserIdByEmail = async (email: string) => {\n try {\n const response = await axios.get(\n `/api/dataentities/CL/search?_where=email%3D'${email}'&_fields=id`\n )\n\n const userId = response.data[0]?.id as string\n\n return userId ?? null\n } catch (error) {\n console.error('Error fetching user ID:', error)\n\n return null\n }\n}\n\n```"
}
] |
code_vtex-ads_67b063f0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/services/types.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype AdTypes = 'product' | 'banner' | 'sponsored_brand'\n\ntype AdContext = 'home' | 'category' | 'search' | 'product_page' | 'brand_page'\n\ntype AdsResponse<T = string> =\n | {\n [key in T]: ProductAd[]\n }\n | {\n [key in T]: BannerAd[]\n }\n | {\n [key in T]: SponsoredBrandAd[]\n }\n\ninterface EventsUrl {\n click_url: string\n impression_url?: string\n view_url: string\n}\ntype ProductAd = {\n ad_id: string\n product_sku: string\n} & EventsUrl\n\ntype BannerAd = {\n ad_id: string\n media_url: string\n destination_url: string\n} & EventsUrl\n\ninterface AdsRequest {\n publisherId: string\n body: RequestBody\n}\n\ntype PageDataContextType =\n | AdContext\n | 'brand'\n | 'product'\n | 'category'\n | 'subcategory'\n | 'department'\n | 'route'\n\ntype CategoryContextData = {\n context: 'category'\n category_name: string | null\n}\n\ntype BrandPageContextData = {\n context: 'brand_page'\n brand_name: string | null\n}\n\ntype SearchContextData = {\n context: 'search'\n term: string | null\n}\n\ntype HomeContextData = {\n context: 'home'\n}\n\ntype ProductPageContextData = {\n context: 'product_page'\n product_sku: string\n}\n\ntype RequestBody =\n | {\n skus?: string[]\n brand?: string\n session_id: string\n user_id?: string\n term?: string\n device: 'mobile' | 'desktop'\n placements: {\n [key: string]:\n | {\n quantity: number\n types: ['product']\n }\n | {\n size: string\n quantity: number\n types: ['banner']\n }\n }\n } & (\n | CategoryContextData\n | BrandPageContextData\n | SearchContextData\n | HomeContextData\n | ProductPageContextData\n )\n\n/**\n * Conversão\n */\n\ntype ConversionItem = {\n sku: string\n quantity: number\n price: number\n promotional_price: number\n}\n\ntype ConversionBody = {\n publisher_id: string\n user_id: string\n session_id: string\n order_id: string\n items: ConversionItem[]\n created_at: string\n channel: 'ecommerce'\n}\ninterface ConversionPost {\n body: ConversionBody\n}\n\n/**\n * Response event\n */\ntype ResponseEvent = {\n messages: string[]\n}\n\n// SB\n\ninterface SponsoredBrandAd {\n ad_id: string\n assets: SponsoredBrandAdAsset[]\n brand_name: string\n brand_url: string\n campaign_name: string\n click_url: string\n description: string\n destination_url: string\n headline: string\n impression_url: string\n position: number\n products: SponsoredBrandAdProduct[]\n seller_id: null\n type: string\n view_url: string\n}\n\ninterface SponsoredBrandAdProduct {\n click_url: string\n destination_url: string\n image_url: string\n impression_url: string\n product_metadata: SponsoredBrandAdProductmetadata\n product_name: string\n product_sku: string\n ad_id: string\n seller_id: null\n view_url: string\n}\n\ninterface SponsoredBrandAdProductmetadata {\n additional_references?: string[]\n productId: string\n product_clusters: string[]\n}\n\ninterface SponsoredBrandAdAsset {\n dimension: string\n type: string\n url: string\n}\n\n```"
}
] |
code_vtex-ads_5793d327
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/services/index.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { CreateAxiosDefaults } from 'axios'\nimport axios from 'axios'\n\nexport const apiNewtailRetailMedia = axios.create({\n baseURL: `https://newtail-media.newtail.com.br/v1/rma`,\n} as CreateAxiosDefaults<{ baseURL: string }>)\n\nexport const getNewtailMedia = async ({ publisherId, body }: AdsRequest) =>\n apiNewtailRetailMedia.post<AdsResponse>(`/${publisherId}`, body)\n\nexport const postNewtailMediaConversionURL =\n 'https://newtail-media.newtail.com.br/v1/beacon/conversion'\n\n```"
}
] |
code_vtex-ads_9263018e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/vtex.order-items/OrderItems.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype DataUpdate = {\n uniqueId: string\n quantity: number\n}\n\ndeclare module 'vtex.order-items/OrderItems' {\n export const useOrderItems: () => { updateQuantity(data: DataUpdate): void }\n}\n\n```"
}
] |
code_vtex-ads_34170e98
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/typings/vtex.order-items/__types_entrypoint.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport { default as OrderItems } from './OrderItems'\nexport {}\n\n```"
}
] |
code_vtex-ads_424d9d85
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Products/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport { useAds } from '../../hooks/useAds'\nimport Products from './Products'\nimport { useProductQuery } from '../../hooks/useProductQuery'\n\nconst CSS_HANDLES = ['sponsored-products-container'] as const\n\nfunction SponsoredProducts() {\n const { skuProducts } = useAds()\n\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const { offers } = useProductQuery()\n\n return (\n <>\n {!!skuProducts?.length && (\n <section className={handles['sponsored-products-container']}>\n {!!offers && <Products products={offers} />}\n </section>\n )}\n </>\n )\n}\n\nexport default SponsoredProducts\n\n```"
}
] |
code_vtex-ads_0ab7c93b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Products/types.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype NewtailMediaShelfProps = {\n active?: boolean\n placementName?: string\n placementNameAdmin?: string\n quantity?: number\n quantityAdmin?: string\n categoryName?: string\n categoryNameAdmin?: string\n}\n\ninterface OnProductClickData {\n brand: string\n brandId: number\n cacheId: string\n categoryTree: CategoryTree[]\n description: string\n items: Item[]\n link: string\n linkText: string\n priceRange: PriceRange\n productClusters: ProductCluster[]\n productId: string\n productName: string\n productReference: string\n properties: string[]\n specificationGroups: string[]\n __typename: string\n sku: Sku\n}\n\ninterface Sku {\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n sellers: Seller[]\n unitMultiplier: number\n variations: string[]\n __typename: string\n seller: Seller\n referenceId: ReferenceId\n image: Image\n}\n\ninterface ReferenceId {\n Value: string\n}\n\ninterface ProductCluster {\n id: string\n name: string\n __typename: string\n}\n\ninterface PriceRange {\n listPrice: ListPrice\n sellingPrice: ListPrice\n __typename: string\n}\n\ninterface ListPrice {\n highPrice: number\n lowPrice: number\n __typename: string\n}\n\ninterface Item {\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n sellers: Seller[]\n unitMultiplier: number\n variations: string[]\n __typename: string\n}\n\ninterface Seller {\n commertialOffer: CommertialOffer\n sellerId: string\n __typename: string\n}\n\ninterface CommertialOffer {\n AvailableQuantity: number\n Installments: Installment[]\n ListPrice: number\n Price: number\n PriceWithoutDiscount: number\n Tax: number\n discountHighlights: DiscountHighlight[]\n taxPercentage: number\n teasers: string[]\n __typename: string\n}\n\ninterface DiscountHighlight {\n name: string\n __typename: string\n}\n\ninterface Installment {\n InterestRate: number\n Name: string\n NumberOfInstallments: number\n TotalValuePlusInterestRate: number\n Value: number\n __typename: string\n}\n\ninterface Image {\n imageLabel: string\n imageTag: string\n imageUrl: string\n __typename: string\n}\n\ninterface CategoryTree {\n slug: string\n __typename: string\n}\n\n```"
}
] |
code_vtex-ads_725d114c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Products/styles.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport styled from 'styled-components'\n\nexport const Container = styled.div``\n\n```"
}
] |
code_vtex-ads_29a7972c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Products/Products.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { ExtensionPoint } from 'vtex.render-runtime'\n\nimport { handleAvailableItems } from '../../helpers/availableitems'\n\ninterface Props {\n products: Product[]\n}\n\nconst SuggestedProducts = ({ products }: Props) => {\n const productAds = handleAvailableItems(products)\n\n return (\n <>\n {!!productAds?.length &&\n productAds.map((item) => (\n <>\n <ExtensionPoint id=\"rich-text\" />\n\n <ExtensionPoint id=\"product-summary.shelf\" product={item} />\n </>\n ))}\n </>\n )\n}\n\nexport default SuggestedProducts\n\n```"
}
] |
code_vtex-ads_261c57df
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/SponsoredBrands/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-console */\nimport React, { useCallback, useEffect, useMemo } from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport { useAds } from '../../hooks/useAds'\nimport { useOnView } from '../../hooks/useOnView'\nimport SponsoredBrandLogo from './Logo'\nimport { ImageFixedSize } from '../UI/Image'\nimport { SponsoredBrandsContentHeader } from './ContentHeader'\nimport SponsoredBrandsTag from './SponsoredBrandsTag'\nimport { templateStyles } from './styles/templates'\nimport { CSS_HANDLES } from './styles/handles'\nimport { useProductQuery } from '../../hooks/useProductQuery'\nimport ProductShelf from '../UI/ProductShelf'\n\nfunction SponsoredBrands({\n hideHeader,\n hideLogo,\n hideHeadline,\n hideDescription,\n hideBrandName,\n template = null,\n}: SponsoredBrandsInnerProps) {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const { assetsSB } = useAds()\n\n const { offers } = useProductQuery()\n\n /**\n * Handle events\n */\n const containerRef = React.useRef<HTMLDivElement | null>(null)\n\n const { handleEvents } = useAds()\n\n const handleImpression = useCallback(() => {\n handleEvents({ type: 'sponsored_brand', event: 'impression' })\n }, [handleEvents])\n\n const onView = useCallback(() => {\n handleEvents({ type: 'sponsored_brand', event: 'view' })\n }, [handleEvents])\n\n const handleClick = useCallback(() => {\n handleEvents({ type: 'sponsored_brand', event: 'click' })\n }, [handleEvents])\n\n useOnView({\n ref: containerRef,\n onView,\n once: true,\n initializeOnInteraction: true,\n })\n\n useEffect(() => {\n handleImpression()\n }, [handleImpression])\n\n // Memos\n\n const hasAd = useMemo(() => {\n return !!offers && !!assetsSB\n }, [assetsSB, offers])\n\n return (\n <>\n {hasAd && (\n <article className={`${handles['sponsored-brands-container']} `}>\n <header\n className={`${handles['sponsored-brands-header']} flex items-end mb2`}\n >\n {!hideHeader && (\n <section\n className={`${handles['sponsored-brands-header-container']} flex items-center`}\n >\n {!hideLogo && (\n <SponsoredBrandLogo handles={handles} assets={assetsSB} />\n )}\n\n <SponsoredBrandsContentHeader\n handles={handles}\n handleClick={handleClick}\n hideHeadline={!!hideHeadline}\n hideDescription={!!hideDescription}\n hideBrandName={!!hideBrandName}\n data={assetsSB as SponsoredBrandAd}\n />\n </section>\n )}\n\n <SponsoredBrandsTag handles={handles} />\n </header>\n\n <section\n className={`${handles['sponsored-brands-content']} flex ${\n template && templateStyles?.[template]?.contentContainer\n }`}\n ref={containerRef}\n style={{\n gap: '.5rem',\n }}\n >\n {assetsSB?.assets?.[0]?.url && (\n <section\n className={`${handles['sponsored-brands-banner-item']} ${handles['sponsored-brands-banner-item']}__${assetsSB?.ad_id} mr4`}\n >\n <a\n href={assetsSB?.destination_url || '#'}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"btn btn-primary\"\n onClick={handleClick}\n >\n <ImageFixedSize\n data={{\n media_url: assetsSB?.assets?.[0]?.url,\n altText: assetsSB?.brand_name,\n ad_id: assetsSB?.ad_id,\n }}\n handles={handles}\n prefix=\"sponsored-brands-banner\"\n fixedMinWidth\n />\n </a>\n </section>\n )}\n\n <section\n className={`${handles['sponsored-brands-products-container']} flex flex-auto mw-100`}\n >\n <ProductShelf products={offers} />\n </section>\n </section>\n </article>\n )}\n </>\n )\n}\n\nexport default SponsoredBrands\n\n```"
}
] |
code_vtex-ads_fa05f1b3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/SponsoredBrands/types.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype SponsoredBrandsTemplates = 'rounded'\n\ninterface SponsoredBrandsInnerProps {\n handleProducts?: (products: Product[]) => void\n hideHeader?: boolean\n hideLogo?: boolean\n hideHeadline?: boolean\n hideDescription?: boolean\n hideBrandName?: boolean\n template?: SponsoredBrandsTemplates | null\n}\n\n//\n\ntype VTEXAdsSponsoredBrandsProps = {\n active?: boolean\n placementName?: string\n placementNameAdmin?: string\n quantity?: number\n quantityAdmin?: string\n categoryName?: string\n categoryNameAdmin?: string\n\n hideHeader?: boolean\n hideLogo?: boolean\n hideHeadline?: boolean\n hideDescription?: boolean\n hideBrandName?: boolean\n\n template\n}\n\ninterface OnProductClickData {\n brand: string\n brandId: number\n cacheId: string\n categoryTree: CategoryTree[]\n description: string\n items: Item[]\n link: string\n linkText: string\n priceRange: PriceRange\n productClusters: ProductCluster[]\n productId: string\n productName: string\n productReference: string\n properties: string[]\n specificationGroups: string[]\n __typename: string\n sku: Sku\n}\n\ninterface Sku {\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n sellers: Seller[]\n unitMultiplier: number\n variations: string[]\n __typename: string\n seller: Seller\n referenceId: ReferenceId\n image: Image\n}\n\ninterface ReferenceId {\n Value: string\n}\n\ninterface ProductCluster {\n id: string\n name: string\n __typename: string\n}\n\ninterface PriceRange {\n listPrice: ListPrice\n sellingPrice: ListPrice\n __typename: string\n}\n\ninterface ListPrice {\n highPrice: number\n lowPrice: number\n __typename: string\n}\n\ninterface Item {\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n sellers: Seller[]\n unitMultiplier: number\n variations: string[]\n __typename: string\n}\n\ninterface Seller {\n commertialOffer: CommertialOffer\n sellerId: string\n __typename: string\n}\n\ninterface CommertialOffer {\n AvailableQuantity: number\n Installments: Installment[]\n ListPrice: number\n Price: number\n PriceWithoutDiscount: number\n Tax: number\n discountHighlights: DiscountHighlight[]\n taxPercentage: number\n teasers: string[]\n __typename: string\n}\n\ninterface DiscountHighlight {\n name: string\n __typename: string\n}\n\ninterface Installment {\n InterestRate: number\n Name: string\n NumberOfInstallments: number\n TotalValuePlusInterestRate: number\n Value: number\n __typename: string\n}\n\ninterface Image {\n imageLabel: string\n imageTag: string\n imageUrl: string\n __typename: string\n}\n\ninterface CategoryTree {\n slug: string\n __typename: string\n}\n\n```"
}
] |
code_vtex-ads_1a19143b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/SponsoredBrands/ContentHeader.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo } from 'react'\n\nexport const SponsoredBrandsContentHeader = ({\n handles,\n\n hideHeadline,\n hideDescription,\n handleClick,\n hideBrandName,\n data,\n}: {\n handles: Record<string, string>\n\n hideHeadline: boolean\n hideDescription: boolean\n handleClick: () => void\n hideBrandName: boolean\n data: SponsoredBrandAd\n}) => {\n const {\n brand_name: brandName,\n destination_url: destinationUrl,\n headline,\n description,\n } = data\n\n const buttonLabel = useMemo(() => {\n if (hideBrandName && brandName) {\n return `Veja mais de ${brandName}`\n }\n\n return 'Veja mais'\n }, [hideBrandName, brandName])\n\n return (\n <section\n className={`${handles['sponsored-brands-header-content']} flex flex-column`}\n >\n {!hideHeadline && headline && (\n <strong className={`${handles['sponsored-brands-header-headline']} f5`}>\n {headline}\n </strong>\n )}\n\n {!hideDescription && description && (\n <span\n className={`${handles['sponsored-brands-header-description']} f6`}\n >\n {description}\n </span>\n )}\n\n {destinationUrl && (\n <a\n href={destinationUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={`${handles['sponsored-brands-header-button']}`}\n onClick={handleClick}\n >\n {buttonLabel}\n </a>\n )}\n </section>\n )\n}\n\nexport default SponsoredBrandsContentHeader\n\n```"
}
] |
code_vtex-ads_0dc7a7b0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/SponsoredBrands/SponsoredBrandsTag.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\ninterface SponsoredBrandsTagProps {\n handles: Record<string, string>\n text?: string\n}\n\nconst SponsoredBrandsTag: React.FC<SponsoredBrandsTagProps> = ({\n handles,\n text = 'Patrocinado',\n}) => {\n return (\n <aside\n className={`${handles['sponsored-brands-label-container']} ml-auto items-end`}\n >\n <small className={`${handles['sponsored-brands-label-text']} black-50`}>\n {text}\n </small>\n </aside>\n )\n}\n\nexport default SponsoredBrandsTag\n\n```"
}
] |
code_vtex-ads_1ae47023
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/SponsoredBrands/Logo.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\ntype SponsoredBrandLogoProps = {\n handles: Record<string, string>\n assets?: SponsoredBrandAd | null\n}\n\nconst SponsoredBrandLogo = ({ handles, assets }: SponsoredBrandLogoProps) => {\n return assets?.brand_url ? (\n <div className={`${handles['sponsored-brands-logo-container']} flex`}>\n <img\n src={assets?.brand_url}\n alt={assets?.brand_name}\n className={`${handles['sponsored-brands-logo']} b--silver mw3 w4 h3 br3 ba b--silver mr4`}\n style={{\n objectFit: 'cover',\n }}\n />\n </div>\n ) : (\n <></>\n )\n}\n\nexport default SponsoredBrandLogo\n\n```"
}
] |
code_vtex-ads_962456a8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/ProductSponsoredTag/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useCallback, useMemo, useRef } from 'react'\nimport { useProduct } from 'vtex.product-context'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport type { ProductContextValue } from '../../typings/ProductContextValue'\nimport { useOnView } from '../../hooks/useOnView'\nimport { useAds } from '../../hooks/useAds'\n\nconst CSS_HANDLES = ['product-tag-label'] as const\n\nconst ProductSponsoredTag: StorefrontFunctionComponent = () => {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const adRef = useRef<HTMLDivElement | null>(null)\n\n const { handleEvents } = useAds()\n\n const productContextValue = useProduct() as\n | Partial<ProductContextValue>\n | undefined\n\n const itemId = useMemo(\n () => productContextValue?.product?.sku?.itemId ?? null,\n\n [productContextValue]\n )\n\n const onView = useCallback(() => {\n if (itemId) {\n handleEvents({ type: 'product', event: 'impression', itemId })\n }\n }, [handleEvents, itemId])\n\n useOnView({\n ref: adRef,\n onView,\n once: true,\n initializeOnInteraction: true,\n })\n\n return (\n <small className={handles['product-tag-label']} ref={adRef}>\n patrocinado\n </small>\n )\n}\n\nexport default ProductSponsoredTag\n\n```"
}
] |
code_vtex-ads_a76a8ff2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/PixelEvent/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useCallback, useMemo, useRef } from 'react'\nimport { useProduct } from 'vtex.product-context'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport type { ProductContextValue } from '../../typings/ProductContextValue'\nimport { useOnView } from '../../hooks/useOnView'\nimport { useAds } from '../../hooks/useAds'\n\nconst CSS_HANDLES = ['product-pixel-event'] as const\n\nconst PixelEvent: StorefrontFunctionComponent = () => {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const adRef = useRef<HTMLDivElement | null>(null)\n\n const { handleEvents } = useAds()\n\n const productContextValue = useProduct() as\n | Partial<ProductContextValue>\n | undefined\n\n const itemId = useMemo(\n () => productContextValue?.product?.sku?.itemId ?? null,\n [productContextValue]\n )\n\n const onView = useCallback(() => {\n if (itemId) {\n handleEvents({ type: 'product', event: 'impression', itemId })\n }\n }, [handleEvents, itemId])\n\n useOnView({\n ref: adRef,\n onView,\n once: true,\n initializeOnInteraction: true,\n })\n\n return (\n <span\n className={handles['product-pixel-event']}\n ref={adRef}\n style={{ width: 0, height: 0, zIndex: -1 }}\n />\n )\n}\n\nexport default PixelEvent\n\n```"
}
] |
code_vtex-ads_c48ef499
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Conversion/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useCallback } from 'react'\nimport { canUseDOM } from 'vtex.render-runtime'\n\nimport { useAds } from '../../hooks/useAds'\n\nconst Conversion: React.FC = () => {\n const { handleConversion } = useAds()\n\n const handleEvents = useCallback(\n (event: VtexEvent) => {\n const { data } = event\n\n if (data.eventName === 'vtex:orderPlaced') {\n handleConversion(data)\n }\n },\n [handleConversion]\n )\n\n if (canUseDOM) {\n window.addEventListener('message', handleEvents)\n }\n\n return <></>\n}\n\nexport default Conversion\n\n```"
}
] |
code_vtex-ads_cf5ecb42
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Shelf/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport { useAds } from '../../hooks/useAds'\nimport ProductShelf from '../UI/ProductShelf'\nimport { useProductQuery } from '../../hooks/useProductQuery'\n\nconst CSS_HANDLES = ['shelf-container'] as const\n\nfunction Shelf() {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const { skuProducts } = useAds()\n\n const { offers } = useProductQuery()\n\n return (\n <>\n {!!skuProducts?.length && (\n <section className={handles['shelf-container']}>\n {!!offers && <ProductShelf products={offers} />}\n </section>\n )}\n </>\n )\n}\n\nexport default Shelf\n\n```"
}
] |
code_vtex-ads_ef268fb7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Shelf/types.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype NewtailMediaShelfProps = {\n active?: boolean\n placementName?: string\n placementNameAdmin?: string\n quantity?: number\n quantityAdmin?: string\n categoryName?: string\n categoryNameAdmin?: string\n}\n\ntype NewtailMediaProductsProps = {\n active?: boolean\n placementName?: string\n placementNameAdmin?: string\n quantity?: number\n quantityAdmin?: string\n categoryName?: string\n categoryNameAdmin?: string\n\n handleProducts?: (products: Product[]) => void\n}\n\ninterface OnProductClickData {\n brand: string\n brandId: number\n cacheId: string\n categoryTree: CategoryTree[]\n description: string\n items: Item[]\n link: string\n linkText: string\n priceRange: PriceRange\n productClusters: ProductCluster[]\n productId: string\n productName: string\n productReference: string\n properties: string[]\n specificationGroups: string[]\n __typename: string\n sku: Sku\n}\n\ninterface Sku {\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n sellers: Seller[]\n unitMultiplier: number\n variations: string[]\n __typename: string\n seller: Seller\n referenceId: ReferenceId\n image: Image\n}\n\ninterface ReferenceId {\n Value: string\n}\n\ninterface ProductCluster {\n id: string\n name: string\n __typename: string\n}\n\ninterface PriceRange {\n listPrice: ListPrice\n sellingPrice: ListPrice\n __typename: string\n}\n\ninterface ListPrice {\n highPrice: number\n lowPrice: number\n __typename: string\n}\n\ninterface Item {\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n sellers: Seller[]\n unitMultiplier: number\n variations: string[]\n __typename: string\n}\n\ninterface Seller {\n commertialOffer: CommertialOffer\n sellerId: string\n __typename: string\n}\n\ninterface CommertialOffer {\n AvailableQuantity: number\n Installments: Installment[]\n ListPrice: number\n Price: number\n PriceWithoutDiscount: number\n Tax: number\n discountHighlights: DiscountHighlight[]\n taxPercentage: number\n teasers: string[]\n __typename: string\n}\n\ninterface DiscountHighlight {\n name: string\n __typename: string\n}\n\ninterface Installment {\n InterestRate: number\n Name: string\n NumberOfInstallments: number\n TotalValuePlusInterestRate: number\n Value: number\n __typename: string\n}\n\ninterface Image {\n imageLabel: string\n imageTag: string\n imageUrl: string\n __typename: string\n}\n\ninterface CategoryTree {\n slug: string\n __typename: string\n}\n\n```"
}
] |
code_vtex-ads_4205ae8a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Banner/ItemBanner.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport { useAds } from '../../hooks/useAds'\nimport { useOnView } from '../../hooks/useOnView'\nimport { ImageFixedSize } from '../UI/Image'\n\nconst CSS_HANDLES = ['banner-item', 'banner-image'] as const\n\nconst ItemBanner = ({ data }: { data: BannerAd }) => {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const bannerRef = useRef<HTMLDivElement | null>(null)\n\n const { handleEvents } = useAds()\n\n const adId = useMemo(\n () => data.ad_id || null,\n\n [data]\n )\n\n const handleImpression = useCallback(() => {\n if (adId) {\n handleEvents({ type: 'banner', event: 'impression', adId })\n }\n }, [handleEvents, adId])\n\n const onView = useCallback(() => {\n if (adId) {\n handleEvents({ type: 'banner', event: 'view', adId })\n }\n }, [handleEvents, adId])\n\n const handleClick = useCallback(() => {\n if (adId) {\n handleEvents({ type: 'banner', event: 'click', adId })\n }\n }, [handleEvents, adId])\n\n useOnView({\n ref: bannerRef,\n onView,\n once: true,\n initializeOnInteraction: true,\n })\n\n useEffect(() => {\n handleImpression()\n }, [handleImpression])\n\n return (\n <div\n ref={bannerRef}\n className={`${handles['banner-item']} ${handles['banner-item']}__${data.ad_id}`}\n data-van-aid={data.ad_id}\n >\n {data.destination_url ? (\n <a href={data.destination_url} onClick={handleClick}>\n <ImageFixedSize data={data} handles={handles} prefix=\"banner\" />\n </a>\n ) : (\n <ImageFixedSize data={data} handles={handles} prefix=\"banner\" />\n )}\n </div>\n )\n}\n\nexport default ItemBanner\n\n```"
}
] |
code_vtex-ads_790aaf10
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Banner/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport { useAds } from '../../hooks/useAds'\nimport ItemBanner from './ItemBanner'\n\nconst CSS_HANDLES = ['banner-container'] as const\n\nconst Banner = () => {\n const { handles } = useCssHandles(CSS_HANDLES)\n\n const { banners } = useAds()\n\n return banners?.length ? (\n <section className={handles['banner-container']}>\n {banners.map((banner) => (\n <ItemBanner data={banner} key={banner.ad_id} />\n ))}\n </section>\n ) : (\n <></>\n )\n}\n\nexport default Banner\n\n```"
}
] |
code_vtex-ads_92cd6c8d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/Banner/types.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype NewtailMediaBannerProps = {\n active?: boolean\n\n placementName?: string\n placementNameAdmin?: string\n\n size?: string\n sizeAdmin?: string\n\n sizeMobile?: string\n sizeMobileAdmin?: string\n\n quantity?: number\n quantityAdmin?: string\n\n categoryName?: string\n categoryNameAdmin?: string\n}\n\n```"
}
] |
code_vtex-ads_a577cf82
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/UI/Image/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useEffect, useState } from 'react'\n\ntype ImageFixedSizeProps = {\n data: Partial<{\n media_url: string\n altText?: string\n ad_id: string\n }>\n handles: Record<string, string>\n prefix: string\n fixedMinWidth?: boolean\n}\n\nexport const ImageFixedSize = ({\n prefix,\n data,\n handles,\n fixedMinWidth = false,\n}: ImageFixedSizeProps) => {\n const [imageSize, setImageSize] = useState<{\n width: number | string\n height: number | string\n }>({\n height: 'auto',\n width: 'auto',\n })\n\n useEffect(() => {\n if (!data.media_url) return\n const img = new Image()\n\n img.src = data.media_url\n img.onload = () => {\n setImageSize({ width: img.width, height: img.height })\n }\n }, [data.media_url])\n\n return (\n <>\n <style>\n {`\n .${handles[`${prefix}-item`]}__${data.ad_id} {\n max-width: ${imageSize.width}px;\n min-width: ${fixedMinWidth ? `${imageSize.width}px` : 'auto'};\n margin: 0 auto;\n }\n .${handles[`${prefix}-image`]}.vtex-ads-banner__${data.ad_id} {\n width: 100vw;\n max-width: 100%;\n height: auto;\n max-height: ${imageSize.height}px;\n margin: auto;\n }\n `}\n </style>\n\n <img\n src={data.media_url}\n alt={data.altText ?? 'Banner'}\n className={`${handles[`${prefix}-image`]} vtex-ads-component-banner__${\n data.ad_id\n }`}\n width={imageSize.width}\n height={imageSize.height}\n />\n </>\n )\n}\n\n```"
}
] |
code_vtex-ads_55cbaaf6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/UI/ProductShelf/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { ExtensionPoint } from 'vtex.render-runtime'\n\nimport { useAds } from '../../../hooks/useAds'\nimport { handleAvailableItems } from '../../../helpers/availableitems'\n\ninterface Props {\n products: Product[]\n}\n\nconst ProductShelf = ({ products }: Props) => {\n const { handleProductClickOnShelf } = useAds()\n\n const productAds = handleAvailableItems(products)\n\n return (\n <>\n {!!productAds?.length && (\n <>\n <ExtensionPoint id=\"rich-text\" />\n\n <ExtensionPoint\n id=\"list-context.product-list-static\"\n products={productAds}\n hideUnavailableItems\n actionOnProductClick={(data: OnProductClickData) =>\n handleProductClickOnShelf(data)\n }\n />\n </>\n )}\n </>\n )\n}\n\nexport default ProductShelf\n\n```"
}
] |
code_vtex-ads_6f85c999
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/SponsoredBrands/styles/templates.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const templateStyles = {\n rounded: {\n contentContainer: 'pa2 pa4-ns ba br3 b--silver',\n },\n}\n\n```"
}
] |
code_vtex-ads_162632fc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/components/SponsoredBrands/styles/handles.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const CSS_HANDLES = [\n 'sponsored-brands-container',\n 'sponsored-brands-header',\n 'sponsored-brands-header-container',\n 'sponsored-brands-header-content',\n 'sponsored-brands-header-headline',\n 'sponsored-brands-header-description',\n 'sponsored-brands-header-button',\n 'sponsored-brands-content',\n 'sponsored-brands-label-container',\n 'sponsored-brands-label-text',\n 'sponsored-brands-logo-container',\n 'sponsored-brands-logo',\n 'sponsored-brands-banner-container',\n 'sponsored-brands-products-container',\n 'sponsored-brands-banner-image',\n 'sponsored-brands-banner-item',\n] as const\n\n```"
}
] |
code_vtex-ads_2426070b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useProductQuery/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useLazyQuery } from 'react-apollo'\nimport { useEffect, useMemo } from 'react'\n\nimport productsByIdentifier from '../../queries/productsByIdentifier.gql'\nimport { useAds } from '../useAds'\n\nconst getAdId = ({\n productAds,\n product,\n}: {\n productAds: ProductAd[] | null\n product: Record<string, any>\n}) =>\n productAds?.find((item) => item.product_sku === product?.items?.[0]?.itemId)\n ?.ad_id ?? null\n\nconst useProductQuery = () => {\n const { skuProducts, products } = useAds()\n\n const [\n queryBaseProductsByID,\n {\n data: baseProductsData,\n loading: loadingBaseProducts,\n called: queryBaseProductsCalled,\n refetch: baseProductsRefetch,\n },\n ] = useLazyQuery(productsByIdentifier, { notifyOnNetworkStatusChange: true })\n\n useEffect(() => {\n if (!!skuProducts && skuProducts.length === 0) {\n return\n }\n\n const executeQuery = (variables: Record<string, any>) =>\n queryBaseProductsCalled\n ? baseProductsRefetch(variables)\n : queryBaseProductsByID({ variables })\n\n if (skuProducts) {\n executeQuery({\n field: 'sku',\n values: skuProducts,\n })\n }\n }, [\n queryBaseProductsCalled,\n queryBaseProductsByID,\n baseProductsRefetch,\n skuProducts,\n ])\n\n const productsByIdentifierWithAds = useMemo(() => {\n if (loadingBaseProducts) return null\n\n return baseProductsData?.productsByIdentifier?.map(\n (product: Record<string, any>) => ({\n ...product,\n advertisement: {\n adId: getAdId({ productAds: products, product }),\n campaignId: null,\n adRequestId: null,\n adResponseId: null,\n actionCost: null,\n },\n })\n )\n }, [loadingBaseProducts, baseProductsData?.productsByIdentifier, products])\n\n return { offers: productsByIdentifierWithAds }\n}\n\nexport { useProductQuery }\n\n```"
}
] |
code_vtex-ads_07f78bb9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useAds/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-console */\nimport React, {\n useEffect,\n createContext,\n useCallback,\n useState,\n useContext,\n useMemo,\n} from 'react'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport { getNewtailMedia, postNewtailMediaConversionURL } from '../../services'\nimport { getUserIdByEmail } from '../../helpers/getUserId'\nimport { useAdsEvents } from '../useAdEvents'\nimport { getSkusEventData } from '../useNewtailMediaSearch/utils'\nimport { useRequestBody } from '../useNewtailMediaSearch/formatRequestBody'\nimport { useSessionData } from '../useSessionData'\nimport { debugTemplates } from '../../utils/debug'\nimport { hashEmail } from '../../utils/hash'\n\nconst NewtailMediaContext = createContext<NewtailMediaContextData | null>(\n {} as NewtailMediaContextData\n)\n\ntype VTEXAdsProviderType = {\n adType: AdTypes | 'conversion'\n} & NewtailMediaBannerProps\n\nconst VTEXAdsProvider: React.FC<VTEXAdsProviderType> = ({\n adType,\n children,\n placementName,\n placementNameAdmin,\n size,\n sizeAdmin,\n sizeMobile,\n sizeMobileAdmin,\n quantity,\n quantityAdmin,\n categoryName: categoryNameProps,\n categoryNameAdmin,\n}) => {\n const { query: queryRaw } = useRuntime()\n\n const debug = useMemo(() => queryRaw?.debug ?? null, [queryRaw])\n\n const publisherId = window?.newtailMedia?.publisherId\n\n const placement =\n placementNameAdmin || placementName || `placement_${adType}_default`\n\n const mediaSize = sizeAdmin || size\n const mobileMediaSize = sizeMobileAdmin || sizeMobile\n const categoryName = categoryNameAdmin || categoryNameProps\n\n const defaultQuantity = adType === 'banner' ? 1 : 20\n const quantityAds = Number(quantityAdmin) || quantity || defaultQuantity\n\n const [loading, setLoading] = useState(true)\n\n const [products, setProducts] = useState<ProductAd[] | null>(null)\n const [productsSB, setProductsSB] = useState<\n SponsoredBrandAdProduct[] | null\n >(null)\n\n const [skuProducts, setSkuProducts] = useState<string[] | null>(null)\n const [banners, setBanners] = useState<BannerAd[] | null>(null)\n const [assetsSB, setAssetsSB] = useState<SponsoredBrandAd | null>(null)\n\n /**\n * Handle session and user id\n */\n const { sessionId, userId } = useSessionData()\n\n /**\n * Handle request payload\n */\n\n const requestBody = useRequestBody({\n placement,\n adType: adType as AdTypes,\n mediaSize,\n mobileMediaSize,\n quantityAds,\n categoryName,\n })\n\n const handleResponse = useCallback(\n (data: AdsResponse) => {\n const response = data?.[placement]\n\n if (!response) return\n\n if (adType === 'product') {\n const adsData = response as ProductAd[]\n\n setProducts(adsData)\n setSkuProducts(adsData.map((item) => item.product_sku) || null)\n }\n\n if (adType === 'banner') {\n const adsData = response as BannerAd[]\n\n setBanners(adsData)\n }\n\n if (adType === 'sponsored_brand') {\n const [adData] = response as SponsoredBrandAd[]\n const productsData = adData?.products\n // max products === quantityAds\n const sliceProducts = productsData?.slice(0, quantityAds) || []\n\n setProductsSB(productsData)\n setSkuProducts(sliceProducts.map((item) => item.product_sku) || null)\n setAssetsSB(adData || null)\n }\n },\n [adType, placement, quantityAds]\n )\n\n const handleRequestAds = useCallback(async () => {\n if (!sessionId || adType === 'conversion') return\n\n try {\n setLoading(true)\n\n if (!requestBody) return\n\n const body = {\n publisherId,\n body: requestBody,\n }\n\n if (debug === 'vtexads') {\n console.log(\n `%c 🚀 VTEXAdsProvider :: Request :: ${placement}`,\n debugTemplates.primary,\n body\n )\n }\n\n const { data } = await getNewtailMedia(body)\n\n if (debug === 'vtexads') {\n console.log(\n `%c 🚀 VTEXAdsProvider :: Response :: ${placement}`,\n debugTemplates.primary,\n data\n )\n }\n\n handleResponse(data)\n } catch (error) {\n console.log(error)\n } finally {\n setLoading(false)\n }\n }, [\n adType,\n debug,\n handleResponse,\n placement,\n publisherId,\n requestBody,\n sessionId,\n ])\n\n useEffect(() => {\n if (adType !== 'conversion') {\n handleRequestAds()\n }\n }, [handleRequestAds, adType])\n\n /**\n * Handle events\n * @function handleEvents()\n */\n\n const fireEvent = useCallback(\n ({ url }) => {\n const body = {\n session_id: sessionId,\n } as {\n session_id: string\n user_id: string\n }\n\n if (userId) {\n body.user_id = userId\n }\n\n navigator.sendBeacon(url, new URLSearchParams(body))\n },\n [sessionId, userId]\n )\n\n /**\n * Handle banner events\n * @function handleBannerClick()\n * @function handleBannrImpression()\n * @function handleBannerView()\n */\n\n const handleEvents = useCallback(\n ({ type, event, adId, itemId }: HandleEvents) => {\n // console.log('handleEvents', type, event, adId, itemId)\n\n let adData = null\n let url = null\n const eventKey = `${event}_url` as keyof EventsUrl\n\n if (type === 'banner') {\n adData = banners?.find((item) => item.ad_id === adId)\n }\n\n if (type === 'sponsored_brand') {\n adData = assetsSB\n }\n\n if (type === 'product' && adType === 'product') {\n adData = products?.find((item) => item.product_sku === itemId)\n }\n\n // Tratamento extra por estar usando o mesmo componente de produto para SB\n if (type === 'product' && adType === 'sponsored_brand') {\n adData = assetsSB?.products?.find((item) => item.product_sku === itemId)\n }\n\n url = adData?.[eventKey]\n\n !!url && fireEvent({ url })\n },\n [adType, assetsSB, banners, fireEvent, products]\n )\n\n /**\n * Handle product events\n */\n\n const { handleAdsEvents } = useAdsEvents()\n\n const handleProductClickOnShelf = useCallback(\n (data: OnProductClickData) => {\n const eventName = 'vtex:productClickOnShelf'\n\n const skusEventData = getSkusEventData?.[eventName]?.(data)\n\n const productsData = adType === 'product' ? products : productsSB\n\n let adsData: ProductAd[] | SponsoredBrandAdProduct[] | undefined\n\n if (adType === 'product') {\n adsData = (productsData as ProductAd[] | undefined)?.filter((ad) =>\n skusEventData.includes(ad.product_sku)\n )\n }\n\n if (adType === 'sponsored_brand') {\n adsData = (\n productsData as SponsoredBrandAdProduct[] | undefined\n )?.filter((ad) => skusEventData.includes(ad.product_sku))\n }\n\n handleAdsEvents({ ads: adsData, event: eventName })\n },\n [adType, handleAdsEvents, products, productsSB]\n )\n\n /**\n * Handle conversion\n */\n\n const handleConversion = useCallback(\n async (data: Order) => {\n if (!sessionId) {\n return\n }\n\n let verifiedUserId: string | null = userId\n\n const [email] = data.visitorContactInfo\n\n if (!userId) {\n await getUserIdByEmail(email)\n .then((responseUserId) => {\n verifiedUserId = responseUserId\n })\n .catch((error) => {\n console.error('Error:', error)\n })\n }\n\n const formatItens = (listProducts: ProductOrder[]) =>\n listProducts.map((item) => ({\n sku: item.sku,\n quantity: item.quantity,\n price: item.price,\n promotional_price: item.sellingPrice,\n })) as ConversionItem[]\n\n const emailHashed = await hashEmail(email)\n\n const body = {\n publisher_id: publisherId,\n user_id: verifiedUserId ?? emailHashed,\n email_hashed: emailHashed,\n session_id: sessionId,\n order_id: data.ordersInOrderGroup?.[0] || data.orderGroup,\n items: formatItens(data.transactionProducts),\n created_at: data.transactionDate,\n channel: 'ecommerce',\n } as ConversionBody\n\n const jsonData = JSON.stringify(body)\n const blobData = new Blob([jsonData], { type: 'application/json' })\n\n navigator.sendBeacon(postNewtailMediaConversionURL, blobData)\n },\n [publisherId, sessionId, userId]\n )\n\n return (\n <NewtailMediaContext.Provider\n value={{\n loading,\n products,\n productsSB,\n skuProducts,\n assetsSB,\n banners,\n placement,\n handleEvents,\n handleProductClickOnShelf,\n handleConversion,\n }}\n >\n {children}\n </NewtailMediaContext.Provider>\n )\n}\n\nfunction useAds(): NewtailMediaContextData {\n const context = useContext(NewtailMediaContext)\n\n if (!context) {\n throw new Error('useAds must be used within an VTEXAdsProvider')\n }\n\n return context\n}\n\nexport { NewtailMediaContext, VTEXAdsProvider, useAds }\n\n```"
}
] |
code_vtex-ads_926422a3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useSearchPageContext/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useMemo } from 'react'\nimport { useSearchPage } from 'vtex.search-page-context/SearchPageContext'\n\nexport const useSearchPageContext = () => {\n const responseUseSearchPage = useSearchPage()\n\n const { searchQuery } = responseUseSearchPage\n\n const products: ContextProduct[] = useMemo(\n () => searchQuery?.data?.productSearch?.products,\n [searchQuery?.data?.productSearch?.products]\n )\n\n return { products }\n}\n\n```"
}
] |
code_vtex-ads_ad78ea90
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useSearchPageContext/types.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// Context\n\ntype ContextProduct = {\n cacheId: string\n productId: string\n description: string\n productName: string\n productReference: string\n linkText: string\n brand: string\n brandId: number\n link: string\n categories: string[]\n categoryId: string\n releaseDate: string\n priceRange: PriceRange\n specificationGroups: SpecificationGroup[]\n skuSpecifications: any[]\n productClusters: any[]\n clusterHighlights: any[]\n properties: Property[]\n __typename: string\n advertisement: null\n items: Item[]\n selectedProperties: null\n rule: null\n}\n\ninterface Item {\n itemId: string\n name: string\n nameComplete: string\n complementName: string\n ean: string\n variations: any[]\n referenceId: ReferenceId[]\n measurementUnit: string\n unitMultiplier: number\n images: Image[]\n __typename: string\n sellers: Seller[]\n}\n\ninterface Seller {\n sellerId: string\n sellerName: string\n sellerDefault: boolean\n __typename: string\n commertialOffer: CommertialOffer\n}\n\ninterface CommertialOffer {\n discountHighlights: any[]\n teasers: any[]\n Price: number\n ListPrice: number\n Tax: number\n taxPercentage: number\n spotPrice: number\n PriceWithoutDiscount: number\n RewardValue: number\n PriceValidUntil: string\n AvailableQuantity: number\n __typename: string\n Installments: any[]\n}\n\ninterface Image {\n cacheId: string\n imageId: string\n imageLabel: string\n imageTag: string\n imageUrl: string\n imageText: string\n __typename: string\n}\n\ninterface ReferenceId {\n Key: string\n Value: string\n __typename: string\n}\n\ninterface Property {\n name: string\n values: string[]\n __typename: string\n}\n\ninterface SpecificationGroup {\n name: string\n originalName: string\n specifications: Specification[]\n __typename: string\n}\n\ninterface Specification {\n name: string\n originalName: string\n values: string[]\n __typename: string\n}\n\ninterface PriceRange {\n sellingPrice: SellingPrice\n listPrice: SellingPrice\n __typename: string\n}\n\ninterface SellingPrice {\n highPrice: number\n lowPrice: number\n __typename: string\n}\n\n```"
}
] |
code_vtex-ads_952547ce
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useAdEvents/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useCallback } from 'react'\n\nimport { useSessionData } from '../useSessionData'\n\ntype UseAdEvents = () => {\n handleAdsEvents: (props: HandleAdEvents) => void\n}\n\ntype HandleAdEvents = {\n event: ValidVtexEvent\n ads?: SponsoredBrandAdProduct[] | ProductAd[] | BannerAd[] | null | undefined\n}\n\ntype FireEventBody =\n | {\n session_id: string\n } & {\n user_id: string\n }\n\nexport const useAdsEvents: UseAdEvents = () => {\n const { sessionId, userId } = useSessionData()\n\n const sendEvent = useCallback(\n (finalUrl: string) => {\n const body: FireEventBody = {\n session_id: sessionId as string,\n } as FireEventBody\n\n if (userId) {\n body.user_id = userId as string\n }\n\n navigator.sendBeacon(finalUrl, new URLSearchParams(body))\n },\n [sessionId, userId]\n )\n\n const fireEvent = useCallback(\n ({ url }) => {\n if (!sessionId) {\n let retries = 0\n const maxRetries = 5\n const interval = setInterval(() => {\n if (sessionId) {\n clearInterval(interval)\n sendEvent(url)\n }\n\n retries++\n if (retries >= maxRetries) {\n clearInterval(interval)\n }\n }, 1000)\n\n return\n }\n\n sendEvent(url)\n },\n [sendEvent, sessionId]\n )\n\n const handleAdsEvents = useCallback(\n ({ ads, event }: HandleAdEvents) => {\n const eventsKeys = {\n 'vtex:productImpression': 'impression',\n 'vtex:productView': 'view',\n 'vtex:productClick': 'click',\n 'vtex:productClickOnShelf': 'click',\n }\n\n const eventKey = eventsKeys[event]\n\n ads?.forEach((ad: ProductAd | BannerAd | SponsoredBrandAdProduct) => {\n let url = null\n const eventKeyUrl = `${eventKey}_url` as keyof EventsUrl\n\n url = ad?.[eventKeyUrl]\n\n !!url && fireEvent({ url })\n })\n },\n [fireEvent]\n )\n\n return { handleAdsEvents }\n}\n\n```"
}
] |
code_vtex-ads_9eeb04e3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useNewtailMediaSearch/index.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-console */\nimport React, {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react'\nimport { useIntl } from 'react-intl'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport { getNewtailMedia } from '../../services'\nimport { useSearchPageContext } from '../useSearchPageContext'\nimport { extractSKUs } from './extractSKUs'\nimport { useRequestBody } from './formatRequestBody'\nimport { useAdsEvents } from '../useAdEvents'\nimport { handleQuantityAds, eventIsValid, getSkusEventData } from './utils'\n// Default settings\nimport * as D from '../../settings'\n\nconst NewtailMediaSearchContext =\n createContext<NewtailMediaSearchContextData | null>(\n {} as NewtailMediaSearchContextData\n )\n\nconst NewtailMediaSearchProvider: React.FC<NewtailMediaSearchProviderProps> = ({\n children,\n onlyFirstSKU = false,\n onlyFirstSKUAdmin = false,\n parentSearchSelector,\n parentSearchSelectorAdmin,\n placementName,\n placementNameAdmin,\n tagClassname,\n tagClassnameAdmin,\n tagPositionAdmin,\n tagPosition,\n tagText,\n tagTextAdmin,\n quantity,\n quantityAdmin,\n // Sponsored Skus at the beginning\n // do not use if using infinite scrolling\n sponsoredSkusAtTop = true,\n}) => {\n const { query: queryRaw } = useRuntime()\n\n const debug = useMemo(() => queryRaw?.debug ?? null, [queryRaw])\n\n /**\n * Handle settings\n */\n\n const i18n = useIntl()\n\n const quantityAds = handleQuantityAds({\n quantityAdmin,\n quantity,\n defaultValue: 20,\n })\n\n const publisherId = window?.newtailMedia?.publisherId\n const placement =\n placementNameAdmin || placementName || `placement_search_default`\n\n const parentSelector =\n parentSearchSelectorAdmin || parentSearchSelector || D.searchSelectorDefault\n\n const HTMLElementTag = 'small'\n const tagPositionElement: TagPosition =\n tagPositionAdmin || tagPosition || 'start'\n\n const onlyFirstSKUInner = onlyFirstSKUAdmin || onlyFirstSKU || false\n\n const classNameTag =\n tagClassnameAdmin || tagClassname || D.tagClassnameDefault\n\n const labelTag =\n tagTextAdmin ||\n tagText ||\n i18n.formatMessage({\n id: 'admin/vtex-vtex-ads.search.tagText.default',\n defaultMessage: 'Patrocinado',\n })\n\n // Handle states hook\n\n const [productAds, setProductAds] = useState<ProductAd[] | null>(null)\n const [skusProductAds, setSkusProductAds] = useState<string[] | null>(null)\n\n /**\n * Get search result\n */\n\n const { products } = useSearchPageContext()\n\n const skus = useMemo(\n () => extractSKUs({ products, onlyFirstSKU: onlyFirstSKUInner }),\n [onlyFirstSKUInner, products]\n )\n\n /**\n * Handle request ads\n */\n\n const requestBody = useRequestBody({\n skus,\n placement,\n quantityAds,\n forceSearchContext: true,\n })\n\n const handleRequestAds = useCallback(async () => {\n if (!requestBody) return\n\n try {\n const body = {\n publisherId,\n body: requestBody,\n }\n\n if (debug === 'vtexads') {\n console.log(\n `%c 🚧 🚧 🚧 🚀 NewtailMediaSearchProvider :: Request :: ${placement}`,\n 'color:white;background:#E31C58;',\n body\n )\n }\n\n const { data } = await getNewtailMedia(body)\n\n if (debug === 'vtexads') {\n console.log(\n `%c 🚧 🚧 🚧 🚀 NewtailMediaSearchProvider :: Response :: ${placement}`,\n 'color:white;background:#E31C58;',\n data\n )\n }\n\n const response = data?.[placement] as ProductAd[]\n\n if (!response) return\n\n const responseSkus = response?.map((item) => item.product_sku) || null\n\n setProductAds(response)\n setSkusProductAds(responseSkus)\n } catch (error) {\n console.error(error)\n }\n }, [debug, placement, publisherId, requestBody])\n\n useEffect(() => {\n if (products?.length && requestBody) {\n handleRequestAds()\n }\n }, [handleRequestAds, products, requestBody])\n\n /**\n * Handle sponsored SKUs\n */\n const sponsoredSkus = useMemo(\n () =>\n skusProductAds\n ? skus.filter((sku) => skusProductAds.includes(sku))\n : null,\n [skus, skusProductAds]\n )\n\n /**\n * Handle sponsored tags\n */\n const handleSponsoredTag = useCallback(() => {\n const container = document.querySelector(parentSelector)\n\n if (!skusProductAds || !container || !sponsoredSkus?.length) return\n\n sponsoredSkus.forEach((item) => {\n const searchResultItem = products.find((product) =>\n product.items.some((productItem) => productItem.itemId === item)\n )\n\n if (!searchResultItem) return\n\n const getItemElements = () => {\n const byLink = container.querySelectorAll(\n `a[href*='${searchResultItem.link}']`\n )\n\n if (byLink.length) {\n return byLink\n }\n\n const byLinkText = container.querySelectorAll(\n `a[href*='${searchResultItem.linkText}']`\n )\n\n return byLinkText\n }\n\n const itemElements = getItemElements()\n\n itemElements.forEach((element: Element) => {\n if (sponsoredSkusAtTop) {\n // handle product summary container\n // div.vtex-search-result-3-x-galleryItem > section.vtex-product-summary-2-x-container\n const sectionParent = element?.parentElement\n\n const containerParent = sectionParent?.parentElement\n\n if (containerParent) {\n containerParent.classList.add(`sponsored-product-container`)\n containerParent.style.order = '-1'\n }\n }\n\n if (element.querySelector(`.${classNameTag}`)) {\n return\n }\n\n const sponsoredTag = document.createElement(HTMLElementTag)\n\n sponsoredTag.textContent = labelTag\n sponsoredTag.className = classNameTag\n\n const insertActions: TagPositionAction = {\n start: () => element.prepend(sponsoredTag),\n end: () => element.appendChild(sponsoredTag),\n // custom: () => customHandle()\n }\n\n insertActions?.[tagPositionElement]?.()\n })\n })\n }, [\n parentSelector,\n skusProductAds,\n sponsoredSkus,\n products,\n sponsoredSkusAtTop,\n classNameTag,\n labelTag,\n tagPositionElement,\n ])\n\n useEffect(() => {\n handleSponsoredTag()\n }, [handleSponsoredTag])\n\n /**\n * Handle events\n */\n\n const { handleAdsEvents } = useAdsEvents()\n\n const handleEvents = useCallback(\n (e: PixelMessage) => {\n const eventName = e?.data?.eventName as ValidVtexEvent\n\n if (!eventName || !eventIsValid(eventName)) return\n\n const eventData: EventData = e.data\n\n const skusEventData = getSkusEventData?.[eventName]?.(eventData as any)\n\n const adsData = productAds?.filter((ad) =>\n skusEventData.includes(ad.product_sku)\n )\n\n handleAdsEvents({ ads: adsData, event: eventName })\n },\n [handleAdsEvents, productAds]\n )\n\n return (\n <NewtailMediaSearchContext.Provider\n value={{\n handleEvents,\n }}\n >\n {children}\n </NewtailMediaSearchContext.Provider>\n )\n}\n\nfunction useAdsSearch(): NewtailMediaSearchContextData {\n const context = useContext(NewtailMediaSearchContext)\n\n if (!context) {\n throw new Error(\n 'useAdsSearch must be used within an NewtailMediaSearchProvider'\n )\n }\n\n return context\n}\n\nexport { NewtailMediaSearchContext, NewtailMediaSearchProvider, useAdsSearch }\n\n```"
}
] |
code_vtex-ads_2ec3b7c7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useNewtailMediaSearch/types.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype NewtailMediaSearchContextData = {\n handleEvents: (e: PixelMessage) => void\n}\n\ntype NewtailMediaSearchProviderProps = React.PropsWithChildren<\n {\n publisherId?: string\n sponsoredSkusAtTop?: boolean\n } & NewtailMediaSearchProps\n>\n\ntype ValidVtexEvent =\n | 'vtex:productImpression'\n | 'vtex:productView'\n | 'vtex:productClick'\n | 'vtex:productClickOnShelf'\n\ntype GetSkusEventData = {\n 'vtex:productImpression': (eventData: ProductImpressionData) => string[]\n 'vtex:productView': (eventData: ProductViewData) => string[]\n 'vtex:productClick': (eventData: ProductClickData) => string[]\n 'vtex:productClickOnShelf': (eventData: OnProductClickData) => string[]\n}\n\ntype EventData = ProductImpressionData | ProductClickData | ProductViewData\n\ntype TagPosition = 'start' | 'end'\n\ntype TagPositionAction = {\n [key in TagPosition]: () => void\n}\n\n```"
}
] |
code_vtex-ads_dfda435d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useNewtailMediaSearch/utils.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nconst extractSkusFromItems = (data: Item[] | ItemSummary[]) =>\n data.map((item: Item | ItemSummary) => item.itemId)\n\nconst extractSkus = {\n impressions: (data: ProductImpressionData) => {\n const products = data.impressions.map((impression) => ({\n ...impression.product,\n }))\n\n const items = products.reduce(\n (acc, product) => [...acc, ...product.items],\n [] as ItemSummary[]\n )\n\n return extractSkusFromItems(items)\n },\n clicks: (data: ProductClickData) => extractSkusFromItems(data.product.items),\n clicksOnShelf: (data: OnProductClickData) => extractSkusFromItems(data.items),\n views: (data: ProductViewData) => extractSkusFromItems(data.product.items),\n}\n\nexport const getSkusEventData: GetSkusEventData = {\n 'vtex:productImpression': (data) => extractSkus.impressions(data),\n 'vtex:productView': (data) => extractSkus.views(data),\n 'vtex:productClick': (data) => extractSkus.clicks(data),\n 'vtex:productClickOnShelf': (data) => extractSkus.clicksOnShelf(data),\n}\n\nconst validEvents: ValidVtexEvent[] = Object.keys(\n getSkusEventData\n) as ValidVtexEvent[]\n\nexport const eventIsValid = (eventName: ValidVtexEvent | string) =>\n validEvents.includes(eventName as ValidVtexEvent)\n\n/**\n * Handle quantity ads\n */\nexport const handleQuantityAds = ({\n quantity,\n quantityAdmin,\n defaultValue,\n}: {\n quantity?: string | number\n quantityAdmin?: string | number\n defaultValue: number\n}) => {\n const validQuantity = (value?: string | number) =>\n !Number.isNaN(Number(value)) && Number(value) > 0\n\n const validQuantityAdmin = (value?: string | number) =>\n !Number.isNaN(Number(value)) && Number(value) > 0\n\n if (validQuantityAdmin(quantityAdmin)) return Number(quantityAdmin)\n\n if (validQuantity(quantity)) return Number(quantity)\n\n return defaultValue\n}\n\n```"
}
] |
code_vtex-ads_010e794e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useNewtailMediaSearch/formatRequestBody.tsx from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useMemo } from 'react'\n\nimport { useDeviceType } from '../useDeviceType'\nimport { useSessionData } from '../useSessionData'\nimport { usePageContext } from '../usePageContext'\n\ntype FormatRequestBodyProps = {\n skus?: string[]\n placement: string\n mediaSize?: string\n mobileMediaSize?: string\n categoryName?: string\n quantityAds?: number\n adType?: AdTypes\n forceSearchContext?: boolean\n}\n\ntype FormatRequestBody = (props: FormatRequestBodyProps) => null | RequestBody\n\ntype ContextData = {\n category: CategoryContextData\n brand_page: BrandPageContextData\n search: SearchContextData\n home: HomeContextData\n product_page: ProductPageContextData\n}\n\nconst adTypesKeys = {\n product: 'product',\n banner: 'banner',\n sponsored_brand: 'sponsored_brand',\n} as { [key in AdTypes]: AdTypes }\n\nexport const useRequestBody: FormatRequestBody = ({\n skus,\n placement = 'search',\n quantityAds = 20,\n mediaSize,\n mobileMediaSize,\n adType = 'product',\n forceSearchContext = false,\n categoryName: categoryNameOverride,\n}) => {\n const { sessionId, userId } = useSessionData()\n const { context, term, brandName, categoryName, productSKU } =\n usePageContext()\n\n const brandCode = window?.newtailMedia?.brandCode\n\n const device = useDeviceType()\n\n const mediaSizeByDevice =\n device === 'mobile' && mobileMediaSize ? mobileMediaSize : mediaSize\n\n const contextData: ContextData = useMemo(\n () => ({\n category: {\n context: 'category',\n category_name: categoryName || '',\n },\n brand_page: {\n context: 'brand_page',\n brand_name: brandName || '',\n },\n search: {\n context: 'search',\n term,\n skus,\n },\n home: {\n context: 'home',\n },\n product_page: {\n context: 'product_page',\n product_sku: productSKU,\n },\n }),\n [brandName, categoryName, productSKU, skus, term]\n )\n\n const contextDataFinal = useMemo(() => {\n if (forceSearchContext) {\n return { ...contextData?.[context], skus }\n }\n\n if (categoryNameOverride) {\n return {\n context: contextData?.[context].context,\n category_name: categoryNameOverride,\n }\n }\n\n return contextData?.[context]\n }, [categoryNameOverride, context, contextData, forceSearchContext, skus])\n\n const placementData = useMemo(\n () => ({\n [adTypesKeys.banner]: {\n size: mediaSizeByDevice,\n quantity: quantityAds,\n types: [adTypesKeys.banner],\n },\n [adTypesKeys.product]: {\n quantity: quantityAds,\n types: [adTypesKeys.product],\n },\n [adTypesKeys.sponsored_brand]: {\n size: mediaSizeByDevice,\n quantity: 1,\n types: [adTypesKeys.sponsored_brand],\n },\n }),\n [mediaSizeByDevice, quantityAds]\n )\n\n const body = useMemo(\n () =>\n !sessionId\n ? null\n : ({\n device,\n term,\n user_id: userId,\n session_id: sessionId,\n placements: {\n [placement]: placementData[adType],\n },\n ...contextDataFinal,\n } as RequestBody),\n [\n adType,\n contextDataFinal,\n device,\n placement,\n placementData,\n sessionId,\n term,\n userId,\n ]\n )\n\n if (body?.term === null) {\n delete body.term\n }\n\n if (body && !!brandCode?.length) {\n body.brand = brandCode\n }\n\n return body\n}\n\n```"
}
] |
code_vtex-ads_a26a2e01
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useNewtailMediaSearch/extractSKUs.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype HandleProductsProps = {\n products: ContextProduct[]\n onlyFirstSKU?: boolean\n}\n\ntype HandleProducts = (props: HandleProductsProps) => string[]\n\nexport const extractSKUs: HandleProducts = ({\n products,\n onlyFirstSKU = false,\n}) => {\n if (!products?.length) return []\n\n const filteredSKUs = products.reduce((acc, item) => {\n const itemIds = onlyFirstSKU\n ? [item.items[0].itemId]\n : item.items.map((product) => product.itemId)\n\n return [...acc, ...itemIds]\n }, [] as string[])\n\n return filteredSKUs\n}\n\n```"
}
] |
code_vtex-ads_54e9d3e0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useAds/types/context.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype PlacementName = string\n\ntype NewtailMediaContextData = {\n loading: boolean\n placement: PlacementName\n skuProducts: string[] | null\n products: ProductAd[] | null\n productsSB: SponsoredBrandAdProduct[] | null\n assetsSB: SponsoredBrandAd | null\n banners: BannerAd[] | null\n handleConversion(data: Order): void\n handleEvents(data: HandleEvents): void\n handleProductClickOnShelf: (data: OnProductClickData) => void\n}\n\n```"
}
] |
code_vtex-ads_c6f7e1e1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useAds/types/functions.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ntype ExtendEventType =\n | {\n type: 'product'\n itemId: string\n }\n | {\n type: 'banner'\n adId: string\n }\n | {\n type: 'sponsored_brand'\n adId?: string\n }\n\ntype HandleEvents = {\n type: AdTypes\n event: 'view' | 'impression' | 'click'\n itemId?: string\n adId?: string\n ad?: ProductAd | BannerAd | SponsoredBrandAd | null | undefined\n} & ExtendEventType\n\n```"
}
] |
code_vtex-ads_4798f5d0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useAdEvents/types/impression.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface ProductImpressionEvent {\n currency: string\n eventName: 'vtex:productImpression'\n event: 'productImpression'\n list: string\n impressions: Impression[]\n}\n\ninterface Impression {\n product: Product\n position: number\n}\n\ninterface Product {\n cacheId: string\n productId: string\n description: string\n productName: string\n productReference: string\n linkText: string\n brand: string\n brandId: number\n link: string\n categories: string[]\n categoryId: string\n releaseDate: string\n priceRange: PriceRange\n specificationGroups: SpecificationGroup[]\n skuSpecifications: any[]\n productClusters: any[]\n clusterHighlights: any[]\n properties: Property[]\n __typename: string\n advertisement: null\n items: Item[]\n selectedProperties: null\n rule: null\n sku: Sku\n}\n\ninterface Sku {\n itemId: string\n name: string\n nameComplete: string\n complementName: string\n ean: string\n variations: any[]\n referenceId: ReferenceId2\n measurementUnit: string\n unitMultiplier: number\n images: Image[]\n __typename: string\n sellers: Seller[]\n seller: Seller\n image: Image\n}\n\ninterface ReferenceId2 {\n Key: string\n Value: null | string\n __typename: string\n}\n\ninterface Item {\n itemId: string\n name: string\n nameComplete: string\n complementName: string\n ean: string\n variations: any[]\n referenceId: ReferenceId[]\n measurementUnit: string\n unitMultiplier: number\n images: Image[]\n __typename: string\n sellers: Seller[]\n}\n\ninterface Seller {\n sellerId: string\n sellerName: string\n sellerDefault: boolean\n __typename: string\n commertialOffer: CommertialOffer\n}\n\ninterface CommertialOffer {\n discountHighlights: any[]\n teasers: any[]\n Price: number\n ListPrice: number\n Tax: number\n taxPercentage: number\n spotPrice: number\n PriceWithoutDiscount: number\n RewardValue: number\n PriceValidUntil: string\n AvailableQuantity: number\n __typename: string\n Installments: any[]\n}\n\ninterface Image {\n cacheId: string\n imageId: string\n imageLabel: string\n imageTag: string\n imageUrl: string\n imageText: string\n __typename: string\n}\n\ninterface ReferenceId {\n Key: string\n Value: null | null | string | string\n __typename: string\n}\n\ninterface Property {\n name: string\n values: string[]\n __typename: string\n}\n\ninterface SpecificationGroup {\n name: string\n originalName: string\n specifications: Specification[]\n __typename: string\n}\n\ninterface Specification {\n name: string\n originalName: string\n values: string[]\n __typename: string\n}\n\ninterface PriceRange {\n sellingPrice: SellingPrice\n listPrice: SellingPrice\n __typename: string\n}\n\ninterface SellingPrice {\n highPrice: number\n lowPrice: number\n __typename: string\n}\n\n```"
}
] |
code_vtex-ads_98250668
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useAdEvents/types/click.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface ProductClickEvent {\n currency: string\n eventName: 'vtex:productClick'\n event: 'productClick'\n product: Product\n query: string\n map: string\n position: number\n list: string\n}\n\ninterface Product {\n cacheId: string\n productId: string\n description: string\n productName: string\n productReference: string\n linkText: string\n brand: string\n brandId: number\n link: string\n categories: string[]\n categoryId: string\n releaseDate: string\n priceRange: PriceRange\n specificationGroups: SpecificationGroup[]\n skuSpecifications: any[]\n productClusters: any[]\n clusterHighlights: any[]\n properties: Property[]\n __typename: string\n advertisement: null\n items: Item[]\n selectedProperties: null\n rule: null\n sku: Sku\n}\n\ninterface Sku {\n itemId: string\n name: string\n nameComplete: string\n complementName: string\n ean: string\n variations: any[]\n referenceId: ReferenceId\n measurementUnit: string\n unitMultiplier: number\n images: Image[]\n __typename: string\n sellers: Seller[]\n seller: Seller\n image: Image\n}\n\ninterface Item {\n itemId: string\n name: string\n nameComplete: string\n complementName: string\n ean: string\n variations: any[]\n referenceId: ReferenceId[]\n measurementUnit: string\n unitMultiplier: number\n images: Image[]\n __typename: string\n sellers: Seller[]\n}\n\ninterface Seller {\n sellerId: string\n sellerName: string\n sellerDefault: boolean\n __typename: string\n commertialOffer: CommertialOffer\n}\n\ninterface CommertialOffer {\n discountHighlights: any[]\n teasers: any[]\n Price: number\n ListPrice: number\n Tax: number\n taxPercentage: number\n spotPrice: number\n PriceWithoutDiscount: number\n RewardValue: number\n PriceValidUntil: string\n AvailableQuantity: number\n __typename: string\n Installments: any[]\n}\n\ninterface Image {\n cacheId: string\n imageId: string\n imageLabel: string\n imageTag: string\n imageUrl: string\n imageText: string\n __typename: string\n}\n\ninterface ReferenceId {\n Key: string\n Value: string\n __typename: string\n}\n\ninterface Property {\n name: string\n values: string[]\n __typename: string\n}\n\ninterface SpecificationGroup {\n name: string\n originalName: string\n specifications: Specification[]\n __typename: string\n}\n\ninterface Specification {\n name: string\n originalName: string\n values: string[]\n __typename: string\n}\n\ninterface PriceRange {\n sellingPrice: SellingPrice\n listPrice: SellingPrice\n __typename: string\n}\n\ninterface SellingPrice {\n highPrice: number\n lowPrice: number\n __typename: string\n}\n\n```"
}
] |
code_vtex-ads_f4f185a2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of vtex-ads/react/hooks/useAdEvents/types/view.d.ts from the vtex-ads VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface ProductViewEvent {\n currency: string\n eventName: 'vtex:productView'\n event: 'productView'\n product: Product\n list: string\n}\n\ninterface Product {\n detailUrl: string\n brand: string\n brandId: number\n productReference: string\n linkText: string\n categoryId: string\n categories: string[]\n categoryTree: CategoryTree[]\n productId: string\n productName: string\n items: Item[]\n selectedSku: Item\n}\n\ninterface Item {\n itemId: string\n name: string\n ean: string\n referenceId: ReferenceId[]\n imageUrl: string\n sellers: Seller[]\n}\n\ninterface Seller {\n sellerId: string\n sellerName: string\n sellerDefault: boolean\n commertialOffer: CommertialOffer\n}\n\ninterface CommertialOffer {\n Price: number\n ListPrice: number\n AvailableQuantity: number\n PriceWithoutDiscount: number\n}\n\ninterface ReferenceId {\n Key: string\n Value: string\n __typename: string\n}\n\ninterface CategoryTree {\n id: number\n name: string\n href: string\n __typename: string\n}\n\n```"
}
] |
code_shelf-components_57946624
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/messages/hu.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.shelf.title\": \"Polc\",\n \"admin/editor.shelf.description\": \"Leírás\",\n \"admin/editor.buy-together.title\": \"Vásárlás együtt\",\n \"store/shelf.buy-together.title\": \"Vásárlás együtt\",\n \"admin/editor.title.label\": \"Cím\",\n \"admin/editor.secondary-title.label\": \"Másodlagos cím\",\n \"store/shelf.buy-together.change.label\": \"Módosítás\",\n \"store/shelf.buy-together.remove.label\": \"Eltávolítás\",\n \"store/shelf.buy-together.add.label\": \"Hozzáadás\",\n \"store/shelf.buy-together.total-products.label\": \"{total} {total, plural, one {termék} other {termék}} vásárlása a következő áron:\",\n \"admin/editor.shelf.collection.title\": \"Gyűjteményazonosító\",\n \"admin/editor.refresh-shelf.title\": \"Polc frissítése\",\n \"admin/editor.refresh-shelf.base-product.label\": \"Alaptermék címe\",\n \"admin/editor.refresh-shelf.secondary-base-product.label\": \"Másodlagos alaptermék címe\",\n \"admin/editor.refresh-shelf.suggested-products.label\": \"Ajánlott termékek címe\",\n \"admin/editor.refresh-shelf.secondary-suggested-products.label\": \"Másodlagos ajánlott termékek címe\",\n \"admin/editor.refresh-shelf.slider-layout.title\": \"Csúszka elrendezése\",\n \"admin/editor.refresh-shelf.suggested-products-list.title\": \"Ajánlott termékek listái\",\n \"admin/editor.refresh-shelf.suggested-products-list.description\": \"Fontos: ha kitölti az „ajánlott termékazonosítók” mezőt, az alatta lévő összes többi mező (kategóriaazonosító, gyűjtemény stb.) figyelmen kívül hagyásra kerül.\",\n \"admin/editor.refresh-shelf.suggested-products-list.base-product.title\": \"Alaptermék-azonosító\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.title\": \"Ajánlott termékek azonosítói\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.description\": \"Az azonosítókat vesszővel kell elválasztani (pl. 1,2,3)\",\n \"store/shelf.refresh.refresh-product-summary.title\": \"A következőt látta:\",\n \"store/shelf.refresh.suggested-products.title\": \"Önnek ajánlott\"\n}\n\n```"
}
] |
code_shelf-components_88220462
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/messages/fi.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.shelf.title\": \"Hylly\",\n \"admin/editor.shelf.description\": \"Kuvaus\",\n \"admin/editor.buy-together.title\": \"Osta yhdessä\",\n \"store/shelf.buy-together.title\": \"Osta yhdessä\",\n \"admin/editor.title.label\": \"Nimi\",\n \"admin/editor.secondary-title.label\": \"Toissijainen ruutu\",\n \"store/shelf.buy-together.change.label\": \"Muuta\",\n \"store/shelf.buy-together.remove.label\": \"Poista\",\n \"store/shelf.buy-together.add.label\": \"Lisää\",\n \"store/shelf.buy-together.total-products.label\": \"Osta {total} {total, plural, one {tuote} other {tuotetta}} hintaan\",\n \"admin/editor.shelf.collection.title\": \"Kokoelman tunnus\",\n \"admin/editor.refresh-shelf.title\": \"Päivitä hylly\",\n \"admin/editor.refresh-shelf.base-product.label\": \"Perustuotenimike\",\n \"admin/editor.refresh-shelf.secondary-base-product.label\": \"Toissijainen tuotteen pohjanimike\",\n \"admin/editor.refresh-shelf.suggested-products.label\": \"Ehdotettu tuotenimike\",\n \"admin/editor.refresh-shelf.secondary-suggested-products.label\": \"Toissijaisten ehdotettu tuotenimike\",\n \"admin/editor.refresh-shelf.slider-layout.title\": \"Liukusäätimen asettelu\",\n \"admin/editor.refresh-shelf.suggested-products-list.title\": \"Ehdotetut tuoteluettelot\",\n \"admin/editor.refresh-shelf.suggested-products-list.description\": \"Tärkeää: jos täytät ”ehdotetut tuotetunnukset” -kentän, kaikki muut tämän alla olevat kentät (kategorian tunnus, kokoelma jne.) sivuutetaan.\",\n \"admin/editor.refresh-shelf.suggested-products-list.base-product.title\": \"Perustuotetunnus\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.title\": \"Ehdotetut tuotetunnukset\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.description\": \"Tunnukset tulee erottaa pilkuilla (esim.: 1,2,3)\",\n \"store/shelf.refresh.refresh-product-summary.title\": \"Näit tämän\",\n \"store/shelf.refresh.suggested-products.title\": \"Suositellaan sinulle\"\n}\n\n```"
}
] |
code_shelf-components_509ed023
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/messages/pt.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.shelf.title\": \"Vitrine\",\n \"admin/editor.shelf.description\": \"Descrição\",\n \"admin/editor.buy-together.title\": \"Compre junto\",\n \"store/shelf.buy-together.title\": \"Compre junto\",\n \"admin/editor.title.label\": \"Título\",\n \"admin/editor.secondary-title.label\": \"Título Secundário\",\n \"store/shelf.buy-together.change.label\": \"Mudar\",\n \"store/shelf.buy-together.remove.label\": \"Remover\",\n \"store/shelf.buy-together.add.label\": \"Adicionar\",\n \"store/shelf.buy-together.total-products.label\": \"Comprar {total} {total, plural, one {produto} other {produtos}} por\",\n \"admin/editor.shelf.collection.title\": \"ID da Coleção\",\n \"admin/editor.refresh-shelf.title\": \"Vitrine atualizável\",\n \"admin/editor.refresh-shelf.base-product.label\": \"Título do produto base\",\n \"admin/editor.refresh-shelf.secondary-base-product.label\": \"Título secundário do produto base\",\n \"admin/editor.refresh-shelf.suggested-products.label\": \"Título dos produtos sugeridos\",\n \"admin/editor.refresh-shelf.secondary-suggested-products.label\": \"Título secundário dos produtos sugeridos\",\n \"admin/editor.refresh-shelf.slider-layout.title\": \"Slider Layout\",\n \"admin/editor.refresh-shelf.suggested-products-list.title\": \"Listas de produtos sugeridos\",\n \"admin/editor.refresh-shelf.suggested-products-list.description\": \"Importante: se você preencher o campo 'IDs dos produtos sugeridos', todos os campos abaixo deste serão ignorados (ID da categoria, collection, etc.)\",\n \"admin/editor.refresh-shelf.suggested-products-list.base-product.title\": \"ID do produto base\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.title\": \"IDs dos produtos sugeridos\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.description\": \"Os IDs devem estar separados por vírgula (ex. 1,2,3)\",\n \"store/shelf.refresh.refresh-product-summary.title\": \"Você viu\",\n \"store/shelf.refresh.suggested-products.title\": \"Sugeridos para você\"\n}\n\n```"
}
] |
code_shelf-components_2760b16e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/messages/en.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.shelf.title\": \"Shelf\",\n \"admin/editor.shelf.description\": \"Description\",\n \"admin/editor.buy-together.title\": \"Buy Together\",\n \"store/shelf.buy-together.title\": \"Buy Together\",\n \"admin/editor.title.label\": \"Title\",\n \"admin/editor.secondary-title.label\": \"Secondary Title\",\n \"store/shelf.buy-together.change.label\": \"Change\",\n \"store/shelf.buy-together.remove.label\": \"Remove\",\n \"store/shelf.buy-together.add.label\": \"Add\",\n \"store/shelf.buy-together.total-products.label\": \"Buy {total} {total, plural, one {product} other {products}} for\",\n \"admin/editor.shelf.collection.title\": \"Collection ID\",\n \"admin/editor.refresh-shelf.title\": \"Refresh Shelf\",\n \"admin/editor.refresh-shelf.base-product.label\": \"Base Product Title\",\n \"admin/editor.refresh-shelf.secondary-base-product.label\": \"Secondary Base Product Title\",\n \"admin/editor.refresh-shelf.suggested-products.label\": \"Suggested Products Title\",\n \"admin/editor.refresh-shelf.secondary-suggested-products.label\": \"Secondary Suggested Products Title\",\n \"admin/editor.refresh-shelf.slider-layout.title\": \"Slider Layout\",\n \"admin/editor.refresh-shelf.suggested-products-list.title\": \"Suggested Products Lists\",\n \"admin/editor.refresh-shelf.suggested-products-list.description\": \"Important: if you fill in the 'suggested product ids' field, all other fields below this (category ID, collection, etc.) will be ignored.\",\n \"admin/editor.refresh-shelf.suggested-products-list.base-product.title\": \"Base product ID\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.title\": \"Suggested products IDs\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.description\": \"IDs must be separated by a comma (e.g: 1,2,3)\",\n \"store/shelf.refresh.refresh-product-summary.title\": \"You saw\",\n \"store/shelf.refresh.suggested-products.title\": \"Suggested for you\"\n}\n\n```"
}
] |
code_shelf-components_1cd6f345
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/messages/context.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.shelf.title\": \"Shelf title\",\n \"admin/editor.shelf.description\": \"Shelf description\",\n \"admin/editor.buy-together.title\": \"Buy Together editor title\",\n \"store/shelf.buy-together.title\": \"Buy together title\",\n \"admin/editor.title.label\": \"Title label\",\n \"admin/editor.secondary-title.label\": \"Secondary title label\",\n \"store/shelf.buy-together.change.label\": \"Change label\",\n \"store/shelf.buy-together.remove.label\": \"Remove label\",\n \"store/shelf.buy-together.add.label\": \"Add label\",\n \"store/shelf.buy-together.total-products.label\": \"Total products label\",\n \"admin/editor.shelf.collection.title\": \"Collection title\",\n \"admin/editor.refresh-shelf.title\": \"Refresh Shelf title\",\n \"admin/editor.refresh-shelf.base-product.label\": \"Base Product Title label\",\n \"admin/editor.refresh-shelf.secondary-base-product.label\": \"Secondary Base Product Title label\",\n \"admin/editor.refresh-shelf.suggested-products.label\": \"Suggested Products Title label\",\n \"admin/editor.refresh-shelf.secondary-suggested-products.label\": \"Secondary Suggested Products Title label\",\n \"admin/editor.refresh-shelf.slider-layout.title\": \"Slider Layout title\",\n \"admin/editor.refresh-shelf.suggested-products-list.title\": \"Suggested products list title\",\n \"admin/editor.refresh-shelf.suggested-products-list.description\": \"Description for suggested products list\",\n \"admin/editor.refresh-shelf.suggested-products-list.base-product.title\": \"Base product title\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.title\": \"Suggested products title\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.description\": \"Suggested products description\",\n \"store/shelf.refresh.refresh-product-summary.title\": \"Refresh Product Summary title\",\n \"store/shelf.refresh.suggested-products.title\": \"Refresh Suggested Products title\"\n}\n\n```"
}
] |
code_shelf-components_dea6753f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/messages/es.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.shelf.title\": \"Escaparate\",\n \"admin/editor.shelf.description\": \"Description\",\n \"admin/editor.buy-together.title\": \"Comprar juntos\",\n \"store/shelf.buy-together.title\": \"Comprar juntos\",\n \"admin/editor.title.label\": \"Título\",\n \"admin/editor.secondary-title.label\": \"Título secundario\",\n \"store/shelf.buy-together.change.label\": \"Cambiar\",\n \"store/shelf.buy-together.remove.label\": \"Eliminar\",\n \"store/shelf.buy-together.add.label\": \"Agregar\",\n \"store/shelf.buy-together.total-products.label\": \"Comprar {total} {total, plural, one {producto} other {productos}} por\",\n \"admin/editor.shelf.collection.title\": \"ID de la Colección\",\n \"admin/editor.refresh-shelf.title\": \"Escaparate actualizable\",\n \"admin/editor.refresh-shelf.base-product.label\": \"Título del producto base\",\n \"admin/editor.refresh-shelf.secondary-base-product.label\": \"Título secundario del producto base\",\n \"admin/editor.refresh-shelf.suggested-products.label\": \"Título de productos sugeridos\",\n \"admin/editor.refresh-shelf.secondary-suggested-products.label\": \"Título secundario de productos sugeridos\",\n \"admin/editor.refresh-shelf.slider-layout.title\": \"Slider Layout\",\n \"admin/editor.refresh-shelf.suggested-products-list.title\": \"Listas de productos sugeridos\",\n \"admin/editor.refresh-shelf.suggested-products-list.description\": \"Importante: si completa el campo 'ID de productos sugeridos', se ignorarán todos los demás campos debajo de este (ID de categoría, colección, etc.)\",\n \"admin/editor.refresh-shelf.suggested-products-list.base-product.title\": \"ID del producto base\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.title\": \"ID de productos sugeridos\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.description\": \"Los IDs deben estar separados por una coma (p. ej. 1,2,3)\",\n \"store/shelf.refresh.refresh-product-summary.title\": \"Has visto\",\n \"store/shelf.refresh.suggested-products.title\": \"Sugeridos para ti\"\n}\n\n```"
}
] |
code_shelf-components_81545401
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/messages/ar.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.shelf.title\": \"الرفوف\",\n \"admin/editor.shelf.description\": \"الوصف\",\n \"admin/editor.buy-together.title\": \"الشراء معا\",\n \"store/shelf.buy-together.title\": \"الشراء معا\",\n \"admin/editor.title.label\": \"العنوان\",\n \"admin/editor.secondary-title.label\": \"عنوان ثانوي\",\n \"store/shelf.buy-together.change.label\": \"تغيير\",\n \"store/shelf.buy-together.remove.label\": \"حذف\",\n \"store/shelf.buy-together.add.label\": \"إضافة\",\n \"store/shelf.buy-together.total-products.label\": \"شراء {total} {total, plural, one {منتج} other {منتجات}} لـ\",\n \"admin/editor.shelf.collection.title\": \"معرّف المجموعة\",\n \"admin/editor.refresh-shelf.title\": \"تحديث الرفوف\",\n \"admin/editor.refresh-shelf.base-product.label\": \"عنوان المنتج الأساسي\",\n \"admin/editor.refresh-shelf.secondary-base-product.label\": \"عنوان المنتج الثانوي\",\n \"admin/editor.refresh-shelf.suggested-products.label\": \"عنوان المنتجات المقترحة\",\n \"admin/editor.refresh-shelf.secondary-suggested-products.label\": \"عنوان المنتجات الثانوية المقترحة\",\n \"admin/editor.refresh-shelf.slider-layout.title\": \"تصميم شريط التمرير\",\n \"admin/editor.refresh-shelf.suggested-products-list.title\": \"قوائم المنتجات المقترحة\",\n \"admin/editor.refresh-shelf.suggested-products-list.description\": \"هام: إذا قمت بملء حقل \\\"معرفات المنتج المقترحة\\\"، فسيتم تجاهل جميع الحقول الأخرى الموجودة أسفل هذه (معرف الفئة، المجموعة، إلخ).\",\n \"admin/editor.refresh-shelf.suggested-products-list.base-product.title\": \"معرّف المنتج الأساسي\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.title\": \"معرّفات المنتجات المقترحة\",\n \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.description\": \"يجب فصل المعرفات بفاصلة (على سبيل المثال: 1، 2، 3)\",\n \"store/shelf.refresh.refresh-product-summary.title\": \"رأيتَ\",\n \"store/shelf.refresh.suggested-products.title\": \"مقترحة لك\"\n}\n\n```"
}
] |
code_shelf-components_30142a14
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/docs/README.md from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/shelf-components) to it or open issues to help evolve it. \n\n# Shelf Components\n\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\nVTEX Shelf Components is a collection of components that can be used to create shelves in your store, which are responsible for displaying a list of products.\n\n:loudspeaker: **Disclaimer:** Don't fork this project; use, contribute, or open issue with your feature request.\n\n## Table of Contents\n\n- [Usage](#usage)\n - [Styles API](#styles-api)\n- [Components Specs](#components-specs)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n\n## Usage\n\nThis app uses our store builder with the blocks architecture. To know more about Store Builder [click here.](https://help.vtex.com/en/tutorial/understanding-storebuilder-and-stylesbuilder#structuring-and-configuring-our-store-with-object-object)\n\nTo use this app, you need to import in your dependencies on `manifest.json`.\n\n```json\n \"dependencies\": {\n \"vtex.shelf-components\": \"0.x\"\n }\n```\n\n### Styles API\n\nThis app provides some CSS classes as an API for style customization.\n\nTo use this CSS API, you must add the `styles` builder and create an app styling CSS file.\n\n1. Add the `styles` builder to your `manifest.json`:\n\n```json\n \"builders\": {\n \"styles\": \"1.x\"\n }\n```\n\n2. Create a file called `vtex.shelf-components.css` inside the `styles/css` folder. Add your custom styles:\n\n```css\n.container {\n margin-top: 10px;\n}\n```\n\n## Components Specs\n\nBelow we have a README for each component of this project that explains how to use them.\n\n- [Shelf](Shelf.md)\n- [Refresh Shelf](RefreshShelf.md)\n\n## Troubleshooting\n\nYou can check if others are passing through similar issues [here](https://github.com/vtex-apps/shelf-components/issues). Also feel free to [open issues](https://github.com/vtex-apps/shelf-components/issues/new) or contribute with pull requests.\n\n## Contributing\n\nCheck it out [how to contribute](https://github.com/vtex-apps/awesome-io#contributing) with this project.\n\n<!-- DOCS-IGNORE:start -->\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n <tr>\n <td align=\"center\"><a href=\"https://github.com/pgrimaud\"><img src=\"https://avatars1.githubusercontent.com/u/1866496?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Pierre Grimaud</b></sub></a><br /><a href=\"https://github.com/vtex-apps/shelf-components/commits?author=pgrimaud\" title=\"Documentation\">📖</a></td>\n </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n<!-- DOCS-IGNORE:end -->\n\n```"
}
] |
code_shelf-components_bad5f471
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/react/package.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"shelf-components\",\n \"version\": \"0.10.1\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.8\",\n \"classnames\": \"^2.2.6\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/classnames\": \"^2.2.10\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.9.8\",\n \"@types/react\": \"^16.9.31\",\n \"@vtex/test-tools\": \"^3.1.0\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.7.0\",\n \"prop-types\": \"^15.7.2\",\n \"react-content-loader\": \"^5.1.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.add-to-cart-button\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.add-to-cart-button@0.20.1/public/@types/vtex.add-to-cart-button\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles\",\n \"vtex.device-detector\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.device-detector@0.2.5/public/@types/vtex.device-detector\",\n \"vtex.flex-layout\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.15.1/public/@types/vtex.flex-layout\",\n \"vtex.format-currency\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.2.0/public/@types/vtex.format-currency\",\n \"vtex.messages\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.messages@1.60.2/public/@types/vtex.messages\",\n \"vtex.pixel-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.pixel-manager@1.4.0/public/@types/vtex.pixel-manager\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.9.2/public/@types/vtex.product-context\",\n \"vtex.product-group-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-group-context@0.2.0/public/@types/vtex.product-group-context\",\n \"vtex.product-list-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-list-context@0.3.0/public/@types/vtex.product-list-context\",\n \"vtex.product-price\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-price@1.10.0/public/@types/vtex.product-price\",\n \"vtex.product-summary\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-summary@2.63.1/public/@types/vtex.product-summary\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.126.0/public/@types/vtex.render-runtime\",\n \"vtex.responsive-layout\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.responsive-layout@0.1.2/public/@types/vtex.responsive-layout\",\n \"vtex.search-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-graphql@0.36.0/public/_types/react\",\n \"vtex.slider-layout\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.slider-layout@0.15.2/public/@types/vtex.slider-layout\",\n \"vtex.store-components\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.132.0/public/@types/vtex.store-components\",\n \"vtex.store-resources\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-resources@0.74.0/public/_types/react\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.133.2/public/@types/vtex.styleguide\"\n }\n}\n\n```"
}
] |
code_shelf-components_3eae75d5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/react/BuyTogether.tsx from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nexport { default } from './components/BuyTogether'\n\n```"
}
] |
code_shelf-components_d9d792f3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/react/RefreshShelf.tsx from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nexport { default } from './components/RefreshShelf'\n\n```"
}
] |
code_shelf-components_c536e385
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/store/contentSchemas.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"definitions\": {\n \"Shelf\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": {\n \"title\": \"admin/editor.title.label\",\n \"type\": \"string\"\n },\n \"secondaryTitle\": {\n \"title\": \"admin/editor.secondary-title.label\",\n \"type\": \"string\"\n }\n }\n },\n \"BuyTogether\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": {\n \"title\": \"admin/editor.title.label\",\n \"type\": \"string\"\n }\n }\n },\n \"RefreshShelf\": {\n \"type\": \"object\",\n \"properties\": {\n \"baseProductTitle\": {\n \"title\": \"admin/editor.refresh-shelf.base-product.label\",\n \"type\": \"string\"\n },\n \"secondaryBaseProductTitle\": {\n \"title\": \"admin/editor.refresh-shelf.secondary-base-product.label\",\n \"type\": \"string\"\n },\n \"suggestedProductsTitle\": {\n \"title\": \"admin/editor.refresh-shelf.suggested-products.label\",\n \"type\": \"string\"\n },\n \"secondarySuggestedProductsTitle\": {\n \"title\": \"admin/editor.refresh-shelf.secondary-suggested-products.label\",\n \"type\": \"string\"\n },\n \"suggestedLists\": {\n \"title\": \"admin/editor.refresh-shelf.suggested-products-list.title\",\n \"description\": \"admin/editor.refresh-shelf.suggested-products-list.description\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"baseProductId\": {\n \"type\": \"string\",\n \"title\": \"admin/editor.refresh-shelf.suggested-products-list.base-product.title\"\n },\n \"suggestedProductsIds\": {\n \"type\": \"string\",\n \"title\": \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.title\",\n \"description\": \"admin/editor.refresh-shelf.suggested-products-list.suggested-products.description\"\n },\n \"$ref\": \"#/definitions/SearchProperties\"\n }\n }\n },\n \"sliderLayout\": {\n \"type\": \"object\",\n \"title\": \"admin/editor.refresh-shelf.slider-layout.title\",\n \"properties\": {\n \"showNavigationArrows\": {\n \"default\": \"always\",\n \"enum\": [\"mobileOnly\", \"desktopOnly\", \"always\", \"never\"],\n \"title\": \"admin/editor.slider-layout.showNavigation\",\n \"type\": \"string\"\n },\n \"showPaginationDots\": {\n \"default\": \"always\",\n \"enum\": [\"mobileOnly\", \"desktopOnly\", \"always\", \"never\"],\n \"title\": \"admin/editor.slider-layout.showPaginationDots\",\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"SearchProperties\": {\n \"category\": {\n \"title\": \"admin/editor.productSummaryList.category.title\",\n \"description\": \"admin/editor.productSummaryList.category.description\",\n \"type\": \"string\",\n \"isLayout\": false\n },\n \"specificationFilters\": {\n \"title\": \"admin/editor.productSummaryList.specificationFilters.title\",\n \"type\": \"array\",\n \"items\": {\n \"title\": \"admin/editor.productSummaryList.specificationFilters.item.title\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"title\": \"admin/editor.productSummaryList.specificationFilters.item.id.title\"\n },\n \"value\": {\n \"type\": \"string\",\n \"title\": \"admin/editor.productSummaryList.specificationFilters.item.value.title\"\n }\n }\n }\n },\n \"collection\": {\n \"title\": \"admin/editor.shelf.collection.title\",\n \"type\": \"string\",\n \"isLayout\": false\n },\n \"orderBy\": {\n \"title\": \"admin/editor.productSummaryList.orderBy.title\",\n \"type\": \"string\",\n \"$ref\": \"#/definitions/OrderByOptions\",\n \"isLayout\": false\n },\n \"hideUnavailableItems\": {\n \"title\": \"admin/editor.productSummaryList.hideUnavailableItems\",\n \"type\": \"boolean\",\n \"default\": false,\n \"isLayout\": false\n },\n \"maxItems\": {\n \"title\": \"admin/editor.productSummaryList.maxItems.title\",\n \"type\": \"number\",\n \"isLayout\": false,\n \"default\": 10\n },\n \"skusFilter\": {\n \"title\": \"admin/editor.productSummaryList.skusFilter.title\",\n \"description\": \"admin/editor.productSummaryList.skusFilter.description\",\n \"type\": \"string\",\n \"default\": \"ALL_AVAILABLE\",\n \"enum\": [\"ALL_AVAILABLE\", \"ALL\", \"FIRST_AVAILABLE\"],\n \"enumNames\": [\n \"admin/editor.productSummaryList.skusFilter.all-available\",\n \"admin/editor.productSummaryList.skusFilter.none\",\n \"admin/editor.productSummaryList.skusFilter.first-available\"\n ]\n },\n \"installmentCriteria\": {\n \"title\": \"admin/editor.productSummaryList.installmentCriteria.title\",\n \"description\": \"admin/editor.productSummaryList.installmentCriteria.description\",\n \"type\": \"string\",\n \"default\": \"MAX_WITHOUT_INTEREST\",\n \"enum\": [\"MAX_WITHOUT_INTEREST\", \"MAX_WITH_INTEREST\"],\n \"enumNames\": [\n \"admin/editor.productSummaryList.installmentCriteria.max-without-interest\",\n \"admin/editor.productSummaryList.installmentCriteria.max-with-interest\"\n ]\n }\n },\n \"OrderByOptions\": {\n \"enum\": [\n \"OrderByScoreDESC\",\n \"OrderByTopSaleDESC\",\n \"OrderByPriceDESC\",\n \"OrderByPriceASC\",\n \"OrderByNameASC\",\n \"OrderByNameDESC\",\n \"OrderByReleaseDateDESC\",\n \"OrderByBestDiscountDESC\"\n ],\n \"enumNames\": [\n \"admin/editor.productSummaryList.orderType.relevance\",\n \"admin/editor.productSummaryList.orderType.sales\",\n \"admin/editor.productSummaryList.orderType.priceDesc\",\n \"admin/editor.productSummaryList.orderType.priceAsc\",\n \"admin/editor.productSummaryList.orderType.nameAsc\",\n \"admin/editor.productSummaryList.orderType.nameDesc\",\n \"admin/editor.productSummaryList.orderType.releaseDate\",\n \"admin/editor.productSummaryList.orderType.discount\"\n ],\n \"default\": \"OrderByTopSaleDESC\"\n }\n }\n}\n\n```"
}
] |
code_shelf-components_af460791
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/store/blocks.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"add-to-cart-button#my-add-to-cart\": {},\n \"buy-button#my-add-to-cart\": {},\n\n \"flex-layout.col#product-image\": {\n \"children\": [\"product-summary-image#shelf\"]\n },\n\n \"product-summary-image#shelf\": {\n \"props\": {\n \"showBadge\": false,\n \"aspectRatio\": \"1:1\",\n \"maxHeight\": 300\n }\n },\n\n \"product-list-price#summary\": {\n \"props\": {\n \"blockClass\": \"summary\"\n }\n },\n \"product-selling-price#summary\": {\n \"props\": {\n \"blockClass\": \"summary\"\n }\n },\n\n \"flex-layout.row#selling-price-savings\": {\n \"props\": {\n \"colGap\": 2,\n \"preserveLayoutOnMobile\": true,\n \"preventHorizontalStretch\": true,\n \"marginBottom\": 4\n },\n \"children\": [\n \"product-selling-price#summary\",\n \"product-price-savings#summary\"\n ]\n },\n\n \"product-installments#summary\": {\n \"props\": {\n \"blockClass\": \"summary\"\n }\n },\n\n \"product-price-savings#summary\": {\n \"props\": {\n \"markers\": [\"discount\"],\n \"blockClass\": \"summary\"\n }\n },\n\n \"product-summary-sku-selector#buy-together\": {\n \"props\": {\n \"thumbnailImage\": \"skuvariation\",\n \"imageHeight\": 28,\n \"blockClass\": \"buyTogether\",\n \"visibility\": \"more-than-one\"\n }\n },\n\n \"flex-layout.col#product-summary-details\": {\n \"props\": {\n \"marginLeft\": 4\n },\n \"children\": [\n \"product-summary-name\",\n \"product-summary-space\",\n \"product-list-price#summary\",\n \"flex-layout.row#selling-price-savings\",\n \"product-installments#summary\",\n \"product-summary-sku-selector#buy-together\"\n ]\n },\n\n \"flex-layout.row#product-summary-mobile\": {\n \"children\": [\n \"flex-layout.col#product-image\",\n \"flex-layout.col#product-summary-details\"\n ],\n \"props\": {\n \"blockClass\": \"buyTogether\"\n }\n },\n\n \"flex-layout.col#product-summary-desktop\": {\n \"children\": [\n \"product-summary-image#shelf\",\n \"product-summary-name\",\n \"product-summary-space\",\n \"product-list-price#summary\",\n \"flex-layout.row#selling-price-savings\",\n \"product-installments#summary\",\n \"product-summary-sku-selector#buy-together\"\n ]\n },\n \"flex-layout.row#product-summary-desktop\": {\n \"children\": [\"flex-layout.col#product-summary-desktop\"]\n },\n\n \"responsive-layout.phone#product-summary\": {\n \"children\": [\"flex-layout.row#product-summary-mobile\"]\n },\n \"responsive-layout.tablet#product-summary\": {\n \"children\": [\"flex-layout.row#product-summary-mobile\"]\n },\n\n \"responsive-layout.desktop#product-summary\": {\n \"children\": [\"flex-layout.row#product-summary-desktop\"]\n },\n\n \"product-summary.shelf#buy-together\": {\n \"children\": [\n \"responsive-layout.desktop#product-summary\",\n \"responsive-layout.tablet#product-summary\",\n \"responsive-layout.phone#product-summary\"\n ],\n \"props\": {\n \"blockClass\": \"buyTogether\"\n }\n },\n\n \"product-summary.shelf\": {\n \"children\": [\n \"product-summary-image#shelf\",\n \"product-summary-name\",\n \"product-summary-space\",\n \"product-list-price#summary\",\n \"flex-layout.row#selling-price-savings\",\n \"product-installments#summary\",\n \"add-to-cart-button\"\n ]\n },\n\n \"slider-layout#shelf\": {\n \"props\": {\n \"itemsPerPage\": {\n \"desktop\": 5,\n \"tablet\": 3,\n \"phone\": 1\n },\n \"infinite\": true,\n \"fullWidth\": false,\n \"blockClass\": \"shelf\"\n }\n },\n\n \"list-context.product-list\": {\n \"blocks\": [\"product-summary.shelf\"],\n \"children\": [\"slider-layout#shelf\"]\n },\n\n \"list-context.product-list-static\": {\n \"blocks\": [\"product-summary.shelf\"],\n \"children\": [\"slider-layout#shelf\"]\n },\n\n \"buy-together\": {\n \"blocks\": [\"product-summary.shelf#buy-together\"],\n \"props\": {\n \"BuyButton\": \"add-to-cart-button#my-add-to-cart\"\n }\n },\n\n \"refresh-shelf\": {\n \"blocks\": [\"product-summary.shelf\"]\n },\n\n \"default-shelf\": {\n \"blocks\": [\"list-context.product-list\", \"list-context.product-list-static\"]\n }\n}\n\n```"
}
] |
code_shelf-components_be45090d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/store/interfaces.json from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"buy-together\": {\n \"required\": [\"product-summary\"],\n \"allowed\": [\"responsive-layout\"],\n \"component\": \"BuyTogether\",\n \"composition\": \"children\",\n \"content\": {\n \"$ref\": \"#/definitions/BuyTogether\"\n }\n },\n \"refresh-shelf\": {\n \"required\": [\"product-summary\"],\n \"component\": \"RefreshShelf\",\n \"content\": {\n \"$ref\": \"#/definitions/RefreshShelf\"\n }\n },\n \"default-shelf\": {\n \"allowed\": [\"list-context.product-list\", \"list-context.product-list-static\"],\n \"component\": \"Shelf\",\n \"content\": {\n \"$ref\": \"#/definitions/Shelf\"\n }\n }\n}\n\n```"
}
] |
code_shelf-components_1b9148fe
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/styles/css/vtex.product-summary.css from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.container--buyTogether {\n max-width: none !important;\n}\n\n.skuSelectorContainer--buyTogether {\n margin: 0.25rem;\n}\n\n.skuSelectorContainer--buyTogether .skuSelectorItemImage .frameAround, .skuSelectorContainer--buyTogether .skuSelectorItemImage .skuSelectorInternalBox {\n border-radius: 50%;\n}\n\n```"
}
] |
code_shelf-components_447a708c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/styles/css/vtex.slider-layout.css from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.slide--shelf {\n margin-bottom: 25px;\n padding-left: .5rem;\n padding-right: .5rem;\n}\n\n.layoutContainer--shelf {\n margin-top: 20px;\n margin-bottom: 20px;\n max-width: 96rem;\n}\n\n```"
}
] |
code_shelf-components_bbe91be8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/react/typings/vtex.recommendation-context.d.ts from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.recommendation-context/RecommendationContext' {\n export const useRecommendation\n}\n\n```"
}
] |
code_shelf-components_0d4a5ccb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/react/typings/vtex.render-runtime.d.ts from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.render-runtime' {\n export const ExtensionPoint\n export const useTreePath\n export const Loading\n export const useRuntime\n}\n\n```"
}
] |
code_shelf-components_6925e135
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/react/typings/global.d.ts from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { FunctionComponent } from 'react'\n\ndeclare global {\n interface StorefrontFunctionComponent<P = {}> extends FunctionComponent<P> {\n schema?: object\n getSchema?(props?: P): object\n }\n\n interface Product {\n brand: string\n brandId: number\n cacheId: string\n categories?: string[]\n clusterHighlights?: Array<{ id: string; name: string }>\n categoryTree?: Array<{ slug: string }>\n description?: string\n items: SKU[]\n link: string\n linkText: string\n priceRange: ProductPriceRange\n productClusters?: Array<{ id: string; name: string }>\n productId: string\n productName: string\n productReference: string\n properties?: Array<{ name: string; values: string[] }>\n sku?: SKU\n specificationGroups: SpecificationGroup[]\n }\n\n interface ProductPriceRange {\n sellingPrice: PriceRange\n listPrice: PriceRange\n }\n\n interface PriceRange {\n highPrice: number\n lowPrice: number\n }\n\n interface SpecificationGroupProperty {\n originalName: string\n name: string\n values: string[]\n }\n\n interface SpecificationGroup {\n name?: string\n originalName?: string\n specifications?: SpecificationGroupProperty[]\n }\n\n interface Item {\n quantity: number\n product: Product\n selectedItem: SKU\n }\n\n interface CartItem {\n id: string\n productId: string\n quantity: number\n uniqueId: string\n detailUrl: string\n name: string\n brand: string\n category: string\n productRefId: string\n seller: string\n variant: string\n skuName: string\n price: number\n listPrice: number\n sellingPrice: number\n sellingPriceWithAssemblies: number\n measurementUnit: string\n skuSpecifications: any[]\n imageUrl: string\n options: any[]\n assemblyOptions: {\n added: any[]\n removed: any[]\n parentPrice: number\n }\n referenceId: Array<{\n Key: string\n Value: string\n }> | null\n }\n\n interface SKU {\n complementName?: string\n ean?: string\n image?: Image\n images: Image[]\n itemId: string\n measurementUnit: string\n name: string\n nameComplete?: string\n referenceId: Array<{\n Key: string\n Value: string\n }> | null\n seller?: Seller\n sellers: Seller[]\n unitMultiplier?: number\n variations: Array<{ name: string; values: string[] }>\n }\n\n interface Image {\n cacheId?: string\n imageId?: string\n imageLabel: string | null\n imageTag?: string\n imageUrl: string\n imageText?: string | null\n }\n\n interface Seller {\n addToCartLink?: string\n commertialOffer: CommertialOffer\n sellerId: string\n sellerDefault?: boolean\n sellerName?: string\n }\n\n interface CommertialOffer {\n AvailableQuantity: number\n Installments: Installment[]\n ListPrice: number\n Price: number\n PriceWithoutDiscount: number\n RewardValue?: number\n Tax: number\n discountHighlights?: Array<{ name: string }>\n spotPrice?: number\n taxPercentage: number\n teasers?: Array<{ name: string }>\n }\n\n interface Installment {\n InterestRate: number\n Name: string\n NumberOfInstallments: number\n PaymentSystemName?: string\n TotalValuePlusInterestRate: number\n Value: number\n }\n\n interface SpecificationFilter {\n id: string\n value: string\n }\n\n interface SuggestedProductsList {\n baseProductId: string\n suggestedProductsIds?: string\n category?: string\n specificationFilters?: SpecificationFilter[]\n collection?: string\n orderBy?: string\n hideUnavailableItems?: boolean\n maxItems?: number\n skusFilter?: string\n installmentCriteria?: string\n }\n\n interface RecommendedList {\n base: Product[]\n recommended: Product[]\n }\n\n interface SuggestedList {\n products: Product[]\n hidden: boolean\n current: number\n }\n}\n\n```"
}
] |
code_shelf-components_952050ed
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shelf-components/react/typings/css.d.ts from the shelf-components VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.css' {\n const styles: {\n [key: string]: string\n }\n\n export default styles\n}\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.