id
stringlengths
12
53
messages
listlengths
3
3
code_broadcaster_856df98c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster/node/middlewares/notifyAllSubaccounts.ts from the broadcaster VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { BroadcasterClient } from '../clients/broadcaster'\n\nconst TIMEOUT_MS = 3000\nconst RETRIES = 2\n\nexport async function notifyAllSubaccounts(\n ctx: Context,\n next: () => Promise<any>\n) {\n const {\n clients: { apps, licenseManager },\n state: { payload },\n vtex: { account, authToken, logger, workspace },\n } = ctx\n\n if (workspace !== 'master') {\n return next()\n }\n\n const { notifySubaccounts = false } = await apps.getAppSettings(\n `${process.env.VTEX_APP_ID}`\n )\n\n if (!notifySubaccounts) {\n return next()\n }\n\n const { accountName, sites = [] } = await licenseManager\n .getAccountData(authToken)\n .catch((error) => {\n logger.error({\n message: 'getAccountData-error',\n error,\n })\n return {}\n })\n\n // if accountName doesn't match the current account, then the app is running in a subaccount\n if (!accountName || accountName !== account) return next()\n\n // instance new client for each target subaccount\n for (const subaccount of sites) {\n // skip the main account\n if (subaccount.name !== account) {\n const broadcasterClient = new BroadcasterClient(\n {\n ...ctx.vtex,\n account: subaccount.name,\n workspace: 'master',\n },\n {\n retries: RETRIES,\n timeout: TIMEOUT_MS,\n }\n )\n broadcasterClient.notify(payload).catch((error) => {\n logger.warn({\n message: 'notifySubaccount-error',\n error,\n })\n })\n }\n }\n next()\n}\n\n```" } ]
code_broadcaster_2a1208fe
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster/node/middlewares/notifyTargetWorkspace.ts from the broadcaster VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { BroadcasterClient } from '../clients/broadcaster'\n\nconst TIMEOUT_MS = 3000\nconst RETRIES = 2\n\nexport async function notifyTargetWorkspace(\n ctx: Context,\n next: () => Promise<any>\n) {\n const {\n clients: { apps },\n state: { payload },\n vtex: { workspace },\n } = ctx\n\n if (workspace !== 'master') {\n return next()\n }\n\n const { targetWorkspace } = await apps.getAppSettings(\n `${process.env.VTEX_APP_ID}`\n )\n\n if (!targetWorkspace || targetWorkspace === workspace) {\n return next()\n }\n\n // instance new client for target workspace\n const broadcasterClient = new BroadcasterClient(\n {\n ...ctx.vtex,\n workspace: targetWorkspace,\n },\n {\n retries: RETRIES,\n timeout: TIMEOUT_MS,\n }\n )\n\n broadcasterClient.notify(payload).catch((error) => {\n if (error?.response?.status === 404) {\n ctx.vtex.logger.warn(\"Target workspace not set or doesn't exist\")\n }\n })\n next()\n}\n\n```" } ]
code_place-components_63825407
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/sl.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Prejemnik\",\n \"place-components.label.country\": \"Država\",\n \"place-components.label.state\": \"Zvezna država\",\n \"place-components.label.city\": \"Mesto\",\n \"place-components.label.neighborhood\": \"Soseska\",\n \"place-components.label.streetRoadAvenue\": \"Ulica, cesta, avenija...\",\n \"place-components.label.numberOption\": \"Številka\",\n \"place-components.label.complement\": \"Dopolnilo\",\n \"place-components.label.stateAbbreviation\": \"Zvezna država\",\n \"place-components.error.fieldRequired\": \"To polje je obvezno\",\n \"place-components.label.withoutNumber\": \"Brez števeilke\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"Uredi\",\n \"place-components.label.province\": \"Provinca\",\n \"place-components.label.department\": \"Oddelek\",\n \"place-components.label.region\": \"Regija\",\n \"place-components.label.community\": \"Skupnost\",\n \"place-components.label.municipality\": \"Občina\",\n \"place-components.label.district\": \"Okrožje\",\n \"place-components.label.locality\": \"Predel\",\n \"place-components.label.ARG\": \"Argentina\",\n \"place-components.label.BRA\": \"Brazilija\",\n \"place-components.label.BOL\": \"Bolivija\",\n \"place-components.label.KOR\": \"Koreja\",\n \"place-components.label.useCurrentLocation\": \"Uporabi trenutno lokacijo\",\n \"place-components.label.postalCode\": \"Poštna številka\",\n \"place-components.error.postalCode\": \"Sporočite veljavno poštno kodo.\",\n \"place-components.label.dontKnowPostalCode\": \"Ne vem svoje poštne številke\",\n \"place-components.label.autocompleteAddress\": \"Naslov (ulica, številka, trg...)\",\n \"place-components.label.autocompleteAddressFail\": \"Nismo našli nobenih rezultatov\"\n}\n\n```" } ]
code_place-components_585d2f4d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/nl.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Ontvanger\",\n \"place-components.label.country\": \"Land\",\n \"place-components.label.state\": \"Staat\",\n \"place-components.label.city\": \"Stad\",\n \"place-components.label.neighborhood\": \"Buurt\",\n \"place-components.label.streetRoadAvenue\": \"Straat, weg, laan...\",\n \"place-components.label.numberOption\": \"Nummer\",\n \"place-components.label.complement\": \"Aanvulling\",\n \"place-components.label.stateAbbreviation\": \"Staat\",\n \"place-components.error.fieldRequired\": \"Dit veld is verplicht\",\n \"place-components.label.withoutNumber\": \"Zonder nummer\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"Bewerk\",\n \"place-components.label.province\": \"Provincie\",\n \"place-components.label.department\": \"Afdeling\",\n \"place-components.label.region\": \"Regio\",\n \"place-components.label.community\": \"Gemeenschap\",\n \"place-components.label.municipality\": \"Gemeente\",\n \"place-components.label.district\": \"Regio\",\n \"place-components.label.locality\": \"Plaats\",\n \"place-components.label.ARG\": \"Argentinië\",\n \"place-components.label.BRA\": \"Brazilië\",\n \"place-components.label.BOL\": \"Bolivia\",\n \"place-components.label.KOR\": \"Korea\",\n \"place-components.label.useCurrentLocation\": \"Gebruik huidige locatie\",\n \"place-components.label.postalCode\": \"Postcode\",\n \"place-components.error.postalCode\": \"Geef een geldige postcode op.\",\n \"place-components.label.dontKnowPostalCode\": \"Ik ken mijn postcode niet\",\n \"place-components.label.autocompleteAddress\": \"Adres (straat, nummer, plein...)\",\n \"place-components.label.autocompleteAddressFail\": \"Geen resultaten gevonden\"\n}\n\n```" } ]
code_place-components_a4eae665
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/ja.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"受取人\",\n \"place-components.label.country\": \"国\",\n \"place-components.label.state\": \"州\",\n \"place-components.label.city\": \"都市\",\n \"place-components.label.neighborhood\": \"近所\",\n \"place-components.label.streetRoadAvenue\": \"通り、道、アベニュー…\",\n \"place-components.label.numberOption\": \"番号\",\n \"place-components.label.complement\": \"補足\",\n \"place-components.label.stateAbbreviation\": \"州\",\n \"place-components.error.fieldRequired\": \"このフィールドは必須です\",\n \"place-components.label.withoutNumber\": \"数字なし\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"編集する\",\n \"place-components.label.province\": \"県\",\n \"place-components.label.department\": \"部門\",\n \"place-components.label.region\": \"地域\",\n \"place-components.label.community\": \"コミュニティ\",\n \"place-components.label.municipality\": \"自治体\",\n \"place-components.label.district\": \"地区\",\n \"place-components.label.locality\": \"地方\",\n \"place-components.label.ARG\": \"アルゼンチン\",\n \"place-components.label.BRA\": \"ブラジル\",\n \"place-components.label.BOL\": \"ボリビア\",\n \"place-components.label.KOR\": \"大韓民国\",\n \"place-components.label.useCurrentLocation\": \"現在のロケーションを使う\",\n \"place-components.label.postalCode\": \"郵便番号\",\n \"place-components.error.postalCode\": \"有効な郵便番号を知らせてください。\",\n \"place-components.label.dontKnowPostalCode\": \"郵便番号が分かりません\",\n \"place-components.label.autocompleteAddress\": \"住所 (通り、番地、街区…)\",\n \"place-components.label.autocompleteAddressFail\": \"結果が見つかりません\"\n}\n\n```" } ]
code_place-components_1ada14eb
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/uk.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Одержувач\",\n \"place-components.label.country\": \"Країна\",\n \"place-components.label.state\": \"Штат\",\n \"place-components.label.city\": \"Місто\",\n \"place-components.label.neighborhood\": \"Мікрорайон\",\n \"place-components.label.streetRoadAvenue\": \"Вулиця, проспект, провулок...\",\n \"place-components.label.numberOption\": \"Номер\",\n \"place-components.label.complement\": \"Доповнення\",\n \"place-components.label.stateAbbreviation\": \"Штат\",\n \"place-components.error.fieldRequired\": \"Це поле обов’язкове\",\n \"place-components.label.withoutNumber\": \"Без номера\",\n \"place-components.label.wn\": \"Б/Н\",\n \"place-components.label.edit\": \"Редагувати\",\n \"place-components.label.province\": \"Провінція\",\n \"place-components.label.department\": \"Округ (якщо є)\",\n \"place-components.label.region\": \"Область\",\n \"place-components.label.community\": \"Мікрорайон\",\n \"place-components.label.municipality\": \"Муніципалітет\",\n \"place-components.label.district\": \"Район\",\n \"place-components.label.locality\": \"Населений пункт\",\n \"place-components.label.ARG\": \"Аргентина\",\n \"place-components.label.BRA\": \"Бразилія\",\n \"place-components.label.BOL\": \"Болівія\",\n \"place-components.label.KOR\": \"Корея\",\n \"place-components.label.useCurrentLocation\": \"Використовувати поточне місцезнаходження\",\n \"place-components.label.postalCode\": \"Поштовий індекс\",\n \"place-components.error.postalCode\": \"Вкажіть правильний поштовий індекс.\",\n \"place-components.label.dontKnowPostalCode\": \"Я не знаю свого поштового індексу\",\n \"place-components.label.autocompleteAddress\": \"Адреса (вулиця, номер...)\",\n \"place-components.label.autocompleteAddressFail\": \"Результати не знайдено\"\n}\n\n```" } ]
code_place-components_aaffd1e4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/fi.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Vastaanottaja\",\n \"place-components.label.country\": \"Maa\",\n \"place-components.label.state\": \"Osavaltio\",\n \"place-components.label.city\": \"Kaupunki\",\n \"place-components.label.neighborhood\": \"Alue\",\n \"place-components.label.streetRoadAvenue\": \"Katu\",\n \"place-components.label.numberOption\": \"Numero\",\n \"place-components.label.complement\": \"Täydennä\",\n \"place-components.label.stateAbbreviation\": \"Osavaltio\",\n \"place-components.error.fieldRequired\": \"Tämä kenttä on pakollinen\",\n \"place-components.label.withoutNumber\": \"Ilman numeroa\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"Muokkaa\",\n \"place-components.label.province\": \"Lääni\",\n \"place-components.label.department\": \"Osasto\",\n \"place-components.label.region\": \"Maakunta\",\n \"place-components.label.community\": \"Kunta\",\n \"place-components.label.municipality\": \"Kunta\",\n \"place-components.label.district\": \"Kaupunginosa\",\n \"place-components.label.locality\": \"Paikkakunta\",\n \"place-components.label.ARG\": \"Argentiina\",\n \"place-components.label.BRA\": \"Brasilia\",\n \"place-components.label.BOL\": \"Bolivia\",\n \"place-components.label.KOR\": \"Korea\",\n \"place-components.label.useCurrentLocation\": \"Käytä nykyistä sijaintia\",\n \"place-components.label.postalCode\": \"Postinumero\",\n \"place-components.error.postalCode\": \"Anna kelpaava postinumero.\",\n \"place-components.label.dontKnowPostalCode\": \"En tiedä postinumeroani\",\n \"place-components.label.autocompleteAddress\": \"Osoite (katu, numero...)\",\n \"place-components.label.autocompleteAddressFail\": \"Tuloksia ei löytynyt\"\n}\n\n```" } ]
code_place-components_27905be4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/sk.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Príjemca\",\n \"place-components.label.country\": \"Krajina\",\n \"place-components.label.state\": \"Štát\",\n \"place-components.label.city\": \"Mesto\",\n \"place-components.label.neighborhood\": \"Štvrť\",\n \"place-components.label.streetRoadAvenue\": \"Názov ulice...\",\n \"place-components.label.numberOption\": \"Číslo\",\n \"place-components.label.complement\": \"Dodatok\",\n \"place-components.label.stateAbbreviation\": \"Štát\",\n \"place-components.error.fieldRequired\": \"Toto pole je povinné\",\n \"place-components.label.withoutNumber\": \"Bez čísla\",\n \"place-components.label.wn\": \"S číslom\",\n \"place-components.label.edit\": \"Upraviť\",\n \"place-components.label.province\": \"Provincia\",\n \"place-components.label.department\": \"Departement\",\n \"place-components.label.region\": \"Región\",\n \"place-components.label.community\": \"Komunita\",\n \"place-components.label.municipality\": \"Samospráva\",\n \"place-components.label.district\": \"Oblasť\",\n \"place-components.label.locality\": \"Lokalita\",\n \"place-components.label.ARG\": \"Argentína\",\n \"place-components.label.BRA\": \"Brazília\",\n \"place-components.label.BOL\": \"Bolívia\",\n \"place-components.label.KOR\": \"Kórea\",\n \"place-components.label.useCurrentLocation\": \"Použiť aktuálnu polohu\",\n \"place-components.label.postalCode\": \"PSČ\",\n \"place-components.error.postalCode\": \"Zadajte platné poštové smerovacie číslo.\",\n \"place-components.label.dontKnowPostalCode\": \"Neviem PSČ\",\n \"place-components.label.autocompleteAddress\": \"Adresa (ulica, číslo, námestie…)\",\n \"place-components.label.autocompleteAddressFail\": \"Nenašli sa žiadne výsledky\"\n}\n\n```" } ]
code_place-components_63896a0c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/pt.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Destinatário\",\n \"place-components.label.country\": \"País\",\n \"place-components.label.state\": \"Estado\",\n \"place-components.label.city\": \"Cidade\",\n \"place-components.label.neighborhood\": \"Bairro\",\n \"place-components.label.streetRoadAvenue\": \"Rua, Avenida...\",\n \"place-components.label.numberOption\": \"Número\",\n \"place-components.label.complement\": \"Complemento\",\n \"place-components.label.stateAbbreviation\": \"Estado\",\n \"place-components.error.fieldRequired\": \"Este campo é obrigatório\",\n \"place-components.label.withoutNumber\": \"Sem número\",\n \"place-components.label.wn\": \"S/N\",\n \"place-components.label.edit\": \"Editar\",\n \"place-components.label.province\": \"Província\",\n \"place-components.label.department\": \"Departamento\",\n \"place-components.label.region\": \"Região\",\n \"place-components.label.community\": \"Comunidade\",\n \"place-components.label.municipality\": \"Municipalidade\",\n \"place-components.label.district\": \"Distrito\",\n \"place-components.label.locality\": \"Localidade\",\n \"place-components.label.ARG\": \"Argentina\",\n \"place-components.label.BRA\": \"Brasil\",\n \"place-components.label.BOL\": \"Bolivia\",\n \"place-components.label.KOR\": \"Coreia do Sul\",\n \"place-components.label.useCurrentLocation\": \"Usar localização atual\",\n \"place-components.label.postalCode\": \"CEP\",\n \"place-components.error.postalCode\": \"Informe um CEP válido.\",\n \"place-components.label.dontKnowPostalCode\": \"Não sei meu CEP\",\n \"place-components.label.autocompleteAddress\": \"Endereço (rua, número, quadra...)\",\n \"place-components.label.autocompleteAddressFail\": \"Nenhum resultado encontrado\"\n}\n\n```" } ]
code_place-components_3de063b0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/en.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Receiver\",\n \"place-components.label.country\": \"Country\",\n \"place-components.label.state\": \"State\",\n \"place-components.label.city\": \"City\",\n \"place-components.label.neighborhood\": \"Neighborhood\",\n \"place-components.label.streetRoadAvenue\": \"Street, Road, Avenue...\",\n \"place-components.label.numberOption\": \"Number\",\n \"place-components.label.complement\": \"Complement\",\n \"place-components.label.stateAbbreviation\": \"State\",\n \"place-components.error.fieldRequired\": \"This field is required\",\n \"place-components.label.withoutNumber\": \"Without number\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"Edit\",\n \"place-components.label.province\": \"Province\",\n \"place-components.label.department\": \"Department\",\n \"place-components.label.region\": \"Region\",\n \"place-components.label.community\": \"Community\",\n \"place-components.label.municipality\": \"Municipality\",\n \"place-components.label.district\": \"District\",\n \"place-components.label.locality\": \"Locality\",\n \"place-components.label.ARG\": \"Argentina\",\n \"place-components.label.BRA\": \"Brazil\",\n \"place-components.label.BOL\": \"Bolivia\",\n \"place-components.label.KOR\": \"Korea\",\n \"place-components.label.useCurrentLocation\": \"Use current location\",\n \"place-components.label.postalCode\": \"Postal Code\",\n \"place-components.error.postalCode\": \"Inform a valid postal code.\",\n \"place-components.label.dontKnowPostalCode\": \"I don't know my postal code\",\n \"place-components.label.autocompleteAddress\": \"Address (street, number, square...)\",\n \"place-components.label.autocompleteAddressFail\": \"No results found\"\n}\n\n```" } ]
code_place-components_91c41bf4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/fr.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Destinataire\",\n \"place-components.label.country\": \"Pays\",\n \"place-components.label.state\": \"État\",\n \"place-components.label.city\": \"Ville\",\n \"place-components.label.neighborhood\": \"Voisinage\",\n \"place-components.label.streetRoadAvenue\": \"Rue, Route, Avenue...\",\n \"place-components.label.numberOption\": \"Numéro\",\n \"place-components.label.complement\": \"Complément\",\n \"place-components.label.stateAbbreviation\": \"État\",\n \"place-components.error.fieldRequired\": \"Ce champ est obligatoire\",\n \"place-components.label.withoutNumber\": \"Sans numéro\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"Modifier\",\n \"place-components.label.province\": \"Province\",\n \"place-components.label.department\": \"Département\",\n \"place-components.label.region\": \"Région\",\n \"place-components.label.community\": \"Agglomération\",\n \"place-components.label.municipality\": \"Municipalité\",\n \"place-components.label.district\": \"Quartier\",\n \"place-components.label.locality\": \"Lieu-dit\",\n \"place-components.label.ARG\": \"Argentine\",\n \"place-components.label.BRA\": \"Brésil\",\n \"place-components.label.BOL\": \"Bolivie\",\n \"place-components.label.KOR\": \"Korea\",\n \"place-components.label.useCurrentLocation\": \"Utiliser la position actuelle\",\n \"place-components.label.postalCode\": \"Code postal\",\n \"place-components.error.postalCode\": \"Code postal non valable.\",\n \"place-components.label.dontKnowPostalCode\": \"Je ne connais pas mon code postal\",\n \"place-components.label.autocompleteAddress\": \"Adresse (rue, numéro, quartier...)\",\n \"place-components.label.autocompleteAddressFail\": \"Aucun résultat\"\n}\n\n```" } ]
code_place-components_6e72605c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/el.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Παραλήπτης\",\n \"place-components.label.country\": \"Χώρα\",\n \"place-components.label.state\": \"Πολιτεία\",\n \"place-components.label.city\": \"Πόλη\",\n \"place-components.label.neighborhood\": \"Γειτονιά\",\n \"place-components.label.streetRoadAvenue\": \"Οδός, δρόμος, λεωφόρος...\",\n \"place-components.label.numberOption\": \"Αριθμός\",\n \"place-components.label.complement\": \"Συμπλήρωμα\",\n \"place-components.label.stateAbbreviation\": \"Πολιτεία\",\n \"place-components.error.fieldRequired\": \"Αυτό το πεδίο είναι υποχρεωτικό\",\n \"place-components.label.withoutNumber\": \"Χωρίς αριθμό\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"Επεξεργασία\",\n \"place-components.label.province\": \"Επαρχία\",\n \"place-components.label.department\": \"Τμήμα\",\n \"place-components.label.region\": \"Περιοχή\",\n \"place-components.label.community\": \"Κοινότητα\",\n \"place-components.label.municipality\": \"Δήμος\",\n \"place-components.label.district\": \"Περιοχή\",\n \"place-components.label.locality\": \"Τοποθεσία\",\n \"place-components.label.ARG\": \"Αργεντινή\",\n \"place-components.label.BRA\": \"Βραζιλία\",\n \"place-components.label.BOL\": \"Βολιβία\",\n \"place-components.label.KOR\": \"Κορέα\",\n \"place-components.label.useCurrentLocation\": \"Χρήση τρέχουσας τοποθεσίας\",\n \"place-components.label.postalCode\": \"Ταχυδρομικός κώδικας\",\n \"place-components.error.postalCode\": \"Ενημέρωση εγκύρου ταχυδρομικού κώδικα.\",\n \"place-components.label.dontKnowPostalCode\": \"Δεν γνωρίζω τον ταχυδρομικό μου κώδικα\",\n \"place-components.label.autocompleteAddress\": \"Διεύθυνση (οδός, αριθμός, πλατεία...)\",\n \"place-components.label.autocompleteAddressFail\": \"Δεν βρέθηκαν αποτελέσματα\"\n}\n\n```" } ]
code_place-components_e9637e16
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/ro.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Destinatar\",\n \"place-components.label.country\": \"Țara\",\n \"place-components.label.state\": \"Stat\",\n \"place-components.label.city\": \"Oraș\",\n \"place-components.label.neighborhood\": \"Cartier\",\n \"place-components.label.streetRoadAvenue\": \"Stradă, alee, bulevard...\",\n \"place-components.label.numberOption\": \"Număr\",\n \"place-components.label.complement\": \"Complement\",\n \"place-components.label.stateAbbreviation\": \"Stat\",\n \"place-components.error.fieldRequired\": \"Acest câmp este obligatoriu\",\n \"place-components.label.withoutNumber\": \"Fără număr\",\n \"place-components.label.wn\": \"Fără număr\",\n \"place-components.label.edit\": \"Editează\",\n \"place-components.label.province\": \"Provincie\",\n \"place-components.label.department\": \"Raion\",\n \"place-components.label.region\": \"Regiune\",\n \"place-components.label.community\": \"Sat\",\n \"place-components.label.municipality\": \"Municipalitate\",\n \"place-components.label.district\": \"Sector\",\n \"place-components.label.locality\": \"Localitate\",\n \"place-components.label.ARG\": \"Argentina\",\n \"place-components.label.BRA\": \"Brazilia\",\n \"place-components.label.BOL\": \"Bolivia\",\n \"place-components.label.KOR\": \"Coreea\",\n \"place-components.label.useCurrentLocation\": \"Folosește locația actuală\",\n \"place-components.label.postalCode\": \"Cod poștal\",\n \"place-components.error.postalCode\": \"Introdu un cod poștal valid.\",\n \"place-components.label.dontKnowPostalCode\": \"Nu îmi știu codul poștal\",\n \"place-components.label.autocompleteAddress\": \"Adresa (stradă, număr, piață...)\",\n \"place-components.label.autocompleteAddressFail\": \"Nu s-au găsit rezultate\"\n}\n\n```" } ]
code_place-components_3e8d99c9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/ko.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"받는 사람\",\n \"place-components.label.country\": \"국가\",\n \"place-components.label.state\": \"주\",\n \"place-components.label.city\": \"도시\",\n \"place-components.label.neighborhood\": \"인근 지역\",\n \"place-components.label.streetRoadAvenue\": \"거리, 도로...\",\n \"place-components.label.numberOption\": \"숫자\",\n \"place-components.label.complement\": \"보완\",\n \"place-components.label.stateAbbreviation\": \"주\",\n \"place-components.error.fieldRequired\": \"해당 입력란은 필수 입력 사항입니다\",\n \"place-components.label.withoutNumber\": \"숫자없이\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"편집\",\n \"place-components.label.province\": \"주\",\n \"place-components.label.department\": \"부문\",\n \"place-components.label.region\": \"지역\",\n \"place-components.label.community\": \"커뮤니티\",\n \"place-components.label.municipality\": \"시\",\n \"place-components.label.district\": \"지역\",\n \"place-components.label.locality\": \"인근\",\n \"place-components.label.ARG\": \"아르헨티나\",\n \"place-components.label.BRA\": \"브라질\",\n \"place-components.label.BOL\": \"볼리비아\",\n \"place-components.label.KOR\": \"한국\",\n \"place-components.label.useCurrentLocation\": \"현재 위치 사용\",\n \"place-components.label.postalCode\": \"우편번호\",\n \"place-components.error.postalCode\": \"유효한 우편 번호를 알려 주세요.\",\n \"place-components.label.dontKnowPostalCode\": \"우편 번호를 모릅니다\",\n \"place-components.label.autocompleteAddress\": \"주소(거리, 번호, 스퀘어...)\",\n \"place-components.label.autocompleteAddressFail\": \"결과를 찾을 수 없음\"\n}\n\n```" } ]
code_place-components_59931668
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/no.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Mottaker\",\n \"place-components.label.country\": \"Land\",\n \"place-components.label.state\": \"Stat\",\n \"place-components.label.city\": \"By\",\n \"place-components.label.neighborhood\": \"Nabolag\",\n \"place-components.label.streetRoadAvenue\": \"Gate, vei, allé ...\",\n \"place-components.label.numberOption\": \"Nummer\",\n \"place-components.label.complement\": \"Komplement\",\n \"place-components.label.stateAbbreviation\": \"Stat\",\n \"place-components.error.fieldRequired\": \"Dette feltet er obligatorisk\",\n \"place-components.label.withoutNumber\": \"Uten nummer\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"Rediger\",\n \"place-components.label.province\": \"Provins\",\n \"place-components.label.department\": \"Avdeling\",\n \"place-components.label.region\": \"Region\",\n \"place-components.label.community\": \"Samfunn\",\n \"place-components.label.municipality\": \"Kommune\",\n \"place-components.label.district\": \"Distrikt\",\n \"place-components.label.locality\": \"Lokalitet\",\n \"place-components.label.ARG\": \"Argentina\",\n \"place-components.label.BRA\": \"Brasil\",\n \"place-components.label.BOL\": \"Bolivia\",\n \"place-components.label.KOR\": \"Korea\",\n \"place-components.label.useCurrentLocation\": \"Bruk nåværende posisjon\",\n \"place-components.label.postalCode\": \"Postnummer\",\n \"place-components.error.postalCode\": \"Informer om gyldig postnummer.\",\n \"place-components.label.dontKnowPostalCode\": \"Jeg vet ikke postnummeret mitt\",\n \"place-components.label.autocompleteAddress\": \"Adresse (gate, nummer, plass...)\",\n \"place-components.label.autocompleteAddressFail\": \"Fant ingen resultater\"\n}\n\n```" } ]
code_place-components_020a9979
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/da.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Modtager\",\n \"place-components.label.country\": \"Land\",\n \"place-components.label.state\": \"Stat\",\n \"place-components.label.city\": \"By\",\n \"place-components.label.neighborhood\": \"Nabolag\",\n \"place-components.label.streetRoadAvenue\": \"Gade, vej, boulevard...\",\n \"place-components.label.numberOption\": \"Nummer\",\n \"place-components.label.complement\": \"Udførsel\",\n \"place-components.label.stateAbbreviation\": \"Stat\",\n \"place-components.error.fieldRequired\": \"Dette felt er påkrævet\",\n \"place-components.label.withoutNumber\": \"Uden nummer\",\n \"place-components.label.wn\": \"W/N\",\n \"place-components.label.edit\": \"Rediger\",\n \"place-components.label.province\": \"Provins\",\n \"place-components.label.department\": \"Afdeling\",\n \"place-components.label.region\": \"Region\",\n \"place-components.label.community\": \"Fællesskab\",\n \"place-components.label.municipality\": \"Kommune\",\n \"place-components.label.district\": \"Distrikt\",\n \"place-components.label.locality\": \"Lokalitet\",\n \"place-components.label.ARG\": \"Argentina\",\n \"place-components.label.BRA\": \"Brasilien\",\n \"place-components.label.BOL\": \"Bolivia\",\n \"place-components.label.KOR\": \"Korea\",\n \"place-components.label.useCurrentLocation\": \"Brug nuværende placering\",\n \"place-components.label.postalCode\": \"Postnummer\",\n \"place-components.error.postalCode\": \"Skriv et gyldigt postnummer.\",\n \"place-components.label.dontKnowPostalCode\": \"Jeg kender ikke min postnummer\",\n \"place-components.label.autocompleteAddress\": \"Adresse (gade, nummer, torv...)\",\n \"place-components.label.autocompleteAddressFail\": \"Ingen resultater blev fundet\"\n}\n\n```" } ]
code_place-components_6896330a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/messages/es.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"place-components.label.receiverName\": \"Destinatario\",\n \"place-components.label.country\": \"País\",\n \"place-components.label.state\": \"Estado\",\n \"place-components.label.city\": \"Ciudad\",\n \"place-components.label.neighborhood\": \"Barrio\",\n \"place-components.label.streetRoadAvenue\": \"Calle, Avenida...\",\n \"place-components.label.numberOption\": \"Número\",\n \"place-components.label.complement\": \"Complemento\",\n \"place-components.label.stateAbbreviation\": \"Estado\",\n \"place-components.error.fieldRequired\": \"Este campo es obligatorio\",\n \"place-components.label.withoutNumber\": \"Sin número\",\n \"place-components.label.wn\": \"S/N\",\n \"place-components.label.edit\": \"Editar\",\n \"place-components.label.province\": \"Provincia\",\n \"place-components.label.department\": \"Departamento\",\n \"place-components.label.region\": \"Región\",\n \"place-components.label.community\": \"Comunidad\",\n \"place-components.label.municipality\": \"Municipalidad\",\n \"place-components.label.district\": \"Distrito\",\n \"place-components.label.locality\": \"Localidad\",\n \"place-components.label.ARG\": \"Argentina\",\n \"place-components.label.BRA\": \"Brasil\",\n \"place-components.label.BOL\": \"Bolivia\",\n \"place-components.label.KOR\": \"Corea del Sur\",\n \"place-components.label.useCurrentLocation\": \"Usar ubicación actual\",\n \"place-components.label.postalCode\": \"Código Postal\",\n \"place-components.error.postalCode\": \"Ingresse un código postal válido.\",\n \"place-components.label.dontKnowPostalCode\": \"No sé mi código postal\",\n \"place-components.label.autocompleteAddress\": \"Dirección (calle, número, plaza...)\",\n \"place-components.label.autocompleteAddressFail\": \"Sin resultados\"\n}\n\n```" } ]
code_place-components_333c2b46
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/docs/README.md from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# Place Components\n\n⚠️ **This is an ongoing, unsupported, unfinished and undocumented project. We do not guarantee any results after installation.** ⚠️\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nThe Place Components are three components (`PlaceDetails`, `AddressForm`, and `LocationForm`) that are meant to replace the [AddressForm](https://github.com/vtex/address-form) repository.\n\nThe Place Components should always be rendered inside their wrapper orchestrator, called [AddressContext](https://github.com/vtex-apps/address-context). This orchestrator provides the address information and an API to alter it.\n\nFor all the following components, you can run tests with `vtex test` from the root repository.\n\nTo manually test internationalization, you can switch the locale information by adding the query string `?cultureInfo={locale}`, like `?cultureInfo=en`. More information in the [Locale Switcher repository](https://github.com/vtex-apps/locale-switcher).\n\nCountry data is sorted according to [Figma designs](https://www.figma.com/file/umwHrHA8nifvQIPEN3DHpX/Onda-Store---Place-Components?node-id=0%3A1) for this project, more specifically, to the [spreadsheet](https://docs.google.com/spreadsheets/d/1_sbwzLlgzFPsddPRTq6kcpbMyoxgOBfb1T8YRQs3k7k/edit#gid=0) defining the mapping between the API names and the \"fantasy\" names. This fantasy name is explicitly set in the \"label\" property, and that one is always placed first. The fantasy name of the field determines the styling it receives.\n\n## Place Details\n\nThe Place Details component displays a summary of a place according to the address it receives from the wrapper orchestrator, and the description of the structure that receives as prop. There are three variations of PlaceDetails according to the amount of information that needs to be shown in a particular scenario. Below you can see a description of them.\n\n- **Extended**: complete address, with all information that's necessary for carriers and users to identify it.\n- **Compact**: displays details gathered through LocationForm or from its info.\n- **Minimal**: only the information that the user inputed in LocationInput or LocationSelect.\n\n## Address Form\n\nThe Address Form component displays inputs and selects to add/edit information contained in the `Address` object it receives from the wrapper orchestrator, and it also displays already filled data using the `PlaceDetails` component.\n\nAt first, the `AddressForm` renders a `PlaceDetails` with compact display mode, and edit button, and the rest of the fields as inputs/selects to complete the information. When the user clicks the edit button, it changes to render a `PlaceDetails` component in minimal display mode, and the rest of the fields as inputs/selects.\n\nIn the previous [AddressForm](https://github.com/vtex/address-form) repository, some of the fields are rendered as dropdowns, and some of those dropdowns depend on another (imagine selecting state, and then selecting city). In the new place components, that complex logic is only meant for the `LocationForm` (that is, when first selecting the address).\n\n## Location Form\n\nThe Location Form is a component that is used when the user wants to **inserts** address information to a system, it's built up of many components.\n\n### LocationCountry\n\nThe Location Country component is meant to replace the current `CountrySelector` component from Checkout V6. It's main task is to let the user select a country, and it has the added functionality of trying to guess a suitable country so that the user is not bothered in selecting such a (nowadays) obvious-to-get information.\n\n### LocationForm\n\nThe Location Form component gathers the most basic details about a particular address, and it is formed by three inner components.\n\n#### LocationField (Search)\n\nThe Location Search is a component that suggests a list of addresses based on a search term. A plug and play feature allows the usage of a custom address database and search algorithm (this feature is currently under construction).\n\n#### LocationField (Input)\n\nTo be done.\n\n#### LocationField (Select)\n\nThe LocationField Select renders a set of select components (called `Dropdown` in our styleguide) such that one depends on the other. This is used, for example, to first display a list of states, and based on that selection of states then display a list of cities, and based on the selected cities, to display a list of neighborhoods, etc.\n\n### DeviceCoordinates\n\nThe `DeviceCoordinates` component renders a simple button that will ask for your permission to get the location from your device. In case the user allows this, the component will modify the address object from the `address-context` automatically filling data based on the lat/lng information gained through the browser. To do this autocompletion, this component communicates with the `places-graphql` project.\n\n## Configuration \n\nTBC\n\n## Customization\n\n🚧 To be defined.\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n<!-- DOCS-IGNORE:end -->\n\n```" } ]
code_place-components_78fd0455
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/formatAddressToString.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Address } from 'vtex.checkout-graphql'\nimport { CountryRules, AddressFields } from 'vtex.address-context/types'\nimport msk from 'msk'\nimport { DisplayData } from 'vtex.country-data-settings'\n\nimport { FieldName } from './useAddressForm'\n\nconst isAddressField = (field: string): field is AddressFields =>\n (field as AddressFields) !== undefined\n\nexport default function formatAddressToString(\n address: Address,\n rules: CountryRules,\n displayType: keyof Omit<DisplayData, '__typename'> = 'compact'\n) {\n const displaySpec = rules.display[displayType]\n\n return displaySpec\n .map((line) =>\n line.filter(({ name }) => isAddressField(name) && address[name])\n )\n .filter((line) => line.length > 0)\n .map((line) =>\n line\n .map((fragment, index) => {\n const hasPreviousFragment =\n index > 0 && address[line[index - 1].name as FieldName]\n\n const hasNextFragment =\n index + 1 < line.length &&\n address[line[index + 1].name as FieldName]\n\n const hasDifferentDelimiter = fragment.delimiterAfter !== '-'\n const shouldShowDelimiter = hasNextFragment ?? hasDifferentDelimiter\n\n const valueMask =\n fragment.name in rules.fields\n ? rules.fields[fragment.name as FieldName]?.mask\n : undefined\n\n const fragmentValue = valueMask\n ? msk(address[fragment.name as FieldName] as string, valueMask)\n : address[fragment.name as FieldName]\n\n return [\n hasPreviousFragment && fragment.delimiter,\n fragmentValue,\n shouldShowDelimiter && fragment.delimiterAfter,\n ]\n .filter(Boolean)\n .join(' ')\n })\n .join(' ')\n )\n .join(' ')\n}\n\n```" } ]
code_place-components_06835c36
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/LocationInput.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState, useEffect, useCallback, useRef } from 'react'\nimport { useAddressContext } from 'vtex.address-context/AddressContext'\nimport { IconSearch, Input, Button, ButtonPlain } from 'vtex.styleguide'\nimport { FormattedMessage, useIntl } from 'react-intl'\nimport { useLazyQuery } from 'react-apollo'\nimport msk from 'msk'\nimport {\n Address,\n Query,\n QueryGetAddressFromPostalCodeArgs,\n} from 'vtex.places-graphql'\n\nimport GET_ADDRESS_FROM_POSTAL_CODE from './graphql/getAddressFromPostalCode.graphql'\nimport styles from './LocationInput.css'\nimport { useCountry } from './useCountry'\n\ninterface Props {\n onSuccess?: (address: Address) => void | Promise<void>\n variation?: 'primary' | 'secondary'\n}\n\nconst LocationInput: React.FC<Props> = ({\n variation = 'secondary',\n onSuccess,\n}) => {\n const { setAddress, rules } = useAddressContext()\n const intl = useIntl()\n const [inputValue, setInputValue] = useState('')\n // the network-only fetch policy asserts that if an incorrect postal code\n // has been submitted twice in a row, it won't return the cached error,\n // re-triggering the effect hook and avoiding an infinite loop state\n const [executeGetAddressFromPostalCode, { error, data }] = useLazyQuery<\n Query,\n QueryGetAddressFromPostalCodeArgs\n >(GET_ADDRESS_FROM_POSTAL_CODE, { fetchPolicy: 'network-only' })\n\n const [loading, setLoading] = useState(false)\n const [invalidPostalCode, setInvalidPostalCode] = useState(false)\n\n const country = useCountry()\n const countryRules = rules[country]\n\n const prevCountryRulesRef = useRef(countryRules)\n\n const formatAndValidate = useCallback(() => {\n const { mask, pattern } = countryRules?.fields.postalCode ?? {}\n\n if (!mask) {\n return\n }\n\n setInputValue(msk(inputValue, mask))\n const patternInvalid =\n inputValue.length && pattern && !inputValue.match(pattern)\n\n if (patternInvalid) {\n setInvalidPostalCode(true)\n }\n }, [countryRules?.fields.postalCode, inputValue])\n\n useEffect(() => {\n if (prevCountryRulesRef.current === countryRules) {\n return\n }\n\n prevCountryRulesRef.current = countryRules\n setInvalidPostalCode(false)\n formatAndValidate()\n }, [countryRules, formatAndValidate])\n\n useEffect(() => {\n let cancelled = false\n\n if (data?.getAddressFromPostalCode) {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n ;(onSuccess?.(data.getAddressFromPostalCode) || Promise.resolve())\n .then(() => {\n setAddress((prevAddress) => ({\n ...prevAddress,\n ...data.getAddressFromPostalCode,\n }))\n\n if (cancelled) {\n return\n }\n\n setLoading(false)\n })\n .catch(() => {\n if (cancelled) {\n return\n }\n\n setInvalidPostalCode(true)\n setLoading(false)\n })\n }\n\n if (error) {\n console.error(error.message)\n setInvalidPostalCode(true)\n setLoading(false)\n }\n\n return () => {\n cancelled = true\n }\n }, [data, error, onSuccess, setAddress])\n\n const handleSubmit: React.EventHandler<\n React.FormEvent<HTMLFormElement> | React.MouseEvent<HTMLButtonElement>\n > = (event) => {\n event.preventDefault()\n if (invalidPostalCode) {\n return\n }\n\n setLoading(true)\n executeGetAddressFromPostalCode({\n variables: {\n postalCode: inputValue,\n countryCode: country,\n },\n })\n }\n\n const handleInputChange: React.ChangeEventHandler<HTMLInputElement> = (\n event\n ) => {\n if (invalidPostalCode) {\n setInvalidPostalCode(false)\n }\n\n setInputValue(event.target.value)\n }\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (\n event\n ) => {\n if (event.key === 'Enter') {\n formatAndValidate()\n }\n }\n\n if (!countryRules) {\n return null\n }\n\n return (\n <div className=\"w-100\">\n <form className={`${styles.locationInput} mb4`} onSubmit={handleSubmit}>\n <Input\n id=\"postal-code-input\"\n label={<FormattedMessage id=\"place-components.label.postalCode\" />}\n suffix={\n <Button\n id=\"submit-postal-code-button\"\n type=\"submit\"\n onClick={handleSubmit}\n isLoading={loading}\n variation={variation}\n >\n <IconSearch />\n </Button>\n }\n size=\"large\"\n value={inputValue}\n onChange={handleInputChange}\n onBlur={formatAndValidate}\n onKeyDown={handleKeyDown}\n disabled={loading}\n error={invalidPostalCode}\n errorMessage={\n invalidPostalCode\n ? intl.formatMessage({ id: 'place-components.error.postalCode' })\n : undefined\n }\n />\n </form>\n {countryRules.fields.postalCode?.additionalData?.forgottenURL && (\n <ButtonPlain\n href={countryRules.fields.postalCode.additionalData.forgottenURL}\n target=\"_blank noreferrer\"\n >\n <FormattedMessage id=\"place-components.label.dontKnowPostalCode\" />\n </ButtonPlain>\n )}\n </div>\n )\n}\n\nexport default LocationInput\n\n```" } ]
code_place-components_9fb47cd1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/LocationInput.css from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.locationInput :global(.vtex-input) input {\n width: auto;\n flex: 1;\n min-width: 0;\n}\n\n.locationInput :global(.vtex-input__suffix) {\n padding: 0;\n}\n\n.locationInput :global(.vtex-button) {\n min-height: auto;\n margin: .125rem;\n align-self: stretch;\n}\n\n@media only screen and (min-width: 40em) {\n .locationInput :global(.vtex-input-prefix__group) {\n height: 2.5rem;\n }\n\n .locationInput :global(.vtex-button) {\n width: 3.25rem;\n }\n\n .locationInput :global(.vtex-button__label) {\n padding: 0;\n }\n}\n\n```" } ]
code_place-components_41b61c25
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/PlaceDetails.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport msk from 'msk'\nimport React from 'react'\nimport { useAddressContext } from 'vtex.address-context/AddressContext'\nimport { AddressFields } from 'vtex.address-context/types'\nimport { ButtonPlain } from 'vtex.styleguide'\nimport { useIntl, defineMessages } from 'react-intl'\nimport { DisplayData } from 'vtex.country-data-settings'\n\nimport { FieldName } from './useAddressForm'\nimport { useCountry } from './useCountry'\n\ninterface Props {\n display?: keyof Omit<DisplayData, '__typename'>\n hiddenFields?: AddressFields[]\n onEdit?: () => void\n}\n\nconst messages = defineMessages({\n edit: {\n defaultMessage: '',\n id: 'place-components.label.edit',\n },\n})\n\nconst PlaceDetails: React.FC<Props> = ({\n display = 'extended',\n hiddenFields = [],\n onEdit,\n}) => {\n const { address, rules } = useAddressContext()\n const country = useCountry()\n const countryRules = rules[country]\n\n const intl = useIntl()\n\n if (!countryRules) {\n return null\n }\n\n const displaySpec = countryRules.display[display]\n\n return (\n <div className=\"flex flex-column\">\n {displaySpec\n .map((line) => {\n return line.filter(\n (fragment) =>\n address[fragment.name as FieldName] &&\n !hiddenFields.includes(fragment.name as FieldName)\n )\n })\n .filter((line) => line.length > 0)\n .map((line, displayIndex) => (\n <div className=\"flex\" key={displayIndex}>\n {line.map((fragment, index) => {\n const hasPreviousFragment =\n index > 0 && address[line[index - 1].name as FieldName]\n\n const hasNextFragment =\n index + 1 < line.length &&\n address[line[index + 1].name as FieldName]\n\n const hasDifferentDelimiter = fragment.delimiterAfter !== '-'\n const shouldShowDelimiter =\n hasNextFragment ?? hasDifferentDelimiter\n\n const valueMask =\n fragment.name in countryRules.fields\n ? countryRules.fields[fragment.name as FieldName]?.mask\n : undefined\n\n const addressValue = valueMask\n ? msk(address[fragment.name as FieldName] as string, valueMask)\n : address[fragment.name as FieldName]\n\n return (\n <div className=\"dib\" key={fragment.name}>\n {fragment.delimiter && hasPreviousFragment && (\n <span style={{ whiteSpace: 'pre-wrap' }}>\n {fragment.delimiter}\n </span>\n )}\n <span className={fragment.name}>{addressValue}</span>\n {fragment.delimiterAfter && shouldShowDelimiter && (\n <span style={{ whiteSpace: 'pre-wrap' }}>\n {fragment.delimiterAfter}\n </span>\n )}\n </div>\n )\n })}\n {onEdit && displayIndex === 0 && (\n <div className=\"ml4 flex items-center\">\n <ButtonPlain onClick={onEdit}>\n <span className=\"ttl\">\n {intl.formatMessage(messages.edit)}\n </span>\n </ButtonPlain>\n </div>\n )}\n </div>\n ))}\n </div>\n )\n}\n\nexport default PlaceDetails\n\n```" } ]
code_place-components_1d054492
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/AddressForm.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport classnames from 'classnames'\nimport React, { useState, useMemo, useRef } from 'react'\nimport { Input, Dropdown } from 'vtex.styleguide'\nimport { DisplayDefinition } from 'vtex.country-data-settings'\nimport { useAddressContext } from 'vtex.address-context/AddressContext'\nimport { AddressFields, Field } from 'vtex.address-context/types'\nimport { useIntl, defineMessages } from 'react-intl'\n\nimport { useAddressForm, FieldName, FieldsMeta } from './useAddressForm'\nimport { styleRules } from './countries/rules'\nimport PlaceDetails from './PlaceDetails'\nimport NumberOption from './components/NumberOption'\nimport { useCountry } from './useCountry'\n\nconst messages = defineMessages({\n receiverName: {\n id: 'place-components.label.receiverName',\n defaultMessage: 'Receiver',\n },\n country: {\n defaultMessage: '',\n id: 'place-components.label.country',\n },\n state: {\n defaultMessage: '',\n id: 'place-components.label.state',\n },\n city: {\n defaultMessage: '',\n id: 'place-components.label.city',\n },\n neighborhood: {\n defaultMessage: '',\n id: 'place-components.label.neighborhood',\n },\n streetRoadAvenue: {\n defaultMessage: '',\n id: 'place-components.label.streetRoadAvenue',\n },\n numberOption: {\n defaultMessage: '',\n id: 'place-components.label.numberOption',\n },\n complement: {\n defaultMessage: '',\n id: 'place-components.label.complement',\n },\n stateAbbreviation: {\n defaultMessage: '',\n id: 'place-components.label.stateAbbreviation',\n },\n postalCode: {\n defaultMessage: '',\n id: 'place-components.label.postalCode',\n },\n})\n\n/**\n * This utility serves to create a \"diff\" for the fields we will\n * show to the user.\n *\n * For example if the address form is not in a editing state, we will\n * render a place details with the \"extended\" display and we will only\n * show the fields that are *not* in the compact mode. This works by ignoring\n * all fields from the compact mode that are in the extended mode.\n */\nconst getExcludedFields = (\n summary: DisplayDefinition[][],\n includedFields: string[] = []\n) => {\n const excludedFields = new Set<string>()\n\n summary.forEach((line) => {\n line.forEach((fragment) => {\n if (includedFields.includes(fragment.name)) {\n return\n }\n\n excludedFields.add(fragment.name)\n })\n })\n\n return excludedFields\n}\n\ninterface AddressFormProps {\n hiddenFields?: AddressFields[]\n mandatoryEditableFields?: AddressFields[]\n onResetAddress?: () => void\n form?: ReturnType<typeof useAddressForm>\n expanded?: boolean\n onExpandForm?: () => void\n}\n\nconst AddressForm: React.FC<AddressFormProps> = ({\n hiddenFields = [],\n mandatoryEditableFields = [],\n onResetAddress,\n form: propsForm,\n expanded: propsExpanded,\n onExpandForm,\n}) => {\n const intl = useIntl()\n const addressContext = useAddressContext()\n const localForm = useAddressForm({\n initialAddress: addressContext.address,\n onAddressChange: addressContext.setAddress,\n })\n\n const [localExpanded, setLocalExpanded] = useState(false)\n\n const expanded = propsExpanded ?? localExpanded\n\n const form = propsForm ?? localForm\n const address = propsForm?.address ?? addressContext.address\n\n const country = useCountry()\n const countryRules = addressContext.rules[country]\n\n const { fields: countryRulesFields, display } = countryRules ?? {}\n const summary = display?.extended\n\n const handleEditButtonClick = () => {\n if (expanded) {\n onResetAddress?.()\n } else if (onExpandForm != null) {\n onExpandForm()\n } else {\n setLocalExpanded(true)\n }\n }\n\n const displayMode = expanded ? 'minimal' : 'compact'\n\n // The use of `useRef` is to prevent the fields from suddenly disappearing\n // from the form while typing the value\n //\n // For example: if the form is missing the number from the address and the user\n // starts typing the number, since the only validation we do on numbers is to check\n // if the value _exists_, as soon as the first character is typed the field will no\n // longer be invalid causing it to suddenly \"disappear\" from the screen if we don't use\n // the `useRef` hook.\n const initialInvalidFields = useRef([\n ...form.invalidFields,\n ...mandatoryEditableFields,\n ])\n\n const ignoredFields = useMemo(\n () =>\n getExcludedFields(\n display?.[displayMode] ?? [],\n initialInvalidFields.current\n ),\n [display, displayMode]\n )\n\n const handleFieldBlur: React.FocusEventHandler<\n HTMLInputElement | HTMLSelectElement\n > = (evt) => {\n const fieldName = evt.target.name\n\n if (!(fieldName in address)) {\n return\n }\n\n form.onFieldBlur(fieldName as FieldName)\n }\n\n return (\n <div>\n <div className=\"mb6 flex items-baseline lh-copy\">\n <PlaceDetails\n display={displayMode}\n hiddenFields={initialInvalidFields.current as AddressFields[]}\n onEdit={handleEditButtonClick}\n />\n </div>\n <div>\n {summary\n ?.map((line) =>\n line.filter((fragment) => {\n const field = countryRulesFields?.[fragment.name as FieldName]\n\n if (\n !field ||\n ignoredFields.has(fragment.name) ||\n hiddenFields.includes(fragment.name as AddressFields)\n ) {\n return false\n }\n\n return true\n })\n )\n .filter((line) => line.length > 0)\n .map((line, index, renderedSummary) => (\n <div className=\"flex flex-wrap\" key={index}>\n {line.map((fragment, fragmentIndex) => {\n const field = countryRulesFields?.[\n fragment.name as FieldName\n ] as Field\n\n const style = styleRules[field.label]\n\n let fragmentElement = null\n\n const { maxLength, autoComplete, label } = field\n\n const handleChange = (value: string) => {\n form.onFieldChange(fragment.name as FieldName, value)\n }\n\n const handleInputChange: React.ChangeEventHandler<\n HTMLInputElement | HTMLSelectElement\n > = (evt) => {\n handleChange(evt.target.value)\n }\n\n const value = address[fragment.name as FieldName] ?? ''\n\n const fragmentMeta =\n form.meta[fragment.name as keyof FieldsMeta]\n\n const commonProps = {\n label: intl.formatMessage(\n messages[label as keyof typeof messages]\n ),\n value,\n name: fragment.name,\n onBlur: handleFieldBlur,\n ...(maxLength && { maxLength }),\n ...(autoComplete && { autoComplete }),\n ...(fragmentMeta?.blurred && fragmentMeta.errorMessage\n ? {\n errorMessage: intl.formatMessage(\n fragmentMeta.errorMessage\n ),\n }\n : null),\n }\n\n fragmentElement =\n fragment.name === 'number' ? (\n <NumberOption\n {...commonProps}\n onChange={handleChange}\n showCheckbox\n />\n ) : field.options ? (\n <Dropdown\n {...commonProps}\n onChange={handleInputChange}\n options={field.options}\n />\n ) : (\n <Input {...commonProps} onChange={handleInputChange} />\n )\n\n return (\n <div\n className={classnames('flex-auto', {\n mb5: index < renderedSummary.length - 1,\n mr5: fragmentIndex < line.length - 1,\n })}\n style={style}\n key={fragment.name}\n >\n {fragmentElement}\n </div>\n )\n })}\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nexport default AddressForm\n\n```" } ]
code_place-components_41a1774a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/useAddressForm.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { useState, useCallback, useMemo } from 'react'\nimport { defineMessages, MessageDescriptor } from 'react-intl'\nimport { AddressFields } from 'vtex.address-context/types'\nimport Utils from 'vtex.address-context/Utils'\nimport AddressContext from 'vtex.address-context/AddressContext'\nimport { Address } from 'vtex.checkout-graphql'\n\nimport { useCountry } from './useCountry'\n\nconst { createEmptyAddress, validateAddress } = Utils\nconst { useAddressContext } = AddressContext\n\ninterface FieldMeta {\n blurred: boolean\n errorMessage?: MessageDescriptor\n}\n\nexport type FieldName = Exclude<\n AddressFields,\n 'addressId' | 'addressType' | 'isDisposable'\n>\n\nexport type FieldsMeta = {\n [field in FieldName]?: FieldMeta\n}\n\ninterface FormOptions {\n initialAddress?: Address | null\n onAddressChange?: (address: Address) => void\n}\n\nconst messages = defineMessages({\n fieldRequired: {\n defaultMessage: '',\n id: 'place-components.error.fieldRequired',\n },\n})\n\nexport function useAddressForm({\n initialAddress,\n onAddressChange,\n}: FormOptions = {}) {\n const { rules: addressRules } = useAddressContext()\n const [address, setAddress] = useState(initialAddress ?? createEmptyAddress())\n const country = useCountry()\n\n const { isValid, invalidFields } = useMemo(\n () => validateAddress(address, addressRules),\n [address, addressRules]\n )\n\n const [fieldsMeta, setFieldsMeta] = useState<FieldsMeta>(\n Object.fromEntries(\n invalidFields.map((field) => [\n field,\n { errorMessage: messages.fieldRequired },\n ])\n )\n )\n\n const updateFieldMeta = useCallback(\n (fieldName: FieldName, meta: Partial<FieldMeta>) => {\n setFieldsMeta((prevMeta) => ({\n ...prevMeta,\n [fieldName]: {\n ...prevMeta[fieldName],\n ...meta,\n },\n }))\n },\n []\n )\n\n const onFieldBlur = useCallback(\n (fieldName: FieldName) => {\n updateFieldMeta(fieldName, { blurred: true })\n },\n [updateFieldMeta]\n )\n\n const executeFieldValidation = useCallback(\n (name: string, value?: string | boolean | null | Array<number | null>) => {\n const countryRules = addressRules[country]\n\n if (!countryRules) {\n return\n }\n\n const fieldName = name in countryRules.fields ? (name as FieldName) : null\n\n if (!fieldName) {\n return\n }\n\n const fieldRule = countryRules.fields[fieldName]\n\n let errorMessage\n\n if (\n fieldRule?.required &&\n typeof value === 'string' &&\n value.length === 0\n ) {\n errorMessage = messages.fieldRequired\n }\n\n updateFieldMeta(fieldName as FieldName, { errorMessage })\n },\n [country, addressRules, updateFieldMeta]\n )\n\n const onFieldChange = useCallback(\n (fieldName: FieldName, value: string) => {\n const updatedAddress = { ...address, [fieldName]: value }\n\n executeFieldValidation(fieldName, value)\n\n setAddress(updatedAddress)\n onAddressChange?.(updatedAddress)\n },\n [address, onAddressChange, executeFieldValidation]\n )\n\n const updateAddress = useCallback(\n (update: React.SetStateAction<Address>) => {\n setAddress((prevAddress) => {\n let updatedAddress\n\n if (typeof update === 'function') {\n updatedAddress = update(prevAddress)\n } else {\n updatedAddress = update\n }\n\n Object.entries(updatedAddress).forEach(([fieldName, fieldValue]) => {\n executeFieldValidation(fieldName, fieldValue)\n })\n\n return updatedAddress\n })\n },\n [executeFieldValidation]\n )\n\n return {\n address,\n setAddress: updateAddress,\n isValid,\n invalidFields,\n meta: fieldsMeta,\n onFieldBlur,\n onFieldChange,\n }\n}\n\nexport default useAddressForm\n\n```" } ]
code_place-components_2bb5d28a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/useCountry.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { useRuntime } from 'vtex.render-runtime'\nimport { useAddressContext } from 'vtex.address-context/AddressContext'\n\nexport const useCountry = () => {\n const { culture } = useRuntime()\n const { address } = useAddressContext()\n\n // TODO: should also try to get country from:\n // - addresses in account\n // - IP\n return address?.country ?? culture.country\n}\n\n```" } ]
code_place-components_ac13943c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/LocationSelect.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useAddressContext } from 'vtex.address-context/AddressContext'\nimport { Dropdown } from 'vtex.styleguide'\nimport { FormattedMessage, defineMessages } from 'react-intl'\nimport { Address } from 'vtex.checkout-graphql'\nimport { AddressFields } from 'vtex.address-context/types'\n\nimport { useCountry } from './useCountry'\n\nconst messages = defineMessages({\n province: {\n defaultMessage: '',\n id: 'place-components.label.province',\n },\n city: {\n defaultMessage: '',\n id: 'place-components.label.city',\n },\n department: {\n defaultMessage: '',\n id: 'place-components.label.department',\n },\n region: {\n defaultMessage: '',\n id: 'place-components.label.region',\n },\n community: {\n defaultMessage: '',\n id: 'place-components.label.community',\n },\n municipality: {\n defaultMessage: '',\n id: 'place-components.label.municipality',\n },\n district: {\n defaultMessage: '',\n id: 'place-components.label.district',\n },\n state: {\n defaultMessage: '',\n id: 'place-components.label.state',\n },\n locality: {\n defaultMessage: '',\n id: 'place-components.label.locality',\n },\n})\n\nconst LocationSelect: React.FC = () => {\n const { address, setAddress, rules } = useAddressContext()\n const country = useCountry()\n const countryRules = rules[country]\n\n if (!countryRules?.locationSelect) {\n throw new Error(\n `The country \"${country}\" is not applicable to the LocationSelect component`\n )\n }\n\n const { countryData, fields } = countryRules.locationSelect\n\n const addressFields = fields.map(\n (field) => address[field.name as AddressFields]\n )\n\n const firstMissingIdx = addressFields.findIndex((field) => !field)\n const completedFields =\n firstMissingIdx === -1\n ? addressFields\n : addressFields.slice(0, firstMissingIdx)\n\n const getLocationSelects = () => {\n const locationSelects = []\n let currentOptions = countryData\n\n for (let i = 0; i < fields.length; ++i) {\n const field = fields[i]\n const fieldValue = address[field.name as AddressFields]\n\n if (typeof fieldValue !== 'string') {\n continue\n }\n\n locationSelects.push(\n <div className=\"mb5\" key={i}>\n <Dropdown\n label={\n <FormattedMessage\n {...messages[field.label as keyof typeof messages]}\n />\n }\n disabled={i > completedFields.length}\n options={(Array.isArray(currentOptions) // Workaround, fix JSON country data\n ? currentOptions\n : Object.keys(currentOptions)\n ).map((name) => {\n return { label: name, value: name }\n })}\n onChange={({\n target: { value },\n }: React.ChangeEvent<HTMLSelectElement>) => {\n let newFields: { [key: string]: string | null } = {\n [field.name as string]: value,\n }\n\n for (let j = i + 1; j < fields.length; ++j) {\n newFields = { ...newFields, [fields[j].name as string]: null }\n }\n\n setAddress((prevAddress: Address) => ({\n ...prevAddress,\n ...newFields,\n }))\n }}\n placeholder=\"Select...\"\n value={fieldValue}\n />\n </div>\n )\n\n currentOptions = fieldValue\n ? // eslint-disable-next-line @typescript-eslint/ban-types\n currentOptions[fieldValue as keyof object]\n : {}\n }\n\n return locationSelects\n }\n\n return <div>{getLocationSelects()}</div>\n}\n\nexport default LocationSelect\n\n```" } ]
code_place-components_8e615260
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/package.json from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test --testPathIgnorePatterns third_party\"\n },\n \"dependencies\": {\n \"@reach/combobox\": \"^0.10.5\",\n \"classnames\": \"^2.2.6\",\n \"graphql\": \"^14.6.0\",\n \"msk\": \"^1.0.5\",\n \"react\": \"^16.8.3\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.8.3\",\n \"react-intl\": \"3.9.1\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@reach/listbox\": \"^0.10.2\",\n \"@testing-library/dom\": \"^7.29.5\",\n \"@testing-library/user-event\": \"^12.7.1\",\n \"@types/classnames\": \"^2.2.7\",\n \"@types/jest\": \"^26.0.8\",\n \"@types/node\": \"^12.7.5\",\n \"@types/prop-types\": \"^15.7.0\",\n \"@types/react\": \"^16.9.2\",\n \"@vtex/styleguide\": \"^9.112.13\",\n \"@vtex/test-tools\": \"^3.0.2\",\n \"apollo-cache-inmemory\": \"^1.6.6\",\n \"apollo-client\": \"^2.6.10\",\n \"vtex.address-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.address-context@0.6.2/public/@types/vtex.address-context\",\n \"vtex.checkout-components\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-components@0.5.1/public/@types/vtex.checkout-components\",\n \"vtex.checkout-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-graphql@0.56.2/public/@types/vtex.checkout-graphql\",\n \"vtex.country-data-settings\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.country-data-settings@0.4.0/public/@types/vtex.country-data-settings\",\n \"vtex.country-flags\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.country-flags@0.1.1/public/@types/vtex.country-flags\",\n \"vtex.geolocation-graphql-interface\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.geolocation-graphql-interface@0.3.0/public/@types/vtex.geolocation-graphql-interface\",\n \"vtex.places-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.places-graphql@0.4.0/public/@types/vtex.places-graphql\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.126.11/public/@types/vtex.render-runtime\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.135.3/public/@types/vtex.styleguide\"\n },\n \"jest\": {\n \"setupFilesAfterEnv\": [\n \"<rootDir>/setupTests.js\"\n ]\n },\n \"version\": \"0.15.0\"\n}\n\n```" } ]
code_place-components_278bf40f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/LocationCountry.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useEffect, useState } from 'react'\nimport { useAddressContext } from 'vtex.address-context/AddressContext'\nimport { Listbox } from 'vtex.checkout-components'\nimport { CountryFlag } from 'vtex.country-flags'\nimport { defineMessages, useIntl } from 'react-intl'\n\nimport { useCountry } from './useCountry'\n\nconst {\n ListboxInput,\n ListboxButton,\n ListboxPopover,\n ListboxList,\n ListboxOption,\n} = Listbox\n\nconst messages = defineMessages({\n ARG: {\n defaultMessage: '',\n id: 'place-components.label.ARG',\n },\n BRA: {\n defaultMessage: '',\n id: 'place-components.label.BRA',\n },\n BOL: {\n defaultMessage: '',\n id: 'place-components.label.BOL',\n },\n KOR: {\n defaultMessage: '',\n id: 'place-components.label.KOR',\n },\n})\n\nconst renderCountryFlagWithName = ({\n country,\n name,\n}: {\n country: string\n name: string\n}) => (\n <>\n <CountryFlag iso3={country} />\n <span className=\"dib ml3\">{name}</span>\n </>\n)\n\ninterface LocationCountryProps {\n labelId?: string\n className?: string\n}\n\nconst LocationCountry: React.FC<LocationCountryProps> = ({\n labelId = 'location-country',\n className = '',\n}) => {\n const intl = useIntl()\n const { setAddress, countries } = useAddressContext()\n\n const [country, setCountry] = useState(useCountry())\n\n if (country && countries && !countries.includes(country)) {\n throw new Error(\n `The country \"${country}\" doesn't belong to the country list, can't render LocationCountry`\n )\n }\n\n useEffect(() => {\n setAddress((prevAddress) => ({\n ...prevAddress,\n country,\n // reset all other fields related\n // to the country\n city: null,\n complement: null,\n geoCoordinates: null,\n neighborhood: null,\n number: null,\n postalCode: null,\n state: null,\n street: null,\n }))\n }, [country, setAddress])\n\n // Do not render anything if we only have 1 country or none.\n if (countries.length <= 1) {\n return null\n }\n\n return (\n <div className={className}>\n <span\n id={labelId}\n className=\"vtex-input__label db mb3 w-100 c-on-base t-body\"\n >\n {intl.formatMessage({ id: 'place-components.label.country' })}\n </span>\n <ListboxInput\n translate={undefined}\n aria-labelledby={labelId}\n value={country}\n onChange={setCountry}\n >\n <ListboxButton>\n {({ label }) =>\n renderCountryFlagWithName({\n country,\n name: label,\n })\n }\n </ListboxButton>\n <ListboxPopover translate={undefined}>\n <ListboxList>\n {countries.map((countryCode) => {\n const name =\n countryCode in messages\n ? intl.formatMessage(\n messages[countryCode as keyof typeof messages]\n )\n : countryCode\n\n return (\n <ListboxOption\n value={countryCode}\n label={name}\n key={countryCode}\n >\n {renderCountryFlagWithName({\n country: countryCode,\n name,\n })}\n </ListboxOption>\n )\n })}\n </ListboxList>\n </ListboxPopover>\n </ListboxInput>\n </div>\n )\n}\n\nexport default LocationCountry\n\n```" } ]
code_place-components_a0deba2e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/LocationSearch.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState, useRef, useEffect, ReactNode } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport {\n Input,\n IconSearch,\n IconClear,\n IconWarning,\n Spinner,\n} from 'vtex.styleguide'\nimport { positionMatchWidth } from '@reach/popover'\nimport { useAddressContext } from 'vtex.address-context/AddressContext'\nimport { useLazyQuery, useQuery } from 'react-apollo'\nimport {\n Address,\n AddressSuggestion,\n Image,\n Query,\n QueryAddressArgs,\n QueryAddressSuggestionsArgs,\n} from 'vtex.geolocation-graphql-interface'\n\nimport PROVIDER_LOGO from './graphql/providerLogo.graphql'\nimport SESSION_TOKEN from './graphql/sessionToken.graphql'\nimport ADDRESS_SUGGESTIONS from './graphql/addressSuggestions.graphql'\nimport ADDRESS from './graphql/address.graphql'\nimport {\n Combobox,\n ComboboxInput,\n ComboboxOption,\n ComboboxPopover,\n ComboboxList,\n} from './components/Combobox'\nimport PlaceIcon from './components/PlaceIcon'\nimport { useCountry } from './useCountry'\n\nconst DEBOUNCE_DELAY_IN_MS = 500\n\nconst useProviderLogo = (): Image | undefined => {\n const { data, error } = useQuery<Query, never>(PROVIDER_LOGO)\n\n if (error) {\n console.error(error.message)\n }\n\n return data?.providerLogo\n}\n\nconst useDebouncedValue = (value: string, delayInMs: number): string => {\n const [debouncedValue, setDebouncedValue] = useState(value)\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value)\n }, delayInMs)\n\n return () => {\n clearTimeout(handler)\n }\n }, [value, delayInMs])\n\n return debouncedValue\n}\n\nconst useSuggestions = (\n searchTerm: string,\n sessionToken?: string | null,\n country?: string | null\n): [AddressSuggestion[], boolean] => {\n const [executeAddressSuggestions, { data, error, loading }] = useLazyQuery<\n Query,\n QueryAddressSuggestionsArgs\n >(ADDRESS_SUGGESTIONS)\n\n useEffect(() => {\n if (searchTerm.trim().length) {\n executeAddressSuggestions({\n variables: { searchTerm, sessionToken, country },\n })\n }\n // the effect shouldn't be triggered when the sessionToken changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchTerm, country, executeAddressSuggestions])\n\n useEffect(() => {\n if (error) {\n console.error(error.message)\n }\n }, [error])\n\n return [data?.addressSuggestions ?? [], loading]\n}\n\nconst renderSuggestionText = ({\n mainText,\n mainTextMatchInterval: { offset, length },\n secondaryText,\n}: AddressSuggestion) => {\n return (\n <div className=\"truncate c-muted-2\">\n <span className=\"c-on-base\">\n {mainText.substr(0, offset)}\n <span className=\"b\">{mainText.substr(offset, length)}</span>\n {mainText.substr(offset + length)}\n </span>{' '}\n <span>{secondaryText}</span>\n </div>\n )\n}\n\ninterface LocationSearchProps {\n label?: ReactNode | string\n onSelectAddress?: (address: Address) => void\n}\n\nconst LocationSearch: React.FC<LocationSearchProps> = ({\n label = <FormattedMessage id=\"place-components.label.autocompleteAddress\" />,\n onSelectAddress,\n}) => {\n const [searchTerm, setSearchTerm] = useState('')\n const [displayedSearchTerm, setDisplayedSearchTerm] = useState('')\n const inputWrapperRef = useRef<HTMLDivElement>(null)\n const { setAddress } = useAddressContext()\n const providerLogo = useProviderLogo()\n const debouncedSearchTerm = useDebouncedValue(\n searchTerm,\n DEBOUNCE_DELAY_IN_MS\n )\n\n const {\n data: sessionTokenData,\n error: sessionTokenError,\n refetch: refetchSessionToken,\n } = useQuery<Query, never>(SESSION_TOKEN, {\n notifyOnNetworkStatusChange: true,\n })\n\n const country = useCountry()\n const sessionToken = sessionTokenData?.sessionToken ?? null\n const [suggestions, loadingSuggestions] = useSuggestions(\n debouncedSearchTerm,\n sessionToken,\n country\n )\n\n const [executeAddress, { data, error, loading }] = useLazyQuery<\n Query,\n QueryAddressArgs\n >(ADDRESS)\n\n useEffect(() => {\n if (sessionTokenError) {\n console.error(sessionTokenError.message)\n }\n }, [sessionTokenError])\n\n useEffect(() => {\n if (data) {\n setAddress((prevAddress) => ({\n ...prevAddress,\n ...data.address,\n }))\n onSelectAddress?.(data.address)\n }\n\n if (error) {\n console.error(error.message)\n }\n }, [data, error, onSelectAddress, setAddress])\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return\n }\n\n setSearchTerm('')\n setDisplayedSearchTerm('')\n }\n\n const handleSuggestionSelection = (selectedSuggestion: string) => {\n const externalId = suggestions.find(\n (suggestion) => suggestion.description === selectedSuggestion\n )?.externalId\n\n if (externalId == null) {\n console.error(`${selectedSuggestion} was not found`)\n\n return\n }\n\n setDisplayedSearchTerm(selectedSuggestion)\n executeAddress({ variables: { externalId, sessionToken } })\n refetchSessionToken()\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setSearchTerm(event.target.value)\n setDisplayedSearchTerm(event.target.value)\n }\n\n const handleClick = () => {\n setSearchTerm('')\n setDisplayedSearchTerm('')\n }\n\n return (\n <div className=\"w-100\">\n <Combobox onSelect={handleSuggestionSelection}>\n <div ref={inputWrapperRef}>\n <ComboboxInput\n as={Input}\n size=\"large\"\n testId=\"location-search-input\"\n label={label}\n prefix={\n <div className=\"c-action-primary flex justify-center items-center\">\n <IconSearch />\n </div>\n }\n suffix={\n loading ? (\n <Spinner size={20} />\n ) : searchTerm.trim().length ? (\n <span\n data-testid=\"location-search-clear\"\n role=\"button\"\n // the input can be cleared by pressing the esc key,\n // so the clear button should not be tabbable\n tabIndex={-1}\n className=\"flex pa3 na3 pointer outline-0 c-muted-3 hover-gray\"\n onClick={handleClick}\n onKeyPress={() => {}}\n >\n <IconClear />\n </span>\n ) : null\n }\n disabled={loading}\n value={displayedSearchTerm}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n />\n </div>\n {debouncedSearchTerm.trim().length ? (\n <ComboboxPopover\n position={(_targetRect, popoverRect) =>\n positionMatchWidth(\n inputWrapperRef.current?.getBoundingClientRect(),\n popoverRect\n )\n }\n >\n {suggestions.length > 0 ? (\n <ComboboxList>\n {suggestions.map((suggestion, index) => (\n <ComboboxOption value={suggestion.description} key={index}>\n <PlaceIcon className=\"flex flex-shrink-0 mr4 c-muted-1\" />\n {renderSuggestionText(suggestion)}\n </ComboboxOption>\n ))}\n </ComboboxList>\n ) : null}\n {loadingSuggestions ? (\n <div className=\"flex flex-row justify-center items-center pa3\">\n <Spinner size={20} />\n </div>\n ) : null}\n {suggestions.length > 0 && providerLogo ? (\n <div className=\"flex flex-row-reverse\">\n <div className=\"mt3 mb1 mh5\">\n <img\n className=\"h1\"\n src={providerLogo.src}\n alt={providerLogo.alt}\n />\n </div>\n </div>\n ) : null}\n {!loadingSuggestions && suggestions.length === 0 ? (\n <div className=\"flex items-center pv3 ph5\">\n <div className=\"flex flex-shrink-0 mr4 c-muted-3\">\n <IconWarning />\n </div>\n <div className=\"truncate c-muted-2 fw6\">\n <FormattedMessage id=\"place-components.label.autocompleteAddressFail\" />\n </div>\n </div>\n ) : null}\n </ComboboxPopover>\n ) : null}\n </Combobox>\n </div>\n )\n}\n\nexport default LocationSearch\n\n```" } ]
code_place-components_dca2a541
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/setupTests.js from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nglobal.navigator.geolocation = {\n getCurrentPosition: jest.fn(),\n}\n\nglobal.navigator.permissions = {\n query: jest.fn(),\n}\n\nObject.defineProperty(window, 'matchMedia', {\n writable: true,\n value: jest.fn().mockImplementation((query) => ({\n matches: false,\n media: query,\n onchange: null,\n addListener: jest.fn(), // Deprecated\n removeListener: jest.fn(), // Deprecated\n addEventListener: jest.fn(),\n removeEventListener: jest.fn(),\n dispatchEvent: jest.fn(),\n })),\n})\n\n```" } ]
code_place-components_62fe1f2e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/DeviceCoordinates.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState, useEffect, useCallback, useMemo } from 'react'\nimport { useAddressContext } from 'vtex.address-context/AddressContext'\nimport { ButtonPlain, Spinner, Tooltip, IconLocation } from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\nimport { useLazyQuery } from 'react-apollo'\nimport { Address } from 'vtex.places-graphql'\n\nimport REVERSE_GEOCODE_QUERY from './graphql/reverseGeocode.graphql'\n\nexport interface GeolocationPosition {\n coords: {\n latitude: number\n longitude: number\n }\n}\n\ninterface GeolocationPositionError {\n code: number\n message: string\n}\n\ntype PermissionState = 'prompt' | 'pending' | 'granted' | 'denied'\n\ninterface Props {\n onSuccess?: (address: Address) => void\n}\n\nconst DeviceCoordinates: React.FC<Props> = ({ onSuccess }) => {\n const { setAddress } = useAddressContext()\n const [geolocationPermission, setGeolocationPermission] = useState<\n PermissionState\n >('prompt')\n\n const [executeReverseGeocode, geoResult] = useLazyQuery(REVERSE_GEOCODE_QUERY)\n\n const { loading } = geoResult\n\n useEffect(() => {\n if (geoResult.data) {\n setAddress(geoResult.data.reverseGeocode)\n onSuccess?.(geoResult.data.reverseGeocode)\n }\n\n if (geoResult.error) {\n console.warn(geoResult.error.message)\n }\n }, [geoResult, setAddress, onSuccess])\n\n const onGetCurrentPositionSuccess = useCallback(\n ({ coords }: GeolocationPosition) => {\n setGeolocationPermission('granted')\n\n executeReverseGeocode({\n variables: {\n lat: coords.latitude.toString(),\n lng: coords.longitude.toString(),\n },\n })\n },\n [executeReverseGeocode]\n )\n\n const onGetCurrentPositionError = useCallback(\n (err: GeolocationPositionError) => {\n setGeolocationPermission('denied')\n console.warn(`ERROR(${err.code}): ${err.message}`)\n },\n []\n )\n\n const requestGeolocation = useCallback(() => {\n setGeolocationPermission('pending')\n navigator.geolocation.getCurrentPosition(\n onGetCurrentPositionSuccess,\n onGetCurrentPositionError,\n {\n enableHighAccuracy: true,\n }\n )\n }, [onGetCurrentPositionError, onGetCurrentPositionSuccess])\n\n const handleButtonClick = () => {\n requestGeolocation()\n }\n\n useEffect(() => {\n // some browsers do not have/require permissions\n if (!navigator.permissions) {\n return\n }\n\n navigator.permissions\n .query({ name: 'geolocation' })\n .then((result: PermissionStatus) => {\n if (result.state === 'denied') {\n setGeolocationPermission('denied')\n }\n })\n }, [requestGeolocation])\n\n const locationIcon = useMemo(() => {\n switch (geolocationPermission) {\n case 'prompt':\n return <IconLocation block />\n\n case 'granted':\n return <IconLocation solid block />\n\n case 'pending':\n return <Spinner size={16} block />\n\n case 'denied':\n return <IconLocation block />\n\n default:\n return null\n }\n }, [geolocationPermission])\n\n let buttonElement = (\n <ButtonPlain\n disabled={geolocationPermission === 'denied'}\n onClick={handleButtonClick}\n >\n <div className=\"flex items-center\">\n <div className=\"flex-none mr3\">\n {loading ? <Spinner size={16} /> : locationIcon}\n </div>\n <div className=\"flex-auto\">\n <FormattedMessage id=\"place-components.label.useCurrentLocation\" />\n </div>\n </div>\n </ButtonPlain>\n )\n\n if (geolocationPermission === 'denied') {\n buttonElement = (\n <Tooltip label=\"Permission not granted\">{buttonElement}</Tooltip>\n )\n }\n\n return buttonElement\n}\n\nexport default DeviceCoordinates\n\n```" } ]
code_place-components_6663b03f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__fixtures__/addressRules.fixture.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { AddressRules } from 'vtex.address-context/types'\n\nexport const braRules: AddressRules = {\n BRA: {\n display: {\n minimal: [\n [\n {\n name: 'postalCode',\n },\n ],\n ],\n compact: [\n [\n {\n name: 'street',\n },\n {\n delimiter: ' ',\n name: 'number',\n },\n ],\n [\n {\n name: 'neighborhood',\n },\n ],\n [\n {\n name: 'city',\n },\n {\n delimiter: ' - ',\n name: 'state',\n },\n ],\n [\n {\n name: 'postalCode',\n },\n ],\n ],\n extended: [\n [\n {\n name: 'receiverName',\n },\n ],\n [\n {\n name: 'street',\n },\n {\n delimiter: ' ',\n name: 'number',\n },\n ],\n [\n {\n name: 'complement',\n },\n ],\n [\n {\n name: 'neighborhood',\n },\n ],\n [\n {\n name: 'city',\n },\n {\n delimiter: ' - ',\n name: 'state',\n },\n ],\n [\n {\n name: 'postalCode',\n },\n ],\n ],\n },\n fields: {\n country: {\n label: 'country',\n hidden: true,\n maxLength: 100,\n },\n state: {\n label: 'stateAbbreviation',\n maxLength: 100,\n required: true,\n optionsCaption: 'UF',\n options: [\n {\n label: 'AC',\n value: 'AC',\n },\n {\n label: 'AL',\n value: 'AL',\n },\n {\n label: 'AP',\n value: 'AP',\n },\n {\n label: 'AM',\n value: 'AM',\n },\n {\n label: 'BA',\n value: 'BA',\n },\n {\n label: 'CE',\n value: 'CE',\n },\n {\n label: 'DF',\n value: 'DF',\n },\n {\n label: 'ES',\n value: 'ES',\n },\n {\n label: 'GO',\n value: 'GO',\n },\n {\n label: 'MA',\n value: 'MA',\n },\n {\n label: 'MT',\n value: 'MT',\n },\n {\n label: 'MS',\n value: 'MS',\n },\n {\n label: 'MG',\n value: 'MG',\n },\n {\n label: 'PA',\n value: 'PA',\n },\n {\n label: 'PB',\n value: 'PB',\n },\n {\n label: 'PR',\n value: 'PR',\n },\n {\n label: 'PE',\n value: 'PE',\n },\n {\n label: 'PI',\n value: 'PI',\n },\n {\n label: 'RJ',\n value: 'RJ',\n },\n {\n label: 'RN',\n value: 'RN',\n },\n {\n label: 'RS',\n value: 'RS',\n },\n {\n label: 'RO',\n value: 'RO',\n },\n {\n label: 'RR',\n value: 'RR',\n },\n {\n label: 'SC',\n value: 'SC',\n },\n {\n label: 'SP',\n value: 'SP',\n },\n {\n label: 'SE',\n value: 'SE',\n },\n {\n label: 'TO',\n value: 'TO',\n },\n ],\n },\n city: {\n label: 'city',\n maxLength: 100,\n required: true,\n },\n neighborhood: {\n label: 'neighborhood',\n maxLength: 100,\n required: true,\n },\n street: {\n label: 'streetRoadAvenue',\n required: true,\n },\n number: {\n label: 'numberOption',\n maxLength: 750,\n required: true,\n autoComplete: 'off',\n },\n complement: {\n label: 'complement',\n maxLength: 750,\n },\n reference: {\n label: 'reference',\n hidden: true,\n maxLength: 750,\n },\n receiverName: {\n label: 'receiverName',\n elementName: 'receiver',\n maxLength: 750,\n required: true,\n },\n postalCode: {\n mask: '99999-999',\n label: 'postalCode',\n additionalData: {\n forgottenURL:\n 'http://www.buscacep.correios.com.br/servicos/dnec/index.do',\n },\n },\n },\n },\n}\n\n```" } ]
code_place-components_0a5551c8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__fixtures__/address.fixture.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { Address } from 'vtex.places-graphql'\n\nexport const emptyAddress: Address = {\n street: '',\n number: '',\n complement: '',\n postalCode: '',\n city: '',\n state: '',\n addressId: '',\n addressType: null,\n country: '',\n geoCoordinates: [],\n neighborhood: '',\n receiverName: null,\n reference: null,\n}\n\nexport const completeAddress: Address = {\n street: 'Av. Belgrano',\n number: '2248',\n complement: 'B',\n postalCode: '2000',\n city: 'Rosario',\n state: 'Santa Fé',\n addressId: '',\n addressType: null,\n country: 'ARG',\n geoCoordinates: [],\n neighborhood: 'Las Delicias',\n receiverName: null,\n reference: null,\n}\n\nexport const incompleteAddress: Address = {\n street: 'Av. Belgrano',\n number: '2248',\n complement: '',\n postalCode: '2000',\n city: '',\n state: '',\n addressId: '',\n addressType: null,\n country: 'ARG',\n geoCoordinates: [],\n neighborhood: '',\n receiverName: null,\n reference: null,\n}\n\nexport const sampleAddress: Address = {\n street: 'Rua Afonso Camargo',\n number: '805',\n complement: '',\n postalCode: '85070-200',\n city: 'Guarapuava',\n state: 'PR',\n addressId: '',\n addressType: null,\n country: 'BRA',\n geoCoordinates: [],\n neighborhood: 'Santana',\n receiverName: null,\n reference: null,\n}\n\nexport const vtexOfficeAddress: Address = {\n addressId: '1',\n addressType: 'residential',\n city: 'Rio de Janeiro',\n complement: null,\n country: 'BRA',\n geoCoordinates: [-43.18037200000001, -22.9418474],\n neighborhood: 'Botafogo',\n number: '200',\n postalCode: '22250-145',\n receiverName: null,\n reference: null,\n state: 'RJ',\n street: 'Rua Praia de Botafogo',\n}\n\n```" } ]
code_place-components_995d27ea
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/typings/vtex.address-context.d.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.address-context/AddressContext' {\n export * from 'vtex.address-context/react/AddressContext'\n export { default } from 'vtex.address-context/react/AddressContext'\n}\n\ndeclare module 'vtex.address-context/types' {\n export * from 'vtex.address-context/react/types'\n}\n\ndeclare module 'vtex.address-context/Utils' {\n export * from 'vtex.address-context/react/Utils'\n}\n\n```" } ]
code_place-components_d0475da8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/typings/css.d.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/no-explicit-any */\ndeclare module '*.css' {\n const css: any\n export default css\n}\n\n```" } ]
code_place-components_62fb1173
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/typings/graphql.d.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.graphql' {\n import { DocumentNode } from 'graphql'\n\n const value: DocumentNode\n export default value\n}\n\n```" } ]
code_place-components_6140b5c0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/typings/vtex.styleguide.d.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react'\n\ndeclare module 'vtex.styleguide' {\n export const Button: React.FC<any>\n\n export const Input: React.FC<any>\n\n export const IconClear: React.FC<any>\n\n export const IconWarning: React.FC<any>\n\n export const InputButton: React.FC<any>\n\n export const Spinner: React.FC<any>\n\n export const IconLocation: React.FC<any>\n\n export const Checkbox: React.FC<any>\n\n interface DropdownProps {\n value?: string\n label?: React.ReactNode\n placeholder?: string\n options: Array<{ label: string; value: string }>\n onChange?: React.ChangeEventHandler<HTMLSelectElement>\n disabled?: boolean\n name?: string\n }\n\n export const Dropdown: React.FC<DropdownProps>\n\n export const IconSearch: React.FC<any>\n\n export const IconCaretDown: React.FC<any>\n\n export const IconEdit: React.FC<any>\n}\n\n```" } ]
code_place-components_a96d6236
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/components/PlaceIcon.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nexport const PlaceIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n {...props}\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"14\"\n height=\"16\"\n viewBox=\"0 0 14 16\"\n fill=\"none\"\n >\n <path\n d=\"M7.04917 0C3.12177 0 0 3.1 0 7C0 8.56189 0.476353 10.0562 1.42906 11.2607C1.50908 11.3782 1.60101 11.4919 1.70535 11.6007L5.19589 15.2393C5.63744 15.6996 6.21111 15.9534 6.79833 16.0006C6.97371 16.0366 7.15342 16.0328 7.31309 15.9891C7.86105 15.9204 8.39053 15.6705 8.80411 15.2393L12.2946 11.6007C12.4052 11.4855 12.5017 11.3647 12.585 11.2399C13.5268 10.039 13.9976 8.55289 13.9976 7C14.0983 3.1 10.9766 0 7.04917 0ZM9.56673 6.5C9.56673 7.88071 8.43958 9 7.04917 9C5.65876 9 4.53161 7.88071 4.53161 6.5C4.53161 5.11929 5.65876 4 7.04917 4C8.43958 4 9.56673 5.11929 9.56673 6.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\nexport default PlaceIcon\n\n```" } ]
code_place-components_99de44d7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/components/Combobox.css from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n:root {\n --reach-combobox: 1;\n}\n\n.option:not([aria-selected=\"true\"]).option:not(:hover) {\n background-color: transparent;\n}\n\n.popover {\n box-shadow: 0px 1px 16px rgba(46, 46, 46, 0.12);\n}\n```" } ]
code_place-components_1df27ee7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/components/NumberOption.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState, useRef, useMemo } from 'react'\nimport { Input, Checkbox } from 'vtex.styleguide'\nimport { FormattedMessage, useIntl, defineMessages } from 'react-intl'\n\nconst messages = defineMessages({\n wn: {\n defaultMessage: '',\n id: 'place-components.label.wn',\n },\n numberOption: {\n defaultMessage: '',\n id: 'place-components.label.numberOption',\n },\n fieldRequired: {\n defaultMessage: '',\n id: 'place-components.error.fieldRequired',\n },\n withoutNumber: {\n defaultMessage: '',\n id: 'place-components.label.withoutNumber',\n },\n})\n\ninterface Props {\n showCheckbox: boolean\n name: string\n label: React.ReactNode\n value: string\n onChange?: (value: string) => void\n disabled?: boolean\n maxLength?: number\n autoComplete?: string\n}\n\nconst NumberOption: React.FC<Props> = ({\n showCheckbox,\n onChange,\n ...props\n}) => {\n const intl = useIntl()\n const inputRef = useRef<HTMLInputElement>(null)\n const withoutNumberMessage = useMemo(() => intl.formatMessage(messages.wn), [\n intl,\n ])\n\n const [disabled, setDisabled] = useState(\n showCheckbox && props.value === withoutNumberMessage\n )\n\n const onCheckboxChange = () => {\n onChange?.(disabled ? '' : intl.formatMessage(messages.wn))\n setDisabled(!disabled)\n\n setTimeout(() => {\n inputRef.current?.focus()\n }, 0)\n }\n\n const checkboxProps = {\n id: 'number-checkbox',\n name: 'number-checkbox',\n label: <FormattedMessage {...messages.withoutNumber} />,\n onChange: onCheckboxChange,\n checked: disabled,\n }\n\n return (\n <div className=\"flex\">\n <div className=\"flex-auto\">\n <Input\n ref={inputRef}\n {...props}\n onChange={({\n target: { value },\n }: React.ChangeEvent<HTMLInputElement>) => onChange?.(value)}\n disabled={disabled || props.disabled}\n />\n </div>\n {showCheckbox && (\n <div className=\"flex-none h-regular ml5 mt7 flex items-center\">\n <Checkbox {...checkboxProps} />\n </div>\n )}\n </div>\n )\n}\n\nexport default NumberOption\n\n```" } ]
code_place-components_566bf3ac
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/components/Combobox.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport {\n Combobox as ReachCombobox,\n ComboboxInput as ReachComboboxInput,\n ComboboxPopover as ReachComboboxPopover,\n ComboboxPopoverProps as ReachComboboxPopoverProps,\n ComboboxList as ReachComboboxList,\n ComboboxListProps as ReachComboboxListProps,\n ComboboxOption as ReachComboboxOption,\n ComboboxOptionProps as ReachComboboxOptionProps,\n ComboboxOptionText as ReachComboboxOptionText,\n} from '@reach/combobox'\nimport { PopoverProps } from '@reach/popover'\nimport React, { forwardRef } from 'react'\nimport classNames from 'classnames'\n\nimport styles from './Combobox.css'\n\nexport const Combobox = ReachCombobox\n\nexport const ComboboxInput = ReachComboboxInput\n\nexport const ComboboxPopover = forwardRef<\n HTMLDivElement,\n ReachComboboxPopoverProps &\n Partial<PopoverProps> &\n React.RefAttributes<HTMLDivElement>\n>(function ComboboxPopover({ className, ...props }, ref) {\n return (\n <ReachComboboxPopover\n {...props}\n ref={ref}\n className={classNames(\n className,\n styles.popover,\n 'bg-base pv3 mt2 br2 ba bw1 b--muted-4 absolute outline-0'\n )}\n />\n )\n})\n\nexport const ComboboxList: React.FC<ReachComboboxListProps & {\n className?: string\n}> = ({ className, ...props }) => (\n <ReachComboboxList\n {...props}\n className={classNames(className, 'bg-base list ma0 pa0 outline-0')}\n />\n)\n\nexport const ComboboxOption: React.FC<ReachComboboxOptionProps & {\n className?: string\n}> = ({ className, children, ...props }) => (\n <ReachComboboxOption\n {...props}\n className={classNames(\n className,\n styles.option,\n 'flex items-center pv3 ph5 pointer bg-action-secondary hover-bg-action-secondary active-bg-action-secondary'\n )}\n >\n {children ?? <ReachComboboxOptionText />}\n </ReachComboboxOption>\n)\n\nexport default {\n Combobox,\n ComboboxInput,\n ComboboxPopover,\n ComboboxList,\n ComboboxOption,\n}\n\n```" } ]
code_place-components_c9ed237a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__tests__/LocationInput.test.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render, screen, waitFor } from '@vtex/test-tools/react'\nimport { MockedResponse } from '@apollo/react-testing'\nimport { Address } from 'vtex.checkout-graphql'\nimport { AddressRules, CountryRules, Field } from 'vtex.address-context/types'\nimport { AddressContextProvider } from 'vtex.address-context/AddressContext'\nimport userEvent from '@testing-library/user-event'\n\nimport LocationInput from '../LocationInput'\nimport { validPostalCode } from '../__fixtures__/graphql/getAddressFromPostalCode.fixture'\n\ninterface SetupProps {\n address?: Address | null\n countries?: string[]\n rules?: AddressRules\n graphqlMocks?: MockedResponse[]\n}\n\ninterface RenderComponentProps extends SetupProps {\n locationInputProps?: React.ComponentProps<typeof LocationInput>\n}\n\nconst defaultGraphqlMocks: MockedResponse[] = []\n\ndescribe('LocationInput', () => {\n const renderComponent = ({\n locationInputProps = {},\n address = { country: 'BRA' },\n countries = [],\n rules = {\n BRA: {\n fields: {\n postalCode: {\n mask: '99999-999',\n pattern: '^(\\\\d){5}-?(\\\\d){3}$',\n additionalData: {\n forgottenURL:\n 'https://buscacepinter.correios.com.br/app/endereco/',\n },\n } as Field,\n },\n } as CountryRules,\n },\n graphqlMocks = [],\n }: RenderComponentProps) => {\n return render(\n <AddressContextProvider\n address={address}\n countries={countries}\n rules={rules}\n >\n <LocationInput {...locationInputProps} />\n </AddressContextProvider>,\n {\n graphql: {\n mocks: [...defaultGraphqlMocks, ...graphqlMocks],\n addTypename: false,\n },\n }\n )\n }\n\n afterEach(() => {\n jest.resetAllMocks()\n })\n\n it('should format and submit a valid postal code', async () => {\n const mockedOnSuccess = jest.fn()\n\n renderComponent({\n locationInputProps: { onSuccess: mockedOnSuccess },\n graphqlMocks: [validPostalCode],\n })\n\n const input = screen.getByRole('textbox', {\n name: /postal code/i,\n })\n\n userEvent.type(input, '22250040')\n userEvent.click(screen.getByRole('button'))\n\n await waitFor(() => {\n expect(mockedOnSuccess).toHaveBeenCalledTimes(1)\n })\n })\n\n it('should format and submit a valid postal code after fixing an invalid postal code', async () => {\n const mockedOnSuccess = jest.fn()\n\n renderComponent({\n locationInputProps: { onSuccess: mockedOnSuccess },\n graphqlMocks: [validPostalCode],\n })\n\n const input = screen.getByRole('textbox', {\n name: /postal code/i,\n })\n\n // it's missing the last digit\n userEvent.type(input, '2225004')\n userEvent.click(screen.getByRole('button'))\n\n expect(\n screen.getByText(/inform a valid postal code\\./i)\n ).toBeInTheDocument()\n\n userEvent.type(input, '{selectall}22250040')\n userEvent.click(screen.getByRole('button'))\n\n await waitFor(() => {\n expect(mockedOnSuccess).toHaveBeenCalledTimes(1)\n })\n })\n\n it('should apply the postal code mask when the input lose focus', () => {\n renderComponent({})\n const input = screen.getByRole('textbox', {\n name: /postal code/i,\n })\n\n userEvent.type(input, '222500')\n expect(input).toHaveValue('222500')\n\n userEvent.type(input, '4')\n expect(input).toHaveValue('2225004')\n\n userEvent.click(screen.getByRole('button'))\n expect(input).toHaveValue('22250-04')\n\n userEvent.type(input, '{selectall}2225004')\n expect(input).toHaveValue('2225004')\n\n userEvent.type(input, '{enter}')\n expect(input).toHaveValue('22250-04')\n })\n})\n\n```" } ]
code_place-components_a832c1a8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__tests__/LocationSearch.test.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render, screen, fireEvent, waitFor } from '@vtex/test-tools/react'\nimport { MockedResponse } from '@apollo/react-testing'\nimport { Address } from 'vtex.checkout-graphql'\nimport { AddressRules } from 'vtex.address-context/types'\nimport { AddressContextProvider } from 'vtex.address-context/AddressContext'\n\nimport LocationSearch from '../LocationSearch'\nimport { googleLogo } from '../__fixtures__/graphql/providerLogo.fixture'\nimport {\n noSuggestions,\n simpleSuggestions,\n simpleSuggestionWithoutToken,\n} from '../__fixtures__/graphql/addressSuggestions.fixture'\nimport { simpleSuggestedAddress } from '../__fixtures__/graphql/address.fixture'\nimport { defaultSessionToken } from '../__fixtures__/graphql/sessionToken.fixture'\n\nconst UNTABABBLE = -1\nconst LABEL_MATCHER = /Address \\(street, number, square\\.\\.\\.\\)/i\n\ninterface RenderComponentProps {\n address?: Address | null\n countries?: string[]\n rules?: AddressRules\n graphqlMocks?: MockedResponse[]\n}\n\nconst defaultGraphqlMocks = [\n googleLogo,\n defaultSessionToken,\n // This duplication is intentional: the first one will be used during the\n // first query and the second one is used during the refetch. Currently,\n // Apollo provides not many good alternatives to do that. You can read\n // more about it on this issue:\n // https://github.com/apollographql/apollo-client/issues/7286\n defaultSessionToken,\n]\n\ndescribe('Location Search', () => {\n const renderComponent = ({\n address = { country: 'BRA' },\n countries = [],\n rules = {},\n graphqlMocks = [],\n }: RenderComponentProps) => {\n return render(\n <AddressContextProvider\n address={address}\n countries={countries}\n rules={rules}\n >\n <LocationSearch />\n </AddressContextProvider>,\n {\n graphql: {\n mocks: [...defaultGraphqlMocks, ...graphqlMocks],\n addTypename: false,\n },\n }\n )\n }\n\n it('should be able to select a suggested address when a search term is found', async () => {\n renderComponent({\n graphqlMocks: [\n simpleSuggestions,\n simpleSuggestedAddress,\n simpleSuggestionWithoutToken,\n ],\n })\n\n const input = screen.getByLabelText(LABEL_MATCHER)\n\n fireEvent.change(input, { target: { value: 'Praia de Botafogo' } })\n\n expect(\n await screen.findByText('Praia de Botafogo, 200')\n ).toBeInTheDocument()\n expect(\n await screen.findByText('Praia de Botafogo, 300')\n ).toBeInTheDocument()\n\n fireEvent.click(screen.getByText('Praia de Botafogo, 200'))\n expect(input).toHaveValue(\n 'Praia de Botafogo, 200, Botafogo, Rio de Janeiro, RJ'\n )\n\n // same as waiting loading to finish\n await waitFor(() => {\n expect(screen.queryByRole('button')).toBeInTheDocument()\n })\n })\n\n it('should be able to clear the input with clear button when something is typed', () => {\n renderComponent({ graphqlMocks: [simpleSuggestions] })\n\n expect(screen.queryByRole('button')).not.toBeInTheDocument()\n\n const input = screen.getByLabelText(LABEL_MATCHER)\n\n fireEvent.change(input, { target: { value: 'Praia de Botafogo' } })\n const button = screen.getByRole('button')\n\n expect(button.tabIndex).toBe(UNTABABBLE)\n\n fireEvent.click(button)\n\n expect(input).toHaveValue('')\n expect(screen.queryByRole('button')).not.toBeInTheDocument()\n })\n\n it('should be able to clear the input with ESC key when something is typed', () => {\n renderComponent({ graphqlMocks: [simpleSuggestions] })\n\n expect(screen.queryByRole('button')).not.toBeInTheDocument()\n\n const input = screen.getByLabelText(LABEL_MATCHER)\n\n fireEvent.change(input, { target: { value: 'Praia de Botafogo' } })\n fireEvent.keyDown(input, { key: 'Escape', code: 'Escape' })\n\n expect(input).toHaveValue('')\n expect(screen.queryByRole('button')).not.toBeInTheDocument()\n })\n\n it('should display failure message when the search term is not found', async () => {\n renderComponent({ graphqlMocks: [noSuggestions] })\n\n const input = screen.getByLabelText(LABEL_MATCHER)\n\n fireEvent.change(input, { target: { value: 'asdfasdfasdf' } })\n\n await waitFor(() => {\n expect(screen.queryByText('No results found')).toBeInTheDocument()\n })\n })\n\n it('should render provider logo', async () => {\n renderComponent({ graphqlMocks: [simpleSuggestions] })\n\n const input = screen.getByLabelText(LABEL_MATCHER)\n\n fireEvent.change(input, { target: { value: 'Praia de Botafogo' } })\n\n expect(await screen.findByAltText('Google logo')).toBeInTheDocument()\n fireEvent.blur(input)\n })\n})\n\n```" } ]
code_place-components_d843a035
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__tests__/AddressForm.test.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { fireEvent, screen, render } from '@vtex/test-tools/react'\nimport { AddressContextProvider } from 'vtex.address-context/AddressContext'\nimport { createEmptyAddress } from 'vtex.address-context/Utils'\n\nimport AddressForm from '../AddressForm'\nimport { useAddressForm, FieldName } from '../useAddressForm'\nimport { braRules } from '../__fixtures__/addressRules.fixture'\n\ndescribe('AddressForm', () => {\n it('should read address from context', () => {\n render(\n <AddressContextProvider\n address={{ ...createEmptyAddress(), country: 'BRA' }}\n rules={braRules}\n countries={['BRA']}\n >\n <AddressForm />\n </AddressContextProvider>\n )\n\n const numberInput = screen.getByLabelText(/^number$/i)\n\n expect(numberInput).toBeInTheDocument()\n\n fireEvent.change(numberInput, { target: { value: '300' } })\n\n expect(numberInput).toHaveValue('300')\n })\n\n it('should be able to act as controlled component', () => {\n const changes: any[] = []\n\n const Component: React.VFC = () => {\n const form = useAddressForm({\n initialAddress: { ...createEmptyAddress(), country: 'BRA' },\n onAddressChange: (address) => changes.push(address),\n })\n\n return (\n <>\n <AddressForm form={form} />\n <button\n onClick={() => {\n form.invalidFields.map((field) =>\n form.onFieldBlur(field as FieldName)\n )\n }}\n >\n blur fields\n </button>\n </>\n )\n }\n\n render(\n <AddressContextProvider\n address={{\n // this won't be used\n ...createEmptyAddress(),\n number: '123',\n country: 'BRA',\n }}\n rules={braRules}\n countries={['BRA']}\n >\n <Component />\n </AddressContextProvider>\n )\n\n const numberInput = screen.getByLabelText(/^number$/i)\n\n expect(numberInput).toBeInTheDocument()\n expect(numberInput).not.toHaveValue('123')\n\n fireEvent.change(numberInput, { target: { value: '321' } })\n\n expect(numberInput).toHaveValue('321')\n expect(changes).toStrictEqual([\n expect.objectContaining({\n number: '321',\n }),\n ])\n\n fireEvent.click(screen.getByText('blur fields'))\n\n expect(\n screen.getAllByText(/this field is required/i).length\n ).toBeGreaterThan(0)\n })\n})\n\n```" } ]
code_place-components_5afd3619
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__tests__/DeviceCoordinates.test.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { fireEvent, render, screen, waitFor } from '@vtex/test-tools/react'\nimport { MockedProvider, MockedResponse } from '@apollo/react-testing'\nimport { Address } from 'vtex.checkout-graphql'\nimport { AddressRules } from 'vtex.address-context/types'\nimport { AddressContextProvider } from 'vtex.address-context/AddressContext'\n\nimport DeviceCoordinates, { GeolocationPosition } from '../DeviceCoordinates'\nimport { reverseGeocode } from '../__fixtures__/graphql/reverseGeocode.fixture'\nimport { vtexOfficeAddress } from '../__fixtures__/address.fixture'\n\ninterface RenderComponentProps {\n deviceCoordinatesProps?: React.ComponentProps<typeof DeviceCoordinates>\n address?: Address | null\n countries?: string[]\n rules?: AddressRules\n graphqlMocks?: MockedResponse[]\n}\n\nconst defaultGraphqlMocks = [] as MockedResponse[]\n\ndescribe('Device Coordinates', () => {\n const renderComponent = ({\n deviceCoordinatesProps,\n address = { country: 'BRA' },\n countries = [],\n rules = {},\n graphqlMocks = [],\n }: RenderComponentProps) => {\n return render(\n <MockedProvider\n addTypename={false}\n mocks={[...defaultGraphqlMocks, ...graphqlMocks]}\n >\n <AddressContextProvider\n address={address}\n countries={countries}\n rules={rules}\n >\n <DeviceCoordinates {...deviceCoordinatesProps} />\n </AddressContextProvider>\n </MockedProvider>\n )\n }\n\n afterEach(() => {\n jest.resetAllMocks()\n })\n\n describe('when geolocation is granted', () => {\n it('should get an address from coordinates', async () => {\n const callOrder: string[] = []\n\n const { query } = navigator.permissions\n const mockedPermissionsQuery = query as jest.MockedFunction<typeof query>\n\n mockedPermissionsQuery.mockImplementation((_permission) => {\n callOrder.push('permissions')\n\n return Promise.resolve({ state: 'granted' } as PermissionStatus)\n })\n\n Object.defineProperty(navigator, 'permissions', {\n get() {\n return { query: mockedPermissionsQuery }\n },\n })\n\n const { getCurrentPosition } = navigator.geolocation\n const mockedGetCurrentPosition = getCurrentPosition as jest.MockedFunction<\n typeof getCurrentPosition\n >\n\n mockedGetCurrentPosition.mockImplementation((success) => {\n callOrder.push('geolocation')\n\n return Promise.resolve(\n success({\n coords: {\n latitude: vtexOfficeAddress.geoCoordinates[0],\n longitude: vtexOfficeAddress.geoCoordinates[1],\n },\n } as GeolocationPosition)\n )\n })\n\n Object.defineProperty(navigator, 'geolocation', {\n get() {\n return { getCurrentPosition: mockedGetCurrentPosition }\n },\n })\n\n const mockedOnSuccess = jest.fn()\n\n renderComponent({\n deviceCoordinatesProps: { onSuccess: mockedOnSuccess },\n graphqlMocks: [reverseGeocode],\n })\n\n const button = screen.getByRole('button')\n\n fireEvent.click(button)\n\n expect(mockedPermissionsQuery).toHaveBeenCalledTimes(1)\n expect(mockedGetCurrentPosition).toHaveBeenCalledTimes(1)\n expect(callOrder).toEqual(['permissions', 'geolocation'])\n await waitFor(() => {\n expect(mockedOnSuccess).toHaveBeenCalledTimes(1)\n })\n })\n\n it(\"should get an address from coordinates on a browser that doesn't support navigator.permissions\", async () => {\n Object.defineProperty(navigator, 'permissions', {\n get() {\n return undefined\n },\n })\n\n const { getCurrentPosition } = navigator.geolocation\n const mockedGetCurrentPosition = getCurrentPosition as jest.MockedFunction<\n typeof getCurrentPosition\n >\n\n mockedGetCurrentPosition.mockImplementation((success) =>\n Promise.resolve(\n success({\n coords: {\n latitude: vtexOfficeAddress.geoCoordinates[0],\n longitude: vtexOfficeAddress.geoCoordinates[1],\n },\n } as GeolocationPosition)\n )\n )\n\n Object.defineProperty(navigator, 'geolocation', {\n get() {\n return { getCurrentPosition: mockedGetCurrentPosition }\n },\n })\n\n const mockedOnSuccess = jest.fn()\n\n renderComponent({\n deviceCoordinatesProps: { onSuccess: mockedOnSuccess },\n graphqlMocks: [reverseGeocode],\n })\n\n const button = screen.getByRole('button')\n\n fireEvent.click(button)\n\n expect(mockedGetCurrentPosition).toHaveBeenCalledTimes(1)\n await waitFor(() => {\n expect(mockedOnSuccess).toHaveBeenCalledTimes(1)\n })\n })\n })\n\n // TODO\n describe('when geolocation is blocked', () => {})\n\n // TODO\n describe('when geolocation is prompt', () => {})\n})\n\n```" } ]
code_place-components_017400f4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/graphql/address.graphql from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery Address($externalId: String!, $sessionToken: String) {\n address(externalId: $externalId, sessionToken: $sessionToken)\n @context(provider: \"vtex.geolocation-graphql-interface\") {\n addressId\n addressType\n city\n complement\n country\n geoCoordinates\n neighborhood\n number\n postalCode\n reference\n state\n street\n }\n}\n\n```" } ]
code_place-components_09b6c416
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/graphql/addressSuggestions.graphql from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery AddressSuggestions(\n $searchTerm: String!\n $sessionToken: String\n $country: String\n) {\n addressSuggestions(\n searchTerm: $searchTerm\n sessionToken: $sessionToken\n country: $country\n ) @context(provider: \"vtex.geolocation-graphql-interface\") {\n description\n mainText\n mainTextMatchInterval {\n offset\n length\n }\n secondaryText\n externalId\n }\n}\n\n```" } ]
code_place-components_7de1ecb9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/graphql/getAddressFromPostalCode.graphql from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery GetAddressFromPostalCode($postalCode: String, $countryCode: String) {\n getAddressFromPostalCode(postalCode: $postalCode, countryCode: $countryCode) {\n addressId\n addressType\n city\n complement\n country\n geoCoordinates\n neighborhood\n number\n postalCode\n reference\n state\n street\n }\n}\n\n```" } ]
code_place-components_1acfc214
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/graphql/reverseGeocode.graphql from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery ReverseGeocode($lat: String, $lng: String) {\n reverseGeocode(lat: $lat, lng: $lng) {\n addressId\n addressType\n city\n complement\n country\n geoCoordinates\n neighborhood\n number\n postalCode\n reference\n state\n street\n }\n}\n\n```" } ]
code_place-components_02713c66
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/graphql/sessionToken.graphql from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery SessionToken {\n sessionToken @context(provider: \"vtex.geolocation-graphql-interface\")\n}\n\n```" } ]
code_place-components_014d29aa
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/graphql/providerLogo.graphql from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery ProviderLogo {\n providerLogo @context(provider: \"vtex.geolocation-graphql-interface\") {\n src\n alt\n }\n}\n\n```" } ]
code_place-components_71223df1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/countries/rules.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { CSSProperties } from 'react'\n\nexport const styleRules: {\n [key: string]: CSSProperties\n} = {\n complement: {\n minWidth: 199,\n maxWidth: 512,\n },\n number: {\n minWidth: 71,\n maxWidth: 128,\n },\n numberOption: {\n minWidth: 256,\n maxWidth: 256,\n },\n streetRoadAvenue: {\n minWidth: 256,\n maxWidth: 512,\n },\n neighborhood: {\n minWidth: 256,\n maxWidth: 256,\n },\n addressLine1: {\n minWidth: 256,\n maxWidth: 512,\n },\n addressLine2: {\n minWidth: 256,\n maxWidth: 512,\n },\n city: {\n minWidth: 199,\n maxWidth: 256,\n },\n canton: {\n minWidth: 256,\n maxWidth: 256,\n },\n province: {\n minWidth: 128,\n maxWidth: 256,\n },\n address: {\n minWidth: 256,\n maxWidth: 512,\n },\n town: {\n minWidth: 256,\n maxWidth: 256,\n },\n county: {\n minWidth: 256,\n maxWidth: 256,\n },\n interiorNo: {\n minWidth: 256,\n maxWidth: 256,\n },\n exteriorNoOption: {\n minWidth: 256,\n maxWidth: 256,\n },\n colony: {\n minWidth: 256,\n maxWidth: 256,\n },\n municipalityDelegation: {\n minWidth: 256,\n maxWidth: 256,\n },\n stateAbbreviation: {\n minWidth: 128,\n maxWidth: 128,\n },\n state: {\n minWidth: 256,\n maxWidth: 256,\n },\n locality: {\n minWidth: 256,\n maxWidth: 256,\n },\n deliveryInstructions: {\n minWidth: 256,\n maxWidth: 512,\n },\n department: {\n minWidth: 256,\n maxWidth: 256,\n },\n addressLine3: {\n minWidth: 256,\n maxWidth: 512,\n },\n parish: {\n minWidth: 256,\n maxWidth: 256,\n },\n}\n\n```" } ]
code_place-components_bf7012e3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__fixtures__/graphql/addressSuggestions.fixture.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport {\n Query,\n QueryAddressSuggestionsArgs,\n} from 'vtex.geolocation-graphql-interface'\nimport { MockedResponse } from '@apollo/react-testing'\n\nimport ADDRESS_SUGGESTIONS from '../../graphql/addressSuggestions.graphql'\nimport { DEFAULT_SESSION_TOKEN } from './sessionToken.fixture'\n\nexport const simpleSuggestions: MockedResponse = {\n request: {\n query: ADDRESS_SUGGESTIONS,\n variables: {\n searchTerm: 'Praia de Botafogo',\n sessionToken: DEFAULT_SESSION_TOKEN,\n country: 'BRA',\n } as QueryAddressSuggestionsArgs,\n },\n result: {\n data: {\n addressSuggestions: [\n {\n description: 'Praia de Botafogo, 200, Botafogo, Rio de Janeiro, RJ',\n mainText: 'Praia de Botafogo, 200',\n mainTextMatchInterval: {\n offset: 0,\n length: 0,\n },\n secondaryText: 'Botafogo, Rio de Janeiro, RJ',\n externalId: '1',\n },\n {\n description: 'Praia de Botafogo, 300, Botafogo, Rio de Janeiro, RJ',\n mainText: 'Praia de Botafogo, 300',\n mainTextMatchInterval: {\n offset: 0,\n length: 0,\n },\n secondaryText: 'Botafogo, Rio de Janeiro, RJ',\n externalId: '2',\n },\n ],\n } as Query,\n },\n}\n\nexport const simpleSuggestionWithoutToken: MockedResponse = {\n ...simpleSuggestions,\n request: {\n ...simpleSuggestions.request,\n variables: {\n ...simpleSuggestions.request.variables,\n sessionToken: null,\n } as QueryAddressSuggestionsArgs,\n },\n}\n\nexport const noSuggestions: MockedResponse = {\n request: {\n query: ADDRESS_SUGGESTIONS,\n variables: {\n searchTerm: 'asdfasdfasdf',\n sessionToken: DEFAULT_SESSION_TOKEN,\n country: 'BRA',\n } as QueryAddressSuggestionsArgs,\n },\n result: {\n data: {\n addressSuggestions: [] as Query['addressSuggestions'],\n } as Query,\n },\n}\n\n```" } ]
code_place-components_1b2c43b1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__fixtures__/graphql/reverseGeocode.fixture.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { MockedResponse } from '@apollo/react-testing'\nimport { Query, QueryReverseGeocodeArgs } from 'vtex.places-graphql'\n\nimport { vtexOfficeAddress } from '../address.fixture'\nimport REVERSE_GEOCODE_QUERY from '../../graphql/reverseGeocode.graphql'\n\nconst [lat, lng] = vtexOfficeAddress.geoCoordinates.map((coordinate) =>\n coordinate.toString()\n)\n\nexport const reverseGeocode: MockedResponse = {\n request: {\n query: REVERSE_GEOCODE_QUERY,\n variables: {\n lat,\n lng,\n } as QueryReverseGeocodeArgs,\n },\n result: {\n data: {\n reverseGeocode: vtexOfficeAddress,\n } as Query,\n },\n}\n\n```" } ]
code_place-components_7bb64e68
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__fixtures__/graphql/sessionToken.fixture.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { Query } from 'vtex.geolocation-graphql-interface'\nimport { MockedResponse } from '@apollo/react-testing'\n\nimport SESSION_TOKEN from '../../graphql/sessionToken.graphql'\n\nexport const DEFAULT_SESSION_TOKEN = 'default session token'\n\nexport const defaultSessionToken: MockedResponse = {\n request: {\n query: SESSION_TOKEN,\n },\n result: {\n data: {\n sessionToken: DEFAULT_SESSION_TOKEN,\n } as Query,\n },\n}\n\n```" } ]
code_place-components_ff8a5374
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__fixtures__/graphql/providerLogo.fixture.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { Query } from 'vtex.geolocation-graphql-interface'\nimport { MockedResponse } from '@apollo/react-testing'\n\nimport PROVIDER_LOGO from '../../graphql/providerLogo.graphql'\n\nexport const googleLogo: MockedResponse = {\n request: {\n query: PROVIDER_LOGO,\n },\n result: {\n data: {\n providerLogo: {\n src:\n 'https://user-images.githubusercontent.com/26108090/100493516-45802680-3116-11eb-9028-06c336a587a7.png',\n alt: 'Google logo',\n },\n } as Query,\n },\n}\n\n```" } ]
code_place-components_3027506d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__fixtures__/graphql/getAddressFromPostalCode.fixture.ts from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Query, QueryGetAddressFromPostalCodeArgs } from 'vtex.places-graphql'\nimport { MockedResponse } from '@apollo/react-testing'\n\nimport GET_ADDRESS_FROM_POSTAL_CODE from '../../graphql/getAddressFromPostalCode.graphql'\n\nexport const validPostalCode: MockedResponse = {\n request: {\n query: GET_ADDRESS_FROM_POSTAL_CODE,\n variables: {\n countryCode: 'BRA',\n postalCode: '22250-040',\n } as QueryGetAddressFromPostalCodeArgs,\n },\n result: {\n data: {\n getAddressFromPostalCode: {\n addressId: null,\n addressType: null,\n city: 'Rio de Janeiro',\n complement: '',\n country: 'BRA',\n geoCoordinates: [-43.18218231201172, -22.94549560546875],\n neighborhood: 'Botafogo',\n number: '',\n postalCode: '22250040',\n receiverName: null,\n reference: '',\n state: 'RJ',\n street: 'Praia Botafogo',\n },\n } as Query,\n },\n}\n\n```" } ]
code_place-components_5a1abd3e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of place-components/react/__fixtures__/graphql/address.fixture.tsx from the place-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { Query, QueryAddressArgs } from 'vtex.geolocation-graphql-interface'\nimport { MockedResponse } from '@apollo/react-testing'\n\nimport ADDRESS from '../../graphql/address.graphql'\nimport { DEFAULT_SESSION_TOKEN } from './sessionToken.fixture'\nimport { vtexOfficeAddress } from '../address.fixture'\n\nexport const simpleSuggestedAddress: MockedResponse = {\n request: {\n query: ADDRESS,\n variables: {\n externalId: '1',\n sessionToken: DEFAULT_SESSION_TOKEN,\n } as QueryAddressArgs,\n },\n result: {\n data: {\n address: vtexOfficeAddress,\n } as Query,\n },\n}\n\n```" } ]
code_broadcaster-adapter_0998c19c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/docs/README.md from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# Broadcaster Adapter\n\nApp in VTEX IO designed to adapat broadcaster catalog changes to an event in IO's Events system.\n\n### How it works?\n\nThe broadcaster adapter will recieve a POST request with the data of the SKU that changed and then it will push an event to the Event system to broadcast to apps that want to listen to this changes.\n\n### Testing\n\nYou can do a `POST` request to\n`app.io.vtex.com/vtex.broadcaster-adapter/v0/{{account}}/{{workspace}}/notify`\nwith the body:\n```\n{\n\t\"HasStockKeepingUnitModified\": \"true\",\n\t\"IdSku\": {{SKU id}}\n}\n```\n\n```" } ]
code_broadcaster-adapter_01de94af
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/node/service.json from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"memory\": 128,\n \"ttl\": 10,\n \"timeout\": 2,\n \"minReplicas\": 2,\n \"maxReplicas\": 10,\n \"workers\": 4,\n \"routes\": {\n \"notify\": {\n \"path\": \"/notify\",\n \"public\": false\n }\n }\n}\n\n```" } ]
code_broadcaster-adapter_f3624592
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/node/package.json from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"co-body\": \"^6.0.0\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^0.0.3\",\n \"@types/node\": \"12.x\",\n \"@vtex/api\": \"6.17.0\",\n \"eslint\": \"^6.3.0\",\n \"eslint-config-vtex\": \"^11.0.0\",\n \"prettier\": \"^1.18.2\",\n \"typescript\": \"3.8.3\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty && eslint -c .eslintrc.json --fix './**/*.ts'\"\n },\n \"version\": \"0.0.1\"\n}\n\n```" } ]
code_broadcaster-adapter_a7ade680
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/node/typings.ts from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { RecorderState, IOClients, ServiceContext, ParamsContext } from '@vtex/api'\n\ndeclare global {\n type Context = ServiceContext<IOClients, State, ParamsContext>\n \n interface State extends RecorderState, BroadcasterEvent {\n payload: BroadcasterEvent\n }\n\n interface BroadcasterEvent {\n HasStockKeepingUnitModified: boolean\n IdSku: string\n }\n\n type ID = string\n type Float = number\n type Int = number\n}\n\n```" } ]
code_broadcaster-adapter_b7444a9e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/node/constants.ts from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const ENABLED_GLOBALLY = false\n\nexport const BROADCASTER_NOTIFICATION = 'broadcaster.notification'\n```" } ]
code_broadcaster-adapter_55f09c75
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/node/index.ts from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Service, IOClients, ParamsContext, method } from '@vtex/api'\n\nimport { parseAndValidate } from './middlewares/parse'\nimport { throttle } from './middlewares/throttle'\nimport { pushNotification } from './middlewares/pushNotification'\n\nconst TREE_SECONDS_MS = 3 * 1000\nconst CONCURRENCY = 10\n\n\nexport default new Service<IOClients, State, ParamsContext>({\n clients: {\n options: {\n events: {\n exponentialTimeoutCoefficient: 2,\n exponentialBackoffCoefficient: 2,\n initialBackoffDelay: 50,\n retries: 1,\n timeout: TREE_SECONDS_MS,\n concurrency: CONCURRENCY,\n }\n },\n },\n routes: {\n notify: method({\n POST: [throttle, parseAndValidate, pushNotification],\n }),\n }\n})\n\n```" } ]
code_broadcaster-adapter_43c7812a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/node/middlewares/pushNotification.ts from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { BROADCASTER_NOTIFICATION } from './../constants'\n\nexport async function pushNotification(ctx: Context, next: () => Promise<any>) {\n const { clients: { events } } = ctx\n\n await events.sendEvent('', BROADCASTER_NOTIFICATION, ctx.state.payload)\n ctx.status = 200\n\n next()\n}\n```" } ]
code_broadcaster-adapter_a53a4071
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/node/middlewares/throttle.ts from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { TooManyRequestsError } from '@vtex/api'\n\nconst MAX_REQUEST = 50\nlet COUNTER = 0\n\nexport async function throttle(\n _: Context,\n next: () => Promise<void>\n) {\n COUNTER++\n try {\n if (COUNTER > MAX_REQUEST) {\n throw new TooManyRequestsError()\n }\n await next()\n } finally {\n COUNTER--\n }\n}\n```" } ]
code_broadcaster-adapter_e077e800
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of broadcaster-adapter/node/middlewares/parse.ts from the broadcaster-adapter VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { json } from 'co-body'\nimport { ENABLED_GLOBALLY } from './../constants'\n\nexport async function parseAndValidate(ctx: Context, next: () => Promise<any>) {\n if (!ENABLED_GLOBALLY) {\n ctx.body = 'Service not enabled.'\n ctx.status = 200\n return\n }\n\n const body = (await json(ctx.req)) as BroadcasterEvent\n\n // Temporary if, in the near future broadcaster will only notify us modifications in SKUs or product.\n if (!body.HasStockKeepingUnitModified) {\n ctx.status = 204\n return\n }\n\n ctx.state.payload = body\n\n await next()\n}\n\n```" } ]
code_shipping-estimate-translator_d38a99e9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/test-utils/index.js from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport { IntlProvider } from 'react-intl'\nimport { render } from 'react-testing-library'\nimport messages from '../messages/en.json'\n\nconst renderWithIntl = node => {\n return render(\n <IntlProvider locale=\"en\" defaultLocale=\"en\" messages={messages}>\n {node}\n </IntlProvider>\n )\n}\n\nexport * from 'react-testing-library'\n\nexport { renderWithIntl }\n\n```" } ]
code_shipping-estimate-translator_a7ba40c5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/sl.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Danes} one {V # delovnem dnevu} two {Do # delovnih dni} few {Do # delovnih dni} other {Do # delovnih dni}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Danes} one {V # dnevu} two {Do # dneh} few {Do # dni} other {Do # dni}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Zdaj} one {V # uri} two {Do # ur} few {Do # ur} other {Do # ur}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Zdaj} one {V # minuti} two {Do # minut} few {Do # minut} other {Do # minut}}\",\n \"shippingEstimate-scheduled\": \"{date}, med {startDate} in {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Načrtovano\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Pripravljeno danes} one {Pripravljeno v # delovnem dnevu} two {Pripravljeno v # delovnih dneh} few {Pripravljeno v # delovnih dneh} other {Pripravljeno v # delovnih dneh}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Pripravljeno danes} one {Pripravljeno v # delovnem dnevu} two {Pripravljeno v # delovnih dneh} few {Pripravljeno v # delovnih dneh} other {Pripravljeno v # delovnih dneh}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Pripravljeno za prevzem} one {Pripravljeno v do # uri} two {Pripravljeno v do # urah} few {Pripravljeno v do # urah} other {Pripravljeno v do # urah}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Pripravljeno za prevzem} one {Pripravljeno v do # minuti} two {Pripravljeno v do # minutah} few {Pripravljeno v do # minutah} other {Pripravljeno v do # minutah}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_59b4d20d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/hu.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Ma} one {# munkanapon belül} other {Legfeljebb # munkanapon belül}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Ma} one {# napon belül} other {Legfeljebb # napon belül}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Most} one {# órán belül} other {Legfeljebb # órán belül}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Most} one {# percen belül} other {Legfeljebb # percen belül}}\",\n \"shippingEstimate-scheduled\": \"{date}, {startDate} és {endDate} között\",\n \"shippingEstimate-scheduled-no-dates\": \"Ütemezett\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Kész ma} one {Kész # munkanapon belül} other {Kész # munkanapon belül}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Kész ma} one {Kész # napon belül} other {Kész # napon belül}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Kész az átvételre} one {Kész # órán belül} other {Kész # órán belül}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Kész az átvételre} one {Kész # percen belül} other {Kész # percen belül}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_335b92a9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/nl.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Vandaag} one {In # werkdag} other {Tot # werkdagen}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Vandaag} one {In # dag} other {Tot # dagen}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Nu} one {In # uur} other {Tot # uren}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Nu} one {In # minuut} other {Tot # minuten}}\",\n \"shippingEstimate-scheduled\": \"{date}, tussen {startDate} en {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Gepland\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Klaar vandaag} one {Klaar in # werkdag} other {Klaar in # werkdagen}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Klaar vandaag} one {Klaar in tot # dag} other {Klaar in tot # dagen}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Klaar om af te halen} one {Klaar in maximaal # uur} other {Klaar in maximaal # uren}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Klaar om af te halen} one {Klaar in # minuut} other {Klaar in maximaal # minuten}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_ae328459
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/ja.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {今日} one {# 営業日} other {最大 # 営業日}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {今日} one {# 日} other {最大 # 日}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {今} one {# 時間} other {最大 # 時間}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {今} one {# 分間} other {最大 # 分間}}\",\n \"shippingEstimate-scheduled\": \"{date}, {startDate} と {endDate} の間\",\n \"shippingEstimate-scheduled-no-dates\": \"スケジュール済み\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {今日で準備完了} one {最大 # 営業日で準備完了} other {最大 # 営業日で準備完了}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {今日で準備完了} one {最大 # 日で準備完了} other {最大 # 日で準備完了}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {ピックアップの準備完了} one {最大 # 時間で準備完了} other {最大 # 時間で準備完了}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {ピックアップの準備完了} one {最大 # 分間で準備完了} other {最大 # 分間で準備完了}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_4eab37e3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/de.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Heute} one {In # Werktag} other {Bis zu # Werktagen}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Heute} one {In # Tag} other {Bis zu # Tage}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Jetzt} one {In # Stunden} other {Bis zu # Stunden}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Jetzt} one {In # Minute} other {Bis zu # Minuten}}\",\n \"shippingEstimate-scheduled\": \"{date}, zwischen {startDate} und {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Geplant\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Heute fertig} one {Fertig in # Werktag} other {Fertig in # Werktagen}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Heute fertig} one {Fertig in # Tag} other {Fertig in # Tagen}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Abholbereit} one {Abholbereit in # Stunde} other {Abholbereit in # Stunden}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Abholbereit} one {Fertig in # Minute} other {Fertig in # Minuten}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_b15a73d0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/ru.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Сегодня} one {За # рабочий день} few {До # рабочих дней} many {До # рабочих дней} other {До # рабочих дней}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Сегодня} one {За # день} few {До # дней} many {До # дней} other {До # дней}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Сейчас} one {За # час} few {До # часов} many {До # часов} other {До # часов}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Сейчас} one {За # минуту} few {До # минут} many {До # минут} other {До # минут}}\",\n \"shippingEstimate-scheduled\": \"{date}, между {startDate} и {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Запланировано\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Готово сегодня} one {Готово через # рабочий день} few {Готово через # рабочих дня} many {Готово через # рабочих дней} other {Готово через # рабочих дней}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Готово сегодня} one {Готово за # день} few {Готово за # дня} many {Готово за # дней} other {Готово за # дней}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Готово к выдаче} one {Готово за # час} few {Готово за # часа} many {Готово за # часов} other {Готово за # часов}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Готово к выдаче} one {Готово за # минуту} few {Готово за # минуты} many {Готово за # минут} other {Готово за # минут}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_56efea04
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/pl.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Dzisiaj} one {Za # dzień roboczy} other {Maks. do # dni roboczych}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Dzisiaj} one {Za # dzień} other {Maks. do # dni}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Teraz} one {Za # godzinę} other {Maks do # godzin}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Teraz} one {Za # minutę} other {Maks. do # minut}}\",\n \"shippingEstimate-scheduled\": \"{date}, pomiędzy {startDate} a {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Zaplanowane\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Gotowa dzisiaj} one {Gotowa za maks. # dzień roboczy} other {Gotowa za maks. # dni roboczych}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Gotowa dzisiaj} one {Gotowa za maks. # dzień} other {Gotowa za maks. # dni}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Gotowa do odbioru} one {Gotowa za maks. # godzinę} other {Gotowa za maks. # godzin}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Gotowa do odbioru} one {Gotowa za maks. # minutę} other {Gotowa za maks. # minut}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_d71557b1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/uk.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Сьогодні} one {За # робочий день} few {До # робочих днів} many {До # робочих днів} other {До # робочих днів}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Сьогодні} one {За # день} few {До # днів} many {До # днів} other {До # днів}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Зараз} one {За # годину} few {За # години} many {За # годин} other {За # годин}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Зараз} one {За # хвилину} few {За # хвилини} many {За # хвилин} other {За # хвилин}}\",\n \"shippingEstimate-scheduled\": \"{date}, з {startDate} по {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Зарезервовано\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Готово сьогодні} one {Готовність до # робочих днів} few {Готовність до # робочих днів} many {Готовність до # робочих днів} other {Готовність до # робочих днів}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Готово сьогодні} one {Готовність до # днів} few {Готовність до # днів} many {Готовність до # днів} other {Готовність до # днів}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Готово до видачі} one {Готовність до # годин} few {Готовність до # годин} many {Готовність до # годин} other {Готовність до # годин}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Готово до видачі} one {Готовність до # хвилин} few {Готовність до # хвилин} many {Готовність до # хвилин} other {Готовність до # хвилин}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_56b96c07
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/fi.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Tänään} one {# työpäivän päästä} other {Enintään # työpäivän päästä}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Tänään} one {# päivän päästä} other {enintään # päivän päästä}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Nyt} one {# tunnin päästä} other {Enintään # tunnin päästä}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Nyt} one {# minuutin päästä} other {Enintään # minuutin päästä}}\",\n \"shippingEstimate-scheduled\": \"{date}, {startDate}–{endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Arvioitu\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Valmis tänään} one {Valmis enintään # työpäivän päästä} other {Valmis enintään # työpäivän päästä}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Valmis tänään} one {Valmis enintään # päivän päästä} other {Valmis enintään # päivän päästä}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Noudettavissa} one {Valmis enintään # tunnin päästä} other {Valmis enintään # tunnin päästä}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Noudettavissa} one {Valmis enintään # minuutin päästä} other {Valmis enintään # minuutin päästä}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_8489a06f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/sk.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Dnes} one {O # pracovný deň} other {Do # pracovných dní}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Dnes} one {O # deň} other {Do # dní}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Hneď} one {O # hodinu} other {Do # hodín}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Hneď} one {O # minútu} other {Do # minút}}\",\n \"shippingEstimate-scheduled\": \"{date}, medzi {startDate} a {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Naplánované\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Pripravené dnes} one {Pripravené za # pracovný deň} other {Pripravené do # pracovných dní}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Pripravené dnes} one {Pripravené za # deň} other {Pripravené do # dní}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Pripravené na vyzdvihnutie} one {Pripravené do # hodiny} other {Pripravené do # hodín}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Pripravené na vyzdvihnutie} one {Pripravené do # minúty} other {Pripravené do # minút}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_363f145e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/pt.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {No mesmo dia} one {Em até # dia útil} other {Em até # dias úteis}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {No mesmo dia} one {Em até # dia} other {Em até # dias}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Em alguns instantes} one {Em até # hora} other {Em até # horas}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Em alguns instantes} one {Em até # minuto} other {Em até # minutos}}\",\n \"shippingEstimate-scheduled\": \"{date}, entre {startDate} e {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Agendada\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Pronto no mesmo dia} one {Pronto em até # dia útil} other {Pronto em até # dias úteis}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Pronto no mesmo dia} one {Pronto em até # dia} other {Pronto em até # dias}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Em alguns instantes} one {Pronto em até # hora} other {Pronto em até # horas}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Em alguns instantes} one {Pronto em até # minuto} other {Pronto em até # minutos}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_5f32f92d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/en.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Today} one {In # business day} other {Up to # business days}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Today} one {In # day} other {Up to # days}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Now} one {In # hour} other {Up to # hours}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Now} one {In # minute} other {Up to # minutes}}\",\n \"shippingEstimate-scheduled\": \"{date}, between {startDate} and {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Scheduled\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Ready today} one {Ready in up to # business day} other {Ready in up to # business days}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Ready today} one {Ready in up to # day} other {Ready in up to # days}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Ready for pickup} one {Ready in up to # hour} other {Ready in up to # hours}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Ready for pickup} one {Ready in up to # minute} other {Ready in up to # minutes}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_eb9ed562
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/pt-PT.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {No mesmo dia} one {# dia útil} other {# dias úteis}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {No mesmo dia} one {# dia} other {# dias}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Em alguns instantes} one {# hora} other {# horas}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Em alguns instantes} one {# minuto} other {# minutos}}\",\n \"shippingEstimate-scheduled\": \"{date}, entre {startDate} e {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Agendada\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Disponível no mesmo dia} one {Disponível até # dia útil} other {Disponível até # dias úteis}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Disponível no mesmo dia} one {Disponível até # dia} other {Disponível até # dias}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Em alguns instantes} one {Disponível até # hora} other {Disponível até # horas}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Em alguns instantes} one {Disponível até # minuto} other {Disponível até # minutos}}\"\n}\n```" } ]
code_shipping-estimate-translator_7ef3d8c3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/it.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Oggi} one {Entro # giorno lavorativo} other {Entro # giorni lavorativi}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Oggi} one {Entro # giorno} other {Entro # giorni}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Ora} one {Entro # ora} other {Entro # ore}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Ora} one {Entro # minuto} other {Entro # minuti}}\",\n \"shippingEstimate-scheduled\": \"{date}, tra il giorno {startDate} e il giorno {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Programmato\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Pronto oggi} one {Pronto entro massimo # giorno lavorativo} other {Pronto entro massimo # giorni lavorativi}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Pronto oggi} one {Pronto entro massimo # giorno} other {Pronto entro massimo # giorni}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Pronto al ritiro} one {Pronto entro massimo # ora} other {Pronto entro massimo # ore}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Pronto al ritiro} one {Pronto entro massimo # minuto} other {Pronto entro massimo # minuti}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_329b6224
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/fr.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Aujourd'hui} one {Dans # jour ouvré} other {Un maximum de # jours ouvrables}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Aujourd'hui} one {Dans # jour} other {Un maximum de # jours}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Maintenant} one {Dans # heure} other {Jusqu’à # heures}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Maintenant} one {Dans # minute} other {Jusqu’à # minutes}}\",\n \"shippingEstimate-scheduled\": \"{date}, entre {startDate} et {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Prévu\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Prêt aujourd'hui} one {Prêt dans # jour ouvré} other {Prêt dans # jours ouvrables}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Prêt aujourd’hui} one {Prêt dans # jour} other {Prêt dans # jours}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Prêt pour le retrait} one {Prêt dans # heure} other {Prêt dans # heures}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Prêt pour le retrait} one {Prêt dans # minute} other {Prêt dans # minutes}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_f709714b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/el.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Σήμερα} one {Σε # εργάσιμη ημέρα} other {Έως # εργάσιμες ημέρες}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Σήμερα} one {Σε # ημέρα} other {Έως # ημέρες}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Τώρα} one {Σε # ώρα} other {Έως # ώρες}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Τώρα} one {Σε # λεπτό} other {Έως # λεπτά}}\",\n \"shippingEstimate-scheduled\": \"{date}, μεταξύ {startDate} και {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Προγραμματίστηκε\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Έτοιμο σήμερα} one {Έτοιμο σε έως # εργάσιμη ημέρα} other {Έτοιμο σε έως # εργάσιμες ημέρες}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Έτοιμο σήμερα} one {Έτοιμο σε έως # ημέρα} other {Έτοιμο σε έως # ημέρες}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Έτοιμο για παραλαβή} one {Έτοιμο σε έως # ώρα} other {Έτοιμο σε έως # ώρες}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Έτοιμο για παραλαβή} one {Έτοιμο σε έως # λεπτό} other {Έτοιμο σε έως # λεπτά}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_9052c496
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/bg.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Днес} one {До # работен ден} other {До # работни дни}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Днес} one {До # ден} other {До # дни}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Сега} one {До # час} other {До # часа}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Сега} one {До # минута} other {До # минути}}\",\n \"shippingEstimate-scheduled\": \"{date}, между {startDate} и {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Планирано\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Готово днес} one {Готово до # работен ден} other {Готово до # работни дни}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Готово днес} one {Готово до # ден} other {Готово до # дни}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Готово за получаване} one {Готово до # час} other {Готово до # часа}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Готово за получаване} one {Готово до # минута} other {Готово до # минути}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_c9706839
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/ro.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {În aceeași zi} one {În # zi lucrătoare} other {Până la # zile lucrătoare}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {În aceeași zi} one {În # zi} other {Până la # zile}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Acum} one {În # oră} other {Până la # ore}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Acum} one {În # minut} other {Până la # minute}}\",\n \"shippingEstimate-scheduled\": \"{date}, între {startDate} și {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Programată\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Gata în aceeași zi} one {Gata în # zi lucrătoare} other {Gata până în # zile lucrătoare}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Gata în aceeași zi} one {Gata în # zi} other {Gata până în # zile}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Gata de ridicat} one {Gata în # oră} other {Gata până în # ore}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Gata de ridicat} one {Gata în # minut} other {Gata până în # minute}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_4f477054
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/ca.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Avui} one {En # dia hàbil} other {# dies hàbils com a màxim}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Avui} one {En # dia} other {# dies com a màxim}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Ara} one {En # hora} other {# hores com a màxim}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Ara} one {En # minut} other {# minuts com a màxim}}\",\n \"shippingEstimate-scheduled\": \"{date}, entre el {startDate} i el {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Programat\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {A punt avui} one {A punt en # dia hàbil com a màxim} other {A punt en # dies hàbils com a màxim}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {A punt avui} one {A punt en # dia com a màxim} other {A punt en # dies com a màxim}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {A punt perquè es reculli} one {A punt en # hora com a màxim} other {A punt en # hores com a màxim}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {A punt perquè es reculli} one {A punt en # minut com a màxim} other {A punt en # minuts com a màxim}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_c6e1ff60
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/ko.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {당일} one {# 영업일} other {최대 # 영업일}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {당일} one {# 일} other {최대 # 일}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {지금} one {# 시간} other {최대 # 시간}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {지금} one {# 분} other {최대 # 분}}\",\n \"shippingEstimate-scheduled\": \"{date}, {startDate} 와 {endDate} 사이\",\n \"shippingEstimate-scheduled-no-dates\": \"예정\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {당일} one {최대 # 영업일 내 준비} other {최대 # 영업일 내 준비}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {오늘 준비} one {최대 # 일 내 준비} other {최대 # 일 내 준비}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {픽업 준비} one {최대 # 시간 내 준비} other {최대 # 시간 내 준비}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {픽업 준비} one {최대 # 분 내 준비} other {최대 # 분 내 준비}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_2394f957
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/cs.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Dnes} one {Za # pracovní den} few {Až # pracovních dnů} many {Až # pracovních dnů} other {Až # pracovních dnů}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Dnes} one {Za # den} few {Až # dnů} many {Až # dnů} other {Až # dnů}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Nyní} one {Za # hodinu} few {Až # hodin} many {Až # hodin} other {Až # hodin}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Nyní} one {Za # minutu} few {Až # minut} many {Až # minut} other {Až # minut}}\",\n \"shippingEstimate-scheduled\": \"{date}, od {startDate} do {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Naplánováno\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Připraveno dnes} one {Připraveno za až # pracovní den} few {Připraveno za až # pracovních dnů} many {Připraveno za až # pracovních dnů} other {Připraveno za až # pracovních dnů}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Připraveno dnes} one {Připraveno za až # den} few {Připraveno za až # dnů} many {Připraveno za až # dnů} other {Připraveno za až # dnů}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Připraveno k vyzvednutí} one {Připraveno za až # hodinu} few {Připraveno za až # hodin} many {Připraveno za až # hodin} other {Připraveno za až # hodin}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Připraveno k vyzvednutí} one {Připraveno za až # minutu} few {Připraveno za až # minut} many {Připraveno za až # minut} other {Připraveno za až # minut}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_7b54978f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/id.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Hari ini} one {Dalam # hari kerja} other {Hingga # hari kerja}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Hari ini} one {Dalam # hari} other {Hingga # hari}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Sekarang} one {Dalam # jam} other {Hingga # jam}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Sekarang} one {Dalam # menit} other {Hingga # menit}}\",\n \"shippingEstimate-scheduled\": \"{date}, antara {startDate} hingga {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Dijadwalkan\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Siap hari ini} one {Siap dalam # hari kerja} other {Siap dalam # hari kerja}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Siap hari ini} one {Siap dalam hingga # hari} other {Siap dalam hingga # hari}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Siap untuk diambil} one {Siap dalam hingga # jam} other {Siap dalam hingga # jam}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Siap untuk diambil} one {Siap dalam hingga # menit} other {Siap dalam hingga # menit}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_fc4e410d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/no.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {I dag} one {Om # virkedag} other {Opptil # virkedager}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {I dag} one {Om # dag} other {Opptil # dager}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Nå} one {Om # time} other {Opptil # timer}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Nå} one {Om # minutt} other {Opptil # minutter}}\",\n \"shippingEstimate-scheduled\": \"{date}, mellom {startDate} og {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Planlagt\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Klar i dag} one {Klar om opptil # virkedag} other {Klar om opptil # virkedager}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Klar i dag} one {Klar om opptil # dag} other {Klar om opptil # dager}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Klar for henting} one {Klar om opptil # time} other {Klar om opptil # timer}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Klar for henting} one {Klar om opptil # minutt} other {Klar om opptil # minutter}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_fcef9516
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/da.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {i dag} one {Om # hverdag} other {Op til # hverdage}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {I dag} one {Om # dag} other {Op til # dage}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Nu} one {Om # time} other {Op til # timer}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Nu} one {Om # minut} other {Op til # minutter}}\",\n \"shippingEstimate-scheduled\": \"{date}, mellem {startDate} og {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Planlagt\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Klar i dag} one {Klar på op til # hverdag} other {Klar på op til # hverdage}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Klar i dag} one {Klar på op til # dag} other {Klar på op til # dage}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Klar til afhentning} on {Klar på op til # time} other {Klar på op til # timer}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Klar til afhentning} one {Klar på op til # minut} other {Klar på op til # minutter}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_2179a86d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/sv.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Idag} one {I # arbetsdag} other {Upp till # arbetsdagar}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Idag} one {I # dagar} other {Upp till # dagar}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Nu} one {I # timme} other {Upp till # timmar}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Nu} one {I # minut} other {Upp till # minuter}}\",\n \"shippingEstimate-scheduled\": \"{date}, mellan {startDate} och {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Schemalagd\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Redo idag} one {Redo i upp till # arbetsdag} other {Redo i upp till # arbetsdagar}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Redo idag} one {Redo i upp till # dag} other {Redo i upp till # dagar}}​\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Redo för upphämtning} one {Redo i upp till # timme} other {Redo i upp till # timmar}}​\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Redo för upphämtning} one {Redo i upp till # minut} other {Redo i upp till # minuter}}​\"\n}\n\n```" } ]
code_shipping-estimate-translator_31b786ea
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/es.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {Mismo día} one {En # día hábil} other {En hasta # días hábiles}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {Mismo día} one {En # día} other {En hasta # días}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {Con entrega inmediata} one {En # hora} other {En hasta # horas}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {Con entrega inmediata} one {En # minuto} other {En hasta # minutos}}\",\n \"shippingEstimate-scheduled\": \"{date}, entre las {startDate} y las {endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"Programado\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {Listo el mismo día} one {Listo en hasta # día hábil} other {Listo en hasta # días hábiles}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {Listo el mismo día} one {Listo en hasta # día} other {Listo en hasta # días}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {Con retirada inmediata} one {Listo en hasta # hora} other {Listo en hasta # horas}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {Con retirada inmediata} one {Listo en hasta # minuto} other {Listo en hasta # minutos}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_7bfd3181
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/messages/ar.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"shippingEstimate-bd\": \"{timeAmount, plural, =0 {اليوم} one {خلال # يوم عمل} other {لغاية # أيام عمل}}\",\n \"shippingEstimate-d\": \"{timeAmount, plural, =0 {اليوم} one {خلال # يوم} other {لغاية # أيام}}\",\n \"shippingEstimate-h\": \"{timeAmount, plural, =0 {الآن} one {خلال # ساعة} other {لغاية # ساعات}}\",\n \"shippingEstimate-m\": \"{timeAmount, plural, =0 {الآن} one {خلال # دقيقة} other {لغاية # دقائق}}\",\n \"shippingEstimate-scheduled\": \"{date}، بين {startDate} و{endDate}\",\n \"shippingEstimate-scheduled-no-dates\": \"مبرمجة\",\n \"shippingEstimatePickup-bd\": \"{timeAmount, plural, =0 {جاهز اليوم} one {جاهز خلال # يوم عمل} other {جاهز خلال # أيام عمل}}\",\n \"shippingEstimatePickup-d\": \"{timeAmount, plural, =0 {جاهز اليوم} one {جاهز خلال # يوم} other {جاهز خلال # أيام}}\",\n \"shippingEstimatePickup-h\": \"{timeAmount, plural, =0 {جاهز للإستلام} one {جاهز خلال # ساعة} other {جاهز خلال # ساعات}}\",\n \"shippingEstimatePickup-m\": \"{timeAmount, plural, =0 {جاهز للإستلام} one {جاهز خلال # دقيقة} other {جاهز خلال # دقائق}}\"\n}\n\n```" } ]
code_shipping-estimate-translator_5d3d15b9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/.vtex/deployment.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n[\n {\n \"name\": \"shipping-estimate-translator\",\n \"description\": \"\",\n \"source\": \"https://github.com/vtex/omniomni.git\",\n \"script\": {\n \"ci\": \".vtex/ci.yml\"\n },\n \"build\": {\n \"type\": \"codebuild\",\n \"image\": \"053131491888.dkr.ecr.us-east-1.amazonaws.com/awsbuild/ubuntu/node:8\",\n \"vpc\": {\n \"id\": \"vpc-d4f109b1\",\n \"subnets\": [\"subnet-955f63d3\", \"subnet-245f030c\", \"subnet-0e35267a\"],\n \"securityGroups\": [\"sg-c84127b3\"]\n }\n },\n \"service\": {\n \"type\": \"front\"\n },\n \"tags\": [\n {\n \"key\": \"Product\",\n \"value\": \"omniomni\"\n },\n {\n \"key\": \"Owner\",\n \"value\": \"Shopping XP\"\n },\n {\n \"key\": \"Team\",\n \"value\": \"Shopping XP\"\n }\n ]\n }\n]\n\n```" } ]
code_shipping-estimate-translator_39ee48e4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/docs/README.md from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# Shipping Estimate Translator\n\n> A React component that renders shippingEstimate property from Checkout's OrderForm\n\n## Setup\n\nThrough **vtex.io**:\n\nAdd the following dependency to your `manifest.json` dependencies:\n\n```\n\"vtex.shipping-estimate-translator\": \"1.x\"\n```\n\n## Usage\n\n```js\nimport TranslateEstimate from 'vtex.shipping-estimate-translator/TranslateEstimate'\n\n<TranslateEstimate shippingEstimate=\"0bd\" />\n// Same day\n\n<TranslateEstimate shippingEstimate=\"1m\" />\n// In 1 minute\n\n<TranslateEstimate shippingEstimate=\"0m\" isPickup />\n// Ready for pickup\n\n<TranslateEstimate shippingEstimate=\"3m\" lowerCase />\n// in 3 minutes\n```\n\n### Params\n\n- **shippingEstimate** | Type `string` | String to be translated\n- **isPickup** | Type `boolean` | Condition to translate estimate for pickup point\n- **lowerCase** | Type `boolean` | Condition to convert translated content to lowerCase\n\n### Returns\n\n- **Translated value** | Type `string`\n\n## Testing\n\n```sh\nyarn test\n```\n\n```" } ]
code_shipping-estimate-translator_ba049a68
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/TranslateEstimate.test.js from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\n\nimport TranslateEstimate from './TranslateEstimate'\nimport { renderWithIntl, cleanup } from '../test-utils' // eslint-disable-line import/named\n\ndescribe('TranslateEstimate - Empty Values', () => {\n afterEach(cleanup)\n\n it('should return empty string if does not pass shippingEstimate', () => {\n const { getByText } = renderWithIntl(<TranslateEstimate />)\n\n const expectedLabel = ''\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return empty string if passes only number', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0\" />\n )\n\n const expectedLabel = ''\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return empty string if passes only string', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"bd\" />\n )\n\n const expectedLabel = ''\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return value in lowerCase if the prop is passed', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1bd\" lowerCase />\n )\n\n const expectedLabel = 'in 1 business day'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n})\n\ndescribe('TranslateEstimate - Valid Values', () => {\n describe('Minutes', () => {\n afterEach(cleanup)\n\n it('should return correct for 0 minute', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0m\" />\n )\n\n const expectedLabel = 'Now'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for 1 minute', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1m\" />\n )\n\n const expectedLabel = 'In 1 minute'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for multiple minutes', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"3m\" />\n )\n\n const expectedLabel = 'Up to 3 minutes'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Hours', () => {\n afterEach(cleanup)\n\n it('should return correct for 0 hour', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0h\" />\n )\n\n const expectedLabel = 'Now'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for 1 hours', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1h\" />\n )\n\n const expectedLabel = 'In 1 hour'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for multiple hours', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"3h\" />\n )\n\n const expectedLabel = 'Up to 3 hours'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Days', () => {\n afterEach(cleanup)\n\n it('should return correct for 0 day', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0d\" />\n )\n\n const expectedLabel = 'Today'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for 1 days', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1d\" />\n )\n\n const expectedLabel = 'In 1 day'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for multiple days', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"3d\" />\n )\n\n const expectedLabel = 'Up to 3 days'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Business Days', () => {\n afterEach(cleanup)\n\n it('should return correct for 0 business day', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0bd\" />\n )\n\n const expectedLabel = 'Today'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for 1 business days', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1bd\" />\n )\n\n const expectedLabel = 'In 1 business day'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for multiple business days', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"3bd\" />\n )\n\n const expectedLabel = 'Up to 3 business days'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Pickup Minutes', () => {\n afterEach(cleanup)\n\n it('should return correct for 0 minute', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0m\" isPickup />\n )\n\n const expectedLabel = 'Ready for pickup'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for 1 minute', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1m\" isPickup />\n )\n\n const expectedLabel = 'Ready in up to 1 minute'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for multiple minutes', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"3m\" isPickup />\n )\n\n const expectedLabel = 'Ready in up to 3 minutes'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Pickup Hours', () => {\n afterEach(cleanup)\n\n it('should return correct for 0 hour', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0h\" isPickup />\n )\n\n const expectedLabel = 'Ready for pickup'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for 1 hours', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1h\" isPickup />\n )\n\n const expectedLabel = 'Ready in up to 1 hour'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for multiple hours', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"3h\" isPickup />\n )\n\n const expectedLabel = 'Ready in up to 3 hours'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Pickup Days', () => {\n afterEach(cleanup)\n\n it('should return correct for 0 day', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0d\" isPickup />\n )\n\n const expectedLabel = 'Ready today'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for 1 days', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1d\" isPickup />\n )\n\n const expectedLabel = 'Ready in up to 1 day'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for multiple days', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"3d\" isPickup />\n )\n\n const expectedLabel = 'Ready in up to 3 days'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Pickup Business Days', () => {\n afterEach(cleanup)\n\n it('should return correct for 0 business day', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0bd\" isPickup />\n )\n\n const expectedLabel = 'Ready today'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for 1 business days', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"1bd\" isPickup />\n )\n\n const expectedLabel = 'Ready in up to 1 business day'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n\n it('should return correct for multiple business days', () => {\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"3bd\" isPickup />\n )\n\n const expectedLabel = 'Ready in up to 3 business days'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Scheduled delivery/pickup', () => {\n afterEach(cleanup)\n\n it('should return correct for a given delivery window', () => {\n const deliveryWindow = {\n startDateUtc: '2019-01-21T12:00:00+00:00',\n endDateUtc: '2019-01-21T13:00:00+00:00',\n }\n\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0bd\" scheduled={deliveryWindow} />\n )\n\n const expectedLabel = '1/21/2019, between 12:00 PM and 1:00 PM'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n\n describe('Scheduled delivery', () => {\n afterEach(cleanup)\n\n it('should return correct for a scheduled delivery with no delivery window', () => {\n const deliveryWindow = {\n startDateUtc: null,\n endDateUtc: null,\n }\n\n const { getByText } = renderWithIntl(\n <TranslateEstimate shippingEstimate=\"0bd\" scheduled={deliveryWindow} />\n )\n\n const expectedLabel = 'Scheduled'\n\n expect(getByText(expectedLabel).textContent).toBe(expectedLabel)\n })\n })\n})\n\n```" } ]
code_shipping-estimate-translator_40f1f7f0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/TranslateEstimate.js from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport PropTypes from 'prop-types'\nimport { injectIntl, intlShape } from 'react-intl'\n\nimport { getEstimateTranslation } from './getEstimateTranslation'\nimport { deliveryWindowShape } from './shapes'\n\nconst TranslateEstimate = ({\n intl,\n isPickup,\n lowerCase,\n shippingEstimate,\n scheduled,\n}) => {\n return getEstimateTranslation({\n intl,\n isPickup,\n lowerCase,\n shippingEstimate,\n scheduled,\n })\n}\n\nTranslateEstimate.defaultProps = {\n shippingEstimate: '',\n lowerCase: false,\n}\n\nTranslateEstimate.propTypes = {\n intl: intlShape,\n isPickup: PropTypes.bool,\n lowerCase: PropTypes.bool,\n shippingEstimate: PropTypes.string.isRequired,\n scheduled: deliveryWindowShape,\n}\n\nexport default injectIntl(TranslateEstimate)\n\n```" } ]
code_shipping-estimate-translator_b1ce995a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building 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/package.json from the shipping-estimate-translator VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"shippint-estimate-translator\",\n \"version\": \"1.1.2\",\n \"description\": \"\",\n \"dependencies\": {\n \"react-intl\": \"^2.7.2\"\n }\n}\n\n```" } ]