id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_training-week-demo_eeca7721
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/about-us.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.custom#about-us\": {\n \"blocks\": [\n \"flex-layout.row#about-us\",\n \"video#about-us\"\n ]\n },\n\n \"flex-layout.row#about-us\": {\n \"children\": [\n \"image#mobile-phone\",\n \"flex-layout.col#text-about-us\"\n ]\n },\n\n \"flex-layout.col#text-about-us\": {\n \"children\": [\n \"rich-text#title-about-us\",\n \"rich-text#about-us\"\n ],\n \"props\": {\n \"blockclass\": \"textColumn\",\n \"preventVerticalStretch\": true\n }\n },\n\n \"rich-text#title-about-us\": {\n \"props\": {\n \"text\":\n \"# Create meaningful and relevant experiences.\",\n \"blockClass\": \"title\"\n }\n },\n\n \"image#mobile-phone\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/mobile-phone.png\",\n \"maxHeight\": \"\",\n \"maxWidth\": \"\",\n \"blockClass\": \"storePrint\"\n }\n },\n \"video#about-us\": {\n \"props\": {\n \"src\": \"https://www.youtube.com/embed/JgkrlaF52WQ\",\n \"width\": \"100%\",\n \"height\": \"100%\"\n }\n },\n \"rich-text#about-us\": {\n \"props\": {\n \"text\": \"**Optimized store framework** \\n Free your front-end with our React + Node store framework. Improve usability and SEO, while driving more conversion with modular components, single page applications, and a ready-for-PWA structure. \\n **Multi-currency and language** \\n Go international with multiple storefronts to support different languages and easily manage local currencies and payment conditions. \\n **Serverless development platform** \\n Reduce loading time, improve usability, and make the best out of SEO. Developing scalable components with a comprehensive, easy-to-use toolset, you can build stores faster than ever.\",\n \"blockClass\": \"about\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_838161aa
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/product-price.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#selling-price\": {\n \"props\": {\n \"colGap\": 2,\n \"preserveLayoutOnMobile\": true,\n \"preventHorizontalStretch\": true,\n \"marginBottom\": 4\n },\n \"children\": [\n \"product-selling-price\"\n ]\n },\n\n \"flex-layout.row#list-price-savings\": {\n \"props\": {\n \"colGap\": 2,\n \"preserveLayoutOnMobile\": true,\n \"preventHorizontalStretch\": true,\n \"marginBottom\": 2,\n \"marginTop\": 5\n },\n \"children\": [\n \"product-list-price\",\n \"product-price-savings\"\n ]\n }\n}\n\n```"
}
] |
code_training-week-demo_f5dafeb0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/minicart.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"add-to-cart-button\": {\n \"props\": {\n \"addToCartFeedback\": \"customEvent\",\n \"customPixelEventId\": \"add-to-cart-button\"\n }\n },\n\n \"minicart.v2\": {\n \"props\": {\n \"customPixelEventId\": \"add-to-cart-button\"\n },\n \"children\": [\"minicart-base-content\"]\n }\n}\n\n```"
}
] |
code_training-week-demo_821d3b41
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/search.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.search\": {\n \"blocks\": [\"search-result-layout\"],\n \"props\": {\n \"context\": {\n \"skusFilter\": \"ALL\",\n \"simulationBehavior\": \"skip\"\n }\n }\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 \"skusFilter\": \"ALL\",\n \"simulationBehavior\": \"skip\"\n }\n }\n },\n\n \"store.search#department\": {\n \"blocks\": [\"search-result-layout\"],\n \"props\": {\n \"context\": {\n \"skusFilter\": \"ALL\",\n \"simulationBehavior\": \"skip\"\n }\n }\n },\n\n \"store.search#category\": {\n \"blocks\": [\"search-result-layout\"],\n \"props\": {\n \"context\": {\n \"skusFilter\": \"ALL\",\n \"simulationBehavior\": \"skip\"\n }\n }\n },\n\n \"store.search#subcategory\": {\n \"blocks\": [\"search-result-layout\"],\n \"props\": {\n \"context\": {\n \"skusFilter\": \"ALL\",\n \"simulationBehavior\": \"skip\"\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 \"preventRouteChange\": false,\n \"defaultGalleryLayout\": \"grid\"\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 \"preventVerticalStretch\": true\n }\n },\n \"flex-layout.row#searchinfo\": {\n \"children\": [\"flex-layout.col#productCount\", \"flex-layout.row#orderByAndSwitcher\"]\n },\n \"flex-layout.row#orderByAndSwitcher\": {\n \"children\": [\"order-by.v2\", \"gallery-layout-switcher\"],\n \"props\": {\n \"horizontalAlign\": \"right\",\n \"preventHorizontalStretch\": true,\n \"blockClass\": \"orderByAndSwitcher\",\n \"colGap\": 3\n }\n },\n \"flex-layout.col#productCount\": {\n \"children\": [\"total-products.v2\"],\n \"props\": {\n \"blockClass\": \"productCountCol\"\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 \"search-fetch-previous\": {\n \"props\": {\n \"htmlElementForButton\": \"a\"\n }\n },\n \"search-fetch-more\": {\n \"props\": {\n \"htmlElementForButton\": \"a\"\n }\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#fetchprevious\",\n \"flex-layout.row#contentmobile\",\n \"flex-layout.row#fetchmore\"\n ],\n \"props\": {\n \"pagination\": \"show-more\",\n \"mobileLayout\": {\n \"mode1\": \"small\",\n \"mode2\": \"normal\"\n },\n \"defaultGalleryLayout\": \"grid\"\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\": [\"gallery-layout-switcher\"],\n \"props\": {\n \"verticalAlign\": \"middle\"\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 \"props\": {\n \"layouts\": [\n {\n \"name\": \"grid\",\n \"component\": \"GridSummary\",\n \"itemsPerRow\": {\n \"(min-width:1300px)\": 4,\n \"desktop\": 3,\n \"tablet\": 3,\n \"phone\": 2\n }\n },\n {\n \"name\": \"list\",\n \"component\": \"ListSummary\",\n \"itemsPerRow\": 1\n }\n ],\n \"ListSummary\": \"product-summary.shelf#listLayout\",\n \"GridSummary\": \"product-summary.shelf\"\n }\n },\n \"gallery-layout-switcher\": {\n \"children\": [\n /*\n * For accessbility to work properly,\n * It's important to define the options in the same order as the layouts\n */\n \"gallery-layout-option#grid\",\n \"gallery-layout-option#list\"\n ]\n },\n \"gallery-layout-option#grid\": {\n \"props\": {\n \"name\": \"grid\"\n },\n \"children\": [\n \"icon-grid\",\n \"responsive-layout.desktop#textOptionGrid\"\n ]\n },\n \"gallery-layout-option#list\": {\n \"props\": {\n \"name\": \"list\"\n },\n \"children\": [\n \"icon-inline-grid\",\n \"responsive-layout.desktop#textOptionList\"\n ]\n },\n \"responsive-layout.desktop#textOptionGrid\": {\n \"children\": [\n \"rich-text#option-grid\"\n ]\n },\n \"responsive-layout.desktop#textOptionList\": {\n \"children\": [\n \"rich-text#option-list\"\n ]\n },\n \"rich-text#option-grid\": {\n \"props\": {\n \"text\": \"Grid\",\n \"textColor\": \"c-auto\",\n \"blockClass\": \"layout-option\"\n }\n },\n \"rich-text#option-list\": {\n \"props\": {\n \"text\": \"List\",\n \"textColor\": \"c-auto\",\n \"blockClass\": \"layout-option\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_14d45bdf
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/contact.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.custom#contact-us\": {\n \"children\": [\n \"flex-layout.row#contact-us\"\n ]\n },\n\n \"flex-layout.row#contact-us\": {\n \"props\": {\n \"blockClass\": \"contact\"\n },\n \"children\": [\n \"flex-layout.col#contact-us\"\n ]\n },\n\n \"flex-layout.col#contact-us\": {\n \"children\": [\n \"rich-text#contact-us\",\n \"form#contact-us\"\n ]\n },\n \"rich-text#contact-us\": {\n \"props\": {\n \"text\": \"## Contact Us\"\n }\n },\n\n \"form#contact-us\": {\n \"props\": {\n \"entity\": \"contact\",\n \"schema\": \"site-contact\"\n },\n \"blocks\": [\n \"form-success#contact-us\"\n ],\n \"children\": [\n \"form-input.text#title\",\n \"form-input.text#name\",\n \"form-input.text#email\",\n \"form-input.textarea#message\",\n \"form-submit#contact\"\n ]\n },\n\n \"form-success#contact-us\": {\n \"children\": [\n \"rich-text#success-submit\"\n ]\n },\n \"rich-text#success-submit\": {\n \"props\": {\n \"text\": \"Thanks for reaching out! We will come back shortly.\",\n \"textAlignment\": \"CENTER\",\n \"textPosition\": \"CENTER\"\n }\n },\n\n \"form-input.text#title\": {\n \"props\": {\n \"pointer\": \"#/properties/title\"\n }\n },\n \"form-input.text#name\": {\n \"props\": {\n \"pointer\": \"#/properties/name\"\n }\n },\n \"form-input.text#email\": {\n \"props\": {\n \"pointer\": \"#/properties/email\"\n }\n },\n \"form-input.textarea#message\": {\n \"props\": {\n \"pointer\": \"#/properties/message\"\n }\n },\n\n \"form-submit#contact\": {\n \"props\": {\n \"label\": \"Submit\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_58d451c1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/orderplaced.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"order-placed\": {\n \"blocks\": [\"op-header\", \"op-order\"]\n },\n \"op-header\": {\n \"children\": [\n \"op-section#confirmation\",\n \"op-section#notices\",\n \"op-summary-section\",\n \"op-bank-invoice-section\"\n ]\n },\n \"op-section#confirmation\": {\n \"props\": {\n \"name\": \"confirmation\",\n \"marginBottom\": 9,\n \"borderless\": true\n },\n \"children\": [\n \"op-confirmation-icon\",\n \"op-confirmation-title\",\n \"op-confirmation-message\",\n \"flex-layout.row#confirmation-buttons\"\n ]\n },\n \"flex-layout.row#confirmation-buttons\": {\n \"props\": {\n \"blockClass\": \"confirmationButtons\",\n \"marginTop\": 8,\n \"marginBottom\": 8,\n \"horizontalAlign\": \"center\",\n \"preventHorizontalStretch\": true,\n \"preserveLayoutOnMobile\": true\n },\n \"children\": [\"flex-layout.col#confirmation-buttons\"]\n },\n \"flex-layout.col#confirmation-buttons\": {\n \"children\": [\"op-print-button\"]\n },\n \"op-section#notices\": {\n \"props\": {\n \"name\": \"notices\",\n \"marginBottom\": 9,\n \"borderless\": true\n },\n \"children\": [\"op-notices\"]\n },\n // each order section\n \"op-order\": {\n \"children\": [\n \"flex-layout.row#order-header\",\n \"op-order-split-notice\",\n \"op-order-customer\",\n \"op-section#payments\",\n \"op-section#pickup-packages\",\n \"op-section#delivery-packages\",\n \"op-order-takeaway-packages\",\n \"op-order-total\"\n ]\n },\n // each order header\n \"flex-layout.row#order-header\": {\n \"props\": {\n \"fullWidth\": true,\n \"colSizing\": \"auto\",\n \"colGap\": 5,\n \"marginBottom\": 5\n },\n \"children\": [\n \"flex-layout.col#order-header-info\",\n \"flex-layout.col#order-header-options\"\n ]\n },\n \"flex-layout.col#order-header-info\": {\n \"children\": [\"op-order-number\", \"op-order-datetime\", \"op-order-seller\"]\n },\n \"flex-layout.col#order-header-options\": {\n \"children\": [\"responsive-layout.desktop#order-options-desktop\"]\n },\n \"responsive-layout.desktop#order-options-desktop\": {\n \"children\": [\"op-order-options\"]\n },\n // payment section\n \"op-section#payments\": {\n \"props\": {\n \"name\": \"paymentMethods\"\n },\n \"children\": [\n \"op-order-payment\",\n \"responsive-layout.mobile#order-options-mobile\"\n ]\n },\n // bottom of top section of order header\n \"responsive-layout.mobile#order-options-mobile\": {\n \"children\": [\"op-order-options#mobile\"]\n },\n \"op-order-options#mobile\": {\n \"props\": {\n \"blockClass\": \"mobile\",\n \"fullWidth\": true\n }\n },\n \"op-section#pickup-packages\": {\n \"props\": {\n \"name\": \"pickupPackages\"\n },\n \"children\": [\"op-order-pickup-packages\"]\n },\n \"op-section#delivery-packages\": {\n \"props\": {\n \"name\": \"deliveryPackages\"\n },\n \"children\": [\"op-order-delivery-packages\"]\n }\n}\n\n```"
}
] |
code_training-week-demo_8c4ed34c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/faq.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.custom#faq\": {\n \"children\": [\n \"flex-layout.row#faq\"\n ]\n },\n\n \"flex-layout.row#faq\": {\n \"props\": {\n \"blockClass\": \"faq\"\n },\n \"children\": [\n \"flex-layout.col#faq\"\n ]\n },\n\n \"flex-layout.col#faq\": {\n \"children\": [\n \"rich-text#faq\",\n \"disclosure-layout-group#group\"\n ]\n },\n \"rich-text#faq\": {\n \"props\": {\n \"text\": \"## FAQ\"\n }\n },\n\n \"disclosure-layout-group#group\": {\n \"children\": [\n \"disclosure-layout#first\",\n \"disclosure-layout#second\",\n \"disclosure-layout#third\",\n \"disclosure-layout#fourth\"\n ]\n },\n\n \"disclosure-layout#first\": {\n \"props\": {\n \"animated\": true\n },\n \"children\": [\"disclosure-trigger#first\", \"disclosure-content#first\"]\n },\n \"disclosure-trigger#first\": {\n \"props\": {\n \"blockClass\": \"question\",\n \"as\": \"div\"\n },\n \"children\": [\"disclosure-state-indicator\", \"rich-text#question1\"]\n },\n \"disclosure-content#first\": {\n \"props\": {\n \"blockClass\": \"answer\"\n },\n \"children\": [\"rich-text#answer1\"]\n },\n \"rich-text#question1\": {\n \"props\": {\n \"text\": \"How can I change my shipping address?\"\n }\n },\n \"rich-text#answer1\": {\n \"props\": {\n \"text\": \"Call us at the number (212) 1234-1234.\"\n }\n },\n\n \"disclosure-layout#second\": {\n \"props\": {\n \"animated\": true\n },\n \"children\": [\"disclosure-trigger#second\", \"disclosure-content#second\"]\n },\n \"disclosure-trigger#second\": {\n \"props\": {\n \"blockClass\": \"question\",\n \"as\": \"div\"\n },\n \"children\": [\"disclosure-state-indicator\", \"rich-text#question2\"]\n },\n \"disclosure-content#second\": {\n \"props\": {\n \"blockClass\": \"answer\"\n },\n \"children\": [\"rich-text#answer2\"]\n },\n \"rich-text#question2\": {\n \"props\": {\n \"text\": \"How can I track my order?\"\n }\n },\n \"rich-text#answer2\": {\n \"props\": {\n \"text\": \"After logging into your account, you can find this info at the link Orders.\"\n }\n },\n\n\n \"disclosure-layout#third\": {\n \"props\": {\n \"animated\": true\n },\n \"children\": [\"disclosure-trigger#third\", \"disclosure-content#third\"]\n },\n \"disclosure-trigger#third\": {\n \"props\": {\n \"blockClass\": \"question\",\n \"as\": \"div\"\n },\n \"children\": [\"disclosure-state-indicator\", \"rich-text#question3\"]\n },\n \"disclosure-content#third\": {\n \"props\": {\n \"blockClass\": \"answer\"\n },\n \"children\": [\"rich-text#answer3\"]\n },\n \"rich-text#question3\": {\n \"props\": {\n \"text\": \"How can I change my shipping address?\"\n }\n },\n \"rich-text#answer3\": {\n \"props\": {\n \"text\": \"Call us at the number (212) 1234-1234.\"\n }\n },\n\n\n \"disclosure-layout#fourth\": {\n \"props\": {\n \"animated\": true\n },\n \"children\": [\"disclosure-trigger#fourth\", \"disclosure-content#fourth\"]\n },\n \"disclosure-trigger#fourth\": {\n \"props\": {\n \"blockClass\": \"question\",\n \"as\": \"div\"\n },\n \"children\": [\"disclosure-state-indicator\", \"rich-text#question4\"]\n },\n \"disclosure-content#fourth\": {\n \"props\": {\n \"blockClass\": \"answer\"\n },\n \"children\": [\"rich-text#answer2\"]\n },\n \"rich-text#question4\": {\n \"props\": {\n \"text\": \"How can I track my order?\"\n }\n },\n \"rich-text#answer4\": {\n \"props\": {\n \"text\": \"After logging into your account, you can find this info at the link Orders.\"\n }\n },\n\n\n \"disclosure-state-indicator\": {\n \"props\": {\n \"Show\": \"icon-caret#down\",\n \"Hide\": \"icon-caret#up\"\n }\n },\n \"icon-caret#down\": {\n \"props\": {\n \"orientation\": \"down\"\n }\n },\n \"icon-caret#up\": {\n \"props\": {\n \"orientation\": \"up\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_afc59b4b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/home/home.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.home\": {\n \"blocks\": [\n \"list-context.image-list#demo\",\n /* You can make references to blocks defined in other files.\n * For example, `flex-layout.row#deals` is defined in the `deals.json` file. */\n \"__fold__.experimentalLazyAssets\",\n \"flex-layout.row#deals\",\n // your custom component goes here (if you want 😄)\n \"rich-text#shelf-title\",\n \"flex-layout.row#shelf\",\n \"info-card#home\",\n \"rich-text#question\",\n \"rich-text#link\",\n \"newsletter\"\n ]\n },\n\n /**\n if your custom component has some kind of property settings,\n you can place them here. Example:\n\n \"my-custom-component-name\": {\n \"props\": {\n \"message\": \"VTEX IO is awesome!\"\n },\n \"children\": [\n \"rich-text\"\n ]\n },\n */\n\n \"list-context.image-list#demo\": {\n \"children\": [\"slider-layout#demo-images\"],\n \"props\": {\n \"height\": 720,\n \"images\": [\n {\n \"image\": \"https://storecomponents.vteximg.com.br/arquivos/banner-principal.png\",\n \"mobileImage\": \"https://storecomponents.vteximg.com.br/arquivos/banner-principal-mobile.jpg\"\n },\n {\n \"image\": \"https://storecomponents.vteximg.com.br/arquivos/banner.jpg\",\n \"mobileImage\": \"https://storecomponents.vteximg.com.br/arquivos/banner-principal-mobile.jpg\"\n }\n ]\n }\n },\n \"slider-layout#demo-images\": {\n \"props\": {\n \"itemsPerPage\": {\n \"desktop\": 1,\n \"tablet\": 1,\n \"phone\": 1\n },\n \"infinite\": true,\n \"showNavigationArrows\": \"desktopOnly\",\n \"blockClass\": \"carousel\"\n }\n },\n\n \"rich-text#shelf-title\": {\n \"props\": {\n \"text\": \"## Summer\",\n \"blockClass\": \"shelfTitle\"\n }\n },\n \"flex-layout.row#shelf\": {\n \"children\": [\"list-context.product-list#demo1\"]\n },\n \"list-context.product-list#demo1\": {\n \"blocks\": [\"product-summary.shelf\"],\n \"children\": [\"slider-layout#demo-products\"],\n \"props\": {\n \"orderBy\": \"OrderByTopSaleDESC\"\n }\n },\n \"slider-layout#demo-products\": {\n \"props\": {\n \"itemsPerPage\": {\n \"desktop\": 5,\n \"tablet\": 3,\n \"phone\": 1\n },\n \"infinite\": true,\n \"fullWidth\": false,\n \"blockClass\": \"shelf\"\n }\n },\n\n \"info-card#home\": {\n \"props\": {\n \"id\": \"info-card-home\",\n \"isFullModeStyle\": false,\n \"textPosition\": \"left\",\n \"imageUrl\": \"https://storecomponents.vteximg.com.br/arquivos/banner-infocard2.png\",\n \"headline\": \"Clearance Sale\",\n \"callToActionText\": \"DISCOVER\",\n \"callToActionUrl\": \"/sale/d\",\n \"blockClass\": \"info-card-home\",\n \"textAlignment\": \"center\"\n }\n },\n\n \"rich-text#question\": {\n \"props\": {\n \"text\": \"**This is an example store built using the VTEX platform.\\nWant to know more?**\",\n \"blockClass\": \"question\"\n }\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```"
}
] |
code_training-week-demo_7ee5f750
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/home/deals.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#deals\": {\n \"children\": [\n \"flex-layout.col#deals1\",\n \"flex-layout.col#deals2\",\n \"flex-layout.col#deals3\",\n \"flex-layout.col#deals4\"\n ],\n \"props\": {\n \"blockClass\": \"deals\"\n }\n },\n\n \"flex-layout.col#deals1\": {\n \"children\": [\n \"image#deal1\",\n \"rich-text#deal1\"\n ]\n },\n \"image#deal1\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/box.png\",\n \"maxHeight\": \"24px\"\n }\n },\n \"rich-text#deal1\": {\n \"props\": {\n \"text\": \"Free shipping\",\n \"blockClass\": \"deals\"\n }\n },\n \"flex-layout.col#deals2\": {\n \"children\": [\n \"image#deal2\",\n \"rich-text#deal2\"\n ]\n },\n \"image#deal2\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/delivery-fast.png\",\n \"maxHeight\": \"24px\"\n }\n },\n \"rich-text#deal2\": {\n \"props\": {\n \"text\": \"One day delivery\",\n \"blockClass\": \"deals\"\n }\n },\n \"flex-layout.col#deals3\": {\n \"children\": [\n \"image#deal3\",\n \"rich-text#deal3\"\n ]\n },\n \"image#deal3\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/store.png\",\n \"maxHeight\": \"24px\"\n }\n },\n \"rich-text#deal3\": {\n \"props\": {\n \"text\": \"Pick up in store\",\n \"blockClass\": \"deals\"\n }\n },\n \"flex-layout.col#deals4\": {\n \"children\": [\n \"image#deal4\",\n \"rich-text#deal4\"\n ]\n },\n \"image#deal4\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/coupon.png\",\n \"maxHeight\": \"24px\"\n }\n },\n \"rich-text#deal4\": {\n \"props\": {\n \"text\": \"Exclusive deals\",\n \"blockClass\": \"deals\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_49b8ffa2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/footer/footer.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"footer\": {\n \"blocks\": [\"footer-layout.desktop\", \"footer-layout.mobile\"]\n },\n \"footer-layout.desktop\": {\n \"children\": [\n \"flex-layout.row#footer-1-desktop\",\n \"flex-layout.row#footer-2-desktop\",\n \"flex-layout.row#footer-3-desktop\"\n ]\n },\n \"flex-layout.row#footer-1-desktop\": {\n \"children\": [\n \"vtex.menu@2.x:menu#Products\",\n \"vtex.menu@2.x:menu#footer-clothing\",\n \"vtex.menu@2.x:menu#footer-decoration\",\n \"vtex.menu@2.x:menu#footer-bags\",\n \"footer-spacer\",\n \"social-networks\"\n ],\n \"props\": {\n \"blockClass\": \"menu-row\",\n \"paddingTop\": 6,\n \"paddingBottom\": 3\n }\n },\n\n \"social-networks\": {\n \"props\": {\n \"socialNetworks\": [\n {\n \"name\": \"Facebook\",\n \"url\": \"https://www.facebook.com/vtexonline/\"\n },\n {\n \"name\": \"Instagram\",\n \"url\": \"https://www.instagram.com/vtextruecloud/\"\n },\n {\n \"name\": \"Twitter\",\n \"url\": \"https://twitter.com/vtexonline\"\n },\n {\n \"name\": \"Youtube\",\n \"url\": \"https://www.youtube.com/user/VTEXTV\"\n }\n ]\n }\n },\n\n \"flex-layout.row#footer-2-desktop\": {\n \"children\": [\"accepted-payment-methods\"],\n \"props\": {\n \"blockClass\": \"payment-methods\"\n }\n },\n \"accepted-payment-methods\": {\n \"props\": {\n \"paymentMethods\": [\"MasterCard\", \"Visa\", \"Diners Club\"]\n }\n },\n\n \"flex-layout.row#footer-3-desktop\": {\n \"children\": [\"rich-text#footer\"],\n \"props\": {\n \"blockClass\": \"credits\"\n }\n },\n \"rich-text#footer\": {\n \"props\": {\n \"text\": \"All stock and product photos are from photos.icons8.com\",\n \"blockClass\": \"footer\"\n }\n },\n\n \"footer-layout.mobile\": {\n \"children\": [\n \"flex-layout.row#1-footer-mobile\",\n \"flex-layout.row#2-footer-mobile\"\n ]\n },\n \"flex-layout.row#2-footer-mobile\": {\n \"children\": [\"flex-layout.col#footer-1-mobile\"],\n \"props\": {\n \"blockClass\": \"payment-methods\",\n \"paddingTop\": 4,\n \"paddingBottom\": 4\n }\n },\n \"flex-layout.col#footer-1-mobile\": {\n \"children\": [\n \"accepted-payment-methods\",\n \"social-networks\",\n \"rich-text#footer-mobile\"\n ],\n \"props\": {\n \"blockClass\": \"payment-methods\",\n \"paddingTop\": 4,\n \"paddingBottom\": 4,\n \"rowGap\": 4\n }\n },\n \"flex-layout.row#1-footer-mobile\": {\n \"props\": {\n \"paddingTop\": 4,\n \"paddingBottom\": 4\n },\n \"children\": [\"vtex.menu@2.x:menu#footer-mobile\"]\n },\n \"rich-text#footer-mobile\": {\n \"props\": {\n \"text\": \"All stock and product photos are from photos.icons8.com\",\n \"blockClass\": \"footer\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_d5f2e552
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/footer/menu.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"vtex.menu@2.x:menu#Products\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#news\",\n \"menu-item#blackfriday\",\n \"menu-item#sale\",\n \"menu-item#personalization\"\n ]\n },\n \"menu-item#news\": {\n \"props\": {\n \"id\": \"menu-item-news\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"News\",\n \"text\": \"News\"\n }\n }\n },\n \"menu-item#blackfriday\": {\n \"props\": {\n \"id\": \"menu-item-black-friday\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"BlackFriday\",\n \"text\": \"Black Friday\"\n }\n }\n },\n \"menu-item#sale\": {\n \"props\": {\n \"id\": \"menu-item-sale\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"Sale\",\n \"text\": \"Sale\"\n }\n }\n },\n \"menu-item#personalization\": {\n \"props\": {\n \"id\": \"menu-item-personalization\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"Personalization\",\n \"text\": \"Personalization\"\n }\n }\n },\n\n \"vtex.menu@2.x:menu#footer-decoration\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#smartphones\",\n \"menu-item#videogames\",\n \"menu-item#tvs\"\n ]\n },\n\n \"menu-item#smartphones\": {\n \"props\": {\n \"id\": \"menu-item-smartphones\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/decoration/smartphones\",\n \"noFollow\": true,\n \"tagTitle\": \"Smartphones\",\n \"text\": \"Smartphones\"\n }\n }\n },\n\n \"menu-item#videogames\": {\n \"props\": {\n \"id\": \"menu-item-videogames\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/decoration/videogames\",\n \"noFollow\": true,\n \"tagTitle\": \"Videogames\",\n \"text\": \"Videogames\"\n }\n }\n },\n\n \"menu-item#tvs\": {\n \"props\": {\n \"id\": \"menu-item-tvs\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/decoration/tvs\",\n \"noFollow\": true,\n \"tagTitle\": \"TVs\",\n \"text\": \"TVs\"\n }\n }\n },\n\n \"vtex.menu@2.x:menu#footer-bags\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#bags\",\n \"menu-item#backpacks\",\n \"menu-item#necessaire\"\n ]\n },\n\n \"menu-item#bags\": {\n \"props\": {\n \"id\": \"menu-item-bags\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/bags/d\",\n \"noFollow\": true,\n \"tagTitle\": \"Bags\",\n \"text\": \"Bags\"\n }\n }\n },\n\n \"menu-item#backpacks\": {\n \"props\": {\n \"id\": \"menu-item-backpacks\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/bags/backpacks\",\n \"noFollow\": true,\n \"tagTitle\": \"Backpacks\",\n \"text\": \"Backpacks\"\n }\n }\n },\n\n \"menu-item#necessaire\": {\n \"props\": {\n \"id\": \"menu-item-necessaire\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/bags/necessaire\",\n \"noFollow\": true,\n \"tagTitle\": \"Necessaire\",\n \"text\": \"Necessaire\"\n }\n }\n },\n\n \"vtex.menu@2.x:menu#footer-clothing\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#clothing\",\n \"menu-item#shorts\",\n \"menu-item#tank-tops\",\n \"menu-item#shirts\",\n \"menu-item#sweatshirt\",\n \"menu-item#cropped\"\n ]\n },\n\n \"vtex.menu@2.x:menu#footer-mobile\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#clothing-mobile\",\n \"menu-item#decoration-mobile\",\n \"menu-item#sale-mobile\"\n ]\n },\n\n \"menu-item#clothing-mobile\": {\n \"props\": {\n \"id\": \"menu-item-category-clothing\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/d\",\n \"noFollow\": true,\n \"tagTitle\": \"Clothing\",\n \"text\": \"Clothing\"\n }\n },\n \"blocks\": [\"vtex.menu@2.x:submenu.accordion#clothing\"]\n },\n \"vtex.menu@2.x:submenu.accordion#clothing\": {\n \"children\": [\"vtex.menu@2.x:menu#clothing-accordion\"]\n },\n\n \"vtex.menu@2.x:menu#clothing-accordion\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#shorts\",\n \"menu-item#tank-tops\",\n \"menu-item#shirts\",\n \"menu-item#sweatshirt\",\n \"menu-item#cropped\"\n ]\n },\n\n \"menu-item#decoration-mobile\": {\n \"props\": {\n \"itemProps\": {\n \"tagTitle\": \"Decoration\",\n \"text\": \"Decoration\"\n }\n },\n \"blocks\": [\"vtex.menu@2.x:submenu.accordion#decoration\"]\n },\n \"vtex.menu@2.x:submenu.accordion#decoration\": {\n \"children\": [\"vtex.menu@2.x:menu#footer-decoration-mobile\"]\n },\n\n \"vtex.menu@2.x:menu#footer-decoration-mobile\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#smartphones\",\n \"menu-item#videogames\",\n \"menu-item#tvs\"\n ]\n },\n\n \"menu-item#sale-mobile\": {\n \"props\": {\n \"itemProps\": {\n \"tagTitle\": \"Sale\",\n \"text\": \"Sale\"\n }\n },\n \"blocks\": [\"vtex.menu@2.x:submenu.accordion#sale\"]\n },\n \"vtex.menu@2.x:submenu.accordion#sale\": {\n \"children\": [\"vtex.menu@2.x:menu#footer-sale-mobile\"]\n },\n\n \"vtex.menu@2.x:menu#footer-sale-mobile\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#smartphones\",\n \"menu-item#videogames\",\n \"menu-item#tvs\"\n ]\n },\n\n \"menu-item#clothing\": {\n \"props\": {\n \"id\": \"menu-item-category-clothing\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/d\",\n \"noFollow\": true,\n \"tagTitle\": \"Clothing\",\n \"text\": \"Clothing\"\n }\n }\n },\n\n \"menu-item#shorts\": {\n \"props\": {\n \"id\": \"menu-item-shorts\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/shorts\",\n \"noFollow\": false,\n \"tagTitle\": \"Shorts\",\n \"text\": \"Shorts\"\n }\n }\n },\n\n \"menu-item#tank-tops\": {\n \"props\": {\n \"id\": \"menu-item-tank-tops\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/tank-tops\",\n \"noFollow\": false,\n \"tagTitle\": \"Tank tops\",\n \"text\": \"Tank tops\"\n }\n }\n },\n\n \"menu-item#shirts\": {\n \"props\": {\n \"id\": \"menu-item-shirts\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/shirts\",\n \"noFollow\": false,\n \"tagTitle\": \"Shirts\",\n \"text\": \"Shirts\"\n }\n }\n },\n\n \"menu-item#sweatshirt\": {\n \"props\": {\n \"id\": \"menu-item-sweat-shirts\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/sweatshirt\",\n \"noFollow\": false,\n \"tagTitle\": \"Sweatshirt\",\n \"text\": \"Sweatshirt\"\n }\n }\n },\n\n \"menu-item#cropped\": {\n \"props\": {\n \"id\": \"menu-item-cropped\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/cropped\",\n \"noFollow\": false,\n \"tagTitle\": \"Cropped\",\n \"text\": \"Cropped\"\n }\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_c4e766be
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/product-summary/product-summary.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-summary.shelf\": {\n \"children\": [\n \"stack-layout#prodsum\",\n \"product-summary-name\",\n \"flex-layout.col#productRating\",\n \"product-summary-space\",\n \"product-list-price#summary\",\n \"flex-layout.row#selling-price-savings\",\n \"product-installments#summary\",\n \"add-to-cart-button\"\n ]\n },\n \"flex-layout.col#productRating\": {\n \"props\": {\n \"blockClass\": \"productRating\"\n },\n \"children\": [\"product-rating-inline\"]\n },\n\n \"stack-layout#prodsum\": {\n \"children\": [\n \"product-summary-image#shelf\",\n \"vtex.product-highlights@2.x:product-highlights#collection\",\n \"modal-trigger#quickview\" // Check quickview.jsonc\n ]\n },\n\n \"product-summary-image#shelf\": {\n \"props\": {\n \"showBadge\": false,\n \"aspectRatio\": \"1:1\",\n \"maxHeight\": 300\n }\n },\n\n \"vtex.product-highlights@2.x:product-highlights#collection\": {\n \"props\": {\n \"type\": \"collection\"\n },\n \"children\": [\"product-highlight-wrapper\"]\n },\n \"product-highlight-wrapper\": {\n \"props\": {\n \"blockClass\": \"collection\"\n },\n \"children\": [\"product-highlight-text\"]\n },\n \"product-highlight-text\": {\n \"props\": {\n \"message\": \"{highlightName}\"\n }\n },\n\n \"product-list-price#summary\": {\n \"props\": {\n \"blockClass\": \"summary\"\n }\n },\n \"flex-layout.row#selling-price-savings\": {\n \"props\": {\n \"colGap\": 2,\n \"preserveLayoutOnMobile\": true,\n \"preventHorizontalStretch\": true,\n \"marginBottom\": 4\n },\n \"children\": [\n \"product-selling-price#summary\",\n \"product-price-savings#summary\"\n ]\n },\n \"product-installments#summary\": {\n \"props\": {\n \"blockClass\": \"summary\"\n }\n },\n \"product-selling-price#summary\": {\n \"props\": {\n \"blockClass\": \"summary\"\n }\n },\n \"product-price-savings#summary\": {\n \"props\": {\n \"markers\": [\n \"discount\"\n ],\n \"blockClass\": \"summary\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_fecd7c77
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/product-summary/quickview.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"modal-trigger#quickview\": {\n \"children\": [\n \"icon-expand\",\n \"modal-layout#quickview\"\n ],\n \"props\": {\n \"blockClass\": \"quickview\"\n }\n },\n\n \"modal-layout#quickview\": {\n \"children\": [\n \"modal-header#quickview\",\n \"flex-layout.row#quickview-main-row\"\n ],\n \"props\": {\n \"blockClass\": \"quickview\"\n }\n },\n \"modal-header#quickview\": {\n \"props\": {\n \"blockClass\": \"quickview\"\n }\n },\n\n \"modal-content#quickview\": {\n \"children\": [\n \"vtex.store-components:product-name\",\n \"flex-layout.col#quickviewPrice\",\n \"product-summary-sku-selector#quickview\"\n ],\n \"props\": {\n \"blockClass\": \"quickviewContent\"\n }\n },\n \"flex-layout.col#quickviewPrice\": {\n \"children\": [\n \"flex-layout.row#list-price-savings\",\n \"flex-layout.row#selling-price\",\n \"product-installments\"\n ]\n },\n \"modal-actions#quickview\": {\n \"props\": {\n \"blockClass\": \"quickview\"\n },\n \"children\": [\n \"flex-layout.row#quickview-actions-1\",\n \"flex-layout.row#quickview-actions-2\"\n ]\n },\n \"flex-layout.row#quickview-actions-1\": {\n \"children\": [\n \"flex-layout.col#quickview-product-quantity\",\n \"flex-layout.col#quickview-add-to-card-button\"\n ],\n \"props\": {\n \"colSizing\": \"auto\",\n \"colGap\": 6,\n \"blockClass\": \"addToCartRow\"\n }\n },\n\n \"flex-layout.col#quickview-product-quantity\": {\n \"children\": [\n \"product-summary-quantity#quickview\"\n ]\n },\n \"product-summary-quantity#quickview\": {\n \"props\": {\n \"showLabel\": false,\n \"size\": \"regular\"\n }\n },\n \"flex-layout.col#quickview-add-to-card-button\": {\n \"children\": [\n \"add-to-cart-button\"\n ],\n \"props\": {\n \"width\": \"grow\"\n }\n },\n\n \"flex-layout.row#quickview-actions-2\": {\n \"children\": [\n \"link.product#button-pdp\"\n ]\n },\n \"link.product#button-pdp\": {\n \"props\": {\n \"buttonProps\": {\n \"variant\": \"secondary\"\n },\n \"displayMode\": \"button\",\n \"label\": \"View details\",\n \"href\": \"/{slug}/p\"\n }\n },\n \"flex-layout.row#quickview-main-row\": {\n \"children\": [\n \"flex-layout.col#quickview-images\",\n \"flex-layout.col#quickview-product-details\"\n ],\n \"props\": {\n \"blockClass\": \"quickviewMainRow\"\n }\n },\n \"flex-layout.col#quickview-images\": {\n \"children\": [\n \"product-images#quickview\"\n ]\n },\n \"flex-layout.col#quickview-product-details\": {\n \"children\": [\n \"modal-content#quickview\",\n \"modal-actions#quickview\"\n ],\n \"props\": {\n \"preventVerticalStretch\": true,\n \"blockClass\": \"quickviewDetails\"\n }\n },\n \"product-summary-sku-selector#quickview\": {\n \"props\": {\n \"thumbnailImage\": \"skuvariation\",\n \"imageHeight\": 28,\n \"blockClass\": \"quickview\",\n \"visibility\": \"more-than-one\"\n }\n },\n \"vtex.store-components:product-name\": {\n \"props\": {\n \"blockClass\": \"quickview\"\n }\n },\n \"product-images#quickview\" : {\n \"props\": {\n \"blockClass\": \"quickview\",\n \"showNavigationArrows\": true\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_48d59a44
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/product-summary/product-summary-list.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-summary.shelf#listLayout\": {\n \"props\": {\n \"blockClass\": \"listLayout\"\n },\n \"children\": [\n \"responsive-layout.desktop#productSummaryList\",\n \"responsive-layout.mobile#productSummaryList\"\n ]\n },\n \"responsive-layout.desktop#productSummaryList\": {\n \"children\": [\n \"flex-layout.row#summaryListDesktop\"\n ]\n },\n \"responsive-layout.mobile#productSummaryList\": {\n \"children\": [\n \"flex-layout.row#summaryListMobile\"\n ]\n },\n \"product-price-savings#summaryPercentage\": {\n \"props\": {\n \"message\": \"{savingsPercentage}\",\n \"blockClass\": \"summaryPercentage\"\n }\n },\n \"flex-layout.row#savingsSummaryListDesktop\": {\n \"props\": {\n \"colSizing\": \"auto\",\n \"colGap\": 3,\n \"blockClass\": \"savingsSummaryListDesktop\"\n },\n \"children\": [\n \"product-price-savings#summaryPercentage\",\n \"product-price-savings#summary\"\n ]\n },\n \"flex-layout.row#summaryListDesktop\": {\n \"props\":{\n \"fullWidth\": true,\n \"colSizing\": \"auto\",\n \"blockClass\": \"summaryListDesktop\"\n },\n \"children\": [\n \"flex-layout.row#summaryLeftListDesktop\",\n \"flex-layout.col#summaryRightListDesktop\"\n ]\n },\n \"flex-layout.row#summaryLeftListDesktop\": {\n \"props\": {\n \"blockClass\": \"summaryLeftListDesktop\",\n \"colSizing\": \"auto\",\n \"colGap\": 7\n },\n \"children\": [\n \"stack-layout#summaryListDesktop\",\n \"flex-layout.col#summaryDetailsListDesktop\"\n ]\n },\n \"flex-layout.col#summaryDetailsListDesktop\": {\n \"props\": {\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"vtex.store-components:product-brand#summaryListDesktop\",\n \"product-summary-name#summaryListDesktop\",\n \"flex-layout.col#productRating\",\n \"flex-layout.row#productSpecifications\"\n ]\n },\n \"flex-layout.row#productSpecifications\": {\n \"children\": [\n \"product-specification-group#summary\"\n ]\n },\n \"product-summary-name#summaryListDesktop\": {\n \"props\": {\n \"blockClass\": \"summaryListDesktop\"\n }\n },\n \"vtex.store-components:product-brand#summaryListDesktop\": {\n \"props\": {\n \"displayMode\": \"text\",\n \"blockClass\": \"summaryListDesktop\"\n }\n },\n \"flex-layout.col#summaryRightListDesktop\": {\n \"props\": {\n \"blockClass\": \"summaryRightListDesktop\",\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"flex-layout.row#savingsSummaryListDesktop\",\n \"flex-layout.col#priceSummaryListDesktop\",\n \"flex-layout.row#buyButtonsSummaryListDesktop\"\n ]\n },\n \"flex-layout.row#buyButtonsSummaryListDesktop\": {\n \"props\": {\n \"colSizing\": \"auto\",\n \"colGap\": 5\n },\n \"children\": [\n \"add-to-cart-button\",\n \"flex-layout.row#buyNowButton\"\n ]\n },\n \"flex-layout.row#buyNowButton\": {\n \"props\": {\n \"blockClass\": \"buyNowButton\"\n },\n \"children\": [\n \"add-to-cart-button#buyNow\"\n ]\n },\n\n \"add-to-cart-button#buyNow\": {\n \"props\": {\n \"text\": \"BUY NOW\",\n \"isOneClickBuy\": true,\n \"onClickEventPropagation\": \"enabled\",\n \"blockClass\": \"buyNow\"\n }\n },\n \"flex-layout.col#priceSummaryListDesktop\": {\n \"children\": [\n \"product-selling-price#summary\",\n \"product-list-price#summary\"\n ]\n },\n \"stack-layout#summaryListDesktop\": {\n \"children\": [\n \"product-summary-image#summaryListDesktop\",\n \"vtex.product-highlights@2.x:product-highlights#collection\",\n \"modal-trigger#quickview\" // Check quickview.jsonc\n ]\n },\n \"product-summary-image#summaryListDesktop\": {\n \"props\": {\n \"showBadge\": false,\n \"aspectRatio\": \"1:1\",\n \"maxHeight\": 180,\n \"blockClass\": \"summaryListDesktop\"\n }\n },\n \"flex-layout.row#summaryListMobile\": {\n \"props\":{\n \"preserveLayoutOnMobile\": true,\n \"colSizing\": \"auto\",\n \"blockClass\": \"summaryListMobile\",\n \"colGap\": 5\n },\n \"children\": [\n \"stack-layout#summaryListMobile\",\n \"flex-layout.col#summaryDetailsListMobile\"\n ]\n },\n \"stack-layout#summaryListMobile\": {\n \"children\": [\n \"product-summary-image#summaryListMobile\",\n \"vtex.product-highlights@2.x:product-highlights#collection\",\n \"modal-trigger#quickview\" // Check quickview.jsonc\n ]\n },\n \"product-summary-image#summaryListMobile\": {\n \"props\": {\n \"showBadge\": false,\n \"aspectRatio\": \"1:1\",\n \"maxHeight\": 220,\n \"blockClass\": \"summaryListMobile\"\n }\n },\n \"flex-layout.col#summaryDetailsListMobile\": {\n \"props\": {\n \"preventVerticalStretch\": true,\n \"width\": \"grow\",\n \"blockClass\": \"summaryDetailsListMobile\"\n },\n \"children\": [\n \"flex-layout.col#summaryUpDetailsListMobile\",\n \"flex-layout.col#summaryDownDetailsListMobile\"\n ]\n },\n \"flex-layout.col#summaryUpDetailsListMobile\": {\n \"props\": {\n \"preventVerticalStretch\": true,\n \"blockClass\": \"summaryUpDetailsListMobile\"\n },\n \"children\": [\n \"vtex.store-components:product-brand#summaryListMobile\",\n \"product-summary-name#summaryListMobile\",\n \"product-rating-inline\"\n ]\n },\n \"flex-layout.col#summaryDownDetailsListMobile\": {\n \"props\": {\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"product-selling-price#summary\",\n \"product-installments#summary\"\n ]\n },\n \"vtex.store-components:product-brand#summaryListMobile\": {\n \"props\": {\n \"displayMode\": \"text\",\n \"blockClass\": \"summaryListMobile\"\n }\n },\n \"product-summary-name#summaryListMobile\": {\n \"props\": {\n \"tag\": \"div\",\n \"blockClass\": \"summaryListMobile\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_69db38c0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/product-summary/product-specification-list.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-specification-group#summary\": {\n \"children\": [\n \"product-specification#summary\"\n ]\n },\n \"product-specification#summary\": {\n \"children\": [\n \"flex-layout.row#summarySpecificationValues\"\n ]\n },\n \"flex-layout.row#summarySpecificationValues\": {\n \"props\": {\n \"preventHorizontalStretch\": true,\n \"colGap\": 3\n },\n \"children\": [\n \"rich-text#summarySpecificationBullet\",\n \"product-specification-values\"\n ]\n },\n \"rich-text#summarySpecificationBullet\": {\n \"props\": {\n \"text\": \"•\",\n \"textColor\": \"c-action-primary\",\n \"blockClass\": \"summarySpecificationBullet\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_8d7b0170
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/pdp/product-assembly.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"sticky-layout#buy-button\": {\n \"props\": {\n \"position\": \"bottom\"\n },\n \"children\": [\"flex-layout.row#buy-button\"]\n },\n \"product-assembly-options\": {\n \"children\": [\n \"flex-layout.row#product-assembly-options\",\n \"assembly-option-input-values\"\n ]\n },\n \"assembly-option-input-values\": {\n \"props\": {\n \"optionsDisplay\": \"box\"\n }\n },\n \"flex-layout.row#product-assembly-options\": {\n \"props\": {\n \"colGap\": 2,\n \"preserveLayoutOnMobile\": true,\n \"colSizing\": \"auto\"\n },\n \"children\": [\n \"flex-layout.col#product-assembly-image\",\n \"flex-layout.col#product-assembly-middle\",\n \"flex-layout.col#product-assembly-quantity\"\n ]\n },\n \"flex-layout.col#product-assembly-quantity\": {\n \"props\": {\n \"verticalAlign\": \"middle\"\n },\n \"children\": [\n \"assembly-option-item-quantity-selector\"\n ]\n },\n \"flex-layout.col#product-assembly-image\": {\n \"props\": {\n \"marginRight\": 4\n },\n \"children\": [\n \"assembly-option-item-image\"\n ]\n },\n \"flex-layout.col#product-assembly-middle\": {\n \"props\": {\n \"width\": \"grow\",\n \"verticalAlignment\": \"middle\"\n },\n \"children\": [\n \"assembly-option-item-name\",\n \"assembly-option-item-price\",\n \"assembly-option-item-children-description\",\n \"assembly-option-item-customize#first-level\"\n ]\n },\n \"assembly-option-item-customize#first-level\": {\n \"props\": {\n \"buttonProps\": {\n \"collapse\": \"left\"\n }\n },\n \"children\": [\n \"flex-layout.row#item-customize\",\n \"assembly-option-input-values\"\n ]\n },\n \"flex-layout.row#item-customize\": {\n \"props\": {\n \"colGap\": 2,\n \"preserveLayoutOnMobile\": true,\n \"colSizing\": \"auto\"\n },\n \"children\": [\n \"flex-layout.col#product-assembly-image\",\n \"flex-layout.col#item-customize-middle\",\n \"flex-layout.col#item-customize-quantity\"\n ]\n },\n \"flex-layout.col#item-customize-middle\": {\n \"props\": {\n \"width\": \"grow\",\n \"verticalAlignment\": \"middle\"\n },\n \"children\": [\n \"assembly-option-item-name\",\n \"assembly-option-item-price\",\n \"assembly-option-item-children-description\",\n \"assembly-option-item-customize#sec-level\"\n ]\n },\n \"flex-layout.col#item-customize-quantity\": {\n \"props\": {\n \"horizontalAlign\": \"right\",\n \"verticalAlign\": \"middle\"\n },\n \"children\": [\n \"assembly-option-item-quantity-selector\"\n ]\n },\n \"assembly-option-item-customize#sec-level\": {\n \"props\": {\n \"buttonProps\": {\n \"collapse\": \"left\"\n }\n },\n \"children\": [\n \"assembly-option-item-image\",\n \"assembly-option-item-name\",\n \"assembly-option-item-price\",\n \"assembly-option-item-quantity-selector\"\n ]\n }\n}\n\n```"
}
] |
code_training-week-demo_8e9820db
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/pdp/product-gifts.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-gifts\": {\n \"props\": {\n \"maxVisibleItems\": {\n \"desktop\": 1,\n \"mobile\": 1\n }\n },\n \"children\": [\"flex-layout.row#product-gifts-text\", \"product-gift-list\"]\n },\n\n \"flex-layout.row#product-gifts-text\": {\n \"props\": {\n \"verticalAlign\": \"middle\",\n \"colSizing\": \"auto\",\n \"preserveLayoutOnMobile\": true\n },\n \"children\": [\n \"rich-text#product-gifts\",\n \"flex-layout.col#product-gifts-text\"\n ]\n },\n \"flex-layout.col#product-gifts-text\": {\n \"children\": [\"modal-trigger#product-gifts\"],\n \"props\": {\n \"verticalAlign\": \"middle\"\n }\n },\n \"rich-text#product-gifts\": {\n \"props\": {\n \"text\": \"**+ GIFT**\"\n }\n },\n \"gift-text\": {\n \"props\": {\n \"blockClass\": \"default\",\n \"text\": \"{exceedingItems, plural, =0{} one {+ # gift} other {+ # gifts}}\"\n }\n },\n \"product-gift-list\": {\n \"children\": [\"flex-layout.row#gift\"]\n },\n \"flex-layout.row#gift\": {\n \"props\": {\n \"fullWidth\": true\n },\n \"children\": [\"flex-layout.col#gift-name-description\", \"gift-image\"]\n },\n \"flex-layout.col#gift-name-description\": {\n \"props\": {\n \"verticalAlign\": \"middle\",\n \"rowGap\": 3\n },\n \"children\": [\"gift-name\", \"gift-description\"]\n },\n\n \"modal-trigger#product-gifts\": {\n \"children\": [\"modal-layout#product-gifts\", \"gift-text\"],\n \"props\": {\n \"blockClass\": \"product-gifts\"\n }\n },\n \"modal-layout#product-gifts\": {\n \"props\": {\n \"blockClass\": \"product-gifts\",\n \"fullScreen\": {\n \"phone\": true,\n \"desktop\": false,\n \"tablet\": false\n }\n },\n \"children\": [\"product-gifts#modal\"]\n },\n\n \"product-gifts#modal\": {\n \"children\": [\"product-gift-list\"]\n }\n}\n\n```"
}
] |
code_training-week-demo_0293237f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/pdp/product.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.product\": {\n \"children\": [\n \"flex-layout.row#product-breadcrumb\",\n \"condition-layout.product#availability\",\n \"flex-layout.row#description\",\n \"flex-layout.row#specifications-title\",\n \"product-specification-group#table\",\n \"shelf.relatedProducts\",\n \"product-reviews\",\n \"product-questions-and-answers\"\n ]\n },\n \"flex-layout.row#specifications-title\": {\n \"children\": [\"rich-text#specifications\"]\n },\n \"rich-text#specifications\": {\n \"props\": {\n \"text\": \"##### Product Specifications\"\n }\n },\n \"flex-layout.row#product-breadcrumb\": {\n \"props\": {\n \"marginTop\": 4\n },\n \"children\": [\"breadcrumb\"]\n },\n \"flex-layout.row#description\": {\n \"props\": {\n \"marginBottom\": 7\n },\n \"children\": [\"product-description\"]\n },\n \"condition-layout.product#availability\": {\n \"props\": {\n \"conditions\": [\n {\n \"subject\": \"isProductAvailable\"\n }\n ],\n \"Then\": \"flex-layout.row#product-main\",\n \"Else\": \"flex-layout.row#product-availability\"\n }\n },\n \"flex-layout.row#product-main\": {\n \"props\": {\n \"colGap\": 7,\n \"rowGap\": 7,\n \"marginTop\": 4,\n \"marginBottom\": 7,\n \"paddingTop\": 7,\n \"paddingBottom\": 7\n },\n \"children\": [\"flex-layout.col#stack\", \"flex-layout.col#right-col\"]\n },\n\n \"stack-layout\": {\n \"props\": {\n \"blockClass\": \"product\"\n },\n \"children\": [\n \"flex-layout.row#product-image\",\n \"product-bookmark\",\n \"product-specification-badges\"\n ]\n },\n\n \"product-specification-badges\": {\n \"props\": {\n \"specificationGroupName\": \"Group\",\n \"specificationName\": \"On Sale\",\n \"visibleWhen\": \"True\",\n \"displayValue\": \"SPECIFICATION_NAME\"\n }\n },\n\n \"flex-layout.col#stack\": {\n \"children\": [\"stack-layout\"],\n \"props\": {\n \"width\": \"60%\",\n \"rowGap\": 0\n }\n },\n \"flex-layout.row#product-image\": {\n \"children\": [\"product-images\"]\n },\n \"product-images\": {\n \"props\": {\n \"aspectRatio\": {\n \"desktop\": \"auto\",\n \"phone\": \"16:9\"\n },\n \"displayThumbnailsArrows\": true\n }\n },\n \"flex-layout.col#right-col\": {\n \"props\": {\n \"preventVerticalStretch\": true,\n \"rowGap\": 0\n },\n \"children\": [\n // your custom component that uses `product-context` goes here (if you want 😄)\n \"flex-layout.row#product-name\",\n \"product-rating-summary\",\n \"flex-layout.row#list-price-savings\",\n \"flex-layout.row#selling-price\",\n \"product-installments\",\n \"product-separator\",\n \"product-identifier.product\",\n \"sku-selector\",\n \"product-quantity\",\n \"product-assembly-options\",\n \"product-gifts\",\n \"flex-layout.row#buy-button\",\n \"availability-subscriber\",\n \"shipping-simulator\",\n \"share#default\"\n ]\n },\n\n \"flex-layout.row#product-name\": {\n \"props\": {\n \"marginBottom\": 3\n },\n \"children\": [\"vtex.store-components:product-name\"]\n },\n\n \"sku-selector\": {\n \"props\": {\n \"variationsSpacing\": 3,\n \"showValueNameForImageVariation\": true\n }\n },\n\n \"flex-layout.row#buy-button\": {\n \"props\": {\n \"marginTop\": 4,\n \"marginBottom\": 7\n },\n \"children\": [\"add-to-cart-button\"]\n },\n\n \"flex-layout.row#product-availability\": {\n \"props\": {\n \"colGap\": 7,\n \"marginTop\": 4,\n \"marginBottom\": 7,\n \"paddingTop\": 7\n },\n \"children\": [\n \"flex-layout.col#stack\",\n \"flex-layout.col#right-col-availability\"\n ]\n },\n \"flex-layout.col#right-col-availability\": {\n \"props\": {\n \"preventVerticalStretch\": true,\n \"rowGap\": 0,\n \"blockClass\": \"info-availability\"\n },\n \"children\": [\n \"flex-layout.row#product-name\",\n \"product-identifier.product\",\n \"sku-selector\",\n \"flex-layout.row#availability\"\n ]\n },\n \"flex-layout.row#availability\": {\n \"props\": {\n \"blockClass\": \"message-availability\"\n },\n \"children\": [\"availability-subscriber\"]\n },\n\n \"share#default\": {\n \"props\": {\n \"social\": {\n \"Facebook\": true,\n \"WhatsApp\": true,\n \"Twitter\": false,\n \"Pinterest\": true\n }\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_b5b118ff
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/pdp/product-specifications-table.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-specification-group#table\": {\n \"children\": [\n \"flex-layout.row#spec-group\"\n ]\n },\n \"flex-layout.row#spec-group\": {\n \"props\": {\n \"blockClass\": \"productSpecificationGroup\"\n },\n \"children\": [\n \"flex-layout.col#spec-group\"\n ]\n },\n \"flex-layout.col#spec-group\": {\n \"children\": [\n \"flex-layout.row#spec-group-name\",\n \"product-specification\"\n ]\n },\n \"flex-layout.row#spec-group-name\": {\n \"props\": {\n \"blockClass\": \"productSpecificationGroupName\"\n },\n \"children\": [\n \"product-specification-text#group\"\n ]\n },\n \"product-specification\": {\n \"children\": [\n \"flex-layout.row#spec-item\"\n ]\n },\n \"flex-layout.row#spec-item\": {\n \"props\": {\n \"blockClass\": \"productSpecification\"\n },\n \"children\": [\n \"flex-layout.col#spec-name\",\n \"flex-layout.col#spec-value\"\n ]\n },\n \"flex-layout.col#spec-name\": {\n \"props\": {\n \"blockClass\": \"productSpecificationName\",\n \"width\": {\n \"mobile\": \"50%\",\n \"desktop\": \"25%\"\n }\n },\n \"children\": [\n \"product-specification-text#specification\"\n ]\n },\n \"flex-layout.col#spec-value\": {\n \"props\": {\n \"blockClass\": \"productSpecificationValue\"\n },\n \"children\": [\n \"product-specification-values\"\n ]\n },\n \"product-specification-values\": {\n \"children\": [\n \"product-specification-text#value\"\n ]\n },\n \"product-specification-text#group\": {\n \"props\": {\n \"message\": \"{groupName}\"\n }\n },\n \"product-specification-text#specification\": {\n \"props\": {\n \"message\": \"{specificationName}\"\n }\n },\n \"product-specification-text#value\": {\n \"props\": {\n \"message\": \"{specificationValue}\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_547ddee2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/header/category-menu.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"vtex.menu@2.x:menu#category-menu\": {\n \"props\": {\n \"experimentalOptimizeRendering\": true\n },\n \"children\": [\n \"menu-item#category-apparel\",\n \"menu-item#category-home\",\n \"menu-item#more\"\n ]\n },\n \"menu-item#category-apparel\": {\n \"props\": {\n \"id\": \"menu-item-category-apparel\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/apparel---accessories/\",\n \"noFollow\": false,\n \"tagTitle\": \"Apparel & Accessories\",\n \"text\": \"Apparel & Accessories\"\n }\n },\n \"blocks\": [\n \"vtex.menu@2.x:submenu#category-apparel\"\n ]\n },\n \"vtex.menu@2.x:submenu#category-apparel\": {\n \"props\": {\n \"width\": \"auto\"\n },\n \"children\": [\n \"vtex.menu@2.x:menu#category-apparel\"\n ]\n },\n \"vtex.menu@2.x:menu#category-apparel\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#category-apparel-clothing\",\n \"menu-item#category-apparel-accessories\",\n \"menu-item#category-apparel-eyeglasses\"\n ]\n },\n \"menu-item#category-apparel-clothing\": {\n \"props\": {\n \"id\": \"menu-item-category-apparel-clothing\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/apparel---accessories/clothing/\",\n \"noFollow\": false,\n \"tagTitle\": \"Clothing\",\n \"text\": \"Clothing\"\n }\n }\n },\n \"menu-item#category-apparel-accessories\": {\n \"props\": {\n \"id\": \"menu-item-category-apparel-accessories\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/apparel---accessories/accessories/\",\n \"noFollow\": false,\n \"tagTitle\": \"Accessories\",\n \"text\": \"Accessories\"\n }\n }\n },\n \"menu-item#category-apparel-eyeglasses\": {\n \"props\": {\n \"id\": \"menu-item-category-apparel-eyeglasses\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/apparel---accessories/eyeglasses/\",\n \"noFollow\": false,\n \"tagTitle\": \"Eyeglasses\",\n \"text\": \"Eyeglasses\"\n }\n }\n },\n \"menu-item#category-home\": {\n \"props\": {\n \"id\": \"menu-item-category-home\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/home---decor/\",\n \"noFollow\": false,\n \"tagTitle\": \"Home & Decor\",\n \"text\": \"Home & Decor\"\n }\n }\n },\n \"menu-item#more\": {\n \"props\": {\n \"id\": \"menu-item-custom-sale\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": true,\n \"tagTitle\": \"More\",\n \"text\": \"More\"\n }\n },\n \"blocks\": [\n \"vtex.menu@2.x:submenu#more\"\n ]\n },\n \"vtex.menu@2.x:submenu#more\": {\n \"props\": {\n \"width\": \"100%\"\n },\n \"children\": [\n \"flex-layout.row#menu-more\"\n ]\n },\n \"flex-layout.row#menu-more\": {\n \"children\": [\n \"flex-layout.col#menu-more-1\",\n \"flex-layout.col#menu-more-2\"\n ]\n },\n \"flex-layout.col#menu-more-1\": {\n \"children\": [\n \"vtex.menu@2.x:menu#more\"\n ]\n },\n \"flex-layout.col#menu-more-2\": {\n \"children\": [\n \"info-card#home\"\n ]\n },\n \"vtex.menu@2.x:menu#more\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#about-us\",\n \"menu-item#faq\"\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\": true,\n \"tagTitle\": \"About us\",\n \"text\": \"About us\"\n }\n }\n },\n \"menu-item#faq\": {\n \"props\": {\n \"id\": \"menu-item-faq\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/faq\",\n \"noFollow\": true,\n \"tagTitle\": \"FAQ\",\n \"text\": \"FAQ\"\n }\n }\n },\n \"menu-item#contact-us\": {\n \"props\": {\n \"id\": \"menu-item-contact-us\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/contact-us\",\n \"noFollow\": true,\n \"tagTitle\": \"Contact Us\",\n \"text\": \"Contact Us\"\n }\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_8590b6bd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/header/header.jsonc from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"header\": {\n \"blocks\": [\"header-layout.desktop\", \"header-layout.mobile\"]\n },\n \"header.full\": {\n \"blocks\": [\"header-layout.desktop\", \"header-layout.mobile\"]\n },\n \"header-layout.desktop\": {\n \"children\": [\n \"flex-layout.row#1-desktop\",\n \"flex-layout.row#2-desktop\",\n \"flex-layout.row#3-desktop\",\n \"sticky-layout#4-desktop\"\n ]\n },\n\n \"flex-layout.row#1-desktop\": {\n \"children\": [\"telemarketing\"],\n \"props\": {\n \"fullWidth\": true\n }\n },\n\n \"flex-layout.row#2-desktop\": {\n \"children\": [\"notification.bar#home\"],\n \"props\": {\n \"fullWidth\": \"true\"\n }\n },\n \"notification.bar#home\": {\n \"props\": {\n \"content\": \"SELECTED ITEMS ON SALE! CHECK IT OUT!\"\n }\n },\n \"flex-layout.row#3-desktop\": {\n \"props\": {\n \"blockClass\": \"menu-link\",\n \"horizontalAlign\": \"center\",\n \"preventHorizontalStretch\": true,\n \"preventVerticalStretch\": true,\n \"fullWidth\": true\n },\n \"children\": [\n \"vtex.menu@2.x:menu#websites\",\n \"flex-layout.col#spacer\",\n \"vtex.menu@2.x:menu#institutional\"\n ]\n },\n \"flex-layout.col#spacer\": {\n \"props\": {\n \"width\": \"grow\"\n }\n },\n \"sticky-layout#4-desktop\": {\n \"props\": {\n \"blockClass\": \"sticky-header\"\n },\n \"children\": [\"flex-layout.row#4-desktop\"]\n },\n \"flex-layout.row#4-desktop\": {\n \"props\": {\n \"blockClass\": \"main-header\",\n \"horizontalAlign\": \"center\",\n \"verticalAlign\": \"center\",\n \"preventHorizontalStretch\": true,\n \"preventVerticalStretch\": true,\n \"fullWidth\": true\n },\n \"children\": [\n \"flex-layout.col#logo-desktop\",\n \"flex-layout.col#category-menu\",\n \"flex-layout.col#spacer\",\n \"search-bar\",\n \"locale-switcher\",\n \"login\",\n \"minicart.v2\"\n ]\n },\n \"flex-layout.col#logo-desktop\": {\n \"props\": {\n \"verticalAlign\": \"middle\"\n },\n \"children\": [\"logo#desktop\"]\n },\n \"flex-layout.col#category-menu\": {\n \"props\": {\n \"verticalAlign\": \"middle\"\n },\n \"children\": [\"vtex.menu@2.x:menu#category-menu\"]\n },\n \"logo#desktop\": {\n \"props\": {\n \"title\": \"Logo\",\n \"href\": \"/\",\n \"url\": \"https://storecomponents.vteximg.com.br/arquivos/store-theme-logo.png\",\n \"width\": \"180\"\n }\n },\n \"header-layout.mobile\": {\n \"children\": [\"sticky-layout#1-mobile\"]\n },\n \"sticky-layout#1-mobile\": {\n \"children\": [\"flex-layout.row#1-mobile\"]\n },\n \"flex-layout.row#1-mobile\": {\n \"children\": [\n \"drawer\",\n \"logo#mobile\",\n \"flex-layout.col#spacer\",\n \"login\",\n \"minicart.v2\"\n ],\n \"props\": {\n \"blockClass\": \"main-header-mobile\",\n \"preventHorizontalStretch\": true,\n \"preserveLayoutOnMobile\": true,\n \"fullWidth\": true\n }\n },\n \"drawer\": {\n \"children\": [\"menu#drawer\"]\n },\n\n \"menu#drawer\": {\n \"children\": [\n \"menu-item#category-apparel\",\n \"menu-item#category-home\",\n \"menu-item#more\"\n ],\n \"props\": {\n \"orientation\": \"vertical\"\n }\n },\n\n \"logo#mobile\": {\n \"props\": {\n \"title\": \"Logo\",\n \"href\": \"/\",\n \"url\": \"https://storecomponents.vteximg.com.br/arquivos/store-theme-logo-mobile.png\",\n \"width\": \"70\"\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_a5eb9f2b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/store-theme/store/blocks/header/top-menu.json from the training-week-demo 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 \"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_training-week-demo_bd29a158
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/messages/pt.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/test\": \"teste\",\n \"store/test\": \"teste\"\n}\n```"
}
] |
code_training-week-demo_1f13f6e1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/messages/en.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/test\": \"test\",\n \"store/test\": \"test\"\n}\n\n```"
}
] |
code_training-week-demo_3f51847d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/messages/es.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/test\": \"teste\",\n \"store/test\": \"teste\"\n}\n```"
}
] |
code_training-week-demo_793753aa
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/react/package.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"CHANGE_ME\",\n \"version\": \"0.0.0\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.8\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.9.8\",\n \"@types/react\": \"^16.9.31\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.6.0\",\n \"trainingweekdev21.storefront-app\": \"https://demo--trainingweekdev21.myvtex.com/_v/private/typings/linked/v1/trainingweekdev21.storefront-app@0.1.0+build1632970466/public/@types/trainingweekdev21.storefront-app\",\n \"typescript\": \"3.9.7\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.10.0/public/@types/vtex.product-context\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.2/public/@types/vtex.render-runtime\",\n \"vtex.search-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-graphql@0.47.0/public/@types/vtex.search-graphql\",\n \"vtex.store-image\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-image@0.14.0/public/@types/vtex.store-image\"\n }\n}\n```"
}
] |
code_training-week-demo_ee15ae1e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/react/DrawnBadge.tsx from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n// import { useProduct } from 'vtex.product-context'\n// import { canUseDOM } from 'vtex.render-runtime'\n\ntype Props = {\n label?: string\n}\n\nconst DrawnBadge = ({ label }: Props) => {\n // const product = useProduct()\n\n return (\n <div className=\"pa3\">\n <span>\n {label ?? 'It should be a nice message 🤔'}\n </span>\n </div>\n )\n}\n\nexport default DrawnBadge\n\n```"
}
] |
code_training-week-demo_14d10eb3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/react/ProductDrawner.tsx from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n// import { useLazyQuery } from 'react-apollo'\n// import { Link } from 'vtex.render-runtime'\n// import { Image } from 'vtex.store-image'\n\n// import GET_PRODUCT from './graphql/getProduct.graphql'\n\nconst ProductDraw = (/** { productIds } */) => {\n // const [getProduct, { data, loading, called }] = useLazyQuery(GET_PRODUCT)\n\n return (\n <div className=\"flex flex-column items-center ma3\">\n <div>\n Where is the data?\n </div>\n <div>\n <button onClick={() => alert('clicked')}>Search new product</button>\n </div>\n </div>\n )\n}\n\nProductDraw.schema = {\n title: 'My component',\n type: 'object',\n properties: {},\n}\n\nexport default ProductDraw\n\n```"
}
] |
code_training-week-demo_38a16c90
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/store/interfaces.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"product-draw\": {\n \"component\": \"ProductDraw\"\n },\n \"drawn-badge\": {\n \"component\": \"DrawnBadge\"\n }\n}\n\n```"
}
] |
code_training-week-demo_61b975f4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/react/typings/gql.d.ts from the training-week-demo 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_training-week-demo_5fda21b7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/react/typings/css.d.ts from the training-week-demo 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_training-week-demo_1a42466e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/storefront-app/react/graphql/getProduct.graphql from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery MyProductQuery($id: ID!) {\n product(identifier: { field: id, value: $id }) {\n productId\n productName\n linkText\n items(filter: FIRST_AVAILABLE) {\n images {\n imageUrl\n }\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_2458553f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/docs/README.md from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# GraphQL Example\n\nA reference app implementing a VTEX IO service with GraphQL resolvers.\n\n\n\nWe use [**Apollo Server**](https://www.apollographql.com/docs/apollo-server/) as the underlying framework along with some tweaks for our platform.\n\nFor communicating with external services or other VTEX IO apps, we use the [**node-vtex-api**](https://github.com/vtex/node-vtex-api), a VTEX set of utilities for Node services. You can import this package using NPM from `@vtex/api` (already imported on this project)\n\n**Start from `graphq/schema.graphql` and `node/index.ts` and follow the comments and imports!**\n\nWhen _linking_ a GraphQL app, our CLI will automatically provide you a **[GraphiQL](https://github.com/graphql/graphiql) endpoint**, for you to test the functionalities. You can also access a specific app's GraphiQL through the **GraphQL IDE** section on the admin site (as long as the [admin-graphql-ide](https://github.com/vtex-apps/admin-graphql-ide) app is installed on that account).\n\nQueries, mutations and types defined on the `schema.graphql` will have theirs implementation on the `Service` object exported on `node/index.ts`.\n\n> For more information about our GraphQL services, check [**graphql-server**](https://github.com/vtex/graphql-server) and its _Wiki_ (VTEX internal only).\n\n## About GraphQL\n\nIt's important to understand what GraphQL is and how it compares with other popular API standards, such as REST.\n\nThere are many resources out there that can help understand the basics, so let's list a few of them here:\n\n- [GraphQL website](http://graphql.org/learn/)\n- [How to GraphQL](https://www.howtographql.com/basics/1-graphql-is-the-better-rest/)\n\n## Recipes\n\n### Configuring cache for specific queries\nCaching is one of the most important strategies for making applications **fast and responsive**. This is achieved by setting **cache control hints** in the GraphQL schema. Our GraphQL Server computes a cache expiration date by combining `@cacheControl` declarations from the fields returned by a specific request, whereas the props `maxAge` and `scope` can be defined. It errs on the safe side for requests with multiple `@cacheControl` declarations, so shorter `maxAge` results override longer, and `PRIVATE` scope overrides `PUBLIC`.\n\n- There are currently tree possible `maxAge`s _(LONG, MEDIUM and SHORT)_ and two possible `scope`s _(PRIVATE and PUBLIC)_.\n\nSuppose that we want to create a simple catalog app that has two types, `type Product` and `type Order`. Since products don't change quickly throughout the day and anyone can see them, they can be cached with a maxAge `LONG` in a `PUBLIC` scope. Order, on the other hand, is a per user entity and should have a PRIVATE scope. To achieve this behavior, the following annotations must be included to the schema\n\n```graphql\ntype Product @cacheControl(maxAge: LONG, scope: PUBLIC) {\n id: ID!\n name: String\n description: String\n}\n\ntype Order @cacheControl(scope: PRIVATE) {\n id: ID!\n statusDescription: String\n description: String\n}\n\ntype Query {\n listOrders: [Order]\n listProducts: [Product]\n}\n```\n\n> **Note** to know more on how these cache hints work, take a look at the [Apollo Server docs for caching](https://www.apollographql.com/docs/apollo-server/performance/caching/) \n\nSince our GraphQL implementation uses a CDN (Cloud-Front) to cache query responses, `PRIVATE` queries should land in a different endpoint from `PUBLIC` ones. Each endpoint have some configurations tweaks in the CDN and may lead to different behaviors. For example, to receive cookies in the backend, you need to be in a private route.\n\n### Caching requests when using public endpoint\n\nRequests to `graphql-server` using public endpoints are not cacheable, so they are given `cache-control` with `no-cache`. The way to override this behavior is to send the header `'x-vtex-cacheable': 'true'` on request.\n\n### Resolving conflicts (`@context` directive)\n\nLet's say that another app called `rewards-graphql` also defines a field named `products` inside the `Query` type. If both apps live on the same workspace/account it will cause some requests to fail, since our GraphQL server won't be able to automatically figure out which app should resolve that query.\n\nFor this use case we support a special directive called `@context`, which GraphQL clients can use to provide additional information to resolve these kind of conflicts.\n\n#### Specifying provider\n\nIf the client knows about a conflict (or in any case, for precaution), it can specify which app defined the field it's requesting. In the example we've mentioned above, with that new `rewards-graphql` app, the client could send the query like this:\n\n```graphql\nquery getProducts {\n products @context(provider: \"vtex.products-graphql\") {\n name\n }\n}\n```\n\nThis declares that we want to use the definition of `products` from `products-graphql`, not from `rewards-graphql`, so that it can properly rename and execute it.\n\n#### Specifying sender\n\nIn some cases it might be hard for a client to know that a conflict can happen, since an app doesn't know about all other apps that may be running on a workspace, it only knows about its own direct dependencies. At the same time, we'd like to restrict apps so that they can only access types/fields defined by apps they directly depend on.\n\nBoth these problems can be solved by using the `@context` directive again, but this time using the `sender` argument. Basically, apps sending requests to `graphql-server` should include this directive announcing their names, so that it can restrict which parts of the schema can be accessed. Note that restricting the access also makes it easier for apps to know exactly when they'd need to specify a `provider`, since conflicts with apps they don't know about will never happen.\n\nSo, let's say that an app called `client-app`, that depends only on `products-graphql` is sending a GraphQL request. Even if `rewards-graphql` is running in the current workspace it won't need to specify the provider anymore, just set the `sender`. \n\n```graphql\n{\n products @context(sender: \"vtex.client-app@1.2.3\") {\n name\n }\n}\n```\n\n**Note:** If you are requesting GraphQL data from React apps that uses the `react` builder the `sender` argument **is already baked** into every request it makes.\n\n## Splunk Dashboard\n\nWe have an (for now, VTEX-only, internal) Splunk dashboard to show all metrics related to your app. You can find it at:\n\nhttps://splunk72.vtex.com/en-US/app/vtex_io_apps/node_app_metrics\n\nAfter linking this app and making some requests, you can select `vtex.graphql-example` and see the metrics for your app. **Don't forget to check the box Development, as you are linking your app in a development workspace**.\n\n```"
}
] |
code_training-week-demo_5d85eb1a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/graphql/schema.graphql from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype OtherType {\n message: String\n}\n\ntype Query {\n # You can place comments here\n queryOne(argOne: String, argTwo: Int!): OtherType\n}\n\n```"
}
] |
code_training-week-demo_7b0271bc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/service.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"memory\": 256,\n \"ttl\": 10,\n \"timeout\": 1,\n \"minReplicas\": 2,\n \"maxReplicas\": 5,\n \"routes\": {\n \"changeMe\": {\n \"path\": \"/_v/change-me\",\n \"public\": true\n }\n }\n}\n\n```"
}
] |
code_training-week-demo_ea73b553
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/package.json from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"co-body\": \"^6.1.0\",\n \"ramda\": \"^0.27.1\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^6.1.0\",\n \"@types/node\": \"^12.0.0\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.45.4\",\n \"@vtex/tsconfig\": \"^0.5.6\",\n \"typescript\": \"3.9.7\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit && tslint -c tslint.json './**/*.ts'\"\n },\n \"version\": \"0.2.2\"\n}\n\n```"
}
] |
code_training-week-demo_c5425644
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/index.ts from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { method, ParamsContext, RecorderState, ServiceContext } from '@vtex/api'\nimport { Service } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { changeMeMiddleware } from './middlewares/changeMeMiddleware'\nimport { changeMeResolver } from './resolvers/changeMeResolver'\n\nconst MEDIUM_TIMEOUT_MS = 2 * 1000\n\ndeclare global {\n // We declare a global Context type just to avoid re-writing ServiceContext<Clients, State> in every handler and resolver\n type Context = ServiceContext<Clients>\n}\n\n// Export a service that defines resolvers and clients' options\nexport default new Service<Clients, RecorderState, ParamsContext>({\n clients: {\n implementation: Clients,\n options: {\n default: {\n timeout: MEDIUM_TIMEOUT_MS,\n },\n },\n },\n routes: {\n changeMe: method({\n GET: [changeMeMiddleware]\n }),\n // otherRoute: method({\n // POST: [otherMiddleware, anotherMiddleware]\n // })\n },\n graphql: {\n // Field resolvers usually go here\n resolvers: {\n Query: {\n // Change the names\n queryOne: changeMeResolver\n },\n Mutation: {\n // Do you have mutation resolvers?\n },\n },\n },\n})\n\n```"
}
] |
code_training-week-demo_e2c4dea8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/clients/index.ts from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nexport class Clients extends IOClients {\n // public get jsonPlaceholder() {\n // return this.getOrSet('jsonPlaceholder', JsonPlaceholderClient)\n // }\n\n // public get externalMasterdata() {\n // return this.getOrSet('externalMasterdata', ExternalMasterdata)\n // }\n}\n\n```"
}
] |
code_training-week-demo_e96141ff
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/typings/global.d.ts from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface UsersArgs {\n filter: string\n perPage: number\n pageNumber: number\n}\n\n```"
}
] |
code_training-week-demo_8fbe1d62
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/middlewares/changeMeMiddleware.ts from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// import { json } from 'co-body'\n\nexport async function changeMeMiddleware(ctx: Context, next: () => Promise<any>) {\n const { } = ctx\n\n // ctx.vtex.route.params\n\n // json(ctx.req)\n\n ctx.body = {\n message: 'I think you have to change me'\n }\n\n await next()\n}\n\n```"
}
] |
code_training-week-demo_ad440507
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/resolvers/changeMeResolver.ts from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const changeMeResolver = (\n _: unknown,\n _args: any /** the props that you defined in query arguments */,\n ctx: Context\n ) => {\n const {} = ctx\n\n return {\n message: 'I am almost sure that you have to change me'\n }\n}\n\n```"
}
] |
code_training-week-demo_f0bd4893
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/clients/externalMasterdata/index.ts from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ExternalClient, InstanceOptions, IOContext } from '@vtex/api'\n\nexport class ExternalMasterdata extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(`http://${context.account}.vtexcommercestable.com.br`, context, {\n ...options,\n headers: {\n ...options?.headers,\n ...(context.authToken\n ? { VtexIdclientAutCookie: context.authToken }\n : null),\n 'Content-Type': 'application/json',\n },\n })\n }\n\n public getCustomers = () => {\n return this.http.get(''/** what resource? */)\n }\n}\n\n```"
}
] |
code_training-week-demo_0fce6ac3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of training-week-demo/service-app/node/clients/jsonPlaceholder/index.ts from the training-week-demo VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\n\nexport class JsonPlaceholderClient extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super('' /** Base URL goes here */, context, options)\n }\n\n public getUsers = () => {\n // Implement a method to get users, you can use this.http.get (or other methods)\n }\n}\n\n```"
}
] |
code_inactive-sku_6044c6e5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of inactive-sku/docs/README.md from the inactive-sku VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Inactive SKU\n\nApp in VTEX that receives a notification when a SKU is changed or created, if the Sku doesnt have Image this in going to be inactive\n\n## How to install\n\n⚠️ First, make sure the broadcaster app is installed.\n\n\nRun command: `vtex install vtex.inactive-sku`\n\n```"
}
] |
code_inactive-sku_ba3c5bb3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of inactive-sku/node/service.json from the inactive-sku VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"memory\": 128,\n \"ttl\": 10,\n \"timeout\": 2,\n \"minReplicas\": 2,\n \"maxReplicas\": 10,\n \"workers\": 4,\n \"events\": {\n \"skuChange\": {\n \"keys\": [\"broadcaster.notification\"]\n }\n }\n}\n\n```"
}
] |
code_inactive-sku_5e66501c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of inactive-sku/node/package.json from the inactive-sku VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"co-body\": \"^6.0.0\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^0.0.3\",\n \"@types/node\": \"12.x\",\n \"@vtex/api\": \"6.45.24\",\n \"@vtex/tsconfig\": \"^0.5.6\",\n \"typescript\": \"3.9.7\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty && eslint -c .eslintrc.json --fix './**/*.ts'\"\n },\n \"version\": \"0.7.2\"\n}\n\n```"
}
] |
code_inactive-sku_c04759be
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of inactive-sku/node/index.ts from the inactive-sku VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type {\n IOClients,\n ParamsContext,\n ServiceContext,\n RecorderState,\n ClientsConfig,\n} from '@vtex/api'\nimport { Service } from '@vtex/api'\n\nimport { skuChange } from './events/skuChange'\nimport { Clients } from './clients'\n\nconst TIMEOUT_MS = 10000\nconst CONCURRENCY = 10\n\ndeclare global {\n type Context = ServiceContext<IOClients, State>\n\n interface State extends RecorderState {\n code: number\n }\n}\n\nconst clients: ClientsConfig<Clients> = {\n // We pass our custom implementation of the clients bag, containing the Status client.\n implementation: Clients,\n options: {\n // All IO Clients will be initialized with these options, unless otherwise specified.\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n },\n events: {\n exponentialTimeoutCoefficient: 2,\n exponentialBackoffCoefficient: 2,\n initialBackoffDelay: 50,\n retries: 1,\n timeout: TIMEOUT_MS,\n concurrency: CONCURRENCY,\n },\n },\n}\n\nexport default new Service<Clients, State, ParamsContext>({\n clients,\n events: {\n skuChange,\n },\n})\n\n```"
}
] |
code_inactive-sku_46152d1a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of inactive-sku/node/clients/index.ts from the inactive-sku VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport Catalog from './catalog'\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {\n public get catalog() {\n return this.getOrSet('catalog', Catalog)\n }\n}\n\n```"
}
] |
code_inactive-sku_f7ee858c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of inactive-sku/node/clients/catalog.ts from the inactive-sku VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\n\ninterface UpdateBody {\n ProductId: number,\n Name: string,\n PackagedHeight: number,\n PackagedLength: number,\n PackagedWidth: number,\n PackagedWeightKg: number,\n IsActive: boolean,\n ActivateIfPossible: boolean,\n}\n\nconst PRODUCT_URL = '/catalog/pvt/product/'\nconst SKU_URL = '/catalog/pvt/stockkeepingunit/'\nconst SKU_URL_image = \"/catalog_system/pvt/sku/stockkeepingunitbyid/\"\n// https://{accountName}.{environment}.com.br/api/catalog/pvt/stockkeepingunit/{skuId}\n\nexport default class Catalog extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(`http://${context.account}.myvtex.com/api`, context, {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie:\n context.adminUserAuthToken ?? context.authToken ?? '',\n 'X-Vtex-Use-Https': 'true',\n },\n })\n }\n\n public async getSku(skuId: string) {\n return this.http.get(`${SKU_URL}${skuId}`, {\n metric: 'get-product-by-sku-id',\n })\n }\n\n public async getSkuImage(skuId: string) {\n return this.http.get(`${SKU_URL_image}${skuId}`, {\n metric: 'get-product-by-sku-id',\n })\n }\n\n public async getProduct(productId: string) {\n return this.http.get(`${PRODUCT_URL}${productId}`, {\n metric: 'get-product-by-product-id',\n })\n }\n\n public async updateSku(data: UpdateBody, skuId: string) {\n return this.http.put(`${SKU_URL}${skuId}`, data, {\n metric: 'update-sku-by-sku-id',\n })\n }\n\n public async updateProduct(data: UpdateBody, productId: string) {\n return this.http.put(`${PRODUCT_URL}${productId}`, data, {\n metric: 'update-product-by-product-id',\n })\n }\n}\n\n```"
}
] |
code_inactive-sku_4a174698
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of inactive-sku/node/events/skuChange.ts from the inactive-sku VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { EventContext } from '@vtex/api'\nimport { LogLevel, NotFoundError, ResolverError } from '@vtex/api'\n\nimport type { Clients } from '../clients'\n\nexport async function skuChange(ctx: EventContext<Clients>) {\n const {\n clients: { catalog: catalogClient },\n } = ctx\n\n const { IdSku, HasStockKeepingUnitModified, IsActive } = ctx.body\n\n if (!HasStockKeepingUnitModified && !IsActive) return false\n\n let sku\n let skuImages\n\n try {\n sku = await catalogClient.getSku(IdSku)\n } catch (error) {\n const erroMessage = `SKU ${IdSku} not found.`\n const splunkError = {\n error: erroMessage,\n detail: error,\n }\n\n ctx.vtex.logger.log(splunkError, LogLevel.Error)\n throw new NotFoundError(erroMessage)\n }\n\n try {\n skuImages = await catalogClient.getSkuImage(IdSku)\n } catch (error) {\n const erroMessage = `SKU IMAGES ${IdSku} not found.`\n const splunkError = {\n error: erroMessage,\n detail: error,\n }\n\n ctx.vtex.logger.log(splunkError, LogLevel.Error)\n throw new NotFoundError(erroMessage)\n }\n\n if (skuImages.Images.length > 0) return false\n\n try {\n const bodyPayload = {\n ProductId: sku.ProductId,\n Name: sku.Name,\n PackagedHeight: sku.PackagedHeight,\n PackagedLength: sku.PackagedLength,\n PackagedWidth: sku.PackagedWidth,\n PackagedWeightKg: sku.PackagedWeightKg,\n IsActive: false,\n ActivateIfPossible: false\n }\n\n await catalogClient.updateSku(bodyPayload, sku.Id)\n } catch (error) {\n const erroMessage = `SKU ${sku.Id} cannot be updated.`\n const splunkError = {\n error: erroMessage,\n detail: error,\n }\n\n console.log('error', error)\n\n ctx.vtex.logger.log(splunkError, LogLevel.Error)\n throw new ResolverError(erroMessage)\n }\n\n return true\n}\n\n```"
}
] |
code_easy-shipping-setup_a06ee34f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/messages/en.json from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/delivery-settings.navigation.label\": \"Delivery Settings\",\n \"admin/delivery-settings.navigation.search.kws\": \"delivery, settings\",\n \"admin/shipping-policy.title\": \"Delivery settings\",\n \"admin/shipping-policy.name\": \"Delivery:\",\n \"admin/shipping-policy.label.holiday\": \"Holiday\",\n \"admin/shipping-policy.label.saturday\": \"Saturday\",\n \"admin/shipping-policy.label.sunday\": \"Sunday\",\n \"admin/shipping-policy.button.update\": \"Update\",\n \"admin/shipping-policy.toast.failure\": \"Delivery settings failed to update\",\n \"admin/shipping-policy.toast.success\": \"Delivery settings successfully updated\",\n \"admin/shipping-rate.delivery-cost\": \"Delivery cost\",\n \"admin/shipping-rate.delivery-time\": \"Delivery time (days)\",\n \"admin/promotion.label.free-delivery-threshold\": \"Free delivery threshold (e.g. 100)\",\n \"admin/promotion.label.isActive\": \"Free shipping\",\n \"admin/dock.name\": \"Dock:\",\n \"admin/warehouse.name\": \"Warehouse:\"\n}\n```"
}
] |
code_easy-shipping-setup_113ffa0c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/messages/ro.json from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/delivery-settings.navigation.label\": \"Setari livrare\",\n \"admin/delivery-settings.navigation.search.kws\": \"setari, livrare, setari livrare\",\n \"admin/shipping-policy.title\": \"Setari livrare\",\n \"admin/shipping-policy.name\": \"Livrare:\",\n \"admin/shipping-policy.label.holiday\": \"Sarbatoare\",\n \"admin/shipping-policy.label.saturday\": \"Sambata\",\n \"admin/shipping-policy.label.sunday\": \"Duminica\",\n \"admin/shipping-policy.button.update\": \"Modifica\",\n \"admin/shipping-policy.toast.failure\": \"Actualizare setari livrare esuata\",\n \"admin/shipping-policy.toast.success\": \"Actualizare setari livrare reusita\",\n \"admin/shipping-rate.delivery-cost\": \"Cost livrare\",\n \"admin/shipping-rate.delivery-time\": \"Timp de livrare (zile)\",\n \"admin/promotion.label.free-delivery-threshold\": \"Limita livrare gratuita (e.g. 100)\",\n \"admin/promotion.label.isActive\": \"Transport gratuit\",\n \"admin/dock.name\": \"Incarcare:\",\n \"admin/warehouse.name\": \"Depozit:\"\n}\n```"
}
] |
code_easy-shipping-setup_8d22500b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/admin/navigation.json from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"section\": \"orders\",\n \"titleId\": \"admin/delivery-settings.navigation.label\",\n \"searchKeyWordsHelpers\": \"admin/delivery-settings.navigation.search.kws\",\n \"path\": \"/admin/delivery-settings\"\n}\n```"
}
] |
code_easy-shipping-setup_a20f1d66
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/admin/routes.json from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin.app.delivery-settings\": {\n \"component\": \"DeliverySettings\",\n \"path\": \"/admin/app/delivery-settings\"\n }\n}\n```"
}
] |
code_easy-shipping-setup_f1e9cf04
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/graphql/shippingRate.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype ShippingRate {\n zipCodeStart: String\n zipCodeEnd: String\n weightStart: Int\n weightEnd: Int\n absoluteMoneyCost: String\n pricePercent: Int\n pricePercentByWeight: Int\n maxVolume: Int\n timeCost: String\n country: String\n operationType: Int\n polygon: String\n minimumValueInsurance: Int\n}\n```"
}
] |
code_easy-shipping-setup_6ed162f4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/graphql/schema.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Query {\n listAllShippingPolicies: ShippingPolicyResponse\n listAllWarehouses: [WarehouseResponse]\n listAllDocks: [DockResponse]\n listShippingRate(carrierId: String, zipCode: String): [ShippingRate]\n listPromotionById(promotionId: String): Promotion\n listAllPromotions: PromotionResponse\n}\n\ntype Mutation {\n updateShippingPolicy(input: ShippingPolicyInput!): ShippingPolicy\n updateShippingRate(carrierId: String, searchZipCode: String, input: [ShippingRateInput]): ShippingRate\n createDock: Boolean\n createWarehouse: Boolean\n createOrUpdatePromotion(\n newTotalValueFloor: Float,\n promotionId: String,\n beginDateUtc: String,\n endDateUtc: String,\n isActive: Boolean\n ): Promotion\n}\n\ninput ShippingPolicyInput {\n id: String\n name: String\n shippingMethod: String\n isHolidayActive: Boolean\n isSaturdayActive: Boolean\n isSundayActive: Boolean\n largestMeasure: Float\n maxMeasureSum: Float\n isActive: Boolean\n}\n\ninput ShippingRateInput {\n zipCodeStart: String\n zipCodeEnd: String\n weightStart: Int\n weightEnd: Int\n absoluteMoneyCost: String\n pricePercent: Int\n pricePercentByWeight: Int\n maxVolume: Int\n timeCost: String\n timeCostToDisplay: String\n country: String\n operationType: Int\n polygon: String\n minimumValueInsurance: Int\n}\n\n```"
}
] |
code_easy-shipping-setup_cabec6de
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/graphql/shippingPolicy.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype ShippingPolicyResponse {\n items: [ShippingPolicy]\n}\n\ntype ShippingPolicy {\n id: String\n name: String\n shippingMethod: String\n weekendAndHolidays: WeekendAndHolidaysSettings\n maxDimension: MaxDimensionSettings\n isActive: Boolean\n}\n\ntype WeekendAndHolidaysSettings {\n saturday: Boolean\n sunday: Boolean\n holiday: Boolean\n}\n\ntype MaxDimensionSettings {\n largestMeasure: Float\n maxMeasureSum: Float\n}\n```"
}
] |
code_easy-shipping-setup_b1cd3cd8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/graphql/promotion.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype PromotionResponse {\n limitConfiguration: LimitConfiguration\n limitConfigurationMaxPrice: LimitConfigurationMaxPrice\n items: [PromotionItem]\n disabledItems: [String]\n archivedItems: [String]\n}\n\ntype LimitConfigurationMaxPrice {\n activesCount: Int\n limit: Int\n}\n\ntype LimitConfiguration {\n activesCount: Int\n limit: Int\n}\n\ntype PromotionItem {\n idCalculatorConfiguration: String\n name: String\n isActive: Boolean\n}\n\ntype Promotion {\n idCalculatorConfiguration: String\n name: String\n description: String\n beginDateUtc: String\n endDateUtc: String\n lastModified: String\n daysAgoOfPurchases: Int\n isActive: Boolean\n isArchived: Boolean\n isFeatured: Boolean\n activeDaysOfWeek: [String]\n offset: Int\n activateGiftsMultiplier: Boolean\n newOffset: Float\n cumulative: Boolean\n nominalShippingDiscountValue: Float\n absoluteShippingDiscountValue: Float\n nominalDiscountValue: Float\n maximumUnitPriceDiscount: Float\n percentualDiscountValue: Float\n rebatePercentualDiscountValue: Float\n percentualShippingDiscountValue: Float\n percentualTax: Float\n shippingPercentualTax: Float\n percentualDiscountValueList1: Float\n percentualDiscountValueList2: Float\n skusGift: SkuGift\n nominalRewardValue: Float\n percentualRewardValue: Float\n orderStatusRewardValue: String\n maxNumberOfAffectedItems: Int\n maxNumberOfAffectedItemsGroupKey: String\n applyToAllShippings: Boolean\n nominalTax: Float\n origin: String\n idSellerIsInclusive: Boolean\n idsSalesChannel: [String]\n areSalesChannelIdsExclusive: Boolean\n marketingTags: [String]\n marketingTagsAreNotInclusive: Boolean\n paymentsMethods: [String]\n campaigns: [String]\n categories: [String]\n categoriesAreInclusive: Boolean\n brands: [String]\n brandsAreInclusive: Boolean\n products: [String]\n productsAreInclusive: Boolean\n skus: [String]\n skusAreInclusive: Boolean\n collections1BuyTogether: [String]\n minimumQuantityBuyTogether: Int\n quantityToAffectBuyTogether: Int\n enableBuyTogetherPerSku: Boolean\n listSku1BuyTogether: [String]\n listSku2BuyTogether: [String]\n totalValueFloor: Float\n totalValueCeling: Float\n totalValueMode: String\n collections: [String]\n collectionsIsInclusive: Boolean\n restrictionsBins: [String]\n totalValuePurchase: Float\n slasIds: [String]\n isSlaSelected: Boolean\n isFirstBuy: Boolean\n firstBuyIsProfileOptimistic: Boolean\n compareListPriceAndPrice: Boolean\n isDifferentListPriceAndPrice: Boolean\n zipCodeRanges: [String]\n itemMaxPrice: Float\n itemMinPrice: Float\n isMinMaxInstallments: Boolean\n minInstallment: Int\n maxInstallment: Int\n clusterExpressions: [String]\n clusterOperator: String\n giftListTypes: [String]\n affiliates: [String]\n maxUsage: Int\n maxUsagePerClient: Int\n multipleUsePerClient: Boolean\n type: String\n useNewProgressiveAlgorithm: Boolean\n}\n\ntype SkuGift {\n quantitySelectable: Int\n gifts: [Gift]\n}\n\ntype Gift {\n id: String\n name: String\n quantity: Int\n sellers: [Seller]\n}\n\ntype Seller {\n id: String\n name: String\n}\n\n```"
}
] |
code_easy-shipping-setup_7e00f883
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/graphql/warehouse.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype WarehouseResponse {\n id: String\n name: String\n warehouseDocks: [Dock]\n isActive: Boolean\n}\n\ntype Dock {\n dockId: String\n}\n```"
}
] |
code_easy-shipping-setup_3142bac3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/graphql/dock.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype DockResponse {\n id: String\n name: String\n isActive: Boolean\n}\n```"
}
] |
code_easy-shipping-setup_42968ac1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/service.json from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"memory\": 128,\n \"ttl\": 10,\n \"timeout\": 10,\n \"minReplicas\": 2,\n \"maxReplicas\": 10,\n \"workers\": 4\n}\n```"
}
] |
code_easy-shipping-setup_14c5ede7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/package.json from the easy-shipping-setup 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\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.45.12\",\n \"@vtex/test-tools\": \"^1.0.0\",\n \"tslint\": \"^5.14.0\",\n \"tslint-config-vtex\": \"^2.1.0\",\n \"typescript\": \"3.9.7\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty && tslint -c tslint.json --fix './**/*.ts'\"\n },\n \"version\": \"1.0.2\"\n}\n\n```"
}
] |
code_easy-shipping-setup_6140ef2a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/index.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type {\n ClientsConfig,\n ServiceContext,\n ParamsContext,\n RecorderState,\n} from '@vtex/api'\nimport { LRUCache, Service } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { resolvers } from './resolvers'\n\nconst TIMEOUT_MS = 800\n\nconst memoryCache = new LRUCache<string, any>({ max: 5000 })\n\nmetrics.trackCache('status', memoryCache)\n\nconst clients: ClientsConfig<Clients> = {\n implementation: Clients,\n options: {\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n }\n },\n}\n\ndeclare global {\n type Context = ServiceContext<Clients, State>\n\n interface State extends RecorderState {\n code: number\n payload: any\n }\n}\n\nexport default new Service<Clients, State, ParamsContext>({\n clients,\n graphql: {\n resolvers\n },\n})\n```"
}
] |
code_easy-shipping-setup_092e0662
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/DeliverySettings.tsx from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC, useEffect, useState } from 'react'\nimport { useQuery, useLazyQuery, useMutation } from 'react-apollo'\nimport { useIntl } from 'react-intl'\n\nimport GET_SHIPPING_POLICIES from './graphql/shipping.graphql'\nimport GET_WAREHOUSES from './graphql/warehouse.graphql'\nimport GET_DOCKS from './graphql/dock.graphql'\nimport GET_SHIPPING_RATES from './graphql/freight.graphql'\nimport GET_PROMOTIONS from './graphql/allPromotions.graphql'\nimport GET_PROMOTION_BY_ID from './graphql/promotion.graphql'\nimport UPDATE_SHIPPING_RATE from './graphql/updateShippingRate.graphql'\nimport UPDATE_SHIPPING_POLICY from './graphql/updateShippingPolicy.graphql'\nimport CREATE_OR_UPDATE_PROMOTION from './graphql/createOrUpdatePromotion.graphql'\nimport CREATE_DOCK from './graphql/createDock.graphql'\nimport CREATE_WAREHOUSE from './graphql/createWarehouse.graphql'\n\nimport {\n Layout,\n PageBlock,\n PageHeader,\n ToastProvider,\n ToastConsumer,\n Input,\n Divider,\n Toggle,\n Button,\n Spinner,\n} from 'vtex.styleguide'\n\ninterface ShippingRateInput {\n carrierId: string\n searchZipCode: string\n input: [ShippingRateInputData]\n}\n\ninterface ShippingRateInputData {\n zipCodeStart: string\n zipCodeEnd: string\n weightStart: number\n weightEnd: number\n absoluteMoneyCost: string\n pricePercent: number\n pricePercentByWeight: number\n maxVolume: number\n timeCost: string\n timeCostToDisplay: string\n country: string\n operationType: number\n polygon: string\n minimumValueInsurance: number\n}\n\ninterface ShippingPolicyInput {\n id: String\n name: String\n shippingMethod: String\n isSaturdayActive: Boolean\n isSundayActive: Boolean\n isHolidayActive: Boolean\n largestMeasure: Number\n maxMeasureSum: Number\n isActive: Boolean\n}\n\nconst DeliverySettings: FC = () => {\n const intl = useIntl()\n\n const [idCalculatorConfiguration, setIdCalculatorConfiguration] = useState('')\n const [shippingRate, setShippingRate] = useState<ShippingRateInput>({\n carrierId: '1',\n searchZipCode: '0',\n input: [{} as ShippingRateInputData],\n })\n\n const [shippingPolicy, setShippingPolicy] = useState<ShippingPolicyInput>(\n {} as ShippingPolicyInput\n )\n const [promotion, setPromotion] = useState({} as any)\n const [isActive, setIsActive] = useState(false)\n const [freeDeliveryThreshold, setFreeDeliveryThreshold] = useState(0)\n const [isLoading, setIsLoading] = useState(true)\n\n const [updateShippingRate] = useMutation(UPDATE_SHIPPING_RATE, {\n refetchQueries: [\n {\n query: GET_SHIPPING_RATES,\n variables: { carrierId: shippingRate.carrierId, zipCode: '0' },\n },\n ],\n })\n\n const [createDock] = useMutation(CREATE_DOCK, {\n refetchQueries: [{ query: GET_DOCKS }],\n })\n\n const [createWarehouse] = useMutation(CREATE_WAREHOUSE, {\n refetchQueries: [{ query: GET_WAREHOUSES }],\n })\n\n const [updateShippingPolicy] = useMutation(UPDATE_SHIPPING_POLICY, {\n refetchQueries: [{ query: GET_SHIPPING_POLICIES }],\n })\n\n const [createOrUpdatePromotion] = useMutation(CREATE_OR_UPDATE_PROMOTION, {\n refetchQueries: [{ query: GET_PROMOTIONS }],\n })\n\n const { data: warehouseData, loading: warehouseLoading } = useQuery(\n GET_WAREHOUSES,\n { ssr: false }\n )\n const { data: dockData, loading: dockLoading } = useQuery(GET_DOCKS, {\n ssr: false,\n })\n const {\n data: shippingPolicyData,\n error,\n loading: shippingPolicyLoading,\n } = useQuery(GET_SHIPPING_POLICIES, { ssr: false })\n const { data: allPromotionsData, loading: allPromotionsLoading } = useQuery(\n GET_PROMOTIONS,\n { ssr: false }\n )\n\n const [\n getShippingRates,\n { data: shippingRateData, loading: shippingRateLoading },\n ] = useLazyQuery(GET_SHIPPING_RATES)\n const [getPromotionData, { data: promotionData, loading: promotionLoading }] =\n useLazyQuery(GET_PROMOTION_BY_ID)\n\n useEffect(() => {\n if (!dockLoading && dockData.listAllDocks.length === 0) {\n createDock().then((result) => {\n if (result.data?.createDock === true) {\n if (\n !warehouseLoading &&\n warehouseData?.listAllWarehouses?.length === 0\n )\n createWarehouse()\n }\n })\n }\n }, [warehouseData, dockData])\n\n useEffect(() => {\n if (\n !shippingRateLoading &&\n !allPromotionsLoading &&\n !shippingRateLoading &&\n !promotionLoading &&\n !dockLoading &&\n !warehouseLoading\n )\n setIsLoading(false)\n }, [\n shippingPolicyLoading,\n allPromotionsLoading,\n shippingRateLoading,\n promotionLoading,\n warehouseLoading,\n dockLoading,\n ])\n\n let filteredPromotion: any = []\n useEffect(() => {\n if (allPromotionsData?.listAllPromotions?.items?.length) {\n filteredPromotion = allPromotionsData.listAllPromotions.items.filter(\n (item: any) => item.name === 'Free delivery'\n )\n setIdCalculatorConfiguration(\n filteredPromotion[0].idCalculatorConfiguration\n )\n }\n }, [allPromotionsData])\n\n useEffect(() => {\n if (idCalculatorConfiguration.length === 0) return\n\n getPromotionData({\n variables: {\n promotionId: idCalculatorConfiguration,\n },\n })\n }, [idCalculatorConfiguration])\n\n useEffect(() => {\n if (!shippingPolicyData?.listAllShippingPolicies?.items.length || error)\n return\n\n let policy = shippingPolicyData.listAllShippingPolicies.items[0]\n\n setShippingPolicy({\n id: policy.id,\n name: policy.name !== 'Standard' ? 'Standard' : policy.name,\n shippingMethod:\n policy.shippingMethod !== 'Standard'\n ? 'Standard'\n : policy.shippingMethod,\n isSaturdayActive: policy.weekendAndHolidays.saturday,\n isSundayActive: policy.weekendAndHolidays.sunday,\n isHolidayActive: policy.weekendAndHolidays.holiday,\n largestMeasure: policy.maxDimension.largestMeasure,\n maxMeasureSum: policy.maxDimension.maxMeasureSum,\n isActive: policy.isActive,\n })\n\n getShippingRates({\n variables: {\n carrierId: policy.id,\n zipCode: '0',\n },\n })\n }, [shippingPolicyData])\n\n useEffect(() => {\n if (!shippingRateData) return\n\n setShippingRate({\n carrierId: shippingPolicyData.listAllShippingPolicies.items[0].id,\n searchZipCode: '0',\n input: shippingRateData.listShippingRate.map(\n (rate: ShippingRateInputData) => ({\n zipCodeStart: rate.zipCodeStart,\n zipCodeEnd: rate.zipCodeEnd,\n weightStart: rate.weightStart,\n weightEnd: rate.weightEnd,\n absoluteMoneyCost: rate.absoluteMoneyCost,\n pricePercent: rate.pricePercent,\n pricePercentByWeight: rate.pricePercentByWeight,\n maxVolume: rate.maxVolume,\n timeCost: rate.timeCost,\n timeCostToDisplay: rate.timeCost.split('.')[0],\n country: rate.country,\n operationType: 2,\n polygon: rate.polygon,\n minimumValueInsurance: rate.minimumValueInsurance,\n })\n ),\n })\n }, [shippingRateData])\n\n useEffect(() => {\n if (!promotionData) return\n\n setPromotion(promotionData)\n setIsActive(promotionData.listPromotionById.isActive)\n setFreeDeliveryThreshold(promotionData.listPromotionById.totalValueFloor)\n }, [promotionData])\n\n const handleChangeRate = (e: any) => {\n shippingRate.input[0].absoluteMoneyCost = e.target.value\n setShippingRate({\n ...shippingRate,\n input: shippingRate.input,\n })\n }\n\n const handleChangeDelivery = (e: any) => {\n shippingRate.input[0].timeCost =\n e.target.value.length <= 4 ? e.target.value + '.00:00:00' : e.target.value\n shippingRate.input[0].timeCostToDisplay = e.target.value\n setShippingRate({\n ...shippingRate,\n input: shippingRate.input,\n })\n }\n\n const handlePromotionChange = (e: any) => {\n const threshold = e.target.value\n setFreeDeliveryThreshold(threshold)\n }\n\n const handleToggleChange = () => {\n setIsActive(!isActive)\n }\n\n const handleSubmit = async (showToast: any) => {\n try {\n setIsLoading(true)\n if (freeDeliveryThreshold !== 0) {\n handlePromotionSubmit()\n }\n\n await updateShippingRate({\n variables: {\n ...shippingRate,\n },\n })\n\n await updateShippingPolicy({\n variables: {\n ...shippingPolicy,\n },\n }).catch((err) => {\n setIsLoading(false)\n console.error(err)\n showToast({\n message: intl.formatMessage({\n id: 'admin/shipping-policy.toast.failure',\n }),\n duration: 5000,\n })\n })\n } catch (err) {\n console.error(err)\n } finally {\n setIsLoading(false)\n showToast({\n message: intl.formatMessage({\n id: 'admin/shipping-policy.toast.success',\n }),\n duration: 5000,\n })\n }\n }\n\n const handlePromotionSubmit = () => {\n createOrUpdatePromotion({\n variables: {\n newTotalValueFloor: Number(freeDeliveryThreshold),\n promotionId: idCalculatorConfiguration,\n beginDateUtc: promotion?.listPromotionById?.beginDateUtc,\n endDateUtc: promotion?.listPromotionById?.endDateUtc,\n isActive: isActive,\n },\n })\n }\n\n return (\n <ToastProvider>\n <Layout\n pageHeader={\n <PageHeader\n title={intl.formatMessage({\n id: 'admin/delivery-settings.navigation.label',\n })}\n />\n }\n >\n <PageBlock variation=\"full\">\n {isLoading ? (\n <div\n style={{\n height: '500px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Spinner />\n </div>\n ) : (\n <div>\n <div className={`flex justify-between`}>\n {Object.keys(shippingRate.input[0]).length !== 0 && (\n <div className={`w-20`}>\n <div className={`mb4`}>\n <Input\n type=\"number\"\n value={shippingRate.input[0].absoluteMoneyCost}\n onChange={(e: any) => handleChangeRate(e)}\n label={intl.formatMessage({\n id: 'admin/shipping-rate.delivery-cost',\n })}\n />\n </div>\n <div className={`mb4`}>\n <Input\n value={shippingRate.input[0].timeCostToDisplay}\n onChange={(e: any) => handleChangeDelivery(e)}\n label={intl.formatMessage({\n id: 'admin/shipping-rate.delivery-time',\n })}\n />\n </div>\n </div>\n )}\n\n <div\n style={{ borderRadius: '8px', backgroundColor: '#f3f4f6' }}\n className={`w-40`}\n >\n <div style={{ lineHeight: 2 }} className={`pa7`}>\n <div>\n {intl.formatMessage({ id: 'admin/shipping-policy.name' })}{' '}\n <strong>{shippingPolicy.name}</strong>\n </div>\n <div>\n {intl.formatMessage({ id: 'admin/dock.name' })}\n <strong>\n {dockData.listAllDocks.length !== 0\n ? dockData.listAllDocks[0].name\n : ''}\n </strong>\n </div>\n <div>\n {intl.formatMessage({ id: 'admin/warehouse.name' })}\n <strong>\n {warehouseData.listAllWarehouses.length !== 0\n ? warehouseData.listAllWarehouses[0].name\n : ''}\n </strong>\n </div>\n </div>\n </div>\n </div>\n <div className=\"mv6\">\n <Divider orientation=\"horizontal\" />\n </div>\n {Object.keys(shippingPolicy).length !== 0 && (\n <div>\n <div style={{ fontWeight: 'bold' }} className={`flex mb6`}>\n {intl.formatMessage({ id: 'admin/shipping-policy.title' })}\n </div>\n <div className={`flex mb4`}>\n <Toggle\n label={intl.formatMessage({\n id: 'admin/shipping-policy.label.holiday',\n })}\n checked={shippingPolicy.isHolidayActive}\n onChange={() => {\n setShippingPolicy({\n ...shippingPolicy,\n isHolidayActive: !shippingPolicy.isHolidayActive,\n })\n }}\n />\n </div>\n <div className={`flex mb4`}>\n <Toggle\n label={intl.formatMessage({\n id: 'admin/shipping-policy.label.saturday',\n })}\n checked={shippingPolicy.isSaturdayActive}\n onChange={() => {\n setShippingPolicy({\n ...shippingPolicy,\n isSaturdayActive: !shippingPolicy.isSaturdayActive,\n })\n }}\n />\n </div>\n <div className={`flex mb4`}>\n <Toggle\n label={intl.formatMessage({\n id: 'admin/shipping-policy.label.sunday',\n })}\n checked={shippingPolicy.isSundayActive}\n onChange={() => {\n setShippingPolicy({\n ...shippingPolicy,\n isSundayActive: !shippingPolicy.isSundayActive,\n })\n }}\n />\n </div>\n </div>\n )}\n <div className=\"mv6\">\n <Divider orientation=\"horizontal\" />\n </div>\n <div className={`flex mb6`}>\n <Toggle\n label={intl.formatMessage({\n id: 'admin/promotion.label.isActive',\n })}\n checked={isActive}\n onChange={() => handleToggleChange()}\n />\n </div>\n {isActive && (\n <div className={`w-40`}>\n <Input\n type=\"number\"\n value={freeDeliveryThreshold}\n label={intl.formatMessage({\n id: 'admin/promotion.label.free-delivery-threshold',\n })}\n onChange={(e: any) => handlePromotionChange(e)}\n />\n </div>\n )}\n <ToastConsumer>\n {({ showToast }: { showToast: any }) => (\n <div className={`pt6`}>\n <Button\n variation={'primary'}\n onClick={() => handleSubmit(showToast)}\n >\n {intl.formatMessage({\n id: 'admin/shipping-policy.button.update',\n })}\n </Button>\n </div>\n )}\n </ToastConsumer>\n </div>\n )}\n </PageBlock>\n </Layout>\n </ToastProvider>\n )\n}\n\nexport default DeliverySettings\n\n```"
}
] |
code_easy-shipping-setup_16a59117
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/package.json from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"shipping-strategy\",\n \"version\": \"1.0.2\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"@vtex/styleguide\": \"^9.142.0\",\n \"@types/react-router-dom\": \"^5.1.7\",\n \"apollo-client\": \"^2.6.8\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\",\n \"react-router\": \"^5.2.0\",\n \"react-router-dom\": \"^4.3.1\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.9.8\",\n \"@types/react\": \"^16.9.31\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.6.0\",\n \"typescript\": \"3.9.7\"\n }\n}\n\n```"
}
] |
code_easy-shipping-setup_a79d095e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/clients/shipping.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport {\n InstanceOptions,\n IOContext,\n JanusClient,\n RequestConfig\n} from '@vtex/api'\nimport { pipe } from 'ramda'\nimport { statusToError } from '../utils'\n\nconst TWO_SECONDS = 2 * 1000\n\nconst withCookieAsHeader =\n (context: IOContext) =>\n (options: InstanceOptions): InstanceOptions => ({\n ...options,\n headers: {\n VtexIdclientAutCookie: context.adminUserAuthToken ?? '',\n ...(options?.headers ?? {}),\n },\n timeout: TWO_SECONDS\n })\n\nexport default class ShippingPolicies extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, options && pipe(withCookieAsHeader(context))(options))\n }\n\n public async listAllShippingPolicies(): Promise<string> {\n return this.get(this.routes.shippingPolicies)\n }\n\n public updateShippingPolicy = (policyId: string, data: any): any => {\n this.put(this.routes.updateShippingPolicy(policyId), data)\n }\n\n protected get = <T>(url: string, config?: RequestConfig) =>\n this.http.get<T>(url, config).catch(statusToError) as Promise<T>\n\n protected post = <T>(url: string, data?: any, config?: RequestConfig) =>\n this.http.post<T>(url, data, config).catch<any>(statusToError)\n\n protected put = <T>(url: string, data?: any, config?: RequestConfig) =>\n this.http.put<T>(url, data, config).catch<any>(statusToError)\n\n\n private get routes() {\n const basePVT = '/api/logistics'\n\n return {\n shippingPolicies: `${basePVT}/pvt/shipping-policies?page=1&perPage=100`,\n updateShippingPolicy: (policyId: string) => `${basePVT}/pvt/shipping-policies/${policyId}`\n }\n }\n}\n```"
}
] |
code_easy-shipping-setup_17edb733
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/clients/freight.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { \n InstanceOptions, \n IOContext, \n RequestConfig, \n JanusClient\n} from '@vtex/api'\nimport { pipe } from 'ramda'\nimport { statusToError } from '../utils'\n\nconst TWO_SECONDS = 2 * 1000\n\nconst withCookieAsHeader =\n (context: IOContext) =>\n (options: InstanceOptions): InstanceOptions => ({\n ...options,\n headers: {\n Accept: 'application/json',\n 'Cache-Control': 'no-cache',\n 'Content-Type': 'application/json',\n VtexIdclientAutcookie: context?.adminUserAuthToken ?? '',\n 'X-Vtex-Use-Https': 'true',\n ...(options?.headers ?? {}),\n },\n timeout: TWO_SECONDS\n })\n\nexport default class ShippingRates extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, options && pipe(withCookieAsHeader(context))(options))\n }\n\n public async listShippingRate(carrierId: string, zipCode: string): Promise<string> {\n return this.get(this.routes.shippingRates(carrierId, zipCode))\n }\n\n public updateShippingRate = (carrierId: string, data: any): any => {\n this.post(this.routes.updateShippingRate(carrierId), data)\n }\n\n protected get = <T>(url: string, config?: RequestConfig) =>\n this.http.get<T>(url, config).catch(statusToError) as Promise<T>\n\n protected post = <T>(url: string, data?: any, config?: RequestConfig) =>\n this.http.post<T>(url, data, config).catch<any>(statusToError) as Promise<T>\n\n private get routes() {\n const basePVT = `/api/logistics`\n\n return {\n shippingRates: (carrierId: string, zipCode: string) => `${basePVT}/pvt/configuration/freights/${carrierId}/${zipCode}/values`,\n updateShippingRate: (carrierId: string) => `${basePVT}/pvt/configuration/freights/${carrierId}/values/update`\n }\n }\n}\n```"
}
] |
code_easy-shipping-setup_f94d6fa9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/clients/dock.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { \n InstanceOptions, \n IOContext, \n JanusClient, \n RequestConfig \n} from '@vtex/api'\nimport { pipe } from 'ramda'\nimport { statusToError } from '../utils'\nimport { CREATE_DOCK_OBJECT } from '../utils/constants'\n\nconst TWO_SECONDS = 2 * 1000\n\nconst withCookieAsHeader =\n (context: IOContext) =>\n (options: InstanceOptions): InstanceOptions => ({\n ...options,\n headers: {\n VtexIdclientAutCookie: context.adminUserAuthToken ?? '',\n ...(options?.headers ?? {}),\n },\n timeout: TWO_SECONDS\n })\n\nexport default class Docks extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, options && pipe(withCookieAsHeader(context))(options))\n }\n\n public async listAllDocks(): Promise<string> {\n return this.get(this.routes.docks)\n }\n\n public createDock = (): Promise<string> => {\n const defaultDock = CREATE_DOCK_OBJECT\n return this.post(this.routes.createDock, defaultDock)\n }\n\n public activateDock = (dockId: string): Promise<string> => {\n return this.post(this.routes.activateDock(dockId))\n }\n\n protected get = <T>(url: string, config?: RequestConfig) =>\n this.http.get<T>(url, config).catch(statusToError) as Promise<T>\n\n protected post = <T>(url: string, data?: any, config?: RequestConfig) =>\n this.http.post<T>(url, data, config).catch<any>(statusToError)\n\n private get routes() {\n const basePVT = '/api/logistics'\n\n return {\n docks: `${basePVT}/pvt/configuration/docks`,\n createDock: `${basePVT}/pvt/configuration/docks`,\n activateDock: (dockId: string) => `${basePVT}/pvt/configuration/docks/${dockId}/activation`\n }\n }\n}\n```"
}
] |
code_easy-shipping-setup_5fecbaf5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/clients/ExternalAppClient.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { AuthType, InstanceOptions, IOClient, IOContext } from '@vtex/api'\n\nconst useHttps = !process.env.VTEX_IO\n\n/**\n * Used to perform calls on private routes in another account\n * Custom implementation of the AppClient: https://github.com/vtex/node-vtex-api/blob/master/src/clients/apps/AppClient.ts\n */\nexport class ExternalAppClient extends IOClient {\n constructor(app: string, context: IOContext, options?: InstanceOptions) {\n const [appName, appVersion] = app.split('@')\n const [vendor, name] = appName.split('.') // vtex.messages\n const protocol = useHttps ? 'https' : 'http'\n\n let baseURL: string\n if (appVersion) {\n const [major] = appVersion.split('.')\n baseURL = formatPrivateRoute({ vendor, name, major, protocol })\n } else {\n throw new Error(`Using old routing for ${app}. Please change vendor.app to vendor.app@major in client ${(options && options.name) || ''}`)\n }\n\n super(\n context,\n {\n ...options,\n authType: AuthType.bearer,\n baseURL,\n name,\n }\n )\n }\n}\n\ninterface PrivateRouteInfo {\n protocol?: 'http' | 'https'\n vendor: string,\n name: string,\n major: string | number,\n}\n\nexport const formatPrivateRoute = ({ protocol = 'https', vendor, name, major }: PrivateRouteInfo) =>\n `${protocol}://app.io.vtex.com/${vendor}.${name}/v${major}`\n\n```"
}
] |
code_easy-shipping-setup_fe312fb4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/clients/promotion.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport {\n InstanceOptions,\n IOContext,\n JanusClient,\n RequestConfig,\n} from '@vtex/api'\nimport { pipe } from 'ramda'\nimport { statusToError } from '../utils'\nimport { CREATE_PROMOTION_OBJECT } from '../utils/constants'\n\nconst TWO_SECONDS = 2 * 1000\n\nconst withCookieAsHeader =\n (context: IOContext) =>\n (options: InstanceOptions): InstanceOptions => ({\n ...options,\n headers: {\n Accept: 'application/vnd.vtex.pricing.v3+json',\n 'Cache-Control': 'no-cache',\n 'Content-Type': 'application/json',\n 'X-Vtex-Use-Https': 'true',\n VtexIdclientAutCookie: context.adminUserAuthToken ?? '',\n ...(options?.headers ?? {}),\n },\n timeout: TWO_SECONDS,\n })\n\nexport default class Promotions extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, options && pipe(withCookieAsHeader(context))(options))\n }\n\n public async listPromotionById(promotionId: string): Promise<string> {\n return this.get(this.routes.promotionById(promotionId))\n }\n\n public async listAllPromotions(): Promise<string> {\n return this.get(this.routes.allPromotions)\n }\n\n public createOrUpdatePromotion = (\n newTotalValueFloor: number,\n promotionId: string,\n beginDateUtc: string,\n endDateUtc: string,\n isActive: boolean\n ): Promise<string> => {\n const defaultPromotion = CREATE_PROMOTION_OBJECT\n defaultPromotion.totalValueFloor = newTotalValueFloor\n defaultPromotion.idCalculatorConfiguration = promotionId\n defaultPromotion.beginDateUtc = beginDateUtc\n defaultPromotion.endDateUtc = endDateUtc\n defaultPromotion.isActive = isActive\n\n if (!promotionId.length) {\n const date = new Date()\n defaultPromotion.beginDateUtc = date.toISOString()\n\n date.setFullYear(date.getFullYear() + 3)\n defaultPromotion.endDateUtc = date.toISOString()\n }\n\n return this.post(this.routes.createOrUpdatePromotion, defaultPromotion)\n }\n\n protected get = <T>(url: string, config?: RequestConfig) =>\n this.http.get<T>(url, config).catch(statusToError) as Promise<T>\n\n protected post = <T>(url: string, data?: any, config?: RequestConfig) =>\n this.http.post<T>(url, data, config).catch<any>(statusToError)\n\n private get routes() {\n const basePVT = '/api/rnb'\n\n return {\n promotionById: (promotionId: string) =>\n `${basePVT}/pvt/calculatorconfiguration/${promotionId}`,\n allPromotions: `${basePVT}/pvt/benefits/calculatorconfiguration`,\n createOrUpdatePromotion: `${basePVT}/pvt/calculatorconfiguration`,\n }\n }\n}\n\n```"
}
] |
code_easy-shipping-setup_1a260906
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/clients/index.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport ShippingPolicies from './shipping'\nimport Warehouses from './warehouse'\nimport Docks from './dock'\nimport ShippingRates from './freight'\nimport Promotions from './promotion'\n\nexport class Clients extends IOClients {\n public get shippingPolicy() {\n return this.getOrSet('shippingPolicy', ShippingPolicies)\n }\n\n public get warehouse() {\n return this.getOrSet('warehouse', Warehouses)\n }\n\n public get dock() {\n return this.getOrSet('dock', Docks)\n }\n\n public get shippingRate() {\n return this.getOrSet('shippingRate', ShippingRates)\n }\n\n public get promotion() {\n return this.getOrSet('promotion', Promotions)\n }\n}\n\n```"
}
] |
code_easy-shipping-setup_4ec3b8ee
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/clients/warehouse.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { \n InstanceOptions, \n IOContext, \n JanusClient, \n RequestConfig \n} from '@vtex/api'\nimport { pipe } from 'ramda'\nimport { statusToError } from '../utils'\nimport { CREATE_WAREHOUSE_OBJECT } from '../utils/constants'\n\nconst TWO_SECONDS = 2 * 1000\n\nconst withCookieAsHeader =\n (context: IOContext) =>\n (options: InstanceOptions): InstanceOptions => ({\n ...options,\n headers: {\n VtexIdclientAutCookie: context.adminUserAuthToken ?? '',\n ...(options?.headers ?? {}),\n },\n timeout: TWO_SECONDS\n })\n\nexport default class Warehouses extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, options && pipe(withCookieAsHeader(context))(options))\n }\n\n public async listAllWarehouses(): Promise<string> {\n return this.get(this.routes.warehouses)\n }\n\n public createWarehouse = (): Promise<string> => {\n const defaultWarehouse = CREATE_WAREHOUSE_OBJECT\n return this.post(this.routes.createWarehouse, defaultWarehouse)\n }\n\n protected get = <T>(url: string, config?: RequestConfig) =>\n this.http.get<T>(url, config).catch(statusToError) as Promise<T>\n\n protected post = <T>(url: string, data?: any, config?: RequestConfig) =>\n this.http.post<T>(url, data, config).catch<any>(statusToError)\n\n private get routes() {\n const basePVT = '/api/logistics'\n\n return {\n warehouses: `${basePVT}/pvt/configuration/warehouses`,\n createWarehouse: `${basePVT}/pvt/configuration/warehouses` \n }\n }\n}\n```"
}
] |
code_easy-shipping-setup_e1f2c721
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/utils/constants.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const CREATE_PROMOTION_OBJECT = {\n idCalculatorConfiguration: '',\n skusGift: {\n quantitySelectable: 1,\n },\n name: 'Free delivery',\n beginDateUtc: '',\n endDateUtc: '',\n daysAgoOfPurchases: 0,\n isActive: true,\n isFeatured: false,\n offset: 3,\n newOffset: 3,\n cumulative: true,\n nominalShippingDiscountValue: 0,\n absoluteShippingDiscountValue: 0,\n nominalDiscountValue: 0,\n maximumUnitPriceDiscount: 0,\n percentualDiscountValue: 0,\n percentualShippingDiscountValue: 100,\n percentualTax: 0,\n shippingPercentualTax: 0,\n percentualDiscountValueList1: 0,\n percentualDiscountValueList2: 0,\n nominalRewardValue: 0,\n percentualRewardValue: 0,\n orderStatusRewardValue: 'invoiced',\n maxNumberOfAffectedItems: 0,\n origin: 'Fulfillment',\n idSellerIsInclusive: true,\n categoriesAreInclusive: true,\n brandsAreInclusive: true,\n productsAreInclusive: true,\n minimumQuantityBuyTogether: 0,\n quantityToAffectBuyTogether: 0,\n enableBuyTogetherPerSku: false,\n totalValueFloor: 0,\n totalValueCeling: 0,\n totalValueMode: 'IncludeMatchedItems',\n collectionsIsInclusive: true,\n totalValuePurchase: 0,\n isSlaSelected: false,\n isFirstBuy: false,\n firstBuyIsProfileOptimistic: true,\n compareListPriceAndPrice: false,\n isDifferentListPriceAndPrice: false,\n itemMaxPrice: 0,\n itemMinPrice: 0,\n isMinMaxInstallments: false,\n minInstallment: 0,\n maxInstallment: 0,\n maxUsage: 0,\n maxUsagePerClient: 0,\n multipleUsePerClient: false,\n type: 'regular',\n applyToAllShippings: true,\n idsSalesChannel: ['1'],\n}\n\nexport const CREATE_DOCK_OBJECT = {\n pickupStoreInfo: {\n isPickupStore: false,\n storeId: null,\n friendlyName: null,\n address: null,\n additionalInfo: null,\n dockId: null,\n distance: null,\n businessHours: null,\n pickupHolidays: null,\n sellerId: null,\n isThirdPartyPickup: false,\n },\n storeId: null,\n pickupInStoreInfo: {\n isActice: false,\n additionalInfo: null,\n },\n deliveryFromStoreInfo: {\n isActice: false,\n deliveryRadius: 0.0,\n deliveryFee: 0.0,\n deliveryTime: '00:00:00',\n maximumWeight: 0.0,\n },\n address: null,\n location: null,\n id: '1',\n name: 'Standard',\n priority: 0,\n dockTimeFake: '1.00:00:00',\n timeFakeOverhead: '00:00:00',\n salesChannels: ['1'],\n freightTableIds: ['1'],\n wmsEndPoint: '',\n isActive: true,\n}\n\nexport const CREATE_WAREHOUSE_OBJECT = {\n id: '1',\n name: 'Standard',\n warehouseDocks: [\n {\n dockId: '1',\n time: '1.00:00:00',\n cost: 0.0,\n },\n ],\n pickupPointIds: [],\n priority: 0,\n isActive: true,\n}\n\n```"
}
] |
code_easy-shipping-setup_d087952f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/utils/index.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { AxiosError } from 'axios'\nimport { AuthenticationError, ForbiddenError, UserInputError } from '@vtex/api'\n\nexport function statusToError(e: any) {\n if (!e.response) {\n throw e\n }\n\n const { response } = e as AxiosError\n const { status } = response!\n\n if (status === 401) {\n throw new AuthenticationError(e)\n }\n\n if (status === 403) {\n throw new ForbiddenError(e)\n }\n\n if (status === 400) {\n throw new UserInputError(e)\n }\n\n throw e\n}\n```"
}
] |
code_easy-shipping-setup_498c401a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/resolvers/shipping.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const queries = {\n listAllShippingPolicies: (\n _: any,\n __: any,\n { clients: { shippingPolicy } }: Context\n ) => shippingPolicy.listAllShippingPolicies(),\n}\n\nexport const mutations = {\n updateShippingPolicy: async (\n _: any,\n args: any,\n { clients: { shippingPolicy } }: Context\n ) => {\n const data = {\n name: args.input.name,\n shippingMethod: args.input.shippingMethod,\n weekendAndHolidays: {\n saturday: args.input.isSaturdayActive,\n sunday: args.input.isSundayActive,\n holiday: args.input.isHolidayActive,\n },\n numberOfItemsPerShipment: 1,\n maxDimension: {\n largestMeasure: args.input.largestMeasure,\n maxMeasureSum: args.input.maxMeasureSum,\n },\n isActive: args.input.isActive,\n }\n\n return shippingPolicy.updateShippingPolicy(args.input.id, data)\n },\n}\n\n```"
}
] |
code_easy-shipping-setup_8757b0d5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/resolvers/freight.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const queries = {\n listShippingRate: (_: any, { carrierId, zipCode }: any, { clients: { shippingRate } }: Context) => shippingRate.listShippingRate(carrierId, zipCode),\n}\n\nexport const mutations = { \n updateShippingRate: async (_: any, args: any, { clients: { shippingRate } }: Context) => {\n const data = args.input\n return shippingRate.updateShippingRate(args.carrierId, data)\n }\n}\n```"
}
] |
code_easy-shipping-setup_41c3ee8a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/resolvers/dock.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const queries = {\n listAllDocks: (_: any, __: any, { clients: { dock } }: Context) => dock.listAllDocks()\n}\n\nexport const mutations = {\n createDock: async (_: any, __: any, { clients: { dock } }: Context) => {\n return dock.createDock()\n }\n}\n```"
}
] |
code_easy-shipping-setup_4167643e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/resolvers/promotion.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const queries = {\n listPromotionById: (_: any, { promotionId }: any, { clients: { promotion } }: Context) => promotion.listPromotionById(promotionId),\n listAllPromotions: (_: any, __: any, { clients: { promotion } }: Context) => promotion.listAllPromotions()\n}\n\nexport const mutations = {\n createOrUpdatePromotion: async (_: any, args: any, { clients: { promotion } }: Context) => {\n return promotion.createOrUpdatePromotion(\n args.newTotalValueFloor,\n args.promotionId,\n args.beginDateUtc,\n args.endDateUtc,\n args.isActive\n )\n }\n}\n```"
}
] |
code_easy-shipping-setup_6255e189
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/resolvers/index.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport {\n queries as shippingQueries,\n mutations as shippingMutations,\n} from './shipping'\nimport {\n queries as warehouseQueries,\n mutations as warehouseMutations,\n} from './warehouse'\nimport { queries as dockQueries, mutations as dockMutations } from './dock'\nimport {\n queries as freightQueries,\n mutations as freightMutations,\n} from './freight'\nimport {\n queries as promotionQueries,\n mutations as promotionMutations,\n} from './promotion'\n\nexport const resolvers = {\n Query: {\n ...shippingQueries,\n ...warehouseQueries,\n ...dockQueries,\n ...freightQueries,\n ...promotionQueries,\n },\n Mutation: {\n ...shippingMutations,\n ...freightMutations,\n ...promotionMutations,\n ...warehouseMutations,\n ...dockMutations,\n },\n}\n\n```"
}
] |
code_easy-shipping-setup_260c18c0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/node/resolvers/warehouse.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const queries = {\n listAllWarehouses: (_: any, __: any, { clients: { warehouse } }: Context) => warehouse.listAllWarehouses()\n}\n\nexport const mutations = {\n createWarehouse: async (_: any, __: any, { clients: { warehouse } }: Context) => {\n return warehouse.createWarehouse()\n }\n}\n```"
}
] |
code_easy-shipping-setup_bafa4b03
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/typings/gql.d.ts from the easy-shipping-setup 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_easy-shipping-setup_6de3b215
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/typings/vtex.styleguide.d.ts from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.styleguide' {\n export const PageHeader\n export const Alert\n export const Modal\n export const Box\n export const Card\n export const Dropdown\n export const Spinner\n export const Table\n export const Button\n export const ButtonPlain\n export const IconWarning\n export const IconCheck\n export const Input\n export const InputCurrency\n export const InputSearch\n export const IconCaretDown\n export const IconCaretUp\n export const IconArrowDown\n export const IconArrowBack\n export const IconArrowUp\n export const IconClose\n export const IconExternalLink\n export const IconSearch\n export const IconSuccess\n export const IconCopy\n export const IconCog\n export const IconVisibilityOn\n export const Toggle\n export const Tooltip\n export const ToastConsumer\n export const ToastProvider\n export const withToast\n export const ButtonWithIcon\n export const Pagination\n export const Collapsible\n export const Textarea\n export const NumericStepper\n export const EmptyState\n export const Tab\n export const IconPlus\n export const IconEdit\n export const Tag\n export const Layout\n export const Tabs\n export const Divider\n export const PageBlock\n export const Progress\n export const InputButton\n}\n```"
}
] |
code_easy-shipping-setup_35c950cb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/allPromotions.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getAllPromotions {\n listAllPromotions {\n limitConfiguration {\n activesCount,\n limit\n },\n limitConfigurationMaxPrice {\n activesCount\n limit\n }\n disabledItems,\n archivedItems, \n items {\n idCalculatorConfiguration,\n name,\n isActive\n }\n }\n}\n```"
}
] |
code_easy-shipping-setup_17cac268
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/updateShippingRate.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation updateShippingRate(\n $carrierId: String\n $searchZipCode: String\n $input: [ShippingRateInput]\n) {\n updateShippingRate(\n carrierId: $carrierId,\n searchZipCode: $searchZipCode,\n input: $input\n ) {\n zipCodeStart\n zipCodeEnd\n weightStart\n weightEnd\n absoluteMoneyCost\n pricePercent\n pricePercentByWeight\n maxVolume\n timeCost\n country\n operationType\n polygon\n minimumValueInsurance\n }\n}\n\n```"
}
] |
code_easy-shipping-setup_2a106840
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/promotion.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getPromotionById($promotionId: String!) {\n listPromotionById(promotionId: $promotionId) {\n idCalculatorConfiguration,\n name,\n description,\n beginDateUtc,\n endDateUtc,\n lastModified,\n daysAgoOfPurchases,\n isActive,\n isArchived,\n isFeatured,\n activeDaysOfWeek,\n offset,\n activateGiftsMultiplier,\n newOffset,\n cumulative,\n nominalShippingDiscountValue,\n absoluteShippingDiscountValue,\n nominalDiscountValue,\n maximumUnitPriceDiscount,\n percentualDiscountValue,\n rebatePercentualDiscountValue,\n percentualShippingDiscountValue,\n percentualTax,\n shippingPercentualTax,\n percentualDiscountValueList1,\n percentualDiscountValueList2,\n skusGift {\n quantitySelectable,\n gifts {\n id,\n name,\n quantity,\n sellers {\n id,\n name,\n }\n }\n },\n nominalRewardValue,\n percentualRewardValue,\n orderStatusRewardValue,\n maxNumberOfAffectedItems,\n maxNumberOfAffectedItemsGroupKey,\n applyToAllShippings,\n nominalTax,\n origin,\n idSellerIsInclusive,\n idsSalesChannel,\n areSalesChannelIdsExclusive,\n marketingTags,\n marketingTagsAreNotInclusive,\n paymentsMethods,\n campaigns,\n categories,\n categoriesAreInclusive,\n brands,\n brandsAreInclusive,\n products,\n productsAreInclusive,\n skus,\n skusAreInclusive,\n collections1BuyTogether,\n minimumQuantityBuyTogether,\n quantityToAffectBuyTogether,\n enableBuyTogetherPerSku,\n listSku1BuyTogether,\n listSku2BuyTogether,\n totalValueFloor,\n totalValueCeling,\n totalValueMode,\n collections,\n collectionsIsInclusive,\n restrictionsBins,\n totalValuePurchase,\n slasIds,\n isSlaSelected,\n isFirstBuy,\n firstBuyIsProfileOptimistic,\n compareListPriceAndPrice,\n isDifferentListPriceAndPrice,\n zipCodeRanges,\n itemMaxPrice,\n itemMinPrice,\n isMinMaxInstallments,\n minInstallment,\n maxInstallment,\n clusterExpressions,\n clusterOperator,\n giftListTypes,\n affiliates,\n maxUsage,\n maxUsagePerClient,\n multipleUsePerClient,\n type,\n useNewProgressiveAlgorithm\n }\n}\n```"
}
] |
code_easy-shipping-setup_8fdf80bb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/warehouse.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getAllWarehouses {\n listAllWarehouses {\n id,\n name,\n warehouseDocks {\n dockId\n },\n isActive\n }\n}\n```"
}
] |
code_easy-shipping-setup_824a98a6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/updateShippingPolicy.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation updateShippingPolicy(\n $id: String!\n $name: String\n $shippingMethod: String\n $isHolidayActive: Boolean\n $isSaturdayActive: Boolean\n $isSundayActive: Boolean\n $largestMeasure: Float\n $maxMeasureSum: Float\n $isActive: Boolean\n) {\n updateShippingPolicy(\n input: {\n id: $id\n name: $name\n shippingMethod: $shippingMethod\n isHolidayActive: $isHolidayActive\n isSaturdayActive: $isSaturdayActive\n isSundayActive: $isSundayActive\n largestMeasure: $largestMeasure\n maxMeasureSum: $maxMeasureSum\n isActive: $isActive\n }\n ) {\n id,\n name,\n shippingMethod,\n weekendAndHolidays {\n saturday,\n sunday,\n holiday\n },\n maxDimension {\n largestMeasure,\n maxMeasureSum\n },\n isActive\n }\n}\n\n```"
}
] |
code_easy-shipping-setup_375f097b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/dock.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getAllDocks {\n listAllDocks {\n id,\n name,\n isActive\n }\n}\n```"
}
] |
code_easy-shipping-setup_45ff7f31
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/shipping.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getAllShippingPolicies {\n listAllShippingPolicies {\n items {\n id,\n name,\n shippingMethod,\n weekendAndHolidays {\n saturday,\n sunday,\n holiday\n },\n maxDimension {\n largestMeasure,\n maxMeasureSum\n },\n isActive\n }\n }\n}\n```"
}
] |
code_easy-shipping-setup_145cd6af
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/createOrUpdatePromotion.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation createOrUpdatePromotion(\n $newTotalValueFloor: Float,\n $promotionId: String,\n $beginDateUtc: String,\n $endDateUtc: String,\n $isActive: Boolean\n) {\n createOrUpdatePromotion(\n newTotalValueFloor: $newTotalValueFloor,\n promotionId: $promotionId,\n beginDateUtc: $beginDateUtc,\n endDateUtc: $endDateUtc,\n isActive: $isActive\n ) {\n idCalculatorConfiguration,\n name,\n description,\n beginDateUtc,\n endDateUtc,\n lastModified,\n daysAgoOfPurchases,\n isActive,\n isArchived,\n isFeatured,\n activeDaysOfWeek,\n offset,\n activateGiftsMultiplier,\n newOffset,\n cumulative,\n nominalShippingDiscountValue,\n absoluteShippingDiscountValue,\n nominalDiscountValue,\n maximumUnitPriceDiscount,\n percentualDiscountValue,\n rebatePercentualDiscountValue,\n percentualShippingDiscountValue,\n percentualTax,\n shippingPercentualTax,\n percentualDiscountValueList1,\n percentualDiscountValueList2,\n skusGift {\n quantitySelectable,\n gifts {\n id,\n name,\n quantity,\n sellers {\n id,\n name,\n }\n }\n },\n nominalRewardValue,\n percentualRewardValue,\n orderStatusRewardValue,\n maxNumberOfAffectedItems,\n maxNumberOfAffectedItemsGroupKey,\n applyToAllShippings,\n nominalTax,\n origin,\n idSellerIsInclusive,\n idsSalesChannel,\n areSalesChannelIdsExclusive,\n marketingTags,\n marketingTagsAreNotInclusive,\n paymentsMethods,\n campaigns,\n categories,\n categoriesAreInclusive,\n brands,\n brandsAreInclusive,\n products,\n productsAreInclusive,\n skus,\n skusAreInclusive,\n collections1BuyTogether,\n minimumQuantityBuyTogether,\n quantityToAffectBuyTogether,\n enableBuyTogetherPerSku,\n listSku1BuyTogether,\n listSku2BuyTogether,\n totalValueFloor,\n totalValueCeling,\n totalValueMode,\n collections,\n collectionsIsInclusive,\n restrictionsBins,\n totalValuePurchase,\n slasIds,\n isSlaSelected,\n isFirstBuy,\n firstBuyIsProfileOptimistic,\n compareListPriceAndPrice,\n isDifferentListPriceAndPrice,\n zipCodeRanges,\n itemMaxPrice,\n itemMinPrice,\n isMinMaxInstallments,\n minInstallment,\n maxInstallment,\n clusterExpressions,\n clusterOperator,\n giftListTypes,\n affiliates,\n maxUsage,\n maxUsagePerClient,\n multipleUsePerClient,\n type,\n useNewProgressiveAlgorithm\n }\n}\n\n```"
}
] |
code_easy-shipping-setup_b2220837
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of easy-shipping-setup/react/graphql/freight.graphql from the easy-shipping-setup VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getShippingRate($carrierId: String!, $zipCode: String!) {\n listShippingRate(carrierId: $carrierId, zipCode: $zipCode) {\n zipCodeStart\n zipCodeEnd\n weightStart\n weightEnd\n absoluteMoneyCost\n pricePercent\n pricePercentByWeight\n maxVolume\n timeCost\n country\n operationType\n polygon\n minimumValueInsurance\n }\n}\n```"
}
] |
code_fixed-prices-app_e9d0d5a8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/messages/pt.json from the fixed-prices-app VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/test\": \"teste\",\n \"store/test\": \"teste\"\n}\n```"
}
] |
code_fixed-prices-app_c8945724
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/messages/en.json from the fixed-prices-app VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/test\": \"test\",\n \"store/test\": \"test\"\n}\n\n```"
}
] |
code_fixed-prices-app_425b7f09
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/messages/es.json from the fixed-prices-app VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/test\": \"teste\",\n \"store/test\": \"teste\"\n}\n```"
}
] |
code_fixed-prices-app_d9502833
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/docs/README.md from the fixed-prices-app 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# Fixed prices app\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nUnder the app's name, you should explain the topic, giving a **brief description** of its **functionality** in a store when installed.\n\nNext, **add media** (either an image of a GIF) with the rendered components, so that users can better understand how the app works in practice. \n\n\n\n## Configuration \n\nIn this section, you first must **add the primary instructions** that will allow users to use the app's blocks in their store, such as:\n\n1. Adding the app as a theme dependency in the `manifest.json` file;\n2. Declaring the app's main block in a given theme template or inside another block from the theme.\n\nRemember to add a table with all blocks exported by the app and their descriptions. You can verify an example of it on the [Search Result documentation](https://vtex.io/docs/components/all/vtex.search-result@3.56.1/). \n\nNext, add the **props table** containing your block's props. \n\nIf the app exports more than one block, create several tables - one for each block. For example:\n\n### `block-1` props\n\n| Prop name | Type | Description | Default value |\n| ------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | \n| `XXXXX` | `XXXXXX` | XXXXXXXX | `XXXXXX` |\n\n\n### `block-2` props\n\n| Prop name | Type | Description | Default value |\n| ------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | \n| `XXXXX` | `XXXXXX` | XXXXXXXX | `XXXXXX` |\n\nProp types are: \n\n- `string` \n- `enum` \n- `number` \n- `boolean` \n- `object` \n- `array` \n\nWhen documenting a prop whose type is `object` or `array` another prop table will be needed. You can create it following the example below:\n\n- `propName` object:\n\n| Prop name | Type | Description | Default value |\n| ------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | \n| `XXXXX` | `XXXXXX` | XXXXXXXX | `XXXXXX` |\n\n\nRemember to also use this Configuration section to **showcase any necessary disclaimer** related to the app and its blocks, such as the different behavior it may display during its configuration. \n\n## Modus Operandi *(not mandatory)*\n\nThere are scenarios in which an app can behave differently in a store, according to how it was added to the catalog, for example. It's crucial to go through these **behavioral changes** in this section, allowing users to fully understand the **practical application** of the app in their store.\n\nIf you feel compelled to give further details about the app, such as it's **relationship with the VTEX admin**, don't hesitate to use this section. \n\n## Customization\n\nThe first thing that should be present in this section is the sentence below, showing users the recipe pertaining to CSS customization in apps:\n\n`In 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\nThereafter, you should add a single column table with the available CSS handles for the app, like the one below. Note that the Handles must be ordered alphabetically.\n\n| CSS Handles |\n| ----------- | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` |\n\n\nIf there are none, add the following sentence instead:\n\n`No CSS Handles are available yet for the app customization.`\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- 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---- \n\nCheck out some documentation models that are already live: \n- [Breadcrumb](https://github.com/vtex-apps/breadcrumb)\n- [Image](https://vtex.io/docs/components/general/vtex.store-components/image)\n- [Condition Layout](https://vtex.io/docs/components/all/vtex.condition-layout@1.1.6/)\n- [Add To Cart Button](https://vtex.io/docs/components/content-blocks/vtex.add-to-cart-button@0.9.0/)\n- [Store Form](https://vtex.io/docs/components/all/vtex.store-form@0.3.4/)\n\n```"
}
] |
code_fixed-prices-app_0161660a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/graphql/schema.graphql from the fixed-prices-app VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Pricelist {\n tradePolicyId: String,\n value: Float,\n listPrice: Float,\n minQuantity: Int\n}\n\ntype Query{\n getFixedPrice(skuId: String!, tableName: String!): [Pricelist]\n}\n\n```"
}
] |
code_fixed-prices-app_cb3a814f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/node/service.json from the fixed-prices-app VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"memory\": 512,\n \"ttl\": 10,\n \"timeout\": 200,\n \"minReplicas\": 2,\n \"maxReplicas\": 4,\n \"workers\": 2,\n \"routes\": {\n \n \"prices\": {\n \"path\": \"/v0/demo/prices/:itemId/:priceTableId\",\n \"public\": true\n }\n }\n}\n\n```"
}
] |
code_fixed-prices-app_172b9e84
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/node/package.json from the fixed-prices-app 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\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.45.12\",\n \"@vtex/test-tools\": \"^1.0.0\",\n \"@vtex/tsconfig\": \"^0.5.6\",\n \"typescript\": \"3.9.7\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.10.0/public/@types/vtex.product-context\",\n \"vtex.search-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-graphql@0.50.0/public/@types/vtex.search-graphql\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.157.1/public/@types/vtex.store-graphql\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty\"\n },\n \"version\": \"0.2.0\"\n}\n\n```"
}
] |
code_fixed-prices-app_79e38fd5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/node/index.ts from the fixed-prices-app VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { ClientsConfig, ServiceContext } from '@vtex/api'\nimport { LRUCache, method, Service } from '@vtex/api'\nimport { Clients } from './clients'\nimport { getPrices } from './middlewares/getPrices'\nimport { getFixedPrice } from './resolvers/fixedprices'\n\n\nconst TIMEOUT_MS = 2000\n\n// Create a LRU memory cache for the Status client.\n// The @vtex/api HttpClient respects Cache-Control headers and uses the provided cache.\nconst memoryCache = new LRUCache<string, any>({ max: 5000 })\n\nmetrics.trackCache('status', memoryCache)\n\n// This is the configuration for clients available in `ctx.clients`.\nconst clients: ClientsConfig<Clients> = {\n // We pass our custom implementation of the clients bag, containing the Status client.\n implementation: Clients,\n options: {\n // All IO Clients will be initialized with these options, unless otherwise specified.\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n },\n // This key will be merged with the default options and add this cache to our Status client.\n demo: {\n memoryCache,\n },\n },\n}\n\ndeclare global {\n // We declare a global Context type just to avoid re-writing ServiceContext<Clients, State> in every handler and resolver\n type Context = ServiceContext<Clients>\n}\n\n// Export a service that defines route handlers and client options.\nexport default new Service({\n clients,\n routes: {\n // `prices` is the route ID from service.json. It maps to an array of middlewares (or a single handler).\n prices: method({\n GET: [getPrices],\n }),\n },\n graphql: {\n resolvers: {\n Query: {\n getFixedPrice\n }\n }\n }\n})\n\n```"
}
] |
code_fixed-prices-app_f00fbaa3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of fixed-prices-app/react/package.json from the fixed-prices-app VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"fixed-prices-app\",\n \"version\": \"0.0.0\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.8\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.9.8\",\n \"@types/react\": \"^16.9.31\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.6.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.10.0/public/@types/vtex.product-context\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime\",\n \"vtex.search-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-graphql@0.50.0/public/@types/vtex.search-graphql\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.157.1/public/@types/vtex.store-graphql\"\n }\n}\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.