id
stringlengths
12
53
messages
listlengths
3
3
code_open-graph_7479dc1a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of open-graph/react/hooks/useAppSettings.ts from the open-graph VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { useQuery } from 'react-apollo'\n\nimport GET_SETTINGS from '../queries/getSettings.graphql'\n\nconst DEFAULT_DISABLE_OFFERS = false\n\ninterface Settings {\n disableOffers: boolean\n}\n\nconst useAppSettings = (): Settings => {\n const { data } = useQuery(GET_SETTINGS, { ssr: false })\n\n if (data?.publicSettingsForApp?.message) {\n const { disableOffers } = JSON.parse(data.publicSettingsForApp.message)\n\n return {\n disableOffers: disableOffers || DEFAULT_DISABLE_OFFERS,\n }\n }\n\n return {\n disableOffers: DEFAULT_DISABLE_OFFERS,\n }\n}\n\nexport default useAppSettings\n\n```" } ]
code_product-details_4b352ef7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/hu.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Termékrészletek\",\n \"admin/editor.product-details.description\": \"Termékrészletek összetevő\",\n \"admin/editor.product-details.maxImages.title\": \"Max. miniatűrképek\",\n \"admin/editor.product-details.displayVertically.title\": \"Miniatűrök függőleges megjelenítése\",\n \"admin/editor.product-details.highlights.default\": \"Alapértelmezett kiemelés kiválasztása\",\n \"store/button-label\": \"Vásárlás\",\n \"store/addToCartButton.label\": \"Tétel hozzáadása a kosárhoz\",\n \"store/share.title\": \"{product} {sku} – {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Írja be a specifikációs csoportokat alább\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Írja be a specifikációkat alább\",\n \"admin/editor.product-details.showHighlight.title\": \"Kiemelések megjelenítése\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Minden specifikáció\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Csoportspecifikáció\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Mezőspecifikáció\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Miniatűrök pozíciója\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Bal\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Jobb\",\n \"store/product-details.quantity\": \"Mennyiség\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# érhető el} other {# érhető el}}\",\n \"admin/editor.product-quantity-selector.title\": \"Termékmennyiség-választó összetevő\",\n \"admin/editor.product-quantity-selector.description\": \"Olyan összetevő, amely lehetővé teszi a felhasználó számára, hogy kiválassza a kosárba adandó termékek mennyiségét\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"A rendelkezésre álló mennyiségre vonatkozó figyelmeztetés küszöbértéke\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Csak akkor jelenítse meg a készleten lévő többi termék mennyiségét, ha a rendelkezésre álló tételmennyiség kisebb vagy egyenlő az ebben a tulajdonságban megadott értékkel\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Termékspecifikációk megjelenítése a következő szerint:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Lapos megtekintési mód\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Táblázatos megtekintési mód\",\n \"admin/editor.product-details.product-specifications.default\": \"Alapértelmezett specifikációk kiválasztása\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Minden specifikáció\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Mezőspecifikáció\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Írja be az értékeket vesszővel elválasztva\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Írja be a specifikációkat alább\"\n}\n\n```" } ]
code_product-details_cd41d050
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/it-IT.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Dettagli del prodotto\",\n \"admin/editor.product-details.description\": \"Componente dei dettagli del prodotto\",\n \"admin/editor.product-details.maxImages.title\": \"Numero massimo di immagini in miniatura\",\n \"admin/editor.product-details.displayVertically.title\": \"Visualizza miniature in verticale\",\n \"admin/editor.product-details.highlights.default\": \"Scegli evidenziazione predefinita\",\n \"store/button-label\": \"Compra\",\n \"store/addToCartButton.label\": \"Aggiungi articolo al carrello\",\n \"store/share.title\": \"{product} {sku} in {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Inserisci gruppi di specifiche\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Inserisci specifiche\",\n \"admin/editor.product-details.showHighlight.title\": \"Mostra elementi in evidenza\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Tutte le specifiche\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Specifiche personalizzate\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Specifiche personalizzate\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Posizione delle miniature\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Sinistra\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Destra\",\n \"store/product-details.quantity\": \"Quantità\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# disponibile} other {# disponibili}}\",\n \"admin/editor.product-quantity-selector.title\": \"Selettore di quantità del prodotto\",\n \"admin/editor.product-quantity-selector.description\": \"Un componente che consente all'utente di selezionare la quantità di articoli da aggiungere al carrello\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Soglia di avviso sulla quantità disponibile\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Indica la quantità di articoli rimanenti in stock solo se la quantità disponibile è inferiore o uguale al valore indicato in questo campo\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Mostra specifiche del prodotto per:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Visualizzazione in schede\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Visualizzazione in tabella\",\n \"admin/editor.product-details.product-specifications.default\": \"Scegli specifiche predefinite\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Tutte le specifiche\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Specifiche personalizzate\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Digita i valori separati da una virgola\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Inserisci specifiche a continuazione\"\n}\n\n```" } ]
code_product-details_aa5258bc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/th-TH.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"รายละเอียดผลิตภัณฑ์\",\n \"admin/editor.product-details.description\": \"คอมโพเนนต์ของรายละเอียดผลิตภัณฑ์\",\n \"admin/editor.product-details.maxImages.title\": \"ภาพตัวอย่างขนาดเล็กสูงสุด\",\n \"admin/editor.product-details.displayVertically.title\": \"แสดงภาพตัวอย่างขนาดเล็กในแนวตั้ง\",\n \"admin/editor.product-details.highlights.default\": \"เลือกค่าไฮไลต์เรื่มต้น\",\n \"store/button-label\": \"ซื้อ\",\n \"store/addToCartButton.label\": \"เพิ่มสินค้าลงในรถเข็น\",\n \"store/share.title\": \"{product} {sku} ที่ {store}: \",\n \"admin/editor.product-details.highlights.title\": \"พิมพ์กลุ่มข้อกำหนดคุณลักษณะด้านล่าง\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"พิมพ์ข้อกำหนดคุณลักษณะด้านล่าง\",\n \"admin/editor.product-details.showHighlight.title\": \"แสดงไฮไลต์\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"ข้อกำหนดคุณลักษณะทั้งหมด\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"ข้อกำหนดคุณลักษณะกลุ่ม\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"ข้อกำหนดคุณลักษณะฟิลด์\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"ตำแหน่งภาพตัวอย่างขนาดเล็ก\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"ซ้าย\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"ขวา\",\n \"store/product-details.quantity\": \"จำนวน\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# พร้อมจำหน่่าย} other {# พร้อมจำหน่่าย}}\",\n \"admin/editor.product-quantity-selector.title\": \"คอมโพเนนต์ของตัวเลือกจำนวนผลิตภัณฑ์\",\n \"admin/editor.product-quantity-selector.description\": \"คอมโพเนนต์ที่ทำให้ผู้ใช้สามารถเลือกจำนวนสินค้าเพื่อเพิ่มลงในรถเข็น\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"เกณฑ์การเตือนจำนวนสินค้าพร้อมจำหน่าย\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"แสดงเฉพาะจำนวนสินค้าคงเหลือในคลังสินค้า หากจำนวนสินค้าพร้อมจำหน่ายน้อยกว่าหรือเท่ากับค่าที่ส่งผ่านในคุณสมบัตินี้\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"แสดงข้อกำหนดคุณลักษณะผลิตถัณฑ์ตาม:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"โหมดดูแท็บ\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"โหมดดูตาราง\",\n \"admin/editor.product-details.product-specifications.default\": \"เลือกค่าข้อกำหนดคุณลักษณะเริ่มต้น\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"ข้อกำหนดคุณลักษณะทั้งหมด\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"ข้อกำหนดคุณลักษณะฟิลด์\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"พิมพ์ค่าที่แยกโดยเครื่องหมายคอมม่า\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"พิมพ์ข้อกำหนดคุณลักษณะด้านล่าง\"\n}\n\n```" } ]
code_product-details_dd57b08f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/ko-KR.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"제품 상세 내역\",\n \"admin/editor.product-details.description\": \"제품 상세내역 요소\",\n \"admin/editor.product-details.maxImages.title\": \"최대 섬네일 이미지\",\n \"admin/editor.product-details.displayVertically.title\": \"섬네일 수직으로 표시\",\n \"admin/editor.product-details.highlights.default\": \"기본 하이라이트 선택\",\n \"store/button-label\": \"구매\",\n \"store/addToCartButton.label\": \"장바구니에 항목 추가\",\n \"store/share.title\": \"{store} 의 {product} {sku}: \",\n \"admin/editor.product-details.highlights.title\": \"아래에 사양 그룹 입력\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"아래에 사양 입력\",\n \"admin/editor.product-details.showHighlight.title\": \"하이라이트 표시\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"모든 사양\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"그룹 사양\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"필드 사양\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"섬네일 위치\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"왼쪽\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"오른쪽\",\n \"store/product-details.quantity\": \"수량\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, other {#개 가능}}\",\n \"admin/editor.product-quantity-selector.title\": \"제품 수량 선택기 구성 요소\",\n \"admin/editor.product-quantity-selector.description\": \"카트에 추가할 항목의 양을 선택할 수 있는 구성 요소\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"이용 가능한 수량 경고의 임계값\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"이용 가능한 품목 수량이 이 속성에 전달된 값보다 작거나 같은 경우에만 재고가 남아 있는 품목의 수량 표시\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"제품 사양 표시:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"탭 보기 모드\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"테이블 보기 모드\",\n \"admin/editor.product-details.product-specifications.default\": \"기본 사양 선택\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"모든 사양\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"필드 사양\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"쉼표로 구분된 값 입력\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"아래에 사양 입력\"\n}\n\n```" } ]
code_product-details_3843d5b0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/nn-NO.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Produktdetaljer\",\n \"admin/editor.product-details.description\": \"Produktdetaljer-komponent\",\n \"admin/editor.product-details.maxImages.title\": \"Maksimalt antall miniatyrbilder\",\n \"admin/editor.product-details.displayVertically.title\": \"Vis miniatyrbilder vertikalt\",\n \"admin/editor.product-details.highlights.default\": \"Velg standard markering\",\n \"store/button-label\": \"Kjøp\",\n \"store/addToCartButton.label\": \"Legg vare i handlekurv\",\n \"store/share.title\": \"{product} {sku} hos {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Type spesifikasjonsgrupper nedenfor\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Type spesifikasjoner nedenfor\",\n \"admin/editor.product-details.showHighlight.title\": \"Vis høydepunkter\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Alle spesifikasjoner\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Gruppespesifikasjoner\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Feltspesifikasjoner\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Plassering av miniatyrbilde\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Venstre\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Høyre\",\n \"store/product-details.quantity\": \"Antall\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# tilgjengelig} other {# tilgjengelig}}\",\n \"admin/editor.product-quantity-selector.title\": \"Velgerkomponent for produktantall\",\n \"admin/editor.product-quantity-selector.description\": \"En komponent som lar brukeren velge antall varer å legge i handlekurven\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Terskeladvarsel for tilgjengelig mengde\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Vis kun antall gjenværende varer på lager dersom tilgjengelige antall er mindre enn eller lik verdien som passeres i denne egenskapen\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Vis produktspesifikasjoner etter:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Fane visningsmodus\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Tabell visningsmodus\",\n \"admin/editor.product-details.product-specifications.default\": \"Velg standardspesifikasjoner\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Alle spesifikasjoner\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Feltspesifikasjoner\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Skriv inn verdiene med komma mellom\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Type spesifikasjoner nedenfor\"\n}\n\n```" } ]
code_product-details_6847b0b9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/ja-JP.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"製品詳細\",\n \"admin/editor.product-details.description\": \"製品詳細コンポーネント\",\n \"admin/editor.product-details.maxImages.title\": \"最大サムネイル画像\",\n \"admin/editor.product-details.displayVertically.title\": \"サムネイルを垂直方向に表示\",\n \"admin/editor.product-details.highlights.default\": \"デフォルトハイライトを選ぶ\",\n \"store/button-label\": \"購入する\",\n \"store/addToCartButton.label\": \"項目をカートに追加\",\n \"store/share.title\": \"{store} の {product} {sku}: \",\n \"admin/editor.product-details.highlights.title\": \"仕様グループを以下に入力\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"仕様を以下に入力\",\n \"admin/editor.product-details.showHighlight.title\": \"ハイライトを表示\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"すべての仕様\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"グループ仕様\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"フィールド仕様\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"サムネイルの位置\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"左\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"右\",\n \"store/product-details.quantity\": \"数量\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# 個が利用可能} other {# 個が利用可能}}\",\n \"admin/editor.product-quantity-selector.title\": \"製品数量セレクタコンポーネント\",\n \"admin/editor.product-quantity-selector.description\": \"ユーザーがカートに追加する項目の合計額を選択できるようになるコンポーネント\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"在庫数の警告のしきい値\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"項目の在庫数がこのプロパティで渡された値以下である場合、在庫にある残りの項目数だけを表示\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"製品仕様を表示:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"タブ閲覧モード\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"表閲覧モード\",\n \"admin/editor.product-details.product-specifications.default\": \"デフォルト仕様を選ぶ\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"すべての仕様\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"フィールド仕様\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"コンマで区切られた値を入力\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"仕様を以下に入力\"\n}\n\n```" } ]
code_product-details_18c979a0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/id-ID.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Detail Produk\",\n \"admin/editor.product-details.description\": \"Komponen Detail Komponen\",\n \"admin/editor.product-details.maxImages.title\": \"Gambar mini maksimal\",\n \"admin/editor.product-details.displayVertically.title\": \"Tampilkan gambar mini secara vertikal\",\n \"admin/editor.product-details.highlights.default\": \"Pilih sorotan default\",\n \"store/button-label\": \"Beli\",\n \"store/addToCartButton.label\": \"Tambah item ke troli\",\n \"store/share.title\": \"{product} {sku} di {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Ketik grup spesifikasi di bawah ini\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Ketik spesifikasi di bawah ini\",\n \"admin/editor.product-details.showHighlight.title\": \"Tampilkan sorotan\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Semua Spesifikasi\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Spesifikasi Grup\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Spesifikasi Bidang\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Posisi gambar mini\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Kiri\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Kanan\",\n \"store/product-details.quantity\": \"Jumlah\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# tersedia} other {# tersedia}}\",\n \"admin/editor.product-quantity-selector.title\": \"Komponen Pemilih Jumlah Produk\",\n \"admin/editor.product-quantity-selector.description\": \"Komponen yang memungkinkan pengguna untuk memilih jumlah item untuk ditambahkan ke troli\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Ambang batas peringatan jumlah yang tersedia\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Hanya tampilkan jumlah item yang stoknya tersedia jika jumlah item yang tersedia kurang atau sama dengan nilai yang diteruskan dalam properti ini\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Tampilkan Spesifikasi Produk berdasarkan:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Mode lihat tab\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Mode lihat tabel\",\n \"admin/editor.product-details.product-specifications.default\": \"Pilih spesifikasi default\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Semua Spesifikasi\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Spesifikasi Bidang\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Ketik nilai pisahkan dengan koma\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Ketik spesifikasi di bawah ini\"\n}\n\n```" } ]
code_product-details_abf0e23c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/pt.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Detalhes do produto\",\n \"admin/editor.product-details.description\": \"Componente de detalhes do produto\",\n \"admin/editor.product-details.maxImages.title\": \"Número máximo de imagens em miniatura\",\n \"admin/editor.product-details.displayVertically.title\": \"Exibir miniaturas na vertical\",\n \"admin/editor.product-details.highlights.default\": \"Escolha o destaque padrão \",\n \"store/button-label\": \"Comprar\",\n \"store/addToCartButton.label\": \"Adicionar ao carrinho\",\n \"store/share.title\": \"{product} {sku} na {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Insira o grupo de especificações abaixo\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Insira as especificações abaixo\",\n \"admin/editor.product-details.showHighlight.title\": \"Mostrar destaques\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Todas as especificações\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Especificações personalizadas\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Especificações personalizadas\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Posição das miniaturas\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Esquerda\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Direita\",\n \"store/product-details.quantity\": \"Quantidade\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# disponível} other {# disponíveis}}\",\n \"admin/editor.product-quantity-selector.title\": \"Seletor de quantidade do produto\",\n \"admin/editor.product-quantity-selector.description\": \"Um componente que permite ao usuário selecionar a quantidade de items para adicionar ao carrinho.\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Limite de aviso de quantidade disponível\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Somente mostrar a quantidade de itens em estoque se a quantidade de itens disponíveis for menor que o valor passado nessa propriedade.\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Exibir especificações do produto por:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Visualização em abas\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Visualização em tabela\",\n \"admin/editor.product-details.product-specifications.default\": \"Escolha o destaque padrão\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Todas as especificações\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Especificações personalizadas\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Os valores devem ser separados por vírgula\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Insira as especificações abaixo\"\n}\n\n```" } ]
code_product-details_b36d9964
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/en.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Product Details\",\n \"admin/editor.product-details.description\": \"Product details component\",\n \"admin/editor.product-details.maxImages.title\": \"Max thumbnail images\",\n \"admin/editor.product-details.displayVertically.title\": \"Display thumbnails vertically\",\n \"admin/editor.product-details.highlights.default\": \"Choose default highlight\",\n \"store/button-label\": \"Buy\",\n \"store/addToCartButton.label\": \"Add item to cart\",\n \"store/share.title\": \"{product} {sku} at {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Enter specification groups below\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Enter specifications below\",\n \"admin/editor.product-details.showHighlight.title\": \"Show highlights\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"All Specifications\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Group Specifications\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Field Specifications\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Thumbnail Position\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Left\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Right\",\n \"store/product-details.quantity\": \"Quantity\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# available} other {# available}}\",\n \"admin/editor.product-quantity-selector.title\": \"Product quantity selector component\",\n \"admin/editor.product-quantity-selector.description\": \"Component that allows the user to select the amount of items to be added to the cart\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Threshold of available quantity warning\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Only show the quantity of remaining items in stock if available item quantity is less than or equal to the value passed in this property\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Display product specifications by:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Tab view mode\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Table view mode\",\n \"admin/editor.product-details.product-specifications.default\": \"Choose default specifications\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"All Specifications\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Field Specifications\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Enter the values separate by commas\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Enter specifications below\"\n}\n\n```" } ]
code_product-details_a18bd30d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/ro-RO.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Detalii produs\",\n \"admin/editor.product-details.description\": \"Componentă detalii produs\",\n \"admin/editor.product-details.maxImages.title\": \"Max imagini în miniatură\",\n \"admin/editor.product-details.displayVertically.title\": \"Afișează imaginile în miniatură vertical\",\n \"admin/editor.product-details.highlights.default\": \"Alege evidențierea implicită\",\n \"store/button-label\": \"Cumpără\",\n \"store/addToCartButton.label\": \"Adaugă articolul în coș\",\n \"store/share.title\": \"{product} {sku} la {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Introdu grupurile de specificații mai jos\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Introdu specificațiile mai jos\",\n \"admin/editor.product-details.showHighlight.title\": \"Arată-le pe cele mai remarcabile\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Toate specificațiile\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Specificații grupuri\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Specificații câmpuri\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Poziție miniaturi\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Stânga\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Dreapta\",\n \"store/product-details.quantity\": \"Cantitate\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# disponibil} other {# disponibile}}\",\n \"admin/editor.product-quantity-selector.title\": \"Componentă Selector Cantitate Produs\",\n \"admin/editor.product-quantity-selector.description\": \"O componentă care îi permite utilizatorului să selecteze cantitatea de articole de adăugat în coș\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Atenționare prag cantitate disponibilă\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Arată doar cantitatea articolelor rămase în stoc dacă cantitatea articolelor disponibile este mai mică sau egală cu valoarea introdusă în această proprietate\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Afișează specificațiile de produs în funcție de:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Mod de vizualizare tab\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Mod de vizualizare tabel\",\n \"admin/editor.product-details.product-specifications.default\": \"Alege specificațiile prestabilite\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Toate specificațiile\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Specificații câmpuri\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Introdu valorile separate prin virgulă\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Introdu specificațiile mai jos\"\n}\n\n```" } ]
code_product-details_d23dbb60
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/da-DK.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Produktdetaljer\",\n \"admin/editor.product-details.description\": \"Produktdetaljer komponent\",\n \"admin/editor.product-details.maxImages.title\": \"Maks. miniaturebilleder\",\n \"admin/editor.product-details.displayVertically.title\": \"Vis miniaturebilleder vertikalt\",\n \"admin/editor.product-details.highlights.default\": \"Vælg standard fremhævning\",\n \"store/button-label\": \"Køb\",\n \"store/addToCartButton.label\": \"Føj vare til kurv\",\n \"store/share.title\": \"{product} {sku} i {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Type specifikationsgrupper under\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Typespecifikationer under\",\n \"admin/editor.product-details.showHighlight.title\": \"Vis fremhævelser\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Alle specifikationer\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Gruppespecifikationer\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Feltspecifikationer\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Miniaturebilleders position\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Venstre\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Højre\",\n \"store/product-details.quantity\": \"Antal\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# tilgængelig} other {# tilgængelig}}\",\n \"admin/editor.product-quantity-selector.title\": \"Produktmængde vælgerkomponent\",\n \"admin/editor.product-quantity-selector.description\": \"En komponent, der giver brugeren mulighed for at vælge den mængde varer, der skal tilføjes i indkøbskurven\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Tærskel for tilgængelig mængdeadvarsel\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Vis kun mængden af resterende varer på lager, hvis den disponible varemængde er mindre end eller lig med den værdi, der er videregivet i denne egenskab\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Vis produktspecifikationer efter:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Fanevisningstilstand\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Tabelvisningstilstand\",\n \"admin/editor.product-details.product-specifications.default\": \"Vælg standardspecifikationer\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Alle specifikationer\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Feltspecifikationer\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Indtast værdierne adskilt med komma\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Skriv specifikationerne under\"\n}\n\n```" } ]
code_product-details_9d12b448
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/context.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"admin/editor.product-details.title\",\n \"admin/editor.product-details.description\": \"admin/editor.product-details.description\",\n \"admin/editor.product-details.highlights\": \"admin/editor.product-details.highlights\",\n \"admin/editor.product-details.highlights.title\": \"admin/editor.product-details.highlights.title\",\n \"admin/editor.product-details.showHighlight\": \"admin/editor.product-details.showHighlight\",\n \"admin/editor.product-details.showHighlight.title\": \"admin/editor.product-details.showHighlight.title\",\n \"admin/editor.product-details.highlights.default\": \"admin/editor.product-details.highlights.default\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"admin/editor.product-details.highlights.allSpecifications\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"admin/editor.product-details.highlights.chooseDefault\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"admin/editor.product-details.highlights.chooseDefaultSpecification\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"admin/editor.product-details.highlights.typeSpecifications.title\",\n \"admin/editor.product-details.maxImages.title\": \"admin/editor.product-details.maxImages.title\",\n \"admin/editor.product-details.displayVertically.title\": \"admin/editor.product-details.displayVertically.title\",\n \"store/button-label\": \"store/button-label\",\n \"store/addToCartButton.label\": \"store/addToCartButton.label\",\n \"store/share.title\": \"store/share.title\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"admin/editor.product-details.thumbnailsPosition.title\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"admin/editor.product-details.thumbnailsPosition.left\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"admin/editor.product-details.thumbnailsPosition.right\",\n \"store/product-details.quantity\": \"Item quantity\",\n \"store/product-details.quantity-available\": \"Tells user how many items are available in stock\",\n \"admin/editor.product-quantity-selector.title\": \"Title of Product Quantity Selector component\",\n \"admin/editor.product-quantity-selector.description\": \"Description of Product Quantity Selector component\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Title of warningQuantityThreshold property\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Description of warningQuantityThreshold property\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"admin/editor.product-specifications.displaySpecification.title\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"admin/editor.product-specifications.displaySpecification.tabMode\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"admin/editor.product-specifications.displaySpecification.tableMode\",\n \"admin/editor.product-details.product-specifications.default\": \"admin/editor.product-details.product-specifications.default\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"admin/editor.product-details.product-specifications.allSpecifications\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"admin/editor.product-details.product-specifications.typeHelper\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"admin/editor.product-details.product-specifications.typeSpecifications.title\"\n}\n\n```" } ]
code_product-details_4f33057d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/fi-FI.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Tuotteen tiedot\",\n \"admin/editor.product-details.description\": \"Tuotetietokomponentti\",\n \"admin/editor.product-details.maxImages.title\": \"Pikkukuvien maksimimäärä\",\n \"admin/editor.product-details.displayVertically.title\": \"Näytä pikkukuvat vaakatasossa\",\n \"admin/editor.product-details.highlights.default\": \"Valitse oletuskorostus\",\n \"store/button-label\": \"Osta\",\n \"store/addToCartButton.label\": \"Lisää tuote ostoskoriin\",\n \"store/share.title\": \"{product} {sku} myymälässä {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Kirjoita tietoryhmät alle\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Kirjoita tiedot alle\",\n \"admin/editor.product-details.showHighlight.title\": \"Näytä korostukset\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Kaikki tiedot\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Ryhmien tiedot\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Kenttien tiedot\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Pikkukuvien sijainti\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Vasemmalla\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Oikealla\",\n \"store/product-details.quantity\": \"Lukumäärä\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# saatavilla} other {# saatavilla}}\",\n \"admin/editor.product-quantity-selector.title\": \"Tuotemäärän valintakomponentti\",\n \"admin/editor.product-quantity-selector.description\": \"Komponentti, jonka avulla käyttäjä voi valita ostoskoriin lisättävien tuotteiden määrän\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Saatavilla olevan määrän rajavaroitus\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Näytä vain varastossa jäljellä olevien tuotteiden määrä, jos tuotteen saatavilla oleva määrä on alle tai yhtä kujin tässä ominaisuudessa oleva arvo\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Tuotetietojen näyttöperuste:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Välilehtinäkymä-tila\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Taulukkonäkymä-tila\",\n \"admin/editor.product-details.product-specifications.default\": \"Valitse oletustiedot\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Kaikki tiedot\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Kenttien tiedot\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Kirjoita arvot pilkuilla eroteltuna\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Kirjoita tiedot alle\"\n}\n\n```" } ]
code_product-details_2a82419f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/es.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"Detalles del producto\",\n \"admin/editor.product-details.description\": \"Componente de detalles del producto\",\n \"admin/editor.product-details.maxImages.title\": \"Número máximo de imágenes en miniatura\",\n \"admin/editor.product-details.displayVertically.title\": \"Mostrar miniaturas verticalmente\",\n \"admin/editor.product-details.highlights.default\": \"Elegir destaque predeterminado \",\n \"store/button-label\": \"Comprar\",\n \"store/addToCartButton.label\": \"Incluir items en el carrito\",\n \"store/share.title\": \"{product} {sku} en la {store}: \",\n \"admin/editor.product-details.highlights.title\": \"Escriva de especificación de los grupos de abajo\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"Escriva las especificaciones abajo\",\n \"admin/editor.product-details.showHighlight.title\": \"Mostrar lo más destacados\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"Todas las especificaciones\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"Grupo del especificaciones personalizadas\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"Especificaciones personalizadas\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"Posición de miniaturas\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"Izquierda\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"Derecha\",\n \"store/product-details.quantity\": \"Cantidad\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# disponible} other {# disponibles}}\",\n \"admin/editor.product-quantity-selector.title\": \"Selector de Cantidad de Producto\",\n \"admin/editor.product-quantity-selector.description\": \"Un componente que permite al usuario a seleccionar la cantidad de elementos para añadir al carrito.\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"Cantidad de umbral disponible\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"Sólo muestra la cantidad de elementos en stock si la cantidad de elementos disponibles es menor que el valor pasado en esa propiedad.\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"Mostrar la Especificaciones del Product por:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"Modo de vista de tab\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"Modo de vista de tabela\",\n \"admin/editor.product-details.product-specifications.default\": \"Elegir destaque predeterminado\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"Todas las especificaciones\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"Especificaciones personalizadas\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"Escriba los valores separados por coma\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"Escriva las especificaciones abajo\"\n}\n\n```" } ]
code_product-details_b41b60c2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/messages/ar.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.product-details.title\": \"تفاصيل المنتج\",\n \"admin/editor.product-details.description\": \"مكون تفاصيل المنتج\",\n \"admin/editor.product-details.maxImages.title\": \"أقصى تصغير للصور\",\n \"admin/editor.product-details.displayVertically.title\": \"عرض الصور المصغرة أفقيًا\",\n \"admin/editor.product-details.highlights.default\": \"اختر التحديد الافتراضي\",\n \"store/button-label\": \"شراء\",\n \"store/addToCartButton.label\": \"إضافة عنصر إلى العربة\",\n \"store/share.title\": \"{product} {sku} في {store}: \",\n \"admin/editor.product-details.highlights.title\": \"اكتب مجموعات المواصفات أدناه\",\n \"admin/editor.product-details.highlights.typeSpecifications.title\": \"اكتب المواصفات أدناه\",\n \"admin/editor.product-details.showHighlight.title\": \"عرض المواصفات\",\n \"admin/editor.product-details.highlights.allSpecifications\": \"كل المواصفات\",\n \"admin/editor.product-details.highlights.chooseDefault\": \"مواصفات المجموعات\",\n \"admin/editor.product-details.highlights.chooseDefaultSpecification\": \"مواصفات الحقول\",\n \"admin/editor.product-details.thumbnailsPosition.title\": \"موضع الصور المصغرة\",\n \"admin/editor.product-details.thumbnailsPosition.left\": \"اليسار\",\n \"admin/editor.product-details.thumbnailsPosition.right\": \"اليمين\",\n \"store/product-details.quantity\": \"الكمية\",\n \"store/product-details.quantity-available\": \"{availableQuantity, plural, one {# متاح} other {# متاحة}}\",\n \"admin/editor.product-quantity-selector.title\": \"مكون محدد كمية المنتج\",\n \"admin/editor.product-quantity-selector.description\": \"مكون يسمح للمستخدم بتحديد كمية العناصر لإضافتها إلى سلة التسوق\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.title\": \"تحذير بعتبة الكمية المتاحة\",\n \"admin/editor.product-quantity-selector.warningQuantityThreshold.description\": \"اعرض فقط كمية العناصر المتبقية في المخزون إذا كانت الكمية المتاحة للعنصر أقل من القيمة التي تم تمريرها في هذه الخاصية أو تساويها\",\n \"admin/editor.product-specifications.displaySpecification.title\": \"عرض مواصفات المنتج من خلال:\",\n \"admin/editor.product-specifications.displaySpecification.tabMode\": \"وضع عرض علامة التبويب\",\n \"admin/editor.product-specifications.displaySpecification.tableMode\": \"وضع عرض الجدول\",\n \"admin/editor.product-details.product-specifications.default\": \"اختر المواصفات الافتراضية\",\n \"admin/editor.product-details.product-specifications.allSpecifications\": \"كل المواصفات\",\n \"admin/editor.product-details.product-specifications.chooseDefaultSpecification\": \"مواصفات الحقول\",\n \"admin/editor.product-details.product-specifications.typeHelper\": \"اكتب القيم مفصولة بفاصلة\",\n \"admin/editor.product-details.product-specifications.typeSpecifications.title\": \"اكتب المواصفات أدناه\"\n}\n\n```" } ]
code_product-details_7d9adde3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/docs/README.md from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# VTEX Product Details\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\n## Description\n\nThe VTEX Category Menu app shows the details of a product like image, name and price. THis app is used by store theme.\n\n:loudspeaker: **Disclaimer:** Don't fork this project. Use, contribute, or open issue with your feature request.\n\n## Release schedule\n\n| Release | Status | Initial Release | Maintenance LTS Start | End-of-life | Dreamstore Compatibility |\n| :-----: | :-----------------: | :-------------: | :-------------------: | :---------: | :----------------------: |\n| [1.x] | **Current Release** | 2018-11-28 | | | 2.x |\n| [0.x] | **Maintenance LTS** | 2018-05-29 | 2018-11-28 | March 2019 | 1.x |\n\nSee our [LTS policy](https://github.com/vtex-apps/awesome-io#lts-policy) for more information.\n\n## Table of Contents\n\n- [Usage](#usage)\n - [Blocks API](#blocks-api)\n - [Configuration](#configuration)\n - [Styles API](#styles-api)\n - [CSS namespaces](#css-namespaces)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [Tests](#tests)\n\n## Usage\n\nThis app uses our store builder with the blocks architecture. To know more about Store Builder [click here.](https://help.vtex.com/en/tutorial/understanding-storebuilder-and-stylesbuilder#structuring-and-configuring-our-store-with-object-object)\n\nWe add the product-details as a block in our [Store Header](https://github.com/vtex-apps/store-header/blob/master/store/interfaces.json).\n\nTo configure or customize this app, you need to import it in your dependencies in `manifest.json`.\n\n```json\n dependencies: {\n \"vtex.product-details\": \"1.x\"\n }\n```\n\nThen, add `product-details` block into your app theme, like we do in our [Store theme app](https://github.com/vtex-apps/store-theme/blob/master/store/blocks.json).\n\nNow, you can change the behavior of the `product-details` block that is in the store header. See an example of how to configure:\n\n```json\n \"product-details\": {\n \"blocks\": [\n \"breadcrumb\",\n \"product-name\",\n \"product-images\",\n \"product-price\",\n \"product-description\",\n \"product-specifications\",\n \"buy-button\",\n \"sku-selector\",\n \"shipping-simulator\",\n \"availability-subscriber\",\n \"share\"\n ],\n \"props\": {\n \"displayVertically\": true,\n \"share\": {\n \"social\": {\n \"Facebook\": true,\n \"WhatsApp\": true,\n \"Twitter\": false\n }\n },\n \"price\": {\n \"labelSellingPrice\": null,\n \"showListPrice\": true,\n \"showLabels\": true,\n \"showInstallments\": true,\n \"showSavings\": true\n },\n \"name\": {\n \"showBrandName\": false,\n \"showSku\": false,\n \"showProductReference\": false\n }\n }\n }\n```\n\n### Blocks API\n\nWhen implementing this app as a block, various inner blocks may be available. The following interface lists the available blocks within `product-details` and describes if they are required or optional.\n\n```json\n{\n \"product-details\": {\n \"required\": [\n \"product-images\",\n \"product-name\",\n \"product-price\",\n \"sku-selector\",\n \"buy-button\",\n \"product-description\",\n \"product-specifications\"\n ],\n \"allowed\": [\n \"breadcrumb\",\n \"shipping-simulator\",\n \"availability-subscriber\",\n \"share\",\n \"addon-details-btn\"\n ],\n \"component\": \"ProductDetails\"\n },\n \"addon-details-btn\": {\n \"component\": \"*\"\n }\n}\n```\n\nThe `ProductDetails` has the required blocks: `product-images`, `product-name`, `product-price`, `sku-selector`, `buy-button`, `product-description` and `product-specifications`. So, any `ProductDetails` block implementation created must add these blocks.\n\n#### Configuration\n\nThrough the Storefront you can change the behavior and interface of `ProductDetails`. But, you can also make adjusts in your theme app, like Store does.\n\n| Prop name | Type | Description | Default Value |\n| ----------------------- | --------- | ----------------------------------------------------------------- | ------------- |\n| `price` | `Object` | Configures the product price area (More info on the table bellow) | false |\n| `name` | `Object` | Configures the product name area (More info on the table bellow) | false |\n| `displayVertically` | `Boolean` | Whether to display the preview images on the vertical or not | false |\n| `showSpecificationsTab` | `Boolean` | Whether to display the product specification on tab mode or not | false |\n\nPrice:\n\n| Prop name | Type | Description |\n| ------------------- | --------- | ---------------------------------------------- |\n| `showListPrice` | `Boolean` | Shows the list prices | true |\n| `showLabels` | `Boolean` | Shows the labels in the price and installments | true |\n| `showInstallments` | `Boolean` | Shows the installments information | true |\n| `showSavings` | `Boolean` | Shows the savings information | true |\n| `labelSellingPrice` | `String` | Text of the label before the price | `null` |\n\nName:\n\n| Prop name | Type | Description |\n| ---------------------- | --------- | ------------------------------------ |\n| `showProductReference` | `Boolean` | Shows the product reference | false |\n| `showBrandName` | `Boolean` | Shows the brand name of the product | false |\n| `showSku` | `Boolean` | Shows the sku value for this product | false |\n\nHighlight:\n\n| Prop name | Type | Description |\n| ------------------ | --------- | ---------------------------------------------------------------------------------------------------------------------- |\n| `defaultHighlight` | `boolean` | Indicates whether the group chosen as the highlight will contain all the properties in product or a group typed entry. |\n| true |\n| `showHighlights` | `Boolean` | Shows the highlights of the product | true |\n| `highlightGroup` |\n\n\nSpecification:\n\n | Prop name | Type | Description |\n| --------------------- | --------- | -------------------------------------------------------------------------------------------------- |\n| `showSpecifications` | `boolean` | Show the specifications of the product |\n| `specificationGroups` | `object` | Define if will be displayed all the specifications of the product or a set of this specifications. |\n| `viewMode` | `string` | Define what is the current view mode for the specifications. |\n| `typeSpecifications` | `string` | indicates which specifications will be displayed |\n\n\nAlso, you can configure the `share` that is defined on `ProductDetails`. See [here](https://github.com/vtex-apps/store-components/blob/master/react/components/Share/README.md) the `Share` API.\n\n### Styles API\n\nThis app provides some CSS classes as an API for style customization.\n\nTo use this CSS API, you must add the `styles` builder and create an app styling CSS file.\n\n1. Add the `styles` builder to your `manifest.json`:\n\n```json\n \"builders\": {\n \"styles\": \"1.x\"\n }\n```\n\n2. Create a file called `vtex.product-details.css` inside the `styles/css` folder. Add your custom styles:\n\n```css\n.container {\n margin-top: 10px;\n}\n```\n\n#### CSS namespaces\n\nBelow, we describe the namespaces that is define in the `ProductDetails`.\n\n| Class name | Description | Component Source |\n| ----------------------- | ---------------------------------------- | ----------------------------------------------------------- |\n| `container` | The main container of Product Details | [productDetails](/react/productDetails.js) |\n| `nameContainer` | The container of the name area | [productDetails](/react/productDetails.js) |\n| `detailsContainer` | The container of the details area | [productDetails](/react/productDetails.js) |\n| `priceContainer` | The container of the price area | [productDetails](/react/productDetails.js) |\n| `informationsContainer` | The container of the information area | [productDetails](/react/productDetails.js) |\n| `fixedButton` | The product buy button | [FixedButton/index](/react/components/FixedButton/index.js) |\n| `highlightsContainer` | The container of product highlights area | [productDetails](/react/productDetails.js) |\n\n## Troubleshooting\n\nYou can check if others are passing through similar issues [here](https://github.com/vtex-apps/product-details/issues). Also feel free to [open issues](https://github.com/vtex-apps/product-details/issues/new) or contribute with pull requests.\n\n## Contributing\n\nCheck it out [how to contribute](https://github.com/vtex-apps/awesome-io#contributing) with this project. \n\n## Tests\n\nTo execute our tests go to `react/` folder and run `yarn test`\n\n### Travis CI\n\n[![Build Status](https://travis-ci.org/vtex-apps/product-details.svg?branch=master)](https://travis-ci.org/vtex-apps/product-details)\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n```" } ]
code_product-details_c0597db9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/ProductDetails.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport PropTypes from 'prop-types'\nimport React, { Component } from 'react'\nimport { any, path, prop, propOr, pathOr } from 'ramda'\nimport { injectIntl, intlShape, FormattedMessage } from 'react-intl'\n\nimport classNames from 'classnames'\n\nimport { ExtensionPoint, withRuntimeContext } from 'vtex.render-runtime'\nimport { Container } from 'vtex.store-components'\n\nimport { changeImageUrlSize } from './utils/generateUrl'\nimport FixedButton from './components/FixedButton'\nimport { productShape } from './propTypes'\n\nimport { schema } from './utils/schema'\n\nimport productDetails from './productDetails.css'\n\nconst productNameLoaderStyles = {\n 'vtex-product-name__brand--loader': {\n x: 0,\n width: '100%',\n height: '1.631em',\n },\n 'vtex-product-name__sku--loader': {\n x: 0,\n y: '2.569em',\n width: '10.311em',\n height: '1.045em',\n },\n}\n\nconst productPriceLoaderStyles = {\n 'vtex-price-list__container--loader': {\n x: 0,\n width: '7.219em',\n height: '0.56em',\n },\n 'vtex-price-selling__label--loader': {\n x: 0,\n y: '2em',\n width: '2.85em',\n height: '1.08em',\n },\n 'vtex-price-selling--loader': {\n x: '3.25em',\n y: '0.86em',\n width: '14.572em',\n height: '2.176em',\n },\n 'vtex-price-installments--loader': {\n x: 0,\n y: '3.75em',\n width: '12em',\n height: '0.825em',\n },\n 'vtex-price-savings--loader': {\n x: 0,\n y: '5em',\n width: '10em',\n height: '0.686em',\n },\n}\nconst thresholds = [640]\nconst imageSizes = [1280, 1920]\nconst thumbnailSize = 160\n\nconst hasSellerWithAvailableItems = (item) => {\n return item.sellers && any((s) => s.commertialOffer && s.commertialOffer.AvailableQuantity > 0, item.sellers)\n}\n\nclass ProductDetails extends Component {\n static defaultProps = {\n price: {\n showListPrice: true,\n showLabels: true,\n showInstallments: true,\n showSavings: true,\n },\n name: {\n showProductReference: false,\n showBrandName: false,\n showSku: false,\n },\n displayVertically: false,\n showSpecificationsTab: false,\n }\n\n static propTypes = {\n categories: PropTypes.arrayOf(PropTypes.string),\n /** Whether to display the preview images on the vertical or not */\n displayVertically: PropTypes.bool,\n intl: intlShape,\n /** Product name schema configuration */\n name: PropTypes.object,\n /** Query */\n productQuery: PropTypes.shape({\n product: productShape,\n loading: PropTypes.bool.isRequired,\n }),\n /** Product price schema configuration */\n price: PropTypes.object,\n /** URL query parameters */\n query: PropTypes.shape({\n skuId: PropTypes.string,\n }),\n runtime: PropTypes.object,\n /** Share Schema properties */\n share: PropTypes.shape({\n /** Social Networks configuration */\n social: PropTypes.object.isRequired,\n }),\n /** Product slug */\n slug: PropTypes.string.isRequired,\n /** Product specifications tab mode */\n showSpecificationsTab: PropTypes.bool,\n\n /** Define the highlight group select to display */\n highlightGroup: PropTypes.string,\n }\n\n state = { selectedQuantity: 1 }\n\n get skuItems() {\n return pathOr([], ['productQuery', 'product', 'items'], this.props)\n }\n\n get selectedItem() {\n const items = path(['productQuery', 'product', 'items'], this.props) || []\n if (!this.props.query || !this.props.query.skuId) {\n return items.find(hasSellerWithAvailableItems) || items[0]\n }\n return items.find(sku => sku.itemId === this.props.query.skuId)\n }\n\n get commertialOffer() {\n return path(['sellers', 0, 'commertialOffer'], this.selectedItem)\n }\n\n get sellerId() {\n return path(['sellers', 0, 'sellerId'], this.selectedItem)\n }\n\n getImages() {\n const images = path(['images'], this.selectedItem)\n\n return images\n ? images.map(image => ({\n imageUrls: imageSizes.map(size =>\n changeImageUrlSize(image.imageUrl, size)\n ),\n thresholds,\n thumbnailUrl: changeImageUrlSize(image.imageUrl, thumbnailSize),\n imageText: image.imageText,\n }))\n : []\n }\n\n getSpecifications() {\n const { productQuery, specificationsDefault } = this.props\n\n const product = productQuery ? productQuery.product : {}\n\n const option = path(\n ['specificationGroups', 'specification'],\n specificationsDefault\n )\n const allSpecifications = propOr([], 'properties', product)\n const getFromProperties = () => {\n const typedSpecifications = pathOr(\n '',\n ['specificationGroups', 'typeSpecifications'],\n specificationsDefault\n )\n const specificationNames = typedSpecifications.trim().split(',')\n const specifications = specificationNames.reduce((acc, item) => {\n const specification = allSpecifications.filter(\n spec => spec.name.toLowerCase() === item.trim().toLowerCase()\n )\n return acc.concat(specification)\n }, [])\n return specifications\n }\n\n switch (option) {\n case 'admin/editor.product-details.product-specifications.chooseDefaultSpecification':\n return getFromProperties()\n default:\n return allSpecifications\n }\n }\n\n filterSpecifications() {\n const highlights = this.getHighlights()\n const specifications = this.getSpecifications()\n return {\n specifications,\n highlights,\n }\n }\n\n getHighlights() {\n const { productQuery, highlightGroupDefault } = this.props\n\n const { product } = productQuery || { product: {} }\n\n const option = pathOr(\n '',\n ['highlightGroupDefault', 'highlight'],\n highlightGroupDefault\n )\n const highlightsFromGroup = () => {\n const typeHighlight = pathOr(\n '',\n ['highlightGroupDefault', 'typeHighlight'],\n highlightGroupDefault\n )\n const highlightName = typeHighlight.trim()\n const names = highlightName.split(',')\n const specificationGroups = propOr([], 'specificationGroups', product)\n const highlights = names.reduce((acc, item) => {\n const highlightSpecificationGroup = specificationGroups.filter(\n x => x.name.toLowerCase() === item.trim().toLowerCase()\n )[0]\n const highlight = propOr(\n [],\n 'specifications',\n highlightSpecificationGroup\n )\n return acc.concat(highlight)\n }, [])\n return highlights\n }\n const highlightsFromSpecifications = () => {\n const typeSpecifications = pathOr(\n '',\n ['highlightGroupDefault', 'typeSpecifications'],\n highlightGroupDefault\n )\n const specificationNames = typeSpecifications.trim().split(',')\n const allSpecifications = propOr([], 'properties', product)\n const highlights = specificationNames.reduce((acc, item) => {\n const highlight = allSpecifications.filter(\n x => x.name.toLowerCase() === item.trim().toLowerCase()\n )\n return acc.concat(highlight)\n }, [])\n return highlights\n }\n\n const highlightsFromAllSpecifications = () => {\n return propOr([], 'properties', product)\n }\n\n switch (option) {\n case 'admin/editor.product-details.highlights.chooseDefault':\n return highlightsFromGroup()\n case 'admin/editor.product-details.highlights.chooseDefaultSpecification':\n return highlightsFromSpecifications()\n case 'admin/editor.product-details.highlights.allSpecifications':\n return highlightsFromAllSpecifications()\n }\n }\n\n render() {\n const {\n productQuery,\n categories,\n categoryTree,\n runtime: {\n account,\n culture: { country },\n hints: { mobile },\n },\n intl,\n thumbnailPosition,\n highlightGroupDefault,\n specificationsDefault,\n showSpecificationsTab: showSpecificationsTabProp,\n } = this.props\n\n const { product } = productQuery || { product: {} }\n\n const { selectedQuantity } = this.state\n const showHighlight = prop('showHighlights', highlightGroupDefault)\n\n const showSpecificationsTab =\n showSpecificationsTabProp == null\n ? propOr(true, 'showSpecifications', specificationsDefault)\n : showSpecificationsTabProp\n\n const viewMode = prop('viewMode', specificationsDefault) || 'tab'\n\n const viewSpecificationsMode = viewMode === 'tab'\n\n const showBuyButton =\n Number.isNaN(+path(['AvailableQuantity'], this.commertialOffer)) || // Show the BuyButton loading information\n path(['AvailableQuantity'], this.commertialOffer) > 0\n\n const skuName = path(['name'], this.selectedItem)\n const description = path(['description'], product)\n const { specifications, highlights } = this.filterSpecifications()\n const buyButtonProps = {\n skuItems: this.selectedItem &&\n this.sellerId && [\n {\n skuId: this.selectedItem.itemId,\n quantity: selectedQuantity,\n seller: this.sellerId,\n name: this.selectedItem.nameComplete,\n price: this.commertialOffer.Price,\n variant: this.selectedItem.name,\n brand: product.brand,\n index: 0,\n detailUrl: `/${product.linkText}/p`,\n imageUrl: path(['images', '0', 'imageUrl'], this.selectedItem),\n listPrice: path(\n ['sellers', '0', 'commertialOffer', 'ListPrice'],\n this.selectedItem\n ),\n },\n ],\n large: true,\n available: showBuyButton,\n }\n\n const productNameProps = {\n styles: productNameLoaderStyles,\n name: path(['productName'], product),\n skuName: path(['name'], this.selectedItem),\n brandName: path(['brand'], product),\n productReference: path(['productReference'], product),\n className: 't-heading-4',\n tag: 'h1',\n ...this.props.name,\n }\n\n const productPriceProps = {\n styles: productPriceLoaderStyles,\n listPriceContainerClass: 't-small-s t-small-ns c-muted-2 mb2',\n sellingPriceLabelClass: 't-heading-6-s t-heading-5-ns dib',\n listPriceLabelClass: 'dib strike',\n listPriceClass: 'ph2 dib strike',\n sellingPriceContainerClass: 'pv1 b c-on-base',\n sellingPriceClass: 't-heading-2-s dib ph2',\n installmentContainerClass: 't-mini-s t-small-ns c-on-base',\n installmentClass: 't-body',\n interestRateClass: 'dib ph2',\n savingsContainerClass: 'c-success mt3',\n savingsClass: 'dib t-small',\n loaderClass: 'h4-s mw6-s pt2-s',\n listPrice: path(['ListPrice'], this.commertialOffer),\n sellingPrice: path(['Price'], this.commertialOffer),\n installments: path(['Installments'], this.commertialOffer),\n ...this.props.price,\n }\n const productImageUrl = path(['items', 0, 'images', 0, 'imageUrl'], product)\n\n const availableQuantity = path(['AvailableQuantity'], this.commertialOffer)\n const showProductPrice =\n Number.isNaN(+availableQuantity) || availableQuantity > 0\n\n const addonDetailsClasses = classNames('absolute z-3 left-0', {\n 'ml-20-ns':\n this.getImages().length > 1 &&\n (!thumbnailPosition || thumbnailPosition === 'left'),\n })\n\n return (\n <Container\n className={`${productDetails.container} pt6 pb8 justify-center flex`}\n >\n <div className=\"w-100 mw9\">\n <article className=\"mb7\">\n <ExtensionPoint id=\"breadcrumb\" />\n <div\n className={`${productDetails.nameContainer} c-on-base mb4 dn-l`}\n >\n <ExtensionPoint id=\"product-name\" {...productNameProps} />\n </div>\n <div className=\"flex flex-wrap\">\n <div className=\"w-60-l w-100\">\n <div className=\"fr-ns w-100 h-100\">\n <div className=\"relative flex justify-center z-3\">\n <ExtensionPoint\n id=\"product-images\"\n images={this.getImages()}\n position={thumbnailPosition}\n />\n <div className={addonDetailsClasses}>\n <ExtensionPoint\n id=\"addon-details-btn\"\n large={!mobile}\n product={{\n quantity: 1,\n skuId: path(['itemId'], this.selectedItem),\n productId: path(['productId'], product),\n }}\n />\n </div>\n </div>\n </div>\n </div>\n <aside\n className={`${\n productDetails.detailsContainer\n } pl8-l w-40-l w-100`}\n >\n <div\n className={`${\n productDetails.nameContainer\n } c-on-base dn db-l mb4`}\n >\n <ExtensionPoint id=\"product-name\" {...productNameProps} />\n </div>\n {highlights && showHighlight && (\n <div className={productDetails.highlightsContainer}>\n <ExtensionPoint\n id=\"product-highlights\"\n highlights={highlights}\n />\n </div>\n )}\n {showProductPrice && (\n <div\n className={`${productDetails.priceContainer} pt1 dn db-l`}\n >\n <ExtensionPoint id=\"product-price\" {...productPriceProps} />\n </div>\n )}\n <div className=\"mv2 mt5 dn db-l\">\n <hr className=\"o-30\" size=\"1\" />\n </div>\n <div className=\"mt6\">\n {product &&\n this.selectedItem &&\n this.selectedItem.variations &&\n this.selectedItem.variations.length > 0 && (\n <ExtensionPoint\n id=\"sku-selector\"\n skuItems={this.skuItems}\n skuSelected={this.selectedItem}\n productSlug={product.linkText}\n variations={this.selectedItem.variations}\n />\n )}\n {showProductPrice && (\n <div\n className={`${\n productDetails.priceContainer\n } pt1 mt mt7 mt4-l dn-l`}\n >\n <ExtensionPoint\n id=\"product-price\"\n {...productPriceProps}\n />\n </div>\n )}\n {showBuyButton ? (\n <div className=\"pv2 dn db-l mt8\">\n <ExtensionPoint\n id=\"product-quantity-selector\"\n selectedQuantity={selectedQuantity}\n onChange={value =>\n this.setState({ selectedQuantity: value })\n }\n availableQuantity={availableQuantity}\n />\n <ExtensionPoint id=\"buy-button\" {...buyButtonProps}>\n <FormattedMessage id=\"store/addToCartButton.label\" />\n </ExtensionPoint>\n </div>\n ) : (\n <div className=\"pv4\">\n <ExtensionPoint\n id=\"availability-subscriber\"\n skuId={this.selectedItem.itemId}\n available={showBuyButton}\n />\n </div>\n )}\n <FixedButton>\n <div className=\"dn-l bg-base w-100 ph5 pv3\">\n <ExtensionPoint id=\"buy-button\" {...buyButtonProps}>\n <FormattedMessage id=\"store/addToCartButton.label\" />\n </ExtensionPoint>\n </div>\n </FixedButton>\n <div className=\"mt8\">\n <ExtensionPoint\n id=\"shipping-simulator\"\n skuId={path(['itemId'], this.selectedItem)}\n seller={this.sellerId}\n country={country}\n />\n </div>\n <div className=\"flex w-100 mt7\">\n <ExtensionPoint\n id=\"share\"\n shareLabelClass=\"c-muted-2 t-small mb3\"\n className=\"db\"\n imageUrl={productImageUrl}\n {...this.props.share}\n loading={!path(['name'], this.selectedItem)}\n title={intl.formatMessage(\n { id: 'store/share.title' },\n {\n product: path(['productName'], product),\n sku: path(['name'], this.selectedItem),\n store: account,\n }\n )}\n />\n </div>\n </div>\n </aside>\n </div>\n </article>\n <footer\n className={`${productDetails.informationsContainer} ph5 ph0-ns`}\n >\n <div className=\"mv4\">\n <hr className=\"o-30 db\" size=\"1\" />\n </div>\n <div\n className={`flex ${\n viewSpecificationsMode ? 'flex-wrap' : 'justify-between'\n }`}\n >\n {description && (\n <div className=\"pv2 mt8 h-100 w-100\">\n <ExtensionPoint\n id=\"product-description\"\n skuName={skuName}\n description={description}\n />\n </div>\n )}\n {specifications && showSpecificationsTab && (\n <div className=\"pv2 mt8 h-100 w-100\">\n <ExtensionPoint\n id=\"product-specifications\"\n tabsMode={viewSpecificationsMode}\n specifications={specifications}\n />\n </div>\n )}\n </div>\n </footer>\n </div>\n </Container>\n )\n }\n}\n\nProductDetails.schema = schema\n\nexport default withRuntimeContext(injectIntl(ProductDetails))\n\n```" } ]
code_product-details_7dbe9503
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/ProductAddToListButton.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React, { useMemo, useContext } from 'react'\nimport { ExtensionPoint, useRuntime } from 'vtex.render-runtime'\nimport { ProductContext } from 'vtex.product-context'\nimport { path } from 'ramda'\nimport classNames from 'classnames'\n\nconst getSkuId = path(['selectedItem', 'itemId'])\nconst getProductId = path(['product', 'productId'])\nconst getImages = path(['selectedItem', 'images'])\n\nconst ProductAddToListButton = () => {\n const {\n hints: { mobile },\n } = useRuntime()\n const productContext = useContext(ProductContext)\n \n const skuId = getSkuId(productContext)\n const productId = getProductId(productContext)\n\n const productProp = useMemo(() => ({\n skuId, productId, quantity: 1\n }), [skuId, productId])\n\n const images = getImages(productContext)\n const isMoreThanOneImage = images && images.length > 1\n \n const addonDetailsClasses = classNames('', {\n 'ml-20-ns': isMoreThanOneImage\n })\n\n return (\n <div className={addonDetailsClasses}>\n <ExtensionPoint id=\"addon-details-btn\" large={!mobile} product={productProp} />\n </div>\n )\n}\n\nexport default ProductAddToListButton\n\n```" } ]
code_product-details_9e6ed5d3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/package.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"product-details\",\n \"version\": \"1.22.0\",\n \"scripts\": {\n \"pretest\": \"yarn\",\n \"test\": \"jest\",\n \"test:watch\": \"jest --watch\"\n },\n \"dependencies\": {\n \"prop-types\": \"^15.6.2\",\n \"ramda\": \"^0.26.1\",\n \"react-content-loader\": \"^3.1.2\",\n \"react-intl\": \"^2.8.0\"\n },\n \"devDependencies\": {\n \"@babel/core\": \"^7.3.3\",\n \"@babel/preset-env\": \"^7.3.1\",\n \"babel-jest\": \"^24.1.0\",\n \"babel-preset-react-app\": \"^7.0.1\",\n \"classnames\": \"^2.2.6\",\n \"identity-obj-proxy\": \"^3.0.0\",\n \"jest\": \"^24.1.0\",\n \"jest-dom\": \"^3.1.2\",\n \"jest-transform-graphql\": \"^2.1.0\",\n \"react\": \"^16.8.3\",\n \"react-dom\": \"^16.8.3\",\n \"react-testing-library\": \"^5.9.0\",\n \"regenerator-runtime\": \"^0.13.1\"\n },\n \"jest\": {\n \"verbose\": true,\n \"setupFilesAfterEnv\": [\n \"<rootDir>/testUtils/setupTests.js\"\n ],\n \"modulePaths\": [\n \"<rootDir>/testUtils\"\n ],\n \"moduleNameMapper\": {\n \"\\\\.(css|less|scss)$\": \"identity-obj-proxy\"\n },\n \"transform\": {\n \"\\\\.(gql|graphql)$\": \"jest-transform-graphql\",\n \"^.+\\\\.(js|jsx|mjs)$\": \"<rootDir>/node_modules/babel-jest\"\n },\n \"transformIgnorePatterns\": [\n \"[/\\\\\\\\]node_modules[/\\\\\\\\].+\\\\.(js|jsx|mjs)$\"\n ]\n }\n}\n\n```" } ]
code_product-details_874a60b9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/propTypes.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport PropTypes from 'prop-types'\n\nexport const productShape = PropTypes.shape({\n /** Product's id */\n productId: PropTypes.string.isRequired,\n /** Product's name */\n productName: PropTypes.string.isRequired,\n /** Product's description */\n description: PropTypes.string,\n /** Product's technical specification */\n properties: PropTypes.arrayOf(\n PropTypes.shape({\n /** The property name */\n name: PropTypes.string,\n /** The specification description */\n values: PropTypes.arrayOf(PropTypes.string),\n })\n ),\n /** Product reference */\n productReference: PropTypes.string,\n /** Product's brand */\n brand: PropTypes.string,\n /** Product's SKUs */\n items: PropTypes.arrayOf(\n PropTypes.shape({\n /** SKU id */\n itemId: PropTypes.string.isRequired,\n /** SKU name */\n name: PropTypes.string.isRequired,\n /** SKU Images to be shown */\n images: PropTypes.arrayOf(\n PropTypes.shape({\n /** Image id */\n imageId: PropTypes.string.isRequired,\n /** Image label */\n imageLabel: PropTypes.string,\n /** Image tag as string */\n imageTag: PropTypes.string,\n /** Image URL */\n imageUrl: PropTypes.string.isRequired,\n /** Image text */\n imageText: PropTypes.string.isRequired,\n })\n ).isRequired,\n /** SKU sellers */\n sellers: PropTypes.arrayOf(\n PropTypes.shape({\n /** Seller id */\n sellerId: PropTypes.string.isRequired,\n /** Seller comertial offer */\n commertialOffer: PropTypes.shape({\n /** SKU installments */\n Installments: PropTypes.arrayOf(\n PropTypes.shape({\n /** Installment value */\n Value: PropTypes.number.isRequired,\n /** Interest rate (zero if interest-free) */\n InterestRate: PropTypes.number.isRequired,\n /** Calculated total value */\n TotalValuePlusInterestRate: PropTypes.number,\n /** Number of installments */\n NumberOfInstallments: PropTypes.number.isRequired,\n /** Installments offer name */\n Name: PropTypes.string,\n })\n ),\n /** Selling Price */\n Price: PropTypes.number.isRequired,\n /** List Price */\n ListPrice: PropTypes.number.isRequired,\n /** available item quantity */\n AvailableQuantity: PropTypes.number,\n }).isRequired,\n })\n ).isRequired,\n })\n ).isRequired,\n})\n\n```" } ]
code_product-details_a274cd74
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/productDetails.css from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n/**\n Product Details CSS Modules\n*/\n\n.container {}\n.nameContainer {}\n.detailsContainer {}\n.priceContainer {}\n.fixedButton {}\n.informationsContainer{}\n.highlightsContainer{}\n\n```" } ]
code_product-details_e16027da
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/ProductQuantitySelector.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport ProductQuantitySelector from './components/ProductQuantitySelector/index'\nexport default ProductQuantitySelector\n\n```" } ]
code_product-details_332a36e7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/store/blocks.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"product-details\": {\n \"blocks\": [\n \"breadcrumb\",\n \"product-name\",\n \"product-images\",\n \"product-price\",\n \"product-description\",\n \"buy-button\",\n \"sku-selector\",\n \"shipping-simulator\",\n \"availability-subscriber\",\n \"share\",\n \"product-specifications\",\n \"product-highlights\"\n ]\n }\n}\n\n```" } ]
code_product-details_11293362
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/store/interfaces.json from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"product-details\": {\n \"required\": [\n \"product-images\",\n \"product-name\",\n \"product-price\",\n \"sku-selector\",\n \"buy-button\",\n \"product-description\",\n \"product-specifications\"\n ],\n \"allowed\": [\n \"breadcrumb\",\n \"shipping-simulator\",\n \"availability-subscriber\",\n \"share\",\n \"product-highlights\",\n \"product-quantity-selector\",\n \"addon-details-btn\"\n ],\n \"component\": \"ProductDetails\"\n },\n \"product-quantity-selector\": {\n \"component\": \"ProductQuantitySelector\"\n },\n \"product-add-to-list-button\": {\n \"component\": \"ProductAddToListButton\",\n \"allowed\": [\"addon-details-btn\"]\n },\n \"addon-details-btn\": {\n \"component\": \"*\"\n }\n}\n\n```" } ]
code_product-details_01012521
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/utils/generateUrl.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nexport const DEFAULT_WIDTH = 'auto'\nexport const DEFAULT_HEIGHT = 'auto'\nexport const MAX_WIDTH = 3000\nexport const MAX_HEIGHT = 4000\n\n/**\n * Having the url below as base for the LEGACY file manager,\n * https://storecomponents.vteximg.com.br/arquivos/ids/155472/Frame-3.jpg?v=636793763985400000\n * the following regex will match https://storecomponents.vteximg.com.br/arquivos/ids/155472\n *\n * Also matches urls with defined sizes like:\n * https://storecomponents.vteximg.com.br/arquivos/ids/155473-160-auto\n * @type {RegExp}\n *\n * On the new vtex.file-manager isn't necessary replace the URL, just add the param on the querystring, like:\n * \"?width=WIDTH&height=HEIGHT&aspect=true\"\n *\n */\nconst baseUrlRegex = new RegExp(/.+ids\\/(\\d+)/)\n\nexport function cleanImageUrl(imageUrl) {\n const result = baseUrlRegex.exec(imageUrl)\n if (result.length > 0) return result[0]\n}\n\nfunction replaceLegacyFileManagerUrl(imageUrl, width, height) {\n const legacyUrlPattern = '/arquivos/ids/'\n const isLegacyUrl = imageUrl.includes(legacyUrlPattern)\n if (!isLegacyUrl) return imageUrl\n return `${cleanImageUrl(imageUrl)}-${width}-${height}`\n}\n\nexport function changeImageUrlSize(\n imageUrl,\n width = DEFAULT_WIDTH,\n height = DEFAULT_HEIGHT,\n) {\n if (!imageUrl) return\n typeof width === 'number' && (width = Math.min(width, MAX_WIDTH))\n typeof height === 'number' && (height = Math.min(height, MAX_HEIGHT))\n\n const normalizedImageUrl = replaceLegacyFileManagerUrl(imageUrl, width, height)\n const queryStringSeparator = normalizedImageUrl.includes('?') ? '&' : '?'\n\n return `${normalizedImageUrl}${queryStringSeparator}width=${width}&height=${height}&aspect=true`\n}\n\n```" } ]
code_product-details_302e1f80
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/utils/thumbnailPositionEnum.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport { values, map } from 'ramda'\n\nconst thumbnailsPosition = {\n DISPLAY_LEFT: {\n name: 'admin/editor.product-details.thumbnailsPosition.left',\n value: 'left',\n },\n DISPLAY_RIGHT: {\n name: 'admin/editor.product-details.thumbnailsPosition.right',\n value: 'right',\n },\n}\n\nexport function getThumbnailsPositionNames() {\n return map(opt => opt.name, values(thumbnailsPosition))\n}\n\nexport function getThumbnailsPositionValues() {\n return map(opt => opt.value, values(thumbnailsPosition))\n}\n\nexport default thumbnailsPosition\n\n```" } ]
code_product-details_23ae1a71
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/utils/schema.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport thumbnailsPosition, {\n getThumbnailsPositionNames,\n getThumbnailsPositionValues,\n} from './thumbnailPositionEnum'\n\nexport const schema = {\n title: 'admin/editor.product-details.title',\n description: 'admin/editor.product-details.description',\n type: 'object',\n widget: {\n 'ui:options': {\n inline: false,\n },\n 'ui:widget': 'radio',\n },\n definitions: {\n highlightsDefault: {\n title: 'highlightsDefault',\n type: 'object',\n properties: {\n showHighlights: {\n title: 'Show highlights',\n type: 'boolean',\n enum: [true, false],\n default: true,\n },\n },\n required: ['showHighlights'],\n dependencies: {\n showHighlights: {\n oneOf: [\n {\n properties: {\n showHighlights: {\n enum: [true],\n },\n highlightGroupDefault: {\n title: 'Person',\n type: 'object',\n properties: {\n highlight: {\n title: 'admin/editor.product-details.highlights.default',\n type: 'string',\n enum: [\n 'admin/editor.product-details.highlights.allSpecifications',\n 'admin/editor.product-details.highlights.chooseDefault',\n 'admin/editor.product-details.highlights.chooseDefaultSpecification',\n ],\n default:\n 'admin/editor.product-details.highlights.allSpecifications',\n },\n },\n required: ['highlight'],\n dependencies: {\n highlight: {\n oneOf: [\n {\n properties: {\n highlight: {\n enum: [\n 'admin/editor.product-details.highlights.allSpecifications',\n ],\n },\n },\n },\n {\n properties: {\n highlight: {\n enum: [\n 'admin/editor.product-details.highlights.chooseDefault',\n ],\n },\n typeHighlight: {\n type: 'string',\n title:\n 'admin/editor.product-details.highlights.title',\n description:\n 'admin/editor.product-details.product-specifications.typeHelper',\n },\n },\n required: [''],\n },\n {\n properties: {\n highlight: {\n enum: [\n 'admin/editor.product-details.highlights.chooseDefaultSpecification',\n ],\n },\n typeSpecifications: {\n type: 'string',\n title:\n 'admin/editor.product-details.highlights.typeSpecifications.title',\n description:\n 'admin/editor.product-details.product-specifications.typeHelper',\n },\n },\n required: [''],\n },\n ],\n },\n },\n },\n },\n },\n ],\n },\n },\n },\n\n specificationsDefault: {\n title: 'specificationsDefault',\n type: 'object',\n properties: {\n showSpecifications: {\n title: 'Show specifications',\n type: 'boolean',\n enum: [true, false],\n default: true,\n },\n },\n required: ['showSpecifications'],\n dependencies: {\n showSpecifications: {\n oneOf: [\n {\n properties: {\n showSpecifications: {\n enum: [true],\n },\n specificationGroups: {\n title: 'specificationGroups',\n type: 'object',\n properties: {\n specification: {\n title:\n 'admin/editor.product-details.product-specifications.default',\n type: 'string',\n enum: [\n 'admin/editor.product-details.product-specifications.allSpecifications',\n 'admin/editor.product-details.product-specifications.chooseDefaultSpecification',\n ],\n default:\n 'admin/editor.product-details.product-specifications.allSpecifications',\n },\n },\n required: ['specification'],\n dependencies: {\n specification: {\n oneOf: [\n {\n properties: {\n specification: {\n enum: [\n 'admin/editor.product-details.product-specifications.allSpecifications',\n ],\n },\n },\n },\n {\n properties: {\n specification: {\n enum: [\n 'admin/editor.product-details.product-specifications.chooseDefaultSpecification',\n ],\n },\n typeSpecifications: {\n type: 'string',\n title:\n 'admin/editor.product-details.product-specifications.typeSpecifications.title',\n description:\n 'admin/editor.product-details.product-specifications.typeHelper',\n },\n },\n required: [''],\n },\n ],\n },\n },\n },\n viewMode: {\n type: 'string',\n title:\n 'admin/editor.product-specifications.displaySpecification.title',\n enum: ['tab', 'table'],\n enumNames: [\n 'admin/editor.product-specifications.displaySpecification.tabMode',\n 'admin/editor.product-specifications.displaySpecification.tableMode',\n ],\n default:\n 'admin/editor.product-specifications.displaySpecification.tabMode',\n widget: {\n 'ui:options': {\n inline: false,\n },\n 'ui:widget': 'radio',\n },\n },\n },\n required: [''],\n },\n ],\n },\n },\n },\n },\n\n properties: {\n highlightGroupDefault: {\n title: 'Conditional',\n $ref: '#/definitions/highlightsDefault',\n },\n specificationsDefault: {\n title: 'specification',\n $ref: '#/definitions/specificationsDefault',\n },\n thumbnailPosition: {\n title: 'admin/editor.product-details.thumbnailsPosition.title',\n type: 'string',\n enum: getThumbnailsPositionValues(),\n enumNames: getThumbnailsPositionNames(),\n default: thumbnailsPosition.DISPLAY_LEFT.value,\n isLayout: false,\n },\n },\n}\n\n```" } ]
code_product-details_bc60ddcb
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/__tests__/ProductQuantitySelector.test.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport { renderWithIntl } from 'intl-utils'\n\nimport ProductQuantitySelector from '../ProductQuantitySelector'\n\ndescribe('<ProductQuantitySelector /> component', () => {\n it('should render and not show available quantity view', () => {\n const component = renderWithIntl(<ProductQuantitySelector selectedQuantity={1} availableQuantity={50} warningQuantityThreshold={10}/>)\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n it('should render and show available quantity view', () => {\n const component = renderWithIntl(<ProductQuantitySelector selectedQuantity={1} availableQuantity={5} warningQuantityThreshold={10}/>)\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n})\n```" } ]
code_product-details_a845f5bd
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/__tests__/ProductDetails.test.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport { renderWithIntl } from 'intl-utils'\nimport { getProduct } from 'product-mock'\n\nimport ProductDetails from '../ProductDetails'\n\ndescribe('<ProductDetails /> component', () => {\n const getComponentRender = customProps => {\n const props = {\n slug: 'productSlug',\n query: {\n skuId: 'id',\n },\n ...customProps,\n }\n\n return renderWithIntl(<ProductDetails {...props} />)\n }\n\n it('should match the loading snapshot', () => {\n const props = {\n productQuery: {\n loading: true,\n },\n }\n\n const render = getComponentRender(props)\n const fragment = render.asFragment()\n expect(fragment).toMatchSnapshot()\n })\n\n it('should match the snapshot with product', () => {\n const props = {\n categories: ['Shirt', 'Shoes'],\n productQuery: {\n loading: false,\n product: getProduct(),\n },\n }\n\n const render = getComponentRender(props)\n const fragment = render.asFragment()\n expect(fragment).toMatchSnapshot()\n })\n\n it('should render breadcrumbs', () => {\n const props = {\n categories: ['Shirt', 'Shoes'],\n productQuery: {\n loading: false,\n product: getProduct(),\n },\n }\n\n const { container } = getComponentRender(props)\n const productName = container.querySelector(\n '.extensionPoint-mock-breadcrumb'\n )\n expect(productName).toBeTruthy()\n })\n\n it('should render fixed button', () => {\n const props = {\n productQuery: {\n loading: false,\n product: getProduct(),\n },\n }\n\n const { container } = getComponentRender(props)\n const productName = container.querySelector('.fixedButton')\n expect(productName).toBeTruthy()\n })\n})\n\n```" } ]
code_product-details_22a74a65
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/testUtils/setupTests.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\n// react-testing-library renders your components to document.body,\n// this will ensure they're removed after each test.\nimport 'react-testing-library/cleanup-after-each'\n\n// this adds jest-dom's custom assertions\nimport 'jest-dom/extend-expect'\n\n```" } ]
code_product-details_6dcdd0af
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/testUtils/intl-utils.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React from 'react'\nimport { render } from 'react-testing-library'\nimport { IntlProvider } from 'react-intl'\nimport defaultMessages from '../../messages/en.json'\n\nexport const renderWithIntl = (node, options) => {\n const rendered = render(\n <IntlProvider messages={defaultMessages} locale=\"en-US\">\n {node}\n </IntlProvider>,\n options\n )\n\n return {\n ...rendered,\n rerender: newUi =>\n renderWithIntl(newUi, {\n container: rendered.container,\n baseElement: rendered.baseElement,\n }),\n }\n}\n\n```" } ]
code_product-details_ffa4963d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/components/ProductQuantitySelector/quantitySelector.css from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.quantitySelectorContainer {}\n.availableQuantityContainer {}\n```" } ]
code_product-details_67b29a30
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/components/ProductQuantitySelector/index.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React, { useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport { NumericStepper } from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\n\nimport styles from './quantitySelector.css'\n\nconst ProductQuantitySelector = ({ selectedQuantity, onChange, availableQuantity, warningQuantityThreshold }) => {\n const showAvailable = availableQuantity <= warningQuantityThreshold\n return (\n <div className={`${styles.quantitySelectorContainer} flex flex-column mb4`}>\n <div className=\"mb3 c-muted-2 t-body\">\n <FormattedMessage id=\"store/product-details.quantity\" />\n </div>\n <NumericStepper\n size=\"small\"\n value={selectedQuantity}\n minValue={1}\n maxValue={availableQuantity ? availableQuantity : undefined}\n onChange={useCallback(e => onChange(e.value), [])}\n />\n {showAvailable && \n <div className={`${styles.availableQuantityContainer} mv4 c-muted-2 t-small`}>\n <FormattedMessage id=\"store/product-details.quantity-available\" values={{ availableQuantity }} />\n </div>}\n </div>\n )\n}\n\nProductQuantitySelector.defaultProps = {\n warningQuantityThreshold: 0,\n onChange: () => {},\n}\n\nProductQuantitySelector.propTypes = {\n selectedQuantity: PropTypes.number.isRequired,\n availableQuantity: PropTypes.number,\n onChange: PropTypes.func,\n warningQuantityThreshold: PropTypes.number.isRequired\n}\n\nProductQuantitySelector.schema = {\n title: 'admin/editor.product-quantity-selector.title',\n description: 'admin/editor.product-quantity-selector.description',\n type: 'object',\n properties: {\n warningQuantityThreshold: {\n title: 'admin/editor.product-quantity-selector.warningQuantityThreshold.title',\n description: 'admin/editor.product-quantity-selector.warningQuantityThreshold.title',\n type: 'number',\n default: 0,\n },\n },\n}\n\nexport default ProductQuantitySelector\n```" } ]
code_product-details_0ef193e2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/components/ProductQuantitySelector/README.md from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# VTEX Product Quantity Selector\n\n## Description\n\nThe VTEX Product Quantity Selector allows the user to add to cart the specified amount of the displayed product\n\n## Table of Contents\n\n- [Usage](#usage)\n - [Blocks API](#blocks-api)\n - [Configuration](#configuration)\n - [Styles API](#styles-api)\n - [CSS Namespaces](#css-namespaces)\n\n## Usage\n\nThis app uses our store builder with the blocks architecture. To know more about Store Builder [click here.](https://help.vtex.com/en/tutorial/understanding-storebuilder-and-stylesbuilder#structuring-and-configuring-our-store-with-object-object)\n\nTo use this app or override the default CSS you need import it in your dependencies on `manifest.json` file.\n\n```json\n \"dependencies\": {\n \"vtex.product-details\": \"1.x\"\n }\n```\n\nThis block may be used inside the `product-details` block.\n\nTo use it, you must declare its use in your `product-details` block array. An example of usage in a `blocks.json`:\n\n```json\n\"product-details#default\": {\n \"blocks\": [\n \"breadcrumb\",\n \"product-name\",\n \"product-images\",\n \"product-price\",\n \"product-description\",\n \"product-specifications\",\n \"buy-button\",\n \"sku-selector\",\n \"shipping-simulator\",\n \"availability-subscriber\",\n \"share\",\n \"product-quantity-selector\"\n ],\n \"props\": {\n \"displayVertically\": true,\n \"share\": {\n \"social\": {\n \"Facebook\": true,\n \"WhatsApp\": true,\n \"Twitter\": false\n }\n },\n \"price\": {\n \"labelSellingPrice\": null,\n \"showListPrice\": true,\n \"showLabels\": true,\n \"showInstallments\": true,\n \"showSavings\": true\n },\n \"name\": {\n \"showBrandName\": false,\n \"showSku\": false,\n \"showProductReference\": false\n }\n }\n },\n\"product-quantity-selector\": {\n \"props\": {\n \"warningQuantityThreshold\": 9999999\n }\n },\n```\n\n### Blocks API\n\nThis is the defined interface for this block:\n\n```json\n{\n \"product-quantity-selector\": {\n \"component\": \"ProductQuantitySelector\"\n }\n}\n```\n\nFor now this block does not have any required or optional blocks.\n\n#### Configuration\n\nThrough the Storefront, you can change the Product Quantity Selector's behavior and interface. However, you also can make in your theme app, as Store theme does.\n\n| Prop name | Type | Description |\n| ------------------- | --------- | ------------------------------------------------------------------------------------------- |\n| `warningQuantityThreshold` | `Number` | Only show the quantity of remaining items in stock if item available quantity is less than or equal to the value passed in this property. Default: 0 (does not appear). |\n\n### Styles API\n\nThis app provides some CSS classes as an API for style customization.\n\nTo use this CSS API, you must add the `styles` builder and create an app styling CSS file.\n\n1. Add the `styles` builder to your `manifest.json`:\n\n```json\n \"builders\": {\n \"styles\": \"1.x\"\n }\n```\n\n2. Create a file called `vtex.product-details.css` inside the `styles/css` folder. Add your custom styles:\n\n```css\n.quantitySelectorContainer {\n margin-top: 10px;\n}\n```\n\n#### CSS Namespaces\n\nBelow, we describe the namespaces that are defined in the Product Quantity Selector.\n\n| Token name | Component | Description |\n| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |\n| `quantitySelectorContainer` | [index](https://github.com/vtex-apps/product-details/blob/master/react/components/ProductQuantitySelector/index.js) | The main container of `Product Quantity Selector` |\n| `availableQuantityContainer` | [index](https://github.com/vtex-apps/product-details/blob/master/react/components/ProductQuantitySelector/index.js) | The container that wraps the available quantity view. |\n```" } ]
code_product-details_797bea18
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/components/FixedButton/index.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React, { Fragment } from 'react'\nimport BottomExtraSpace from './BottomExtraSpace'\nimport { NoSSR } from 'vtex.render-runtime'\n\nimport productDetails from '../../productDetails.css'\n\nexport default props => (\n <Fragment>\n <div\n className={`${\n productDetails.fixedButton\n } fixed bottom-0 left-0 w-100 z-999`}\n >\n {props.children}\n </div>\n <NoSSR>\n <BottomExtraSpace>{props.children}</BottomExtraSpace>\n </NoSSR>\n </Fragment>\n)\n\n```" } ]
code_product-details_1074b850
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of product-details/react/components/FixedButton/BottomExtraSpace.js from the product-details VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nimport React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport ReactDOM from 'react-dom'\n\nclass BottomExtraSpace extends Component {\n constructor(props) {\n super(props)\n\n this.ref = React.createRef()\n this.state = { mounted: false }\n this.el = document.createElement('div')\n }\n\n componentDidMount() {\n this.fixedRoot = this.ref.current\n\n while (this.fixedRoot &&\n window.getComputedStyle(this.fixedRoot)\n .getPropertyValue('overflow') !== 'auto') { this.fixedRoot = this.fixedRoot.parentElement }\n\n if (!this.fixedRoot)this.fixedRoot = document.body\n\n this.fixedRoot && this.fixedRoot.appendChild(this.el)\n this.setState({ mounted: true })\n }\n\n componentWillUnmount() {\n this.fixedRoot && this.fixedRoot.removeChild(this.el)\n }\n\n render() {\n const { mounted } = this.state\n\n if (!mounted) return <div ref={this.ref} />\n\n const children = this.props.children\n\n return ReactDOM.createPortal(\n <div className=\"o-0\" tabIndex=\"-1\">\n {children}\n </div>,\n this.el,\n )\n }\n}\n\nBottomExtraSpace.propTypes = {\n children: PropTypes.node,\n}\n\nexport default BottomExtraSpace\n\n```" } ]
code_starter.store-react-components_d16f6668
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/types/index.d.ts from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare namespace NodeJS {\n interface ProcessEnv {\n [key: string]: string | undefined\n NODE_ENV: 'development' | 'production',\n USE_LOCAL_SERVER?: 'true' | any\n }\n}\n\ndeclare var __DEV__: boolean;\n\n```" } ]
code_starter.store-react-components_12a3d16b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/test/thing.test.tsx from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { Default as Thing } from '../stories/Thing.stories';\n\ndescribe('Thing', () => {\n it('renders without crashing', () => {\n const div = document.createElement('div');\n ReactDOM.render(<Thing />, div);\n ReactDOM.unmountComponentAtNode(div);\n });\n});\n\n```" } ]
code_starter.store-react-components_08b30693
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/.storybook/preview.js from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\n// https://storybook.js.org/docs/react/writing-stories/parameters#global-parameters\nexport const parameters = {\n // https://storybook.js.org/docs/react/essentials/actions#automatically-matching-args\n actions: { argTypesRegex: '^on.*' },\n controls: {\n matchers: {\n color: /(background|color)$/i,\n },\n },\n};\n\n```" } ]
code_starter.store-react-components_12fa43df
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/.storybook/main.js from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nmodule.exports = {\n stories: ['../stories/**/*.stories.@(ts|tsx|js|jsx)'],\n addons: ['@storybook/addon-links', '@storybook/addon-essentials'],\n // https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration\n typescript: {\n check: true, // type-check stories during Storybook build\n }\n};\n\n```" } ]
code_starter.store-react-components_a74876f5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/stories/Thing.stories.tsx from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react';\nimport { Meta, Story } from '@storybook/react';\nimport { Thing, Props } from '../src/components/Things';\n\nconst meta: Meta = {\n title: 'Welcome',\n component: Thing,\n argTypes: {\n children: {\n control: {\n type: 'text',\n },\n },\n },\n parameters: {\n controls: { expanded: true },\n },\n};\n\nexport default meta;\n\nconst Template: Story<Props> = args => <Thing {...args} />;\n\n// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test\n// https://storybook.js.org/docs/react/workflows/unit-testing\nexport const Default = Template.bind({});\n\nDefault.args = {};\n\n```" } ]
code_starter.store-react-components_136ac0a5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/stories/Hello.stories.tsx from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react';\nimport { Story, Meta } from '@storybook/react';\nimport { Hello } from '../src';\nimport { HelloProps } from '../src/components/Hello';\n\nexport default {\n component: Hello,\n title: 'Components/Hello',\n} as Meta;\n\nconst Template: Story<HelloProps> = (args) => <Hello {...args} />;\n\nexport const Aracaju = Template.bind({});\nAracaju.args = { name: 'Aracaju' };\n\nexport const Brasilia = Template.bind({});\nBrasilia.args = { name: 'Brasilia' };\n\nexport const Rio = Template.bind({});\nRio.args = { name: 'Rio de Janeiro' };\n\n```" } ]
code_starter.store-react-components_53523475
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/pages/index.tsx from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'react-app-polyfill/ie11';\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { Hello, Thing } from '../.';\n\nconst App = () => {\n return (\n <div>\n <Thing />\n <Hello name={'VTEX'} />\n </div>\n );\n};\n\nReactDOM.render(<App />, document.getElementById('root'));\n\n```" } ]
code_starter.store-react-components_e143a40d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/pages/package.json from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"pages\",\n \"version\": \"1.0.0\",\n \"main\": \"index.js\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"start\": \"parcel index.html\",\n \"build\": \"parcel build index.html\"\n },\n \"dependencies\": {\n \"react-app-polyfill\": \"^2.0.0\"\n },\n \"alias\": {\n \"react\": \"../node_modules/react\",\n \"react-dom\": \"../node_modules/react-dom/profiling\",\n \"scheduler/tracing\": \"../node_modules/scheduler/tracing-profiling\"\n },\n \"devDependencies\": {\n \"@types/react\": \"^16.9.11\",\n \"@types/react-dom\": \"^16.8.4\",\n \"parcel\": \"^1.12.3\",\n \"typescript\": \"^3.4.5\"\n },\n \"resolutions\": {\n \"@babel/preset-env\": \"7.13.8\"\n }\n}\n\n```" } ]
code_starter.store-react-components_112b31b7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/src/index.tsx from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\n\nimport { Hello as HelloComponent, HelloProps } from './components/Hello';\nimport { Configuration } from './utils/configuration';\n\nconst client = new ApolloClient({\n uri: Configuration.serverUrl,\n cache: new InMemoryCache(),\n});\n\nexport { Thing } from './components/Things';\n\nexport function Hello(helloProps: HelloProps) {\n return (\n <ApolloProvider client={client}>\n <HelloComponent\n name={helloProps.name}\n backgroundColor={helloProps.backgroundColor}\n />\n </ApolloProvider>\n );\n}\n\n```" } ]
code_starter.store-react-components_2b4966fc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/src/config.json from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"appBackendBaseUrl\": {\n \"localServer\": \"http://localhost:8080\",\n \"development\": \"https://vtex-app-poc-backend.vtex.io\",\n \"production\": \"https://vtex-app-poc-backend.vtex.io\"\n }\n}\n\n```" } ]
code_starter.store-react-components_3cf74d34
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/src/utils/configuration.ts from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport * as configFile from '../config.json';\ninterface Configuration {\n serverUrl: string;\n}\n\nfunction getServerBaseUrl(): string {\n if (process.env.USE_LOCAL_SERVER === 'true') {\n return configFile.appBackendBaseUrl.localServer;\n } else {\n return configFile.appBackendBaseUrl[process.env.NODE_ENV];\n }\n}\n\nlet config: Configuration = {\n serverUrl: `${getServerBaseUrl()}/graphql`,\n};\n\nexport const Configuration = config;\n\n```" } ]
code_starter.store-react-components_a8decabd
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/src/components/Hello.tsx from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react';\nimport { useQuery, gql } from '@apollo/client';\n\nconst HELLO_QUERY = gql`\n query Hello {\n hello\n }\n`;\nexport interface HelloProps {\n name: string;\n backgroundColor?: string;\n}\n\nexport function Hello({ name, backgroundColor = '#db1457' }: HelloProps) {\n const { loading, error, data } = useQuery(HELLO_QUERY);\n\n if (loading) return <p>Loading...</p>;\n if (error) return <p>Error :(</p>;\n\n return (\n <div\n style={{\n backgroundColor,\n padding: '10px',\n color: 'white',\n fontSize: '2em',\n }}\n >\n {data.hello},{' '}\n <span>\n <u>{name}</u>\n </span>\n !\n </div>\n );\n}\n\n```" } ]
code_starter.store-react-components_3c856486
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of starter.store-react-components/src/components/Things.tsx from the starter.store-react-components VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC, HTMLAttributes, ReactChild } from 'react';\n\nexport interface Props extends HTMLAttributes<HTMLDivElement> {\n /** custom content, defaults to 'the snozzberries taste like snozzberries' */\n children?: ReactChild;\n}\n\n// Please do not use types off of a default export module or else Storybook Docs will suffer.\n// see: https://github.com/storybookjs/storybook/issues/9556\n/**\n * A custom Thing component. Neat!\n */\nexport const Thing: FC<Props> = ({ children }) => {\n return <div>{children}</div>;\n};\n\n```" } ]
code_multisite-segment-results_8799aad2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/messages/pt.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"editor.multisite.title\" : \"Multisitio\",\n \"editor.multisite.description\" : \"Componente de Multisitio\",\n \"editor.multisite.navigation.name1\" : \"Primeiro nome de navegação\",\n \"editor.multisite.navigation.default\" : \"Nome\",\n \"editor.multisite.navigation.value1\" : \"Primeiro parâmetro ID\",\n \"editor.multisite.navigation.name2\" : \"Segundo nome de navegação\",\n \"editor.multisite.navigation.value2\" : \"Segundo parâmetro ID\",\n \"editor.multisite.navigation.name3\" : \"Terceiro nome de navegação\",\n \"editor.multisite.navigation.value3\" : \"Terceiro parâmetro ID\",\n \"editor.image.src.title\" : \"Src\",\n \"editor.image.alt.title\" : \"Alt\",\n \"editor.image.title.title\" : \"Título\"\n}\n\n```" } ]
code_multisite-segment-results_355a4649
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/messages/en.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"editor.multisite.title\" : \"Multisite\",\n \"editor.multisite.description\" : \"Multisite component\",\n \"editor.multisite.navigation.name1\" : \"First navigation name\",\n \"editor.multisite.navigation.default\" : \"Name\",\n \"editor.multisite.navigation.value1\" : \"First parameter ID\",\n \"editor.multisite.navigation.name2\" : \"Second navigation name\",\n \"editor.multisite.navigation.value2\" : \"Second parameter ID\",\n \"editor.multisite.navigation.name3\" : \"Third navigation name\",\n \"editor.multisite.navigation.value3\" : \"Third parameter ID\",\n \"editor.image.src.title\" : \"Src\",\n \"editor.image.alt.title\" : \"Alt\",\n \"editor.image.title.title\" : \"Title\"\n}\n```" } ]
code_multisite-segment-results_4772917d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/messages/context.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"editor.multisite.title\" : \"Multisite\",\n \"editor.multisite.description\" : \"Multisite component\",\n \"editor.multisite.navigation.name1\" : \"First navigation name\",\n \"editor.multisite.navigation.default\" : \"Name\",\n \"editor.multisite.navigation.value1\" : \"First parameter ID\",\n \"editor.multisite.navigation.name2\" : \"Second navigation name\",\n \"editor.multisite.navigation.value2\" : \"Second parameter ID\",\n \"editor.multisite.navigation.name3\" : \"Third navigation name\",\n \"editor.multisite.navigation.value3\" : \"Third parameter ID\",\n \"editor.image.src.title\" : \"Src\",\n \"editor.image.alt.title\" : \"Alt\",\n \"editor.image.title.title\" : \"Title\"\n}\n```" } ]
code_multisite-segment-results_106274ea
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/messages/es.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"editor.multisite.title\" : \"Multisitio\",\n \"editor.multisite.description\" : \"Componente Multisitio\",\n \"editor.multisite.navigation.name1\" : \"Primer nombre de la navegación\",\n \"editor.multisite.navigation.default\" : \"Nombre\",\n \"editor.multisite.navigation.value1\" : \"Primer ID de parametro\",\n \"editor.multisite.navigation.name2\" : \"Segundo nombre de la navegación\",\n \"editor.multisite.navigation.value2\" : \"Segundo ID de parametro\",\n \"editor.multisite.navigation.name3\" : \"Tercer nombre de la navegación\",\n \"editor.multisite.navigation.value3\" : \"Tercer ID de parametro\",\n \"editor.image.src.title\" : \"Src\",\n \"editor.image.alt.title\" : \"Alt\",\n \"editor.image.title.title\" : \"Título\"\n}\n```" } ]
code_multisite-segment-results_af63c1c8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/docs/README.md from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# VTEX Recommendation Resolver\n\nThis app is an implementation of the VTEX recommendation protocol for recommendation shelves that is defined by the schema GraphQL [recommendation-graphql](https://github.com/vtex-apps/recommendation-graphql).\n\n```" } ]
code_multisite-segment-results_d47d4cc2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/node/service.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"stack\": \"nodejs\",\n \"memory\": 256,\n \"minReplicas\": 3,\n \"workers\": 1,\n \"ttl\": 60\n}\n\n```" } ]
code_multisite-segment-results_17cfae92
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/node/package.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"graphql\": \"^14.5.8\",\n \"graphql-tools\": \"^4.0.6\",\n \"vtex.search-segment-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-segment-graphql@0.1.0/public\"\n },\n \"devDependencies\": {\n \"@types/atob\": \"^2.1.2\",\n \"@types/node\": \"^12.0.0\",\n \"@vtex/api\": \"6.45.12\",\n \"@vtex/prettier-config\": \"^0.1.3\",\n \"eslint\": \"^6.8.0\",\n \"eslint-config-vtex\": \"^12.2.1\",\n \"husky\": \"^4.2.0\",\n \"lint-staged\": \"^10.0.2\",\n \"prettier\": \"^1.19.1\",\n \"typescript\": \"3.9.7\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles\",\n \"vtex.messages\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.messages@1.65.0/public/@types/vtex.messages\",\n \"vtex.native-types\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.native-types@0.8.0/public/@types/vtex.native-types\",\n \"vtex.search-segment-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-segment-graphql@0.1.1/public/@types/vtex.search-segment-graphql\",\n \"vtex.search-session\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-session@0.2.10/public/_types/react\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.152.0/public/@types/vtex.store-graphql\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide\"\n },\n \"version\": \"0.1.4\"\n}\n\n```" } ]
code_multisite-segment-results_201d7dd9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/node/global.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n IOContext,\n ParamsContext,\n RecorderState,\n ServiceContext,\n SegmentData,\n} from '@vtex/api'\n\nimport { Clients } from './clients/index'\n\ndeclare global {\n type Context = ServiceContext<Clients, RecorderState, CustomContext>\n\n interface CustomContext extends ParamsContext {\n vtex: CustomIOContext\n }\n interface CustomIOContext extends IOContext {\n segment?: SegmentData\n }\n\n interface SearchSegmentInput {\n userEmail?: string\n isAuthenticated?: boolean\n selectedFacets?: SelectedFacet[]\n }\n\n interface SelectedFacet {\n key: string\n value: string\n }\n}\n\n```" } ]
code_multisite-segment-results_4de10356
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/node/index.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Service, RecorderState, ParamsContext } from '@vtex/api'\nimport schema from 'vtex.search-segment-graphql/graphql'\n\nimport { Clients, clients } from './clients'\nimport { queries as segmentSearchQueries } from './resolvers/segmentSearch'\n\nexport default new Service<Clients, RecorderState, ParamsContext>({\n clients,\n graphql: {\n resolvers: {\n Query: {\n ...segmentSearchQueries,\n },\n },\n schema,\n },\n})\n\n```" } ]
code_multisite-segment-results_efedc06d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/Multisite.tsx from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useEffect } from 'react';\nimport NavigationLink from './components/NavegationLink';\nimport { useCssHandles } from 'vtex.css-handles';\n\ninterface MultisiteProps {\n src1: string,\n alt1: string,\n title1: string,\n idValue1: number,\n src2: string,\n alt2: string,\n title2: string,\n idValue2: number,\n src3: string,\n alt3: string,\n title3: string,\n idValue3: number\n}\n\nconst SetCssClass = (el: any, cssClass: string) => {\n el?.classList.add(cssClass);\n}\n\nconst SetActiveClassOnReload = () =>{\n const activeBtn = localStorage.getItem(\"btnActiveElement\") || \"\";\n const el = document.getElementById(activeBtn);\n const activeClass = localStorage.getItem(\"btnActiveClass\") || \"\";\n SetCssClass(el, activeClass);\n localStorage.removeItem(\"btnActiveElement\");\n localStorage.removeItem(\"btnActiveClass\");\n}\n \nconst Multisite: StorefrontFunctionComponent<MultisiteProps> = ({\n src1, \n alt1,\n title1, \n idValue1, \n\n src2, \n alt2,\n title2, \n idValue2, \n\n src3, \n alt3,\n title3,\n idValue3, \n \n }) => {\n \n useEffect(() => {\n SetActiveClassOnReload();\n }, []);\n\n const CSS_HANDLES = [\n 'multisiteSegmentatitionResultsContainer',\n ]\n\n const handles = useCssHandles(CSS_HANDLES)\n\n return (\n <div className={`${handles.multisiteSegmentatitionResultsContainer} flex ph7 pv2 items-center`}>\n\n <NavigationLink \n src={src1}\n alt={alt1}\n title={title1}\n idValue={idValue1}\n >\n </NavigationLink>\n\n <NavigationLink \n src={src2}\n alt={alt2}\n title={title2}\n idValue={idValue2}\n >\n </NavigationLink>\n\n <NavigationLink \n src={src3}\n alt={alt3}\n title={title3}\n idValue={idValue3}\n >\n </NavigationLink>\n\n </div>\n )\n}\n\nMultisite.schema = {\n title: 'editor.multisite.title',\n description: 'editor.multisite.description'\n}\n\nexport default Multisite\n\n```" } ]
code_multisite-segment-results_495be8ac
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/ConditionalSegmentBlock.tsx from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { FC } from \"react\";\nimport React from \"react\";\n// import { useRuntime } from \"vtex.render-runtime\";\nimport type { Runtime } from './typings/global';\nimport atob from 'atob';\n\ntype Props = {\n segmentValue: number;\n isDefault: boolean\n};\n\ndeclare let window: {\n __RUNTIME__: Runtime\n};\n\nconst ConditionalSegmentBlock: FC<Props> = ({\n segmentValue,\n isDefault,\n children,\n}) => {\n //obtener de la cookie vtex_segment\n const segmentParameter = 'productClustersId';\n const segmentToken = window?.__RUNTIME__?.segmentToken;\n const defaultBanner = isDefault;\n let selectedSegment = <>{defaultBanner && children}</>;\n\n if (segmentToken) {\n const segmentTokenInfo = JSON.parse(atob(segmentToken));\n \n if (segmentTokenInfo && segmentTokenInfo.facets) {\n let segmentFacet = (segmentTokenInfo.facets).split(\"=\");\n let facetParameter = segmentFacet[0];\n let facetParameterId = segmentFacet[1].split(\";\")[0]; \n const condition = segmentValue == facetParameterId;\n\n if (segmentParameter === facetParameter) {\n selectedSegment = <>{condition && children}</>;\n }\n }\n\n }\n\n return selectedSegment;\n};\n\nexport default ConditionalSegmentBlock;\n\n```" } ]
code_multisite-segment-results_3472015f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/package.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"@vtex/css-handles\": \"^1.0.0\",\n \"atob\": \"^2.1.2\",\n \"classnames\": \"^2.2.6\",\n \"ramda\": \"^0.26.1\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/atob\": \"^2.1.2\",\n \"@types/classnames\": \"^2.2.7\",\n \"@types/jest\": \"^24.0.18\",\n \"@types/node\": \"^12.7.5\",\n \"@types/prop-types\": \"^15.7.0\",\n \"@types/ramda\": \"^0.26.5\",\n \"@types/react\": \"^16.9.31\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"apollo-client\": \"^2.5.1\",\n \"graphql\": \"^14.6.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles\",\n \"vtex.messages\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.messages@1.65.0/public/@types/vtex.messages\",\n \"vtex.native-types\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.native-types@0.8.0/public/@types/vtex.native-types\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime\",\n \"vtex.search-segment-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-segment-graphql@0.1.1/public/@types/vtex.search-segment-graphql\",\n \"vtex.search-session\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-session@0.2.10/public/_types/react\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.152.0/public/@types/vtex.store-graphql\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide\"\n }\n}\n\n```" } ]
code_multisite-segment-results_b9ba30c8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/store/contentSchemas.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"definitions\": {\n \"Multisite\": {\n \"type\": \"object\",\n \"properties\": {\n \"src1\": {\n \"title\": \"admin/editor.image.src.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/url\",\n \"default\": \"\",\n \"widget\": {\n \"ui:widget\": \"image-uploader\"\n }\n },\n \"alt1\": {\n \"title\": \"admin/editor.image.alt.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"\"\n },\n \"title1\": {\n \"title\": \"admin/editor.image.title.title\",\n \"description\": \"admin/editor.image.title.description\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"\"\n },\n \"idValue1\": {\n \"title\": \"editor.multisite.navigation.value1\",\n \"type\": \"number\",\n \"default\": null\n },\n \"src2\": {\n \"title\": \"admin/editor.image.src.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/url\",\n \"default\": \"\",\n \"widget\": {\n \"ui:widget\": \"image-uploader\"\n }\n },\n \"alt2\": {\n \"title\": \"admin/editor.image.alt.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"\"\n },\n \"title2\": {\n \"title\": \"admin/editor.image.title.title\",\n \"description\": \"admin/editor.image.title.description\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"\"\n },\n \"idValue2\": {\n \"title\": \"editor.multisite.navigation.value2\",\n \"type\": \"number\",\n \"default\": null\n },\n \"src3\": {\n \"title\": \"admin/editor.image.src.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/url\",\n \"default\": \"\",\n \"widget\": {\n \"ui:widget\": \"image-uploader\"\n }\n },\n \"alt3\": {\n \"title\": \"admin/editor.image.alt.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"\"\n },\n \"title3\": {\n \"title\": \"admin/editor.image.title.title\",\n \"description\": \"admin/editor.image.title.description\",\n \"$ref\": \"app:vtex.native-types#/definitions/text\",\n \"default\": \"\"\n },\n \"idValue3\": {\n \"title\": \"editor.multisite.navigation.value3\",\n \"type\": \"number\",\n \"default\": null\n }\n } \n },\n \"ConditionalSegmentBlock\": {\n \"type\": \"object\",\n \"properties\": {\n \"segmentValue\": {\n \"title\": \"segmentValue\",\n \"type\": \"number\",\n \"default\": null\n },\n \"isDefault\": {\n \"title\": \"isDefault\",\n \"type\": \"boolean\",\n \"default\": false\n }\n } \n }\n }\n}\n```" } ]
code_multisite-segment-results_0dddb011
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/store/interfaces.json from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"multisite\": {\n \"component\": \"Multisite\",\n \"content\": {\n \"$ref\": \"#/definitions/Multisite\"\n }\n },\n \"conditionalSegmentBlock\": {\n \"component\": \"ConditionalSegmentBlock\",\n \"composition\": \"children\",\n \"content\": {\n \"$ref\": \"#/definitions/ConditionalSegmentBlock\"\n }\n }\n}\n```" } ]
code_multisite-segment-results_e0c0bea0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/node/clients/index.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ClientsConfig, IOClients } from '@vtex/api'\n\nconst MEDIUM_TIMEOUT_MS = 2 * 1000\n\nexport class Clients extends IOClients {\n // Add client example\n // public get myClient(): ClientType {\n // return this.getOrSet('myClient', ClientType)\n // }\n}\n\nexport const clients: ClientsConfig<Clients> = {\n implementation: Clients,\n options: {\n default: {\n retries: 2,\n timeout: MEDIUM_TIMEOUT_MS,\n },\n },\n}\n\n```" } ]
code_multisite-segment-results_cc3c0a25
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/node/typings/global.d.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare const metrics\n\ntype GenericObject = Record<string, any>\n\n```" } ]
code_multisite-segment-results_e3661b99
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/node/resolvers/segmentSearch.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const queries = {\n\n searchSegment: async (\n __: unknown, \n args: SearchSegmentInput, \n context: Context\n ) => {\n\n const { parameterValue } = await context.clients.apps.getAppSettings(\n `${process.env.VTEX_APP_ID}`\n )\n const parameter = 'productClustersId';\n \n if(args.isAuthenticated === true){\n const selectedFacets = args.selectedFacets || [];\n if (selectedFacets.length > 0){\n return [{ key: selectedFacets[0].key, value: selectedFacets[0].value }];\n } \n } \n\n return [{ key: parameter, value: parameterValue }];\n\n }\n}\n```" } ]
code_multisite-segment-results_4512c089
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/typings/storefront.d.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { FunctionComponent } from 'react'\n\ndeclare global {\n interface StorefrontFunctionComponent<P = GenericObject>\n extends FunctionComponent<P> {\n getSchema?(props: P): GenericObject\n schema?: GenericObject\n }\n\n interface StorefrontComponent<P = GenericObject, S = GenericObject>\n extends Component<P, S> {\n getSchema?(props: P): GenericObject\n schema: GenericObject\n }\n}\n\n```" } ]
code_multisite-segment-results_11c08514
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/typings/vtex.render-runtime.d.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* Typings for `render-runtime` */\ndeclare module 'vtex.render-runtime' {\n import { Component, ComponentType, ReactElement, ReactType } from 'react'\n\n export interface NavigationOptions {\n page: string\n params?: any\n }\n\n export interface RenderContextProps {\n runtime: {\n navigate: (options: NavigationOptions) => void\n }\n }\n\n interface ExtensionPointProps {\n id: string\n [key: string]: any\n }\n\n export const ExtensionPoint: ComponentType<ExtensionPointProps>\n\n interface ChildBlockProps {\n id: string\n }\n\n export const ChildBlock: ComponentType<ChildBlockProps>\n export const useChildBlock = ({ id: string }) => GenericObject\n\n export const Helmet: ReactElement\n export const Link: ReactType\n export const NoSSR: ReactElement\n export const RenderContextConsumer: ReactElement\n export const canUseDOM: boolean\n export const withRuntimeContext: <TOriginalProps extends GenericObject>(\n Component: ComponentType<TOriginalProps & RenderContextProps>\n ) => ComponentType<TOriginalProps>\n}\n\n```" } ]
code_multisite-segment-results_0841409b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/typings/global.d.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport interface Runtime {\n segmentToken: string\n}\n\nexport interface TimeSplit {\n hours: string\n minutes: string\n seconds: string\n}\n\ntype GenericObject = Record<string, any>\n\n```" } ]
code_multisite-segment-results_66aec802
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/typings/css.d.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.css' {\n const css: any\n export default css\n}\n\n```" } ]
code_multisite-segment-results_5bf7eddf
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/typings/graphql.d.ts from the multisite-segment-results 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_multisite-segment-results_be695a1d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/typings/vtex.styleguide.d.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.styleguide' {\n import { ComponentType } from 'react'\n\n export const Input: ComponentType<InputProps>\n\n interface InputProps {\n [key: string]: any\n }\n}\n\n```" } ]
code_multisite-segment-results_39215fdd
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/utils/time.ts from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { TimeSplit } from '../typings/global'\n\nconst SECONDS_IN_MINUTE = 60\nconst SECONDS_IN_HOUR = 60 * SECONDS_IN_MINUTE\n\nconst fillWithZero = (digits: number, number: number): string => {\n const filled = `${'0'.repeat(digits - 1)}${number}`\n\n return filled.slice(filled.length - digits)\n}\n\nexport const parseTimeRemaining = (totalSeconds: number): TimeSplit => {\n const hours = Math.floor(totalSeconds / SECONDS_IN_HOUR)\n const minutes = Math.floor(\n (totalSeconds % SECONDS_IN_HOUR) / SECONDS_IN_MINUTE\n )\n\n const seconds = Math.floor(\n (totalSeconds % SECONDS_IN_HOUR) % SECONDS_IN_MINUTE\n )\n\n return {\n hours: fillWithZero(2, hours),\n minutes: fillWithZero(2, minutes),\n seconds: fillWithZero(2, seconds),\n }\n}\n\n/**\n *\n * @param targetDate ISOString for the date that the countdown will expire\n * @param dispatchFn A function that updates the state of the component\n */\nexport const tick = (\n targetDate: string,\n dispatchFn: React.Dispatch<React.SetStateAction<TimeSplit>>\n) => {\n const ONE_SECOND_IN_MILLIS = 1000\n const finalDate = new Date(targetDate)\n const now = new Date()\n\n const secondsLeft =\n (finalDate.getTime() - now.getTime()) / ONE_SECOND_IN_MILLIS\n\n setTimeout(() => {\n dispatchFn(parseTimeRemaining(secondsLeft))\n }, ONE_SECOND_IN_MILLIS)\n}\n\nexport const getTwoDaysFromNow = () => {\n const today = new Date()\n\n today.setDate(today.getDate() + 2)\n\n return today.toISOString()\n}\n\n```" } ]
code_multisite-segment-results_cb7aa5ed
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/styles/styles.css from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.navigationLink {\n border: 1px solid transparent;\n background-color: transparent;\n color: rgba(150, 150, 150, 0.322);\n text-decoration: none;\n margin-right: .5rem;\n padding: .5rem 1.5rem;\n width: 150px;\n height: 60px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.navigationLink:hover {\n border: 1px solid rgba(150, 150, 150, 0.322);\n cursor: pointer;\n transition: .3s all ease-in;\n}\n\n.active {\n border: 1px solid rgba(150, 150, 150, 0.322);\n color: rgba(44, 44, 44, 0.322);\n transition: .3s all ease-in;\n}\n\n.navigationLink img {\n width: 100%;\n height: auto;\n}\n```" } ]
code_multisite-segment-results_342a4fd4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/components/NavegationLink.tsx from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react';\nimport { useState } from 'react';\nimport styles from '../styles/styles.css';\nimport LoadingSpinner from './LoadingSpinner';\n// import LoadingSpinner from './component/LoadingSpinner';\n\ninterface NavigationLinkProps {\n src: string,\n alt: string,\n title: string,\n idValue: number,\n}\n\nconst parameter = 'productClustersId';\n\nconst SetFacets = async(parameter: string, parameterValue: number, btn: string, activeClass: any) => {\n const data = {\n public: {\n facets: {\n value: `${parameter}=${parameterValue};`\n }\n }\n };\n\n fetch('/api/sessions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n },\n body: JSON.stringify(data)\n })\n .then((response: any) => {\n response.json();\n SetLocalStorageBtnActiveClass(btn, activeClass);\n location.reload();\n });\n}\n\nconst SetCssClassById = (id: string, cssClass: string) => {\n const el = document.getElementById(id);\n el?.classList.add(cssClass);\n}\n\nconst SetLocalStorageBtnActiveClass = (btn: string, activeClass: string) =>{\n localStorage.setItem(\"btnActiveElement\", btn);\n localStorage.setItem(\"btnActiveClass\", activeClass);\n}\n\nconst NavigationLink: StorefrontFunctionComponent<NavigationLinkProps> = ({src, alt, title, idValue}) => {\n \n const [loadingState, SetLoadingState] = useState(false);\n\n let content = loadingState ? <LoadingSpinner/> : <img src={src} alt={alt} /> ;\n\n return (\n <>\n <button \n id={`btn-${title}`} \n className={styles.navigationLink}\n onClick={() => {\n SetCssClassById(`btn-${title}`, styles.active);\n SetFacets(parameter, idValue, `btn-${title}`, styles.active);\n SetLoadingState(true);\n }}>\n {content}\n </button>\n </>\n )\n}\n\nexport default NavigationLink\n```" } ]
code_multisite-segment-results_26e395c1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/components/LoadingSpinner.tsx from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { Spinner } from 'vtex.styleguide'\nimport React from 'react'\n\nexport default function LoadingSpinner() {\n return (\n <div className=\"loading-container\">\n <span className=\"dib c-muted-1\">\n <Spinner color=\"currentColor\" size={20} />\n </span>\n </div>\n )\n}\n```" } ]
code_multisite-segment-results_9dd436fb
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of multisite-segment-results/react/graphql/productReleaseDate.graphql from the multisite-segment-results VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery productReleaseDate($slug: String){\n product(slug: $slug) {\n releaseDate\n }\n}\n\n```" } ]
code_vtex-anaf_a8e0c709
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/docs/anaf.css from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.corporate-info-box p.client-company-document {\n position: relative;\n}\n\n.corporate-info-box p.client-company-document .getCompanyInfo {\n position: absolute;\n height: 44px;\n right: 0;\n top: 20px;\n background: #b3f498;\n border: none;\n cursor: pointer;\n display: none;\n z-index: 9;\n}\n\n.cuiError {\n font-weight: 600;\n color: #cc0000;\n}\n\n.corporate-info-box {\n flex-direction: column;\n}\n\n.corporate-info-box .client-company-document {\n order: -1;\n}\n\n```" } ]
code_vtex-anaf_233d12d4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/docs/README.md from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# VTEX ANAF\n\n\n### Installation Guide\n- Open the VTEX App Store and install this app on your store, or run the following command on VTEX toolbelt:\n\n> vtex install vtex.taxid-validation@0.x\n\n### Check CUI\n\nMake a new POST request to https://{{vendor}}.myvtex.com/anaf/validate-cui with the following body:\n\n```\n{\n \"cui\": \"YOUR CUI HERE\"\n}\n```\n\n\n*If the CUI is invalid, the response code will be 500*\n\nResponse body example:\n```\n{\n \"cod\": 200,\n \"message\": \"SUCCESS\",\n \"found\": [\n {\n \"cui\": YOUR_CUI_HERE,\n \"data\": \"2021-03-30\",\n \"denumire\": \"COMPANY NAME\",\n \"adresa\": \"COMPANY ADDRESS\",\n \"nrRegCom\": \"\",\n \"telefon\": \"\",\n \"fax\": \"\",\n \"codPostal\": \"\",\n \"act\": \"\",\n \"stare_inregistrare\": \"\",\n \"scpTVA\": false,\n \"data_inceput_ScpTVA\": \"\",\n \"data_sfarsit_ScpTVA\": \"\",\n \"data_anul_imp_ScpTVA\": \"\",\n \"mesaj_ScpTVA\": \"nu figureaza in registre \",\n \"dataInceputTvaInc\": \"\",\n \"dataSfarsitTvaInc\": \"\",\n \"dataActualizareTvaInc\": \"\",\n \"dataPublicareTvaInc\": \"\",\n \"tipActTvaInc\": \"\",\n \"statusTvaIncasare\": false,\n \"dataInactivare\": \" \",\n \"dataReactivare\": \" \",\n \"dataPublicare\": \" \",\n \"dataRadiere\": \" \",\n \"statusInactivi\": false,\n \"dataInceputSplitTVA\": \"\",\n \"dataAnulareSplitTVA\": \"\",\n \"statusSplitTVA\": false,\n \"iban\": \"\"\n }\n ],\n \"notfound\": []\n}\n```\n\nIf there is no company with the CUI you provide, the \"denumire\" and \"adresa\" fields will be blank.\n\n\n# App Settings\n1. Go to **Admin > Apps > My Apps > VTEX Anaf**\n2. Fill up the form and press save.\n\nKey listafirme.ro is optional. If you have licence on listafirme, put your api key thene. \nIf the request to ANAF fails, the application will make a new request to the list of companies\n\n# Add Validation on checkout\n\n1. Go to **Admin > Checkout > Code**\n2. Create a new file `anaf.js`\n3. Create a new file `anaf.css`\n4. Copy the content from docs/anaf.js and paste it into your `anaf.js`\n5. Copy the content from docs/anaf.css and paste it into your `anaf.css`\n6. Go to checkout6-custom.js in admin and paste the following code\n\n```\n(function (document, tag) {\n var lockersTag = document.createElement(tag);\n var firstLockersTag = document.getElementsByTagName(tag)[0];\n lockersTag.src = \"/files/anaf.js?\" + Date.now();\n firstLockersTag.parentNode.insertBefore(lockersTag, firstLockersTag);\n \n $('head').append('<link rel=\"stylesheet\" href=\"/files/anaf.css?'+ Date.now()+'\" />');\n })(document, \"script\");\n```\n\nNow you can customize your `anaf.js` and `anaf.css` file as you want.\n\n```" } ]
code_vtex-anaf_43649dc0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/docs/anaf.js from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```javascript\nconst body = $('body');\nvtexjs.checkout.getOrderForm().done((orderForm) => {\n getAnafSettings();\n});\nbody.on('click', 'a#is-corporate-client, #client-profile-data .link-box-edit', function(){\n getAnafSettings();\n}).on('keyup', '.corporate-info-box input#client-company-document', function(){\n if($(this).val()) {\n $('.getCompanyInfo').show();\n } else {\n $('.getCompanyInfo').hide();\n }\n}).on('click', '.getCompanyInfo', function(e){\n e.preventDefault();\n const cui = $('.corporate-info-box input#client-company-document').val();\n validateCui(cui.replace(/[^0-9]/g, ''));\n\n return false;\n});\n\nasync function validateCui(cui) {\n const requestBody = {\n cui\n }\n const response = await fetch(`/anaf/validate-cui`, {\n method: \"POST\",\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(requestBody)\n });\n\n const company = await response.json();\n\n vtexjs.checkout.getOrderForm().done((orderForm) => {\n let clientProfileData = orderForm.clientProfileData\n clientProfileData.corporateName = company.name\n clientProfileData.tradeName = company.name\n clientProfileData.corporateDocument = cui\n clientProfileData.corporatePhone = company.phone\n clientProfileData.isCorporate = true\n vtexjs.checkout.sendAttachment(\n \"clientProfileData\",\n clientProfileData\n ).then(() => {\n if(company.hasOwnProperty('allowEdit') && company.allowEdit === false){\n disableInputs();\n }\n\n if(company.error){\n if(!$('.corporate-info-box p.client-company-document .cuiError').length) {\n $('.corporate-info-box p.client-company-document').append('<p class=\"cuiError\">CUI invalid</p>');\n }\n\n } else {\n if($('.corporate-info-box p.client-company-document .cuiError').length) {\n $('.corporate-info-box p.client-company-document .cuiError').remove();\n }\n }\n\n if(!company.allowContinue && (company.error || !company.isActive)) {\n $(\"#go-to-shipping\").hide();\n } else {\n $(\"#go-to-shipping\").show();\n }\n })\n });\n}\n\nasync function getAnafSettings() {\n $('label[for=\"client-company-document\"]').html('CUI:');\n if(!$('.box-client-info-pj h5.corporate-title').hasClass('visible')) {\n $('.corporate-info-box').css('display', 'none');\n } else {\n $('.corporate-info-box').css('display', 'flex');\n }\n\n if(!$('.corporate-info-box .client-company-document .getCompanyInfo').length) {\n $('.corporate-info-box .client-company-document').append('<button class=\"getCompanyInfo\">Preia</button>');\n }\n\n const settingsResponse = await fetch(`/anaf/get-settings`);\n const settings = await settingsResponse.json();\n\n if(!settings.allowEdit) {\n disableInputs();\n }\n\n if(!$('#client-company-name').val()) {\n const getUserResponse = await fetch(`/anaf/get-user`);\n const userResponse = await getUserResponse.json();\n console.log(userResponse);\n }\n}\n\nfunction disableInputs() {\n $('#client-company-name').prop('disabled', 'disabled');\n $('#client-company-nickname').prop('disabled', 'disabled');\n}\n\n```" } ]
code_vtex-anaf_559685da
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/service.json from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"memory\": 256,\n \"ttl\": 10,\n \"timeout\": 5000,\n \"minReplicas\": 2,\n \"maxReplicas\": 4,\n \"routes\": {\n \"validateCUI\": {\n \"path\": \"/anaf/validate-cui\",\n \"public\": true,\n \"settingsType\": \"workspace\"\n },\n \"getSettings\": {\n \"path\": \"/anaf/get-settings\",\n \"public\": true,\n \"settingsType\": \"workspace\"\n }\n }\n}\n\n```" } ]
code_vtex-anaf_9d1d9d46
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/package.json from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"axios\": \"^0.20.0\",\n \"co-body\": \"^6.0.0\",\n \"ramda\": \"^0.25.0\",\n \"@vtex/api\": \"6.44.0\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^0.0.3\",\n \"@types/jest\": \"^24.0.18\",\n \"@types/node\": \"^12.0.0\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.44.0\",\n \"@vtex/test-tools\": \"^1.0.0\",\n \"tslint\": \"^5.14.0\",\n \"tslint-config-vtex\": \"^2.1.0\",\n \"typescript\": \"3.9.7\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty && tslint -c tslint.json --fix './**/*.ts'\"\n },\n \"version\": \"0.0.7\"\n}\n\n```" } ]
code_vtex-anaf_90d4f136
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/index.ts from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {ClientsConfig, LRUCache, method, RecorderState, Service, ServiceContext} from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { settings } from './middlewares/settings'\nimport { validateCUI } from './middlewares/validateCUI'\n\nconst TIMEOUT_MS = 5000\nconst memoryCache = new LRUCache<string, any>({ max: 5000 })\n\nconst clients: ClientsConfig<Clients> = {\n implementation: Clients,\n options: {\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n },\n status: {\n memoryCache,\n },\n },\n}\n\ndeclare global {\n type Context = ServiceContext<Clients, State>\n\n interface State extends RecorderState {}\n}\n\nexport default new Service({\n clients,\n routes: {\n getSettings: method({\n GET: settings,\n }),\n validateCUI: method({\n POST: validateCUI,\n }),\n },\n})\n\n```" } ]
code_vtex-anaf_910d864c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/clients/anaf.ts from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {ExternalClient, InstanceOptions, IOContext} from '@vtex/api'\n\nimport { getCurrentDate } from '../utils/functions'\n\nexport default class Anaf extends ExternalClient {\n\n constructor(context: IOContext, options?: InstanceOptions) {\n super('', context, options)\n }\n\n public async validateCuiAnaf(body: any): Promise<any> {\n const postBody = [\n {\n cui: body.cui,\n data: getCurrentDate(),\n },\n ]\n\n return this.http.post(\n `http://webservicesp.anaf.ro/PlatitorTvaRest/api/v5/ws/tva`,\n postBody, {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n 'X-Vtex-Use-Https': true,\n },\n })\n }\n\n public async validateCuiListaFirme(key: any, body: any): Promise<any> {\n return this.http.post(\n `https://www.listafirme.ro/api/info-v1.asp?key=${key}&data=${JSON.stringify(body)}`,\n {}, {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n 'X-Vtex-Use-Https': true,\n },\n })\n }\n\n}\n\n```" } ]
code_vtex-anaf_16ccdea6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/clients/index.ts from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport Anaf from './anaf'\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {\n public get anaf() {\n return this.getOrSet('anaf', Anaf)\n }\n}\n\n```" } ]
code_vtex-anaf_d8e89f21
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/middlewares/settings.ts from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n\nimport {getSettings} from '../utils/helpers'\n\nexport async function settings(ctx: Context, next: () => Promise<any>) {\n\n const appSettings = await getSettings(ctx)\n\n const allowEdit = appSettings.allowEdit ? appSettings.allowEdit : false\n const allowContinue = appSettings.allowContinue ? appSettings.allowContinue : false\n\n const output = {\n allowContinue,\n allowEdit,\n }\n\n ctx.status = 200\n ctx.body = output\n\n await next()\n}\n\n```" } ]
code_vtex-anaf_927dda3f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/middlewares/validateCUI.ts from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {json} from 'co-body'\nimport {getSettings} from '../utils/helpers'\n\nexport async function validateCUI(ctx: Context, next: () => Promise<any>) {\n\n const body = await json(ctx.req)\n const settings = await getSettings(ctx)\n\n const allowEdit = settings.allowEdit ? settings.allowEdit : false\n const allowContinue = settings.allowContinue ? settings.allowContinue : false\n const apiKeyListaFirme = settings.listaFirme ? settings.listaFirme : ''\n\n const {\n clients: {anaf: client},\n } = ctx\n\n let output = {\n address: '',\n allowContinue,\n allowEdit,\n cui: body.cui,\n error: false,\n errorMessage: '',\n isActive: false,\n name: '',\n nrRegCom: '',\n phone: '',\n }\n\n const response = await client.validateCuiAnaf(body)\n if (response.cod === 200 && response.found.length) {\n const company = response.found[0]\n output = {\n ...output,\n address: company.adresa,\n error: company.statusInactivi || !company.denumire,\n isActive: !company.statusInactivi,\n name: company.denumire,\n nrRegCom: company.nrRegCom,\n\n phone: company.telefon,\n }\n } else {\n if (apiKeyListaFirme) {\n const listaFirmeData = {\n Address: '',\n Mobile: '',\n Name: '',\n RegNo: '',\n Status: '',\n TaxCode: body.cui,\n }\n\n const responseListaFirme = await client.validateCuiListaFirme(apiKeyListaFirme, listaFirmeData)\n if (responseListaFirme.hasOwnProperty('error')) {\n output = {\n ...output,\n error: true,\n errorMessage: responseListaFirme.error,\n }\n } else {\n output = {\n ...output,\n address: responseListaFirme.Address,\n error: responseListaFirme.Status !== 'functiune',\n errorMessage: responseListaFirme.Status !== 'functiune' ? 'Compania este inactiva' : '',\n isActive: responseListaFirme.Status === 'functiune',\n name: responseListaFirme.Name,\n nrRegCom: responseListaFirme.RegNo,\n phone: responseListaFirme.Mobile[0] ?? '',\n }\n }\n\n } else {\n output = {\n ...output,\n error: true,\n errorMessage: 'Couldn\\'t get company info',\n }\n }\n }\n\n\n ctx.status = 200\n ctx.body = output\n\n await next()\n}\n\n```" } ]
code_vtex-anaf_bee30d1f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/utils/helpers.ts from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Apps } from '@vtex/api'\n\nexport const getSettings = (ctx: any) => {\n const apps = new Apps(ctx.vtex)\n\n return apps.getAppSettings(ctx.vtex.userAgent)\n}\n\n```" } ]
code_vtex-anaf_c40bc2fa
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/utils/functions.ts from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport function getCurrentDate() {\n var d = new Date(),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2)\n month = '0' + month;\n if (day.length < 2)\n day = '0' + day;\n\n return [year, month, day].join('-');\n}\n\n```" } ]
code_vtex-anaf_31217bc1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of vtex-anaf/node/__tests__/simple.test.ts from the vtex-anaf VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n// You can import your files here for testing them\n//\n// More info: https://github.com/sapegin/jest-cheat-sheet\n\ndescribe('simpleTest', () => {\n it('one test case', async () => {\n expect(0.2 + 0.1).not.toBe(0.3)\n })\n})\n\n```" } ]
code_phone-field_4a25037e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/docs/README.md from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# Phone Field\n\nPhone Field is a VTEX IO app that handles formatting and validation of phone numbers. It\nincludes an UI component that renders a text field with a listbox that contains the flag of\nthe country and the respective [country calling code](https://en.wikipedia.org/wiki/List_of_country_calling_codes).\n\n<img width=\"405\" alt=\"component screenshot USA\" src=\"https://user-images.githubusercontent.com/10223856/76995145-306bba80-692e-11ea-9f3b-847627dfc49f.png\">\n<img width=\"405\" alt=\"component screenshot Brazil\" src=\"https://user-images.githubusercontent.com/10223856/76907932-3efe9700-6886-11ea-8b01-1c81ce31a339.png\">\n\n## Usage\n\nTo use this app, you first need to add it in your `manifest.json` file, like so\n\n```json\n{\n \"dependencies\": {\n \"vtex.phone-field\": \"0.x\"\n }\n}\n```\n\n> If you are developing in TypeScript, you may also want to run `vtex setup` after the step above\n\nThen, you can import the phone context and field components and use it inside your forms:\n\n```jsx\nimport React from 'react'\nimport { PhoneField, PhoneContext, rules } from 'vtex.phone-field'\n\nconst Form = () => {\n const [phone, setPhone] = React.useState('+15554567038')\n\n const handlePhoneChange = React.useCallback(({ value, isValid }) => {\n setPhone(value)\n // you can use the `isValid` variable to show some error message\n }, [])\n\n return (\n <form>\n <PhoneContext.PhoneContextProvider rules={rules}>\n <PhoneField\n label=\"Phone number\"\n value={phone}\n onChange={handlePhoneChange}\n />\n </PhoneContext.PhoneContextProvider>\n </form>\n )\n}\n```\n\nYou might be wondering, _what is that `rules` variable?_ And there is a few reasons that it and the\nphone context exists.\n\nThe rules variable includes all default rules that exist inside the `vtex.phone-field` app, but the\n`PhoneField` component isn't limited to them. A rule is a definition of the format (mask) of the phone\nnumber, alongside it's [country ISO alpha-3 code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) and\ncountry calling code. This is used by the component to mask the number correctly and also do the validations.\n\nThe phone context exists so we can decouple the rules definition of the component itself. If you ever\nwant to include a rule that our app doesn't natively support yet, you can pass it to the `rules` prop\nof the `PhoneContextProvider` component. If you have any problems with that, please\n[open an issue](https://github.com/vtex-apps/phone-field/issues/new/choose)!\n\nThe country flags are all inside the app for now, and the `PhoneField` component is rendering them based on\nthe country ISO of the rule. For example, given the following rule:\n\n```javascript\nconst rule = {\n countryISO: 'BRA',\n countryCode: '55',\n mask: '(99) 9 9999-9999',\n}\n```\n\nThe component will look for a flag named `BRA.svg` inside the `react/icons` folder of the app and\nrender it. If the component doesn't find the flag of the country, it will use a default gray flag as\na placeholder.\n\n## Components\n\n### PhoneField\n\nResponsible for rendering the listbox with the text field and formatting and validating the phone number.\n\n#### Props\n\nThe `PhoneField` component also accepts all props of [Styleguide's `Input`](https://styleguide.vtex.com/#/Components/Forms/Input),\nexcept for the `value` and `onChange`, which are redefined by this component.\n\n| Prop name | type | Required |\n| --- | --- | --- |\n| [`value`](#phonefield-value) | `string` | `true` |\n| [`onChange`](#phonefield-onchange) | `func` | `true` |\n| [`defaultCountry`](#phonefield-defaultcountry) | `string` | `false` |\n\n##### PhoneField value\n\n`value: string`\n\nThe phone field value. Can include the country calling code. E.g.: `+15554567038`, `+55999998888`\n\n##### PhoneField onChange\n\n`onChange: (data: { value: string; isValid: boolean }) => void`\n\nCallback to trigger the change of phone value. Can be triggered by either typing on the text field\nor by changing the country from the listbox.\n\n##### PhoneField defaultCountry\n\n`defaultCountry?: string`\n\nThe default country to show in the listbox. Used only when the phone number passed in `value`\ndoesn't have a country calling code or if we don't have a `value` at all.\n\n### PhoneContext.PhoneContextProvider\n\nThe wrapper component for the phone number that provides the rules definitions.\n\n#### Props\n\n| Prop name | type | Required |\n| --- | --- | --- |\n| [`rules`](#phonecontext-rules) | `array` | `true` |\n\n##### PhoneContext rules\n\n`rules: Array<{ countryISO: string; countryCode: string; mask?: string }>`\n\nThe rules definitions used by the `<PhoneField />` component.\n\n```" } ]
code_phone-field_c7e1a082
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/react/rules.tsx from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nexport interface PhoneRuleDescriptor {\n /**\n * ISO3 Country code representation\n */\n countryISO: string\n /**\n * Country's international code number. E.g.: \"55\" for Brazil\n */\n countryCode: string\n /**\n * Mask to the phone. E.g.: \"(99) 9 9999-9999\"\n */\n mask?: string\n /**\n * Regex used for the phone validation\n */\n pattern: string\n}\n\n/**\n * Default rules for the phone field. Don't use this as this won't be updated\n * to include any more countries. Instead you should rely on a service that provides\n * this information dynamically (such as `vtex.country-data-settings`).\n *\n * @deprecated\n */\nconst defaultRules: PhoneRuleDescriptor[] = [\n {\n countryCode: '55',\n countryISO: 'BRA',\n mask: '(99) 9 9999-9999',\n pattern:\n '^(?:(?:(?:\\\\+|)(?:55|)|))(?:0|)(?:(?:(?:1[1-9]|2[12478]|3[1-8]|6[1-9]|7[134579]|8[1-9]|9[1-9]|4[1-9]|5[1-5])(?:9\\\\d{8}|\\\\d{8})))$',\n },\n {\n countryCode: '54',\n countryISO: 'ARG',\n mask: '9 999 999-9999',\n pattern:\n '^(?:(?:\\\\+|)54|)(?:0|)(?:(?:9(?:0|)(?:(?:11\\\\d{8})|(?:2(?:20|21|23|30|36|37|49|60|61|63|64|66|80|91|94|97|98|99)|3(?:36|41|42|43|45|45|48|51|53|58|62|64|70|76|79|80|81|83|85|87|88))\\\\d{7})|(?:2(?:2(?:02|21|23|24|25|26|27|29|41|42|43|44|45|46|52|54|55|57|61|62|64|65|66|67|68|71|72|73|74|81|83|84|85|86|91|92|96|97)|3(?:02|14|16|17|20|23|24|25|26|31|33|34|35|37|38|42|43|44|45|46|52|53|54|55|56|57|58|92|93|94|95|96)|4(?:73|74|75|77|78)|6(?:22|24|25|26|46|47|48|51|55|56|57|58)|9(?:01|02|03|20|21|22|23|24|25|26|27|28|29|31|32|33|34|35|36|40|42|45|46|48|52|53|54|62|63|64|66|72|82|83))|3(?:3(?:27|29|82|85|87|88)|4(?:00|01|02|04|05|06|07|08|09|35|36|37|38|42|44|45|46|47|54|55|56|58|60|62|63|64|65|66|67|68|69|71|72|76|82|83|87|89|91|92|93|96|97|98)|5(?:21|22|24|25|32|33|37|41|42|43|44|46|47|48|49|62|63|64|71|72|73|74|75|76|82|83|84|85)|7(?:11|15|16|18|21|25|31|34|35|41|43|51|54|55|56|57|58|72|73|74|75|77|81|82|86)|8(?:21|25|26|27|32|35|37|38|41|43|44|45|46|54|55|56|57|58|61|62|63|65|67|68|69|73|76|77|78|85|86|87|88|91|92|94))\\\\d{6}))|(?:(?:11(?:15\\\\d{8}|(?!15)\\\\d{8}))|(?:(?:2(?:20|21|23|30|36|37|49|60|61|63|64|66|80|91|94|97|98|99)|3(?:36|41|42|43|45|45|48|51|53|58|62|64|70|76|79|80|81|83|85|87|88))(?:15\\\\d{7}|(?!15)\\\\d{7}))|(?:2(?:2(?:02|21|23|24|25|26|27|29|41|42|43|44|45|46|52|54|55|57|61|62|64|65|66|67|68|71|72|73|74|81|83|84|85|86|91|92|96|97)|3(?:02|14|16|17|20|23|24|25|26|31|33|34|35|37|38|42|43|44|45|46|52|53|54|55|56|57|58|92|93|94|95|96)|4(?:73|74|75|77|78)|6(?:22|24|25|26|46|47|48|51|55|56|57|58)|9(?:01|02|03|20|21|22|23|24|25|26|27|28|29|31|32|33|34|35|36|40|42|45|46|48|52|53|54|62|63|64|66|72|82|83))|3(?:3(?:27|29|82|85|87|88)|4(?:00|01|02|04|05|06|07|08|09|35|36|37|38|42|44|45|46|47|54|55|56|58|60|62|63|64|65|66|67|68|69|71|72|76|82|83|87|89|91|92|93|96|97|98)|5(?:21|22|24|25|32|33|37|41|42|43|44|46|47|48|49|62|63|64|71|72|73|74|75|76|82|83|84|85)|7(?:11|15|16|18|21|25|31|34|35|41|43|51|54|55|56|57|58|72|73|74|75|77|81|82|86)|8(?:21|25|26|27|32|35|37|38|41|43|44|45|46|54|55|56|57|58|61|62|63|65|67|68|69|73|76|77|78|85|86|87|88|91|92|94)))(?:15\\\\d{6}|(?!15)\\\\d{6})))$',\n },\n {\n countryCode: '1',\n countryISO: 'USA',\n mask: '999-999-9999',\n pattern:\n '^(?:(?:(?:\\\\+|)(?:1|))|)(?:1|)(?:2(?:0[1-9]|1[02-9]|2[4-9]|3[1469]|4[089]|5[01-46]|6[0279]|7[0468]|8[139])|3(?:0[1-9]|1[02-9]|2[01235]|3[014679]|4[01367]|5[12]|6[01459]|8[056])|4(?:0[1-9]|1[02-9]|2[345]|3[0-24578]|4[023578]|5[08]|6[49]|7[0589]|8[04]|50[1-57-9])|5(?:0[1-9]|1[02-9]|20|3[014]|4[01]|5[179]|6[1-47]|7[013-59]|8[01567])|6(?:0[1-9]|1[0234-9]|2[036-8]|3[0169]|4[167]|5[0179]|6[01279]|7[0189]|8[1249])|7(?:0[1-9]|1[2-9]|2[047]|3[01247]|4[07]|5[247]|6[02-59]|7[02-589]|8[01567])|8(?:0[1-8]|1[0-9]|28|3[0-25]|4[3578]|5[06-9]|6[02-57]|7[0238])|9(?:0[1-9]|1[02-9]|2[0578]|3[15-9]|4[0179]|5[124679]|7[0-3589]|8[045]|89))\\\\d{7}$',\n },\n]\n\nexport default defaultRules\n\n```" } ]
code_phone-field_07190138
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/react/PhoneField.css from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.phoneField :global(.vtex-input__prefix) {\n padding-left: 0;\n}\n\n.phoneField :global(.vtex-input__prefix) {\n flex-shrink: 0;\n padding-right: 0;\n}\n\n.phoneField :global(.vtex-input) input {\n padding-right: .5rem;\n padding-left: .5rem;\n flex: 1;\n width: auto;\n min-width: 0;\n}\n\n.listboxButton {\n border-radius: 0;\n padding-top: 0;\n padding-bottom: 0;\n padding-right: .5rem;\n}\n\n```" } ]
code_phone-field_6dc71a16
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/react/package.json from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"phone-field\",\n \"version\": \"0.1.5\",\n \"private\": true,\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@reach/listbox\": \"^0.10.2\",\n \"@types/classnames\": \"^2.2.10\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.9.1\",\n \"@types/react\": \"^16.9.23\",\n \"@vtex/styleguide\": \"^9.112.20\",\n \"@vtex/test-tools\": \"^3.0.3\",\n \"vtex.checkout-components\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-components@0.4.0/public/@types/vtex.checkout-components\",\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.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.104.3/public/@types/vtex.render-runtime\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.120.1/public/@types/vtex.styleguide\"\n },\n \"dependencies\": {\n \"classnames\": \"^2.2.6\",\n \"msk\": \"^1.0.5\",\n \"react\": \"^16.13.0\",\n \"react-intl\": \"^3.12.1\"\n }\n}\n\n```" } ]
code_phone-field_0fec6362
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/react/PhoneContext.tsx from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { createContext, useContext, useMemo } from 'react'\n\nimport { PhoneRuleDescriptor } from './rules'\n\ninterface Context {\n rules: PhoneRuleDescriptor[]\n}\n\nconst PhoneContext = createContext<Context | undefined>(undefined)\n\nexport const usePhoneContext = () => {\n const contextValue = useContext(PhoneContext)\n\n if (contextValue === undefined) {\n throw new Error(\n 'usePhoneContext must be used inside a PhoneContextProvider'\n )\n }\n\n return contextValue\n}\n\nexport const PhoneContextProvider: React.FC<Context> = ({\n rules,\n children,\n}) => {\n const contextValue = useMemo(\n () => ({\n rules: rules.sort((ruleA, ruleB) =>\n ruleA.countryISO > ruleB.countryISO\n ? 1\n : ruleA.countryISO < ruleB.countryISO\n ? -1\n : 0\n ),\n }),\n [rules]\n )\n\n return (\n <PhoneContext.Provider value={contextValue}>\n {children}\n </PhoneContext.Provider>\n )\n}\n\nexport default { PhoneContextProvider, usePhoneContext }\n\n```" } ]
code_phone-field_da8caa93
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/react/PhoneField.tsx from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport classnames from 'classnames'\nimport msk from 'msk'\nimport React, { useMemo, useRef, useState, useEffect, useCallback } from 'react'\nimport { Input } from 'vtex.styleguide'\nimport { Listbox } from 'vtex.checkout-components'\nimport { CountryFlag } from 'vtex.country-flags'\n\nimport { usePhoneContext } from './PhoneContext'\nimport styles from './PhoneField.css'\nimport { PhoneRuleDescriptor } from './rules'\n\nconst {\n ListboxInput,\n ListboxButton,\n ListboxPopover,\n ListboxList,\n ListboxOption,\n} = Listbox\n\ninterface PhoneData {\n value: string\n isValid: boolean\n}\n\ninterface Props\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'onChange' | 'value' | 'size'\n > {\n onChange?: (data: PhoneData) => void\n value?: string\n defaultCountry?: string\n // Input's props\n label?: string | React.ReactElement\n error?: boolean\n errorMessage?: string\n helpText?: React.ReactNode\n suffix?: React.ReactNode\n size?: 'small' | 'regular' | 'large'\n isLoadingButton?: boolean\n}\n\nconst renderCountryFlagWithCode = ({\n country,\n code,\n}: {\n country: string\n code?: string\n}) => (\n <>\n <CountryFlag iso3={country} />\n {code && <span className=\"dib ml3\">+{code}</span>}\n </>\n)\n\nconst ArrowDownIcon: React.FC<{ size?: number; color?: string }> = ({\n size = 16,\n color = 'currentColor',\n}) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n >\n <g fill={color}>\n <path d=\"M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z\" />\n </g>\n </svg>\n)\n\nconst unmaskPhone = (phone: string) => phone.replace(/\\D/g, '')\n\nconst PhoneField = React.forwardRef<HTMLInputElement, Props>(\n function PhoneField(\n { onChange = () => {}, value = '', defaultCountry = 'BRA', ...props },\n ref\n ) {\n const { rules } = usePhoneContext()\n const inputRef = useRef<HTMLInputElement>(null)\n\n const [inputHovered, setInputHovered] = useState(false)\n const [inputFocused, setInputFocused] = useState(false)\n const [hovered, setHovered] = useState(false)\n\n const phoneData = useMemo(() => {\n let phoneValue = value\n let selectedCountry = !value ? defaultCountry : ''\n\n if (value.startsWith('+')) {\n phoneValue = value.substr(1)\n const unmaskedPhone = unmaskPhone(phoneValue)\n\n const phoneRule = rules.find(({ countryCode }) => {\n return unmaskedPhone.startsWith(countryCode)\n })\n\n if (phoneRule) {\n selectedCountry = phoneRule.countryISO\n phoneValue = phoneValue.substr(phoneRule.countryCode.length)\n }\n } else {\n phoneValue = unmaskPhone(value)\n }\n\n return { phoneValue, selectedCountry }\n }, [defaultCountry, rules, value])\n\n const countryRule = useMemo(\n () =>\n rules.find(\n ({ countryISO }) => countryISO === phoneData.selectedCountry\n ),\n [rules, phoneData.selectedCountry]\n )\n\n const onChangeRef = useRef(onChange)\n\n useEffect(() => {\n onChangeRef.current = onChange\n }, [onChange])\n\n const updatePhone = useCallback(\n (phone: string, rule: PhoneRuleDescriptor) => {\n const unmaskedValue = `+${rule.countryCode}${unmaskPhone(phone)}`\n\n onChangeRef.current({\n value: `+${rule.countryCode}${phone}`,\n isValid: !!unmaskedValue.match(rule.pattern),\n })\n },\n []\n )\n\n useEffect(() => {\n if (inputFocused || !countryRule || !countryRule.mask) {\n return\n }\n\n const phone = msk(unmaskPhone(phoneData.phoneValue), countryRule.mask)\n\n updatePhone(phone, countryRule)\n }, [phoneData.phoneValue, countryRule, inputFocused, updatePhone])\n\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = ({\n target: { value: eventValue },\n }) => {\n if (!countryRule) {\n return\n }\n\n updatePhone(eventValue, countryRule)\n }\n\n const handleCountryUpdate = (country: string) => {\n const newRule = rules.find(({ countryISO }) => countryISO === country)!\n\n updatePhone(phoneData.phoneValue, newRule)\n\n // schedule focus for the next tick since the listbox\n // is already focused by default after this event handler,\n // and we need to override that\n setTimeout(() => void inputRef.current?.focus(), 0)\n }\n\n const handleInputMouseEnter: React.MouseEventHandler<HTMLInputElement> = evt => {\n setInputHovered(true)\n props.onMouseEnter?.(evt)\n }\n\n const handleInputMouseLeave: React.MouseEventHandler<HTMLInputElement> = evt => {\n setInputHovered(false)\n props.onMouseLeave?.(evt)\n }\n\n const handleInputFocus: React.FocusEventHandler<HTMLInputElement> = evt => {\n setInputFocused(true)\n props.onFocus?.(evt)\n }\n\n const handleInputBlur: React.FocusEventHandler<HTMLInputElement> = evt => {\n setInputFocused(false)\n props.onBlur?.(evt)\n }\n\n const handleMouseEnter = () => {\n setHovered(true)\n }\n\n const handleMouseLeave = () => {\n setHovered(false)\n }\n\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const hasError = !!(props.error || props.errorMessage)\n\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const inputDisabled = props.disabled || !countryRule\n\n return (\n <div className={styles.phoneField}>\n <Input\n {...props}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n onMouseEnter={handleInputMouseEnter}\n onMouseLeave={handleInputMouseLeave}\n disabled={inputDisabled}\n inputMode=\"numeric\"\n value={phoneData.phoneValue}\n onChange={handleChange}\n ref={(node: HTMLInputElement) => {\n if (ref) {\n if (typeof ref === 'function') {\n ref(node)\n } else {\n // @ts-ignore: React TS types says this is read-only, but\n // it its possible to mutate this value\n ref.current = node\n }\n }\n // @ts-ignore: same as above\n inputRef.current = node\n }}\n prefix={\n <ListboxInput\n className=\"h-100 flex-auto\"\n value={phoneData.selectedCountry}\n onChange={handleCountryUpdate}\n disabled={inputDisabled}\n >\n <ListboxButton\n className={classnames(styles.listboxButton, 'br bw1 br-2', {\n 'b--danger': hasError,\n 'b--muted-4':\n !(hovered || inputHovered || inputFocused) && !hasError,\n 'b--muted-3':\n (hovered || inputHovered) && !inputFocused && !hasError,\n 'b--muted-2': inputFocused && !hasError,\n })}\n variation=\"plain\"\n arrow={\n <div className=\"c-action-primary flex items-center ml2\">\n <ArrowDownIcon />\n </div>\n }\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {({ label }) =>\n renderCountryFlagWithCode({\n country: phoneData.selectedCountry,\n code: label,\n })\n }\n </ListboxButton>\n <ListboxPopover\n className=\"nl1\"\n style={{ minWidth: 192, maxHeight: 200 }}\n >\n <ListboxList>\n {rules.map(({ countryCode, countryISO }) => {\n return (\n <ListboxOption\n value={countryISO}\n label={countryCode}\n key={countryISO}\n >\n {renderCountryFlagWithCode({\n country: countryISO,\n code: countryCode,\n })}\n </ListboxOption>\n )\n })}\n </ListboxList>\n </ListboxPopover>\n </ListboxInput>\n }\n />\n </div>\n )\n }\n)\n\nexport default PhoneField\n\n```" } ]
code_phone-field_179b510c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/react/typings/assets.d.ts from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.svg' {\n const url: string\n\n export default url\n}\n\ndeclare module '*.css' {\n const styles: { [name: string]: string }\n export default styles\n}\n\n```" } ]
code_phone-field_62490b71
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/react/typings/vtex.styleguide.d.ts from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* eslint-disable import/order */\n\nimport * as Styleguide from 'vtex.styleguide'\n\ndeclare module 'vtex.styleguide' {\n import React from 'react'\n\n export const Input: React.FC\n\n export const IconCaretDown: React.FC\n}\n\n```" } ]
code_phone-field_8d48b3f3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of phone-field/react/__tests__/PhoneField.test.tsx from the phone-field VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport { render, fireEvent, act } from '@vtex/test-tools/react'\nimport React, { useState, useEffect, useRef } from 'react'\n\nimport PhoneField from '../PhoneField'\nimport defaultRules, { PhoneRuleDescriptor } from '../rules'\nimport { PhoneContextProvider } from '../PhoneContext'\n\n/**\n * Listbox opens on mousedown, not click event\n */\nfunction fireMouseClick(element: HTMLElement) {\n fireEvent.mouseDown(element)\n fireEvent.mouseUp(element)\n}\n\ndescribe('<PhoneField />', () => {\n beforeEach(() => {\n jest.useFakeTimers()\n })\n\n afterEach(() => {\n jest.clearAllTimers()\n })\n\n it('should correctly mask a phone number given a rule', () => {\n const rules: PhoneRuleDescriptor[] = [\n {\n countryISO: 'ABC',\n countryCode: '123',\n mask: '999 999 9-9',\n pattern: '\\\\d{8}',\n },\n ]\n\n const Component: React.FC = () => {\n const [phone, setPhone] = useState('')\n\n const handlePhoneChange = ({ value }: { value: string }) => {\n setPhone(value)\n }\n\n return (\n <PhoneContextProvider rules={rules}>\n <PhoneField\n label=\"Phone number\"\n value={phone}\n defaultCountry=\"ABC\"\n onChange={handlePhoneChange}\n />\n </PhoneContextProvider>\n )\n }\n\n const { getByRole } = render(<Component />)\n\n const phoneInput = getByRole('textbox')\n const listboxButton = getByRole('button')\n\n fireEvent.focus(phoneInput)\n\n fireEvent.change(phoneInput, { target: { value: '4567' } })\n\n expect(listboxButton).toHaveTextContent('+123')\n\n expect(phoneInput).toHaveValue('4567')\n\n fireEvent.change(phoneInput, { target: { value: '45678901' } })\n\n expect(phoneInput).toHaveValue('45678901')\n\n fireEvent.change(phoneInput, { target: { value: '456789012' } })\n\n fireEvent.blur(phoneInput)\n\n expect(phoneInput).toHaveValue('456 789 0-12')\n })\n\n it('should show error message for invalid phones', () => {\n const Component: React.FC = () => {\n const [phone, setPhone] = useState('')\n const [valid, setValid] = useState(false)\n\n const handlePhoneChange = ({\n value,\n isValid,\n }: {\n value: string\n isValid: boolean\n }) => {\n setPhone(value)\n setValid(isValid)\n }\n\n return (\n <PhoneContextProvider rules={defaultRules}>\n <PhoneField\n label=\"Phone number\"\n value={phone}\n defaultCountry=\"BRA\"\n onChange={handlePhoneChange}\n />\n {!valid && <span>Phone is invalid</span>}\n </PhoneContextProvider>\n )\n }\n\n const { getByRole, queryByText } = render(<Component />)\n\n const phoneInput = getByRole('textbox')\n\n expect(queryByText(/phone is invalid/i)).toBeInTheDocument()\n\n fireEvent.change(phoneInput, { target: { value: '21988884444' } })\n\n expect(queryByText(/phone is invalid/i)).not.toBeInTheDocument()\n\n fireEvent.change(phoneInput, { target: { value: '219888844443' } })\n\n expect(queryByText(/phone is invalid/i)).toBeInTheDocument()\n })\n\n it('should focus the input button on flag change', () => {\n const Component: React.FC = () => {\n const [phone, setPhone] = useState('+5511999998888')\n\n return (\n <PhoneContextProvider rules={defaultRules}>\n <PhoneField\n label=\"Phone number\"\n value={phone}\n onChange={({ value }) => setPhone(value)}\n />\n </PhoneContextProvider>\n )\n }\n\n const { getByRole, getByLabelText } = render(<Component />)\n\n const phoneInput = getByLabelText(/phone number/i)\n\n expect(document.activeElement).not.toBe(phoneInput)\n\n const listboxButton = getByRole('button')\n\n act(() => void fireMouseClick(listboxButton))\n\n const usaOption = getByRole('option', { name: '+ 1' })\n\n act(() => {\n fireMouseClick(usaOption)\n jest.runAllTimers()\n })\n\n expect(document.activeElement).toBe(phoneInput)\n })\n\n it('should use pattern for phone validation', () => {\n const rules: PhoneRuleDescriptor[] = [\n { countryISO: 'ABC', countryCode: '1', pattern: '\\\\d{9}' },\n ]\n\n const Component: React.FC = () => {\n const [phone, setPhone] = useState('+1')\n const [valid, setValid] = useState(false)\n\n const handlePhoneChange = ({\n value,\n isValid,\n }: {\n value: string\n isValid: boolean\n }) => {\n setPhone(value)\n setValid(isValid)\n }\n\n return (\n <PhoneContextProvider rules={rules}>\n <PhoneField\n label=\"Phone number\"\n value={phone}\n onChange={handlePhoneChange}\n />\n {!valid && <span>Phone is invalid</span>}\n </PhoneContextProvider>\n )\n }\n\n const { getByRole, queryByText } = render(<Component />)\n\n const phoneField = getByRole('textbox')\n\n fireEvent.focus(phoneField)\n\n fireEvent.change(phoneField, { target: { value: '123 456' } })\n\n expect(queryByText(/phone is invalid/i)).toBeInTheDocument()\n\n fireEvent.change(phoneField, { target: { value: '123 456 789' } })\n\n expect(queryByText(/phone is invalid/i)).not.toBeInTheDocument()\n\n fireEvent.blur(phoneField)\n\n expect(phoneField).toHaveValue('123 456 789')\n })\n\n it('should be able to accept refs in phone field', () => {\n let ref = null\n\n const Component: React.FC = () => {\n const inputRef = useRef<HTMLInputElement>(null)\n\n useEffect(() => {\n ref = inputRef.current\n })\n\n return (\n <PhoneContextProvider rules={defaultRules}>\n <PhoneField\n label=\"Phone number\"\n value=\"+5511999998888\"\n ref={inputRef}\n />\n </PhoneContextProvider>\n )\n }\n\n const { getByLabelText } = render(<Component />)\n\n expect(ref).toBe(getByLabelText(/phone number/i))\n })\n\n it(\"should show phone number when rule don't have a mask\", () => {\n const rules = [\n {\n countryISO: 'ABC',\n countryCode: '1',\n pattern: '.*',\n },\n ]\n\n const Component: React.FC = () => {\n return (\n <PhoneContextProvider rules={rules}>\n <PhoneField label=\"Phone number\" value=\"+1123456\" />\n </PhoneContextProvider>\n )\n }\n\n const { getByLabelText } = render(<Component />)\n\n const phoneInput = getByLabelText(/phone number/i)\n\n expect(phoneInput).toHaveValue('123456')\n })\n\n describe('default rules', () => {\n it('should correctly apply the USA mask with country change', () => {\n const Component: React.FC = () => {\n const [phone, setPhone] = useState('+5511999998888')\n const [valid, setValid] = useState(true)\n\n return (\n <PhoneContextProvider rules={defaultRules}>\n <PhoneField\n label=\"Phone number\"\n value={phone}\n onChange={({ value, isValid }) => {\n setPhone(value)\n setValid(isValid)\n }}\n />\n {!valid && <span>Phone is invalid</span>}\n </PhoneContextProvider>\n )\n }\n\n const { getByRole, getByLabelText, getByText } = render(<Component />)\n\n const listboxButton = getByRole('button')\n\n act(() => void fireMouseClick(listboxButton))\n\n const usaOption = getByRole('option', { name: '+ 1' })\n\n act(() => void fireMouseClick(usaOption))\n\n const phoneInput = getByLabelText(/phone number/i)\n\n expect(phoneInput).toHaveValue('119-999-98888')\n\n const errorMessage = getByText(/phone is invalid/i)\n\n expect(errorMessage).toBeInTheDocument()\n })\n })\n})\n\n```" } ]