id
stringlengths
12
53
messages
listlengths
3
3
code_glovo-integration_5dfcf683
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/node/middlewares/routes/index.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { method } from '@vtex/api'\n\nimport { authorizeOrder } from './authorizeOrder'\nimport { createOrder } from './createOrder'\nimport { errorHandler } from './errorHandler'\nimport { getGlovoMenu } from './getGlovoMenu'\nimport { getGlovoMenuByStore } from './getGlovoMenuByStore'\nimport { glovoMenuCompleteUpdate } from './glovoMenuCompleteUpdate'\nimport { glovoMenuPartialUpdate } from './glovoMenuPartialUpdate'\nimport { glovoProductUpdate } from './glovoProductUpdate'\nimport { orderChange } from './orderChange'\nimport { saveGlovoMenu } from './saveGlovoMenu'\nimport { saveOrderRecord } from './saveOrderRecord'\nimport { sendResponse } from './sendReponse'\nimport { simulateOrder } from './simulateOrder'\nimport { storeMenuUpdates } from './storeMenuUpdate'\nimport { validateGlovoToken } from './validateGlovoToken'\nimport { validateSettings } from './validateSettings'\n\nexport const routes = {\n createOrder: method({\n POST: [\n errorHandler,\n validateSettings,\n validateGlovoToken,\n simulateOrder,\n createOrder,\n authorizeOrder,\n saveOrderRecord,\n ],\n }),\n updateProduct: method({\n POST: [glovoProductUpdate, sendResponse],\n }),\n updateCompleteMenu: method({\n POST: [glovoMenuCompleteUpdate, sendResponse],\n }),\n updatePartialMenu: method({\n POST: [glovoMenuPartialUpdate, sendResponse],\n }),\n glovoMenu: method({\n GET: [errorHandler, getGlovoMenu],\n POST: [errorHandler, saveGlovoMenu],\n }),\n getGlovoMenuByStore: method({\n GET: [errorHandler, validateSettings, getGlovoMenuByStore],\n }),\n storeMenuUpdates: method({\n GET: [errorHandler, validateSettings, storeMenuUpdates],\n }),\n orderChange: method({\n POST: [errorHandler, orderChange],\n }),\n}\n\n```" } ]
code_glovo-integration_9fa043e1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/node/middlewares/routes/validateGlovoToken.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { AuthenticationError } from '@vtex/api'\n\nexport async function validateGlovoToken(\n ctx: Context,\n next: () => Promise<void>\n) {\n const {\n req: { headers },\n state: { glovoToken },\n } = ctx\n\n const reqAuth = headers.authorization\n\n if (!reqAuth || reqAuth !== glovoToken) {\n throw new AuthenticationError('Missing or invalid token')\n }\n\n await next()\n}\n\n```" } ]
code_glovo-integration_cc81304c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/node/middlewares/routes/validateSettings.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { UserInputError } from '@vtex/api'\nimport type { GlovoIntegrationSettings } from 'vtex.glovo-integration'\n\nimport { APP_SETTINGS, GLOVO } from '../../constants'\n\nexport async function validateSettings(\n ctx: Context,\n next: () => Promise<void>\n) {\n const {\n clients: { vbase },\n } = ctx\n\n const appSettings: GlovoIntegrationSettings = await vbase.getJSON(\n GLOVO,\n APP_SETTINGS,\n true\n )\n\n if (!appSettings.glovoToken) {\n throw new UserInputError('Missing Glovo token. Please check app settings')\n }\n\n ctx.state.glovoToken = appSettings.glovoToken\n ctx.state.marketplace = appSettings.marketplace\n ctx.state.stores = appSettings.stores\n ctx.state.clientProfileData = appSettings.clientProfileData\n\n await next()\n}\n\n```" } ]
code_glovo-integration_44060100
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/node/middlewares/routes/simulateOrder.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { json } from 'co-body'\nimport type { Store } from 'vtex.glovo-integration'\n\nimport {\n convertGlovoProductToItems,\n createSimulationPayload,\n getStoreInfoFormGlovoStoreId,\n ServiceError,\n} from '../../utils'\n\nexport async function simulateOrder(ctx: Context, next: () => Promise<void>) {\n const {\n state: { stores },\n vtex: { logger },\n clients: { checkout },\n } = ctx\n\n const glovoOrder: GlovoOrder = await json(ctx.req)\n\n try {\n ctx.state.glovoOrder = glovoOrder\n\n logger.info({\n message: `Received order ${glovoOrder.order_id} from store ${glovoOrder.store_id} from Glovo`,\n glovoOrder,\n })\n\n const storeInfo = getStoreInfoFormGlovoStoreId(\n glovoOrder.store_id,\n stores\n ) as Store\n\n if (!storeInfo) {\n throw new Error(\n `Order not handled. Missing or invalid store with Glovo Store Id ${glovoOrder.store_id}`\n )\n }\n\n const { sellerId, salesChannel, affiliateId, postalCode, country } =\n storeInfo\n\n const simulationItems = convertGlovoProductToItems(\n sellerId,\n glovoOrder.products\n )\n\n const simulationPayload = createSimulationPayload({\n items: simulationItems,\n affiliateId,\n salesChannel,\n postalCode,\n country,\n })\n\n logger.info({\n message: `Simulation payload for order ${glovoOrder.order_id}`,\n simulationPayload,\n })\n\n const simulation = await checkout.simulation(...simulationPayload)\n\n if (!simulation.items.length) {\n throw new Error(\n `No items were returned from simulation for Glovo Order ${glovoOrder.order_id}`\n )\n }\n\n logger.info({\n message: `Simulation for order ${glovoOrder.order_id}`,\n simulation,\n })\n\n ctx.state.orderSimulation = simulation\n ctx.state.storeInfo = storeInfo\n\n await next()\n } catch (error) {\n throw new ServiceError({\n message: error.message ?? 'Order simulation error',\n reason:\n error.reason ??\n `Simulation failed for Glovo Order ${glovoOrder.order_id}`,\n metric: 'orders',\n data: error.data ?? glovoOrder,\n error: error.error ?? error.response?.data,\n })\n }\n}\n\n```" } ]
code_glovo-integration_ba72b2ba
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/node/middlewares/routes/sendReponse.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport async function sendResponse(ctx: Context) {\n return (ctx.status = 204)\n}\n\n```" } ]
code_glovo-integration_9abb7979
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/node/middlewares/routes/orderChange.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { json } from 'co-body'\n\nimport { ServiceError } from '../../utils'\n\nexport async function orderChange(ctx: Context) {\n const {\n vtex: {\n route: { params },\n },\n } = ctx\n\n try {\n const { orderId } = params\n const body: OrderChangeBody = await json(ctx.req)\n\n ctx.body = {\n orderId,\n receipt: body.requestId,\n }\n } catch (error) {\n throw new ServiceError({\n message: error.message,\n reason:\n error.reason ?? `There was a problem changing order ${params?.orderId}`,\n metric: 'orders',\n data: ctx.body,\n error: error.response?.data,\n })\n }\n}\n\n```" } ]
code_glovo-integration_b24666bc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/constants/index.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const GLOVO_TOKEN = 'glovoToken'\nexport const PRODUCTION = 'production'\nexport const MARKETPLACE = 'marketplace'\nexport const MINIMUM_STOCK = 'minimumStock'\n\nexport const STORE_NAME = 'storeName'\nexport const SELLER_ID = 'sellerId'\nexport const AFFILIATE_ID = 'affiliateId'\nexport const SALES_CHANNEL = 'salesChannel'\nexport const POSTAL_CODE = 'postalCode'\nexport const COUNTRY = 'country'\nexport const GLOVO_STORE_ID = 'glovoStoreId'\n\nexport const EMAIL = 'email'\nexport const FIRST_NAME = 'firstName'\nexport const LAST_NAME = 'lastName'\nexport const CORPORATE_NAME = 'corporateName'\nexport const DOCUMENT_TYPE = 'documentType'\nexport const DOCUMENT = 'document'\nexport const PHONE_NUMBER = 'phone'\n\nexport const TYPE_NEW = 'new'\nexport const TYPE_EDIT = 'edit'\nexport const DANGER = 'danger'\nexport const SUCCESS = 'success'\nexport const ERROR = 'error'\n\n```" } ]
code_glovo-integration_8e9aa4cc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/typings/settingsSections.d.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { Dispatch, SetStateAction } from 'react'\n\nexport interface SettingsSection {\n settings: AppSettings\n setSettings: Dispatch<SetStateAction<AppSettings>>\n saveSettings: (settings: AppSettings) => Promise<boolean>\n}\n\n```" } ]
code_glovo-integration_e2250d87
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/typings/files.d.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.svg'\ndeclare module '*.png'\ndeclare module '*.jpg'\ndeclare module '*.jpeg'\ndeclare module '*.gif'\ndeclare module '*.bmp'\ndeclare module '*.tiff'\ndeclare module '*.gql'\ndeclare module '*.css'\ndeclare module '*.graphql'\n\n```" } ]
code_glovo-integration_8fb0b1dc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/typings/global.d.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module 'uuid'\ndeclare module 'react-apollo'\ndeclare module 'vtex.styleguide'\ndeclare module 'vtex.native-types'\n\ninterface AppSettings {\n glovoToken: string\n production: boolean\n marketplace: boolean\n stores: StoreInfo[]\n clientProfileData: ClientProfileData\n minimumStock: number\n}\ninterface StoreInfo {\n id: string\n storeName: string\n sellerId: string\n sellerName: string\n affiliateId: string\n salesChannel: string\n postalCode: string\n country: string\n glovoStoreId: string\n}\n\ninterface ClientProfileData {\n email: string\n firstName: string\n lastName: string\n documentType: string\n document: string\n phone: string\n corporateName: string\n}\n\ninterface Seller {\n id: string\n name: string\n isActive: boolean\n}\n\ninterface TableItem {\n cellData: unknown\n rowData: StoreInfo\n updateCellMeasurements: () => void\n}\n\ntype AlertType = 'success' | 'warning' | 'error'\n\ninterface SelectOption {\n label: string\n value: string\n}\n\ninterface UpdateStore {\n storeId: string\n store: StoreInfo | null\n isOpen: boolean\n loading: boolean\n}\n\ntype ModifyStore = Pick<UpdateStore, 'isOpen' | 'loading'>\ntype RemoveStore = Omit<UpdateStore, 'store'>\ntype AddOrEditStore = Omit<UpdateStore, 'storeId'>\n\n```" } ]
code_glovo-integration_117423a7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/typings/vtex.styleguide.d.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type PropTypes from 'prop-types'\nimport type React from 'react'\nimport 'vtex.styleguide'\n\ndeclare const propTypes: any\ndeclare const Progress: React.FC<PropTypes.InferProps<typeof propTypes>>\n\ndeclare module 'vtex.styleguide' {\n export const Button: React.FC<PropTypes.InferProps<any>>\n export const Card: React.FC<PropTypes.InferProps<any>>\n export const Checkbox: React.FC<PropTypes.InferProps<any>>\n export const Input: React.FC<PropTypes.InferProps<any>>\n export const Tag: React.FC<PropTypes.InferProps<any>>\n export const Alert: React.FC<PropTypes.InferProps<any>>\n export const Layout: React.FC<PropTypes.InferProps<any>>\n export const PageHeader: React.FC<PropTypes.InferProps<any>>\n export const Dropdown: React.FC<PropTypes.InferProps<any>>\n export const ButtonWithIcon: React.FC<PropTypes.InferProps<any>>\n export const InputSearch: React.FC<PropTypes.InferProps<any>>\n export const Table: React.FC<PropTypes.InferProps<any>>\n export const Toggle: React.FC<PropTypes.InferProps<any>>\n export const PageBlock: React.FC<PropTypes.InferProps<any>>\n export const Tabs: React.FC<PropTypes.InferProps<any>>\n export const Tab: React.FC<PropTypes.InferProps<any>>\n export const Collapsible: React.FC<PropTypes.InferProps<any>>\n export const Textarea: React.FC<PropTypes.InferProps<any>>\n export const Spinner: React.FC<PropTypes.InferProps<any>>\n export const ModalDialog: React.FC<PropTypes.InferProps<any>>\n export const Modal: React.FC<PropTypes.InferProps<any>>\n /* eslint-disable @typescript-eslint/naming-convention */\n export const EXPERIMENTAL_Select: React.FC<PropTypes.InferProps<any>>\n}\n\n```" } ]
code_glovo-integration_3094dab3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/utils/countries.ts from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n// This is a list of the countries where Glovo operates currently\n\nexport type CountriesRecord = Record<string, string>\n\nexport const countriesMap: CountriesRecord = {\n ESP: 'Spain',\n PRT: 'Portugal',\n ITA: 'Italy',\n POL: 'Poland',\n HRV: 'Croatia',\n SRB: 'Serbia',\n KAZ: 'Kazakhstan',\n ROU: 'Romania',\n MAR: 'Morocco',\n GEO: 'Georgia',\n KEN: 'Kenya',\n CIV: 'Ivory Coast',\n UKR: 'Ukraine',\n MDA: 'Moldova',\n UGA: 'Uganda',\n KGZ: 'Kyrgyzstan',\n BIH: 'Bosnia & Herzegovina',\n GHA: 'Ghana',\n MNE: 'Montenegro',\n BGR: 'Bulgaria',\n}\n\nexport const countriesOptions: CountriesRecord[] = Object.keys(\n countriesMap\n).map((country) => ({\n value: country,\n label: countriesMap[country],\n}))\n\n```" } ]
code_glovo-integration_827d30cd
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/graphql/getAppSettings.gql from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery getGlovoIntegrationSettings {\n settings: getGlovoIntegrationSettings {\n glovoToken\n production\n marketplace\n minimumStock\n stores {\n id\n storeName\n sellerId\n sellerName\n affiliateId\n salesChannel\n postalCode\n country\n glovoStoreId\n }\n clientProfileData {\n email\n firstName\n lastName\n documentType\n document\n phone\n corporateName\n }\n }\n}\n\n```" } ]
code_glovo-integration_7a7a48e8
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/graphql/saveAppSettings.gql from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation SaveGlovoIntegrationSettings($settings: SaveGlovoIntegrationSettings) {\n settingsUpdated: saveGlovoIntegrationSettings(settings: $settings)\n}\n\n```" } ]
code_glovo-integration_afa24bfc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/graphql/getSellers.gql from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery getSellers {\n sellers @context(provider: \"vtex.sellers-graphql\") {\n items {\n id\n name\n isActive\n }\n }\n}\n\n```" } ]
code_glovo-integration_812399ba
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/icons/IconGlovo.tsx from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\n\nimport logo from './GlovoLogo.png'\n\ninterface Props {\n size?: number\n}\n\nconst IconGlovo: FC<Props> = ({ size = 80 }) => {\n return <img src={logo} style={{ width: `${size}px` }} alt=\"Glovo logo\" />\n}\n\nexport { IconGlovo }\n\n```" } ]
code_glovo-integration_5c581793
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/components/admin/Stores.tsx from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState, Fragment } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { ButtonWithIcon, ModalDialog, IconPlusLines } from 'vtex.styleguide'\n\nimport { StoreModal } from './StoreModal'\nimport type { AlertProps } from './AlertBanner'\nimport { AlertBanner } from './AlertBanner'\nimport type { SettingsSection } from '../../typings/settingsSections'\nimport { StoreTable } from './StoresTable'\n\nconst Stores = ({ settings, saveSettings }: SettingsSection) => {\n const [addOrEditStore, setAddOrEditStore] = useState<AddOrEditStore>({\n isOpen: false,\n loading: false,\n store: null,\n })\n\n const [removeStore, setRemoveStore] = useState<RemoveStore>({\n isOpen: false,\n loading: false,\n storeId: '',\n })\n\n const [alert, setAlert] = useState<AlertProps>({\n show: false,\n type: 'success',\n })\n\n const handleOpenStoreModal = () => {\n setAddOrEditStore({\n ...addOrEditStore,\n isOpen: true,\n store: null,\n })\n }\n\n const handleCloseRemoveStoreDialog = () => {\n setRemoveStore({\n isOpen: false,\n loading: false,\n storeId: '',\n })\n }\n\n const updateSettings = async (stores: StoreInfo[]) => {\n const successfulUpdate = await saveSettings({\n ...settings,\n stores,\n })\n\n if (!successfulUpdate) {\n setAlert({\n show: true,\n type: 'error',\n })\n\n return\n }\n\n setAlert({\n show: true,\n type: 'success',\n })\n }\n\n const handleAddStore = async (store: StoreInfo) => {\n const updatedStores = [...settings.stores, store]\n\n updateSettings(updatedStores)\n\n setAddOrEditStore({\n ...addOrEditStore,\n isOpen: false,\n })\n }\n\n const handleEditStore = async (editedStore: StoreInfo) => {\n const updatedStores = settings.stores.map((store: StoreInfo) => {\n if (store.id === editedStore.id) {\n return editedStore\n }\n\n return store\n })\n\n updateSettings(updatedStores)\n\n setAddOrEditStore({\n isOpen: false,\n loading: false,\n store: null,\n })\n }\n\n const handleRemoveStore = async () => {\n setRemoveStore({\n ...removeStore,\n loading: true,\n })\n\n const updatedStores = settings.stores.filter(\n (store: StoreInfo) => store.id !== removeStore.storeId\n )\n\n if (updatedStores.length === settings.stores.length) {\n setAlert({\n show: true,\n type: 'error',\n })\n }\n\n updateSettings(updatedStores)\n\n setRemoveStore({\n isOpen: false,\n loading: false,\n storeId: '',\n })\n }\n\n return (\n <Fragment>\n <StoreModal\n isOpen={addOrEditStore.isOpen}\n setIsOpen={setAddOrEditStore}\n saving={addOrEditStore.loading}\n store={addOrEditStore.store}\n addStore={handleAddStore}\n editStore={handleEditStore}\n />\n\n <ModalDialog\n centered\n loading={removeStore.loading}\n isOpen={removeStore.isOpen}\n onClose={handleCloseRemoveStoreDialog}\n confirmation={{\n onClick: handleRemoveStore,\n label: (\n <FormattedMessage id=\"admin/glovo-integration.delete-store-dialog.confirmation\" />\n ),\n isDangerous: true,\n }}\n cancelation={{\n onClick: handleCloseRemoveStoreDialog,\n label: (\n <FormattedMessage id=\"admin/glovo-integration.delete-store-dialog.cancel\" />\n ),\n }}\n >\n <div>\n <p className=\"f3 f3-ns fw3 gray\">\n <FormattedMessage id=\"admin/glovo-integration.delete-store-dialog.title\" />\n </p>\n <p>\n <FormattedMessage id=\"admin/glovo-integration.delete-store-dialog.subtitle\" />\n </p>\n </div>\n </ModalDialog>\n\n <AlertBanner show={alert.show} type={alert.type} onClose={setAlert} />\n\n <div>\n <div className=\"flex justify-between items-center\">\n <div>\n <h2>\n <FormattedMessage id=\"admin/glovo-integration.table.title\" />\n </h2>\n <p className=\"i mt0 mb7 gray\">\n <FormattedMessage id=\"admin/glovo-integration.table.subtitle\" />\n </p>\n </div>\n <ButtonWithIcon\n icon={<IconPlusLines />}\n onClick={handleOpenStoreModal}\n >\n <FormattedMessage id=\"admin/glovo-integration.add-more\" />\n </ButtonWithIcon>\n </div>\n\n <StoreTable\n stores={settings.stores}\n addOrEditStore={addOrEditStore}\n setAddOrEditStore={setAddOrEditStore}\n removeStore={removeStore}\n setRemoveStore={setRemoveStore}\n />\n </div>\n </Fragment>\n )\n}\n\nexport { Stores }\n\n```" } ]
code_glovo-integration_e400c371
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/components/admin/StoresTable.tsx from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { ChangeEvent, Dispatch, SetStateAction } from 'react'\nimport React, { useEffect, useState } from 'react'\nimport { Checkbox, Table } from 'vtex.styleguide'\nimport { FormattedMessage, useIntl } from 'react-intl'\n\nimport type { AddOrEditStore, RemoveStore } from './Stores'\nimport { countriesMap } from '../../utils'\n\ninterface Props {\n stores: StoreInfo[]\n addOrEditStore: AddOrEditStore\n setAddOrEditStore: Dispatch<SetStateAction<AddOrEditStore>>\n removeStore: RemoveStore\n setRemoveStore: Dispatch<SetStateAction<RemoveStore>>\n}\n\ntype BooleanRecords = Record<string, boolean>\n\ntype FilterSelectorEvent = {\n error: any\n onChange: any\n value: any\n}\n\ntype Statement = {\n subject: string\n verb: string\n object: any\n}\n\nconst StoreTable = ({\n stores,\n addOrEditStore,\n setAddOrEditStore,\n removeStore,\n setRemoveStore,\n}: Props) => {\n // Pagination state\n const [storesToDisplay, setStoresToDisplay] = useState<StoreInfo[]>([])\n const [tableLength, setTableLength] = useState(10)\n const [currentItemFrom, setCurrentItemFrom] = useState(1)\n const [currentItemTo, setCurrentItemTo] = useState(10)\n const [totalItems, setTotalItems] = useState(0)\n\n // Filters state\n const [filteredStores, setFilteredStores] = useState<StoreInfo[]>([])\n const [filterStatements, setFilterStatements] = useState<Statement[]>([])\n const [affiliatesFilters, setAffiliatesFilters] = useState<BooleanRecords>({})\n const [countriesFilters, setCountriesFilters] = useState<BooleanRecords>({})\n\n const schema = {\n properties: {\n storeName: {\n title: <FormattedMessage id=\"admin/glovo-integration.store-name\" />,\n },\n sellerName: {\n title: <FormattedMessage id=\"admin/glovo-integration.seller-name\" />,\n width: 300,\n },\n affiliateId: {\n title: <FormattedMessage id=\"admin/glovo-integration.affiliate-id\" />,\n },\n salesChannel: {\n title: <FormattedMessage id=\"admin/glovo-integration.sales-channel\" />,\n },\n glovoStoreId: {\n title: <FormattedMessage id=\"admin/glovo-integration.glovo-store-id\" />,\n },\n postalCode: {\n title: <FormattedMessage id=\"admin/glovo-integration.postal-code\" />,\n },\n country: {\n title: <FormattedMessage id=\"admin/glovo-integration.country\" />,\n cellRenderer: ({ cellData }: TableItem) =>\n countriesMap[cellData as string],\n },\n },\n }\n\n const lineActions = [\n {\n label: () => (\n <FormattedMessage id=\"admin/glovo-integration.table.edit-store\" />\n ),\n onClick: ({ rowData: store }: TableItem) => {\n setAddOrEditStore({\n ...addOrEditStore,\n isOpen: true,\n store,\n })\n },\n },\n {\n label: () => (\n <FormattedMessage id=\"admin/glovo-integration.table.remove-store\" />\n ),\n isDangerous: true,\n onClick: ({ rowData: { id } }: TableItem) => {\n setRemoveStore({\n ...removeStore,\n isOpen: true,\n storeId: id,\n })\n },\n },\n ]\n\n const intl = useIntl()\n\n // Pagination\n useEffect(() => {\n setFilteredStores(stores)\n setStoresToDisplay(stores.slice(currentItemFrom - 1, currentItemTo))\n setTotalItems(stores.length)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [stores])\n\n const setTablePage = (\n from: number,\n to: number,\n storesInPage: StoreInfo[]\n ) => {\n setCurrentItemFrom(from)\n setCurrentItemTo(to)\n setStoresToDisplay(storesInPage.slice(from - 1, to))\n }\n\n const handleNextClick = () => {\n const from = currentItemFrom + tableLength\n const to = currentItemTo + tableLength\n\n setTablePage(from, to, filteredStores)\n }\n\n const handlePrevClick = () => {\n let from = currentItemFrom - tableLength\n let to = currentItemTo - tableLength\n\n if (from < 0) {\n from = 1\n to = tableLength\n }\n\n setTablePage(from, to, filteredStores)\n }\n\n const handleRowsChange = (_: ChangeEvent, value: string) => {\n const to = currentItemFrom - 1 + parseInt(value, 10)\n\n setTableLength(parseInt(value, 10))\n setCurrentItemTo(to)\n\n setTablePage(currentItemFrom, to, filteredStores)\n }\n\n // Filters\n useEffect(() => {\n const affiliatesForFilters: BooleanRecords = {}\n const countriesForFilters: BooleanRecords = {}\n\n for (const store of stores) {\n const { affiliateId, country } = store\n\n if (!(affiliateId in affiliatesForFilters)) {\n affiliatesForFilters[affiliateId] = true\n }\n\n if (!(country in countriesForFilters)) {\n countriesForFilters[country] = true\n }\n }\n\n setAffiliatesFilters(affiliatesForFilters)\n setCountriesFilters(countriesForFilters)\n }, [stores])\n\n const handleFiltersChange = async (statements: Statement[] = []) => {\n let storesToFilter: StoreInfo[] = stores.slice()\n\n statements.forEach((statement) => {\n if (statement) {\n switch (statement.subject) {\n case 'affiliate':\n if (!statement.object) return\n\n storesToFilter = storesToFilter.filter(\n (store) => statement.object[store.affiliateId]\n )\n break\n\n case 'country':\n if (!statement.object) return\n\n storesToFilter = storesToFilter.filter(\n (store) => statement.object[store.country]\n )\n break\n\n default:\n break\n }\n }\n })\n\n setFilteredStores(storesToFilter)\n setFilterStatements(statements)\n setTotalItems(storesToFilter.length)\n setTablePage(1, tableLength, storesToFilter)\n }\n\n const renderFilterLabel = (statement: Statement) => {\n if (!statement) {\n return intl.formatMessage({ id: 'admin/glovo-integration.table.all' })\n }\n\n const { object } = statement\n\n const keys = Object.keys(object) ?? []\n const isAllTrue = !keys.some((key) => !object[key])\n const isAllFalse = !keys.some((key) => object[key])\n const trueKeys = keys.filter((key) => object[key])\n\n let trueKeysLabel = ''\n\n trueKeys.forEach((key, i) => {\n trueKeysLabel += `${key}${i === trueKeys.length - 1 ? '' : ', '}`\n })\n\n return `${\n isAllTrue\n ? intl.formatMessage({ id: 'admin/glovo-integration.table.all' })\n : isAllFalse\n ? intl.formatMessage({ id: 'admin/glovo-integration.table.none' })\n : `${trueKeysLabel}`\n }`\n }\n\n const toggleCheckbox = (values: any, defaultValues: any, key: string) => {\n const updatedValues = {\n ...(values ?? defaultValues),\n [key]: values ? !values[key] : false,\n }\n\n return updatedValues\n }\n\n const affiliatesSelector = ({ onChange, value }: FilterSelectorEvent) => {\n return (\n <div>\n {Object.keys(affiliatesFilters).map((affiliate, i) => (\n <div className=\"mb2 ml2\" key={`${affiliate}-${i}`}>\n <Checkbox\n checked={value ? value[affiliate] : affiliatesFilters[affiliate]}\n label={affiliate}\n onChange={() => {\n const updated = toggleCheckbox(\n value,\n affiliatesFilters,\n affiliate\n )\n\n onChange(updated)\n }}\n value={affiliate}\n />\n </div>\n ))}\n </div>\n )\n }\n\n const countriesSelector = ({ onChange, value }: FilterSelectorEvent) => {\n return (\n <div>\n {Object.keys(countriesFilters).map((country, i) => (\n <div className=\"mb2 ml2\" key={`${countriesMap[country]}-${i}`}>\n <Checkbox\n checked={value ? value[country] : countriesMap[country]}\n label={countriesMap[country]}\n onChange={() => {\n const updated = toggleCheckbox(value, countriesFilters, country)\n\n onChange(updated)\n }}\n value={country}\n />\n </div>\n ))}\n </div>\n )\n }\n\n return (\n <Table\n items={storesToDisplay}\n schema={schema}\n lineActions={lineActions}\n fullWidth\n filters={{\n statements: filterStatements,\n onChangeStatements: handleFiltersChange,\n moreOptionsLabel: (\n <FormattedMessage id=\"admin/glovo-integration.table.more-options\" />\n ),\n alwaysVisibleFilters: ['affiliate', 'country'],\n clearAllFiltersButtonLabel: (\n <FormattedMessage id=\"admin/glovo-integration.table.clear-all\" />\n ),\n submitFilterLabel: (\n <FormattedMessage id=\"admin/glovo-integration.table.apply\" />\n ),\n options: {\n affiliate: {\n label: intl.formatMessage({\n id: 'admin/glovo-integration.affiliate-id',\n }),\n renderFilterLabel,\n verbs: [\n {\n value: '=',\n object: affiliatesSelector,\n },\n ],\n },\n country: {\n label: intl.formatMessage({\n id: 'admin/glovo-integration.country',\n }),\n renderFilterLabel,\n verbs: [\n {\n value: '=',\n object: countriesSelector,\n },\n ],\n },\n },\n }}\n pagination={{\n currentItemFrom,\n currentItemTo,\n totalItems,\n onNextClick: handleNextClick,\n onPrevClick: handlePrevClick,\n onRowsChange: handleRowsChange,\n textOf: <FormattedMessage id=\"admin/glovo-integration.table.of\" />,\n textShowRows: (\n <FormattedMessage id=\"admin/glovo-integration.table.show-rows\" />\n ),\n rowsOptions: [10, 25],\n }}\n emptyStateLabel=\"\"\n emptyStateChildren={\n <div className=\"\">\n <h4 className=\"t-heading-4 pt8\">\n <FormattedMessage id=\"admin/glovo-integration.table.empty\" />\n </h4>\n </div>\n }\n />\n )\n}\n\nexport { StoreTable }\n\n```" } ]
code_glovo-integration_1995de8a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/components/admin/Configuration.tsx from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\n/* eslint-disable padding-line-between-statements */\nimport type { ChangeEvent } from 'react'\nimport React, { Fragment, useState } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Button, Input, InputPassword, Toggle } from 'vtex.styleguide'\n\nimport {\n CORPORATE_NAME,\n DOCUMENT,\n DOCUMENT_TYPE,\n EMAIL,\n FIRST_NAME,\n GLOVO_TOKEN,\n LAST_NAME,\n MARKETPLACE,\n MINIMUM_STOCK,\n PHONE_NUMBER,\n PRODUCTION,\n} from '../../constants'\nimport { validateInputs } from '../../../common/utils'\nimport type { AlertProps } from './AlertBanner'\nimport { AlertBanner } from './AlertBanner'\nimport type { SettingsSection } from '../../typings/settingsSections'\n\nconst Configuration = ({\n settings,\n setSettings,\n saveSettings,\n}: SettingsSection) => {\n const [error, setError] = useState(false)\n const [savingSettings, setSavingSettings] = useState(false)\n const [alert, setAlert] = useState<AlertProps>({\n show: false,\n type: 'success',\n })\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n switch (e.target.id) {\n case GLOVO_TOKEN: {\n setSettings({\n ...settings,\n glovoToken: e.target.value,\n })\n\n return\n }\n\n case MINIMUM_STOCK: {\n setSettings({\n ...settings,\n minimumStock: Number(e.target.value),\n })\n\n return\n }\n case PRODUCTION:\n case MARKETPLACE: {\n setSettings({\n ...settings,\n [e.target.id]: !settings[e.target.id],\n })\n\n return\n }\n\n default: {\n setSettings({\n ...settings,\n clientProfileData: {\n ...settings.clientProfileData,\n [e.target.id]: e.target.value,\n },\n })\n }\n }\n }\n\n const handleSaveSettings = async () => {\n setSavingSettings(true)\n\n const validation = validateInputs({\n glovoToken: settings.glovoToken,\n clientProfileData: settings.clientProfileData,\n })\n\n if (!validation) {\n setError(true)\n setSavingSettings(false)\n\n return\n }\n\n setError(false)\n\n try {\n const succesfulUpdate = await saveSettings(settings)\n\n if (!succesfulUpdate) {\n throw new Error('Unable to save settings.')\n }\n\n setAlert({\n show: true,\n type: 'success',\n })\n } catch (err) {\n console.error(err)\n\n setAlert({\n show: true,\n type: 'error',\n })\n }\n\n setSavingSettings(false)\n }\n\n return (\n <Fragment>\n <AlertBanner show={alert.show} type={alert.type} onClose={setAlert} />\n {/* Integration settings */}\n <div>\n <h2>\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.title\" />\n </h2>\n <p className=\"i mt0 mb7 gray\">\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.subtitle\" />\n </p>\n\n <div className=\"mt4\">\n <p>\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.glovo-token\" />\n </p>\n <InputPassword\n id={GLOVO_TOKEN}\n value={settings.glovoToken}\n label={\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.glovo-token.description\" />\n }\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.glovoToken && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n <div className=\"mt4\">\n <p>\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.minimumStock.label\" />\n </p>\n <Input\n id={MINIMUM_STOCK}\n value={settings.minimumStock}\n label={\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.minimumStock.description\" />\n }\n type=\"number\"\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.minimumStock && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n <div className=\"mt7\">\n <p className=\"i mt0 gray\">\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.marketplace.description\" />\n </p>\n <Toggle\n checked={settings.marketplace}\n id={MARKETPLACE}\n label={\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.marketplace.label\" />\n }\n name=\"marketplace\"\n value={settings.marketplace}\n onChange={handleChange}\n />\n </div>\n <div className=\"mt7\">\n <p className=\"i mt0 gray\">\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.production.description\" />\n </p>\n <Toggle\n checked={settings.production}\n id={PRODUCTION}\n label={\n <FormattedMessage id=\"admin/glovo-integration.integration-settings.production.label\" />\n }\n name=\"production\"\n value={settings.production}\n onChange={handleChange}\n semantic\n />\n </div>\n </div>\n\n {/* Client information */}\n <div className=\"mt8\">\n <h2>\n <FormattedMessage id=\"admin/glovo-integration.client-info.title\" />\n </h2>\n <p className=\"i mt0 mb7 gray\">\n <FormattedMessage id=\"admin/glovo-integration.client-info.subtitle\" />\n </p>\n <div className=\"mt4\">\n <Input\n id={EMAIL}\n value={settings.clientProfileData.email}\n label={\n <FormattedMessage id=\"admin/glovo-integration.client-info.email\" />\n }\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.clientProfileData.email && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n <div className=\"flex\">\n <div className=\"w-50 pr5 pt5\">\n <Input\n id={FIRST_NAME}\n value={settings.clientProfileData.firstName}\n label={\n <FormattedMessage id=\"admin/glovo-integration.client-info.first-name\" />\n }\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.clientProfileData.firstName && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n <div className=\"w-50 pt5\">\n <Input\n id={LAST_NAME}\n value={settings.clientProfileData.lastName}\n label={\n <FormattedMessage id=\"admin/glovo-integration.client-info.last-name\" />\n }\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.clientProfileData.lastName && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n </div>\n <div className=\"flex\">\n <div className=\"w-50 pr5 pt5\">\n <Input\n id={DOCUMENT_TYPE}\n value={settings.clientProfileData.documentType}\n label={\n <FormattedMessage id=\"admin/glovo-integration.client-info.document-type\" />\n }\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.clientProfileData.documentType && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n <div className=\"w-50 pt5\">\n <Input\n id={DOCUMENT}\n value={settings.clientProfileData.document}\n label={\n <FormattedMessage id=\"admin/glovo-integration.client-info.document\" />\n }\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.clientProfileData.document && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n </div>\n <div className=\"pt5\">\n <Input\n id={PHONE_NUMBER}\n value={settings.clientProfileData.phone}\n label={\n <FormattedMessage id=\"admin/glovo-integration.client-info.phone-number\" />\n }\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.clientProfileData.phone && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n <div className=\"pt5\">\n <Input\n id={CORPORATE_NAME}\n value={settings.clientProfileData.corporateName}\n label={\n <FormattedMessage id=\"admin/glovo-integration.client-info.corporate-name\" />\n }\n onChange={handleChange}\n errorMessage={\n error &&\n !settings.clientProfileData.corporateName && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n </div>\n <div className=\"flex justify-end mt8\">\n <Button isLoading={savingSettings} onClick={handleSaveSettings} block>\n {<FormattedMessage id=\"admin/glovo-integration.save\" />}\n </Button>\n </div>\n </div>\n </Fragment>\n )\n}\n\nexport { Configuration }\n\n```" } ]
code_glovo-integration_b0158c45
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/components/admin/StoreModal.tsx from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { ChangeEvent, Dispatch, SetStateAction } from 'react'\nimport React, { useEffect, useState } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport {\n Button,\n Input,\n Modal,\n EXPERIMENTAL_Select as Select,\n} from 'vtex.styleguide'\nimport { v4 as createId } from 'uuid'\nimport { useQuery } from 'react-apollo'\n\nimport {\n COUNTRY,\n GLOVO_STORE_ID,\n POSTAL_CODE,\n SALES_CHANNEL,\n AFFILIATE_ID,\n STORE_NAME,\n SELLER_ID,\n} from '../../constants'\nimport { countriesMap, countriesOptions } from '../../utils'\nimport { validateInputs } from '../../../common/utils'\nimport GET_SELLERS from '../../graphql/getSellers.gql'\n\ninterface Props {\n isOpen: boolean\n setIsOpen: Dispatch<SetStateAction<AddOrEditStore>>\n saving: boolean\n store: StoreInfo | null\n addStore: (store: StoreInfo) => Promise<void>\n editStore: (store: StoreInfo) => Promise<void>\n}\n\nconst StoreModal = ({\n isOpen,\n setIsOpen,\n saving,\n store,\n addStore,\n editStore,\n}: Props) => {\n const [error, setError] = useState(false)\n const [storeInfo, setStoreInfo] = useState({} as StoreInfo)\n const [sellers, setSellers] = useState<SelectOption[]>([])\n const [selectedSeller, setSelectedSeller] = useState<SelectOption | null>(\n null\n )\n\n const [selectedCountry, setSelectedCountry] = useState<SelectOption | null>(\n null\n )\n\n const {\n loading: loadingSellers,\n error: sellersError,\n data,\n } = useQuery(GET_SELLERS, {\n ssr: false,\n })\n\n useEffect(() => {\n if (!store) {\n setStoreInfo({\n ...storeInfo,\n id: createId(),\n })\n\n return\n }\n\n setSelectedSeller({\n label: store.sellerName,\n value: store.sellerId,\n })\n\n setSelectedCountry({\n label: countriesMap[store.country],\n value: store.country,\n })\n\n setStoreInfo(store)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store])\n\n useEffect(() => {\n if (loadingSellers || sellersError) {\n return\n }\n\n if (data) {\n const sellersInfo = data.sellers.items.reduce(\n (sellersOptions: SelectOption[], seller: Seller) => {\n if (seller.isActive) {\n sellersOptions.push({\n label: seller.name,\n value: seller.id,\n })\n\n return sellersOptions\n }\n\n return sellersOptions\n },\n []\n )\n\n setSellers(sellersInfo)\n }\n }, [loadingSellers, data, sellersError])\n\n const handleCloseModal = () => {\n setStoreInfo({} as StoreInfo)\n\n setIsOpen({\n isOpen: false,\n loading: false,\n store: null,\n })\n }\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const value =\n e.target.id === AFFILIATE_ID\n ? e.target.value.toUpperCase().replace(/[AEIOU0-9]/, '')\n : e.target.value\n\n setStoreInfo({\n ...storeInfo,\n [e.target.id]: value,\n })\n }\n\n const handleSelectCountry = (country: SelectOption) => {\n setStoreInfo({\n ...storeInfo,\n country: country.value,\n })\n\n setSelectedCountry(country)\n }\n\n const handleSelectSeller = (seller: SelectOption) => {\n setStoreInfo({\n ...storeInfo,\n sellerId: seller.value,\n sellerName: seller.label,\n })\n\n setSelectedSeller(seller)\n }\n\n const validate = () => {\n setIsOpen({\n isOpen: true,\n loading: true,\n store: storeInfo,\n })\n\n const validation = validateInputs({\n ...storeInfo,\n })\n\n if (!validation) {\n setError(true)\n\n return false\n }\n\n setError(false)\n\n return true\n }\n\n const handleAddStore = () => {\n if (validate()) {\n addStore(storeInfo)\n }\n\n setStoreInfo({ id: createId() } as StoreInfo)\n setSelectedCountry(null)\n setSelectedSeller(null)\n }\n\n const handleEditStore = () => {\n if (validate()) {\n editStore(storeInfo)\n }\n\n setStoreInfo({} as StoreInfo)\n setSelectedCountry(null)\n setSelectedSeller(null)\n }\n\n return (\n <Modal isOpen={isOpen} onClose={handleCloseModal}>\n <div className=\"mt3\">\n <h4 className=\"t-heading-4\">\n <FormattedMessage id=\"admin/glovo-integration.modal.title\" />\n </h4>\n <div className=\"mb6\">\n <p className=\"mb2\">\n <FormattedMessage id=\"admin/glovo-integration.store-name\" />\n </p>\n <Input\n id={STORE_NAME}\n label={\n <FormattedMessage id=\"admin/glovo-integration.modal.store-name.description\" />\n }\n value={storeInfo.storeName}\n onChange={handleChange}\n errorMessage={\n error &&\n !storeInfo.storeName && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n\n <div className=\"mb6\">\n <p className=\"mb2\">\n {<FormattedMessage id=\"admin/glovo-integration.seller-id\" />}\n </p>\n <Select\n id={SELLER_ID}\n label={\n <FormattedMessage id=\"admin/glovo-integration.modal.seller-id.description\" />\n }\n value={selectedSeller}\n multi={false}\n options={sellers}\n onChange={handleSelectSeller}\n errorMessage={\n error &&\n !storeInfo.sellerId && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n\n <div className=\"mb6\">\n <p className=\"mb2\">\n {<FormattedMessage id=\"admin/glovo-integration.affiliate-id\" />}\n </p>\n <Input\n id={AFFILIATE_ID}\n maxLength={3}\n label={\n <FormattedMessage id=\"admin/glovo-integration.modal.affiliate-id.description\" />\n }\n value={storeInfo.affiliateId}\n onChange={handleChange}\n errorMessage={\n error &&\n !storeInfo.affiliateId && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n\n <div className=\"mb6\">\n <p className=\"mb2\">\n {<FormattedMessage id=\"admin/glovo-integration.sales-channel\" />}\n </p>\n <Input\n id={SALES_CHANNEL}\n label={\n <FormattedMessage id=\"admin/glovo-integration.modal.sales-channel.description\" />\n }\n value={storeInfo.salesChannel}\n onChange={handleChange}\n errorMessage={\n error &&\n !storeInfo.salesChannel && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n\n <div className=\"mb6\">\n <p className=\"mb2\">\n {<FormattedMessage id=\"admin/glovo-integration.postal-code\" />}\n </p>\n <Input\n id={POSTAL_CODE}\n label={\n <FormattedMessage id=\"admin/glovo-integration.modal.postal-code.description\" />\n }\n value={storeInfo.postalCode}\n onChange={handleChange}\n errorMessage={\n error &&\n !storeInfo.postalCode && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n\n <div className=\"mb6\">\n <p className=\"mb2\">\n {<FormattedMessage id=\"admin/glovo-integration.country\" />}\n </p>\n <Select\n id={COUNTRY}\n label={\n <FormattedMessage id=\"admin/glovo-integration.modal.country.description\" />\n }\n value={selectedCountry}\n multi={false}\n options={countriesOptions}\n onChange={handleSelectCountry}\n errorMessage={\n error &&\n !storeInfo.country && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n\n <div className=\"mb6\">\n <p className=\"mb2\">\n {<FormattedMessage id=\"admin/glovo-integration.glovo-store-id\" />}\n </p>\n <Input\n label={\n <FormattedMessage id=\"admin/glovo-integration.modal.glovo-store-id.description\" />\n }\n value={storeInfo.glovoStoreId}\n id={GLOVO_STORE_ID}\n onChange={handleChange}\n errorMessage={\n error &&\n !storeInfo.glovoStoreId && (\n <FormattedMessage id=\"admin/glovo-integration.inputs.error-message\" />\n )\n }\n />\n </div>\n </div>\n <div className=\"flex justify-end mt8\">\n <Button\n isLoading={saving}\n onClick={!store ? handleAddStore : handleEditStore}\n block\n >\n <FormattedMessage id=\"admin/glovo-integration.save\" />\n </Button>\n </div>\n </Modal>\n )\n}\n\nexport { StoreModal }\n\n```" } ]
code_glovo-integration_b975212f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/components/admin/AdminPanel.tsx from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Fragment, useEffect, useState } from 'react'\nimport { useMutation, useQuery } from 'react-apollo'\nimport { FormattedMessage } from 'react-intl'\nimport {\n EmptyState,\n IconFailure,\n Layout,\n PageBlock,\n PageHeader,\n Spinner,\n} from 'vtex.styleguide'\n\nimport GET_APP_SETTINGS from '../../graphql/getAppSettings.gql'\nimport SAVE_APP_SETTINGS from '../../graphql/saveAppSettings.gql'\nimport { IconGlovo } from '../../icons/IconGlovo'\nimport { Configuration } from './Configuration'\nimport { Stores } from './Stores'\n\ninterface QueryResponse {\n loading: boolean\n error: any\n data: {\n settings: AppSettings\n }\n}\n\nconst AdminPanel = () => {\n const [settings, setSettings] = useState<AppSettings>({\n glovoToken: '',\n production: false,\n marketplace: false,\n minimumStock: 1,\n stores: [],\n clientProfileData: {\n email: '',\n firstName: '',\n lastName: '',\n documentType: '',\n document: '',\n phone: '',\n corporateName: '',\n },\n })\n\n const [saveSettings] = useMutation(SAVE_APP_SETTINGS)\n\n const { loading, error, data }: QueryResponse = useQuery(GET_APP_SETTINGS, {\n ssr: false,\n })\n\n useEffect(() => {\n if (\n !data?.settings ||\n data?.settings.glovoToken === null ||\n data?.settings.production === null ||\n data?.settings.clientProfileData === null\n ) {\n return\n }\n\n setSettings(data.settings)\n }, [data])\n\n const updateSettings = async (\n updatedSettings: AppSettings\n ): Promise<boolean> => {\n try {\n const response = await saveSettings({\n variables: {\n settings: updatedSettings,\n },\n })\n\n if (!response.data.settingsUpdated) {\n throw new Error('Unable to save settings')\n }\n\n setSettings(updatedSettings)\n\n return true\n } catch (err) {\n console.error(err)\n\n return false\n }\n }\n\n return (\n <Layout\n fullWidth\n pageHeader={\n <PageHeader\n title={\n <div className=\"flex items-center\">\n <div className=\"mr3\">\n <IconGlovo />\n </div>\n <FormattedMessage id=\"admin/glovo-integration.settings-title\" />\n </div>\n }\n />\n }\n >\n {loading ? (\n <EmptyState height={500}>\n <h5 className=\"t-heading-5\">\n <FormattedMessage id=\"admin/glovo-integration.settings.loading\" />\n </h5>\n <Spinner size={60} />\n </EmptyState>\n ) : error ? (\n <EmptyState height={500}>\n <h5 className=\"t-heading-5 gray mt0\">\n <FormattedMessage id=\"admin/glovo-integration.settings.error\" />\n </h5>\n <IconFailure size={60} />\n </EmptyState>\n ) : (\n <Fragment>\n <div className=\"mb7\">\n <PageBlock>\n <Stores\n settings={settings}\n setSettings={setSettings}\n saveSettings={updateSettings}\n />\n </PageBlock>\n </div>\n <PageBlock>\n <Configuration\n settings={settings}\n setSettings={setSettings}\n saveSettings={updateSettings}\n />\n </PageBlock>\n </Fragment>\n )}\n </Layout>\n )\n}\n\nexport { AdminPanel }\n\n```" } ]
code_glovo-integration_d40ddf6b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of glovo-integration/react/components/admin/AlertBanner.tsx from the glovo-integration VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { Dispatch, SetStateAction } from 'react'\nimport React from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Alert } from 'vtex.styleguide'\n\nexport interface AlertProps {\n show: boolean\n type: AlertType\n}\n\ninterface Props extends AlertProps {\n onClose: Dispatch<SetStateAction<AlertProps>>\n autoClose?: number\n}\n\nconst AlertBanner = ({ show, type, onClose, autoClose = 0 }: Props) => {\n const handleClose = () => {\n onClose({\n show: false,\n type,\n })\n }\n\n if (!show) {\n return null\n }\n\n return (\n <div className=\"mb4\">\n <Alert type={type} onClose={handleClose} autoClose={autoClose}>\n {type === 'success' ? (\n <FormattedMessage id=\"admin/glovo-integration.alert.success\" />\n ) : (\n <FormattedMessage id=\"admin/glovo-integration.alert.error\" />\n )}\n </Alert>\n </div>\n )\n}\n\nexport { AlertBanner }\n\n```" } ]
code_alexa-certify-code_9272d329
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of alexa-certify-code/docs/README.md from the alexa-certify-code VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/alexa-certify) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Alexa Certify\n\nThis app adds the [Alexa Certify Code](https://support.alexa.com/hc/en-us/sections/200063374-Certified-Site-Metrics) to your store.\n\n## Configuration \n\n[Installing the app](https://vtex.io/docs/recipes/store/installing-an-app) running the following command:\n\n\n```\nvtex install vtex.alexa-certify-code@1.x\n```\n\nNext, open the app settings on your admin and fill the form with your Alexa Account and Domain.\n\n```" } ]
code_order-places_0a05a79f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/messages/pt.json from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"editor.base-store-component.title\": \"IO Base App\",\n \"editor.base-store-component.description\": \"Um componente de demonstração para apps do VTEX IO\",\n \"editor.base-store-component.title.title\": \"Título\",\n \"editor.base-store-component.title.description\": \"Especifique um título personalizado\",\n \"base.title\": \"Olá, Mundo!!\",\n \"base.change-value\": \"Troque seu valor: {value}\",\n \"example\": \"Isto é um exemplo\"\n}\n```" } ]
code_order-places_d7042e1a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/messages/en.json from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"editor.base-store-component.title\": \"IO Base App\",\n \"editor.base-store-component.description\": \"A demo component for IO apps\",\n \"editor.base-store-component.title.title\": \"Title\",\n \"editor.base-store-component.title.description\": \"Specify a custom title\",\n \"base.title\": \"Hello, World!!\",\n \"base.change-value\": \"Change your value: {value}\",\n \"example\": \"This is an example\"\n}\n```" } ]
code_order-places_2c88bf93
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/messages/context.json from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"editor.base-store-component.title\": \"Title of IO Base App component\",\n \"editor.base-store-component.description\": \"Description of IO Base App component\",\n \"editor.base-store-component.title.title\": \"Title of title property\",\n \"editor.base-store-component.title.description\": \"Description of title property\",\n \"base.title\": \"Base title message to be shown when title is not provided via CMS\",\n \"base.change-value\": \"Text to be shown beside input component typed value\"\n}\n```" } ]
code_order-places_9920c8ad
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/messages/es.json from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"editor.base-store-component.title\": \"IO Base App\",\n \"editor.base-store-component.description\": \"Un componente de demostración para aplicaciones IO.\",\n \"editor.base-store-component.title.title\": \"Título\",\n \"editor.base-store-component.title.description\": \"Especifique un título personalizado\",\n \"base.title\": \"¡Hola Mundo!\",\n \"base.change-value\": \"Cambia tu valor: {value}\",\n \"example\": \"Esto es un ejemplo\"\n}\n```" } ]
code_order-places_0a04330a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/docs/README.md from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\nFirst of all (even before the block's name), its README.md should contain the following sentence at the very beginning:\n\n`📢 Use this project, [contribute](https://github.com/{OrganizationName/{AppName}) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).`\n\n# BLOCK NAME\n\nUnder the block's name, you should explain the topic, giving a **brief description** of the **block's functionality** in a store.\n\nNext, **add media** (either an image of a GIF) with the rendered block, so that users can better understand how the block works in practice. \n\n![Media Placeholder](https://user-images.githubusercontent.com/52087100/71204177-42ca4f80-227e-11ea-89e6-e92e65370c69.png)\n\n## Configuration \n\nIn this section, you first must **add the primary instructions** that will allow users to use the block in their store, such as adding the block's app as a dependency in the `manifest.json` and declaring the block itself in a given template.\n\nNext, add the **block's props table**:\n\n| Prop name | Type | Description | Default value |\n| ------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | \n| `XXXXX` | `XXXXXX` | XXXXXXXX | `XXXXXX` |\n\n\nRemember to also **showcase any necessary disclaimer** related to the block in this section, such as the different behavior it may display during its configuration. \n\n## Modus Operandi *(not mandatory)*\n\nThere are scenarios in which a block can behave differently in a store, according to how it was added to the catalog, for example. It's crucial to go through these **behavioral changes** in this section, allowing users to fully understand the **practical application** of the block in their store.\n\nIf you feel compelled to give further details about the block, such as it's **relationship with the VTEX admin**, don't hesitate to use this section. \n\n## Customization\n\nThe first thing that should be present in this section is the sentence below, showing users the recipe pertaining to CSS customization in blocks:\n\n`In order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://vtex.io/docs/recipes/style/using-css-handles-for-store-customization).`\n\nThereafter, you should add a single column table with the available CSS handles for that block:\n\n| CSS Handles |\n| ----------- | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` |\n\n\nIf there are none, add the following sentence instead:\n\n`The component still doesn't have CSS Handles for its specific customization.`\n\n---\n\nCheck out some documentation models that are already live: \n- [Breadcrumb](https://github.com/vtex-apps/breadcrumb)\n- [Image](https://vtex.io/docs/components/general/vtex.store-components/image)\n\n```" } ]
code_order-places_15666be6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/package.json from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\",\n \"lint\": \"tsc --noEmit && eslint --ext ts,tsx .\"\n },\n \"dependencies\": {\n \"@vtex/css-handles\": \"^1.0.0\",\n \"classnames\": \"^2.2.6\",\n \"ramda\": \"^0.26.1\",\n \"react\": \"^16.8.3\",\n \"react-dom\": \"^16.8.3\",\n \"react-intl\": \"^2.7.2\"\n },\n \"devDependencies\": {\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.2\",\n \"@vtex/test-tools\": \"^1.1.0\",\n \"apollo-client\": \"^2.5.1\",\n \"eslint\": \"^5.16.0\",\n \"eslint-config-vtex-react\": \"^4.1.0\",\n \"prettier\": \"^1.18.2\",\n \"tslint-eslint-rules\": \"^5.4.0\",\n \"typescript\": \"3.5.2\"\n },\n \"version\": \"0.2.2\"\n}\n\n```" } ]
code_order-places_888e793d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/Example.tsx from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState } from 'react'\nimport { Input } from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\n\nimport TranslatedTitle from './components/TranslatedTitle'\n\nimport styles from './styles.css'\n\nconst Example: StorefrontFunctionComponent<ExampleProps> = ({ title }) => {\n const [inputValue, setValue] = useState<string | null>(null)\n\n return (\n <div className={`${styles.container} flex flex-column pv6 ph4`}>\n <TranslatedTitle title={title} />\n <div className=\"t-body pv4\">\n <FormattedMessage\n id=\"base.change-value\"\n values={{ value: inputValue || '' }}\n />\n </div>\n <Input\n value={inputValue}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n setValue(e.target.value)\n }\n />\n </div>\n )\n}\n\ninterface ExampleProps {\n title?: string\n}\n\nExample.schema = {\n title: 'editor.base-store-component.title',\n description: 'editor.base-store-component.description',\n type: 'object',\n properties: {\n title: {\n title: 'editor.base-store-component.title.title',\n description: 'editor.base-store-component.title.description',\n type: 'string',\n default: null,\n },\n },\n}\n\nexport default Example\n\n```" } ]
code_order-places_5cb88707
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/store/interfaces.json from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"base-store-component\": {\n \"component\": \"Example\"\n }\n}\n```" } ]
code_order-places_32bf10ec
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/typings/storefront.d.ts from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { FunctionComponent } from 'react'\n\ndeclare global {\n interface StorefrontFunctionComponent<P = {}> extends FunctionComponent<P> {\n getSchema?(props: P): object\n schema?: object\n }\n\n interface StorefrontComponent<P = {}, S = {}> extends Component<P, S> {\n getSchema?(props: P): object\n schema: object\n }\n}\n\n```" } ]
code_order-places_78e55a36
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/typings/vtex.render-runtime.d.ts from the order-places 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 = function({ id: string }): object {}\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 {}>(\n Component: ComponentType<TOriginalProps & RenderContextProps>\n ) => ComponentType<TOriginalProps>\n}\n\n```" } ]
code_order-places_6a247c07
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/typings/css.d.ts from the order-places 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_order-places_4dffda00
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/typings/graphql.d.ts from the order-places 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_order-places_24cf3555
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/typings/vtex.styleguide.d.ts from the order-places 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_order-places_0f14fdf9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/components/index.tsx from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\nimport { FormattedMessage } from 'react-intl'\n\nconst HelloWorld: FunctionComponent = () => {\n return (\n <div>\n <FormattedMessage id=\"example\" />\n </div>\n )\n}\n\nexport default HelloWorld\n\n```" } ]
code_order-places_c33c41cc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/components/TranslatedTitle.tsx from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\nimport { FormattedMessage } from 'react-intl'\n\n// The b-s token makes the `b` class be applied only on mobile devices.\nconst TranslatedTile: FunctionComponent<TranslatedTileProps> = ({ title }) => {\n const titleText = title || <FormattedMessage id=\"base.title\" />\n return (\n <div className=\"flex flex-grow-1 justify-center b-s\">\n <span className=\"t-heading-4\">{titleText}</span>\n </div>\n )\n}\n\ninterface TranslatedTileProps {\n title?: string\n}\n\nexport default TranslatedTile\n\n```" } ]
code_order-places_df59296f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of order-places/react/__tests__/index.test.tsx from the order-places VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport Component from '../components/index'\n\ndescribe('HelloWorld Component', () => {\n const { getByText } = render(<Component />)\n\n it('should render the example in TypeScript', () => {\n expect(getByText(/This is an example/)).toBeDefined()\n })\n})\n\n```" } ]
code_helloworld_17fe395a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of helloworld/pages/interfaces.json from the helloworld VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"guide\": {},\n \"guide.root\": {\n \"component\": \"Home\"\n }\n}\n\n```" } ]
code_helloworld_18822e3e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of helloworld/pages/routes.json from the helloworld VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"guide.root\": {\n \"path\": \"/helloworld\"\n }\n}\n\n```" } ]
code_helloworld_2b8b8f84
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of helloworld/react/Home.tsx from the helloworld VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FunctionComponent } from 'react'\n\nconst Home: FunctionComponent = () => (\n <h1>Hello World</h1>\n)\n\nexport default Home\n\n```" } ]
code_helloworld_f7d6a912
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of helloworld/react/package.json from the helloworld VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"apollo-client\": \"^2.4.7\",\n \"graphql\": \"^14.0.2\",\n \"highlight.js\": \"^9.13.1\",\n \"react\": \"^16.6.3\",\n \"react-apollo\": \"^2.3.1\",\n \"react-dom\": \"^16.0.0\",\n \"react-markdown\": \"^4.0.4\"\n },\n \"devDependencies\": {\n \"@types/highlight.js\": \"^9.12.3\",\n \"@types/jest\": \"^24.0.11\",\n \"@types/lodash.isequal\": \"^4.5.5\",\n \"@types/node\": \"^10.12.17\",\n \"@types/react\": \"^16.7.17\",\n \"@vtex/test-tools\": \"^0.1.4\",\n \"prettier\": \"^1.16.4\",\n \"tslint\": \"^5.12.0\",\n \"tslint-config-vtex\": \"^2.1.0\",\n \"typescript\": \"3.5.2\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit && tslint -c tslint.json './**/*.ts'\",\n \"test\": \"vtex-test-tools test\"\n }\n}\n\n```" } ]
code_yourviews-graphql_5962bf40
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/docs/README.md from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# YourViews GraphQL resolvers\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\nTo add your YourViews token you must create a file in VBase at the `secret_keys` bucket called `keys.json` with this format:\n\n```\n{\n \"yourviewsToken\": \"<token>\",\n \"appId\": \"<appId>\"\n}\n```\n\nExample curl:\n\n```\ncurl --request PUT \\\n --url http://vbase.aws-us-east-1.vtex.io/<account>/<workspace>/buckets/vtex.yourviews-graphql/secret_keys/files/keys.json \\\n --header 'authorization: <vtex token>' \\\n --header 'content-type: application/json' \\\n --data '{\n \"yourviewsToken\": \"<yourviews token>\",\n \"appId\": \"<appId>\"\n}'\n```\n\nTo grab your vtex token, run on the terminal:\n\n`vtex local token`\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<table>\n <tr>\n <td align=\"center\"><a href=\"http://www.josantana.net\"><img src=\"https://avatars0.githubusercontent.com/u/5032844?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Jo Santana</b></sub></a><br /><a href=\"https://github.com/vtex-apps/yourviews-graphql/commits?author=josantana\" title=\"Code\">💻</a></td>\n </tr>\n</table>\n\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_yourviews-graphql_3271ee3a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/graphql/schema.graphql from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\n\ntype RatingElement {\n ProductId: Int,\n TotalRatings: Int,\n Rating: Float,\n}\n\ntype Rating {\n HasErrors: Boolean,\n Element: [RatingElement],\n ErrorList: [String],\n Total: Int,\n CurrentPage: Int\n}\n\ntype Fields {\n Name: String,\n Values: [String]\n}\n\ntype User {\n Name: String,\n Email: String,\n CPF: String,\n City: String,\n State: String,\n UserId: String,\n ExhibitionName: String,\n}\n\ntype ReviewElement {\n ReviewId: Int,\n Rating: Int,\n Review: String,\n Date: String,\n Likes: Int,\n Dislikes: Int,\n CustomFields: [Fields],\n User: User,\n ReferenceOrder: String,\n ReviewTitle: String,\n BoughtProduct: Boolean\n}\n\ntype Reviews {\n HasErrors: Boolean,\n Element: [ReviewElement],\n ErrorList: [String],\n Total: Int,\n CurrentPage: Int\n}\n\ntype Query {\n rating(productId: String): Rating @withSecretKeys\n ratings(productIds: [String!]): Rating @withSecretKeys\n reviews(productId: String): Reviews @withSecretKeys\n}\n\n```" } ]
code_yourviews-graphql_81d44e3d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/node/service.json from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"stack\": \"nodejs\",\n \"memory\": 512,\n \"ttl\": 60,\n \"timeout\": 10,\n \"minReplicas\": 8,\n \"maxReplicas\": 20\n}\n\n```" } ]
code_yourviews-graphql_9c39d16d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/node/package.json from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"axios\": \"^0.18.0\",\n \"bluebird\": \"^3.5.0\",\n \"co-body\": \"^6.0.0\",\n \"cookie\": \"^0.3.1\",\n \"graphql\": \"^0.13.2\",\n \"graphql-tools\": \"^3.1.1\",\n \"ramda\": \"^0.25.0\",\n \"request\": \"^2.85.0\",\n \"slugify\": \"^1.2.6\",\n \"url-parse\": \"^1.2.0\",\n \"utf8\": \"^3.0.0\"\n },\n \"devDependencies\": {\n \"@types/request\": \"^2.47.0\",\n \"@types/bluebird\": \"^3.5.0\",\n \"@types/bluebird-global\": \"^3.5.0\",\n \"@types/es6-shim\": \"^0.31.32\",\n \"@types/graphql\": \"^14.0.5\",\n \"@types/koa\": \"^2.0.39\",\n \"@types/node\": \"^10.5.3\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"^3.8.1\",\n \"tslint\": \"^5.12.0\",\n \"tslint-config-vtex\": \"^2.1.0\",\n \"typescript\": \"3.7.3\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit && tslint --fix -c tslint.json './**/*.ts'\"\n },\n \"version\": \"1.0.0\"\n}\n\n```" } ]
code_yourviews-graphql_8be0f48a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/node/index.ts from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { LRUCache, Service, ServiceContext } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { WithSecretKeys } from './directives/secretKeys'\nimport { queries } from './resolvers/review'\n\nconst MEDIUM_TIMEOUT_MS = 2 * 1000\n\ndeclare global {\n interface SecretKeys {\n appId: string\n yourviewsToken: string\n }\n\n // We declare a global Context type just to avoid re-writing ServiceContext<Clients, State> in every handler and resolver\n type Context = ServiceContext<Clients>\n}\n\nconst vbaseCache = new LRUCache<string, any>({max: 10})\nmetrics.trackCache('vbase', vbaseCache)\n\n// Export a service that defines resolvers and clients' options\nexport default new Service<Clients>({\n clients: {\n implementation: Clients,\n options: {\n default: {\n timeout: MEDIUM_TIMEOUT_MS,\n },\n vbase: {\n memoryCache: vbaseCache,\n },\n },\n },\n graphql: {\n resolvers: {\n Query: queries,\n },\n schemaDirectives: {\n withSecretKeys: WithSecretKeys,\n },\n },\n})\n\n```" } ]
code_yourviews-graphql_0a8b449a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/node/directives/secretKeys.ts from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { defaultFieldResolver, GraphQLField } from 'graphql'\nimport { SchemaDirectiveVisitor } from 'graphql-tools'\n\nexport class WithSecretKeys extends SchemaDirectiveVisitor {\n public visitFieldDefinition (field: GraphQLField<any, any>) {\n const {resolve = defaultFieldResolver} = field\n field.resolve = async (root: any, args: any, ctx: Context, info: any) => {\n const bucket = 'secret_keys'\n const filePath = 'keys.json'\n ctx.clients.yourviews.init(await ctx.clients.vbase.getJSON<SecretKeys>(bucket, filePath))\n return resolve(root, args, ctx, info)\n }\n }\n}\n\n```" } ]
code_yourviews-graphql_adea2756
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/node/clients/yourviews.ts from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { ExternalClient, InstanceOptions, IOContext, RequestConfig } from '@vtex/api'\n\nexport default class YourViewsClient extends ExternalClient {\n public appId?: string\n public token?: string\n\n constructor(context: IOContext, options?: InstanceOptions) {\n super('http://service.yourviews.com.br', context, options)\n }\n\n // This is initialized by the withSecretKeys directive\n public init(secretKeys: SecretKeys) {\n this.appId = secretKeys.appId\n this.token = secretKeys.yourviewsToken\n }\n\n public async getRating (productId: string): Promise<string> {\n return this.get(this.routes.rating(productId), {\n metric: 'yourviews-get-rating',\n })\n }\n\n public async getRatings (productIds: string[]): Promise<string> {\n return this.get(this.routes.ratings(productIds), {\n metric: 'yourviews-get-ratings',\n })\n }\n\n public async getReviews (productId: string): Promise<string> {\n return this.get(this.routes.reviews(productId), {\n metric: 'yourviews-get-reviews',\n })\n }\n\n private get routes () {\n return {\n rating: (productId: string) => `/api/${this.appId}/review/reviewshelf?productIds=${productId}`,\n ratings: (productIds: string[]) => `/api/${this.appId}/review/reviewshelf?productIds=${productIds.join(',')}`,\n reviews: (productId: string) => `/api/${this.appId}/review?productId=${productId}`,\n }\n }\n\n private get (url: string, config?: RequestConfig) {\n return this.http.get(url, {\n ...config,\n headers: {\n Accept: 'application/json',\n 'Authorization': this.token,\n 'Content-Type': 'application/json',\n },\n })\n }\n}\n\n```" } ]
code_yourviews-graphql_8c1e7428
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/node/clients/index.ts from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport YourViewsClient from './yourviews'\n\nexport class Clients extends IOClients {\n get yourviews() {\n return this.getOrSet('yourviews', YourViewsClient)\n }\n}\n\n```" } ]
code_yourviews-graphql_c6fad76f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/node/resolvers/review/index.ts from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport {\n rating,\n ratings,\n reviews,\n} from './yourviewsResolver'\n\nexport const queries = {\n rating,\n ratings,\n reviews,\n}\n\n```" } ]
code_yourviews-graphql_ccd4d08d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of yourviews-graphql/node/resolvers/review/yourviewsResolver.ts from the yourviews-graphql VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface SingleProductArgs {\n productId: string\n}\n\nexport const rating = async (_: any, args: SingleProductArgs, ctx: Context) => {\n const data = await ctx.clients.yourviews.getRating(args.productId)\n return data\n}\n\ninterface MultipleProductsArg {\n productIds: string[]\n}\n\nexport const ratings = async (_: any, args: MultipleProductsArg, ctx: Context) => {\n const data = await ctx.clients.yourviews.getRatings(args.productIds)\n return data\n}\n\nexport const reviews = async (_: any, args: SingleProductArgs, ctx: Context) => {\n const data = await ctx.clients.yourviews.getReviews(args.productId)\n return data\n}\n\n```" } ]
code_admin-example_876d6699
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/messages/pt.json from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin-example.navigation.label-group\": \"Admin de exemplo\",\n \"admin-example.navigation.label-table\": \"Exemplo de tabela\",\n \"admin-example.navigation.search.kws\": \"teste, mock, fake\",\n \"admin-example.navigation.details.search.kws\": \"detalhe, mock, test, oi\",\n \"admin-example.navigation.table.search.kws\": \"tabela, mock, test, tchau\",\n \"admin-example.hello-world\": \"Admin de exemplo\",\n \"admin-example.details\": \"Admin detalhes\"\n}\n\n```" } ]
code_admin-example_ddd81d28
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/messages/en.json from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin-example.navigation.label-group\": \"Example admins\",\n \"admin-example.navigation.label-table\": \"Example table\",\n \"admin-example.navigation.search.kws\": \"test, mock, fake\",\n \"admin-example.navigation.details.search.kws\": \"details, mock, test, hello\",\n \"admin-example.navigation.table.search.kws\": \"table, mock, test, bye\",\n \"admin-example.hello-world\": \"Example Admin\",\n \"admin-example.details\": \"Details page\"\n}\n\n```" } ]
code_admin-example_412a7e5f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/messages/es.json from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin-example.navigation.label-group\": \"Admins de ejemplo\",\n \"admin-example.navigation.label-table\": \"Ejemplo de tabela\",\n \"admin-example.navigation.search.kws\": \"teste, mock, fake\",\n \"admin-example.navigation.details.search.kws\": \"detalhe, mock, test, oi\",\n \"admin-example.navigation.table.search.kws\": \"tabela, mock, test, tchau\",\n \"admin-example.hello-world\": \"Admin de ejemplo\",\n \"admin-example.details\": \"Página de detalles\"\n}\n\n```" } ]
code_admin-example_a341a581
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/admin/navigation.json from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"section\": \"orders\",\n \"titleId\": \"admin-example.navigation.label-group\",\n \"subSection\": \"example\",\n \"searchKeyWordsHelpers\": \"admin-example.navigation.search.kws\",\n \"subSectionItems\": [\n {\n \"labelId\": \"admin-example.navigation.label-table\",\n \"path\": \"/admin/example\",\n \"searchKeyWordsHelpers\": \"admin-example.navigation.table.search.kws\"\n }\n ]\n}\n\n```" } ]
code_admin-example_8577878a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/admin/routes.json from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"admin.app.example\": {\n \"component\": \"AdminExample\",\n \"path\": \"/admin/app/example\"\n },\n \"admin.app.example-detail\": {\n \"component\": \"AdminExampleDetail\",\n \"path\": \"/admin/app/example/:id\"\n }\n}\n\n```" } ]
code_admin-example_a66c2434
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/docs/README.md from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```markdown\n# [Deprecating] Admin Example\n\n_We're working on our new design system. Please get in touch if you are part of VTEX product team and working on an admin app. If you are external to VTEX you can still use this repo._\n\nAn example admin app that adds a menu button to the admin sidebar and a navigation via parameter example.\n\n### How to develop admins\n\n1. Admins always declare routes in `/admin/app/<route>`\n\n2. Declare the `admin` builder in your manifest\n\n3. When installed, the user navigates to `/admin/<route>`, but your app runs in an iframe that points to `/admin/app/<route>`.\n\n4. You can develop directly in the `/admin/app` route for convenience, but don't forget to test it inside the iframe. :)\n\n### Quickstart\n\n1. Clone this repo\n\n2. `yarn --cwd react/` for code completion\n\n3. `vtex link`\n\n4. Navigate to `workspace--account.myvtex.com/admin/app/example`\n\n```" } ]
code_admin-example_e47310cb
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/react/AdminExampleDetail.tsx from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Layout, PageBlock, PageHeader } from 'vtex.styleguide'\n\nimport './styles.global.css'\n\nconst AdminExampleDetail: FC<Props> = ({ params }) => {\n return (\n <Layout\n pageHeader={\n <PageHeader title={<FormattedMessage id=\"admin-example.details\" />} />\n }\n >\n <PageBlock variation=\"full\">\n <div>\n Params: <pre>{JSON.stringify(params, null, 2)}</pre>\n </div>\n </PageBlock>\n </Layout>\n )\n}\n\ninterface Props {\n params: any\n}\n\nexport default AdminExampleDetail\n\n```" } ]
code_admin-example_43132316
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/react/AdminExample.tsx from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\nimport { FormattedMessage } from 'react-intl'\nimport { Layout, PageBlock, PageHeader } from 'vtex.styleguide'\n\nimport UsersTable from './UsersTable'\n\nimport './styles.global.css'\n\nconst AdminExample: FC = () => {\n return (\n <Layout\n pageHeader={\n <PageHeader\n title={<FormattedMessage id=\"admin-example.hello-world\" />}\n />\n }\n >\n <PageBlock variation=\"full\">\n <UsersTable />\n </PageBlock>\n </Layout>\n )\n}\n\nexport default AdminExample\n\n```" } ]
code_admin-example_d4b7c9c5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/react/package.json from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.admin-example\",\n \"version\": \"0.0.12\",\n \"devDependencies\": {\n \"@types/node\": \"^11.12.1\",\n \"@types/react\": \"^16.8.10\",\n \"@types/react-intl\": \"^2.3.17\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-client\": \"^2.4.7\",\n \"graphql\": \"^14.0.2\",\n \"prop-types\": \"^15.7.2\",\n \"react\": \"^16.8.6\",\n \"react-dom\": \"^16.8.6\",\n \"react-intl\": \"^2.7.2\",\n \"typescript\": \"3.9.7\"\n },\n \"dependencies\": {\n \"@types/faker\": \"^4.1.5\",\n \"faker\": \"^4.1.0\"\n }\n}\n\n```" } ]
code_admin-example_9bc0e490
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/react/styles.global.css from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\nhtml,\nbody,\n#render-container,\n#render-provider,\n.render-container,\n.render-provider {\n height: 100%;\n}\n\n```" } ]
code_admin-example_95dd3aa4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of admin-example/react/UsersTable/index.tsx from the admin-example VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Component, Fragment } from 'react'\nimport {\n Table,\n IconArrowUp,\n IconArrowDown,\n IconShoppingCart,\n Input,\n} from 'vtex.styleguide'\nimport faker from 'faker'\nimport { withRuntimeContext } from 'vtex.render-runtime'\n\nconst EXAMPLE_LENGTH = 100\nconst MOCKED_DATA = [...Array(EXAMPLE_LENGTH)].map(() => ({\n name: faker.name.findName(),\n streetAddress: faker.address.streetAddress(),\n cityStateZipAddress: `${faker.address.city()}, ${faker.address.stateAbbr()} ${faker.address.zipCode()}`,\n email: faker.internet.email().toLowerCase(),\n}))\n\ninterface Props {\n runtime: any\n}\n\nclass UsersTable extends Component<Props> {\n constructor(props: any) {\n super(props)\n this.state = {\n items: MOCKED_DATA,\n tableDensity: 'low',\n searchValue: null,\n filterStatements: [],\n }\n }\n\n private getSchema() {\n const { tableDensity }: any = this.state\n\n let fontSize = 'f5'\n\n switch (tableDensity) {\n case 'low': {\n fontSize = 'f5'\n break\n }\n case 'medium': {\n fontSize = 'f6'\n break\n }\n case 'high': {\n fontSize = 'f7'\n break\n }\n default: {\n fontSize = 'f5'\n break\n }\n }\n return {\n properties: {\n name: {\n title: 'Name',\n },\n streetAddress: {\n title: 'Street Address',\n cellRenderer: ({ cellData }: any) => {\n return <span className=\"ws-normal\">{cellData}</span>\n },\n },\n cityStateZipAddress: {\n title: 'City, State Zip',\n cellRenderer: ({ cellData }: any) => {\n return <span className={`ws-normal ${fontSize}`}>{cellData}</span>\n },\n },\n email: {\n title: 'Email',\n cellRenderer: ({ cellData }: any) => {\n return <span className={`ws-normal ${fontSize}`}>{cellData}</span>\n },\n },\n },\n }\n }\n\n private simpleInputObject({ values, onChangeObjectCallback }: any) {\n return (\n <Input\n value={values || ''}\n onChange={(e: any) => onChangeObjectCallback(e.target.value)}\n />\n )\n }\n\n private simpleInputVerbsAndLabel() {\n return {\n renderFilterLabel: (st: any) => {\n if (!st || !st.object) {\n // you should treat empty object cases only for alwaysVisibleFilters\n return 'Any'\n }\n return `${\n st.verb === '=' ? 'is' : st.verb === '!=' ? 'is not' : 'contains'\n } ${st.object}`\n },\n verbs: [\n {\n label: 'is',\n value: '=',\n object: {\n renderFn: this.simpleInputObject,\n extraParams: {},\n },\n },\n {\n label: 'is not',\n value: '!=',\n object: {\n renderFn: this.simpleInputObject,\n extraParams: {},\n },\n },\n {\n label: 'contains',\n value: 'contains',\n object: {\n renderFn: this.simpleInputObject,\n extraParams: {},\n },\n },\n ],\n }\n }\n\n public render() {\n const {\n items,\n searchValue,\n filterStatements,\n tableDensity,\n }: any = this.state\n const {\n runtime: { navigate },\n } = this.props\n\n return (\n <div>\n <Table\n fullWidth\n updateTableKey={tableDensity}\n items={items}\n schema={this.getSchema()}\n density=\"low\"\n onRowClick={({ rowData }: any) =>\n navigate({\n page: 'admin.app.example-detail',\n params: { id: rowData.id },\n })\n }\n toolbar={{\n density: {\n buttonLabel: 'Line density',\n lowOptionLabel: 'Low',\n mediumOptionLabel: 'Medium',\n highOptionLabel: 'High',\n handleCallback: (density: string) =>\n this.setState({ tableDensity: density }),\n },\n inputSearch: {\n value: searchValue,\n placeholder: 'Search stuff...',\n onChange: (value: string) =>\n this.setState({ searchValue: value }),\n onClear: () => this.setState({ searchValue: null }),\n onSubmit: () => {},\n },\n download: {\n label: 'Export',\n handleCallback: () => alert('Callback()'),\n },\n upload: {\n label: 'Import',\n handleCallback: () => alert('Callback()'),\n },\n fields: {\n label: 'Toggle visible fields',\n showAllLabel: 'Show All',\n hideAllLabel: 'Hide All',\n },\n extraActions: {\n label: 'More options',\n actions: [\n {\n label: 'An action',\n handleCallback: () => alert('An action'),\n },\n {\n label: 'Another action',\n handleCallback: () => alert('Another action'),\n },\n {\n label: 'A third action',\n handleCallback: () => alert('A third action'),\n },\n ],\n },\n newLine: {\n label: 'New',\n handleCallback: () => alert('handle new line callback'),\n },\n }}\n filters={{\n alwaysVisibleFilters: ['name', 'email'],\n statements: filterStatements,\n onChangeStatements: (newStatements: string) =>\n this.setState({ filterStatements: newStatements }),\n clearAllFiltersButtonLabel: 'Clear Filters',\n collapseLeft: true,\n options: {\n name: {\n label: 'Name',\n ...this.simpleInputVerbsAndLabel(),\n },\n email: {\n label: 'Email',\n ...this.simpleInputVerbsAndLabel(),\n },\n streetAddress: {\n label: 'Street Address',\n ...this.simpleInputVerbsAndLabel(),\n },\n cityStateZipAddress: {\n label: 'City State Zip',\n ...this.simpleInputVerbsAndLabel(),\n },\n },\n }}\n totalizers={[\n {\n label: 'Sales',\n value: '420.763',\n icon: <IconShoppingCart size={14} />,\n },\n {\n label: 'Cash in',\n value: 'R$ 890.239,05',\n iconBackgroundColor: '#eafce3',\n icon: <IconArrowUp color=\"#79B03A\" size={14} />,\n },\n\n {\n label: 'Cash out',\n value: '- R$ 13.485,26',\n icon: <IconArrowDown size={14} />,\n },\n ]}\n bulkActions={{\n texts: {\n secondaryActionsLabel: 'Actions',\n rowsSelected: (qty: any) => (\n <Fragment>Selected rows: {qty}</Fragment>\n ),\n selectAll: 'Select all',\n allRowsSelected: (qty: any) => (\n <Fragment>All rows selected: {qty}</Fragment>\n ),\n },\n totalItems: 100,\n main: {\n label: 'Send email',\n handleCallback: (_params: any) => alert('TODO: SHOW EMAIL FORM'),\n },\n others: [\n {\n label: 'Delete',\n handleCallback: (params: any) => console.warn(params),\n },\n ],\n }}\n />\n </div>\n )\n }\n}\n\nexport default withRuntimeContext(UsersTable)\n\n```" } ]
code_micro_bc641866
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/package.json from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"simple\",\n \"version\": \"1.1.1-alpha.17\",\n \"license\": \"MIT\",\n \"micro\": {\n \"plugins\": [\n \"@vtex/micro-core\",\n \"@vtex/micro-css\",\n \"@vtex/micro-react\",\n \"@vtex/micro-assets\",\n \"@vtex/micro-react-intl\",\n \"@vtex/micro-react-router\"\n ]\n },\n \"private\": true,\n \"scripts\": {\n \"build\": \"yarn run micro build\",\n \"watch\": \"yarn run micro link\",\n \"clean\": \"rm -r dist\",\n \"prepublish\": \"yarn build\"\n },\n \"main\": \"./dist/build/cjs/index.js\",\n \"types\": \"./.micro/onBuild/cjs/index.js\",\n \"module\": \"./dist/build/es6/components/index.js\",\n \"browser\": \"./components/index.ts\",\n \"dependencies\": {\n \"@loadable/component\": \"^5.12.0\",\n \"@vtex/micro-assets\": \"^1.1.1-alpha.17\",\n \"@vtex/micro-cli\": \"^1.1.1-alpha.17\",\n \"@vtex/micro-core\": \"^1.1.1-alpha.16\",\n \"@vtex/micro-css\": \"^1.1.1-alpha.17\",\n \"@vtex/micro-react\": \"^1.1.1-alpha.17\",\n \"@vtex/micro-react-intl\": \"^1.1.1-alpha.17\",\n \"@vtex/micro-react-router\": \"^1.1.1-alpha.17\",\n \"react\": \"^16.13.1\",\n \"react-dom\": \"^16.13.1\",\n \"react-prerendered-component\": \"^1.2.4\",\n \"vtex-tachyons\": \"^3.2.0\",\n \"webpack-blocks\": \"^2.1.0\"\n },\n \"devDependencies\": {\n \"@types/loadable__component\": \"^5.10.0\",\n \"@types/node\": \"^13.13.4\",\n \"@types/react\": \"^16.9.34\",\n \"@types/react-dom\": \"^16.9.7\",\n \"@types/uikit\": \"^3.3.0\",\n \"@types/webpack-blocks\": \"^2.0.0\",\n \"typescript\": \"^3.8.3\"\n }\n}\n\n```" } ]
code_micro_262695cf
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/asyncPages.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable, { LoadableComponent } from '@loadable/component'\nimport { AsyncPageProps } from '@vtex/micro-react-router'\n\nexport const AsyncPages: LoadableComponent<any> = loadable<AsyncPageProps>(\n ({ name }) => import(`./pages/${name}`),\n { ssr: false }\n)\n\nexport const AsyncImport = /* #__LOADABLE__ */ ({ name }: { name: string }) => import(`./pages/${name}`)\n\n```" } ]
code_micro_2cba2c8d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/footer.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport { HeaderProps, LinkServer } from './header'\n\ntype Props = Pick<HeaderProps, 'Link'>\n\nconst Footer: React.SFC<Props> = ({ Link = LinkServer }) => (\n <footer>\n <div>This is the footer</div>\n <ul>\n <li><Link className=\"link dim rebel-pink dib mr3\" to='/'>Home</Link></li>\n <li><Link className=\"link dim rebel-pink dib mr3\" to='/about'>About</Link></li>\n <li><Link className=\"link dim rebel-pink dib mr3\" to='/product'>product</Link></li>\n <li><Link className=\"link dim rebel-pink dib mr3\" to='/reactOnly'>react only</Link></li>\n </ul>\n </footer>\n)\n\nexport default Footer\n\n```" } ]
code_micro_a9966515
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/layout.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable from '@loadable/component'\nimport React, { Fragment } from 'react'\n\nimport { Header, HeaderProps } from './header'\nimport { Loading } from './loading'\n\nconst Footer = loadable(() => import(\n /* webpackChunkName: \"Footer\" */\n './footer'\n))\n\ntype Props = HeaderProps & {\n NavLink: HeaderProps['Link']\n}\n\nexport const Layout: React.SFC<Props> = ({ menu, children, NavLink, Link }) => (\n <Fragment>\n <Header menu={menu} Link={NavLink}/>\n { children }\n <Footer Link={Link} fallback={<Loading/>} />\n </Fragment>\n)\n\n```" } ]
code_micro_efc8a5b4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/placeholder.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nexport const PlaceHolder: React.SFC = () => {\n return (\n <ul>\n {\n [...Array(9)].map((_, index) => (\n <li key={index}>\n Lorem ipsum dolor sit amet, consectetur adipisicing elit.\n </li>\n ))\n }\n </ul>\n )\n}\n\n```" } ]
code_micro_371d633d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/Header.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\ninterface LinkProps {\n to: string\n className: string\n activeClassName?: string\n}\n\nexport const LinkServer: React.SFC<LinkProps> = ({ to, className, children }) => (\n <a href={to} className={className}>{children}</a>\n)\n\nexport interface HeaderProps {\n Link?: React.SFC<LinkProps>\n menu: Record<string, string>\n}\n\nexport const Header: React.SFC<HeaderProps> = ({ menu, Link = LinkServer }) => {\n return (\n <header className=\"bg-rebel-pink fixed w-100 ph3 pv3 pv4-ns ph4-m ph5-l\">\n <div>this is the header. The data in the menu comes from a server side fetching</div>\n <nav className=\"f6 fw6 ttu tracked\">\n {Object.entries(menu).map(([key, value]) => (\n <Link key={key} className=\"link dim white dib mr3\" activeClassName=\"link:hover\" to={key}>{value}</Link>\n ))}\n </nav>\n </header>\n )\n}\n\n```" } ]
code_micro_6bf0e3c1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/loading.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nexport const Loading: React.SFC = () => <div>loading...</div>\n\n```" } ]
code_micro_143aca03
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/hugeComponent1.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Fragment } from 'react'\n\nconst HugeComponent: React.SFC = () => {\n return (\n <Fragment>\n <ul>\n {[...Array(100)].map((_, index) => (<li key={index}>Etiam luctus laoreet erat, nec laoreet augue malesuada ut.</li>))}\n </ul>\n </Fragment>\n )\n}\n\nexport default HugeComponent\n\n```" } ]
code_micro_b0228e65
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/hugeComponent2.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { Fragment } from 'react'\n\nconst HugeComponent: React.SFC = () => {\n return (\n <Fragment>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec efficitur finibus orci, in varius metus convallis ut. Etiam sollicitudin, nisl non tempus ultrices, nisl ipsum luctus est, a bibendum ante sapien vitae dolor. Duis tempus turpis sed eros tincidunt, id consectetur arcu laoreet. Duis mollis ultricies diam, iaculis ullamcorper eros placerat vel. Etiam eu sodales ligula. Donec a dui lorem. Vivamus condimentum, felis sed sodales gravida, arcu libero pretium justo, sed sodales metus eros a erat. Nam consectetur id sem id porttitor. Nam at pellentesque nisl.\n </p>\n <p>\n Nam et nulla at risus ornare elementum. Etiam luctus laoreet erat, nec laoreet augue malesuada ut. Proin tortor nisi, aliquam nec condimentum sed, blandit eget diam. Vivamus mattis volutpat maximus. Donec faucibus non mi vel efficitur. Donec ultricies at elit a dignissim. Suspendisse eu ipsum at erat rhoncus tempus interdum ac nulla.\n </p>\n <p>\n Nullam ac tellus eu urna convallis consequat. Suspendisse iaculis, purus et aliquam gravida, sapien mi viverra massa, nec viverra quam nibh iaculis ligula. Maecenas tristique purus erat, in vulputate nunc cursus eu. Ut sodales vel dui aliquam malesuada. Nunc at sapien risus. Praesent sit amet nibh justo. Aliquam risus metus, imperdiet quis molestie in, gravida vitae dui. Suspendisse dapibus lacus consequat nisi vehicula, fermentum faucibus ligula elementum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean vitae pharetra sapien, in volutpat lacus. Nam pulvinar, velit eu laoreet ultricies, leo augue scelerisque ipsum, et porttitor sem neque aliquam sapien.\n </p>\n <p>\n Aliquam vel vehicula est. Fusce facilisis justo quis neque molestie ultrices. Fusce facilisis eu tortor at tempor. Vivamus sit amet quam sed quam finibus consequat sit amet non risus. Fusce euismod sollicitudin viverra. Donec tincidunt consequat diam sed lacinia. Fusce ultrices ut eros non aliquet. Curabitur tristique pharetra dapibus. Sed id vulputate nibh. Quisque aliquam sapien sed blandit dictum. Sed metus eros, suscipit eu lorem vel, pellentesque laoreet ante. Nunc sed turpis elit. Aenean quis placerat mauris, ornare rutrum nulla.\n </p>\n <p>\n Ut lacus libero, auctor a nunc quis, euismod interdum quam. Etiam a aliquam libero. Vestibulum ligula ligula, accumsan ac erat id, iaculis laoreet mauris. Aliquam sed orci nec nisl feugiat pulvinar at non urna. Aliquam felis enim, porttitor id hendrerit convallis, cursus a lacus. Nullam eget elit volutpat, efficitur ante ac, euismod lacus. Sed a mi auctor velit sagittis pellentesque et a metus. Praesent tristique et odio et auctor. Cras congue consectetur ex ac venenatis. Donec fermentum commodo fermentum. Mauris quam tortor, cursus nec justo sodales, ultricies tempor urna.\n </p>\n </Fragment>\n )\n}\n\nexport default HugeComponent\n\n```" } ]
code_micro_5133b256
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/pages/home.pt.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'vtex-tachyons/tachyons.css'\n\nimport { LoadMicroComponent } from '@vtex/micro-react'\nimport { withIntlProvider } from '@vtex/micro-react-intl'\nimport { withRouter } from '@vtex/micro-react-router'\n\nimport { AsyncImport } from '../components/asyncPages'\nimport Page from '../components/pages/home'\nimport messages from '../messages/pt.json'\n\nexport default LoadMicroComponent(\n withIntlProvider(\n withRouter(Page, AsyncImport),\n messages,\n 'pt'\n )\n)\n\n```" } ]
code_micro_ef42cda2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/pages/product.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'vtex-tachyons/tachyons.css'\n\nimport { LoadMicroComponent } from '@vtex/micro-react'\nimport { withRouter } from '@vtex/micro-react-router'\n\nimport Page from '../components/pages/product'\nimport { AsyncImport } from '../components/asyncPages'\n\nexport default LoadMicroComponent(withRouter(Page, AsyncImport))\n\n```" } ]
code_micro_b60b449f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/pages/404.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'vtex-tachyons/tachyons.css'\n\nimport { LoadMicroComponent } from '@vtex/micro-react'\nimport { withRouter } from '@vtex/micro-react-router'\n\nimport Page from '../components/pages/404'\nimport { AsyncImport } from '../components/asyncPages'\n\nexport default LoadMicroComponent(withRouter(Page, AsyncImport))\n\n```" } ]
code_micro_8c1698d9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/pages/search.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'vtex-tachyons/tachyons.css'\n\nimport { LoadMicroComponent } from '@vtex/micro-react'\nimport { withRouter } from '@vtex/micro-react-router'\n\nimport Page from '../components/pages/search'\nimport { AsyncImport } from '../components/asyncPages'\n\nexport default LoadMicroComponent(withRouter(Page, AsyncImport))\n\n```" } ]
code_micro_165a081a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/pages/500.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'vtex-tachyons/tachyons.css'\n\nimport { LoadMicroComponent } from '@vtex/micro-react'\nimport { withRouter } from '@vtex/micro-react-router'\n\nimport Page from '../components/pages/500'\nimport { AsyncImport } from '../components/asyncPages'\n\nexport default LoadMicroComponent(withRouter(Page, AsyncImport))\n\n```" } ]
code_micro_c70a3934
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/pages/reactOnly.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'vtex-tachyons/tachyons.css'\n\nimport { LoadMicroComponent } from '@vtex/micro-react'\n\nimport Page from '../components/pages/reactOnly'\n\nexport default LoadMicroComponent(Page)\n\n```" } ]
code_micro_420013bb
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/pages/home.en.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'vtex-tachyons/tachyons.css'\n\nimport { LoadMicroComponent } from '@vtex/micro-react'\nimport { withRouter } from '@vtex/micro-react-router'\nimport { withIntlProvider } from '@vtex/micro-react-intl'\n\nimport { AsyncImport } from '../components/asyncPages'\nimport Page from '../components/pages/home'\nimport messages from '../messages/en.json'\n\nexport default LoadMicroComponent(\n withIntlProvider(\n withRouter(Page, AsyncImport),\n messages,\n 'en'\n )\n)\n\n```" } ]
code_micro_c19bdfa6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/pages/about.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport 'vtex-tachyons/tachyons.css'\n\nimport { LoadMicroComponent } from '@vtex/micro-react'\nimport { withRouter } from '@vtex/micro-react-router'\n\nimport Page from '../components/pages/about'\nimport { AsyncImport } from '../components/asyncPages'\n\nexport default LoadMicroComponent(withRouter(Page, AsyncImport))\n\n```" } ]
code_micro_9875bfce
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/router/index.ts from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { Router } from '@vtex/micro'\nimport { pack } from '@vtex/micro-react-router'\n\nconst removeSlash = (x: string) => x.startsWith('/') ? x.slice(1) : x\n\nconst menu = {\n '/': 'Home',\n '/about': 'About',\n '/500': '500',\n '/404': '404'\n}\n\nconst locales = new Set(['en', 'pt'])\n\nconst router: Router<any> = async request => {\n const { path, query } = request\n const locale = locales.has(query.locale) ? query.locale : undefined\n const name = path === '/' ? 'home' : removeSlash(path)\n\n const resolved = {\n name: locale ? `${name}.${locale}` : name,\n data: { menu },\n status: 200\n }\n\n return pack(resolved, path)\n}\n\nexport default router\n\n```" } ]
code_micro_5b9e57ca
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/plugins/onAssemble/index.ts from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { OnAssemblePlugin } from '@vtex/micro'\nimport { Block, Context, group } from 'webpack-blocks'\nimport { htmlTags, purgeCSS } from '@vtex/micro-css'\n\nexport default class OnAssemble extends OnAssemblePlugin {\n public getConfig = async (config: Block<Context>): Promise<Block<Context>> => {\n return group([\n config,\n purgeCSS({\n whitelist: () => htmlTags\n })\n ])\n }\n}\n\n```" } ]
code_micro_8c0250c3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/pages/product.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable from '@loadable/component'\nimport React from 'react'\nimport { NavLink, Link } from '@vtex/micro-react-router'\n\nimport { PlaceHolder } from '../placeholder'\nimport { Layout } from '../layout'\nimport { Loading } from '../loading'\n\nconst BelowTheFold = loadable(() => import(\n /* webpackChunkName: \"BelowTheFold\" */\n /* webpackPreload: true */\n '../hugeComponent1'\n), { ssr: false })\n\ninterface Props {\n data: {\n menu: Record<string, string>\n }\n error: any\n}\n\nconst Page: React.SFC<Props> = ({ data }) => {\n const { menu } = data\n return (\n <Layout menu={menu} NavLink={NavLink} Link={Link}>\n <PlaceHolder />\n <BelowTheFold fallback={<Loading/>}/>\n </Layout>\n )\n}\n\nexport default Page\n\n```" } ]
code_micro_33c8bf2c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/pages/404.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable from '@loadable/component'\nimport React from 'react'\nimport { NavLink, Link } from '@vtex/micro-react-router'\n\nimport { PlaceHolder } from '../placeholder'\nimport { Layout } from '../layout'\nimport { Loading } from '../loading'\n\nconst BelowTheFold = loadable(() => import(\n /* webpackChunkName: \"BelowTheFold\" */\n /* webpackPreload: true */\n '../hugeComponent1'\n), { ssr: false })\n\ninterface Props {\n data: {\n menu: Record<string, string>\n }\n error: any\n}\n\nconst Page: React.SFC<Props> = ({ data }) => {\n const { menu } = data\n return (\n <Layout menu={menu} NavLink={NavLink} Link={Link}>\n <PlaceHolder />\n <BelowTheFold fallback={<Loading/>}/>\n </Layout>\n )\n}\n\nexport default Page\n\n```" } ]
code_micro_19e2f54a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/pages/home.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable from '@loadable/component'\nimport React from 'react'\nimport { NavLink, Link } from '@vtex/micro-react-router'\nimport { FormattedMessage } from '@vtex/micro-react-intl'\n\nimport { PlaceHolder } from '../placeholder'\nimport { Layout } from '../layout'\nimport { Loading } from '../loading'\n\nconst BelowTheFold = loadable(() => import(\n /* webpackChunkName: \"BelowTheFold\" */\n /* webpackPreload: true */\n '../hugeComponent1'\n), { ssr: false })\n\ninterface Props {\n data: {\n menu: Record<string, string>\n }\n error: any\n}\n\nconst Page: React.SFC<Props> = ({ data }) => {\n const { menu } = data\n return (\n <Layout menu={menu} NavLink={NavLink} Link={Link}>\n <PlaceHolder />\n <FormattedMessage id='greeting' />\n <BelowTheFold fallback={<Loading/>}/>\n </Layout>\n )\n}\n\nexport default Page\n\n```" } ]
code_micro_a6b74e2c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/pages/search.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable from '@loadable/component'\nimport { NavLink, Link } from '@vtex/micro-react-router'\nimport React from 'react'\n\nimport { Layout } from '../layout'\nimport { Loading } from '../loading'\nimport { PlaceHolder } from '../placeholder'\n\nconst BelowTheFold = loadable(() => import(\n /* webpackChunkName: \"BelowTheFold\" */\n /* webpackPreload: true */\n '../hugeComponent1'\n), { ssr: false })\n\ninterface Props {\n data: {\n menu: Record<string, string>\n }\n error: any\n}\n\nconst Page: React.SFC<Props> = ({ data }) => {\n const { menu } = data\n return (\n <Layout menu={menu} NavLink={NavLink} Link={Link}>\n <PlaceHolder />\n <BelowTheFold fallback={<Loading/>}/>\n </Layout>\n )\n}\n\nexport default Page\n\n```" } ]
code_micro_ca24e4c3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/pages/500.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable from '@loadable/component'\nimport React from 'react'\nimport { NavLink, Link } from '@vtex/micro-react-router'\n\nimport { PlaceHolder } from '../placeholder'\nimport { Layout } from '../layout'\nimport { Loading } from '../loading'\n\nconst BelowTheFold = loadable(() => import(\n /* webpackChunkName: \"BelowTheFold\" */\n /* webpackPreload: true */\n '../hugeComponent1'\n), { ssr: false })\n\ninterface Props {\n data: {\n menu: Record<string, string>\n }\n error: any\n}\n\nconst Page: React.SFC<Props> = ({ data }) => {\n const { menu } = data\n return (\n <Layout menu={menu} NavLink={NavLink} Link={Link}>\n <PlaceHolder />\n <BelowTheFold fallback={<Loading/>}/>\n </Layout>\n )\n}\n\nexport default Page\n\n```" } ]
code_micro_1c29bd38
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/pages/reactOnly.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable from '@loadable/component'\nimport React from 'react'\n\nimport { LinkServer } from '../header'\nimport { Layout } from '../layout'\nimport { Loading } from '../loading'\nimport { PlaceHolder } from '../placeholder'\n\nconst BelowTheFold = loadable(() => import(\n /* webpackChunkName: \"BelowTheFold\" */\n /* webpackPreload: true */\n '../hugeComponent1'\n), { ssr: false })\n\ninterface Props {\n data: {\n menu: Record<string, string>\n }\n error: any\n}\n\nconst Page: React.SFC<Props> = ({ data }) => {\n const { menu } = data\n return (\n <Layout menu={menu} Link={LinkServer}>\n <PlaceHolder />\n <BelowTheFold fallback={<Loading/>}/>\n </Layout>\n )\n}\n\nexport default Page\n\n```" } ]
code_micro_ff1f3b76
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/examples/simple/components/pages/about.tsx from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport loadable from '@loadable/component'\nimport React from 'react'\nimport { NavLink, Link } from '@vtex/micro-react-router'\n\nimport Huge from '../hugeComponent1'\nimport { Layout } from '../layout'\nimport { Loading } from '../loading'\n\nconst BelowTheFold = loadable(() => import(\n /* webpackChunkName: \"BelowTheFold\" */\n /* webpackPreload: true */\n '../hugeComponent2'\n), { ssr: false })\n\ninterface Props {\n data: {\n menu: Record<string, string>\n }\n error: any\n}\n\nconst Page: React.SFC<Props> = ({ data }) => {\n const { menu } = data\n return (\n <Layout menu={menu} NavLink={NavLink} Link={Link}>\n <Huge />\n <BelowTheFold fallback={<Loading/>}/>\n </Layout>\n )\n}\n\nexport default Page\n\n```" } ]
code_micro_965e8399
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-react-intl/package.json from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"@vtex/micro-react-intl\",\n \"version\": \"1.1.1-alpha.17\",\n \"license\": \"MIT\",\n \"micro\": {\n \"plugins\": [\n \"@vtex/micro-core\",\n \"@vtex/micro-react\"\n ]\n },\n \"scripts\": {\n \"build\": \"yarn run micro build\",\n \"watch\": \"yarn run micro link\",\n \"clean\": \"rm -r dist\",\n \"prepublish\": \"yarn build\"\n },\n \"main\": \"./dist/build/cjs/index.js\",\n \"module\": \"./dist/build/es6/components/index.js\",\n \"browser\": \"./components/index.ts\",\n \"dependencies\": {\n \"@vtex/micro-core\": \"^1.1.1-alpha.16\",\n \"@vtex/micro-react\": \"^1.1.1-alpha.17\",\n \"babel-plugin-react-intl\": \"^7.5.14\",\n \"intl-messageformat-parser\": \"^5.0.10\",\n \"react-intl\": \"^4.6.0\",\n \"webpack-blocks\": \"^2.1.0\"\n },\n \"devDependencies\": {\n \"@types/react\": \"^16.9.35\",\n \"@types/react-intl\": \"^3.0.0\",\n \"@types/webpack-blocks\": \"^2.0.0\",\n \"@vtex/micro-cli\": \"^1.1.1-alpha.17\"\n },\n \"peerDependencies\": {\n \"@loadable/component\": \"*\",\n \"react\": \"*\",\n \"react-dom\": \"*\"\n }\n}\n\n```" } ]
code_micro_6b56704d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-react-intl/index.ts from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport * from './components'\nexport * from './plugins/bundle'\nexport * from './plugins/serve'\n\n```" } ]
code_micro_261757cf
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-css/package.json from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"@vtex/micro-css\",\n \"version\": \"1.1.1-alpha.17\",\n \"license\": \"MIT\",\n \"micro\": {\n \"plugins\": [\n \"@vtex/micro-core\"\n ]\n },\n \"scripts\": {\n \"build\": \"yarn run micro build\",\n \"watch\": \"yarn run micro link\",\n \"clean\": \"rm -r dist\",\n \"prepublish\": \"yarn build\"\n },\n \"main\": \"./dist/build/cjs/index.js\",\n \"module\": \"./dist/build/es6/components/index.js\",\n \"browser\": \"./components/index.ts\",\n \"dependencies\": {\n \"@vtex/micro-core\": \"^1.1.1-alpha.16\",\n \"babel-plugin-ignore-html-and-css-imports\": \"^0.0.2\",\n \"css-loader\": \"^3.5.3\",\n \"mini-css-extract-plugin\": \"^0.9.0\",\n \"optimize-css-assets-webpack-plugin\": \"^5.0.3\",\n \"purgecss-webpack-plugin\": \"^2.2.0\",\n \"terser-webpack-plugin\": \"^3.0.1\",\n \"webpack\": \"^4.43.0\",\n \"webpack-blocks\": \"^2.1.0\"\n },\n \"devDependencies\": {\n \"@types/babel__core\": \"^7.1.7\",\n \"@types/mini-css-extract-plugin\": \"^0.9.1\",\n \"@types/optimize-css-assets-webpack-plugin\": \"^5.0.1\",\n \"@types/terser-webpack-plugin\": \"^2.2.0\",\n \"@types/webpack\": \"^4.41.12\",\n \"@types/webpack-blocks\": \"^2.0.0\",\n \"@vtex/micro-cli\": \"^1.1.1-alpha.17\",\n \"typescript\": \"^3.8.3\"\n }\n}\n\n```" } ]
code_micro_1704e56e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-css/index.ts from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport * from './plugins/bundle/modules/purgeCSS'\nexport * from './plugins/bundle/modules/htmlTags'\n\n```" } ]
code_micro_4857c25f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-server/package.json from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"@vtex/micro-server\",\n \"version\": \"1.1.1-alpha.16\",\n \"license\": \"MIT\",\n \"types\": \"./index.ts\",\n \"main\": \"./dist/build/cjs/index.js\",\n \"module\": \"./dist/build/es6/components/index.js\",\n \"browser\": \"./components/index.ts\",\n \"micro\": {\n \"plugins\": {}\n },\n \"scripts\": {\n \"build\": \"yarn run tsc\",\n \"watch\": \"yarn run tsc --watch\",\n \"clean\": \"rm -r .micro\",\n \"prepublish\": \"yarn build\"\n },\n \"dependencies\": {\n \"@vtex/micro-core\": \"^1.1.1-alpha.16\",\n \"@yarnpkg/fslib\": \"^2.0.0-rc.20\",\n \"@yarnpkg/libzip\": \"^2.0.0-rc.11\",\n \"compression\": \"^1.7.4\",\n \"cookie\": \"^0.4.1\",\n \"express\": \"next\",\n \"fs-extra\": \"^9.0.0\",\n \"mime-types\": \"^2.1.27\",\n \"morgan\": \"^1.10.0\",\n \"pretty\": \"^2.0.0\"\n },\n \"devDependencies\": {\n \"@types/compression\": \"^1.7.0\",\n \"@types/cookie\": \"^0.3.3\",\n \"@types/express\": \"^4.17.6\",\n \"@types/fs-extra\": \"^9.0.1\",\n \"@types/loadable__server\": \"^5.12.1\",\n \"@types/mime-types\": \"^2.1.0\",\n \"@types/morgan\": \"^1.9.0\",\n \"@types/pnpapi\": \"^0.0.0\",\n \"@types/pretty\": \"^2.0.0\",\n \"@types/webpack\": \"^4.41.12\",\n \"@types/webpack-dev-middleware\": \"^3.7.0\",\n \"typescript\": \"^3.8.3\"\n }\n}\n\n```" } ]
code_micro_859c224d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-cli/package.json from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"@vtex/micro-cli\",\n \"version\": \"1.1.1-alpha.17\",\n \"license\": \"MIT\",\n \"main\": \"./dist/build/cjs/index.js\",\n \"module\": \"./dist/build/es6/index.js\",\n \"browser\": \"./components/index.ts\",\n \"bin\": {\n \"micro\": \"./dist/build/cjs/lib/index.js\"\n },\n \"scripts\": {\n \"build\": \"yarn run tsc\",\n \"watch\": \"yarn run tsc --watch\",\n \"clean\": \"rm -r dist\",\n \"prepublish\": \"yarn build\"\n },\n \"dependencies\": {\n \"@babel/core\": \"^7.9.6\",\n \"@types/babel__core\": \"^7.1.7\",\n \"@vtex/micro-core\": \"^1.1.1-alpha.16\",\n \"@vtex/micro-server\": \"^1.1.1-alpha.16\",\n \"chalk\": \"^4.0.0\",\n \"chokidar\": \"^3.4.0\",\n \"findhelp\": \"^1.1.0\",\n \"fs-extra\": \"^9.0.0\",\n \"glob\": \"^7.1.6\",\n \"minimist\": \"^1.2.5\",\n \"open\": \"^7.0.4\",\n \"ramda\": \"^0.27.0\",\n \"webpack\": \"^4.43.0\"\n },\n \"devDependencies\": {\n \"@types/chalk\": \"^2.2.0\",\n \"@types/chokidar\": \"^2.1.3\",\n \"@types/fs-extra\": \"^8.1.0\",\n \"@types/glob\": \"^7.1.1\",\n \"@types/open\": \"^6.2.1\",\n \"@types/ramda\": \"^0.27.4\",\n \"@types/webpack\": \"^4.41.12\",\n \"nodemon\": \"^2.0.3\",\n \"typescript\": \"^3.8.3\"\n }\n}\n\n```" } ]
code_micro_51be4e35
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-react/package.json from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"@vtex/micro-react\",\n \"version\": \"1.1.1-alpha.17\",\n \"license\": \"MIT\",\n \"micro\": {\n \"plugins\": [\n \"@vtex/micro-core\",\n \"@vtex/micro-react\"\n ]\n },\n \"scripts\": {\n \"build\": \"yarn run micro build\",\n \"watch\": \"yarn run micro link\",\n \"clean\": \"rm -r dist\",\n \"prepublish\": \"yarn build\"\n },\n \"main\": \"./dist/build/cjs/index.js\",\n \"module\": \"./dist/build/es6/components/index.js\",\n \"browser\": \"./components/index.ts\",\n \"dependencies\": {\n \"@babel/core\": \"^7.9.6\",\n \"@babel/plugin-proposal-class-properties\": \"^7.8.3\",\n \"@babel/plugin-proposal-optional-chaining\": \"^7.9.0\",\n \"@babel/plugin-syntax-dynamic-import\": \"^7.8.3\",\n \"@babel/preset-env\": \"^7.9.6\",\n \"@babel/preset-react\": \"^7.9.4\",\n \"@babel/preset-typescript\": \"^7.9.0\",\n \"@hot-loader/react-dom\": \"^16.13.0\",\n \"@loadable/babel-plugin\": \"^5.12.0\",\n \"@loadable/server\": \"^5.12.0\",\n \"@loadable/webpack-plugin\": \"^5.12.0\",\n \"@vtex/micro-core\": \"^1.1.1-alpha.16\",\n \"babel-loader\": \"^8.1.0\",\n \"css-loader\": \"^3.5.3\",\n \"exenv\": \"^1.2.2\",\n \"file-loader\": \"^6.0.0\",\n \"fs-extra\": \"^9.0.0\",\n \"mini-css-extract-plugin\": \"^0.9.0\",\n \"optimize-css-assets-webpack-plugin\": \"^5.0.3\",\n \"pnp-webpack-plugin\": \"^1.6.4\",\n \"purgecss-webpack-plugin\": \"^2.2.0\",\n \"terser-webpack-plugin\": \"^3.0.1\",\n \"time-fix-plugin\": \"^2.0.6\",\n \"webpack\": \"^4.43.0\",\n \"webpack-blocks\": \"^2.1.0\",\n \"webpack-dynamic-public-path\": \"^1.0.5\",\n \"webpack-messages\": \"^2.0.4\"\n },\n \"devDependencies\": {\n \"@types/babel__core\": \"^7.1.7\",\n \"@types/exenv\": \"^1.2.0\",\n \"@types/fs-extra\": \"^9.0.1\",\n \"@types/loadable__component\": \"^5.10.0\",\n \"@types/loadable__server\": \"^5.12.1\",\n \"@types/loadable__webpack-plugin\": \"^5.7.0\",\n \"@types/mini-css-extract-plugin\": \"^0.9.1\",\n \"@types/optimize-css-assets-webpack-plugin\": \"^5.0.1\",\n \"@types/react\": \"^16.9.35\",\n \"@types/react-dom\": \"^16.9.7\",\n \"@types/terser-webpack-plugin\": \"^2.2.0\",\n \"@types/webpack\": \"^4.41.12\",\n \"@types/webpack-blocks\": \"^2.0.0\",\n \"@vtex/micro-cli\": \"^1.1.1-alpha.17\",\n \"typescript\": \"^3.8.3\"\n },\n \"peerDependencies\": {\n \"@loadable/component\": \"*\",\n \"react\": \"*\",\n \"react-dom\": \"*\"\n }\n}\n\n```" } ]
code_micro_95b76da5
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-react/index.ts from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport * from './components'\nexport * from './plugins/bundle/modules/purgeCSS'\nexport * from './plugins/bundle/modules/cacheGroups'\n\n```" } ]
code_micro_373ecb87
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-core/package.json from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"@vtex/micro-core\",\n \"version\": \"1.1.1-alpha.16\",\n \"license\": \"MIT\",\n \"micro\": {\n \"plugins\": []\n },\n \"scripts\": {\n \"build\": \"yarn run tsc\",\n \"watch\": \"yarn run tsc --watch\",\n \"clean\": \"rm -r dist\",\n \"prepublish\": \"yarn build\"\n },\n \"main\": \"./dist/build/cjs/index.js\",\n \"module\": \"./dist/build/es6/components/index.js\",\n \"browser\": \"./components/index.ts\",\n \"dependencies\": {\n \"@babel/core\": \"^7.10.1\",\n \"@babel/plugin-proposal-class-properties\": \"^7.10.1\",\n \"@babel/plugin-proposal-optional-chaining\": \"^7.10.1\",\n \"@babel/preset-env\": \"^7.10.1\",\n \"@babel/preset-typescript\": \"^7.10.1\",\n \"@yarnpkg/fslib\": \"^2.0.0-rc.20\",\n \"@yarnpkg/libzip\": \"^2.0.0-rc.11\",\n \"fs-extra\": \"^9.0.0\",\n \"globby\": \"^11.0.0\",\n \"pnpapi\": \"^0.0.0\",\n \"ramda\": \"^0.27.0\",\n \"webpack\": \"^4.43.0\",\n \"webpack-blocks\": \"^2.1.0\"\n },\n \"devDependencies\": {\n \"@types/babel__core\": \"^7.1.7\",\n \"@types/fs-extra\": \"^8.1.0\",\n \"@types/globby\": \"^9.1.0\",\n \"@types/pnpapi\": \"^0.0.0\",\n \"@types/ramda\": \"^0.27.4\",\n \"@types/webpack\": \"^4.41.12\",\n \"@types/webpack-blocks\": \"^2.0.0\",\n \"typescript\": \"^3.8.3\"\n }\n}\n\n```" } ]
code_micro_8dc49d58
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of micro/packages/micro-assets/package.json from the micro VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```json\n{\n \"name\": \"@vtex/micro-assets\",\n \"version\": \"1.1.1-alpha.17\",\n \"license\": \"MIT\",\n \"micro\": {\n \"plugins\": [\n \"@vtex/micro-core\"\n ]\n },\n \"scripts\": {\n \"build\": \"yarn run micro build\",\n \"watch\": \"yarn run micro link\",\n \"clean\": \"rm -r dist\",\n \"prepublish\": \"yarn build\"\n },\n \"main\": \"./dist/build/cjs/index.js\",\n \"module\": \"./dist/build/es6/components/index.js\",\n \"browser\": \"./components/index.ts\",\n \"dependencies\": {\n \"@vtex/micro-core\": \"^1.1.1-alpha.16\",\n \"babel-plugin-inline-json-import\": \"^0.3.2\",\n \"babel-plugin-transform-remove-imports\": \"^1.3.2\",\n \"webpack-blocks\": \"^2.1.0\"\n },\n \"devDependencies\": {\n \"@types/babel__core\": \"^7.1.7\",\n \"@types/webpack\": \"^4.41.12\",\n \"@types/webpack-blocks\": \"^2.0.0\",\n \"@vtex/micro-cli\": \"^1.1.1-alpha.17\",\n \"typescript\": \"^3.8.3\"\n }\n}\n\n```" } ]