id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_store-indexer_1882883a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/typings/global.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { EventContext, RecorderState, Tenant } from '@vtex/api'\nimport { InternalInput, RouteLocator } from 'vtex.rewriter'\n\nimport { Clients } from '../clients'\nimport { Settings } from '../middlewares/settings'\n\nexport type Context = EventContext<Clients, State>\n\nexport interface State extends RecorderState {\n searchURLs: Array<{ path: string; canonicalPath?: string }>\n settings: Settings\n tenantInfo: Tenant\n internals?: InternalInput[]\n oldRoutes?: RouteLocator[]\n}\n\nexport interface Event {\n appId: string\n key: string\n message: string\n sender: string\n senderName: string\n trigger: string\n buildId: string\n buildCode: string\n routeId: string\n}\n\n```"
}
] |
code_store-indexer_97227552
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/throttle.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { TooManyRequestsError } from '@vtex/api'\n\nimport { Context } from '../typings/global'\n\nconst MAX_REQUEST = 10\nlet COUNTER = 0\n\nexport async function throttle(_: Context, next: () => Promise<void>) {\n COUNTER++\n try {\n if (COUNTER > MAX_REQUEST) {\n throw new TooManyRequestsError()\n }\n await next()\n } finally {\n COUNTER--\n }\n}\n\n```"
}
] |
code_store-indexer_f9066751
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/settings.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { APP } from '@vtex/api'\n\nimport { Context } from '../typings/global'\n\nexport interface Settings {\n numberOfIndexedSearches: number\n usesMultiLanguageSearch: boolean\n resolveBrandMapQueryAs: string\n}\n\nexport const DEFAULT_SETTINGS: Settings = {\n numberOfIndexedSearches: 0,\n resolveBrandMapQueryAs: 'b',\n usesMultiLanguageSearch: false,\n}\n\nexport async function settings(ctx: Context, next: () => Promise<void>) {\n const {\n clients: { apps },\n } = ctx\n\n const appSettings = await apps.getAppSettings(APP.ID)\n ctx.state.settings = { ...DEFAULT_SETTINGS, ...appSettings }\n\n await next()\n}\n\n```"
}
] |
code_store-indexer_e03d3dda
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/tenant.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Context } from '../typings/global'\n\nconst TEN_MINUTES_S = 10 * 60\n\nexport async function tenant(ctx: Context, next: () => Promise<void>) {\n const {\n clients: { tenant: tenantClient },\n } = ctx\n const tenantInfo = await tenantClient.info({\n forceMaxAge: TEN_MINUTES_S,\n })\n\n const locale = tenantInfo.defaultLocale\n\n ctx.state.tenantInfo = tenantInfo\n ctx.vtex.locale = locale\n ctx.vtex.tenant = { locale }\n\n await next()\n}\n\n```"
}
] |
code_store-indexer_97779f69
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/utils/messages.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Messages } from '../clients/messages'\n\ninterface Message {\n content: string\n context: string\n}\n\nexport const createTranslator = (service: Messages) => async (\n from: string,\n to: string,\n messages: Message[]\n) => {\n if (from.toLowerCase() === to.toLowerCase()) {\n return messages.map(({ content }) => content)\n }\n const translations = await service.translateNoCache({\n indexedByFrom: [\n {\n from,\n messages,\n },\n ],\n to,\n })\n return translations\n}\n\n```"
}
] |
code_store-indexer_e72e4129
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/utils/bindings.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Tenant } from '@vtex/api'\nimport { Product } from 'vtex.catalog-graphql'\n\nexport const filterBindingsBySalesChannel = (\n tenantInfo: Tenant,\n salesChannels: Product['salesChannel']\n): Tenant['bindings'] => {\n const salesChannelsSet = salesChannels?.reduce((acc, sc) => {\n if (sc?.id) {\n acc.add(sc.id)\n }\n return acc\n }, new Set<string>())\n\n return tenantInfo.bindings.filter(binding => {\n if (binding.targetProduct === 'vtex-storefront') {\n const bindingSC: number | undefined =\n binding.extraContext.portal?.salesChannel\n const productActiveInBindingSC =\n bindingSC && salesChannelsSet?.has(bindingSC.toString())\n if (productActiveInBindingSC || !salesChannelsSet) {\n return true\n }\n }\n return false\n })\n}\n\nexport const filterStoreBindings = (tenantInfo: Tenant): Tenant['bindings'] =>\n tenantInfo.bindings.filter(\n binding => binding.targetProduct === 'vtex-storefront'\n )\n\n```"
}
] |
code_store-indexer_908ffaaf
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/utils/slugify.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-useless-escape */\n\nexport const slugify = (str: string) =>\n str\n .toLowerCase()\n .normalize('NFD')\n .replace(/([\\u0300-\\u036f]|,)/g, '')\n .replace(/([\\u0020\\u00A0])/g, '-')\n .replace(/(\\u00A0|[*+~.()'\"!:@&\\[\\]`,/ %$#?{}|><=_^])/g, '-')\n\n```"
}
] |
code_store-indexer_b1d20f44
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/utils/internals.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-useless-escape */\nimport { Apps } from '@vtex/api'\nimport RouteParser from 'route-parser'\nimport { InternalInput, RouteLocator } from 'vtex.rewriter'\n\nexport const INDEXED_ORIGIN = `${process.env.VTEX_APP_ID!}:routes-indexing`\nexport const STORE_LOCATOR = 'vtex.store@2.x'\nexport const ROUTES_JSON_PATH = 'dist/vtex.store-indexer/build.json'\n\nexport const PAGE_TYPE_TO_STORE_ENTITIES = {\n Brand: 'brand',\n Category: 'category',\n Department: 'department',\n FullText: null,\n NotFound: null,\n Product: 'product',\n Search: null,\n SubCategory: 'subcategory',\n}\n\nexport const PAGE_TYPES = {\n BRAND: 'brand',\n CATEGORY: 'category',\n DEPARTMENT: 'department',\n PRODUCT: 'product',\n PRODUCT_NOT_FOUND: 'notFoundProduct',\n SEARCH_NOT_FOUND: 'notFoundSearch',\n SUBCATEGORY: 'subcategory',\n}\n\nexport interface ContentTypeDefinition {\n internal: string\n canonical: string\n}\n\nexport interface InternalAndOldRoute {\n internal: InternalInput\n oldRoute: RouteLocator | null\n}\n\nexport type Routes = Record<string, ContentTypeDefinition>\n\ntype PageTypes = typeof PAGE_TYPES[keyof typeof PAGE_TYPES]\n\nexport const routeFormatter = async (apps: Apps, type: PageTypes) => {\n const routesJSON = await apps.getAppJSON<Routes>(\n STORE_LOCATOR,\n ROUTES_JSON_PATH\n )\n routesJSON.subcategory.canonical =\n '/:department/:category/:subcategory(/*terms)'\n const route = routesJSON[type]\n const canonicalParser = new RouteParser(route.canonical)\n return (params?: Record<string, string | undefined> | null) => {\n const path = canonicalParser.reverse(params ?? {})\n if (!path) {\n throw new Error(`Parse error, params: ${params}, path: ${path}`)\n }\n return path\n }\n}\n\nexport const processInternalAndOldRoute = (\n internalsAndOldRoutes: Array<InternalAndOldRoute | null>\n) => {\n return internalsAndOldRoutes.reduce(\n (acc, data) => {\n if (data === null) {\n return acc\n }\n const { internal, oldRoute } = data\n acc.internals.push(internal)\n if (oldRoute) {\n acc.oldRoutes.push(oldRoute)\n }\n return acc\n },\n { internals: [] as InternalInput[], oldRoutes: [] as RouteLocator[] }\n )\n}\n\n```"
}
] |
code_store-indexer_f5e9f76a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/utils/delete.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { RouteLocator } from 'vtex.rewriter'\n\nimport { Rewriter } from '../clients/rewriter'\n\nexport const deleteOldTranslation = async (\n id: string,\n type: string,\n bindingId: string,\n newPath: string,\n rewriter: Rewriter\n): Promise<RouteLocator | null> => {\n const routesById = await rewriter.routesById({ id, type })\n const oldPath = routesById.find(({ binding }) => binding === bindingId)\n\n if (!oldPath || oldPath.route === newPath) {\n return null\n }\n return { from: oldPath.route, binding: bindingId }\n}\n\n```"
}
] |
code_store-indexer_4164a8f0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/search/indexCanonicals.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-await-in-loop */\nimport * as querystring from 'querystring'\n\nimport { includes, propEq, splitAt, splitEvery } from 'ramda'\nimport { InternalInput } from 'vtex.rewriter'\n\nimport { Catalog, CatalogPageTypeResponse } from '../../clients/catalog'\nimport { Context } from '../../typings/global'\nimport {\n INDEXED_ORIGIN,\n PAGE_TYPE_TO_STORE_ENTITIES,\n STORE_LOCATOR,\n} from '../../utils/internals'\n\nconst BUCKET_SIZE = 100\nconst DAYS_TO_EXPIRE = 7\n\nconst handleResponse = (\n pageTypeResponse: CatalogPageTypeResponse | undefined,\n path: string\n) => {\n const SEARCH_TYPES = ['Search', 'FullText']\n // Search with one segment, fallback handles this case\n if (\n !pageTypeResponse ||\n (includes(pageTypeResponse.pageType) && path.split('/').length === 2)\n ) {\n return { pageType: 'NotFound', id: 'null' } as CatalogPageTypeResponse\n }\n const { pageType, id } = pageTypeResponse\n if (!includes(pageType, SEARCH_TYPES)) {\n return { pageType, id } as CatalogPageTypeResponse\n }\n // Search with more segments, should render a category page to keep current behaviour\n return { pageType: 'Category', id: 'search' } as CatalogPageTypeResponse\n}\n\n// Sends multiple requests (max 3) to pageType API, one with each important\n// segments (first three), because sometimes the API return wrongly `NotFound`,\n// for example `:department/:brand/:category`\nconst getPageType = async (path: string, search: string, catalog: Catalog) => {\n const IMPORTANT_SEGMENTS = [3, 2, 1]\n const segments = path.split('/')\n const responses = await Promise.all(\n IMPORTANT_SEGMENTS.map(len => {\n const splittedPath = splitAt(len + 1, segments)[0].join('/')\n return splittedPath && segments.length > len\n ? catalog.pageType(splittedPath + search)\n : ({ pageType: 'NotFound' } as CatalogPageTypeResponse)\n })\n )\n const pageTypeResponse =\n responses.find(response => !propEq('pageType', 'NotFound')(response)) ??\n ({} as CatalogPageTypeResponse)\n return handleResponse(pageTypeResponse, path)\n}\n\nconst toInternalURL = async (\n uri: string,\n canonicalPath: string,\n endDate: string,\n catalog: Catalog\n): Promise<InternalInput | null> => {\n const [path, query] = uri.split('?')\n const parsedQuery = querystring.parse(query)\n const { pageType } = await getPageType(path, `?${query}`, catalog)\n const type = PAGE_TYPE_TO_STORE_ENTITIES[pageType]\n\n if (!type) {\n return null\n }\n\n return {\n declarer: STORE_LOCATOR,\n endDate,\n from: canonicalPath,\n id: 'search',\n origin: INDEXED_ORIGIN,\n query: parsedQuery,\n resolveAs: path,\n type,\n }\n}\n\nexport async function indexCanonicals(ctx: Context, next: () => Promise<void>) {\n const {\n clients: { rewriter, catalog },\n state: { searchURLs },\n } = ctx\n const buckets = splitEvery(BUCKET_SIZE, searchURLs)\n const endDate = new Date()\n endDate.setDate(endDate.getDate() + DAYS_TO_EXPIRE)\n for (const URLsBucket of buckets) {\n const internals = await Promise.all(\n URLsBucket.map<Promise<InternalInput | null>>(url =>\n toInternalURL(\n url.path,\n url.canonicalPath!,\n endDate.toUTCString(),\n catalog\n )\n )\n )\n await rewriter.saveManyInternals(\n internals.filter(internal => internal !== null) as InternalInput[]\n )\n }\n await next()\n}\n\n```"
}
] |
code_store-indexer_454d46b5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/search/getSearchStats.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Context } from '../../typings/global'\n\nexport async function getSearchStats(ctx: Context, next: () => Promise<void>) {\n const {\n clients: { searchGraphql },\n state: {\n settings: { numberOfIndexedSearches },\n },\n } = ctx\n const searchUrls = (await searchGraphql.getSearchURLsCount(\n numberOfIndexedSearches\n )) as Array<{ path: string }>\n ctx.state.searchURLs = searchUrls\n await next()\n}\n\n```"
}
] |
code_store-indexer_64623141
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/search/createCanonicals.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-restricted-globals */\n/* eslint-disable no-await-in-loop */\nimport { zip } from 'ramda'\n\nimport { Catalog } from '../../clients/catalog'\nimport { Context } from '../../typings/global'\n\nconst enrichSegmentName = async (\n catalog: Catalog,\n segment: string,\n mapValue: string\n) => {\n const [fieldName, fieldValue] = mapValue.split('_')\n if (fieldName === 'specificationFilter' && !isNaN(Number(fieldValue))) {\n const { Name: specificationFilterName } = await catalog.getField(\n Number(fieldValue)\n )\n return `${specificationFilterName.toLowerCase()}_${segment}`\n }\n\n return segment.toLowerCase()\n}\n\nexport async function createCanonicals(\n ctx: Context,\n next: () => Promise<void>\n) {\n const {\n clients: { catalog },\n state: { searchURLs },\n } = ctx\n\n for (const searchURL of searchURLs) {\n const { path } = searchURL\n const [segments, queryMap] = path.split('?map=')\n const pathSegments = segments.slice(1).split('/')\n const mapSegments = queryMap.split(',')\n const zippedSegments = zip(pathSegments, mapSegments)\n const enrichedPathSegments: string[] = []\n\n for (const [segment, mapValue] of zippedSegments) {\n enrichedPathSegments.push(\n await enrichSegmentName(catalog, segment, mapValue)\n )\n }\n\n searchURL.canonicalPath = `/${enrichedPathSegments.join('/')}`.replace(\n /\\s/g,\n '-'\n )\n }\n\n await next()\n}\n\n```"
}
] |
code_store-indexer_0107174a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/search/index.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport * from './getSearchStats'\nexport * from './createCanonicals'\nexport * from './indexCanonicals'\n\n```"
}
] |
code_store-indexer_d43abe5a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/internals/category.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Category } from '@vtex/api/lib/clients/apps/catalogGraphQL/category'\nimport { InternalInput } from 'vtex.rewriter'\n\nimport { Context } from '../../typings/global'\nimport { filterStoreBindings } from '../../utils/bindings'\nimport { deleteOldTranslation } from '../../utils/delete'\nimport {\n INDEXED_ORIGIN,\n InternalAndOldRoute,\n PAGE_TYPES,\n processInternalAndOldRoute,\n routeFormatter,\n STORE_LOCATOR,\n} from '../../utils/internals'\nimport { createTranslator } from '../../utils/messages'\nimport { slugify } from '../../utils/slugify'\n\ntype CategoryTypes = 'DEPARTMENT' | 'CATEGORY' | 'SUBCATEGORY'\n\ninterface IdentifiedCategory extends Category {\n parents: Array<Pick<Category, 'name' | 'id'>>\n}\n\nconst getCategoryType = (\n parents: IdentifiedCategory['parents']\n): { type: CategoryTypes; map: string } => {\n const height = parents.length\n switch (height) {\n case 0:\n return {\n map: 'c',\n type: 'DEPARTMENT',\n }\n case 1:\n return {\n map: 'c,c',\n type: 'CATEGORY',\n }\n default:\n return {\n map: Array(height + 1)\n .fill('c')\n .join(','),\n type: 'SUBCATEGORY',\n }\n }\n}\n\nconst toParams = ([department, category, subcategory, ...terms]: string[]) => ({\n category,\n department,\n subcategory,\n terms: terms.join('/'),\n})\n\ntype Params = ReturnType<typeof toParams>\n\nconst pathFromTree = (formatRoute: (x: Params) => string, tree: string[]) =>\n formatRoute(toParams(tree.map(x => slugify(x).toLowerCase())))\n\nexport async function categoryInternals(\n ctx: Context,\n next: () => Promise<void>\n) {\n const {\n clients: { apps, messages: messagesClient, rewriter },\n state: {\n tenantInfo: { defaultLocale: tenantLocale },\n tenantInfo,\n settings: { usesMultiLanguageSearch },\n },\n vtex: { logger },\n } = ctx\n const category: IdentifiedCategory = ctx.body\n const bindings = filterStoreBindings(tenantInfo)\n\n if (bindings.length === 0) {\n return\n }\n\n const { id, isActive, name, parents } = category\n const { map, type } = getCategoryType(parents)\n const pageType = PAGE_TYPES[type]\n const messages = [...parents, { id, name }].map(c => ({\n content: c.name,\n context: c.id,\n }))\n\n const formatRoute = await routeFormatter(apps, pageType)\n const translate = createTranslator(messagesClient)\n\n const tenantPath = pathFromTree(\n formatRoute,\n messages.map(x => x.content)\n )\n\n const internalsAndOldRoutes = await Promise.all(\n bindings.map(async binding => {\n try {\n const { id: bindingId, defaultLocale: bindingLocale } = binding\n const translatedTree = await translate(\n tenantLocale,\n bindingLocale,\n messages\n )\n const path = pathFromTree(formatRoute, translatedTree)\n const oldRoute = await deleteOldTranslation(\n id,\n pageType,\n bindingId,\n path,\n rewriter\n )\n const internal: InternalInput = {\n binding: bindingId,\n declarer: STORE_LOCATOR,\n from: path,\n id,\n origin: INDEXED_ORIGIN,\n query: isActive ? { map } : null,\n resolveAs: usesMultiLanguageSearch ? null : tenantPath,\n type: isActive ? pageType : PAGE_TYPES.SEARCH_NOT_FOUND,\n }\n return {\n internal,\n oldRoute,\n } as InternalAndOldRoute\n } catch (error) {\n logger.error({\n binding: binding.id,\n category,\n error,\n message: 'Error creating category internals',\n })\n return null\n }\n })\n )\n\n const { internals, oldRoutes } = processInternalAndOldRoute(\n internalsAndOldRoutes\n )\n\n ctx.state.internals = internals\n ctx.state.oldRoutes = oldRoutes\n\n await next()\n}\n\n```"
}
] |
code_store-indexer_3f312f50
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/internals/brand.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Brand } from 'vtex.catalog-graphql'\nimport { InternalInput } from 'vtex.rewriter'\n\nimport { Context } from '../../typings/global'\nimport { filterStoreBindings } from '../../utils/bindings'\nimport { deleteOldTranslation } from '../../utils/delete'\nimport {\n INDEXED_ORIGIN,\n PAGE_TYPES,\n processInternalAndOldRoute,\n routeFormatter,\n STORE_LOCATOR,\n} from '../../utils/internals'\nimport { createTranslator } from '../../utils/messages'\nimport { slugify } from '../../utils/slugify'\n\ntype Params = Record<string, string | undefined> | null | undefined\n\nconst pathFromRoute = (formatRoute: (x: Params) => string, brand: string) =>\n formatRoute({ brand: slugify(brand).toLowerCase() })\n\nexport async function brandInternals(ctx: Context, next: () => Promise<void>) {\n const {\n clients: { apps, messages: messagesClient, rewriter },\n state: {\n tenantInfo: { defaultLocale: tenantLocale },\n tenantInfo,\n settings: { usesMultiLanguageSearch, resolveBrandMapQueryAs },\n },\n vtex: { logger },\n } = ctx\n const brand: Brand = ctx.body\n const { name, active, id } = brand\n const bindings = filterStoreBindings(tenantInfo)\n\n if (bindings.length === 0) {\n return\n }\n\n const formatRoute = await routeFormatter(apps, PAGE_TYPES.BRAND)\n const translate = createTranslator(messagesClient)\n const messages = [{ content: name, context: id, behavior: 'USER_ONLY'}]\n const tenantPath = pathFromRoute(formatRoute, name)\n\n const internalsAndOldRoutes = await Promise.all(\n bindings.map(async binding => {\n try {\n const { id: bindingId, defaultLocale: bindingLocale } = binding\n const [translated] = await translate(\n tenantLocale,\n bindingLocale,\n messages\n )\n const path = pathFromRoute(formatRoute, translated)\n const oldRoute = await deleteOldTranslation(\n id,\n 'brand',\n bindingId,\n path,\n rewriter\n )\n\n const internal: InternalInput = {\n binding: bindingId,\n declarer: STORE_LOCATOR,\n from: path,\n id,\n origin: INDEXED_ORIGIN,\n query: active ? { map: resolveBrandMapQueryAs } : null,\n resolveAs: usesMultiLanguageSearch ? null : tenantPath,\n type: active ? PAGE_TYPES.BRAND : PAGE_TYPES.SEARCH_NOT_FOUND,\n }\n return {\n internal,\n oldRoute,\n }\n } catch (error) {\n logger.error({\n binding: binding.id,\n brand,\n error,\n message: 'Error creating category internals',\n })\n return null\n }\n })\n )\n\n const { internals, oldRoutes } = processInternalAndOldRoute(\n internalsAndOldRoutes\n )\n\n ctx.state.internals = internals\n ctx.state.oldRoutes = oldRoutes\n\n await next()\n}\n\n```"
}
] |
code_store-indexer_86de8575
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/internals/product.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Product } from 'vtex.catalog-graphql'\nimport { InternalInput } from 'vtex.rewriter'\n\nimport { Context } from '../../typings/global'\nimport { filterBindingsBySalesChannel } from '../../utils/bindings'\nimport { deleteOldTranslation } from '../../utils/delete'\nimport {\n INDEXED_ORIGIN,\n PAGE_TYPES,\n processInternalAndOldRoute,\n routeFormatter,\n STORE_LOCATOR,\n} from '../../utils/internals'\nimport { createTranslator } from '../../utils/messages'\nimport { slugify } from '../../utils/slugify'\n\ntype Params = Record<string, string | undefined> | null | undefined\n\nconst pathFromRoute = (formatRoute: (x: Params) => string, slug: string) =>\n formatRoute({ slug: slugify(slug).toLowerCase() })\n\nexport async function productInternals(\n ctx: Context,\n next: () => Promise<void>\n) {\n const {\n clients: { apps, messages: messagesClient, rewriter },\n state: {\n tenantInfo: { defaultLocale: tenantLocale },\n tenantInfo,\n settings: { usesMultiLanguageSearch },\n },\n vtex: { logger },\n } = ctx\n const product: Product = ctx.body\n const { linkId, isActive, id } = product\n const bindings = filterBindingsBySalesChannel(\n tenantInfo,\n product.salesChannel\n )\n\n if (!linkId || bindings.length === 0) {\n return\n }\n\n const formatRoute = await routeFormatter(apps, PAGE_TYPES.PRODUCT)\n const translate = createTranslator(messagesClient)\n const messages = [{ content: linkId, context: id }]\n\n const tenantPath = pathFromRoute(formatRoute, linkId)\n\n const internalsAndOldRoutes = await Promise.all(\n bindings.map(async binding => {\n try {\n const { defaultLocale: bindingLocale, id: bindingId } = binding\n const [translated] = await translate(\n tenantLocale,\n bindingLocale,\n messages\n )\n const path = pathFromRoute(formatRoute, translated)\n const oldRoute = await deleteOldTranslation(\n id,\n 'product',\n bindingId,\n path,\n rewriter\n )\n\n const internal: InternalInput = {\n binding: bindingId,\n declarer: STORE_LOCATOR,\n from: path,\n id,\n origin: INDEXED_ORIGIN,\n resolveAs: usesMultiLanguageSearch ? null : tenantPath,\n type: isActive ? PAGE_TYPES.PRODUCT : PAGE_TYPES.PRODUCT_NOT_FOUND,\n }\n return {\n internal,\n oldRoute,\n }\n } catch (error) {\n logger.error({\n binding: binding.id,\n error,\n message: 'Error creating category internals',\n product,\n })\n return null\n }\n })\n )\n\n const { internals, oldRoutes } = processInternalAndOldRoute(\n internalsAndOldRoutes\n )\n\n ctx.state.internals = internals\n ctx.state.oldRoutes = oldRoutes\n\n await next()\n}\n\n```"
}
] |
code_store-indexer_a8de4e28
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/internals/save.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-console */\nimport { Binding, LINKED } from '@vtex/api'\nimport { pick } from 'ramda'\nimport { InternalInput } from 'vtex.rewriter'\n\nimport { Context } from '../../typings/global'\n\nconst mergeBindingsToInternals = (\n bindings: Binding[],\n internals: InternalInput[]\n) =>\n internals.map(internal => {\n const binding = bindings.find(b => b.id === internal.binding)\n return {\n ...internal,\n binding: pick(['id', 'defaultLocale', 'canonicalBaseAddress'], binding),\n }\n })\n\nexport async function saveInternals(ctx: Context, next: () => Promise<void>) {\n const {\n clients: { rewriter },\n state: { internals, tenantInfo },\n } = ctx\n if (internals) {\n if (LINKED) {\n const tenant = pick(['id', 'defaultLocale'], tenantInfo)\n console.log(\n JSON.stringify(\n {\n internals: mergeBindingsToInternals(tenantInfo.bindings, internals),\n tenant,\n },\n null,\n 2\n )\n )\n }\n await rewriter.saveManyInternals(internals)\n }\n\n await next()\n}\n\n```"
}
] |
code_store-indexer_14b3a6eb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of store-indexer/node/middlewares/internals/delete.ts from the store-indexer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-console */\nimport { LINKED } from '@vtex/api'\n\nimport { Context } from '../../typings/global'\n\nexport async function deleteOldRoutes(ctx: Context, next: () => Promise<void>) {\n const {\n clients: { rewriter },\n state: { oldRoutes },\n } = ctx\n if (oldRoutes) {\n if (LINKED) {\n console.log(\n JSON.stringify({\n message: 'Old Routes deletion',\n oldRoutes,\n })\n )\n }\n await rewriter.deleteManyInternals(oldRoutes)\n }\n\n await next()\n}\n\n```"
}
] |
code_mycheckout-store-framework_6074946b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/messages/pt.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"checkoutless.button-save\": \"Salve\",\n \"checkoutless.button-restore\": \"Restaurar\",\n \"checkoutless.button-select\": \"Selecionar\",\n \"checkoutless.button-cancel\": \"Cancelar\",\n \"checkoutless.button-yes\": \"Sim\",\n \"admin-example.navigation.label\": \"My Checkout\",\n \"admin-example.navigation.search.kws\": \"checkout,pagamentos\",\n \"admin-example.navigation.settings\": \"Configuração\",\n \"admin-example.navigation.payments\": \"Métodos de Pagamento\",\n \"checkoutless.settings.title\": \"Configuração\",\n \"checkoutless.settings.subtitle\": \"You should configure VTEX App Key and VTEX App Token to activate My Checkout\",\n \"checkoutless.settings.success\": \"Your account has been updated with success\",\n \"checkoutless.linksList\": \"Listado de vinculos\",\n \"checkoutless.linksList.title\": \"Links list\",\n \"checkoutless.linksList.accountColumn\": \"Account\",\n \"checkoutless.linksList.dateColumn\": \"Date\",\n \"checkoutless.linksList.statusColumn\": \"Status\",\n \"checkoutless.linksList.actionColumn\": \"Action\",\n \"checkoutless.linksList.newLinkButton\": \"New\",\n \"checkoutless.linksList.approved\": \"Approved\",\n \"checkoutless.linksList.pending\": \"Pending\",\n \"checkoutless.linksList.rejected\": \"Rejected\",\n \"checkoutless.linksList.deleteMessage\": \"Link has been deleted with success\",\n \"checkoutless.linksList.approvedMessage\": \"Link has been approved with success\",\n \"checkoutless.linksList.rejectedMessage\": \"Link has been rejected with success\",\n \"checkoutless.linkForm.title\": \"New link\",\n \"checkoutless.linkForm.accountField\": \"Account\",\n \"checkoutless.linkForm.linkExist\": \"Already exist a link with this account\",\n \"checkoutless.inputs.required\": \"Required\",\n \"checkoutless.inputs.save-button\": \"Save\",\n \"checkoutless.statistics\": \"Estatisticas\",\n \"checkoutless.statistics.title\": \"Estatisticas\",\n \"checkoutless.statistics.subtitle\": \"Estatísticas de uso por comerciante\",\n \"checkoutless.statistics.admin.useButton\": \"Usar botão\",\n \"checkoutless.statistics.checkout\": \"Compras\",\n \"checkoutless.statistics.conversion\": \"Taxa de conversão\",\n \"checkoutless.statistics.category\": \"Uso da categoria\",\n \"checkoutless.statistics.subcategory\": \"Uso da subcategoria\",\n \"checkoutless.statistics.ticket\": \"Bilhete médio\",\n \"checkoutless.statistics.lastSixMonths\": \"Últimos 6 meses\",\n \"checkoutless.statistics.previousPeriod\": \"Período anterior\",\n \"checkoutless.statistics.day\": \"Dia\",\n \"checkoutless.statistics.month\": \"Mês\",\n \"checkoutless.statistics.year\": \"Ano\",\n \"checkoutless.statistics.period\": \"Período:\",\n \"checkoutless.statistics.compare\": \"Compare com:\",\n \"checkoutless.statistics.accept\": \"Aceitar\",\n \"checkoutless.statistics.cancel\": \"Cancelar\",\n \"checkoutless.statistics.filter.select\": \"Selecionar\",\n \"checkoutless.statistics.filter.person\": \"Personalizado\",\n \"checkoutless.statistics.filter.today\": \"Hoje\",\n \"checkoutless.statistics.filter.yesterday\": \"Ontem\",\n \"checkoutless.statistics.filter.lastWeek\": \"Última semana\",\n \"checkoutless.statistics.filter.lastMonth\": \"Último mês\",\n \"checkoutless.settings.warning\": \"A conta ainda não está configurada\",\n \"checkoutless.categories.table.name\": \"Categoria\",\n \"checkoutless.categories.table.id\": \"ID\",\n \"checkoutless.categories.table.type\": \"Tipo\",\n \"checkoutless.categories.table.active\": \"Activar\",\n \"checkoutless.categories.title\": \"Visualización\",\n \"checkoutless.categories.description\": \"En la siguiente sección podrá configurar las categorias donde no quiera el botón de My Checkout sea visible\",\n \"checkoutless.paymentsList\": \"Medios de pagos\",\n \"checkoutless.paymentsList.title\": \"Medios de pagos\",\n \"checkoutless.paymentsList.table.name\": \"Médio de pago\",\n \"checkoutless.paymentsList.table.sales-channel\": \"Sales Channels\",\n \"checkoutless.paymentsList.table.status\": \"Mostrar en My Checkout\",\n \"checkoutless.paymentsList.table.warning\": \"Debe tener al menos un medio de pago activo\",\n \"checkoutless.paymentsList.table.origin\": \"Origen\",\n \"checkoutless.paymentsList.auto-save\": \"Todos tus cambios se guardarán de forma automática\",\n \"checkoutless.settings.buttonMessage\": \"Use * para resaltar un texto, ejemplo: Paga *fácil y rápido*...\",\n \"checkoutless.styleSettings\": \"Configurações de estilo\",\n \"checkoutless.styleSettings.menu-name\": \"Nome\",\n \"checkoutless.styleSettings.menu-font\": \"Fonte\",\n \"checkoutless.styleSettings.menu-radio\": \"Rádio\",\n \"checkoutless.styleSettings.menu-width\": \"Largura\",\n \"checkoutless.styleSettings.menu-button\": \"Botão\",\n \"checkoutless.styleSettings.menu-icons\": \"Ícones\",\n \"checkoutless.styleSettings.menu-background\": \"Fundo\",\n \"checkoutless.styleSettings.menu.button.input-placeholder\": \"Compre Agora\",\n \"checkoutless.styleSettings.menu.button.color-text\": \"Texto\",\n \"checkoutless.styleSettings.menu.button.color-background\": \"Fundo\",\n \"checkoutless.styleSettings.menu.button.color-outline\": \"Contorno\",\n \"checkoutless.styleSettings.menu.icons-color\": \"Cores dos ícones\",\n \"checkoutless.styleSettings.menu.background-color\": \"Cor modal\",\n \"checkoutless.styleSettings.menu-font-advanced-btn\": \"Avançado\",\n \"checkoutless.styleSettings.menu-font-advanced-description\": \"Escreva o nome da fonte que você já adicionou no seu negócio\",\n \"checkoutless.styleSettings.menu-restore-confirmation-message\": \"¿ Tem certeza de que deseja redefinir os estilos ?\",\n \"checkoutless.styleSettings.menu-update-confirmation-message\": \"¿ Tem certeza de que deseja atualizar os estilos ?\",\n \"checkoutless.styleSettings.preview-modal\": \"Modal\",\n \"checkoutless.styleSettings.preview-button\": \"Botão\",\n \"checkoutless.styleSettings.preview-button-design\": \"Design de botão\",\n \"checkoutless.styleSettings.preview-modal-design\": \"Design modal\",\n \"checkoutless.styleSettings.success-update-styles\": \"Estilos atualizados com sucesso\",\n \"checkoutless.styleSettings.success-restore-styles\": \"Estilos redefinidos com sucesso\",\n \"checkoutless.styleSettings.error-update-styles\": \"Desculpe, ocorreu um erro\"\n}\n\n```"
}
] |
code_mycheckout-store-framework_0b23234b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/messages/en.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"checkoutless.button-save\": \"Save\",\n \"checkoutless.button-restore\": \"Restore\",\n \"checkoutless.button-select\": \"To select\",\n \"checkoutless.button-cancel\": \"Cancel\",\n \"checkoutless.button-yes\": \"Yes\",\n \"admin-example.navigation.label\": \"My Checkout\",\n \"admin-example.navigation.search.kws\": \"checkout,payments\",\n \"admin-example.navigation.settings\": \"Configuration\",\n \"admin-example.navigation.payments\": \"Payment methods\",\n \"checkoutless.settings.title\": \"Configuration\",\n \"checkoutless.settings.subtitle\": \"You should configure VTEX App Key and VTEX App Token to activate My Checkout\",\n \"checkoutless.settings.success\": \"Your account has been updated with success\",\n \"checkoutless.linksList\": \"Links list\",\n \"checkoutless.linksList.title\": \"Links list\",\n \"checkoutless.linksList.accountColumn\": \"Account\",\n \"checkoutless.linksList.dateColumn\": \"Date\",\n \"checkoutless.linksList.statusColumn\": \"Status\",\n \"checkoutless.linksList.actionColumn\": \"Action\",\n \"checkoutless.linksList.newLinkButton\": \"New\",\n \"checkoutless.linksList.approved\": \"Approved\",\n \"checkoutless.linksList.pending\": \"Pending\",\n \"checkoutless.linksList.rejected\": \"Rejected\",\n \"checkoutless.linksList.deleteMessage\": \"Link has been deleted with success\",\n \"checkoutless.linksList.approvedMessage\": \"Link has been approved with success\",\n \"checkoutless.linksList.rejectedMessage\": \"Link has been rejected with success\",\n \"checkoutless.linkForm.title\": \"New link\",\n \"checkoutless.linkForm.accountField\": \"Account\",\n \"checkoutless.linkForm.linkExist\": \"Already exist a link with this account\",\n \"checkoutless.inputs.required\": \"Required\",\n \"checkoutless.inputs.save-button\": \"Save\",\n \"checkoutless.statistics\": \"Statistics\",\n \"checkoutless.statistics.title\": \"Statistics\",\n \"checkoutless.statistics.subtitle\": \"Usage statistics by merchant\",\n \"checkoutless.statistics.admin.useButton\": \"Use button\",\n \"checkoutless.statistics.checkout\": \"Shopping\",\n \"checkoutless.statistics.conversion\": \"Conversion rate\",\n \"checkoutless.statistics.category\": \"Category use\",\n \"checkoutless.statistics.subcategory\": \"Subcategory use\",\n \"checkoutless.statistics.ticket\": \"Average ticket\",\n \"checkoutless.statistics.lastSixMonths\": \"Last 6 months\",\n \"checkoutless.statistics.previousPeriod\": \"Previous period\",\n \"checkoutless.statistics.day\": \"Day\",\n \"checkoutless.statistics.month\": \"Month\",\n \"checkoutless.statistics.year\": \"Year\",\n \"checkoutless.statistics.period\": \"Period:\",\n \"checkoutless.statistics.compare\": \"Compare with:\",\n \"checkoutless.statistics.accept\": \"Accept\",\n \"checkoutless.statistics.cancel\": \"Cancel\",\n \"checkoutless.statistics.filter.select\": \"Select\",\n \"checkoutless.statistics.filter.person\": \"Custom\",\n \"checkoutless.statistics.filter.today\": \"Today\",\n \"checkoutless.statistics.filter.yesterday\": \"Yesterday\",\n \"checkoutless.statistics.filter.lastWeek\": \"Last week\",\n \"checkoutless.statistics.filter.lastMonth\": \"Last month\",\n \"checkoutless.settings.warning\": \"Account is not set up yet\",\n \"checkoutless.categories.table.name\": \"Categoria\",\n \"checkoutless.categories.table.id\": \"ID\",\n \"checkoutless.categories.table.type\": \"Tipo\",\n \"checkoutless.categories.table.active\": \"Activar\",\n \"checkoutless.categories.title\": \"Visualización\",\n \"checkoutless.categories.description\": \"En la siguiente sección podrá configurar las categorias donde no quiera el botón de My Checkout sea visible\",\n \"checkoutless.paymentsList\": \"Payments\",\n \"checkoutless.paymentsList.title\": \"Medios de pagos\",\n \"checkoutless.paymentsList.table.name\": \"Médio de pago\",\n \"checkoutless.paymentsList.table.sales-channel\": \"Sales Channels\",\n \"checkoutless.paymentsList.table.status\": \"Mostrar en My Checkout\",\n \"checkoutless.paymentsList.table.warning\": \"Debe tener al menos un medio de pago activo\",\n \"checkoutless.paymentsList.table.origin\": \"Origen\",\n \"checkoutless.paymentsList.auto-save\": \"Todos tus cambios se guardarán de forma automática\",\n \"checkoutless.settings.buttonMessage\": \"Use * para resaltar un texto, ejemplo: Paga *fácil y rápido*...\",\n \"checkoutless.styleSettings\": \"Style settings\",\n \"checkoutless.styleSettings.menu-name\": \"Name\",\n \"checkoutless.styleSettings.menu-font\": \"Font\",\n \"checkoutless.styleSettings.menu-radio\": \"Radio\",\n \"checkoutless.styleSettings.menu-width\": \"Width\",\n \"checkoutless.styleSettings.menu-button\": \"Button\",\n \"checkoutless.styleSettings.menu-icons\": \"Icons\",\n \"checkoutless.styleSettings.menu-background\": \"Background\",\n \"checkoutless.styleSettings.menu.button.input-placeholder\": \"Buy now\",\n \"checkoutless.styleSettings.menu.button.color-text\": \"Text\",\n \"checkoutless.styleSettings.menu.button.color-background\": \"Background\",\n \"checkoutless.styleSettings.menu.button.color-outline\": \"Outline\",\n \"checkoutless.styleSettings.menu.icons-color\": \"Icons color\",\n \"checkoutless.styleSettings.menu.background-color\": \"Modal color\",\n \"checkoutless.styleSettings.menu-font-advanced-btn\": \"Advanced\",\n \"checkoutless.styleSettings.menu-font-advanced-description\": \"Write the name of the font that you already have added in your business\",\n \"checkoutless.styleSettings.menu-restore-confirmation-message\": \"Are you sure you want to reset the styles ?\",\n \"checkoutless.styleSettings.menu-update-confirmation-message\": \"Are you sure you want to update the styles ?\",\n \"checkoutless.styleSettings.preview-modal\": \"Modal\",\n \"checkoutless.styleSettings.preview-button\": \"Button\",\n \"checkoutless.styleSettings.preview-button-design\": \"Button design\",\n \"checkoutless.styleSettings.preview-modal-design\": \"Modal design\",\n \"checkoutless.styleSettings.success-update-styles\": \"Styles updated successfully\",\n \"checkoutless.styleSettings.success-restore-styles\": \"Styles reset successfully\",\n \"checkoutless.styleSettings.error-update-styles\": \"Sorry an error occurred\"\n}\n\n```"
}
] |
code_mycheckout-store-framework_89bb5de7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/messages/es.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"checkoutless.button-save\": \"Guardar\",\n \"checkoutless.button-restore\": \"Restablecer\",\n \"checkoutless.button-select\": \"Seleccionar\",\n \"checkoutless.button-cancel\": \"Cancelar\",\n \"checkoutless.button-yes\": \"Sí\",\n \"admin-example.navigation.label\": \"My Checkout\",\n \"admin-example.navigation.search.kws\": \"checkout,pagos\",\n \"admin-example.navigation.settings\": \"Configuración\",\n \"admin-example.navigation.payments\": \"Medios de pagos\",\n \"checkoutless.settings.title\": \"Configuración\",\n \"checkoutless.settings.subtitle\": \"Debe configurar VTEX App Key y VTEX App Token para activar My Checkout\",\n \"checkoutless.settings.success\": \"Su cuenta ha sido actualizado con éxito.\",\n \"checkoutless.linksList\": \"Listado de vinculos\",\n \"checkoutless.linksList.title\": \"Listado de vinculos\",\n \"checkoutless.linksList.accountColumn\": \"Cuenta\",\n \"checkoutless.linksList.dateColumn\": \"Fecha\",\n \"checkoutless.linksList.statusColumn\": \"Estado\",\n \"checkoutless.linksList.actionColumn\": \"Acción\",\n \"checkoutless.linksList.newLinkButton\": \"Nuevo\",\n \"checkoutless.linksList.approved\": \"Aprobado\",\n \"checkoutless.linksList.pending\": \"Pendiente\",\n \"checkoutless.linksList.rejected\": \"Rechazado\",\n \"checkoutless.linksList.deleteMessage\": \"Se ha eliminado el vinculo con éxito\",\n \"checkoutless.linksList.approvedMessage\": \"Se ha aprobado el vinculo con éxito\",\n \"checkoutless.linksList.rejectedMessage\": \"Se ha rechazado el vinculo con éxito\",\n \"checkoutless.linkForm.title\": \"Nuevo vinculo\",\n \"checkoutless.linkForm.accountField\": \"Cuenta\",\n \"checkoutless.linkForm.linkExist\": \"Ya existe un vinculo con esta cuenta\",\n \"checkoutless.inputs.required\": \"Requerido\",\n \"checkoutless.inputs.save-button\": \"Guardar\",\n \"checkoutless.statistics\": \"Estadísticas\",\n \"checkoutless.statistics.title\": \"Estadísticas\",\n \"checkoutless.statistics.subtitle\": \"Estadísticas de uso por comercio\",\n \"checkoutless.statistics.admin.useButton\": \"Uso botón\",\n \"checkoutless.statistics.checkout\": \"Compras\",\n \"checkoutless.statistics.conversion\": \"Tasa de conversión\",\n \"checkoutless.statistics.category\": \"Uso categoría\",\n \"checkoutless.statistics.subcategory\": \"Uso subcategoria\",\n \"checkoutless.statistics.ticket\": \"Ticket promedio\",\n \"checkoutless.statistics.lastSixMonths\": \"Últimos 6 meses\",\n \"checkoutless.statistics.previousPeriod\": \"Periodo anterior\",\n \"checkoutless.statistics.day\": \"Día\",\n \"checkoutless.statistics.month\": \"Mes\",\n \"checkoutless.statistics.year\": \"Año\",\n \"checkoutless.statistics.period\": \"Periodo:\",\n \"checkoutless.statistics.compare\": \"Comparar con:\",\n \"checkoutless.statistics.accept\": \"Aceptar\",\n \"checkoutless.statistics.cancel\": \"Cancelar\",\n \"checkoutless.statistics.filter.select\": \"Seleccionar\",\n \"checkoutless.statistics.filter.person\": \"Personalizado\",\n \"checkoutless.statistics.filter.today\": \"Hoy\",\n \"checkoutless.statistics.filter.yesterday\": \"Ayer\",\n \"checkoutless.statistics.filter.lastWeek\": \"La semana pasada\",\n \"checkoutless.statistics.filter.lastMonth\": \"El mes pasado\",\n \"checkoutless.settings.warning\": \"La cuenta aún no está configurada\",\n \"checkoutless.categories.table.name\": \"Categoria\",\n \"checkoutless.categories.table.id\": \"ID\",\n \"checkoutless.categories.table.type\": \"Tipo\",\n \"checkoutless.categories.table.active\": \"Activar\",\n \"checkoutless.categories.title\": \"Visualización\",\n \"checkoutless.categories.description\": \"En la siguiente sección podrá configurar las categorias donde no quiera el botón de My Checkout sea visible\",\n \"checkoutless.paymentsList\": \"Medios de pagos\",\n \"checkoutless.paymentsList.title\": \"Medios de pagos\",\n \"checkoutless.paymentsList.table.name\": \"Médio de pago\",\n \"checkoutless.paymentsList.table.sales-channel\": \"Sales Channels\",\n \"checkoutless.paymentsList.table.status\": \"Mostrar en My Checkout\",\n \"checkoutless.paymentsList.table.warning\": \"Debe tener al menos un medio de pago activo\",\n \"checkoutless.paymentsList.table.origin\": \"Origen\",\n \"checkoutless.paymentsList.auto-save\": \"Todos tus cambios se guardarán de forma automática\",\n \"checkoutless.settings.buttonMessage\": \"Use * para resaltar un texto, ejemplo: Paga *fácil y rápido*...\",\n \"checkoutless.styleSettings\": \"Ajustes de estilo\",\n \"checkoutless.styleSettings.menu-name\": \"Nombre\",\n \"checkoutless.styleSettings.menu-font\": \"Fuente\",\n \"checkoutless.styleSettings.menu-radio\": \"Radio\",\n \"checkoutless.styleSettings.menu-width\": \"Ancho\",\n \"checkoutless.styleSettings.menu-button\": \"Botón\",\n \"checkoutless.styleSettings.menu-icons\": \"Iconos\",\n \"checkoutless.styleSettings.menu-background\": \"Fondo\",\n \"checkoutless.styleSettings.menu.button.input-placeholder\": \"Compra ya\",\n \"checkoutless.styleSettings.menu.button.color-text\": \"Texto\",\n \"checkoutless.styleSettings.menu.button.color-background\": \"Fondo\",\n \"checkoutless.styleSettings.menu.button.color-outline\": \"Contorno\",\n \"checkoutless.styleSettings.menu.icons-color\": \"Color iconos\",\n \"checkoutless.styleSettings.menu.background-color\": \"Color modal\",\n \"checkoutless.styleSettings.menu-font-advanced-btn\": \"Avanzado\",\n \"checkoutless.styleSettings.menu-font-advanced-description\": \"Escribe el nombre de la fuente que ya tienes agregada en tu comercio\",\n \"checkoutless.styleSettings.menu-restore-confirmation-message\": \"¿ Estas seguro de que quieres restablecer los estilos ?\",\n \"checkoutless.styleSettings.menu-update-confirmation-message\": \"¿ Está seguro de que desea actualizar los estilos ?\",\n \"checkoutless.styleSettings.preview-modal\": \"Modal\",\n \"checkoutless.styleSettings.preview-button\": \"Botón\",\n \"checkoutless.styleSettings.preview-button-design\": \"Diseño del botón\",\n \"checkoutless.styleSettings.preview-modal-design\": \"Diseño de la modal\",\n \"checkoutless.styleSettings.success-update-styles\": \"Estilos actualizados con éxito\",\n \"checkoutless.styleSettings.success-restore-styles\": \"Estilos restablecidos con éxito\",\n \"checkoutless.styleSettings.error-update-styles\": \"Lo sentimos ha ocurrido un error\"\n}\n\n```"
}
] |
code_mycheckout-store-framework_4309c721
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/admin/navigation.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"section\": \"storeSetup\",\n \"titleId\": \"admin-example.navigation.label\",\n \"searchKeyWordsHelpers\": \"admin-example.navigation.search.kws\",\n \"subSectionItems\": [\n {\n \"labelId\": \"admin-example.navigation.settings\",\n \"path\": \"/admin/kuikpay/settings\"\n },\n {\n \"labelId\": \"checkoutless.statistics\",\n \"path\": \"/admin/kuikpay/statistics\"\n },\n {\n \"labelId\": \"checkoutless.paymentsList\",\n \"path\": \"/admin/kuikpay/payment-list\"\n },\n {\n \"labelId\": \"checkoutless.styleSettings\",\n \"path\": \"/admin/kuikpay/style-settings\"\n }\n ]\n}\n\n```"
}
] |
code_mycheckout-store-framework_9d52e684
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/admin/routes.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin.app.checkoutless-settings\": {\n \"component\": \"adminExample\",\n \"path\": \"/admin/app/kuikpay/settings\"\n },\n \"admin.app.checkoutless-linksList\": {\n \"component\": \"adminLinksList\",\n \"path\": \"/admin/app/kuikpay/links\"\n },\n \"admin.app.checkoutless-linkForm\": {\n \"component\": \"adminLinkForm\",\n \"path\": \"/admin/app/kuikpay/links/new\"\n },\n \"admin.app.checkoutless-form\": {\n \"component\": \"adminJsonSchema\",\n \"path\": \"/admin/app/kuikpay/form\"\n },\n \"admin.app.checkoutless-statistics\": {\n \"component\": \"adminStatistics\",\n \"path\": \"/admin/app/kuikpay/statistics\"\n },\n \"admin.app.payment-list\": {\n \"component\": \"adminPaymentList\",\n \"path\": \"/admin/app/kuikpay/payment-list\"\n },\n \"admin.app.styles-settings\": {\n \"component\": \"adminStyleSettings\",\n \"path\": \"/admin/app/kuikpay/style-settings\"\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_8f5a3bac
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/docs/README.md from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\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# APP NAME\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nUnder the app's name, you should explain the topic, giving a **brief description** of its **functionality** in a store when installed.\n\nNext, **add media** (either an image of a GIF) with the rendered components, so that users can better understand how the app works in practice. \n\n\n\n## Configuration \n\nIn this section, you first must **add the primary instructions** that will allow users to use the app's blocks in their store, such as:\n\n1. Adding the app as a theme dependency in the `manifest.json` file;\n2. Declaring the app's main block in a given theme template or inside another block from the theme.\n\nRemember to add a table with all blocks exported by the app and their descriptions. You can verify an example of it on the [Search Result documentation](https://vtex.io/docs/components/all/vtex.search-result@3.56.1/). \n\nNext, add the **props table** containing your block's props. \n\nIf the app exports more than one block, create several tables - one for each block. For example:\n\n### `block-1` props\n\n| Prop name | Type | Description | Default value |\n| ------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | \n| `XXXXX` | `XXXXXX` | XXXXXXXX | `XXXXXX` |\n\n\n### `block-2` props\n\n| Prop name | Type | Description | Default value |\n| ------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | \n| `XXXXX` | `XXXXXX` | XXXXXXXX | `XXXXXX` |\n\nProp types are: \n\n- `string` \n- `enum` \n- `number` \n- `boolean` \n- `object` \n- `array` \n\nWhen documenting a prop whose type is `object` or `array` another prop table will be needed. You can create it following the example below:\n\n- `propName` object:\n\n| Prop name | Type | Description | Default value |\n| ------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | \n| `XXXXX` | `XXXXXX` | XXXXXXXX | `XXXXXX` |\n\n\nRemember to also use this Configuration section to **showcase any necessary disclaimer** related to the app and its blocks, such as the different behavior it may display during its configuration. \n\n## Modus Operandi *(not mandatory)*\n\nThere are scenarios in which an app can behave differently in a store, according to how it was added to the catalog, for example. It's crucial to go through these **behavioral changes** in this section, allowing users to fully understand the **practical application** of the app in their store.\n\nIf you feel compelled to give further details about the app, such as it's **relationship with the VTEX admin**, don't hesitate to use this section. \n\n## Customization\n\nThe first thing that should be present in this section is the sentence below, showing users the recipe pertaining to CSS customization in apps:\n\n`In order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://vtex.io/docs/recipes/style/using-css-handles-for-store-customization).`\n\nThereafter, you should add a single column table with the available CSS handles for the app, like the one below. Note that the Handles must be ordered alphabetically.\n\n| CSS Handles |\n| ----------- | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` | \n| `XXXXX` |\n\n\nIf there are none, add the following sentence instead:\n\n`No CSS Handles are available yet for the app customization.`\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n<!-- DOCS-IGNORE:end -->\n\n---- \n\nCheck out some documentation models that are already live: \n- [Breadcrumb](https://github.com/vtex-apps/breadcrumb)\n- [Image](https://vtex.io/docs/components/general/vtex.store-components/image)\n- [Condition Layout](https://vtex.io/docs/components/all/vtex.condition-layout@1.1.6/)\n- [Add To Cart Button](https://vtex.io/docs/components/content-blocks/vtex.add-to-cart-button@0.9.0/)\n- [Store Form](https://vtex.io/docs/components/all/vtex.store-form@0.3.4/)\n\n```"
}
] |
code_mycheckout-store-framework_fb3096e5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/schema.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Query {\n getUser(email: String!): User!\n getAddress(email: String!): [Address!]!\n getPayments(email: String!): [Payments!]!\n login(email: String!): GeneralResponse!\n verifyCode(email: String!, code: Int!): GeneralUserResponse!\n getCountries: PaginatedCountriesResponse\n getCountry(id: ID): Countries\n getStateCities(country: ID, state: String): [Cities]\n getCities(city: String): [SearchCities]\n getDocumentTypes: [DocumentTypes]\n accounts: Accounts\n validateCredit(email: String, totals: Int): ValidateCredit\n categoryMetrics(data: MetricsInput): CategoryMetrics\n subcategoryMetrics(category: String, data: MetricsInput): SubcategoryMetrics\n ticketAverage(data: MetricsInput): TicketAverage\n checkout(data: MetricsInput): Checkout\n button(data: MetricsInput): ButtonUses\n conversionRate(data: MetricsInput): ConversionRate\n token: String\n getLinksByAccount: [AccountLink]\n getAccount: Account\n getCategories: [Categories]\n getPaymentsMethods: [AdminPaymentsMethods]\n getPaymentProcessStatus(orderId: String): PaymentProccess\n getStyles: Accounts\n authBnpl(authCode: String): AuthBnpl\n}\n\ntype Mutation {\n createUser(\n email: String!\n habeasData: Boolean\n id_number: String!\n id_type: String!\n ip: String!\n lastname: String!\n name: String!\n phone_code: String!\n phone_number: String!\n ): User!\n updateUser(userArgs: UserInput): GeneralUserResponse!\n\n externalAddress(args: AddressInput): Address\n\n createAddress(\n id: ID\n profileId: String!\n country: String!\n state: String!\n city: String!\n street: String!\n number: String!\n postalCode: String!\n receiverName: String!\n neighborhood: String!\n geoCoordinates: GeocoordinatesInput!\n reference: String\n ): Address!\n updateAddress(\n id: ID!\n country: String\n state: String\n city: String\n street: String\n number: String\n postalCode: String\n receiverName: String\n neighborhood: String\n geoCoordinates: GeocoordinatesInput\n reference: String\n ): GeneralAddressResponse!\n\n deleteAddress(id: ID!): GeneralAddressResponse!\n\n deletePayment(id: ID!): GeneralPaymentsResponse!\n\n createOrder(orderArgs: OrderInput): Order\n @cacheControl(maxAge: ZERO, scope: PRIVATE)\n\n ecommerce(args: EcommerceInput): Ecommerce\n\n saveToken(\n key: String\n token: String\n paymentMethodId: String\n cvcRequired: Boolean\n buttonMessage: String\n visualization: [VisualizationInput]\n ): String\n\n createLink(accountApprover: String): AccountLink\n\n updateLink(id: String, status: String): AccountLink\n\n deleteLink(id: String): Remove\n\n handleVisualization(\n visualization: [VisualizationInput]\n ): ResponseVisualization\n\n createPaymentMethod(\n id: ID!\n type: String\n isActive: Boolean\n paymentMethodName: String\n accountName: String\n ): AdminPaymentsMethods\n\n updateStyles(styles: String, buttonText: String, restore: Boolean): Account\n}\n\n```"
}
] |
code_mycheckout-store-framework_2b507dc4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/service.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"memory\": 256,\n \"ttl\": 60,\n \"timeout\": 30,\n \"minReplicas\": 2,\n \"maxReplicas\": 5,\n \"workers\": 1,\n \"routes\": {\n \"healthcheck\": {\n \"path\": \"/_v/api/mycheckoutv1/healthcheck\",\n \"public\": true\n },\n \"scheduler\": {\n \"path\": \"/_v/api/mycheckoutv1/scheduler\",\n \"public\": true\n }\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_87d9e3c1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/package.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"ramda\": \"^0.26.1\",\n \"co-body\": \"^6.0.0\",\n \"qs\": \"^6.10.3\"\n },\n \"devDependencies\": {\n \"@types/bluebird\": \"^3.5.25\",\n \"@types/co-body\": \"^0.0.3\",\n \"@types/jest\": \"^24.0.18\",\n \"@types/node\": \"^12.0.0\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.45.12\",\n \"@vtex/test-tools\": \"^3.4.3\",\n \"tslint\": \"^5.12.0\",\n \"tslint-config-vtex\": \"^2.1.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.admin-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.admin-graphql@2.36.5/public/@types/vtex.admin-graphql\",\n \"vtex.catalog-api-proxy\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-api-proxy@0.10.2/public/_types/react\",\n \"vtex.checkout-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-graphql@0.65.1/public/@types/vtex.checkout-graphql\",\n \"vtex.checkout-resources\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-resources@0.48.0/public/@types/vtex.checkout-resources\",\n \"vtex.order-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.11.1/public/@types/vtex.order-manager\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.10.0/public/@types/vtex.product-context\",\n \"vtex.search-page-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-page-context@0.2.0/public/@types/vtex.search-page-context\",\n \"vtex.store\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store@2.123.0/public/@types/vtex.store\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.149.3/public/@types/vtex.store-graphql\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty && tslint -c tslint.json --fix './**/*.ts'\"\n },\n \"version\": \"0.2.1\"\n}\n\n```"
}
] |
code_mycheckout-store-framework_21f63e99
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/index.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type {\n Cached,\n ParamsContext,\n RecorderState,\n ServiceContext,\n} from '@vtex/api'\nimport { method, Service, LRUCache } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { healthcheck } from './middlewares/healthcheck'\nimport { scheduler } from './middlewares/scheduler'\nimport * as mutations from './resolvers/mutations'\nimport * as queries from './resolvers/queries'\n\nconst MEDIUM_TIMEOUT_MS = 2 * 10000\n\n// Create a LRU memory cache for the Status client.\n// The @vtex/api HttpClient respects Cache-Control headers and uses the provided cache.\nconst memoryCache = new LRUCache<string, Cached>({ max: 5000 })\n\nmetrics.trackCache('kuikpayAdmin', memoryCache)\n\ndeclare global {\n // We declare a global Context type just to avoid re-writing ServiceContext<Clients, State> in every handler and resolver\n type Context = ServiceContext<Clients>\n}\n\n// Export a service that defines resolvers and clients' options\nexport default new Service<Clients, RecorderState, ParamsContext>({\n clients: {\n implementation: Clients,\n options: {\n default: {\n timeout: MEDIUM_TIMEOUT_MS,\n baseURL: 'checkout',\n retries: 2,\n },\n adminMetrics: {\n timeout: MEDIUM_TIMEOUT_MS,\n baseURL: 'statistics',\n },\n ecommerce: {\n timeout: MEDIUM_TIMEOUT_MS,\n baseURL: 'statistics',\n },\n orders: {\n timeout: MEDIUM_TIMEOUT_MS,\n },\n orionServices: {\n timeout: MEDIUM_TIMEOUT_MS,\n baseURL: 'orion',\n },\n status: {\n memoryCache,\n },\n },\n },\n graphql: {\n resolvers: {\n Mutation: mutations,\n Query: queries,\n },\n },\n routes: {\n scheduler: method({\n POST: [scheduler],\n }),\n healthcheck: method({\n GET: [healthcheck],\n }),\n },\n})\n\n```"
}
] |
code_mycheckout-store-framework_d54b6a23
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/QuickpayButton.test.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\n\nimport Greeting from './QuickpayButton'\n\ntest('greets Fred', () => {\n const { queryByText } = render(<Greeting name=\"Fred\" />)\n\n expect(queryByText('Hey, Fred')).toBeInTheDocument()\n})\n\n```"
}
] |
code_mycheckout-store-framework_0edf8801
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/KuikpayQuotaInformation.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo } from 'react'\nimport { KuikpayQuotaInformative } from 'kuikpay-sdk'\nimport useProduct from 'vtex.product-context/useProduct'\n// eslint-disable-next-line no-restricted-imports\nimport { pathOr, path } from 'ramda'\n\nimport { CONSTANTS } from './utils'\n\nconst KuikpayQuotaInformation = () => {\n const ProductContext = useProduct()\n const language = __RUNTIME__?.culture?.language\n const theme = __RUNTIME__?.query?.theme || 'kuikpay'\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const runtime = {\n account: __RUNTIME__?.account,\n workspace: __RUNTIME__?.workspace,\n platform: CONSTANTS.platform,\n }\n\n const selectedItem = useMemo(() => {\n return pathOr(\n path(['product', 'items', 0], ProductContext),\n ['selectedItemasas'],\n ProductContext\n )\n }, [ProductContext])\n\n return useMemo(\n () => (\n <div>\n <KuikpayQuotaInformative\n language={language}\n theme={theme}\n selectedItem={selectedItem as any}\n runtime={runtime}\n />\n </div>\n ),\n [language, theme, selectedItem, runtime]\n )\n}\n\nexport default KuikpayQuotaInformation\n\n```"
}
] |
code_mycheckout-store-framework_27ae4f54
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/adminStyleSettings.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nexport { default } from './admin/component/StyleSettings'\n\n```"
}
] |
code_mycheckout-store-framework_76f0854c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/adminExample.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-restricted-imports */\nimport type { FC } from 'react'\nimport React, { useEffect, useState } from 'react'\nimport { useMutation, useQuery } from 'react-apollo'\nimport {\n Layout,\n PageBlock,\n Button,\n Alert,\n Spinner,\n Textarea,\n Divider,\n} from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\nimport { pathOr } from 'ramda'\n\nimport Categories from './admin/component/categories'\nimport saveTokenGQL from './admin/graphql/saveToken.graphql'\nimport getAccountGQL from './admin/graphql/getAccount.graphql'\n\nconst AdminExample: FC = () => {\n const [buttonMessage, setButtonMessage] = useState('')\n const [cvcRequired] = useState(true)\n const [showAlert, setShowAlert] = useState(false)\n const [showIsNotConfigured, setShowIsNotConfigured] = useState(false)\n const [categories, setCategories] = useState([])\n const [visualization, setVisualization] = useState([])\n\n const [saveToken] = useMutation(saveTokenGQL)\n const { loading, data } = useQuery(getAccountGQL)\n\n useEffect(() => {\n if (!data || !data.getAccount) return\n setShowIsNotConfigured(\n data.getAccount.isConfigured !== null\n ? !data.getAccount.isConfigured\n : true\n )\n setButtonMessage(pathOr('', ['getAccount', 'buttonMessage'], data))\n setCategories(pathOr([], ['getAccount', 'visualization'], data))\n }, [data])\n\n const handleClick = () => {\n saveToken({\n variables: { cvcRequired, visualization, buttonMessage },\n }).then(() => {\n setShowAlert(true)\n setShowIsNotConfigured(false)\n })\n }\n\n if (loading) {\n return <Spinner />\n }\n\n return (\n <Layout>\n <PageBlock\n title={<FormattedMessage id=\"checkoutless.settings.title\" />}\n subtitle={<FormattedMessage id=\"checkoutless.settings.subtitle\" />}\n variation=\"full\"\n >\n {showAlert ? (\n <div className=\"mb5\">\n <Alert\n autoClose={5000}\n type=\"success\"\n onClose={() => setShowAlert(false)}\n >\n <FormattedMessage id=\"checkoutless.settings.success\" />\n </Alert>\n </div>\n ) : (\n <></>\n )}\n {showIsNotConfigured && (\n <div className=\"mb5\">\n <Alert type=\"warning\" onClose={() => setShowIsNotConfigured(false)}>\n <FormattedMessage id=\"checkoutless.settings.warning\" />\n </Alert>\n </div>\n )}\n\n <div className=\"mb5\">\n <Textarea\n label=\"Button Message\"\n onChange={(e: any) => setButtonMessage(e.target.value)}\n value={buttonMessage}\n maxLength=\"140\"\n helpText={\n <FormattedMessage id=\"checkoutless.settings.buttonMessage\" />\n }\n />\n </div>\n {/* <div className=\"mb5\">\n <Toggle\n label=\"Require CVC\"\n checked={cvcRequired}\n semantic\n onChange={() => setCvcRequired(!cvcRequired)}\n />\n </div> */}\n <Divider />\n <Categories visualization={categories} onChange={setVisualization} />\n </PageBlock>\n <div className=\"flex justify-end\">\n <Button onClick={handleClick}>\n <FormattedMessage id=\"checkoutless.inputs.save-button\" />\n </Button>\n </div>\n </Layout>\n )\n}\n\nexport default AdminExample\n\n```"
}
] |
code_mycheckout-store-framework_86430c31
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/QuickpayButton.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n// import React, { useState, useEffect } from 'react'\n// import { useMutation } from 'react-apollo'\n// import { Kuikpay } from 'kuikpay-sdk'\n// import { useOrderForm } from 'vtex.order-manager/OrderForm'\n// import addToCartMutation from 'vtex.checkout-resources/MutationAddToCart'\n// import updateItemsMutation from 'vtex.checkout-resources/MutationUpdateItems'\n// import useProduct from 'vtex.product-context/useProduct'\n// import updateOrderFormProfileMutation from 'vtex.checkout-resources/MutationUpdateOrderFormProfile'\n// import insertCouponMutation from 'vtex.checkout-resources/MutationInsertCoupon'\n// import { useProductDispatch } from 'vtex.product-context/ProductDispatchContext'\n\n// import removeItemOfferingMutation from './mutations/removeItemOffering.graphql'\n// import addItemOfferingMutation from './mutations/addItemOffering.graphql'\n\n// import './App.global.css'\n// import type {\n// //Card,\n// CartSimulation,\n// Config,\n// CustomData,\n// Item,\n// ItemToAdd,\n// ItemToRemove,\n// OfferingInput,\n// OrderForm,\n// ProductItem,\n// Profile,\n// ResponseValidateItem,\n// Seller,\n// Totalizer,\n// } from './interfaces'\n\n// interface Props {\n// validateItems?: () => ResponseValidateItem[]\n// customData?: CustomData\n// isVisible?: boolean\n// config?: Config\n// validateBeforeOfAdd?: () => boolean | undefined\n// sellerId?: string\n// onClickBehavior?: 'ensure-sku-selection'\n// handleGetDocumentsClient?: (email: string) => void\n// }\n\n// function App(props: Props) {\n// const {\n// validateItems,\n// customData,\n// isVisible,\n// onClickBehavior,\n// validateBeforeOfAdd,\n// sellerId,\n// config,\n// handleGetDocumentsClient,\n// } = props\n\n// const [order, setOrder] = useState<OrderForm | null>(null)\n// const [isAvailable, setIsAvailable] = useState(false)\n// const [itemToAdd, setItemToAdd] = useState<ItemToAdd | undefined>()\n\n// const {\n// selectedItem: selectedItemContext,\n// selectedQuantity,\n// product,\n// } = useProduct()\n\n// const selectedItem = selectedItemContext ?? product?.items[0]\n// const dispatch = useProductDispatch()\n// const itemsLength = product?.items?.length ?? 0\n// const multipleAvailableSKUs = itemsLength > 1\n\n// useEffect(() => {\n// const availableBySeller = selectedItem?.sellers?.find(\n// (seller: Seller) => seller.commertialOffer.AvailableQuantity > 0\n// )\n\n// if (availableBySeller) {\n// setIsAvailable(true)\n// } else {\n// setIsAvailable(false)\n// }\n\n// setItemToAdd({\n// id: selectedItem?.itemId,\n// quantity: selectedQuantity,\n// seller: sellerId ?? selectedItem?.sellers[0]?.sellerId,\n// })\n// }, [selectedItem, selectedQuantity, sellerId])\n\n// const { orderForm, loading, setOrderForm } = useOrderForm()\n\n// const [addToCart] = useMutation(addToCartMutation)\n// const [updateItems] = useMutation(updateItemsMutation)\n// const [updateOrderFormProfile] = useMutation(updateOrderFormProfileMutation)\n// const [insertCoupon] = useMutation(insertCouponMutation)\n\n// const handleInsertCoupon = (text: string) => {\n// insertCoupon({\n// variables: {\n// text,\n// },\n// }).then((data) => setOrderForm(data.data.insertCoupon))\n// }\n\n// const [addItemOffering] = useMutation(addItemOfferingMutation)\n// const [removeItemOffering] = useMutation(removeItemOfferingMutation)\n\n// const handleAddItemOffering = (offeringInput: OfferingInput) => {\n// addItemOffering({\n// variables: {\n// offeringInput,\n// },\n// }).then((data) => setOrderForm(data.data.addItemOffering))\n// }\n\n// const handleRemoveItemOffering = (offeringInput: OfferingInput) => {\n// removeItemOffering({\n// variables: {\n// offeringInput,\n// },\n// }).then((data) => setOrderForm(data.data.removeItemOffering))\n// }\n\n// const handleAddToCart = (item: ItemToAdd) => {\n// const id: number = +item.id\n\n// addToCart({\n// variables: {\n// items: [\n// {\n// id,\n// quantity: item.quantity,\n// seller: item.seller,\n// },\n// ],\n// },\n// }).then((data) => setOrderForm(data.data.addToCart))\n// }\n\n// const handleUpdateItems = (items: ItemToRemove[]) => {\n// updateItems({\n// variables: {\n// orderItems: items,\n// },\n// }).then((data) => setOrderForm(data.data.updateItems))\n// }\n\n// const handleClearItems = (items: ItemToRemove[]) => {\n// updateItems({\n// variables: {\n// orderItems: items,\n// },\n// }).then((data) => setOrderForm(data.data.updateItems))\n// }\n\n// const handleUpdateOrderFormProfile = (profile: Profile) => {\n// updateOrderFormProfile({\n// variables: {\n// profile,\n// },\n// })\n// }\n\n// const cartSimulation = async (body: CartSimulation) => {\n// const myHeaders = new Headers()\n\n// myHeaders.append('Accept', 'application/json')\n// myHeaders.append('Content-Type', 'application/json')\n\n// const raw = JSON.stringify(body)\n\n// const requestOptions = {\n// method: 'POST',\n// headers: myHeaders,\n// body: raw,\n// redirect: 'follow' as const,\n// }\n\n// const response = await fetch(\n// '/api/checkout/pub/orderforms/simulation',\n// requestOptions\n// )\n\n// return response\n// }\n\n// useEffect(() => {\n// if (loading) return\n\n// const formattedOrderForm = {\n// clientProfileData: {\n// email: orderForm.clientProfileData?.email,\n// },\n// shippingData: {\n// selectedAddress: {\n// addressId: orderForm.selectedAddress?.addressId || '',\n// addressType: orderForm.selectedAddress?.addressType || '',\n// city: orderForm.selectedAddress?.city || '',\n// complement: orderForm.selectedAddress?.complement || '',\n// country: orderForm.selectedAddress?.country || '',\n// geoCoordinates: orderForm.selectedAddress?.geoCoordinates || '',\n// isDisposable: orderForm.selectedAddress?.isDisposable || '',\n// neighborhood: orderForm.selectedAddress?.neighborhood || '',\n// number: orderForm.selectedAddress?.number || '',\n// postalCode: orderForm.selectedAddress?.postalCode || '',\n// receiverName: orderForm.selectedAddress?.receiverName || '',\n// reference: orderForm.selectedAddress?.reference || '',\n// state: orderForm.selectedAddress?.state || '',\n// street: orderForm.selectedAddress?.street || '',\n// completed: false,\n// },\n// },\n// items: orderForm.items.map((item: Item) => ({\n// ...item,\n// sellingPrice: item.sellingPrice / 100,\n// price: item.price / 100,\n// imageUrl: item.imageUrls.at1x,\n// })),\n// totalizers: orderForm.totalizers?.map((totalizer: Totalizer) => ({\n// ...totalizer,\n// value: totalizer.value / 100,\n// })),\n// value: orderForm.value / 100,\n// // paymentData: {\n// // availablePaymentMethods: orderForm.paymentData?.availableAccounts?.map(\n// // (card: Card) => ({\n// // franchise: card.paymentSystemName,\n// // id: card.accountId,\n// // number: card.cardNumber.substring(12),\n// // paymentMethod: 'tc',\n// // })\n// // ),\n// // },\n// messages: orderForm.messages.couponMessages\n// ? orderForm.messages.couponMessages\n// : orderForm.messages,\n// marketingData: {\n// coupon: orderForm.marketingData.coupon,\n// },\n// }\n\n// setOrder(formattedOrderForm)\n// }, [loading, orderForm])\n\n// if (loading) return null\n\n// const language = __RUNTIME__?.culture?.language\n// const theme = __RUNTIME__?.query?.theme || 'vtex'\n// const runtime = {\n// account: __RUNTIME__?.account,\n// workspace: __RUNTIME__?.workspace,\n// }\n\n// const processIsVisible = () => {\n// if (isVisible === null || isVisible === undefined) {\n// return !selectedItem ? true : isAvailable\n// }\n\n// return isVisible\n// }\n\n// const handleSelectedItem = (item: ProductItem) => {\n// dispatch({ type: 'SET_SELECTED_ITEM', args: { item } })\n// }\n\n// return (\n// <Kuikpay\n// addToCart={handleAddToCart}\n// itemToAdd={itemToAdd}\n// updateItems={handleUpdateItems}\n// orderForm={order}\n// updateSelectedAddress={() => {}}\n// updateOrderFormProfile={handleUpdateOrderFormProfile}\n// cartSimulation={cartSimulation}\n// clearData={handleClearItems}\n// language={language}\n// isVisible={processIsVisible()}\n// theme={theme}\n// insertCoupon={handleInsertCoupon}\n// addItemOffering={handleAddItemOffering}\n// removeItemOffering={handleRemoveItemOffering}\n// validateItems={validateItems}\n// customData={customData}\n// config={config}\n// validateBeforeOfAdd={validateBeforeOfAdd}\n// multipleAvailableSKUs={multipleAvailableSKUs}\n// onClickBehavior={onClickBehavior}\n// product={product}\n// selectedItem={selectedItem}\n// handleSelectedItem={handleSelectedItem}\n// runtime={runtime}\n// handleGetDocumentsClient={handleGetDocumentsClient}\n// />\n// )\n// }\n\n// export default App\n\n```"
}
] |
code_mycheckout-store-framework_9e281ddb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/QuickpayButtonV2.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useState, useEffect } from 'react'\nimport { useMutation } from 'react-apollo'\nimport { Kuikpay } from 'kuikpay-sdk'\nimport { useOrderForm } from 'vtex.order-manager/OrderForm'\nimport addToCartMutation from 'vtex.checkout-resources/MutationAddToCart'\nimport useProduct from 'vtex.product-context/useProduct'\nimport { useProductDispatch } from 'vtex.product-context/ProductDispatchContext'\n\n// eslint-disable-next-line import/order\n\nimport './App.global.css'\nimport type {\n ItemToAdd,\n ProductItem,\n ResponseValidateItem,\n Seller,\n} from './interfaces'\nimport { CONSTANTS } from './utils'\n\ninterface Props {\n validateItems?: () => ResponseValidateItem[]\n isVisible?: boolean\n validateBeforeOfAdd?: () => boolean | undefined\n sellerId?: string\n onClickBehavior?: 'ensure-sku-selection'\n forceOpenModal?: boolean\n}\n\nfunction App(props: Props) {\n const {\n isVisible,\n onClickBehavior,\n validateBeforeOfAdd,\n sellerId,\n forceOpenModal,\n } = props\n\n const [isAvailable, setIsAvailable] = useState(false)\n const [itemToAdd, setItemToAdd] = useState<ItemToAdd | undefined>()\n const [multipleAvailableSKUs, setMultipleAvailableSKUs] = useState(false)\n const [isBehavior, setIsBehavior] = useState(onClickBehavior)\n\n const {\n selectedItem: selectedItemContext,\n selectedQuantity,\n product,\n skuSelector: { areAllVariationsSelected },\n } = useProduct()\n\n const dispatch = useProductDispatch()\n\n useEffect(() => {\n if (!onClickBehavior) {\n setIsBehavior(\n areAllVariationsSelected ? undefined : 'ensure-sku-selection'\n )\n }\n }, [areAllVariationsSelected, onClickBehavior])\n\n const selectedItem =\n selectedItemContext || (product?.items?.length ? product?.items[0] : null)\n\n const itemsLength = product?.items?.length ?? 0\n\n useEffect(() => {\n if (itemsLength > 1) {\n const hasVariations =\n product?.items?.filter((item: any) => item.variations?.length > 0) || []\n\n hasVariations.length > 0 && setMultipleAvailableSKUs(true)\n }\n }, [itemsLength, product?.items, selectedItem])\n\n useEffect(() => {\n const availableBySeller = selectedItem?.sellers?.find(\n (seller: Seller) => seller.commertialOffer.AvailableQuantity > 0\n )\n\n if (availableBySeller) {\n setIsAvailable(true)\n } else {\n setIsAvailable(false)\n }\n\n setItemToAdd({\n id: selectedItem?.itemId,\n quantity: selectedQuantity,\n seller: sellerId ?? selectedItem?.sellers[0]?.sellerId,\n })\n }, [selectedItem, selectedQuantity, sellerId])\n\n const { setOrderForm } = useOrderForm()\n\n const [addToCart] = useMutation(addToCartMutation)\n\n const handleAddToCart = (item: ItemToAdd) => {\n const id: number = item.id ? +item.id : NaN\n\n // eslint-disable-next-line use-isnan\n if (id !== NaN) {\n addToCart({\n variables: {\n items: [\n {\n id,\n quantity: item.quantity,\n seller: item.seller,\n },\n ],\n },\n }).then((data) => setOrderForm(data.data.addToCart))\n }\n }\n\n const processIsVisible = () => {\n if (isVisible === null || isVisible === undefined) {\n return !selectedItem ? true : isAvailable\n }\n\n return isVisible\n }\n\n const handleSelectedItem = (item: ProductItem) => {\n dispatch({ type: 'SET_SELECTED_ITEM', args: { item } })\n }\n\n const runtime = {\n account: __RUNTIME__?.account,\n workspace: __RUNTIME__?.workspace,\n platform: CONSTANTS.platform,\n }\n\n if (!selectedItem) return null\n\n return (\n <Kuikpay\n addToCart={handleAddToCart}\n itemToAdd={itemToAdd}\n isVisible={processIsVisible()}\n validateBeforeOfAdd={validateBeforeOfAdd}\n multipleAvailableSKUs={multipleAvailableSKUs}\n onClickBehavior={isBehavior}\n product={product}\n selectedItem={selectedItem}\n forceOpenModal={forceOpenModal}\n runtime={runtime}\n handleSelectedItem={handleSelectedItem}\n />\n )\n}\n\nexport default App\n\n```"
}
] |
code_mycheckout-store-framework_7d86a071
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/adminJsonSchema.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nconst AdminJsonSchema = () => {\n return (\n <div className=\"h-100 bg-light-silver min-vh-100 flex flex-row-reverse bg-base bb bw1 b--muted-5\">\n <div\n className=\"center w-100 vh-100 overflow-y-auto\"\n style={{ maxWidth: 320 }}\n >\n <iframe\n className=\"w-100 h-100\"\n frameBorder=\"0\"\n id=\"kuikpay-iframe\"\n src=\"https://milwaukee-voice-jury-thought.trycloudflare.com/\"\n title=\"kuikpay-iframe\"\n />\n </div>\n </div>\n )\n}\n\nexport default AdminJsonSchema\n\n```"
}
] |
code_mycheckout-store-framework_17511fc9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/adminLinksList.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo, useState } from 'react'\nimport type { FC } from 'react'\nimport {\n Layout,\n PageBlock,\n PageHeader,\n Table,\n Tag,\n Alert,\n} from 'vtex.styleguide'\nimport { useRuntime } from 'vtex.render-runtime'\nimport { FormattedMessage, defineMessages, useIntl } from 'react-intl'\nimport { useQuery } from 'react-apollo'\n\nimport LinkItemAction from './admin/component/LinkItemAction'\nimport GET_LINKS_ACCOUNT from './admin/graphql/getLinksByAccount.graphql'\n\nconst LinkListContext = React.createContext<any>(null)\n\nconst messages = defineMessages({\n approvedMessage: { id: 'checkoutless.linksList.approvedMessage' },\n rejectedMessage: { id: 'checkoutless.linksList.rejectedMessage' },\n deleteMessage: { id: 'checkoutless.linksList.deleteMessage' },\n})\n\nconst defaultSchema = {\n properties: {\n account: {\n title: <FormattedMessage id=\"checkoutless.linksList.accountColumn\" />,\n },\n date: {\n title: <FormattedMessage id=\"checkoutless.linksList.dateColumn\" />,\n },\n status: {\n title: <FormattedMessage id=\"checkoutless.linksList.statusColumn\" />,\n cellRenderer: ({\n cellData,\n rowData,\n }: {\n cellData: string\n rowData: { approver: boolean }\n }) => {\n return (\n <span className=\"tc\">\n {cellData === 'pending' && rowData.approver && (\n <Tag type=\"warning\">\n <FormattedMessage id=\"checkoutless.linksList.pending\" />\n </Tag>\n )}\n {cellData === 'pending' && !rowData.approver && (\n <Tag>\n <FormattedMessage id=\"checkoutless.linksList.pending\" />\n </Tag>\n )}\n {cellData === 'approved' && (\n <Tag type=\"success\">\n <FormattedMessage id=\"checkoutless.linksList.approved\" />\n </Tag>\n )}\n {cellData === 'rejected' && (\n <Tag type=\"error\">\n <FormattedMessage id=\"checkoutless.linksList.rejected\" />\n </Tag>\n )}\n </span>\n )\n },\n },\n action: {\n title: <FormattedMessage id=\"checkoutless.linksList.actionColumn\" />,\n cellRenderer: ({\n rowData,\n }: {\n rowData: { approver: boolean; status: string; id: string }\n }) => {\n return (\n <LinkListContext.Consumer>\n {(value) => (\n <LinkItemAction\n rowData={rowData}\n refetch={value.refetch}\n setMessageId={value.setMessageId}\n setShowAlert={value.setShowAlert}\n />\n )}\n </LinkListContext.Consumer>\n )\n },\n },\n },\n}\n\nconst LinkList: FC = () => {\n const [messageId, setMessageId] = useState<\n 'deleteMessage' | 'approvedMessage' | 'rejectedMessage'\n >('deleteMessage')\n\n const [showAlert, setShowAlert] = useState(false)\n const { navigate } = useRuntime()\n const intl = useIntl()\n\n const { data, loading, refetch } = useQuery(GET_LINKS_ACCOUNT, {\n fetchPolicy: 'network-only',\n })\n\n const linksListResult = useMemo(() => {\n if (data) {\n return data.getLinksByAccount\n }\n\n return []\n }, [data])\n\n return (\n <LinkListContext.Provider value={{ refetch, setMessageId, setShowAlert }}>\n <Layout\n pageHeader={\n <PageHeader\n title={<FormattedMessage id=\"checkoutless.linksList.title\" />}\n />\n }\n >\n <PageBlock variation=\"full\">\n {showAlert ? (\n <div className=\"mb5\">\n <Alert\n autoClose={5000}\n type=\"success\"\n onClose={() => setShowAlert(false)}\n >\n {intl.formatMessage(messages[messageId])}\n </Alert>\n </div>\n ) : (\n <></>\n )}\n <Table\n fullWidth\n schema={defaultSchema}\n items={linksListResult}\n loading={loading}\n toolbar={{\n newLine: {\n label: (\n <FormattedMessage id=\"checkoutless.linksList.newLinkButton\" />\n ),\n handleCallback: () =>\n navigate({ to: '/admin/app/kuikpay/links/new' }),\n },\n }}\n />\n </PageBlock>\n </Layout>\n </LinkListContext.Provider>\n )\n}\n\nexport default LinkList\n\n```"
}
] |
code_mycheckout-store-framework_954bb727
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/package.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"kuikpay\",\n \"version\": \"0.0.0\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"@types/ramda\": \"^0.27.64\",\n \"apollo-client\": \"^2.6.8\",\n \"kuikpay-sdk\": \"1.0.27\",\n \"ramda\": \"^0.28.0\",\n \"react\": \"^17.0.2\",\n \"react-apollo\": \"^3.1.3\",\n \"react-color\": \"^2.19.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/jest\": \"^25.1.4\",\n \"@types/node\": \"^13.13.52\",\n \"@types/react\": \"^16.14.14\",\n \"@vtex/test-tools\": \"^3.4.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"graphql\": \"^14.6.0\",\n \"recharts\": \"^2.1.8\",\n \"typescript\": \"3.9.7\",\n \"vtex.admin-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.admin-graphql@2.36.5/public/@types/vtex.admin-graphql\",\n \"vtex.catalog-api-proxy\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-api-proxy@0.10.2/public/_types/react\",\n \"vtex.checkout-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-graphql@0.65.1/public/@types/vtex.checkout-graphql\",\n \"vtex.checkout-resources\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.checkout-resources@0.48.0/public/@types/vtex.checkout-resources\",\n \"vtex.order-manager\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.11.1/public/@types/vtex.order-manager\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.10.0/public/@types/vtex.product-context\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime\",\n \"vtex.search-page-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-page-context@0.2.0/public/@types/vtex.search-page-context\",\n \"vtex.store\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store@2.123.0/public/@types/vtex.store\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.149.3/public/@types/vtex.store-graphql\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide\"\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_17e8f15c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/KuikpayWrapper.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n// import React, { useEffect, useState } from 'react'\n// import { KuikpayWrapper } from 'kuikpay-sdk'\n// import { useLazyQuery, useMutation } from 'react-apollo'\n// import insertCouponMutation from 'vtex.checkout-resources/MutationInsertCoupon'\n// import { useOrderForm } from 'vtex.order-manager/OrderForm'\n// import updateOrderFormProfileMutation from 'vtex.checkout-resources/MutationUpdateOrderFormProfile'\n// import OrderFormQuery from 'vtex.checkout-resources/QueryOrderForm'\n// import updateItemsMutation from 'vtex.checkout-resources/MutationUpdateItems'\n// import { useSearchPage } from 'vtex.search-page-context/SearchPageContext'\n// import addToCartMutation from 'vtex.checkout-resources/MutationAddToCart'\n\nimport type {\n Address,\n BlockedShipping,\n Config,\n CustomData,\n // Item,\n // ItemToAdd,\n // ItemToRemove,\n // OfferingInput,\n // OrderForm,\n // Profile,\n StoreTermsAndConditionsContent,\n ShowPaymentMethod,\n} from './interfaces'\n// import addItemOfferingMutation from './mutations/addItemOffering.graphql'\n// import removeItemOfferingMutation from './mutations/removeItemOffering.graphql'\n// import { CONSTANTS } from './utils'\n\ninterface Props {\n children: JSX.Element\n addressAlternative?: Address | undefined | null\n customData?: CustomData\n config?: Config\n skuSelectorProps?: {\n useImageInColor?: boolean\n visibleVariations?: string[]\n }\n handleGetDocumentsClient?: (email: string) => void\n storeTermsAndConditionsContent?: StoreTermsAndConditionsContent[]\n blockedShipping?: BlockedShipping\n showPaymentMethods?: ShowPaymentMethod[]\n}\n\n// const Kuikpaywrapper = ({\n// addressAlternative,\n// skuSelectorProps,\n// customData,\n// config,\n// handleGetDocumentsClient,\n// storeTermsAndConditionsContent,\n// blockedShipping,\n// showPaymentMethods,\n// }: Props) => {\nconst Kuikpaywrapper = (_props: Props) => {\n // const [formattedItems, setFormattedItems] = useState([])\n // const [order, setOrder] = useState<OrderForm | null>(null)\n // const [insertCoupon] = useMutation(insertCouponMutation)\n // const [addItemOffering] = useMutation(addItemOfferingMutation)\n // const [removeItemOffering] = useMutation(removeItemOfferingMutation)\n // const [updateOrderFormProfile] = useMutation(updateOrderFormProfileMutation)\n // const [updateItems] = useMutation(updateItemsMutation)\n // const [addToCart] = useMutation(addToCartMutation)\n // const OrderFormContext = useOrderForm()\n // const { orderForm, loading, setOrderForm } = OrderFormContext\n // const { searchQuery } = useSearchPage()\n // const [getOrderForm, { data: orderFormData }] = useLazyQuery(OrderFormQuery, {\n // fetchPolicy: 'network-only',\n // })\n\n // const cartSimulation = async (simulationItems: any) => {\n // const myHeaders = new Headers()\n\n // myHeaders.append('Accept', 'application/json')\n // myHeaders.append('Content-Type', 'application/json')\n\n // const raw = JSON.stringify(simulationItems)\n\n // const requestOptions = {\n // method: 'POST',\n // headers: myHeaders,\n // body: raw,\n // redirect: 'follow' as const,\n // }\n\n // const response = await fetch(\n // '/api/checkout/pub/orderforms/simulation?RnbBehavior=0',\n // requestOptions\n // )\n\n // return response\n // }\n\n // const parseLogisticsInfo = (deliveryOptions: any, selectedAddress: any) => {\n // const initialLogisticsInfo: any[] = []\n\n // deliveryOptions.forEach((deliveryOption: any, index: number) => {\n // initialLogisticsInfo.push({\n // addressId: selectedAddress.addressId,\n // itemIndex: index, // this is not real, only because simulation needs it to trigger a totalizer\n // selectedSla: deliveryOption.id,\n // deliveryChannel: deliveryOption.deliveryChannel,\n // })\n // })\n\n // // merge delivery options\n // // merge pickup options\n // return initialLogisticsInfo\n // }\n\n // useEffect(() => {\n // setFormattedItems(\n // orderForm.items.map((item: Item) => ({\n // ...item,\n // sellingPrice: item.sellingPrice / 100,\n // price: item?.price / 100,\n // listPrice: item?.listPrice / 100,\n // imageUrl: item?.imageUrls?.at1x,\n // }))\n // )\n // }, [orderForm.items])\n\n // useEffect(() => {\n // if (loading) return\n\n // const formattedOrderForm: any = {\n // clientProfileData: {\n // email: orderForm.clientProfileData?.email,\n // },\n // shippingData: {\n // addressAlternative: null,\n // selectedAddress: {\n // addressId: orderForm.shipping?.selectedAddress?.addressId || '',\n // addressType: orderForm.shipping?.selectedAddress?.addressType || '',\n // city: orderForm.shipping?.selectedAddress?.city || '',\n // complement: orderForm.shipping?.selectedAddress?.complement || '',\n // country: orderForm.shipping?.selectedAddress?.country || '',\n // geoCoordinates:\n // orderForm.shipping?.selectedAddress?.geoCoordinates || '',\n // isDisposable: orderForm.shipping?.selectedAddress?.isDisposable || '',\n // neighborhood: orderForm.shipping?.selectedAddress?.neighborhood || '',\n // number: orderForm.shipping?.selectedAddress?.number || '',\n // postalCode: orderForm.shipping?.selectedAddress?.postalCode || '',\n // receiverName: orderForm.shipping?.selectedAddress?.receiverName || '',\n // reference: orderForm.shipping?.selectedAddress?.reference || '',\n // state: orderForm.shipping?.selectedAddress?.state || '',\n // street: orderForm.shipping?.selectedAddress?.street || '',\n // completed: false,\n // },\n // },\n // logisticsInfo: parseLogisticsInfo(\n // orderForm.shipping?.deliveryOptions,\n // orderForm.shipping?.selectedAddress\n // ),\n // items: formattedItems,\n // totalizers: orderForm.totalizers,\n // value: orderForm.value / 100,\n // paymentData: {\n // availablePaymentMethods: orderForm.paymentData?.availableAccounts?.map(\n // (card: any) => ({\n // franchise: card.paymentSystemName,\n // id: card.accountId,\n // number: card.cardNumber.substring(12),\n // paymentMethod: 'tc',\n // origin: 'store',\n // })\n // ),\n // },\n // messages: orderForm.messages.couponMessages\n // ? orderForm.messages.couponMessages\n // : orderForm.messages,\n // marketingData: {\n // coupon: orderForm.marketingData.coupon,\n // },\n // }\n\n // if (addressAlternative) {\n // formattedOrderForm.shippingData.addressAlternative = addressAlternative\n // }\n\n // setOrder(formattedOrderForm)\n // }, [\n // loading,\n // orderForm.clientProfileData?.email,\n // orderForm.shipping?.selectedAddress,\n // orderForm.shipping?.deliveryOptions,\n // orderForm.items,\n // orderForm.totalizers,\n // orderForm.value,\n // orderForm.paymentData?.availableAccounts,\n // orderForm.messages,\n // orderForm.marketingData,\n // addressAlternative,\n // formattedItems,\n // ])\n\n // useEffect(() => {\n // if (orderFormData) {\n // setOrderForm(orderFormData?.orderForm)\n // }\n // // eslint-disable-next-line react-hooks/exhaustive-deps\n // }, [orderFormData])\n\n // const clearOrderFormProfile = async () => {\n // const orderFormId = orderForm?.id\n // const clientProfileData = orderForm?.clientProfileData\n\n // if (clientProfileData) {\n // await fetch(`/checkout/changeToAnonymousUser/${orderFormId}`, {\n // method: 'GET',\n // redirect: 'follow',\n // }).then(() =>\n // getOrderForm({\n // variables: {\n // refreshOutdatedData: false,\n // },\n // })\n // )\n // }\n // }\n\n // const handleInsertCoupon = (text: string) => {\n // insertCoupon({\n // variables: {\n // text,\n // },\n // }).then((data) => setOrderForm(data.data.insertCoupon))\n // }\n\n // const handleAddItemOffering = (offeringInput: OfferingInput) => {\n // addItemOffering({\n // variables: {\n // offeringInput,\n // },\n // }).then((data) => setOrderForm(data.data.addItemOffering))\n // }\n\n // const handleRemoveItemOffering = (offeringInput: OfferingInput) => {\n // removeItemOffering({\n // variables: {\n // offeringInput,\n // },\n // }).then((data) => setOrderForm(data.data.removeItemOffering))\n // }\n\n // const handleUpdateOrderFormProfile = (profile: Profile) => {\n // updateOrderFormProfile({\n // variables: {\n // profile,\n // },\n // }).then((data) => setOrderForm(data.data.updateOrderFormProfile))\n // }\n\n // const handleAddToCart = (item: ItemToAdd) => {\n // const id: number = item.id ? +item.id : NaN\n\n // // eslint-disable-next-line use-isnan\n // if (id !== NaN) {\n // addToCart({\n // variables: {\n // items: [\n // {\n // id,\n // quantity: item.quantity,\n // seller: item.seller,\n // },\n // ],\n // },\n // }).then((data) => setOrderForm(data.data.addToCart))\n // }\n // }\n\n // const handleUpdateItems = async (items: ItemToRemove[]) => {\n // updateItems({\n // variables: {\n // orderItems: items?.map((item: ItemToRemove) => ({\n // uniqueId: item?.uniqueId,\n // quantity: item?.quantity,\n // })),\n // },\n // })\n // .then((data) => {\n // setOrderForm(data.data.updateItems)\n // })\n // .then(() => searchQuery?.refetch())\n // }\n\n // const handleClearItems = (items: ItemToRemove[]) => {\n // insertCoupon({\n // variables: {\n // text: '',\n // },\n // }).then(() =>\n // updateItems({\n // variables: {\n // orderItems: items,\n // },\n // })\n // .then((data) => {\n // setOrderForm(data.data.updateItems)\n // })\n // .then(() => searchQuery?.refetch())\n // )\n // }\n\n // const language = __RUNTIME__?.culture?.language\n // const theme = __RUNTIME__?.query?.theme || 'kuikpay'\n // const runtime = {\n // account: __RUNTIME__?.account,\n // workspace: __RUNTIME__?.workspace,\n // platform: CONSTANTS.platform,\n // }\n\n // const production = __RUNTIME__?.production\n\n // if (!orderForm || orderForm?.id === 'default-order-form') return null\n\n return null\n\n // return (\n // <KuikpayWrapper\n // sandbox={!production}\n // updateSelectedAddress={() => {}}\n // cartSimulation={cartSimulation}\n // language={language}\n // theme={theme}\n // runtime={runtime}\n // insertCoupon={handleInsertCoupon}\n // addItemOffering={handleAddItemOffering}\n // removeItemOffering={handleRemoveItemOffering}\n // updateOrderFormProfile={handleUpdateOrderFormProfile}\n // updateItems={handleUpdateItems}\n // clearData={handleClearItems}\n // orderForm={order}\n // addToCart={handleAddToCart}\n // clearOrderFormProfile={clearOrderFormProfile}\n // skuSelectorProps={skuSelectorProps}\n // customData={customData}\n // config={config}\n // handleGetDocumentsClient={handleGetDocumentsClient}\n // storeTermsAndConditionsContent={storeTermsAndConditionsContent}\n // blockedShipping={blockedShipping}\n // showPaymentMethods={showPaymentMethods}\n // hideDiscount\n // />\n // )\n}\n\nexport default Kuikpaywrapper\n\n```"
}
] |
code_mycheckout-store-framework_ad591606
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/adminStatistics.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nexport { default } from './admin/component/statistics'\n\n```"
}
] |
code_mycheckout-store-framework_9709f26f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/adminOtherExample.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport type { FC } from 'react'\nimport React from 'react'\nimport { Layout, PageBlock } from 'vtex.styleguide'\nimport { useQuery } from 'react-apollo'\n\nimport tokenGQL from './admin/graphql/token.gql'\n\nconst AdminOtherExample: FC = () => {\n const { data: retrievedToken } = useQuery(tokenGQL)\n\n return (\n <Layout>\n <PageBlock\n title=\"Gerenciamento\"\n subtitle=\"Tokens e Dados de Configuração\"\n variation=\"full\"\n >\n <p>Current token: {retrievedToken?.token}</p>\n </PageBlock>\n </Layout>\n )\n}\n\nexport default AdminOtherExample\n\n```"
}
] |
code_mycheckout-store-framework_83b1eb9e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/adminLinkForm.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useState } from 'react'\nimport type { FC } from 'react'\nimport {\n Layout,\n PageBlock,\n PageHeader,\n Input,\n Button,\n Alert,\n} from 'vtex.styleguide'\nimport { useMutation } from 'react-apollo'\nimport { useRuntime } from 'vtex.render-runtime'\nimport { FormattedMessage } from 'react-intl'\n\nimport CREATE_LINK from './admin/graphql/createLink.graphql'\n\nconst LinkForm: FC = () => {\n const [account, setAccount] = useState('')\n const [errorAccountField, setErrorAccountField] = useState('')\n const [showAlert, setShowAlert] = useState(false)\n\n const { navigate } = useRuntime()\n\n const [createLink, { loading }] = useMutation(CREATE_LINK)\n\n const handleSaveChange = async () => {\n if (account) {\n try {\n await createLink({\n variables: {\n accountApprover: account,\n },\n })\n\n navigate({\n page: 'admin.app.checkoutless-linksList',\n })\n } catch (e) {\n setShowAlert(true)\n }\n } else {\n setErrorAccountField('Required')\n }\n }\n\n return (\n <Layout\n pageHeader={\n <PageHeader\n title={<FormattedMessage id=\"checkoutless.linkForm.title\" />}\n linkLabel={<FormattedMessage id=\"checkoutless.linksList.title\" />}\n onLinkClick={() => navigate({ to: '/admin/app/kuikpay/links' })}\n />\n }\n >\n <PageBlock variation=\"full\">\n {showAlert ? (\n <div className=\"mb5\">\n <Alert\n autoClose={5000}\n type=\"error\"\n onClose={() => setShowAlert(false)}\n >\n <FormattedMessage id=\"checkoutless.linkForm.linkExist\" />\n </Alert>\n </div>\n ) : (\n <></>\n )}\n <div className=\"mb5\">\n <Input\n label={<FormattedMessage id=\"checkoutless.linkForm.accountField\" />}\n value={account}\n onChange={(e: any) => {\n setErrorAccountField('')\n setAccount(e.target.value)\n }}\n minLength={5}\n maxLength={128}\n required\n placeholder=\"Required\"\n errorMessage={errorAccountField}\n />\n </div>\n </PageBlock>\n\n <div className=\"flex justify-end\">\n <div className=\"pb7 pr7-s flex-row \">\n <Button\n variation=\"primary\"\n onClick={handleSaveChange}\n isLoading={loading}\n >\n <FormattedMessage id=\"checkoutless.inputs.save-button\" />\n </Button>\n </div>\n </div>\n </Layout>\n )\n}\n\nexport default LinkForm\n\n```"
}
] |
code_mycheckout-store-framework_31419aa1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/react/adminPaymentList.tsx from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nexport { default } from './admin/component/PaymentList'\n\n```"
}
] |
code_mycheckout-store-framework_4416ccba
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/store/interfaces.json from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"kuikpay-button\": {\n \"component\": \"QuickpayButtonV2\"\n },\n \"kuikpay-quota-information\": {\n \"component\": \"KuikpayQuotaInformation\",\n \"render\": \"client\"\n },\n \"kuikpay-wrapper\": {\n \"component\": \"KuikpayWrapper\"\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_746ac567
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/address.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Address {\n id: ID!\n profile: String!\n country: String!\n state: String!\n city: String!\n street: String!\n number: String!\n postalCode: String!\n receiverName: String!\n geoCoordinates: Geocoordinates\n neighborhood: String\n reference: String\n isEqual: String\n}\n\ntype GeneralAddressResponse {\n message: String!\n data: Address!\n}\n\ntype Geocoordinates {\n latitude: String!\n longitude: String!\n}\n\n```"
}
] |
code_mycheckout-store-framework_bda93c36
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/orders.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Order {\n id: String\n transaction: Transaction\n}\n\ntype Transaction {\n RedirectResponseCollection: [RedirectResponseCollection]\n}\n\ntype RedirectResponseCollection {\n redirectUrl: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_4b9179ef
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/documents.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype PaginatedDocumentResponse {\n count: Int!\n total: Int!\n current: Int!\n prev: Int!\n next: Int!\n data: [DocumentTypes]\n}\n\ntype DocumentTypes {\n id: ID\n name: String\n type: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_761b2505
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/users.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Auth {\n email: String!\n code: Int!\n}\n\ntype PaginatedUserResponse {\n count: Int!\n total: Int!\n current: Int!\n prev: Int!\n next: Int!\n data: [User!]!\n}\n\ntype User {\n accessToken: String\n addresses: [Address]\n cards: [Payments]\n email: String!\n habeasData: Boolean\n id_number: String!\n id_type: String!\n id: ID\n lastname: String!\n name: String!\n phone_code: String!\n phone_number: String!\n selectedAddress: Address\n selectedPayment: SelectedPayment\n}\n\ntype GeneralUserResponse {\n message: String!\n data: User\n}\n\ntype GeneralResponse {\n message: String!\n}\n\n```"
}
] |
code_mycheckout-store-framework_d3aa3df1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/orion.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype AuthBnpl {\n message: String\n token: String\n sessionToken: String\n transactionId: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_51461a9e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/products.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Products {\n sku: String\n quantity: Int\n price: Float\n category: String\n subcategory: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_8326eca0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/accounts.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Visualization {\n type: String\n key: String\n secundaryKey: String\n}\n\ntype Accounts {\n cvcRequired: Boolean\n paymentSystem: String\n buttonMessage: String\n visualization: [Visualization]\n PaymentMethod: [PaymentsMethods]\n isConfigured: Boolean\n styles: String\n text: String\n hasGoogleAnalytics: Boolean\n additionalData: [AdditionalData]\n habeasDataInformation: HabeasDataInformation\n}\n\ntype AccountLink {\n approver: Boolean\n account: String\n status: String\n date: String\n id: String\n}\n\ntype ResponseVisualization {\n visualization: [AdminVisualization]\n}\n\ntype Remove {\n removed: Int\n id: String\n}\n\ntype AdminVisualization {\n type: String\n key: String\n}\n\ntype AdditionalData {\n key: String\n value: String\n}\n\ntype Account {\n account: String\n paymentMethodId: String\n cvcRequired: Boolean\n isConfigured: Boolean\n buttonMessage: String\n visualization: [AdminVisualization]\n buttonText: String\n additionalData: [AdditionalData]\n}\n\ntype HabeasDataInformation {\n url: String\n version: Int\n}\n\n```"
}
] |
code_mycheckout-store-framework_231e9f86
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/metrics.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype CategoryData {\n _id: String\n totalPrice: Float\n totalQuantity: Int\n category: String\n}\n\ntype SubcategoryData {\n _id: String\n totalPrice: Float\n totalQuantity: Int\n subcategory: String\n}\n\ntype PaginationCategory {\n total: Int\n current: Int\n next: Int\n prev: Int\n count: Int\n data: [CategoryData]\n}\n\ntype PaginationSubcategory {\n total: Int\n current: Int\n next: Int\n prev: Int\n count: Int\n data: [SubcategoryData]\n}\n\ntype CategoryMetrics {\n selectedPeriodCategory: PaginationCategory\n previousPeriodCategory: PaginationCategory\n currentDayCategory: Float\n currentDayVariationCategory: Float\n currentMonthCategory: Float\n}\n\ntype SubcategoryMetrics {\n category: String\n selectedPeriodSubcategory: PaginationSubcategory\n previousPeriodSubcategory: PaginationSubcategory\n currentDaySubcategory: Float\n currentDayVariationSubcategory: Float\n currentMonthSubcategory: Float\n}\n\ntype TicketAverageData {\n _id: String\n ticketAverage: Float\n}\n\ntype TicketAverage {\n selectedPeriodTicket: [TicketAverageData]\n previousPeriodTicket: [TicketAverageData]\n currentDayTicket: Float\n currentDayVariationTicket: Float\n currentMonthTicket: Float\n}\n\ntype CheckoutData {\n _id: String\n closedPurchases: Int\n}\n\ntype Checkout {\n selectedPeriodCheckout: [CheckoutData]\n previousPeriodCheckout: [CheckoutData]\n currentDayCheckout: Float\n currentDayVariationCheckout: Float\n currentMonthCheckout: Float\n}\n\ntype ButtonUsesData {\n _id: String\n use: Int\n}\n\ntype ButtonUses {\n selectedPeriodButton: [ButtonUsesData]\n previousPeriodButton: [ButtonUsesData]\n currentDayButton: Float\n currentDayVariationButton: Float\n currentMonthButton: Float\n}\n\ntype ConversionRateData {\n _id: String\n cr: Int\n}\n\ntype ConversionRate {\n selectedPeriodCR: [ConversionRateData]\n previousPeriodCR: [ConversionRateData]\n currentDayCR: Float\n currentDayVariationCR: Float\n currentMonthCR: Float\n}\n\ntype Categories {\n id: String\n name: String\n hasChildren: Boolean\n url: String\n children: [Categories]\n}\n\n```"
}
] |
code_mycheckout-store-framework_5a61e6b5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/countries.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype PaginatedCountriesResponse {\n count: Int!\n total: Int!\n current: Int!\n prev: Int!\n next: Int!\n data: [Countries]\n}\n\ntype Countries {\n id: String\n country: String\n iso: String\n phone: String\n postal_code_regex: String\n states: [States]\n}\n\ntype States {\n state: String\n cities: [Cities]\n}\n\ntype Cities {\n city_id: String\n city: String\n}\n\ntype SearchCities {\n city: String\n state: String\n country: String\n phone: String\n iso: String\n postal_code: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_b089f55d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/payments.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Payments {\n id: ID\n franchise: String\n number: String\n gateway: String\n bin: String\n cvv: String\n paymentSystem: String\n cardContent: [CardContent]\n}\n\ntype CardContent {\n key: String\n value: String\n}\n\ntype GeneralPaymentsResponse {\n message: String\n data: Payments\n}\n\ntype PaymentsMethods {\n id: ID\n type: String\n isActive: Boolean\n paymentMethodName: String\n accountName: String\n}\n\ntype SelectedPayment {\n card: Payments\n paymentMethod: String\n}\n\ntype ValidateCredit {\n approvedCredit: Int\n maxInstallments: Int\n}\n\ntype AdminPaymentsMethods {\n id: ID\n type: String\n isActive: Boolean\n paymentMethodName: String\n accountName: String\n}\n\ntype PaymentProccess {\n status: Boolean\n message: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_4b0518b1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/types/ecommerce.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Ecommerce {\n event: String\n userEmail: String\n account: String\n products: [Products]\n product: Products\n}\n\n```"
}
] |
code_mycheckout-store-framework_f6ac3543
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/address.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput AddressInput {\n addressId: String\n profileId: String\n country: String\n state: String\n city: String\n street: String\n number: String\n postalCode: String\n receiverName: String\n geoCoordinates: GeocoordinatesInput\n neighborhood: String\n reference: String\n}\n\ninput ExternalAddressInput {\n addressId: String\n postalCode: String\n country: String\n state: String\n city: String\n street: String\n number: String\n geoCoordinates: GeocoordinatesInput\n neighborhood: String\n addressType: String\n receiverName: String\n reference: String\n}\n\ninput GeocoordinatesInput {\n latitude: String\n longitude: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_8a50156d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/orders.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput OrderInput {\n items: [ItemInput]\n gifts: [GiftInput]\n offerings: [OfferingInput]\n payment: PaymentDataInput\n profile: ProfileInput\n shipping: ShippingInput\n account: AccountInput\n channel: String\n customData: CustomDataInput\n marketingData: MarketingDataInput\n ip: String!\n}\n\ninput CustomDataInput {\n customApps: [CustomAppsInput]\n}\n\ninput CustomAppsInput {\n id: String\n major: Int\n fields: [CustomFieldsInput]\n}\n\ninput CustomFieldsInput {\n key: String\n value: String\n}\n\ninput ShippingInput {\n addressId: String\n externalAddress: ExternalAddressInput\n logisticsInfo: [LogisticInfoInput]\n}\n\ninput OfferingInput {\n id: String\n parentItemId: String\n}\n\ninput GiftInput {\n id: String\n seller: String\n quantity: Int\n}\n\ninput ItemInput {\n id: String\n quantity: Int\n seller: String\n}\n\ninput DeliveryWindowInput {\n startDateUtc: String\n endDateUtc: String\n}\n\ninput LogisticInfoInput {\n itemIndex: Int\n selectedSla: String\n selectedDeliveryChannel: String\n deliveryWindow: DeliveryWindowInput\n}\n\ninput MarketingDataInput {\n coupon: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_098a974e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/users.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput UserInput {\n name: String\n lastname: String\n phone_code: String\n phone_number: String\n selectedAddress: ID\n selectedPayment: ID\n}\n\ninput ProfileInput {\n email: String\n habeasData: Boolean\n}\n\n```"
}
] |
code_mycheckout-store-framework_867e362f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/pagination.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput PaginationInput {\n limit: Int\n page: Int\n}\n\n```"
}
] |
code_mycheckout-store-framework_779f577f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/products.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput ProductsInput {\n sku: String\n quantity: Int\n price: Float\n category: String\n subcategory: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_03e52b1b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/accounts.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput VisualizationInput {\n type: String\n key: String\n}\n\ninput AccountInput {\n storePreferences: StorePreferencesInput\n}\n\ninput StorePreferencesInput {\n currencyCode: String\n countryCode: String\n salesChannel: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_dca0c3f8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/metrics.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput DatesInput {\n from: String\n until: String\n}\n\ninput FiltersInput {\n visualization: String\n selectedPeriod: DatesInput\n previousPeriod: DatesInput\n}\n\ninput MetricsInput {\n filters: FiltersInput\n pagination: PaginationInput\n timezone: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_56113517
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/payment.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput PaymentMethodsInput {\n type: String\n isActive: Boolean\n paymentMethodName: String\n accountName: String\n}\n\ninput PaymentDataInput {\n cardId: String\n gateway: String\n token: String\n franchise: String\n number: String\n paymentMethod: String\n additionalData: [AdditionalDataInput]\n holderName: String\n expirationDate: String\n cardNumber: String\n cvv: String\n bin: String\n holderDocument: String\n}\n\ninput AdditionalDataInput {\n key: String\n value: String\n}\n\n```"
}
] |
code_mycheckout-store-framework_feeaaef5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/graphql/inputs/ecommerce.graphql from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ninput DataInput {\n products: [ProductsInput]\n}\n\ninput EcommerceInput {\n event: String\n userEmail: String\n account: String\n data: DataInput\n}\n\n```"
}
] |
code_mycheckout-store-framework_010f8832
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/index.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport { AddressService } from './checkout/address'\nimport { AuthService } from './checkout/auth'\nimport { CountriesService } from './checkout/countries'\nimport { DocumentsService } from './checkout/documents'\nimport { OrderService } from './checkout/orders'\nimport { PaymentsService } from './checkout/payments'\nimport { AccountsService } from './checkout/accounts'\nimport { UserService } from './checkout/user'\nimport { CreditService } from './checkout/credit'\nimport { EcommerceService } from './checkout/ecommerce'\nimport SchedulerClient from './checkout/scheduler'\nimport { CheckoutlessClient } from './admin/checkoutless'\nimport { CategoriesClient } from './admin/categories'\nimport { PaymentsClient } from './admin/payments'\nimport { MetricsService } from './admin/metrics'\nimport { OrionServices } from './orion'\nimport { PaymentGateway } from './admin/paymentGateway'\n\nexport class Clients extends IOClients {\n /* ---- Checkout ---- */\n public get user() {\n return this.getOrSet('user', UserService)\n }\n\n public get auth() {\n return this.getOrSet('auth', AuthService)\n }\n\n public get address() {\n return this.getOrSet('address', AddressService)\n }\n\n public get payments() {\n return this.getOrSet('payments', PaymentsService)\n }\n\n public get orders() {\n return this.getOrSet('orders', OrderService)\n }\n\n public get countries() {\n return this.getOrSet('countries', CountriesService)\n }\n\n public get documents() {\n return this.getOrSet('documents', DocumentsService)\n }\n\n public get accounts() {\n return this.getOrSet('accounts', AccountsService)\n }\n\n public get credit() {\n return this.getOrSet('credit', CreditService)\n }\n\n public get ecommerce() {\n return this.getOrSet('ecommerce', EcommerceService)\n }\n\n public get scheduler() {\n return this.getOrSet('scheduler', SchedulerClient)\n }\n\n /* ---- Admin ---- */\n public get checkoutless() {\n return this.getOrSet('checkoutless', CheckoutlessClient)\n }\n\n public get categories() {\n return this.getOrSet('categories', CategoriesClient)\n }\n\n public get paymentsClient() {\n return this.getOrSet('paymentsClient', PaymentsClient)\n }\n\n public get adminMetrics() {\n return this.getOrSet('adminMetrics', MetricsService)\n }\n\n public get paymentGateway() {\n return this.getOrSet('paymentGateway', PaymentGateway)\n }\n\n /* ---- Orion ---- */\n\n public get orionServices() {\n return this.getOrSet('orionServices', OrionServices)\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_690c2e69
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/typings/payments.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport interface IPaymentSystem {\n id: string\n name: string\n}\n\nexport interface ISalesChannels {\n id: string\n}\n\nexport interface IPaymentRules {\n enabled: boolean\n id: string\n name: string\n paymentSystem: IPaymentSystem\n salesChannels: ISalesChannels[]\n}\n\nexport interface IPayment {\n id: string\n paymentMethodName: string\n payment: string\n isActive: boolean\n type: string\n accountName: string\n}\n\n```"
}
] |
code_mycheckout-store-framework_1dbefc55
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/middlewares/scheduler.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nconst CRON_EXPRESSION = '*/5 * * * *'\n\nexport async function scheduler(ctx: Context, next: () => Promise<unknown>) {\n try {\n const {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n clients: { scheduler },\n vtex: { workspace, account },\n } = ctx\n\n const cron = await scheduler\n .getSchedule('schedulerMyCheckoutPing')\n .then((data) => {\n return data\n })\n .catch(() => {\n return null\n })\n\n if (!cron || cron.expression !== CRON_EXPRESSION) {\n const schedulerData = {\n id: `schedulerMyCheckoutPing`,\n scheduler: {\n expression: CRON_EXPRESSION,\n endDate: '2029-12-30T23:29:00',\n },\n request: {\n method: 'GET',\n uri: `https://${workspace}--${account}.myvtex.com/_v/api/mycheckout/healthcheck`,\n headers: {\n 'cache-control': 'no-cache',\n pragma: 'no-cache',\n },\n body: null,\n },\n }\n\n await scheduler\n .createOrUpdateSchedule(schedulerData)\n .catch((error: Error) => {\n throw new Error(error.message)\n })\n }\n\n ctx.body = true\n ctx.status = 200\n ctx.set('Cache-Control', 'no-cache')\n } catch (e) {\n throw new Error(e.message)\n }\n\n await next()\n}\n\n```"
}
] |
code_mycheckout-store-framework_7a69623d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/middlewares/healthcheck.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function healthcheck(ctx: Context, next: () => Promise<any>) {\n ctx.status = 200\n ctx.body = 'OK'\n ctx.set('Cache-Control', 'no-cache')\n\n await next()\n}\n\n```"
}
] |
code_mycheckout-store-framework_61b8086d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/utils/config.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { pathOr, uniqBy } from 'ramda'\n\nimport type { IPaymentRules } from '../typings/payments'\n\nexport const buildPayments = (\n account: string,\n paymentsCreated: any[],\n paymentRules: IPaymentRules[]\n) =>\n uniqBy(\n (e) => pathOr('', ['paymentSystem', 'id'], e),\n [\n ...paymentRules.filter(\n (ruler) =>\n ruler.enabled &&\n ruler?.paymentSystem?.name !== 'Kuikpay' &&\n ruler?.paymentSystem?.name !== 'PSE' &&\n ruler?.paymentSystem?.name !== 'Pago contra entrega'\n ),\n ]\n ).map((ruler) => {\n const payment = paymentsCreated.find(\n (p) => p.paymentMethodName === ruler.paymentSystem.id.toString()\n )\n\n return {\n id: pathOr('', ['id'], payment) as string,\n paymentMethodName: pathOr('', ['paymentSystem', 'id'], ruler) as string,\n payment: pathOr('', ['paymentSystem', 'name'], ruler) as string,\n isActive: pathOr(true, ['isActive'], payment) as boolean,\n type: pathOr(\n (ruler as any)?.type || 'store',\n ['type'],\n payment\n ) as unknown as string,\n accountName: account,\n }\n })\n\n```"
}
] |
code_mycheckout-store-framework_18dd5e76
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/queries.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* ---- Checkout ---- */\n\nexport { getUser } from './checkout/user'\n\nexport { login, verifyCode } from './checkout/auth'\n\nexport { getAddress } from './checkout/address'\n\nexport { getPayments } from './checkout/payments'\n\nexport {\n getCountries,\n getCountry,\n getStateCities,\n getCities,\n} from './checkout/countries'\n\nexport { getDocumentTypes } from './checkout/documents'\n\nexport { accounts } from './checkout/accounts'\n\nexport { validateCredit } from './checkout/credit'\n\n/* ---- Admin ---- */\n\nexport { token } from './admin/token'\n\nexport { getLinksByAccount } from './admin/getLinksByAccount'\n\nexport { getAccount } from './admin/getAccount'\n\nexport { getCategories } from './admin/getCategories'\n\nexport { getPaymentsMethods } from './admin/getPaymentsMethods'\n\nexport {\n ticketAverage,\n checkout,\n button,\n conversionRate,\n} from './admin/metrics'\n\nexport { getPaymentProcessStatus } from './checkout/orders'\nexport { getStyles } from './admin/getStyles'\n\n/* ---- Orion ---- */\nexport * from './orion/queries'\n\n```"
}
] |
code_mycheckout-store-framework_a090dac6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/mutations.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* ---- Checkout ---- */\n\nexport { createUser, updateUser } from './checkout/user'\n\nexport {\n createAddress,\n externalAddress,\n deleteAddress,\n updateAddress,\n} from './checkout/address'\n\nexport { deletePayment } from './checkout/payments'\n\nexport { createOrder } from './checkout/orders'\n\nexport { ecommerce } from './checkout/ecommerce'\n\n/* ---- admin ---- */\n\nexport { saveToken } from './admin/saveToken'\n\nexport { createLink } from './admin/createLink'\n\nexport { updateLink } from './admin/updateLink'\n\nexport { deleteLink } from './admin/deleteLink'\n\nexport { handleVisualization } from './admin/handleVisualization'\n\nexport { createPaymentMethod } from './admin/createPaymentsMethods'\n\nexport { updateStyles } from './admin/updateStyles'\n\n```"
}
] |
code_mycheckout-store-framework_ebefd002
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/base/base.restservice.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { InstanceOptions, IOContext, RequestConfig } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\n\nimport { urlApi, urlApiQA } from './base.urls'\n\nexport class BaseRestService extends ExternalClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(\n ctx.production\n ? `${urlApi}/${options?.baseURL}`\n : `${urlApiQA}/${options?.baseURL}`,\n ctx,\n {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie: ctx.authToken,\n },\n }\n )\n }\n\n protected get(endpoint: string, config?: RequestConfig) {\n return this.http.get(`/${endpoint}`, {\n ...config,\n })\n }\n\n protected post(endpoint: string, data: object, config?: RequestConfig) {\n return this.http.post(`/${endpoint}`, data, {\n ...config,\n })\n }\n\n protected put(endpoint: string, data: object, config?: RequestConfig) {\n return this.http.put(`/${endpoint}`, data, {\n ...config,\n })\n }\n\n protected delete(endpoint: string, config?: RequestConfig) {\n return this.http.delete(`/${endpoint}`, {\n ...config,\n })\n }\n\n protected headers(auth: string) {\n return {\n Authorization: `Bearer ${auth}`,\n }\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_c1184577
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/base/base.urls.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const urlApi =\n '' // Prod\nexport const urlApiQA =\n '' // QA\n\n```"
}
] |
code_mycheckout-store-framework_8cd90774
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/orion/index.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { IOClient } from '@vtex/api'\n\nimport { AuthService } from './auth'\n\nexport class OrionServices extends IOClient {\n public auth: AuthService\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, options)\n this.auth = new AuthService(context, options)\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_c40c1399
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/orion/auth.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class AuthService extends BaseRestService {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'auth'\n ) {\n super(context, options)\n }\n\n public login(authBnpl: {\n redirectUrl: string\n consumerId: string\n clientIp: string\n authCode: string\n }): Promise<unknown> {\n return this.post(`${this.name}/login`, authBnpl, {\n metric: `${this.name}-login`,\n timeout: 5000,\n })\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_9717e16a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/admin/checkoutless.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class CheckoutlessClient extends BaseRestService {\n public create(accountData: {\n account: string\n paymentMethodId: string\n cvcRequired: boolean\n buttonMessage: string\n visualization: Array<{ type: string; key: string }>\n }) {\n return this.http.post('/accounts', accountData)\n }\n\n public findByAccount() {\n const { account } = this.context\n\n return this.http.get(`/accounts?an=${account}`)\n }\n\n public createLink(accountLinkData: {\n accountRequester: string\n accountApprover: string\n }) {\n return this.http.post('/accounts/links', accountLinkData)\n }\n\n public updateLink(id: string, status: string) {\n return this.http.put('/accounts/links', {\n id,\n status,\n })\n }\n\n public deleteLink(id: string) {\n return this.http.delete(`/accounts/links/${id}`)\n }\n\n public getLinksByAccount(account: string) {\n return this.http.get(`/accounts/links/${account}`)\n }\n\n public createVisualization(\n visualization: Array<{\n type: string\n key: string\n }>,\n account: string\n ) {\n return this.http.post(`/accounts?an=${account}`, {\n visualization,\n account,\n })\n }\n\n public updateStyles(\n {\n styles,\n buttonText,\n restore,\n }: { styles: string; buttonText: string; restore: boolean },\n account: string\n ) {\n return this.http.post(`/accounts/styles?an=${account}`, {\n styles,\n buttonText,\n restore,\n })\n }\n\n public getStyles(account: string) {\n return this.http.get(`/accounts/styles?an=${account}`)\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_13e2198f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/admin/paymentGateway.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\n\nexport class PaymentGateway extends ExternalClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(`https://${ctx.account}.vtexpayments.com.br`, ctx, {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie:\n ctx.storeUserAuthToken ?? ctx.adminUserAuthToken ?? ctx.authToken,\n },\n })\n }\n\n public getPaymentRules = (): Promise<any> =>\n this.http.get(`/api/pvt/rules`, {\n metric: 'get-payment-rules',\n })\n}\n\n```"
}
] |
code_mycheckout-store-framework_ee7c92b3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/admin/categories.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type {\n IOContext,\n InstanceOptions,\n SegmentData,\n RequestConfig,\n} from '@vtex/api'\nimport { AppClient } from '@vtex/api'\nimport { stringify } from 'qs'\n\nconst inflightKey = ({ baseURL, url, params, headers }: RequestConfig) => {\n return `${baseURL}${url}${stringify(params, {\n arrayFormat: 'repeat',\n addQueryPrefix: true,\n })}&segmentToken=${headers['x-vtex-segment']}`\n}\n\nexport class CategoriesClient extends AppClient {\n private basePath: string\n\n constructor(context: IOContext, options?: InstanceOptions) {\n super('vtex.catalog-api-proxy@0.x', context, options)\n this.basePath = context.sessionToken\n ? '/proxy/authenticated/catalog'\n : '/proxy/catalog'\n }\n\n public async getCategories() {\n const response = await this.get(`/pub/category/tree/3/`, {\n metric: 'search-categories',\n })\n\n return response\n }\n\n private get = <T = unknown>(url: string, config: RequestConfig = {}) => {\n const segmentData: SegmentData | undefined = (this.context as any).segment\n const { channel: salesChannel = '' } = segmentData ?? {}\n\n config.params = {\n ...config.params,\n ...(!!salesChannel && { sc: salesChannel }),\n }\n config.inflightKey = inflightKey\n\n return this.http.get<T>(`${this.basePath}${url}`, config)\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_bfa8afd2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/admin/payments.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class PaymentsClient extends BaseRestService {\n public getPaymentsMethods() {\n const { account } = this.context\n\n return this.http.get(`/accounts/payment-methods?an=${account}`)\n }\n\n public createPaymentMethod(args: {\n type: string\n isActive: boolean\n paymentMethodName: string\n }) {\n return this.http.post(\n `/accounts/payment-methods?an=${this.context.account}`,\n args\n )\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_6f539ec0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/admin/metrics.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class MetricsService extends BaseRestService {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'metrics'\n ) {\n super(context, options)\n }\n\n public categoryMetrics(data: unknown) {\n const { account } = this.context\n\n return this.post(\n `${this.name}/categories/category`,\n { data: { ...(data as JSON), account } },\n {\n metric: `${this.name}-get`,\n }\n )\n }\n\n public subcategoryMetrics(category: string, data: unknown) {\n const { account } = this.context\n\n return this.post(\n `${this.name}/categories/subcategory?c=${category || 'default'}`,\n { data: { ...(data as JSON), account } },\n {\n metric: `${this.name}-get`,\n }\n )\n }\n\n public ticketAverage(data: unknown) {\n const { account } = this.context\n\n return this.post(\n `${this.name}/ticket`,\n { data: { ...(data as JSON), account } },\n {\n metric: `${this.name}-get`,\n }\n )\n }\n\n public checkout(data: unknown) {\n const { account } = this.context\n\n return this.post(\n `${this.name}/checkout`,\n { data: { ...(data as JSON), account } },\n {\n metric: `${this.name}-get`,\n }\n )\n }\n\n public button(data: unknown) {\n const { account } = this.context\n\n return this.post(\n `${this.name}/button`,\n { data: { ...(data as JSON), account } },\n {\n metric: `${this.name}-get`,\n }\n )\n }\n\n public conversionRate(data: unknown) {\n const { account } = this.context\n\n return this.post(\n `${this.name}/conversion`,\n { data: { ...(data as JSON), account } },\n {\n metric: `${this.name}-get`,\n }\n )\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_19bb3216
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/credit.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class CreditService extends BaseRestService {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'credit'\n ) {\n super(context, options)\n }\n\n public validateCredit(args: {\n email: string\n totals: number\n }): Promise<unknown> {\n return this.post(`credit-pay/validate-credit`, args, {\n metric: `${this.name}-validateCredit`,\n })\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_479e5272
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/ecommerce.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class EcommerceService\n extends BaseRestService\n implements IEcommerceService\n{\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'ecommerce'\n ) {\n super(context, options)\n }\n\n public log(args: EcommerceInput): Promise<unknown> {\n const { account } = this.context\n\n args.account = args.account ? args.account : account\n\n return this.post(`${this.name}`, args, {\n metric: `${this.name}-get`,\n })\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_0655c901
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/scheduler.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { JanusClient } from '@vtex/api'\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nconst routes = {\n scheduler: (workspace: string, account: string) =>\n `/api/scheduler/${workspace}/${account}?version=4`,\n getSchedule: (workspace: string, account: string, id: string) =>\n `/api/scheduler/${workspace}/${account}/${id}?version=4`,\n}\n\nexport default class SchedulerClient extends JanusClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(ctx, {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie: ctx.authToken,\n },\n })\n }\n\n public createOrUpdateSchedule = (schedulerData: SchedulerArgs) => {\n return this.http.put(\n routes.scheduler(this.context.workspace, this.context.account),\n schedulerData,\n { metric: 'mycheckout-scheduler-create' }\n )\n }\n\n public getSchedule = (id: string) => {\n return this.http.get(\n routes.getSchedule(this.context.workspace, this.context.account, id),\n { metric: 'mycheckout-scheduler-get' }\n )\n }\n\n public deleteSchedule = (id: string) => {\n return this.http.delete(\n routes.getSchedule(this.context.workspace, this.context.account, id),\n { metric: 'mycheckout-scheduler-delete' }\n )\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_bb65dad8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/orders.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class OrderService extends BaseRestService {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'orders'\n ) {\n super(context, options)\n }\n\n public createOrder(args: OrderInput, hostname: string): Promise<unknown> {\n const { account } = this.context\n\n args.account.accountName = account\n args.account.hostname = hostname\n args.oms = 'vtex'\n\n return this.post(`${this.name}/v2`, args, {\n metric: `${this.name}-create`,\n headers: {\n debug: true,\n },\n })\n }\n\n public getPaymentProcessStatus(orderId: string): Promise<unknown> {\n const { account } = this.context\n\n return this.get(\n `${this.name}/payment-process?an=${account}&orderId=${orderId}`,\n {\n metric: `${this.name}-get`,\n }\n )\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_b2713520
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/documents.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class DocumentsService\n extends BaseRestService\n implements DocumentServiceImpl\n{\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'documents'\n ) {\n super(context, options)\n }\n\n public getDocumentTypes(): unknown {\n return this.get(`masters/${this.name}?limit=100`, {\n metric: `${this.name}-get`,\n })\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_39e00f4c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/accounts.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class AccountsService extends BaseRestService {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'accounts'\n ) {\n super(context, options)\n }\n\n public accounts(): unknown {\n return this.get(`${this.name}/storefront?an=${this.context.account}`, {\n metric: `${this.name}-get`,\n })\n }\n\n public initConfig(): unknown {\n return this.post(`${this.name}/initConfig`, {})\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_81626c37
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/payments.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class PaymentsService extends BaseRestService implements IPayments {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'cards'\n ) {\n super(context, options)\n }\n\n public getPayments(\n email: User['email'],\n auth: string\n ): Payments[] | Promise<Payments[]> {\n const { account } = this.context\n\n return this.get(`users/${this.name}/${email}?an=${account}`, {\n headers: this.headers(auth),\n metric: `${this.name}-get`,\n })\n }\n\n public createPayment(args: Payments): Promise<unknown> {\n return this.post(`${this.name}/`, args, {\n metric: `${this.name}-create`,\n })\n }\n\n public async deletePayment(\n id: Payments['id'],\n auth: string\n ): Promise<unknown> {\n return (\n await this.delete(`users/${this.name}/${id}`, {\n headers: this.headers(auth),\n metric: `${this.name}-create`,\n })\n ).data\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_b0e975c1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/countries.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class CountriesService\n extends BaseRestService\n implements CountriesServiceImpl\n{\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'countries'\n ) {\n super(context, options)\n }\n\n public getCountries(): unknown {\n return this.get(`masters/${this.name}`, {\n metric: `${this.name}-get`,\n })\n }\n\n public getCountry(id: string): unknown {\n return this.get(`${this.name}/${id}`, {\n metric: `${this.name}-get`,\n })\n }\n\n public async getStateCities(country: string, state: string) {\n return this.get(\n `masters/${this.name}/stateCities?country=${country}&state=${state}`,\n {\n metric: `${this.name}-get`,\n }\n )\n }\n\n public async getCities(city: string) {\n return this.get(`masters/${this.name}/cities?city=${city}`, {\n metric: `${this.name}-get`,\n })\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_e9bdeff2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/user.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class UserService extends BaseRestService implements IUser {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'users'\n ) {\n super(context, options)\n }\n\n public getUser(\n email: User['email'],\n _account: string,\n auth: string\n ): Promise<unknown> {\n const { account } = this.context\n const query = _account ? `?an=${_account}` : `?an=${account}`\n\n return this.get(`${this.name}/profiles/${email}${query}`, {\n headers: this.headers(auth),\n metric: `${this.name}-get`,\n })\n }\n\n public createUser(args: User): Promise<unknown> {\n const { account } = this.context\n\n return this.post(`${this.name}/profiles?an=${account}`, args, {\n metric: `${this.name}-create`,\n })\n }\n\n public updateUser(args: UserInput, auth: string): Promise<unknown> {\n return this.put(`${this.name}/profiles`, args, {\n headers: this.headers(auth),\n metric: `${this.name}-update`,\n })\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_a0063df4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/auth.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class AuthService extends BaseRestService implements IAuth {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'auth'\n ) {\n super(context, options)\n }\n\n public login(email: Auth['email'], origin: string): Promise<unknown> {\n const { account } = this.context\n\n return this.post(\n `users/${this.name}/${email}?an=${account}`,\n { origin },\n {\n metric: `${this.name}-login`,\n timeout: 5000,\n }\n )\n }\n\n public verifyCode(args: Auth): Promise<unknown> {\n const { account } = this.context\n\n return this.post(\n `users/${this.name}/verify/${args.email}?an=${account}`,\n args,\n {\n metric: `${this.name}-verifycode`,\n }\n )\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_fbbd004d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/clients/checkout/address.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\n\nimport { BaseRestService } from '../../base/base.restservice'\n\nexport class AddressService extends BaseRestService {\n constructor(\n context: IOContext,\n options?: InstanceOptions,\n private readonly name: string = 'addresses'\n ) {\n super(context, options)\n }\n\n public getAddress(email: User['email'], auth: string): Promise<unknown> {\n const { account } = this.context\n\n return this.get(`users/${this.name}/${email}?an=${account}`, {\n headers: this.headers(auth),\n metric: `${this.name}-get`,\n })\n }\n\n public createAddress(args: never): Promise<unknown> {\n return this.post(`users/${this.name}/`, args, {\n metric: `${this.name}-create`,\n })\n }\n\n public externalAddress(args: never): Promise<unknown> {\n const { account } = this.context\n\n return this.post(`users/${this.name}/external?an=${account}`, args, {\n metric: `${this.name}-create`,\n })\n }\n\n public updateAddress(args: never, auth: string): Promise<unknown> {\n return this.put(`users/${this.name}/`, args, {\n headers: this.headers(auth),\n metric: `${this.name}-create`,\n })\n }\n\n public async deleteAddress(id: string, auth: string): Promise<unknown> {\n return (\n await this.delete(`users/${this.name}/${id}`, {\n headers: this.headers(auth),\n metric: `${this.name}-create`,\n })\n ).data\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_f5ae9e47
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/orion/auth.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const authCookie = 'x-mycheckout-orion'\n\nexport const login = async (\n _: unknown,\n { authCode }: { authCode: string },\n { clients: { orionServices: OrionServicesClient }, cookies, request }: Context\n) => {\n const origin = request.get('origin').split('://')\n const args = {\n redirectUrl: '',\n consumerId: '',\n clientIp: '',\n authCode,\n }\n\n args.redirectUrl = `${request.get('origin')}/`\n // TODO: investigar de donde obtener ORN\n args.consumerId = 'ORN'\n args.clientIp = request.get('x-forwarded-for')?.split(',')?.[0] || '127.0.0.1'\n\n const response = (await OrionServicesClient.auth.login(args)) as {\n token: string\n transactionId: string\n }\n\n cookies.set(\n authCookie,\n Buffer.from(`${response.transactionId}:${response.token}`).toString(\n 'base64'\n ),\n {\n httpOnly: false,\n domain: origin[1],\n secure: origin[0] === 'https',\n expires: new Date(\n new Date().setTime(new Date().getTime() + 2 * 60 * 60 * 1000)\n ),\n }\n )\n\n return response\n}\n\n```"
}
] |
code_mycheckout-store-framework_1568f975
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/getStyles.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const getStyles = async (\n _: any,\n __: any,\n { clients: { checkoutless: CheckoutlessClient }, vtex: { account } }: Context\n) => {\n return CheckoutlessClient.getStyles(account)\n}\n\n```"
}
] |
code_mycheckout-store-framework_9e5a032c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/getAccount.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport function getAccount(\n _: unknown,\n __: unknown,\n { clients: { checkoutless } }: Context\n) {\n return checkoutless.findByAccount()\n}\n\n```"
}
] |
code_mycheckout-store-framework_7de8ac92
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/getCategories.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function getCategories(\n _: unknown,\n __: unknown,\n { clients: { categories } }: Context\n) {\n const theCategories = await categories.getCategories()\n\n return theCategories\n}\n\n```"
}
] |
code_mycheckout-store-framework_9e50a80f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/updateStyles.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const updateStyles = async (\n _: any,\n {\n styles,\n buttonText,\n restore = false,\n }: {\n styles: string\n buttonText: string\n restore: boolean\n },\n { clients: { checkoutless: CheckoutlessClient }, vtex: { account } }: Context\n) => {\n return CheckoutlessClient.updateStyles(\n { styles, buttonText, restore },\n account\n )\n}\n\n```"
}
] |
code_mycheckout-store-framework_8b525844
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/getPaymentsMethods.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function getPaymentsMethods(\n _: unknown,\n __: unknown,\n { clients: { paymentsClient } }: Context\n) {\n const paymentMethods = await paymentsClient.getPaymentsMethods()\n\n return paymentMethods\n}\n\n```"
}
] |
code_mycheckout-store-framework_54054557
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/getLinksByAccount.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function getLinksByAccount(\n _: unknown,\n __: unknown,\n { clients: { checkoutless }, vtex: { account } }: Context\n) {\n const data = await checkoutless.getLinksByAccount(account)\n\n return data.map(\n (item: { accountApprover: string; accountRequester: string }) => ({\n ...item,\n account:\n account === item.accountApprover\n ? item.accountRequester\n : item.accountApprover,\n approver: account === item.accountApprover,\n })\n )\n}\n\n```"
}
] |
code_mycheckout-store-framework_681b8db4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/handleVisualization.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface Arg {\n visualization: Array<{\n type: string\n key: string\n }>\n}\n\nexport async function handleVisualization(\n _: unknown,\n { visualization }: Arg,\n { clients: { checkoutless }, vtex: { account } }: Context\n) {\n const data = await checkoutless.createVisualization(visualization, account)\n\n return data\n}\n\n```"
}
] |
code_mycheckout-store-framework_cc152618
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/deleteLink.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function deleteLink(\n _: unknown,\n { id }: { id: string },\n { clients: { checkoutless } }: Context\n) {\n const data = await checkoutless.deleteLink(id)\n\n return {\n ...data,\n id,\n }\n}\n\n```"
}
] |
code_mycheckout-store-framework_929a73db
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/updateLink.ts from the mycheckout-store-framework VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function updateLink(\n _: unknown,\n { id, status }: { id: string; status: string },\n { clients: { checkoutless }, vtex: { account } }: Context\n) {\n const data = (await checkoutless.updateLink(id, status)) as unknown as {\n accountApprover: string\n accountRequester: string\n }\n\n return {\n ...data,\n account:\n account === data.accountApprover\n ? data.accountRequester\n : data.accountApprover,\n approver: account === data.accountApprover,\n }\n}\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.