id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_shipping-estimate-translator_b51b7cba
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipping-estimate-translator/react/getEstimateTranslation.js from the shipping-estimate-translator VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nconst getTranslateId = (shippingEstimate, isPickup) => {\n const shippingEstimateString =\n shippingEstimate && shippingEstimate.split(/[0-9]+/)[1]\n\n return (\n shippingEstimate &&\n shippingEstimateString &&\n `shippingEstimate${isPickup ? 'Pickup' : ''}-${\n shippingEstimate.split(/[0-9]+/)[1]\n }`\n )\n}\n\nconst getTimeAmount = shippingEstimate => {\n return shippingEstimate && shippingEstimate.split(/\\D+/)[0]\n}\n\nconst getScheduledWindow = (scheduled, intl) => {\n return scheduled.startDateUtc && scheduled.endDateUtc\n ? {\n date: intl.formatDate(scheduled.startDateUtc, {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n }),\n startDate: intl.formatTime(scheduled.startDateUtc, {\n timeZone: 'UTC',\n }),\n endDate: intl.formatTime(scheduled.endDateUtc, {\n timeZone: 'UTC',\n }),\n }\n : {\n date: null,\n startDate: null,\n endDate: null,\n }\n}\n\nexport function getEstimateTranslation({\n intl,\n shippingEstimate,\n isPickup = false,\n lowerCase = false,\n scheduled = false,\n}) {\n if (scheduled) {\n const { date, startDate, endDate } = getScheduledWindow(scheduled, intl)\n const hasDeliveryWindow = !!(startDate && endDate)\n const translatedEstimate = hasDeliveryWindow\n ? intl.formatMessage(\n {\n id: 'shippingEstimate-scheduled',\n },\n { date, startDate, endDate }\n )\n : intl.formatMessage({\n id: 'shippingEstimate-scheduled-no-dates',\n })\n\n return lowerCase ? translatedEstimate.toLowerCase() : translatedEstimate\n }\n\n const id = getTranslateId(shippingEstimate, isPickup)\n const timeAmount = getTimeAmount(shippingEstimate)\n\n let translatedEstimate = ''\n\n if (id && timeAmount && intl) {\n translatedEstimate = intl.formatMessage({ id }, { timeAmount })\n }\n\n if (lowerCase) {\n translatedEstimate = translatedEstimate.toLowerCase()\n }\n\n return translatedEstimate\n}\n\nexport default { getEstimateTranslation }\n\n```"
}
] |
code_shipping-estimate-translator_a77058c6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipping-estimate-translator/react/shapes/index.js from the shipping-estimate-translator VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nimport PropTypes from 'prop-types'\n\nexport const deliveryWindowShape = PropTypes.shape({\n startDateUtc: PropTypes.string,\n endDateUtc: PropTypes.string,\n})\n\n```"
}
] |
code_storecomponents-checkout-ui-settings_667c21f8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storecomponents-checkout-ui-settings/checkout-ui-custom/checkout5-custom.css from the storecomponents-checkout-ui-settings VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n/* /files/checkout5-custom.css */\n\n/* Displays the option to enter a foreign document */\n.document-box { display: block; }\n\n/* Displays the option to enter an international phone */\n.phone-box { display: block; }\n\n```"
}
] |
code_storecomponents-checkout-ui-settings_a1cc78fa
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storecomponents-checkout-ui-settings/checkout-ui-custom/checkout6-custom.js from the storecomponents-checkout-ui-settings VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\n// WARNING: THE USAGE OF CUSTOM SCRIPTS IS NOT SUPPORTED. VTEX IS NOT LIABLE FOR ANY DAMAGES THIS MAY CAUSE. THIS MAY BREAK YOUR STORE AND STOP SALES. IN CASE OF ERRORS, PLEASE DELETE THE CONTENT OF THIS SCRIPT.\n\n```"
}
] |
code_storecomponents-checkout-ui-settings_a53a1ef1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storecomponents-checkout-ui-settings/checkout-ui-custom/checkout-confirmation-custom.js from the storecomponents-checkout-ui-settings VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\n// WARNING: THE USAGE OF CUSTOM SCRIPTS IS NOT SUPPORTED. VTEX IS NOT LIABLE FOR ANY DAMAGES THIS MAY CAUSE.\n// THIS MAY BREAK YOUR STORE AND STOP SALES. IN CASE OF ERRORS, PLEASE DELETE THE CONTENT OF THIS SCRIPT.\n\n```"
}
] |
code_storecomponents-checkout-ui-settings_e2ed7cdb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storecomponents-checkout-ui-settings/checkout-ui-custom/checkout5-custom.js from the storecomponents-checkout-ui-settings VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\n// WARNING: THE USAGE OF CUSTOM SCRIPTS IS NOT SUPPORTED. VTEX IS NOT LIABLE FOR ANY DAMAGES THIS MAY CAUSE. THIS MAY BREAK YOUR STORE AND STOP SALES. IN CASE OF ERRORS, PLEASE DELETE THE CONTENT OF THIS SCRIPT.\n\n```"
}
] |
code_storecomponents-checkout-ui-settings_28823c97
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storecomponents-checkout-ui-settings/checkout-ui-custom/checkout6-custom.css from the storecomponents-checkout-ui-settings VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n/* Content copied from \"checkout5-custom.css\" at 2019-03-01T05:12:59.334Z */\n\n/* /files/checkout5-custom.css */\n\n/* Displays the option to enter a foreign document */\n.document-box { display: block; }\n\n/* Displays the option to enter an international phone */\n.phone-box { display: block; }\n\n```"
}
] |
code_storecomponents-checkout-ui-settings_d4143c30
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storecomponents-checkout-ui-settings/docs/README.md from the storecomponents-checkout-ui-settings VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Checkout UI Settings for Storecomponents\n\nThis project implements Checkout UI Settings in the account storecomponents and can be used as an implementation example.\n\n## Checkout UI Settings\n\nThe Checkout UI Settings app is responsible for **customizing your store's Checkout UI through scripts**.\n\nThe main advantage of using the app instead of the [store's admin](https://help.vtex.com/tutorial/configure-template-in-smartcheckout-update--ToTE5XB39t0SwtHgpgwSv?locale=en) for this customization is that your Checkout scripts will behave as configurations for platform apps.\n\nIn practice, it means that Checkout UI Settings allows A/B testing in your store's scripts, in addition to the possibility of quick rollbacks for old scripts (i.e. scripts pertaining to older Checkout UI Settings app's versions).\n\n## Configuration\n\n1. Using your terminal and the [VTEX IO Toolbelt](https://vtex.io/docs/recipes/development/vtex-io-cli-installment-and-command-reference), log into the desired account;\n2. Run `vtex list` to access the list of apps that are already installed on the account you're working on. If the Checkout UI Settings option already exists, you can skip to step 7 of this step-by-step;\n3. If the Checkout UI Settings app was not found in the list of installed apps, run the `vtex init` command;\n4. Select the `checkout-ui-settings` option;\n5. Open the `checkout-ui-settings` app in whichever code editor you prefer;\n6. In the `manifest.json` file, change the predefined default value `vendor` to the name of the account in which you want to install the app;\n7. In the `checkout-custom` folder, create the files in which the scripts will be included, just as you would do in the [admin's interface](https://help.vtex.com/tutorial/configure-template-in-smartcheckout-update--ToTE5XB39t0SwtHgpgwSv?locale=en#configure-code). Notice that a few defaults files already exist in the `checkout-custom` folder, files which you can use to insert the scripts;\n8. According to the Checkout customization you are looking for, open the most suitable file and insert the desired scripts;\n9. Save your changes. Then, [publish](https://vtex.io/docs/recipes/development/publishing-an-app) the app's new version;\n10. Still logged into the desired account, [create a production workspace](https://vtex.io/docs/recipes/development/creating-a-production-workspace) and [install the app](https://vtex.io/docs/recipes/development/installing-an-app);\n10. If everything is working as expected, [promote the workspace to master](https://vtex.io/docs/recipes/development/promoting-a-workspace-to-master).\n\n## Modus Operandi \n\nOnce the app is deployed and installed in the account, every scripts contained in it will be automatically linked to your store and used to [build the templates](https://help.vtex.com/tutorial/configure-template-in-smartcheckout-update--ToTE5XB39t0SwtHgpgwSv?locale=en#configuring-templates-from-the-code-menu) to customize your Checkout.\n\n\n:warning: **Scripts used by Checkout are linked to the Checkout UI Settings version that's installed in your store**. If a prior app version was already installed and your want to change the scripts linked to it, you'll need to repeat the already existing code and thereafter launch the app's new version containing the changes you just did. Housekeeper is responsible for updating app versions in the accounts it's installed in.\n\n```"
}
] |
code_iubenda_88d259f5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of iubenda/docs/README.md from the iubenda VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/iubenda) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Iubenda\n\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n\nThis is a Iubenda first party integration app. The [solution](https://www.iubenda.com/en/?utm_source=adwords&utm_medium=ppc&utm_campaign=aw_brand_global_exact&utm_term=iubenda&utm_content=336331123145&gclid=EAIaIQobChMI38Tz0Jqg6QIVlwyRCh3KoQtkEAAYASAAEgKtK_D_BwE) is integrated with the IAB TCF and US Privacy Framework and it is responsible for managing consent preferences for the ePrivacy, GDPR, and CCPAntegrated. \n\n\n\n## Configuration\n\n1. [Install](https://vtex.io/docs/recipes/development/installing-an-app/) the `vtex.iubenda` app;\n2. In your VTEX account's admin, open the **App** section and select the Iubenda App box;\n3. Add the Site ID and the Cookie Policy ID in the respective fields;\n4. Save your changes.\n\n\n\n:information_source: *The Site ID and the Cookie Policy ID are provided by Iubenda*.\n\n### Recommended Iubenda configuration\n\n\n\nIubenda also provides a store component to let visitors update their advertising tracking preferences even after closing the cookie banner. Use the [Iubenda Components app](https://github.com/vtex-apps/iubenda-components) for that.\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n<!-- DOCS-IGNORE:end -->\n\n\n```"
}
] |
code_iubenda_8373896c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of iubenda/public/metadata/messages/es-AR.json from the iubenda VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Iubenda\",\n \"headline\": \"Soluciones fáciles de implementar para que su sitio web cumpla con la ley en varios países y leyes.\",\n \"overview\": \"Genere fácilmente un banner de cookies totalmente personalizable, obtenga el consentimiento e implemente el bloqueo previo con reactivación asincrónica.\",\n \"features\": [\n \"Cree su política de privacidad y cookies en minutos\",\n \"Administre las preferencias de consentimiento para ePrivacy, GDPR y CCPA. Integrado con IAB TCF y US Privacy Framework\",\n \"Crea tus términos y condiciones en minutos\",\n \"Recopilar el consentimiento de GDPR, aceptar documentos y desactivar CCPA a través de sus formularios web\",\n \"Documente toda la actividad de procesamiento de datos en su organización\"\n ],\n \"additionalInformation\": \"Para usar el servicio, debe tener una cuenta Iubenda activa. Algunas funciones solo están disponibles para planes específicos.\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_iubenda_a2004b9f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of iubenda/public/metadata/messages/pt-BR.json from the iubenda VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Iubenda\",\n \"headline\": \"Soluções de implementação fácil para tornar seu site compatível com a lei em vários países e legislações.\",\n \"overview\": \"Gere facilmente um banner de cookie totalmente personalizável, obtenha o consentimento e implemente o bloqueio prévio com a reativação assíncrona.\",\n \"features\": [\n \"Crie sua política de privacidade e cookies em minutos\",\n \"Gerencie preferências de consentimento para ePrivacy, GDPR e CCPA. Integrado ao IAB TCF e US Privacy Framework\",\n \"Crie seus termos e condições em minutos\",\n \"Colete o consentimento do GDPR, aceite documentos e desative o CCPA por meio de seus formulários da web\",\n \"Documente toda a atividade de processamento de dados na sua organização\"\n ],\n \"additionalInformation\": \"Para utilizar o serviço é preciso ter uma conta Iubenda ativa. Algumas funcionalidades só estão disponíveis para planos específicos.\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_iubenda_e0f0be28
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of iubenda/public/metadata/messages/en-US.json from the iubenda VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Iubenda\",\n \"headline\": \"Easy to implement solutions to make your website compliant with the law in various countries and laws.\",\n \"overview\": \"Easily generate a fully customizable cookie banner, obtain consent and implement prior blocking with asynchronous reactivation.\",\n \"features\": [\n \"Create your privacy and cookie policy in minutes\",\n \"Manage consent preferences for the ePrivacy, GDPR, and CCPA. Integrated with the IAB TCF and US Privacy Framework\",\n \"Create your terms and conditions in minutes\",\n \"Collect GDPR consent, document opt-ins and CCPA opt-outs via your web forms\",\n \"Document all the data processing activity within your organization\"\n ],\n \"additionalInformation\": \"To use the service, you must have an active Iubenda account. Some features are only available for specific plans.\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_buybox-context_81f215cc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/sl.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Vsebina Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Strategija razvrščanja\",\n \"store/buybox-context.sortStrategy-description\": \"Konfigurirajte strategijo za razvrščanje prodajalcev v Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Sproži dogodek spremembe poštne številke\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Konfigurirajte, kateri dogodek bo uporabljen za razvrščanje prodajalcev v Buybox\",\n \"store/buybox-context.price.label\": \"Cena\",\n \"store/buybox-context.price-and-shipping.label\": \"Cena in dostava\",\n \"store/buybox-context.custom-expression\": \"Izraz po meri\",\n \"store/buybox-context.protocol\": \"Protokol\",\n \"store/buybox-context.order-form.label\": \"Obrazec za naročilo\",\n \"store/buybox-context.seller-selector.label\": \"Izbirnik prodajalca\",\n \"store/buybox-context.expression-title\": \"Izraz\",\n \"store/buybox-context.expression-description\": \"Konfigurirajte izraze za razvrščanje prodajalcev: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Med izvajanjem protokola razvrščanja je prišlo do napake in strategija razvrščanja je bila spremenjena na ceno.\"\n}\n```"
}
] |
code_buybox-context_843d13e6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/nl.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox context\",\n \"store/buybox-context.sortStrategy-title\": \"Strategie sorteren\",\n \"store/buybox-context.sortStrategy-description\": \"Strategie configureren om verkopers op buybox te sorteren\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"CEP-wijzigingsgebeurtenis activeren\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configureren welke gebeurtenis wordt gebruikt om verkopers op buybox te sorteren\",\n \"store/buybox-context.price.label\": \"Prijs\",\n \"store/buybox-context.price-and-shipping.label\": \"Prijs en verzending\",\n \"store/buybox-context.custom-expression\": \"Aangepaste expressie\",\n \"store/buybox-context.protocol\": \"Protocol\",\n \"store/buybox-context.order-form.label\": \"Bestelformulier\",\n \"store/buybox-context.seller-selector.label\": \"Kiezer verkoper\",\n \"store/buybox-context.expression-title\": \"Expressie\",\n \"store/buybox-context.expression-description\": \"Configureer expressies voor sorteerverkopers: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Er is een fout opgetreden bij het uitvoeren van het sorteerprotocol en de sorteerstrategie is gewijzigd in prijs.\"\n}\n```"
}
] |
code_buybox-context_f3a169ae
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/ja.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"ショッピングカートのコンテキスト\",\n \"store/buybox-context.sortStrategy-title\": \"並べ替え戦略\",\n \"store/buybox-context.sortStrategy-description\": \"ショッピングカートで販売者を並べ替えるための戦略を構成する\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"CEP 変更イベントをトリガーする\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"ショッピングカートで販売者を並べ替えるために使うイベントを構成する\",\n \"store/buybox-context.price.label\": \"価格\",\n \"store/buybox-context.price-and-shipping.label\": \"価格と出荷\",\n \"store/buybox-context.custom-expression\": \"カスタム式\",\n \"store/buybox-context.protocol\": \"プロトコル\",\n \"store/buybox-context.order-form.label\": \"注文フォーム\",\n \"store/buybox-context.seller-selector.label\": \"販売者セレクタ\",\n \"store/buybox-context.expression-title\": \"式\",\n \"store/buybox-context.expression-description\": \"販売者を並べ替えるための式を構成します: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"並べ替えプロトコルの実行時にエラーが発生し、並べ替え戦略が価格に変更されました。\"\n}\n```"
}
] |
code_buybox-context_4eb8bc8c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/de.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox-Kontext\",\n \"store/buybox-context.sortStrategy-title\": \"Sortierstrategie\",\n \"store/buybox-context.sortStrategy-description\": \"Konfigurieren Sie die Strategie zur Einstufung von Verkäufern in der Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Postleitzahlwechsel auslösen\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Konfigurieren Sie, welches Ereignis verwendet wird, um Verkäufer in der Buybox zu klassifizieren\",\n \"store/buybox-context.price.label\": \"Preis\",\n \"store/buybox-context.price-and-shipping.label\": \"Preis und Versand\",\n \"store/buybox-context.custom-expression\": \"Benutzerdefinierter Ausdruck\",\n \"store/buybox-context.protocol\": \"Protokoll\",\n \"store/buybox-context.order-form.label\": \"Bestellformular\",\n \"store/buybox-context.seller-selector.label\": \"Verkäuferauswahl\",\n \"store/buybox-context.expression-title\": \"Ausdruck\",\n \"store/buybox-context.expression-description\": \"Konfigurieren Sie Ausdrücke zur Einstufung von Verkäufern: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Bei der Ausführung des Sortierprotokolls ist ein Fehler aufgetreten und die Sortierstrategie wurde auf Preis geändert.\"\n}\n```"
}
] |
code_buybox-context_b3a52ed8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/ru.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Содержимое области Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Стратегия сортировки\",\n \"store/buybox-context.sortStrategy-description\": \"Настройте стратегию рейтинга продавцов в Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Запуск события изменения почтового кода\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Настройте, какое событие будет использоваться для рейтинга продавцов в Buybox\",\n \"store/buybox-context.price.label\": \"Цена\",\n \"store/buybox-context.price-and-shipping.label\": \"Цена и доставка\",\n \"store/buybox-context.custom-expression\": \"Пользовательское выражение\",\n \"store/buybox-context.protocol\": \"Протокол\",\n \"store/buybox-context.order-form.label\": \"Форма заказа\",\n \"store/buybox-context.seller-selector.label\": \"Селектор продавцов\",\n \"store/buybox-context.expression-title\": \"Выражение\",\n \"store/buybox-context.expression-description\": \"Настройте выражения для рейтинга продавцов: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"При выполнении протокола сортировки произошла ошибка, и стратегия сортировки была изменена на ценовую.\"\n}\n```"
}
] |
code_buybox-context_07f5a25b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/pl.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Kontekst Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Strategia sortowania\",\n \"store/buybox-context.sortStrategy-description\": \"Skonfiguruj strategię do rankingu sprzedawców w Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Wyzwalaj zdarzenie zmiany kodu pocztowego\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Skonfiguruj, które wydarzenie będzie używane do rankingu sprzedawców w Buybox\",\n \"store/buybox-context.price.label\": \"Cena\",\n \"store/buybox-context.price-and-shipping.label\": \"Cena i wysyłka\",\n \"store/buybox-context.custom-expression\": \"Wyrażenie niestandardowe\",\n \"store/buybox-context.protocol\": \"Protokół\",\n \"store/buybox-context.order-form.label\": \"Formularz zamówienia\",\n \"store/buybox-context.seller-selector.label\": \"Selektor sprzedawcy\",\n \"store/buybox-context.expression-title\": \"Wyrażenie\",\n \"store/buybox-context.expression-description\": \"Skonfiguruj wyrażenia, aby uszeregować sprzedawców: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Podczas wykonywania protokołu sortowania wystąpił błąd i strategia sortowania została zmieniona na cenę.\"\n}\n```"
}
] |
code_buybox-context_2b98bac3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/uk.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Вміст області Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Стратегія сортування\",\n \"store/buybox-context.sortStrategy-description\": \"Налаштуйте стратегію рейтингу продавців у Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Запуск події зміни поштового коду\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Налаштуйте, яку подію використовуватимуть для рейтингу продавців у Buybox\",\n \"store/buybox-context.price.label\": \"Ціна\",\n \"store/buybox-context.price-and-shipping.label\": \"Ціна та доставка\",\n \"store/buybox-context.custom-expression\": \"Користувацький вираз\",\n \"store/buybox-context.protocol\": \"Протокол\",\n \"store/buybox-context.order-form.label\": \"Форма замовлення\",\n \"store/buybox-context.seller-selector.label\": \"Селектор продавців\",\n \"store/buybox-context.expression-title\": \"Вираз\",\n \"store/buybox-context.expression-description\": \"Налаштуйте вирази для рейтингу продавців: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Під час виконання протоколу сортування сталася помилка, і стратегію сортування було змінено на цінову.\"\n}\n```"
}
] |
code_buybox-context_56a7a94e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/fi.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buyboxin konteksti\",\n \"store/buybox-context.sortStrategy-title\": \"Lajittelustrategia\",\n \"store/buybox-context.sortStrategy-description\": \"Määritä strategia myyjien järjestämiseksi Buyboxissa\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Laukaise postinumeron muutos tapahtuma\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Määritä, mikä tapahtuma käytetään myyjien järjestämiseen Buyboxissa\",\n \"store/buybox-context.price.label\": \"Hinta\",\n \"store/buybox-context.price-and-shipping.label\": \"Hinta ja toimitus\",\n \"store/buybox-context.custom-expression\": \"Mukautettu ilmaisu\",\n \"store/buybox-context.protocol\": \"Protokolla\",\n \"store/buybox-context.order-form.label\": \"Tilauslomake\",\n \"store/buybox-context.seller-selector.label\": \"Myyjän valitsija\",\n \"store/buybox-context.expression-title\": \"Lauseke\",\n \"store/buybox-context.expression-description\": \"Määritä lausekkeet myyjien järjestämiseen: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Lajitteluprotokollaa suorittaessa tapahtui virhe, ja lajittelustrategia vaihdettiin hintaan.\"\n}\n```"
}
] |
code_buybox-context_4c4f1f0a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/sk.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Kontext služby Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Stratégia triedenia\",\n \"store/buybox-context.sortStrategy-description\": \"Konfigurácia stratégie na radenie predajcov v služe Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Spustenie udalosti zmeny poštového smerovacieho čísla\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Konfigurácia udalosti, ktorá sa použije na radenie predajcov v službe Buybox\",\n \"store/buybox-context.price.label\": \"Cena\",\n \"store/buybox-context.price-and-shipping.label\": \"Cena a doprava\",\n \"store/buybox-context.custom-expression\": \"Vlastný výraz\",\n \"store/buybox-context.protocol\": \"Protokol\",\n \"store/buybox-context.order-form.label\": \"Objednávkovy formulár\",\n \"store/buybox-context.seller-selector.label\": \"Výber predajcu\",\n \"store/buybox-context.expression-title\": \"Výraz\",\n \"store/buybox-context.expression-description\": \"Konfigurácia výrazov na radenie predajcov: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Pri vykonávaní triediaceho protokolu sa vyskytla chyba a stratégia triedenia bola zmenená na cenu.\"\n}\n```"
}
] |
code_buybox-context_08efa891
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/pt.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Contexto da Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Estratégia de ordenação\",\n \"store/buybox-context.sortStrategy-description\": \"Configure a estratégia para ordenar os sellers na Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Acionar evento de mudança de CEP\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configure o evento que será usado para ordenar os sellers na Buybox\",\n \"store/buybox-context.price.label\": \"Preço\",\n \"store/buybox-context.price-and-shipping.label\": \"Preço e frete\",\n \"store/buybox-context.custom-expression\": \"Expressão personalizada\",\n \"store/buybox-context.protocol\": \"Protocolo\",\n \"store/buybox-context.order-form.label\": \"Formulário de pedido\",\n \"store/buybox-context.seller-selector.label\": \"Seletor de sellers\",\n \"store/buybox-context.expression-title\": \"Expressão\",\n \"store/buybox-context.expression-description\": \"Configure as expressões para ordenar os sellers: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Ocorreu um erro ao executar o protocolo de ordenação e a estratégia de ordenação foi alterada para preço.\"\n}\n```"
}
] |
code_buybox-context_2a311159
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/en.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox Context\",\n \"store/buybox-context.sortStrategy-title\": \"Sorting Strategy\",\n \"store/buybox-context.sortStrategy-description\": \"Configure the strategy to rank sellers in the Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Trigger postal code change event\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configure which event will be used to rank sellers in the Buybox\",\n \"store/buybox-context.price.label\": \"Price\",\n \"store/buybox-context.price-and-shipping.label\": \"Price and Shipping\",\n \"store/buybox-context.custom-expression\": \"Custom Expression\",\n \"store/buybox-context.protocol\": \"Protocol\",\n \"store/buybox-context.order-form.label\": \"Order Form\",\n \"store/buybox-context.seller-selector.label\": \"Seller Selector\",\n \"store/buybox-context.expression-title\": \"Expression\",\n \"store/buybox-context.expression-description\": \"Configure expressions to rank sellers: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"An error ocurred while executing the sorting protocol and the sorting strategy was changed to price.\"\n}\n```"
}
] |
code_buybox-context_642bf170
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/it.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Contesto della Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Strategia di ordinamento\",\n \"store/buybox-context.sortStrategy-description\": \"Configura la strategia per ordinare i venditori nella Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Attiva evento di modifica del codice postale\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configura quale evento verrà utilizzato per ordinare i venditori nella Buybox\",\n \"store/buybox-context.price.label\": \"Prezzo\",\n \"store/buybox-context.price-and-shipping.label\": \"Prezzo e spedizione\",\n \"store/buybox-context.custom-expression\": \"Espressione personalizzata\",\n \"store/buybox-context.protocol\": \"Protocollo\",\n \"store/buybox-context.order-form.label\": \"Modulo d'ordine\",\n \"store/buybox-context.seller-selector.label\": \"Selettore di venditori\",\n \"store/buybox-context.expression-title\": \"Espressione\",\n \"store/buybox-context.expression-description\": \"Configura le seguenti espressioni per ordinare i venditori: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Si è verificato un errore durante l'esecuzione del protocollo di ordinamento. La strategia di ordinamento è stata cambiata in \\\"Prezzo\\\".\"\n}\n```"
}
] |
code_buybox-context_d52064f9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/fr.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Contexte de la Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Stratégie de tri\",\n \"store/buybox-context.sortStrategy-description\": \"Configurer la stratégie pour trier les vendeurs sur la buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Déclencher un événement de changement CEP\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configurer quel événement sera utilisé pour trier les vendeurs sur la buybox\",\n \"store/buybox-context.price.label\": \"Prix\",\n \"store/buybox-context.price-and-shipping.label\": \"Prix et frais de port\",\n \"store/buybox-context.custom-expression\": \"Expression personnalisée\",\n \"store/buybox-context.protocol\": \"Protocole\",\n \"store/buybox-context.order-form.label\": \"Formulaire de commande\",\n \"store/buybox-context.seller-selector.label\": \"Sélecteur de Vendeur\",\n \"store/buybox-context.expression-title\": \"Expression\",\n \"store/buybox-context.expression-description\": \"Configurer les expressions pour trier les vendeurs : productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Une erreur s’est produite lors du Protocole de tri et la Stratégie de tri a été changée en Prix.\"\n}\n```"
}
] |
code_buybox-context_9997565b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/el.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Πλαίσιο Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Στρατηγική Ταξινόμησης\",\n \"store/buybox-context.sortStrategy-description\": \"Παραμετροποίηση στρατηγικής για την κατάταξη των πωλητών στο Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Ενεργοποίηση συμβάντος αλλαγής ταχυδρομικού κώδικα\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Παραμετροποίηση συμβάντος που θα χρησιμοποιηθεί για την κατάταξη των πωλητών στο Buybox\",\n \"store/buybox-context.price.label\": \"Τιμή\",\n \"store/buybox-context.price-and-shipping.label\": \"Τιμή και Αποστολή\",\n \"store/buybox-context.custom-expression\": \"Προσαρμοσμένη Έκφραση\",\n \"store/buybox-context.protocol\": \"Πρωτόκολλο\",\n \"store/buybox-context.order-form.label\": \"Φόρμα παραγγελίας\",\n \"store/buybox-context.seller-selector.label\": \"Επιλογέας Πωλητή\",\n \"store/buybox-context.expression-title\": \"Παράσταση\",\n \"store/buybox-context.expression-description\": \"Παραμετροποίηση έκφρασης για την κατάταξη των πωλητών: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Προέκυψε σφάλμα κατά την εκτέλεση του πρωτοκόλλου και η στρατηγική ταξινόμησης άλλαξε σε κατά τιμή.\"\n}\n```"
}
] |
code_buybox-context_437c001b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/bg.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Контекст на Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Стратегия за сортиране\",\n \"store/buybox-context.sortStrategy-description\": \"Конфигуриране на стратегията за сортиране на продавачи в buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Активиране на събитие за промяна на CEP\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Конфигуриране на това кое събитие ще се използва за сортиране на продавачи в buybox\",\n \"store/buybox-context.price.label\": \"Цена\",\n \"store/buybox-context.price-and-shipping.label\": \"Цена и доставка\",\n \"store/buybox-context.custom-expression\": \"Експресии по избор\",\n \"store/buybox-context.protocol\": \"Протокол\",\n \"store/buybox-context.order-form.label\": \"Формуляр за поръчка\",\n \"store/buybox-context.seller-selector.label\": \"Селектор на продавач\",\n \"store/buybox-context.expression-title\": \"Експресия\",\n \"store/buybox-context.expression-description\": \"Конфигуриране на експресиите за сортиране на продавачи: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Възникна грешка при изпълнението на протокола за сортиране и стратегията за сортиране беше променена на цена.\"\n}\n```"
}
] |
code_buybox-context_df21cbe9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/ro.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Context Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Strategie de sortare\",\n \"store/buybox-context.sortStrategy-description\": \"Configurare strategie pentru sortarea comercianților în Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Declanșare eveniment schimbare CEP\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configurare eveniment de utilizat pentru sortarea comercianților în caseta de cumpărare\",\n \"store/buybox-context.price.label\": \"Preț\",\n \"store/buybox-context.price-and-shipping.label\": \"Preț și livrare\",\n \"store/buybox-context.custom-expression\": \"Expresie personalizată\",\n \"store/buybox-context.protocol\": \"Protocol\",\n \"store/buybox-context.order-form.label\": \"Formular de comandă\",\n \"store/buybox-context.seller-selector.label\": \"Selector comerciant\",\n \"store/buybox-context.expression-title\": \"Expresie\",\n \"store/buybox-context.expression-description\": \"Configurează expresiile pentru a sorta comercianții: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"A apărut o eroare la executarea Protocolului de sortare și Strategia de sortare a fost schimbată în Preț.\"\n}\n```"
}
] |
code_buybox-context_48ff10b2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/ca.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Context de Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Estratègia d'ordenació\",\n \"store/buybox-context.sortStrategy-description\": \"Configureu l'estratègia per classificar els venedors a Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Activeu un esdeveniment de canvi de codi postal\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configureu l'esdeveniment que s'utilitzarà per classificar els venedors a Buybox\",\n \"store/buybox-context.price.label\": \"Preu\",\n \"store/buybox-context.price-and-shipping.label\": \"Preu i enviament\",\n \"store/buybox-context.custom-expression\": \"Expressió personalitzada\",\n \"store/buybox-context.protocol\": \"Protocol\",\n \"store/buybox-context.order-form.label\": \"Formulari de comanda\",\n \"store/buybox-context.seller-selector.label\": \"Selector de venedor\",\n \"store/buybox-context.expression-title\": \"Expressió\",\n \"store/buybox-context.expression-description\": \"Configureu les expressions per classificar els venedors: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"S'ha produït un error en executar el protocol d'ordenació i l'estratègia d'ordenació s'ha canviat a Preu.\"\n}\n```"
}
] |
code_buybox-context_4f9705c7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/context.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox Context\",\n \"store/buybox-context.sortStrategy-title\": \"Sort Strategy\",\n \"store/buybox-context.sortStrategy-description\": \"Configure strategy to sort sellers on buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Trigger CEP change event\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configure which event will be used to sort sellers on buybox\",\n \"store/buybox-context.price.label\": \"Price\",\n \"store/buybox-context.price-and-shipping.label\": \"Price and Shipping\",\n \"store/buybox-context.custom-expression\": \"Custom Expression\",\n \"store/buybox-context.protocol\": \"Protocol\",\n \"store/buybox-context.order-form.label\": \"Order Form\",\n \"store/buybox-context.seller-selector.label\": \"Seller Selector\",\n \"store/buybox-context.expression-title\": \"Expression\",\n \"store/buybox-context.expression-description\": \"Configure expressions to sort sellers: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"An error ocurred on execute Sort Protocol and the Sort Strategy was changed to Price.\"\n}\n```"
}
] |
code_buybox-context_f46b0851
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/ko.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"바이박스 컨텍스트\",\n \"store/buybox-context.sortStrategy-title\": \"정렬 전략\",\n \"store/buybox-context.sortStrategy-description\": \"바이박스에서 판매자를 정렬하는 전략 구성\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"CEP 변경 이벤트 트리거\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"바이박스에서 판매자를 정렬하는 데 사용할 이벤트 구성\",\n \"store/buybox-context.price.label\": \"가격\",\n \"store/buybox-context.price-and-shipping.label\": \"가격 및 배송\",\n \"store/buybox-context.custom-expression\": \"사용자 지정 식\",\n \"store/buybox-context.protocol\": \"프로토콜\",\n \"store/buybox-context.order-form.label\": \"주문 양식\",\n \"store/buybox-context.seller-selector.label\": \"판매자 선택기\",\n \"store/buybox-context.expression-title\": \"식\",\n \"store/buybox-context.expression-description\": \"판매자를 정렬하는 식 구성: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"정렬 프로토콜 실행 시 오류가 발생했으며 정렬 전략이 가격으로 변경되었습니다.\"\n}\n```"
}
] |
code_buybox-context_8d7c6bde
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/cs.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Kontext Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Strategie třídění\",\n \"store/buybox-context.sortStrategy-description\": \"Konfigurovat strategie pro řazení prodejců v Buyboxu\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Spustit událost změny PSČ\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Konfigurovat, která událost bude použita pro řazení prodejců v Buyboxu\",\n \"store/buybox-context.price.label\": \"Cena\",\n \"store/buybox-context.price-and-shipping.label\": \"Cena a doprava\",\n \"store/buybox-context.custom-expression\": \"Vlastní výraz\",\n \"store/buybox-context.protocol\": \"Protokol\",\n \"store/buybox-context.order-form.label\": \"Objednávkový formulář\",\n \"store/buybox-context.seller-selector.label\": \"Výběr prodejce\",\n \"store/buybox-context.expression-title\": \"Výraz\",\n \"store/buybox-context.expression-description\": \"Konfigurovat výrazy pro řazení prodejců: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Při provádění řadícího protokolu došlo k chybě a strategie třídění byla změněna na cenu.\"\n}\n```"
}
] |
code_buybox-context_b2280195
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/id.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Konteks Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"Strategi Penyortiran\",\n \"store/buybox-context.sortStrategy-description\": \"Konfigurasi strategi untuk memeringkat penjual di Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Picu event perubahan kode pos\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Konfigurasi event mana yang akan digunakan untuk memeringkat penjual di Buybox\",\n \"store/buybox-context.price.label\": \"Harga\",\n \"store/buybox-context.price-and-shipping.label\": \"Harga dan Pengiriman\",\n \"store/buybox-context.custom-expression\": \"Ekspresi Kustom\",\n \"store/buybox-context.protocol\": \"Protokol\",\n \"store/buybox-context.order-form.label\": \"Formulir Pesanan\",\n \"store/buybox-context.seller-selector.label\": \"Pemilih Penjual\",\n \"store/buybox-context.expression-title\": \"Ekspresi\",\n \"store/buybox-context.expression-description\": \"Konfigurasi ekspresi untuk memeringkat penjual: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Terjadi kesalahan saat menjalankan protokol penyortiran dan strategi penyortiran diubah harganya.\"\n}\n```"
}
] |
code_buybox-context_d8d127af
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/no.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox Kontekst\",\n \"store/buybox-context.sortStrategy-title\": \"Sortering Strategi\",\n \"store/buybox-context.sortStrategy-description\": \"Konfigurer strategien for å rangere selgere i Buyboxen\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Utløs hendelsen ved endring av postnummer\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Konfigurer hvilken hendelse som skal brukes til å rangere selgere i Buyboxen\",\n \"store/buybox-context.price.label\": \"Pris\",\n \"store/buybox-context.price-and-shipping.label\": \"Pris og frakt\",\n \"store/buybox-context.custom-expression\": \"Tilpasset uttrykk\",\n \"store/buybox-context.protocol\": \"Protokoll\",\n \"store/buybox-context.order-form.label\": \"Bestillingsskjema\",\n \"store/buybox-context.seller-selector.label\": \"Selgervelger\",\n \"store/buybox-context.expression-title\": \"Uttrykk\",\n \"store/buybox-context.expression-description\": \"Konfigurer uttrykk for å rangere selgere: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Det oppsto en feil under utførelsen av sorteringsprotokollen, og sorteringsstrategien ble endret til pris.\"\n}\n```"
}
] |
code_buybox-context_eefadbbd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/da.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox-kontekst\",\n \"store/buybox-context.sortStrategy-title\": \"Sorteringsstrategi\",\n \"store/buybox-context.sortStrategy-description\": \"Konfigurer strategien til at rangordne sælgere i Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Udløser postnummerændringshændelse\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Konfigurer, hvilken begivenhed der skal bruges til at rangordne sælgere i Buybox\",\n \"store/buybox-context.price.label\": \"Pris\",\n \"store/buybox-context.price-and-shipping.label\": \"Pris og forsendelse\",\n \"store/buybox-context.custom-expression\": \"Brugerdefineret udtryk\",\n \"store/buybox-context.protocol\": \"Protokol\",\n \"store/buybox-context.order-form.label\": \"Ordreformular\",\n \"store/buybox-context.seller-selector.label\": \"Sælgervælger\",\n \"store/buybox-context.expression-title\": \"Udtryk\",\n \"store/buybox-context.expression-description\": \"Konfigurer udtryk til at rangordne sælgere: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Der opstod en fejl under udførelsen af sorteringsprotokollen, og sorteringsstrategien blev ændret til pris.\"\n}\n```"
}
] |
code_buybox-context_8dde9131
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/th.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"บริบทของ Buybox\",\n \"store/buybox-context.sortStrategy-title\": \"กลยุทธ์การคัดแยก\",\n \"store/buybox-context.sortStrategy-description\": \"กำหนดค่ากลยุทธ์เพื่อคัดแยกผู้ขายใน Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"กระตุ้นเหตุการณ์การเปลี่ยนแปลงใน CEP\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"กำหนดค่าว่าจะใช้เหตุการณ์ใดเป็นตัวคัดแยกผู้ขายใน Buybox\",\n \"store/buybox-context.price.label\": \"ราคา\",\n \"store/buybox-context.price-and-shipping.label\": \"ราคาและการขนส่ง\",\n \"store/buybox-context.custom-expression\": \"Expression ที่กำหนดเอง\",\n \"store/buybox-context.protocol\": \"โปรโตคอล\",\n \"store/buybox-context.order-form.label\": \"แบบฟอร์มคำสั่ง\",\n \"store/buybox-context.seller-selector.label\": \"ผู้ขายที่มีให้เลือก\",\n \"store/buybox-context.expression-title\": \"Expression\",\n \"store/buybox-context.expression-description\": \"กำหนดค่า Expression ที่จะคัดแยกผู้ขาย: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"เกิดข้อผิดพลาดเมื่อทำรายการโปรโตคอลการคัดแยก และมีการเปลี่ยนกลยุทธ์การคัดแยกไปที่ราคา\"\n}\n```"
}
] |
code_buybox-context_9a29c461
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/sv.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox Kontext\",\n \"store/buybox-context.sortStrategy-title\": \"Sorteringsstrategi\",\n \"store/buybox-context.sortStrategy-description\": \"Konfigurera strategin för att rangordna säljare i Buyboxen\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Trigga händelsen för postnummerändring\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Konfigurera vilken händelse som ska användas för att rangordna säljare i Buyboxen\",\n \"store/buybox-context.price.label\": \"Pris\",\n \"store/buybox-context.price-and-shipping.label\": \"Pris och frakt\",\n \"store/buybox-context.custom-expression\": \"Anpassat uttryck\",\n \"store/buybox-context.protocol\": \"Protokoll\",\n \"store/buybox-context.order-form.label\": \"Orderformulär\",\n \"store/buybox-context.seller-selector.label\": \"Säljareväljare\",\n \"store/buybox-context.expression-title\": \"Uttryck\",\n \"store/buybox-context.expression-description\": \"Konfigurera uttryck för att rangordna säljare: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Ett fel inträffade vid utförandet av sorteringsprotokollet och sorteringsstrategin ändrades till pris.\"\n}\n```"
}
] |
code_buybox-context_cc370018
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/es.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox Context\",\n \"store/buybox-context.sortStrategy-title\": \"Estrategia de ordenación\",\n \"store/buybox-context.sortStrategy-description\": \"Configura la estrategia para clasificar los sellers en el Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Activar evento de cambio de código postal\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configura qué evento se utilizará para clasificar los sellers en el Buybox\",\n \"store/buybox-context.price.label\": \"Precio\",\n \"store/buybox-context.price-and-shipping.label\": \"Precio y envío\",\n \"store/buybox-context.custom-expression\": \"Expresión personalizada\",\n \"store/buybox-context.protocol\": \"Protocolo\",\n \"store/buybox-context.order-form.label\": \"Formulario de pedido\",\n \"store/buybox-context.seller-selector.label\": \"Selector de sellers\",\n \"store/buybox-context.expression-title\": \"Expresión\",\n \"store/buybox-context.expression-description\": \"Configura expresiones para clasificar los sellers: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Se produjo un error al ejecutar el protocolo de ordenación y se cambió la estrategia de ordenación a precio.\"\n}\n```"
}
] |
code_buybox-context_141f24d6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/ar.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"سياق علبة الشراء\",\n \"store/buybox-context.sortStrategy-title\": \"استراتيجية الفرز\",\n \"store/buybox-context.sortStrategy-description\": \"قم بإعداد إستراتيجية لترتيب البائعين في علبة الشراء\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"تشغيل حدث تغيير الرمز البريدي\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"قم بإعداد الحدث الذي سيتم استخدامه لترتيب البائعين في علبة الشراء\",\n \"store/buybox-context.price.label\": \"السعر\",\n \"store/buybox-context.price-and-shipping.label\": \"السعر والشحن\",\n \"store/buybox-context.custom-expression\": \"تعبير مخصص\",\n \"store/buybox-context.protocol\": \"البروتوكول\",\n \"store/buybox-context.order-form.label\": \"استمارة الطلب\",\n \"store/buybox-context.seller-selector.label\": \"محدد البائع\",\n \"store/buybox-context.expression-title\": \"التعبير\",\n \"store/buybox-context.expression-description\": \"قم بإعداد التعابير لترتيب البائعين: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"تم تغيير الخطأ أثناء تنفيذ بروتوكول الفرز واستراتيجية الفرز إلى السعر.\"\n}\n```"
}
] |
code_buybox-context_70cf6cec
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/messages/es-MX.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/buybox-context.title\": \"Buybox Context\",\n \"store/buybox-context.sortStrategy-title\": \"Estrategia de ordenación\",\n \"store/buybox-context.sortStrategy-description\": \"Configura la estrategia para clasificar los sellers en el Buybox\",\n \"store/buybox-context.triggerCepChangeEvent-title\": \"Activar evento de cambio de código postal\",\n \"store/buybox-context.triggerCepChangeEvent-description\": \"Configura qué evento se utilizará para clasificar los sellers en el Buybox\",\n \"store/buybox-context.price.label\": \"Precio\",\n \"store/buybox-context.price-and-shipping.label\": \"Precio y envío\",\n \"store/buybox-context.custom-expression\": \"Expresión personalizada\",\n \"store/buybox-context.protocol\": \"Protocolo\",\n \"store/buybox-context.order-form.label\": \"Formulario de pedido\",\n \"store/buybox-context.seller-selector.label\": \"Selector de sellers\",\n \"store/buybox-context.expression-title\": \"Expresión\",\n \"store/buybox-context.expression-description\": \"Configura expresiones para clasificar los sellers: productPrice, productSpotPrice, productAvailableQuantity, minShippingPrice, maxShippingPrice, minShippingEstimate, maxShippingEstimate\",\n \"store/buybox-context.protocol-error\": \"Se produjo un error al ejecutar el protocolo de ordenación y se cambió la estrategia de ordenación a precio.\"\n}\n```"
}
] |
code_buybox-context_abea9cf3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/docs/README.md from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/buybox-context) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Buybox Context\n\n## ⚠️ Maintenance ⚠️\n*Starting June 1st 2023, this application will no longer be maintained by VTEX.*\n\n---\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n\n[](#contributors-)\n\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nBuybox context is a component to add the possibility to sort the sellers of a product that is sold by multiple sellers.\nWhen Buybox context wrap a Product context, it change the ordenation of sellers and set the new `sellerDefault` on seller list of current product.\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;\n\n```json\n \"dependencies\": {\n \"vtexbr.buybox-context\": \"1.x\"\n }\n```\n\n> 📢 If you want to use the [vtex.seller-selector](https://github.com/vtex-apps/seller-selector) app to boost your development, you can add it as a dependency in the `manifest.json` file\n>\n> ```json\n> \"dependencies\": {\n> \"vtex.seller-selector\": \"0.x\"\n> }\n> ```\n\n2. Wrap a block that uses the [`Product Context`](https://github.com/vtex-apps/product-context) and configure the `sortStrategy` that will be used to sort the sellers.\n\n```json\n \"buybox-context\": {\n \"props\": {\n \"conditionalStrategy\": {\n \"sortStrategy\": \"priceShipping\",\n }\n \"triggerCepChangeEvent\": \"sellerSelector\"\n },\n \"children\": [\n ...\n ]\n }\n```\n\nNow, you are able to use all the blocks exported by the `buybox-context` app. Check out the full list below:\n\n### `buybox-context` props\n\n| Prop name | Type | Description | Default value |\n| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- |\n| `conditionalStrategy` | `object` | Object responsible to provide the sort strategy and custom expresions. | `undefined` |\n| `triggerCepChangeEvent` | `enum` | The Buybox Context depends on CEP event to get Sellers of Product. Depending on context the Buybox Context is used, you can select what this component will be listening to intercept changes and reorder sellers. | `\"orderForm\"` |\n| `children` | `array` | Array with `block` components, that use the `Product Context` to sort sellers. | `null` |\n\n- `conditionalStrategy` props\n\n| Prop name | Type | Description | Default value |\n| -------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |\n| `sortStrategy` | `enum` | Use to select which sort strategy will be used to sort the sellers. If this prop isn't informed, nothing will be done. | `undefined` |\n| `expression` | `string` | Custom expression based on a math expression, with predefined [`variables`](#custom-expression-variables). The lowest value resultant of this expression, will be positioned at the top of the sellers list. For more details about how to create expressions, click [here](https://github.com/silentmatt/expr-eval#readme). | `undefined` |\n\n- `sortStrategy` enum:\n | Prop name | Type | Description |\n | --------- | -------- | ----------- |\n | `price` | `string` | Sort sellers **only product price**. The sellers at the top of the list will have the lowest prices. |\n | `priceShipping` | `string` | Sort sellers by **product price + shipping price**. The lowest sum between these two values, will be positioned at the top of the sellers list. |\n | `customExpression` | `string` | Sort sellers by a custom expression based on a math expression, with predefined [`variables`](#custom-expression-variables). The lowest value resultant of this expression, will be positioned at the top of the sellers list. For more details about how to create expressions, click [here](https://github.com/silentmatt/expr-eval#readme) |\n | `protocol` | `string` | Sort sellers using a protocol defined on [buybox-graphql](https://github.com/vtex-apps/buybox-graphql). This protocol defines the contract to receive and respond with the sorted data. For that to work, it's necessary to implement a resolver for this contract. The [buybox-resolver](https://github.com/vtex-apps/buybox-resolver) was created as an example of that implementation. |\n\n- `triggerCepChangeEvent` enum:\n | Prop name | Type | Description |\n | --------- | -------- | ----------- |\n | `orderForm` | `string` | Used for listening [`useOrderForm()`](https://github.com/vtex-apps/order-manager#orderform-orderform) changes, to get sellers and logistics info to sort seller list with new shipping values. |\n | `sellerSelector` | `string` | Used for listening [`useSellerContext()`]() changes, to get sellers and logistics info to sort seller list with new shipping values. |\n\n- `children` array: Array with `block` components\n\n📢 _The `sortStrategy` and `triggerCepChangeEvent` can be changed using Site Editor_\n\n### Custom expression variables\n\n| Variable | Entity | Description |\n| -------------------------- | -------- | ------------------------------- |\n| `productPrice` | Product | Product price |\n| `productSpotPrice` | Product | Product spot price |\n| `productAvailableQuantity` | Product | Product available quantity |\n| `minShippingPrice` | Shipping | Cheapest shipping price |\n| `maxShippingPrice` | Shipping | Most expensive shipping price |\n| `minShippingEstimate` | Shipping | Minimum estimated delivery time |\n| `maxShippingEstimate` | Shipping | Maximum estimated delivery time |\n\n### `seller-body.buybox` props\n\n| Prop name | Type | Description | Default value |\n| ---------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- |\n| `children` | `array` | Array with `block` components. It's very recommended you follow the [seller-sellector](https://github.com/vtex-apps/seller-selector#advanced-configuration) instrucions to use this. | `null` |\n\n- `children` array: Array with `block` components.\n\n## Dependences\n\n- [vtex.product-context](https://github.com/vtex-apps/product-context)\n- [vtex.order-manager](https://github.com/vtex-apps/order-manager)\n- [vtex.seller-selector](https://github.com/vtex-apps/seller-selector)\n- [expr-eval](https://github.com/silentmatt/expr-eval)\n\n## Modus Operandi\n\n### Product Page\n\nOn product page you can add the `buybox-context` where make sense the behavior of select the Buybox winner. In the example bellow `flex-layout.col#right-col` is the block that contains product values and conditions. See below:\n\n```json\n{\n ...\n \"flex-layout.row#product-main\": {\n \"children\": [\n \"flex-layout.col#stack\",\n \"flex-layout.col#right-col\"\n ]\n }\n ...\n}\n```\n\nAfter adding the `buybox-context` in this example, the new code will be like bellow:\n\n```diff\n{\n ...\n \"flex-layout.row#product-main\": {\n \"children\": [\n \"flex-layout.col#stack\",\n- \"flex-layout.col#right-col\"\n+ \"vtex.buybox-context:buybox-context#product-col\"\n ]\n },\n+ \"vtex.buybox-context:buybox-context#product-col\": {\n+ \"props\": {\n+ \"conditionalStrategy\": {\n+ \"sortStrategy\": \"priceShipping\"\n+ },\n+ \"triggerCepChangeEvent\": \"orderForm\"\n+ },\n+ \"children\": [\n+ \"flex-layout.col#right-col\"\n+ ]\n+ },\n ...\n}\n```\n\nℹ️ _By default the prop `triggerCepChangeEvent` value is `orderForm`, which makes this prop optional._\n\n### Sellers\n\nWith [seller-selector](https://github.com/vtex-apps/seller-selector) and `buybox-context` installed in your theme, do you can create or edit file in `store/blocks/sellers/sellers.jsonc` and add this code bellow:\n\n```json\n{\n \"store.sellers\": {\n \"blocks\": [\"vtex.seller-selector:seller-table\"]\n },\n \"vtex.seller-selector:seller-table\": {\n \"children\": [\n \"vtex.seller-selector:seller-simulate-shipping\",\n \"vtex.seller-selector:seller-head\",\n \"buybox-context\"\n ]\n },\n \"buybox-context\": {\n \"props\": {\n \"conditionalStrategy\": {\n \"sortStrategy\": \"priceShipping\"\n },\n \"triggerCepChangeEvent\": \"sellerSelector\"\n },\n \"children\": [\"seller-body.buybox\"]\n },\n \"seller-body.buybox\": {\n \"children\": [\"vtex.seller-selector:seller-row\"]\n }\n}\n```\n\nThat way you will have a page similar to this:\n\n\nℹ️ _To have the full behaviour using `seller-body.buybox`, it will be necessary to set the `triggerCepChangeEvent` as `sellerSelector` props on `buybox-context`. Because the default value for this parameter is `orderForm`, but on this page we usually use the `seller-simulate-shipping` to calculate shipping_\n\n## Customization\n\nIn order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://vtex.io/docs/recipes/style/using-css-handles-for-store-customization).\n\n| CSS Handles |\n| ------------ |\n| `sellerList` |\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n<!-- DOCS-IGNORE:end -->\n\n**Upcoming documentation:**\n\n- [Feature/brpa 352 sort by expression](https://github.com/vtex-apps/buybox-context/pull/5)\n- [add a conditional field expression](https://github.com/vtex-apps/buybox-context/pull/6)\n- [add productSpotPrice and productAvailableQuantity variables](https://github.com/vtex-apps/buybox-context/pull/7)\n- [add shipping estimate as variable](https://github.com/vtex-apps/buybox-context/pull/8)\n\n```"
}
] |
code_buybox-context_3a916c43
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/package.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.8\",\n \"expr-eval\": \"^2.0.2\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.9.8\",\n \"@types/react\": \"^16.9.31\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.6.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles\",\n \"vtex.order-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.11.1/public/@types/vtex.order-manager\",\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.3/public/@types/vtex.render-runtime\",\n \"vtex.seller-selector\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.seller-selector@0.3.0/public/@types/vtex.seller-selector\",\n \"vtex.store\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store@2.120.1/public/@types/vtex.store\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.147.3/public/@types/vtex.store-graphql\"\n },\n \"version\": \"1.1.0\"\n}\n\n```"
}
] |
code_buybox-context_e77df2ed
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/SellerBody.tsx from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { ReactNode } from 'react'\nimport React, { useCallback } from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { CurrentSellerContext } from 'vtex.seller-selector'\n\nimport { useBuyBoxContext } from './context/BuyboxContext'\nimport type { LogisticsInfo, Seller } from './typings/types'\n\nconst SELLERS_CSS_HANDLES = ['sellerList']\n\ninterface Props {\n children: ReactNode\n}\n\ninterface CurrentSellerContextValue {\n currentSeller: Seller | null\n shipping: LogisticsInfo | null\n}\n\nconst SellerBody: StorefrontFunctionComponent<Props> = ({ children }) => {\n const handles = useCssHandles(SELLERS_CSS_HANDLES)\n\n const { sortedSellers, sortedLogisticsInfo } = useBuyBoxContext()\n\n const currentSellerCreate = useCallback(\n (current: Seller, index: number) => {\n const currentContext: CurrentSellerContextValue = {\n currentSeller: current,\n shipping: sortedLogisticsInfo ? sortedLogisticsInfo[index] : null,\n }\n\n return currentContext\n },\n [sortedLogisticsInfo]\n )\n\n return (\n <div className={`${handles.sellers} mh7 mb7`}>\n {sortedSellers?.map((current, index: number) => (\n <CurrentSellerContext.CurrentSellerProvider\n value={currentSellerCreate(current, index)}\n key={index}\n >\n {children}\n </CurrentSellerContext.CurrentSellerProvider>\n ))}\n </div>\n )\n}\n\nexport default SellerBody\n\n```"
}
] |
code_buybox-context_97478b51
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/BuyboxApp.tsx from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport { ProductWithSortedSellers } from './components/ProductWithSortedSellers'\nimport BuyboxProvider from './provider/BuyboxProvider'\nimport type { Strategies, TriggerCepChangeEventType } from './typings/types'\nimport { messages } from './utils/messages'\n\ninterface Props {\n conditionalStrategy?: {\n sortStrategy?: Strategies\n expression?: string\n }\n triggerCepChangeEvent?: TriggerCepChangeEventType\n}\n\nconst BuyboxApp: StorefrontFunctionComponent<Props> = ({\n children,\n conditionalStrategy = { sortStrategy: 'price' },\n triggerCepChangeEvent = 'orderForm',\n}) => {\n return conditionalStrategy?.sortStrategy ? (\n <BuyboxProvider\n sortStrategy={conditionalStrategy.sortStrategy}\n triggerCepChangeEvent={triggerCepChangeEvent}\n expression={conditionalStrategy.expression}\n >\n <ProductWithSortedSellers>{children}</ProductWithSortedSellers>\n </BuyboxProvider>\n ) : (\n <>{children}</>\n )\n}\n\nBuyboxApp.schema = {\n title: messages.title.id,\n type: 'object',\n properties: {\n conditionalStrategy: {\n type: 'object',\n properties: {\n sortStrategy: {\n type: 'string',\n title: messages.sortStrategyTitle.id,\n description: messages.sortStrategyDescription.id,\n enum: ['price', 'priceShipping', 'customExpression', 'protocol'],\n enumNames: [\n 'store/buybox-context.price.label',\n 'store/buybox-context.price-and-shipping.label',\n 'store/buybox-context.custom-expression',\n 'store/buybox-context.protocol',\n ],\n },\n },\n dependencies: {\n sortStrategy: {\n oneOf: [\n {\n properties: {\n sortStrategy: {\n enum: ['customExpression'],\n },\n expression: {\n type: 'string',\n title: messages.expressionTitle.id,\n description: messages.expressionDescription.id,\n },\n },\n },\n ],\n },\n },\n },\n triggerCepChangeEvent: {\n type: 'string',\n title: messages.triggerCepChangeEventTitle.id,\n description: messages.triggerCepChangeEventDescription.id,\n enum: ['orderForm', 'sellerSelector'],\n enumNames: [\n 'store/buybox-context.order-form.label',\n 'store/buybox-context.seller-selector.label',\n ],\n default: 'orderForm',\n },\n },\n}\n\nexport default BuyboxApp\n\n```"
}
] |
code_buybox-context_7951d9a4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/store/interfaces.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"buybox-context\": {\n \"component\": \"BuyboxApp\",\n \"composition\": \"children\"\n },\n \"seller-body.buybox\": {\n \"component\": \"SellerBody\",\n \"composition\": \"children\"\n }\n}\n\n```"
}
] |
code_buybox-context_7d4fea89
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/public/metadata/messages/es-AR.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Buybox\",\n \"headline\": \"Muestra un producto con diferentes sellers destacando la mejor oferta\",\n \"overview\": \"Con esta aplicación, puedes configurar reglas de elegibilidad de sellers para el producto y mostrar el producto que tenga la mejor oferta para el cliente.\",\n \"additionalInformation\": \"Después de instalar la aplicación, la debes configurar en el tema de la tienda en un contexto de producto.\",\n \"features\": [\n \"Clasifica los sellers de un producto de forma personalizada\",\n \"Crea tu propia ordenación utilizando expresiones con atributos del producto\",\n \"Flexibilidad para utilizar los órdenes predefinidos o personalizados\"\n ],\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_buybox-context_31432f18
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/public/metadata/messages/pt-BR.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Buybox\",\n \"headline\": \"Exiba um produto com diferentes sellers, destacando a melhor oferta\",\n \"overview\": \"Com este aplicativo, você poderá configurar as regras de elegibilidade de sellers para um produto e mostrar a melhor oferta para o cliente.\",\n \"additionalInformation\": \"Após a instalação, o aplicativo deve ser configurado no tema da loja, em um contexto de produto.\",\n \"features\": [\n \"Ordene os sellers de um produto de forma personalizada\",\n \"Crie sua própria estratégia de ordenação utilizando expressões com atributos do produto\",\n \"Flexibilidade para utilizar ordenações predefinidas ou customizadas\"\n ],\n \"websiteURL\": \"https://vtex.com/br-pt/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_buybox-context_04588200
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/public/metadata/messages/en-US.json from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"Buybox\",\n \"headline\": \"Display a product with different sellers, featuring the best offer\",\n \"overview\": \"With this app, you will be able to define seller eligibility rules for a product and feature the best offer to the customer.\",\n \"additionalInformation\": \"After installing this app, you must configure it in the store theme, in a product context.\",\n \"features\": [\n \"Rank sellers of a product based on custom criteria\",\n \"Create your own sorting strategy using expressions with product attributes\",\n \"Flexibility to use predefined or custom sorting settings\"\n ],\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_buybox-context_4fb91774
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/context/BuyboxContext.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { createContext, useContext } from 'react'\n\nimport type {\n LogisticsInfo,\n Seller,\n SellerLogisticsInfoResult,\n} from '../typings/types'\n\nexport interface BuyBoxContextType {\n sortedSellersLogisticInfo: SellerLogisticsInfoResult[]\n sortedSellers: Seller[]\n sortedLogisticsInfo: LogisticsInfo[]\n}\n\nexport const BuyBoxContext = createContext<BuyBoxContextType>({\n sortedSellersLogisticInfo: [],\n sortedSellers: [],\n sortedLogisticsInfo: [],\n})\n\nexport function useBuyBoxContext() {\n return useContext(BuyBoxContext)\n}\n\nexport default BuyBoxContext\n\n```"
}
] |
code_buybox-context_358f2a68
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/typings/storefront.d.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { FunctionComponent } from 'react'\n\ndeclare global {\n interface StorefrontFunctionComponent<P = GenericObject>\n extends FunctionComponent<P> {\n getSchema?(props: P): GenericObject\n schema?: GenericObject\n }\n\n interface StorefrontComponent<P = GenericObject, S = GenericObject>\n extends Component<P, S> {\n getSchema?(props: P): GenericObject\n schema: GenericObject\n }\n}\n\n```"
}
] |
code_buybox-context_ece2fa9c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/typings/types.d.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { LogisticsInfo as SellerContextLogisticsInfo } from 'vtex.seller-selector/react/SellerContext'\nimport type { Seller as SellerContextSeller } from 'vtex.product-context/react/ProductTypes'\n\nexport type Strategies =\n | 'price'\n | 'priceShipping'\n | 'customExpression'\n | 'protocol'\nexport type TriggerCepChangeEventType = 'orderForm' | 'sellerSelector'\n\nexport type LogisticsInfo = SellerContextLogisticsInfo\nexport type Seller = SellerContextSeller\n\nexport interface SellerLogisticsInfoResult {\n seller: Seller\n logisticsInfo?: LogisticsInfo\n}\n\n```"
}
] |
code_buybox-context_10d6397a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/typings/gql.d.ts from the buybox-context 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_buybox-context_04b65f8c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/typings/css.d.ts from the buybox-context 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_buybox-context_7d278e28
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/provider/BuyboxProvider.tsx from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { ReactNode } from 'react'\nimport React from 'react'\nimport { useIntl } from 'react-intl'\n\nimport BuyboxContext from '../context/BuyboxContext'\nimport { useReduceSellerLogisticsInfo } from '../hooks/useReduceSellerLogisticsInfo'\nimport { useSellerLoginstcsInfoSellerSelector } from '../hooks/useSellerLoginstcsInfoSellerSelector'\nimport { useSellerLogisticsInfo } from '../hooks/useSellerLogisticsInfo'\nimport { useSellersByProtocol } from '../hooks/useSellersByProtocol'\nimport type {\n SellerLogisticsInfoResult,\n Strategies,\n TriggerCepChangeEventType,\n} from '../typings/types'\nimport { messages } from '../utils/messages'\nimport {\n sortSellersByCustomExpression,\n sortSellersByPrice,\n sortSellersByPriceShipping,\n} from '../utils/sortSellers'\n\nconst SortStrategyFunctions: {\n [key in Strategies]: (\n sellersInfo: SellerLogisticsInfoResult[],\n expression?: string\n ) => SellerLogisticsInfoResult[]\n} = {\n price: sortSellersByPrice,\n priceShipping: sortSellersByPriceShipping,\n customExpression: sortSellersByCustomExpression,\n protocol: useSellersByProtocol,\n}\n\nconst SellerLogisticsInfoFunctions: {\n [key in TriggerCepChangeEventType]: () => SellerLogisticsInfoResult[]\n} = {\n orderForm: useSellerLogisticsInfo,\n sellerSelector: useSellerLoginstcsInfoSellerSelector,\n}\n\ninterface Props {\n children: ReactNode\n sortStrategy: Strategies\n expression?: string\n triggerCepChangeEvent: TriggerCepChangeEventType\n}\n\nconst BuyboxProvider = ({\n children,\n sortStrategy,\n expression,\n triggerCepChangeEvent,\n}: Props) => {\n const intl = useIntl()\n\n const sellersInfoResult =\n SellerLogisticsInfoFunctions[triggerCepChangeEvent]()\n\n let sortedSellersLogisticInfo: SellerLogisticsInfoResult[] = []\n\n try {\n sortedSellersLogisticInfo = SortStrategyFunctions[sortStrategy](\n sellersInfoResult,\n expression\n )\n } catch (error) {\n sortedSellersLogisticInfo = SortStrategyFunctions.price(sellersInfoResult)\n\n console.error(intl.formatMessage(messages.protocolError), '\\n', error)\n }\n\n const { sellers: sortedSellers, logisticsInfo: sortedLogisticsInfo } =\n useReduceSellerLogisticsInfo({\n sellerLogisticsInfo: sortedSellersLogisticInfo,\n })\n\n return (\n <BuyboxContext.Provider\n value={{\n sortedSellersLogisticInfo,\n sortedSellers,\n sortedLogisticsInfo,\n }}\n >\n {children}\n </BuyboxContext.Provider>\n )\n}\n\nexport default BuyboxProvider\n\n```"
}
] |
code_buybox-context_b785095d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/utils/shippingEstimate.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// eslint-disable-next-line no-restricted-syntax\nexport enum UnitTime {\n m = 0, // minutes\n h = 1, // hours\n d = 2, // days\n bd = 3, // business days\n}\n\nconst MINUTES = 1\nconst HOUR_IN_MINUTES = MINUTES * 60\nconst DAYS_IN_MINUTES = HOUR_IN_MINUTES * 24\nconst BUSINESS_DAYS_IN_MINUTES = DAYS_IN_MINUTES * 1.4\n\nexport const UnitTimeWeight: { [key in keyof typeof UnitTime]: number } = {\n m: MINUTES,\n h: HOUR_IN_MINUTES,\n d: DAYS_IN_MINUTES,\n bd: BUSINESS_DAYS_IN_MINUTES,\n}\n\nexport const splitShippingEstimate = (shippingEstimate: string) => {\n const timeAmount = Number(shippingEstimate.split(/\\D+/)[0])\n const unitTime = shippingEstimate.split(/[0-9]+/)[1] as keyof typeof UnitTime\n\n return { timeAmount, unitTime }\n}\n\nexport const evaluateShippingEstimate = (shippingEstimate: string) => {\n const { timeAmount, unitTime } = splitShippingEstimate(shippingEstimate)\n\n return timeAmount * UnitTimeWeight[unitTime]\n}\n\nexport const compare = (\n shippingEstimateA: string,\n shippingEstimateB: string\n) => {\n const { timeAmount: timeAmountA, unitTime: unitTimeA } =\n splitShippingEstimate(shippingEstimateA)\n\n const { timeAmount: timeAmountB, unitTime: unitTimeB } =\n splitShippingEstimate(shippingEstimateB)\n\n if (unitTimeA !== unitTimeB) {\n return UnitTime[unitTimeA] - UnitTime[unitTimeB]\n }\n\n if (timeAmountA !== timeAmountB) {\n return timeAmountA - timeAmountB\n }\n\n return 0\n}\n\n```"
}
] |
code_buybox-context_adb3f6ed
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/utils/sortSellers.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Parser } from 'expr-eval'\n\nimport type {\n LogisticsInfo,\n Seller,\n SellerLogisticsInfoResult,\n} from '../typings/types'\nimport { compare, evaluateShippingEstimate } from './shippingEstimate'\n\nexport const sortSellersByPrice = (\n sellersInfo: SellerLogisticsInfoResult[]\n) => {\n if (!sellersInfo) return []\n\n const sortedList = [...sellersInfo]\n\n sortedList.sort(\n (sellerA, sellerB) =>\n Number(sellerA.seller.commertialOffer.Price) -\n Number(sellerB.seller.commertialOffer.Price)\n )\n\n return sortedList\n}\n\nexport const sortSellersByPriceShipping = (\n sellersInfo: SellerLogisticsInfoResult[]\n) => {\n if (!sellersInfo) return []\n\n const sortedList = [...sellersInfo]\n\n sortedList.sort((sellerA, sellerB) => {\n if (!sellerA.logisticsInfo?.slas?.length) {\n return 1\n }\n\n if (!sellerB.logisticsInfo?.slas?.length) {\n return -1\n }\n\n const shippingPriceA = sellerA.logisticsInfo?.slas?.length\n ? sellerA.logisticsInfo.slas[0].price / 100\n : 0\n\n const shippingPriceB = sellerB.logisticsInfo?.slas?.length\n ? sellerB.logisticsInfo.slas[0].price / 100\n : 0\n\n return (\n Number(sellerA.seller.commertialOffer.Price + shippingPriceA) -\n Number(sellerB.seller.commertialOffer.Price + shippingPriceB)\n )\n })\n\n return sortedList\n}\n\ntype ExpressionVariablesType =\n | 'productPrice'\n | 'productSpotPrice'\n | 'productAvailableQuantity'\n | 'minShippingPrice'\n | 'maxShippingPrice'\n | 'minShippingEstimate'\n | 'maxShippingEstimate'\n\ntype ExpressionVariablesDictionaryType = {\n [key in ExpressionVariablesType]?: (\n seller: Seller,\n logisticsInfo?: LogisticsInfo\n ) => number | string | undefined\n}\n\ntype LogisticsInfoSLA = LogisticsInfo['slas']\n\n// alternative functions to sort SLA's before sort sellers\nconst sortSLAByField = {\n minPrice: (slas: LogisticsInfoSLA) =>\n slas.sort((slaA, slaB) => Number(slaA.price) - Number(slaB.price)),\n maxPrice: (slas: LogisticsInfoSLA) =>\n slas.sort((slaA, slaB) => Number(slaB.price) - Number(slaA.price)),\n minShippingEstimate: (slas: LogisticsInfoSLA) =>\n slas?.sort((slaA, slaB) =>\n compare(slaA.shippingEstimate, slaB.shippingEstimate)\n ),\n maxShippingEstimate: (slas: LogisticsInfoSLA) =>\n slas?.sort((slaB, slaA) =>\n compare(slaA.shippingEstimate, slaB.shippingEstimate)\n ),\n}\n\n// functions used to get expression values based on ExpressionVariablesType inputed by user\nconst expressionVariables: ExpressionVariablesDictionaryType = {\n productPrice: (seller: Seller, _logisticsInfo?: LogisticsInfo) =>\n seller.commertialOffer.Price,\n productSpotPrice: (seller: Seller, _logisticsInfo?: LogisticsInfo) =>\n seller.commertialOffer.spotPrice,\n productAvailableQuantity: (seller: Seller, _logisticsInfo?: LogisticsInfo) =>\n seller.commertialOffer.AvailableQuantity,\n minShippingPrice: (_seller: Seller, logisticsInfo?: LogisticsInfo) =>\n logisticsInfo?.slas[0]?.price !== undefined\n ? sortSLAByField.minPrice(logisticsInfo?.slas)[0]?.price / 100\n : undefined,\n maxShippingPrice: (_seller: Seller, logisticsInfo?: LogisticsInfo) =>\n logisticsInfo?.slas[0]?.price !== undefined\n ? sortSLAByField.maxPrice(logisticsInfo?.slas)[0]?.price / 100\n : undefined,\n minShippingEstimate: (_seller: Seller, logisticsInfo?: LogisticsInfo) => {\n const shippingEstimate =\n logisticsInfo &&\n sortSLAByField.minShippingEstimate(logisticsInfo.slas)[0]\n ?.shippingEstimate\n\n if (shippingEstimate) {\n return evaluateShippingEstimate(shippingEstimate)\n }\n\n return undefined\n },\n maxShippingEstimate: (_seller: Seller, logisticsInfo?: LogisticsInfo) => {\n const shippingEstimate =\n logisticsInfo &&\n sortSLAByField.maxShippingEstimate(logisticsInfo.slas)[0]\n ?.shippingEstimate\n\n if (shippingEstimate) {\n return evaluateShippingEstimate(shippingEstimate)\n }\n\n return undefined\n },\n}\n\nexport const sortSellersByCustomExpression = (\n sellersInfo: SellerLogisticsInfoResult[],\n expression?: string\n) => {\n if (!sellersInfo) return []\n\n if (!expression) return sellersInfo\n\n const logisticInfoVariables: ExpressionVariablesType[] = [\n 'minShippingPrice',\n 'maxShippingPrice',\n 'minShippingEstimate',\n 'maxShippingEstimate',\n ]\n\n const sortedList = [...sellersInfo]\n\n const variables = Object.keys(expressionVariables)\n .filter((e) => expression.includes(e))\n .reduce((accumulator: ExpressionVariablesDictionaryType, key) => {\n return {\n ...accumulator,\n [key]: expressionVariables[key as ExpressionVariablesType],\n }\n }, {})\n\n try {\n sortedList.sort((sellerA, sellerB) => {\n // set the sellers without SLA calculated to end of the array\n if (logisticInfoVariables.some((info) => expression.includes(info))) {\n if (!sellerA.logisticsInfo?.slas?.length) {\n return 1\n }\n\n if (!sellerB.logisticsInfo?.slas?.length) {\n return -1\n }\n }\n\n const { valuesSellerA, valuesSellerB } = Object.keys(variables).reduce(\n (\n accumulator: {\n valuesSellerA: {\n [key in ExpressionVariablesType]?: any\n }\n valuesSellerB: {\n [key in ExpressionVariablesType]?: any\n }\n },\n key: string\n ) => {\n const exec = expressionVariables[key as ExpressionVariablesType]\n\n const valueA = exec?.(sellerA.seller, sellerA.logisticsInfo)\n const valueB = exec?.(sellerB.seller, sellerB.logisticsInfo)\n\n return {\n valuesSellerA: { ...accumulator.valuesSellerA, [key]: valueA ?? 0 },\n valuesSellerB: { ...accumulator.valuesSellerB, [key]: valueB ?? 0 },\n }\n },\n { valuesSellerA: {}, valuesSellerB: {} }\n )\n\n const parser = new Parser()\n const expr = parser.parse(expression)\n\n const resultA = expr.evaluate({\n ...valuesSellerA,\n })\n\n const resultB = expr.evaluate({\n ...valuesSellerB,\n })\n\n return resultA - resultB\n })\n } catch (error) {\n console.error('Invalid variable on expression: ', error.message)\n\n return sellersInfo\n }\n\n return sortedList\n}\n\n```"
}
] |
code_buybox-context_fc34fc6f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/utils/messages.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { MessageDescriptor } from 'react-intl'\nimport { defineMessages } from 'react-intl'\n\nexport const messages: {\n [name: string]: MessageDescriptor\n} = defineMessages({\n title: {\n id: 'store/buybox-context.title',\n },\n sortStrategyTitle: {\n id: 'store/buybox-context.sortStrategy-title',\n },\n sortStrategyDescription: {\n id: 'store/buybox-context.sortStrategy-description',\n },\n triggerCepChangeEventTitle: {\n id: 'store/buybox-context.triggerCepChangeEvent-title',\n },\n triggerCepChangeEventDescription: {\n id: 'store/buybox-context.triggerCepChangeEvent-description',\n },\n expressionTitle: {\n id: 'store/buybox-context.expression-title',\n },\n expressionDescription: {\n id: 'store/buybox-context.expression-description',\n },\n protocolError: {\n id: 'store/buybox-context.protocol-error',\n },\n})\n\n```"
}
] |
code_buybox-context_a564e527
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/utils/index.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Seller } from '../typings/types'\n\nexport const isAvailableSeller = (seller: Seller) => {\n return seller.commertialOffer.AvailableQuantity > 0\n}\n\nexport const getAvailableSellers = (sellers: Seller[] | undefined) => {\n if (!sellers) return []\n\n return sellers.filter(isAvailableSeller)\n}\n\n```"
}
] |
code_buybox-context_98cfb5fa
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/components/ProductWithSortedSellers.tsx from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\nimport { ProductContextProvider, useProduct } from 'vtex.product-context'\n\nimport { useNewProductWithSellers } from '../hooks/useNewProductWithSellers'\nimport { useBuyBoxContext } from '../context/BuyboxContext'\n\nexport const ProductWithSortedSellers: FC = ({ children }) => {\n const productContext = useProduct() ?? {}\n const { sortedSellers } = useBuyBoxContext()\n\n const newProduct = useNewProductWithSellers({\n productContext,\n sellers: sortedSellers,\n })\n\n return (\n <ProductContextProvider\n query={{ skuId: productContext.selectedItem?.itemId }}\n product={newProduct}\n >\n {children}\n </ProductContextProvider>\n )\n}\n\n```"
}
] |
code_buybox-context_ce34666c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/BuyboxContext.test.tsx from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\n\nimport BuyboxApp from '../BuyboxApp'\n\ntest('BuyboxContext rendered', () => {\n const { container } = render(<BuyboxApp />)\n\n expect(container).toBeTruthy()\n})\n\n```"
}
] |
code_buybox-context_6c18885e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/graphql/SimulateShipping.gql from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery SimulateShipping(\n $shippingItems: [ShippingItem]\n $postalCode: String\n $country: String\n) {\n shipping(items: $shippingItems, postalCode: $postalCode, country: $country)\n @context(provider: \"vtex.store-graphql\") {\n logisticsInfo {\n itemIndex\n slas {\n id\n name\n price\n }\n }\n }\n}\n\n```"
}
] |
code_buybox-context_13936123
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/graphql/SortSellersProtocol.gql from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery SortSellersProtocol(\n $skuId: ID!\n $postalCode: String\n $country: String\n $salesChannel: Int\n) {\n sortSellers(\n skuId: $skuId\n postalCode: $postalCode\n country: $country\n salesChannel: $salesChannel\n ) @context(provider: \"vtex.buybox-graphql\") {\n sellers\n }\n}\n\n```"
}
] |
code_buybox-context_9722ab72
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/hooks/useSellersByProtocol.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useQuery } from 'react-apollo'\nimport { useProduct } from 'vtex.product-context'\nimport { OrderForm } from 'vtex.order-manager'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport SortSellersProtocol from '../graphql/SortSellersProtocol.gql'\nimport type { SellerLogisticsInfoResult } from '../typings/types'\n\ninterface SortedSellersProtocol {\n sortSellers: {\n sellers: string[]\n }\n}\n\ninterface SortedSellersProtocolVariables {\n skuId: string\n postalCode?: string\n country?: string\n salesChannel?: number\n}\n\nexport const useSellersByProtocol = (\n sellersInfo: SellerLogisticsInfoResult[]\n) => {\n const { selectedItem } = useProduct() ?? {}\n const orderFormContext = OrderForm?.useOrderForm() ?? {}\n\n const runtime = useRuntime()\n const {\n culture: { country },\n } = runtime\n\n const { data, loading, error } = useQuery<\n SortedSellersProtocol,\n SortedSellersProtocolVariables\n >(SortSellersProtocol, {\n variables: {\n skuId: selectedItem?.itemId ?? '',\n country,\n postalCode:\n orderFormContext.orderForm?.shipping?.selectedAddress?.postalCode ?? '',\n },\n ssr: false,\n })\n\n if (error) throw error\n\n if (!sellersInfo.length || !data?.sortSellers?.sellers || loading) {\n return []\n }\n\n const sellersInfoIndex = sellersInfo.reduce(\n (acummulator, currentValue) => {\n acummulator[currentValue.seller.sellerId] = currentValue\n\n return acummulator\n },\n {} as {\n [key in string]: SellerLogisticsInfoResult\n }\n )\n\n return data.sortSellers.sellers.reduce((acummulator, sellerId) => {\n if (sellersInfoIndex[sellerId]) {\n acummulator.push(sellersInfoIndex[sellerId])\n }\n\n return acummulator\n }, [] as SellerLogisticsInfoResult[])\n}\n\n```"
}
] |
code_buybox-context_d1343755
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/hooks/useReduceSellerLogisticsInfo.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type {\n LogisticsInfo,\n Seller,\n SellerLogisticsInfoResult,\n} from '../typings/types'\n\ninterface ReducerAcumulator {\n sellers: Seller[]\n logisticsInfo: LogisticsInfo[]\n}\n\ninterface Props {\n sellerLogisticsInfo: SellerLogisticsInfoResult[]\n}\n\nexport const useReduceSellerLogisticsInfo = ({\n sellerLogisticsInfo,\n}: Props): ReducerAcumulator => {\n const initialValue = {\n sellers: [],\n logisticsInfo: [],\n }\n\n if (!sellerLogisticsInfo) {\n return initialValue\n }\n\n const reducer = (\n acumulator: ReducerAcumulator,\n currentValue: SellerLogisticsInfoResult,\n index: number\n ) => {\n // set the buybox winner seller as default seller\n currentValue.seller.sellerDefault = index === 0\n\n acumulator.sellers.push(currentValue.seller)\n currentValue.logisticsInfo &&\n acumulator.logisticsInfo.push(currentValue.logisticsInfo)\n\n return acumulator\n }\n\n return sellerLogisticsInfo.reduce(reducer, {\n sellers: [],\n logisticsInfo: [],\n })\n}\n\n```"
}
] |
code_buybox-context_fd5df93f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/hooks/useSellerLoginstcsInfoSellerSelector.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useMemo } from 'react'\nimport { useProduct } from 'vtex.product-context'\nimport { SellerContext } from 'vtex.seller-selector'\n\nimport type { LogisticsInfo, SellerLogisticsInfoResult } from '../typings/types'\nimport { isAvailableSeller } from '../utils'\n\nexport const useSellerLoginstcsInfoSellerSelector =\n (): SellerLogisticsInfoResult[] => {\n const { selectedItem } = useProduct() ?? {}\n\n const { shippingQuotes } = SellerContext.useSellerContext()\n\n const logisticsInfo = useMemo(\n () =>\n shippingQuotes?.logisticsInfo.reduce((acummulator, currentValue) => {\n acummulator[currentValue.itemIndex] = currentValue\n\n return acummulator\n }, {} as { [key in string]: LogisticsInfo }),\n [shippingQuotes?.logisticsInfo]\n )\n\n return selectedItem\n ? selectedItem.sellers.reduce((accumulator, seller, index) => {\n if (isAvailableSeller(seller)) {\n accumulator.push({\n seller,\n logisticsInfo: logisticsInfo ? logisticsInfo[index] : undefined,\n })\n }\n\n return accumulator\n }, [] as SellerLogisticsInfoResult[])\n : []\n }\n\n```"
}
] |
code_buybox-context_a830d27d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/hooks/useReduceProduct.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useCallback } from 'react'\nimport type {\n Item,\n ProductContextState,\n} from 'vtex.product-context/react/ProductTypes'\n\ninterface ReducerInterface {\n productItemsWithoutSelected: Item[]\n productSelectedItem: Item | undefined\n}\n\nexport const useReduceProduct = (\n productContext: Partial<ProductContextState>\n): ReducerInterface => {\n const initialValue: ReducerInterface = {\n productItemsWithoutSelected: [],\n productSelectedItem: undefined,\n }\n\n const reducer = useCallback(\n (acumulator: ReducerInterface, currentValue: Item) => {\n if (currentValue.itemId === productContext.selectedItem?.itemId) {\n acumulator.productSelectedItem = { ...currentValue }\n } else {\n acumulator.productItemsWithoutSelected?.push({ ...currentValue })\n }\n\n return acumulator\n },\n [productContext.selectedItem?.itemId]\n )\n\n if (!productContext.product) {\n return { ...initialValue }\n }\n\n return productContext.product.items.reduce(reducer, { ...initialValue })\n}\n\n```"
}
] |
code_buybox-context_ba023875
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/hooks/useNewProductWithSellers.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useMemo } from 'react'\nimport type {\n MaybeProduct,\n ProductContextState,\n} from 'vtex.product-context/react/ProductTypes'\n\nimport type { Seller } from '../typings/types'\nimport { useReduceProduct } from './useReduceProduct'\n\ninterface Props {\n productContext: Partial<ProductContextState>\n sellers: Seller[]\n}\n\nexport const useNewProductWithSellers = ({\n productContext,\n sellers,\n}: Props): MaybeProduct => {\n const { productSelectedItem, productItemsWithoutSelected } =\n useReduceProduct(productContext)\n\n const productWithSortedSellers = useMemo<MaybeProduct>(() => {\n if (\n productContext.product &&\n productSelectedItem &&\n productItemsWithoutSelected\n ) {\n return {\n ...productContext.product,\n items: [\n ...productItemsWithoutSelected,\n { ...productSelectedItem, sellers: [...sellers] },\n ],\n }\n }\n\n return undefined\n }, [\n productContext.product,\n productSelectedItem,\n productItemsWithoutSelected,\n sellers,\n ])\n\n const newProduct = useMemo(() => {\n return productWithSortedSellers ?? productContext.product\n }, [productContext.product, productWithSortedSellers])\n\n return newProduct\n}\n\n```"
}
] |
code_buybox-context_c167ec2c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/hooks/useSellerLogisticsInfo.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { ShippingQuote } from 'vtex.seller-selector/react/SellerContext'\nimport { useLazyQuery } from 'react-apollo'\nimport { useRuntime } from 'vtex.render-runtime'\nimport { useEffect, useMemo } from 'react'\nimport { OrderForm } from 'vtex.order-manager'\nimport { useProduct } from 'vtex.product-context'\n\nimport SimulateShippingQuery from '../graphql/SimulateShipping.gql'\nimport type { LogisticsInfo, SellerLogisticsInfoResult } from '../typings/types'\nimport { getAvailableSellers } from '../utils'\n\nexport const useSellerLogisticsInfo = (): SellerLogisticsInfoResult[] => {\n const { selectedItem, selectedQuantity } = useProduct() ?? {}\n const orderFormContext = OrderForm?.useOrderForm() ?? {}\n\n const [updateShippingQuotes, { data: shippingData, error }] = useLazyQuery<{\n shipping: ShippingQuote\n }>(SimulateShippingQuery)\n\n const availableSellers = useMemo(\n () => getAvailableSellers(selectedItem?.sellers),\n [selectedItem]\n )\n\n const shippingItems = useMemo(\n () =>\n availableSellers.map((current) => ({\n id: selectedItem?.itemId,\n quantity: selectedQuantity?.toString() ?? '1',\n seller: current.sellerId,\n })),\n [selectedItem?.itemId, availableSellers, selectedQuantity]\n )\n\n const runtime = useRuntime()\n const {\n culture: { country },\n } = runtime\n\n const variables = useMemo(() => {\n return {\n shippingItems,\n country,\n postalCode:\n orderFormContext.orderForm?.shipping?.selectedAddress?.postalCode ?? '',\n }\n }, [\n country,\n orderFormContext.orderForm?.shipping?.selectedAddress?.postalCode,\n shippingItems,\n ])\n\n const logisticsInfo = useMemo(\n () =>\n shippingData?.shipping.logisticsInfo?.reduce(\n (acummulator, currentValue) => {\n acummulator[currentValue.itemIndex] = currentValue\n\n return acummulator\n },\n {} as { [key in string]: LogisticsInfo }\n ),\n [shippingData?.shipping.logisticsInfo]\n )\n\n useEffect(() => {\n updateShippingQuotes({ variables: { ...variables } })\n }, [updateShippingQuotes, variables])\n\n if (availableSellers && logisticsInfo) {\n return availableSellers.map((seller, index) => {\n return {\n seller,\n logisticsInfo: logisticsInfo[index],\n }\n })\n }\n\n if (availableSellers && error) {\n return availableSellers.map((seller) => {\n return {\n seller,\n logisticsInfo: undefined,\n }\n })\n }\n\n return []\n}\n\n```"
}
] |
code_buybox-context_2eefbbc2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/utils/index.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { getAvailableSellers } from '../../utils'\n\ndescribe('getAvailableSellers', () => {\n const sellers = [\n {\n sellerId: '1',\n sellerName: 'SELLER NAME 1',\n sellerDefault: false,\n addToCartLink: '',\n commertialOffer: {\n discountHighlights: [],\n teasers: [],\n Price: 280.5,\n ListPrice: 280.5,\n Tax: 0,\n taxPercentage: 0,\n spotPrice: 280.5,\n PriceWithoutDiscount: 280.5,\n RewardValue: 0,\n PriceValidUntil: '2022-08-25T13:35:42Z',\n AvailableQuantity: 6000,\n CacheVersionUsedToCallCheckout: 'B2D78F230C87C13044F23B4A0F4BA986_',\n Installments: [],\n },\n },\n {\n sellerId: '2',\n sellerName: 'SELLER NAME 2',\n sellerDefault: true,\n addToCartLink: '',\n commertialOffer: {\n discountHighlights: [],\n teasers: [],\n Price: 100,\n ListPrice: 100,\n Tax: 0,\n taxPercentage: 0,\n spotPrice: 100,\n PriceWithoutDiscount: 100,\n RewardValue: 0,\n PriceValidUntil: '2022-08-25T13:35:41Z',\n AvailableQuantity: 0,\n CacheVersionUsedToCallCheckout: 'B2D78F230C87C13044F23B4A0F4BA986_',\n Installments: [],\n },\n },\n {\n sellerId: '3',\n sellerName: 'SELLER NAME 3',\n sellerDefault: false,\n addToCartLink: '',\n commertialOffer: {\n discountHighlights: [],\n teasers: [],\n Price: 1,\n ListPrice: 1,\n Tax: 0,\n taxPercentage: 0,\n spotPrice: 1,\n PriceWithoutDiscount: 1,\n RewardValue: 0,\n PriceValidUntil: '2022-08-25T13:35:42Z',\n AvailableQuantity: 6000,\n CacheVersionUsedToCallCheckout: 'B2D78F230C87C13044F23B4A0F4BA986_',\n Installments: [],\n },\n },\n {\n sellerId: '4',\n sellerName: 'SELLER NAME 4',\n sellerDefault: true,\n addToCartLink: '',\n commertialOffer: {\n discountHighlights: [],\n teasers: [],\n Price: 25,\n ListPrice: 25,\n Tax: 0,\n taxPercentage: 0,\n spotPrice: 25,\n PriceWithoutDiscount: 25,\n RewardValue: 0,\n PriceValidUntil: '2022-08-25T13:35:41Z',\n AvailableQuantity: 992,\n CacheVersionUsedToCallCheckout: 'B2D78F230C87C13044F23B4A0F4BA986_',\n Installments: [],\n },\n },\n {\n sellerId: '5',\n sellerName: 'SELLER NAME 5',\n sellerDefault: false,\n addToCartLink: '',\n commertialOffer: {\n discountHighlights: [],\n teasers: [],\n Price: 15,\n ListPrice: 15,\n Tax: 0,\n taxPercentage: 0,\n spotPrice: 15,\n PriceWithoutDiscount: 15,\n RewardValue: 0,\n PriceValidUntil: '2022-08-25T13:35:42Z',\n AvailableQuantity: 0,\n CacheVersionUsedToCallCheckout: 'B2D78F230C87C13044F23B4A0F4BA986_',\n Installments: [],\n },\n },\n {\n sellerId: '6',\n sellerName: 'SELLER NAME 6',\n sellerDefault: true,\n addToCartLink: '',\n commertialOffer: {\n discountHighlights: [],\n teasers: [],\n Price: 80,\n ListPrice: 80,\n Tax: 0,\n taxPercentage: 0,\n spotPrice: 80,\n PriceWithoutDiscount: 80,\n RewardValue: 0,\n PriceValidUntil: '2022-08-25T13:35:41Z',\n AvailableQuantity: 0,\n CacheVersionUsedToCallCheckout: 'B2D78F230C87C13044F23B4A0F4BA986_',\n Installments: [],\n },\n },\n ]\n\n it('should return an array with available sellers', () => {\n // act\n const availableSellers = getAvailableSellers(sellers)\n\n // assert\n expect(\n availableSellers.map((seller) => seller.commertialOffer.AvailableQuantity)\n ).toBeTruthy()\n })\n\n it('should return an empty array', () => {\n // act\n const availableSellers = getAvailableSellers(undefined)\n\n // assert\n expect(availableSellers).toStrictEqual([])\n })\n\n it('should return an empty array when all sellers are unavailable', () => {\n // arrange\n const unavailables = sellers.filter(\n (seller) => seller.commertialOffer.AvailableQuantity === 0\n )\n\n // act\n const availableSellers = getAvailableSellers(unavailables)\n\n // assert\n expect(availableSellers).toStrictEqual([])\n })\n})\n\n```"
}
] |
code_buybox-context_3afab3fd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/utils/sortSellers.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { SellerLogisticsInfoResult } from '../../typings/types'\nimport {\n sortSellersByCustomExpression,\n sortSellersByPrice,\n sortSellersByPriceShipping,\n} from '../../utils/sortSellers'\n// eslint-disable-next-line jest/no-mocks-import\nimport {\n unsortedSellersMock,\n unsortedSellersShippingMock,\n sortedSellerLogisticsInfoMock,\n unsortedSellerLogisticsInfoMock,\n} from '../../__mocks__/sellers'\n\ndescribe('sortSellersByPrice', () => {\n it('should sort sellers correctly', () => {\n // arrange\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller3,\n seller5,\n seller4,\n seller6,\n seller2,\n seller1,\n ]\n\n const unsortedSellers: SellerLogisticsInfoResult[] = unsortedSellersMock\n\n // act\n const sortedSellers = sortSellersByPrice(unsortedSellers)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should mantain sellers sort', () => {\n // arrange\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller3,\n seller5,\n seller4,\n seller6,\n seller2,\n seller1,\n ]\n\n const sellers: SellerLogisticsInfoResult[] = [...expected]\n\n // act\n const sortedSellers = sortSellersByPrice(sellers)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should return a array empty', () => {\n // arrange\n const expected: SellerLogisticsInfoResult[] = []\n const unsortedSellers: SellerLogisticsInfoResult[] = []\n\n // act\n const sortedSellers = sortSellersByPrice(unsortedSellers)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n})\n\ndescribe('sortSellersByPriceShipping', () => {\n it('should sort sellers correctly', () => {\n // arrange\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller5,\n seller6,\n seller2,\n seller1,\n seller3,\n seller4,\n ]\n\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByPriceShipping(unsortedSellers)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should mantain sellers sort', () => {\n // arrange\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller5,\n seller6,\n seller2,\n seller1,\n seller3,\n seller4,\n ]\n\n const sellers: SellerLogisticsInfoResult[] = [...expected]\n\n // act\n const sortedSellers = sortSellersByPriceShipping(sellers)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should set seller to last position when have not SLA', () => {\n // arrange\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const hasSLA: SellerLogisticsInfoResult[] = [\n seller5,\n seller6,\n seller2,\n seller1,\n ]\n\n const hasNotSLA: SellerLogisticsInfoResult[] = [seller3, seller4]\n\n // act\n const sortedSellers = sortSellersByPriceShipping(\n unsortedSellersShippingMock\n )\n\n // assert\n const SLAs = sortedSellers.filter(\n (seller) => seller.logisticsInfo?.slas.length\n )\n\n expect(SLAs).toStrictEqual(hasSLA)\n expect(sortedSellers.splice(SLAs.length)).toStrictEqual(hasNotSLA)\n })\n\n it('should return a array empty', () => {\n // arrange\n const expected: SellerLogisticsInfoResult[] = []\n const unsortedSellers: SellerLogisticsInfoResult[] = []\n\n // act\n const sortedSellers = sortSellersByPrice(unsortedSellers)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n})\n\ndescribe('sortSellersByCustomExpression', () => {\n it('should sort sellers correctly with expression productPrice + minShippingPrice', () => {\n // arrange\n const expression = 'productPrice + minShippingPrice'\n\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller5,\n seller6,\n seller2,\n seller1,\n seller3,\n seller4,\n ]\n\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellers,\n expression\n )\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should sort sellers correctly with expression productPrice + maxShippingPrice', () => {\n // arrange\n const expression = 'productPrice + maxShippingPrice'\n\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller6,\n seller5,\n seller2,\n seller1,\n seller3,\n seller4,\n ]\n\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellers,\n expression\n )\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should sort sellers correctly with expression productSpotPrice + minShippingPrice', () => {\n // arrange\n const expression = 'productSpotPrice + minShippingPrice'\n\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller5,\n seller6,\n seller2,\n seller1,\n seller3,\n seller4,\n ]\n\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellers,\n expression\n )\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should sort sellers correctly with expression productAvailableQuantity < 1000', () => {\n // arrange\n const expression = 'productAvailableQuantity < 1000'\n\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller1,\n seller3,\n seller5,\n seller2,\n seller4,\n seller6,\n ]\n\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellers,\n expression\n )\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should sort sellers correctly with expression minShippingEstimate', () => {\n // arrange\n const expression = 'minShippingEstimate'\n\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller6,\n seller5,\n seller2,\n seller1,\n seller3,\n seller4,\n ]\n\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellers,\n expression\n )\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should sort sellers correctly with expression maxShippingEstimate', () => {\n // arrange\n const expression = 'maxShippingEstimate'\n\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller5,\n seller2,\n seller1,\n seller6,\n seller3,\n seller4,\n ]\n\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellers,\n expression\n )\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should mantain sellers sort', () => {\n // arrange\n const expression = 'productPrice + minShippingPrice'\n\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const expected: SellerLogisticsInfoResult[] = [\n seller5,\n seller6,\n seller2,\n seller1,\n seller3,\n seller4,\n ]\n\n const sellers: SellerLogisticsInfoResult[] = [...expected]\n\n // act\n const sortedSellers = sortSellersByCustomExpression(sellers, expression)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should set seller to last position when have not SLA', () => {\n // arrange\n const expression = 'productPrice + minShippingPrice'\n\n const [seller1, seller2, seller3, seller4, seller5, seller6] =\n unsortedSellersShippingMock\n\n const hasSLA: SellerLogisticsInfoResult[] = [\n seller5,\n seller6,\n seller2,\n seller1,\n ]\n\n const hasNotSLA: SellerLogisticsInfoResult[] = [seller3, seller4]\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellersShippingMock,\n expression\n )\n\n // assert\n const SLAs = sortedSellers.filter(\n (seller) => seller.logisticsInfo?.slas.length\n )\n\n expect(SLAs).toStrictEqual(hasSLA)\n expect(sortedSellers.splice(SLAs.length)).toStrictEqual(hasNotSLA)\n })\n\n it('should return a array empty', () => {\n // arrange\n const expected: SellerLogisticsInfoResult[] = []\n const unsortedSellers: SellerLogisticsInfoResult[] = []\n\n // act\n const sortedSellers = sortSellersByCustomExpression(unsortedSellers)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should return a same array unsorted when expression is empty', () => {\n // arrange\n const expected: SellerLogisticsInfoResult[] = unsortedSellersShippingMock\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByCustomExpression(unsortedSellers)\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n })\n\n it('should return a same array unsorted when expression is wrong', () => {\n // arrange\n const expression = 'wrongWord1 + wrongWord2'\n\n jest.spyOn(console, 'error').mockImplementation()\n\n const expected: SellerLogisticsInfoResult[] = unsortedSellersShippingMock\n const unsortedSellers: SellerLogisticsInfoResult[] =\n unsortedSellersShippingMock\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellers,\n expression\n )\n\n // assert\n expect(sortedSellers).toStrictEqual(expected)\n expect(console.error).toBeCalledTimes(1)\n })\n\n it('should sort by SLA correctly when the price is of SLA is 0.00 and shipping estimate is bigger', () => {\n // arrange\n const expression = 'minShippingEstimate * 100000 + maxShippingPrice'\n\n // act\n const sortedSellers = sortSellersByCustomExpression(\n unsortedSellerLogisticsInfoMock,\n expression\n )\n\n // assert\n const SLAs = sortedSellers\n .filter((seller) => seller.logisticsInfo?.slas.length)\n .map((sla, index) => {\n return {\n ...sla,\n seller: {\n ...sla.seller,\n sellerDefault: index === 0,\n },\n }\n })\n\n expect(SLAs).toEqual(sortedSellerLogisticsInfoMock)\n })\n})\n\n```"
}
] |
code_buybox-context_2981ec75
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/utils/shippingEstimate.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport {\n compare,\n evaluateShippingEstimate,\n splitShippingEstimate,\n UnitTime,\n UnitTimeWeight,\n} from '../../utils/shippingEstimate'\n\ndescribe('evaluateShippingEstimate', () => {\n it('should be return business days weight correctly', () => {\n // arrange\n const shippingEstimate = '8bd'\n\n // act\n const result = evaluateShippingEstimate(shippingEstimate)\n\n // assert\n expect(result).toEqual(8 * UnitTimeWeight.bd)\n })\n it('should be return days weight correctly', () => {\n // arrange\n const shippingEstimate = '1d'\n\n // act\n const result = evaluateShippingEstimate(shippingEstimate)\n\n // assert\n expect(result).toEqual(1 * UnitTimeWeight.d)\n })\n it('should be return hours weight correctly', () => {\n // arrange\n const shippingEstimate = '2h'\n\n // act\n const result = evaluateShippingEstimate(shippingEstimate)\n\n // assert\n expect(result).toEqual(2 * UnitTimeWeight.h)\n })\n it('should be return minutes weight correctly', () => {\n // arrange\n const shippingEstimate = '30m'\n\n // act\n const result = evaluateShippingEstimate(shippingEstimate)\n\n // assert\n expect(result).toEqual(30 * UnitTimeWeight.m)\n })\n})\n\ndescribe('splitShippingEstimate', () => {\n it('should be return business days correctly', () => {\n // arrange\n const shippingEstimate = '8bd'\n\n // act\n const { timeAmount, unitTime } = splitShippingEstimate(shippingEstimate)\n\n // assert\n expect(timeAmount).toEqual(8)\n expect(UnitTime[unitTime]).toEqual(UnitTime.bd)\n })\n\n it('should be return days correctly', () => {\n // arrange\n const shippingEstimate = '1d'\n\n // act\n const { timeAmount, unitTime } = splitShippingEstimate(shippingEstimate)\n\n // assert\n expect(timeAmount).toEqual(1)\n expect(UnitTime[unitTime]).toEqual(UnitTime.d)\n })\n\n it('should be return hours correctly', () => {\n // arrange\n const shippingEstimate = '2h'\n\n // act\n const { timeAmount, unitTime } = splitShippingEstimate(shippingEstimate)\n\n // assert\n expect(timeAmount).toEqual(2)\n expect(UnitTime[unitTime]).toEqual(UnitTime.h)\n })\n it('should be return minutes correctly', () => {\n // arrange\n const shippingEstimate = '30m'\n\n // act\n const { timeAmount, unitTime } = splitShippingEstimate(shippingEstimate)\n\n // assert\n expect(timeAmount).toEqual(30)\n expect(UnitTime[unitTime]).toEqual(UnitTime.m)\n })\n})\n\ndescribe('compare', () => {\n it('should be return 1 when the first value is greater', () => {\n // arrange\n const shippingEstimateA = '8bd'\n const shippingEstimateB = '7bd'\n\n // act\n const result = compare(shippingEstimateA, shippingEstimateB)\n\n // assert\n expect(result).toEqual(1)\n })\n\n it('should be return -1 when the first value is smaller', () => {\n // arrange\n const shippingEstimateA = '7bd'\n const shippingEstimateB = '8bd'\n\n // act\n const result = compare(shippingEstimateA, shippingEstimateB)\n\n // assert\n expect(result).toEqual(-1)\n })\n it('should be return 0 when two vales are equal', () => {\n // arrange\n const shippingEstimateA = '8bd'\n const shippingEstimateB = '8bd'\n\n // act\n const result = compare(shippingEstimateA, shippingEstimateB)\n\n // assert\n expect(result).toEqual(0)\n })\n\n it('should be return 1 when the first value is a work day', () => {\n // arrange\n const shippingEstimateA = '1bd'\n const shippingEstimateB = '1d'\n\n // act\n const result = compare(shippingEstimateA, shippingEstimateB)\n\n // assert\n expect(result).toEqual(1)\n })\n it('should be return 1 when the first value is a day', () => {\n // arrange\n const shippingEstimateA = '1d'\n const shippingEstimateB = '1h'\n\n // act\n const result = compare(shippingEstimateA, shippingEstimateB)\n\n // assert\n expect(result).toEqual(1)\n })\n it('should be return 1 when the first value is a hour', () => {\n // arrange\n const shippingEstimateA = '1h'\n const shippingEstimateB = '1m'\n\n // act\n const result = compare(shippingEstimateA, shippingEstimateB)\n\n // assert\n expect(result).toEqual(1)\n })\n})\n\n```"
}
] |
code_buybox-context_21755637
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/hooks/useReduceSellerLogisticsInfo.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { renderHook } from '@vtex/test-tools/react'\n\nimport { useReduceSellerLogisticsInfo } from '../../hooks/useReduceSellerLogisticsInfo'\nimport type { SellerLogisticsInfoResult } from '../../typings/types'\n// eslint-disable-next-line jest/no-mocks-import\nimport { unsortedSellersMock } from '../../__mocks__/sellers'\n\ndescribe('useReduceSellerLogisticsInfo', () => {\n it('should return sellers and logistics info correctly', async () => {\n // arrange\n const sellerLogisticsInfo: SellerLogisticsInfoResult[] = unsortedSellersMock\n\n // act\n const {\n result: {\n current: { sellers, logisticsInfo },\n },\n } = renderHook(() =>\n useReduceSellerLogisticsInfo({\n sellerLogisticsInfo,\n })\n )\n\n // assert\n expect(sellerLogisticsInfo.map((s) => s.seller)).toStrictEqual(sellers)\n expect(sellerLogisticsInfo.map((s) => s.logisticsInfo)).toStrictEqual(\n logisticsInfo\n )\n })\n\n it('should return first seller as default', async () => {\n // arrange\n const sellerLogisticsInfo: SellerLogisticsInfoResult[] = unsortedSellersMock\n\n // act\n const {\n result: {\n current: { sellers },\n },\n } = renderHook(() =>\n useReduceSellerLogisticsInfo({\n sellerLogisticsInfo,\n })\n )\n\n // assert\n expect(sellers[0].sellerDefault).toBeTruthy()\n expect(\n sellers.slice(1, sellers.length).some((s) => s.sellerDefault)\n ).toBeFalsy()\n })\n})\n\n```"
}
] |
code_buybox-context_bd66d7cc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/hooks/useSellerLogisticsInfo.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { renderHook } from '@vtex/test-tools/react'\nimport { OrderForm } from 'vtex.order-manager'\nimport * as productContext from 'vtex.product-context'\nimport * as reactapollo from 'react-apollo'\n\nimport { useSellerLogisticsInfo } from '../../hooks/useSellerLogisticsInfo'\n// eslint-disable-next-line jest/no-mocks-import\nimport { productContextState } from '../../__mocks__/productContext'\n\ndescribe('useNewProductWithSellers', () => {\n jest\n .spyOn(productContext, 'useProduct')\n .mockImplementation(() => productContextState)\n\n jest.spyOn(OrderForm, 'useOrderForm').mockImplementation(() => {\n return {\n orderForm: {\n shipping: {\n selectedAddress: {\n postalCode: '',\n },\n },\n },\n }\n })\n\n it('should return an empty array when logistics info does not exists', async () => {\n // arrange\n jest\n .spyOn(reactapollo, 'useLazyQuery')\n .mockImplementation()\n .mockReturnValue([\n jest.fn(),\n {\n data: { shipping: {} },\n refetch: jest.fn(),\n },\n ] as any)\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellerLogisticsInfo())\n\n // assert\n expect(sellersInfoResult).toStrictEqual([])\n })\n\n it('should return correctly when logistics info exists', async () => {\n // arrange\n const shippingData = {\n shipping: {\n logisticsInfo: [\n {\n itemIndex: '0',\n slas: [\n {\n id: 'Transportadora1',\n name: 'Transportadora1',\n price: 3520,\n },\n {\n id: 'Transportadora2',\n name: 'Transportadora2',\n price: 3520,\n },\n ],\n },\n ],\n },\n }\n\n jest\n .spyOn(reactapollo, 'useLazyQuery')\n .mockImplementation()\n .mockReturnValue([\n jest.fn(),\n {\n data: { ...shippingData },\n refetch: jest.fn(),\n },\n ] as any)\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellerLogisticsInfo())\n\n // assert\n expect(sellersInfoResult[0].seller).toStrictEqual(\n productContextState.selectedItem?.sellers[0]\n )\n expect(sellersInfoResult[0].logisticsInfo).toStrictEqual(\n shippingData.shipping.logisticsInfo[0]\n )\n expect(sellersInfoResult[1].seller).toStrictEqual(\n productContextState.selectedItem?.sellers[1]\n )\n expect(sellersInfoResult[1].logisticsInfo).toStrictEqual(\n shippingData.shipping.logisticsInfo[1]\n )\n })\n\n it('should return correctly when got error to find logistcInfo', async () => {\n // arrange\n jest\n .spyOn(reactapollo, 'useLazyQuery')\n .mockImplementation()\n .mockReturnValue([\n jest.fn(),\n {\n error: new Error(),\n refetch: jest.fn(),\n },\n ] as any)\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellerLogisticsInfo())\n\n // assert\n expect(sellersInfoResult[0].seller).toStrictEqual(\n productContextState.selectedItem?.sellers[0]\n )\n expect(sellersInfoResult[0].logisticsInfo).toBeUndefined()\n expect(sellersInfoResult[1].seller).toStrictEqual(\n productContextState.selectedItem?.sellers[1]\n )\n expect(sellersInfoResult[1].logisticsInfo).toBeUndefined()\n })\n})\n\n```"
}
] |
code_buybox-context_7bb6de33
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/hooks/useReduceProduct.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { renderHook, waitFor, cleanup } from '@vtex/test-tools/react'\n\nimport { useReduceProduct } from '../../hooks/useReduceProduct'\n// eslint-disable-next-line jest/no-mocks-import\nimport { productContextState } from '../../__mocks__/productContext'\n\ndescribe('sortSellersByPrice', () => {\n beforeEach(() => {\n cleanup()\n })\n\n it('should return items without selectedItem', async () => {\n // arrange\n const { selectedItem } = { ...productContextState }\n\n // act\n const {\n result: {\n current: { productItemsWithoutSelected },\n },\n } = renderHook(() => useReduceProduct({ ...productContextState }))\n\n // assert\n\n await waitFor(() =>\n expect(\n productItemsWithoutSelected.find(\n (item) => item.itemId === selectedItem?.itemId\n )\n ).toBeFalsy()\n )\n })\n\n it('should return selectedItem correctly', async () => {\n // arrange\n const { selectedItem } = { ...productContextState }\n\n // act\n const {\n result: {\n current: { productSelectedItem },\n },\n } = renderHook(() => useReduceProduct({ ...productContextState }))\n\n // assert\n\n await waitFor(() =>\n expect(productSelectedItem?.itemId).toBe(selectedItem?.itemId)\n )\n })\n\n it('should return selectedItem empty', async () => {\n // arrange\n const state = { ...productContextState, selectedItem: undefined }\n\n // act\n const {\n result: {\n current: { productSelectedItem },\n },\n } = renderHook(() => useReduceProduct(state))\n\n // assert\n await waitFor(() => expect(productSelectedItem).toBeFalsy())\n })\n\n it('should return productItemsWithoutSelected with all items', async () => {\n // arrange\n const state = { ...productContextState, selectedItem: undefined }\n\n // act\n const {\n result: {\n current: { productItemsWithoutSelected },\n },\n } = renderHook(() => useReduceProduct(state))\n\n // assert\n await waitFor(() =>\n expect(productItemsWithoutSelected).toStrictEqual(\n productContextState.product?.items\n )\n )\n })\n\n it('should return initial values', async () => {\n // arrange\n const initialValue = {\n productItemsWithoutSelected: [],\n productSelectedItem: undefined,\n }\n\n // act\n const {\n result: { current },\n } = renderHook(() =>\n useReduceProduct({ ...productContextState, product: undefined })\n )\n\n // assert\n await waitFor(() => expect(current).toStrictEqual(initialValue))\n })\n})\n\n```"
}
] |
code_buybox-context_32aee5c3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/hooks/useSellersByProtocol.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { renderHook } from '@vtex/test-tools/react'\nimport * as reactapollo from 'react-apollo'\n\nimport { useSellersByProtocol } from '../../hooks/useSellersByProtocol'\nimport type { SellerLogisticsInfoResult } from '../../typings/types'\n// eslint-disable-next-line jest/no-mocks-import\nimport { unsortedSellersMock } from '../../__mocks__/sellers'\n\ndescribe('useSellersByProtocol', () => {\n it('should return an array with ordered sellers by protocol', async () => {\n // arrange\n jest\n .spyOn(reactapollo, 'useQuery')\n .mockImplementation()\n .mockReturnValue({\n data: {\n sortSellers: {\n sellers: ['3', '1', '4', '2', '5'],\n },\n },\n } as any)\n\n const sellerLogisticsInfo: SellerLogisticsInfoResult[] = unsortedSellersMock\n\n const [seller1, seller2, seller3, seller4, seller5] = unsortedSellersMock\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellersByProtocol(sellerLogisticsInfo))\n\n // assert\n expect(sellersInfoResult).toStrictEqual([\n seller3,\n seller1,\n seller4,\n seller2,\n seller5,\n ])\n })\n\n it('should return an empty array when loading is true', async () => {\n // arrange\n jest\n .spyOn(reactapollo, 'useQuery')\n .mockImplementation()\n .mockReturnValue({\n data: {\n sortSellers: {\n sellers: ['3', '1', '4', '2', '5'],\n },\n },\n loading: true,\n } as any)\n\n const sellerLogisticsInfo: SellerLogisticsInfoResult[] = unsortedSellersMock\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellersByProtocol(sellerLogisticsInfo))\n\n // assert\n expect(sellersInfoResult).toStrictEqual([])\n })\n\n it('should return an empty array when data is empty', async () => {\n // arrange\n jest\n .spyOn(reactapollo, 'useQuery')\n .mockImplementation()\n .mockReturnValue({\n data: {},\n } as any)\n\n const sellerLogisticsInfo: SellerLogisticsInfoResult[] = unsortedSellersMock\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellersByProtocol(sellerLogisticsInfo))\n\n // assert\n expect(sellersInfoResult).toStrictEqual([])\n })\n\n it('should return an empty array when sellersInfo parameter is empty', async () => {\n // arrange\n jest\n .spyOn(reactapollo, 'useQuery')\n .mockImplementation()\n .mockReturnValue({\n data: {\n sortSellers: {\n sellers: ['3', '1', '4', '2', '5'],\n },\n },\n loading: true,\n } as any)\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellersByProtocol([]))\n\n // assert\n expect(sellersInfoResult).toStrictEqual([])\n })\n\n it('should return an array without sellers that do not exists on sellerLogisticsInfo', async () => {\n // arrange\n jest\n .spyOn(reactapollo, 'useQuery')\n .mockImplementation()\n .mockReturnValue({\n data: {\n sortSellers: {\n sellers: ['10', '20', '3', '1', '4', '2', '5'],\n },\n },\n } as any)\n\n const sellerLogisticsInfo: SellerLogisticsInfoResult[] = unsortedSellersMock\n\n const [seller1, seller2, seller3, seller4, seller5] = unsortedSellersMock\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellersByProtocol(sellerLogisticsInfo))\n\n // assert\n expect(sellersInfoResult).toStrictEqual([\n seller3,\n seller1,\n seller4,\n seller2,\n seller5,\n ])\n })\n})\n\n```"
}
] |
code_buybox-context_a56a4210
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/hooks/useNewProductWithSellers.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { renderHook } from '@vtex/test-tools/react'\nimport type { ProductContextState } from 'vtex.product-context/react/ProductContextProvider'\n\nimport { useNewProductWithSellers } from '../../hooks/useNewProductWithSellers'\nimport type { Seller } from '../../typings/types'\n// eslint-disable-next-line jest/no-mocks-import\nimport { productContextState } from '../../__mocks__/productContext'\n// eslint-disable-next-line jest/no-mocks-import\nimport { unsortedSellersMock } from '../../__mocks__/sellers'\n\ndescribe('useNewProductWithSellers', () => {\n it('should return new product with sellers ordered', async () => {\n // arrange\n const productContext: Partial<ProductContextState> = productContextState\n const sellers: Seller[] = [unsortedSellersMock[0].seller]\n\n // act\n const {\n result: { current: newProduct },\n } = renderHook(() =>\n useNewProductWithSellers({\n productContext,\n sellers,\n })\n )\n\n // assert\n expect(productContext.selectedItem?.sellers).not.toStrictEqual(sellers)\n expect(newProduct?.items[0].sellers).toStrictEqual(sellers)\n })\n})\n\n```"
}
] |
code_buybox-context_9568cd2a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of buybox-context/react/__tests__/hooks/useSellerLoginstcsInfoSellerSelector.test.ts from the buybox-context VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { renderHook } from '@vtex/test-tools/react'\nimport * as productContext from 'vtex.product-context'\nimport { SellerContext } from 'vtex.seller-selector'\n\nimport { useSellerLoginstcsInfoSellerSelector } from '../../hooks/useSellerLoginstcsInfoSellerSelector'\nimport type { LogisticsInfo } from '../../typings/types'\n// eslint-disable-next-line jest/no-mocks-import\nimport { productContextState } from '../../__mocks__/productContext'\n\ndescribe('useSellerLoginstcsInfoSellerSelector', () => {\n it('should return sellers and logistics info correctly', async () => {\n // arrange\n const shippingQuotes = {\n sellerList: null,\n shippingQuotes: {\n logisticsInfo: [\n { itemIndex: 0, slas: [] },\n {\n itemIndex: 1,\n slas: [\n {\n id: '1',\n name: 'logistic name 1',\n price: 4000,\n shippingEstimate: '3d',\n shippingEstimateDate: '',\n },\n {\n id: '2',\n name: 'logistic name 2',\n price: 9000,\n shippingEstimate: '1h',\n shippingEstimateDate: '',\n },\n ],\n },\n ] as LogisticsInfo[],\n },\n setShippingQuotes: jest.fn(),\n limitShownShippingInformation: 0,\n }\n\n jest\n .spyOn(productContext, 'useProduct')\n .mockImplementation(() => productContextState)\n\n jest\n .spyOn(SellerContext, 'useSellerContext')\n .mockImplementation(() => shippingQuotes)\n\n // act\n const {\n result: { current: sellersInfoResult },\n } = renderHook(() => useSellerLoginstcsInfoSellerSelector())\n\n // assert\n expect(sellersInfoResult[0].seller).toStrictEqual(\n productContextState.selectedItem?.sellers[0]\n )\n expect(sellersInfoResult[0].logisticsInfo).toStrictEqual(\n shippingQuotes.shippingQuotes.logisticsInfo[0]\n )\n expect(sellersInfoResult[1].seller).toStrictEqual(\n productContextState.selectedItem?.sellers[1]\n )\n expect(sellersInfoResult[1].logisticsInfo).toStrictEqual(\n shippingQuotes.shippingQuotes.logisticsInfo[1]\n )\n })\n})\n\n```"
}
] |
code_search-listener_6e27f330
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/docs/README.md from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/CHANGEME) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# APP NAME\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 the **app's functionality** (what is it for?) in a store.\n\nNext, you can **add media** (either an image of a GIF) if possible, so that users can better understand how the app works in practice. \n\n\n\n## Configuration\n\nIt is possible to install in your store either by using App Store or the VTEX IO Toolbelt.\n\n### Using VTEX App Store\n\n1. Access the **Apps** section in your account's admin page and look for the Icommkt box;\n2. Then, click on the **Install** button;\n3. You'll see a warning message about needing to enter the necessary configurations. Scroll down and type in your **NAME OF A SETTINGS FIELD** in the `NAME OF THE APP` field.\n4. Click on **Save**.\n\n### Using VTEX IO Toolbelt\n\n1. [Install](https://vtex.io/docs/recipes/development/installing-an-app/) the `vtex.icommkt@0.x` app. You can confirm that the app has now been installed by running `vtex ls` again. \n2. Access the **Apps** section in your account's admin page and look for the NAME OF THE APP box. Once you find it, click on the box.\n3. Fill in the `NAME OF THE APP` field with your **NAME OF THE SETTINGS FIELD**.\n4. Click on **Save**.\n\n<!-- Remember to also **showcase any necessary disclaimer** related to the app in this section, 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 its configuration. It's crucial then 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, such as the app's **relationship with others**, don't hesitate to use this section. \n\n<!-- DOCS-IGNORE:start -->\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n<!-- DOCS-IGNORE:end -->\n\n```"
}
] |
code_search-listener_07c97cbe
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/react/index.tsx from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { canUseDOM } from 'vtex.render-runtime'\n\nimport type { PixelMessage } from './typings/events'\n\nexport function handleEvents(e: PixelMessage) {\n switch (e.data.eventName) {\n case 'vtex:pageView': {\n break\n }\n\n default: {\n break\n }\n }\n}\n\nif (canUseDOM) {\n window.addEventListener('message', handleEvents)\n}\n\n```"
}
] |
code_search-listener_e60bd449
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/react/package.json from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/graphql\": \"^14.5.0\",\n \"@types/jest\": \"^25.1.5\",\n \"@types/node\": \"^13.11.0\",\n \"@types/react\": \"^16.9.31\",\n \"@types/react-intl\": \"^3.0.0\",\n \"@vtex/test-tools\": \"^3.1.0\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"apollo-client\": \"^2.6.8\",\n \"graphql\": \"^14.5.4\",\n \"react-intl\": \"^3.11.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.pixel-interfaces\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.pixel-interfaces@1.1.1/public/_types/react\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.124.3/public/@types/vtex.render-runtime\"\n }\n}\n\n```"
}
] |
code_search-listener_0c7d9b8d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/store/interfaces.json from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"pixel.APPNAME\": {\n \"component\": \"index\"\n }\n}\n```"
}
] |
code_search-listener_e93305af
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/public/metadata/messages/es-AR.json from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"\",\n \"headline\": \"\",\n \"overview\": \"\",\n \"features\": [],\n \"additionalInformation\": \"\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_search-listener_72c2b237
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/public/metadata/messages/pt-BR.json from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"\",\n \"headline\": \"\",\n \"overview\": \"\",\n \"features\": [],\n \"additionalInformation\": \"\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_search-listener_769c12ad
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/public/metadata/messages/en-US.json from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"\",\n \"headline\": \"\",\n \"overview\": \"\",\n \"features\": [],\n \"additionalInformation\": \"\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_search-listener_55d85756
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/react/typings/events.d.ts from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport interface PixelMessage extends MessageEvent {\n data:\n | ProductViewData\n | ProductClickData\n | OrderPlacedData\n | OrderPlacedTrackedData\n | PageViewData\n | ProductImpressionData\n | AddToCartData\n | RemoveToCartData\n | CartChangedData\n | HomePageInfo\n | ProductPageInfoData\n | SearchPageInfoData\n | UserData\n | CartIdData\n | PromoViewData\n | PromotionClickData\n | NewsletterSubscriptionData\n}\n\nexport interface EventData {\n event: string\n eventName: string\n currency: string\n}\n\nexport interface PageInfoData extends EventData {\n event: 'pageInfo'\n eventName: 'vtex:pageInfo'\n accountName: string\n pageTitle: string\n pageUrl: string\n}\n\nexport interface UserData extends PageInfoData {\n eventType: 'userData'\n eventName: 'vtex:userData'\n firstName?: string\n lastName?: string\n document?: string\n id?: string\n email?: string\n phone?: string\n isAuthenticated: boolean\n}\n\nexport interface CartIdData extends PageInfoData {\n eventType: 'cartId'\n eventName: 'vtex:cartId'\n cartId: string\n}\n\nexport interface HomePageInfo extends PageInfoData {\n eventType: 'homeView'\n}\n\nexport interface ProductPageInfoData extends PageInfoData {\n eventType: 'productPageInfo'\n}\n\nexport interface SearchPageInfoData extends PageInfoData {\n eventType:\n | 'internalSiteSearchView'\n | 'categoryView'\n | 'departmentView'\n | 'emptySearchView'\n category?: CategoryMetaData\n department?: DepartmentMetaData\n search?: SearchMetaData\n}\n\ninterface CategoryMetaData {\n id: string\n name: string\n}\n\ninterface DepartmentMetaData {\n id: string\n name: string\n}\n\ninterface SearchMetaData {\n term: string\n category: CategoryMetaData\n results: number\n}\n\nexport interface PageViewData extends EventData {\n event: 'pageView'\n eventName: 'vtex:pageView'\n pageTitle: string\n pageUrl: string\n referrer: string\n}\n\nexport interface AddToCartData extends EventData {\n event: 'addToCart'\n eventName: 'vtex:addToCart'\n items: CartItem[]\n}\n\nexport interface RemoveToCartData extends EventData {\n event: 'removeFromCart'\n eventName: 'vtex:removeFromCart'\n items: CartItem[]\n}\n\nexport interface CartChangedData extends EventData {\n event: 'cartChanged'\n eventName: 'vtex:cartChanged'\n items: CartItem[]\n}\n\nexport interface OrderPlacedData extends Order, EventData {\n event: 'orderPlaced'\n eventName: 'vtex:orderPlaced'\n}\n\nexport interface OrderPlacedTrackedData extends Order, EventData {\n event: 'orderPlacedTracked'\n eventName: 'vtex:orderPlacedTracked'\n}\n\nexport interface ProductViewData extends EventData {\n event: 'productView'\n eventName: 'vtex:productView'\n product: Product\n}\n\nexport interface ProductClickData extends EventData {\n event: 'productClick'\n eventName: 'vtex:productClick'\n product: ProductSummary\n list?: string\n}\n\nexport interface ProductImpressionData extends EventData {\n event: 'productImpression'\n eventName: 'vtex:productImpression'\n impressions: Impression[]\n product?: ProductSummary // deprecated, use impressions list!\n position?: number // deprecated, use impressions list!\n list: string\n}\n\nexport interface CartData extends EventData {\n event: 'cart'\n eventName: 'vtex:cart'\n orderForm: OrderForm\n}\n\nexport interface PromoViewData extends EventData {\n event: 'promoView'\n eventName: 'vtex:promoView'\n promotions: Promotion[]\n}\n\nexport interface PromotionClickData extends EventData {\n event: 'promotionClick'\n eventName: 'vtex:promotionClick'\n promotions: Promotion[]\n}\n\nexport interface NewsletterSubscriptionData extends EventData {\n event: 'newsletterSubscription'\n eventName: 'vtex:newsletterSubscription'\n name: string\n email: string\n phone: string\n}\n\ninterface Promotion {\n id?: string\n name?: string\n creative?: string\n position?: string\n}\n\ninterface CartItem {\n [x: string]: {};\n brand: string\n ean: string\n category: string\n detailUrl: string\n imageUrl: string\n name: string\n price: number\n productId: string\n productRefId: string\n quantity: number\n seller: string\n sellerName: string\n skuId: string\n variant: string\n}\n\nexport interface OrderForm {\n id: string\n items: CartItem[]\n}\n\nexport interface Order {\n accountName: string\n corporateName: string\n coupon: string\n currency: string\n openTextField: string\n orderGroup: string\n salesChannel: string\n visitorAddressCity: string\n visitorAddressComplement: string\n visitorAddressCountry: string\n visitorAddressNeighborhood: string\n visitorAddressNumber: string\n visitorAddressPostalCode: string\n visitorAddressState: string\n visitorAddressStreet: string\n visitorContactInfo: string[]\n visitorContactPhone: string\n visitorType: string\n transactionId: string\n transactionDate: string\n transactionAffiliation: string\n transactionTotal: number\n transactionShipping: number\n transactionSubtotal: number\n transactionDiscounts: number\n transactionTax: number\n transactionCurrency: string\n transactionPaymentType: PaymentType[]\n transactionShippingMethod: ShippingMethod[]\n transactionLatestShippingEstimate: Date\n transactionProducts: ProductOrder[]\n transactionPayment: {\n id: string\n }\n}\n\nexport interface Impression {\n product: ProductSummary\n position: number\n}\n\nexport interface PaymentType {\n group: string\n paymentSystemName: string\n installments: number\n value: number\n}\n\nexport interface ShippingMethod {\n itemId: string\n selectedSla: string\n}\n\nexport interface ProductOrder {\n id: string\n name: string\n sku: string\n skuRefId: string\n skuName: string\n productRefId: string\n ean: string\n slug: string\n brand: string\n brandId: string\n seller: string\n sellerId: string\n category: string\n categoryId: string\n categoryTree: string[]\n categoryIdTree: string[]\n priceTags: PriceTag[]\n originalPrice: number\n price: number\n sellingPrice: number\n tax: number\n quantity: number\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n components: any[]\n measurementUnit: string\n unitMultiplier: number\n}\n\nexport interface PriceTag {\n identifier: string\n isPercentual: boolean\n value: number\n}\n\nexport interface Product {\n brand: string\n brandId: string\n categories: string[]\n categoryId: string\n categoryTree: Array<{ id: string; name: string }>\n detailUrl: string\n items: Item[]\n linkText: string\n productId: string\n productName: string\n productReference: string\n selectedSku: Item\n}\n\nexport interface Item {\n itemId: string\n name: string\n ean: string\n referenceId: { Key: string; Value: string }\n imageUrl: string\n sellers: Seller[]\n}\n\nexport interface ProductSummary {\n brand: string\n brandId: string\n categories: string[]\n items: ItemSummary[]\n linkText: string\n productId: string\n productName: string\n productReference: string\n sku: ItemSummary\n}\n\ninterface ItemSummary {\n itemId: string\n ean: string\n name: string\n referenceId: { Key: string; Value: string }\n seller: Seller\n sellers: Seller[]\n}\n\nexport interface Seller {\n commertialOffer: CommertialOffer\n sellerId: string\n sellerName: string\n}\n\nexport interface CommertialOffer {\n Price: number\n ListPrice: number\n AvailableQuantity: number\n}\n\n```"
}
] |
code_search-listener_b177d377
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of search-listener/react/typings/global.d.ts from the search-listener VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface Window extends Window {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n dataLayer: any[]\n}\n\n```"
}
] |
code_order-profile_3950b21a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/docs/README.md from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Order Profile\n\nCentralizes all profile related requests to the Checkout API\n\n```"
}
] |
code_order-profile_c1f3b8d8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/package.json from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"order-profile\",\n \"version\": \"0.3.1\",\n \"private\": true,\n \"license\": \"UNLICENSED\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"react\": \"^16.13.0\",\n \"react-apollo\": \"^3.1.3\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^4.0.0\",\n \"@babel/compat-data\": \"^7.9.0\",\n \"@testing-library/react-hooks\": \"^7.0.2\",\n \"@types/react\": \"^16.9.23\",\n \"@types/react-dom\": \"^16.9.5\",\n \"@vtex/checkout-types\": \"^0.1.2\",\n \"@vtex/order-manager\": \"^0.5.4-beta.0\",\n \"@vtex/test-tools\": \"3.0.3\",\n \"react-intl\": \"^5.23.0\",\n \"vtex.checkout-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-graphql@0.55.1/public/@types/vtex.checkout-graphql\",\n \"vtex.checkout-resources\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-resources@0.41.0/public/@types/vtex.checkout-resources\",\n \"vtex.order-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.9.0/public/@types/vtex.order-manager\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.126.5/public/@types/vtex.render-runtime\"\n }\n}\n\n```"
}
] |
code_order-profile_f5fd414f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/OrderProfile.tsx from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { useCallback } from 'react'\nimport { useMutation } from 'react-apollo'\nimport MutationUpdateOrderFormProfile from 'vtex.checkout-resources/MutationUpdateOrderFormProfile'\nimport MutationUpdateClientPreferencesData from 'vtex.checkout-resources/MutationUpdateClientPreferencesData'\nimport { useOrderForm } from 'vtex.order-manager/OrderForm'\nimport { useQueueStatus, useOrderQueue } from 'vtex.order-manager/OrderQueue'\nimport {\n UserProfileInput,\n ClientPreferencesDataInput,\n OrderForm as CheckoutOrderForm,\n} from '@vtex/checkout-types'\n\nimport { useLogger } from './utils/logger'\nimport {\n createOrderProfileProvider,\n useOrderProfile,\n} from './components/createOrderProfileProvider'\n\ninterface UpdateOrderFormProfileMutation {\n updateOrderFormProfile: CheckoutOrderForm\n}\n\ninterface UpdateOrderFormProfileMutationVariables {\n profile: UserProfileInput\n}\n\ninterface UpdateClientPreferencesDataMutation {\n updateClientPreferencesData: CheckoutOrderForm\n}\n\ninterface UpdateClientPreferencesDataMutationVariables {\n clientPreferences: ClientPreferencesDataInput\n}\n\nfunction useUpdateOrderFormProfile() {\n const [updateOrderFormProfile] = useMutation<\n UpdateOrderFormProfileMutation,\n UpdateOrderFormProfileMutationVariables\n >(MutationUpdateOrderFormProfile)\n\n return {\n updateOrderFormProfile: useCallback(\n async (profile: UserProfileInput) => {\n const { data } = await updateOrderFormProfile({\n variables: { profile },\n })\n\n const newOrderForm = data!.updateOrderFormProfile\n\n return newOrderForm\n },\n [updateOrderFormProfile]\n ),\n }\n}\n\nfunction useUpdateClientPreferencesData() {\n const [updateClientPreferencesData] = useMutation<\n UpdateClientPreferencesDataMutation,\n UpdateClientPreferencesDataMutationVariables\n >(MutationUpdateClientPreferencesData)\n\n return {\n updateClientPreferencesData: useCallback(\n async (clientPreferences: ClientPreferencesDataInput) => {\n const { data } = await updateClientPreferencesData({\n variables: { clientPreferences },\n })\n\n const newOrderForm = data!.updateClientPreferencesData\n\n return newOrderForm\n },\n [updateClientPreferencesData]\n ),\n }\n}\n\nconst { OrderProfileProvider } = createOrderProfileProvider({\n useOrderQueue,\n useOrderForm,\n useQueueStatus,\n useLogger,\n useUpdateOrderFormProfile,\n useUpdateClientPreferencesData,\n})\n\nexport { OrderProfileProvider, useOrderProfile }\nexport default { OrderProfileProvider, useOrderProfile }\n\n```"
}
] |
code_order-profile_c1f77e9a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/__fixtures__/OrderFormProvider.tsx from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { createOrderFormProvider } from '@vtex/order-manager'\n\nimport { mockOrderForm } from './orderForm'\n\nfunction useToast() {\n return {\n showToast: () => {},\n toastState: {\n isToastVisible: false,\n },\n }\n}\n\nfunction useClearOrderFormMessages() {\n return () =>\n new Promise(resolve => {\n resolve(true)\n })\n}\n\nfunction useGetOrderForm(args: any): any {\n return new Promise(resolve => {\n resolve({\n ...args,\n })\n })\n}\n\nconst { OrderFormProvider } = createOrderFormProvider({\n useToast,\n useClearOrderFormMessages,\n useGetOrderForm,\n defaultOrderForm: mockOrderForm,\n})\n\nexport { OrderFormProvider }\n\n```"
}
] |
code_order-profile_037a0bd3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/__fixtures__/orderform.ts from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const mockOrderForm = {\n id: '123',\n loggedIn: false,\n paymentData: {\n installmentOptions: [\n {\n value: 100,\n paymentSystem: '1',\n installments: [],\n },\n ],\n isValid: true,\n payments: [],\n paymentSystems: [],\n availableAccounts: [],\n },\n items: [\n {\n additionalInfo: {\n brandName: 'Test Brand 0',\n },\n id: '1',\n uniqueId: '1',\n detailUrl: '/work-shirt/p',\n imageUrls: {\n at1x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155476-55-55/Frame-4.jpg?v=636793808441900000',\n at2x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155476-55-55/Frame-4.jpg?v=636793808441900000',\n at3x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155476-55-55/Frame-4.jpg?v=636793808441900000',\n },\n listPrice: 2800000,\n measurementUnit: 'un',\n name: 'قميص العمل الأعلى',\n price: 2400000,\n productId: '1',\n quantity: 3,\n sellingPrice: 2400000,\n skuName: 'Test SKU 0',\n skuSpecifications: [],\n attachmentOfferings: [],\n bundleItems: [],\n\n attachments: [],\n offerings: [],\n priceTags: [],\n },\n {\n additionalInfo: {\n brandName: 'Test Brand 1',\n },\n id: '30',\n uniqueId: '30',\n detailUrl: '/long-sleeve-shirt/p',\n imageUrls: {\n at1x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155487-55-55/Frame-7.jpg?v=636793837686400000',\n at2x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155487-55-55/Frame-7.jpg?v=636793837686400000',\n at3x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155487-55-55/Frame-7.jpg?v=636793837686400000',\n },\n listPrice: 945000,\n measurementUnit: 'un',\n name: '上品なサングラス',\n price: 945000,\n productId: '2000005',\n quantity: 1,\n sellingPrice: 945000,\n skuName: 'Test SKU 1',\n skuSpecifications: [],\n attachmentOfferings: [],\n bundleItems: [],\n isGift: false,\n attachments: [],\n offerings: [],\n priceTags: [],\n },\n {\n additionalInfo: {\n brandName: 'Test Brand 2',\n },\n id: '2000535',\n uniqueId: '2000535',\n detailUrl: '/classy--sunglasses/p',\n imageUrls: {\n at1x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155469-55-55/Frame-8.jpg?v=636793757498800000',\n at2x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155469-55-55/Frame-8.jpg?v=636793757498800000',\n at3x:\n 'http://storecomponents.vteximg.com.br/arquivos/ids/155469-55-55/Frame-8.jpg?v=636793757498800000',\n },\n listPrice: 400000,\n measurementUnit: 'un',\n name: 'กางเกงขาสั้น St Tropez',\n price: 360000,\n productId: '13',\n quantity: 4,\n sellingPrice: 360000,\n skuName: 'Test SKU 2',\n skuSpecifications: [],\n attachmentOfferings: [],\n bundleItems: [],\n isGift: false,\n attachments: [],\n offerings: [],\n priceTags: [],\n },\n ],\n marketingData: {},\n totalizers: [\n {\n id: 'Items',\n name: 'Items Total',\n value: 9585000,\n },\n ],\n shipping: { isValid: true, pickupOptions: [], deliveryOptions: [] },\n messages: {\n couponMessages: [],\n generalMessages: [],\n },\n clientProfileData: {\n email: 'fulanodetal@vtex.com',\n firstName: 'Fulano',\n lastName: 'Di Tal',\n isValid: true,\n },\n canEditData: false,\n value: 9585000,\n}\n\n```"
}
] |
code_order-profile_53f6c309
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/typings/vtex.checkout-resources.d.ts from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable import/export */\n\ndeclare module 'vtex.checkout-resources/MutationUpdateOrderFormProfile' {\n export { default } from 'vtex.checkout-resources/react/MutationUpdateOrderFormProfile'\n}\n\ndeclare module 'vtex.checkout-resources/MutationUpdateClientPreferencesData' {\n export { default } from 'vtex.checkout-resources/react/MutationUpdateClientPreferencesData'\n}\n\n```"
}
] |
code_order-profile_abcaf5d7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/typings/vtex.order-manager.d.ts from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable import/export */\n\ndeclare module 'vtex.order-manager/OrderQueue' {\n export * from 'vtex.order-manager/react/OrderQueue'\n export { default } from 'vtex.order-manager/react/OrderQueue'\n\n export const QueueStatus = {\n PENDING: 'Pending',\n FULFILLED: 'Fulfilled',\n } as const\n}\n\ndeclare module 'vtex.order-manager/OrderForm' {\n export * from 'vtex.order-manager/react/OrderForm'\n export { default } from 'vtex.order-manager/react/OrderForm'\n}\n\ndeclare module 'vtex.order-manager/constants' {\n export * from 'vtex.order-manager/react/constants'\n}\n\n```"
}
] |
code_order-profile_3f0f22d2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/utils/logger.ts from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport interface LogParams {\n type: 'Error'\n level: 'Critical'\n event: unknown\n workflowType?: 'OrderProfile'\n workflowInstance: string\n}\n\nexport type LogFn = (params: LogParams) => void\n\nexport type UseLogger = () => { log: LogFn }\n\nconst log = ({\n type,\n level,\n event,\n workflowType,\n workflowInstance,\n}: LogParams) => {\n // eslint-disable-next-line no-console\n console.log({\n type,\n level,\n event,\n workflowInstance,\n workflowType: workflowType || 'OrderProfile',\n })\n}\n\nexport function useLogger() {\n return { log }\n}\n\n```"
}
] |
code_order-profile_30725f9e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/components/createOrderProfileProvider.tsx from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC, useMemo, useContext, useCallback } from 'react'\nimport { OrderQueueContext } from '@vtex/order-manager'\nimport {\n UserProfileInput,\n ClientPreferencesDataInput,\n OrderForm as CheckoutOrderForm,\n} from '@vtex/checkout-types'\n\nimport { UseLogger } from '../utils/logger'\n\nexport const QueueStatus = {\n PENDING: 'Pending',\n FULFILLED: 'Fulfilled',\n} as const\n\ninterface ProfileContext {\n setOrderProfile: (profile: UserProfileInput) => Promise<{ success: boolean }>\n setClientPreferencesData: (\n clientPreferences: ClientPreferencesDataInput\n ) => Promise<{ success: boolean }>\n clientProfileData: CheckoutOrderForm['clientProfileData']\n}\n\nconst OrderProfileContext = React.createContext<ProfileContext | undefined>(\n undefined\n)\n\ntype UseUpdateOrderFormProfile = () => {\n updateOrderFormProfile: (\n profile: UserProfileInput,\n orderFormId?: string\n ) => Promise<CheckoutOrderForm>\n}\n\ntype UseUpdateClientPreferencesData = () => {\n updateClientPreferencesData: (\n clientPreferences: ClientPreferencesDataInput,\n orderFormId?: string\n ) => Promise<CheckoutOrderForm>\n}\n\ntype ListenFunction = (event: any, callback: () => void) => () => void\ninterface QueueContext {\n enqueue: (task: () => Promise<CheckoutOrderForm>, id?: string) => any\n listen: ListenFunction\n isWaiting: (id: string) => boolean\n}\ndeclare type OrderFormUpdate<O> =\n | Partial<O>\n | ((prevOrderForm: O) => Partial<O>)\n\ninterface OrderContext<O extends CheckoutOrderForm> {\n loading: boolean\n setOrderForm: (nextValue: OrderFormUpdate<O>) => void\n error: any | undefined\n orderForm: O\n}\n\ninterface CreateOrderProfileProvider<O extends CheckoutOrderForm> {\n useLogger: UseLogger\n useOrderQueue: () => QueueContext\n useOrderForm: () => OrderContext<O>\n useUpdateClientPreferencesData: UseUpdateClientPreferencesData\n useUpdateOrderFormProfile: UseUpdateOrderFormProfile\n useQueueStatus: (listen: OrderQueueContext<O>['listen']) => any\n}\n\nconst SET_PROFILE_TASK = 'SetProfileTask'\nconst SET_CLIENT_PREFERENCES_TASK = 'SetClientPreferencesTask'\n\nexport function createOrderProfileProvider({\n useLogger,\n useOrderQueue,\n useUpdateClientPreferencesData,\n useUpdateOrderFormProfile,\n useOrderForm,\n useQueueStatus,\n}: CreateOrderProfileProvider<CheckoutOrderForm>): {\n OrderProfileProvider: FC\n} {\n const OrderProfileProvider: FC = ({ children }) => {\n const { enqueue, listen } = useOrderQueue()\n const { setOrderForm, orderForm } = useOrderForm()\n const { updateOrderFormProfile } = useUpdateOrderFormProfile()\n const { updateClientPreferencesData } = useUpdateClientPreferencesData()\n const { log } = useLogger()\n\n const queueStatusRef = useQueueStatus(listen)\n const { id, clientProfileData } = orderForm\n\n const setOrderProfile = useCallback(\n async (profile: UserProfileInput) => {\n try {\n const task = async () => {\n const updatedOrderForm = await updateOrderFormProfile(profile, id)\n\n return updatedOrderForm\n }\n\n const newOrderForm = await enqueue(task, SET_PROFILE_TASK)\n\n if (queueStatusRef.current === QueueStatus.FULFILLED) {\n setOrderForm(newOrderForm)\n }\n\n return { success: true }\n } catch (err) {\n log({\n type: 'Error',\n level: 'Critical',\n event: {\n error: err,\n orderFormId: id,\n },\n workflowInstance: 'client-profile-not-updated',\n })\n\n if (!err || err.code !== 'TASK_CANCELLED') {\n throw err\n }\n\n return { success: false }\n }\n },\n [enqueue, queueStatusRef, updateOrderFormProfile, id, setOrderForm, log]\n )\n\n const setClientPreferencesData = useCallback(\n async (clientPreferences: ClientPreferencesDataInput) => {\n const task = async () => {\n const updatedOrderForm = await updateClientPreferencesData(\n clientPreferences,\n id\n )\n\n return updatedOrderForm\n }\n\n try {\n const newOrderForm = await enqueue(task, SET_CLIENT_PREFERENCES_TASK)\n\n if (queueStatusRef.current === QueueStatus.FULFILLED) {\n setOrderForm(newOrderForm)\n }\n\n return { success: true }\n } catch (err) {\n log({\n type: 'Error',\n level: 'Critical',\n event: {\n error: err,\n orderFormId: id,\n },\n workflowInstance: 'client-preferences-data-not-updated',\n })\n\n return { success: false }\n }\n },\n [\n updateClientPreferencesData,\n id,\n enqueue,\n queueStatusRef,\n setOrderForm,\n log,\n ]\n )\n\n const value = useMemo(\n () => ({ setOrderProfile, setClientPreferencesData, clientProfileData }),\n [setOrderProfile, setClientPreferencesData, clientProfileData]\n )\n\n return (\n <OrderProfileContext.Provider value={value}>\n {children}\n </OrderProfileContext.Provider>\n )\n }\n\n return { OrderProfileProvider }\n}\n\nexport const useOrderProfile = () => {\n const context = useContext(OrderProfileContext)\n\n if (context === undefined) {\n throw new Error('useOrderProfile must be used within an <OrderProfile />')\n }\n\n return context\n}\n\nexport default { createOrderProfileProvider, useOrderProfile }\n\n```"
}
] |
code_order-profile_1ac91b4f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of order-profile/react/__tests__/createOrderProfileProvider.test.tsx from the order-profile VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { renderHook, act } from '@testing-library/react-hooks'\nimport {\n useOrderForm,\n useOrderQueue,\n useQueueStatus,\n OrderQueueProvider,\n} from '@vtex/order-manager'\n\nimport { mockOrderForm } from '../__fixtures__/orderForm'\nimport { OrderFormProvider } from '../__fixtures__/OrderFormProvider'\nimport {\n createOrderProfileProvider,\n useOrderProfile,\n} from '../components/createOrderProfileProvider'\nimport { LogParams } from '../utils/logger'\n\nconst mockProfileData = {\n firstName: 'Sicrano ',\n lastName: 'DiTal',\n phone: '+55(12) 3 1231-223',\n documentType: 'cpf',\n document: '123.456.789-09',\n email: 'fulano@detal.com',\n}\n\nconst mockLog = jest.fn()\n\nfunction useLogger() {\n const log = ({\n type,\n level,\n event,\n workflowType,\n workflowInstance,\n }: LogParams) => {\n mockLog({\n type,\n level,\n event,\n workflowType: workflowType ?? 'OrderProfileTest',\n workflowInstance,\n })\n }\n\n return { log }\n}\n\nconst mockUpdateOrderFormProfile = jest.fn().mockResolvedValue(true)\nconst mockUpdateClientPreferencesData = jest.fn().mockResolvedValue(true)\n\nconst createWrapperOrderProviders = () => {\n const useUpdateOrderFormProfile = () => ({\n updateOrderFormProfile: mockUpdateOrderFormProfile,\n })\n\n const useUpdateClientPreferencesData = () => ({\n updateClientPreferencesData: mockUpdateClientPreferencesData,\n })\n\n const { OrderProfileProvider } = createOrderProfileProvider({\n useLogger,\n useOrderQueue,\n useOrderForm,\n useUpdateOrderFormProfile,\n useUpdateClientPreferencesData,\n useQueueStatus,\n })\n\n const Wrapper: FC = ({ children }) => {\n return (\n <OrderQueueProvider>\n <OrderFormProvider>\n <OrderProfileProvider>{children}</OrderProfileProvider>\n </OrderFormProvider>\n </OrderQueueProvider>\n )\n }\n\n return { Wrapper }\n}\n\ndescribe('OrderProfile', () => {\n afterEach(() => {\n mockUpdateOrderFormProfile.mockReset()\n mockUpdateClientPreferencesData.mockReset()\n mockLog.mockReset()\n })\n\n it('should throw an error if theres no OrderPaymentProvider on the tree', () => {\n const {\n result: { error },\n } = renderHook(() => useOrderProfile())\n\n expect(error).not.toBeNull()\n expect(error?.message).toEqual(\n 'useOrderProfile must be used within an <OrderProfile />'\n )\n expect(mockUpdateOrderFormProfile).not.toHaveBeenCalled()\n })\n\n it('should get right client data from orderform context', () => {\n const { Wrapper } = createWrapperOrderProviders()\n const {\n result: { error, current },\n } = renderHook(() => useOrderProfile(), { wrapper: Wrapper })\n\n expect(error).toBeUndefined()\n expect(current.clientProfileData).toEqual(mockOrderForm.clientProfileData)\n })\n\n it('should call updateOrderFormProfile if setOrderProfile is executed', async () => {\n const { Wrapper } = createWrapperOrderProviders()\n const {\n result: {\n error,\n current: { setOrderProfile, clientProfileData },\n },\n } = renderHook(() => useOrderProfile(), { wrapper: Wrapper })\n\n mockUpdateOrderFormProfile.mockReturnValue({\n ...mockOrderForm,\n clientProfileData: {\n email: mockProfileData.email,\n firstName: mockProfileData.firstName,\n lastName: mockProfileData.lastName,\n isValid: true,\n },\n })\n\n expect(mockUpdateOrderFormProfile).not.toHaveBeenCalled()\n expect(error).toBeUndefined()\n expect(clientProfileData).toEqual(mockOrderForm.clientProfileData)\n await act(async () => {\n const { success } = await setOrderProfile(mockProfileData)\n\n expect(success).toBeTruthy()\n })\n expect(mockUpdateOrderFormProfile).toHaveBeenCalledWith(\n mockProfileData,\n mockOrderForm.id\n )\n expect(mockLog).not.toHaveBeenCalled()\n })\n\n it('should dispatch a log if something broken during the setOrderProfile execution', async () => {\n const { Wrapper } = createWrapperOrderProviders()\n const {\n result: {\n error,\n current: { setOrderProfile },\n },\n } = renderHook(() => useOrderProfile(), { wrapper: Wrapper })\n\n expect(mockUpdateOrderFormProfile).not.toHaveBeenCalled()\n mockUpdateOrderFormProfile.mockRejectedValue({ code: 'TASK_CANCELLED' })\n expect(error).toBeUndefined()\n await act(async () => {\n const { success } = await setOrderProfile(mockProfileData)\n\n expect(success).toBeFalsy()\n })\n expect(mockLog).toHaveBeenCalledWith({\n type: 'Error',\n level: 'Critical',\n event: {\n error: { code: 'TASK_CANCELLED' },\n orderFormId: mockOrderForm.id,\n },\n workflowInstance: 'client-profile-not-updated',\n workflowType: 'OrderProfileTest',\n })\n })\n\n it('should call updateClientPreferencesData when setClientPreferencesData is executed', async () => {\n const { Wrapper } = createWrapperOrderProviders()\n const {\n result: {\n error,\n current: { setClientPreferencesData, clientProfileData },\n },\n } = renderHook(() => useOrderProfile(), { wrapper: Wrapper })\n\n const mockPreferencesData = {\n optInNewsletter: false,\n locale: 'pt-br',\n }\n\n expect(mockUpdateClientPreferencesData).not.toHaveBeenCalled()\n expect(error).toBeUndefined()\n expect(clientProfileData).toEqual(mockOrderForm.clientProfileData)\n await act(async () => {\n const { success } = await setClientPreferencesData(mockPreferencesData)\n\n expect(success).toBeTruthy()\n })\n expect(mockUpdateClientPreferencesData).toHaveBeenCalledWith(\n mockPreferencesData,\n mockOrderForm.id\n )\n expect(mockLog).not.toHaveBeenCalled()\n })\n\n it('should dispatch a log if something broken during the setClientPreferencesData execution', async () => {\n const { Wrapper } = createWrapperOrderProviders()\n const {\n result: {\n error,\n current: { setClientPreferencesData, clientProfileData },\n },\n } = renderHook(() => useOrderProfile(), { wrapper: Wrapper })\n\n const mockPreferencesData = {\n optInNewsletter: false,\n locale: 'pt-br',\n }\n\n mockUpdateClientPreferencesData.mockRejectedValue({\n code: 'TASK_CANCELLED',\n })\n expect(mockUpdateClientPreferencesData).not.toHaveBeenCalled()\n expect(error).toBeUndefined()\n expect(clientProfileData).toEqual(mockOrderForm.clientProfileData)\n await act(async () => {\n const { success } = await setClientPreferencesData(mockPreferencesData)\n\n expect(success).toBeFalsy()\n })\n expect(mockUpdateClientPreferencesData).toHaveBeenCalledWith(\n mockPreferencesData,\n mockOrderForm.id\n )\n expect(mockLog).toHaveBeenCalledWith({\n type: 'Error',\n level: 'Critical',\n event: {\n error: {\n code: 'TASK_CANCELLED',\n },\n orderFormId: mockOrderForm.id,\n },\n workflowInstance: 'client-preferences-data-not-updated',\n workflowType: 'OrderProfileTest',\n })\n })\n})\n\n```"
}
] |
code_product-teaser-interfaces_47056cd9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-teaser-interfaces/example/README.md from the product-teaser-interfaces VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Product Teaser app example\n\nThis is an example of how a product teaser app would integrate with the store framework.\n\n## How to add to your theme\n\nAdd the `product-teaser.product.example-teaser` block to your product page layout in your `blocks.json`. Example:\n\n```diff\n // In the product page layout block\n // ...\n \"children\": [\n \"product-name\",\n \"product-rating-summary\",\n \"product-price#product-details\",\n+ \"product-teaser.product.example-teaser\",\n \"product-separator\",\n \"product-quantity\",\n```\n\nYou can also use it in the shelf or search results block of the product. Make sure you are using the block `product-summary.shelf`. This will not work if it uses the `product-summary`. Example:\n\n```diff\n \"product-summary.shelf\": {\n \"children\": [\n // ...other blocks\n+ \"product-teaser.summary.example-teaser\",\n // ...other blocks\n ]\n }\n```\n\n```"
}
] |
code_product-teaser-interfaces_f71ba6be
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-teaser-interfaces/example/manifest.json from the product-teaser-interfaces VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"vendor\": \"vtex\",\n \"name\": \"teaser-app-example\",\n \"version\": \"0.0.1\",\n \"title\": \"Teaser App Example\",\n \"description\": \"Example app of a product teaser app in the platform.\",\n \"builders\": {\n \"messages\": \"1.x\",\n \"store\": \"0.x\",\n \"react\": \"3.x\"\n },\n \"mustUpdateAt\": \"2019-04-02\",\n \"scripts\": {\n \"postreleasy\": \"vtex publish --verbose\"\n },\n \"dependencies\": {\n \"vtex.product-teaser-interfaces\": \"1.x\",\n \"vtex.product-summary-context\": \"0.x\",\n \"vtex.product-context\": \"0.x\",\n \"vtex.store\": \"2.x\"\n },\n \"$schema\": \"https://raw.githubusercontent.com/vtex/node-vtex-api/master/gen/manifest.schema\"\n}\n\n```"
}
] |
code_product-teaser-interfaces_b4c8a122
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-teaser-interfaces/docs/README.md from the product-teaser-interfaces VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Product Teaser Interfaces\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\n> Interfaces for a product teaser app.\n\nThis app provides extensible interfaces that can be used by the `vtex.store` and a theme app. A product teaser app would depend on this app and extend the interfaces provided to become available in the store.\n\nYou can see an [example of a product teaser app here](/example).\n\n## Use cases\n\n1. Display promotional data related to a product.\n2. Promote special conditions of payments.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n```"
}
] |
code_product-teaser-interfaces_46b6069c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of product-teaser-interfaces/react/package.json from the product-teaser-interfaces VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"lint\": \"tsc --noEmit && eslint --ext ts .\"\n },\n \"dependencies\": {\n \"react\": \"^16.8.3\",\n \"react-dom\": \"^16.8.3\"\n },\n \"devDependencies\": {\n \"@types/graphql\": \"^14.2.0\",\n \"@types/jest\": \"^24.0.11\",\n \"@types/node\": \"^11.13.0\",\n \"@types/prop-types\": \"^15.7.0\",\n \"@types/react\": \"^16.8.10\",\n \"apollo-client\": \"^2.5.1\",\n \"eslint\": \"^5.16.0\",\n \"eslint-config-vtex\": \"^10.1.0\",\n \"prettier\": \"^1.16.4\",\n \"tslint-eslint-rules\": \"^5.4.0\",\n \"typescript\": \"3.5.2\"\n }\n}\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.