id
stringlengths
12
53
messages
listlengths
3
3
code_store-media_223b1cfa
[ { "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-media/messages/en.json from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.media.title\": \"Media\",\n \"admin/editor.media.description\": \"Media block that supports images and videos\",\n \"admin/editor.mediaType.title\": \"Media type\",\n \"admin/editor.mediaType.image\": \"Image\",\n \"admin/editor.mediaType.video\": \"Video\",\n \"admin/editor.mediaList.title\": \"Media List\",\n \"admin/editor.mediaList.description\": \"Media List block that supports a list of images and videos\",\n \"admin/editor.mediaList.mobileVideo.title\": \"URL for mobile\"\n}\n\n```" } ]
code_store-media_af867beb
[ { "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-media/messages/context.json from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.media.title\": \"Media\",\n \"admin/editor.media.description\": \"Media block that supports images and videos\",\n \"admin/editor.mediaType.title\": \"Media type\",\n \"admin/editor.mediaType.image\": \"Image\",\n \"admin/editor.mediaType.video\": \"Video\",\n \"admin/editor.mediaList.title\": \"Media List\",\n \"admin/editor.mediaList.description\": \"Media List block that supports a list of images and videos\",\n \"admin/editor.mediaList.mobileVideo.title\": \"URL for mobile\"\n}\n\n```" } ]
code_store-media_1676adde
[ { "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-media/messages/es.json from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.media.title\": \"Medio\",\n \"admin/editor.media.description\": \"Bloque de medio que admite imágenes y videos\",\n \"admin/editor.mediaType.title\": \"Tipo de medio\",\n \"admin/editor.mediaType.image\": \"Imagen\",\n \"admin/editor.mediaType.video\": \"Vídeo\",\n \"admin/editor.mediaList.title\": \"Lista de Medios\",\n \"admin/editor.mediaList.description\": \"Bloque de Lista de Medios que admite una lista de imágenes y videos\",\n \"admin/editor.mediaList.mobileVideo.title\": \"URL para móvil\"\n}\n\n```" } ]
code_store-media_4cf59f58
[ { "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-media/docs/README.md from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/store-media) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Media\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)\n\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nThe Media app allows you to display image and video assets using a single block.\n\n![media-list-example](https://user-images.githubusercontent.com/8127610/107076678-848fbf80-67ca-11eb-9ba3-8a7d285c4b2c.gif)\n## Configuration\n\n1. Add the `store-media` app to your theme's dependencies in the `manifest.json` file:\n\n```diff\n \"dependencies \": {\n+ \"vtex.store-media\": \"0.x\"\n }\n```\n\nNow, you are able to use all blocks exported by the `store-media` app. Check out the full list below:\n\n| Block name | Description |\n| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `media` | This block is capable of displaying a single image or video. |\n| `list-context.media-list` | This block allows you to display a list of images and videos in your store with a higher degree of composability. You can use it along with other `list-context` or `slider-layout` blocks to create different sliders and layouts. |\n\n### `media` block\n\nThe `media` block inherits all props from `image` and `video` blocks. It's highly recommended you check out the docs for [Image](https://github.com/vtex-apps/store-image) and [Video](https://github.com/vtex-apps/store-video) blocks before using this block.\n\nYou can use props from both blocks, but `media` will only consider the props from the block (`image` or `video`) that matches the current `mediaType`, or, in the case of `mediaType` being `imageOrVideo`, that matches the type of the `src`.\n\n| Prop name | Type | Description | Default value |\n| ----------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |\n| `mediaType` | enum | Type of the media to be displayed. Possible values are: `image` (behaves as an image block no matter the `src`), `video` (behaves as an video block no matter the `src`), and `imageOrVideo`. Choosing `imageOrVideo` will make `media` automatically identify the type of the `src` based on its extension and behave accordingly. | `imageOrVideo` |\n\nUse the **admin's Site Editor** to manage some props declared in the `media` block. Using the Site Editor to provide the image or video `src` will force you to choose between `image` and `video`.\n\n**Usage Example**:\n\n```json\n\"media#mobile-phone\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/mobile-phone.png\",\n \"blockClass\": \"storePrint\"\n }\n}\n```\n\n### `list-context.media-list` block\n\nThe `list-context.media-list` block acts just like the `list-context.image-list` block and inherits a lot from `image` and `video` blocks, with a few key differences. It's highly recommended you check out the docs for [Image](https://github.com/vtex-apps/store-image) and [Video](https://github.com/vtex-apps/store-video) blocks before using this block.\n\n`list-context.media-list` accepts both images and videos, so you can mix them inside a single carousel, for example. Images can receive `image` blocks' props and videos can receive `video` blocks' props. If you pass props that don't match the media type, they will be ignored.\n\n| Prop name | Type | Description | Default value |\n| ----------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |\n| `height` | `string | number` | This value is used for the `max-height` CSS property and **is applied to images only**. | `420` |\n| `mediaList` | [MediaListElement] | List of `MediaListElement` that represents the media to be added to the list context. | `[]` |\n\n- `MediaListElement` object\n\nA `MediaListElement` object has a very similar shape to the props accepted by the `media` component, that is, you can specify the `mediaType` of the asset you want to display and pass the props for `image` and `video` blocks. Read the docs for the `media` block to better understand how that works.\n\nDifferently from the `media` component, it does **not** use the `src` prop to receive the assets. For images, it uses the `image` and `mobileImage` props, and, for video, it uses the `video` and `mobileVideo` props.\n\n| Prop name | Type | Description | Default value |\n| ----------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |\n| `image` | `string` | URL to the image to be displayed. | undefined |\n| `mobileImage` | `string` | URL to the image to be displayed when the user is using a mobile device. If it's undefined, `image` will be used instead. | undefined |\n| `video` | `string` | URL to the video to be displayed. | undefined |\n| `mobileVideo` | `string` | URL to the video to be displayed when the user is using a mobile device. If it's undefined, `video` will be used instead. | undefined |\n\n\n**Usage Example**:\n\n```json\n\"list-context.media-list#demo\": {\n \"children\": [\"slider-layout#demo-media\"],\n \"props\": {\n \"height\": 720,\n \"mediaList\": [\n {\n \"image\": \"https://storecomponents.vteximg.com.br/arquivos/banner-principal.png\",\n \"mobileImage\": \"https://storecomponents.vteximg.com.br/arquivos/banner-principal-mobile.jpg\"\n },\n {\n \"video\": \"https://www.youtube.com/embed/JgkrlaF52WQ\"\n },\n {\n \"image\": \"https://storecomponents.vteximg.com.br/arquivos/banner.jpg\",\n \"mobileImage\": \"https://storecomponents.vteximg.com.br/arquivos/banner-principal-mobile.jpg\"\n }\n ]\n }\n},\n\"slider-layout#demo-media\": {\n \"props\": {\n \"itemsPerPage\": 1,\n \"infinite\": true,\n \"showNavigationArrows\": \"desktopOnly\",\n \"blockClass\": \"carousel\"\n }\n}\n```\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\nJust like they do with props, all blocks from this app inherits all of `image` and `video` blocks' CSS Handles. You can find them in their respective docs.\n\nKeep in mind that, for instance, applying CSS customizations to CSS Handles that came from `image` won't have any effect if the `mediaType` is set to `video` or if the `mediaType` is set to `imageOrVideo` and the `src` was identified as a video.\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\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\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<!-- DOCS-IGNORE:end -->\n\n```" } ]
code_store-media_eae44e94
[ { "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-media/react/MediaList.tsx from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { PropsWithChildren } from 'react'\nimport { useDevice } from 'vtex.device-detector'\nimport { ListContextProvider, useListContext } from 'vtex.list-context'\nimport type { ImageTypes } from 'vtex.store-image'\n\nimport { getMediaAsJSXList } from './modules/mediaAsList'\nimport type { MediaProps } from './MediaTypes'\n\nexport interface MediaListProps {\n /**\n * List of Media props that will be turned into a list of Media components\n * @default []\n */\n mediaList?: MediaProps[]\n}\n\nexport interface MediaListPropsWithHeight extends MediaListProps {\n /**\n * maxHeight to be applied to Media in case it's an image and is being used as a block\n * @default 420\n */\n height?: ImageTypes.ImageListProps['height']\n}\n\n/**\n * MediaList must receive a mediaList containing props identical\n * to the ones accepted by the Media component, meaning that it\n * receives 'src' when being used as a component.\n *\n * When used as a block, this component acts similar to the list-context.image-list block\n * present on the vtex.store-image app. It acceps 'image' and 'mobileImage'\n * to indicate the source of the image and, for video, it receives 'video' and 'mobileVideo'.\n */\nfunction MediaList(props: PropsWithChildren<MediaListProps>) {\n const { mediaList = [], children } = props\n\n // This is here to mantain compatibility with list-context.image-list\n const { height } = props as MediaListPropsWithHeight\n\n const list = useListContext()?.list ?? []\n const { isMobile } = useDevice()\n\n const imageListContent = getMediaAsJSXList(mediaList, isMobile, height)\n\n const newListContextValue = list.concat(imageListContent)\n\n return (\n <ListContextProvider list={newListContextValue}>\n {children}\n </ListContextProvider>\n )\n}\n\nMediaList.schema = {\n title: 'admin/editor.mediaList.title',\n}\n\nexport default MediaList\n\n```" } ]
code_store-media_a752c5b5
[ { "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-media/react/package.json from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"store-media\",\n \"version\": \"0.3.0\",\n \"license\": \"UNLICENSED\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\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/test-tools\": \"^3.3.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.6.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/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.list-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.list-context@0.2.0/public/@types/vtex.list-context\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.126.11/public/@types/vtex.render-runtime\",\n \"vtex.store-image\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-image@0.10.0/public/@types/vtex.store-image\",\n \"vtex.store-video\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-video@1.4.0/public/@types/vtex.store-video\"\n }\n}\n\n```" } ]
code_store-media_59b3f23b
[ { "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-media/react/MediaTypes.ts from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { VideoTypes } from 'vtex.store-video'\nimport type { ImageTypes } from 'vtex.store-image'\n\nimport type { MediaProps } from './Media'\nimport type { MediaListProps, MediaListPropsWithHeight } from './MediaList'\n\nexport { MediaProps, MediaListProps, MediaListPropsWithHeight }\n\nexport interface VideoModeProps extends Omit<VideoTypes.VideoPlayer, 'src'> {\n /**\n * The type of the media to be displayed\n * @default 'imageOrVideo'\n */\n mediaType?: 'video' | 'imageOrVideo'\n src?: VideoTypes.VideoPlayer['src']\n}\n\ntype ImageModeMediaType = {\n /**\n * The type of the media to be displayed\n * @default 'imageOrVideo'\n */\n mediaType?: 'image' | 'imageOrVideo'\n}\n\nexport type ImageModeProps = ImageModeMediaType & ImageTypes.ImageProps\n\n// Media type will always be defined (image or video), but assuring that here\n// makes the prop autocomplete on this component way less powerful\n// on the test site-editor tests\nexport interface VideoSchema extends Omit<VideoModeProps, 'src'> {\n videoUrl?: VideoTypes.VideoPlayer['src']\n}\n\nexport type MediaSchema = ImageTypes.ImageProps | VideoSchema\n\nexport type ImageListSchemaElement = Partial<ImageTypes.ImagesSchema[0]> &\n ImageModeMediaType\n\nexport type VideoListSchemaElement = Omit<VideoModeProps, 'src'> & {\n video?: VideoModeProps['src']\n mobileVideo?: VideoModeProps['src']\n}\n\nexport type MediaListSchemaElement =\n | ImageListSchemaElement\n | VideoListSchemaElement\n\nexport type MediaListWithSchema = MediaListSchemaElement[] | MediaProps[]\n\n```" } ]
code_store-media_ee0a2b5a
[ { "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-media/react/Media.tsx from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { Image } from 'vtex.store-image'\nimport { Video } from 'vtex.store-video'\nimport { useCssHandles, useCustomClasses } from 'vtex.css-handles'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\n\nimport type { VideoSchema, ImageModeProps, VideoModeProps } from './MediaTypes'\n\nconst IMAGE_CSS_HANDLES = Image.cssHandles\nconst VIDEO_CSS_HANDLES = Video.cssHandles\n\n/*\n * The no-useless-escape rule is disabled on these expressions so they work correctly on the popular\n * regex validator \"Regex101\". This makes it simple to debug them in the future.\n * */\n\n// The original regex for this validation was taken from here: https://stackoverflow.com/a/36991065/6352590\n// eslint-disable-next-line no-useless-escape\nconst isVideoFileRegex = /((?:https?(?:%3A%2F%2F|:\\/\\/))(?:www\\.)?(?:\\S+)(?:%2F|\\/)(?:(?!\\.(?:mp4|mkv|wmv|m4v|mov|avi|flv|webm))[^\\/])*\\.(mp4|mkv|wmv|m4v|mov|avi|flv|webm))(?!\\/|\\.[a-z]{1,3})/\n\n// The original regex for this validation was taken from here: https://stackoverflow.com/a/50777192/6352590\n// eslint-disable-next-line no-useless-escape\nconst isVimeoRegex = /(http|https)?:\\/\\/(www\\.|player\\.)?vimeo\\.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|video\\/|)(\\d+)(?:|\\/\\?)/\n\n// The original regex for this validation was taken from here: https://stackoverflow.com/a/61033353/6352590\n// eslint-disable-next-line no-useless-escape\nconst isYoutubeRegex = /(?:https?:\\/\\/)?(?:www\\.)?youtu(?:\\.be\\/|be.com\\/\\S*(?:watch|embed)(?:(?:(?=\\/[^&\\s\\?]+(?!\\S))\\/)|(?:\\S*v=|v\\/)))([^&\\s\\?]+)/\n\nfunction isVideoSrc(src?: string) {\n if (!src) {\n return false\n }\n\n const matchesVideoPatterns =\n isVideoFileRegex.test(src) ||\n isYoutubeRegex.test(src) ||\n isVimeoRegex.test(src)\n\n return matchesVideoPatterns\n}\n\ntype GetMediaValuesParams = {\n rawSrc?: ImageModeProps['src'] | VideoModeProps['src']\n mediaType: 'image' | 'video' | 'imageOrVideo'\n videoUrl?: VideoSchema['videoUrl']\n}\n\nfunction getMediaValues({ rawSrc, mediaType, videoUrl }: GetMediaValuesParams) {\n if (\n mediaType === 'video' ||\n (mediaType === 'imageOrVideo' && (videoUrl || isVideoSrc(rawSrc)))\n ) {\n return { isVideo: true, src: videoUrl ?? rawSrc }\n }\n\n return { isVideo: false, src: rawSrc }\n}\n\nfunction getModifiableHandles(handles: CssHandlesTypes.CssHandles<string[]>) {\n const modifiableHandles = {} as CssHandlesTypes.CustomClasses<string[]>\n\n Object.entries(handles).forEach(([handle, name]) => {\n modifiableHandles[handle] = { name, applyModifiers: true }\n })\n\n return modifiableHandles\n}\n\nexport type MediaProps = ImageModeProps | VideoModeProps\n\nfunction Media(props: MediaProps) {\n const { src: rawSrc, mediaType = 'imageOrVideo', classes } = props\n\n const { handles: imageHandles } = useCssHandles(IMAGE_CSS_HANDLES, {\n migrationFrom: ['vtex.store-image@0.x', 'vtex.store-components@3.x'],\n classes,\n })\n\n const { handles: videoHandles } = useCssHandles(VIDEO_CSS_HANDLES, {\n migrationFrom: 'vtex.store-video@1.x',\n classes,\n })\n\n const imageClasses = useCustomClasses(() =>\n getModifiableHandles(imageHandles)\n )\n\n const videoClasses = useCustomClasses(() =>\n getModifiableHandles(videoHandles)\n )\n\n /*\n * Dependency properties with the same name\n * on the schema conflicted when using different input methods.\n *\n * In this case, the src prop was showing as an image uploader\n * even when on video mode (where it shouldn't).\n *\n * This prop is used by the schema to receive the source of the video.\n * Since image is using a the src prop, they don't conflict.\n */\n const { videoUrl } = props as VideoSchema\n\n const { isVideo, src } = getMediaValues({\n rawSrc,\n mediaType,\n videoUrl,\n })\n\n if (isVideo) {\n return (\n <Video\n {...(props as VideoModeProps)}\n src={src ?? ''}\n classes={videoClasses}\n />\n )\n }\n\n return (\n <Image {...(props as ImageModeProps)} src={src} classes={imageClasses} />\n )\n}\n\nMedia.schema = {\n title: 'admin/editor.media.title',\n}\n\nexport default Media\n\n```" } ]
code_store-media_a2e82ad1
[ { "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-media/store/contentSchemas.json from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"definitions\": {\n \"Media\": {\n \"title\": \"admin/editor.media.title\",\n \"description\": \"admin/editor.media.description\",\n \"properties\": {\n \"mediaType\": {\n \"title\": \"admin/editor.mediaType.title\",\n \"type\": \"string\",\n \"enum\": [\"image\", \"video\"],\n \"enumNames\": [\n \"admin/editor.mediaType.image\",\n \"admin/editor.mediaType.video\"\n ]\n }\n },\n \"required\": [\"mediaType\"],\n \"dependencies\": {\n \"mediaType\": {\n \"oneOf\": [\n {\n \"properties\": {\n \"mediaType\": {\n \"enum\": [\"image\"]\n },\n \"$ref\": \"app:vtex.store-image#/definitions/Image/properties\"\n },\n \"dependencies\": {\n \"$ref\": \"app:vtex.store-image#/definitions/Image/dependencies\"\n }\n },\n {\n \"properties\": {\n \"mediaType\": {\n \"enum\": [\"video\"]\n },\n \"videoUrl\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/src\"\n },\n \"name\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/name\"\n },\n \"description\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/description\"\n },\n \"width\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/width\"\n },\n \"height\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/height\"\n },\n \"autoPlay\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/autoPlay\"\n },\n \"loop\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/loop\"\n },\n \"playsInline\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/playsInline\"\n },\n \"poster\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/poster\"\n },\n \"uploadDate\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/uploadDate\"\n }\n }\n }\n ]\n }\n }\n },\n \"MediaList\": {\n \"title\": \"admin/editor.mediaList.title\",\n \"description\": \"admin/editor.mediaList.description\",\n \"properties\": {\n \"mediaList\": {\n \"title\": \"admin/editor.mediaList.title\",\n \"type\": \"array\",\n \"items\": {\n \"title\": \"admin/editor.mediaList.title\",\n \"properties\": {\n \"$ref\": \"app:vtex.store-media#/definitions/Media/properties\"\n },\n \"required\": [\"mediaType\"],\n \"dependencies\": {\n \"mediaType\": {\n \"oneOf\": [\n {\n \"properties\": {\n \"mediaType\": {\n \"enum\": [\"image\"]\n },\n \"$ref\": \"app:vtex.store-image#/definitions/Images/items/properties\"\n },\n \"dependencies\": {\n \"$ref\": \"app:vtex.store-image#/definitions/Images/items/dependencies\"\n }\n },\n {\n \"properties\": {\n \"mediaType\": {\n \"enum\": [\"video\"]\n },\n \"video\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/src\"\n },\n \"mobileVideo\": {\n \"title\": \"admin/editor.mediaList.mobileVideo.title\",\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/src\"\n },\n \"name\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/name\"\n },\n \"description\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/description\"\n },\n \"width\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/width\"\n },\n \"height\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/height\"\n },\n \"autoPlay\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/autoPlay\"\n },\n \"loop\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/loop\"\n },\n \"playsInline\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/playsInline\"\n },\n \"poster\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/poster\"\n },\n \"uploadDate\": {\n \"$ref\": \"app:vtex.store-video#/definitions/Video/properties/uploadDate\"\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n }\n }\n}\n\n```" } ]
code_store-media_9094270b
[ { "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-media/store/interfaces.json from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"media\": {\n \"component\": \"Media\",\n \"content\": {\n \"$ref\": \"app:vtex.store-media#/definitions/Media\"\n }\n },\n \"list-context.media-list\": {\n \"component\": \"MediaList\",\n \"composition\": \"children\",\n \"content\": {\n \"$ref\": \"app:vtex.store-media#/definitions/MediaList\"\n }\n }\n}\n\n```" } ]
code_store-media_e91acc39
[ { "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-media/react/typings/gql.d.ts from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.gql' {\n import { DocumentNode } from 'graphql'\n\n const Schema: DocumentNode\n\n export default Schema\n}\n\ndeclare module '*.graphql' {\n import { DocumentNode } from 'graphql'\n\n const schema: DocumentNode\n\n export default Schema\n}\n\n```" } ]
code_store-media_e871b641
[ { "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-media/react/typings/css.d.ts from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.css' {\n type Styles = {\n [selector: string]: string\n }\n\n const styles: Styles\n\n export default styles\n}\n\n```" } ]
code_store-media_16087487
[ { "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-media/react/__tests__/MediaList.test.tsx from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { ComponentType } from 'react'\nimport { render } from '@vtex/test-tools/react'\n\nimport MediaList from '../MediaList'\nimport type {\n ImageListSchemaElement,\n MediaListSchemaElement,\n VideoListSchemaElement,\n} from '../MediaTypes'\n\nlet mockDeviceDetectorReturn = { isMobile: false }\n\njest.mock('vtex.device-detector', () => ({\n useDevice: jest.fn(() => mockDeviceDetectorReturn),\n}))\n\nconst MediaListSiteEditor = MediaList as ComponentType<{\n mediaList?: MediaListSchemaElement[]\n height?: number\n}>\n\ndescribe('Using list-context.media-list block via site-editor', () => {\n it('should render an youtube player correctly', () => {\n const mediaList = [\n {\n mediaType: 'video',\n video: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n },\n ] as VideoListSchemaElement[]\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render a vimeo player correctly', () => {\n const mediaList = [\n {\n mediaType: 'video',\n video: 'https://vimeo.com/89404519',\n },\n ] as VideoListSchemaElement[]\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player correctly', () => {\n const mediaList = [\n {\n mediaType: 'video',\n video: 'http://vtex.com/vtex.mp4',\n },\n ] as VideoListSchemaElement[]\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player using \"video\" even if \"src\" is set', () => {\n const video = 'http://vtex.com/vtex-video-url.mp4'\n const src = 'http://vtex.com/vtex-src.mp4'\n\n const mediaList = [\n {\n mediaType: 'video',\n video,\n src,\n },\n ] as Array<VideoListSchemaElement & { src: string }>\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n\n // Checks if the <source> inside <video> has the correct src value\n expect(queryByTestId('html5-player')?.firstElementChild).toHaveAttribute(\n 'src',\n video\n )\n })\n\n it('should render using mobileVideo when browsing through a mobile device', () => {\n mockDeviceDetectorReturn = { isMobile: true }\n\n const mediaList = [\n {\n mediaType: 'video',\n video: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n mobileVideo: 'http://vtex.com/vtex.mp4',\n },\n ] as VideoListSchemaElement[]\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n // Cleaning vtex.device-detector mobile mock\n mockDeviceDetectorReturn = { isMobile: false }\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render using video when browsing through a mobile device and mobileVideo is not set', () => {\n mockDeviceDetectorReturn = { isMobile: true }\n\n const mediaList = [\n {\n mediaType: 'video',\n video: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n },\n ] as VideoListSchemaElement[]\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n // Cleaning vtex.device-detector mobile mock\n mockDeviceDetectorReturn = { isMobile: false }\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render using video when browsing through a desktop device, even if mobileVideo is set', () => {\n const mediaList = [\n {\n mediaType: 'video',\n video: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n mobileVideo: 'http://vtex.com/vtex.mp4',\n },\n ] as VideoListSchemaElement[]\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render a HTML5 player even if \"video\" is malformed', () => {\n const mediaList = [\n {\n mediaType: 'video',\n // File with no extension\n video: 'vtex',\n },\n ] as VideoListSchemaElement[]\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render HTML5, Youtube and Vimeo player', () => {\n const mediaList = [\n {\n mediaType: 'video',\n video: 'http://vtex.com/vtex.mp4',\n },\n {\n mediaType: 'video',\n video: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n },\n {\n mediaType: 'video',\n video: 'https://vimeo.com/89404519',\n },\n ] as VideoListSchemaElement[]\n\n const { queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render an image correctly', () => {\n const image = 'vtex.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n })\n\n it('should render an image with default maxHeight if height is not set', () => {\n const DEFAULT_HEIGHT = 420\n const image = 'vtex.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n expect(queryByAltText(altText)).toHaveStyle(\n `max-height: ${DEFAULT_HEIGHT}px`\n )\n })\n\n it('should render an image with maxHeight if height is set', () => {\n const image = 'vtex.png'\n const altText = 'vtex-image'\n const height = 300\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} height={height} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n expect(queryByAltText(altText)).toHaveStyle(`max-height: ${height}px`)\n })\n\n it('should render an image with default width if it is not set', () => {\n const DEFAULT_WIDTH = '100%'\n const image = 'vtex.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n expect(queryByAltText(altText)).toHaveStyle(`width: ${DEFAULT_WIDTH}`)\n })\n\n it('should render an image with width if it is set', () => {\n const image = 'vtex.png'\n const altText = 'vtex-image'\n const width = '50%'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n width,\n image,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n expect(queryByAltText(altText)).toHaveStyle(`width: ${width}`)\n })\n\n it('should render an image using \"image\" even if \"src\" is set', () => {\n const image = 'vtex-image.png'\n const src = 'vtex-image-src.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n src,\n },\n ] as Array<ImageListSchemaElement & { src: string }>\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n })\n\n it('should render using mobileImage when browsing through a mobile device', () => {\n mockDeviceDetectorReturn = { isMobile: true }\n\n const image = 'vtex-image.png'\n const mobileImage = 'vtex-image-mobile.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n mobileImage,\n },\n ] as Array<ImageListSchemaElement & { src: string }>\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n // Cleaning vtex.device-detector mobile mock\n mockDeviceDetectorReturn = { isMobile: false }\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', mobileImage)\n })\n\n it('should render using image when browsing through a mobile device and mobileImage is not set', () => {\n mockDeviceDetectorReturn = { isMobile: true }\n\n const image = 'vtex-image.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n },\n ] as Array<ImageListSchemaElement & { src: string }>\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n // Cleaning vtex.device-detector mobile mock\n mockDeviceDetectorReturn = { isMobile: false }\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n })\n\n it('should render using image when browsing through a desktop device, even if mobileImage is set', () => {\n const image = 'vtex-image.png'\n const mobileImage = 'vtex-image-mobile.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n mobileImage,\n },\n ] as Array<ImageListSchemaElement & { src: string }>\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n })\n\n it('should render a list of images correctly', () => {\n const image1 = 'vtex-1.png'\n const image2 = 'vtex-2.png'\n const image3 = 'vtex-3.png'\n const altText1 = 'vtex-image-1'\n const altText2 = 'vtex-image-2'\n const altText3 = 'vtex-image-3'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText1,\n image: image1,\n },\n {\n mediaType: 'image',\n description: altText2,\n image: image2,\n },\n {\n mediaType: 'image',\n description: altText3,\n image: image3,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText1)).toBeInTheDocument()\n expect(queryByAltText(altText2)).toBeInTheDocument()\n expect(queryByAltText(altText3)).toBeInTheDocument()\n expect(queryByAltText(altText1)).toHaveAttribute('src', image1)\n expect(queryByAltText(altText2)).toHaveAttribute('src', image2)\n expect(queryByAltText(altText3)).toHaveAttribute('src', image3)\n })\n\n it('should render an image even if \"image\" is malformed', () => {\n // File with no extension\n const image = 'vtex'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText,\n image,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n })\n\n it('should render a list of images and videos correctly', () => {\n const image1 = 'vtex-1.png'\n const image2 = 'vtex-2.png'\n const altText1 = 'vtex-image-1'\n const altText2 = 'vtex-image-2'\n\n const mediaList = [\n {\n mediaType: 'image',\n description: altText1,\n image: image1,\n },\n {\n mediaType: 'video',\n video: 'http://vtex.com/vtex.mp4',\n },\n {\n mediaType: 'image',\n description: altText2,\n image: image2,\n },\n {\n mediaType: 'video',\n video: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText, queryByTestId } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText1)).toBeInTheDocument()\n expect(queryByAltText(altText2)).toBeInTheDocument()\n expect(queryByAltText(altText1)).toHaveAttribute('src', image1)\n expect(queryByAltText(altText2)).toHaveAttribute('src', image2)\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n})\n\ndescribe('Migration from list-context.image-list to list-context.media-list', () => {\n // The cases below are only possible in case of migration from\n // list-context.image-list to list.context.media-list\n it('should render an image correctly', () => {\n const image = 'vtex.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n description: altText,\n image,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n })\n\n it('should render an image using \"image\" even if \"src\" is set', () => {\n const image = 'vtex-image.png'\n const src = 'vtex-src.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n description: altText,\n image,\n src,\n },\n ] as Array<ImageListSchemaElement & { src: string }>\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n })\n\n it('should render a list of images correctly', () => {\n const image1 = 'vtex-1.png'\n const image2 = 'vtex-2.png'\n const image3 = 'vtex-3.png'\n const altText1 = 'vtex-image-1'\n const altText2 = 'vtex-image-2'\n const altText3 = 'vtex-image-3'\n\n const mediaList = [\n {\n description: altText1,\n image: image1,\n },\n {\n description: altText2,\n image: image2,\n },\n {\n description: altText3,\n image: image3,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText1)).toBeInTheDocument()\n expect(queryByAltText(altText2)).toBeInTheDocument()\n expect(queryByAltText(altText3)).toBeInTheDocument()\n expect(queryByAltText(altText1)).toHaveAttribute('src', image1)\n expect(queryByAltText(altText2)).toHaveAttribute('src', image2)\n expect(queryByAltText(altText3)).toHaveAttribute('src', image3)\n })\n\n it('should render an image even if \"image\" is malformed', () => {\n // File with no extension\n const image = 'vtex'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n description: altText,\n image,\n },\n ] as ImageListSchemaElement[]\n\n const { queryByAltText } = render(\n <MediaListSiteEditor mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', image)\n })\n})\n\ndescribe('Using list-context.media-list as a React Component', () => {\n it('should render an youtube player correctly', () => {\n const mediaList = [\n {\n src: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n },\n ]\n\n const { queryByTestId } = render(<MediaList mediaList={mediaList} />)\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render a vimeo player correctly', () => {\n const mediaList = [\n {\n src: 'https://vimeo.com/89404519',\n },\n ]\n\n const { queryByTestId } = render(<MediaList mediaList={mediaList} />)\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player correctly', () => {\n const mediaList = [\n {\n src: 'http://vtex.com/vtex.mp4',\n },\n ]\n\n const { queryByTestId } = render(<MediaList mediaList={mediaList} />)\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render HTML5, Youtube and Vimeo player', () => {\n const mediaList = [\n {\n src: 'http://vtex.com/vtex.mp4',\n },\n {\n src: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n },\n {\n src: 'https://vimeo.com/89404519',\n },\n ]\n\n const { queryByTestId } = render(<MediaList mediaList={mediaList} />)\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render an image correctly', () => {\n const src = 'vtex.png'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n alt: altText,\n src,\n },\n ]\n\n const { queryByAltText } = render(<MediaList mediaList={mediaList} />)\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', src)\n })\n\n it('should render a list of images correctly', () => {\n const src1 = 'vtex-1.png'\n const src2 = 'vtex-2.png'\n const src3 = 'vtex-3.png'\n const altText1 = 'vtex-image-1'\n const altText2 = 'vtex-image-2'\n const altText3 = 'vtex-image-3'\n\n const mediaList = [\n {\n alt: altText1,\n src: src1,\n },\n {\n alt: altText2,\n src: src2,\n },\n {\n alt: altText3,\n src: src3,\n },\n ]\n\n const { queryByAltText } = render(<MediaList mediaList={mediaList} />)\n\n expect(queryByAltText(altText1)).toBeInTheDocument()\n expect(queryByAltText(altText2)).toBeInTheDocument()\n expect(queryByAltText(altText3)).toBeInTheDocument()\n expect(queryByAltText(altText1)).toHaveAttribute('src', src1)\n expect(queryByAltText(altText2)).toHaveAttribute('src', src2)\n expect(queryByAltText(altText3)).toHaveAttribute('src', src3)\n })\n\n it('should render an image even if \"src\" is malformed', () => {\n // File with no extension\n const src = 'vtex'\n const altText = 'vtex-image'\n\n const mediaList = [\n {\n alt: altText,\n src,\n },\n ]\n\n const { queryByAltText } = render(<MediaList mediaList={mediaList} />)\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', src)\n })\n\n it('should render a list of images and videos correctly', () => {\n const imageSrc1 = 'vtex-1.png'\n const imageSrc2 = 'vtex-2.png'\n const altText1 = 'vtex-image-1'\n const altText2 = 'vtex-image-2'\n\n const mediaList = [\n {\n alt: altText1,\n src: imageSrc1,\n },\n {\n src: 'http://vtex.com/vtex.mp4',\n },\n {\n alt: altText2,\n src: imageSrc2,\n },\n {\n src: 'https://www.youtube.com/watch?v=hT0OMD11b0A',\n },\n ]\n\n const { queryByAltText, queryByTestId } = render(\n <MediaList mediaList={mediaList} />\n )\n\n expect(queryByAltText(altText1)).toBeInTheDocument()\n expect(queryByAltText(altText2)).toBeInTheDocument()\n expect(queryByAltText(altText1)).toHaveAttribute('src', imageSrc1)\n expect(queryByAltText(altText2)).toHaveAttribute('src', imageSrc2)\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n})\n\n```" } ]
code_store-media_1d0f19a7
[ { "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-media/react/__tests__/Media.test.tsx from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { ComponentType } from 'react'\nimport { render } from '@vtex/test-tools/react'\n\nimport Media from '../Media'\nimport type { MediaSchema, MediaProps } from '../MediaTypes'\n\ndescribe('Using media block via site-editor', () => {\n const MediaSiteEditor = Media as ComponentType<MediaProps & MediaSchema>\n\n it('should render a youtube player correctly', () => {\n const { queryByTestId } = render(\n <MediaSiteEditor\n mediaType=\"video\"\n videoUrl=\"https://www.youtube.com/watch?v=hT0OMD11b0A\"\n />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render a vimeo player correctly', () => {\n const { queryByTestId } = render(\n <MediaSiteEditor\n mediaType=\"video\"\n videoUrl=\"https://vimeo.com/89404519\"\n />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player correctly', () => {\n const { queryByTestId } = render(\n <MediaSiteEditor mediaType=\"video\" videoUrl=\"http://vtex.com/vtex.mp4\" />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player using videoUrl even if src is set', () => {\n const videoUrl = 'http://vtex.com/vtex-video-url.mp4'\n const src = 'http://vtex.com/vtex-src.mp4'\n\n const { queryByTestId } = render(\n <MediaSiteEditor mediaType=\"video\" videoUrl={videoUrl} src={src} />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n\n // Checks if the <source> inside <video> has the correct src value\n expect(queryByTestId('html5-player')?.firstElementChild).toHaveAttribute(\n 'src',\n videoUrl\n )\n })\n\n it('should render a HTML5 player even if videoUrl is malformed', () => {\n const { queryByTestId } = render(\n // File with no extension\n <MediaSiteEditor mediaType=\"video\" videoUrl=\"vtex\" />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render an image correctly', () => {\n const altText = 'vtex-image'\n\n const { queryByAltText } = render(\n <MediaSiteEditor mediaType=\"image\" src=\"vtex.png\" alt={altText} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', 'vtex.png')\n })\n\n it('should render an image even if src is malformed', () => {\n const altText = 'vtex-image'\n const src = 'vtex'\n\n const { queryByAltText } = render(\n <MediaSiteEditor mediaType=\"image\" src={src} alt={altText} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', src)\n })\n})\n\ndescribe('Using media with fixed mediaType', () => {\n it('should render a youtube player correctly', () => {\n const { queryByTestId } = render(\n <Media\n mediaType=\"video\"\n src=\"https://www.youtube.com/watch?v=hT0OMD11b0A\"\n />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render a vimeo player correctly', () => {\n const { queryByTestId } = render(\n <Media mediaType=\"video\" src=\"https://vimeo.com/89404519\" />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player correctly', () => {\n const { queryByTestId } = render(\n <Media mediaType=\"video\" src=\"http://vtex.com/vtex.mp4\" />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player even if src is malformed', () => {\n const { queryByTestId } = render(\n // File with no extension\n <Media mediaType=\"video\" src=\"vtex\" />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render an image correctly', () => {\n const altText = 'vtex-image'\n const src = 'vtex.png'\n\n const { queryByAltText } = render(\n <Media mediaType=\"image\" src={src} alt={altText} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', src)\n })\n\n it('should render an image even if src is malformed', () => {\n const altText = 'vtex-image'\n const src = 'vtex'\n\n const { queryByAltText } = render(\n <Media mediaType=\"image\" src={src} alt={altText} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', src)\n })\n\n it('should render an image if mediaType is set to image, even if src has mp4 extension', () => {\n const altText = 'vtex-image'\n\n const { queryByAltText } = render(\n <Media\n mediaType=\"image\"\n src=\"http://vtex.com/vtex-png.mp4\"\n alt={altText}\n />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n })\n})\n\ndescribe('Using media with imageOrVideo mediaType', () => {\n it('should render a youtube player correctly', () => {\n const { queryByTestId } = render(\n <Media\n mediaType=\"imageOrVideo\"\n src=\"https://www.youtube.com/watch?v=hT0OMD11b0A\"\n />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).toBeInTheDocument()\n })\n\n it('should render a vimeo player correctly', () => {\n const { queryByTestId } = render(\n <Media mediaType=\"imageOrVideo\" src=\"https://vimeo.com/89404519\" />\n )\n\n expect(queryByTestId('html5-player')).not.toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player correctly', () => {\n const { queryByTestId } = render(\n <Media mediaType=\"imageOrVideo\" src=\"http://vtex.com/video.mp4\" />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player correctly even if src has name \"png\" on it', () => {\n const { queryByTestId } = render(\n <Media mediaType=\"imageOrVideo\" src=\"http://vtex.com/vtex-png.mp4\" />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render a HTML5 player correctly even if src has query params', () => {\n const { queryByTestId } = render(\n <Media\n mediaType=\"imageOrVideo\"\n src=\"http://vtex.com/vtex-png.mp4?one=1&two=2&three=3\"\n />\n )\n\n expect(queryByTestId('html5-player')).toBeInTheDocument()\n expect(queryByTestId('vimeo-player')).not.toBeInTheDocument()\n expect(queryByTestId('youtube-player')).not.toBeInTheDocument()\n })\n\n it('should render an image correctly', () => {\n const altText = 'vtex-image'\n const src = 'vtex.png'\n\n const { queryByAltText } = render(\n <Media mediaType=\"imageOrVideo\" src={src} alt={altText} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', src)\n })\n\n it('should render an image if src is malformed', () => {\n const altText = 'vtex-image'\n const src = 'vtex'\n\n const { queryByAltText } = render(\n <Media mediaType=\"imageOrVideo\" src={src} alt={altText} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n expect(queryByAltText(altText)).toHaveAttribute('src', src)\n })\n\n it('should render an image correctly even if src has \"mp4\", \"youtube\" or \"vimeo\" on it', () => {\n const altText = 'vtex-image'\n\n const { queryByAltText } = render(\n <Media\n mediaType=\"imageOrVideo\"\n src=\"vtex-youtube-vimeo-mp4.png\"\n alt={altText}\n />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n })\n\n it('should render an image correctly even if src has query params', () => {\n const altText = 'vtex-image'\n\n const { queryByAltText } = render(\n <Media\n mediaType=\"imageOrVideo\"\n src=\"vtex-mp4.png?one=1&two=2&three=3\"\n alt={altText}\n />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n })\n\n it('should render an image correctly even if src has no extension', () => {\n const altText = 'vtex-image'\n\n const { queryByAltText } = render(\n <Media\n mediaType=\"imageOrVideo\"\n src=\"http://vtex.com/vtex-image-mp4\"\n alt={altText}\n />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n })\n\n it('should render an image if src is not set', () => {\n const altText = 'vtex-image'\n\n const { queryByAltText } = render(\n <Media mediaType=\"imageOrVideo\" alt={altText} />\n )\n\n expect(queryByAltText(altText)).toBeInTheDocument()\n })\n})\n\n```" } ]
code_store-media_f051ba84
[ { "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-media/react/modules/mediaAsList.tsx from the store-media VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport Media from '../Media'\nimport type {\n ImageModeProps,\n VideoModeProps,\n ImageListSchemaElement,\n VideoListSchemaElement,\n MediaListSchemaElement,\n MediaProps,\n} from '../MediaTypes'\n\nexport const getMediaAsJSXList = (\n mediaList: MediaProps[],\n isMobile: boolean,\n maxHeight?: string | number\n) => {\n return mediaList.map((props: MediaProps | MediaListSchemaElement, idx) => {\n const { mediaType } = props as MediaProps\n\n const {\n image,\n mobileImage,\n // This is here to mantain compatibility with list-context.image-list\n description,\n width = '100%',\n } = props as ImageListSchemaElement\n\n // If it's being used as a block and it's set to be 'image', 'imageOrVideo' or undefined\n if (mediaType !== 'video' && (image || mobileImage)) {\n return (\n <Media\n key={idx}\n {...(props as ImageModeProps)}\n mediaType=\"image\"\n src={isMobile && mobileImage ? mobileImage : image}\n // These are here to mantain compatibility with list-context.image-list\n alt={description}\n maxHeight={maxHeight ?? 420}\n width={width}\n />\n )\n }\n\n const { video, mobileVideo } = props as VideoListSchemaElement\n\n // If it's being used as a block and it's set to be 'video', 'imageOrVideo' or undefined\n if (mediaType !== 'image' && (video || mobileVideo)) {\n return (\n <Media\n key={idx}\n {...(props as VideoModeProps)}\n mediaType=\"video\"\n src={isMobile && mobileVideo ? mobileVideo : video}\n />\n )\n }\n\n // If it's being used as a React Component\n // mediaType can be either 'image', 'video', 'imageOrVideo' or undefined\n return <Media key={idx} {...(props as MediaProps)} />\n })\n}\n\n```" } ]
code_external-seller-example_779e2c9f
[ { "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 external-seller-example/docs/README.md from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# External Seller Example\n\nThis is an example application to build an integration with an external seller. It's important to emphasize that it contains mocked data, but it can be used as the first step towards developing a fully function integration.\n\nIn the following sections, we explain some details regarding the app that's been developed, such as the routes that are available and GraphQL queries and mutations. It's really important for you to read it and make sure that you fully understand what is mandatory to be implemented. We do encourage you to check [our documentation](https://developers.vtex.com/vtex-developer-docs/docs/external-seller-integration-connector) about creating an external seller connector.\n\nSo you can test it, you can follow the steps below:\n1. Link this application on a development workspace of a VTEX account;\n2. Open the GraphiQL link that is available when the app is successfully linked;\n3. Use the GraphQL IDE to create a seller on the VTEX account;\n4. Make a request to send a SKU suggestion to the marketplace (you can use the SKU Suggestion request in [this Postman collection](https://www.getpostman.com/collections/37709bb691b50a08348c));\n5. Wait for the suggestion to pass through our matcher and appear as a Received SKU, on VTEX account's admin panel (Admin > Seller > Received SKUs);\n6. At this point, you can approve the SKU so it will appear on the marketplace's store. To do that, it's necessary to select both the category and the brand of the product. In case of not having, you can create it on the Catalog panel;\n7. Wait for the product to be indexed;\n8. Once it's already available on the store, you can test to buy it. By doing that, you'll automatically trigger all the order flow until the Order Placement. After that, you can test the routes that are exposed on this app regarding invoicing, tracking or cancellation.\n\nFeel free to contribute to this repo in case of identifying any problems or having suggestions to improve it! :rocket:\n\n## Routes\nThere are some routes that need to be implemented on the seller integration, in order for the marketplace to be able to communicate with the external services from the seller. For each route, there is a handler that is responsible for using the External Seller client to establish the communication with the external API. \n\nBesides that, some routes were implemented to perform the other way communication, from the seller to the marketplace; an external seller integration has a two way communication. You can check in [this documentation](https://developers.vtex.com/vtex-developer-docs/docs/external-seller-integration-connector) the target of each request that can happen.\n\n## Handlers\n\n| **Handler file** | **Implemented Functions** | Use |\n|-----------------------------|----------------------------------------------------|----------------------------------------------------------------------|\n| `fulfillmentSimulation.ts` | `fullfilmentSimulation` | This is the most important route when developing an external seller integration. It needs to have high availability, because whenever the marketplace needs to check the current price or inventory, it will use this route. **NOTE**: This route has a 2.5s timeout. |\n| `orderCancellation.ts` | `mkpOrderCancellation`, `sellerOrderCancellation` | The order cancellation can be done by both: marketplace or seller. In case of being the seller the one that's cancelling, it will use an endpoint from OMS. On the other side, if it's the marketplace, it will send a request to a route that is exposed on this app. |\n| `orderDispatching.ts` | `dispatchOrder` | Responsible for sending information regarding the order dispatch to the marketplace |\n| `orderPlacement.ts` | `placeOrder` | Once the order is placed on the marketplace, it sends information about it to the seller, so the placement can happen also in the seller side, when it will inform the order ID |\n| `skuSuggestion` | `suggestSku` | Handles the SKU suggestions that the seller can send to the marketplace, whether to send a new SKU or update one that has already been registered in the marketplace. |\n| `invoice.ts` | `invoiceOrder` | Implements the order invoice on the seller side. It has to connect to its external API. |\n| `tracking.ts` | `sendTrackingInformation` | It uses the same endpoint as the `invoice` method, but sends different information. Tracking information can only be sent once the order was invoiced. |\n\n---\n\n## Utils\nThis boilerplate uses some utils functions in order to have a cleaner code. \n> **NOTE!** It's important to pay attention that some of the utils functions are used with only one purpose: provide mocked data as the response bodies. **Those functions are not going to be used on a real integration.**\n\n## GraphQL queries\n### Get list of sellers\nReturns the list of sellers that are registered on the account. Below you can find a query example and what it returns. \n\n> **NOTE!** This resolver was implemented so the developer can debug his application, to check whether registration of a seller worked or not.\n```graphql\nquery {\n getSellerList{\n SellerId\n Name\n FulfillmentEndpoint\n CatalogSystemEndpoint\n }\n}\n```\n\n```json\n{\n \"data\": {\n \"getSellerList\": [\n {\n \"SellerId\": \"externalsellertest\",\n \"Name\": \"External Seller Test\",\n \"FulfillmentEndpoint\": \"http://fabiana--pilateslovers.myvtex.com/my-seller\",\n \"CatalogSystemEndpoint\": \"http://fabiana--pilateslovers.myvtex.com/my-seller\"\n }\n ]\n }\n}\n```\n\n> It's important to know that there are other fields for each seller, you can check them out on the Documentation tab, on _GraphiQL_ or in the `schema.graphql`.\n\n## GraphQL mutations\n### Creating a seller\nIn order to create a seller, it's necessary to provide a body with all the mandatory information described on the schema. As a matter of simplifying this template application, we chose to keep the seller creation on a GraphQL mutation, so it can be set on the front-end, such as an admin panel. It would be possible to have it on the back-end, triggered by a set up button on the admin panel.\n\nExample of mutation and its query variables:\n```graphql\nmutation ($seller: SellerInput){\n createSellerOnMarketplace(seller: $seller) {\n SellerId\n Name\n Email\n FulfillmentEndpoint\n CatalogSystemEndpoint\n }\n}\n```\n\n```json\n{\n \"seller\": {\n \"SellerId\": \"externalsellertest\",\n \"Email\": \"fabiana.fonseca@vtex.com.br\",\n \"Name\": \"External Seller Test\",\n \"FulfillmentEndpoint\": \"http://fabiana--appliancetheme.myvtex.com/my-seller\",\n \"CatalogSystemEndpoint\": \"http://fabiana--appliancetheme.myvtex.com/my-seller\",\n \"UseHybridPaymentOptions\": false,\n \"CSCIdentification\": \"externalsellertest\",\n \"ProductCommissionPercentage\": 0,\n \"FreightCommissionPercentage\": 0\n }\n}\n```\n\n> The fields that are on the query variables are the mandatory ones, but there are other fields, which you can check on the **Docs** tab, on the top right of GraphiQL.\n\n```" } ]
code_external-seller-example_f3272551
[ { "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 external-seller-example/graphql/schema.graphql from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\ntype Query {\n getSellerList: [Seller]\n}\n\ntype Mutation {\n createSellerOnMarketplace(seller: SellerInput): Seller\n}\n\ninput SellerInput {\n SellerId: String!\n Name: String!\n Email: String!\n Description: String\n ExchangeReturnPolicy: String\n DeliveryPolicy: String\n UseHybridPaymentOptions: Boolean!\n UserName: String\n Password: String\n SecutityPrivacyPolicy: String\n CNPJ: String\n CSCIdentification: String!\n ArchiveId: String\n UrlLogo: String\n ProductCommissionPercentage: Float!\n FreightCommissionPercentage: Float!\n FulfillmentEndpoint: String!\n CatalogSystemEndpoint: String!\n IsActive: Boolean\n FulfillmentSellerId: String\n SellerType: Int\n IsBetterScope: Boolean\n}\n\ntype Seller {\n SellerId: String\n Name: String\n Email: String\n Description: String\n ExchangeReturnPolicy: String\n DeliveryPolicy: String\n UseHybridPaymentOptions: Boolean\n UserName: String\n Password: String\n SecutityPrivacyPolicy: String\n CNPJ: String\n CSCIdentification: String\n ArchiveId: String\n UrlLogo: String\n ProductCommissionPercentage: Float\n FreightCommissionPercentage: Float\n FulfillmentEndpoint: String\n CatalogSystemEndpoint: String\n IsActive: Boolean\n FulfillmentSellerId: String\n SellerType: Int\n IsBetterScope: Boolean\n}\n\n```" } ]
code_external-seller-example_67bb1b13
[ { "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 external-seller-example/node/service.json from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"memory\": 256,\n \"ttl\": 10,\n \"timeout\": 2,\n \"minReplicas\": 2,\n \"maxReplicas\": 4,\n \"workers\": 1,\n \"routes\": {\n \"fullfilmentSimulation\": {\n \"path\": \"/my-seller/pvt/orderForms/simulation\",\n \"public\": true\n },\n \"orderPlacement\": {\n \"path\": \"/my-seller/pvt/orders\",\n \"public\": true\n },\n \"orderDispatching\": {\n \"path\": \"/my-seller/pvt/orders/:orderId/fulfill\",\n \"public\": true\n },\n \"mkpCancellation\": {\n \"path\": \"/my-seller/pvt/orders/:orderId/cancel\",\n \"public\": true\n },\n \"sellerCancellation\": {\n \"path\": \"/my-seller/pvt/orders/seller/cancel\",\n \"public\": true\n },\n \"skuSuggestion\": {\n \"path\": \"/my-seller/suggestion/:sellerId/:sellerSkuId\",\n \"public\": true\n },\n \"invoice\": {\n \"path\": \"/my-seller/oms/invoice/:marketplaceOrderId\",\n \"public\": true\n },\n \"trackingInfo\": {\n \"path\": \"/my-seller/oms/tracking/:marketplaceOrderId\",\n \"public\": true\n }\n }\n}\n\n```" } ]
code_external-seller-example_99b83a17
[ { "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 external-seller-example/node/package.json from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"@vtex/clients\": \"^1.0.4\",\n \"co-body\": \"^6.0.0\",\n \"ramda\": \"^0.25.0\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^0.0.3\",\n \"@types/jest\": \"^24.0.18\",\n \"@types/node\": \"^12.0.0\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/prettier-config\": \"^0.3.1\",\n \"typescript\": \"3.9.7\",\n \"@vtex/api\": \"6.45.13\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty\"\n },\n \"version\": \"0.1.1\"\n}\n\n```" } ]
code_external-seller-example_3e03105f
[ { "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 external-seller-example/node/index.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n ClientsConfig,\n LRUCache,\n method,\n Service,\n ServiceContext,\n} from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { fullfilmentSimulation } from './handlers/fullfilmentSimulation'\nimport { placeOrder } from './handlers/orderPlacement'\nimport { suggestSku } from './handlers/skuSuggestion'\nimport { invoiceOrder } from './handlers/invoice'\nimport { createSellerOnMarketplace, getSellerList } from './resolvers/seller'\nimport { dispatchOrder } from './handlers/orderDispatching'\nimport { sendTrackingInformation } from './handlers/tracking'\nimport {\n mkpOrderCancellation,\n sellerOrderCancellation,\n} from './handlers/orderCancellation'\n\nconst TIMEOUT_MS = 800\n\n// Create a LRU memory cache for the Status client.\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('status', memoryCache)\n\n// This is the configuration for clients available in `ctx.clients`.\nconst clients: ClientsConfig<Clients> = {\n // We pass our custom implementation of the clients bag, containing the Status client.\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 },\n // This key will be merged with the default options and add this cache to our Status client.\n status: {\n memoryCache,\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({\n clients,\n routes: {\n fullfilmentSimulation: method({\n POST: fullfilmentSimulation,\n }),\n orderPlacement: method({\n POST: placeOrder,\n }),\n mkpCancellation: method({\n POST: mkpOrderCancellation,\n }),\n sellerCancellation: method({\n POST: sellerOrderCancellation,\n }),\n orderDispatching: method({\n POST: dispatchOrder,\n }),\n skuSuggestion: method({\n POST: suggestSku,\n }),\n invoice: method({\n POST: invoiceOrder,\n }),\n trackingInfo: method({\n POST: sendTrackingInformation,\n }),\n },\n graphql: {\n resolvers: {\n Query: {\n getSellerList,\n },\n Mutation: {\n createSellerOnMarketplace,\n },\n },\n },\n})\n\n```" } ]
code_external-seller-example_25194532
[ { "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 external-seller-example/node/clients/externalSeller.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { NotificationInput } from '@vtex/clients'\nimport { ExternalClient, InstanceOptions, IOContext } from '@vtex/api'\n\nimport {\n SimulationInput,\n SimulationResponse,\n} from '../typings/fullfilmentSimulation'\nimport {\n MarketplaceOrderInput,\n MarketplaceOrderResponse,\n} from '../typings/orderPlacement'\nimport { getItemsInfoFromInput } from '../utils/simulationMock'\n\nexport class ExternalSeller extends ExternalClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(`baseUrl`, ctx, {\n ...options,\n })\n }\n\n public fullfilmentSimulation(input: SimulationInput) {\n const items = getItemsInfoFromInput(input)\n\n const body: SimulationResponse = {\n country: 'BRA',\n items,\n logisticsInfo: [\n {\n itemIndex: 0,\n quantity: 1,\n shipsTo: ['BRA'],\n slas: [\n {\n id: 'Regular',\n deliveryChannel: 'delivery',\n name: 'Regular Delivery',\n price: 1000,\n shippingEstimate: '7bd',\n },\n ],\n stockBalance: 199,\n deliveryChannels: [\n {\n id: 'delivery',\n stockBalance: 179,\n },\n {\n id: 'pickup-in-point',\n stockBalance: 20,\n },\n ],\n },\n ],\n postalCode: input.postalCode,\n }\n\n return body\n }\n\n public placeOrder(request: MarketplaceOrderInput) {\n const body: MarketplaceOrderResponse = {\n ...request,\n orderId: '123456',\n followUpEmail: 'fabiana.fonseca@vtex.com.br',\n }\n\n return body\n }\n\n public async dispatchOrder(orderId: string, marketplaceOrderId: string) {\n const body: OrderDispatch = {\n date: new Date().toISOString(),\n marketplaceOrderId,\n orderId,\n receipt: null,\n }\n\n return body\n }\n\n public async invoiceOrder(_: string) {\n const invoiceData: NotificationInput = {\n type: 'Output',\n invoiceNumber: 'NFe-00001',\n issuanceDate: '2020-11-21T00:00:00',\n invoiceValue: 38500,\n invoiceUrl: 'https://7dfd0931fce9d4b74d20fd70d48eb714.m.pipedream.net',\n courier: '',\n trackingNumber: '',\n trackingUrl: '',\n items: [\n {\n id: '345117',\n quantity: 1,\n price: 9003,\n },\n ],\n }\n\n return invoiceData\n }\n\n public async cancelOrder(orderId: string, marketplaceOrderId: string) {\n const body = {\n date: '2020-11-02 18:52:00',\n marketplaceOrderId,\n orderId,\n receipt: 'e39d05f9-0c54-4469-a626-8bb5cff169f8',\n }\n\n return body\n }\n}\n\ninterface OrderDispatch {\n date: string\n marketplaceOrderId: string\n orderId: string\n receipt: string | null\n}\n\n```" } ]
code_external-seller-example_cb416ba9
[ { "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 external-seller-example/node/clients/index.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\nimport { Catalog, OMS, Suggestions } from '@vtex/clients'\n\nimport { ExternalSeller } from './externalSeller'\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {\n public get externalSeller() {\n return this.getOrSet('externalSeller', ExternalSeller)\n }\n\n public get catalog() {\n return this.getOrSet('catalog', Catalog)\n }\n\n public get suggestion() {\n return this.getOrSet('suggestions', Suggestions)\n }\n\n public get oms() {\n return this.getOrSet('oms', OMS)\n }\n}\n\n```" } ]
code_external-seller-example_875f266f
[ { "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 external-seller-example/node/typings/orderPlacement.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport interface MarketplaceOrderInput {\n marketplaceOrderId: string\n marketplaceServicesEndpoint: string\n marketplacePaymentValue: number\n items: Item[]\n clientProfileData: ClientProfileData\n shippingData: ShippingData\n openTextField?: any\n marketingData?: MarketingData\n paymentData?: any\n}\n\nexport interface MarketplaceOrderResponse extends MarketplaceOrderInput {\n orderId: string\n followUpEmail: string\n}\n\ninterface ClientProfileData {\n email: string\n firstName: string\n lastName: string\n documentType: string\n document: string\n phone: string\n corporateName: string | null\n tradeName: string | null\n corporateDocument: string | null\n stateInscription: string | null\n corporatePhone: string | null\n isCorporate: boolean\n userProfileId: string | null\n}\n\ninterface Item {\n id: string\n quantity: number\n Seller: string\n commission: number\n freightCommission: number\n price: number\n bundleItems: any[]\n itemAttachment: ItemAttachment\n attachments: any[]\n priceTags: any[]\n measurementUnit: string\n unitMultiplier: number\n isGift: boolean\n}\n\ninterface ItemAttachment {\n name: string\n content: any\n}\n\ninterface MarketingData {\n utmSource: string\n utmMedium: string\n utmCampaign: string\n utmiPage: string\n utmiPart: string\n utmiCampaign: string\n}\n\ninterface ShippingData {\n address: OrderAddress\n logisticsInfo: OrderLogisticsInfo[]\n}\n\ninterface OrderAddress {\n addressType: string\n receiverName: string\n addressId: string\n postalCode: string\n city: string\n state: string\n country: string\n street: string\n number: string\n neighborhood: string\n complement: string | null\n reference: string\n geoCoordinates: any[]\n}\n\ninterface OrderLogisticsInfo {\n itemIndex: number\n selectedSla: string\n lockTTL: string\n shippingEstimate: string\n price: number\n deliveryWindow: any\n}\n\n```" } ]
code_external-seller-example_f9052744
[ { "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 external-seller-example/node/typings/fullfilmentSimulation.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ClientProfileDetail } from '@vtex/clients'\n\nexport interface SimulationResponse {\n country: string\n items: SimulationItem[]\n logisticsInfo: LogisticsInfo[]\n postalCode?: string\n}\n\nexport interface SimulationItem {\n attachmentOfferings?: AttachmentOffering[]\n id: string\n listPrice?: number\n measurementUnit: string\n merchantName: string | null\n offerings?: Offering[]\n price: number\n priceTags: any[]\n priceValidUntil: null\n quantity: number\n requestIndex: number\n seller: string\n unitMultiplier: number\n}\n\ninterface AttachmentOffering {\n name: string\n required: boolean\n schema: Schema\n}\n\ninterface Schema {\n Name: Name\n Number: Name\n}\n\ninterface Name {\n maximumNumberOfCharacters: number\n domain: any[]\n}\n\ninterface Offering {\n type: string\n id: string\n name: string\n price: number\n}\n\ninterface LogisticsInfo {\n itemIndex: number\n quantity: number\n shipsTo: string[]\n slas: Sla[] | []\n stockBalance: number\n deliveryChannels: DeliveryChannel[]\n}\n\ninterface DeliveryChannel {\n id: string\n stockBalance: number\n}\n\ninterface Sla {\n id: string\n deliveryChannel: string\n name: string\n price: number\n shippingEstimate: string\n availableDeliveryWindows?: AvailableDeliveryWindow[]\n pickupStoreInfo?: PickupStoreInfo\n}\n\ninterface AvailableDeliveryWindow {\n startDateUtc: string\n endDateUtc: string\n price: number\n}\n\ninterface PickupStoreInfo {\n isPickupStore: boolean\n friendlyName: string\n address: Address\n additionalInfo: string\n}\n\ninterface Address {\n addressType: string\n receiverName: null\n addressId: string\n postalCode: string\n city: string\n state: string\n country: string\n street: string\n number: string\n neighborhood: string\n complement: string\n reference: null\n geoCoordinates: number[]\n}\n\nexport interface SimulationInput {\n postalCode: string\n geoCoordinates: string[]\n country: string | null\n items: Item[]\n priceTables: any[]\n marketingData: any\n clientProfileData: ClientProfileDetail | null\n shippingData: ShippingData | null\n paymentData: any\n orderFormId: string | null\n isCheckedIn: boolean\n storeId: string | null\n selectedSla: string\n checkedInPickupPointId: string | null\n}\n\ninterface ShippingData {\n state: string\n city: string\n neighborhood: string\n street: string\n isFOB: boolean\n selectedAddresses: any[]\n logisticsInfo: LogisticsInfo[]\n}\n\ninterface Item {\n id: string\n seller: string\n quantity: number\n parentItemIndex: any\n parentAssembluBinding: any\n}\n\n```" } ]
code_external-seller-example_1020b540
[ { "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 external-seller-example/node/utils/orderPlacement.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { MarketplaceOrderInput } from '../typings/orderPlacement'\n\nexport const processAllOrderInputs = (\n ctx: Context,\n requests: MarketplaceOrderInput[]\n) => {\n const {\n clients: { externalSeller },\n } = ctx\n\n return requests.map((order) => externalSeller.placeOrder(order))\n}\n\n```" } ]
code_external-seller-example_36457684
[ { "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 external-seller-example/node/utils/simulationMock.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n SimulationInput,\n SimulationItem,\n} from '../typings/fullfilmentSimulation'\n\nexport const getItemsInfoFromInput = (input: SimulationInput) =>\n input.items.map((item) => {\n const { id, quantity, seller } = item\n\n return <SimulationItem>{\n id,\n quantity,\n seller,\n measurementUnit: 'un',\n merchantName: null,\n price: 37500,\n priceTags: [],\n priceValidUntil: null,\n requestIndex: 0,\n unitMultiplier: 1,\n }\n })\n\n```" } ]
code_external-seller-example_a513b01e
[ { "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 external-seller-example/node/resolvers/seller.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Seller } from '@vtex/clients'\n\nexport const createSellerOnMarketplace = async (\n _: unknown,\n body: SellerGraphqlVars,\n ctx: Context\n) => {\n const {\n clients: { catalog },\n } = ctx\n\n const token = 'ADMIN_TOKEN'\n\n const { seller } = body\n\n return catalog.createSeller(seller, token)\n}\n\nexport const getSellerList = async (_: unknown, __: unknown, ctx: Context) => {\n const {\n clients: { catalog },\n } = ctx\n\n return catalog.getSellerList()\n}\n\ninterface SellerGraphqlVars {\n seller: Seller\n}\n\n```" } ]
code_external-seller-example_4f9f3fa6
[ { "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 external-seller-example/node/handlers/invoice.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/**\n * Invoices the order on the seller side. In case of happening\n * any problem during the invoice, it will trigger the cancellation\n * by the seller.\n * @param {Context} ctx\n */\nexport async function invoiceOrder(ctx: Context) {\n const {\n clients: { externalSeller, oms },\n state: { body: marketplaceOrderId },\n } = ctx\n\n /*\n Try catch to make sure that any problem that happens while\n invoicing will trigger the order cancellation by the seller\n */\n try {\n const invoiceData = await externalSeller.invoiceOrder(\n marketplaceOrderId as string\n )\n\n ctx.body = await oms.orderNotification(\n marketplaceOrderId as string,\n invoiceData\n )\n ctx.status = 200\n } catch (e) {\n ctx.body = 'An error has ocurred while invoicing. Order was canceled.'\n ctx.status = 500\n }\n}\n\n```" } ]
code_external-seller-example_d0467b64
[ { "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 external-seller-example/node/handlers/orderCancellation.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { json } from 'co-body'\n\nexport async function mkpOrderCancellation(ctx: Context) {\n const {\n clients: { externalSeller },\n vtex: {\n route: {\n params: { orderId },\n },\n },\n } = ctx\n\n const { marketplaceOrderId } = await json(ctx.req)\n\n try {\n ctx.body = await externalSeller.cancelOrder(\n orderId as string,\n marketplaceOrderId\n )\n ctx.status = 200\n } catch (e) {\n ctx.body = 'An error has occurred'\n ctx.status = 500\n }\n}\n\nexport async function sellerOrderCancellation(ctx: Context) {\n const {\n clients: { oms },\n } = ctx\n\n const { marketplaceOrderId } = await json(ctx.req)\n\n try {\n ctx.body = await oms.cancelOrder(marketplaceOrderId)\n ctx.status = 200\n } catch (e) {\n ctx.body = 'An error has occurred'\n ctx.status = 500\n }\n}\n\n```" } ]
code_external-seller-example_61416562
[ { "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 external-seller-example/node/handlers/orderPlacement.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { json } from 'co-body'\n\nimport { MarketplaceOrderInput } from '../typings/orderPlacement'\nimport { processAllOrderInputs } from '../utils/orderPlacement'\n\nexport async function placeOrder(ctx: Context) {\n const body: MarketplaceOrderInput[] = await json(ctx.req)\n\n /*\n The body request here is an array of MarketplaceOrderInput, which\n means that for each object element on the array, we need to call\n the placeOrder method. In order to do that, that is a function inside\n utils folder, to avoid having the logic inside this handler\n */\n\n ctx.body = processAllOrderInputs(ctx, body)\n\n ctx.status = 200\n}\n\n```" } ]
code_external-seller-example_75ae0b10
[ { "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 external-seller-example/node/handlers/tracking.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { json } from 'co-body'\n\nexport async function sendTrackingInformation(ctx: Context) {\n const {\n clients: { oms },\n vtex: {\n route: {\n params: { marketplaceOrderId },\n },\n },\n } = ctx\n\n const body = await json(ctx.req)\n\n ctx.body = await oms.orderNotification(marketplaceOrderId as string, body)\n ctx.status = 200\n}\n\n```" } ]
code_external-seller-example_0f2e7eec
[ { "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 external-seller-example/node/handlers/fullfilmentSimulation.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { json } from 'co-body'\n\nimport { SimulationInput } from '../typings/fullfilmentSimulation'\n\nexport async function fullfilmentSimulation(ctx: Context) {\n const {\n clients: { externalSeller },\n } = ctx\n\n const body: SimulationInput = await json(ctx.req)\n\n ctx.body = externalSeller.fullfilmentSimulation(body)\n\n ctx.status = 200\n}\n\n```" } ]
code_external-seller-example_5dfd8ac2
[ { "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 external-seller-example/node/handlers/orderDispatching.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { json } from 'co-body'\n\nexport async function dispatchOrder(ctx: Context, next: () => Promise<any>) {\n const {\n clients: { externalSeller },\n vtex: {\n route: {\n params: { orderId },\n },\n },\n } = ctx\n\n const { marketplaceOrderId } = await json(ctx.req)\n\n ctx.body = externalSeller.dispatchOrder(orderId as string, marketplaceOrderId)\n ctx.state.body = marketplaceOrderId\n ctx.status = 200\n\n await next()\n}\n\n```" } ]
code_external-seller-example_260d4316
[ { "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 external-seller-example/node/handlers/skuSuggestion.ts from the external-seller-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { SuggestionRequest } from '@vtex/clients'\nimport { json } from 'co-body'\n\nexport async function suggestSku(ctx: Context) {\n const {\n clients: { catalog, suggestion },\n vtex: {\n route: {\n params: { sellerId, sellerSkuId },\n },\n },\n } = ctx\n\n const body: SuggestionRequest = await json(ctx.req)\n\n try {\n await catalog.changeNotification({\n sellerId: sellerId as string,\n sellerSkuId: sellerSkuId as string,\n })\n ctx.body = 'SKU already exists on Marketplace'\n ctx.status = 304\n } catch (e) {\n if (e.response.status === 404) {\n suggestion.sendSkuSuggestion(body)\n ctx.body = 'Suggestion was successfully sent'\n ctx.status = 200\n } else {\n // eslint-disable-next-line no-console\n console.log(`Error: ${e.response.message}`)\n }\n }\n}\n\n```" } ]
code_releases_fd8d7243
[ { "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 releases/messages/pt.json from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"releases.content.title\": \"Últimos Lançamentos\",\n \"releases.content.overview\": \"Visão Geral\",\n \"releases.content.releases\": \"Lançamentos\",\n \"releases.content.notes\": \"Notas de Lançamentos\",\n \"releases.content.apps\": \"Meus Apps\",\n \"releases.overview.hour\": \"ÚLTIMA HORA\",\n \"releases.overview.3hours\": \"ÚLTIMAS 3 HORAS\",\n \"releases.overview.7days\": \"ÚLTIMOS 7 DIAS\",\n \"releases.overview.30days\": \"ÚLTIMOS 30 DIAS\",\n \"releases.date.months.0\": \"JAN\",\n \"releases.date.months.1\": \"FEV\",\n \"releases.date.months.2\": \"MAR\",\n \"releases.date.months.3\": \"ABR\",\n \"releases.date.months.4\": \"MAI\",\n \"releases.date.months.5\": \"JUN\",\n \"releases.date.months.6\": \"JUL\",\n \"releases.date.months.7\": \"AGO\",\n \"releases.date.months.8\": \"SET\",\n \"releases.date.months.9\": \"OUT\",\n \"releases.date.months.10\": \"NOV\",\n \"releases.date.months.11\": \"DEZ\",\n \"releases.card.dependencies\": \"Dependências\",\n \"releases.card.nocommits\": \"Sem commits\",\n \"releases.card.from\": \"De\",\n \"releases.card.button.collapse\": \"COLAPSAR\",\n \"releases.card.button.expand\": \"EXPANDIR\",\n \"releases.filter.allProjects\": \"Todos os projetos\",\n \"releases.filter.allEnvs\": \"Todos os ambientes\"\n}\n```" } ]
code_releases_207b93ce
[ { "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 releases/messages/en.json from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"releases.content.title\": \"Latest Releases\",\n \"releases.content.overview\": \"Overview\",\n \"releases.content.releases\": \"Releases\",\n \"releases.content.notes\": \"Releases Notes\",\n \"releases.content.apps\": \"My Apps\",\n \"releases.overview.hour\": \"LAST HOUR\",\n \"releases.overview.3hours\": \"LAST 3 HOURS\",\n \"releases.overview.7days\": \"LAST 7 DAYS\",\n \"releases.overview.30days\": \"LAST 30 DAYS\",\n \"releases.date.months.0\": \"JAN\",\n \"releases.date.months.1\": \"FEB\",\n \"releases.date.months.2\": \"MAR\",\n \"releases.date.months.3\": \"APR\",\n \"releases.date.months.4\": \"MAY\",\n \"releases.date.months.5\": \"JUN\",\n \"releases.date.months.6\": \"JUL\",\n \"releases.date.months.7\": \"AUG\",\n \"releases.date.months.8\": \"SEP\",\n \"releases.date.months.9\": \"OCT\",\n \"releases.date.months.10\": \"NOV\",\n \"releases.date.months.11\": \"DEC\",\n \"releases.card.dependencies\": \"Dependencies\",\n \"releases.card.nocommits\": \"No commits\",\n \"releases.card.from\": \"From\",\n \"releases.card.button.collapse\": \"COLLAPSE\",\n \"releases.card.button.expand\": \"EXPAND\",\n \"releases.filter.allProjects\": \"All projects\",\n \"releases.filter.allEnvs\": \"All Environments\"\n}\n\n```" } ]
code_releases_854b74ae
[ { "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 releases/messages/context.json from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"releases.content.title\": \"Latest Releases\",\n \"releases.content.overview\": \"Overview\",\n \"releases.content.releases\": \"Releases\",\n \"releases.content.notes\": \"Releases Notes\",\n \"releases.content.apps\": \"My Apps\",\n \"releases.overview.hour\": \"LAST HOUR\",\n \"releases.overview.3hours\": \"LAST 3 HOURS\",\n \"releases.overview.7days\": \"LAST 7 DAYS\",\n \"releases.overview.30days\": \"LAST 30 DAYS\",\n \"releases.date.months.0\": \"JAN\",\n \"releases.date.months.1\": \"FEB\",\n \"releases.date.months.2\": \"MAR\",\n \"releases.date.months.3\": \"APR\",\n \"releases.date.months.4\": \"MAY\",\n \"releases.date.months.5\": \"JUN\",\n \"releases.date.months.6\": \"JUL\",\n \"releases.date.months.7\": \"AUG\",\n \"releases.date.months.8\": \"SEP\",\n \"releases.date.months.9\": \"OCT\",\n \"releases.date.months.10\": \"NOV\",\n \"releases.date.months.11\": \"DEC\",\n \"releases.card.dependencies\": \"Dependencies\",\n \"releases.card.nocommits\": \"No commits\",\n \"releases.card.from\": \"From\",\n \"releases.card.button.collapse\": \"COLLAPSE\",\n \"releases.card.button.expand\": \"EXPAND\",\n \"releases.filter.allProjects\": \"All projects\",\n \"releases.filter.allEnvs\": \"All Environments\"\n}\n\n```" } ]
code_releases_a946760c
[ { "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 releases/messages/es.json from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"releases.content.title\": \"Últimos Lanzamientos\",\n \"releases.content.overview\": \"Visión de Conjunto\",\n \"releases.content.releases\": \"Lanzamientos\",\n \"releases.content.notes\": \"Notas de Lanzamientos\",\n \"releases.content.apps\": \"Mis Apps\",\n \"releases.overview.hour\": \"ÚLTIMA HORA\",\n \"releases.overview.3hours\": \"ÚLTIMAS 3 HORAS\",\n \"releases.overview.7days\": \"ÚLTIMOS 7 DÍAS\",\n \"releases.overview.30days\": \"ÚLTIMOS 30 DÍAS\",\n \"releases.date.months.0\": \"ENE\",\n \"releases.date.months.1\": \"FEB\",\n \"releases.date.months.2\": \"MAR\",\n \"releases.date.months.3\": \"ABR\",\n \"releases.date.months.4\": \"MAY\",\n \"releases.date.months.5\": \"JUN\",\n \"releases.date.months.6\": \"JUL\",\n \"releases.date.months.7\": \"AGO\",\n \"releases.date.months.8\": \"SEP\",\n \"releases.date.months.9\": \"OCT\",\n \"releases.date.months.10\": \"NOV\",\n \"releases.date.months.11\": \"DIC\",\n \"releases.card.dependencies\": \"Dependencias\",\n \"releases.card.nocommits\": \"Sin commits\",\n \"releases.card.from\": \"De\",\n \"releases.card.button.collapse\": \"COLAPSAR\",\n \"releases.card.button.expand\": \"EXPANDIR\",\n \"releases.filter.allProjects\": \"Todos los proyectos\",\n \"releases.filter.allEnvs\": \"Todos los ambientes\"\n}\n\n```" } ]
code_releases_80ef3e3c
[ { "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 releases/pages/interfaces.json from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"releases\": {\n \"component\": \"*\"\n },\n \"releases.home\": {\n \"component\": \"ReleasesPage\"\n }\n}\n\n```" } ]
code_releases_165e668e
[ { "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 releases/react/releases.global.css from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\nhtml, body {\n height: 100%;\n}\n\n.render-provider, .render-container {\n height: 100%;\n background-color: #fff;\n}\n\n.timeline:after {\n content:\"\";\n position: absolute;\n z-index: 0;\n top: 0;\n bottom: 0;\n left: 4.5%;\n border-left: 1px solid #CACBCC;\n transform: translate(-50%);\n}\n\n@media screen and (min-width: 40em) {\n .timeline:after {\n content:\"\";\n position: absolute;\n z-index: 0;\n top: 0;\n bottom: 0;\n left: 6.5rem;\n border-left: 1px solid #CACBCC;\n transform: translate(-50%);\n }\n}\n\n.vtex-logo {\n background: no-repeat center center url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAA/CAYAAABn/8O7AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAFE5JREFUeAHtnAnQZVVxx9kEoQiLoEQEl2FJQanRQtyZiQGSGCspt1ipgBo1QlJqVKy4sGiKRKKoIW4UCdnElIklkGg0imCggIhsUYliwjooBEQWA8gOk9/vvPN/c997975lvm9mvvnqdVXfPkt3n+4+fc499777fZttNod5BDZiBDafdew1a9Yos8WsckuYf83mm2/+6BK2b25aIkDyLafEi1ubuaiWq299J5doYeod0EkCIGt2wpdV4JPBTT0h78KHy/HrCqiJuMV8NzQSSwxMPk2CHgZeDy4neABn/gHcsfq4qS+qJZY9482ZuAMyMVuyKzwC/V1U/V1VtwYqbuqg/4nB1ym/DF8fxlfI5svBvyU/Pwl+q6FMRLklQX8ehu+Au4EPgVuBwlj5HsuSvmYh+RCiT0eQeKfib1l0S9ryZWLcpNtN+lfir8n3MPgYsLlzUN1kQT/0MQvppXpCErrjp82mOaynCCTButTnNvTEyrBcJyV+7UriucDmsIEiMCkBY8btKSxTmoV2I7vfQ+5+QNqWqctLw61pE/BizPWVxZbgcntpa6IlDmdSFlLv1ebX9RaBsYGuZyEfRK7Ggs9XK5ZbAuqPt+AL8fP0ZepjdWvpkbEJOGTuX1C/F/Rpcbncnpq730f0tz4BLxf/dGlJw8QEZFd4lElxF7wST06t3jyypL2a3jj9cPc7G/++VMWW2w4/fTQ2Amee/sYOXRPQRHwyjJeCTwCdqIkJDM9SBXe5+P/LJOC5+Dd//7eBZ2uqBKq7oJPzQ+w7udq4qd+msoufUZPPZJzvfhs4AbMDTBy2sQu6+10O7gFuqrtgdj9frL+YBLx4vvsRiY0A+UltZGgmZCA56y64FfRW+j6BwIlgcxdslkf0LaBhwI4F6GmKunB8pfSZmnyecbMjNvlK2cU30ojvyEzlc5s8sv3dtq2/ZbyJTU2dTWb0G8MmDnTXSnwZ8KvLtq6xBhRPEbeRyWXAiecgeLZnoP8E9wHdRZygtkmiecFgYqh7xNZ11Jxd2/eaBxLIqwzyNAFdx/E2mhh+GbOxi2tdjVM3kKQdUDOuT8Zm/8gOiNKyE8DkDtE2gLvgPfT7WubT4IgO2hYTtEPQlsVIwiTg3+CHyTd2wdHvT3P7gtuAysaG/0b+Pvoh7RMBr8E2Pso/Foy8Mb4Kufuh8riQdwddzNFPcSowLo5xE/quiQQ6s6j8XVvbnwXuDe4Mbg1qix+WiHeCt4A/Blej50Godm0H+UWwOQeOdSc8V0BHABm6ynejbhrPAR1bG2PnDfSvDp/KBoCOV9HwZvBxYHPS+2V4NF4nhPtA36H5a4n65FsMcCIc5yDwXWAWxKwThGgf1KeNd4Afr62t9uJjJtAJ+Crorm+CyP9z4FHgSaD2jOhA3oUq/6+BZ4BOdPic2EPAc+Gz/AXQcYzlrHcSfdoW/D66XsiYd0HLooK6eN4KHgE+DTQZusCx1fMp8G2V6fFQbd8NNCkT+y3R/TrG+kdo/KS7gPa7wI4D/xiMT7bp69Hgn4HhIyr1Xg19EzgrHI+y9QoYdEo1ym/1FgL+zisUm6FZ2SP201eCDd0BvAEchnMVojGTMqCDdgNs/0lV0NdYgdso7F37d6Ic/U2e8E5Lb4YxH4047mPBLw0Jq98YNtEd0nap8OVqV4kN9feV1h5PLRZyE1c/02vmT2SeTd+DTeZa/gHUja0fty1oIJHLy2ZX+DvtBMx2V1YXms2icJUX9GwNqm8xMbvsnY6xQMju9yP0uMqF7Ei9WuNKTHCl7IJ30VySDeqOFr/3o3+P8DVES3BrTLV/Ve1zfHdB4TL6c7u0Xb2CtBlz7WvDJk9TVt7AMRR+A3RM+e2TCi6OoAvIvvgVGwsvdrpbXQDK51jySncHPwgWIBaw9h/kPkyju2/8iV1HwXMHvO7QpU0jsoLNTF+xCArHwDZaMr1wbrbZKyvVcK14dDFQnehxFWnTYdaB2NqrzXZNED6OXp/kDUImpEtTxju7Mlg3HurytvRcULCtCZHbh8b9akfiaPX82iYxbonncNyjR9osR5fUI4WgjpJE+LYr5cQsvOGRL/pC5XFsQXsKoCe630ODulNXhzF4Izy/XuNYNgvqb6T9UNDYyi91nM/A91X6Bx6KZMjE3Ez5atD7vkIJCsVW0GjhFSh9CcrPhfaD0Ota0DUBfwta9gQNwCSbugaMP/8Dw19XJtumhcthdCfcAVRONHbPB/2CZlhXbF9JX/PhI/b/O+3ulC4CH2SOpLo36J3HuDonoue3Z4LRb9/14J+DD4DW7XPyV4O3g8L+4NNAdYRH6t3qZPA20L5h0KdL0oht3qq18SKoZ+ajwCRi5uPD9F0Az91QjwAfiDxU29T5E/A4sB0cxB7o4aCQ80Cv1n3VQOHr0Uw5wU/TzBQdBkt7VoCel4R1PR81zzdvqnqTCGNtY8y+L5TP1wjAc2TicynlsnNAm7yx3z92EpoyV1LfqdpR+LqMgO+fFQaUT6wvHMPvZBu3VykEKKP/id0rumSb7fC3+bIj7Z7hhNiSM/UJddxTe93FXouJ0+/X/va4w1gGlILngUIG6dXar03nfnPsIE0PJ5QZKhN4ch02jrZbMb41flwCWxZaP8ATTHEyI3N8HSaTavVesNxiobE5dBfargEFJyI+lB2Yej/5LIM+WTbRufgyKCgbP75F2fO6tm0FRqboqO1vpl1QJknwM8oH1v7HUI7cMB2JjbxV7mWUhcx7dN9J2zGg8RDsj71jN6cSBLZPhdxq3ZZ9pSI4aNs2XTrrRWNze3i3bejQqBEnKv9EUu3QAW89b6gCJQAThUcZtD8T/ZFqm68NJvnV1BTes2tj9Om3ry1W1fZhn/elfa9GX3y4oNFWitjjufkRkYaUHTdjV5FCbJNPKDJVNvNge8ayHLuUS9n26G9S20dA/cyHZ7ev0OkCUo82GAvl3dH/FDQe1gVt8BVMyYs6r+mzv0CC2U+cOshZtb/pVG0aITHiRQzy27W3r3eEe3JDjPTdn+cnn6SagZusYS2H9it7IX75rk3I5PVq01+vhPVaUH3amNi8gLIQu2Prql5zfzzbPUeeX9sjX6uLSmKLSlOW3mMDsXgIbHtYNKGZxrEbyHGouBH0dm8sEw/1i9bj24no+05Nvta4lzMDAgETR0YfvX8VNIujlGIrZEDpexjsiwzqwRoy005TbnfIuNqeh67D62jN1dxqQEejdmchfEiecYHo0OFkuRu7+m+H/gd8e4EGOLqfT/vO9Hsbsi3BX0VZ0I7E8DLKq8FZwdjOAk3+lH1QeQc23gC1rE1NkM+5/xy+eHSArJ0/ysbBu8ct0PfB91lQf+MbxQLqcM6+DZpHQmLSq427OrD90C+AQs4uvVr3Nfd8n9zKZEtnAVRn7By+o7N71O6eyJYXq9oR/bPYVOXKIkD+DXU4J0MM+DSs/rKgoXuAN9ZOF1RieHRTn+VhgLfEwHbK/1p16Ev88YnUW92IP7THziMbcrU4NTmm6h7enAbGQ1vyI3Y5QGIiPaRLj+2BrOLUpWn7KGUzV0OGVwtNI5DAvZPBd2KlzHQWRKacQavhL6/aY8vIYBMatNfJ0P4Pyxv9ltcBsoLPQ/ZuML6mfVXVGXufTv1JoP3yGkN3hovAjQkeZx7qwPurYdopjMy5O6Jx7HWXr6EsWg9v4nEmvOfUmDtmJyRgfYYkDvRiGj9XO2JUn6+loC75VoBH1P4R/bV9gGAow/XfopdDKwzqykQP8E9RSSA+j94L0D/w8nMK+S6W1XT4TlAw6BnnoNKytv7iWpcnk3MD5UuH+Gp1gxEXgq+N2tDztrBNj3TGPv68pvJlkVnNfB1AzP2VqDy8VL5W0pUgUeTu8TNw1l3w7Riw2zQGVKuKHci8mvqhoE522VZFOomyrkqfwMrZDxp/KM4O+IFp/bcEeRo28LHxmfTvDl9W+8GNUTJhF9HvV0QuhrQ12MYWZ+Vv81d7rwe/D/6gBX3Iuhr8LihkcfVqXGsMvL0+l6ovpYfBeLhxPBU8AVx3cDCloSeBQvNe32tpv4bvg1W+6OmyBBUlWNBtwMuqyuio1ZlIZD89zfhddg23Y0HisZJyznSucFF4aR3P34h9YBHsiz2vncYe+PvJQzlnQMeLnlnPgDmXmfwvqjZsT3nbIdyOug8nA2c96wJ9TbvOoS4kDo6ROFjOmOUoRd0NrBWygts6s+r8CcafeJyAkVXRIhhDPQg/hdWuYePGSd9h6DoAdAWNTdqWMdOkfcp6TvNTKSF+9Grrfo3v3kava6iJ/pW17TnQx4Hhjz25dTdEpy4mplMLNBhjn03eFXyyvwe8bwjvpe5v75DWHbrMCf2vR8XBoP6ZWFLtcx5Tzpgfgt/nARdP5hm2tdDaaDdCZrEPBqup/qVtQBT3au1XdZpEu4DvqCytAUQ/6kuCbgvfuyrvQkgm/VT0XlPtT9tC9BoP1JXbp5P4zaqsGY+Vte15jb70fw95b3HCotjTU9V5bYu3tiSJ/PVDh0ZQP4e1Vr9Nol3pe3+jX1+c7xvA62o5bR5HfgE8FuyEzgSsEjHmk9RvBnXAASZB9PqT0DNwqmsXLAFB2RGgP6AvdPdzRd4KLvbuh8oCmdivNepp2xdfn037Cxt9tbjZhRboz69NaV9f9MGG4tiXWNtlnKyPIDZm7uQbBpNpBWhyNfneTd05FByvn+yUj0LnSnKgbGgyzAQGTQHoe0HBlTAN5Hzw2SqfQJTxUVAcgPqb6eqqMOeIWp2JxK5j6njF7jLYIl2wJjbvRTkfScRmA+wn/vkQ07ooHFxtak5aq1Xw9uNEOWdAfYt/486AJpZz9XJQUKZpx+tbBx1qRKZpQ+bfF+6xQZ0pnxdx2k4Dhcx96MW0+eStbX3d1ovBFsZAdsG/gudI8KlgtlmKnZAE+B0G/RQrQCPcAdzlhBjyB5SfAi5093O868FTQGGanbrHOf21xAIfrsWX/0Lsl8DER3/2AQO2m3A/AuXdEBBbbqmDGZO02fQn2L0C+hMrQyDf1uAF+OfDYJmfxnwdT5/63P2k0f1+ygEX/yHgE0Hjb345rz41vx303XJ0UJwSTBxZoX8ICsn+Xq37mhVwepUvTsHuxKhvT9CfdoTsJL3abNfIvq3qLfZaXmzArMTiA9XE+GhVO7Lrpf2ftIH2LLixJjX5KM+6Aya+PtH62ZcQO2JXr7X7embshSU76mGVPXHO/J9aef0SJ7y/N8QbGX+q3LfyzzY/CDYd++7QALXaSppOv6QO7qdAMXbWVzxtgyQYV9BZXqZCp5ps7ZkV0J3Fs4Ly3aCQSe7V1t76rPte0wScKujw9W2n/EVQ8LaeMb5J2Ye21qSmLwvkLZQFE0BZ5yJlYzaM99MmJAHjp3+zck3p6elJvH9M257VDhOwaXc+I9Nux43t/yK/0OTvtUy4IhDHDqMs6EwzwUpjyyUGn9McAr79web3Yy2iUzVlhR2ufiRKcjfHWuwyY2Ry3tqw0FhkktN8YrWpPzmTbEGwz0v5rChq0Mspb9ell76m/CcbcinGzia1L3H8t6o7Pn4igkO0vIimrR9vyskR59bvD9vAI5fzVPRbngoQKI4pCHoQFpJcvVr7NY7aewK4K7gfeCEoTKOjxzl6jewldMX5/gRM5dg6MDFWfwzKrwXzpTDFAjdx7f9SQLnPP81w4Yd+DHSR/i94M+jL5L8HMxetetPvWJRfA34N/D9wHLib3woeGxspO1feyv1DIo9K2nAX+BWw9W5De+bBX8N+CirnbqmsY5wD9mVbHYgBwxTB8hABfSV9Z4A54E7SI194bqHsCt4BnOZhBrZOiPxvcVg+PfZ1ci9yB+MxbHk/uD2qPd/sAfqj/rdpLwf98NA2NUQG6kT5Utv4ie4aP0W3SVnGpt4K9tuhfVLq3i53B32X58OGDwcPVbwNegfoO87bkTGuyphMu4AlqWyqZXm8ZU+yYTf4h3e6h2nrj0F5eohTSlD+BihkF+rVxl+zzc8q16Y1454TD2BKkqdpvVPGzOQMjGX7QuwZJzuub8AIKtox3LYY9VlsGDfezBOmQ6S9ifQrKD4LLCsMOklXdis/VHw86G6h7CQ5WEagKXco9ritN1/xjAisz4Y6GQN+YFPZRRYybpte9LntJOZTqe/Q0yU7oB/Z4R1MuQGeTkULkO3S6YrqB5pynnayG9HUCp4DAy+gcHStTJKLzDCNXJ7Y+jZ1Gj7vWD4RIBvKtg49CMxttZlkXQlTHsPp3B1c1/d/GcdH+/K7K3S93GaWz4wtQ0+Y9LI1Q08DhexKvdraaxLGd0IHJhSU8z9HuuTWahgs5Z3S36qLrrZbRIaZ0+UaASY+u+AzKOedT5KtmTLDCZOX0DvDdF1lzC7alGsrh8/x9je20Pnut1yTbJJfmXzoKaCQZOvV1r6o9q/knp6EoZzk9V2RMO0uGP2L+rHpJD/n/Us0AiRObsN+iuQLSiG7lOUkzMk1+cJfHhro3x78noxAU67XMnhNvy83927qW6LhmZu1ISJAMmQ3+2jNF19QeitO8vkGfsVwwtAWuddRFpJgvdroNbvkVJ/6bwjf52MsgQiQJ9nVnkD52tG8WfPe4eSr9eyC/rT3rSqXJBtWk+T8IR2+XZ8/fBiEOfQiQFIkCZ9F2R/QbwNNxmPBJNrIuzr68kDyasqCiTbuQeaPHBGe+YPHPPkGI0BSlCSsCbIndX/DLEB5JPnsaLZT/gYoPAAmEU1G64KfW/mb64Cc9TnMI1AiQIL0k9AG62Br8iVkkYHuA14NtoFfUxxQdc53vwRvTkcjQKL4eYiJN5CMo5xrW8ILfRLo92fXgX6642dNp4F56p0n39qwzUuLGQGSrJ9clH094891O2aMZn/a5nQegUWNAEk2snPSVnbURR1ormzJRGDs+WxjWWnSZexZPz2K3JzOIzCPwDwCEyPw/4zfYtHhyvl1AAAAAElFTkSuQmCC');\n width: 163px;\n height: 63px;\n position: relative;\n display: inline-block;\n text-indent: -100%;\n overflow: hidden;\n margin-right: 10px;\n\tmargin-top: 11px;\n}\n\n/* Skeleton animation */\n@keyframes shimmer-anim {\n 0% {\n transform: translate3d(0, 0, 0);\n }\n 100% {\n transform: translate3d(50%, 0, 0);\n }\n}\n\n.shimmer {\n width: 200%;\n height: 100%;\n position: absolute;\n top: 0;\n left: -100%;\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.7),\n rgba(255, 255, 255, 0)\n );\n background-size: 50% 100%;\n animation: shimmer-anim 0.7s linear infinite;\n}\n\n```" } ]
code_releases_2b8f1eee
[ { "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 releases/react/ReleasesPage.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { graphql } from 'react-apollo'\n\nimport ReleasesContent from './components/ReleasesContent'\n\nimport Profile from './queries/Profile.graphql'\n\nimport SkeletonPiece from './components/SkeletonPiece'\nimport LogoutIcon from './icons/LogoutIcon'\nimport VtexIcon from './icons/VtexIcon'\n\nimport './releases.global.css'\n\ninterface ProfileData {\n profile: any\n}\n\ninterface ReleasesPageState {\n bottom: boolean\n}\n\nclass ReleasesPage extends Component<{} & ProfileData, ReleasesPageState> {\n constructor(props: any) {\n super(props)\n\n this.state = {\n bottom: false,\n }\n }\n\n public componentDidUpdate() {\n const {\n profile: { error },\n } = this.props\n\n if (error) {\n const { graphQLErrors } = error\n const authError =\n graphQLErrors &&\n graphQLErrors.length > 0 &&\n graphQLErrors.find((e: any) => e.extensions.code === 'UNAUTHENTICATED')\n console.log('Authentication error, redirecting to login', authError)\n window.location.href = '/_v/segment/admin-login/v1/login?returnUrl=%2F'\n }\n }\n\n public render() {\n const {\n profile: { profile },\n } = this.props\n\n const firstName = profile && profile.name ? profile.name.split(' ')[0] : ''\n\n return (\n <div\n className=\"w-100 h-100 bg-light-silver overflow-hidden overflow-y-scroll\"\n onScroll={this.onScroll}\n >\n <div className=\"w-100 flex flex-row flex-none justify-between pa7-ns pt5 pl5 pr5 pb7 items-center\">\n <VtexIcon />\n <div className=\"flex flex-row items-center justify-center\">\n {firstName ? <p>{firstName}</p> : <SkeletonPiece />}\n <div className=\"pl3 pointer\" onClick={this.logout}>\n <LogoutIcon />\n </div>\n </div>\n </div>\n <ReleasesContent bottom={this.state.bottom} />\n </div>\n )\n }\n\n private logout = () => {\n window.location.href = '/admin/logout?redirectUrl=/'\n }\n\n private onScroll = (event: any) => {\n const element = event.target\n const bottom =\n element.scrollHeight - element.scrollTop === element.clientHeight\n\n if (bottom) {\n this.setState({ bottom: true })\n } else if (this.state.bottom) {\n this.setState({ bottom: false })\n }\n }\n}\n\nexport default graphql<ProfileData>(Profile, {\n name: 'profile',\n options: {\n ssr: false,\n },\n})(ReleasesPage)\n\n```" } ]
code_releases_45f56cf8
[ { "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 releases/react/package.json from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.releases\",\n \"license\": \"UNLICENSED\",\n \"dependencies\": {\n \"apollo-client\": \"^2.3.8\",\n \"axios\": \"^0.18.0\",\n \"graphql\": \"^0.13.2\",\n \"marked\": \"^0.4.0\",\n \"moment\": \"^2.22.2\",\n \"ramda\": \"^0.25.0\",\n \"react\": \"^16.4.2\",\n \"react-apollo\": \"^2.1.11\",\n \"react-intl\": \"^2.4.0\",\n \"react-motion\": \"^0.5.2\",\n \"react-tooltip\": \"^3.6.1\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^24.0.13\",\n \"@types/node\": \"^12.0.2\",\n \"@types/graphql\": \"^0.13.4\",\n \"@types/marked\": \"^0.4.0\",\n \"@types/moment\": \"^2.13.0\",\n \"@types/ramda\": \"^0.25.36\",\n \"@types/react\": \"^16.4.7\",\n \"@types/react-intl\": \"^2.3.9\",\n \"@types/react-motion\": \"0.0.27\",\n \"@types/react-no-ssr\": \"^1.1.1\",\n \"@types/react-tooltip\": \"^3.3.6\",\n \"tslint\": \"^5.11.0\",\n \"tslint-config-vtex\": \"^2.0.0\",\n \"typescript\": \"3.7.3\"\n },\n \"version\": \"1.0.4\"\n}\n\n```" } ]
code_releases_e80b605d
[ { "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 releases/react/typing.d.ts from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.graphql' {\n import { DocumentNode } from 'graphql'\n\n const value: DocumentNode\n export default value\n}\n\ndeclare module 'vtex.styleguide' {\n import { ReactElement } from 'react'\n\n export const Button: ReactElement\n export const Checkbox: ReactElement\n export const Dropdown: ReactElement\n export const IconCaretRight: ReactElement\n export const Tab: ReactElement\n export const Tabs: ReactElement\n export const Radio: ReactElement\n export const Spinner: ReactElement\n}\n\ndeclare module 'vtex.render-runtime' {\n export const NoSSR: ReactElement\n export const Helmet: ReactElement\n}\n\ntype ReleaseType = 'publication' | 'deployment'\n\ntype ContentType = 'releases' | 'notes'\n\ntype Environment = 'all' | 'stable' | 'beta'\n\ninterface Author {\n gravatarURL: string\n name: string\n username: string\n}\n\ninterface Commit {\n title: string\n}\n\ninterface Dependency {\n name: string\n version: string\n}\n\ninterface Deployment {\n authors: Author[]\n appName: string\n commits?: Commit[]\n commitsTotal: number\n cacheId: string\n date: string\n dependencies?: Dependency[]\n environment: string\n version: string\n}\n\ninterface Project {\n name: string\n}\n\ninterface Publication {\n authors: Author[]\n appName: string\n cacheId: string\n date: string\n environment: string\n type: ReleaseType\n version: string\n versionFrom: string\n}\n\ninterface Release {\n authors: Author[]\n appName: string\n commits?: Commit[]\n commitsTotal?: number\n cacheId: string\n date: string\n dependencies?: Dependency[]\n environment: string\n type: ReleaseType\n version: string\n versionFrom?: string\n}\n\ninterface ReleaseNote {\n appName: string\n author: Author\n date: string\n description: string\n cacheId: string\n title: string\n url: string\n version: string\n}\n\ninterface Statistic {\n lastHour: number\n last3Hours: number\n last7Days: number\n last30Days: number\n}\n\n```" } ]
code_releases_9776c57c
[ { "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 releases/react/queries/ReleasesNotes.graphql from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery ReleasesNotes($page: Int = 1) {\n releasesNotes(page: $page) {\n appName\n author {\n gravatarURL\n username\n }\n date\n description\n cacheId\n title\n url\n version\n }\n}\n```" } ]
code_releases_ca6ae3ee
[ { "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 releases/react/queries/Profile.graphql from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery Profile @context(scope: \"private\") {\n profile {\n id\n name\n }\n}\n```" } ]
code_releases_c12d5781
[ { "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 releases/react/queries/Statistic.graphql from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery Statistic($appName: String = \"\", $env: String = \"\") {\n statistic(appName: $appName, env: $env) {\n lastHour\n last3Hours\n last7Days\n last30Days\n }\n}\n```" } ]
code_releases_4d2b16b6
[ { "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 releases/react/queries/ReleaseDetails.graphql from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery ReleaseDetails($appName: String, $cacheId: String) {\n releaseDetails(appName: $appName, cacheId: $cacheId) {\n appName\n cacheId\n commits {\n title\n }\n dependencies {\n name\n version\n }\n }\n}\n```" } ]
code_releases_4e8763d4
[ { "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 releases/react/queries/Releases.graphql from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery Releases($appName: String = \"\", $page: Int = 1, $endDate: String = \"\") {\n releases(appName: $appName, page: $page, endDate: $endDate) {\n authors {\n gravatarURL\n username\n }\n appName\n commitsTotal\n cacheId\n date\n environment\n type\n version\n versionFrom\n }\n}\n```" } ]
code_releases_eb68f523
[ { "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 releases/react/components/ReleasesList.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport moment from 'moment'\nimport { addIndex, filter, map } from 'ramda'\nimport React, { Component } from 'react'\nimport { compose, graphql, withApollo, WithApolloClient } from 'react-apollo'\nimport { injectIntl } from 'react-intl'\n\nimport { Helmet } from 'vtex.render-runtime'\nimport { Spinner } from 'vtex.styleguide'\n\nimport DeploymentCard from './DeploymentCard'\nimport Overview from './Overview'\nimport PublicationCard from './PublicationCard'\nimport ReleasesListFilter from './ReleasesListFilter'\nimport ReleaseTime from './ReleaseTime'\n\nimport Releases from '../queries/Releases.graphql'\n\ninterface ReleasesData {\n releases: any\n}\n\ninterface ReleasesQuery {\n appName: string\n}\n\ninterface ReleasesListProps {\n appName: string\n bottom: boolean\n handleAppChange: (event: any) => void\n}\n\ninterface ReleasesListState {\n env: Environment\n isLoading: boolean\n releases?: Release[]\n nextPage: number\n lastPage: boolean\n}\n\nconst mapReleasesWithIndex = addIndex<Release>(map)\n\nclass ReleasesList extends Component<\n WithApolloClient<ReleasesData> &\n ReleasesListProps &\n ReactIntl.InjectedIntlProps,\n ReleasesListState\n> {\n constructor(props: any) {\n super(props)\n\n this.state = {\n env: 'all',\n isLoading: false,\n lastPage: false,\n nextPage: 2,\n releases: props.releases.releases,\n }\n }\n\n public componentDidUpdate(\n prevProps: ReleasesListProps,\n prevState: ReleasesListState\n ) {\n const {\n appName,\n bottom,\n releases: { releases: curReleases },\n } = this.props\n const { releases: prevReleasesState } = prevState\n const { releases } = this.state\n\n if (prevProps.appName !== appName) {\n this.setState(pState => {\n return {\n ...pState,\n lastPage: false,\n releases: undefined,\n }\n })\n }\n\n if (!prevReleasesState && !releases && curReleases) {\n this.setState(pState => {\n return { ...pState, releases: curReleases }\n })\n }\n\n if (!prevProps.bottom && bottom) {\n this.setState(pState => {\n const nextPage = pState.nextPage\n const currReleases = pState.releases as Release[]\n const endDate = currReleases.length\n ? currReleases[currReleases.length - 1].date\n : ''\n this.getPage(nextPage, endDate)\n\n return { ...pState, isLoading: true, nextPage: nextPage + 1 }\n })\n }\n }\n\n public render() {\n const {\n appName,\n handleAppChange,\n releases: { loading },\n intl,\n } = this.props\n const { env, releases } = this.state\n\n return (\n <div>\n <Helmet\n title={intl.formatMessage({\n id: 'releases.content.releases',\n })}\n />\n <ReleasesListFilter\n appName={appName}\n env={env}\n handleAppChange={handleAppChange}\n handleEnvChange={this.handleEnvChange}\n />\n <Overview appName={appName} env={env} />\n {loading || releases === undefined\n ? this.renderLoading()\n : this.renderReleasesList()}\n </div>\n )\n }\n\n private handleEnvChange = (event: any) => {\n const newEnv = event.target.value\n\n this.setState(prevState => {\n return { ...prevState, env: newEnv }\n })\n }\n\n private getPage = (page: number, endDate: string) => {\n const { appName, client } = this.props\n\n client\n .query<ReleasesData>({\n query: Releases,\n variables: {\n appName,\n endDate,\n page,\n },\n })\n .then(data => {\n const releases = data.data.releases\n\n this.setState(prevState => {\n const prevReleases = prevState.releases ? [...prevState.releases] : []\n return {\n ...prevState,\n isLoading: false,\n lastPage: releases.length === 0,\n releases: [...prevReleases, ...releases],\n }\n })\n })\n }\n\n private renderReleasesList = () => {\n const { isLoading, releases, env } = this.state\n\n const filteredReleases = releases\n ? filter((release: Release) => {\n return env === 'all' || release.environment === env\n }, releases)\n : []\n\n const releasesList = releases\n ? mapReleasesWithIndex((release: Release, index: number) => {\n const releaseDate = moment(new Date(release.date))\n\n const lastRelease =\n index !== 0 ? moment(new Date(releases[index - 1].date)) : null\n\n const addDate =\n index === 0 ||\n (lastRelease !== null && releaseDate.date() !== lastRelease.date())\n\n return (\n <div\n key={release.cacheId}\n className=\"timeline relative flex flex-row w-100 justify-center pb8\"\n >\n <ReleaseTime canAddDate={addDate} releaseDate={releaseDate} />\n {release.type === 'deployment' ? (\n <DeploymentCard deployment={release as Deployment} />\n ) : (\n <PublicationCard publication={release as Publication} />\n )}\n </div>\n )\n }, filteredReleases)\n : null\n\n return (\n <div className=\"pa5 ph8-ns pv6-ns\">\n {releasesList}\n {isLoading ? this.renderLoading() : null}\n </div>\n )\n }\n\n private renderLoading = () => {\n return (\n <div className=\"w-100 flex justify-center pv4\">\n <Spinner />\n </div>\n )\n }\n}\n\nconst options = {\n name: 'releases',\n options: (props: ReleasesListProps) => ({\n ssr: false,\n variables: {\n appName: props.appName,\n },\n }),\n}\n\nexport default compose(\n injectIntl,\n withApollo,\n graphql<ReleasesListProps, ReleasesData, ReleasesQuery>(Releases, options)\n)(ReleasesList)\n\n```" } ]
code_releases_f0523f44
[ { "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 releases/react/components/SkeletonPiece.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\ninterface SkeletonPieceProps {\n color?: string\n height?: number\n width?: number\n}\n\nconst DEFAULT_COLOR = 'light-gray'\nconst DEFAULT_HEIGHT = 4\nconst DEFAULT_WIDTH = 4\n\nclass SkeletonPiece extends Component<SkeletonPieceProps> {\n\n public render() {\n const color = this.props.color ? this.props.color : DEFAULT_COLOR\n const height = this.props.height ? this.props.height : DEFAULT_HEIGHT\n const width = this.props.width ? this.props.width : DEFAULT_WIDTH\n\n return (\n <div className={`pa${height} bg-${color} w${width} relative overflow-hidden self-end mb3`}>\n <div className={`shimmer`} />\n </div>\n )\n }\n\n}\n\nexport default SkeletonPiece\n```" } ]
code_releases_688ab27c
[ { "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 releases/react/components/NavigationTab.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { injectIntl } from 'react-intl'\nimport { Tab, Tabs } from 'vtex.styleguide'\n\ninterface Props {\n contentType: string\n handleContentChange: (contentType: string) => void\n}\n\nclass NavigationTab extends Component<Props & ReactIntl.InjectedIntlProps> {\n\n public render() {\n const { contentType, handleContentChange, intl } = this.props\n\n return (\n <Tabs>\n <Tab\n label={intl.formatMessage({\n id: 'releases.content.releases',\n })}\n active={contentType === 'releases'}\n onClick={() => handleContentChange('releases')}\n />\n <Tab\n label={intl.formatMessage({\n id: 'releases.content.notes',\n })}\n active={contentType === 'notes'}\n onClick={() => handleContentChange('notes')}\n />\n </Tabs>\n )\n }\n}\n\nexport default injectIntl(NavigationTab)\n```" } ]
code_releases_453c0e1e
[ { "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 releases/react/components/DeploymentCard.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { addIndex, map } from 'ramda'\nimport React, { Component } from 'react'\nimport { withApollo, WithApolloClient } from 'react-apollo'\nimport { FormattedMessage } from 'react-intl'\nimport ReactTooltip from 'react-tooltip'\nimport { Button, Spinner } from 'vtex.styleguide'\n\nimport GithubIcon from '../icons/GithubIcon'\nimport ReleaseDetails from '../queries/ReleaseDetails.graphql'\nimport Badge from './Badge'\n\ninterface DeploymentCardProps {\n deployment: Deployment\n}\n\ninterface DeploymentCardState {\n deployment: Deployment\n isLoading: boolean\n isOpen: boolean\n}\n\ninterface ReleaseDetailsData {\n releaseDetails: Release\n}\n\nconst mapAuthorWithIndex = addIndex<Author>(map)\nconst mapCommitsWithIndex = addIndex<Commit>(map)\nconst mapDependenciesWithIndex = addIndex<Dependency>(map)\n\nclass DeploymentCard extends Component<WithApolloClient<DeploymentCardProps>, DeploymentCardState> {\n constructor(props: any) {\n super(props)\n\n this.state = {\n deployment: props.deployment,\n isLoading: false,\n isOpen: false\n }\n }\n\n public render() {\n const { deployment, isLoading, isOpen } = this.state\n const isBeta = deployment.environment === 'beta'\n const badgeBgColor = isBeta ? 'bg-white ba b--rebel-pink' : 'bg-rebel-pink'\n const badgeColor = isBeta ? 'rebel-pink' : 'white'\n const commitText = deployment.commitsTotal === 0\n ? <FormattedMessage id=\"releases.card.nocommits\" />\n : `${deployment.commitsTotal} commit${deployment.commitsTotal > 1 ? 's' : ''}`\n\n const authors = mapAuthorWithIndex((author: Author, index: number) => {\n const key = deployment.date + author.username + index\n return (\n <div key={key} className=\"pl2\">\n <img\n data-tip\n data-for={key}\n className=\"br-pill\"\n src={author.gravatarURL}\n />\n <ReactTooltip id={key} effect=\"solid\" place=\"bottom\">\n <span>{author.username}</span>\n </ReactTooltip>\n </div>\n )\n }, deployment.authors)\n\n return (\n <div className=\"flex-auto b--silver ba br3 pa5 ph7-ns pv7-ns\">\n <div className=\"w-100 flex flex-column flex-row-ns justify-between pb4 pb0-ns\">\n <span className=\"fw4 f4 f3-ns near-black\">\n {deployment.appName}\n </span>\n <div className=\"pt4 pt0-ns\">\n <Badge className={`${badgeBgColor} ${badgeColor}`}>\n {deployment.environment}\n </Badge>\n <Badge className=\"ml3 near-black ba b--near-black\">\n {deployment.version}\n </Badge>\n </div>\n </div>\n <div className=\"w-100 mt4\">\n <div className=\"w-100 flex flex-row justify-between items-center\">\n <div className=\"flex flex-row\">\n {authors}\n </div>\n <div className=\"flex flex-row items-center nr6-ns\">\n <GithubIcon />\n <span className=\"dn-s db-ns pl3 f5 near-black\">{commitText}</span>\n <span className=\"dn-ns pl3 f5 near-black\">{deployment.commitsTotal}</span>\n <div className=\"w4 nr5 nr0-ns\">\n <Button variation=\"tertiary\" onClick={this.onExpandClick}>\n {isOpen\n ? <FormattedMessage id=\"releases.card.button.collapse\" />\n : <FormattedMessage id=\"releases.card.button.expand\" />\n }\n </Button>\n </div>\n </div>\n </div>\n {isOpen\n ? (isLoading ? this.renderLoading() : this.renderDetails())\n : null\n }\n </div>\n </div>\n )\n }\n\n private getDeploymentDetails = () => {\n const { client } = this.props\n const { deployment } = this.state\n\n client.query<ReleaseDetailsData>({\n query: ReleaseDetails,\n variables: {\n appName: deployment.appName,\n cacheId: deployment.cacheId\n }\n }).then((data) => {\n const { dependencies, commits } = data.data.releaseDetails\n const deploymentDetail = { dependencies, commits }\n\n this.setState((prevState) => {\n return ({\n ...prevState,\n deployment: {\n ...prevState.deployment,\n ...deploymentDetail\n },\n isLoading: false\n })\n })\n })\n }\n\n private onExpandClick = () => {\n this.setState((prevState) => {\n const isOpen = !prevState.isOpen\n const isLoading = isOpen\n\n if (isOpen) {\n this.getDeploymentDetails()\n }\n return ({ ...prevState, isOpen, isLoading })\n })\n }\n\n private renderLoading = () => {\n return (\n <div className=\"w-100 ph3 pt2 pb4 flex items-center justify-center\">\n <Spinner />\n </div>\n )\n }\n\n private renderDetails = () => {\n const { deployment } = this.state\n const commits = deployment.commits\n ? mapCommitsWithIndex((commit: Commit, index: number) => {\n return (\n <li key={commit.title + index}>- {commit.title}</li>\n )\n }, deployment.commits)\n : []\n\n const dependencies = deployment.dependencies\n ? mapDependenciesWithIndex((dependency: Dependency, index: number) => {\n return (\n <div key={dependency.name + dependency.version + index} className=\"dib\">\n <div className=\"br-pill pv2 ph3 bg-muted-5 ma2 f6\" style={{ wordBreak: 'break-all' }} >\n {dependency.name} - {dependency.version}\n </div>\n </div>\n )\n }, deployment.dependencies)\n : []\n\n return (\n <div className=\"w-100 flex flex-column near-black pt4\">\n <div className=\"w-100 pt6-ns\">\n <span className=\"f6 fw7\">Commits</span>\n <div className=\"w-100 pt4-ns pv4 pb6-ns code lh-copy f6\">\n <ul className=\"pa0 ma0 list\">\n {commits}\n </ul>\n </div>\n </div>\n <div className=\"w-100\">\n <div className=\"pb3\">\n <span className=\"f6 fw7\">\n <FormattedMessage id=\"releases.card.dependencies\" />\n </span>\n </div>\n <div className=\"w-100\">\n {dependencies}\n </div>\n </div>\n </div>\n )\n }\n}\n\nexport default withApollo(DeploymentCard)\n\n```" } ]
code_releases_01599529
[ { "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 releases/react/components/PublicationCard.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { addIndex, map } from 'ramda'\nimport React, { Component } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport ReactTooltip from 'react-tooltip'\nimport Badge from './Badge'\n\nimport RefreshIcon from '../icons/RefreshIcon'\n\ninterface PublicationCardProps {\n publication: Publication\n}\n\nconst mapAuthorWithIndex = addIndex<Author>(map)\n\nclass PublicationCard extends Component<PublicationCardProps> {\n public render() {\n const { publication } = this.props\n const isBeta = publication.environment === 'beta'\n const badgeBgColor = isBeta ? 'bg-white ba b--rebel-pink' : 'bg-rebel-pink'\n const badgeColor = isBeta ? 'rebel-pink' : 'white'\n\n const authors = mapAuthorWithIndex((author: Author, index: number) => {\n const key = publication.date + author.username + index\n return (\n <div key={key} className=\"pl2\">\n <img data-tip\n data-for={key}\n className=\"br-pill\"\n src={author.gravatarURL}\n />\n <ReactTooltip id={key} effect=\"solid\" place=\"bottom\">\n <span>{author.username}</span>\n </ReactTooltip>\n </div>\n )\n }, publication.authors)\n\n return (\n <div className=\"flex-auto b--silver ba br3 pa5 ph7-ns pv7-ns\">\n <div className=\"w-100 flex flex-column flex-row-ns justify-between pb4 pb0-ns\">\n <span className=\"fw4 f4 f3-ns near-black\">\n {publication.appName}\n </span>\n <div className=\"pt4 pt0-ns\">\n <Badge className={`${badgeBgColor} ${badgeColor}`}>\n {publication.environment}\n </Badge>\n <Badge className=\"ml3 near-black ba b--near-black\">\n {publication.version}\n </Badge>\n </div>\n </div>\n <div className=\"w-100 mt4\">\n <div className=\"w-100 flex flex-row justify-between\">\n <div className=\"flex flex-row\">\n {authors}\n </div>\n <div className=\"flex flex-row items-center\">\n <RefreshIcon />\n <span className=\"pl3 f5 near-black\">\n <FormattedMessage id=\"releases.card.from\" /> {publication.version}\n </span>\n </div>\n </div>\n </div>\n </div>\n )\n }\n}\n\nexport default PublicationCard\n\n```" } ]
code_releases_63d627a7
[ { "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 releases/react/components/Overview.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { addIndex, map } from 'ramda'\nimport React, { Component } from 'react'\nimport { compose, graphql, withApollo, WithApolloClient } from 'react-apollo'\nimport { FormattedMessage } from 'react-intl'\nimport Statistic from '../queries/Statistic.graphql'\nimport SkeletonPiece from './SkeletonPiece'\n\ninterface StatisticData {\n statistic: any\n}\n\ninterface OverviewProps {\n appName: string\n env: string\n statistic: any\n}\n\nconst STATISTIC_NAMES = ['hour', '3hours', '7days', '30days']\nconst mapWithIndex = addIndex<number, JSX.Element>(map)\n\nclass Overview extends Component<WithApolloClient<StatisticData> & OverviewProps> {\n public render() {\n const { statistic: { loading, statistic } } = this.props\n\n const statisticNumbers = [\n statistic ? statistic.lastHour : 0,\n statistic ? statistic.last3Hours : 0,\n statistic ? statistic.last7Days : 0,\n statistic ? statistic.last30Days : 0\n ]\n const statisticElements = mapWithIndex((stat: number, index: number) => {\n const name = STATISTIC_NAMES[index]\n return (\n <div key={name} className=\"w-50 pb6 pa0-ns flex flex-column\">\n <div className=\"w-100 flex justify-center\">\n <span className=\"silver f5 fw4 tracked\">\n <FormattedMessage id={`releases.overview.${name}`} />\n </span>\n </div>\n <div className=\"flex justify-center\">\n {loading\n ? <SkeletonPiece color=\"light-silver\" height={5} width={3} />\n : <span className=\"f2 fw5\">{stat}</span>}\n </div>\n </div>\n )\n }, statisticNumbers)\n\n return (\n <div className=\"flex flex-column\">\n <div className=\"flex flex-column flex-row-ns items-center justify-between-ns pv7\">\n {statisticElements}\n </div>\n </div>\n )\n }\n}\n\nconst statisticOptions = {\n name: 'statistic',\n options: (props: OverviewProps) => ({\n ssr: false,\n variables: {\n appName: props.appName,\n env: props.env\n },\n }),\n}\n\nexport default compose(\n withApollo,\n graphql<OverviewProps, StatisticData>(Statistic, statisticOptions),\n)(Overview)\n\n```" } ]
code_releases_9f09dfb8
[ { "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 releases/react/components/ReleaseTime.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport moment, { Moment } from 'moment'\nimport React, { Component, Fragment } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { NoSSR } from 'vtex.render-runtime'\n\nimport SkeletonPiece from './SkeletonPiece'\n\ninterface ReleaseTimeProps {\n canAddDate: boolean\n releaseDate: Moment\n}\n\nclass ReleaseTime extends Component<ReleaseTimeProps> {\n public render() {\n const { canAddDate, releaseDate } = this.props\n return (\n <NoSSR onSSR={this.renderSkeleton()}>\n <div className=\"flex flex-column flex-none flex-row-ns justify-center justify-end-ns mr7-ns w4-ns pr4 pr0-ns\">\n {canAddDate ? this.renderDate(releaseDate) : null}\n <div className=\"z-1 flex h3-ns self-center self-start-ns\">\n <span className=\"f6 f4-ns bg-white fw5 gray silver-ns self-end-ns lh-copy pv4 pv0-ns\">\n {releaseDate.format('HH:mm')}\n </span>\n </div>\n </div>\n </NoSSR>\n )\n }\n\n private renderDate = (date: Moment) => {\n const curDate = moment(Date.now())\n const curYear = curDate.year()\n\n return (\n <div className=\"z-1 bg-white flex pt4 flex-column pb2 pa0-ns mr6-ns items-center\">\n <span className=\"f2-ns f3 fw3 rebel-pink lh-solid\">{date.date()}</span>\n <span className=\"f4-ns f6 fw5 black lh-title\">\n <FormattedMessage id={`releases.date.months.${date.month()}`} />\n </span>\n {curYear !== date.year() ? (\n <span className=\"f3 fw5 light-gray\">{date.year()}</span>\n ) : null}\n </div>\n )\n }\n\n private renderSkeleton = () => {\n return (\n <Fragment>\n <SkeletonPiece width={100} />\n <SkeletonPiece width={50} />\n </Fragment>\n )\n }\n}\n\nexport default ReleaseTime\n\n```" } ]
code_releases_22c86332
[ { "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 releases/react/components/Badge.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\ninterface BadgeProps {\n className?: string\n}\n\nclass Badge extends Component<BadgeProps> {\n public render() {\n const { className } = this.props\n\n return (\n <div className={`${className} br-pill f7 f6-ns pv2 ph3 dib fw5`}>\n {this.props.children}\n </div>\n )\n }\n}\n\nexport default Badge\n\n```" } ]
code_releases_936f5a8a
[ { "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 releases/react/components/ReleasesNotesList.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { ApolloClient } from 'apollo-client'\nimport moment from 'moment'\nimport { addIndex, map } from 'ramda'\nimport React, { Component } from 'react'\nimport { compose, graphql, withApollo } from 'react-apollo'\nimport { injectIntl } from 'react-intl'\n\nimport { Helmet } from 'vtex.render-runtime'\nimport { Spinner } from 'vtex.styleguide'\n\nimport ReleaseNoteCard from './ReleaseNoteCard'\nimport ReleaseTime from './ReleaseTime'\n\nimport ReleasesNotes from '../queries/ReleasesNotes.graphql'\n\ninterface ReleasesNotesData {\n releasesNotes: any\n}\n\ninterface ReleasesNotesProps {\n bottom: boolean\n client: ApolloClient<any>\n releasesNotes: any\n}\n\ninterface ReleasesNotesState {\n isLoading: boolean\n lastPage: boolean\n nextPage: number\n releasesNotes: ReleaseNote[]\n}\n\nconst mapNotesWithIndex = addIndex<ReleaseNote>(map)\n\nclass ReleasesNotesList extends Component<\n ReleasesNotesProps & ReactIntl.InjectedIntlProps,\n ReleasesNotesState\n> {\n constructor(props: any) {\n super(props)\n\n this.state = {\n isLoading: props.releasesNotes.loading,\n lastPage: false,\n nextPage: 2,\n releasesNotes: props.releasesNotes.releasesNotes,\n }\n }\n\n public componentDidUpdate(\n prevProps: ReleasesNotesProps,\n _: ReleasesNotesState\n ) {\n const {\n releasesNotes: { loading: prevLoading },\n } = prevProps\n const { releasesNotes: curStateNotes } = this.state\n const {\n bottom,\n releasesNotes: { releasesNotes: curPropsNotes, loading: curLoading },\n } = this.props\n\n if (prevLoading && !curLoading && !curStateNotes) {\n this.setState(prevState => {\n return {\n ...prevState,\n isLoading: false,\n releasesNotes: curPropsNotes,\n }\n })\n }\n\n if (!prevProps.bottom && bottom) {\n this.setState(pState => {\n this.getPage(pState.nextPage)\n\n return { ...pState, isLoading: true, nextPage: pState.nextPage + 1 }\n })\n }\n }\n\n public render() {\n const { isLoading, releasesNotes } = this.state\n const {\n releasesNotes: { error },\n intl,\n } = this.props\n\n if (error) {\n console.error(error)\n }\n\n const notesList = releasesNotes\n ? mapNotesWithIndex((note: ReleaseNote, index: number) => {\n const noteDate = moment(new Date(note.date))\n\n const lastNote =\n index !== 0 ? moment(new Date(releasesNotes[index - 1].date)) : null\n\n const addDate =\n index === 0 ||\n (lastNote !== null && noteDate.date() !== lastNote.date())\n\n return (\n <div\n key={note.cacheId}\n className=\"timeline relative flex flex-row w-100 justify-center pb8\"\n >\n <Helmet\n title={intl.formatMessage({\n id: 'releases.content.notes',\n })}\n />\n <ReleaseTime canAddDate={addDate} releaseDate={noteDate} />\n <ReleaseNoteCard note={note} />\n </div>\n )\n }, releasesNotes)\n : []\n\n return (\n <div className=\"pa5 ph8-ns pt8-ns pb6-ns\">\n {notesList}\n {isLoading ? this.renderLoading() : null}\n </div>\n )\n }\n\n private getPage = (page: number) => {\n const { client } = this.props\n\n client\n .query<ReleasesNotesData>({\n query: ReleasesNotes,\n variables: { page },\n })\n .then(data => {\n const releasesNotes = data.data.releasesNotes\n\n this.setState(prevState => {\n return {\n ...prevState,\n isLoading: false,\n lastPage: releasesNotes.length === 0,\n releasesNotes: [...prevState.releasesNotes, ...releasesNotes],\n }\n })\n })\n }\n\n private renderLoading = () => {\n return (\n <div className=\"w-100 flex justify-center pv4\">\n <Spinner />\n </div>\n )\n }\n}\n\nexport default compose(\n injectIntl,\n withApollo,\n graphql<ReleasesNotesData>(ReleasesNotes, { name: 'releasesNotes' })\n)(ReleasesNotesList)\n\n```" } ]
code_releases_22f6a7fc
[ { "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 releases/react/components/ReleaseNoteCard.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport marked from 'marked'\nimport React, { Component } from 'react'\nimport ReactTooltip from 'react-tooltip'\nimport Badge from './Badge'\n\nimport TagIcon from '../icons/TagIcon'\n\ninterface ReleaseNoteCardProps {\n note: ReleaseNote\n}\n\nclass ReleaseNoteCard extends Component<ReleaseNoteCardProps> {\n public render() {\n const { note } = this.props\n const markdownDescription = marked(note.description)\n\n return (\n <div className=\"flex-auto b--silver ba br3 pa5 ph7-ns pv7-ns\">\n <div className=\"w-100 flex flex-column flex-row-l justify-between pb4 pb0-l\">\n <div className=\"w-75\">\n <span className=\"fw4 f3 near-black\">\n {note.appName}\n </span>\n <span className=\"db pt3 lh-title c-muted-1 pb4\">\n {note.title}\n </span>\n </div>\n <div className=\"pt4 pt0-l\">\n <Badge className=\"near-black ba b--near-black\">\n <TagIcon /><span className=\"f5 pl2\">{note.version}</span>\n </Badge>\n </div>\n </div>\n <div className=\"w-100 mt4\">\n <div className=\"w-100 flex flex-row justify-between\">\n <div className=\"flex flex-row\">\n <img\n className=\"br-pill w-auto\"\n data-tip data-for={note.date + note.appName}\n src={note.author.gravatarURL}\n style={{ height: '40px' }}\n />\n <ReactTooltip\n id={note.date + note.appName}\n effect=\"solid\"\n place=\"bottom\"\n >\n <span>{note.author.username}</span>\n </ReactTooltip>\n </div>\n </div>\n <div className=\"w-100 br3 br--bottom pt3\">\n <div className=\"near-black f5 lh-title list\" dangerouslySetInnerHTML={{ __html: markdownDescription }}></div>\n </div>\n </div>\n </div>\n )\n }\n}\n\nexport default ReleaseNoteCard\n\n```" } ]
code_releases_f2039da5
[ { "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 releases/react/components/ReleasesListFilter.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { concat, map } from 'ramda'\nimport React, { Component } from 'react'\nimport { compose, graphql } from 'react-apollo'\nimport { injectIntl } from 'react-intl'\nimport { Dropdown, Radio } from 'vtex.styleguide'\n\nimport Projects from '../queries/Projects.graphql'\n\ninterface ProjectsData {\n projects: any\n}\n\ninterface FilterProps {\n appName: string\n env: Environment\n handleAppChange: (event: any) => void\n handleEnvChange: (event: any) => void\n}\n\nclass ReleasesListFilter extends Component<ProjectsData & FilterProps & ReactIntl.InjectedIntlProps> {\n public render() {\n const {\n appName,\n env,\n handleAppChange,\n handleEnvChange,\n intl,\n projects: { projects } } = this.props\n\n const projectList = projects ? projects : []\n const projectOptions = concat(\n [\n {\n label: intl.formatMessage({ id: 'releases.filter.allProjects' }),\n value: 'all'\n }\n ],\n map((project: Project) => {\n return { value: project.name, label: project.name }\n }, projectList)\n )\n\n return (\n <div className=\"flex flex-column flex-row-ns flex-none justify-between-ns ph5 pt7 pb5 pb0-ns pt8-ns ph8-ns\">\n <div className=\"w-25-ns\">\n <Dropdown\n onChange={handleAppChange}\n options={projectOptions}\n value={appName}\n />\n </div>\n <div className=\"flex flex-row-ns pt4 justify-start\">\n <div className=\"pr4\">\n <Radio\n checked={env === 'all'}\n id=\"all\"\n label={intl.formatMessage({ id: 'releases.filter.allEnvs' })}\n value=\"all\"\n name=\"env-checkbox-group\"\n onChange={handleEnvChange}\n />\n </div>\n <div className=\"pr4\">\n <Radio\n checked={env === 'stable'}\n id=\"stable\"\n label=\"Stable\"\n value=\"stable\"\n name=\"env-checkbox-group\"\n onChange={handleEnvChange}\n />\n </div>\n <div>\n <Radio\n checked={env === 'beta'}\n id=\"beta\"\n label=\"Beta\"\n value=\"beta\"\n name=\"env-checkbox-group\"\n onChange={handleEnvChange}\n />\n </div>\n </div>\n </div>\n )\n }\n}\n\nexport default compose(\n injectIntl,\n graphql<ProjectsData>(Projects, {\n name: 'projects',\n options: {\n ssr: false\n }\n }),\n)(ReleasesListFilter)\n\n```" } ]
code_releases_254e76a9
[ { "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 releases/react/components/ReleasesContent.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\nimport { FormattedMessage } from 'react-intl'\n\nimport NavigationTab from './NavigationTab'\nimport ReleasesList from './ReleasesList'\nimport ReleasesNotesList from './ReleasesNotesList'\n\ninterface ReleasesContentProps {\n bottom: boolean\n}\n\ninterface ReleasesContentState {\n appName: string\n contentType: string\n}\n\nclass ReleasesContent extends Component<ReleasesContentProps, ReleasesContentState> {\n constructor(props: any) {\n super(props)\n\n this.state = {\n appName: 'all',\n contentType: 'releases'\n }\n }\n\n public render() {\n const { contentType } = this.state\n\n return (\n <div className=\"w-100 h-100 flex-auto\">\n <div className=\"h-100 w-100 flex flex-column items-center\">\n <div className=\"w-100 w-60-l mw9 flex flex-column\">\n <div>\n <div className=\"ph5 mb7 ph4 ph0-ns\">\n <span className=\"near-black f1 fw6\">\n <FormattedMessage id=\"releases.content.title\" />\n </span>\n </div>\n <NavigationTab\n contentType={contentType}\n handleContentChange={this.handleContentChange}\n />\n </div>\n <div className=\"w-100 bg-white br2\">\n {this.selectContent()}\n </div>\n </div>\n </div>\n </div>\n )\n }\n\n private handleAppChange = (event: any) => {\n const appName = event.target.value as string\n\n this.setState((prevState) => {\n return ({\n ...prevState,\n appName\n })\n })\n }\n\n private handleContentChange = (contentType: string) => {\n this.setState({ contentType })\n }\n\n private selectContent = () => {\n const { appName, contentType } = this.state\n\n switch (contentType) {\n case 'releases':\n return (\n <ReleasesList\n appName={appName}\n handleAppChange={this.handleAppChange}\n bottom={this.props.bottom}\n />\n )\n case 'notes':\n return <ReleasesNotesList bottom={this.props.bottom} />\n default:\n return null\n }\n }\n}\n\nexport default ReleasesContent\n\n```" } ]
code_releases_8710da1f
[ { "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 releases/react/icons/TagIcon.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass TagIcon extends Component {\n public render() {\n return (\n <svg width=\"15px\" height=\"15px\" viewBox=\"0 0 1792 1792\">\n <path d=\"M576 448q0-53-37.5-90.5t-90.5-37.5-90.5 37.5-37.5 90.5 37.5 90.5 90.5 37.5 90.5-37.5 37.5-90.5zm1067 576q0 53-37 90l-491 492q-39 37-91 37-53 0-90-37l-715-716q-38-37-64.5-101t-26.5-117v-416q0-52 38-90t90-38h416q53 0 117 26.5t102 64.5l715 714q37 39 37 91z\" />\n </svg>\n )\n }\n}\n\nexport default TagIcon\n```" } ]
code_releases_9d976157
[ { "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 releases/react/icons/RefreshIcon.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass RefreshIcon extends Component {\n public render() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 1792 1792\">\n <path d=\"M1639 1056q0 5-1 7-64 268-268 434.5t-478 166.5q-146 0-282.5-55t-243.5-157l-129 129q-19 19-45 19t-45-19-19-45v-448q0-26 19-45t45-19h448q26 0 45 19t19 45-19 45l-137 137q71 66 161 102t187 36q134 0 250-65t186-179q11-17 53-117 8-23 30-23h192q13 0 22.5 9.5t9.5 22.5zm25-800v448q0 26-19 45t-45 19h-448q-26 0-45-19t-19-45 19-45l138-138q-148-137-349-137-134 0-250 65t-186 179q-11 17-53 117-8 23-30 23h-199q-13 0-22.5-9.5t-9.5-22.5v-7q65-268 270-434.5t480-166.5q146 0 284 55.5t245 156.5l130-129q19-19 45-19t45 19 19 45z\"/>\n </svg>\n )\n }\n}\n\nexport default RefreshIcon\n\n```" } ]
code_releases_5ccaee22
[ { "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 releases/react/icons/VtexIcon.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass VtexIcon extends Component {\n public render() {\n return (\n <svg width=\"100\" height=\"36\" viewBox=\"0 0 100 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"100\" height=\"36\" fill=\"black\" fillOpacity=\"0\"/>\n <path d=\"M39.3559 0H7.58867C5.12544 0 3.54811 2.59188 4.70074 4.7466L7.87832 10.7021H2.11774C1.75293 10.7022 1.39433 10.7956 1.07667 10.9732C0.759019 11.1507 0.493077 11.4065 0.304605 11.7156C0.116133 12.0248 0.0115195 12.3769 0.000898204 12.7378C-0.00972314 13.0987 0.0740067 13.4562 0.243979 13.7757L10.4647 32.9227C10.6449 33.2595 10.9144 33.5412 11.2442 33.7378C11.5741 33.9343 11.9518 34.0381 12.3368 34.0381C12.7218 34.0381 13.0995 33.9343 13.4293 33.7378C13.7592 33.5412 14.0287 33.2595 14.2088 32.9227L16.9846 27.7507L20.4672 34.2762C21.6928 36.5714 25.0131 36.5756 26.243 34.283L42.1657 4.62638C43.2912 2.52883 41.7555 0 39.3559 0ZM25.0862 12.6711L18.2205 25.4615C18.1005 25.6854 17.9212 25.8728 17.7017 26.0034C17.4823 26.1341 17.231 26.2032 16.9749 26.2032C16.7188 26.2032 16.4675 26.1341 16.2481 26.0034C16.0286 25.8728 15.8492 25.6854 15.7292 25.4615L8.92986 12.7249C8.81622 12.5125 8.7599 12.2747 8.76636 12.0345C8.77283 11.7943 8.84185 11.5598 8.96675 11.3537C9.09166 11.1476 9.2682 10.977 9.4793 10.8582C9.69039 10.7395 9.92888 10.6768 10.1717 10.6761H23.8749C24.1116 10.6761 24.3443 10.7367 24.5503 10.8521C24.7564 10.9675 24.9287 11.1336 25.0507 11.3345C25.1726 11.5353 25.2399 11.7639 25.2462 11.9981C25.2524 12.2323 25.1973 12.4642 25.0862 12.6711Z\" fill=\"#F71963\"/>\n <path d=\"M73.1448 13.7581H69.6699V25.5456C69.6697 25.653 69.6265 25.7559 69.5497 25.8319C69.473 25.9078 69.369 25.9506 69.2605 25.9508H66.5807C66.4722 25.9506 66.3681 25.9078 66.2914 25.8319C66.2147 25.7559 66.1715 25.653 66.1713 25.5456V13.7581H62.676C62.6234 13.7602 62.5708 13.7519 62.5215 13.7335C62.4722 13.7152 62.4271 13.6873 62.389 13.6513C62.3508 13.6154 62.3203 13.5723 62.2992 13.5245C62.2782 13.4767 62.2671 13.4252 62.2666 13.373V11.2881C62.2671 11.236 62.2782 11.1845 62.2992 11.1367C62.3203 11.0889 62.3508 11.0457 62.389 11.0098C62.4271 10.9739 62.4722 10.9459 62.5215 10.9276C62.5708 10.9093 62.6234 10.9009 62.676 10.9031H73.1439C73.2524 10.898 73.3585 10.9357 73.439 11.0078C73.5196 11.08 73.568 11.1807 73.5737 11.2881V13.3739C73.5678 13.4809 73.5194 13.5814 73.4391 13.6533C73.3587 13.7252 73.253 13.7629 73.1448 13.7581Z\" fill=\"#F71963\"/>\n <path d=\"M84.2999 25.8659C83.5838 25.9668 82.3794 26.129 80.1701 26.129C77.531 26.129 75.1995 25.4607 75.1995 21.7759V15.0503C75.1995 11.3655 77.5523 10.7173 80.1905 10.7173C82.3989 10.7173 83.5838 10.8795 84.2999 10.9804C84.5861 11.0208 84.7093 11.1225 84.7093 11.3856V13.2713C84.709 13.3787 84.6658 13.4817 84.5891 13.5576C84.5124 13.6336 84.4084 13.6763 84.2999 13.6766H79.9866C79.0251 13.6766 78.6777 14.0002 78.6777 15.0536V16.8964H84.1368C84.2453 16.8967 84.3493 16.9394 84.426 17.0154C84.5027 17.0913 84.546 17.1943 84.5462 17.3017V19.2252C84.546 19.3326 84.5027 19.4355 84.426 19.5115C84.3493 19.5874 84.2453 19.6302 84.1368 19.6304H78.6777V21.7767C78.6777 22.8293 79.0251 23.1538 79.9866 23.1538H84.2999C84.4084 23.154 84.5124 23.1968 84.5891 23.2727C84.6658 23.3487 84.709 23.4516 84.7093 23.559V25.4422C84.7093 25.7036 84.5861 25.8255 84.2999 25.8659Z\" fill=\"#F71963\"/>\n <path d=\"M99.7342 25.9466H96.4818C96.216 25.9466 96.0928 25.8625 95.9501 25.6431L93.1301 21.2117L90.5752 25.5455C90.4316 25.7885 90.2889 25.9508 90.0655 25.9508H87.0383C86.8336 25.9508 86.7317 25.8289 86.7317 25.6876C86.7356 25.6381 86.7495 25.5898 86.7724 25.5455L91.2037 18.2314L86.7266 11.2864C86.7039 11.2493 86.6899 11.2077 86.6858 11.1645C86.6931 11.0901 86.729 11.0213 86.7861 10.9724C86.8431 10.9234 86.917 10.898 86.9924 10.9014H90.2855C90.5106 10.9014 90.6745 11.104 90.7951 11.2864L93.4121 15.3764L95.945 11.2864C96.0469 11.104 96.2312 10.9014 96.4546 10.9014H99.4819C99.5573 10.898 99.6312 10.9234 99.6882 10.9724C99.7453 11.0213 99.7812 11.0901 99.7885 11.1645C99.7844 11.2077 99.7704 11.2493 99.7477 11.2864L95.2927 18.2743L99.9388 25.5455C99.9751 25.6073 99.9961 25.6768 100 25.7481C100.001 25.8658 99.8981 25.9466 99.7342 25.9466Z\" fill=\"#F71963\"/>\n <path d=\"M57.3639 10.9434C57.2909 10.9436 57.2201 10.9688 57.1638 11.0148C57.1074 11.0608 57.0689 11.1247 57.0547 11.1956L54.0852 22.0735C54.0445 22.2962 53.9833 22.377 53.799 22.377C53.6147 22.377 53.5535 22.2929 53.5128 22.0735L50.5399 11.1931C50.5257 11.1222 50.4872 11.0583 50.4308 11.0123C50.3745 10.9663 50.3038 10.9411 50.2307 10.9409H47.308C47.2604 10.9409 47.2135 10.9516 47.1707 10.9721C47.1279 10.9926 47.0904 11.0223 47.0608 11.0592C47.0313 11.096 47.0105 11.139 47 11.1849C46.9896 11.2308 46.9897 11.2784 47.0005 11.3242C47.0005 11.3242 50.6274 23.7994 50.6673 23.9222C51.1514 25.4085 52.3262 26.1189 53.8211 26.1189C55.2447 26.1189 56.4873 25.3749 56.9732 23.9264C57.0309 23.7582 60.5772 11.3234 60.5772 11.3234C60.5877 11.2776 60.5878 11.2301 60.5773 11.1843C60.5667 11.1385 60.5459 11.0957 60.5164 11.0589C60.4869 11.0222 60.4494 10.9925 60.4066 10.972C60.3639 10.9516 60.3171 10.941 60.2697 10.9409L57.3639 10.9434Z\" fill=\"#F71963\"/>\n <path d=\"M39.3559 0H7.58867C5.12544 0 3.54811 2.59188 4.70074 4.7466L7.87832 10.7021H2.11774C1.75293 10.7022 1.39433 10.7956 1.07667 10.9732C0.759019 11.1507 0.493077 11.4065 0.304605 11.7156C0.116133 12.0248 0.0115195 12.3769 0.000898204 12.7378C-0.00972314 13.0987 0.0740067 13.4562 0.243979 13.7757L10.4647 32.9227C10.6449 33.2595 10.9144 33.5412 11.2442 33.7378C11.5741 33.9343 11.9518 34.0381 12.3368 34.0381C12.7218 34.0381 13.0995 33.9343 13.4293 33.7378C13.7592 33.5412 14.0287 33.2595 14.2088 32.9227L16.9846 27.7507L20.4672 34.2762C21.6928 36.5714 25.0131 36.5756 26.243 34.283L42.1657 4.62638C43.2912 2.52883 41.7555 0 39.3559 0ZM25.0862 12.6711L18.2205 25.4615C18.1005 25.6854 17.9212 25.8728 17.7017 26.0034C17.4823 26.1341 17.231 26.2032 16.9749 26.2032C16.7188 26.2032 16.4675 26.1341 16.2481 26.0034C16.0286 25.8728 15.8492 25.6854 15.7292 25.4615L8.92986 12.7249C8.81622 12.5125 8.7599 12.2747 8.76636 12.0345C8.77283 11.7943 8.84185 11.5598 8.96675 11.3537C9.09166 11.1476 9.2682 10.977 9.4793 10.8582C9.69039 10.7395 9.92888 10.6768 10.1717 10.6761H23.8749C24.1116 10.6761 24.3443 10.7367 24.5503 10.8521C24.7564 10.9675 24.9287 11.1336 25.0507 11.3345C25.1726 11.5353 25.2399 11.7639 25.2462 11.9981C25.2524 12.2323 25.1973 12.4642 25.0862 12.6711Z\" fill=\"#F71963\"/>\n </svg>\n\n )\n }\n}\n\nexport default VtexIcon\n```" } ]
code_releases_d5867c54
[ { "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 releases/react/icons/UserIcon.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass UserIcon extends Component {\n public render() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 1792 1792\">\n <path d=\"M1536 1399q0 109-62.5 187t-150.5 78h-854q-88 0-150.5-78t-62.5-187q0-85 8.5-160.5t31.5-152 58.5-131 94-89 134.5-34.5q131 128 313 128t313-128q76 0 134.5 34.5t94 89 58.5 131 31.5 152 8.5 160.5zm-256-887q0 159-112.5 271.5t-271.5 112.5-271.5-112.5-112.5-271.5 112.5-271.5 271.5-112.5 271.5 112.5 112.5 271.5z\" />\n </svg>\n )\n }\n}\n\nexport default UserIcon\n```" } ]
code_releases_86781eff
[ { "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 releases/react/icons/LogoutIcon.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass GithubIcon extends Component {\n public render() {\n return (\n <svg width=\"17\" height=\"16\" viewBox=\"0 0 17 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"15\" height=\"14\" fill=\"black\" fillOpacity=\"0\" transform=\"translate(1 1)\"/>\n <path d=\"M6 8H16\" stroke=\"#134CD8\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n <path d=\"M12 4L16 8L12 12\" stroke=\"#134CD8\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n <path d=\"M9 15H2C1.448 15 1 14.552 1 14V2C1 1.448 1.448 1 2 1H9\" stroke=\"#134CD8\" strokeMiterlimit=\"10\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n </svg>\n\n )\n }\n}\n\nexport default GithubIcon\n```" } ]
code_releases_ca666bfa
[ { "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 releases/react/icons/GithubIcon.tsx from the releases VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component } from 'react'\n\nclass GithubIcon extends Component {\n public render() {\n return (\n <svg width=\"15px\" height=\"15px\" viewBox=\"0 0 256 250\">\n <g>\n <path d=\"M128.00106,0 C57.3172926,0 0,57.3066942 0,128.00106 C0,184.555281 36.6761997,232.535542 87.534937,249.460899 C93.9320223,250.645779 96.280588,246.684165 96.280588,243.303333 C96.280588,240.251045 96.1618878,230.167899 96.106777,219.472176 C60.4967585,227.215235 52.9826207,204.369712 52.9826207,204.369712 C47.1599584,189.574598 38.770408,185.640538 38.770408,185.640538 C27.1568785,177.696113 39.6458206,177.859325 39.6458206,177.859325 C52.4993419,178.762293 59.267365,191.04987 59.267365,191.04987 C70.6837675,210.618423 89.2115753,204.961093 96.5158685,201.690482 C97.6647155,193.417512 100.981959,187.77078 104.642583,184.574357 C76.211799,181.33766 46.324819,170.362144 46.324819,121.315702 C46.324819,107.340889 51.3250588,95.9223682 59.5132437,86.9583937 C58.1842268,83.7344152 53.8029229,70.715562 60.7532354,53.0843636 C60.7532354,53.0843636 71.5019501,49.6441813 95.9626412,66.2049595 C106.172967,63.368876 117.123047,61.9465949 128.00106,61.8978432 C138.879073,61.9465949 149.837632,63.368876 160.067033,66.2049595 C184.49805,49.6441813 195.231926,53.0843636 195.231926,53.0843636 C202.199197,70.715562 197.815773,83.7344152 196.486756,86.9583937 C204.694018,95.9223682 209.660343,107.340889 209.660343,121.315702 C209.660343,170.478725 179.716133,181.303747 151.213281,184.472614 C155.80443,188.444828 159.895342,196.234518 159.895342,208.176593 C159.895342,225.303317 159.746968,239.087361 159.746968,243.303333 C159.746968,246.709601 162.05102,250.70089 168.53925,249.443941 C219.370432,232.499507 256,184.536204 256,128.00106 C256,57.3066942 198.691187,0 128.00106,0 Z M47.9405593,182.340212 C47.6586465,182.976105 46.6581745,183.166873 45.7467277,182.730227 C44.8183235,182.312656 44.2968914,181.445722 44.5978808,180.80771 C44.8734344,180.152739 45.876026,179.97045 46.8023103,180.409216 C47.7328342,180.826786 48.2627451,181.702199 47.9405593,182.340212 Z M54.2367892,187.958254 C53.6263318,188.524199 52.4329723,188.261363 51.6232682,187.366874 C50.7860088,186.474504 50.6291553,185.281144 51.2480912,184.70672 C51.8776254,184.140775 53.0349512,184.405731 53.8743302,185.298101 C54.7115892,186.201069 54.8748019,187.38595 54.2367892,187.958254 Z M58.5562413,195.146347 C57.7719732,195.691096 56.4895886,195.180261 55.6968417,194.042013 C54.9125733,192.903764 54.9125733,191.538713 55.713799,190.991845 C56.5086651,190.444977 57.7719732,190.936735 58.5753181,192.066505 C59.3574669,193.22383 59.3574669,194.58888 58.5562413,195.146347 Z M65.8613592,203.471174 C65.1597571,204.244846 63.6654083,204.03712 62.5716717,202.981538 C61.4524999,201.94927 61.1409122,200.484596 61.8446341,199.710926 C62.5547146,198.935137 64.0575422,199.15346 65.1597571,200.200564 C66.2704506,201.230712 66.6095936,202.705984 65.8613592,203.471174 Z M75.3025151,206.281542 C74.9930474,207.284134 73.553809,207.739857 72.1039724,207.313809 C70.6562556,206.875043 69.7087748,205.700761 70.0012857,204.687571 C70.302275,203.678621 71.7478721,203.20382 73.2083069,203.659543 C74.6539041,204.09619 75.6035048,205.261994 75.3025151,206.281542 Z M86.046947,207.473627 C86.0829806,208.529209 84.8535871,209.404622 83.3316829,209.4237 C81.8013,209.457614 80.563428,208.603398 80.5464708,207.564772 C80.5464708,206.498591 81.7483088,205.631657 83.2786917,205.606221 C84.8005962,205.576546 86.046947,206.424403 86.046947,207.473627 Z M96.6021471,207.069023 C96.7844366,208.099171 95.7267341,209.156872 94.215428,209.438785 C92.7295577,209.710099 91.3539086,209.074206 91.1652603,208.052538 C90.9808515,206.996955 92.0576306,205.939253 93.5413813,205.66582 C95.054807,205.402984 96.4092596,206.021919 96.6021471,207.069023 Z\" fill=\"#161614\"></path>\n </g>\n </svg>\n )\n }\n}\n\nexport default GithubIcon\n```" } ]
code_google-geolocation-resolver_77bfbc59
[ { "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 google-geolocation-resolver/docs/README.md from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# VTEX Google Geolocation GraphQL Resolver\n\n⚠️ **This is an ongoing, unsupported, unfinished and undocumented project. We do not guarantee any results after installation.** ⚠️\n\nImplements the GraphQL Schema defined here: <https://github.com/vtex-apps/geolocation-graphql-interface>\n\n```" } ]
code_google-geolocation-resolver_5cc2cf52
[ { "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 google-geolocation-resolver/node/package.json from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"private\": \"true\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"uuid\": \"^8.3.1\",\n \"@googlemaps/google-maps-services-js\": \"^3.1.6\",\n \"vtex.geolocation-graphql-interface\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.geolocation-graphql-interface@0.3.0/public\"\n },\n \"devDependencies\": {\n \"@types/googlemaps\": \"^3.39.13\",\n \"@types/jest\": \"^26.0.16\",\n \"@types/uuid\": \"^8.3.0\",\n \"@types/vtex.geolocation-graphql-interface\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.geolocation-graphql-interface@0.3.0/public/@types/vtex.geolocation-graphql-interface\",\n \"@vtex/api\": \"6.37.1\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"vtex.messages\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.messages@1.60.2/public/@types/vtex.messages\"\n },\n \"version\": \"0.4.0\"\n}\n\n```" } ]
code_google-geolocation-resolver_b92c5f95
[ { "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 google-geolocation-resolver/node/index.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ParamsContext, RecorderState, Service } from '@vtex/api'\nimport schema from 'vtex.geolocation-graphql-interface/graphql'\n\nimport { Clients } from './clients'\nimport { resolvers } from './resolvers'\n\nconst DEFAULT_TIMEOUT_MS = 5 * 1000\n\nexport default new Service<Clients, RecorderState, ParamsContext>({\n clients: {\n implementation: Clients,\n options: {\n default: {\n timeout: DEFAULT_TIMEOUT_MS,\n },\n },\n },\n graphql: {\n schema,\n resolvers,\n },\n})\n\n```" } ]
code_google-geolocation-resolver_80ed0ce2
[ { "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 google-geolocation-resolver/node/clients/Google.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n Client,\n PlaceAutocompleteRequest,\n PlaceDetailsRequest,\n} from '@googlemaps/google-maps-services-js'\nimport { ExternalClient, IOContext, InstanceOptions } from '@vtex/api'\nimport axios from 'axios'\n\nexport class Google extends ExternalClient {\n private client: Client\n private baseUrl = 'http://maps.googleapis.com'\n private routes = {\n placeAutocomplete: `${this.baseUrl}/maps/api/place/autocomplete/json`,\n placeDetails: `${this.baseUrl}/maps/api/place/details/json`,\n }\n\n constructor(context: IOContext, options?: InstanceOptions) {\n super('', context, options)\n\n const axiosInstance = axios.create({\n ...options,\n baseURL: this.baseUrl,\n headers: {\n ...options?.headers,\n 'x-vtex-use-https': 'true',\n 'proxy-authorization': context.authToken,\n },\n })\n\n this.client = new Client({ axiosInstance })\n }\n\n public placeAutocomplete(request: PlaceAutocompleteRequest) {\n return this.client.placeAutocomplete({\n ...request,\n url: this.routes.placeAutocomplete,\n })\n }\n\n public placeDetails(request: PlaceDetailsRequest) {\n return this.client.placeDetails({\n ...request,\n url: this.routes.placeDetails,\n })\n }\n}\n\n```" } ]
code_google-geolocation-resolver_49f8dfd4
[ { "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 google-geolocation-resolver/node/clients/index.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport { Google } from './Google'\n\nexport class Clients extends IOClients {\n public get google() {\n return this.getOrSet('google', Google)\n }\n}\n\n```" } ]
code_google-geolocation-resolver_85871586
[ { "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 google-geolocation-resolver/node/typings/global.d.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ServiceContext } from '@vtex/api'\n\nimport { Clients } from '../clients'\n\ndeclare global {\n type Context = ServiceContext & {\n clients: Clients\n }\n\n interface GeolocationRule {\n valueIn: 'long_name' | 'short_name'\n types: string[]\n required?: boolean\n notApplicable?: boolean\n handler?: (\n address: Address,\n googleAddress: google.maps.GeocoderResult\n ) => Address\n }\n\n type GeolocationComponents =\n | 'postalCode'\n | 'street'\n | 'neighborhood'\n | 'state'\n | 'city'\n | 'number'\n\n type GeolocationRules = {\n [component in GeolocationComponents]?: GeolocationRule\n }\n\n interface Rules {\n geolocation: GeolocationRules\n }\n\n namespace NodeJS {\n interface ProcessEnv {\n VTEX_APP_ID: string\n }\n }\n}\n\n```" } ]
code_google-geolocation-resolver_3f2b9526
[ { "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 google-geolocation-resolver/node/resolvers/providerLogo.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/*\nThe `src` have two variations, based on weather or not the app is in development (linked).\n- Development/linked: [...]/private/assets/v1/linked/[...]\n- Production/released: [...]/public/assets/v1/published/[...]\n*/\nimport { Image } from 'vtex.geolocation-graphql-interface'\n\n// TODO: find a way to translate this to other idioms.\nconst ALT_TEXT = 'Google logo'\n\nconst getProviderLogo = async (\n _: unknown,\n _args: unknown,\n { clients: { apps }, vtex: { host } }: Context\n): Promise<Image> => {\n const appId = process.env.VTEX_APP_ID\n const appManifest = await apps.getApp(appId)\n const linked = appManifest.version.includes('+')\n const visibility = linked ? 'private' : 'public'\n const status = linked ? 'linked' : 'published'\n const src = `https://${host}/_v/${visibility}/assets/v1/${status}/${appId}/public/logo.png`\n\n return { src, alt: ALT_TEXT }\n}\n\nexport default getProviderLogo\n\n```" } ]
code_google-geolocation-resolver_abd20f36
[ { "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 google-geolocation-resolver/node/resolvers/sessionToken.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { v4 as uuidv4 } from 'uuid'\n\nconst getSessionToken = async (\n _: unknown,\n _args: unknown,\n _ctx: Context\n): Promise<string> => uuidv4()\n\nexport default getSessionToken\n\n```" } ]
code_google-geolocation-resolver_5c92513a
[ { "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 google-geolocation-resolver/node/resolvers/index.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport providerLogo from './providerLogo'\nimport sessionToken from './sessionToken'\nimport addressSuggestions from './addressSuggestions'\nimport address from './address'\n\nexport const resolvers = {\n Query: {\n providerLogo,\n sessionToken,\n addressSuggestions,\n address,\n },\n}\n\n```" } ]
code_google-geolocation-resolver_2733bd0a
[ { "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 google-geolocation-resolver/node/resolvers/addressSuggestions.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n Language,\n PlaceAutocompleteType,\n Status,\n} from '@googlemaps/google-maps-services-js'\nimport {\n AddressSuggestion,\n QueryAddressSuggestionsArgs,\n} from 'vtex.geolocation-graphql-interface'\n\nimport { isAlpha2, isAlpha3, toAlpha2 } from '../countries/ISO'\nimport { ISOAlpha3 } from '../countries/types'\n\nconst toValidCountry = (country?: string | null) => {\n let validCountry = country?.toUpperCase() ?? ''\n\n if (isAlpha3(validCountry)) {\n validCountry = toAlpha2(validCountry as ISOAlpha3)\n } else if (!isAlpha2(validCountry)) {\n validCountry = ''\n }\n\n validCountry = validCountry.toLowerCase()\n\n return validCountry || null\n}\n\nconst getAddressSuggestions = async (\n _: unknown,\n { searchTerm, sessionToken, country }: QueryAddressSuggestionsArgs,\n { clients: { apps, google }, vtex: { logger, locale } }: Context\n): Promise<AddressSuggestion[]> => {\n const { apiKey } = await apps.getAppSettings(process.env.VTEX_APP_ID)\n\n if (!sessionToken) {\n logger.warn('No session token found. Additional charges may apply')\n }\n\n if (!Object.values(Language).includes(locale as Language)) {\n logger.warn(\n `\"${locale}\" is not a valid language. See the list of supported languages on https://developers.google.com/maps/faq#languagesupport`\n )\n }\n\n const validCountry = toValidCountry(country)\n\n if (country && !validCountry) {\n logger.warn(\n `\"${country}\" is not a valid country code. Use a two character, case insensitive, ISO 3166-1 Alpha-2 or Alpha-3 compatible country code instead.`\n )\n }\n\n const response = await google.placeAutocomplete({\n params: {\n input: searchTerm,\n language: locale,\n types: PlaceAutocompleteType.address,\n components: validCountry ? [`country:${validCountry}`] : undefined,\n sessiontoken: sessionToken ?? undefined,\n key: apiKey,\n },\n timeout: 1000,\n })\n\n if (response.statusText !== 'OK') {\n logger.error(response)\n\n return []\n }\n\n const { status, predictions } = response.data\n\n if (status !== Status.OK) {\n if (status === Status.ZERO_RESULTS) {\n logger.warn(response)\n } else {\n logger.error(response)\n }\n\n return []\n }\n\n return predictions.map(\n ({\n description,\n place_id: externalId,\n structured_formatting: {\n main_text: mainText,\n secondary_text: secondaryText,\n main_text_matched_substrings: [mainTextMatchInterval],\n },\n }): AddressSuggestion => {\n return {\n description,\n mainText,\n mainTextMatchInterval,\n secondaryText,\n externalId,\n }\n }\n )\n}\n\nexport default getAddressSuggestions\n\n```" } ]
code_google-geolocation-resolver_ddf16ad2
[ { "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 google-geolocation-resolver/node/resolvers/address.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n Status,\n AddressType,\n Place,\n AddressGeometry,\n Language,\n} from '@googlemaps/google-maps-services-js'\nimport { Address, QueryAddressArgs } from 'vtex.geolocation-graphql-interface'\n\nimport countryRules from '../countries/rules'\nimport { toAlpha3 } from '../countries/ISO'\nimport { ISOAlpha2 } from '../countries/types'\n\nfunction revertRuleIndex(geolocationRules: GeolocationRules) {\n return Object.entries(geolocationRules).reduce<{\n [key: string]: GeolocationComponents\n }>((acc, [propName, rule]) => {\n for (let i = 0; i < rule!.types.length; i++) {\n const type = rule!.types[i]\n\n acc[type] = propName as GeolocationComponents\n }\n\n return acc\n }, {})\n}\n\nfunction getCountry(place: Place) {\n const countryComponent = place?.address_components?.find(\n (component) => component.types.indexOf(AddressType.country) !== -1\n )\n\n return countryComponent\n ? toAlpha3(countryComponent.short_name as ISOAlpha2)\n : null\n}\n\nconst getAddress = async (\n _: unknown,\n { externalId, sessionToken }: QueryAddressArgs,\n { clients: { apps, google }, vtex: { logger, locale } }: Context\n): Promise<Address> => {\n const { apiKey } = await apps.getAppSettings(process.env.VTEX_APP_ID)\n\n if (!sessionToken) {\n logger.warn('No session token found. Additional charges may apply')\n }\n\n if (!Object.values(Language).includes(locale as Language)) {\n logger.warn(\n `\"${locale}\" is not a valid language. See the list of supported languages on https://developers.google.com/maps/faq#languagesupport`\n )\n }\n\n const response = await google.placeDetails({\n params: {\n place_id: externalId,\n language: locale ? (locale as Language) : undefined,\n sessiontoken: sessionToken ?? undefined,\n fields: ['address_component', 'geometry'],\n key: apiKey,\n },\n timeout: 1000,\n })\n\n const { result: place, status } = response.data\n\n if (response.statusText !== 'OK' || status !== Status.OK) {\n logger.error(response)\n\n return {}\n }\n\n const country = getCountry(place)\n\n const rules = countryRules[country!]\n\n if (!rules) {\n logger.warn(`We don't have geolocation rules for the country: ${country}`)\n\n return {} as Address\n }\n\n const geolocationRules = rules.geolocation\n\n const indexedRules = revertRuleIndex(geolocationRules)\n\n if (!place.address_components) {\n return {} as Address\n }\n\n const {\n location: { lng, lat },\n } = place.geometry as AddressGeometry\n\n const baseAddress = {\n addressId: '1',\n addressType: 'residential',\n geoCoordinates: [lng, lat],\n country,\n } as Address\n\n return place.address_components.reduce<Address>(\n (updatedAddress: Address, component) => {\n const mappedType = component.types.find((type) => indexedRules[type])\n const checkoutFieldName = mappedType ? indexedRules[mappedType] : null\n\n if (checkoutFieldName) {\n const geolocationField = geolocationRules[checkoutFieldName]\n\n updatedAddress[checkoutFieldName] = component[geolocationField!.valueIn]\n\n return updatedAddress\n }\n\n return updatedAddress\n },\n baseAddress\n )\n}\n\nexport default getAddress\n\n```" } ]
code_google-geolocation-resolver_e1a2015a
[ { "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 google-geolocation-resolver/node/__tests__/address.test.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n PlaceDetailsRequest,\n PlaceDetailsResponse,\n Status,\n} from '@googlemaps/google-maps-services-js'\nimport { Apps, IOClients, IOContext } from '@vtex/api'\nimport { QueryAddressArgs } from 'vtex.geolocation-graphql-interface'\n\nimport { Clients } from '../clients'\nimport { Google } from '../clients/Google'\nimport getAddress from '../resolvers/address'\n\nconst mockArgs = (): QueryAddressArgs => ({\n externalId: 'id',\n sessionToken: 'session token',\n})\n\ninterface MockContextProps {\n locale: string\n warn: (warning: unknown) => void\n}\n\nconst mockContext = ({ locale, warn }: MockContextProps): Context =>\n ({\n clients: {\n google: {\n placeDetails: (_request: PlaceDetailsRequest) =>\n Promise.resolve({\n statusText: Status.OK,\n data: {},\n } as PlaceDetailsResponse),\n } as Google,\n apps: {\n getAppSettings: (_app: string) =>\n Promise.resolve({\n apiKey: 'api key',\n } as { apiKey: string }),\n } as Apps,\n } as IOClients & Clients,\n vtex: {\n locale,\n logger: {\n warn,\n error: (_error: unknown) => undefined,\n },\n } as IOContext,\n } as Context)\n\ndescribe('address', () => {\n it.each(['pt-BR', 'en'])(\n 'shouldn\\'t log \"%s\" as invalid language code',\n async (language: string) => {\n const mockWarn = jest.fn((_warning: unknown) => undefined)\n\n await getAddress(\n {},\n mockArgs(),\n mockContext({ locale: language, warn: mockWarn })\n )\n\n expect(mockWarn).not.toBeCalledWith(\n `\"${language}\" is not a valid language. See the list of supported languages on https://developers.google.com/maps/faq#languagesupport`\n )\n }\n )\n\n it.each(['pt_BR', ''])(\n 'should log \"%s\" as invalid language code',\n async (language) => {\n const mockWarn = jest.fn((_warning: unknown) => undefined)\n\n await getAddress(\n {},\n mockArgs(),\n mockContext({ locale: language, warn: mockWarn })\n )\n\n expect(mockWarn).toBeCalledWith(\n `\"${language}\" is not a valid language. See the list of supported languages on https://developers.google.com/maps/faq#languagesupport`\n )\n }\n )\n})\n\n```" } ]
code_google-geolocation-resolver_344cfb62
[ { "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 google-geolocation-resolver/node/__tests__/sessionToken.test.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport getSessionToken from '../resolvers/sessionToken'\n\ndescribe('sessionToken', () => {\n it('should retrieve a non-empty token', async () => {\n const sessionToken = await getSessionToken({}, {}, {} as Context)\n\n expect(sessionToken).toBeTruthy()\n })\n\n it('should retrieve unique tokens', async () => {\n const firstSessionToken = await getSessionToken({}, {}, {} as Context)\n const secondSessionToken = await getSessionToken({}, {}, {} as Context)\n\n expect(firstSessionToken).not.toBe(secondSessionToken)\n })\n})\n\n```" } ]
code_google-geolocation-resolver_db80d504
[ { "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 google-geolocation-resolver/node/__tests__/providerLogo.test.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { AppManifest, Apps, IOContext } from '@vtex/api'\n\nimport getProviderLogo from '../resolvers/providerLogo'\n\ninterface MockContextProps {\n appVersion: string\n host: string\n}\n\nconst mockContext = ({ appVersion, host }: MockContextProps): Context => {\n return {\n clients: {\n apps: {\n getApp: (_app: string) =>\n Promise.resolve({\n version: appVersion,\n } as AppManifest),\n } as Apps,\n },\n vtex: {\n host,\n } as IOContext,\n } as Context\n}\n\ndescribe('providerLogo', () => {\n beforeAll(() => {\n process.env.VTEX_APP_ID = 'vtex.google-geolocation-resolver@0.1.0'\n })\n\n it('should get logo for development environment', async () => {\n const { src, alt } = await getProviderLogo(\n {},\n {},\n mockContext({\n appVersion: '0.1.0+build1607022562',\n host: 'checkoutio.myvtex.com',\n })\n )\n\n expect(src).toBe(\n 'https://checkoutio.myvtex.com/_v/private/assets/v1/linked/vtex.google-geolocation-resolver@0.1.0/public/logo.png'\n )\n expect(alt).toBe('Google logo')\n })\n\n it('should get logo for production environment', async () => {\n const { src, alt } = await getProviderLogo(\n {},\n {},\n mockContext({\n appVersion: '0.1.0',\n host: 'checkoutio.myvtex.com',\n })\n )\n\n expect(src).toBe(\n 'https://checkoutio.myvtex.com/_v/public/assets/v1/published/vtex.google-geolocation-resolver@0.1.0/public/logo.png'\n )\n expect(alt).toBe('Google logo')\n })\n})\n\n```" } ]
code_google-geolocation-resolver_cddcc7e8
[ { "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 google-geolocation-resolver/node/__tests__/addressSuggestion.test.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport getAddressSuggestions from '../resolvers/addressSuggestions'\n// eslint-disable-next-line jest/no-mocks-import\nimport {\n mockContext,\n defaultWarn,\n defaultPlaceAutocomplete,\n} from '../__mocks__/context.mock'\n\ndescribe('addressSuggestion', () => {\n it.each(['pt-BR', 'en'])(\n 'shouldn\\'t log \"%s\" as invalid language code',\n async (language: string) => {\n const mockedWarn = jest.fn((_warning: unknown) => undefined)\n\n await getAddressSuggestions(\n {},\n { searchTerm: '' },\n mockContext({ locale: language, mockedWarn })\n )\n\n expect(mockedWarn).not.toBeCalledWith(\n `\"${language}\" is not a valid language. See the list of supported languages on https://developers.google.com/maps/faq#languagesupport`\n )\n }\n )\n\n it.each(['pt_BR', ''])(\n 'should log \"%s\" as invalid language code',\n async (language: string) => {\n const mockedWarn = jest.fn((_warning: unknown) => undefined)\n\n await getAddressSuggestions(\n {},\n { searchTerm: '' },\n mockContext({ locale: language, mockedWarn })\n )\n\n expect(mockedWarn).toBeCalledWith(\n `\"${language}\" is not a valid language. See the list of supported languages on https://developers.google.com/maps/faq#languagesupport`\n )\n }\n )\n\n it.each(['br', 'bra', 'BR', 'BRA'])(\n 'should restrict address suggestions to Brazil when the \"%s\" country code is given',\n async (country: string) => {\n const mockedWarn = jest.fn(defaultWarn)\n const mockedPlaceAutocomplete = jest.fn(defaultPlaceAutocomplete)\n\n await getAddressSuggestions(\n {},\n { searchTerm: '', country },\n mockContext({ mockedPlaceAutocomplete, mockedWarn })\n )\n\n expect(mockedPlaceAutocomplete.mock.calls[0][0]).toMatchObject({\n params: { components: ['country:br'] },\n })\n expect(mockedWarn).not.toBeCalledWith(\n `\"${country}\" is not a valid country code. Use a two character, case insensitive, ISO 3166-1 Alpha-2 or Alpha-3 compatible country code instead.`\n )\n }\n )\n\n it('should not restrict address suggestions when no country code is given', async () => {\n const mockedWarn = jest.fn(defaultWarn)\n const mockedPlaceAutocomplete = jest.fn(defaultPlaceAutocomplete)\n\n await getAddressSuggestions(\n {},\n { searchTerm: '' },\n mockContext({ mockedPlaceAutocomplete, mockedWarn })\n )\n\n expect(mockedPlaceAutocomplete.mock.calls[0][0]).toMatchObject({\n params: { components: undefined },\n })\n expect(mockedWarn).not.toBeCalledWith(\n '\"\" is not a valid country code. Use a two character, case insensitive, ISO 3166-1 Alpha-2 or Alpha-3 compatible country code instead.'\n )\n })\n\n it('should not restrict address suggestions when an invalid country code is given', async () => {\n const mockedWarn = jest.fn(defaultWarn)\n const mockedPlaceAutocomplete = jest.fn(defaultPlaceAutocomplete)\n\n await getAddressSuggestions(\n {},\n { searchTerm: '', country: 'Brazil' },\n mockContext({ mockedPlaceAutocomplete, mockedWarn })\n )\n\n expect(mockedPlaceAutocomplete.mock.calls[0][0]).toMatchObject({\n params: { components: undefined },\n })\n expect(mockedWarn).toBeCalledWith(\n '\"Brazil\" is not a valid country code. Use a two character, case insensitive, ISO 3166-1 Alpha-2 or Alpha-3 compatible country code instead.'\n )\n })\n})\n\n```" } ]
code_google-geolocation-resolver_4ee08b6d
[ { "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 google-geolocation-resolver/node/countries/BRA.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nconst rules: Rules = {\n geolocation: {\n postalCode: {\n valueIn: 'long_name',\n types: ['postal_code'],\n required: false,\n },\n number: {\n valueIn: 'long_name',\n types: ['street_number'],\n required: true,\n notApplicable: true,\n },\n street: {\n valueIn: 'long_name',\n types: ['route'],\n },\n neighborhood: {\n valueIn: 'long_name',\n types: [\n 'neighborhood',\n 'sublocality_level_1',\n 'sublocality_level_2',\n 'sublocality_level_3',\n 'sublocality_level_4',\n 'sublocality_level_5',\n ],\n },\n state: {\n valueIn: 'short_name',\n types: ['administrative_area_level_1'],\n },\n city: {\n valueIn: 'long_name',\n types: ['administrative_area_level_2', 'locality'],\n },\n },\n}\n\nexport default rules\n\n```" } ]
code_google-geolocation-resolver_4c5bd7d3
[ { "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 google-geolocation-resolver/node/countries/ISO.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ISOAlpha2, ISOAlpha3 } from './types'\n\nconst countryISOMapping: Array<[ISOAlpha2, ISOAlpha3]> = [\n ['AF', 'AFG'],\n ['AX', 'ALA'],\n ['AL', 'ALB'],\n ['DZ', 'DZA'],\n ['AS', 'ASM'],\n ['AD', 'AND'],\n ['AO', 'AGO'],\n ['AI', 'AIA'],\n ['AQ', 'ATA'],\n ['AG', 'ATG'],\n ['AR', 'ARG'],\n ['AM', 'ARM'],\n ['AW', 'ABW'],\n ['AU', 'AUS'],\n ['AT', 'AUT'],\n ['AZ', 'AZE'],\n ['BS', 'BHS'],\n ['BH', 'BHR'],\n ['BD', 'BGD'],\n ['BB', 'BRB'],\n ['BY', 'BLR'],\n ['BE', 'BEL'],\n ['BZ', 'BLZ'],\n ['BJ', 'BEN'],\n ['BM', 'BMU'],\n ['BT', 'BTN'],\n ['BO', 'BOL'],\n ['BA', 'BIH'],\n ['BW', 'BWA'],\n ['BV', 'BVT'],\n ['BR', 'BRA'],\n ['VG', 'VGB'],\n ['IO', 'IOT'],\n ['BN', 'BRN'],\n ['BG', 'BGR'],\n ['BF', 'BFA'],\n ['BI', 'BDI'],\n ['KH', 'KHM'],\n ['CM', 'CMR'],\n ['CA', 'CAN'],\n ['CV', 'CPV'],\n ['KY', 'CYM'],\n ['CF', 'CAF'],\n ['TD', 'TCD'],\n ['CL', 'CHL'],\n ['CN', 'CHN'],\n ['HK', 'HKG'],\n ['MO', 'MAC'],\n ['CX', 'CXR'],\n ['CC', 'CCK'],\n ['CO', 'COL'],\n ['KM', 'COM'],\n ['CG', 'COG'],\n ['CD', 'COD'],\n ['CK', 'COK'],\n ['CR', 'CRI'],\n ['CI', 'CIV'],\n ['HR', 'HRV'],\n ['CU', 'CUB'],\n ['CY', 'CYP'],\n ['CZ', 'CZE'],\n ['DK', 'DNK'],\n ['DJ', 'DJI'],\n ['DM', 'DMA'],\n ['DO', 'DOM'],\n ['EC', 'ECU'],\n ['EG', 'EGY'],\n ['SV', 'SLV'],\n ['GQ', 'GNQ'],\n ['ER', 'ERI'],\n ['EE', 'EST'],\n ['ET', 'ETH'],\n ['FK', 'FLK'],\n ['FO', 'FRO'],\n ['FJ', 'FJI'],\n ['FI', 'FIN'],\n ['FR', 'FRA'],\n ['GF', 'GUF'],\n ['PF', 'PYF'],\n ['TF', 'ATF'],\n ['GA', 'GAB'],\n ['GM', 'GMB'],\n ['GE', 'GEO'],\n ['DE', 'DEU'],\n ['GH', 'GHA'],\n ['GI', 'GIB'],\n ['GR', 'GRC'],\n ['GL', 'GRL'],\n ['GD', 'GRD'],\n ['GP', 'GLP'],\n ['GU', 'GUM'],\n ['GT', 'GTM'],\n ['GG', 'GGY'],\n ['GN', 'GIN'],\n ['GW', 'GNB'],\n ['GY', 'GUY'],\n ['HT', 'HTI'],\n ['HM', 'HMD'],\n ['VA', 'VAT'],\n ['HN', 'HND'],\n ['HU', 'HUN'],\n ['IS', 'ISL'],\n ['IN', 'IND'],\n ['ID', 'IDN'],\n ['IR', 'IRN'],\n ['IQ', 'IRQ'],\n ['IE', 'IRL'],\n ['IM', 'IMN'],\n ['IL', 'ISR'],\n ['IT', 'ITA'],\n ['JM', 'JAM'],\n ['JP', 'JPN'],\n ['JE', 'JEY'],\n ['JO', 'JOR'],\n ['KZ', 'KAZ'],\n ['KE', 'KEN'],\n ['KI', 'KIR'],\n ['KP', 'PRK'],\n ['KR', 'KOR'],\n ['KW', 'KWT'],\n ['KG', 'KGZ'],\n ['LA', 'LAO'],\n ['LV', 'LVA'],\n ['LB', 'LBN'],\n ['LS', 'LSO'],\n ['LR', 'LBR'],\n ['LY', 'LBY'],\n ['LI', 'LIE'],\n ['LT', 'LTU'],\n ['LU', 'LUX'],\n ['MK', 'MKD'],\n ['MG', 'MDG'],\n ['MW', 'MWI'],\n ['MY', 'MYS'],\n ['MV', 'MDV'],\n ['ML', 'MLI'],\n ['MT', 'MLT'],\n ['MH', 'MHL'],\n ['MQ', 'MTQ'],\n ['MR', 'MRT'],\n ['MU', 'MUS'],\n ['YT', 'MYT'],\n ['MX', 'MEX'],\n ['FM', 'FSM'],\n ['MD', 'MDA'],\n ['MC', 'MCO'],\n ['MN', 'MNG'],\n ['ME', 'MNE'],\n ['MS', 'MSR'],\n ['MA', 'MAR'],\n ['MZ', 'MOZ'],\n ['MM', 'MMR'],\n ['NA', 'NAM'],\n ['NR', 'NRU'],\n ['NP', 'NPL'],\n ['NL', 'NLD'],\n ['AN', 'ANT'],\n ['NC', 'NCL'],\n ['NZ', 'NZL'],\n ['NI', 'NIC'],\n ['NE', 'NER'],\n ['NG', 'NGA'],\n ['NU', 'NIU'],\n ['NF', 'NFK'],\n ['MP', 'MNP'],\n ['NO', 'NOR'],\n ['OM', 'OMN'],\n ['PK', 'PAK'],\n ['PW', 'PLW'],\n ['PS', 'PSE'],\n ['PA', 'PAN'],\n ['PG', 'PNG'],\n ['PY', 'PRY'],\n ['PE', 'PER'],\n ['PH', 'PHL'],\n ['PN', 'PCN'],\n ['PL', 'POL'],\n ['PT', 'PRT'],\n ['PR', 'PRI'],\n ['QA', 'QAT'],\n ['RE', 'REU'],\n ['RO', 'ROU'],\n ['RU', 'RUS'],\n ['RW', 'RWA'],\n ['BL', 'BLM'],\n ['SH', 'SHN'],\n ['KN', 'KNA'],\n ['LC', 'LCA'],\n ['MF', 'MAF'],\n ['PM', 'SPM'],\n ['VC', 'VCT'],\n ['WS', 'WSM'],\n ['SM', 'SMR'],\n ['ST', 'STP'],\n ['SA', 'SAU'],\n ['SN', 'SEN'],\n ['RS', 'SRB'],\n ['SC', 'SYC'],\n ['SL', 'SLE'],\n ['SG', 'SGP'],\n ['SK', 'SVK'],\n ['SI', 'SVN'],\n ['SB', 'SLB'],\n ['SO', 'SOM'],\n ['ZA', 'ZAF'],\n ['GS', 'SGS'],\n ['SS', 'SSD'],\n ['ES', 'ESP'],\n ['LK', 'LKA'],\n ['SD', 'SDN'],\n ['SR', 'SUR'],\n ['SJ', 'SJM'],\n ['SZ', 'SWZ'],\n ['SE', 'SWE'],\n ['CH', 'CHE'],\n ['SY', 'SYR'],\n ['TW', 'TWN'],\n ['TJ', 'TJK'],\n ['TZ', 'TZA'],\n ['TH', 'THA'],\n ['TL', 'TLS'],\n ['TG', 'TGO'],\n ['TK', 'TKL'],\n ['TO', 'TON'],\n ['TT', 'TTO'],\n ['TN', 'TUN'],\n ['TR', 'TUR'],\n ['TM', 'TKM'],\n ['TC', 'TCA'],\n ['TV', 'TUV'],\n ['UG', 'UGA'],\n ['UA', 'UKR'],\n ['AE', 'ARE'],\n ['GB', 'GBR'],\n ['US', 'USA'],\n ['UM', 'UMI'],\n ['UY', 'URY'],\n ['UZ', 'UZB'],\n ['VU', 'VUT'],\n ['VE', 'VEN'],\n ['VN', 'VNM'],\n ['VI', 'VIR'],\n ['WF', 'WLF'],\n ['EH', 'ESH'],\n ['YE', 'YEM'],\n ['ZM', 'ZMB'],\n ['ZW', 'ZWE'],\n]\n\nexport const toAlpha3 = (country: ISOAlpha2): ISOAlpha3 => {\n const index = countryISOMapping.findIndex(([alpha2]) => alpha2 === country)\n\n return countryISOMapping[index][1]\n}\n\nexport const toAlpha2 = (country: ISOAlpha3): ISOAlpha2 => {\n const index = countryISOMapping.findIndex(([, alpha3]) => alpha3 === country)\n\n return countryISOMapping[index][0]\n}\n\nexport const isAlpha2 = (country: string): boolean => {\n return countryISOMapping.findIndex(([alpha2]) => alpha2 === country) !== -1\n}\n\nexport const isAlpha3 = (country: string): boolean => {\n return countryISOMapping.findIndex(([, alpha3]) => alpha3 === country) !== -1\n}\n\n```" } ]
code_google-geolocation-resolver_1eda584c
[ { "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 google-geolocation-resolver/node/countries/ARG.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nconst rules: Rules = {\n geolocation: {\n postalCode: {\n valueIn: 'long_name',\n types: ['postal_code'],\n required: false,\n },\n number: {\n valueIn: 'long_name',\n types: ['street_number'],\n required: true,\n notApplicable: true,\n },\n street: { valueIn: 'long_name', types: ['route'] },\n neighborhood: {\n valueIn: 'long_name',\n types: [\n 'neighborhood',\n 'sublocality_level_1',\n 'sublocality_level_2',\n 'sublocality_level_3',\n 'sublocality_level_4',\n 'sublocality_level_5',\n ],\n },\n state: {\n valueIn: 'long_name',\n types: ['administrative_area_level_1'],\n },\n city: {\n valueIn: 'long_name',\n types: ['administrative_area_level_2', 'locality'],\n },\n },\n}\n\nexport default rules\n\n```" } ]
code_google-geolocation-resolver_abe02824
[ { "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 google-geolocation-resolver/node/countries/BOL.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nconst rules: Rules = {\n geolocation: {\n postalCode: {\n valueIn: 'long_name',\n types: ['postal_code'],\n required: false,\n },\n number: {\n valueIn: 'long_name',\n types: ['street_number'],\n required: true,\n notApplicable: true,\n },\n street: { valueIn: 'long_name', types: ['route'] },\n state: {\n valueIn: 'short_name',\n types: ['administrative_area_level_1'],\n },\n city: {\n valueIn: 'long_name',\n types: ['locality', 'administrative_area_level_2'],\n },\n neighborhood: {\n valueIn: 'long_name',\n types: ['administrative_area_level_3'],\n },\n },\n}\n\nexport default rules\n\n```" } ]
code_google-geolocation-resolver_e11e1d11
[ { "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 google-geolocation-resolver/node/countries/types.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport type ISOAlpha2 =\n | 'AF'\n | 'AX'\n | 'AL'\n | 'DZ'\n | 'AS'\n | 'AD'\n | 'AO'\n | 'AI'\n | 'AQ'\n | 'AG'\n | 'AR'\n | 'AM'\n | 'AW'\n | 'AU'\n | 'AT'\n | 'AZ'\n | 'BS'\n | 'BH'\n | 'BD'\n | 'BB'\n | 'BY'\n | 'BE'\n | 'BZ'\n | 'BJ'\n | 'BM'\n | 'BT'\n | 'BO'\n | 'BA'\n | 'BW'\n | 'BV'\n | 'BR'\n | 'VG'\n | 'IO'\n | 'BN'\n | 'BG'\n | 'BF'\n | 'BI'\n | 'KH'\n | 'CM'\n | 'CA'\n | 'CV'\n | 'KY'\n | 'CF'\n | 'TD'\n | 'CL'\n | 'CN'\n | 'HK'\n | 'MO'\n | 'CX'\n | 'CC'\n | 'CO'\n | 'KM'\n | 'CG'\n | 'CD'\n | 'CK'\n | 'CR'\n | 'CI'\n | 'HR'\n | 'CU'\n | 'CY'\n | 'CZ'\n | 'DK'\n | 'DJ'\n | 'DM'\n | 'DO'\n | 'EC'\n | 'EG'\n | 'SV'\n | 'GQ'\n | 'ER'\n | 'EE'\n | 'ET'\n | 'FK'\n | 'FO'\n | 'FJ'\n | 'FI'\n | 'FR'\n | 'GF'\n | 'PF'\n | 'TF'\n | 'GA'\n | 'GM'\n | 'GE'\n | 'DE'\n | 'GH'\n | 'GI'\n | 'GR'\n | 'GL'\n | 'GD'\n | 'GP'\n | 'GU'\n | 'GT'\n | 'GG'\n | 'GN'\n | 'GW'\n | 'GY'\n | 'HT'\n | 'HM'\n | 'VA'\n | 'HN'\n | 'HU'\n | 'IS'\n | 'IN'\n | 'ID'\n | 'IR'\n | 'IQ'\n | 'IE'\n | 'IM'\n | 'IL'\n | 'IT'\n | 'JM'\n | 'JP'\n | 'JE'\n | 'JO'\n | 'KZ'\n | 'KE'\n | 'KI'\n | 'KP'\n | 'KR'\n | 'KW'\n | 'KG'\n | 'LA'\n | 'LV'\n | 'LB'\n | 'LS'\n | 'LR'\n | 'LY'\n | 'LI'\n | 'LT'\n | 'LU'\n | 'MK'\n | 'MG'\n | 'MW'\n | 'MY'\n | 'MV'\n | 'ML'\n | 'MT'\n | 'MH'\n | 'MQ'\n | 'MR'\n | 'MU'\n | 'YT'\n | 'MX'\n | 'FM'\n | 'MD'\n | 'MC'\n | 'MN'\n | 'ME'\n | 'MS'\n | 'MA'\n | 'MZ'\n | 'MM'\n | 'NA'\n | 'NR'\n | 'NP'\n | 'NL'\n | 'AN'\n | 'NC'\n | 'NZ'\n | 'NI'\n | 'NE'\n | 'NG'\n | 'NU'\n | 'NF'\n | 'MP'\n | 'NO'\n | 'OM'\n | 'PK'\n | 'PW'\n | 'PS'\n | 'PA'\n | 'PG'\n | 'PY'\n | 'PE'\n | 'PH'\n | 'PN'\n | 'PL'\n | 'PT'\n | 'PR'\n | 'QA'\n | 'RE'\n | 'RO'\n | 'RU'\n | 'RW'\n | 'BL'\n | 'SH'\n | 'KN'\n | 'LC'\n | 'MF'\n | 'PM'\n | 'VC'\n | 'WS'\n | 'SM'\n | 'ST'\n | 'SA'\n | 'SN'\n | 'RS'\n | 'SC'\n | 'SL'\n | 'SG'\n | 'SK'\n | 'SI'\n | 'SB'\n | 'SO'\n | 'ZA'\n | 'GS'\n | 'SS'\n | 'ES'\n | 'LK'\n | 'SD'\n | 'SR'\n | 'SJ'\n | 'SZ'\n | 'SE'\n | 'CH'\n | 'SY'\n | 'TW'\n | 'TJ'\n | 'TZ'\n | 'TH'\n | 'TL'\n | 'TG'\n | 'TK'\n | 'TO'\n | 'TT'\n | 'TN'\n | 'TR'\n | 'TM'\n | 'TC'\n | 'TV'\n | 'UG'\n | 'UA'\n | 'AE'\n | 'GB'\n | 'US'\n | 'UM'\n | 'UY'\n | 'UZ'\n | 'VU'\n | 'VE'\n | 'VN'\n | 'VI'\n | 'WF'\n | 'EH'\n | 'YE'\n | 'ZM'\n | 'ZW'\n\nexport type ISOAlpha3 =\n | 'AFG'\n | 'ALA'\n | 'ALB'\n | 'DZA'\n | 'ASM'\n | 'AND'\n | 'AGO'\n | 'AIA'\n | 'ATA'\n | 'ATG'\n | 'ARG'\n | 'ARM'\n | 'ABW'\n | 'AUS'\n | 'AUT'\n | 'AZE'\n | 'BHS'\n | 'BHR'\n | 'BGD'\n | 'BRB'\n | 'BLR'\n | 'BEL'\n | 'BLZ'\n | 'BEN'\n | 'BMU'\n | 'BTN'\n | 'BOL'\n | 'BIH'\n | 'BWA'\n | 'BVT'\n | 'BRA'\n | 'VGB'\n | 'IOT'\n | 'BRN'\n | 'BGR'\n | 'BFA'\n | 'BDI'\n | 'KHM'\n | 'CMR'\n | 'CAN'\n | 'CPV'\n | 'CYM'\n | 'CAF'\n | 'TCD'\n | 'CHL'\n | 'CHN'\n | 'HKG'\n | 'MAC'\n | 'CXR'\n | 'CCK'\n | 'COL'\n | 'COM'\n | 'COG'\n | 'COD'\n | 'COK'\n | 'CRI'\n | 'CIV'\n | 'HRV'\n | 'CUB'\n | 'CYP'\n | 'CZE'\n | 'DNK'\n | 'DJI'\n | 'DMA'\n | 'DOM'\n | 'ECU'\n | 'EGY'\n | 'SLV'\n | 'GNQ'\n | 'ERI'\n | 'EST'\n | 'ETH'\n | 'FLK'\n | 'FRO'\n | 'FJI'\n | 'FIN'\n | 'FRA'\n | 'GUF'\n | 'PYF'\n | 'ATF'\n | 'GAB'\n | 'GMB'\n | 'GEO'\n | 'DEU'\n | 'GHA'\n | 'GIB'\n | 'GRC'\n | 'GRL'\n | 'GRD'\n | 'GLP'\n | 'GUM'\n | 'GTM'\n | 'GGY'\n | 'GIN'\n | 'GNB'\n | 'GUY'\n | 'HTI'\n | 'HMD'\n | 'VAT'\n | 'HND'\n | 'HUN'\n | 'ISL'\n | 'IND'\n | 'IDN'\n | 'IRN'\n | 'IRQ'\n | 'IRL'\n | 'IMN'\n | 'ISR'\n | 'ITA'\n | 'JAM'\n | 'JPN'\n | 'JEY'\n | 'JOR'\n | 'KAZ'\n | 'KEN'\n | 'KIR'\n | 'PRK'\n | 'KOR'\n | 'KWT'\n | 'KGZ'\n | 'LAO'\n | 'LVA'\n | 'LBN'\n | 'LSO'\n | 'LBR'\n | 'LBY'\n | 'LIE'\n | 'LTU'\n | 'LUX'\n | 'MKD'\n | 'MDG'\n | 'MWI'\n | 'MYS'\n | 'MDV'\n | 'MLI'\n | 'MLT'\n | 'MHL'\n | 'MTQ'\n | 'MRT'\n | 'MUS'\n | 'MYT'\n | 'MEX'\n | 'FSM'\n | 'MDA'\n | 'MCO'\n | 'MNG'\n | 'MNE'\n | 'MSR'\n | 'MAR'\n | 'MOZ'\n | 'MMR'\n | 'NAM'\n | 'NRU'\n | 'NPL'\n | 'NLD'\n | 'ANT'\n | 'NCL'\n | 'NZL'\n | 'NIC'\n | 'NER'\n | 'NGA'\n | 'NIU'\n | 'NFK'\n | 'MNP'\n | 'NOR'\n | 'OMN'\n | 'PAK'\n | 'PLW'\n | 'PSE'\n | 'PAN'\n | 'PNG'\n | 'PRY'\n | 'PER'\n | 'PHL'\n | 'PCN'\n | 'POL'\n | 'PRT'\n | 'PRI'\n | 'QAT'\n | 'REU'\n | 'ROU'\n | 'RUS'\n | 'RWA'\n | 'BLM'\n | 'SHN'\n | 'KNA'\n | 'LCA'\n | 'MAF'\n | 'SPM'\n | 'VCT'\n | 'WSM'\n | 'SMR'\n | 'STP'\n | 'SAU'\n | 'SEN'\n | 'SRB'\n | 'SYC'\n | 'SLE'\n | 'SGP'\n | 'SVK'\n | 'SVN'\n | 'SLB'\n | 'SOM'\n | 'ZAF'\n | 'SGS'\n | 'SSD'\n | 'ESP'\n | 'LKA'\n | 'SDN'\n | 'SUR'\n | 'SJM'\n | 'SWZ'\n | 'SWE'\n | 'CHE'\n | 'SYR'\n | 'TWN'\n | 'TJK'\n | 'TZA'\n | 'THA'\n | 'TLS'\n | 'TGO'\n | 'TKL'\n | 'TON'\n | 'TTO'\n | 'TUN'\n | 'TUR'\n | 'TKM'\n | 'TCA'\n | 'TUV'\n | 'UGA'\n | 'UKR'\n | 'ARE'\n | 'GBR'\n | 'USA'\n | 'UMI'\n | 'URY'\n | 'UZB'\n | 'VUT'\n | 'VEN'\n | 'VNM'\n | 'VIR'\n | 'WLF'\n | 'ESH'\n | 'YEM'\n | 'ZMB'\n | 'ZWE'\n\n```" } ]
code_google-geolocation-resolver_c21ea9c6
[ { "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 google-geolocation-resolver/node/countries/rules.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ISOAlpha3 } from './types'\nimport ARG from './ARG'\nimport BOL from './BOL'\nimport BRA from './BRA'\nimport USA from './USA'\n\nconst rules: { [key in ISOAlpha3]?: Rules } = {\n ARG,\n BOL,\n BRA,\n USA,\n}\n\nexport default rules\n\n```" } ]
code_google-geolocation-resolver_4d665761
[ { "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 google-geolocation-resolver/node/countries/USA.ts from the google-geolocation-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nconst rules: Rules = {\n geolocation: {\n postalCode: {\n valueIn: 'long_name',\n types: ['postal_code'],\n required: false,\n },\n street: {\n valueIn: 'long_name',\n types: ['route'],\n },\n neighborhood: {\n valueIn: 'long_name',\n types: [\n 'neighborhood',\n 'sublocality_level_1',\n 'sublocality_level_2',\n 'sublocality_level_3',\n 'sublocality_level_4',\n 'sublocality_level_5',\n ],\n },\n state: {\n valueIn: 'short_name',\n types: ['administrative_area_level_1'],\n },\n city: {\n valueIn: 'long_name',\n types: ['locality'],\n },\n },\n}\n\nexport default rules\n\n```" } ]
code_is-api-middleware-resolver_b013aca0
[ { "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 is-api-middleware-resolver/docs/README.md from the is-api-middleware-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# VTEX Intelligent Search API Middleware Resolver\n\n`vtex.is-api-middleware-resolver` is a boilerplate for the Intelligent Search Middleware feature.\n\nCheck the full documentation to learn how to create a middleware for your account.\n\n<!-- TODO: add link to the documentation -->\n\n```" } ]
code_is-api-middleware-resolver_1856354b
[ { "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 is-api-middleware-resolver/node/service.json from the is-api-middleware-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"stack\": \"nodejs\",\n \"memory\": 256,\n \"minReplicas\": 3,\n \"workers\": 1\n}\n```" } ]
code_is-api-middleware-resolver_5a1a3f36
[ { "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 is-api-middleware-resolver/node/package.json from the is-api-middleware-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"is-api-middleware-resolver\",\n \"private\": true,\n \"license\": \"UNLICENSED\",\n \"dependencies\": {\n \"graphql\": \"^14.5.8\",\n \"graphql-tools\": \"^4.0.6\",\n \"vtex.is-api-middleware-graphql\": \"http://hiago--storecomponents.myvtex.com/_v/public/typings/v1/vtex.is-api-middleware-graphql@0.0.2/public\"\n },\n \"devDependencies\": {\n \"@types/atob\": \"^2.1.2\",\n \"@types/node\": \"^12.12.21\",\n \"@vtex/api\": \"6.45.12\",\n \"@vtex/prettier-config\": \"^0.1.3\",\n \"eslint\": \"^6.8.0\",\n \"eslint-config-vtex\": \"^12.2.1\",\n \"husky\": \"^4.2.0\",\n \"lint-staged\": \"^10.0.2\",\n \"prettier\": \"^1.19.1\",\n \"typescript\": \"3.9.7\"\n },\n \"version\": \"0.1.1\"\n}\n\n```" } ]
code_is-api-middleware-resolver_c7e68858
[ { "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 is-api-middleware-resolver/node/global.ts from the is-api-middleware-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ServiceContext } from '@vtex/api'\n\nimport { Clients } from './clients/index'\n\ndeclare global {\n type Context = ServiceContext<Clients>\n\n type SelectedFacet = {\n key: string\n value: string\n }\n\n type Operator = 'AND' | 'OR'\n\n type Options = {\n allowRedirect: boolean\n }\n\n type BoostAction = 'add' | 'remove' | 'promote' | 'demote'\n\n type BoostType =\n | 'term'\n | 'id'\n | 'skuId'\n | 'skuEan'\n | 'skuReference'\n | 'productLink'\n | 'product'\n | 'sku'\n | 'productId'\n | 'attribute'\n\n type DynamicRule = {\n action: BoostAction\n type: BoostType\n value: string\n }\n\n type SearchParams = {\n query?: string\n page?: string\n count?: string\n sort?: string\n operator?: string\n fuzzy?: string\n locale?: string\n allowRedirect?: boolean\n regionId?: string\n simulationBehavior?: 'skip' | 'only1P' | 'default' | null\n hideUnavailableItems?: boolean | null\n productOriginVtex?: string\n selectedFacets?: SelectedFacet[]\n dynamicRules?: DynamicRule[]\n searchState?: string\n }\n}\n\n```" } ]
code_is-api-middleware-resolver_0d09a8a3
[ { "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 is-api-middleware-resolver/node/index.ts from the is-api-middleware-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Service, RecorderState, ParamsContext } from '@vtex/api'\nimport schema from 'vtex.is-api-middleware-graphql/graphql'\n\nimport { Clients, clients } from './clients'\nimport before from './resolvers/before'\n\nexport default new Service<Clients, RecorderState, ParamsContext>({\n clients,\n graphql: {\n resolvers: {\n Query: {\n before,\n },\n },\n schema,\n },\n})\n\n```" } ]
code_is-api-middleware-resolver_891dde7d
[ { "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 is-api-middleware-resolver/node/clients/index.ts from the is-api-middleware-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ClientsConfig, IOClients } from '@vtex/api'\n\nconst MEDIUM_TIMEOUT_MS = 2 * 1000\n\nexport class Clients extends IOClients {\n // Add client example\n // public get myClient(): ClientType {\n // return this.getOrSet('myClient', ClientType)\n // }\n}\n\nexport const clients: ClientsConfig<Clients> = {\n implementation: Clients,\n options: {\n default: {\n retries: 2,\n timeout: MEDIUM_TIMEOUT_MS,\n },\n },\n}\n\n```" } ]
code_is-api-middleware-resolver_1dce9bf0
[ { "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 is-api-middleware-resolver/node/resolvers/before.ts from the is-api-middleware-resolver VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport default async function before(\n _: unknown,\n args: SearchParams,\n __: Context\n): Promise<SearchParams> {\n // This is just an example. Change the implementation of this function however you like :)\n\n if (args.query === 'shoes') {\n const myDynamicRules: DynamicRule[] = [\n {\n action: 'promote',\n type: 'id',\n value: '123',\n },\n ]\n\n return { ...args, dynamicRules: myDynamicRules }\n }\n\n return args\n}\n\n```" } ]
code_quickorder_ba69e46f
[ { "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 quickorder/messages/de.json from the quickorder VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/quickorder.ORD002\": \"Ungültiger Warenkorb\",\n \"store/quickorder.ORD003\": \"Kommunikationsfehler mit der Aktion\",\n \"store/quickorder.ORD004\": \"Negativer Gesamtbetrag\",\n \"store/quickorder.ORD005\": \"Kein Artikel im Warenkorb gefunden\",\n \"store/quickorder.ORD006\": \"Ungültiger Versand\",\n \"store/quickorder.ORD007\": \"Ungültiges Profil\",\n \"store/quickorder.ORD008\": \"Stornierte Bestellung\",\n \"store/quickorder.ORD009\": \"Ausreißerwerte\",\n \"store/quickorder.ORD011\": \"Produkt ohne SLA\",\n \"store/quickorder.ORD012\": \"Reservierung kann nicht vorgenommen werden\",\n \"store/quickorder.ORD013\": \"Produkt nicht verfügbar\",\n \"store/quickorder.ORD014\": \"Workflow-Fehler\",\n \"store/quickorder.ORD015\": \"Verkäuferfehler\",\n \"store/quickorder.ORD016\": \"Kommunikationsfehler\",\n \"store/quickorder.ORD017\": \"Aktionsfehler\",\n \"store/quickorder.ORD019\": \"Ungültiger Anhang\",\n \"store/quickorder.ORD020\": \"Ungültige Zahlung\",\n \"store/quickorder.ORD021\": \"Katalogfehler\",\n \"store/quickorder.ORD022\": \"Alte Warenkorb-Version\",\n \"store/quickorder.ORD023\": \"Nicht verfügbare Produkte\",\n \"store/quickorder.ORD024\": \"Präzisionspreis-Fehler\",\n \"store/quickorder.ORD025\": \"Fehlender obligatorischer Anhang\",\n \"store/quickorder.ORD026\": \"Fehler bei der Postleitzahl\",\n \"store/quickorder.ORD027\": \"Inaktives Produkt\",\n \"store/quickorder.ORD028\": \"Produkt nicht verfügbar\",\n \"store/quickorder.ORD029\": \"Versandfehler\",\n \"store/quickorder.ORD030\": \"Versandfehler\",\n \"store/quickorder.ORD031\": \"Versandfehler\",\n \"store/quickorder.addToCart\": \"In den Warenkorb legen\",\n \"store/quickorder.autocomplete.addButton\": \"Hinzufügen\",\n \"store/quickorder.autocomplete.placeholder\": \"Nach einem Produkt suchen...\",\n \"store/quickorder.autocomplete.selectSku\": \"Bitte wählen Sie eine SKU aus\",\n \"store/quickorder.autocomplete.multiplierOf\": \"Einheit Multiplikator von\",\n \"store/quickorder.available\": \"Verfügbar\",\n \"store/quickorder.back\": \"Zurück\",\n \"store/quickorder.cannotBeDelivered\": \"Kann nicht geliefert werden\",\n \"store/quickorder.inactive\": \"Nicht verfügbar\",\n \"store/quickorder.cannotGetSkuInfo\": \"Konnte die SKU-Informationen nicht abrufen\",\n \"store/quickorder.category.addButton\": \"Artikel zum Warenkorb hinzufügen\",\n \"store/quickorder.category.loading\": \"Wird geladen...\",\n \"store/quickorder.category.noneSelection\": \"Geben Sie eine Menge bei den Artikeln ein\",\n \"store/quickorder.category.multiplier\": \"Die Artikelmenge wurde auf das nächste Vielfache des Einheitsmultiplikators gerundet\",\n \"store/quickorder.invalidPattern\": \"Ungültiges Muster\",\n \"store/quickorder.review.label.content\": \"Inhalt\",\n \"store/quickorder.review.label.lineNumber\": \"#\",\n \"store/quickorder.review.label.quantity\": \"Menge\",\n \"store/quickorder.review.label.multiplier\": \"Einheit Multiplikator\",\n \"store/quickorder.review.label.totalQuantity\": \"Gesamtmenge\",\n \"store/quickorder.review.label.seller\": \"Verkäufer\",\n \"store/quickorder.review.label.sku\": \"SKU\",\n \"store/quickorder.review.label.status\": \"Status\",\n \"store/quickorder.review.label.emptyState\": \"Nichts anzuzeigen.\",\n \"store/quickorder.skuNotFound\": \"SKU nicht gefunden\",\n \"store/quickorder.upload.drop\": \"Hier können Sie Ihre XLS ablegen oder\",\n \"store/quickorder.upload.choose\": \"Eine Datei auswählen\",\n \"store/quickorder.valid\": \"Gültig\",\n \"store/quickorder.validate\": \"Validieren\",\n \"store/quickorder.withoutPriceFulfillment\": \"Produkt ohne Preis\",\n \"store/quickorder.withoutStock\": \"Ohne Lagerbestand\",\n \"store/quickorder.limited\": \"Eingeschränkter Artikel\",\n \"store/quickorder.partiallyAvailable\": \"Maximale Menge ist {quantity}. Insgesamt sind nur {totalQuantity} Einheiten verfügbar.\",\n \"store/toaster.cart.duplicated\": \"Element dupliziert\",\n \"store/toaster.cart.error\": \"Fehler beim Hinzufügen von Produkten zum Warenkorb\",\n \"store/toaster.cart.seeCart\": \"Warenkorb anzeigen\",\n \"store/toaster.cart.success\": \"Produkte erfolgreich zum Warenkorb hinzugefügt\"\n}\n\n```" } ]
code_quickorder_d29103ed
[ { "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 quickorder/messages/pt.json from the quickorder VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/quickorder.ORD002\": \"Carrinho inválido\",\n \"store/quickorder.ORD003\": \"Erro de comunicação com promoções\",\n \"store/quickorder.ORD004\": \"Total negativo\",\n \"store/quickorder.ORD005\": \"Nenhum no carrinho\",\n \"store/quickorder.ORD006\": \"Entrega inválida\",\n \"store/quickorder.ORD007\": \"Perfil inválido\",\n \"store/quickorder.ORD008\": \"Pedido cancelado\",\n \"store/quickorder.ORD009\": \"Valores incoerentes\",\n \"store/quickorder.ORD011\": \"Produto sem SLA\",\n \"store/quickorder.ORD012\": \"Reserva não pode ser efetuada\",\n \"store/quickorder.ORD013\": \"Produto indisponível\",\n \"store/quickorder.ORD014\": \"Erro de Workflow\",\n \"store/quickorder.ORD015\": \"Erro de vendedor\",\n \"store/quickorder.ORD016\": \"Erro de comunicação\",\n \"store/quickorder.ORD017\": \"Erro de promoção\",\n \"store/quickorder.ORD019\": \"Anexo inválido\",\n \"store/quickorder.ORD020\": \"Pagamento inválido\",\n \"store/quickorder.ORD021\": \"Erro no catálogo\",\n \"store/quickorder.ORD022\": \"Versão antiga do carrinho\",\n \"store/quickorder.ORD023\": \"Produtos indisponíveis\",\n \"store/quickorder.ORD024\": \"Erro de precisão no preço\",\n \"store/quickorder.ORD025\": \"Faltando anexo obrigatório\",\n \"store/quickorder.ORD026\": \"Erro de código postal\",\n \"store/quickorder.ORD027\": \"Produto inativo\",\n \"store/quickorder.ORD028\": \"Produto indisponível\",\n \"store/quickorder.ORD029\": \"Erro de entrega\",\n \"store/quickorder.ORD030\": \"Erro de entrega\",\n \"store/quickorder.ORD031\": \"Erro de entrega\",\n \"store/quickorder.addToCart\": \"Adicionar ao Carrinho\",\n \"store/quickorder.autocomplete.addButton\": \"Adicionar\",\n \"store/quickorder.autocomplete.placeholder\": \"Busque um produto...\",\n \"store/quickorder.autocomplete.selectSku\": \"Por favor, selecione um SKU\",\n \"store/quickorder.autocomplete.multiplierOf\": \"Multiplicador de Unidade de\",\n \"store/quickorder.available\": \"Disponível\",\n \"store/quickorder.back\": \"Voltar\",\n \"store/quickorder.cannotBeDelivered\": \"Não pode ser entregue\",\n \"store/quickorder.inactive\": \"Indisponível\",\n \"store/quickorder.cannotGetSkuInfo\": \"Não foi possível obter informações do SKU\",\n \"store/quickorder.category.addButton\": \"Adicionar itens ao carrinho\",\n \"store/quickorder.category.loading\": \"Carregando...\",\n \"store/quickorder.category.noneSelection\": \"Informe alguma quantidade nos items desejados\",\n \"store/quickorder.category.multiplier\": \"A quantidade do item foi arredondada para o múltiplo mais próximo do multiplicador de unidade\",\n \"store/quickorder.invalidPattern\": \"Formato inválido\",\n \"store/quickorder.review.label.content\": \"Conteúdo\",\n \"store/quickorder.review.label.lineNumber\": \"#\",\n \"store/quickorder.review.label.quantity\": \"Quantidade\",\n \"store/quickorder.review.label.multiplier\": \"Multiplicador de Unidade\",\n \"store/quickorder.review.label.totalQuantity\": \"Quantidade total\",\n \"store/quickorder.review.label.seller\": \"Seller\",\n \"store/quickorder.review.label.sku\": \"SKU\",\n \"store/quickorder.review.label.status\": \"Status\",\n \"store/quickorder.review.label.emptyState\": \"Nada a mostrar.\",\n \"store/quickorder.skuNotFound\": \"SKU não encontrado\",\n \"store/quickorder.upload.choose\": \"selecione o arquivo\",\n \"store/quickorder.upload.drop\": \"Arraste aqui seu arquivo XLS ou\",\n \"store/quickorder.valid\": \"Válido\",\n \"store/quickorder.validate\": \"Validar\",\n \"store/quickorder.withoutPriceFulfillment\": \"Produto sem preço\",\n \"store/quickorder.withoutStock\": \"Sem estoque\",\n \"store/quickorder.limited\": \"Restricted Item\",\n \"store/quickorder.partiallyAvailable\": \"A quantidade máxima é {quantity}. Existem apenas {totalQuantity} unidades disponíveis.\",\n \"store/toaster.cart.duplicated\": \"Item duplicado\",\n \"store/toaster.cart.error\": \"Erro adicionando produtos ao carrinho\",\n \"store/toaster.cart.seeCart\": \"Ver o carrinho\",\n \"store/toaster.cart.success\": \"Produtos adicionados com sucesso\"\n}\n\n```" } ]
code_quickorder_5392e2c2
[ { "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 quickorder/messages/en.json from the quickorder VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/quickorder.ORD002\": \"Invalid cart\",\n \"store/quickorder.ORD003\": \"Communication error with promotion\",\n \"store/quickorder.ORD004\": \"Negative total amount\",\n \"store/quickorder.ORD005\": \"None item found in the cart\",\n \"store/quickorder.ORD006\": \"Invalid shipping\",\n \"store/quickorder.ORD007\": \"Invalid profile\",\n \"store/quickorder.ORD008\": \"Canceled order\",\n \"store/quickorder.ORD009\": \"Outlier values\",\n \"store/quickorder.ORD011\": \"Product without SLA\",\n \"store/quickorder.ORD012\": \"Reservation cannot be done\",\n \"store/quickorder.ORD013\": \"Unavailable product\",\n \"store/quickorder.ORD014\": \"Workflow error\",\n \"store/quickorder.ORD015\": \"Seller error\",\n \"store/quickorder.ORD016\": \"Communication error\",\n \"store/quickorder.ORD017\": \"Promotion error\",\n \"store/quickorder.ORD019\": \"Invalid attachment\",\n \"store/quickorder.ORD020\": \"Invalid payment\",\n \"store/quickorder.ORD021\": \"Catalog error\",\n \"store/quickorder.ORD022\": \"Old cart version\",\n \"store/quickorder.ORD023\": \"Unavailable products\",\n \"store/quickorder.ORD024\": \"Precision price error\",\n \"store/quickorder.ORD025\": \"Missing mandatory attachment\",\n \"store/quickorder.ORD026\": \"Postal code error\",\n \"store/quickorder.ORD027\": \"Inactive product\",\n \"store/quickorder.ORD028\": \"Product unavailable\",\n \"store/quickorder.ORD029\": \"Shipping error\",\n \"store/quickorder.ORD030\": \"Shipping error\",\n \"store/quickorder.ORD031\": \"Shipping error\",\n \"store/quickorder.addToCart\": \"Add to Cart\",\n \"store/quickorder.autocomplete.addButton\": \"Add\",\n \"store/quickorder.autocomplete.placeholder\": \"Search for a product...\",\n \"store/quickorder.autocomplete.selectSku\": \"Please select one SKU\",\n \"store/quickorder.autocomplete.multiplierOf\": \"Unit Multiplier of\",\n \"store/quickorder.available\": \"Available\",\n \"store/quickorder.back\": \"Back\",\n \"store/quickorder.cannotBeDelivered\": \"Cannot be delivered\",\n \"store/quickorder.inactive\": \"Unavailable\",\n \"store/quickorder.cannotGetSkuInfo\": \"Could not get SKU information\",\n \"store/quickorder.category.addButton\": \"Add items to Cart\",\n \"store/quickorder.category.loading\": \"Loading...\",\n \"store/quickorder.category.noneSelection\": \"Enter some quantity on the items\",\n \"store/quickorder.category.multiplier\": \"The item quantity has been rounded to the closest multiple of the unit multiplier\",\n \"store/quickorder.invalidPattern\": \"Invalid pattern\",\n \"store/quickorder.review.label.content\": \"Content\",\n \"store/quickorder.review.label.lineNumber\": \"#\",\n \"store/quickorder.review.label.quantity\": \"Quantity\",\n \"store/quickorder.review.label.multiplier\": \"Unit Multiplier\",\n \"store/quickorder.review.label.totalQuantity\": \"Total Quantity\",\n \"store/quickorder.review.label.seller\": \"Seller\",\n \"store/quickorder.review.label.sku\": \"SKU\",\n \"store/quickorder.review.label.status\": \"Status\",\n \"store/quickorder.review.label.emptyState\": \"Nothing to show.\",\n \"store/quickorder.skuNotFound\": \"SKU Not Found\",\n \"store/quickorder.upload.choose\": \"choose a file\",\n \"store/quickorder.upload.drop\": \"Drop here your XLS or\",\n \"store/quickorder.valid\": \"Valid\",\n \"store/quickorder.validate\": \"Validate\",\n \"store/quickorder.withoutPriceFulfillment\": \"Product without price\",\n \"store/quickorder.withoutStock\": \"Without stock\",\n \"store/quickorder.limited\": \"Restricted Item\",\n \"store/quickorder.partiallyAvailable\": \"Max quantity is {quantity}. Only {totalQuantity} total units available.\",\n \"store/toaster.cart.duplicated\": \"Item duplicated\",\n \"store/toaster.cart.error\": \"Error adding products to the cart\",\n \"store/toaster.cart.seeCart\": \"See cart\",\n \"store/toaster.cart.success\": \"Products successfuly added to the cart\"\n}\n\n```" } ]
code_quickorder_0867f1b5
[ { "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 quickorder/messages/ro.json from the quickorder VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/quickorder.ORD002\": \"Coș nevalid\",\n \"store/quickorder.ORD003\": \"Eroare de comunicare la promovare\",\n \"store/quickorder.ORD004\": \"Suma totală negativă\",\n \"store/quickorder.ORD005\": \"Niciun articol găsit în coș\",\n \"store/quickorder.ORD006\": \"Expediere nevalidă\",\n \"store/quickorder.ORD007\": \"Profil nevalid\",\n \"store/quickorder.ORD008\": \"Comandă anulată\",\n \"store/quickorder.ORD009\": \"Valori anterioare\",\n \"store/quickorder.ORD011\": \"Produs fără SLA\",\n \"store/quickorder.ORD012\": \"Rezervarea nu poate fi făcută\",\n \"store/quickorder.ORD013\": \"Produs indisponibil\",\n \"store/quickorder.ORD014\": \"Eroare flux de lucru\",\n \"store/quickorder.ORD015\": \"Eroare vânzător\",\n \"store/quickorder.ORD016\": \"Eroare de comunicare\",\n \"store/quickorder.ORD017\": \"Eroare la promoție\",\n \"store/quickorder.ORD019\": \"Atașament nevalid\",\n \"store/quickorder.ORD020\": \"Plată nevalidă\",\n \"store/quickorder.ORD021\": \"Eroare de catalog\",\n \"store/quickorder.ORD022\": \"Versiunea de coș veche\",\n \"store/quickorder.ORD023\": \"Produse indisponibile\",\n \"store/quickorder.ORD024\": \"Eroare de preț de precizie\",\n \"store/quickorder.ORD025\": \"Lipsește atașamentul obligatoriu\",\n \"store/quickorder.ORD026\": \"Eroare cod poștal\",\n \"store/quickorder.ORD027\": \"Produs inactiv\",\n \"store/quickorder.ORD028\": \"Produsul nu este disponibil\",\n \"store/quickorder.ORD029\": \"Eroare de expediere\",\n \"store/quickorder.ORD030\": \"Eroare de expediere\",\n \"store/quickorder.ORD031\": \"Eroare de expediere\",\n \"store/quickorder.addToCart\": \"Adauga in Cos\",\n \"store/quickorder.autocomplete.addButton\": \"Adauga\",\n \"store/quickorder.autocomplete.placeholder\": \"Căutați un produs...\",\n \"store/quickorder.autocomplete.selectSku\": \"Selecteaza un SKU\",\n \"store/quickorder.autocomplete.multiplierOf\": \"Multiplicator unitar al\",\n \"store/quickorder.available\": \"Disponibil\",\n \"store/quickorder.back\": \"Inapoi\",\n \"store/quickorder.cannotBeDelivered\": \"Nu poate fi livrat\",\n \"store/quickorder.inactive\": \"Indisponibil\",\n \"store/quickorder.cannotGetSkuInfo\": \"Nu s-au primit informațiile SKU\",\n \"store/quickorder.category.addButton\": \"Adauga articole in carucior\",\n \"store/quickorder.category.loading\": \"Se incarca...\",\n \"store/quickorder.category.noneSelection\": \"Introduceti cantitati\",\n \"store/quickorder.category.multiplier\": \"Cantitatea articolului a fost rotunjită la cel mai apropiat multiplu al multiplicatorului unității\",\n \"store/quickorder.invalidPattern\": \"Pattern Invalid\",\n \"store/quickorder.review.label.content\": \"Continut\",\n \"store/quickorder.review.label.lineNumber\": \"#\",\n \"store/quickorder.review.label.quantity\": \"Cantitate\",\n \"store/quickorder.review.label.multiplier\": \"Multiplicator unitar\",\n \"store/quickorder.review.label.totalQuantity\": \"Cantitate totală\",\n \"store/quickorder.review.label.seller\": \"Vanzator\",\n \"store/quickorder.review.label.sku\": \"SKU\",\n \"store/quickorder.review.label.status\": \"Stare\",\n \"store/quickorder.review.label.emptyState\": \"Nimic de afișat.\",\n \"store/quickorder.skuNotFound\": \"SKU negasit\",\n \"store/quickorder.upload.choose\": \"alege fisier\",\n \"store/quickorder.upload.drop\": \"Incarca aici XLS or\",\n \"store/quickorder.valid\": \"Valid\",\n \"store/quickorder.validate\": \"Validare\",\n \"store/quickorder.withoutPriceFulfillment\": \"Produs fără preț\",\n \"store/quickorder.withoutStock\": \"Fără stoc\",\n \"store/quickorder.limited\": \"Restricted Item\",\n \"store/quickorder.partiallyAvailable\": \"Cantitatea maximă este {quantity}. Sunt disponibile doar {totalQuantity} unități în total.\",\n \"store/toaster.cart.duplicated\": \"Articol duplicat\",\n \"store/toaster.cart.error\": \"Eroare la adaugarea produselor in cos\",\n \"store/toaster.cart.seeCart\": \"Vezi cos\",\n \"store/toaster.cart.success\": \"Produse adaugate in cos\"\n}\n\n```" } ]
code_quickorder_80668244
[ { "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 quickorder/messages/context.json from the quickorder VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store/quickorder.ORD002\": \"store/quickorder.ORD002\",\n \"store/quickorder.ORD003\": \"store/quickorder.ORD003\",\n \"store/quickorder.ORD004\": \"store/quickorder.ORD004\",\n \"store/quickorder.ORD005\": \"store/quickorder.ORD005\",\n \"store/quickorder.ORD006\": \"store/quickorder.ORD006\",\n \"store/quickorder.ORD007\": \"store/quickorder.ORD007\",\n \"store/quickorder.ORD008\": \"store/quickorder.ORD008\",\n \"store/quickorder.ORD009\": \"store/quickorder.ORD009\",\n \"store/quickorder.ORD011\": \"store/quickorder.ORD011\",\n \"store/quickorder.ORD012\": \"store/quickorder.ORD012\",\n \"store/quickorder.ORD013\": \"store/quickorder.ORD013\",\n \"store/quickorder.ORD014\": \"store/quickorder.ORD014\",\n \"store/quickorder.ORD015\": \"store/quickorder.ORD014\",\n \"store/quickorder.ORD016\": \"store/quickorder.ORD016\",\n \"store/quickorder.ORD017\": \"store/quickorder.ORD017\",\n \"store/quickorder.ORD019\": \"store/quickorder.ORD019\",\n \"store/quickorder.ORD020\": \"store/quickorder.ORD020\",\n \"store/quickorder.ORD021\": \"store/quickorder.ORD021\",\n \"store/quickorder.ORD022\": \"store/quickorder.ORD022\",\n \"store/quickorder.ORD023\": \"store/quickorder.ORD023\",\n \"store/quickorder.ORD024\": \"store/quickorder.ORD024\",\n \"store/quickorder.ORD025\": \"store/quickorder.ORD025\",\n \"store/quickorder.ORD026\": \"store/quickorder.ORD026\",\n \"store/quickorder.ORD027\": \"store/quickorder.ORD027\",\n \"store/quickorder.ORD028\": \"store/quickorder.ORD028\",\n \"store/quickorder.ORD029\": \"store/quickorder.ORD029\",\n \"store/quickorder.ORD030\": \"store/quickorder.ORD030\",\n \"store/quickorder.ORD031\": \"store/quickorder.ORD031\",\n \"store/quickorder.addToCart\": \"store/quickorder.addToCart\",\n \"store/quickorder.autocomplete.addButton\": \"store/quickorder.autocomplete.addButton\",\n \"store/quickorder.autocomplete.placeholder\": \"store/quickorder.autocomplete.placeholder\",\n \"store/quickorder.autocomplete.selectSku\": \"store/quickorder.autocomplete.selectSku\",\n \"store/quickorder.autocomplete.multiplierOf\": \"store/quickorder.autocomplete.multiplierOf\",\n \"store/quickorder.available\": \"store/quickorder.available\",\n \"store/quickorder.back\": \"store/quickorder.back\",\n \"store/quickorder.cannotBeDelivered\": \"store/quickorder.cannotBeDelivered\",\n \"store/quickorder.inactive\": \"store/quickorder.inactive\",\n \"store/quickorder.cannotGetSkuInfo\": \"store/quickorder.cannotGetSkuInfo\",\n \"store/quickorder.category.addButton\": \"store/quickorder.category.addButton\",\n \"store/quickorder.category.loading\": \"store/quickorder.category.loading\",\n \"store/quickorder.category.noneSelection\": \"store/quickorder.category.noneSelection\",\n \"store/quickorder.category.multiplier\": \"store/quickorder.category.multiplier\",\n \"store/quickorder.invalidPattern\": \"store/quickorder.invalidPattern\",\n \"store/quickorder.review.label.content\": \"store/quickorder.review.label.content\",\n \"store/quickorder.review.label.lineNumber\": \"store/quickorder.review.label.lineNumber\",\n \"store/quickorder.review.label.quantity\": \"store/quickorder.review.label.quantity\",\n \"store/quickorder.review.label.multiplier\": \"store/quickorder.review.label.multiplier\",\n \"store/quickorder.review.label.totalQuantity\": \"store/quickorder.review.label.totalQuantity\",\n \"store/quickorder.review.label.seller\": \"store/quickorder.review.label.seller\",\n \"store/quickorder.review.label.sku\": \"store/quickorder.review.label.sku\",\n \"store/quickorder.review.label.status\": \"store/quickorder.review.label.status\",\n \"store/quickorder.review.label.emptyState\": \"store/quickorder.review.label.emptyState\",\n \"store/quickorder.skuNotFound\": \"store/quickorder.skuNotFound\",\n \"store/quickorder.upload.choose\": \"store/quickorder.upload.choose\",\n \"store/quickorder.upload.drop\": \"store/quickorder.upload.drop\",\n \"store/quickorder.valid\": \"store/quickorder.valid\",\n \"store/quickorder.validate\": \"store/quickorder.validate\",\n \"store/quickorder.withoutPriceFulfillment\": \"store/quickorder.withoutPriceFulfillment\",\n \"store/quickorder.withoutStock\": \"store/quickorder.withoutStock\",\n \"store/quickorder.limited\": \"store/quickorder.limited\",\n \"store/quickorder.partiallyAvailable\": \"store/quickorder.partiallyAvailable\",\n \"store/toaster.cart.duplicated\": \"store/toaster.cart.duplicated\",\n \"store/toaster.cart.error\": \"store/toaster.cart.error\",\n \"store/toaster.cart.seeCart\": \"store/toaster.cart.seeCart\",\n \"store/toaster.cart.success\": \"store/toaster.cart.success\"\n}\n\n```" } ]