id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_store-resources_80e2c40c
|
[
{
"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 store-resources/react/QueryProductsTypes.tsx from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { InstallmentsCriteria, ItemsFilter } from 'vtex.search-graphql'\n\nimport type { CommertialOfferFragment } from './fragments/CommertialOfferType'\nimport CommertialOfferType from './fragments/CommertialOfferType'\nimport type { InstallmentFragment } from './fragments/InstallmentType'\nimport InstallmentType from './fragments/InstallmentType'\nimport type { SkuFragment } from './fragments/ItemType'\nimport ItemType from './fragments/ItemType'\nimport type { ProductFragment } from './fragments/ProductType'\nimport ProductType from './fragments/ProductType'\nimport type { SellerFragment } from './fragments/SellerType'\nimport SellerType from './fragments/SellerType'\n\ntype Installment = {\n Installments: InstallmentFragment[]\n}\n\ntype CommertialOffer = CommertialOfferFragment & Installment\n\ntype Seller = SellerFragment & CommertialOffer\n\ntype Item = SkuFragment & { sellers: Seller[] }\n\nexport type Data = {\n products: Array<ProductFragment & { items: Item[] }>\n}\n\nexport type Variables = {\n category?: string\n collection?: string\n specificationFilters?: string[]\n orderBy?: string\n from?: number\n to?: number\n hideUnavailableItems?: boolean\n skusFilter?: ItemsFilter\n installmentCriteria?: InstallmentsCriteria\n shippingOptions?: string[]\n advertisementOptions: AdvertisementOptions\n}\n\ntype AdvertisementOptions = {\n showSponsored?: boolean\n sponsoredCount?: number\n repeatSponsoredProducts?: boolean\n advertisementPlacement?: string\n}\n\n// We need to fake usage of some JS from the other modules so they\n// are not removed out from the type generation\nexport {\n CommertialOfferType,\n InstallmentType, ItemType, ProductType, SellerType\n}\n\n\n```"
}
] |
code_store-resources_28a50a80
|
[
{
"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 store-resources/react/QuerySearchSuggestions.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport searchSuggestions from './queries/searchSuggestions.gql'\n\nexport default searchSuggestions\n\n```"
}
] |
code_store-resources_9b8fd6c4
|
[
{
"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 store-resources/react/QueryItemsWithSimulation.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport productWithSimulation from './queries/itemsWithSimulation.gql'\n\nexport default productWithSimulation\n\n```"
}
] |
code_store-resources_080bf2f3
|
[
{
"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 store-resources/react/QueryProductSearchV3.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport productSearchV3 from './queries/productSearchV3.gql'\n\nexport default productSearchV3\n\n```"
}
] |
code_store-resources_f474b975
|
[
{
"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 store-resources/react/QueryCorrection.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport correction from './queries/correction.gql'\n\nexport default correction\n\n```"
}
] |
code_store-resources_411dd91f
|
[
{
"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 store-resources/react/MutationUpdateOrderFormProfile.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport updateOrderFormProfile from './mutations/updateOrderFormProfile.gql'\n\nexport default updateOrderFormProfile\n\n```"
}
] |
code_store-resources_19c93981
|
[
{
"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 store-resources/react/QueryRecommendationShelf.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport recommendationShelf from './queries/recommendationShelf.gql'\n\nexport default recommendationShelf\n\n```"
}
] |
code_store-resources_d05ecd74
|
[
{
"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 store-resources/react/package.json from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"version\": \"0.104.3\",\n \"dependencies\": {\n \"apollo-client\": \"^2.6.8\",\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/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.9.8\",\n \"@types/react\": \"^16.9.31\",\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.pixel-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.pixel-manager@1.7.0/public/@types/vtex.pixel-manager\",\n \"vtex.pwa-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.pwa-graphql@1.16.0/public/@types/vtex.pwa-graphql\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.128.2/public/@types/vtex.render-runtime\",\n \"vtex.search-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-graphql@0.60.1/public/@types/vtex.search-graphql\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.139.0/public/@types/vtex.store-graphql\",\n \"vtex.store-resources\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-resources@0.78.0/public/@types/vtex.store-resources\"\n }\n}\n\n```"
}
] |
code_store-resources_2c59f910
|
[
{
"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 store-resources/react/QueryProduct.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport product from './queries/product.gql'\n\nexport default product\n\n```"
}
] |
code_store-resources_c878a470
|
[
{
"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 store-resources/react/QueryFacets.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport facets from './queries/facets.gql'\n\nexport default facets\n\n```"
}
] |
code_store-resources_2c952344
|
[
{
"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 store-resources/react/MutationUpdateItems.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport updateItems from './mutations/updateItems.gql'\n\nexport default updateItems\n\n```"
}
] |
code_store-resources_86b5cbca
|
[
{
"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 store-resources/react/QueryProductSearch.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport productSearch from './queries/productSearch.gql'\n\nexport default productSearch\n\n```"
}
] |
code_store-resources_3c099bb3
|
[
{
"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 store-resources/react/QuerySearchMetadataV2.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport searchMetadataV2 from './queries/searchMetadataV2.gql'\n\nexport default searchMetadataV2\n\n```"
}
] |
code_store-resources_a1862520
|
[
{
"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 store-resources/react/QueryFacetsV2.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport facetsV2 from './queries/facetsV2.gql'\n\nexport default facetsV2\n\n```"
}
] |
code_store-resources_06b0723d
|
[
{
"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 store-resources/react/QueryProductPreviewFragment.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport productPreviewFragment from './queries/productPreview.gql'\n\nexport default productPreviewFragment\n\n```"
}
] |
code_store-resources_1d81510a
|
[
{
"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 store-resources/react/PWAContext.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport React, {\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { Helmet, useRuntime } from 'vtex.render-runtime'\nimport { graphql } from 'react-apollo'\nimport { usePixel } from 'vtex.pixel-manager/PixelContext'\n\nimport pwaData from './queries/pwaData.gql'\n\nconst PWAContext = React.createContext(null)\n\nconst PWAProvider = ({ rootPath, children, data = {} }) => {\n const { manifest, iOSIcons, splashes, pwaSettings, loading, error } = data\n const { push } = usePixel()\n const { workspace } = useRuntime()\n\n const deferredPrompt = useRef(null)\n /* beforeinstallprompt event is fired even after the userChoice is to cancel (and there is no need to re-render) */\n const captured = useRef(false)\n\n const [alreadyInstalled, setAlreadyInstalled] = useState(false)\n const [installDismissed, setInstallDismissed] = useState(false)\n\n useEffect(() => {\n const handleBeforeInstall = e => {\n const { promptOnCustomEvent, disablePrompt } = pwaSettings\n\n if (promptOnCustomEvent !== 'default' && !captured.current) {\n e.preventDefault()\n\n if (disablePrompt) {\n return false\n }\n\n deferredPrompt.current = e\n captured.current = true\n\n return false\n }\n\n return true\n }\n\n window.addEventListener('beforeinstallprompt', handleBeforeInstall)\n\n return () =>\n window.removeEventListener('beforeinstallprompt', handleBeforeInstall)\n }, [captured, pwaSettings])\n\n useEffect(() => {\n const webAppInstalled = localStorage.getItem('webAppInstalled')\n\n if (webAppInstalled) {\n setAlreadyInstalled(webAppInstalled)\n }\n\n const webAppInstallDismissed = localStorage.getItem(\n 'webAppInstallDismissed'\n )\n\n if (webAppInstallDismissed) {\n setInstallDismissed(webAppInstallDismissed)\n }\n }, [])\n\n const showInstallPrompt = useCallback(() => {\n const prompt = deferredPrompt.current\n\n if (prompt) {\n prompt.prompt()\n prompt.userChoice.then(choiceResult => {\n if (choiceResult.outcome === 'accepted') {\n localStorage.setItem('webAppInstalled', 'true')\n } else {\n localStorage.setItem('webAppInstallDismissed', 'true')\n }\n\n push({\n event: 'installWebApp',\n userChoice: choiceResult.outcome,\n })\n deferredPrompt.current = null\n })\n }\n }, [])\n\n const context = useMemo(() => {\n if (pwaSettings) {\n const { disablePrompt, promptOnCustomEvent } = pwaSettings\n /* browsers for ios devices doesn't support install prompt */\n const isIOS =\n navigator && !!navigator.userAgent.match(/(iPod|iPhone|iPad)/)\n\n return {\n showInstallPrompt,\n settings: {\n promptOnCustomEvent:\n disablePrompt || isIOS || installDismissed || alreadyInstalled\n ? ''\n : promptOnCustomEvent,\n },\n }\n }\n }, [showInstallPrompt, pwaSettings, alreadyInstalled])\n\n const hasManifest = !loading && manifest && !error\n\n const manifestHrefSuffix =\n workspace === 'master' ? '' : `?workspace=${workspace}`\n\n return (\n <PWAContext.Provider value={context}>\n {hasManifest && (\n <Helmet\n meta={[\n { name: 'theme-color', content: manifest.theme_color },\n { name: 'apple-mobile-web-app-capable', content: 'yes' },\n ]}\n link={[\n {\n rel: 'manifest',\n href: `${rootPath}/pwa/manifest.json${manifestHrefSuffix}`,\n },\n ...(iOSIcons\n ? iOSIcons.map(icon => ({\n rel: 'apple-touch-icon',\n sizes: icon.sizes,\n href: `${rootPath}${icon.src}`,\n }))\n : []),\n ...(splashes\n ? splashes.map(splash => ({\n href: `${rootPath}${splash.src}`,\n sizes: splash.sizes,\n rel: 'apple-touch-startup-image',\n }))\n : []),\n ].filter(Boolean)}\n />\n )}\n {children}\n </PWAContext.Provider>\n )\n}\n\nconst usePWA = () => {\n return useContext(PWAContext)\n}\n\nconst options = {\n options: () => ({\n ssr: false,\n }),\n}\n\nexport default {\n PWAContext,\n PWAProvider: graphql(pwaData, options)(PWAProvider),\n usePWA,\n}\n\n```"
}
] |
code_store-resources_2869dd2d
|
[
{
"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 store-resources/react/Queries.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\n/** DEPRECATED, being kept just for retrocompatibility.\n * Create individual entry points for each query instead */\n\nimport orderForm from './queries/orderForm.gql'\nimport product from './queries/product.gql'\nimport productPreviewFragment from './queries/productPreview.gql'\nimport recommendationsAndBenefits from './queries/recommendationsAndBenefits.gql'\nimport search from './queries/search.gql'\nimport productSearch from './queries/productSearch.gql'\nimport productSearchV2 from './queries/productSearchV2.gql'\nimport session from './queries/session.gql'\nimport productBenefits from './queries/productBenefits.gql'\nimport address from './queries/address.gql'\nimport searchMetadata from './queries/searchMetadata.gql'\nimport productCategoryTree from './queries/UNSTABLE__productCategoryTree.gql'\nimport facets from './queries/facets.gql'\n\nexport default {\n address,\n orderForm,\n product,\n productSearch,\n productSearchV2,\n productPreviewFragment,\n recommendationsAndBenefits,\n search,\n session,\n productBenefits,\n UNSTABLE__productCategoryTree: productCategoryTree,\n searchMetadata,\n facets,\n}\n\n```"
}
] |
code_store-resources_15c19358
|
[
{
"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 store-resources/react/QuerySearchMetadata.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport searchMetadata from './queries/searchMetadata.gql'\n\nexport default searchMetadata\n\n```"
}
] |
code_store-resources_6361aa32
|
[
{
"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 store-resources/react/QueryTopSearches.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport topSearches from './queries/topSearches.gql'\n\nexport default topSearches\n\n```"
}
] |
code_store-resources_6638963d
|
[
{
"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 store-resources/react/QueryProducts.tsx from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { DocumentNode } from 'graphql'\n\nimport products from './queries/products.gql'\n\nexport default products as DocumentNode\n\n```"
}
] |
code_store-resources_d0f7d615
|
[
{
"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 store-resources/react/MutationUpdateOrderFormShipping.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport updateOrderFormShipping from './mutations/updateOrderFormShipping.gql'\n\nexport default updateOrderFormShipping\n\n```"
}
] |
code_store-resources_65c2e33d
|
[
{
"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 store-resources/react/QueryOrderForm.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport orderForm from './queries/orderForm.gql'\n\nexport default orderForm\n\n```"
}
] |
code_store-resources_f21db8db
|
[
{
"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 store-resources/react/QueryProductBenefits.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport productBenefits from './queries/productBenefits.gql'\n\nexport default productBenefits\n\n```"
}
] |
code_store-resources_5321996b
|
[
{
"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 store-resources/react/QueryUNSTABLEProductCategoryTree.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport productCategoryTree from './queries/UNSTABLE__productCategoryTree.gql'\n\nexport default productCategoryTree\n\n```"
}
] |
code_store-resources_a61e9975
|
[
{
"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 store-resources/react/QueryProductRecommendations.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport productRecommendations from './queries/productRecommendations.gql'\n\nexport default productRecommendations\n\n```"
}
] |
code_store-resources_09acbd6e
|
[
{
"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 store-resources/react/QuerySearch.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport search from './queries/search.gql'\n\nexport default search\n\n```"
}
] |
code_store-resources_441aa180
|
[
{
"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 store-resources/react/QueryAutocompleteSearchSuggestions.js from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport autocompleteSearchSuggestions from './queries/autocompleteSearchSuggestions.gql'\n\nexport default autocompleteSearchSuggestions\n\n```"
}
] |
code_store-resources_f2239db9
|
[
{
"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 store-resources/react/fragments/commertialOffer.graphql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nfragment CommertialOfferFragment on Offer {\n discountHighlights {\n name\n }\n teasers {\n name\n conditions {\n minimumQuantity\n parameters {\n name\n value\n }\n }\n effects {\n parameters {\n name\n value\n }\n }\n }\n Price\n ListPrice\n Tax\n taxPercentage\n spotPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n}\n\n```"
}
] |
code_store-resources_10fd6c14
|
[
{
"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 store-resources/react/fragments/CommertialOfferType.ts from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Offer } from 'vtex.search-graphql'\n\nexport type CommertialOfferFragment = Pick<\n Offer,\n | 'discountHighlights'\n | 'teasers'\n | 'Price'\n | 'ListPrice'\n | 'Tax'\n | 'taxPercentage'\n | 'spotPrice'\n | 'PriceWithoutDiscount'\n | 'RewardValue'\n | 'PriceValidUntil'\n | 'AvailableQuantity'\n>\n\nexport default {}\n\n```"
}
] |
code_store-resources_7f00f679
|
[
{
"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 store-resources/react/fragments/seller.graphql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nfragment SellerFragment on Seller {\n sellerId\n sellerName\n sellerDefault\n}\n\n```"
}
] |
code_store-resources_67e5bca4
|
[
{
"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 store-resources/react/fragments/ProductType.tsx from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { Product } from 'vtex.search-graphql'\n\nexport type ProductFragment = Pick<\n Product,\n | 'advertisement'\n | 'cacheId'\n | 'productId'\n | 'description'\n | 'productName'\n | 'productReference'\n | 'linkText'\n | 'brand'\n | 'brandId'\n | 'link'\n | 'categories'\n | 'priceRange'\n | 'specificationGroups'\n | 'skuSpecifications'\n | 'productClusters'\n | 'clusterHighlights'\n | 'properties'\n>\n\nexport default {}\n\n```"
}
] |
code_store-resources_acde3b4d
|
[
{
"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 store-resources/react/fragments/item.graphql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nfragment ItemFragment on SKU {\n itemId\n name\n nameComplete\n complementName\n ean\n variations {\n name\n values\n }\n referenceId {\n Key\n Value\n }\n measurementUnit\n unitMultiplier\n images {\n cacheId\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n}\n\n```"
}
] |
code_store-resources_8ff7f152
|
[
{
"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 store-resources/react/fragments/InstallmentType.ts from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Installment } from 'vtex.search-graphql'\n\nexport type InstallmentFragment = Pick<\n Installment,\n | 'Value'\n | 'InterestRate'\n | 'TotalValuePlusInterestRate'\n | 'NumberOfInstallments'\n | 'Name'\n | 'PaymentSystemName'\n>\n\nexport default {}\n\n```"
}
] |
code_store-resources_0be38d92
|
[
{
"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 store-resources/react/fragments/SellerType.ts from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Seller } from 'vtex.search-graphql'\n\nexport type SellerFragment = Pick<\n Seller,\n 'sellerId' | 'sellerName' | 'sellerDefault'\n>\n\nexport default {}\n\n```"
}
] |
code_store-resources_e4eb5026
|
[
{
"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 store-resources/react/fragments/installment.graphql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nfragment InstallmentFragment on Installment {\n Value\n InterestRate\n TotalValuePlusInterestRate\n NumberOfInstallments\n Name\n PaymentSystemName\n}\n\n```"
}
] |
code_store-resources_5c50cbe2
|
[
{
"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 store-resources/react/fragments/ItemType.ts from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Sku } from 'vtex.search-graphql'\n\nexport type SkuFragment = Pick<\n Sku,\n | 'itemId'\n | 'name'\n | 'nameComplete'\n | 'complementName'\n | 'ean'\n | 'variations'\n | 'referenceId'\n | 'measurementUnit'\n | 'unitMultiplier'\n | 'images'\n>\n\nexport default {}\n\n```"
}
] |
code_store-resources_807b5e87
|
[
{
"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 store-resources/react/fragments/product.graphql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nfragment ProductFragment on Product {\n advertisement {\n adId\n adResponseId\n adRequestId\n }\n cacheId\n productId\n description\n productName\n productReference\n linkText\n brand\n brandId\n link\n categories\n categoryId\n releaseDate\n priceRange {\n sellingPrice {\n highPrice\n lowPrice\n }\n listPrice {\n highPrice\n lowPrice\n }\n }\n specificationGroups {\n name\n originalName\n specifications {\n name\n originalName\n values\n }\n }\n skuSpecifications {\n field {\n name\n originalName\n }\n values {\n name\n originalName\n }\n }\n productClusters {\n id\n name\n }\n clusterHighlights {\n id\n name\n }\n properties {\n name\n values\n }\n}\n\n```"
}
] |
code_store-resources_a6fbb534
|
[
{
"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 store-resources/react/mutations/updateItems.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation updateItems($orderFormId: String, $items: [OrderFormItemInput]) {\n updateItems(orderFormId: $orderFormId, items: $items) {\n cacheId\n orderFormId\n value\n totalizers {\n id\n name\n value\n }\n items {\n id\n productId\n name\n imageUrl\n detailUrl\n productRefId\n additionalInfo {\n brandName\n }\n canHaveAttachment\n productCategoryIds\n productCategories\n skuName\n quantity\n sellingPrice\n listPrice\n parentItemIndex\n parentAssemblyBinding\n seller\n cartIndex\n sellingPriceWithAssemblies\n assemblyOptions {\n added {\n item {\n name\n sellingPrice\n quantity\n sellingPriceWithAssemblies\n assemblyOptions {\n added {\n item {\n name\n sellingPrice\n quantity\n sellingPriceWithAssemblies\n }\n normalizedQuantity\n choiceType\n extraQuantity\n }\n removed {\n removedQuantity\n initialQuantity\n name\n }\n parentPrice\n }\n }\n normalizedQuantity\n choiceType\n extraQuantity\n }\n removed {\n removedQuantity\n initialQuantity\n name\n }\n parentPrice\n }\n priceDefinition {\n calculatedSellingPrice\n total\n sellingPrices {\n quantity\n value\n }\n }\n }\n shippingData {\n address {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n }\n availableAddresses {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n }\n }\n clientProfileData {\n email\n firstName\n }\n storePreferencesData {\n countryCode\n currencyCode\n timeZone\n }\n checkedInPickupPointId\n isCheckedIn\n }\n}\n\n```"
}
] |
code_store-resources_7ec86cda
|
[
{
"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 store-resources/react/mutations/updateOrderFormCheckin.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation updateOrderFormCheckin(\n $orderFormId: String\n $checkin: OrderFormCheckinInput\n) {\n updateOrderFormCheckin(orderFormId: $orderFormId, checkin: $checkin) {\n isCheckedIn\n checkedInPickupPointId\n shippingData {\n selectedAddresses {\n id\n street\n number\n receiverName\n complement\n neighborhood\n country\n state\n geoCoordinates\n postalCode\n city\n reference\n addressName\n addressType\n }\n }\n }\n}\n```"
}
] |
code_store-resources_e69cadd0
|
[
{
"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 store-resources/react/mutations/updateOrderFormProfile.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation updateOrderFormProfile(\n $orderFormId: String\n $fields: OrderFormProfileInput\n) {\n updateOrderFormProfile(orderFormId: $orderFormId, fields: $fields) {\n orderFormId\n }\n}\n\n```"
}
] |
code_store-resources_e5a7d352
|
[
{
"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 store-resources/react/mutations/addToCart.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation addItem($orderFormId: String, $items: [OrderFormItemInput], $utmParams: OrderFormInputUTMParams, $utmiParams: OrderFormInputUTMIParams) {\n addItem(orderFormId: $orderFormId, items: $items, utmParams: $utmParams, utmiParams: $utmiParams) {\n cacheId\n orderFormId\n value\n totalizers {\n id\n name\n value\n }\n items {\n id\n productId\n name\n imageUrl\n detailUrl\n productRefId\n additionalInfo {\n brandName\n }\n canHaveAttachment\n productCategoryIds\n productCategories\n skuName\n quantity\n sellingPrice\n listPrice\n parentItemIndex\n parentAssemblyBinding\n seller\n cartIndex\n sellingPriceWithAssemblies\n assemblyOptions {\n added {\n item {\n name\n sellingPrice\n quantity\n sellingPriceWithAssemblies\n assemblyOptions {\n added {\n item {\n name\n sellingPrice\n quantity\n sellingPriceWithAssemblies\n }\n normalizedQuantity\n choiceType\n extraQuantity\n }\n removed {\n removedQuantity\n initialQuantity\n name\n }\n parentPrice\n }\n }\n normalizedQuantity\n choiceType\n extraQuantity\n }\n removed {\n removedQuantity\n initialQuantity\n name\n }\n parentPrice\n }\n priceDefinition {\n calculatedSellingPrice\n total\n sellingPrices {\n quantity\n value\n }\n }\n }\n shippingData {\n address {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n }\n availableAddresses {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n }\n }\n clientProfileData {\n email\n firstName\n }\n storePreferencesData {\n countryCode\n currencyCode\n timeZone\n }\n checkedInPickupPointId\n isCheckedIn\n }\n}\n\n```"
}
] |
code_store-resources_4fb9e107
|
[
{
"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 store-resources/react/mutations/updateOrderFormShipping.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation updateOrderFormShipping(\n $orderFormId: String\n $address: OrderFormAddressInput\n) {\n updateOrderFormShipping(orderFormId: $orderFormId, address: $address) {\n orderFormId\n isCheckedIn\n checkedInPickupPointId\n shippingData {\n address {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n geoCoordinates\n state\n receiverName\n country\n }\n availableAddresses {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n geoCoordinates\n state\n receiverName\n country\n }\n }\n }\n}\n\n```"
}
] |
code_store-resources_4bab711e
|
[
{
"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 store-resources/react/queries/recommendationsAndBenefits.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n# File deprecated. To be removed in next major!\nquery RecommendationsAndBenefits(\n $slug: String\n $identifier: ProductUniqueIdentifier\n) {\n product(slug: $slug, identifier: $identifier)\n @context(provider: \"vtex.search-graphql\") {\n cacheId\n recommendations {\n view {\n cacheId\n productId\n productName\n description\n link\n linkText\n brand\n items {\n name\n itemId\n referenceId {\n Value\n }\n images {\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n sellerId\n sellerName\n addToCartLink\n sellerDefault\n commertialOffer {\n Price\n ListPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n Tax\n CacheVersionUsedToCallCheckout\n Installments(criteria: MAX) {\n Value\n InterestRate\n TotalValuePlusInterestRate\n NumberOfInstallments\n Name\n PaymentSystemName\n }\n }\n }\n }\n }\n buy {\n cacheId\n productId\n productName\n description\n link\n linkText\n brand\n items {\n name\n itemId\n referenceId {\n Value\n }\n images {\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n sellerId\n sellerName\n addToCartLink\n sellerDefault\n commertialOffer {\n Price\n ListPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n Tax\n CacheVersionUsedToCallCheckout\n Installments(criteria: MAX) {\n Value\n InterestRate\n TotalValuePlusInterestRate\n NumberOfInstallments\n Name\n PaymentSystemName\n }\n }\n }\n }\n }\n similars {\n cacheId\n productId\n productName\n description\n link\n linkText\n brand\n items {\n name\n itemId\n referenceId {\n Value\n }\n images {\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n sellerId\n sellerName\n addToCartLink\n sellerDefault\n commertialOffer {\n Price\n ListPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n Tax\n CacheVersionUsedToCallCheckout\n Installments(criteria: MAX) {\n Value\n InterestRate\n TotalValuePlusInterestRate\n NumberOfInstallments\n Name\n PaymentSystemName\n }\n }\n }\n }\n }\n }\n benefits {\n featured\n id\n name\n items {\n benefitProduct {\n cacheId\n productName\n productId\n description\n linkText\n categoryId\n brand\n properties {\n name\n values\n }\n items {\n itemId\n name\n nameComplete\n complementName\n ean\n referenceId {\n Key\n Value\n }\n measurementUnit\n unitMultiplier\n images {\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n sellerId\n sellerName\n addToCartLink\n sellerDefault\n commertialOffer {\n Price\n ListPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n Tax\n CacheVersionUsedToCallCheckout\n Installments(criteria: MAX) {\n Value\n InterestRate\n TotalValuePlusInterestRate\n NumberOfInstallments\n Name\n PaymentSystemName\n }\n }\n }\n variations {\n name\n }\n }\n }\n discount\n minQuantity\n benefitSKUIds\n }\n teaserType\n }\n }\n}\n\n```"
}
] |
code_store-resources_d41254ff
|
[
{
"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 store-resources/react/queries/productRecommendations.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import '../fragments/product.graphql'\n#import '../fragments/item.graphql'\n#import '../fragments/seller.graphql'\n#import '../fragments/commertialOffer.graphql'\n#import '../fragments/installment.graphql'\n\nquery ProductRecommendations(\n $identifier: ProductUniqueIdentifier\n $type: CrossSelingInputEnum\n $searchState: String\n) {\n productRecommendations(\n identifier: $identifier\n type: $type\n searchState: $searchState\n ) @context(provider: \"vtex.search-graphql\") {\n ...ProductFragment\n items {\n ...ItemFragment\n sellers {\n ...SellerFragment\n commertialOffer {\n ...CommertialOfferFragment\n Installments(criteria: MAX) {\n ...InstallmentFragment\n }\n }\n }\n }\n }\n}\n\n```"
}
] |
code_store-resources_4de443cb
|
[
{
"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 store-resources/react/queries/product.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import '../fragments/product.graphql'\n#import '../fragments/item.graphql'\n#import '../fragments/seller.graphql'\n#import '../fragments/commertialOffer.graphql'\n#import '../fragments/installment.graphql'\n\nquery Product(\n $slug: String\n $identifier: ProductUniqueIdentifier\n $skipCategoryTree: Boolean = false\n) {\n product(slug: $slug, identifier: $identifier)\n @context(provider: \"vtex.search-graphql\") {\n ...ProductFragment\n titleTag\n metaTagDescription\n categoryId\n categoryTree @skip(if: $skipCategoryTree) {\n id\n name\n href\n }\n items {\n ...ItemFragment\n videos {\n videoUrl\n }\n sellers {\n ...SellerFragment\n addToCartLink\n sellerDefault\n commertialOffer {\n ...CommertialOfferFragment\n CacheVersionUsedToCallCheckout\n Installments {\n ...InstallmentFragment\n }\n }\n }\n kitItems {\n itemId\n amount\n product {\n productName\n productId\n description\n linkText\n categoryTree {\n id\n name\n href\n }\n categoryId\n brand\n properties {\n name\n values\n }\n }\n sku {\n itemId\n name\n referenceId {\n Key\n Value\n }\n images {\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n ...SellerFragment\n addToCartLink\n sellerDefault\n commertialOffer {\n ...CommertialOfferFragment\n Installments(criteria: MAX) {\n ...InstallmentFragment\n }\n }\n }\n }\n }\n attachments {\n id\n name\n required\n }\n estimatedDateArrival\n }\n itemMetadata {\n items {\n id\n name\n imageUrl\n seller\n assemblyOptions {\n id\n name\n required\n inputValues {\n label\n maxLength\n type\n domain\n defaultValue\n }\n composition {\n minQuantity\n maxQuantity\n items {\n id\n minQuantity\n maxQuantity\n priceTable\n seller\n initialQuantity\n }\n }\n }\n }\n priceTable {\n type\n values {\n id\n assemblyId\n price\n }\n }\n }\n }\n}\n\n```"
}
] |
code_store-resources_369ad268
|
[
{
"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 store-resources/react/queries/searchSuggestions.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery searchSuggestions($fullText: String!, $searchState: String) {\n searchSuggestions(fullText: $fullText, searchState: $searchState)\n @context(provider: \"vtex.search-graphql\") {\n searches {\n term\n count\n }\n }\n}\n\n```"
}
] |
code_store-resources_91524185
|
[
{
"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 store-resources/react/queries/productBenefits.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery ProductBenefits($slug: String, $identifier: ProductUniqueIdentifier) {\n product(slug: $slug, identifier: $identifier)\n @context(provider: \"vtex.search-graphql\") {\n cacheId\n benefits {\n featured\n id\n name\n items {\n benefitProduct {\n cacheId\n productName\n productId\n description\n linkText\n categoryId\n brand\n properties {\n name\n values\n }\n specificationGroups {\n name\n originalName\n specifications {\n name\n originalName\n values\n }\n }\n items {\n itemId\n name\n nameComplete\n complementName\n ean\n referenceId {\n Key\n Value\n }\n measurementUnit\n unitMultiplier\n images {\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n sellerId\n sellerName\n addToCartLink\n sellerDefault\n commertialOffer {\n Price\n ListPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n Tax\n CacheVersionUsedToCallCheckout\n Installments {\n Value\n InterestRate\n TotalValuePlusInterestRate\n NumberOfInstallments\n Name\n PaymentSystemName\n }\n }\n }\n variations {\n name\n }\n }\n }\n discount\n minQuantity\n benefitSKUIds\n }\n teaserType\n }\n }\n}\n\n```"
}
] |
code_store-resources_2629e719
|
[
{
"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 store-resources/react/queries/productSearch.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery productSearch(\n $query: String\n $map: String\n $facetQuery: String\n $facetMap: String\n $orderBy: String\n $priceRange: String\n $from: Int\n $to: Int\n $withFacets: Boolean = true\n) {\n products(\n query: $query\n map: $map\n orderBy: $orderBy\n priceRange: $priceRange\n from: $from\n to: $to\n ) @context(provider: \"vtex.search-graphql\") {\n cacheId\n productId\n description\n productName\n linkText\n brand\n link\n items {\n itemId\n name\n nameComplete\n complementName\n ean\n referenceId {\n Key\n Value\n }\n measurementUnit\n unitMultiplier\n images {\n cacheId\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n sellerId\n sellerName\n commertialOffer {\n discountHighlights {\n name\n }\n Price\n ListPrice\n Tax\n taxPercentage\n spotPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n }\n }\n }\n productClusters {\n id\n name\n }\n }\n facets(query: $facetQuery, map: $facetMap)\n @include(if: $withFacets)\n @context(provider: \"vtex.search-graphql\") {\n departments {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n brands {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n specificationFilters {\n name\n facets {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n }\n categoriesTrees {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n }\n }\n }\n priceRanges {\n quantity\n name\n link\n linkEncoded\n slug\n map\n }\n recordsFiltered\n # Backwards compatibility with search-result v3\n Departments {\n Quantity\n Name\n Link\n }\n Brands {\n Quantity\n Name\n Link\n }\n SpecificationFilters {\n name\n facets {\n Quantity\n Name\n Link\n }\n }\n CategoriesTrees {\n Id\n Quantity\n Name\n Link\n href\n name\n Children {\n Id\n Quantity\n Name\n Link\n href\n name\n Children {\n Id\n Quantity\n Name\n Link\n href\n name\n }\n }\n }\n PriceRanges {\n Quantity\n Name\n Link\n Slug\n }\n }\n}\n\n```"
}
] |
code_store-resources_a0f67bf8
|
[
{
"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 store-resources/react/queries/recommendationShelf.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import '../fragments/product.graphql'\n#import '../fragments/item.graphql'\n#import '../fragments/seller.graphql'\n#import '../fragments/commertialOffer.graphql'\n#import '../fragments/installment.graphql'\n\nfragment RecommendationProductFragment on Product {\n ...ProductFragment\n items {\n ...ItemFragment\n sellers {\n ...SellerFragment\n commertialOffer {\n ...CommertialOfferFragment\n Installments {\n ...InstallmentFragment\n }\n }\n }\n }\n}\n\nquery recommendation($input: RecommendationInput) {\n recommendation(input: $input)\n @context(provider: \"vtex.recommendation-graphql\") {\n products {\n ...RecommendationProductFragment\n }\n jwt\n }\n}\n\n```"
}
] |
code_store-resources_08a4c9c2
|
[
{
"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 store-resources/react/queries/orderForm.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery orderForm {\n orderForm @context(scope: \"private\") {\n cacheId\n sellers {\n id\n name\n }\n orderFormId\n userProfileId\n customData {\n customApps {\n id\n fields\n }\n }\n itemMetadata {\n items {\n id\n name\n assemblyOptions {\n id\n name\n composition {\n items {\n id\n seller\n }\n }\n }\n }\n priceTable {\n type\n values {\n id\n price\n }\n }\n }\n value\n totalizers {\n id\n name\n value\n }\n items {\n id\n productId\n name\n imageUrl\n detailUrl\n productRefId\n additionalInfo {\n brandName\n }\n canHaveAttachment\n productCategoryIds\n productCategories\n skuName\n quantity\n sellingPrice\n listPrice\n parentItemIndex\n parentAssemblyBinding\n cartIndex\n sellingPriceWithAssemblies\n assemblyOptions {\n added {\n item {\n name\n sellingPrice\n quantity\n sellingPriceWithAssemblies\n assemblyOptions {\n added {\n item {\n name\n sellingPrice\n quantity\n sellingPriceWithAssemblies\n }\n normalizedQuantity\n choiceType\n extraQuantity\n }\n removed {\n removedQuantity\n initialQuantity\n name\n }\n parentPrice\n }\n }\n normalizedQuantity\n choiceType\n extraQuantity\n }\n removed {\n removedQuantity\n initialQuantity\n name\n }\n parentPrice\n }\n seller\n priceDefinition {\n calculatedSellingPrice\n total\n sellingPrices {\n quantity\n value\n }\n }\n }\n shippingData {\n address {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n geoCoordinates\n state\n receiverName\n country\n }\n availableAddresses {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n geoCoordinates\n state\n receiverName\n country\n }\n }\n clientProfileData {\n email\n firstName\n lastName\n }\n storePreferencesData {\n countryCode\n currencyCode\n timeZone\n }\n checkedInPickupPointId\n isCheckedIn\n }\n}\n\n```"
}
] |
code_store-resources_b68de4d9
|
[
{
"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 store-resources/react/queries/pwaData.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery pwaData {\n pwaSettings {\n disablePrompt\n promptOnCustomEvent\n }\n manifest {\n theme_color\n }\n iOSIcons {\n src\n type\n sizes\n }\n splashes {\n src\n type\n sizes\n }\n}\n```"
}
] |
code_store-resources_5c44f35f
|
[
{
"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 store-resources/react/queries/search.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery search(\n $query: String\n $map: String\n $rest: String\n $orderBy: String\n $priceRange: String\n $from: Int\n $to: Int\n $withFacets: Boolean = true\n) {\n search(\n query: $query\n map: $map\n rest: $rest\n orderBy: $orderBy\n priceRange: $priceRange\n from: $from\n to: $to\n ) @context(provider: \"vtex.store-graphql\") {\n titleTag\n metaTagDescription\n facets @include(if: $withFacets) {\n Departments {\n Quantity\n Name\n Link\n }\n Brands {\n Quantity\n Name\n Link\n }\n SpecificationFilters {\n name\n facets {\n Quantity\n Name\n Link\n }\n }\n CategoriesTrees {\n Id\n Quantity\n Name\n Link\n href\n name\n Children {\n Id\n Quantity\n Name\n Link\n href\n name\n Children {\n Id\n Quantity\n Name\n Link\n href\n name\n }\n }\n }\n PriceRanges {\n Quantity\n Name\n Link\n Slug\n }\n }\n products {\n cacheId\n categories\n categoryTree {\n name\n href\n }\n productId\n description\n productName\n linkText\n brand\n link\n items {\n itemId\n name\n nameComplete\n complementName\n ean\n referenceId {\n Key\n Value\n }\n measurementUnit\n unitMultiplier\n images {\n cacheId\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n sellerId\n sellerName\n commertialOffer {\n discountHighlights {\n name\n }\n Price\n ListPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n }\n }\n }\n productClusters {\n id\n name\n }\n }\n recordsFiltered\n }\n}\n\n```"
}
] |
code_store-resources_4e62e6db
|
[
{
"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 store-resources/react/queries/searchMetadata.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery SearchMetadata($query: String, $map: String) {\n searchMetadata(query: $query, map: $map)\n @context(provider: \"vtex.search-graphql\") {\n titleTag\n metaTagDescription\n }\n}\n\n```"
}
] |
code_store-resources_980d633a
|
[
{
"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 store-resources/react/queries/itemsWithSimulation.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery itemsWithSimulation($items: [ItemInput]) {\n itemsWithSimulation(items: $items) {\n itemId\n sellers {\n sellerId\n commertialOffer {\n AvailableQuantity\n Price\n ListPrice\n PriceValidUntil\n Installments {\n \tValue\n InterestRate\n TotalValuePlusInterestRate\n NumberOfInstallments\n \t}\n }\n }\n }\n}\n\n```"
}
] |
code_store-resources_70bfb342
|
[
{
"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 store-resources/react/queries/facets.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery facets(\n $query: String\n $map: String\n $hideUnavailableItems: Boolean = false\n $behavior: String = \"Static\"\n) {\n facets(query: $query, map: $map, hideUnavailableItems: $hideUnavailableItems, behavior: $behavior)\n @context(provider: \"vtex.search-graphql\") {\n departments {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n brands {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n specificationFilters {\n name\n facets {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n }\n categoriesTrees {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n }\n }\n }\n }\n }\n priceRanges {\n quantity\n name\n link\n linkEncoded\n slug\n map\n }\n queryArgs {\n query\n map\n }\n }\n}\n\n```"
}
] |
code_store-resources_7498d804
|
[
{
"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 store-resources/react/queries/sponsoredProducts.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import '../fragments/product.graphql'\n#import '../fragments/item.graphql'\n#import '../fragments/seller.graphql'\n#import '../fragments/commertialOffer.graphql'\n#import '../fragments/installment.graphql'\n\nquery sponsoredProducts(\n $fullText: String\n $selectedFacets: [SelectedFacetInput]\n $orderBy: String\n $from: Int\n $to: Int\n $hideUnavailableItems: Boolean = false\n $skusFilter: ItemsFilter = ALL_AVAILABLE\n $simulationBehavior: SimulationBehavior = default\n $installmentCriteria: InstallmentsCriteria = MAX_WITHOUT_INTEREST\n $productOriginVtex: Boolean = false\n $fuzzy: String\n $operator: Operator\n $searchState: String\n $excludedPaymentSystems: [String]\n $includedPaymentSystems: [String]\n $anonymousId: String\n) {\n sponsoredProducts(\n fullText: $fullText\n selectedFacets: $selectedFacets\n orderBy: $orderBy\n from: $from\n to: $to\n hideUnavailableItems: $hideUnavailableItems\n simulationBehavior: $simulationBehavior\n productOriginVtex: $productOriginVtex\n fuzzy: $fuzzy\n operator: $operator\n searchState: $searchState\n anonymousId: $anonymousId\n ) @context(provider: \"vtex.search-graphql\") {\n ...ProductFragment\n advertisement {\n adId\n campaignId\n actionCost\n adRequestId\n adResponseId\n }\n items(filter: $skusFilter) {\n ...ItemFragment\n sellers {\n ...SellerFragment\n commertialOffer {\n ...CommertialOfferFragment\n Installments(\n criteria: $installmentCriteria\n excludedPaymentSystems: $excludedPaymentSystems\n includedPaymentSystems: $includedPaymentSystems\n ) {\n ...InstallmentFragment\n }\n }\n }\n }\n selectedProperties {\n key\n value\n }\n rule {\n id\n }\n }\n}\n\n```"
}
] |
code_store-resources_acf49f7d
|
[
{
"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 store-resources/react/queries/facetsV2.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery facetsV2(\n $query: String\n $fullText: String\n $selectedFacets: [SelectedFacetInput]\n $hideUnavailableItems: Boolean = false\n $behavior: String = \"Static\"\n $categoryTreeBehavior: CategoryTreeBehavior = default\n $fuzzy: String\n $operator: Operator\n $searchState: String\n $from: Int\n $to: Int\n $initialAttributes: String\n $variant: String\n) {\n facets(\n query: $query\n fullText: $fullText\n selectedFacets: $selectedFacets\n hideUnavailableItems: $hideUnavailableItems\n behavior: $behavior\n categoryTreeBehavior: $categoryTreeBehavior\n fuzzy: $fuzzy\n operator: $operator\n searchState: $searchState\n initialAttributes: $initialAttributes\n variant: $variant\n ) @context(provider: \"vtex.search-graphql\") {\n sampling\n breadcrumb {\n name\n href\n }\n facets {\n name\n type\n hidden\n quantity\n facets: values (from: $from, to: $to) {\n id\n quantity\n name\n key\n selected\n value\n link\n linkEncoded\n href\n range {\n from\n to\n }\n children {\n id\n quantity\n name\n key\n selected\n value\n link\n linkEncoded\n href\n children {\n id\n quantity\n name\n key\n selected\n value\n link\n linkEncoded\n href\n children {\n id\n quantity\n name\n key\n selected\n value\n link\n linkEncoded\n href\n children {\n id\n quantity\n name\n key\n selected\n value\n link\n linkEncoded\n href\n }\n }\n }\n }\n }\n }\n queryArgs {\n query\n selectedFacets {\n key\n value\n }\n }\n }\n}\n\n```"
}
] |
code_store-resources_e5485c0b
|
[
{
"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 store-resources/react/queries/session.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery Session {\n getSession {\n id\n adminUserId\n impersonable\n adminUserEmail\n address {\n cacheId\n id\n addressId\n userId\n receiverName\n complement\n neighborhood\n country\n state\n number\n street\n geoCoordinates\n postalCode\n city\n reference\n addressName\n addressType\n }\n profile {\n id\n firstName\n lastName\n email\n }\n impersonate {\n profile {\n phone\n email\n lastName\n document\n firstName\n }\n }\n }\n}\n\n```"
}
] |
code_store-resources_af25f81c
|
[
{
"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 store-resources/react/queries/address.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery address {\n orderForm {\n pickupPointCheckedIn {\n friendlyName\n }\n cacheId\n orderFormId\n shippingData {\n address {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n geoCoordinates\n state\n receiverName\n country\n }\n availableAddresses {\n id\n neighborhood\n complement\n number\n street\n postalCode\n city\n reference\n addressName\n addressType\n geoCoordinates\n state\n receiverName\n country\n }\n }\n }\n}\n\n```"
}
] |
code_store-resources_6acbb3aa
|
[
{
"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 store-resources/react/queries/banners.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery banners($fullText: String, $selectedFacets: [SelectedFacetInput]) {\n banners(fullText: $fullText, selectedFacets: $selectedFacets)\n @context(provider: \"vtex.search-graphql\") {\n banners {\n id\n name\n area\n html\n }\n }\n}\n\n```"
}
] |
code_store-resources_5981b490
|
[
{
"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 store-resources/react/queries/productSearchV2.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import '../fragments/product.graphql'\n#import '../fragments/item.graphql'\n#import '../fragments/seller.graphql'\n#import '../fragments/commertialOffer.graphql'\n#import '../fragments/installment.graphql'\n\nquery productSearchV2(\n $query: String\n $map: String\n $facetQuery: String\n $facetMap: String\n $category: String\n $collection: String\n $specificationFilters: [String]\n $orderBy: String\n $priceRange: String\n $from: Int\n $to: Int\n $withFacets: Boolean = true\n $hideUnavailableItems: Boolean = false\n $skusFilter: ItemsFilter = ALL_AVAILABLE\n $simulationBehavior: SimulationBehavior = default\n $installmentCriteria: InstallmentsCriteria = MAX_WITHOUT_INTEREST\n) {\n productSearch(\n query: $query\n map: $map\n category: $category\n collection: $collection\n specificationFilters: $specificationFilters\n orderBy: $orderBy\n priceRange: $priceRange\n from: $from\n to: $to\n hideUnavailableItems: $hideUnavailableItems\n simulationBehavior: $simulationBehavior\n ) @context(provider: \"vtex.search-graphql\") {\n products {\n ...ProductFragment\n items(filter: $skusFilter) {\n ...ItemFragment\n sellers {\n ...SellerFragment\n commertialOffer {\n ...CommertialOfferFragment\n Installments(criteria: $installmentCriteria) {\n ...InstallmentFragment\n }\n }\n }\n }\n }\n recordsFiltered\n breadcrumb {\n name\n href\n }\n }\n facets(\n query: $facetQuery\n map: $facetMap\n hideUnavailableItems: $hideUnavailableItems\n ) @include(if: $withFacets) @context(provider: \"vtex.search-graphql\") {\n departments {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n brands {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n specificationFilters {\n name\n facets {\n quantity\n name\n link\n linkEncoded\n map\n selected\n value\n }\n }\n categoriesTrees {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n children {\n id\n quantity\n name\n link\n href\n linkEncoded\n map\n selected\n value\n }\n }\n }\n }\n }\n priceRanges {\n quantity\n name\n link\n linkEncoded\n slug\n map\n }\n }\n}\n\n```"
}
] |
code_store-resources_235ce64e
|
[
{
"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 store-resources/react/queries/productSearchV3.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import '../fragments/product.graphql'\n#import '../fragments/item.graphql'\n#import '../fragments/seller.graphql'\n#import '../fragments/commertialOffer.graphql'\n#import '../fragments/installment.graphql'\n\nquery productSearchV3(\n $query: String\n $fullText: String\n $selectedFacets: [SelectedFacetInput]\n $orderBy: String\n $from: Int\n $to: Int\n $hideUnavailableItems: Boolean = false\n $skusFilter: ItemsFilter = ALL_AVAILABLE\n $simulationBehavior: SimulationBehavior = default\n $installmentCriteria: InstallmentsCriteria = MAX_WITHOUT_INTEREST\n $productOriginVtex: Boolean = false\n $fuzzy: String\n $operator: Operator\n $searchState: String\n $excludedPaymentSystems: [String]\n $includedPaymentSystems: [String]\n $variant: String\n $showSponsored: Boolean\n $advertisementOptions: AdvertisementOptions\n $origin: String\n) {\n productSearch(\n query: $query\n fullText: $fullText\n selectedFacets: $selectedFacets\n orderBy: $orderBy\n from: $from\n to: $to\n hideUnavailableItems: $hideUnavailableItems\n simulationBehavior: $simulationBehavior\n productOriginVtex: $productOriginVtex\n fuzzy: $fuzzy\n operator: $operator\n searchState: $searchState\n variant: $variant\n showSponsored: $showSponsored\n advertisementOptions: $advertisementOptions\n origin: $origin\n ) @context(provider: \"vtex.search-graphql\") {\n products {\n ...ProductFragment\n advertisement {\n adId\n campaignId\n actionCost\n adRequestId\n adResponseId\n }\n items(filter: $skusFilter) {\n ...ItemFragment\n sellers {\n ...SellerFragment\n commertialOffer {\n ...CommertialOfferFragment\n Installments(\n criteria: $installmentCriteria\n excludedPaymentSystems: $excludedPaymentSystems\n includedPaymentSystems: $includedPaymentSystems\n ) {\n ...InstallmentFragment\n }\n }\n }\n }\n selectedProperties {\n key\n value\n }\n rule {\n id\n }\n deliveryPromisesBadges {\n typeName\n pickupId\n pickupName\n }\n specification\n }\n recordsFiltered\n correction {\n misspelled\n }\n breadcrumb {\n name\n href\n }\n fuzzy\n operator\n searchState\n redirect\n options {\n deliveryPromisesEnabled\n }\n searchId\n }\n}\n\n```"
}
] |
code_store-resources_528b2c5b
|
[
{
"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 store-resources/react/queries/productSuggestions.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import '../fragments/product.graphql'\n#import '../fragments/item.graphql'\n#import '../fragments/seller.graphql'\n#import '../fragments/commertialOffer.graphql'\n#import '../fragments/installment.graphql'\n\nquery productSuggestions(\n $fullText: String!\n $facetKey: String\n $facetValue: String\n $origin: String\n $productOriginVtex: Boolean = false\n $simulationBehavior: SimulationBehavior = default\n $hideUnavailableItems: Boolean = false\n $orderBy: String\n $count: Int\n $shippingOptions: [String]\n $variant: String\n $advertisementOptions: AdvertisementOptions\n) {\n productSuggestions(\n fullText: $fullText\n facetKey: $facetKey\n facetValue: $facetValue\n origin: $origin\n productOriginVtex: $productOriginVtex\n simulationBehavior: $simulationBehavior\n hideUnavailableItems: $hideUnavailableItems\n orderBy: $orderBy\n count: $count\n shippingOptions: $shippingOptions\n variant: $variant\n advertisementOptions: $advertisementOptions\n ) @context(provider: \"vtex.search-graphql\") {\n count\n misspelled\n operator\n products {\n ...ProductFragment\n items {\n ...ItemFragment\n sellers {\n ...SellerFragment\n commertialOffer {\n ...CommertialOfferFragment\n Installments {\n ...InstallmentFragment\n }\n }\n }\n }\n selectedProperties {\n key\n value\n }\n rule {\n id\n }\n specification\n }\n searchId\n }\n}\n\n```"
}
] |
code_store-resources_59089b29
|
[
{
"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 store-resources/react/queries/searchMetadataV2.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery SearchMetadataV2(\n $query: String\n $selectedFacets: [SelectedFacetInput]\n $fullText: String\n) {\n searchMetadata(\n query: $query\n selectedFacets: $selectedFacets\n fullText: $fullText\n ) @context(provider: \"vtex.search-graphql\") {\n titleTag\n metaTagDescription\n }\n}\n\n```"
}
] |
code_store-resources_72b2eed0
|
[
{
"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 store-resources/react/queries/topSearches.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery topSearches($searchState: String) {\n topSearches(searchState: $searchState)\n @context(provider: \"vtex.search-graphql\") {\n searches {\n term\n }\n }\n}\n\n```"
}
] |
code_store-resources_b3b7702c
|
[
{
"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 store-resources/react/queries/correction.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery correction($fullText: String) {\n correction(fullText: $fullText) @context(provider: \"vtex.search-graphql\") {\n correction {\n text\n highlighted\n misspelled\n correction\n }\n }\n}\n\n```"
}
] |
code_store-resources_e177cf1d
|
[
{
"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 store-resources/react/queries/autocompleteSearchSuggestions.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery autocompleteSearchSuggestions($fullText: String!, $searchState: String) {\n autocompleteSearchSuggestions(fullText: $fullText, searchState: $searchState)\n @context(provider: \"vtex.search-graphql\") {\n searches {\n term\n attributes {\n key\n value\n labelValue\n }\n }\n }\n}\n\n```"
}
] |
code_store-resources_2bfd29ce
|
[
{
"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 store-resources/react/queries/UNSTABLE__productCategoryTree.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery ProductCategoryTree($slug: String, $identifier: ProductUniqueIdentifier) {\n product(slug: $slug, identifier: $identifier)\n @context(provider: \"vtex.search-graphql\") {\n cacheId\n categoryTree {\n id\n name\n href\n }\n }\n}\n\n```"
}
] |
code_store-resources_ea1f6221
|
[
{
"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 store-resources/react/queries/products.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\n#import '../fragments/product.graphql'\n#import '../fragments/item.graphql'\n#import '../fragments/seller.graphql'\n#import '../fragments/commertialOffer.graphql'\n#import '../fragments/installment.graphql'\n\nquery Products(\n $category: String\n $collection: String\n $specificationFilters: [String]\n $shippingOptions: [String]\n $orderBy: String\n $from: Int\n $to: Int\n $hideUnavailableItems: Boolean = false\n $skusFilter: ItemsFilter = ALL_AVAILABLE\n $installmentCriteria: InstallmentsCriteria = MAX_WITHOUT_INTEREST\n $variant: String\n $searchState: String\n $advertisementOptions: AdvertisementOptions\n) {\n products(\n category: $category\n collection: $collection\n specificationFilters: $specificationFilters\n shippingOptions: $shippingOptions\n orderBy: $orderBy\n from: $from\n to: $to\n advertisementOptions: $advertisementOptions\n hideUnavailableItems: $hideUnavailableItems\n variant: $variant\n searchState: $searchState\n ) @context(provider: \"vtex.search-graphql\") {\n ...ProductFragment\n items(filter: $skusFilter) {\n ...ItemFragment\n sellers {\n ...SellerFragment\n commertialOffer {\n ...CommertialOfferFragment\n Installments(criteria: $installmentCriteria) {\n ...InstallmentFragment\n }\n }\n }\n }\n rule {\n id\n }\n }\n}\n\n```"
}
] |
code_store-resources_16a54e96
|
[
{
"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 store-resources/react/queries/productPreview.gql from the store-resources VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nfragment product on Product {\n cacheId\n productId\n productName\n linkText\n titleTag\n metaTagDescription\n categories\n categoryTree {\n name\n href\n }\n items {\n itemId\n name\n nameComplete\n complementName\n ean\n referenceId {\n Key\n Value\n }\n measurementUnit\n unitMultiplier\n images {\n imageId\n imageLabel\n imageTag\n imageUrl\n imageText\n }\n sellers {\n sellerId\n sellerName\n commertialOffer {\n Price\n ListPrice\n PriceWithoutDiscount\n RewardValue\n PriceValidUntil\n AvailableQuantity\n }\n }\n }\n}\n\n```"
}
] |
code_product-list-context_20d1dd77
|
[
{
"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 product-list-context/docs/README.md from the product-list-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, contribute to it or open issues to help evolve it using Store Discussion.\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\n# Product List Context\n\nThe Product List Context is responsible for storing product data from an app and then providing it to specific store product components, such as the Shelf.\n\n⚠️ This app is not rendered and should only be used to provide product data to specific store blocks.\n\n## Configuration\n\nAdd the `product-list-context` app to the app's dependencies list (in the `manifest.json`) from which you want fetch product data. For example:\n\n```json\n\"dependencies\": {\n \"vtex.product-list-context\": \"0.x\"\n}\n```\n\n| Prop name | Type | Description | Default Value |\n| --- | --- | --- | --- |\n| `listName` | `string` | The list that you are providing the products (e.g. `Home Shelf` or `Search Result`) | `'List of products'` |\n\n\nIn the app's files, use the `ProductListProvider` to initialise the context. You'll need to wrap the file's rendered component with the provider in order for its children to have access to the context's data. For example:\n\n```tsx\nreturn (\n <div ref={ref} className={`${handles.container} pv4 pb9`}>\n <ProductListProvider listName=\"Shelf\">\n <ProductList {...productListProps} />\n </ProductListProvider>\n </div>\n)\n```\n\nThe Product List Context state is comprised of a object with the following properties: `nextImpressions`: List of products that are going to be sent on the product impression event.\n`sentIds`: Set of the IDs of the products that were already impressed or are marked to be impressed.\n\nYou can use two Hooks to handle the data contained in the Product List Context object: `useProductListState` and `useProductListDispatch`.\n\n`useProductListState`: used to get the data stored in the context. In order to use it, you need to first import and then call the hook anywhere in any file under the component which is wrapped by ProductListProvider. For example:\n\n```tsx\nimport { ProductListContext } from 'vtex.product-list-context'\n\n//...\n\n const { useProductListState } = ProductListContext\n const { nextImpressions } = useProductListState()\n```\n\n`useProductListDispatch`: returns a dispatch function that is used to change the context state. Notice that you should only import and declare this hook if you wish to change data that's stored in the context.\n\n```tsx\nimport { ProductListContext } from 'vtex.product-list-context'\n\n//...\n\n const { useProductListDispatch } = ProductListContext\n const dispatch = useProductListDispatch()\n```\n\nStarting from the dispatch function, you can add new values to the `nextImpressions` array (`SEND_IMPRESSION`) or reset this array (`RESET_NEXT_IMPRESSIONS`). For example:\n\n```tsx\nconst dispatch = useProductListDispatch() useEffect(() => {\n if (inView) {\n dispatch({ type: 'SEND_IMPRESSION', args: { product: product }})\n }\n}, [inView])\n```\n\nThis app also contains `useProductImpression`, which is a hook that you can call when you want to send impression events of the products in the `nextImpressions` array. For example:\n\n```tsx\nimport { useProductImpression } from 'vtex.product-list-context'\n\n//...\n\n useProductImpression()\n```\n\nWhen calling this hook, the `product-list-context` will always check if there is anything in the `nextImpressions` array. If there is, and the array doesn't change for one second, all the products in it will be impressed and the array will be reseted.\n\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<!-- 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 are welcome!\n\n```"
}
] |
code_product-list-context_ae1d6eb2
|
[
{
"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 product-list-context/react/ProductListContext.tsx from the product-list-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React, { useReducer, useContext, createContext, useEffect } from 'react'\n\nexport interface Product {\n productId: string\n [key: string]: any\n}\nexport interface State {\n nextImpressions: Array<{\n product: Product\n impressionIndex: number\n originalIndex: number\n }>\n sentIds: Map<string, { position: number }>\n listName?: string\n}\n\ninterface SendImpressionAction {\n type: 'SEND_IMPRESSION'\n args: { product: Product; position?: number }\n}\n\ninterface ResetNextImpressionsAction {\n type: 'RESET_NEXT_IMPRESSIONS'\n}\n\ninterface SetListNameAction {\n type: 'SET_LIST_NAME'\n args: { listName: string }\n}\n\ntype ReducerActions =\n | SendImpressionAction\n | ResetNextImpressionsAction\n | SetListNameAction\n\nexport type Dispatch = (action: ReducerActions) => void\n\nconst DEFAULT_STATE: State = {\n nextImpressions: [],\n sentIds: new Map<string, { position: number }>(),\n}\n\nconst ProductListStateContext = createContext<State>(DEFAULT_STATE)\nconst ProductListDispatchContext = createContext<Dispatch>((action) => {\n console.error('error in dispatch ', action)\n})\n\nfunction productListReducer(state: State, action: ReducerActions): State {\n switch (action.type) {\n case 'SEND_IMPRESSION': {\n const { product, position: originalIndex = 0 } = action.args\n let { nextImpressions } = state\n\n // ignore already sent impressions\n if (state.sentIds.has(product.productId)) {\n return state\n }\n\n const position = state.sentIds.size + 1\n\n state.sentIds.set(product.productId, { position })\n\n const nextImpressionsFirstPosition =\n state.nextImpressions[0]?.impressionIndex ?? position\n\n nextImpressions = state.nextImpressions\n .concat({\n product,\n impressionIndex: position,\n originalIndex,\n })\n .sort(\n (\n { originalIndex: originalIndexA },\n { originalIndex: originalIndexB }\n ) => originalIndexA - originalIndexB\n )\n .map((impression, index) => ({\n ...impression,\n impressionIndex: nextImpressionsFirstPosition + index,\n }))\n\n return {\n ...state,\n nextImpressions,\n }\n }\n\n case 'RESET_NEXT_IMPRESSIONS': {\n return {\n ...state,\n nextImpressions: [],\n }\n }\n\n case 'SET_LIST_NAME': {\n // When setting a new list name, we should also reset `sentIds`, since\n // this indicates we're dealing with a brand new list.\n if (action.args.listName !== state.listName) {\n return {\n ...state,\n listName: action.args.listName,\n sentIds: new Map(),\n }\n }\n\n return state\n }\n\n default: {\n throw new Error(`Unhandled action type on product-list-context`)\n }\n }\n}\n\nconst initialState: State = {\n nextImpressions: [],\n sentIds: new Map(),\n}\n\ninterface ProviderProps {\n // Because of this prop you can't use the same context\n // to two different lists (if you want to differentiate both)\n listName: string\n}\n\nconst ProductListProvider: FC<ProviderProps> = ({ children, listName }) => {\n const [state, dispatch] = useReducer(productListReducer, initialState)\n\n useEffect(() => {\n dispatch({ type: 'SET_LIST_NAME', args: { listName } })\n }, [listName])\n\n return (\n <ProductListStateContext.Provider value={state}>\n <ProductListDispatchContext.Provider value={dispatch}>\n {children}\n </ProductListDispatchContext.Provider>\n </ProductListStateContext.Provider>\n )\n}\n\nconst useProductListState = () => useContext(ProductListStateContext)\n\nconst useProductListDispatch = () => useContext(ProductListDispatchContext)\n\nexport default {\n ProductListProvider,\n useProductListState,\n useProductListDispatch,\n}\n\n```"
}
] |
code_product-list-context_6bda3efd
|
[
{
"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 product-list-context/react/package.json from the product-list-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.3\",\n \"debounce\": \"^1.2.0\",\n \"react\": \"^16.8.6\",\n \"react-apollo\": \"^2.5.8\",\n \"react-dom\": \"^16.8.6\",\n \"react-intl\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@types/debounce\": \"^1.2.0\",\n \"@types/graphql\": \"^14.2.2\",\n \"@types/react\": \"^16.8.22\",\n \"@types/react-intl\": \"^2.3.18\",\n \"@vtex/test-tools\": \"^3.4.3\",\n \"@vtex/tsconfig\": \"^0.2.0\",\n \"prop-types\": \"^15.7.2\",\n \"typescript\": \"3.9.7\",\n \"vtex.pixel-manager\": \"http://vtex.vteximg.com.br/_v/public/typings/v1/vtex.pixel-manager@1.1.4/public/@types/vtex.pixel-manager\",\n \"vtex.render-runtime\": \"http://vtex.vteximg.com.br/_v/public/typings/v1/vtex.render-runtime@8.88.0/public/@types/vtex.render-runtime\"\n },\n \"version\": \"0.4.1\"\n}\n\n```"
}
] |
code_product-list-context_76e1f236
|
[
{
"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 product-list-context/react/useProductImpression.tsx from the product-list-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useEffect, useCallback } from 'react'\nimport debounce from 'debounce'\nimport { PixelContext } from 'vtex.pixel-manager'\n\nimport type { Product, Dispatch } from './ProductListContext'\nimport productImpressionHooks from './ProductListContext'\nimport { parseToProductImpression } from './utils/parser'\n\nconst { useProductListDispatch, useProductListState } = productImpressionHooks\n\ninterface ImpressionParams {\n nextImpressions: Array<{ product: Product; impressionIndex: number }>\n push: any\n dispatch: Dispatch\n listName?: string\n}\n\nconst sendImpressionEvents = (params: ImpressionParams) => {\n const { push, nextImpressions, dispatch, listName } = params\n\n if (!nextImpressions || nextImpressions.length <= 0) {\n return\n }\n\n const impressions = nextImpressions\n .filter(Boolean)\n .map(({ product, impressionIndex }, index) => ({\n product: parseToProductImpression(product),\n position: impressionIndex ?? index,\n }))\n\n push({\n event: 'productImpression',\n list: listName || 'List of products',\n impressions,\n })\n\n dispatch({ type: 'RESET_NEXT_IMPRESSIONS' })\n}\n\nconst useProductImpression = (): void => {\n const { nextImpressions, listName } = useProductListState()\n const { push } = PixelContext.usePixel()\n const dispatch = useProductListDispatch()\n\n // we know what we're doing.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const debouncedSendImpressionEvents = useCallback(\n debounce(sendImpressionEvents, 1000, false),\n []\n )\n\n useEffect(() => {\n debouncedSendImpressionEvents({\n push,\n dispatch,\n listName,\n nextImpressions,\n })\n }, [nextImpressions, debouncedSendImpressionEvents, dispatch, push, listName])\n}\n\nexport default useProductImpression\n\n```"
}
] |
code_product-list-context_d4398965
|
[
{
"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 product-list-context/react/utils/parser.tsx from the product-list-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { Product } from '../ProductListContext'\nimport { changeImageUrlSize, toHttps } from './urlHelpers'\n\nconst defaultImage = { imageUrl: '', imageLabel: '' }\nconst defaultReference = { Value: '' }\nconst defaultSeller = { commertialOffer: { Price: 0, ListPrice: 0 } }\n\nfunction findAvailableProduct(item: any) {\n return item.sellers.find(\n ({ commertialOffer = {} }: { commertialOffer: any }) =>\n commertialOffer.AvailableQuantity > 0\n )\n}\n\nexport function parseToProductImpression(product: Product): Product {\n const parsedProduct = { ...product }\n const items = parsedProduct.items || []\n const sku = items.find(findAvailableProduct) || items[0]\n\n if (sku) {\n const [seller = defaultSeller] = sku?.sellers ?? []\n const [referenceId = defaultReference] = sku.referenceId ?? []\n const [image = defaultImage] = sku.images ?? []\n\n const resizedImage = changeImageUrlSize(toHttps(image.imageUrl), 500)\n const parsedImage = { ...image, imageUrl: resizedImage }\n\n parsedProduct.sku = {\n ...sku,\n seller,\n referenceId,\n image: parsedImage,\n }\n }\n\n return parsedProduct\n}\n\n```"
}
] |
code_product-list-context_d942bfd8
|
[
{
"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 product-list-context/react/utils/urlHelpers.tsx from the product-list-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nexport const DEFAULT_WIDTH = 'auto'\nexport const DEFAULT_HEIGHT = 'auto'\nexport const MAX_WIDTH = 3000\nexport const MAX_HEIGHT = 4000\n\n/**\n * Having the url below as base for the LEGACY file manager,\n * https://storecomponents.vteximg.com.br/arquivos/ids/155472/Frame-3.jpg?v=636793763985400000\n * the following regex will match https://storecomponents.vteximg.com.br/arquivos/ids/155472\n *\n * Also matches urls with defined sizes like:\n * https://storecomponents.vteximg.com.br/arquivos/ids/155473-160-auto\n * @type {RegExp}\n *\n * On the new vtex.file-manager isn't necessary replace the URL, just add the param on the querystring, like:\n * \"?width=WIDTH&height=HEIGHT&aspect=true\"\n *\n */\nconst baseUrlRegex = /.+ids\\/(\\d+)/\nconst httpRegex = /http:\\/\\//\nconst legacyUrlPattern = '/arquivos/ids/'\n\nexport function toHttps(url: any) {\n return url.replace(httpRegex, 'https://')\n}\n\nexport function cleanImageUrl(imageUrl: any) {\n const result = baseUrlRegex.exec(imageUrl)\n\n if (result && result.length > 0) {\n return result[0]\n }\n\n return undefined\n}\n\nfunction replaceLegacyFileManagerUrl(imageUrl: any, width: any, height: any) {\n const isLegacyUrl = imageUrl.includes(legacyUrlPattern)\n\n if (!isLegacyUrl) return imageUrl\n\n return `${cleanImageUrl(imageUrl)}-${width}-${height}`\n}\n\nexport function changeImageUrlSize(\n imageUrl: any,\n width: number | string = DEFAULT_WIDTH,\n height: number | string = DEFAULT_HEIGHT\n) {\n if (!imageUrl) return\n if (typeof width === 'number') width = Math.min(width, MAX_WIDTH)\n if (typeof height === 'number') height = Math.min(height, MAX_HEIGHT)\n\n const normalizedImageUrl = replaceLegacyFileManagerUrl(\n imageUrl,\n width,\n height\n )\n\n const queryStringSeparator = normalizedImageUrl.includes('?') ? '&' : '?'\n\n return `${normalizedImageUrl}${queryStringSeparator}width=${width}&height=${height}&aspect=true`\n}\n\n```"
}
] |
code_binding-selector_c1fe97b0
|
[
{
"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 binding-selector/messages/pt.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/binding-selector.navigation.label\": \"Seletor de binding\",\n \"admin/binding-selector\": \"Seletor de binding\",\n \"admin/binding-selector.navigation.search.kws\": \"Seletor de binding\",\n \"admin/description\": \"As políticas de vendas serão atualizadas quando seus clientes mudarem os bindings de suas lojas.\",\n \"admin/label\": \"Atualizar política comercial\",\n \"admin/store\": \"Loja {index}: {address}\",\n \"admin/locale\": \"Região: {locale}\",\n \"admin/action\": \"Nomes das lojas personalizadas\",\n \"admin/modal\": \"Personalize os nomes da loja no idioma deste binding.\",\n \"admin/cancel\": \"Cancelar\",\n \"admin/save\": \"Salvar\",\n \"admin/hide-binding\": \"Visível\",\n \"admin/show-binding\": \"Oculto\",\n \"admin/advanced-settings\": \"Configurações avançadas\",\n \"admin/set-external-url\": \"Definir URL de redirecionamento externo\",\n \"admin/external-url-placeholder\": \"URL de redirecionamento externo\",\n \"admin/save-url\": \"Salvar URL\",\n \"admin/edit-url\": \"Editar URL\",\n \"admin/external-url-helper-text\": \"Por favor inclua https:// na URL\",\n \"admin/missing-labels\": \"Falta uma etiqueta\",\n \"admin/hide-label\": \"Ocultar\",\n \"store/challenge-bar.action-text\": \"Escolha visualizar conteúdo específico ou comprar online em outro país ou região.\",\n \"admin/editor.challenge-bar.title\": \"Barra de ações do desafio de binding\",\n \"admin/editor.challenge-bar.barText.title\": \"Chamada para ação\",\n \"admin/custom-flag.toggle\": \"Ícone de flag de binding personalizado\",\n \"admin/custom-flag.helpText\": \"É recomendável usar arquivos SVG com um tamanho de 24x24 px para manter a consistência\",\n \"admin/custom-flag.cta\": \"Editar flag\",\n \"admin/custom-flag.modal-title\": \"Carregar flag personalizada\",\n \"admin/custom-flag.modal-error\": \"Você carregou um {type} com um tamanho de {size} KB. Somente imagens de menos de 512 KB são permitidas\",\n \"admin/custom-flag.modal-dropzone-title\": \"Solte o arquivo aqui ou\",\n \"admin/custom-flag.modal-dropzone-cta\": \"selecione um arquivo\",\n \"admin/custom-flag.modal-dropzone-limit\": \"O tamanho máximo de arquivo é de {max_size} KB.\",\n \"admin/redirect-url.tooltip-label\": \"Este binding tem uma URL de redirecionamento externo\"\n}\n\n```"
}
] |
code_binding-selector_dcbceb45
|
[
{
"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 binding-selector/messages/en.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/binding-selector.navigation.label\": \"Binding Selector\",\n \"admin/binding-selector\": \"Binding Selector\",\n \"admin/binding-selector.navigation.search.kws\": \"Binding Selector\",\n \"admin/description\": \"The sales policies will be updated when your customers change their store bindings.\",\n \"admin/label\": \"Update Trade Policy\",\n \"admin/store\": \"Store {index}: {address}\",\n \"admin/locale\": \"Locale: {locale}\",\n \"admin/action\": \"Custom store names\",\n \"admin/modal\": \"Customise the store names in this binding’s language.\",\n \"admin/cancel\": \"Cancel\",\n \"admin/save\": \"Save\",\n \"admin/hide-binding\": \"Visible\",\n \"admin/show-binding\": \"Hidden\",\n \"admin/advanced-settings\": \"Advanced Settings\",\n \"admin/set-external-url\": \"Set external redirect URL\",\n \"admin/external-url-placeholder\": \"External redirect URL\",\n \"admin/save-url\": \"Save URL\",\n \"admin/edit-url\": \"Edit URL\",\n \"admin/external-url-helper-text\": \"Please include https:// in the URL\",\n \"admin/missing-labels\": \"There is a missing label\",\n \"admin/hide-label\": \"Hide\",\n \"store/challenge-bar.action-text\": \"Choose to view specific content or buy online in another country or region.\",\n \"admin/editor.challenge-bar.title\": \"Binding challenge action bar\",\n \"admin/editor.challenge-bar.barText.title\": \"Call to action\",\n \"admin/custom-flag.toggle\": \"Custom binding flag icon\",\n \"admin/custom-flag.helpText\": \"SVG files, with a 24x24px size, is recommended to mantain consistency\",\n \"admin/custom-flag.cta\": \"Edit flag\",\n \"admin/custom-flag.modal-title\": \"Upload custom flag\",\n \"admin/custom-flag.modal-error\": \"You uploaded a/an {type} weighting {size} KB and only images of less than 512 KB are allowed\",\n \"admin/custom-flag.modal-dropzone-title\": \"Drop your file here or\",\n \"admin/custom-flag.modal-dropzone-cta\": \"choose a file\",\n \"admin/custom-flag.modal-dropzone-limit\": \"Maximum file size of {max_size} KB.\",\n \"admin/redirect-url.tooltip-label\": \"This binding has an external redirect URL\"\n}\n\n```"
}
] |
code_binding-selector_feeea833
|
[
{
"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 binding-selector/messages/it.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/binding-selector.navigation.label\": \"Selettore di binding\",\n \"admin/binding-selector\": \"Selettore di binding\",\n \"admin/binding-selector.navigation.search.kws\": \"Selettore di binding\",\n \"admin/description\": \"Le politiche di vendita verranno aggiornate quando i tuoi clienti cambieranno i binding dei negozi.\",\n \"admin/label\": \"Aggiorna politica commerciale\",\n \"admin/store\": \"Negozio {index}: {address}\",\n \"admin/locale\": \"Regione: {locale}\",\n \"admin/action\": \"Personalizza i nomi del negozio\",\n \"admin/modal\": \"Personalizza i nomi del negozio nella lingua del binding.\",\n \"admin/cancel\": \"Annulla\",\n \"admin/save\": \"Salva\",\n \"admin/hide-binding\": \"Visibile\",\n \"admin/show-binding\": \"Nascosto\",\n \"admin/advanced-settings\": \"Impostazioni avanzate\",\n \"admin/set-external-url\": \"Imposta URL di reindirizzamento esterno\",\n \"admin/external-url-placeholder\": \"URL di reindirizzamento esterno\",\n \"admin/save-url\": \"Salva URL\",\n \"admin/edit-url\": \"Modifica URL\",\n \"admin/external-url-helper-text\": \"Si prega di includere https:// nell'URL\",\n \"admin/missing-labels\": \"Manca un'etichetta\",\n \"admin/hide-label\": \"Nascondi\",\n \"store/challenge-bar.action-text\": \"Scegli di visualizzare contenuti specifici o acquista online in un altro paese o regione.\",\n \"admin/editor.challenge-bar.title\": \"Barra delle azioni della sfida di binding\",\n \"admin/editor.challenge-bar.barText.title\": \"CTA (Call to Action)\",\n \"admin/custom-flag.toggle\": \"Personalizza l'icona del flag di binding\",\n \"admin/custom-flag.helpText\": \"É consigliabile utilizzare file SVG con una dimensione di 24x24 px per mantenere la consistenza.\",\n \"admin/custom-flag.cta\": \"Modifica flag\",\n \"admin/custom-flag.modal-title\": \"Carica flag personalizzato\",\n \"admin/custom-flag.modal-error\": \"Hai caricato un {type} con una dimensione di {size} KB. Sono consentite solamente immagini con una dimensione inferiore ai 512 KB.\",\n \"admin/custom-flag.modal-dropzone-title\": \"Trascina il tuo file qui o\",\n \"admin/custom-flag.modal-dropzone-cta\": \"scegli un file\",\n \"admin/custom-flag.modal-dropzone-limit\": \"La dimensione massima del file è di {max_size} KB.\",\n \"admin/redirect-url.tooltip-label\": \"Questo binding ha un URL di reindirizzamento esterno\"\n}\n\n```"
}
] |
code_binding-selector_801f3e20
|
[
{
"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 binding-selector/messages/context.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/binding-selector.navigation.label\": \"Binding Selector\",\n \"admin/binding-selector\": \"Binding Selector\",\n \"admin/binding-selector.navigation.search.kws\": \"Binding Selector\",\n \"admin/description\": \"The sales policies will be updated when your customers change their store bindings.\",\n \"admin/label\": \"Update Trade Policy\",\n \"admin/store\": \"Store {index}: {address}\",\n \"admin/locale\": \"Locale: {locale}\",\n \"admin/action\": \"Custom store names\",\n \"admin/modal\": \"Customise the store names in this binding’s language.\",\n \"admin/cancel\": \"Cancel\",\n \"admin/save\": \"Save\",\n \"admin/hide-binding\": \"Hide\",\n \"admin/show-binding\": \"Show\",\n \"admin/advanced-settings\": \"Advanced Settings\",\n \"admin/set-external-url\": \"Set external redirect URL\",\n \"admin/external-url-placeholder\": \"External redirect URL\",\n \"admin/save-url\": \"Save URL\",\n \"admin/edit-url\": \"Edit URL\",\n \"admin/external-url-helper-text\": \"Please include https:// in the URL\",\n \"admin/missing-labels\": \"There is a missing label\",\n \"admin/hide-label\": \"Hide\",\n \"store/challenge-bar.action-text\": \"Content for the challenge binding action bar\",\n \"admin/editor.challenge-bar.title\": \"Site editor challenge bar title\",\n \"admin/editor.challenge-bar.barText.title\": \"Challenge bar action-text title\",\n \"admin/custom-flag.toggle\": \"Custom binding flag toggle label\",\n \"admin/custom-flag.helpText\": \"Custom binding flag toggle help text\",\n \"admin/custom-flag.cta\": \"Custom binding flag button call to action\",\n \"admin/custom-flag.modal-title\": \"Custom binding flag modal title\",\n \"admin/custom-flag.modal-error\": \"Modal upload error\",\n \"admin/custom-flag.modal-dropzone-title\": \"First line of modal's text\",\n \"admin/custom-flag.modal-dropzone-cta\": \"Modal's call to action\",\n \"admin/custom-flag.modal-dropzone-limit\": \"Modal's file limit\",\n \"admin/redirect-url.tooltip-label\": \"Tooltip text describing the use of a redirect url\"\n}\n\n```"
}
] |
code_binding-selector_7fc8d802
|
[
{
"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 binding-selector/messages/es.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/binding-selector.navigation.label\": \"Selector de binding\",\n \"admin/binding-selector\": \"Selector de binding\",\n \"admin/binding-selector.navigation.search.kws\": \"Selector de binding\",\n \"admin/description\": \"Las políticas comerciales se actualizarán cuando tus clientes cambien los bindings de su tienda.\",\n \"admin/label\": \"Actualizar política comercial\",\n \"admin/store\": \"Tienda {index}: {address}\",\n \"admin/locale\": \"Región: {locale}\",\n \"admin/action\": \"Nombres de tienda personalizados\",\n \"admin/modal\": \"Personalizar los nombres de las tiendas en el idioma del binding.\",\n \"admin/cancel\": \"Cancelar\",\n \"admin/save\": \"Guardar\",\n \"admin/hide-binding\": \"Visible\",\n \"admin/show-binding\": \"Oculto\",\n \"admin/advanced-settings\": \"Configuración avanzada\",\n \"admin/set-external-url\": \"Establecer URL de redirección externa\",\n \"admin/external-url-placeholder\": \"URL de redirección externa\",\n \"admin/save-url\": \"Guardar URL\",\n \"admin/edit-url\": \"Editar URL\",\n \"admin/external-url-helper-text\": \"Por favor, incluye https:// en la URL\",\n \"admin/missing-labels\": \"Falta una etiqueta\",\n \"admin/hide-label\": \"Ocultar\",\n \"store/challenge-bar.action-text\": \"Elige ver contenido específico o compra online en otro país o región.\",\n \"admin/editor.challenge-bar.title\": \"Barra de acciones del desafío de binding\",\n \"admin/editor.challenge-bar.barText.title\": \"CTA\",\n \"admin/custom-flag.toggle\": \"Ícono de flag de binding personalizado\",\n \"admin/custom-flag.helpText\": \"Se recomienda utilizar archivos SVG con un tamaño de 24x24 px para mantener uniformidad.\",\n \"admin/custom-flag.cta\": \"Editar flag\",\n \"admin/custom-flag.modal-title\": \"Cargar flag personalizado\",\n \"admin/custom-flag.modal-error\": \"Has cargado un {type} con un tamaño de {size} KB y solo se permiten imágenes de menos de 512 KB\",\n \"admin/custom-flag.modal-dropzone-title\": \"Arrastra el archivo aquí o\",\n \"admin/custom-flag.modal-dropzone-cta\": \"selecciona un archivo\",\n \"admin/custom-flag.modal-dropzone-limit\": \"El tamaño máximo de archivo es de {max_size} KB.\",\n \"admin/redirect-url.tooltip-label\": \"Este binding tiene una URL de redirección externa.\"\n}\n\n```"
}
] |
code_binding-selector_1fcf9e69
|
[
{
"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 binding-selector/admin/navigation.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"section\": \"accountSettings\",\n \"titleId\": \"admin/binding-selector.navigation.label\",\n \"path\": \"/admin/binding-selector\",\n \"searchKeyWordsHelpers\": \"admin/binding-selector.navigation.search.kws\"\n}\n\n```"
}
] |
code_binding-selector_dfacf34e
|
[
{
"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 binding-selector/admin/routes.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin.binding-selector\": {\n \"component\": \"BindingSelectorAdmin\",\n \"path\": \"/admin/app/binding-selector\"\n }\n}\n\n```"
}
] |
code_binding-selector_eea3be49
|
[
{
"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 binding-selector/docs/README.md from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Binding Selector\n\n## ⚠️ Maintenance ⚠️\n*Starting June 1st 2023, this application will no longer be maintained by VTEX.*\n\n---\n\nThe Binding Selector APP, allows multi-language stores, specifically those with a single account-multiple binding architecture, to switch between their configured bindings.\n\nThe App takes the **Canonical** context of the current binding as well as the **Alternate href** addresses registered for the other bindings, and creates a drop-down menu component to display the possible options on the Store Front.\n\nThis allows customers to seamlesly switch between stores without returning to Home or leaving the site.\n\nExample:\nIf a user arrives to the Spanish Site:\nwww.testperformancev.com/es/iphone-11-128gb-rojo/p -> Canonical\nwww.testperformancev.com/pt/iphone-11-128gb-vermelho/p -> Alternate\n\nIf a user switches or arrives to the Portuguese Site:\nwww.testperformancev.com/pt/iphone-11-128gb-vermelho/p -> Canonical\nwww.testperformancev.com/es/iphone-11-128gb-rojo/p -> Alternate\n\nIt has the possibility to update the Session and Cart's Sales Channel, this changes the prices and stock available for each store. It is up to the user to toggle this setting ON of OFF inside the App's settings.\n\nThe App is geared towards an improvement on Site Experience for the customer and it will have a direct impact on the store's conversion.\n\n\n\n## Configuration\n\nThe App consists on **two** main features an **Admin Interface** and a Store Block called **binding-selector** to be declared on the Store-Theme.\n\nThe Setup for the app is as follows:\n\n1. on the CLI and run: `vtex install vtex.binding-selector@2.x`\n2. declare the block as a peerDependency inside your store-theme manifest.json:\n\n ```\n \"peerDependencies\": {\n \"vtex.binding-selector\": \"2.x\"\n }\n ```\n\n3. on the **store-theme** declare the block **binding-selector** where it is intended to be displayed, for example, inside the **header.json** declare the block as follows:\n\n ```\n \"flex-layout.row#4-desktop\": {\n \"props\": {\n \"blockClass\": \"main-header\",\n \"horizontalAlign\": \"center\",\n \"verticalAlign\": \"center\",\n \"preventHorizontalStretch\": true,\n \"preventVerticalStretch\": true,\n \"fullWidth\": true\n },\n \"children\": [\n \"flex-layout.col#logo-desktop\",\n \"flex-layout.col#category-menu\",\n \"flex-layout.col#spacer\",\n \"search-bar\",\n \"binding-selector\",\n \"login\",\n \"minicart.v2\"\n ]},\n \"binding-selector\": {\n \"props\": {\n \"layout\": \"dropdown\",\n \"display\": \"combined\"\n }\n }\n\n ```\n\n4. Go to your account Admin Panel and under the Account Settings, there will be a new menu item called **Binding Selector**. Here you will have the following options:\n\n 4.1 Possibility to toggle whether or not the app will change Sales Channels when switching bindings. When the store changes the Sales Channel, the prices of the store and the checkout will also change.\n\n 4.2. Toggle each store individually to be displayed on the front end component.\n\n 4.3 Modify each displayed option labels clicking on the **Custom Store Names** button. This process has to be done for each active or displayed site.\n\n **if there are no labels configured, the menu won't display any options!!**\n\n 4.4 _Advanced Settings_\n\n 4.4.1 External redirect URL\n - When set, user will redirect to the given URL when clicking the binding in the store\n\n 4.4.2 Custom Flag\n - It's possible to customize the flags that represents the bindings. SVG files, with a 24x24px size, is recommended to mantain consistency.\n\n\n\n### `binding-selector` block\n\nRenders a component that allows the user to select a different binding for your store.\n\n| Prop name | Type | Description | Default value |\n| --------- | -------- | ---------------------------------------------------------------------------------------------- | ------------- |\n| `layout` | `string` | How the bindings are grouped. Possible values are: `dropdown` - `list` - `select` | `dropdown` |\n| `display` | `string` | How the bindings are displayed in the group. Possible values are: `text` - `flag` - `combined`. Please keep in mind that the `select` layout cannot be paired with `flag` or `combined`, as the native HTML tag 'select' can only render text | `text` |\n\n### `current-binding` block\n\nRenders a component that ONLY shows the current binding as a SVG flag. Useful to use it as modal-trigger\n\n### `binding-challenge` block\n\nRenders an action bar that automatically detects if the user's country is different from the binding locale its browsing.\nThe bar has a call to action text and is using the `binding-selector` selector.\n\n## Customization\n\nIn order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://vtex.io/docs/recipes/style/using-css-handles-for-store-customization).\n\n| CSS Handles |\n| ------------------- |\n| `container` |\n| `relativeContainer` |\n| `button` |\n| `buttonText` |\n| `list` |\n| `listElement` |\n| `active*` |\n| `currentBinding` |\n| `challengeBar` |\n| `actionCTA` |\n| `actionContainer` |\n| `listContainer` |\n\n_\\*conditional class when dropdown is open_\n\n```"
}
] |
code_binding-selector_50629c53
|
[
{
"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 binding-selector/graphql/schema.graphql from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Query {\n bindingInfo: [TranslatedInfoOutput]\n @cacheControl(scope: PUBLIC, maxAge: SHORT)\n isSalesChannelUpdate: Boolean @cacheControl(scope: PUBLIC, maxAge: SHORT)\n}\n\ntype Mutation {\n updateSalesChannel(orderFormId: ID, salesChannel: String): PartialOrderForm\n\n saveBindingInfo(data: [BindingsInput]): [TranslatedInfoOutput]\n toggleSalesChannel(salesChannel: Boolean): Boolean\n}\n\n```"
}
] |
code_binding-selector_de4c526c
|
[
{
"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 binding-selector/node/routes.ts from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { method } from '@vtex/api'\n\nimport { viewerCountry } from './middlewares'\n\nconst routes = {\n viewerCountry: method({\n GET: [viewerCountry],\n }),\n}\n\nexport { routes }\n\n```"
}
] |
code_binding-selector_211e05f7
|
[
{
"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 binding-selector/node/service.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"stack\": \"nodejs\",\n \"memory\": 1024,\n \"ttl\": 12,\n \"timeout\": 10,\n \"minReplicas\": 6,\n \"maxReplicas\": 20,\n \"routes\": {\n \"viewerCountry\": {\n \"path\": \"/_v/binding-selector/viewer-country\",\n \"public\": true\n }\n }\n}\n\n```"
}
] |
code_binding-selector_5da05e0e
|
[
{
"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 binding-selector/node/utils.ts from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { AuthenticationError, ForbiddenError, UserInputError } from '@vtex/api'\nimport type { AxiosError } from 'axios'\n\nexport const statusToError = (e: AxiosError) => {\n if (!e.response) {\n throw e\n }\n\n const {\n response: { status },\n } = e\n\n switch (status) {\n case 401: {\n throw new AuthenticationError(e)\n }\n\n case 403: {\n throw new ForbiddenError(e)\n }\n\n case 400: {\n throw new UserInputError(e)\n }\n\n default:\n break\n }\n}\n\n```"
}
] |
code_binding-selector_170c1d29
|
[
{
"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 binding-selector/node/package.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.binding-selector\",\n \"version\": \"2.1.7\",\n \"license\": \"UNLICENSED\",\n \"private\": true,\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"devDependencies\": {\n \"@vtex/test-tools\": \"vtex/test-tools\",\n \"@vtex/tsconfig\": \"^0.5.6\",\n \"axios\": \"^0.21.1\",\n \"typescript\": \"3.9.7\",\n \"vtex.checkout-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-graphql@0.65.1/public/@types/vtex.checkout-graphql\",\n \"vtex.country-flags\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.country-flags@0.1.1/public/@types/vtex.country-flags\",\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.6/public/@types/vtex.device-detector\",\n \"vtex.file-manager-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.file-manager-graphql@0.3.0/public/@types/vtex.file-manager-graphql\",\n \"vtex.order-items\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-items@0.13.1/public/@types/vtex.order-items\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@7.45.0/public/@types/vtex.render-runtime\",\n \"vtex.rewriter\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.rewriter@1.56.1/public/@types/vtex.rewriter\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.149.2/public/@types/vtex.store-graphql\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.145.2/public/@types/vtex.styleguide\",\n \"vtex.tenant-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql\"\n },\n \"dependencies\": {\n \"@vtex/api\": \"6.45.6\"\n }\n}\n\n```"
}
] |
code_binding-selector_038d309f
|
[
{
"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 binding-selector/node/index.ts from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type {\n ClientsConfig,\n ServiceContext,\n ParamsContext,\n RecorderState,\n} from '@vtex/api'\nimport { LRUCache, Service } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { routes } from './routes'\nimport { queries, mutations } from './resolvers'\n\nconst TIMEOUT_MS = 10 * 1000\n\n// The @vtex/api HttpClient respects Cache-Control headers and uses the provided cache.\nconst memoryCache = new LRUCache<string, any>({ max: 5000 })\n\nmetrics.trackCache('checkout', memoryCache)\n\n// This is the configuration for clients available in `ctx.clients`.\nconst clients: ClientsConfig<Clients> = {\n implementation: Clients,\n options: {\n // All IO Clients will be initialized with these options, unless otherwise specified.\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n memoryCache,\n concurrency: 10,\n },\n },\n}\n\ndeclare global {\n // We declare a global Context type just to avoid re-writing ServiceContext<Clients, State> in every handler and resolver\n type Context = ServiceContext<Clients>\n}\n\n// Export a service that defines route handlers and client options.\nexport default new Service<Clients, RecorderState, ParamsContext>({\n clients,\n routes,\n graphql: {\n resolvers: {\n Query: {\n ...queries,\n },\n Mutation: {\n ...mutations,\n },\n },\n },\n})\n\n```"
}
] |
code_binding-selector_7e859dbf
|
[
{
"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 binding-selector/react/CurrentBinding.tsx from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { FC } from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport { useBinding } from './hooks/useBindings'\nimport Spinner from './components/Spinner'\nimport LabelOption from './components/LabelsFlags'\n\nconst CSS_HANDLES = ['currentBinding'] as const\n\ninterface Props {\n /* How we display the current binding */\n display: FlagDisplay\n}\n\n/**\n * @returns an icon or string showing which is\n * the current binding, useful as a modal-trigger\n */\nconst CurrentBinding: FC<Props> = ({ display = 'text' }) => {\n const {\n data: { currentBinding, bindingsError, loadingBindings },\n } = useBinding()\n\n const handles = useCssHandles(CSS_HANDLES)\n const noBinding = !loadingBindings && !currentBinding.id\n const hasError = !!bindingsError\n const flag = currentBinding.customFlagData\n\n if (hasError) {\n console.error('Error loading current Binding', {\n bindingsError,\n })\n\n return null\n }\n\n if (noBinding) {\n console.warn('No Binding assigned to the current Binding', {\n bindingsError,\n })\n\n return null\n }\n\n return (\n <div\n className={`${handles.currentBinding} flex items-center justify-center h-100 mh4`}\n >\n {loadingBindings ? (\n <Spinner />\n ) : (\n <LabelOption binding={currentBinding} display={display} flag={flag} />\n )}\n </div>\n )\n}\n\nexport default CurrentBinding\n\n```"
}
] |
code_binding-selector_8d2e4ea7
|
[
{
"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 binding-selector/react/BindingSelectorAdmin.tsx from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Layout, PageBlock, PageHeader } from 'vtex.styleguide'\n\nimport Selector from './components/admin/Selector'\n\nimport './styles.global.css'\n\nconst BindingSelectorAdmin: FC = () => {\n return (\n <Layout\n pageHeader={\n <PageHeader title={<FormattedMessage id=\"admin/binding-selector\" />} />\n }\n >\n <PageBlock variation=\"full\">\n <Selector />\n </PageBlock>\n </Layout>\n )\n}\n\nexport default BindingSelectorAdmin\n\n```"
}
] |
code_binding-selector_dc36b076
|
[
{
"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 binding-selector/react/package.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.binding-selector\",\n \"version\": \"2.1.7\",\n \"scripts\": {\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^11.12.1\",\n \"@types/react\": \"^16.8.10\",\n \"@types/react-intl\": \"^3.0.0\",\n \"prop-types\": \"^15.7.2\",\n \"react-intl\": \"^5.13.2\",\n \"typescript\": \"3.9.7\",\n \"vtex.checkout-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-graphql@0.65.1/public/@types/vtex.checkout-graphql\",\n \"vtex.country-flags\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.country-flags@0.1.1/public/@types/vtex.country-flags\",\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.6/public/@types/vtex.device-detector\",\n \"vtex.file-manager-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.file-manager-graphql@0.3.0/public/@types/vtex.file-manager-graphql\",\n \"vtex.order-items\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-items@0.13.1/public/@types/vtex.order-items\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.3/public/@types/vtex.render-runtime\",\n \"vtex.rewriter\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.rewriter@1.56.1/public/@types/vtex.rewriter\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.149.2/public/@types/vtex.store-graphql\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.145.2/public/@types/vtex.styleguide\",\n \"vtex.tenant-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql\"\n },\n \"dependencies\": {\n \"@apollo/client\": \"^3.3.7\",\n \"apollo-client\": \"^2.6.10\",\n \"graphql\": \"^15.5.0\",\n \"react\": \"^17.0.1\",\n \"react-apollo\": \"^3.1.5\",\n \"react-dom\": \"^17.0.1\",\n \"react-markdown\": \"^4.0.4\",\n \"react-router-dom\": \"5.2.0\"\n }\n}\n\n```"
}
] |
code_binding-selector_3e6e47ba
|
[
{
"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 binding-selector/react/styles.global.css from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\nhtml,\nbody,\n#render-container,\n#render-provider,\n.render-container,\n.render-provider {\n height: 100%;\n}\n\n.flex-basis-33 {\n flex-basis: 33%;\n}\n\n.flex-basis-25 {\n flex-basis: 25%;\n}\n\n.flex-basis-50 {\n flex-basis: 50%;\n}\n\n.width-70 {\n width: 70%;\n}\n\n.z-9999 {\n z-index: 9999;\n}\n\n```"
}
] |
code_binding-selector_f8f2f68c
|
[
{
"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 binding-selector/react/BindingChallenge.tsx from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useState, useEffect } from 'react'\nimport { ButtonWithIcon, IconClose } from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\nimport { useDevice } from 'vtex.device-detector'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport { useBinding } from './hooks/useBindings'\nimport BindingSelectorBlock from './BindingSelectorBlock'\n\nconst close = <IconClose />\n\nconst CSS_HANDLES = ['challengeBar', 'actionCTA', 'actionContainer'] as const\n\ninterface Props {\n barText: string\n}\n\nconst BindingChallenge = ({ barText }: Props) => {\n const [show, setDisplay] = useState(false)\n const [viewerCountry, setViewerCountry] = useState<string | null>(null)\n const handles = useCssHandles(CSS_HANDLES)\n const { device } = useDevice()\n\n const {\n data: { currentBinding, bindingsError, loadingBindings },\n } = useBinding()\n\n useEffect(() => {\n async function fetchViewerCountry() {\n try {\n const response = await fetch(`/_v/binding-selector/viewer-country`)\n const countryISO = await response.text()\n\n !countryISO || setViewerCountry(countryISO)\n } catch (e) {\n console.error(e)\n }\n }\n\n fetchViewerCountry()\n }, [])\n\n useEffect(() => {\n if (!viewerCountry || !currentBinding.defaultLocale) {\n return\n }\n\n if (localStorage.getItem('hasShownBindingBar') === 'true') {\n return\n }\n\n /* viewer country is ISO2\n so we compare the last 2 digits of the locale\n i.e es-ES === ES\n */\n const bindingLocale = currentBinding.defaultLocale\n ?.substr(3, 2)\n .toUpperCase()\n\n if (viewerCountry === bindingLocale) {\n return\n }\n\n setDisplay(true)\n }, [currentBinding, viewerCountry])\n\n const handleActionBar = () => {\n localStorage.setItem('hasShownBindingBar', 'true')\n setDisplay(false)\n }\n\n const text = barText || (\n <FormattedMessage id=\"store/challenge-bar.action-text\" />\n )\n\n const shouldShowActionBar =\n show && !bindingsError && !loadingBindings && currentBinding.id\n\n if (!shouldShowActionBar) {\n return null\n }\n\n return (\n <div\n className={`${\n handles.challengeBar\n } flex items-center justify-center shadow-active w-100 bg-base pa4 tc ${\n device === 'phone' ? 'flex-column' : ''\n }`}\n >\n <span\n className={`${handles.actionCTA} t-small ${\n device === 'phone' ? 'pb3' : ''\n }`}\n >\n {text}\n </span>\n <div className={`${handles.actionContainer} flex`}>\n <span className=\"mh5 w-10\" style={{ width: 180 }}>\n <BindingSelectorBlock layout=\"select\" display=\"text\" />\n </span>\n <span>\n <ButtonWithIcon\n size=\"small\"\n icon={close}\n variation=\"tertiary\"\n onClick={() => {\n handleActionBar()\n }}\n />\n </span>\n </div>\n </div>\n )\n}\n\nBindingChallenge.schema = {\n title: 'admin/editor.challenge-bar.title',\n type: 'object',\n properties: {\n barText: {\n title: 'admin/editor.challenge-bar.barText.title',\n type: 'string',\n },\n },\n}\n\nexport default BindingChallenge\n\n```"
}
] |
code_binding-selector_fe1ee6b5
|
[
{
"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 binding-selector/react/BindingSelectorBlock.tsx from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React, { useState, useEffect } from 'react'\nimport { useRuntime } from 'vtex.render-runtime'\nimport { useMutation, useLazyQuery, useQuery } from 'react-apollo'\nimport { useOrderItems } from 'vtex.order-items/OrderItems'\n\nimport BindingSelectorDropdown from './components/BindingSelectorDropdown'\nimport updateSalesChannelMutation from './graphql/updateSalesChannel.gql'\nimport alternateHrefsQuery from './graphql/alternateHrefs.gql'\nimport { createRedirectUrl, getMatchRoute, transformUserRouteId } from './utils'\nimport shouldUpdateSalesChannel from './graphql/isSalesChannelUpdate.gql'\nimport BindingSelectorList from './components/BindingSelectorList'\nimport BindingSelectorSelect from './components/BindingSelectorSelect'\nimport { useBinding } from './hooks/useBindings'\nimport getOrderForm from './graphql/getOrderForm.gql'\n\ninterface GetOrderFormResponse {\n orderForm: {\n salesChannel: string\n orderFormId: string\n items: Array<{ id: string }>\n }\n}\n\ninterface Props {\n /* How the list of bindings is rendered */\n layout: 'dropwdown' | 'list' | 'select'\n /* How we display each binding */\n display: FlagDisplay\n}\n\nconst BindingSelectorBlock: FC<Props> = ({\n layout = 'dropdown',\n display = 'text',\n}) => {\n const {\n data: { currentBinding, bindingList, bindingsError, loadingBindings },\n actions: { setCurrentBindingInfo },\n } = useBinding()\n\n const [HasRunSyncEffect, setHasRunSyncEffect] = useState(false)\n const [salesChannel, setSalesChannel] = useState('')\n const {\n route: {\n pageContext: { id, type },\n queryString,\n },\n } = useRuntime()\n\n const { updateQuantity } = useOrderItems()\n\n const queryVariables = {\n id: type === 'route' ? transformUserRouteId(id) : id,\n type: type === 'route' ? 'userRoute' : type,\n }\n\n const [\n getAlternateHrefs,\n { data: hrefAltData },\n ] = useLazyQuery<QueryInternal>(alternateHrefsQuery, {\n variables: queryVariables,\n })\n\n const [updateSalesChannel] = useMutation<\n {\n updateSalesChannel: {\n orderFormId: string\n items: Array<{ quantity: number; uniqueId: string }>\n }\n },\n UpdateSalesChannelVariables\n >(updateSalesChannelMutation)\n\n /**\n * @todo We are using this query only because the order-manager doesn't\n * expose the salesChannel. If we make a PR to checkout-graphql to add it\n * we could dispose of this query to avoid waiting for the block to render\n */\n const {\n data: orderFormResponse,\n loading: loadingOrderForm,\n error: orderFormError,\n } = useQuery<GetOrderFormResponse>(getOrderForm, {\n ssr: false,\n })\n\n const [loadingRedirect, setLoadingRedirect] = useState<boolean>(false)\n\n const { data: toogleSalesChannel } = useQuery<SalesChannelResponse>(\n shouldUpdateSalesChannel,\n {\n ssr: false,\n }\n )\n\n /**\n * This effect handles the redirect after user selects a new binding.\n * We are handling it here because we couldn't get the hreflang inside the handleSelection method, since the callback from useLazyCallback returns void\n */\n useEffect(() => {\n const { canonicalBaseAddress } = currentBinding\n const { hostname, protocol, hash } = window.location\n let path = ''\n\n // eslint-disable-next-line vtex/prefer-early-return\n if (hrefAltData) {\n const { routes = [] } = hrefAltData.internal\n\n path = getMatchRoute({ routes, currentBindingId: currentBinding.id })\n\n const keepSalesChannel = !toogleSalesChannel?.isSalesChannelUpdate\n\n const { channel } = JSON.parse(atob(window.__RUNTIME__.segmentToken))\n\n const urlToRedirect = createRedirectUrl({\n canonicalBaseAddress,\n hostname,\n protocol,\n path,\n hash,\n pageType: id,\n keepSalesChannel,\n /**\n * We try to use the salesChannel set on state, but the first load\n * will not have it - we trust that segmentToken on runtime will be right.\n * See more details in the useEffect below.\n */\n salesChannel: salesChannel || channel,\n })\n\n console.info(`Redirecting to ${urlToRedirect}`)\n\n window.location.href = urlToRedirect\n }\n }, [hrefAltData, currentBinding, id, toogleSalesChannel, salesChannel])\n\n /**\n * This effect handles the synchronization between binding sales channel on page load and cart sales channel.\n * If different, it updates the cart sales channel to be the same as the one coming from the sales channel based on the binding url\n */\n useEffect(() => {\n const syncSalesChannel = async () => {\n const { data } = await updateSalesChannel({\n variables: {\n orderFormId: (orderFormResponse as GetOrderFormResponse).orderForm\n .orderFormId,\n salesChannel: currentBinding.salesChannel,\n },\n })\n\n const { items } = data?.updateSalesChannel ?? { items: [] }\n\n for (let i = 0; i < items.length; i++) {\n const { uniqueId, quantity } = items[i]\n\n // Trigger a re-render for cart component\n updateQuantity({\n uniqueId,\n quantity,\n })\n }\n }\n\n if (\n orderFormResponse?.orderForm.items.length &&\n currentBinding?.id &&\n toogleSalesChannel?.isSalesChannelUpdate\n ) {\n if (\n orderFormResponse.orderForm.salesChannel !==\n currentBinding.salesChannel &&\n !HasRunSyncEffect\n ) {\n syncSalesChannel()\n }\n\n setHasRunSyncEffect(true)\n }\n }, [\n currentBinding,\n toogleSalesChannel,\n updateSalesChannel,\n updateQuantity,\n HasRunSyncEffect,\n orderFormResponse,\n ])\n\n /**\n * This effect sets the target sales channel after the user changes binding\n * for the first time. This allows the user to change to a different binding multiple\n * times wihtout losing reference from the first one visited. It was necessary because\n * `window.__RUNTIME__.segmentToken` (for some weird reason) didn't keep sync'ed with the\n * sales channel in the session cookie.\n */\n useEffect(() => {\n if (queryString?.sc && !salesChannel) {\n setSalesChannel(queryString.sc)\n }\n }, [queryString, salesChannel])\n\n const handleSelection = async (\n selectedBinding: TranslationsAndSettings\n ): Promise<void> => {\n setLoadingRedirect(true)\n setCurrentBindingInfo(selectedBinding.id)\n\n if (selectedBinding.externalRedirectData?.redirectUrl) {\n window.location.href = selectedBinding.externalRedirectData.url\n\n return\n }\n\n if (toogleSalesChannel?.isSalesChannelUpdate) {\n try {\n await updateSalesChannel({\n variables: {\n orderFormId: (orderFormResponse as GetOrderFormResponse).orderForm\n .orderFormId,\n salesChannel: selectedBinding.salesChannel,\n },\n })\n } catch (e) {\n // How to handle when there is an error updating sales channel?\n console.error(e)\n }\n }\n\n getAlternateHrefs()\n }\n\n const isLoading =\n loadingBindings || loadingOrderForm || !currentBinding.id || loadingRedirect\n\n const noBinding = !loadingBindings && !loadingOrderForm && !currentBinding.id\n\n const hasError = !!orderFormError || !!bindingsError\n\n if (hasError) {\n console.error('Error loading Binding Selector', {\n orderFormError,\n bindingsError,\n })\n\n return null\n }\n\n if (noBinding) {\n console.warn('No Binding assigned to the current Binding')\n\n return null\n }\n\n if (layout === 'list') {\n return (\n <BindingSelectorList\n bindingList={bindingList}\n currentBinding={currentBinding}\n onSelectBinding={handleSelection}\n display={display}\n /* Don't want to check for loadingRedirect */\n isLoading={loadingBindings || loadingOrderForm || !currentBinding.id}\n />\n )\n }\n\n if (layout === 'select') {\n if (display === 'combined' || display === 'flag') {\n console.error(\n 'Binding selector: Native HTML <select> tag cannot render flags as options, please choose a different layout'\n )\n }\n\n return (\n <BindingSelectorSelect\n bindingList={bindingList}\n currentBinding={currentBinding}\n onSelectBinding={handleSelection}\n isLoading={isLoading}\n />\n )\n }\n\n return (\n <BindingSelectorDropdown\n bindingInfo={bindingList}\n currentBinding={currentBinding}\n onSelectBinding={handleSelection}\n isLoading={isLoading}\n display={display}\n />\n )\n}\n\nexport default BindingSelectorBlock\n\n```"
}
] |
code_binding-selector_bcab26f1
|
[
{
"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 binding-selector/store/interfaces.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"binding-selector\": {\n \"component\": \"BindingSelectorBlock\"\n },\n \"current-binding\": {\n \"component\": \"CurrentBinding\"\n },\n \"binding-challenge\": {\n \"component\": \"BindingChallenge\"\n }\n}\n\n```"
}
] |
code_binding-selector_0224c65c
|
[
{
"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 binding-selector/public/metadata/messages/es-AR.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Country Store Switcher\",\n \"headline\": \"Solución nativa para cambiar entre tiendas para los clientes en una arquitectura de una cuenta - multiples bindings.\",\n \"overview\": \"Esta App le permite a los usuarios cambiar entre las diferentes tiendas que tenga la cuenta.\",\n \"features\": [\n \"Cambia de una tienda a la otra sin barreras\",\n \"Posibilidad de cambiar Políticas Comerciales entre tiendas\",\n \"Toggle On/Off para los sitios que se desean mostrar\",\n \"Capacidad de tener redirects externos\",\n \"Configuración de etiquetas por idioma\"\n ],\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_binding-selector_c48f93d8
|
[
{
"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 binding-selector/public/metadata/messages/pt-BR.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Country Store Switcher\",\n \"headline\": \"Solução nativa para navegação entre lojas em contas com arquitetura single account - multi-bindings.\",\n \"overview\": \"Esta applicação permite navegação entre diferentes lojas para contas com arquitetura single account - multiple bindings.\",\n \"features\": [\n \"Mudança simples de navegação entre lojas\",\n \"Permite alterar Sales Channel do carrinho ao navegar para outra loja\",\n \"Escolha de quais lojas serão listadas no seletor de loja\",\n \"Permite incluir URL externa para redirecionar usuários a lojas fora da VTEX\",\n \"Configuração dos nomes das lojas que serão listadas no seletor\"\n ],\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_binding-selector_8cf83a5c
|
[
{
"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 binding-selector/public/metadata/messages/en-US.json from the binding-selector VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Country Store Switcher\",\n \"headline\": \"Native solution to switch between stores on a single account - multi-binding architecture.\",\n \"overview\": \"This app allows stores with a single account - multiple binding architecture to switch between their stores.\",\n \"features\": [\n \"Seamlessly switch between stores\",\n \"Possibility to change Sales Channels when switching stores\",\n \"Toggle On/Off the sites desired to be shown\",\n \"External redirect capability\",\n \"Configure labels by language\"\n ],\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.