id
stringlengths
12
53
messages
listlengths
3
3
code_iodas-bookstore-theme_97b3b41b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of iodas-bookstore-theme/store/blocks/header/main-menu.json from the iodas-bookstore-theme VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"menu#header-main2\": {\n \"children\": [\n \"menu-item#livros\",\n \"menu-item#papelaria\",\n \"menu-item#ebooks\",\n \"menu-item#eletronicos\",\n \"menu-item#blog\",\n \"menu-item#black-friday\"\n ]\n },\n \"menu-item#livros\": {\n \"blocks\": [\n \"submenu#livros\"\n ],\n \"props\": {\n \"id\": \"menu-item-livros\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/books/d\",\n \"noFollow\": false,\n \"tagTitle\": \"Livros\",\n \"text\": \"Livros\"\n }\n }\n },\n \"submenu#livros\": {\n \"children\": [\n \"flex-layout.row#submenu-livros\"\n ],\n \"props\": {\n \"width\": \"auto\"\n }\n },\n \"flex-layout.row#submenu-livros\": {\n \"children\": [\n \"flex-layout.col#submenu-menu-livros\",\n \"flex-layout.col#submenu-image-livros\"\n ]\n },\n \"flex-layout.col#submenu-menu-livros\": {\n \"children\": [\n \"menu#sub-livros-mobile\"\n ]\n },\n \"flex-layout.col#submenu-image-livros\": {\n \"children\": [\n \"image#submenu-image-livros\"\n ],\n \"props\": {\n \"horizontalAlign\": \"right\"\n }\n },\n \"image#submenu-image-livros\": {\n \"props\": {\n \"maxWidth\": \"300px\",\n \"src\": \"https://i.pinimg.com/originals/2c/fc/93/2cfc93d7665f5d7728782700e50596e3.png\"\n }\n },\n\n \"submenu#papelaria\": {\n \"children\": [\n \"flex-layout.row#submenu-papelaria\"\n ]\n },\n \"flex-layout.row#submenu-papelaria\": {\n \"children\": [\n \"flex-layout.col#submenu-menu-papelaria\",\n \"flex-layout.col#submenu-image-papelaria\"\n ]\n },\n \"flex-layout.col#submenu-menu-papelaria\": {\n \"children\": [\n \"menu#sub-papelaria-mobile\"\n ]\n },\n \"flex-layout.col#submenu-image-papelaria\": {\n \"children\": [\n \"image#submenu-image-papelaria\"\n ],\n \"props\": {\n \"horizontalAlign\": \"right\"\n }\n },\n \"image#submenu-image-papelaria\": {\n \"props\": {\n \"maxWidth\": \"300px\",\n \"src\": \"https://uploaddeimagens.com.br/images/002/472/310/full/papelaria.png?1572621942\"\n }\n },\n\n \"submenu#ebooks\": {\n \"children\": [\n \"flex-layout.row#submenu-ebooks\"\n ]\n },\n \"flex-layout.row#submenu-ebooks\": {\n \"children\": [\n \"flex-layout.col#submenu-menu-ebooks\",\n \"flex-layout.col#submenu-image-ebooks\"\n ]\n },\n \"flex-layout.col#submenu-menu-ebooks\": {\n \"children\": [\n \"menu#sub-ebooks-mobile\"\n ]\n },\n \"flex-layout.col#submenu-image-ebooks\": {\n \"children\": [\n \"image#submenu-image-ebooks\"\n ],\n \"props\": {\n \"horizontalAlign\": \"right\"\n }\n },\n \"image#submenu-image-ebooks\": {\n \"props\": {\n \"maxWidth\": \"300px\",\n \"src\": \"https://uploaddeimagens.com.br/images/002/472/318/full/ebook.png?1572622144\"\n }\n },\n\n \"submenu#eletronicos\": {\n \"children\": [\n \"flex-layout.row#submenu-eletronicos\"\n ]\n },\n \"flex-layout.row#submenu-eletronicos\": {\n \"children\": [\n \"flex-layout.col#submenu-menu-eletronicos\",\n \"flex-layout.col#submenu-image-eletronicos\"\n ]\n },\n \"flex-layout.col#submenu-menu-eletronicos\": {\n \"children\": [\n \"menu#sub-eletronicos-mobile\"\n ]\n },\n \"flex-layout.col#submenu-image-eletronicos\": {\n \"children\": [\n \"image#submenu-image-eletronicos\"\n ],\n \"props\": {\n \"horizontalAlign\": \"right\"\n }\n },\n \"image#submenu-image-eletronicos\": {\n \"props\": {\n \"maxWidth\": \"300px\",\n \"src\": \"https://uploaddeimagens.com.br/images/002/472/347/original/icon_game_video.png?1572622753\"\n }\n },\n\n \"menu#livros-categorias\": {\n \"props\": {\n \"orientation\": \"vertical\"\n }\n },\n \"menu-item#papelaria\": {\n \"blocks\": [\n \"submenu#papelaria\"\n ],\n \"props\": {\n \"id\": \"menu-item-papelaria\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/office-supplies/d\",\n \"noFollow\": false,\n \"tagTitle\": \"Papelaria\",\n \"text\": \"Papelaria\"\n }\n }\n },\n \"menu-item#ebooks\": {\n \"blocks\": [\n \"submenu#ebooks\"\n ],\n \"props\": {\n \"id\": \"menu-item-ebooks\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/ebooks/d\",\n \"noFollow\": false,\n \"tagTitle\": \"Ebooks\",\n \"text\": \"Ebooks\"\n }\n }\n },\n \"menu-item#eletronicos\": {\n \"blocks\": [\n \"submenu#eletronicos\"\n ],\n \"props\": {\n \"id\": \"menu-item-eletronicos\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/notebooks---pens/d\",\n \"noFollow\": false,\n \"tagTitle\": \"Eletrônicos\",\n \"text\": \"Eletrônicos\"\n }\n }\n },\n \"menu-item#blog\": {\n \"props\": {\n \"id\": \"menu-item-blog\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/blog\",\n \"noFollow\": false,\n \"tagTitle\": \"Blog\",\n \"text\": \"Blog\"\n }\n }\n },\n \"menu-item#black-friday\": {\n \"props\": {\n \"id\": \"menu-item-black-friday\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/blackfriday\",\n \"noFollow\": false,\n \"tagTitle\": \"Black Friday\",\n \"text\": \"Black Friday\"\n }\n }\n }\n}\n\n```" } ]
code_iodas-bookstore-theme_47ed77e4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of iodas-bookstore-theme/store/blocks/header/top-menu.json from the iodas-bookstore-theme VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"vtex.menu@2.x:menu#websites\": {\n \"children\": [\n \"menu-item#shop\",\n \"menu-item#about-us\"\n ]\n },\n \"menu-item#shop\": {\n \"props\": {\n \"id\": \"menu-item-shop\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"Shop\",\n \"text\": \"Shop\"\n }\n }\n },\n \"menu-item#about-us\": {\n \"props\": {\n \"id\": \"menu-item-about-us\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/about-us\",\n \"noFollow\": false,\n \"tagTitle\": \"about-us\",\n \"text\": \"About Us\"\n }\n }\n },\n \"vtex.menu@2.x:menu#institutional\": {\n \"children\": [\n \"menu-item#vtex-website\"\n ]\n },\n \"menu-item#vtex-website\": {\n \"props\": {\n \"id\": \"menu-item-vtex-website\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"external\",\n \"href\": \"http://vtex.com\",\n \"noFollow\": false,\n \"tagTitle\": \"visit vtex.com\",\n \"text\": \"visit vtex.com\"\n }\n }\n }\n}\n\n```" } ]
code_iodas-bookstore-theme_4af8149f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of iodas-bookstore-theme/store/blocks/search-result/search.jsonc from the iodas-bookstore-theme VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"store.search\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"store.search#brand\": {\n \"blocks\": [\"search-result-layout\"],\n \"props\": {\n \"context\": {\n \"orderByField\": \"OrderByReleaseDateDESC\",\n \"hideUnavailableItems\": true,\n \"maxItemsPerPage\": 10\n }\n }\n },\n\n \"search-result-layout\": {\n \"blocks\": [\n \"search-result-layout.desktop\",\n \"search-result-layout.mobile\",\n \"search-not-found-layout\"\n ]\n },\n\n \"search-result-layout.desktop\": {\n \"children\": [\n \"flex-layout.row#searchbread\",\n \"flex-layout.row#searchtitle\",\n \"flex-layout.row#result\"\n ],\n \"props\": {\n \"pagination\": \"show-more\",\n \"mobileLayout\": {\n \"mode1\": \"small\",\n \"mode2\": \"normal\"\n }\n }\n },\n \"flex-layout.row#searchbread\": {\n \"children\": [\"breadcrumb.search\"],\n \"props\": {\n \"preserveLayoutOnMobile\": true,\n \"fullWidth\": true\n }\n },\n \"flex-layout.row#searchtitle\": {\n \"children\": [\"search-title.v2\"]\n },\n \"flex-layout.row#result\": {\n \"children\": [\"flex-layout.col#filter\", \"flex-layout.col#content\"],\n \"props\": {\n \"preventHorizontalStretch\": true,\n \"fullWidth\": true\n }\n },\n \"flex-layout.col#filter\": {\n \"children\": [\"filter-navigator.v3\"],\n \"props\": {\n \"blockClass\": \"filterCol\"\n }\n },\n \"flex-layout.col#content\": {\n \"children\": [\n \"flex-layout.row#searchinfo\",\n \"flex-layout.row#fetchprevious\",\n \"flex-layout.row#products\",\n \"flex-layout.row#fetchmore\"\n ],\n \"props\": {\n \"width\": \"grow\"\n }\n },\n \"flex-layout.row#searchinfo\": {\n \"children\": [\"flex-layout.col#productCount\", \"flex-layout.col#orderby\"]\n },\n \"flex-layout.col#productCount\": {\n \"children\": [\"total-products.v2\"],\n \"props\": {\n \"blockClass\": \"productCountCol\"\n }\n },\n \"flex-layout.col#orderby\": {\n \"children\": [\"order-by.v2\"],\n \"props\": {\n \"blockClass\": \"orderByCol\"\n }\n },\n \"flex-layout.row#fetchprevious\": {\n \"props\": {\n \"marginBottom\": 3\n },\n \"children\": [\"search-fetch-previous\"]\n },\n \"flex-layout.row#fetchmore\": {\n \"props\": {\n \"marginTop\": 3\n },\n \"children\": [\"search-fetch-more\"]\n },\n \"flex-layout.row#products\": {\n \"children\": [\"search-content\"]\n },\n \"search-content\": {\n \"blocks\": [\"gallery\", \"not-found\"]\n },\n\n \"search-result-layout.mobile\": {\n \"children\": [\n \"flex-layout.row#searchinfomobile\",\n \"flex-layout.row#searchbread\",\n \"flex-layout.row#productCountMobile\",\n \"flex-layout.row#contentmobile\"\n ],\n \"props\": {\n \"pagination\": \"show-more\",\n \"mobileLayout\": {\n \"mode1\": \"small\",\n \"mode2\": \"normal\"\n }\n }\n },\n \"flex-layout.row#contentmobile\": {\n \"children\": [\"search-content\"],\n \"props\": {\n \"preserveLayoutOnMobile\": true\n }\n },\n\n \"flex-layout.row#searchinfomobile\": {\n \"children\": [\n \"flex-layout.col#orderByMobile\",\n \"flex-layout.col#filterMobile\",\n \"flex-layout.col#switcherMobile\"\n ],\n \"props\": {\n \"preserveLayoutOnMobile\": true,\n \"colSizing\": \"auto\",\n \"colJustify\": \"around\"\n }\n },\n\n \"flex-layout.col#orderByMobile\": {\n \"children\": [\"order-by.v2\"],\n \"props\": {\n \"blockClass\": \"orderByMobileCol\"\n }\n },\n\n \"flex-layout.row#productCountMobile\": {\n \"children\": [\"total-products.v2\"],\n \"props\": {\n \"blockClass\": \"productCountMobileRow\"\n }\n },\n\n \"flex-layout.col#filterMobile\": {\n \"children\": [\"filter-navigator.v3\"],\n \"props\": {\n \"blockClass\": \"filterMobileCol\"\n }\n },\n \"flex-layout.col#switcherMobile\": {\n \"children\": [\"search-layout-switcher\"],\n \"props\": {\n \"blockClass\": \"switcherMobileCol\"\n }\n },\n \"search-not-found-layout\": {\n \"children\": [\"flex-layout.row#searchbread\", \"flex-layout.row#notfound\"]\n },\n\n \"flex-layout.row#notfound\": {\n \"children\": [\"not-found\"],\n \"props\": {\n \"fullWidth\": true\n }\n },\n\n \"breadcrumb\": {\n \"props\": {\n \"showOnMobile\": true\n }\n },\n\n \"gallery\": {\n \"blocks\": [\"product-summary.shelf\"]\n },\n\n \"carousel#store-search\": {\n \"props\": {\n \"autoplaySpeed\": 5,\n \"autoplay\": true,\n \"banners\": [\n {\n \"image\": \"https://files.slack.com/files-pri/T02BCPD0X-FPPLM59QS/banner_departamento_livro.png\"\n }\n ],\n \"height\": 480,\n \"showArrows\": false,\n \"showDots\": false\n }\n }\n}\n\n```" } ]
code_kelkoo_0e1b1492
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of kelkoo/docs/README.md from the kelkoo VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/CHANGEME) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Kelkoo app\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nKelkoo first party app\n\n## Configuration\n\nIt is possible to install in your store either by using App Store or the VTEX IO Toolbelt.\n\n### Using VTEX App Store\n\n1. Access the **Apps** section in your account's admin page and look for the Kelkoo box;\n2. Then, click on the **Install** button;\n3. You'll see a warning message about needing to enter the necessary configurations. Scroll down and type in your Kelkoo Shop ID and Kelkoo product country identifier in the `Kelkoo` field.\n4. Click on **Save**.\n\n### Using VTEX IO Toolbelt\n\n1. [Install](https://vtex.io/docs/recipes/development/installing-an-app/) the `vtex.kelkoo@1.x` app. You can confirm that the app has now been installed by running `vtex ls` again. \n2. Access the **Apps** section in your account's admin page and look for the Kelkoo box. Once you find it, click on the box.\n3. Fill in the `Kelkoo` field with your Kelkoo Shop ID and Kelkoo product country identifier.\n4. Click on **Save**.\n\n<!-- DOCS-IGNORE:start -->\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n<!-- DOCS-IGNORE:end -->\n\n```" } ]
code_kelkoo_b5327db4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of kelkoo/react/index.tsx from the kelkoo VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { canUseDOM } from 'vtex.render-runtime'\n\nimport { PixelMessage } from './typings/events'\n\nexport function handleEvents(e: PixelMessage) {\n switch (e.data.eventName) {\n case 'vtex:orderPlaced': {\n const { transactionId: orderId, transactionTotal: orderValue } = e.data\n\n window._kkstrack = {\n ...window._kkstrack,\n orderValue: orderValue.toString(),\n orderId,\n }\n\n const s = document.createElement('script')\n\n s.type = 'text/javascript'\n s.async = true\n s.src = 'https://s.kk-resources.com/ks.js'\n\n // eslint-disable-next-line prefer-destructuring\n const x = document.getElementsByTagName('script')[0]\n\n x.parentNode?.insertBefore(s, x)\n\n break\n }\n\n default: {\n break\n }\n }\n}\n\nif (canUseDOM) {\n window.addEventListener('message', handleEvents)\n}\n\n```" } ]
code_kelkoo_027ae592
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of kelkoo/react/package.json from the kelkoo VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/graphql\": \"^14.5.0\",\n \"@types/jest\": \"^25.1.5\",\n \"@types/node\": \"^13.11.0\",\n \"@types/react\": \"^16.9.31\",\n \"@types/react-intl\": \"^3.0.0\",\n \"@vtex/test-tools\": \"^3.1.0\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"apollo-client\": \"^2.6.8\",\n \"graphql\": \"^14.5.4\",\n \"react-intl\": \"^3.11.0\",\n \"typescript\": \"3.8.3\"\n },\n \"version\": \"1.0.0\"\n}\n\n```" } ]
code_kelkoo_6a4d9f7e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of kelkoo/store/interfaces.json from the kelkoo VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"pixel.kelkoo\": {\n \"component\": \"index\"\n }\n}\n\n```" } ]
code_kelkoo_1947202b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of kelkoo/react/typings/events.d.ts from the kelkoo VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport interface PixelMessage extends MessageEvent {\n data:\n | ProductViewData\n | ProductClickData\n | OrderPlacedData\n | OrderPlacedTrackedData\n | PageViewData\n | ProductImpressionData\n | AddToCartData\n | RemoveToCartData\n | CartChangedData\n | HomePageInfo\n | ProductPageInfoData\n | SearchPageInfoData\n | UserData\n | CartIdData\n}\n\nexport interface EventData {\n event: string\n eventName: string\n currency: string\n}\n\nexport interface PageInfoData extends EventData {\n event: 'pageInfo'\n eventName: 'vtex:pageInfo'\n accountName: string\n pageTitle: string\n pageUrl: string\n}\n\nexport interface UserData extends PageInfoData {\n eventType: 'userData'\n eventName: 'vtex:userData'\n firstName?: string\n lastName?: string\n document?: string\n id?: string\n email?: string\n phone?: string\n isAuthenticated: boolean\n}\n\nexport interface CartIdData extends PageInfoData {\n eventType: 'cartId'\n eventName: 'vtex:cartId'\n cartId: string\n}\n\nexport interface HomePageInfo extends PageInfoData {\n eventType: 'homeView'\n}\n\nexport interface ProductPageInfoData extends PageInfoData {\n eventType: 'productPageInfo'\n}\n\nexport interface SearchPageInfoData extends PageInfoData {\n eventType:\n | 'internalSiteSearchView'\n | 'categoryView'\n | 'departmentView'\n | 'emptySearchView'\n category?: CategoryMetaData\n department?: DepartmentMetaData\n search?: SearchMetaData\n}\n\ninterface CategoryMetaData {\n id: string\n name: string\n}\n\ninterface DepartmentMetaData {\n id: string\n name: string\n}\n\ninterface SearchMetaData {\n term: string\n category: CategoryMetaData\n results: number\n}\n\nexport interface PageViewData extends EventData {\n event: 'pageView'\n eventName: 'vtex:pageView'\n pageTitle: string\n pageUrl: string\n referrer: string\n}\n\nexport interface AddToCartData extends EventData {\n event: 'addToCart'\n eventName: 'vtex:addToCart'\n items: CartItem[]\n}\n\nexport interface RemoveToCartData extends EventData {\n event: 'removeFromCart'\n eventName: 'vtex:removeFromCart'\n items: CartItem[]\n}\n\nexport interface CartChangedData extends EventData {\n event: 'cartChanged'\n eventName: 'vtex:cartChanged'\n items: CartItem[]\n}\n\nexport interface OrderPlacedData extends Order, EventData {\n event: 'orderPlaced'\n eventName: 'vtex:orderPlaced'\n}\n\nexport interface OrderPlacedTrackedData extends Order, EventData {\n event: 'orderPlacedTracked'\n eventName: 'vtex:orderPlacedTracked'\n}\n\nexport interface ProductViewData extends EventData {\n event: 'productView'\n eventName: 'vtex:productView'\n product: Product\n}\n\nexport interface ProductClickData extends EventData {\n event: 'productClick'\n eventName: 'vtex:productClick'\n product: ProductSummary\n}\n\nexport interface ProductImpressionData extends EventData {\n event: 'productImpression'\n eventName: 'vtex:productImpression'\n impressions: Impression[]\n product?: ProductSummary // deprecated, use impressions list!\n position?: number // deprecated, use impressions list!\n list: string\n}\n\nexport interface CartData extends EventData {\n event: 'cart'\n eventName: 'vtex:cart'\n orderForm: OrderForm\n}\n\ninterface CartItem {\n brand: string\n ean: string\n category: string\n detailUrl: string\n imageUrl: string\n name: string\n price: number\n productId: string\n productRefId: string\n quantity: number\n seller: string\n sellerName: string\n skuId: string\n variant: string\n}\n\nexport interface OrderForm {\n id: string\n items: CartItem[]\n}\n\nexport interface Order {\n accountName: string\n corporateName: string\n coupon: string\n currency: string\n openTextField: string\n orderGroup: string\n salesChannel: string\n visitorAddressCity: string\n visitorAddressComplement: string\n visitorAddressCountry: string\n visitorAddressNeighborhood: string\n visitorAddressNumber: string\n visitorAddressPostalCode: string\n visitorAddressState: string\n visitorAddressStreet: string\n visitorContactInfo: string[]\n visitorContactPhone: string\n visitorType: string\n transactionId: string\n transactionDate: string\n transactionAffiliation: string\n transactionTotal: number\n transactionShipping: number\n transactionSubtotal: number\n transactionDiscounts: number\n transactionTax: number\n transactionCurrency: string\n transactionPaymentType: PaymentType[]\n transactionShippingMethod: ShippingMethod[]\n transactionLatestShippingEstimate: Date\n transactionProducts: ProductOrder[]\n transactionPayment: {\n id: string\n }\n}\n\nexport interface Impression {\n product: ProductSummary\n position: number\n}\n\nexport interface PaymentType {\n group: string\n paymentSystemName: string\n installments: number\n value: number\n}\n\nexport interface ShippingMethod {\n itemId: string\n selectedSla: string\n}\n\nexport interface ProductOrder {\n id: string\n name: string\n sku: string\n skuRefId: string\n skuName: string\n productRefId: string\n ean: string\n slug: string\n brand: string\n brandId: string\n seller: string\n sellerId: string\n category: string\n categoryId: string\n categoryTree: string[]\n categoryIdTree: string[]\n priceTags: PriceTag[]\n originalPrice: number\n price: number\n sellingPrice: number\n tax: number\n quantity: number\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n components: any[]\n measurementUnit: string\n unitMultiplier: number\n}\n\nexport interface PriceTag {\n identifier: string\n isPercentual: boolean\n value: number\n}\n\nexport interface Product {\n brand: string\n brandId: string\n categories: string[]\n categoryId: string\n categoryTree: Array<{ id: string; name: string }>\n detailUrl: string\n items: Item[]\n linkText: string\n productId: string\n productName: string\n productReference: string\n selectedSku: Item\n}\n\nexport interface Item {\n itemId: string\n name: string\n ean: string\n referenceId: { Key: string; Value: string }\n imageUrl: string\n sellers: Seller[]\n}\n\nexport interface ProductSummary {\n brand: string\n brandId: string\n categories: string[]\n items: ItemSummary[]\n linkText: string\n productId: string\n productName: string\n productReference: string\n sku: ItemSummary\n}\n\ninterface ItemSummary {\n itemId: string\n ean: string\n name: string\n referenceId: { Key: string; Value: string }\n seller: Seller\n sellers: Seller[]\n}\n\nexport interface Seller {\n commertialOffer: CommertialOffer\n sellerId: string\n sellerName: string\n}\n\nexport interface CommertialOffer {\n Price: number\n ListPrice: number\n AvailableQuantity: number\n}\n\n```" } ]
code_kelkoo_fa8c16f0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of kelkoo/react/typings/vtex.render-runtime.d.ts from the kelkoo VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.render-runtime' {\n export const canUseDOM: boolean\n}\n\n```" } ]
code_kelkoo_002d8c33
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of kelkoo/react/typings/global.d.ts from the kelkoo VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface Window extends Window {\n _kkstrack: {\n merchantInfo: Array<{ country: string; merchantId: string }>\n orderValue: string\n orderId: string\n }\n}\n\n```" } ]
code_konduto-antifraud_73579af2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of konduto-antifraud/react/package.json from the konduto-antifraud VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"author\": \"VTEX\",\n \"license\": \"ISC\",\n \"devDependencies\": {\n \"@types/jest\": \"^24.0.12\",\n \"@types/node\": \"^12.0.0\",\n \"@types/react\": \"^16.8.16\",\n \"@types/react-intl\": \"^2.3.17\",\n \"@vtex/test-tools\": \"^0.3.2\",\n \"apollo-client\": \"^2.5.1\",\n \"eslint\": \"^5.16.0\",\n \"eslint-config-vtex\": \"^10.1.0\",\n \"prettier\": \"^1.17.1\",\n \"typescript\": \"3.5.2\"\n }\n}\n\n```" } ]
code_konduto-antifraud_37511f76
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of konduto-antifraud/react/index.ts from the konduto-antifraud VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { canUseDOM } from 'vtex.render-runtime'\nimport { PixelMessage } from './typings/events'\n\nfunction setKondutoFingerPrint(category_page: string) {\n var kdtFP = Konduto.getVisitorID()\n if (vtex) {\n vtex.deviceFingerprint = kdtFP\n Konduto.sendEvent('page', category_page)\n }\n}\n\nfunction handlePageEvent(eventType: string) {\n switch (eventType) {\n case 'homeView': {\n setKondutoFingerPrint('home')\n break\n }\n case 'productView': {\n setKondutoFingerPrint('product')\n break\n }\n case 'departmentView':\n case 'categoryView': {\n setKondutoFingerPrint('category')\n break\n }\n case 'accountView': {\n setKondutoFingerPrint('account')\n break\n }\n case 'internalSiteSearchView': {\n setKondutoFingerPrint('search')\n break\n }\n }\n}\n\nfunction handleAccountEvent(eventName: string) {\n switch (eventName) {\n case 'accountCreation': {\n setKondutoFingerPrint('account_creation')\n break\n }\n case 'passwordReset': {\n setKondutoFingerPrint('password_reset')\n break\n }\n }\n}\n\nexport function handleEvents(e: PixelMessage) {\n const {\n data: { eventName, eventType },\n } = e\n var period = 300\n var limit = 20 * 1e3\n var nTry = 0\n var intervalID = setInterval(function() {\n var clear = limit / period <= ++nTry\n if (typeof Konduto !== 'undefined' && Konduto.sendEvent) {\n handlePageEvent(eventType)\n handleAccountEvent(eventName)\n clear = true\n }\n if (clear) {\n clearInterval(intervalID)\n }\n }, period)\n}\n\nif (canUseDOM) window.addEventListener('message', handleEvents)\n\n```" } ]
code_konduto-antifraud_af015f32
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of konduto-antifraud/store/interfaces.json from the konduto-antifraud VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"pixel.konduto\": {\n \"component\": \"index\"\n }\n}\n\n```" } ]
code_konduto-antifraud_ed51a3d1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of konduto-antifraud/react/typings/events.d.ts from the konduto-antifraud VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport interface PixelMessage {\n data: EventData\n}\nexport interface EventData {\n event: string\n eventName: string\n eventType: string\n currency: string\n}\n\n```" } ]
code_konduto-antifraud_51d99a48
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of konduto-antifraud/react/typings/vtex.render-runtime.d.ts from the konduto-antifraud VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* Typings for `render-runtime` */\ndeclare module 'vtex.render-runtime' {\n export const canUseDOM: boolean\n}\n\n```" } ]
code_konduto-antifraud_fbe5767a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of konduto-antifraud/react/typings/global.d.ts from the konduto-antifraud VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* Typings for `Konduto` */\nexport interface Konduto {\n sendEvent: Function\n getVisitorID: Function\n}\nexport interface VTEX {\n deviceFingerprint: string\n}\n\ndeclare global {\n const Konduto: Konduto\n const vtex: VTEX\n}\n\n```" } ]
code_onesignal_6bd8dd54
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of onesignal/node/service.json from the onesignal 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 \"oneSignalSDKWorker\": {\n \"path\": \"/OneSignalSDKWorker.js\",\n \"public\": true\n },\n \"oneSignalSDKUpdaterWorker\": {\n \"path\": \"/OneSignalSDKUpdaterWorker.js\",\n \"public\": true\n }\n }\n}\n\n```" } ]
code_onesignal_f98f1a93
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of onesignal/node/package.json from the onesignal VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\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\": \"^0.27.12\",\n \"@vtex/api\": \"6.41.0\",\n \"@vtex/test-tools\": \"^3.0.0\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"typescript\": \"3.9.7\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty\"\n },\n \"version\": \"1.1.0\"\n}\n\n```" } ]
code_onesignal_18555edc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of onesignal/node/index.ts from the onesignal VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n ClientsConfig,\n LRUCache,\n method,\n Service,\n ServiceContext,\n Cached,\n} from '@vtex/api'\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, Cached>({ max: 5000 })\n\nmetrics.trackCache('status', memoryCache)\n\n// This is the configuration for clients available in `ctx.clients`.\nconst clients: ClientsConfig = {\n // We pass our custom implementation of the clients bag, containing the Status client.\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 oneSignalSDKWorker: {\n memoryCache,\n },\n oneSignalSDKUpdaterWorker: {\n memoryCache,\n },\n },\n}\n\nasync function worker(ctx: ServiceContext, next: () => Promise<unknown>) {\n ctx.status = 200\n ctx.set('content-type', 'application/javascript; charset=utf-8')\n ctx.set('cache-control', 'public, max-age=7200')\n ctx.body = `importScripts('https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js');`\n await next()\n}\n\n// Export a service that defines route handlers and client options.\nexport default new Service({\n clients,\n routes: {\n oneSignalSDKWorker: method({\n GET: [worker],\n }),\n oneSignalSDKUpdaterWorker: method({\n GET: [worker],\n }),\n },\n})\n\n```" } ]
code_onesignal_1cc44297
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of onesignal/service-workers/header.js from the onesignal VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nfunction oneSignalSWHeader() {\n // eslint-disable-next-line no-undef\n importScripts(`https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js`)\n}\n\nexport default oneSignalSWHeader\n\n```" } ]
code_overlay-layout_d8fb4603
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/docs/README.md from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/overlay-layout) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Overlay Layout\n\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\nThe Overlay Layout app provides blocks that help you create a Dropdown, Select or a Tooltip component.\n\n![overlay-layout](https://user-images.githubusercontent.com/52087100/78159134-881f2100-7418-11ea-94e1-d70343cd021f.gif)\n\n*Example of a [Locale Switcher](https://vtex.io/docs/components/all/vtex.locale-switcher@0.5.5) using the Overlay Layout*. \n\n## Configuration\n\n1. Add the Overlay Layout app to your theme's dependencies in the `manifest.json`, for example:\n\n```jsonc\n{\n \"dependencies\": {\n \"vtex.overlay-layout\": \"0.x\"\n }\n}\n```\n\nNow you can use the two blocks exported by the app: \n\nBlock name | Description |\n| --------------------| -------- |\n| `overlay-trigger` | ![https://img.shields.io/badge/-Mandatory-red](https://img.shields.io/badge/-Mandatory-red) Declares a renderable children block responsible for triggering the `overlay-layout` content. |\n| `overlay-layout` | ![https://img.shields.io/badge/-Mandatory-red](https://img.shields.io/badge/-Mandatory-red) Declares a renderable children block responsible for building the |\n\n2. In any desired theme template, add the `overlay-trigger` and then declare it using a block of your choosing and the `overlay-layout`:\n\n```jsonc\n{\n \"overlay-trigger\": {\n \"children\": [\n \"rich-text#question\",\n \"overlay-layout\" \n ]\n },\n```\n\n*Notice that the* `overlay-trigger` i*s not rendered. Following the example stated above, the* `rich-text` *block will be the one rendered and responsible for effectively triggering the Overlay Layout content (defined by the children block of* `overlay-layout`*).*\n\n### `overlay-trigger` props\n\n| Prop name | Type | Description | Default value |\n| --- | --- | --- | --- |\n| `trigger` | `Enum` | Defines whether the `popover-layout` will be opened by click (`click`) or hover (`hover`).| `click` |\n\n3. Configure the chosen trigger [block](https://vtex.io/docs/apps/all) and declare the `overlay-layout` using its props. For example:\n\n```jsonc\n \"rich-text#question\": {\n \"props\": {\n \"text\": \"**Click to open the Overlay Layout**\",\n \"blockClass\": \"question\"\n }\n },\n \"overlay-layout\": {\n \"props\": {\n \"placement\": \"left\"\n },\n \"children\": [\n \"rich-text#link\"\n ]\n },\n \"rich-text#link\": {\n \"props\": {\n \"text\": \"\\n**Reach us at**\\nwww.vtex.com.br\",\n \"blockClass\": \"link\"\n }\n }\n}\n```\n\n*The* `overlay-layout` *defines which block will be rendered in order to build the Overlay Layout content. This means that you will have to pass to it a children block to be rendered.* \n\n### `overlay-layout` props\n\n| Prop name | Type | Description | Default value |\n| --- | --- | --- | --- |\n| `placement` | `Enum` | Defines the Overlay Layout content placement when it is triggered according to the Trigger component positioning. Possible values are: `bottom`, `left`, `right` or `top`. If there is no page space in the placement that you choose, it will fit in a fallback position. | `bottom` |\n| `scrollBehavior` | `Enum` | Defines the Overlay Layout content behavior when users try to scroll the page. Possible values are: `lock-page-scroll` (in which users can't scroll), `close-on-scroll` (the block is closed when users start scrolling) or `default` (Scroll does not affect the Overlay Layout content). | `default` |\n| `backdrop` | `Enum` | Once the Overlay Layout content is rendered, it defines whether a backdrop overlay will be displayed (`visible`) or not (`none`). When set as `visible`, the backdrop will close Overlay Layout content when clicked on. Otherwise, the content will be closed only if any component from the page is clicked on. | `none` |\n| `showArrow` | `Boolean` | Whether an arrow pointing to the `overlay-trigger` component should be displayed on UI(`true`) or not (`false`). | `false` |\n| `offsets` | `Object` | Defines the `overlay-layout` component positioning when compared to the `overlay-trigger` (unit used is `px`). For more details, check out the `offsets` object table stated below. | `{ skidding: 0, distance: 0 }` |\n\n- **`offsets` object:**\n\n| Prop | Type | Description |\n| --- | --- | --- |\n| `skidding` | `Number` | Defines the `overlay-layout` component positioning side by side with the `overlay-trigger`. |\n| `distance` | `Number` | Defines the distance between the `overlay-layout` and the `overlay-trigger` components in the UI. A positive number places the `overlay-layout` component farther, while a negative number lets it overlap the `overlay-trigger`. |\n\n## Customization\n\nIn order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://vtex.io/docs/recipes/style/using-css-handles-for-store-customization).\n\n| CSS Handles |\n| --- |\n| `arrow` |\n| `container` |\n| `outsideClickHandler` |\n| `paper` |\n| `popper` |\n| `popperArrow` |\n| `trigger` |\n\n## Contributors ✨\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n\n\n```" } ]
code_overlay-layout_633cb1de
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/styles.css from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.backdropContainer {\n top: 0;\n left: 0;\n z-index: -1;\n width: 300vw;\n height: 300vh;\n position: fixed;\n touch-action: none;\n transform: translate(-100vw, -100vh);\n}\n\n.backdrop {\n opacity: 0.5;\n height: 100%;\n}\n\n.dropdown {\n z-index: 900;\n}\n\n.arrow {\n border-width: 1em;\n border-style: solid;\n position: absolute;\n box-sizing: border-box;\n font-size: 10px;\n}\n\n.popperArrow[data-popper-placement=\"bottom\"] .arrow {\n border-color: transparent transparent currentColor transparent;\n top: -1.7em;\n}\n\n.popperArrow[data-popper-placement=\"top\"] .arrow {\n border-color: currentColor transparent transparent transparent;\n bottom: -1.7em;\n}\n\n.popperArrow[data-popper-placement=\"right\"] .arrow {\n border-color: transparent currentColor transparent transparent;\n left: -1.7em;\n}\n\n.popperArrow[data-popper-placement=\"left\"] .arrow {\n border-color: transparent transparent transparent currentColor;\n right: -1.7em;\n}\n\n```" } ]
code_overlay-layout_71111682
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/OverlayContext.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { createContext, useReducer, useContext } from 'react'\n\nimport { TriggerMode } from './OverlayTrigger'\n\ninterface State {\n open: boolean\n containerRef?: React.RefObject<HTMLElement> | null\n triggerMode: TriggerMode\n exited: boolean\n}\n\nconst DEFAULT_STATE: State = {\n open: false,\n exited: false,\n containerRef: null,\n triggerMode: 'click',\n}\n\ninterface OpenAction {\n type: 'OPEN_OVERLAY'\n}\n\ninterface CloseAction {\n type: 'CLOSE_OVERLAY'\n}\n\ninterface SetExitedAction {\n type: 'SET_EXITED'\n payload: { exited: boolean }\n}\n\ninterface SetContainerRefAction {\n type: 'SET_CONTAINER_REF'\n payload: { containerRef: React.RefObject<HTMLElement> }\n}\n\ninterface SetTriggerModeAction {\n type: 'SET_TRIGGER_MODE'\n payload: { triggerMode: TriggerMode }\n}\n\ntype Action =\n | OpenAction\n | CloseAction\n | SetExitedAction\n | SetTriggerModeAction\n | SetContainerRefAction\ntype Dispatch = (action: Action) => void\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => {}\nconst OverlayStateContext = createContext<State>(DEFAULT_STATE)\nconst OverlayDispatchContext = createContext<Dispatch>(noop)\n\nfunction overlayContextReducer(state: State = DEFAULT_STATE, action: Action) {\n switch (action.type) {\n case 'OPEN_OVERLAY':\n return {\n ...state,\n open: true,\n }\n case 'CLOSE_OVERLAY':\n return {\n ...state,\n open: false,\n }\n case 'SET_CONTAINER_REF':\n return {\n ...state,\n containerRef: action.payload.containerRef,\n }\n case 'SET_TRIGGER_MODE':\n return {\n ...state,\n triggerMode: action.payload.triggerMode,\n }\n case 'SET_EXITED': {\n return {\n ...state,\n exited: action.payload.exited,\n }\n }\n default:\n return state\n }\n}\n\nexport const OverlayContextProvider: React.FC = ({ children }) => {\n const [state, dispatch] = useReducer(overlayContextReducer, DEFAULT_STATE)\n\n return (\n <OverlayStateContext.Provider value={state}>\n <OverlayDispatchContext.Provider value={dispatch}>\n {children}\n </OverlayDispatchContext.Provider>\n </OverlayStateContext.Provider>\n )\n}\n\nexport function useOverlayDispatch() {\n return useContext(OverlayDispatchContext)\n}\n\nexport function useOverlayState() {\n const context = useContext(OverlayStateContext)\n if (typeof context === 'undefined') {\n throw Error('useOverlayState must be used within a OverlayStateContext')\n }\n\n return context\n}\n\nexport default {\n useOverlayState,\n useOverlayDispatch,\n}\n\n```" } ]
code_overlay-layout_3ba2dd5e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/Backdrop.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useEffect, useRef } from 'react'\nimport classnames from 'classnames'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { TransitionProps } from 'react-transition-group/Transition'\n\nimport styles from './styles.css'\nimport Fade from './components/Animations/Fade'\nimport ownerDocument from './modules/ownerDocument'\n\nexport type BackdropMode = 'display' | 'clickable' | 'none'\n\ninterface Classes {\n backdropContainer: string\n backdrop: string\n}\n\ninterface Props {\n open: boolean\n exited: boolean\n classes?: Partial<Classes>\n transitionDuration?: TransitionProps['timeout']\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void\n}\n\nfunction restoreOverflowX(\n valueRef: React.MutableRefObject<string | undefined>,\n body: HTMLElement\n) {\n if (valueRef.current) {\n body.style.overflowX = valueRef.current\n valueRef.current = undefined\n } else {\n body.style.removeProperty('overflow-x')\n }\n}\n\nconst CSS_HANDLES = ['backdrop', 'backdropContainer'] as const\n\nconst Backdrop: React.FC<Props> = props => {\n const {\n open,\n exited,\n onClick,\n children,\n classes = {},\n transitionDuration,\n } = props\n const rootRef = useRef(null)\n const overflowX = useRef<string>()\n const handles = useCssHandles(CSS_HANDLES)\n\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (onClick) {\n onClick(e)\n }\n }\n\n useEffect(() => {\n let body: HTMLElement\n if (rootRef.current) {\n body = ownerDocument(rootRef.current).body\n if (open) {\n if (body.style.overflowX) {\n overflowX.current = body.style.overflowX\n }\n body.style.overflowX = 'hidden'\n } else if (exited) {\n restoreOverflowX(overflowX, body)\n }\n }\n\n return () => {\n if (!open && body) {\n restoreOverflowX(overflowX, body)\n }\n }\n }, [open, exited])\n\n if (!open && exited) {\n return null\n }\n\n const containerClasses = classnames(\n handles.backdropContainer,\n classes.backdropContainer,\n styles.backdropContainer\n )\n\n const backdropClasses = classnames(\n handles.backdrop,\n classes.backdrop,\n styles.backdrop\n )\n\n return (\n <Fade in={open} timeout={transitionDuration}>\n <div className={containerClasses} ref={rootRef}>\n <div\n role=\"presentation\"\n onClick={handleClick}\n className={backdropClasses}\n >\n {children}\n </div>\n </div>\n </Fade>\n )\n}\n\nexport default React.memo(Backdrop)\n\n```" } ]
code_overlay-layout_b7ce42f2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/BaseOverlay.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useCallback, useMemo, useEffect, useState } from 'react'\nimport classnames from 'classnames'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { Placement as PopperPlacement } from '@popperjs/core'\n\nimport styles from './styles.css'\nimport Popper from './components/Popper'\nimport TrapFocus from './components/TrapFocus'\nimport Fade from './components/Animations/Fade'\nimport useEventCallback from './modules/useEventCallback'\nimport OutsideClickHandler from './components/OutsideClickHandler'\nimport { useOverlayState, useOverlayDispatch } from './OverlayContext'\nimport handleContainerStyle, { RestoreFn } from './modules/handleContainerStyle'\n\ntype TransitionComponentType = 'fade'\n\ninterface Offsets {\n distance: number\n skidding: number\n}\n\ninterface Classes {\n arrow: string\n popper: string\n backdrop: string\n container: string\n popperArrow: string\n backdropContainer: string\n outsideClickHandler: string\n}\n\ninterface Props\n extends React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n > {\n showArrow?: boolean\n children: React.ReactNode\n classes?: Partial<Classes>\n offsets?: Partial<Offsets>\n placement?: PopperPlacement\n backdrop?: 'visible' | 'none'\n scrollBehavior?: 'lock-page-scroll' | 'close-on-scroll' | 'default'\n transitionComponent?: TransitionComponentType\n}\n\nfunction useTransition(option: TransitionComponentType) {\n return useMemo(() => {\n const lowerCaseOption = option.toLowerCase() as TransitionComponentType\n switch (lowerCaseOption) {\n case 'fade':\n return Fade\n default:\n return Fade\n }\n }, [option])\n}\n\nconst CSS_HANDLES = [\n 'arrow',\n 'popper',\n 'backdrop',\n 'container',\n 'popperArrow',\n 'backdropContainer',\n 'outsideClickHandler',\n] as const\n\nexport default function BaseOverlay(props: Props) {\n const {\n ref,\n role,\n offsets,\n onClick,\n children,\n classes = {},\n backdrop = 'none',\n showArrow = false,\n placement = 'bottom',\n className: classNameProp,\n scrollBehavior = 'default',\n transitionComponent = 'fade',\n ...rest\n } = props\n const { open, containerRef, triggerMode } = useOverlayState()\n const dispatch = useOverlayDispatch()\n const handles = useCssHandles(CSS_HANDLES)\n const [arrowRef, setArrowRef] = useState<HTMLSpanElement | null>(null)\n const TransitionComponent = useTransition(transitionComponent)\n\n const handleClose = useCallback(\n (e: Event) => {\n const triggerClicked = containerRef?.current?.contains(\n e.target as Node | null\n )\n if (!triggerClicked) {\n dispatch({ type: 'CLOSE_OVERLAY' })\n }\n },\n [containerRef, dispatch]\n )\n\n const handleKeydown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key !== 'Escape' || triggerMode !== 'click') {\n return\n }\n dispatch({ type: 'CLOSE_OVERLAY' })\n },\n [dispatch, triggerMode]\n )\n\n const closeOnScroll = useEventCallback((e: any) => {\n e.preventDefault()\n dispatch({ type: 'CLOSE_OVERLAY' })\n })\n\n useEffect(() => {\n let restore: RestoreFn | null = null\n if (open) {\n if (scrollBehavior === 'close-on-scroll') {\n window.addEventListener('scroll', closeOnScroll)\n } else if (scrollBehavior === 'lock-page-scroll') {\n restore = handleContainerStyle(window?.document.body)\n }\n }\n\n return () => {\n window.removeEventListener('scroll', closeOnScroll)\n if (restore) {\n restore()\n }\n }\n }, [closeOnScroll, scrollBehavior, open])\n\n const handleClick: React.MouseEventHandler<HTMLDivElement> = useCallback(\n e => {\n if (triggerMode === 'click') {\n // The Trigger works as a toggle, so if this event\n // go up to the Trigger it will close the Overlay\n e.stopPropagation()\n }\n\n if (onClick) {\n onClick(e)\n }\n },\n [onClick, triggerMode]\n )\n\n const popperClasses = useMemo(\n () => ({\n container: classes.popper,\n backdrop: classes.backdrop,\n popperArrow: classes.popperArrow,\n backdropContainer: classes.backdropContainer,\n }),\n [classes]\n )\n\n const containerClasses = classnames(\n handles.container,\n classNameProp,\n classes.container\n )\n const arrowClasses = classnames(handles.arrow, classes.arrow, styles.arrow)\n\n return (\n <Popper\n transition\n open={open}\n offsets={offsets}\n arrowEl={arrowRef}\n placement={placement}\n classes={popperClasses}\n anchorEl={containerRef?.current}\n backdrop={backdrop !== 'none' ? 'clickable' : 'none'}\n >\n {({ TransitionProps }: any) => (\n <OutsideClickHandler\n onOutsideClick={handleClose}\n className={classes.outsideClickHandler}\n >\n <TrapFocus open={open}>\n <TransitionComponent {...TransitionProps}>\n <div\n role={role}\n tabIndex={-1}\n onClick={handleClick}\n onKeyDown={handleKeydown}\n className={containerClasses}\n {...rest}\n >\n {showArrow && (\n <span className={arrowClasses} ref={setArrowRef} />\n )}\n {children}\n </div>\n </TransitionComponent>\n </TrapFocus>\n </OutsideClickHandler>\n )}\n </Popper>\n )\n}\n\n```" } ]
code_overlay-layout_b8663e7a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/OverlayLayout.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo } from 'react'\nimport { Placement as PopperPlacement } from '@popperjs/core'\n\nimport BaseOverlay from './BaseOverlay'\n\ntype TransitionComponentType = 'fade'\n\ninterface Offsets {\n distance: number\n skidding: number\n}\n\ninterface Props {\n role?: string\n showArrow?: boolean\n children: React.ReactNode\n offsets?: Partial<Offsets>\n placement?: PopperPlacement\n backdrop?: 'visible' | 'none'\n scrollBehavior?: 'lock-page-scroll' | 'close-on-scroll' | 'default'\n transitionComponent?: TransitionComponentType\n}\n\nexport default function OverlayLayout(props: Props) {\n const classes = useMemo(\n () => ({\n arrow: 'c-on-base--inverted',\n backdrop: 'bg-base--inverted',\n container: 'outline-0 pv2 bg-base br bl bb bt b--muted-4 br2 w-100',\n }),\n []\n )\n return <BaseOverlay {...props} classes={classes} />\n}\n\n```" } ]
code_overlay-layout_8a287816
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/package.json from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"lint\": \"tsc --noEmit && eslint --quiet --fix --ext ts,tsx .\",\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"@popperjs/core\": \"^2.0.5\",\n \"classnames\": \"^2.2.6\",\n \"consolidated-events\": \"^2.0.2\",\n \"react\": \"^16.8.6\",\n \"react-dom\": \"^16.8.6\",\n \"react-transition-group\": \"^4.3.0\"\n },\n \"devDependencies\": {\n \"@types/classnames\": \"^2.2.9\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/react\": \"^16.8.22\",\n \"@types/react-transition-group\": \"^4.2.3\",\n \"@vtex/test-tools\": \"^3.0.0\",\n \"@vtex/tsconfig\": \"^0.3.0\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.2/public/@types/vtex.css-handles\",\n \"typescript\": \"3.8.3\"\n },\n \"version\": \"0.1.3\"\n}\n\n```" } ]
code_overlay-layout_c22bf518
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/OverlayTrigger.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport classnames from 'classnames'\nimport {\n useResponsiveValue,\n MaybeResponsiveInput,\n} from 'vtex.responsive-values'\n\nimport BaseTrigger from './BaseTrigger'\n\nexport type TriggerMode = 'click' | 'hover' | 'none'\n\ninterface Props {\n children: React.ReactNode\n backdrop?: 'visible' | 'none'\n trigger: MaybeResponsiveInput<TriggerMode>\n}\n\nexport default function OverlayTrigger(props: Props) {\n const { children, trigger: triggerProp = 'click' } = props\n const trigger = useResponsiveValue(triggerProp)\n const role = trigger === 'click' ? 'button' : undefined\n const containerClasses = classnames(\n 'outline-0 bg-transparent bn pa0 dib bg-red',\n {\n pointer: trigger === 'click',\n }\n )\n\n return (\n <BaseTrigger\n role={role}\n tabIndex={0}\n style={{ zIndex: 2000 }}\n trigger={trigger}\n className={containerClasses}\n >\n {children}\n </BaseTrigger>\n )\n}\n\n```" } ]
code_overlay-layout_62044a30
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/BaseTrigger.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useEffect, useRef } from 'react'\nimport {\n useResponsiveValue,\n MaybeResponsiveInput,\n} from 'vtex.responsive-values'\nimport classnames from 'classnames'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport {\n useOverlayState,\n useOverlayDispatch,\n OverlayContextProvider,\n} from './OverlayContext'\nimport useForkRef from './modules/useForkRef'\n\nexport type TriggerMode = 'click' | 'hover' | 'none'\n\ntype TriggerElement = HTMLDivElement & HTMLLIElement\n\ninterface Props\n extends React.DetailedHTMLProps<\n React.HTMLAttributes<TriggerElement>,\n TriggerElement\n > {\n children: React.ReactNode\n tag?: 'div' | 'li'\n trigger?: MaybeResponsiveInput<TriggerMode>\n}\n\nconst CSS_HANDLES = ['trigger'] as const\n\nconst BaseTrigger = React.forwardRef(function BaseTrigger(\n props: Props,\n ref: React.Ref<TriggerElement>\n) {\n const {\n onClick,\n children,\n onMouseEnter,\n onMouseLeave,\n tag: Tag = 'div',\n className: classNameProp,\n trigger: triggerProp = 'click',\n ...rest\n } = props\n const trigger = useResponsiveValue(triggerProp)\n const dispatch = useOverlayDispatch()\n const { open } = useOverlayState()\n const handles = useCssHandles(CSS_HANDLES)\n const containerRef = useRef<TriggerElement>(null)\n const handleRef = useForkRef(containerRef, ref)\n const role = trigger === 'click' ? 'button' : undefined\n\n useEffect(() => {\n dispatch({\n type: 'SET_CONTAINER_REF',\n payload: { containerRef },\n })\n }, [dispatch, containerRef])\n\n useEffect(() => {\n dispatch({\n type: 'SET_TRIGGER_MODE',\n payload: { triggerMode: trigger },\n })\n }, [dispatch, trigger])\n\n const handleKeydown = (e: React.KeyboardEvent<TriggerElement>) => {\n if (e.key !== 'Enter' || trigger !== 'click') {\n return\n }\n\n e.stopPropagation()\n dispatch({ type: 'OPEN_OVERLAY' })\n }\n\n const handleClick: React.MouseEventHandler<TriggerElement> = e => {\n if (trigger === 'click') {\n // This is needed to block some parent element to use this event\n // to do some action (like open a Modal or change the url).\n // If you click in the Trigger you want to open the trigger only\n // nothing else.\n e.stopPropagation()\n e.preventDefault()\n\n if (open) {\n dispatch({ type: 'CLOSE_OVERLAY' })\n } else {\n dispatch({ type: 'OPEN_OVERLAY' })\n }\n }\n\n if (onClick) {\n onClick(e)\n }\n }\n const handleMouseEnter: React.MouseEventHandler<TriggerElement> = e => {\n if (trigger === 'hover') {\n dispatch({ type: 'OPEN_OVERLAY' })\n }\n\n if (onMouseEnter) {\n onMouseEnter(e)\n }\n }\n\n const handleMouseLeave: React.MouseEventHandler<TriggerElement> = e => {\n if (trigger === 'hover') {\n dispatch({ type: 'CLOSE_OVERLAY' })\n }\n\n if (onMouseLeave) {\n onMouseLeave(e)\n }\n }\n\n const className = classnames(handles.trigger, classNameProp)\n\n return (\n <Tag\n role={role}\n ref={handleRef}\n className={className}\n onClick={handleClick}\n onKeyDown={handleKeydown}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n {...rest}\n >\n {children}\n </Tag>\n )\n})\n\nconst EnhancedTrigger = React.forwardRef(function EnhancedTrigger(\n props: Props,\n ref: React.Ref<TriggerElement>\n) {\n return (\n <OverlayContextProvider>\n <BaseTrigger {...props} ref={ref} />\n </OverlayContextProvider>\n )\n})\n\nexport default EnhancedTrigger\n\n```" } ]
code_overlay-layout_6dada776
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/store/interfaces.json from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"overlay-trigger\": {\n \"component\": \"OverlayTrigger\",\n \"composition\": \"children\"\n },\n \"overlay-layout\": {\n \"component\": \"OverlayLayout\",\n \"composition\": \"children\"\n }\n}\n\n```" } ]
code_overlay-layout_fc5899d4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/typings/vtex.responsive-values.d.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.responsive-values' {\n export type MaybeResponsiveInput<T> = T | ResponsiveInput<T>\n\n export const useResponsiveValue: <T>(prop: ResponsiveInput<T> | T) => T\n export const useResponsiveValues: (\n props: Record<string, MaybeResponsiveInput<any>>\n ) => Record<string, any>\n\n export interface ResponsiveInput<T> {\n mobile: T\n desktop: T\n tablet: T\n }\n}\n\n```" } ]
code_overlay-layout_e6478a38
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/typings/vtex.render-runtime.d.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.render-runtime' {\n const canUseDOM: boolean\n}\n\n```" } ]
code_overlay-layout_0ed10d25
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/typings/consolidated-events.d.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'consolidated-events' {\n export const addEventListener: <K extends keyof DocumentEventMap>(\n element: HTMLElement | Document | Window,\n type: K,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ) => () => void\n}\n\n```" } ]
code_overlay-layout_2b828a76
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/typings/css.d.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.css' {\n type CssFiles = Record<string, string | undefined>\n const CssObj: CssFiles\n export default CssObj\n}\n\n```" } ]
code_overlay-layout_cf89a9f0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/components/Portal.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport ReactDOM from 'react-dom'\nimport React, { useState, forwardRef } from 'react'\n\nimport setRef from '../modules/setRef'\nimport useEnhancedEffect from '../modules/useEnhancedEffect'\n\nexport type ContainerType =\n | React.ReactInstance\n | (() => React.ReactInstance | null)\n | null\n\ninterface Props {\n children: React.ReactNode\n container?: ContainerType\n}\n\nexport function getContainer(container?: ContainerType) {\n container = typeof container === 'function' ? container() : container\n // eslint-disable-next-line react/no-find-dom-node\n return ReactDOM.findDOMNode(container) as Element | null\n}\n\nconst Portal = forwardRef(function Portal(props: Props, ref) {\n const { children, container } = props\n const [mountNode, setMountNode] = useState<Element | null>(null)\n\n useEnhancedEffect(() => {\n setMountNode(getContainer(container) || document.body)\n }, [container])\n\n useEnhancedEffect(() => {\n if (mountNode) {\n setRef(ref, mountNode)\n\n return () => {\n setRef(ref, null)\n }\n }\n\n return undefined\n }, [ref, mountNode])\n\n return mountNode ? ReactDOM.createPortal(children, mountNode) : mountNode\n})\n\nexport default Portal\n\n```" } ]
code_overlay-layout_078dbbee
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/components/Popper.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, {\n useRef,\n useMemo,\n useState,\n useEffect,\n forwardRef,\n useCallback,\n MutableRefObject,\n} from 'react'\nimport {\n createPopper,\n VirtualElement,\n ModifierArguments,\n State as PopperState,\n Instance as PopperInstance,\n Modifier as PopperModifier,\n Placement as PopperPlacementType,\n} from '@popperjs/core'\nimport classnames from 'classnames'\nimport { useCssHandles } from 'vtex.css-handles'\n\nimport styles from '../styles.css'\nimport setRef from '../modules/setRef'\nimport useForkRef from '../modules/useForkRef'\nimport { useOverlayDispatch } from '../OverlayContext'\nimport Backdrop, { BackdropMode } from '../Backdrop'\n\ninterface Offsets {\n distance: number\n skidding: number\n}\n\ntype AnchorElType =\n | null\n | VirtualElement\n | (() => VirtualElement)\n | React.RefObject<HTMLElement>\n\ninterface Classes {\n container: string\n popperArrow: string\n backdrop: string\n backdropContainer: string\n}\n\ninterface Props\n extends React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n > {\n role?: string\n open?: boolean\n transition?: boolean\n backdrop?: BackdropMode\n anchorEl?: AnchorElType\n children: React.ReactNode\n classes?: Partial<Classes>\n offsets?: Partial<Offsets>\n arrowEl?: HTMLElement | null\n placement?: PopperPlacementType\n}\n\nfunction getAnchorEl(anchorEl: React.ReactNode) {\n return typeof anchorEl === 'function' ? anchorEl() : anchorEl\n}\n\nconst defaultOffsets: Offsets = {\n distance: 0,\n skidding: 0,\n}\n\nconst CSS_HANDLES = ['popper', 'popperArrow'] as const\n\nconst Popper = forwardRef(function Popper(props: Props, ref) {\n const {\n arrowEl,\n anchorEl,\n children,\n open = false,\n classes = {},\n backdrop = 'none',\n transition = false,\n role = 'presentation',\n className: classNameProp,\n offsets: offsetsProp = defaultOffsets,\n placement: initialPlacement = 'bottom',\n ...rest\n } = props\n\n const tooltipRef = useRef<HTMLElement>(null)\n const ownRef = useForkRef(tooltipRef, ref)\n const dispatch = useOverlayDispatch()\n const handles = useCssHandles(CSS_HANDLES)\n const popperRef: MutableRefObject<PopperInstance | null> = useRef<\n PopperInstance\n >(null)\n const [placement, setPlacement] = useState(initialPlacement)\n const [exited, setExited] = useState(true)\n\n // It doesn't have a dependency array because it should update\n // after every render of react\n useEffect(() => {\n if (popperRef.current) {\n popperRef.current.update()\n }\n })\n\n const popperModifiers = useMemo(() => {\n const handlePopperUpdate = (data: ModifierArguments<{}>) => {\n setPlacement(data.state.placement)\n }\n\n const { distance, skidding } = {\n ...defaultOffsets,\n ...offsetsProp,\n }\n\n const modifiers: Partial<PopperModifier<unknown>>[] = [\n {\n name: 'afterWrite',\n enabled: true,\n phase: 'afterWrite',\n fn: handlePopperUpdate,\n },\n {\n name: 'preventOverflow',\n options: {\n mainAxis: true,\n altAxis: false,\n ...(window && { boundary: window }),\n },\n },\n {\n name: 'offset',\n options: {\n offset: [skidding, distance],\n },\n },\n ]\n\n if (arrowEl) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowEl,\n },\n })\n }\n\n return modifiers\n }, [arrowEl, offsetsProp])\n\n const handleOpen = useCallback(() => {\n if (!tooltipRef.current || !open) {\n return\n }\n\n if (popperRef.current) {\n popperRef.current.destroy()\n }\n\n const handlePopperFirstUpdate = (data: Partial<PopperState>) => {\n if (data.placement) {\n setPlacement(data.placement)\n }\n }\n\n const popper = createPopper(getAnchorEl(anchorEl), tooltipRef.current, {\n modifiers: popperModifiers,\n placement: initialPlacement,\n onFirstUpdate: handlePopperFirstUpdate,\n })\n popperRef.current = popper\n }, [open, anchorEl, initialPlacement, popperModifiers])\n\n const handleRef = useCallback(\n node => {\n setRef(ownRef, node)\n handleOpen()\n },\n [ownRef, handleOpen]\n )\n\n const handleEnter = () => {\n setExited(false)\n dispatch({ type: 'SET_EXITED', payload: { exited: false } })\n }\n\n const handleClose = () => {\n if (!popperRef.current) {\n return\n }\n\n popperRef.current.destroy()\n }\n\n const handleExited = () => {\n setExited(true)\n dispatch({ type: 'SET_EXITED', payload: { exited: true } })\n handleClose()\n }\n\n useEffect(() => {\n handleOpen()\n }, [handleOpen])\n\n useEffect(() => {\n return () => {\n handleClose()\n }\n }, [])\n\n useEffect(() => {\n if (!open && !transition) {\n handleClose()\n }\n }, [open, transition])\n\n const backdropClasses = useMemo(\n () => ({\n backdrop: classes.backdrop,\n backdropContainer: classes.backdropContainer,\n }),\n [classes]\n )\n\n if (!open && (!transition || exited)) {\n return null\n }\n\n const childProps: any = { placement }\n\n if (transition) {\n childProps.TransitionProps = {\n in: open,\n onEnter: handleEnter,\n onExited: handleExited,\n }\n }\n\n const popperArrowClasses = classnames(\n handles.popperArrow,\n classes.popperArrow,\n styles.popperArrow\n )\n\n const containerClasses = classnames(\n handles.popper,\n classNameProp,\n classes.container,\n styles.dropdown,\n {\n [popperArrowClasses]: Boolean(arrowEl),\n }\n )\n\n return (\n <div className={containerClasses} role={role} ref={handleRef} {...rest}>\n {typeof children === 'function' ? children(childProps) : children}\n {backdrop !== 'none' && (\n <Backdrop\n open={open}\n classes={backdropClasses}\n exited={!transition || exited}\n />\n )}\n </div>\n )\n})\n\nexport default Popper\n\n```" } ]
code_overlay-layout_8270755c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/components/OutsideClickHandler.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useCallback, useRef, forwardRef, useEffect } from 'react'\nimport classnames from 'classnames'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { addEventListener } from 'consolidated-events'\n\nimport setRef from '../modules/setRef'\nimport useForkRef from '../modules/useForkRef'\n\ninterface Props\n extends React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n > {\n children: React.ReactNode\n disabled?: boolean\n useCapture?: boolean\n onOutsideClick?: EventListener\n}\n\nconst CSS_HANDLES = ['outsideClickHandler'] as const\n\nconst OutsideClickHandler = forwardRef(function OutsideClickHandler(\n props: Props,\n ref\n) {\n const {\n children,\n disabled = false,\n useCapture = true,\n onOutsideClick,\n className: classNameProp,\n ...rest\n } = props\n const rootRef = useRef<HTMLDivElement>(null)\n const ownRef = useForkRef(rootRef, ref)\n const handles = useCssHandles(CSS_HANDLES)\n const removeMouseUpRef = useRef<Function | null>()\n const removeMouseDownRef = useRef<Function | null>()\n const handleRef = useCallback(\n node => {\n setRef(ownRef, node)\n },\n [ownRef]\n )\n\n const handleMouseUp = useCallback(\n e => {\n const isDescendantOfRoot = rootRef.current?.contains(e.target)\n if (removeMouseUpRef.current) {\n removeMouseUpRef.current()\n removeMouseUpRef.current = null\n }\n\n if (!isDescendantOfRoot && onOutsideClick) {\n onOutsideClick(e)\n }\n },\n [onOutsideClick]\n )\n\n const handleMouseDown = useCallback(\n e => {\n const isDescendantOfRoot = rootRef.current?.contains(e.target)\n if (!isDescendantOfRoot) {\n if (removeMouseUpRef.current) {\n removeMouseUpRef.current()\n removeMouseDownRef.current = null\n }\n\n removeMouseUpRef.current = addEventListener(\n window?.document,\n 'mouseup',\n handleMouseUp,\n { capture: useCapture }\n )\n }\n },\n [handleMouseUp, useCapture]\n )\n\n const addMouseDownEventListener = useCallback(\n (useCapture: boolean) => {\n removeMouseDownRef.current = addEventListener(\n window?.document,\n 'mousedown',\n handleMouseDown,\n {\n capture: useCapture,\n }\n )\n },\n [handleMouseDown]\n )\n\n const removeEventListeners = () => {\n if (removeMouseUpRef.current) {\n removeMouseUpRef.current()\n removeMouseUpRef.current = null\n }\n\n if (removeMouseDownRef.current) {\n removeMouseDownRef.current()\n removeMouseDownRef.current = null\n }\n }\n\n useEffect(() => {\n if (disabled) {\n removeEventListeners()\n } else {\n if (removeMouseUpRef.current) {\n removeMouseUpRef.current()\n removeMouseUpRef.current = null\n }\n addMouseDownEventListener(useCapture)\n }\n\n return () => removeEventListeners()\n }, [addMouseDownEventListener, disabled, useCapture])\n\n const className = classnames(handles.outsideClickHandler, classNameProp)\n\n return (\n <div className={className} {...rest} ref={handleRef}>\n {children}\n </div>\n )\n})\n\nexport default OutsideClickHandler\n\n```" } ]
code_overlay-layout_c8734c0f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/components/TrapFocus.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useEffect, useRef } from 'react'\n\nimport useForkRef from '../modules/useForkRef'\nimport ownerDocument from '../modules/ownerDocument'\n\ninterface Props {\n children: React.ReactElement\n open: boolean\n}\n\nconst TrapFocus = function TrapFocus(props: Props) {\n const { children, open } = props\n const rootRef: React.MutableRefObject<HTMLElement | null> = useRef(null)\n /*\n * I'm just passing rootRef here because I know this will not receive\n * non class components as children that don't have fowardedRef\n */\n const handleRef = useForkRef(rootRef, (children as any)?.ref)\n\n useEffect(() => {\n if (!open) {\n return\n }\n\n /*\n * Popperjs probably always starts the element at the top of the screen.\n * So if I try to focus after it positions the element in the right place\n * the scroll will go to the top of the page. That's why I have to use\n * the requestAnimationFrame\n * */\n requestAnimationFrame(() => {\n // And we need two because of IE11\n requestAnimationFrame(() => {\n const doc = ownerDocument(rootRef.current)\n /*\n * We should only try to focus if no element that is inside of\n * rootRef is not the current focused element\n */\n if (!rootRef.current?.contains(doc.activeElement)) {\n if (!rootRef.current?.hasAttribute('tabIndex')) {\n ;(rootRef.current as any).setAttribute('tabIndex', -1)\n }\n rootRef.current?.focus()\n }\n })\n })\n }, [open])\n\n return <>{React.cloneElement(children, { ref: handleRef })}</>\n}\n\nexport default TrapFocus\n\n```" } ]
code_overlay-layout_afb2dcc7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/__tests__/index.test.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\ndescribe('Orders List Scenarios', () => {\n it('should work', () => {\n expect(1).toBe(1)\n })\n})\n\n```" } ]
code_overlay-layout_815ea69c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/getPaddingRight.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport default function getPaddingRight(node: HTMLElement) {\n return parseInt(window.getComputedStyle(node).paddingRight, 10) || 0\n}\n\n```" } ]
code_overlay-layout_00b83c99
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/useEventCallback.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { useRef, useCallback } from 'react'\n\nimport useEnhancedEffect from './useEnhancedEffect'\n\n// https://github.com/facebook/react/issues/14099#issuecomment-440013892\nexport default function useEventCallback(fn: Function) {\n const ref = useRef(fn)\n\n useEnhancedEffect(() => {\n ref.current = fn\n })\n\n return useCallback((...args) => ref.current(...args), [])\n}\n\n```" } ]
code_overlay-layout_8174717c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/handleContainerStyle.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport isOverflowing from './isOverflowing'\nimport getScrollbarSize from './getScrollbarSize'\nimport getPaddingRight from './getPaddingRight'\n\ninterface RestoreStyle {\n value: string\n el: HTMLElement\n key: string\n}\n\nexport type RestoreFn = () => void\n\nexport default function handleContainerStyle(\n container: HTMLElement\n): RestoreFn {\n const restoreStyle: RestoreStyle[] = []\n\n if (isOverflowing(container)) {\n const scrollbarSize = getScrollbarSize()\n\n restoreStyle.push({\n value: container.style.paddingRight,\n key: 'padding-right',\n el: container,\n })\n\n container.style.paddingRight = `${getPaddingRight(container) +\n scrollbarSize}px`\n }\n\n // https://css-tricks.com/snippets/css/force-vertical-scrollbar/\n const parent = container.parentElement\n const scrollContainer =\n parent?.nodeName === 'HTML' &&\n window.getComputedStyle(parent).overflowY === 'scroll'\n ? parent\n : container\n restoreStyle.push({\n value: scrollContainer.style.overflow,\n key: 'overflow',\n el: scrollContainer,\n })\n scrollContainer.style.overflow = 'hidden'\n\n const restore = () => {\n restoreStyle.forEach(({ value, el, key }) => {\n if (!el) {\n return\n }\n\n if (value) {\n el.style.setProperty(key, value)\n } else {\n el.style.removeProperty(key)\n }\n })\n }\n\n return restore\n}\n\n```" } ]
code_overlay-layout_884ad5a8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/onwerWindow.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport ownerDocument from './ownerDocument'\n\ntype NodeType = HTMLElement | Document | null | undefined\nexport default function ownerWindow(node: NodeType) {\n const doc = ownerDocument(node as HTMLElement)\n return doc.defaultView || window\n}\n\n```" } ]
code_overlay-layout_ecf20cfa
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/transitionsConstants.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const duration = {\n enteringScreen: 250,\n leavingScreen: 218,\n standard: 300,\n}\n\nexport const easing = {\n easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',\n easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',\n easeIn: 'cubic-bezier(0.4, 0, 1, 1)',\n sharp: 'cubic-bezier(0.4, 0, 0.6, 1)',\n}\n\n```" } ]
code_overlay-layout_a35f43da
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/getTransitionProps.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n TransitionActions,\n TransitionProps as _TransitionProps,\n} from 'react-transition-group/Transition'\n\nexport type TransitionHandlerKeys = 'onEnter' | 'onExit'\nexport type TransitionKeys = 'in' | 'timeout' | TransitionHandlerKeys\nexport type TransitionProps = TransitionActions &\n Partial<Pick<_TransitionProps, TransitionKeys>>\n\nexport interface TransitionPropsOptions {\n mode: 'enter' | 'exit' | 'appear'\n}\n\nexport default function getTransitionProps(\n props: TransitionProps,\n options?: TransitionPropsOptions\n) {\n const { timeout } = props\n\n let duration: number | string | undefined = 0\n if (typeof timeout === 'number') {\n duration = timeout\n } else if (typeof timeout === 'object' && options && timeout[options.mode]) {\n duration = timeout[options.mode]\n }\n\n return {\n duration,\n }\n}\n\n```" } ]
code_overlay-layout_e944e2ab
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/ownerDocument.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport default function ownerDocument(node: HTMLElement | null | undefined) {\n return (node && node.ownerDocument) || window.document\n}\n\n```" } ]
code_overlay-layout_90bc0154
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/useForkRef.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { useMemo } from 'react'\n\nimport setRef from './setRef'\n\nexport default function useForkRef<T>(\n refA: React.Ref<T> | ((instance: T | null) => void) | null | undefined,\n refB: React.Ref<T> | ((instance: T | null) => void) | null | undefined\n): React.Ref<T> {\n return useMemo(() => {\n if (!refA && !refB) {\n return null\n }\n\n return refValue => {\n setRef(refA, refValue)\n setRef(refB, refValue)\n }\n }, [refA, refB])\n}\n\n```" } ]
code_overlay-layout_4b87f5c8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/setRef.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport default function setRef<T>(\n ref: React.Ref<T> | ((instance: T | null) => void) | null | undefined,\n value: T | null\n) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref) {\n ;(ref as any).current = value\n }\n}\n\n```" } ]
code_overlay-layout_67eba5da
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/getScrollbarSize.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport default function getScrollbarSize() {\n const scrollDiv = document.createElement('div')\n scrollDiv.style.width = '99px'\n scrollDiv.style.height = '99px'\n scrollDiv.style.position = 'absolute'\n scrollDiv.style.top = '-9999px'\n scrollDiv.style.overflow = 'scroll'\n\n document.body.appendChild(scrollDiv)\n const scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth\n document.body.removeChild(scrollDiv)\n\n return scrollbarSize\n}\n\n```" } ]
code_overlay-layout_82cf301a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/useEnhancedEffect.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { useLayoutEffect, useEffect } from 'react'\nimport { canUseDOM } from 'vtex.render-runtime'\n\nconst useEnhancedEffect = canUseDOM ? useLayoutEffect : useEffect\n\nexport default useEnhancedEffect\n\n```" } ]
code_overlay-layout_5386047a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/isOverflowing.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport ownerWindow from './onwerWindow'\nimport ownerDocument from './ownerDocument'\n\nexport default function isOverflowing(container: HTMLElement) {\n const doc = ownerDocument(container)\n\n if (doc.body === container) {\n return ownerWindow(doc).innerWidth > doc.documentElement.clientWidth\n }\n\n return container.scrollHeight > container.clientHeight\n}\n\n```" } ]
code_overlay-layout_94e084a7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/modules/createTransition.ts from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n easing as easingFunctions,\n duration as transitionDuration,\n} from './transitionsConstants'\n\nexport interface TransitionCreationOptions {\n duration: number | string\n easing: string\n delay: number | string\n}\n\nconst formatMs = (milliseconds: number) => `${Math.round(milliseconds)}ms`\n\nexport default function createTransition(\n props: string | string[] = ['all'],\n options: Partial<TransitionCreationOptions> = {}\n) {\n const {\n delay = 0,\n easing = easingFunctions.easeInOut,\n duration = transitionDuration.standard,\n } = options\n\n return (Array.isArray(props) ? props : [props])\n .map(\n animatedProp =>\n `${animatedProp} ${\n typeof duration === 'string' ? duration : formatMs(duration)\n } ${easing} ${typeof delay === 'string' ? delay : formatMs(delay)}`\n )\n .join(',')\n}\n\n```" } ]
code_overlay-layout_bf4a80bc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of overlay-layout/react/components/Animations/Fade.tsx from the overlay-layout VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { Transition } from 'react-transition-group'\nimport {\n ENTERED,\n ENTERING,\n ExitHandler,\n EnterHandler,\n TransitionProps,\n TransitionStatus,\n} from 'react-transition-group/Transition'\n\nimport { duration } from '../../modules/transitionsConstants'\nimport createTransition from '../../modules/createTransition'\nimport getTransitionProps from '../../modules/getTransitionProps'\nimport useForkRef from '../../modules/useForkRef'\n\ninterface Props {\n in?: boolean\n children: React.ReactElement\n timeout?: TransitionProps['timeout']\n onEnter?: EnterHandler\n onExit?: ExitHandler\n}\n\nfunction getOpacity(state: TransitionStatus) {\n switch (state) {\n case ENTERING:\n return 1\n case ENTERED:\n return 1\n default:\n return 0\n }\n}\n\nconst defaultTimeout = {\n enter: duration.enteringScreen,\n exit: duration.leavingScreen,\n}\n\nconst Fade = React.forwardRef(function Fade(\n props: Props,\n ref: React.Ref<unknown>\n) {\n const {\n onExit,\n onEnter,\n children,\n in: inProp = false,\n timeout = defaultTimeout,\n ...other\n } = props\n\n const handleRef = useForkRef(ref, (children as any).ref)\n const handleEnter: EnterHandler = (node, isAppearing) => {\n const transitionProps = getTransitionProps({ timeout }, { mode: 'enter' })\n // support for older versions of android browser and safari\n // https://caniuse.com/#feat=css-transitions\n node.style.webkitTransition = createTransition('opacity', transitionProps)\n node.style.transition = createTransition('opacity', transitionProps)\n\n if (onEnter) {\n onEnter(node, isAppearing)\n }\n }\n\n const handleExit: ExitHandler = node => {\n const transitionProps = getTransitionProps({ timeout }, { mode: 'exit' })\n node.style.webkitTransition = createTransition('opacity', transitionProps)\n node.style.transition = createTransition('opacity', transitionProps)\n\n if (onExit) {\n onExit(node)\n }\n }\n\n return (\n <Transition\n appear\n in={inProp}\n timeout={timeout}\n onExit={handleExit}\n onEnter={handleEnter}\n {...other}\n >\n {(state: TransitionStatus) => {\n return React.cloneElement(children, {\n ref: handleRef,\n style: {\n opacity: getOpacity(state),\n visibility: state === 'exited' && !inProp ? 'hidden' : undefined,\n ...children.props.style,\n },\n })\n }}\n </Transition>\n )\n})\n\nexport default Fade\n\n```" } ]
code_product-highlight-by-vtex-segment_ad66aee3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/docs/README.md from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n## ⚠️ Maintenance ⚠️\n*Starting September 1st 2022, this application will no longer be maintained by VTEX. Code is released for free under the GNU/PL Agreement for you to use and modify at your convenience. The VTEX repository shall remain unchanged with the original version.*\n\n---\n\n> 📢 Use this project, [contribute](https://github.com/vtex-apps/product-highlight-by-vtex-segment) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Product Highlight by VTEX Segment\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nThe **Product Highlight by VTEX Segment** app allows shoppers to select a Whitelabel Seller available in their region, and it filters the product listing results accordingly. The app also uses a badge to highlight products of Whitelabel Sellers that are available in the shopper's region.\n\n![Media Placeholder](https://user-images.githubusercontent.com/55905671/143295939-7d1b5625-5c57-46ad-a197-ef959db268de.gif)\n\n---\n\n## Before you start\n\nBefore configuring the **Product Highlight by VTEX Segment** app, make sure to create a collection for each Whitelabel Seller of your store (*See [Creating Collections Beta](https://help.vtex.com/en/tutorial/creating-collections-beta) for more information).* When naming your collection, make sure to use the following naming structure: `{sellerId}-{defaultCollectionName}`, where the `{sellerId}` is the `sellerId` of the Whitelabel Seller and `{defaultCollectionName}` is the name of the Collection.\n\n![Colection Name](https://user-images.githubusercontent.com/55905671/143301880-ee440d48-eced-4750-9cd2-ae3f3588a8e4.png)\n\n---\n\n## Configuration \n\nTo configure the **Product Highlight by VTEX Segment** app, you'll need to:\n1. Set up the default configurations of the **Product Highlight by VTEX Segment** app via the VTEX Admin.\n2. Add the **Product Highlight by VTEX Segment** to the store theme.\n\nBy the end of these steps, you'll have your store products highlighted according to the Whitelabel Seller selected.\n\n## Setting up the Product Highlights app\n\n1. Open the terminal and log in to the desired VTEX account using the [VTEX IO CLI](https://developers.vtex.com/vtex-developer-docs/docs/vtex-io-documentation-vtex-io-cli-installation-and-command-reference).\n2. Install the `vtexarg.product-highlight-by-vtex-segment` app on your account.\n ```sh\n vtex install vtexarg.product-highlight-by-vtex-segment\n ```\n3. Open the VTEX Admin.\n4. Go to **Account Settings > Apps > My apps**.\n5. Look for the **Product Highlight by VTEX Segment** app and click on **Settings**.\n\n ![Product Highlight by VTEX Segment](https://user-images.githubusercontent.com/55905671/143299640-21b00a57-64bc-467c-917b-34a16d44bc51.png)\n\n6. Fill in the presented fields as in the following:\n - **Default Seller Id** - Enter the default seller ID to use in cases the shopper's region is not detected (e.g., `jumboargentinav692lanus692`).\n - **Default Collection Name** - Enter the name of the collection corresponding to the default seller ID (e.g., `leyDeGondolas`). This is the `{defaultCollectionName}` part of the **Collection Name** (*See [Before you start](#before-you-start) for more information*).\n - **Image Url of Highlight** - Enter the URL of the ximage badge that will highlight the products. For example: ![Image Url of Highlight](https://user-images.githubusercontent.com/60782333/152064990-8990c5a7-3549-49c9-91b0-3bc3ad7604fb.png)\n7. Click on **Save**.\n\n### Adding the Product Highlights component to your store theme\n\n1. Open your store theme in any code editor of your choice.\n2. Open the `manifest.json` file and add the `vtexarg.product-highlight-by-vtex-segment` app as a peer dependency of your theme:\n ```diff\n \"peerDependencies\": {\n ...\n + \"vtexarg.product-highlight-by-vtex-segment\": \"0.x\"\n ...\n }\n ```\n3. Add the `product-highlight-by-vtex-segment` block to any child of the `store.product` template (Product Details Page template). For example:\n\n ```diff\n \"store.product\": {\n \"children\": [\n \"flex-layout.row#product-main\",\n ]\n },\n \"flex-layout.row#product-main\": {\n \"children\": [\n \"flex-layout.col#right-col\"\n ]\n },\n \"flex-layout.col#right-col\": {\n \"children\": [\n + \"product-highlight-by-vtex-segment\"\n ]\n }\n ```\n\nNow, see the [Customization](#customization) section to add custom styles to your component.\n\nAfter [linking your store theme app](https://developers.vtex.com/vtex-developer-docs/docs/vtex-io-documentation-linking-an-app) in a development workspace, you'll be able to select a Whitelabel Seller available in your region from a dropdown menu list. \n\n![Select Whitelabel Seller](https://user-images.githubusercontent.com/55905671/143302341-6ba9d940-185f-4c9a-98c5-cb158f285d03.png)\n\nYou'll then be able to see the chosen badge in the product cards of the selected Whitelabel Seller's collection.\n\n![Image Url of Highlight](https://user-images.githubusercontent.com/55905671/143302850-e8d39857-ffb6-49fc-b1cf-a7496733ac4c.png)\n\n## Customization\n\nTo apply CSS customizations in this and other blocks, follow the [Using CSS Handles for store customization](https://developers.vtex.com/vtex-developer-docs/docs/vtex-io-documentation-using-css-handles-for-store-customization) guide.\n\n| CSS Handles |\n| ----------- | \n| `productHighlightByVtexSegmentContainer` | \n| `imageOfHighlight` | \n\n---\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n<table>\n <tr>\n <td align=\"center\"><a href=\"https://github.com/germanBonacchi\"><img src=\"https://avatars.githubusercontent.com/u/55905671?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Germán Bonacchi</b></sub></a><br /><a href=\"https://github.com/vtex-apps/product-highlight-by-vtex-segment/commits?author=germanBonacchi\" title=\"Code\">💻</a></td>\n <td align=\"center\"><a href=\"https://github.com/arielabaruffaldi\"><img src=\"https://avatars.githubusercontent.com/u/36748003?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Ariela Baruffaldi</b></sub></a><br /><a href=\"https://github.com/vtex-apps/product-highlight-by-vtex-segment/commits?author=arielabaruffaldi\" title=\"Code\">💻</a></td>\n <td align=\"center\"><a href=\"https://github.com/GuidoSdo\"><img src=\"https://avatars.githubusercontent.com/u/33711188?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Guido Salcedo</b></sub></a><br /><a href=\"https://github.com/vtex-apps/product-highlight-by-vtex-segment/commits?author=GuidoSdo\" title=\"Code\">💻</a></td>\n </tr>\n</table>\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n<!-- DOCS-IGNORE:end -->\n\n```" } ]
code_product-highlight-by-vtex-segment_0ef30136
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/node/service.json from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"memory\": 512,\n \"ttl\": 10,\n \"timeout\": 6000,\n \"minReplicas\": 2,\n \"maxReplicas\": 4,\n \"workers\": 2\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_efb6045f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/node/package.json from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"@vtex/api\": \"6.45.6\",\n \"@vtex/clients\": \"^2.13.0\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^12.0.0\",\n \"@vtex/api\": \"6.45.6\",\n \"typescript\": \"3.9.7\"\n },\n \"resolutions\": {\n \"**/**/minimist\": \"^0.2.1\",\n \"**/**/lodash\": \"^4.17.17\"\n },\n \"version\": \"0.4.0\"\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_4fa55a28
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/node/globals.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type {\n IOContext,\n ParamsContext,\n RecorderState,\n SegmentData,\n ServiceContext,\n MessagesLoaderV2,\n} from '@vtex/api'\n\nimport type { Clients } from './clients'\n\ndeclare global {\n type Context = ServiceContext<Clients, State>\n\n interface State extends RecorderState {\n messagesTenantLanguage?: MessagesLoaderV2\n messagesBindingLanguage?: MessagesLoaderV2\n }\n\n interface StaleRevalidateData<T> {\n ttl: Date\n data: T\n }\n\n interface CustomContext extends ParamsContext {\n cookie: string\n originalPath: string\n vtex: CustomIOContext\n }\n\n interface CustomIOContext extends IOContext {\n segment?: SegmentData\n }\n\n interface Property {\n name: string\n values: [string]\n }\n\n interface TranslatableMessage {\n content: string\n from: string\n id: string\n }\n\n interface Reference {\n Key: string\n Value: string\n }\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_8c17776f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/node/index.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { RecorderState } from '@vtex/api'\nimport { LRUCache, Service } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { resolvers } from './resolvers'\n\nconst TIMEOUT_MS = 800\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst memoryCache = new LRUCache<string, any>({ max: 20 })\n\nmetrics.trackCache('status', memoryCache)\n\nexport default new Service<Clients, RecorderState, Context>({\n clients: {\n implementation: Clients,\n options: {\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n },\n status: {\n memoryCache,\n },\n },\n },\n graphql: {\n resolvers,\n },\n})\n\n```" } ]
code_product-highlight-by-vtex-segment_945cdcc5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/react/package.json from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"@vtex/css-handles\": \"^1.0.0\",\n \"atob\": \"^2.1.2\",\n \"react\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\",\n \"react-apollo\": \"^3.1.5\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^24.0.18\",\n \"@types/prop-types\": \"^15.7.0\",\n \"@types/react\": \"^16.9.31\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"typescript\": \"3.9.7\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles\"\n },\n \"version\": \"0.2.1\"\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_c0f28120
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/react/ProductHighlight.tsx from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useProduct } from 'vtex.product-context'\nimport { useCssHandles } from 'vtex.css-handles'\nimport atob from 'atob'\n\nimport useAppSettings from './hooks/useAppSettings'\nimport type { Collection, Runtime } from './typings/global'\n\ndeclare let window: {\n __RUNTIME__: Runtime\n}\n\nconst ProductHighligh: StorefrontFunctionComponent = () => {\n const { product } = useProduct()\n\n if (!product) {\n return null\n }\n\n const { appSettings: appInfo } = useAppSettings()\n\n const collections: Collection[] = product.productClusters\n\n const segmentToken = window?.__RUNTIME__?.segmentToken\n const segmentTokenInfo = JSON.parse(atob(segmentToken))\n const { regionId } = segmentTokenInfo\n let sellerIds: string[]\n\n if (regionId) {\n const regionIdInfo = atob(regionId)\n\n sellerIds = regionIdInfo.split('SW#')[1].split(';')\n } else {\n sellerIds = appInfo?.defaultSellerId ? [appInfo?.defaultSellerId] : []\n }\n\n const defaultNameCollection = appInfo?.defaultNameCollection\n ? appInfo?.defaultNameCollection\n : ''\n\n const productFromCollection: boolean[] = []\n\n sellerIds?.forEach((seller: string) => {\n productFromCollection.push(\n collections.some(\n (collection: Collection) =>\n collection.name.trim() === `${seller}-${defaultNameCollection}`\n )\n )\n })\n\n const imageUrlOfHighlight = appInfo?.imageUrlOfHighlight\n ? [appInfo?.imageUrlOfHighlight]\n : ''\n\n const CSS_HANDLES = [\n 'productHighlightByVtexSegmentContainer',\n 'imageOfHighlight',\n ]\n\n const handles = useCssHandles(CSS_HANDLES)\n\n if (productFromCollection.some((p) => p === true)) {\n const keyDiv = `${product.productId}-productHighlightByVtexSegment`\n\n return (\n <div\n key={keyDiv}\n id={keyDiv}\n className={`${handles.productHighlightByVtexSegmentContainer} t-body mh1 mv2`}\n >\n <img\n className={`${handles.imageOfHighlight}`}\n src={`${imageUrlOfHighlight}`}\n alt=\"imageUrlOfHighlight\"\n />\n </div>\n )\n }\n\n return null\n}\n\nexport default ProductHighligh\n\n```" } ]
code_product-highlight-by-vtex-segment_943681b7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/store/interfaces.json from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"product-highlight-by-vtex-segment\": {\n \"component\": \"ProductHighlight\"\n }\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_86019b0b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/public/metadata/messages/es-AR.json from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Product Highlight by Vtex Segment\",\n \"headline\": \"¡Vea highlights por cada Whitelabel Seller!\",\n \"overview\": \"La aplicación de Product Highlight en arquitectura Whitelabel dependiendo de la región seleccionada y de colecciones creadas por cada seller, te permitirá colocar un Highlight a cada producto de la colección.\",\n \"features\": [\n \"Highlights en la Página de Producto (PDP) para cada producto en una colleción\",\n \"Highlights en la Página de Listado de Producto (PLP) para cada producto en una colleción\",\n \"Arquitectura Whitelabel Seller\"\n ],\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_9c740b41
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/public/metadata/messages/pt-BR.json from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Product Highlight by Vtex Segment\",\n \"headline\": \"Veja os destaques de cada Whitelabel Seller!\",\n \"overview\": \"O aplicativo Product Highlight na arquitetura Whitelabel permite, dependendo da região e das coleções criadas para cada vendedor, mostrar um Highlight em cada produto da coleção.\",\n \"features\": [\n \"Destaques na Página do Produto (PDP) para cada produto em uma coleção\",\n \"Destaques na Página de Listagem de Produtos (PLP) para cada produto em uma coleção\",\n \"Arquitetura Whitelabel Seller\"\n ],\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_68481b63
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/public/metadata/messages/en-US.json from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Product Highlight by Vtex Segment\",\n \"headline\": \"See highlights for each Whitelabel Seller!\",\n \"overview\": \"The Product Highlight app in Whitelabel architecture allows depending on the region and collections created for each sellers show a Highlight on each product in the collection.\",\n \"features\": [\n \"Highlights on Product Page (PDP) for each product in a collection\",\n \"Highlights on Product Listing Page (PLP) for each product in a collection\",\n \"Whitelabel Seller architecture\"\n ],\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_7f1cf65d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/graphql/types/appSettings.graphql from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\ntype AppSettingsResponse {\n defaultSellerId: String\n defaultNameCollection: String\n imageUrlOfHighlight: String\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_f3ebcea1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/node/clients/index.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {}\n\n```" } ]
code_product-highlight-by-vtex-segment_8cbb044d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/node/resolvers/index.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { queries as appSettingsQueries } from './appSettings'\n\nexport const resolvers = {\n Query: {\n ...appSettingsQueries,\n },\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_35ebcf8f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/node/resolvers/appSettings/index.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const queries = {\n appSettings: async (_: unknown, __: unknown, ctx: Context) => {\n const appId = process.env.VTEX_APP_ID ? process.env.VTEX_APP_ID : ''\n const { defaultSellerId, defaultNameCollection, imageUrlOfHighlight } =\n await ctx.clients.apps.getAppSettings(appId)\n\n return { defaultSellerId, defaultNameCollection, imageUrlOfHighlight }\n },\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_438f79c3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/react/typings/storefront.d.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { FunctionComponent } from 'react'\n\ndeclare global {\n interface StorefrontFunctionComponent<P = GenericObject>\n extends FunctionComponent<P> {\n getSchema?(props: P): GenericObject\n schema?: GenericObject\n }\n\n interface StorefrontComponent<P = GenericObject, S = GenericObject>\n extends Component<P, S> {\n getSchema?(props: P): GenericObject\n schema: GenericObject\n }\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_8f63fac3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/react/typings/gql.d.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.gql' {\n import type { DocumentNode } from 'graphql'\n\n const Schema: DocumentNode\n\n export default Schema\n}\n\ndeclare module '*.graphql' {\n import type { DocumentNode } from 'graphql'\n\n const schema: DocumentNode\n\n export default Schema\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_ac849413
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/react/typings/global.d.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport interface Runtime {\n segmentToken: string\n}\n\nexport interface Collection {\n id: string\n name: string\n}\n\nexport interface AppInfo {\n defaultSellerId: string\n defaultNameCollection: string\n imageUrlOfHighlight: string\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_230e78f2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/react/typings/css.d.ts from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/no-explicit-any */\ndeclare module '*.css' {\n const css: any\n export default css\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_8a1c86f9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/react/graphql/appSettings.gql from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery appSettings{\n appSettings{\n defaultSellerId\n defaultNameCollection\n imageUrlOfHighlight\n }\n}\n\n```" } ]
code_product-highlight-by-vtex-segment_a5fd865e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-highlight-by-vtex-segment/react/hooks/useAppSettings.tsx from the product-highlight-by-vtex-segment VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { useState, useEffect } from 'react'\nimport { useLazyQuery } from 'react-apollo'\n\nimport GetAppSettings from '../graphql/appSettings.gql'\nimport type { AppInfo } from '../typings/global'\n\nconst useAppSettings = () => {\n const [appSettings, setAppSettings] = useState<AppInfo>()\n\n const [getContent, { data, loading, error }] = useLazyQuery(GetAppSettings, {\n notifyOnNetworkStatusChange: true,\n ssr: false,\n })\n\n useEffect(() => {\n getContent()\n }, [])\n\n useEffect(() => {\n if (!loading && !error && data) {\n setAppSettings(data.appSettings)\n }\n }, [data, loading, error])\n\n return { appSettings, loading, error }\n}\n\nexport default useAppSettings\n\n```" } ]
code_avatax-br-admin_3f51b2b3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/messages/pt.json from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"avatax-admin.navigation.label\": \"Avatax Br\",\n \"avatax-admin.info\": \"Informações\",\n \"avatax-admin.place\": \"Localidade\",\n \"avatax-admin.authentication\": \"Parâmetros de autenticação:\",\n \"avatax-admin.client.id\": \"Insira seu Client ID\",\n \"avatax-admin.client.secret\": \"Insira seu Client Secret\",\n \"avatax-admin.change\": \"Alterar valores\",\n \"avatax-admin.save\": \"Salvar\",\n \"avatax-admin.id\": \"ID\",\n \"avatax-admin.dock.name\": \"Estoque\",\n \"avatax-admin.edit\": \"Editar\",\n \"avatax-admin.delete\": \"Deletar\",\n \"avatax-admin.loading\": \"Carregando...\",\n \"avatax-admin.data\": \"Dados salvos\",\n \"avatax-admin.cancel\": \"Cancelar\",\n \"avatax-admin.edit.stock\": \"Editar Estoque\",\n \"avatax-admin.verify\": \"Verificar Ping: \",\n \"avatax-admin.verify.true\": \"Verificado\",\n \"avatax-admin.verify.false\": \"Falhou\",\n \"avatax-admin.verify.button\": \"Verificar Ping\",\n \"avatax-admin.environment\": \"Ambiente: \",\n \"avatax-admin.sandbox\": \"Sandbox\",\n \"avatax-admin.production\": \"Produção\",\n \"avatax-admin.use.sandbox\": \"Usar ambiente sandbox\",\n \"avatax-admin.status\": \"Status do conector da Avalara: \",\n \"avatax-admin.activate\": \"Ativado\",\n \"avatax-admin.deactivate\": \"Desativado\",\n \"avatax-admin.add\": \"Adicionar\",\n \"avatax-admin.data.save\": \"Dados salvos!\",\n \"avatax-admin.number\": \"Deve conter somente números\",\n \"avatax-admin.cnpj\": \"CNPJ inválido\",\n \"avatax-admin.zipcode\": \"CEP deve conter 8 caracteres\",\n \"avatax-admin.cnpj.length\": \"CNPJ deve conter 14 caracteres\",\n \"avatax-admin.empty\": \"Preencha o campo obrigatório\",\n \"avatax-admin.avatax\": \"Avatax\",\n \"avatax-admin.avalara\": \"Configuração Avalara\",\n \"avatax-admin.configuration\": \"Configuração\",\n \"avatax-admin.add.stock\": \"Adicionar estoque\",\n \"avatax-admin.fields\": \"campos obrigatórios*\",\n \"avatax-admin.current.stock\": \"Estoques atuais\",\n \"avatax-admin.dock.id.placeholder\": \"Inserir ID da doca\",\n \"avatax-admin.dock.id.label\": \"Doca ID\",\n \"avatax-admin.dock.name.placeholder\": \"Inserir nome da doca\",\n \"avatax-admin.dock.name.label\": \"Nome da doca\",\n \"avatax-admin.icms.label\": \"Contribuinte de ICMS\",\n \"avatax-admin.icms.option.true\": \"Sim\",\n \"avatax-admin.icms.option.false\": \"Não\",\n \"avatax-admin.activity.label\": \"Setor de atividade\",\n \"avatax-admin.activity.security\": \"Agência Pública de Segurança Brasileira\",\n \"avatax-admin.activity.wholesale\": \"Atacado\",\n \"avatax-admin.activity.warehouse.general\": \"Armazem Geral\",\n \"avatax-admin.activity.audiovisual\": \"Audiovisual\",\n \"avatax-admin.activity.distribution\": \"Centro de Distribuição\",\n \"avatax-admin.activity.construction\": \"Construção Civil\",\n \"avatax-admin.activity.consumer\": \"Consumidor Final\",\n \"avatax-admin.activity.coops\": \"Cooperativa\",\n \"avatax-admin.activity.farm.coop\": \"Cooperativa de Produtores\",\n \"avatax-admin.activity.warehouse.bonded\": \"Depósito Alfandegado\",\n \"avatax-admin.activity.warehouse.stock\": \"Depósito Fechado\",\n \"avatax-admin.activity.distributor\": \"Distribuidor\",\n \"avatax-admin.activity.distributor.water\": \"Distribuidor de Água\",\n \"avatax-admin.activity.distributor.fuel\": \"Distribuidor de Combustível\",\n \"avatax-admin.activity.distributor.eletricity\": \"Distribuidor de Energia Elétrica\",\n \"avatax-admin.activity.distributor.pharma\": \"Distribuidor de Medicamento\",\n \"avatax-admin.activity.entity\": \"Entidades sem Fins Lucrativos\",\n \"avatax-admin.activity.extractor\": \"Extrator\",\n \"avatax-admin.activity.armed\": \"Forças Armadas\",\n \"avatax-admin.activity.meal\": \"Fornecedor de Refeição\",\n \"avatax-admin.activity.generation\": \"Gerador e Produtor De Energia Elétrica\",\n \"avatax-admin.activity.importer\": \"Importadora\",\n \"avatax-admin.activity.industry\": \"Industria\",\n \"avatax-admin.activity.film\": \"Indústria Cinematográfica\",\n \"avatax-admin.activity.itaipu\": \"Itaipu Binacional\",\n \"avatax-admin.activity.auctioneer\": \"Leiloeiro\",\n \"avatax-admin.activity.agency\": \"Orgão Publico\",\n \"avatax-admin.activity.rural\": \"Produtor Rural\",\n \"avatax-admin.activity.broadcasting\": \"Radiodifusão\",\n \"avatax-admin.activity.service\": \"Serviço\",\n \"avatax-admin.activity.telco\": \"Serviço de Comunicação\",\n \"avatax-admin.activity.maritime\": \"Serviço Marítimo\",\n \"avatax-admin.activity.religious\": \"Templos de Qualquer Culto\",\n \"avatax-admin.activity.transporter\": \"Transportador/Serviço de Transportadora\",\n \"avatax-admin.activity.retail\": \"Varejo\",\n \"avatax-admin.tax.regime.label\": \"Regime de Tributação\",\n \"avatax-admin.tax.regime.individual\": \"Indivíduo\",\n \"avatax-admin.tax.regime.profit.estimated\": \"Lucro Presumido\",\n \"avatax-admin.tax.regime.profit.real\": \"Lucro Real\",\n \"avatax-admin.tax.regime.simplified\": \"Optante do SIMPLES\",\n \"avatax-admin.tax.regime.simplified.grossthreshold\": \"Optante do SIMPLES com limite de faturamento bruto\",\n \"avatax-admin.tax.regime.simplified.entrepreneur\": \"Micro Empreendedor Individual\",\n \"avatax-admin.tax.regime.not.applicable\": \"Não Aplicável\",\n \"avatax-admin.entity.type.label\": \"Tipo de entidade\",\n \"avatax-admin.entity.type.mixed.capital\": \"Capital misto\",\n \"avatax-admin.entity.type.government\": \"Estado Governamental\",\n \"avatax-admin.entity.type.foreign\": \"Estrangeiro\",\n \"avatax-admin.entity.type.federal\": \"Governo Federal\",\n \"avatax-admin.entity.type.individual\": \"Individual\",\n \"avatax-admin.entity.type.city\": \"Prefeitura\",\n \"avatax-admin.entity.type.business\": \"Negócio\",\n \"avatax-admin.state.tax.id.placeholder\": \"Inserir Identificação fiscal estadual\",\n \"avatax-admin.state.tax.id.label\": \"Inscrição Estadual\",\n \"avatax-admin.street.placeholder\": \"Inserir rua\",\n \"avatax-admin.street.label\": \"Rua\",\n \"avatax-admin.neighborhood.placeholder\": \"Inserir bairro\",\n \"avatax-admin.neighborhood.label\": \"Bairro\",\n \"avatax-admin.zipCode.placeholder\": \"Inserir CEP\",\n \"avatax-admin.zipCode.label\": \"CEP\",\n \"avatax-admin.city.placeholder\": \"Inserir cidade\",\n \"avatax-admin.city.label\": \"Cidade\",\n \"avatax-admin.state.placeholder\": \"Inserir estado\",\n \"avatax-admin.state.label\": \"Estado\",\n \"avatax-admin.street.number.placeholder\": \"Inserir número\",\n \"avatax-admin.street.number.label\": \"Número\",\n \"avatax-admin.complement.placeholder\": \"Inserir complemento\",\n \"avatax-admin.complement.label\": \"Complemento\",\n \"avatax-admin.phone.placeholder\": \"Inserir telefone\",\n \"avatax-admin.phone.label\": \"Telefone\",\n \"avatax-admin.cnpj.placeholder\": \"Inserir CNPJ\",\n \"avatax-admin.cnpj.label\": \"CNPJ\",\n \"avatax-admin.suframa.placeholder\": \"Inserir código suframa (Se existir)\",\n \"avatax-admin.suframa.label\": \"Suframa\",\n \"avatax-admin.logs-caption\": \"Aqui você encontra todos os resultados dos cálculos de impostos efetuados\",\n \"avatax-admin.logs-details-caption\": \"Resultado do Cálculo:\",\n \"avatax-admin.logs-refresh-button\": \"Atualizar\",\n \"avatax-admin.logs-no-result\": \"Nenhum resultado encontrado.\",\n \"avatax-admin.logs-order-input-placeholder\": \"Número do Pedido...\",\n \"avatax-admin.logs-table-fields-caption\": \"Alterar colunas visíveis\",\n \"avatax-admin.logs-table-show-all\": \"Exibir tudo\",\n \"avatax-admin.logs-table-hide-all\": \"Ocultar tudo\",\n \"avatax-admin.logs-download-button\": \"Exportar Logs\",\n \"avatax-admin.logs-details-button\": \"Mais Detalhes\",\n \"avatax-admin.logs-download-request-button\": \"Baixar Request\",\n \"avatax-admin.logs-table-show-rows\": \"Mostrar linhas\",\n \"avatax-admin.logs-table-rows-of\": \"de\",\n \"avatax-admin.logs-schema-details\": \"Detalhes\",\n \"avatax-admin.logs-schema-createdIn\": \"Data/Hora ↓\",\n \"avatax-admin.logs-schema-client\": \"Cliente\",\n \"avatax-admin.logs-schema-dockName\": \"Doca\",\n \"avatax-admin.logs-schema-city\": \"Cidade\",\n \"avatax-admin.logs-schema-state\": \"Estado\",\n \"avatax-admin.logs-schema-activitySector\": \"Setor de Atividade\",\n \"avatax-admin.logs-schema-numberOfProducts\": \"Produtos\",\n \"avatax-admin.logs-schema-productsTotal\": \"Valor Prod.\",\n \"avatax-admin.logs-schema-freightTotal\": \"Valor Frete\",\n \"avatax-admin.logs-schema-includedTaxes\": \"Impostos Inclusos\",\n \"avatax-admin.logs-schema-includedTaxesTotal\": \"Total Inclusos\",\n \"avatax-admin.logs-schema-addedTaxes\": \"Impostos Destacados\",\n \"avatax-admin.logs-schema-addedTaxesTotal\": \"Total Destacados\"\n}\n\n```" } ]
code_avatax-br-admin_7bbb141b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/messages/en.json from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"avatax-admin.navigation.label\": \"Avatax Br\",\n \"avatax-admin.info\": \"Informações\",\n \"avatax-admin.place\": \"Localidade\",\n \"avatax-admin.authentication\": \"Parâmetros de autenticação:\",\n \"avatax-admin.client.id\": \"Insira seu Client ID\",\n \"avatax-admin.client.secret\": \"Insira seu Client Secret\",\n \"avatax-admin.change\": \"Alterar valores\",\n \"avatax-admin.save\": \"Salvar\",\n \"avatax-admin.id\": \"ID\",\n \"avatax-admin.dock.name\": \"Estoque\",\n \"avatax-admin.edit\": \"Editar\",\n \"avatax-admin.delete\": \"Deletar\",\n \"avatax-admin.loading\": \"Carregando...\",\n \"avatax-admin.data\": \"Dados salvos\",\n \"avatax-admin.cancel\": \"Cancelar\",\n \"avatax-admin.edit.stock\": \"Editar Estoque\",\n \"avatax-admin.verify\": \"Verificar Ping: \",\n \"avatax-admin.verify.true\": \"Verificado\",\n \"avatax-admin.verify.false\": \"Falhou\",\n \"avatax-admin.verify.button\": \"Verificar Ping\",\n \"avatax-admin.environment\": \"Ambiente: \",\n \"avatax-admin.sandbox\": \"Sandbox\",\n \"avatax-admin.production\": \"Produção\",\n \"avatax-admin.use.sandbox\": \"Usar ambiente sandbox\",\n \"avatax-admin.status\": \"Status do conector da Avalara: \",\n \"avatax-admin.activate\": \"Ativado\",\n \"avatax-admin.deactivate\": \"Desativado\",\n \"avatax-admin.add\": \"Adicionar\",\n \"avatax-admin.data.save\": \"Dados salvos!\",\n \"avatax-admin.number\": \"Deve conter somente números\",\n \"avatax-admin.cnpj\": \"CNPJ inválido\",\n \"avatax-admin.zipcode\": \"CEP deve conter 8 caracteres\",\n \"avatax-admin.cnpj.length\": \"CNPJ deve conter 14 caracteres\",\n \"avatax-admin.empty\": \"Preencha o campo obrigatório\",\n \"avatax-admin.avatax\": \"Avatax\",\n \"avatax-admin.avalara\": \"Configuração Avalara\",\n \"avatax-admin.configuration\": \"Configuração\",\n \"avatax-admin.add.stock\": \"Adicionar estoque\",\n \"avatax-admin.fields\": \"campos obrigatórios*\",\n \"avatax-admin.current.stock\": \"Estoques atuais\",\n \"avatax-admin.dock.id.placeholder\": \"Inserir ID da doca\",\n \"avatax-admin.dock.id.label\": \"Doca ID\",\n \"avatax-admin.dock.name.placeholder\": \"Inserir nome da doca\",\n \"avatax-admin.dock.name.label\": \"Nome da doca\",\n \"avatax-admin.icms.label\": \"Contribuinte de ICMS\",\n \"avatax-admin.icms.option.true\": \"Sim\",\n \"avatax-admin.icms.option.false\": \"Não\",\n \"avatax-admin.activity.label\": \"Setor de atividade\",\n \"avatax-admin.activity.security\": \"Agência Pública de Segurança Brasileira\",\n \"avatax-admin.activity.wholesale\": \"Atacado\",\n \"avatax-admin.activity.warehouse.general\": \"Armazem Geral\",\n \"avatax-admin.activity.audiovisual\": \"Audiovisual\",\n \"avatax-admin.activity.distribution\": \"Centro de Distribuição\",\n \"avatax-admin.activity.construction\": \"Construção Civil\",\n \"avatax-admin.activity.consumer\": \"Consumidor Final\",\n \"avatax-admin.activity.coops\": \"Cooperativa\",\n \"avatax-admin.activity.farm.coop\": \"Cooperativa de Produtores\",\n \"avatax-admin.activity.warehouse.bonded\": \"Depósito Alfandegado\",\n \"avatax-admin.activity.warehouse.stock\": \"Depósito Fechado\",\n \"avatax-admin.activity.distributor\": \"Distribuidor\",\n \"avatax-admin.activity.distributor.water\": \"Distribuidor de Água\",\n \"avatax-admin.activity.distributor.fuel\": \"Distribuidor de Combustível\",\n \"avatax-admin.activity.distributor.eletricity\": \"Distribuidor de Energia Elétrica\",\n \"avatax-admin.activity.distributor.pharma\": \"Distribuidor de Medicamento\",\n \"avatax-admin.activity.entity\": \"Entidades sem Fins Lucrativos\",\n \"avatax-admin.activity.extractor\": \"Extrator\",\n \"avatax-admin.activity.armed\": \"Forças Armadas\",\n \"avatax-admin.activity.meal\": \"Fornecedor de Refeição\",\n \"avatax-admin.activity.generation\": \"Gerador e Produtor De Energia Elétrica\",\n \"avatax-admin.activity.importer\": \"Importadora\",\n \"avatax-admin.activity.industry\": \"Industria\",\n \"avatax-admin.activity.film\": \"Indústria Cinematográfica\",\n \"avatax-admin.activity.itaipu\": \"Itaipu Binacional\",\n \"avatax-admin.activity.auctioneer\": \"Leiloeiro\",\n \"avatax-admin.activity.agency\": \"Orgão Publico\",\n \"avatax-admin.activity.rural\": \"Produtor Rural\",\n \"avatax-admin.activity.broadcasting\": \"Radiodifusão\",\n \"avatax-admin.activity.service\": \"Serviço\",\n \"avatax-admin.activity.telco\": \"Serviço de Comunicação\",\n \"avatax-admin.activity.maritime\": \"Serviço Marítimo\",\n \"avatax-admin.activity.religious\": \"Templos de Qualquer Culto\",\n \"avatax-admin.activity.transporter\": \"Transportador/Serviço de Transportadora\",\n \"avatax-admin.activity.retail\": \"Varejo\",\n \"avatax-admin.tax.regime.label\": \"Regime Tributário Federal\",\n \"avatax-admin.tax.regime.individual\": \"Indivíduo\",\n \"avatax-admin.tax.regime.profit.estimated\": \"Lucro Presumido\",\n \"avatax-admin.tax.regime.profit.real\": \"Lucro Real\",\n \"avatax-admin.tax.regime.simplified\": \"Optante do SIMPLES\",\n \"avatax-admin.tax.regime.simplified.grossthreshold\": \"Optante do SIMPLES com limite de faturamento bruto\",\n \"avatax-admin.tax.regime.simplified.entrepreneur\": \"Micro Empreendedor Individual\",\n \"avatax-admin.tax.regime.not.applicable\": \"Não Aplicável\",\n \"avatax-admin.entity.type.label\": \"Tipo de entidade\",\n \"avatax-admin.entity.type.mixed.capital\": \"Capital misto\",\n \"avatax-admin.entity.type.government\": \"Estado Governamental\",\n \"avatax-admin.entity.type.foreign\": \"Estrangeiro\",\n \"avatax-admin.entity.type.federal\": \"Governo Federal\",\n \"avatax-admin.entity.type.individual\": \"Individual\",\n \"avatax-admin.entity.type.city\": \"Prefeitura\",\n \"avatax-admin.entity.type.business\": \"Negócio\",\n \"avatax-admin.state.tax.id.placeholder\": \"Inserir Identificação fiscal estadual\",\n \"avatax-admin.state.tax.id.label\": \"Inscrição Estadual\",\n \"avatax-admin.street.placeholder\": \"Inserir rua\",\n \"avatax-admin.street.label\": \"Rua\",\n \"avatax-admin.neighborhood.placeholder\": \"Inserir bairro\",\n \"avatax-admin.neighborhood.label\": \"Bairro\",\n \"avatax-admin.zipCode.placeholder\": \"Inserir CEP\",\n \"avatax-admin.zipCode.label\": \"CEP\",\n \"avatax-admin.city.placeholder\": \"Inserir cidade\",\n \"avatax-admin.city.label\": \"Cidade\",\n \"avatax-admin.state.placeholder\": \"Inserir estado\",\n \"avatax-admin.state.label\": \"Estado\",\n \"avatax-admin.street.number.placeholder\": \"Inserir número\",\n \"avatax-admin.street.number.label\": \"Número\",\n \"avatax-admin.complement.placeholder\": \"Inserir complemento\",\n \"avatax-admin.complement.label\": \"Complemento\",\n \"avatax-admin.phone.placeholder\": \"Inserir telefone\",\n \"avatax-admin.phone.label\": \"Telefone\",\n \"avatax-admin.cnpj.placeholder\": \"Inserir CNPJ\",\n \"avatax-admin.cnpj.label\": \"CNPJ\",\n \"avatax-admin.suframa.placeholder\": \"Inserir código suframa (Se existir)\",\n \"avatax-admin.suframa.label\": \"Suframa\",\n \"avatax-admin.logs-caption\": \"Aqui você encontra todos os resultados dos cálculos de impostos efetuados\",\n \"avatax-admin.logs-details-caption\": \"Resultado do Cálculo:\",\n \"avatax-admin.logs-refresh-button\": \"Atualizar\",\n \"avatax-admin.logs-no-result\": \"Nenhum resultado encontrado.\",\n \"avatax-admin.logs-order-input-placeholder\": \"Número do Pedido...\",\n \"avatax-admin.logs-table-fields-caption\": \"Alterar colunas visíveis\",\n \"avatax-admin.logs-table-show-all\": \"Exibir tudo\",\n \"avatax-admin.logs-table-hide-all\": \"Ocultar tudo\",\n \"avatax-admin.logs-download-button\": \"Exportar Logs\",\n \"avatax-admin.logs-details-button\": \"Mais Detalhes\",\n \"avatax-admin.logs-download-request-button\": \"Baixar Request\",\n \"avatax-admin.logs-table-show-rows\": \"Mostrar linhas\",\n \"avatax-admin.logs-table-rows-of\": \"de\",\n \"avatax-admin.logs-schema-details\": \"Detalhes\",\n \"avatax-admin.logs-schema-createdIn\": \"Data/Hora ↓\",\n \"avatax-admin.logs-schema-client\": \"Cliente\",\n \"avatax-admin.logs-schema-dockName\": \"Doca\",\n \"avatax-admin.logs-schema-city\": \"Cidade\",\n \"avatax-admin.logs-schema-state\": \"Estado\",\n \"avatax-admin.logs-schema-activitySector\": \"Setor de Atividade\",\n \"avatax-admin.logs-schema-numberOfProducts\": \"Produtos\",\n \"avatax-admin.logs-schema-productsTotal\": \"Valor Prod.\",\n \"avatax-admin.logs-schema-freightTotal\": \"Valor Frete\",\n \"avatax-admin.logs-schema-includedTaxes\": \"Impostos Inclusos\",\n \"avatax-admin.logs-schema-includedTaxesTotal\": \"Total Inclusos\",\n \"avatax-admin.logs-schema-addedTaxes\": \"Impostos Destacados\",\n \"avatax-admin.logs-schema-addedTaxesTotal\": \"Total Destacados\"\n}\n\n```" } ]
code_avatax-br-admin_5100b3ab
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/messages/es.json from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"avatax-admin.navigation.label\": \"Avatax Br\",\n \"avatax-admin.info\": \"Informações\",\n \"avatax-admin.place\": \"Localidade\",\n \"avatax-admin.authentication\": \"Parâmetros de autenticação:\",\n \"avatax-admin.client.id\": \"Insira seu Client ID\",\n \"avatax-admin.client.secret\": \"Insira seu Client Secret\",\n \"avatax-admin.change\": \"Alterar valores\",\n \"avatax-admin.save\": \"Salvar\",\n \"avatax-admin.id\": \"ID\",\n \"avatax-admin.dock.name\": \"Estoque\",\n \"avatax-admin.edit\": \"Editar\",\n \"avatax-admin.delete\": \"Deletar\",\n \"avatax-admin.loading\": \"Carregando...\",\n \"avatax-admin.data\": \"Dados salvos\",\n \"avatax-admin.cancel\": \"Cancelar\",\n \"avatax-admin.edit.stock\": \"Editar Estoque\",\n \"avatax-admin.verify\": \"Verificar Ping: \",\n \"avatax-admin.verify.true\": \"Verificado\",\n \"avatax-admin.verify.false\": \"Falhou\",\n \"avatax-admin.verify.button\": \"Verificar Ping\",\n \"avatax-admin.environment\": \"Ambiente: \",\n \"avatax-admin.sandbox\": \"Sandbox\",\n \"avatax-admin.production\": \"Produção\",\n \"avatax-admin.use.sandbox\": \"Usar ambiente sandbox\",\n \"avatax-admin.status\": \"Status do conector da Avalara: \",\n \"avatax-admin.activate\": \"Ativado\",\n \"avatax-admin.deactivate\": \"Desativado\",\n \"avatax-admin.add\": \"Adicionar\",\n \"avatax-admin.data.save\": \"Dados salvos!\",\n \"avatax-admin.number\": \"Deve conter somente números\",\n \"avatax-admin.cnpj\": \"CNPJ inválido\",\n \"avatax-admin.zipcode\": \"CEP deve conter 8 caracteres\",\n \"avatax-admin.cnpj.length\": \"CNPJ deve conter 14 caracteres\",\n \"avatax-admin.empty\": \"Preencha o campo obrigatório\",\n \"avatax-admin.avatax\": \"Avatax\",\n \"avatax-admin.avalara\": \"Configuração Avalara\",\n \"avatax-admin.configuration\": \"Configuração\",\n \"avatax-admin.add.stock\": \"Adicionar estoque\",\n \"avatax-admin.fields\": \"campos obrigatórios*\",\n \"avatax-admin.current.stock\": \"Estoques atuais\",\n \"avatax-admin.dock.id.placeholder\": \"Inserir ID da doca\",\n \"avatax-admin.dock.id.label\": \"Doca ID\",\n \"avatax-admin.dock.name.placeholder\": \"Inserir nome da doca\",\n \"avatax-admin.dock.name.label\": \"Nome da doca\",\n \"avatax-admin.icms.label\": \"Contribuinte de ICMS\",\n \"avatax-admin.icms.option.true\": \"Sim\",\n \"avatax-admin.icms.option.false\": \"Não\",\n \"avatax-admin.activity.label\": \"Setor de atividade\",\n \"avatax-admin.activity.security\": \"Agência Pública de Segurança Brasileira\",\n \"avatax-admin.activity.wholesale\": \"Atacado\",\n \"avatax-admin.activity.warehouse.general\": \"Armazem Geral\",\n \"avatax-admin.activity.audiovisual\": \"Audiovisual\",\n \"avatax-admin.activity.distribution\": \"Centro de Distribuição\",\n \"avatax-admin.activity.construction\": \"Construção Civil\",\n \"avatax-admin.activity.consumer\": \"Consumidor Final\",\n \"avatax-admin.activity.coops\": \"Cooperativa\",\n \"avatax-admin.activity.farm.coop\": \"Cooperativa de Produtores\",\n \"avatax-admin.activity.warehouse.bonded\": \"Depósito Alfandegado\",\n \"avatax-admin.activity.warehouse.stock\": \"Depósito Fechado\",\n \"avatax-admin.activity.distributor\": \"Distribuidor\",\n \"avatax-admin.activity.distributor.water\": \"Distribuidor de Água\",\n \"avatax-admin.activity.distributor.fuel\": \"Distribuidor de Combustível\",\n \"avatax-admin.activity.distributor.eletricity\": \"Distribuidor de Energia Elétrica\",\n \"avatax-admin.activity.distributor.pharma\": \"Distribuidor de Medicamento\",\n \"avatax-admin.activity.entity\": \"Entidades sem Fins Lucrativos\",\n \"avatax-admin.activity.extractor\": \"Extrator\",\n \"avatax-admin.activity.armed\": \"Forças Armadas\",\n \"avatax-admin.activity.meal\": \"Fornecedor de Refeição\",\n \"avatax-admin.activity.generation\": \"Gerador e Produtor De Energia Elétrica\",\n \"avatax-admin.activity.importer\": \"Importadora\",\n \"avatax-admin.activity.industry\": \"Industria\",\n \"avatax-admin.activity.film\": \"Indústria Cinematográfica\",\n \"avatax-admin.activity.itaipu\": \"Itaipu Binacional\",\n \"avatax-admin.activity.auctioneer\": \"Leiloeiro\",\n \"avatax-admin.activity.agency\": \"Orgão Publico\",\n \"avatax-admin.activity.rural\": \"Produtor Rural\",\n \"avatax-admin.activity.broadcasting\": \"Radiodifusão\",\n \"avatax-admin.activity.service\": \"Serviço\",\n \"avatax-admin.activity.telco\": \"Serviço de Comunicação\",\n \"avatax-admin.activity.maritime\": \"Serviço Marítimo\",\n \"avatax-admin.activity.religious\": \"Templos de Qualquer Culto\",\n \"avatax-admin.activity.transporter\": \"Transportador/Serviço de Transportadora\",\n \"avatax-admin.activity.retail\": \"Varejo\",\n \"avatax-admin.tax.regime.label\": \"Regime Tributário Federal\",\n \"avatax-admin.tax.regime.individual\": \"Indivíduo\",\n \"avatax-admin.tax.regime.profit.estimated\": \"Lucro Presumido\",\n \"avatax-admin.tax.regime.profit.real\": \"Lucro Real\",\n \"avatax-admin.tax.regime.simplified\": \"Optante do SIMPLES\",\n \"avatax-admin.tax.regime.simplified.grossthreshold\": \"Optante do SIMPLES com limite de faturamento bruto\",\n \"avatax-admin.tax.regime.simplified.entrepreneur\": \"Micro Empreendedor Individual\",\n \"avatax-admin.tax.regime.not.applicable\": \"Não Aplicável\",\n \"avatax-admin.entity.type.label\": \"Tipo de entidade\",\n \"avatax-admin.entity.type.mixed.capital\": \"Capital misto\",\n \"avatax-admin.entity.type.government\": \"Estado Governamental\",\n \"avatax-admin.entity.type.foreign\": \"Estrangeiro\",\n \"avatax-admin.entity.type.federal\": \"Governo Federal\",\n \"avatax-admin.entity.type.individual\": \"Individual\",\n \"avatax-admin.entity.type.city\": \"Prefeitura\",\n \"avatax-admin.entity.type.business\": \"Negócio\",\n \"avatax-admin.state.tax.id.placeholder\": \"Inserir Identificação fiscal estadual\",\n \"avatax-admin.state.tax.id.label\": \"Inscrição Estadual\",\n \"avatax-admin.street.placeholder\": \"Inserir rua\",\n \"avatax-admin.street.label\": \"Rua\",\n \"avatax-admin.neighborhood.placeholder\": \"Inserir bairro\",\n \"avatax-admin.neighborhood.label\": \"Bairro\",\n \"avatax-admin.zipCode.placeholder\": \"Inserir CEP\",\n \"avatax-admin.zipCode.label\": \"CEP\",\n \"avatax-admin.city.placeholder\": \"Inserir cidade\",\n \"avatax-admin.city.label\": \"Cidade\",\n \"avatax-admin.state.placeholder\": \"Inserir estado\",\n \"avatax-admin.state.label\": \"Estado\",\n \"avatax-admin.street.number.placeholder\": \"Inserir número\",\n \"avatax-admin.street.number.label\": \"Número\",\n \"avatax-admin.complement.placeholder\": \"Inserir complemento\",\n \"avatax-admin.complement.label\": \"Complemento\",\n \"avatax-admin.phone.placeholder\": \"Inserir telefone\",\n \"avatax-admin.phone.label\": \"Telefone\",\n \"avatax-admin.cnpj.placeholder\": \"Inserir CNPJ\",\n \"avatax-admin.cnpj.label\": \"CNPJ\",\n \"avatax-admin.suframa.placeholder\": \"Inserir código suframa (Se existir)\",\n \"avatax-admin.suframa.label\": \"Suframa\",\n \"avatax-admin.logs-caption\": \"Aqui você encontra todos os resultados dos cálculos de impostos efetuados\",\n \"avatax-admin.logs-details-caption\": \"Resultado do Cálculo:\",\n \"avatax-admin.logs-refresh-button\": \"Atualizar\",\n \"avatax-admin.logs-no-result\": \"Nenhum resultado encontrado.\",\n \"avatax-admin.logs-order-input-placeholder\": \"Número do Pedido...\",\n \"avatax-admin.logs-table-fields-caption\": \"Alterar colunas visíveis\",\n \"avatax-admin.logs-table-show-all\": \"Exibir tudo\",\n \"avatax-admin.logs-table-hide-all\": \"Ocultar tudo\",\n \"avatax-admin.logs-download-button\": \"Exportar Logs\",\n \"avatax-admin.logs-details-button\": \"Mais Detalhes\",\n \"avatax-admin.logs-download-request-button\": \"Baixar Request\",\n \"avatax-admin.logs-table-show-rows\": \"Mostrar linhas\",\n \"avatax-admin.logs-table-rows-of\": \"de\",\n \"avatax-admin.logs-schema-details\": \"Detalhes\",\n \"avatax-admin.logs-schema-createdIn\": \"Data/Hora ↓\",\n \"avatax-admin.logs-schema-client\": \"Cliente\",\n \"avatax-admin.logs-schema-dockName\": \"Doca\",\n \"avatax-admin.logs-schema-city\": \"Cidade\",\n \"avatax-admin.logs-schema-state\": \"Estado\",\n \"avatax-admin.logs-schema-activitySector\": \"Setor de Atividade\",\n \"avatax-admin.logs-schema-numberOfProducts\": \"Produtos\",\n \"avatax-admin.logs-schema-productsTotal\": \"Valor Prod.\",\n \"avatax-admin.logs-schema-freightTotal\": \"Valor Frete\",\n \"avatax-admin.logs-schema-includedTaxes\": \"Impostos Inclusos\",\n \"avatax-admin.logs-schema-includedTaxesTotal\": \"Total Inclusos\",\n \"avatax-admin.logs-schema-addedTaxes\": \"Impostos Destacados\",\n \"avatax-admin.logs-schema-addedTaxesTotal\": \"Total Destacados\"\n}\n\n```" } ]
code_avatax-br-admin_869ce0b8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/admin/navigation.json from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"section\": \"other\",\n \"titleId\": \"avatax-admin.navigation.label\",\n \"icon\": \"extensions-ic\",\n \"path\": \"/admin/avatax-br\"\n}\n\n```" } ]
code_avatax-br-admin_01a1fcd6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/admin/routes.json from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin.app.example\": {\n \"component\": \"AvataxAdmin\",\n \"path\": \"/admin/app/avatax-br\"\n }\n}\n\n```" } ]
code_avatax-br-admin_669f9203
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/docs/README.md from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n## Avatax-BR\n\nThis app enables tax calculations using AvaTax-Brazil V3 api services from Avalara.\n\n> This app requires external subscription to Avalara.\n\nThe Avatax-BR conector is an app which connects to VTEX Tax Hub allowing Avalara to calculate taxes in various B2B (or B2C) scenarios. \n\nThis app is only compatible with Brazil stores.\n\n#### Installation\n\nYou can install this app through VTEX App Store or by command-line using `VTEX Toolbelt`:\n\n```\nvtex install vtex.avatax-br@2.x\n```\n\nAfter installation, this app requires additional configurations in your store account, which will be described as following. **Don't worry**: The app will only be activated through a on/off switch in the Avatax Br admin page.\n\n#### Initial Setup\n\nThe following steps must be followed:\n- MasterData configuration (AS, AE, AL and CL entities)\n- Establishment configuration through the admin app\n- SKU Integration (must be custom-built)\n- Client registration form (must be custom-built)\n\n#### MasterData Configuration\n\nFirst, go to MasterData on the Admin sidebar, and click on the \"Advanced Settings\" button. In the configurations panel, click on \"Data structures\". There you'll be able to edit and create MasterData structures. For this app, you need to create three new entities: AS (skus), AE (establishments) and AL (logs), and edit an existent one CL (clients).\n\n![](https://user-images.githubusercontent.com/1629129/125787544-95a06cfc-e6f3-4697-8c07-8bf589bdf891.png)\n\n##### 1 - Avatax SKUs\nContains relevant product data required by Avalara.\n**Acronym**: AS\n**Name**: Avatax SKUs\n\n| Name | Display Name | Data Type | Nullable | Searchable | Filterable |\n|---------|----------|---------|---------|----------|-----------|\n| skuId | SKU ID | Integer | Yes | Yes | Yes |\n| skuInfo | SKU Info | Text | Yes | | |\n| | | | | | |\n\n**skuId**: The id of the SKU in VTEX.\n**skuInfo**: A string in JSON format which should contain all needed properties to perform tax calculation. These properties will be described in a later topic (SKU integration)\n\n![](https://user-images.githubusercontent.com/1629129/125787730-39825489-97ae-414b-80f7-c7303c5d7119.png)\n\n##### 2 - Avatax Establishments\nTo Avalara, the establishments represent the source (dock) of the products being sold. There should be as many establishments as there are docks.\n\n**Acronym**: AE\n**Name**: Avatax Establishments\n\n| Name \t| Display Name \t| Data Type \t| Nullable \t| Searchable \t| Filterable \t|\n|----------------\t|----------------------\t|-------------\t|---------\t|----------\t|-----------\t|\n| activitySector \t| Activity Sector \t| Text \t| Yes \t| \t| \t|\n| city \t| City \t| Varchar 750 \t| Yes \t| \t| \t|\n| cnpj \t| CNPJ \t| CPF / CNPJ \t| Yes \t| \t| \t|\n| complement \t| Complement \t| Text \t| Yes \t| \t| \t|\n| dockId \t| Dock Id \t| Varchar 100 \t| Yes \t| Yes \t| Yes \t|\n| dockName \t| Dock Name \t| Text \t| Yes \t| \t| \t|\n| entityType \t| Entity Type \t| Text \t| Yes \t| \t| \t|\n| icmsTaxPayer \t| Is ICMS Tax Payer \t| Boolean \t| Yes \t| \t| \t|\n| pCredSN \t| ICMS Tax Rate \t| Integer \t| Yes \t| \t| \t|\n| phone \t| Phone Number \t| Phone \t| Yes \t| \t| \t|\n| neighborhood \t| Neighborhood \t| Varchar 750 \t| Yes \t| \t| \t|\n| state \t| State \t| Varchar 100 \t| Yes \t| \t| \t|\n| stateTaxId \t| State Tax Id \t| Text \t| Yes \t| \t| \t|\n| street \t| Street \t| Varchar 750 \t| Yes \t| \t| \t|\n| streetNumber \t| Street Number \t| Integer \t| Yes \t| \t| \t|\n| suframa \t| Suframa \t| Text \t| Yes \t| \t| \t|\n| taxRegime \t| Tax Regime \t| Text \t| Yes \t| \t| \t|\n| zipCode \t| Postal Code \t| CEP \t| Yes \t| \t| \t|\n\n**activitySector**: The company's activity sector.\n**city**: City where the establishment is located.\n**cnpj**: Corporate document of the establishment.\n**complement**: Complement of the establishment's address.\n**dockId**: Id of the VTEX dock.\n**dockName**: Name of the VTEX dock.\n**entityType**: Entity Type (Company, Individual, Government, etc)\n**icmsTaxPayer**: Defines if the entity is an ICMS taxpayer.\n**pCredSN**: Rate for calculating the use of ICMS credit.\n**neighborhood**: Neighborhood of the establishment's address.\n**state**: State of the establishment's address.\n**stateTaxId**: State registration of the company, if it is an ICMS tax payer.\n**street**: Street address of the establishment.\n**streetNumber**: Address number of the establishment.\n**suframa**: Suframa number (\"Superintendencia da Zona Franca de Manaus\").\n**taxRegime**: Company's tax regime (simplified, real profit, estimated profit, and so on).\n**zipCode**: Postal code of the establishment's address.\n\n##### 3 - Avatax Logs\nEvery tax calculation is saved in this entity for later queries.\n**Acronym**: AL\n**Name**: Avatax Logs\n\n| Name \t| Display Name \t| Data Type \t| Nullable \t| Searchable \t| Filterable \t|\n|-------------------\t|------------------------------\t|-------------\t|---------\t|----------\t|-----------\t|\n| avalaraReturn \t| Avalara Response \t| Text \t| Sim \t| \t| \t|\n| client \t| Client \t| Text \t| Sim \t| \t| \t|\n| email \t| Client Email \t| Varchar 100 \t| Sim \t| \t| \t|\n| establishment \t| Establishment \t| Text \t| Sim \t| \t| \t|\n| freightSimulation \t| Freight Simulation \t| Currency \t| Sim \t| \t| \t|\n| orderId \t| Checkout/Order ID \t| Varchar 100 \t| Sim \t| Sim \t| Sim \t|\n| payLoad \t| Avalara Request \t| Text \t| Sim \t| \t| \t|\n| type \t| Log Type \t| Text \t| Sim \t| \t| \t|\n\n**avalaraReturn**: The response from Avalara's APIs.\n**client**: Object containing client data.\n**email**: The email of the client.\n**establishment**: Object containing establishment data.\n**freightSimulation**: Freight simulation value total.\n**orderId**: Unique session id for the checkout step, or orderId in case the purchase has been completed.\n**payLoad**: The request sent to Avalara's APIs.\n**type**: PDP/Checkout. Specifies where exactly the calculation process was called. PDP means the \"productTax\" endpoint, checkout means it was called on the checkout steps.\n\n##### Client Entity Changes\nThe following fields must be added to the client (CL) entity:\n\n| Name \t| Display Name \t| Data Type \t| Nullable \t| Searchable \t| Filterable \t|\n|----------------\t|----------------------\t|-------------\t|---------\t|----------\t|-----------\t|\n| activitySector \t| Activity Sector \t| Text \t| Sim \t| \t| \t|\n| entityType \t| Entity Type \t| Text \t| Sim \t| \t| \t|\n| icmsTaxPayer \t| Is ICMS Tax Payer \t| Boolean \t| Sim \t| \t| \t|\n| pCredSN \t| ICMS Tax Rate \t| Integer \t| Sim \t| \t| \t|\n| stateTaxId \t| State Tax Id \t| Varchar 750 \t| Sim \t| \t| \t|\n| taxRegime \t| Tax Regime \t| Text \t| Sim \t| \t| \t|\n| useType \t| Use Type \t| Varchar 100 \t| Sim \t| \t| \t|\n| usagePurpose \t| Usage Purpose \t| Varchar 100 \t| Sim \t| \t| \t|\n\n**activitySector**: The entity's activity sector. Allowed values:\n> **armedForces**\n> **auctioneer**\n> **audiovisualIndustry**\n> **bondedWarehouse**\n> **broadcastingIndustry**\n> **construction**\n> **coops**\n> **distributor**\n> **distributionCenter**\n> **electricityDistributor**\n> **energyGeneration**\n> **extractor**\n> **farmCoop**\n> **filmIndustry**\n> **finalConsumer**\n> **fuelDistributor**\n> **generalWarehouse**\n> **importer**\n> **industry**\n> **itaipubiNacional**\n> **maritimeService**\n> **mealSupplier**\n> **nonProfitEntity**\n> **pharmaDistributor**\n> **publicAgency**\n> **religiousEstablishment**\n> **retail**\n> **ruralProducer**\n> **securityPublicAgency**\n> **service**\n> **stockWarehouse**\n> **telco**\n> **transporter**\n> **waterDistributor**\n> **wholesale**\n\n**entityType**: Entity type. Allowed values:\n> **business**\n> **individual**\n> **federalGovernment**\n> **stateGovernment**\n> **cityGovernment**\n> **foreign**\n> **mixedCapital**\n> **coops**\n\n**icmsTaxPayer**: true if the entity is an ICMS tax payer.\n**pCredSN**: ICMS tax rate.\n**stateTaxId**: State tax id. Mandatory is the entity is an ICMS tax payer.\n\n**taxRegime**: The entity's tax regime. Allowed values:\n> **realProfit**\n> **estimatedProfit**\n> **simplified**\n> **simplifiedOverGrossthreshold**\n> **simplifiedEntrepeneur**\n> **individual**\n\n**useType**: Type of \"use\" for which the customer's purchases are intended. Allowed values:\n> **use or consumption**\n> **resale**\n> **agricultural production**\n> **production**\n> **fixed assets**\n\n**usagePurpose**: Optional free text which describes the useType field in detail.\n\n#### Application Configuration\nAfter configuring MasterData, access the application through the VTEX Admin menu and click on *Others -> Avatax Br*:\n\nOn the main tab we have the application's settings area, where you can turn the connector on/off and enable the sandbox environment (that makes so the app requests reach Avalara's sandbox servers instead of production).\n\nYou also need to fill in the **clientId** and **clientSecret** parameters. Those are provided by Avalara (or generated through their platform). After filling them in, click on \"Verify Ping\" to ensure the connection is operational.\n\n![](https://user-images.githubusercontent.com/1629129/125787878-dcb9379a-8a24-40e6-bf56-0162685f3bbb.png)\n\n#### Establishment Configuration\n\nYou can see that there are two stock related tabs: \"Add stock\" and \"Current stocks\". The configuration of stocks, which are equivalent to the establishment at Avalara (represented by the entity AE of MasterData), is one of the necessary steps for the adequate operation of the connector. To get started, go to the second tab, \"Add Stock\" and register all the establishments.\n\nKeep in mind that the connector works only for docks that have an associated establishment, so make sure that the establishments are properly registered.\n\n![](https://user-images.githubusercontent.com/1629129/125788018-0d0bb86e-5e9f-43b2-be37-ea953abc9c24.png)\n\n#### Sku Integration\n\nIn addition to the establishments, SKUs need to be properly entered in MasterData, based on information coming from the ERP. The sku structure contains two fields, skuId which corresponds to the SKU ID in VTEX, and skuInfo, which contains the additional data we send during tax calculation. The skuInfo field is a text field which must be in a JSON format, respecting the following structure:\n\n**itemCode**: Code of the item in the ERP. *Type: string*.\n**itemDescriptor.taxCode**: Auxiliary code for determining the legal basis of the item, registered in Avalara's system, used mainly to promote disambiguation in some cases of conflicts between tax rules. *Type: string*.\n**itemDescriptor.hsCode**: NCM (Mercosul Common Nomenclature) code of the product. *Type: string.*\n**itemDescriptor.ex**: Tax exception code, linked to IPI. *Type: string*.\n**itemDescriptor.cean**: Item bar code (EAN). *Type: string*.\n**itemDescriptor.source**: Code which defines the origin of the item. *Type: string*. Allowed values:\n> **0**: Domestic goods, except those treated in codes 3,4,5 and 8.\n> **1**: Foreign goods imported directly by the seller, except those treated in code 6.\n> **2**: Foreign goods acquired in the domestic market (within Brazil), except those treated in code 7.\n> **3**: Domestic goods with imported content above 40% and of value less than or equal to 70%.\n> **4**: Domestic goods produced following \"standard basic processes\", as established by legislation (standard basic processes are designed to separate simple assembly from manufacturing processes) \n> **5**: Domestic goods with imported content less than or equal to 40%.\n> **6**: Foreign goods imported directly by the seller without national equivalent as listed by Comex and natural gas.\n> **7**: Foreign goods purchased in the domestic market (within Brazil) without national equivalent as listed by Comex and natural gas.\n> **8**: National goods with imported content above 70%.\nitemDescriptor.\n\n**productType**: Fiscal type of the product according to SPED table. *Type: string*. Allowed values:\n> **FOR PRODUCT**: Finished product\n> **FOR MERCHANDISE**: Goods for resale\n> **SERVICE**: Services\n> **FEEDSTOCK**: Raw materials\n> **FIXED ASSETS**: Fixed Assets\n> **PACKAGING**: Packaging\n> **PRODUCT IN PROCESS**: Product in process\n> **SUBPRODUCT**: By-product\n> **INTERMEDIATE PRODUCT**: Intermediate product\n> **MATERIAL FOR USAGE AND CONSUMPTION**: Material for Use and Consumption\n> **OTHER INPUTS**: Other inputs\n> **NO RESTRICTION**: Other\n\n**itemDescriptor.manufacturerEquivalent**: Item is a commodity, but will be considered as a product. *Type: boolean*.\n\n**JSON Example**:\n```\n{\n \"itemCode\": \"12345\",\n \"itemDescriptor\": {\n \"taxCode\": \"\",\n \"hsCode\": \"85171231\"\n \"ex\": \"\",\n \"cest\": \"2105301\"\n \"cean\": \"\",\n \"source\": \"4\", \"source\": \"4\",\n \"productType\": \"FOR MERCHANDISE\",\n \"manufacturerEquivalent\": true\n }\n}\n```\n\nThis json **must** be converted to text and inserted from an integration between ERP and VTEX MasterData. It is worth noting that the skuInfo is a **string** and not an object, so all its content must be enclosed in quotes (\"\").\n\nBelow is an example of a request (cURL) to insert a sku:\n```\ncurl --location --request POST 'http://{{account}}.myvtex.com/api/dataentities/AS/documents' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n \"skuId\": 1,\n \"skuInfo\": \"{\\\"itemCode\\\":\\\"12345\\\",\\\"itemDescriptor\\\":{\\\"taxCode\\\":\\\"\\\",\\\"hsCode\\\":\\\"85171231\\\",\\\"ex\\\":\\\"\\\",\\\"cest\\\":\\\"2105301\\\",\\\"cean\\\":\\\"\\\",\\\"source\\\":\\\"4\\\",\\\"productType\\\":\\\"FOR MERCHANDISE\\\",\\\"manufacturerEquivalent\\\":true}}\"\n}'\n```\n\nSince these are private entities, it is also necessary to have authorization to add this information to MasterData, so authorization parameters must be placed in the header:\n\n**VtexIdclientAutCookie**: To obtain this value you must open the Developer Tools on your browser, on the Applications tab, while inside the VTEX Admin. Then look for Cookie values and copy the value of the VtexIdclientAutCookie cookie value.\n\n**AppKey/AppToken**: To get the AppKey and AppToken, log into the admin and go to the \"Account Management\" tab and then click on \"Account\". You can see all registered tokens in the security area. You can create one by clicking on \"Generate appKey and appToken\", then fill in the request information and click on \"Generate new tokens\".\n\n#### Using Avatax BR\nAfter finishing the setup and activating the connector your store will be able to calculate and display taxes and fees through Avalara. \n\nIn summary, the steps for configuring and using the connector are:\n* MasterData Structure\n* Application Settings\n* Customer Master Data Customization\n* Establishment registration\n* SKU Integration\n* Connector activation through the Settings screen\n\nTo see everything working just enter your store, login and add the product to the cart. When you enter the cart, the taxes calculated by Avalara will automatically appear and the final amount will be calculated with the addition of taxes. Each operation during the checkout process, from the cart to the checkout, such as change of address, change of quantity and inclusion / removal of products, causes a new calculation and the information is automatically updated. \n\n![](https://user-images.githubusercontent.com/1629129/125788192-7fd8fa6e-584f-448f-839f-d5dc02d0b7da.png)\n\n#### Viewing the Logs\nYou can view all tax and fee calculations performed by the connector through the Logs tab.\n\nIn this table you can view all the calculations performed and their city/state of origin and destination, and included/highlighted taxes. The \"Refresh\" button reloads the logs, and you can filter the view of the columns and display more or fewer rows through the table buttons.\n\n![](https://user-images.githubusercontent.com/1629129/125788247-0b1b4826-5d47-445c-8032-f14ecebaad88.png)\n\nIf you want to view the entire contents of a calculation, simply click the icon in the \"Details\" column.\n\nBesides being able to analyze Avalara's answer in full, it is also possible to download just the request object (for further simulations and/or questions with Avalara).\n\n![](https://user-images.githubusercontent.com/1629129/125788312-325b2edd-4b78-4aae-8783-295a35dc5809.png)\n\nThe logs screen also allows you to export the log files and filter by order number, to investigate which tax calculation was performed for a specific purchase.\n \n```" } ]
code_avatax-br-admin_2fddc591
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/AvataxAdmin.tsx from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC, useState } from 'react'\nimport { Layout, PageBlock, Tabs, Tab } from 'vtex.styleguide'\nimport { useIntl } from 'react-intl'\n\nimport AddStock from './components/Common/AddStock'\nimport CurrentStock from './components/Common/CurrentStock'\nimport EditArea from './components/Common/editArea'\nimport ModalArea from './components/Common/modal'\nimport EstablishmentProvider from './components/Establishment/EstablishmentProvider'\nimport { LogForm } from './components/Logs/LogForm'\nimport LogProvider from './components/Logs/LogProvider'\nimport Settings from './components/Common/settings'\nimport { avatax } from './utils/definedMessages'\n\nconst AvataxAdmin: FC = () => {\n const [tab, setTab] = useState({\n currentTab: 1,\n })\n\n const intl = useIntl()\n\n return (\n <>\n <Layout>\n <PageBlock\n title={intl.formatMessage(avatax.avatax)}\n subtitle={intl.formatMessage(avatax.avalara)}\n variation=\"full\"\n >\n <Tabs>\n <Tab\n label={intl.formatMessage(avatax.configuration)}\n active={tab.currentTab === 1}\n onClick={() => setTab({ currentTab: 1 })}\n >\n <EstablishmentProvider>\n <Settings />\n </EstablishmentProvider>\n </Tab>\n <Tab\n label={intl.formatMessage(avatax.addStock)}\n active={tab.currentTab === 2}\n onClick={() => setTab({ currentTab: 2 })}\n >\n <p>{intl.formatMessage(avatax.fields)}</p>\n <EstablishmentProvider>\n <AddStock />\n </EstablishmentProvider>\n </Tab>\n\n <Tab\n label={intl.formatMessage(avatax.currentStock)}\n active={tab.currentTab === 3}\n onClick={() => setTab({ currentTab: 3 })}\n >\n <EstablishmentProvider>\n <CurrentStock />\n <ModalArea>\n <EditArea />\n </ModalArea>\n </EstablishmentProvider>\n </Tab>\n <Tab\n label=\"Logs\"\n active={tab.currentTab === 4}\n onClick={() => setTab({ currentTab: 4 })}\n >\n <LogProvider page={1} pageSize={5}>\n <LogForm />\n </LogProvider>\n </Tab>\n </Tabs>\n </PageBlock>\n </Layout>\n </>\n )\n}\n\nexport default AvataxAdmin\n\n```" } ]
code_avatax-br-admin_28572dcc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/package.json from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"CHANGE_ME\",\n \"version\": \"2.2.0\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.8\",\n \"file-saver\": \"^2.0.5\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\",\n \"react-json-view\": \"^1.21.3\",\n \"yup\": \"^0.32.9\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/file-saver\": \"^2.0.2\",\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 }\n}\n\n```" } ]
code_avatax-br-admin_aa86d9e6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/public/metadata/messages/pt-BR.json from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Avalara Brasil\",\n \"headline\": \"Calcule os impostos e tributos sobre vendas através do conector Avalara\",\n \"overview\": \"O App Avalara Brasil é integrado com o checkout da VTEX e permite o cálculo e exibição de taxas e impostos na loja.\",\n \"features\": [\"\"],\n \"additionalInformation\": \"\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```" } ]
code_avatax-br-admin_0985f8a2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/context/LogContext.tsx from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\ninterface LogContextType {\n loading: boolean\n reloading: boolean\n logs?: CalculationLog[]\n pagination?: Pagination\n searchTerm?: string\n setSearchTerm: (term: string, callback?: () => void) => void\n setPage: (page: number, pageSize: number) => void\n refetch: (searchTerm?: string) => void\n}\nconst LogContext = React.createContext<LogContextType>({\n loading: true,\n reloading: false,\n setSearchTerm: () => {},\n setPage: () => {},\n refetch: () => {},\n})\n\nexport default LogContext\n\n```" } ]
code_avatax-br-admin_01f5329d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/context/EstablishmentContext.tsx from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\ninterface EstablishmentContextType {\n establishment: Establishment\n setEstablishment: (establishment: Establishment) => void\n edit: boolean\n setEdit: (edit: boolean) => void\n loading: boolean\n establishmentList?: Establishment[]\n update: (establishment: Establishment) => void\n deleteEstablishments: (documentId: string | boolean) => void\n saveConfigurations: () => Promise<boolean>\n showAlert: boolean\n setShowAlert: (showAlert: boolean) => void\n handleCloseAlert: () => void\n docks: Docks[] | undefined\n validationValues: EstablishmentValidation\n zip: boolean\n validationFuntion: (object: Establishment) => Promise<string>\n showAlertUpdate: boolean\n setShowAlertUpdate: (showAlert: boolean) => void\n settings: Settings\n changeSettings: () => void\n updateSettings: (object: Settings) => void\n change: boolean\n ping: number\n verifyPing: () => void\n updateSettingsSandbox: (object: Settings) => void\n}\nconst EstablishmentContext = React.createContext<EstablishmentContextType>({\n establishment: {},\n setEstablishment: () => {},\n edit: false,\n setEdit: () => {},\n loading: true,\n establishmentList: [],\n update: () => {},\n deleteEstablishments: () => {},\n saveConfigurations: async () => false,\n showAlert: false,\n setShowAlert: () => {},\n handleCloseAlert: () => {},\n docks: [{ name: '', id: '' }],\n validationValues: {},\n zip: false,\n validationFuntion: async () => '',\n showAlertUpdate: false,\n setShowAlertUpdate: () => {},\n settings: {},\n changeSettings: () => {},\n updateSettings: () => {},\n change: false,\n ping: 0,\n verifyPing: () => {},\n updateSettingsSandbox: () => {},\n})\n\nexport default EstablishmentContext\n\n```" } ]
code_avatax-br-admin_bac248ef
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/settings.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface Settings {\n sandbox?: boolean | undefined\n clientId?: string | undefined\n clientSecret?: string | undefined\n [index: string]: string | boolean | undefined\n}\n\ninterface GetSettings {\n getSettings: {\n useAvalaraSandboxEnv: boolean\n clientIdValue: string\n clientSecretValue: string\n }\n}\n\n```" } ]
code_avatax-br-admin_e4bbe714
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/calculationLog.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface CalculationLog {\n avalaraReturn: [\n {\n skuId: string\n lineAmount: number\n numberOfItems: number\n freightAmount: number\n lineUnitPrice: number\n useType: string\n itemDescriptor: {\n taxCode: string\n hsCode: string\n ex: string\n cest: string\n productType: string\n }\n taxDetails: [\n {\n taxImpact: {\n impactOnFinalPrice: string\n }\n taxType: string\n citation: string\n subtotalTaxable: number\n rate: number\n tax: number\n }\n ]\n }\n ]\n client: {\n activitySector: string\n icmsTaxPayer: boolean\n taxRegime: string\n stateTaxId: string\n useType: string\n cnpj: string\n suframa: string\n city: string\n state: string\n }\n establishment: {\n dockId: string\n dockName: string\n activitySector: string\n taxRegime: string\n entityType: string\n stateTaxId: string\n street: string\n neighborhood: string\n zipCode: string\n city: string\n state: string\n streetNumber: number\n complement: string\n phone: string\n cnpj: string\n suframa: string\n }\n email: string\n createdIn: string\n payload: string\n orderId: string\n}\n\ninterface CalculationLogQueryResult {\n getLogs: CalculationLogData\n}\n\ninterface CalculationLogData {\n pagination: Pagination\n data: CalculationLog[]\n}\n\n```" } ]
code_avatax-br-admin_2771da99
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/gql.d.ts from the avatax-br-admin 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_avatax-br-admin_12001a18
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/address.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface Address {\n postalCode: string\n city: string\n state: string\n street: string\n number: string\n neighborhood: string\n complement: string\n reference: string\n geoCoordinates: string[]\n}\n\n```" } ]
code_avatax-br-admin_760d6dc1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/taxConfiguration.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface TaxConfiguration {\n allowExecutionAfterErrors: boolean\n authorizationHeader: string\n integratedAuthentication: boolean\n url: string\n}\n\ninterface GetTaxConfiguration {\n getTaxConfiguration: TaxConfiguration\n}\n\ninterface SetTaxConfiguration {\n paymentConfiguration?: PaymentConfiguration\n taxConfiguration?: TaxConfiguration\n minimumQuantityAccumulatedForItems?: number\n decimalDigitsPrecision?: number\n minimumValueAccumulated?: number\n apps?: [App]\n allowMultipleDeliveries?: boolean\n allowManualPrice?: boolean\n maxIntOfWhiteLabelSellers?: number\n maskFirstPurchaseData?: boolean\n recaptchaValidation?: boolean\n}\n\ninterface SettingsInput {\n operation: string\n}\n\n```" } ]
code_avatax-br-admin_5d6c7f47
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/global.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.styleguide'\ndeclare module '*.png'\n\n```" } ]
code_avatax-br-admin_5db4055e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/css.d.ts from the avatax-br-admin 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_avatax-br-admin_4db2cc65
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/docks.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface Docks {\n name: string\n id: string\n}\n\ninterface GetDocks {\n getDocks: Docks[]\n}\n\n```" } ]
code_avatax-br-admin_e8531567
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/establishment.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface Establishment {\n activitySector?: string\n icmsTaxPayer?: boolean\n taxRegime?: string\n entityType?: string\n stateTaxId?: string\n street?: string\n neighborhood?: string\n zipCode?: string\n city?: string\n state?: string\n streetNumber?: string\n complement?: string\n phone?: string\n cnpj?: string\n suframa?: string\n dockId?: string\n dockName?: string\n [index: string]: string | boolean\n}\n\ninterface GetEstablishment {\n establishments: Establishment[]\n}\n\ninterface EstablishmentValidation {\n activitySector?: boolean\n icmsTaxPayer?: boolean\n taxRegime?: boolean\n entityType?: boolean\n stateTaxId?: boolean\n street?: boolean\n neighborhood?: boolean\n zipCode?: boolean\n city?: boolean\n state?: boolean\n streetNumber?: boolean\n complement?: boolean\n cnpj?: boolean\n suframa?: boolean\n dockId?: boolean\n dockName?: boolean\n [index: string]: boolean\n}\n\n```" } ]
code_avatax-br-admin_a0fb3c15
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/pagination.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface Pagination {\n total: number\n page: number\n pageSize: number\n}\n\ninterface PaginationContext {\n pagination?: Pagination\n setPage: (\n page: number,\n pageSize: number\n ) => Promise<{ pagination: Pagination }> | void\n}\n\n```" } ]
code_avatax-br-admin_7e923f5c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/typings/values.d.ts from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface Values {\n dockId: {\n name: string\n placeholder: string\n label: string\n }\n dockName: {\n name: string\n placeholder: string\n label: string\n options: Array<{ value: string; label: string }>\n }\n icmsTaxPayer: {\n name: string\n label: string\n options: Array<{ value: boolean; label: string }>\n }\n activitySector: {\n name: string\n label: string\n options: Array<{ value: string; label: string }>\n }\n taxRegime: {\n name: string\n label: string\n options: Array<{ value: string; label: string }>\n }\n entityType: {\n name: string\n label: string\n options: Array<{ value: string; label: string }>\n }\n stateTaxId: {\n name: string\n placeholder: string\n label: string\n }\n street: {\n name: string\n placeholder: string\n label: string\n }\n neighborhood: {\n name: string\n placeholder: string\n label: string\n }\n zipCode: {\n name: string\n placeholder: string\n label: string\n }\n\n city: {\n name: string\n placeholder: string\n label: string\n }\n state: {\n name: string\n placeholder: string\n label: string\n }\n streetNumber: {\n name: string\n placeholder: string\n label: string\n }\n complement: {\n name: string\n placeholder: string\n label: string\n }\n phone: {\n name: string\n placeholder: string\n label: string\n }\n cnpj: {\n name: string\n placeholder: string\n label: string\n }\n suframa: {\n name: string\n placeholder: string\n label: string\n }\n}\n\n```" } ]
code_avatax-br-admin_0f6110b3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/queries/getTaxConfiguration.gql from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery getTaxConfiguration {\n getTaxConfiguration @context(provider: \"vtex.avatax-br-service@1.x\"){\n allowExecutionAfterErrors\n authorizationHeader\n integratedAuthentication\n url\n }\n}\n\n```" } ]
code_avatax-br-admin_d365abf5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/queries/getLogs.gql from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery getLogs($params: LogParamsInput) {\n getLogs(params: $params) @context(provider: \"vtex.avatax-br-service@1.x\") {\n pagination {\n page\n pageSize\n total\n }\n data {\n avalaraReturn {\n skuId\n lineAmount\n numberOfItems\n freightAmount\n lineUnitPrice\n useType \n itemDescriptor {\n taxCode\n hsCode\n ex\n cest\n productType\n }\n taxDetails {\n taxImpact {\n impactOnFinalPrice\n }\n taxType\n citation\n subtotalTaxable\n rate\n tax \n }\n }\n client {\n activitySector\n icmsTaxPayer\n taxRegime\n stateTaxId\n useType\n cnpj\n suframa\n city\n state\n }\n establishment { \n activitySector\n icmsTaxPayer\n taxRegime\n stateTaxId\n cnpj\n suframa\n entityType\n city\n state\n dockName\n }\n email\n createdIn\n payload\n orderId\n }\n }\n}\n```" } ]
code_avatax-br-admin_67ad1f09
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/queries/updateSettings.gql from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation updateSettings($settings: SettingsInput) {\n updateSettings(settings: $settings)\n @context(provider: \"vtex.avatax-br-service@1.x\") {\n useAvalaraSandboxEnv\n clientIdValue\n clientSecretValue\n }\n}\n\n```" } ]
code_avatax-br-admin_cd38c4cc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of avatax-br-admin/react/queries/saveConfiguration.gql from the avatax-br-admin VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\n\nmutation saveConfigurationMutation($esta: EstablishmentInput){\n saveConfiguration(data: $esta) @context(provider: \"vtex.avatax-br-service@1.x\")\n}\n\n```" } ]