id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_shipment-tracker_28184f3d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/clients/scheduler.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { InstanceOptions, IOContext, JanusClient } 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) =>\n `/api/scheduler/${workspace}/${account}/vtex-shipping-tracker?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 createSchedule = (\n schedulerData: CreateSchedulerArgs\n ): Promise<CreateSchedulerResponse> => {\n return this.http.post(\n routes.scheduler(this.context.workspace, this.context.account),\n schedulerData,\n { metric: 'scheduler-create-schedule' }\n )\n }\n\n public viewSchedule = async (): Promise<ViewSchedulerResponse> => {\n return this.http.get(\n routes.getSchedule(this.context.workspace, this.context.account),\n { metric: 'scheduler-view-schedule' }\n )\n }\n\n public deleteSchedule = async () => {\n return this.http.delete(\n routes.getSchedule(this.context.workspace, this.context.account),\n { metric: 'scheduler-delete-schedule' }\n )\n }\n}\n\n```"
}
] |
code_shipment-tracker_47ecb2e9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/clients/ups.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ExternalClient, InstanceOptions, IOContext } from '@vtex/api'\n\nexport default class UPSClient extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super('https://wwwcie.ups.com', context, {\n ...options,\n headers: {\n 'X-Vtex-Use-Https': 'true',\n 'Proxy-Authorization': context.authToken,\n },\n })\n }\n\n public async getTracking(\n trackingNumber: string,\n key: string\n ): Promise<string> {\n return this.http.get(`/track/v1/details/${trackingNumber}`, {\n headers: {\n AccessLicenseNumber: key,\n },\n })\n }\n}\n\n```"
}
] |
code_shipment-tracker_0aca643f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/clients/oms.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ExternalClient, InstanceOptions, IOContext } from '@vtex/api'\n\nconst FOUR_SECONDS = 4 * 1000\n\nexport default class OMSClient extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(`http://${context.account}.vtexcommercestable.com.br`, context, {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie: context.authToken,\n },\n timeout: FOUR_SECONDS,\n })\n }\n\n public async getOrder(orderId: string): Promise<OMSOrder> {\n return this.http.get(`/api/oms/pvt/orders/${orderId}`, {\n metric: 'order-get',\n })\n }\n\n public async updateOrderTracking(\n orderId: string,\n invoiceId: string,\n update: TrackingUpdate\n ): Promise<OMSOrderTracking> {\n return this.http.put(\n `/api/oms/pvt/orders/${orderId}/invoice/${invoiceId}/tracking`,\n update,\n {\n metric: 'order-tracking-put',\n }\n )\n }\n}\n\n```"
}
] |
code_shipment-tracker_8852b25a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/clients/usps.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ExternalClient, InstanceOptions, IOContext } from '@vtex/api'\n\nconst TEN_SECONDS = 10 * 1000\n\nexport default class USPSClient extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super('http://secure.shippingapis.com', context, {\n ...options,\n headers: {\n 'X-Vtex-Use-Https': 'true',\n 'Proxy-Authorization': context.authToken,\n },\n timeout: TEN_SECONDS,\n })\n }\n\n public async getTracking(xml: string): Promise<string> {\n return this.http.get(`/ShippingAPI.dll?API=TrackV2&XML=${xml}`, {\n metric: 'usps-get-tracking',\n })\n }\n}\n\n```"
}
] |
code_shipment-tracker_d80b86f5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/clients/index.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport OMSClient from './oms'\nimport RequestHub from '../utils/Hub'\nimport SchedulerClient from './scheduler'\nimport USPSClient from './usps'\nimport FedExClient from './fedex'\nimport UPSClient from './ups'\nimport CanadaPostClient from './canadaPost'\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {\n public get hub() {\n return this.getOrSet('hub', RequestHub)\n }\n\n public get oms() {\n return this.getOrSet('orders', OMSClient)\n }\n\n public get scheduler() {\n return this.getOrSet('scheduler', SchedulerClient)\n }\n\n public get usps() {\n return this.getOrSet('usps', USPSClient)\n }\n\n public get fedex() {\n return this.getOrSet('fedex', FedExClient)\n }\n\n public get ups() {\n return this.getOrSet('ups', UPSClient)\n }\n\n public get canadaPost() {\n return this.getOrSet('canadaPost', CanadaPostClient)\n }\n}\n\n```"
}
] |
code_shipment-tracker_6acc3592
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/clients/fedex.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ExternalClient, InstanceOptions, IOContext } from '@vtex/api'\n\nconst BASE_URL = ''\n\nexport default class FedExClient extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(BASE_URL, context, {\n ...options,\n headers: {\n 'X-Vtex-Use-Https': 'true',\n 'Proxy-Authorization': context.authToken,\n },\n })\n }\n\n public async getTracking(url: string, body: string): Promise<string> {\n return this.http.post(url, body, {\n headers: {},\n })\n }\n}\n\n```"
}
] |
code_shipment-tracker_6e392822
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/typings/usps.d.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface UspsParsedResult {\n TrackResponse: TrackResponse\n}\n\ninterface TrackResponse {\n TrackInfo: TrackInfo[]\n}\n\ninterface TrackInfo {\n $: { ID: string }\n Class: [string]\n ClassOfMailCode: [string]\n DestinationCity: [string]\n DestinationCountryCode: [string]\n DestinationState: [string]\n DestinationZip: [string]\n EmailEnabled: [string]\n KahalaIndicator: [string]\n MailTypeCode: [string]\n MPDATE: [string]\n MPSUFFIX: [string]\n OriginCity: [string]\n OriginCountryCode: [string]\n PodEnabled: [string]\n TPodEnabled: [string]\n RestoreEnabled: [string]\n RramEnabled: [string]\n RreEnabled: [string]\n Service: [string]\n ServiceTypeCode: [string]\n Status: [string]\n StatusCategory: [string]\n StatusSummary: [string]\n TABLECODE: [string]\n TrackSummary: [TrackDetail]\n TrackDetail?: TrackDetail[]\n}\n\ninterface TrackDetail {\n EventTime: [string]\n EventDate: [string]\n Event: [string]\n EventCity: [string]\n EventState: [string]\n EventZIPCode: [string]\n EventCountry: [string]\n FirmName: [string]\n Name: [string]\n AuthorizedAgent: [string]\n EventCode: [string]\n}\n\n```"
}
] |
code_shipment-tracker_c75b1b1f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/typings/scheduler.d.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface CreateSchedulerArgs {\n id: string\n scheduler: { expression: string; endDate: string }\n request: {\n uri: string\n method: string\n }\n}\n\ninterface ViewSchedulerResponse {\n id: string\n expression: string\n NextExecution: string\n endDate: string\n lastInteractionIn: string\n request: {\n uri: string\n method: string\n }\n}\n\ninterface ViewSchedulerGraphQL {\n nextExecution: string\n lastInteractionIn: string\n}\n\ninterface ViewSchedule {\n id: string\n expression: string\n NextExecution: string\n endDate: string\n lastInteractionIn: string\n}\n\ninterface CreateSchedulerResponse {\n endpoint: string\n nextExecution: string\n}\n\n```"
}
] |
code_shipment-tracker_4c76cbb4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/typings/global.d.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface AppSettings {\n schema: boolean\n schemaVersion: string\n title: string\n carriers?: Carriers\n}\n\ninterface Carriers {\n fedex: FedexConfig\n usps: UspsConfig\n ups: UpsConfig\n canadaPost: CanadaPostConfig\n [index: string]: any\n}\n\ninterface CarrierConfig {\n active: boolean\n}\ninterface FedexConfig extends CarrierConfig {\n key: string\n accountNumber: string\n meterNumber: string\n password: string\n}\n\ninterface UpsConfig extends CarrierConfig {\n key: string\n}\n\ninterface UspsConfig extends CarrierConfig {\n userId: string\n}\n\ninterface CanadaPostConfig extends CarrierConfig {\n userId: string\n password: string\n}\n\n```"
}
] |
code_shipment-tracker_f72870d0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/typings/shipment.d.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface Shipment {\n id: string\n trackingNumber: string\n carrier: string\n delivered: boolean\n orderId: string\n invoiceId: string\n externalLink: string\n lastInteractionDate: string\n createdIn: string\n updatedIn: string\n}\n\ninterface AddShipmentArgs {\n trackingNumber: string\n carrier: Carrier\n orderId: string\n invoiceId: string\n externalLink: string\n}\n\ninterface UpdateShipmentArgs {\n id: string\n trackingNumber?: string\n carrier?: Carrier\n orderId?: string\n invoiceId?: string\n externalLink?: string\n lastInteractionDate?: string\n}\n\ninterface ShipmentsByCarrierArgs {\n carrier: Carrier\n page?: number\n pageSize?: number\n createdBefore?: string | null\n}\n\ninterface Interaction {\n id: string\n shipmentId: string\n delivered: boolean\n createdIn: string\n updatedIn: string\n}\n\ninterface AddInteractionArgs {\n shipmentId: string\n delivered: boolean\n}\n\n```"
}
] |
code_shipment-tracker_1343b2ee
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/typings/order.d.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/no-explicit-any */\ninterface OMSOrder {\n orderId: string\n status: 'invoiced' | 'cancel' | 'canceled'\n packageAttachment: PackageAttachment\n}\n\ninterface OMSOrderTracking {\n date: string\n orderId: string\n receipt: string\n}\n\ninterface PackageAttachment {\n packages: Package[]\n}\n\ninterface Package {\n items: Item[]\n courier: string\n invoiceNumber: string\n invoiceValue: number\n invoiceUrl: string | null\n issuanceDate: string\n trackingNumber: string\n invoiceKey: string | null\n trackingUrl: string | null\n embeddedInvoice: string\n type: string\n courierStatus: string | null\n cfop: string | null\n restitutions: any\n volumes: any | null\n}\n\ninterface Item {\n itemIndex: number\n quantity: number\n price: number\n description: string | null\n unitMultiplier: number\n}\n\ninterface TrackingUpdate {\n isDelivered: boolean\n events?: TrackingEvent[]\n}\n\ninterface TrackingEvent {\n city?: string\n state?: string\n description?: string\n date?: string\n}\n\n```"
}
] |
code_shipment-tracker_80813777
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/utils/Hub.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ExternalClient, InstanceOptions, IOContext } from '@vtex/api'\n\nexport default class RequestHub extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(\n `http://${context.account}.vtexcommercestable.com.br/api/`,\n context,\n options\n )\n }\n\n public authToken() {\n return this.context.authToken\n }\n\n public account() {\n return this.context.account\n }\n\n public get(url: string, headers: any, data?: any) {\n return this.http.getRaw(url, {\n headers,\n data,\n })\n }\n\n public post(url: string, data: any, headers?: any) {\n return this.http.postRaw(url, data, {\n headers,\n })\n }\n\n public put(url: string, data: any, headers?: any) {\n return this.http.putRaw(url, data, {\n headers,\n })\n }\n\n public patch(url: string, data: any, headers?: any) {\n return this.http.patch(url, data, {\n headers,\n })\n }\n\n public delete(url: string) {\n return this.http.delete(url)\n }\n}\n\n```"
}
] |
code_shipment-tracker_7f3694e3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/resolvers/index.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-console */\nimport { Apps } from '@vtex/api'\n\nconst getAppId = (): string => {\n return process.env.VTEX_APP_ID ?? ''\n}\nconst SCHEMA_VERSION = 'v0.8'\nconst schemaShipments = {\n properties: {\n trackingNumber: {\n type: 'string',\n title: 'Tracking Number',\n },\n carrier: {\n type: 'string',\n title: 'Carrier',\n },\n delivered: {\n type: 'boolean',\n title: 'Delivery Status',\n },\n orderId: {\n type: 'string',\n title: 'Order ID',\n },\n invoiceId: {\n type: 'string',\n title: 'Invoice ID',\n },\n externalLink: {\n type: 'string',\n title: 'External Id',\n },\n lastInteractionDate: {\n type: 'string',\n title: 'Last Interaction Date',\n },\n creationDate: {\n type: 'string',\n title: 'Creation Date',\n },\n },\n 'v-indexed': [\n 'trackingNumber',\n 'carrier',\n 'delivered',\n 'orderId',\n 'invoiceId',\n 'lastInteractionDate',\n 'creationDate',\n ],\n 'v-default-fields': [\n 'trackingNumber',\n 'carrier',\n 'delivered',\n 'orderId',\n 'invoiceId',\n 'lastInteractionDate',\n 'creationDate',\n ],\n 'v-cache': false,\n}\nconst schemaInteractions = {\n properties: {\n shipmentId: {\n type: 'string',\n title: 'Shipment ID',\n },\n interaction: {\n type: 'string',\n title: 'Interaction',\n },\n delivered: {\n type: 'boolean',\n title: 'Delivery Status',\n },\n creationDate: {\n type: 'string',\n title: 'Creation Date',\n },\n },\n 'v-indexed': ['shipmentId', 'interaction', 'status', 'creationDate'],\n 'v-default-fields': ['shipmentId', 'interaction', 'status', 'creationDate'],\n 'v-cache': false,\n}\n\nconst routes = {\n baseUrl: (account: string) =>\n `http://${account}.vtexcommercestable.com.br/api`,\n\n shipmentEntity: (account: string) =>\n `${routes.baseUrl(account)}/dataentities/shipment`,\n\n interactionEntity: (account: string) =>\n `${routes.baseUrl(account)}/dataentities/interaction`,\n\n saveSchemaShipment: (account: string) =>\n `${routes.shipmentEntity(account)}/schemas/${SCHEMA_VERSION}`,\n\n saveSchemaInteraction: (account: string) =>\n `${routes.interactionEntity(account)}/schemas/${SCHEMA_VERSION}`,\n}\n\nconst defaultHeaders = (authToken: string) => ({\n 'Content-Type': 'application/json',\n Accept: 'application/vnd.vtex.ds.v10+json',\n VtexIdclientAutCookie: authToken,\n 'Proxy-Authorization': authToken,\n})\n\nexport const resolvers = {\n Query: {\n viewSchedule: async (\n _: void,\n _args: void,\n ctx: Context\n ): Promise<ViewSchedulerGraphQL | null> => {\n const {\n clients: { scheduler },\n } = ctx\n\n let response\n\n try {\n response = await scheduler.viewSchedule()\n } catch (_err) {\n return null\n }\n\n const { NextExecution: nextExecution, lastInteractionIn } = response\n\n console.log('view schedule', response)\n\n return {\n nextExecution,\n lastInteractionIn,\n }\n },\n config: async (_: any, __: any, ctx: any) => {\n const {\n vtex: { account, authToken },\n clients: { hub },\n } = ctx\n\n const apps = new Apps(ctx.vtex)\n const app: string = getAppId()\n let settings = await apps.getAppSettings(app)\n const defaultSettings = {\n schema: false,\n schemaVersion: null,\n title: 'Shipment Tracking',\n }\n\n if (!settings.title) {\n settings = defaultSettings\n }\n\n let schemaError = false\n\n if (!settings.schema || settings.schemaVersion !== SCHEMA_VERSION) {\n try {\n const url = routes.saveSchemaShipment(account)\n const headers = defaultHeaders(authToken)\n\n await hub.put(url, schemaShipments, headers)\n } catch (e) {\n if (e.response.status >= 400) {\n console.log(e.response)\n schemaError = true\n }\n }\n\n if (!schemaError) {\n try {\n const url = routes.saveSchemaInteraction(account)\n const headers = defaultHeaders(authToken)\n\n await hub.put(url, schemaInteractions, headers)\n } catch (e) {\n if (e.response.status >= 400) {\n schemaError = true\n }\n }\n }\n\n settings.schema = !schemaError\n settings.schemaVersion = !schemaError ? SCHEMA_VERSION : null\n\n await apps.saveAppSettings(app, settings)\n }\n\n return settings\n },\n allShipments: async (_: any, __: any, ctx: Context) => {\n const {\n clients: { masterdata },\n } = ctx\n\n const result = await masterdata.searchDocuments({\n dataEntity: 'shipment',\n fields: [\n 'id',\n 'trackingNumber',\n 'carrier',\n 'delivered',\n 'orderId',\n 'invoiceId',\n 'externalLink',\n 'lastInteractionDate',\n 'createdIn',\n 'updatedIn',\n ],\n pagination: {\n page: 1,\n pageSize: 99,\n },\n schema: SCHEMA_VERSION,\n })\n\n return result\n },\n interactions: async (_: any, args: any, ctx: Context) => {\n const {\n clients: { masterdata },\n } = ctx\n\n console.log(args)\n\n const result = await masterdata.searchDocuments({\n dataEntity: 'interaction',\n fields: [\n 'id',\n 'shipmentId',\n 'interaction',\n 'delivered',\n 'updatedIn',\n 'createdIn',\n ],\n pagination: {\n page: 1,\n pageSize: 99,\n },\n where: `shipmentId=${args.shipmentId}`,\n schema: SCHEMA_VERSION,\n })\n\n return result\n },\n shipment: async (_: any, args: any, ctx: Context | StatusChangeContext) => {\n const {\n clients: { masterdata },\n } = ctx\n\n const result = await masterdata.searchDocuments({\n dataEntity: 'shipment',\n fields: [\n 'id',\n 'trackingNumber',\n 'carrier',\n 'delivered',\n 'orderId',\n 'invoiceId',\n 'externalLink',\n 'lastInteractionDate',\n 'createdIn',\n 'updatedIn',\n ],\n where: `trackingNumber=${args.trackingNumber}`,\n pagination: {\n page: 1,\n pageSize: 99,\n },\n schema: SCHEMA_VERSION,\n })\n\n console.log('create', result)\n\n return result\n },\n shipmentsByCarrier: async (\n _: any,\n args: ShipmentsByCarrierArgs,\n ctx: Context\n ) => {\n const {\n clients: { masterdata },\n } = ctx\n\n const { carrier, page = 1, pageSize = 99, createdBefore = null } = args\n let where = `carrier=${carrier} AND delivered=false`\n\n if (createdBefore) {\n where = where.concat(` AND createdIn<${createdBefore}`)\n }\n\n const result = await masterdata.searchDocuments<Shipment>({\n dataEntity: 'shipment',\n fields: [\n 'id',\n 'trackingNumber',\n 'carrier',\n 'delivered',\n 'orderId',\n 'invoiceId',\n 'externalLink',\n 'lastInteractionDate',\n 'createdIn',\n 'updatedIn',\n ],\n where,\n sort: 'createdIn DESC',\n pagination: {\n page,\n pageSize,\n },\n schema: SCHEMA_VERSION,\n })\n\n return result\n },\n },\n Mutation: {\n addShipment: async (\n _: any,\n args: AddShipmentArgs,\n ctx: Context | StatusChangeContext\n ) => {\n const {\n clients: { masterdata },\n } = ctx\n\n return masterdata\n .createDocument({\n dataEntity: 'shipment',\n fields: args,\n schema: SCHEMA_VERSION,\n })\n .then((res) => {\n return res.DocumentId\n })\n .catch((err: any) => {\n console.log('err', err)\n return err.response.message\n })\n },\n updateShipment: async (\n _: any,\n args: UpdateShipmentArgs,\n ctx: Context | StatusChangeContext\n ) => {\n const {\n clients: { masterdata },\n } = ctx\n\n const { id, ...fields } = args\n\n return masterdata\n .updatePartialDocument({\n dataEntity: 'shipment',\n id,\n fields,\n schema: SCHEMA_VERSION,\n })\n .then((_res) => {\n return id\n })\n .catch((err: any) => {\n console.log('err', err)\n return err.response.message\n })\n },\n addInteraction: async (_: any, args: AddInteractionArgs, ctx: Context) => {\n const {\n clients: { masterdata },\n } = ctx\n\n return masterdata\n .createDocument({\n dataEntity: 'interaction',\n fields: args,\n schema: SCHEMA_VERSION,\n })\n .then((res) => {\n return res.DocumentId\n })\n .catch((err: any) => {\n return err.response.message\n })\n },\n createSchedule: async (\n _: void,\n _args: void,\n ctx: Context\n ): Promise<CreateSchedulerResponse> => {\n const {\n clients: { scheduler },\n vtex: { workspace, account },\n } = ctx\n\n const schedulerData = {\n id: `vtex-shipping-tracker`,\n scheduler: {\n expression: '0 6 * * *',\n endDate: '2029-12-30T23:29:00',\n },\n request: {\n method: 'GET',\n uri: `https://${workspace}--${account}.myvtex.com/_v/api/tracking/update`,\n },\n }\n\n const response = await scheduler.createSchedule(schedulerData)\n\n console.log('create schedule', response)\n\n return response\n },\n deleteSchedule: async (\n _: void,\n _args: void,\n ctx: Context\n ): Promise<boolean> => {\n const {\n clients: { scheduler },\n } = ctx\n\n const response = await scheduler.deleteSchedule()\n\n console.log('delete schedule', response)\n\n return true\n },\n },\n}\n\n```"
}
] |
code_shipment-tracker_1b42c0f6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/events/canadaPost.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { CARRIERS } from '../constants'\n\nconst CANADA_POST_REGEX = ['^[0-9]{16}$', '^[A-Z]{2}[0-9]{9}[A-Z]{2}$']\n\nexport const canadaPost = {\n detect: (shipment: Package) => {\n if (shipment.courier.toLowerCase().includes('canada')) {\n return CARRIERS.CANADAPOST\n }\n\n const trackingNumber = shipment.trackingNumber.replace(/\\s/g, '')\n\n const regexp = new RegExp(CANADA_POST_REGEX.join('|'), 'i')\n return regexp.test(trackingNumber) ? CARRIERS.CANADAPOST : null\n },\n}\n\n```"
}
] |
code_shipment-tracker_d3dc8cbc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/events/ups.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { CARRIERS } from '../constants'\n\nconst UPS_REGEX = [\n '^(1Z)[0-9A-Z]{16}$',\n '^(T)+[0-9A-Z]{10}$',\n '^[0-9]{9}$',\n '^[0-9]{26}$',\n]\n\nexport const ups = {\n detect: (shipment: Package) => {\n if (shipment.courier.toLowerCase().includes('ups')) {\n return CARRIERS.UPS\n }\n\n const trackingNumber = shipment.trackingNumber.replace(/\\s/g, '')\n\n const regexp = new RegExp(UPS_REGEX.join('|'), 'i')\n return regexp.test(trackingNumber) ? CARRIERS.UPS : null\n },\n}\n\n```"
}
] |
code_shipment-tracker_b8bcee10
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/events/usps.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { CARRIERS } from '../constants'\n\nconst USPS_REGEX = [\n '^((9[12345])?(([0-9]){24}|([0-9]){20}))$',\n `^([0-9]{20})$`,\n `^(420)(([0-9]){9})((9[2345])?(([0-9]){20}))$`,\n '^([A-Z]{2})[0-9]{9}(US)$',\n]\n\nexport const usps = {\n detect: (shipment: Package) => {\n if (shipment.courier.toLowerCase().includes('usps')) {\n return CARRIERS.USPS\n }\n\n const trackingNumber = shipment.trackingNumber.replace(/\\s/g, '')\n\n const regexp = new RegExp(USPS_REGEX.join('|'), 'i')\n return regexp.test(trackingNumber) ? CARRIERS.USPS : null\n },\n}\n\n```"
}
] |
code_shipment-tracker_5792d9d3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/events/index.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Carrier } from '../constants'\nimport { canadaPost } from './canadaPost'\nimport { fedex } from './fedex'\nimport { ups } from './ups'\nimport { usps } from './usps'\n\nexport const carrierLookup = {\n usps,\n ups,\n fedex,\n canadaPost,\n}\n\nexport const getCarrier = async (\n ctx: StatusChangeContext,\n shipment: Package\n): Promise<Carrier | null> => {\n let matched: Carrier | null = null\n\n const appId = process.env.VTEX_APP_ID\n const settings = appId\n ? ((await ctx.clients.apps.getAppSettings(appId)) as AppSettings)\n : null\n\n if (!settings?.carriers) {\n console.log('no settings config')\n return null\n }\n\n for (const carrier in carrierLookup) {\n const carrierConfig = settings.carriers[carrier as keyof Carriers]\n\n if (carrierConfig.active) {\n const lookup = carrierLookup[carrier as keyof typeof carrierLookup].detect\n const match = lookup(shipment)\n\n if (match) {\n matched = match\n break\n }\n }\n }\n\n return matched\n}\n\n```"
}
] |
code_shipment-tracker_9c25c220
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/events/orderStatusChange.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-await-in-loop */\nimport { resolvers } from '../resolvers'\nimport { getCarrier } from '.'\n\nexport async function orderStatusChange(ctx: StatusChangeContext) {\n const {\n body,\n clients: { oms },\n vtex: { logger },\n } = ctx\n\n if (body.domain === 'Marketplace') {\n return\n }\n\n const order = await oms.getOrder(body.orderId)\n\n if (!order) {\n return\n }\n\n const { packages } = order.packageAttachment || []\n\n const shipments = []\n for (const shipment of packages) {\n const { trackingNumber } = shipment\n const existingShipment = await resolvers.Query.shipment(\n null,\n trackingNumber,\n ctx\n )\n\n if (!existingShipment) {\n const carrier = await getCarrier(ctx, shipment)\n const externalLink = shipment.trackingUrl // add trackingUrl validation\n\n if (carrier) {\n const data = {\n trackingNumber: shipment.trackingNumber,\n carrier,\n delivered: false,\n orderId: order.orderId,\n invoiceId: shipment.invoiceNumber,\n externalLink: externalLink ?? '',\n }\n\n shipments.push(resolvers.Mutation.addShipment(null, data, ctx))\n }\n }\n }\n\n try {\n await Promise.all(shipments)\n } catch (err) {\n logger.error({\n error: err,\n message: 'ShipmentTracker-OrderStatusChangeError',\n })\n }\n}\n\n```"
}
] |
code_shipment-tracker_9e313338
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/events/fedex.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { CARRIERS } from '../constants'\n\nconst FEDEX_REGEX = [\n '^96[0-9]{32}$',\n '^100[0-9]{31}$',\n '^96[0-9]{20}$',\n '^(92)?[0-9]{20}$',\n '^[0-9]{18}$',\n '^[0-9]{15}$',\n '^[0-9]{12}$',\n]\n\nexport const fedex = {\n detect: (shipment: Package) => {\n if (shipment.courier.toLowerCase().includes('fedex')) {\n return CARRIERS.FEDEX\n }\n\n const trackingNumber = shipment.trackingNumber.replace(/\\s/g, '')\n\n const regexp = new RegExp(FEDEX_REGEX.join('|'), 'i')\n return regexp.test(trackingNumber) ? CARRIERS.FEDEX : null\n },\n}\n\n```"
}
] |
code_shipment-tracker_6c5cc6e7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/routes/updateTracking.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { trackingService } from '../services'\n\nexport async function updateTracking(ctx: Context) {\n const { response } = ctx\n // verify request\n\n const appId = process.env.VTEX_APP_ID\n const settings = appId\n ? ((await ctx.clients.apps.getAppSettings(appId)) as AppSettings)\n : null\n\n if (!settings?.carriers) {\n console.log('no settings config')\n return null\n }\n\n for (const carrier in trackingService) {\n const carrierConfig = settings.carriers[carrier]\n\n console.log('config', carrierConfig)\n if (carrierConfig.active) {\n trackingService[carrier as keyof typeof trackingService](\n carrierConfig,\n ctx\n )\n }\n }\n\n response.set('Cache-Control', 'no-cache')\n response.status = 200\n return response\n}\n\n```"
}
] |
code_shipment-tracker_679890b0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/services/canadaPost.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { parseString } from 'xml2js'\nimport { resolvers } from '../resolvers'\n\n\nexport const canadaPost = async (settings: CanadaPostConfig, ctx: Context) => {\n const {\n clients: { canadaPost: canadaPostClient, oms },\n vtex: { logger }\n } = ctx\n\n console.log(settings)\n\n const { userId, password } = settings\n const combined = userId + ':' + password\n const encode = (str: string):string => Buffer.from(str, 'binary').toString('base64');\n\n const authKey = encode(combined)\n\n const args = { carrier: 'CANADAPOST' }\n const shipments = await resolvers.Query.shipmentsByCarrier(null, args, ctx)\n\n for (const shipment of shipments) {\n const trackingNum = shipment.trackingNumber\n console.log(\"trackingNum =>\", trackingNum)\n\n try {\n const response = await canadaPostClient.getTracking(trackingNum, authKey)\n parseString(response, (_err, result) => {\n const events = result['tracking-detail']['significant-events'][0]['occurrence']\n\n let newUpdateTime = new Date(shipment.lastInteractionDate)\n let updateFlag = false\n let delivered = false\n let trackingEvents = []\n\n for (const event of events) {\n console.log(\"event =>\", event)\n const timeString = event['event-date'] + 'T' + event['event-time']\n const timestamp = new Date(timeString)\n\n const interactionDelivered = !!result['actual-delivery-date']\n const interactionMessage = event['event-description'][0]\n const [city] = event['event-site']\n const [state] = event['event-province']\n\n trackingEvents.push({ city, state, description: interactionMessage, date: timestamp.toUTCString() })\n\n if (!shipment.lastInteractionDate || timestamp > new Date(shipment.lastInteractionDate)) {\n\n updateFlag = true\n\n if (interactionDelivered) {\n delivered = true\n }\n\n const interaction = {\n shipmentId: shipment.id,\n interaction: interactionMessage,\n delivered: interactionDelivered\n }\n\n if (newUpdateTime < timestamp) {\n newUpdateTime = timestamp\n }\n\n resolvers.Mutation.addInteraction(null, interaction, ctx)\n }\n\n }\n\n const trackingUpdate = {\n isDelivered: delivered,\n events: trackingEvents.reverse(),\n }\n\n oms.updateOrderTracking(\n shipment.orderId,\n shipment.invoiceId,\n trackingUpdate\n )\n\n if (updateFlag) {\n const updateShipment = {\n id: shipment.id,\n delivered,\n lastInteractionDate: newUpdateTime.toUTCString()\n }\n\n resolvers.Mutation.updateShipment(null, updateShipment, ctx)\n }\n })\n\n } catch (err){\n logger.error({\n error: err,\n message: 'ShipmentTracker-CanadaPostTrackingError',\n })\n continue\n }\n }\n}\n\n```"
}
] |
code_shipment-tracker_498f3ca6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/services/ups.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { resolvers } from '../resolvers'\n\n\nexport const ups = async (settings: UpsConfig, ctx: Context) => {\n const {\n clients: { ups: upsClient, oms },\n vtex: { logger }\n } = ctx\n\n const { key } = settings\n\n const args = { carrier: 'UPS' }\n const shipments = await resolvers.Query.shipmentsByCarrier(null, args, ctx)\n\n for (const shipment of shipments) {\n const trackingNum = shipment.trackingNumber\n\n const response:any = await upsClient.getTracking(trackingNum, key)\n\n if (response.trackResponse.shipment[0].warnings) {\n continue\n }\n\n const packageInfo = response.trackResponse.shipment[0].package[0]\n const events = packageInfo.activity\n\n if (!events) {\n continue\n }\n\n let newUpdateTime = new Date(shipment.lastInteractionDate)\n let updateFlag = false\n let delivered = false\n let trackingEvents = []\n\n for (const event of events) {\n const year = event.date.slice(0, 4)\n const month = event.date.slice(4, 6)\n const day = event.date.slice(6)\n const hour = event.time.slice(0, 2)\n const minute = event.time.slice(2, 4)\n const second = event.time.slice(4)\n\n const timestamp = new Date(year, month, day, hour, minute, second)\n const interactionDelivered = event.status.type === 'D'\n const interactionMessage = event.status.description\n const city = event['location']['address']['city']\n const state = event['location']['address']['stateProvince']\n\n trackingEvents.push({ city, state, description: interactionMessage, date: timestamp.toUTCString() })\n\n\n if (!shipment.lastInteractionDate || timestamp > new Date(shipment.lastInteractionDate)) {\n\n updateFlag = true\n\n if (interactionDelivered) {\n delivered = true\n }\n\n const interaction = {\n shipmentId: shipment.id,\n interaction: interactionMessage,\n delivered: interactionDelivered\n }\n\n if (newUpdateTime < timestamp) {\n newUpdateTime = timestamp\n }\n\n resolvers.Mutation.addInteraction(null, interaction, ctx)\n }\n\n }\n\n const trackingUpdate = {\n isDelivered: delivered,\n events: trackingEvents.reverse(),\n }\n\n try{\n oms.updateOrderTracking(\n shipment.orderId,\n shipment.invoiceId,\n trackingUpdate\n )\n } catch (err) {\n logger.error({\n error: err,\n message: 'ShipmentTracker-UPSUpdateOrderTrackingError',\n })\n }\n\n if (updateFlag) {\n const updateShipment = {\n id: shipment.id,\n delivered,\n lastInteractionDate: newUpdateTime.toUTCString()\n }\n resolvers.Mutation.updateShipment(null, updateShipment, ctx)\n }\n\n }\n\n}\n\n```"
}
] |
code_shipment-tracker_d4b9cbbd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/services/usps.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-await-in-loop */\nimport { parseString } from 'xml2js'\n\nimport { resolvers } from '../resolvers'\nimport { CARRIERS } from '../constants'\n\nconst USPS_API_LIMIT = 10\nconst USPS_DELIVERED_STATUS = 'Delivered'\n\nexport const usps = async (settings: UspsConfig, ctx: Context) => {\n const {\n vtex: { account, logger },\n clients: { usps: uspsClient, oms },\n } = ctx\n\n const userId = `\"${settings.userId}\"`\n const clientIp = ctx.request.ip\n const sourceId = account\n const pageSize = USPS_API_LIMIT\n let returned = 0\n let createdBefore = null\n\n do {\n const args = { carrier: CARRIERS.USPS, pageSize, createdBefore }\n const shipments: Shipment[] = await resolvers.Query.shipmentsByCarrier(\n null,\n args,\n ctx\n )\n\n if (shipments.length) {\n const oldestDate = new Date(shipments[shipments.length - 1].createdIn)\n oldestDate.setSeconds(oldestDate.getSeconds() - 1)\n createdBefore = oldestDate.toISOString()\n\n const trackingNumbersXml = shipments.map((shipment) => {\n return `<TrackID ID=\"${shipment.trackingNumber}\"/>`\n })\n\n const xml = `<TrackFieldRequest USERID=${userId}><Revision>1</Revision><ClientIp>${clientIp}</ClientIp><SourceId>${sourceId}</SourceId>${trackingNumbersXml.join(\n ''\n )}</TrackFieldRequest>`\n\n const xmlResponse = await uspsClient.getTracking(xml)\n\n let updates: Array<Promise<string | void | OMSOrderTracking>> = []\n\n parseString(xmlResponse, async (_err, result: UspsParsedResult) => {\n const trackingItems = result.TrackResponse.TrackInfo\n\n updates = trackingItems.reduce(\n (\n promises: Array<Promise<string | void | OMSOrderTracking>>,\n trackingInfo\n ) => {\n const matchedShipment = shipments.find((shipment) => {\n return shipment.trackingNumber === trackingInfo?.$.ID\n })\n\n // console.log('matchedShipment', matchedShipment)\n // console.log('trackingSummary', trackingInfo.TrackSummary)\n if (!matchedShipment?.id || !trackingInfo.StatusCategory) {\n return promises\n }\n console.log('matched', matchedShipment?.orderId)\n\n const shipmentId = matchedShipment.id\n const [status] = trackingInfo.StatusCategory\n const isDelivered = status === USPS_DELIVERED_STATUS\n const [trackSummary] = trackingInfo.TrackSummary\n const trackingEvents: TrackingEvent[] = []\n\n if (trackSummary) {\n const [city] = trackSummary.EventCity\n const [state] = trackSummary.EventState\n const [description] = trackSummary.Event\n const [date] = trackSummary.EventDate\n\n trackingEvents.push({ city, state, description, date })\n }\n\n if (trackingInfo.TrackDetail) {\n const pastEvents = trackingInfo.TrackDetail.map((event) => {\n const [city] = event.EventCity\n const [state] = event.EventState\n const [description] = event.Event\n const [date] = event.EventDate\n\n return { city, state, description, date }\n })\n\n trackingEvents.push(...pastEvents)\n }\n\n const trackingUpdate = {\n isDelivered,\n events: trackingEvents.reverse(),\n }\n // console.log('tracking update', trackingUpdate)\n\n promises.push(\n oms.updateOrderTracking(\n matchedShipment.orderId,\n matchedShipment.invoiceId,\n trackingUpdate\n )\n )\n\n const interaction: AddInteractionArgs = {\n shipmentId,\n delivered: isDelivered,\n }\n\n // console.log('interaction', interaction)\n\n promises.push(\n resolvers.Mutation.addInteraction(null, interaction, ctx)\n )\n\n const shipment = {\n id: matchedShipment.id,\n delivered: isDelivered,\n }\n\n // console.log('update shipment', shipment)\n\n promises.push(\n resolvers.Mutation.updateShipment(null, shipment, ctx)\n )\n\n return promises\n },\n []\n )\n })\n\n try {\n if (updates) {\n await Promise.allSettled(updates)\n }\n } catch (err) {\n logger.error({\n error: err,\n message: 'ShipmentTracker-USPSTrackingError',\n })\n }\n }\n\n returned = shipments.length || 0\n } while (returned === USPS_API_LIMIT)\n}\n\n```"
}
] |
code_shipment-tracker_913a6aa3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/services/index.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { usps } from './usps'\nimport { fedex } from './fedex'\nimport { ups } from './ups'\nimport { canadaPost } from './canadaPost'\n\nexport const trackingService = {\n usps,\n ups,\n fedex,\n canadaPost,\n}\n\n```"
}
] |
code_shipment-tracker_87ccf6d8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/node/services/fedex.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { parseString } from 'xml2js'\nimport { resolvers } from '../resolvers'\n\nexport const fedex = async (settings: FedexConfig, ctx: Context) => {\n const {\n clients: { fedex: fedexClient, oms },\n vtex: { logger }\n } = ctx\n\n\n const url = `https://wsbeta.fedex.com:443/web-services`\n const { key, accountNumber, meterNumber, password } = settings\n\n const args = { carrier: 'FEDEX' }\n const shipments = await resolvers.Query.shipmentsByCarrier(null, args, ctx)\n\n console.log(\"shipments =>\", shipments)\n for (const shipment of shipments) {\n const trackingNum = shipment.trackingNumber\n\n const body =\n `<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n xmlns:v16=\"http://fedex.com/ws/track/v16\">\n <soapenv:Header/>\n <soapenv:Body>\n <v16:TrackRequest>\n <v16:WebAuthenticationDetail>\n <v16:ParentCredential>\n <v16:Key>${key}</v16:Key>\n <v16:Password>${password}</v16:Password>\n </v16:ParentCredential>\n <v16:UserCredential>\n <v16:Key>${key}</v16:Key>\n <v16:Password>${password}</v16:Password>\n </v16:UserCredential>\n </v16:WebAuthenticationDetail>\n <v16:ClientDetail>\n <v16:AccountNumber>${accountNumber}</v16:AccountNumber>\n <v16:MeterNumber>${meterNumber}</v16:MeterNumber>\n </v16:ClientDetail>\n <v16:TransactionDetail>\n <v16:CustomerTransactionId>Track By Number_v16</v16:CustomerTransactionId>\n <v16:Localization>\n <v16:LanguageCode>EN</v16:LanguageCode>\n <v16:LocaleCode>US</v16:LocaleCode>\n </v16:Localization>\n </v16:TransactionDetail>\n <v16:Version>\n <v16:ServiceId>trck</v16:ServiceId>\n <v16:Major>16</v16:Major>\n <v16:Intermediate>0</v16:Intermediate>\n <v16:Minor>0</v16:Minor>\n </v16:Version>\n <v16:SelectionDetails>\n <v16:CarrierCode>FDXE</v16:CarrierCode>\n <v16:PackageIdentifier>\n <v16:Type>TRACKING_NUMBER_OR_DOORTAG</v16:Type>\n <v16:Value>${trackingNum}</v16:Value>\n </v16:PackageIdentifier>\n\n <v16:ShipmentAccountNumber/>\n\n <v16:SecureSpodAccount/>\n <v16:Destination>\n <v16:GeographicCoordinates>rates evertitque aequora</v16:GeographicCoordinates>\n </v16:Destination>\n </v16:SelectionDetails>\n </v16:TrackRequest>\n </soapenv:Body>\n </soapenv:Envelope>`\n\n const response = await fedexClient.getTracking(url, body)\n\n parseString(response, (_err, result) => {\n try {\n result['SOAP-ENV:Envelope']['SOAP-ENV:Body'][0]['TrackReply'][0]['HighestSeverity'][0]\n result['SOAP-ENV:Envelope']['SOAP-ENV:Body'][0]['TrackReply'][0]['CompletedTrackDetails'][0]['TrackDetails'][0]['Events']\n } catch (err) {\n logger.error({\n error: err,\n message: 'ShipmentTracker-FedExTrackingError',\n })\n return\n }\n\n const events = result['SOAP-ENV:Envelope']['SOAP-ENV:Body'][0]['TrackReply'][0]['CompletedTrackDetails'][0]['TrackDetails'][0]['Events']\n let delivered = false\n let newLastInteractionDate = new Date(shipment.lastInteractionDate)\n let trackingEvents = []\n let updateFlag = false\n\n\n for (const event of events) {\n const timestamp = new Date(event.Timestamp[0])\n const location = event['Address'][0]\n const interactionMessage = event['EventDescription'][0]\n const interactionDelivered = interactionMessage === 'Delivered'\n const [city] = location['City']\n const [state] = location['StateOrProvinceCode']\n const description = interactionMessage\n const date = event.Timestamp[0]\n\n trackingEvents.push({ city, state, description, date })\n\n if (!shipment.lastInteractionDate || timestamp > new Date(shipment.lastInteractionDate)) {\n updateFlag = true\n if (interactionDelivered) {\n delivered = true\n }\n\n\n const interaction = {\n shipmentId: shipment.id,\n interaction: interactionMessage,\n delivered: interactionDelivered\n }\n\n if (newLastInteractionDate < timestamp) {\n newLastInteractionDate = timestamp\n }\n\n resolvers.Mutation.addInteraction(null, interaction, ctx)\n }\n }\n\n const trackingUpdate = {\n isDelivered: delivered,\n events: trackingEvents.reverse(),\n }\n\n try {\n oms.updateOrderTracking(\n shipment.orderId,\n shipment.invoiceId,\n trackingUpdate\n )\n } catch (err){\n logger.error({\n error: err,\n message: 'ShipmentTracker-FedExUpdateOrderTrackingError',\n })\n }\n\n if (updateFlag) {\n const updateShipment = {\n id: shipment.id,\n delivered,\n lastInteractionDate: newLastInteractionDate.toUTCString()\n }\n resolvers.Mutation.updateShipment(null, updateShipment, ctx)\n }\n })\n }\n}\n\n```"
}
] |
code_shipment-tracker_81e13e74
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/typings/schedule.d.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface ScheduleViewResponse {\n viewSchedule: Schedule | null\n}\n\ninterface ScheduleCreateResponse {\n createSchedule: {\n nextExecution: string\n }\n}\n\ninterface Schedule {\n nextExecution: string\n lastInteractionIn?: string\n}\n\n```"
}
] |
code_shipment-tracker_616e287b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/typings/graphql.d.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.gql' {\n import type { DocumentNode } from 'graphql'\n\n const value: DocumentNode\n export default value\n}\n\n```"
}
] |
code_shipment-tracker_03ddd403
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/typings/vtex.styleguide.d.ts from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.styleguide' {\n export const PageHeader\n export const Alert\n export const Modal\n export const Box\n export const Card\n export const Dropdown\n export const Spinner\n export const Table\n export const Button\n export const ButtonPlain\n export const IconWarning\n export const IconCheck\n export const Input\n export const InputSearch\n export const IconCaretDown\n export const IconCaretUp\n export const IconArrowDown\n export const IconArrowBack\n export const IconArrowUp\n export const IconClose\n export const IconExternalLink\n export const IconSearch\n export const IconSuccess\n export const IconCopy\n export const IconCog\n export const Toggle\n export const Tooltip\n export const ToastConsumer\n export const ToastProvider\n export const withToast\n export const ButtonWithIcon\n export const Pagination\n export const Collapsible\n export const Textarea\n export const NumericStepper\n export const EmptyState\n export const Tab\n export const IconEdit\n export const Tag\n export const Layout\n export const Tabs\n export const Divider\n export const PageBlock\n}\n\n```"
}
] |
code_shipment-tracker_8adaabac
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/getAllShipments.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery GetAllShipments {\n allShipments{\n id\n trackingNumber\n carrier\n delivered\n orderId\n invoiceId\n externalLink\n createdIn\n lastInteractionDate\n }\n}\n\n```"
}
] |
code_shipment-tracker_376970b8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/addShipment.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation AddShipment($trackingNumber: String, $carrier: String, $delivered: Boolean, $orderId: String, $invoiceId: String, $externalLink: String) {\n addShipment(trackingNumber: $trackingNumber, carrier: $carrier, delivered: $delivered, orderId: $orderId, invoiceId: $invoiceId, externalLink: $externalLink)\n}\n\n```"
}
] |
code_shipment-tracker_2c150d53
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/config.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery Config {\n config {\n title\n schema\n }\n}\n\n```"
}
] |
code_shipment-tracker_18521705
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/appSettings.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery AppSettings($version: String) {\n appSettings(app: \"vtex.shipping-tracker\", version: $version)\n @context(provider: \"vtex.apps-graphql\") {\n message\n }\n}\n\n```"
}
] |
code_shipment-tracker_d673530a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/getShipment.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery GetShipment($id: String!) {\n shipment(id: $id) {\n id\n trackingNumber\n carrier\n delivered\n orderId\n invoiceId\n externalLink\n createdIn\n lastInteractionDate\n }\n}\n\n```"
}
] |
code_shipment-tracker_b6ab7bdf
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/shipmentsByCarrier.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery ShipmentsByCarrier($carrier: String) {\n shipmentsByCarrier(carrier: $carrier) {\n id\n trackingNumber\n carrier\n delivered\n orderId\n invoiceId\n externalLink\n createdIn\n lastInteractionDate\n }\n}\n\n```"
}
] |
code_shipment-tracker_541fdac4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/getInteractions.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery GetInteractions($shipmentId: String) {\n interactions(shipmentId: $shipmentId) {\n id\n interaction\n delivered\n createdIn\n updatedIn\n }\n}\n\n```"
}
] |
code_shipment-tracker_67d18ee6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/saveAppSettings.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation SaveAppSettings($version: String, $settings: String) {\n saveAppSettings(\n app: \"vtex.shipping-tracker\"\n version: $version\n settings: $settings\n ) @context(provider: \"vtex.apps-graphql\") {\n message\n }\n}\n\n```"
}
] |
code_shipment-tracker_f51954e2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/viewSchedule.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery ViewSchedule {\n viewSchedule {\n lastInteractionIn\n nextExecution\n }\n}\n\n```"
}
] |
code_shipment-tracker_40544bd6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/addInteraction.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation AddInteraction($shipmentId: String, $interaction: String, $delivered: Boolean) {\n addInteraction(shipmentId: $shipmentId, interaction: $interaction, delivered: $delivered)\n}\n\n```"
}
] |
code_shipment-tracker_224da246
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/queries/createSchedule.gql from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nmutation CreateSchedule {\n createSchedule {\n nextExecution\n }\n}\n\n```"
}
] |
code_shipment-tracker_284382f9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of shipment-tracker/react/components/Carriers.tsx from the shipment-tracker VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, {\n ChangeEvent,\n FC,\n Fragment,\n useEffect,\n useReducer,\n useState,\n} from 'react'\nimport { injectIntl, defineMessages } from 'react-intl'\nimport { useMutation, useQuery } from 'react-apollo'\nimport { Button, PageBlock, Input } from 'vtex.styleguide'\n\nimport AppSettings from '../queries/appSettings.gql'\nimport SaveAppSettings from '../queries/saveAppSettings.gql'\n\nimport '../styles.global.css'\n\nconst initialState = {\n canadaPost: {\n userId: '',\n password: '',\n active: false,\n },\n fedex: {\n key: '',\n accountNumber: '',\n meterNumber: '',\n password: '',\n active: false,\n },\n ups: {\n key: '',\n active: false,\n },\n usps: {\n userId: '',\n active: false,\n },\n}\n\nconst reducer = (state: any, action: any) => {\n switch (action.type) {\n case 'canadaPost':\n return {\n ...state,\n canadaPost: { ...state.canadaPost, ...action.payload },\n }\n case 'fedex':\n return { ...state, fedex: { ...state.fedex, ...action.payload } }\n case 'ups':\n return { ...state, ups: { ...state.ups, ...action.payload } }\n case 'usps':\n return { ...state, usps: { ...state.usps, ...action.payload } }\n case 'setConfig':\n return { ...state, ...action.payload }\n default:\n throw new Error()\n }\n}\n\nconst markActive = (settings: any) => {\n const {\n usps: { userId: uspsUserId },\n ups: { key: upsKey },\n fedex: { key: fedexKey },\n canadaPost: { userId: canadaPostUserId },\n } = settings.carriers\n\n settings.carriers.usps.active = !!uspsUserId\n settings.carriers.ups.active = !!upsKey\n settings.carriers.fedex.active = !!fedexKey\n settings.carriers.canadaPost.active = !!canadaPostUserId\n\n return settings\n}\n\nconst Carriers: FC<any> = ({ intl }) => {\n const messages = defineMessages({\n title: {\n id: 'admin/carrier.title',\n defaultMessage: 'Carrier',\n },\n save: {\n id: 'admin/carrier.save.label',\n defaultMessage: 'Save',\n },\n canadaPost: {\n id: 'admin/carrier.canadapost.label',\n defaultMessage: 'Canada Post',\n },\n canadaPostId: {\n id: 'admin/carrier.canadapost.id.label',\n defaultMessage: 'User ID',\n },\n canadaPostPassword: {\n id: 'admin/carrier.canadapost.password.label',\n defaultMessage: 'Account Password',\n },\n fedex: {\n id: 'admin/carrier.fedex.label',\n defaultMessage: 'Fedex',\n },\n fedexKey: {\n id: 'admin/carrier.fedex.key.label',\n defaultMessage: 'Key',\n },\n fedexAccountNumber: {\n id: 'admin/carrier.fedex.account-number.label',\n defaultMessage: 'Account Number',\n },\n fedexMeterNumber: {\n id: 'admin/carrier.fedex.meter-number.label',\n defaultMessage: 'Meter Number',\n },\n fedexPassword: {\n id: 'admin/carrier.fedex.password.label',\n defaultMessage: 'Password',\n },\n ups: {\n id: 'admin/carrier.ups.label',\n defaultMessage: 'UPS',\n },\n upsKey: {\n id: 'admin/carrier.ups.key.label',\n defaultMessage: 'Key',\n },\n usps: {\n id: 'admin/carrier.usps.label',\n defaultMessage: 'USPS',\n },\n uspsUserID: {\n id: 'admin/carrier.usps.userID.label',\n defaultMessage: 'User ID',\n },\n })\n\n const [loading, setLoading] = useState(false)\n const [appSettings, setAppSettings] = useState<any>(null)\n const [saveSettings] = useMutation(SaveAppSettings)\n const [state, dispatch] = useReducer(reducer, initialState)\n const { data } = useQuery(AppSettings, {\n variables: {\n version: process.env.VTEX_APP_VERSION,\n },\n })\n\n useEffect(() => {\n if (!data) {\n return\n }\n const settings = JSON.parse(data.appSettings.message)\n setAppSettings(settings)\n\n if (settings.carriers) {\n dispatch({\n type: 'setConfig',\n payload: settings.carriers,\n })\n }\n }, [data])\n\n const handleSave = async () => {\n setLoading(true)\n if (!appSettings) {\n return\n }\n const settings = appSettings\n\n settings.carriers = {\n ...settings.carriers,\n ...state,\n }\n\n await saveSettings({\n variables: {\n version: process.env.VTEX_APP_VERSION,\n settings: JSON.stringify(markActive(settings)),\n },\n })\n setLoading(false)\n }\n\n return (\n <Fragment>\n <div className=\"mt5\" />\n <PageBlock\n title=\"Carriers\"\n variation=\"full\"\n titleAside={\n <div className=\"flex justify-end\">\n <div className=\"w-40 mb5\">\n <Button\n isLoading={loading}\n onClick={() => handleSave()}\n variation=\"primary\"\n >\n Save\n </Button>\n </div>\n </div>\n }\n >\n <PageBlock title=\"Canada Post\" variation=\"full\">\n <div className=\"mb5\">\n <Input\n value={state.canadaPost.userId}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n dispatch({\n type: 'canadaPost',\n payload: { userId: e.target.value },\n })\n }}\n placeholder=\"User ID\"\n label=\"User ID\"\n />\n </div>\n <div className=\"mb5\">\n <Input\n value={state.canadaPost.password}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n dispatch({\n type: 'canadaPost',\n payload: { password: e.target.value },\n })\n }\n placeholder=\"Account Password\"\n label=\"Account Password\"\n />\n </div>\n </PageBlock>\n <PageBlock title=\"FedEx\" variation=\"full\">\n <div className=\"mb5\">\n <Input\n value={state.fedex.key}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n dispatch({ type: 'fedex', payload: { key: e.target.value } })\n }}\n placeholder=\"Key\"\n label=\"Key\"\n />\n </div>\n <div className=\"mb5\">\n <Input\n value={state.fedex.accountNumber}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n dispatch({\n type: 'fedex',\n payload: { accountNumber: e.target.value },\n })\n }\n placeholder=\"Account Number\"\n label=\"Account Number\"\n />\n </div>\n <div className=\"mb5\">\n <Input\n value={state.fedex.meterNumber}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n dispatch({\n type: 'fedex',\n payload: { meterNumber: e.target.value },\n })\n }\n placeholder=\"Meter Number\"\n label=\"Meter Number\"\n />\n </div>\n <div className=\"mb5\">\n <Input\n value={state.fedex.password}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n dispatch({\n type: 'fedex',\n payload: { password: e.target.value },\n })\n }\n placeholder=\"Password\"\n label=\"Password\"\n />\n </div>\n </PageBlock>\n <PageBlock title=\"UPS\" variation=\"full\">\n <Input\n value={state.ups.key}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n dispatch({ type: 'ups', payload: { key: e.target.value } })\n }\n placeholder=\"Key\"\n label=\"Key\"\n />\n </PageBlock>\n <PageBlock title=\"USPS\" variation=\"full\">\n <Input\n value={state.usps.userId}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n dispatch({ type: 'usps', payload: { userId: e.target.value } })\n }\n placeholder=\"USPS Web Tools User ID\"\n label=\"User ID\"\n />\n </PageBlock>\n </PageBlock>\n </Fragment>\n )\n}\n\nexport default injectIntl(Carriers)\n\n```"
}
] |
code_places-graphql_eda6f19e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/docs/README.md from the places-graphql 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# PLACES GRAPHQL\n\n⚠️ **This is an ongoing, unsupported, unfinished and undocumented project. We do not guarantee any results after installation.** ⚠️\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nService used as a middleware for localization and geocoding utilities.\n\n## Configuration \n\nTBC\n\n## Customization\n\nTBC\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n<!-- DOCS-IGNORE:end -->\n\n```"
}
] |
code_places-graphql_10966292
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/graphql/schema.graphql from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Query {\n reverseGeocode(\n \"\"\"\n Latitude of the point you want to get the Address object from\n \"\"\"\n lat: String\n \"\"\"\n Longitude of the point you want to get the Address object from\n \"\"\"\n lng: String\n ): Address\n\n getAddressFromPostalCode(\n \"\"\"\n Postal Code\n \"\"\"\n postalCode: String\n \"\"\"\n Alpha-3 code for the country\n \"\"\"\n countryCode: String\n ): Address\n}\n\n```"
}
] |
code_places-graphql_376d31cd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/package.json from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"places-graphql\",\n \"version\": \"0.4.1\",\n \"license\": \"UNLICENSED\",\n \"private\": true,\n \"dependencies\": {\n \"ramda\": \"^0.27.0\"\n },\n \"devDependencies\": {\n \"@types/googlemaps\": \"^3.39.3\",\n \"@types/lodash\": \"^4.14.149\",\n \"@types/ramda\": \"^0.26.43\",\n \"@vtex/api\": \"6.36.3\"\n }\n}\n\n```"
}
] |
code_places-graphql_a0dda899
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/index.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Service, RecorderState, ParamsContext } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { resolvers } from './resolvers'\n\nconst DEFAULT_TIMEOUT_MS = 10 * 1000\n\nexport default new Service<Clients, RecorderState, ParamsContext>({\n clients: {\n implementation: Clients,\n options: {\n default: {\n timeout: DEFAULT_TIMEOUT_MS,\n },\n },\n },\n graphql: {\n resolvers,\n },\n})\n\n```"
}
] |
code_places-graphql_f8675b1b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/graphql/types/Address.graphql from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Address {\n addressId: ID\n addressType: AddressType\n city: String\n complement: String\n country: String\n geoCoordinates: [Float!]\n neighborhood: String\n number: String\n postalCode: String\n receiverName: String\n reference: String\n state: String\n street: String\n}\n\nenum AddressType {\n residential\n commercial\n inStore\n giftRegistry\n pickup\n search\n}\n\n```"
}
] |
code_places-graphql_b22e4c7b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/clients/GoogleGeolocation.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ExternalClient, InstanceOptions, IOContext } from '@vtex/api'\n\nexport class GoogleGeolocation extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super('https://maps.googleapis.com/maps/api', context, options)\n }\n\n public reverseGeocode = (lat: string, lng: string, apiKey: string) => {\n return this.http.get(`/geocode/json?latlng=${lat},${lng}&key=${apiKey}`, {\n metric: 'google-reverse-geocode-country',\n timeout: 3000,\n })\n }\n}\n\n```"
}
] |
code_places-graphql_caac5fe8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/clients/Checkout.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { JanusClient } from '@vtex/api'\n\nexport class Checkout extends JanusClient {\n public getAddressFromPostalCode = (\n postalCode: string,\n countryCode: string\n ) => {\n return this.http.get<Address>(\n `/api/checkout/pub/postal-code/${countryCode}/${postalCode}`,\n {\n metric: 'checkout-autocomplete-address-based-on-postal-code',\n timeout: 3000,\n }\n )\n }\n}\n\n```"
}
] |
code_places-graphql_8fec1c8c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/clients/index.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport { GoogleGeolocation } from './GoogleGeolocation'\nimport { Checkout } from './Checkout'\n\nexport class Clients extends IOClients {\n public get googleGeolocation() {\n return this.getOrSet('googleGeolocation', GoogleGeolocation)\n }\n\n public get checkout() {\n return this.getOrSet('checkout', Checkout)\n }\n}\n\n```"
}
] |
code_places-graphql_a1b8e06a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/typings/global.d.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ServiceContext } from '@vtex/api'\n\nimport { Clients } from '../clients'\n\ndeclare global {\n type Context = ServiceContext & {\n clients: Clients\n }\n\n type AddressType =\n | 'residential'\n | 'commercial'\n | 'inStore'\n | 'giftRegistry'\n | 'pickup'\n | 'search'\n\n interface Address {\n addressId: string\n addressType: AddressType\n city: string | null\n complement: string | null\n country: string | null\n geoCoordinates: number[]\n neighborhood: string | null\n number: string | null\n postalCode: string | null\n receiverName: string | null\n reference: string | null\n state: string | null\n street: string | null\n }\n\n type AddressFields = keyof Address\n\n type AddressWithValidation = {\n [prop in AddressFields]: {\n value: Address[prop]\n valid?: boolean\n }\n }\n\n interface GeolocationRule {\n valueIn: 'long_name' | 'short_name'\n types: string[]\n required?: boolean\n notApplicable?: boolean\n handler?: (\n address: Address,\n googleAddress: google.maps.GeocoderResult\n ) => Address\n }\n\n type GeolocationComponents =\n | 'postalCode'\n | 'street'\n | 'neighborhood'\n | 'state'\n | 'city'\n | 'number'\n\n type GeolocationRules = {\n [component in GeolocationComponents]?: GeolocationRule\n }\n\n interface Rules {\n geolocation: GeolocationRules\n }\n\n namespace NodeJS {\n interface ProcessEnv {\n VTEX_APP_ID: string\n }\n }\n}\n\n```"
}
] |
code_places-graphql_ae0c39aa
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/resolvers/postalCode.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface PostalCodeQueryArgs {\n postalCode: string\n countryCode: string\n}\n\nexport const queries = {\n getAddressFromPostalCode: async (\n _: unknown,\n args: PostalCodeQueryArgs,\n ctx: Context\n ): Promise<Address> => {\n const {\n clients: { checkout },\n } = ctx\n const { postalCode, countryCode } = args\n\n return checkout.getAddressFromPostalCode(postalCode, countryCode)\n },\n}\n\n```"
}
] |
code_places-graphql_65a0c8b7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/resolvers/index.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { queries as geolocationQueries } from './geolocation'\nimport { queries as postalCodeQueries } from './postalCode'\n\nexport const resolvers = {\n Query: {\n ...geolocationQueries,\n ...postalCodeQueries,\n },\n}\n\n```"
}
] |
code_places-graphql_67db88bb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/resolvers/geolocation.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { pipe } from 'ramda'\n\nimport countryRules from '../countries/rules'\nimport { ISOAlpha2 } from '../countries/types'\nimport { toAlpha3 } from '../countries/ISO'\n\nconst processGoogleGeocoderResult = (\n googleAddress: google.maps.GeocoderResult\n): Address => {\n const baseAddress: Address = {\n addressId: '1',\n addressType: 'residential',\n city: null,\n complement: null,\n country: null,\n geoCoordinates: [],\n neighborhood: null,\n number: null,\n postalCode: null,\n receiverName: null,\n reference: null,\n state: null,\n street: null,\n }\n\n const rules = countryRules[getCountry(googleAddress)!]\n\n if (!rules) {\n console.warn(\n `We don't have geolocation rules for the country: ${getCountry(\n googleAddress\n )}`\n )\n return baseAddress\n }\n\n const geolocationRules = rules.geolocation\n\n // The functions below use googleAddress and geolocationRules\n // from the closure created.\n\n function setAddressFields() {\n const indexedRules = revertRuleIndex(geolocationRules)\n\n return googleAddress.address_components.reduce<Address>(\n (updatedAddress: Address, component) => {\n const checkoutFieldName = getCheckoutFieldName(\n component.types,\n indexedRules\n )\n\n if (checkoutFieldName) {\n return setAddressFieldValue(\n updatedAddress,\n checkoutFieldName,\n geolocationRules,\n component\n )\n }\n\n return updatedAddress\n },\n {} as Address\n )\n }\n\n function setGeoCoordinates(updatedAddress: Address) {\n const {\n location: { lng, lat },\n } = googleAddress.geometry\n\n updatedAddress.geoCoordinates = [\n typeof lng === 'function' ? lng() : lng,\n typeof lat === 'function' ? lat() : lat,\n ]\n\n return updatedAddress\n }\n\n // Run custom function handlers to fill some fields\n function runGeolocationFieldHandlers(updatedAddress: Address) {\n Object.values(geolocationRules).forEach(rule => {\n if (rule!.handler) {\n updatedAddress = rule!.handler(updatedAddress, googleAddress)\n }\n })\n\n Object.values(geolocationRules).forEach(rule => {\n if (rule!.handler) {\n updatedAddress = rule!.handler(updatedAddress, googleAddress)\n }\n })\n\n return updatedAddress\n }\n\n function setCountry(updatedAddress: Address) {\n const country = getCountry(googleAddress)\n updatedAddress.country = country\n return updatedAddress\n }\n\n return pipe(\n setAddressFields,\n runGeolocationFieldHandlers,\n setGeoCoordinates,\n setCountry,\n (newAddress: Address) => ({\n ...newAddress,\n addressId: baseAddress.addressId,\n addressType: baseAddress.addressType,\n receiverName: baseAddress.receiverName,\n })\n )()\n}\n\n/** This function creates a map like this:\n * {\n * \"postal_code\": \"postalCode\",\n * \"street_number\": \"number\",\n * \"route\": \"street\",\n * \"neighborhood\": \"neighborhood\",\n * \"sublocality_level_1\": \"neighborhood\",\n * \"sublocality_level_2\": \"neighborhood\",\n * \"sublocality_level_3\": \"neighborhood\",\n * \"sublocality_level_4\": \"neighborhood\",\n * \"sublocality_level_5\": \"neighborhood\",\n * \"administrative_area_level_1\": \"state\",\n * \"administrative_area_level_2\": \"city\",\n * \"locality\": \"city\"\n * }\n * So it's easy to find which Google address type matches ours\n * */\nfunction revertRuleIndex(geolocationRules: GeolocationRules) {\n return Object.entries(geolocationRules).reduce<{\n [key: string]: GeolocationComponents\n }>((acc, [propName, rule]) => {\n for (let i = 0; i < rule!.types.length; i++) {\n const type = rule!.types[i]\n acc[type] = propName as GeolocationComponents\n }\n return acc\n }, {})\n}\n\n// Return the matched checkout field name\nfunction getCheckoutFieldName(\n types: string[],\n indexedRules: { [key: string]: GeolocationComponents }\n) {\n const mappedType = types.find(type => indexedRules[type])\n return mappedType ? indexedRules[mappedType] : null\n}\n\nfunction setAddressFieldValue(\n address: Address,\n fieldName: GeolocationComponents,\n geolocationRules: GeolocationRules,\n addressComponent: google.maps.GeocoderAddressComponent\n) {\n const geolocationField = geolocationRules[fieldName]\n address[fieldName] = addressComponent[geolocationField!.valueIn]\n return address\n}\n\nfunction getCountry(googleAddress: google.maps.GeocoderResult) {\n const countryComponent = googleAddress.address_components.find(\n component => component.types.indexOf('country') !== -1\n )\n\n return countryComponent\n ? toAlpha3(countryComponent.short_name as ISOAlpha2)\n : null\n}\n\ninterface ReverseGeocodeArgs {\n lat: string\n lng: string\n}\n\nexport const queries = {\n reverseGeocode: async (\n _: unknown,\n args: ReverseGeocodeArgs,\n ctx: Context\n ): Promise<Address> => {\n const { clients } = ctx\n const { lat, lng } = args\n const { apiKey } = await clients.apps.getAppSettings(\n process.env.VTEX_APP_ID\n )\n\n const googleAddress = await clients.googleGeolocation.reverseGeocode(\n lat,\n lng,\n apiKey\n )\n\n return processGoogleGeocoderResult(googleAddress.results[0])\n },\n}\n\n```"
}
] |
code_places-graphql_962551a5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/countries/BRA.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nconst rules: Rules = {\n geolocation: {\n postalCode: {\n valueIn: 'long_name',\n types: ['postal_code'],\n required: false,\n },\n number: {\n valueIn: 'long_name',\n types: ['street_number'],\n required: true,\n notApplicable: true,\n },\n street: {\n valueIn: 'long_name',\n types: ['route'],\n },\n neighborhood: {\n valueIn: 'long_name',\n types: [\n 'neighborhood',\n 'sublocality_level_1',\n 'sublocality_level_2',\n 'sublocality_level_3',\n 'sublocality_level_4',\n 'sublocality_level_5',\n ],\n },\n state: {\n valueIn: 'short_name',\n types: ['administrative_area_level_1'],\n },\n city: {\n valueIn: 'long_name',\n types: ['administrative_area_level_2', 'locality'],\n },\n },\n}\n\nexport default rules\n\n```"
}
] |
code_places-graphql_964185b9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/countries/ISO.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ISOAlpha2, ISOAlpha3 } from './types'\n\nconst countryISOMapping: Array<[ISOAlpha2, ISOAlpha3]> = [\n ['AF', 'AFG'],\n ['AX', 'ALA'],\n ['AL', 'ALB'],\n ['DZ', 'DZA'],\n ['AS', 'ASM'],\n ['AD', 'AND'],\n ['AO', 'AGO'],\n ['AI', 'AIA'],\n ['AQ', 'ATA'],\n ['AG', 'ATG'],\n ['AR', 'ARG'],\n ['AM', 'ARM'],\n ['AW', 'ABW'],\n ['AU', 'AUS'],\n ['AT', 'AUT'],\n ['AZ', 'AZE'],\n ['BS', 'BHS'],\n ['BH', 'BHR'],\n ['BD', 'BGD'],\n ['BB', 'BRB'],\n ['BY', 'BLR'],\n ['BE', 'BEL'],\n ['BZ', 'BLZ'],\n ['BJ', 'BEN'],\n ['BM', 'BMU'],\n ['BT', 'BTN'],\n ['BO', 'BOL'],\n ['BA', 'BIH'],\n ['BW', 'BWA'],\n ['BV', 'BVT'],\n ['BR', 'BRA'],\n ['VG', 'VGB'],\n ['IO', 'IOT'],\n ['BN', 'BRN'],\n ['BG', 'BGR'],\n ['BF', 'BFA'],\n ['BI', 'BDI'],\n ['KH', 'KHM'],\n ['CM', 'CMR'],\n ['CA', 'CAN'],\n ['CV', 'CPV'],\n ['KY', 'CYM'],\n ['CF', 'CAF'],\n ['TD', 'TCD'],\n ['CL', 'CHL'],\n ['CN', 'CHN'],\n ['HK', 'HKG'],\n ['MO', 'MAC'],\n ['CX', 'CXR'],\n ['CC', 'CCK'],\n ['CO', 'COL'],\n ['KM', 'COM'],\n ['CG', 'COG'],\n ['CD', 'COD'],\n ['CK', 'COK'],\n ['CR', 'CRI'],\n ['CI', 'CIV'],\n ['HR', 'HRV'],\n ['CU', 'CUB'],\n ['CY', 'CYP'],\n ['CZ', 'CZE'],\n ['DK', 'DNK'],\n ['DJ', 'DJI'],\n ['DM', 'DMA'],\n ['DO', 'DOM'],\n ['EC', 'ECU'],\n ['EG', 'EGY'],\n ['SV', 'SLV'],\n ['GQ', 'GNQ'],\n ['ER', 'ERI'],\n ['EE', 'EST'],\n ['ET', 'ETH'],\n ['FK', 'FLK'],\n ['FO', 'FRO'],\n ['FJ', 'FJI'],\n ['FI', 'FIN'],\n ['FR', 'FRA'],\n ['GF', 'GUF'],\n ['PF', 'PYF'],\n ['TF', 'ATF'],\n ['GA', 'GAB'],\n ['GM', 'GMB'],\n ['GE', 'GEO'],\n ['DE', 'DEU'],\n ['GH', 'GHA'],\n ['GI', 'GIB'],\n ['GR', 'GRC'],\n ['GL', 'GRL'],\n ['GD', 'GRD'],\n ['GP', 'GLP'],\n ['GU', 'GUM'],\n ['GT', 'GTM'],\n ['GG', 'GGY'],\n ['GN', 'GIN'],\n ['GW', 'GNB'],\n ['GY', 'GUY'],\n ['HT', 'HTI'],\n ['HM', 'HMD'],\n ['VA', 'VAT'],\n ['HN', 'HND'],\n ['HU', 'HUN'],\n ['IS', 'ISL'],\n ['IN', 'IND'],\n ['ID', 'IDN'],\n ['IR', 'IRN'],\n ['IQ', 'IRQ'],\n ['IE', 'IRL'],\n ['IM', 'IMN'],\n ['IL', 'ISR'],\n ['IT', 'ITA'],\n ['JM', 'JAM'],\n ['JP', 'JPN'],\n ['JE', 'JEY'],\n ['JO', 'JOR'],\n ['KZ', 'KAZ'],\n ['KE', 'KEN'],\n ['KI', 'KIR'],\n ['KP', 'PRK'],\n ['KR', 'KOR'],\n ['KW', 'KWT'],\n ['KG', 'KGZ'],\n ['LA', 'LAO'],\n ['LV', 'LVA'],\n ['LB', 'LBN'],\n ['LS', 'LSO'],\n ['LR', 'LBR'],\n ['LY', 'LBY'],\n ['LI', 'LIE'],\n ['LT', 'LTU'],\n ['LU', 'LUX'],\n ['MK', 'MKD'],\n ['MG', 'MDG'],\n ['MW', 'MWI'],\n ['MY', 'MYS'],\n ['MV', 'MDV'],\n ['ML', 'MLI'],\n ['MT', 'MLT'],\n ['MH', 'MHL'],\n ['MQ', 'MTQ'],\n ['MR', 'MRT'],\n ['MU', 'MUS'],\n ['YT', 'MYT'],\n ['MX', 'MEX'],\n ['FM', 'FSM'],\n ['MD', 'MDA'],\n ['MC', 'MCO'],\n ['MN', 'MNG'],\n ['ME', 'MNE'],\n ['MS', 'MSR'],\n ['MA', 'MAR'],\n ['MZ', 'MOZ'],\n ['MM', 'MMR'],\n ['NA', 'NAM'],\n ['NR', 'NRU'],\n ['NP', 'NPL'],\n ['NL', 'NLD'],\n ['AN', 'ANT'],\n ['NC', 'NCL'],\n ['NZ', 'NZL'],\n ['NI', 'NIC'],\n ['NE', 'NER'],\n ['NG', 'NGA'],\n ['NU', 'NIU'],\n ['NF', 'NFK'],\n ['MP', 'MNP'],\n ['NO', 'NOR'],\n ['OM', 'OMN'],\n ['PK', 'PAK'],\n ['PW', 'PLW'],\n ['PS', 'PSE'],\n ['PA', 'PAN'],\n ['PG', 'PNG'],\n ['PY', 'PRY'],\n ['PE', 'PER'],\n ['PH', 'PHL'],\n ['PN', 'PCN'],\n ['PL', 'POL'],\n ['PT', 'PRT'],\n ['PR', 'PRI'],\n ['QA', 'QAT'],\n ['RE', 'REU'],\n ['RO', 'ROU'],\n ['RU', 'RUS'],\n ['RW', 'RWA'],\n ['BL', 'BLM'],\n ['SH', 'SHN'],\n ['KN', 'KNA'],\n ['LC', 'LCA'],\n ['MF', 'MAF'],\n ['PM', 'SPM'],\n ['VC', 'VCT'],\n ['WS', 'WSM'],\n ['SM', 'SMR'],\n ['ST', 'STP'],\n ['SA', 'SAU'],\n ['SN', 'SEN'],\n ['RS', 'SRB'],\n ['SC', 'SYC'],\n ['SL', 'SLE'],\n ['SG', 'SGP'],\n ['SK', 'SVK'],\n ['SI', 'SVN'],\n ['SB', 'SLB'],\n ['SO', 'SOM'],\n ['ZA', 'ZAF'],\n ['GS', 'SGS'],\n ['SS', 'SSD'],\n ['ES', 'ESP'],\n ['LK', 'LKA'],\n ['SD', 'SDN'],\n ['SR', 'SUR'],\n ['SJ', 'SJM'],\n ['SZ', 'SWZ'],\n ['SE', 'SWE'],\n ['CH', 'CHE'],\n ['SY', 'SYR'],\n ['TW', 'TWN'],\n ['TJ', 'TJK'],\n ['TZ', 'TZA'],\n ['TH', 'THA'],\n ['TL', 'TLS'],\n ['TG', 'TGO'],\n ['TK', 'TKL'],\n ['TO', 'TON'],\n ['TT', 'TTO'],\n ['TN', 'TUN'],\n ['TR', 'TUR'],\n ['TM', 'TKM'],\n ['TC', 'TCA'],\n ['TV', 'TUV'],\n ['UG', 'UGA'],\n ['UA', 'UKR'],\n ['AE', 'ARE'],\n ['GB', 'GBR'],\n ['US', 'USA'],\n ['UM', 'UMI'],\n ['UY', 'URY'],\n ['UZ', 'UZB'],\n ['VU', 'VUT'],\n ['VE', 'VEN'],\n ['VN', 'VNM'],\n ['VI', 'VIR'],\n ['WF', 'WLF'],\n ['EH', 'ESH'],\n ['YE', 'YEM'],\n ['ZM', 'ZMB'],\n ['ZW', 'ZWE'],\n]\n\nexport const toAlpha3 = (country: ISOAlpha2): ISOAlpha3 => {\n const index = countryISOMapping.findIndex(([alpha2]) => alpha2 === country)\n\n return countryISOMapping[index][1]\n}\n\nexport const toAlpha2 = (country: ISOAlpha3): ISOAlpha2 => {\n const index = countryISOMapping.findIndex(([, alpha3]) => alpha3 === country)\n\n return countryISOMapping[index][0]\n}\n\n```"
}
] |
code_places-graphql_47bd662c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/countries/ARG.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nconst rules: Rules = {\n geolocation: {\n postalCode: {\n valueIn: 'long_name',\n types: ['postal_code'],\n required: false,\n },\n number: {\n valueIn: 'long_name',\n types: ['street_number'],\n required: true,\n notApplicable: true,\n },\n street: { valueIn: 'long_name', types: ['route'] },\n neighborhood: {\n valueIn: 'long_name',\n types: [\n 'neighborhood',\n 'sublocality_level_1',\n 'sublocality_level_2',\n 'sublocality_level_3',\n 'sublocality_level_4',\n 'sublocality_level_5',\n ],\n },\n state: {\n valueIn: 'long_name',\n types: ['administrative_area_level_1'],\n },\n city: {\n valueIn: 'long_name',\n types: ['administrative_area_level_2', 'locality'],\n },\n },\n}\n\nexport default rules\n\n```"
}
] |
code_places-graphql_7569a8a0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/countries/BOL.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nconst rules: Rules = {\n geolocation: {\n postalCode: {\n valueIn: 'long_name',\n types: ['postal_code'],\n required: false,\n },\n number: {\n valueIn: 'long_name',\n types: ['street_number'],\n required: true,\n notApplicable: true,\n },\n street: { valueIn: 'long_name', types: ['route'] },\n state: {\n valueIn: 'short_name',\n types: ['administrative_area_level_1'],\n },\n city: {\n valueIn: 'long_name',\n types: ['locality', 'administrative_area_level_2'],\n },\n neighborhood: {\n valueIn: 'long_name',\n types: ['administrative_area_level_3'],\n },\n },\n}\n\nexport default rules\n\n```"
}
] |
code_places-graphql_86445e7c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/countries/types.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport type ISOAlpha2 =\n | 'AF'\n | 'AX'\n | 'AL'\n | 'DZ'\n | 'AS'\n | 'AD'\n | 'AO'\n | 'AI'\n | 'AQ'\n | 'AG'\n | 'AR'\n | 'AM'\n | 'AW'\n | 'AU'\n | 'AT'\n | 'AZ'\n | 'BS'\n | 'BH'\n | 'BD'\n | 'BB'\n | 'BY'\n | 'BE'\n | 'BZ'\n | 'BJ'\n | 'BM'\n | 'BT'\n | 'BO'\n | 'BA'\n | 'BW'\n | 'BV'\n | 'BR'\n | 'VG'\n | 'IO'\n | 'BN'\n | 'BG'\n | 'BF'\n | 'BI'\n | 'KH'\n | 'CM'\n | 'CA'\n | 'CV'\n | 'KY'\n | 'CF'\n | 'TD'\n | 'CL'\n | 'CN'\n | 'HK'\n | 'MO'\n | 'CX'\n | 'CC'\n | 'CO'\n | 'KM'\n | 'CG'\n | 'CD'\n | 'CK'\n | 'CR'\n | 'CI'\n | 'HR'\n | 'CU'\n | 'CY'\n | 'CZ'\n | 'DK'\n | 'DJ'\n | 'DM'\n | 'DO'\n | 'EC'\n | 'EG'\n | 'SV'\n | 'GQ'\n | 'ER'\n | 'EE'\n | 'ET'\n | 'FK'\n | 'FO'\n | 'FJ'\n | 'FI'\n | 'FR'\n | 'GF'\n | 'PF'\n | 'TF'\n | 'GA'\n | 'GM'\n | 'GE'\n | 'DE'\n | 'GH'\n | 'GI'\n | 'GR'\n | 'GL'\n | 'GD'\n | 'GP'\n | 'GU'\n | 'GT'\n | 'GG'\n | 'GN'\n | 'GW'\n | 'GY'\n | 'HT'\n | 'HM'\n | 'VA'\n | 'HN'\n | 'HU'\n | 'IS'\n | 'IN'\n | 'ID'\n | 'IR'\n | 'IQ'\n | 'IE'\n | 'IM'\n | 'IL'\n | 'IT'\n | 'JM'\n | 'JP'\n | 'JE'\n | 'JO'\n | 'KZ'\n | 'KE'\n | 'KI'\n | 'KP'\n | 'KR'\n | 'KW'\n | 'KG'\n | 'LA'\n | 'LV'\n | 'LB'\n | 'LS'\n | 'LR'\n | 'LY'\n | 'LI'\n | 'LT'\n | 'LU'\n | 'MK'\n | 'MG'\n | 'MW'\n | 'MY'\n | 'MV'\n | 'ML'\n | 'MT'\n | 'MH'\n | 'MQ'\n | 'MR'\n | 'MU'\n | 'YT'\n | 'MX'\n | 'FM'\n | 'MD'\n | 'MC'\n | 'MN'\n | 'ME'\n | 'MS'\n | 'MA'\n | 'MZ'\n | 'MM'\n | 'NA'\n | 'NR'\n | 'NP'\n | 'NL'\n | 'AN'\n | 'NC'\n | 'NZ'\n | 'NI'\n | 'NE'\n | 'NG'\n | 'NU'\n | 'NF'\n | 'MP'\n | 'NO'\n | 'OM'\n | 'PK'\n | 'PW'\n | 'PS'\n | 'PA'\n | 'PG'\n | 'PY'\n | 'PE'\n | 'PH'\n | 'PN'\n | 'PL'\n | 'PT'\n | 'PR'\n | 'QA'\n | 'RE'\n | 'RO'\n | 'RU'\n | 'RW'\n | 'BL'\n | 'SH'\n | 'KN'\n | 'LC'\n | 'MF'\n | 'PM'\n | 'VC'\n | 'WS'\n | 'SM'\n | 'ST'\n | 'SA'\n | 'SN'\n | 'RS'\n | 'SC'\n | 'SL'\n | 'SG'\n | 'SK'\n | 'SI'\n | 'SB'\n | 'SO'\n | 'ZA'\n | 'GS'\n | 'SS'\n | 'ES'\n | 'LK'\n | 'SD'\n | 'SR'\n | 'SJ'\n | 'SZ'\n | 'SE'\n | 'CH'\n | 'SY'\n | 'TW'\n | 'TJ'\n | 'TZ'\n | 'TH'\n | 'TL'\n | 'TG'\n | 'TK'\n | 'TO'\n | 'TT'\n | 'TN'\n | 'TR'\n | 'TM'\n | 'TC'\n | 'TV'\n | 'UG'\n | 'UA'\n | 'AE'\n | 'GB'\n | 'US'\n | 'UM'\n | 'UY'\n | 'UZ'\n | 'VU'\n | 'VE'\n | 'VN'\n | 'VI'\n | 'WF'\n | 'EH'\n | 'YE'\n | 'ZM'\n | 'ZW'\n\nexport type ISOAlpha3 =\n | 'AFG'\n | 'ALA'\n | 'ALB'\n | 'DZA'\n | 'ASM'\n | 'AND'\n | 'AGO'\n | 'AIA'\n | 'ATA'\n | 'ATG'\n | 'ARG'\n | 'ARM'\n | 'ABW'\n | 'AUS'\n | 'AUT'\n | 'AZE'\n | 'BHS'\n | 'BHR'\n | 'BGD'\n | 'BRB'\n | 'BLR'\n | 'BEL'\n | 'BLZ'\n | 'BEN'\n | 'BMU'\n | 'BTN'\n | 'BOL'\n | 'BIH'\n | 'BWA'\n | 'BVT'\n | 'BRA'\n | 'VGB'\n | 'IOT'\n | 'BRN'\n | 'BGR'\n | 'BFA'\n | 'BDI'\n | 'KHM'\n | 'CMR'\n | 'CAN'\n | 'CPV'\n | 'CYM'\n | 'CAF'\n | 'TCD'\n | 'CHL'\n | 'CHN'\n | 'HKG'\n | 'MAC'\n | 'CXR'\n | 'CCK'\n | 'COL'\n | 'COM'\n | 'COG'\n | 'COD'\n | 'COK'\n | 'CRI'\n | 'CIV'\n | 'HRV'\n | 'CUB'\n | 'CYP'\n | 'CZE'\n | 'DNK'\n | 'DJI'\n | 'DMA'\n | 'DOM'\n | 'ECU'\n | 'EGY'\n | 'SLV'\n | 'GNQ'\n | 'ERI'\n | 'EST'\n | 'ETH'\n | 'FLK'\n | 'FRO'\n | 'FJI'\n | 'FIN'\n | 'FRA'\n | 'GUF'\n | 'PYF'\n | 'ATF'\n | 'GAB'\n | 'GMB'\n | 'GEO'\n | 'DEU'\n | 'GHA'\n | 'GIB'\n | 'GRC'\n | 'GRL'\n | 'GRD'\n | 'GLP'\n | 'GUM'\n | 'GTM'\n | 'GGY'\n | 'GIN'\n | 'GNB'\n | 'GUY'\n | 'HTI'\n | 'HMD'\n | 'VAT'\n | 'HND'\n | 'HUN'\n | 'ISL'\n | 'IND'\n | 'IDN'\n | 'IRN'\n | 'IRQ'\n | 'IRL'\n | 'IMN'\n | 'ISR'\n | 'ITA'\n | 'JAM'\n | 'JPN'\n | 'JEY'\n | 'JOR'\n | 'KAZ'\n | 'KEN'\n | 'KIR'\n | 'PRK'\n | 'KOR'\n | 'KWT'\n | 'KGZ'\n | 'LAO'\n | 'LVA'\n | 'LBN'\n | 'LSO'\n | 'LBR'\n | 'LBY'\n | 'LIE'\n | 'LTU'\n | 'LUX'\n | 'MKD'\n | 'MDG'\n | 'MWI'\n | 'MYS'\n | 'MDV'\n | 'MLI'\n | 'MLT'\n | 'MHL'\n | 'MTQ'\n | 'MRT'\n | 'MUS'\n | 'MYT'\n | 'MEX'\n | 'FSM'\n | 'MDA'\n | 'MCO'\n | 'MNG'\n | 'MNE'\n | 'MSR'\n | 'MAR'\n | 'MOZ'\n | 'MMR'\n | 'NAM'\n | 'NRU'\n | 'NPL'\n | 'NLD'\n | 'ANT'\n | 'NCL'\n | 'NZL'\n | 'NIC'\n | 'NER'\n | 'NGA'\n | 'NIU'\n | 'NFK'\n | 'MNP'\n | 'NOR'\n | 'OMN'\n | 'PAK'\n | 'PLW'\n | 'PSE'\n | 'PAN'\n | 'PNG'\n | 'PRY'\n | 'PER'\n | 'PHL'\n | 'PCN'\n | 'POL'\n | 'PRT'\n | 'PRI'\n | 'QAT'\n | 'REU'\n | 'ROU'\n | 'RUS'\n | 'RWA'\n | 'BLM'\n | 'SHN'\n | 'KNA'\n | 'LCA'\n | 'MAF'\n | 'SPM'\n | 'VCT'\n | 'WSM'\n | 'SMR'\n | 'STP'\n | 'SAU'\n | 'SEN'\n | 'SRB'\n | 'SYC'\n | 'SLE'\n | 'SGP'\n | 'SVK'\n | 'SVN'\n | 'SLB'\n | 'SOM'\n | 'ZAF'\n | 'SGS'\n | 'SSD'\n | 'ESP'\n | 'LKA'\n | 'SDN'\n | 'SUR'\n | 'SJM'\n | 'SWZ'\n | 'SWE'\n | 'CHE'\n | 'SYR'\n | 'TWN'\n | 'TJK'\n | 'TZA'\n | 'THA'\n | 'TLS'\n | 'TGO'\n | 'TKL'\n | 'TON'\n | 'TTO'\n | 'TUN'\n | 'TUR'\n | 'TKM'\n | 'TCA'\n | 'TUV'\n | 'UGA'\n | 'UKR'\n | 'ARE'\n | 'GBR'\n | 'USA'\n | 'UMI'\n | 'URY'\n | 'UZB'\n | 'VUT'\n | 'VEN'\n | 'VNM'\n | 'VIR'\n | 'WLF'\n | 'ESH'\n | 'YEM'\n | 'ZMB'\n | 'ZWE'\n\n```"
}
] |
code_places-graphql_8b2cfd32
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/countries/rules.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { ISOAlpha3 } from './types'\nimport ARG from './ARG'\nimport BOL from './BOL'\nimport BRA from './BRA'\nimport USA from './USA'\n\nconst rules: { [key in ISOAlpha3]?: Rules } = {\n ARG,\n BOL,\n BRA,\n USA,\n}\n\nexport default rules\n\n```"
}
] |
code_places-graphql_58796a83
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of places-graphql/node/countries/USA.ts from the places-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nconst rules: Rules = {\n geolocation: {\n postalCode: {\n valueIn: 'long_name',\n types: ['postal_code'],\n required: false,\n },\n street: {\n valueIn: 'long_name',\n types: ['route'],\n },\n neighborhood: {\n valueIn: 'long_name',\n types: [\n 'neighborhood',\n 'sublocality_level_1',\n 'sublocality_level_2',\n 'sublocality_level_3',\n 'sublocality_level_4',\n 'sublocality_level_5',\n ],\n },\n state: {\n valueIn: 'short_name',\n types: ['administrative_area_level_1'],\n },\n city: {\n valueIn: 'long_name',\n types: ['locality'],\n },\n },\n}\n\nexport default rules\n\n```"
}
] |
code_encryption-service_b7e3a5e8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/docs/README.md from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n\n\n# Service Example\n\nA reference app implementing a VTEX IO service with HTTP route handlers.\n\n\n\nWe use [**KoaJS**](https://koajs.com/) as the web framework, so you might want to get into that\n\nWe also use the [**node-vtex-api**](https://github.com/vtex/node-vtex-api), a VTEX set of utilities for Node services. You can import this package using NPM from `@vtex/api` (already imported on this project)\n\n- Start from `node/index.ts` and follow the comments and imports :)\n\n## Recipes\n\n### Defining routes on _service.json_ \n```json\n{\n \"memory\": 256,\n \"ttl\": 10,\n \"timeout\": 2,\n \"minReplicas\": 2,\n \"maxReplicas\": 4,\n \"routes\": {\n \"status\": {\n \"path\": \"/_v/status/:code\",\n \"public\": true\n }\n }\n}\n```\n\nThe `service.json` file that sits on the root of the `node` folder holds informations about this service, like the maximum timeout and number of replicas, what might be discontinued on the future, but also **sets its routes**. \n\nKoa uses the [path-to-regexp](https://github.com/pillarjs/path-to-regexp) format for defining routes and, as seen on the example, we use the `:code` notation for declaring a **route param** named code, in this case. A HTTP request for `https://{{workspace}}--{{account}}.myvtex.com/_v/status/500` will match the route we've defined. \n\nFor cach _key_ on the `routes` object, there should be a **corresponding entry** on the exported Service object on `node/index.ts`, this will hook your code to a specific route.\n\n### Access Control\nYou can also provide a `public` option for each route. If `true`, that resource will be reachable for everyone on the internet. If `false`, VTEX credentials will be requested as well.\n\nAnother way of controlling access to specific routes is using **ReBACs (Resource-based access)**, that supports more robust configuration. You can read more [on this document](https://docs.google.com/document/d/1ZxNHMFIXfXz3BgTN9xyrHL3V5dYz14wivYgQjRBZ6J8/edit#heading=h.z7pad3qd2qw7) (VTEX only).\n\n#### Query String\nFor `?accepting=query-string`, you **don't need to declare anything**, as any query provided to the URL will already be available for you to use on the code as `ctx.query`, already parsed as an object, or `ctx.queryString`, taken directly from the URL as a string.\n\n#### Route Params\nRoute Params will be available for you to use on the code as `ctx.vtex.params`, already parsed as an object.\nFor a path like `/_v/status/:code`, if you receive the request `/_v/status/200`, `ctx.vtex.params` will return `{ code: '200' }`\n\n#### HTTP methods\nWhen you define a route on the `service.json`, your NodeJS handlers for that route will be triggered **on every HTTP method** (GET, POST, PUT...), so, if you need to handle them separately you need to implement a \"sub-router\". Fortunately, the _node-vtex-api_ provides a helper function `method`, exported from `@vtex/api`, to accomplish that behaviour. Instead of passing your handlers directly to the corresponding route on `index.ts`, you pass a `method` call passing **an object with the desired method as key and one handler as its corresponding value**. Check this example:\n```typescript\nimport { method } from '@vtex/api'\n...\n\nexport default new Service<Clients, State>({\n clients,\n routes: {\n status: method({\n GET: statusGetHandler,\n POST: statusPostHandler,\n }),\n },\n})\n```\n\n### Throwing errors\n\nWhen building a HTTP service, we should follow HTTP rules regarding data types, cache, authorization, and status code. Our example app sets a `ctx.status` value that will be used as a HTTP status code return value, but often we also want to give proper information about errors as well.\n\nThe **node-vtex-api** already exports a handful of **custom error classes** that can be used for that purpose, like the `NotFoundError`. You just need to throw them inside one of the the route handlers that the appropriate response will be sent to the server.\n\n```typescript\nimport { UserInputError } from '@vtex/api'\n\nexport async function validate(ctx: Context, next: () => Promise<any>) {\n const { code } = ctx.vtex.route.params\n if (isNaN(code) || code < 100 || code > 600) {\n throw new UserInputError('Code must be a number between 100 and 600')\n }\n...\n```\n\nYou can check all the available errors [here](https://github.com/vtex/node-vtex-api/tree/fd6139349de4e68825b1074f1959dd8d0c8f4d5b/src/errors), but some are not useful for just-HTTP services. Check the most useful ones:\n\n|Error Class | HTTP Code |\n|--|:--:|\n| `UserInputError` | 400 |\n| `AuthenticationError` | 401 |\n| `ForbiddenError` | 403 |\n| `NotFoundError` | 404 |\n\nYou can also **create your custom error**, just see how it's done above ;)\n\n### Reading a JSON body\n\nWhen writing POST or PUT handlers, for example, often you need to have access to the **request body** that comes as a JSON format, which is not provided directly by the handler function.\n\nFor this, you have to use the [co-body](https://www.npmjs.com/package/co-body) package that will parse the request into a readable JSON object, used as below: \n```typescript\nimport { json } from 'co-body'\nexport async function method(ctx: Context, next: () => Promise<any>) {\n const body = await json(ctx.req)\n```\n\n### Other example apps\n\nWe use Node services across all VTEX, and there are a lot inspiring examples. If you want to dive deeper on learning about this subject, don't miss those internal apps: [builder-hub](https://github.com/vtex/builder-hub) or [store-sitemap](https://github.com/vtex-apps/store-sitemap)\n\n\n## Testing\n\n`@vtex/test-tools` and `@types/jest` should be installed on `./node` package as `devDependencies`.\n\nRun `vtex test` and [Jest](https://jestjs.io/) will do its thing.\n\nCheck the `node/__tests__/simple.test.ts` test case and also [Jest's Documentation](https://jestjs.io/docs/en/getting-started).\n\n## Splunk Dashboard\n\nWe have an (for now, VTEX-only, internal) Splunk dashboard to show all metrics related to your app. You can find it [here](https://splunk7.vtex.com/en-US/app/vtex_colossus/node_app_metrics).\n\nAfter linking this app and making some requests, you can select `vtex.service-example` and see the metrics for your app. **Don't forget to check the box Development, as you are linking your app in a development workspace**.\n\nFor convenience, the link for the current version: https://splunk7.vtex.com/en-US/app/vtex_colossus/node_app_metrics?form.time.earliest=-30m%40m&form.time.latest=%40m&form.picked_context=false&form.picked_region=aws-us-east-*&form.picked_service=vtex.service-example\n\n\n```"
}
] |
code_encryption-service_751c61e3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/node/service.json from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"memory\": 256,\n \"ttl\": 10,\n \"timeout\": 2,\n \"minReplicas\": 2,\n \"maxReplicas\": 4,\n \"workers\": 1,\n \"routes\": {\n \"encryption\": {\n \"path\": \"/_v/encryption\",\n \"public\": true\n }\n }\n}\n\n```"
}
] |
code_encryption-service_ddfca36d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/node/package.json from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"axios\": \"^0.24.0\",\n \"co-body\": \"^6.0.0\",\n \"crypto-js\": \"^4.1.1\",\n \"ramda\": \"^0.25.0\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^0.0.3\",\n \"@types/jest\": \"^24.0.18\",\n \"@types/node\": \"^12.0.0\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.45.6\",\n \"@vtex/test-tools\": \"^1.0.0\",\n \"@vtex/tsconfig\": \"^0.5.6\",\n \"typescript\": \"3.9.7\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty\"\n },\n \"version\": \"0.2.0\"\n}\n\n```"
}
] |
code_encryption-service_8b93b01c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/node/index.ts from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { ClientsConfig, ServiceContext, RecorderState } from '@vtex/api'\nimport { LRUCache, method, Service } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { encryption } from './middlewares/encryption'\n\nconst TIMEOUT_MS = 800\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, any>({ max: 5000 })\n\nmetrics.trackCache('encryption', memoryCache)\n\n// This is the configuration for clients available in `ctx.clients`.\nconst clients: ClientsConfig<Clients> = {\n // We pass our custom implementation of the clients bag, containing the Status client.\n implementation: Clients,\n options: {\n // All IO Clients will be initialized with these options, unless otherwise specified.\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n },\n // This key will be merged with the default options and add this cache to our Status client.\n encryption: {\n memoryCache,\n },\n },\n}\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, State>\n\n // The shape of our State object found in `ctx.state`. This is used as state bag to communicate between middlewares.\n interface State extends RecorderState {\n plaintext: any,\n key: string\n }\n}\n\n// Export a service that defines route handlers and client options.\nexport default new Service({\n clients,\n routes: {\n // `status` is the route ID from service.json. It maps to an array of middlewares (or a single handler).\n encryption: method({\n GET: [encryption]\n }),\n },\n})\n\n```"
}
] |
code_encryption-service_401c156d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/node/clients/index.ts from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\nimport Encryption from './encryption'\n\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {\n public get encryption() {\n return this.getOrSet('encryption', Encryption)\n }\n}\n\n```"
}
] |
code_encryption-service_f146a6c9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/node/clients/encryption.ts from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\nvar CryptoJS = require('crypto-js')\n\nexport default class Encryption extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super('', context, {\n ...options,\n headers: {\n ...options?.headers,\n 'X-Vtex-Use-Https': 'true'\n },\n })\n }\n\n profitshareBin2hex(s: any){ \n var i, f = 0, a = []; \n s += ''; \n f = s.length; \n \n for (i = 0; i<f; i++) { \n a[i] = s.charCodeAt(i).toString(16).replace(/^([\\da-f])$/,\"0$1\"); \n } \n \n return a.join(''); \n} \n//decode\natob = function(str:any){ return Buffer.from(str, 'base64').toString('binary'); }\n//encode\nbtoa = function(str:any){ return Buffer.from(str, 'binary').toString('base64'); };\n\n public getEncryption(plaintext: any, key: any): string {\n const encodedPlainText = encodeURIComponent(plaintext).toString()\n let iv = CryptoJS.enc.Utf8.parse(Math.round((Math.pow(36, 16 + 1) - Math.random() * Math.pow(36, 16))).toString(36).slice(1));\n\n let subKey = CryptoJS.enc.Utf8.parse(key.substring(0, 16));\n key = CryptoJS.enc.Utf8.parse(key);\n\n let chiperData = CryptoJS.AES.encrypt(encodedPlainText, subKey, {\n iv: iv,\n mode: CryptoJS.mode.CBC,\n });\n\n let hash = CryptoJS.HmacSHA256(chiperData.ciphertext, key);\n let hmac = this.atob(hash.toString(CryptoJS.enc.Base64));\n\n iv = this.atob(iv.toString(CryptoJS.enc.Base64)); \n let chiperRaw = this.atob(chiperData.toString());\n\n let data = this.profitshareBin2hex(this.btoa(iv + hmac + chiperRaw)); \n console.log('Plain text: ', encodedPlainText);\n console.log('Data: ', data)\n \n return data\n }\n\n}\n\n```"
}
] |
code_encryption-service_8197db0f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/node/middleware/validate.ts from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { UserInputError } from '@vtex/api'\n\nexport async function validate(ctx: Context, next: () => Promise<any>) {\n const {\n vtex: {\n route: { params },\n },\n } = ctx\n\n console.info('Received params:', params)\n\n const { plaintext, key } = params\n console.log('Params: ', params)\n if (!plaintext || !key) {\n throw new UserInputError('Plaintext and key are required') // Wrapper for a Bad Request (400) HTTP Error. Check others in https://github.com/vtex/node-vtex-api/blob/fd6139349de4e68825b1074f1959dd8d0c8f4d5b/src/errors/index.ts\n }\n\n ctx.state.plaintext = plaintext\n\n await next()\n}\n\n```"
}
] |
code_encryption-service_7b21b2e7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/node/middleware/encryption.ts from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function encryption(ctx: Context, next: () => Promise<any>) {\n const {\n clients: { encryption}\n } = ctx\n\n try {\n const data = encryption.getEncryption(ctx.request.query.plaintext, ctx.request.query.key) \n console.log('data: ', data);\n ctx.status = 201\n ctx.body = data\n } catch (error) {\n ctx.status = 502;\n console.log(JSON.stringify(error));\n }\n\n await next()\n}\n\n```"
}
] |
code_encryption-service_822dbde5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of encryption-service/node/_tests_/simple.test.ts from the encryption-service VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// You can import your files here for testing them\n//\n// More info: https://github.com/sapegin/jest-cheat-sheet\n\ndescribe('simpleTest', () => {\n it('one test case', async () => {\n expect(0.2 + 0.1).not.toBe(0.3)\n })\n})\n\n```"
}
] |
code_pixel-app-template_ebc5da8e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/docs/README.md from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/CHANGEME) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# APP NAME\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nUnder the app's name, you should explain the topic, giving a **brief description** of the **app's functionality** (what is it for?) in a store.\n\nNext, you can **add media** (either an image of a GIF) if possible, so that users can better understand how the app works in practice. \n\n\n\n## Configuration\n\nIt is possible to install in your store either by using App Store or the VTEX IO Toolbelt.\n\n### Using VTEX App Store\n\n1. Access the **Apps** section in your account's admin page and look for the Icommkt box;\n2. Then, click on the **Install** button;\n3. You'll see a warning message about needing to enter the necessary configurations. Scroll down and type in your **NAME OF A SETTINGS FIELD** in the `NAME OF THE APP` field.\n4. Click on **Save**.\n\n### Using VTEX IO Toolbelt\n\n1. [Install](https://vtex.io/docs/recipes/development/installing-an-app/) the `vtex.icommkt@0.x` app. You can confirm that the app has now been installed by running `vtex ls` again. \n2. Access the **Apps** section in your account's admin page and look for the NAME OF THE APP box. Once you find it, click on the box.\n3. Fill in the `NAME OF THE APP` field with your **NAME OF THE SETTINGS FIELD**.\n4. Click on **Save**.\n\n<!-- Remember to also **showcase any necessary disclaimer** related to the app in this section, such as the different behavior it may display during its configuration. -->\n\n## Modus Operandi *(not mandatory)*\n\nThere are scenarios in which an app can behave differently in a store, according to its configuration. It's crucial then to go through these **behavioral changes** in this section, allowing users to fully understand the **practical application** of the app in their store.\n\nIf you feel compelled to give further details, such as the app's **relationship with others**, don't hesitate to use this section. \n\n<!-- DOCS-IGNORE:start -->\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n<!-- DOCS-IGNORE:end -->\n\n```"
}
] |
code_pixel-app-template_189b282a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/react/index.tsx from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { canUseDOM } from 'vtex.render-runtime'\n\nimport type { PixelMessage } from './typings/events'\n\nexport function handleEvents(e: PixelMessage) {\n switch (e.data.eventName) {\n case 'vtex:pageView': {\n break\n }\n\n default: {\n break\n }\n }\n}\n\nif (canUseDOM) {\n window.addEventListener('message', handleEvents)\n}\n\n```"
}
] |
code_pixel-app-template_dbbf3aab
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/react/package.json from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@types/graphql\": \"^14.5.0\",\n \"@types/jest\": \"^25.1.5\",\n \"@types/node\": \"^13.11.0\",\n \"@types/react\": \"^16.9.31\",\n \"@types/react-intl\": \"^3.0.0\",\n \"@vtex/test-tools\": \"^3.1.0\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"apollo-client\": \"^2.6.8\",\n \"graphql\": \"^14.5.4\",\n \"react-intl\": \"^3.11.0\",\n \"typescript\": \"3.8.3\",\n \"vtex.pixel-interfaces\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.pixel-interfaces@1.1.1/public/_types/react\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.124.3/public/@types/vtex.render-runtime\"\n }\n}\n```"
}
] |
code_pixel-app-template_130cd3fb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/store/interfaces.json from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"pixel.APPNAME\": {\n \"component\": \"index\"\n }\n}\n```"
}
] |
code_pixel-app-template_be6a8c20
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/public/metadata/messages/es-AR.json from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"\",\n \"headline\": \"\",\n \"overview\": \"\",\n \"features\": [],\n \"additionalInformation\": \"\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_pixel-app-template_ec211a2c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/public/metadata/messages/pt-BR.json from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"\",\n \"headline\": \"\",\n \"overview\": \"\",\n \"features\": [],\n \"additionalInformation\": \"\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_pixel-app-template_aec7fe62
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/public/metadata/messages/en-US.json from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"\",\n \"headline\": \"\",\n \"overview\": \"\",\n \"features\": [],\n \"additionalInformation\": \"\",\n \"websiteURL\": \"https://vtex.com/\",\n \"support\": {\n \"url\": \"https://support.vtex.com/hc/requests\"\n }\n}\n\n```"
}
] |
code_pixel-app-template_fe2c35eb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/react/typings/events.d.ts from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport interface PixelMessage extends MessageEvent {\n data:\n | ProductViewData\n | ProductClickData\n | OrderPlacedData\n | OrderPlacedTrackedData\n | PageViewData\n | ProductImpressionData\n | AddToCartData\n | RemoveToCartData\n | CartChangedData\n | HomePageInfo\n | ProductPageInfoData\n | SearchPageInfoData\n | UserData\n | CartIdData\n | PromoViewData\n | PromotionClickData\n | NewsletterSubscriptionData\n}\n\nexport interface EventData {\n event: string\n eventName: string\n currency: string\n}\n\nexport interface PageInfoData extends EventData {\n event: 'pageInfo'\n eventName: 'vtex:pageInfo'\n accountName: string\n pageTitle: string\n pageUrl: string\n}\n\nexport interface UserData extends PageInfoData {\n eventType: 'userData'\n eventName: 'vtex:userData'\n firstName?: string\n lastName?: string\n document?: string\n id?: string\n email?: string\n phone?: string\n isAuthenticated: boolean\n}\n\nexport interface CartIdData extends PageInfoData {\n eventType: 'cartId'\n eventName: 'vtex:cartId'\n cartId: string\n}\n\nexport interface HomePageInfo extends PageInfoData {\n eventType: 'homeView'\n}\n\nexport interface ProductPageInfoData extends PageInfoData {\n eventType: 'productPageInfo'\n}\n\nexport interface SearchPageInfoData extends PageInfoData {\n eventType:\n | 'internalSiteSearchView'\n | 'categoryView'\n | 'departmentView'\n | 'emptySearchView'\n category?: CategoryMetaData\n department?: DepartmentMetaData\n search?: SearchMetaData\n}\n\ninterface CategoryMetaData {\n id: string\n name: string\n}\n\ninterface DepartmentMetaData {\n id: string\n name: string\n}\n\ninterface SearchMetaData {\n term: string\n category: CategoryMetaData\n results: number\n}\n\nexport interface PageViewData extends EventData {\n event: 'pageView'\n eventName: 'vtex:pageView'\n pageTitle: string\n pageUrl: string\n referrer: string\n}\n\nexport interface AddToCartData extends EventData {\n event: 'addToCart'\n eventName: 'vtex:addToCart'\n items: CartItem[]\n}\n\nexport interface RemoveToCartData extends EventData {\n event: 'removeFromCart'\n eventName: 'vtex:removeFromCart'\n items: CartItem[]\n}\n\nexport interface CartChangedData extends EventData {\n event: 'cartChanged'\n eventName: 'vtex:cartChanged'\n items: CartItem[]\n}\n\nexport interface OrderPlacedData extends Order, EventData {\n event: 'orderPlaced'\n eventName: 'vtex:orderPlaced'\n}\n\nexport interface OrderPlacedTrackedData extends Order, EventData {\n event: 'orderPlacedTracked'\n eventName: 'vtex:orderPlacedTracked'\n}\n\nexport interface ProductViewData extends EventData {\n event: 'productView'\n eventName: 'vtex:productView'\n product: Product\n}\n\nexport interface ProductClickData extends EventData {\n event: 'productClick'\n eventName: 'vtex:productClick'\n product: ProductSummary\n list?: string\n}\n\nexport interface ProductImpressionData extends EventData {\n event: 'productImpression'\n eventName: 'vtex:productImpression'\n impressions: Impression[]\n product?: ProductSummary // deprecated, use impressions list!\n position?: number // deprecated, use impressions list!\n list: string\n}\n\nexport interface CartData extends EventData {\n event: 'cart'\n eventName: 'vtex:cart'\n orderForm: OrderForm\n}\n\nexport interface PromoViewData extends EventData {\n event: 'promoView'\n eventName: 'vtex:promoView'\n promotions: Promotion[]\n}\n\nexport interface PromotionClickData extends EventData {\n event: 'promotionClick'\n eventName: 'vtex:promotionClick'\n promotions: Promotion[]\n}\n\nexport interface NewsletterSubscriptionData extends EventData {\n event: 'newsletterSubscription'\n eventName: 'vtex:newsletterSubscription'\n name: string\n email: string\n phone: string\n}\n\ninterface Promotion {\n id?: string\n name?: string\n creative?: string\n position?: string\n}\n\ninterface CartItem {\n brand: string\n ean: string\n category: string\n detailUrl: string\n imageUrl: string\n name: string\n price: number\n productId: string\n productRefId: string\n quantity: number\n seller: string\n sellerName: string\n skuId: string\n variant: string\n}\n\nexport interface OrderForm {\n id: string\n items: CartItem[]\n}\n\nexport interface Order {\n accountName: string\n corporateName: string\n coupon: string\n currency: string\n openTextField: string\n orderGroup: string\n salesChannel: string\n visitorAddressCity: string\n visitorAddressComplement: string\n visitorAddressCountry: string\n visitorAddressNeighborhood: string\n visitorAddressNumber: string\n visitorAddressPostalCode: string\n visitorAddressState: string\n visitorAddressStreet: string\n visitorContactInfo: string[]\n visitorContactPhone: string\n visitorType: string\n transactionId: string\n transactionDate: string\n transactionAffiliation: string\n transactionTotal: number\n transactionShipping: number\n transactionSubtotal: number\n transactionDiscounts: number\n transactionTax: number\n transactionCurrency: string\n transactionPaymentType: PaymentType[]\n transactionShippingMethod: ShippingMethod[]\n transactionLatestShippingEstimate: Date\n transactionProducts: ProductOrder[]\n transactionPayment: {\n id: string\n }\n}\n\nexport interface Impression {\n product: ProductSummary\n position: number\n}\n\nexport interface PaymentType {\n group: string\n paymentSystemName: string\n installments: number\n value: number\n}\n\nexport interface ShippingMethod {\n itemId: string\n selectedSla: string\n}\n\nexport interface ProductOrder {\n id: string\n name: string\n sku: string\n skuRefId: string\n skuName: string\n productRefId: string\n ean: string\n slug: string\n brand: string\n brandId: string\n seller: string\n sellerId: string\n category: string\n categoryId: string\n categoryTree: string[]\n categoryIdTree: string[]\n priceTags: PriceTag[]\n originalPrice: number\n price: number\n sellingPrice: number\n tax: number\n quantity: number\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n components: any[]\n measurementUnit: string\n unitMultiplier: number\n}\n\nexport interface PriceTag {\n identifier: string\n isPercentual: boolean\n value: number\n}\n\nexport interface Product {\n brand: string\n brandId: string\n categories: string[]\n categoryId: string\n categoryTree: Array<{ id: string; name: string }>\n detailUrl: string\n items: Item[]\n linkText: string\n productId: string\n productName: string\n productReference: string\n selectedSku: Item\n}\n\nexport interface Item {\n itemId: string\n name: string\n ean: string\n referenceId: { Key: string; Value: string }\n imageUrl: string\n sellers: Seller[]\n}\n\nexport interface ProductSummary {\n brand: string\n brandId: string\n categories: string[]\n items: ItemSummary[]\n linkText: string\n productId: string\n productName: string\n productReference: string\n sku: ItemSummary\n}\n\ninterface ItemSummary {\n itemId: string\n ean: string\n name: string\n referenceId: { Key: string; Value: string }\n seller: Seller\n sellers: Seller[]\n}\n\nexport interface Seller {\n commertialOffer: CommertialOffer\n sellerId: string\n sellerName: string\n}\n\nexport interface CommertialOffer {\n Price: number\n ListPrice: number\n AvailableQuantity: number\n}\n\n```"
}
] |
code_pixel-app-template_b953846d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of pixel-app-template/react/typings/global.d.ts from the pixel-app-template VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ninterface Window extends Window {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n dataLayer: any[]\n}\n\n```"
}
] |
code_hardsport-theme_392cdb63
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/docs/README.md from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Hardsport Theme\nA simple example store implemented in Store Framework\n\n## Preview\n\n\n```"
}
] |
code_hardsport-theme_b5653164
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/styles/css/vtex.store-header.css from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.headerRow--logo-bar .headerRowContainer {\n min-height: 120px;\n}\n\n.headerRow--logo-bar :global(.vtex-button):hover,\n.headerRow--logo-bar :global(.vtex-button):focus,\n.headerRow--logo-bar :global(.vtex-button):active {\n background: #273b58;\n}\n\n.headerRowBackground--promo-bar {\n background-color: #FFF;\n}\n\n```"
}
] |
code_hardsport-theme_d6164d05
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/styles/css/vtex.store-components.css from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.infoCardContainer--full-banner,\n.infoCardContainer--full-banner-centered {\n height: 370px;\n background-position: bottom;\n margin: 0 auto;\n max-width: 1920px;\n border: none;\n}\n\n.infoCardContainer--full-banner .infoCardHeadline,\n.infoCardContainer--full-banner-centered .infoCardHeadline {\n color: #FFF;\n font-size: 70px;\n line-height: 70px;\n}\n\n.infoCardContainer--display {\n height: 100%;\n min-height: 295px;\n}\n\n.infoCardContainer--display .infoCardHeadline {\n color: #FFF;\n font-size: 50px;\n line-height: 50px;\n}\n\n.infoCardContainer--display .infoCardTextContainer {\n width: 70%;\n}\n\n.infoCardContainer--full-banner-centered .infoCardTextContainer {\n width: 100%;\n}\n\n.infoCardContainer--full-banner-centered .infoCardHeadline {\n width: 100%;\n text-align: center;\n}\n\n.infoCardContainer--categories {\n min-height: 180px;\n}\n\n.infoCardContainer--categories .infoCardHeadline {\n color: #FFF;\n font-weight: 400;\n letter-spacing: .3em;\n text-transform: uppercase;\n}\n\n.infoCardContainer--display .infoCardCallActionContainer,\n.infoCardContainer--categories .infoCardCallActionContainer,\n.infoCardContainer--full-banner .infoCardCallActionContainer,\n.infoCardContainer--full-banner-centered .infoCardCallActionContainer,\n.infoCardContainer--display .infoCardHeadline,\n.infoCardContainer--categories .infoCardHeadline,\n.infoCardContainer--full-banner .infoCardHeadline,\n.infoCardContainer--full-banner-centered .infoCardHeadline {\n z-index: 1;\n}\n\n.infoCardContainer--categories .infoCardTextContainer {\n width: 70%;\n}\n\n.infoCardContainer--display::after,\n.infoCardContainer--categories::after,\n.infoCardContainer--full-banner::after,\n.infoCardContainer--full-banner-centered::after {\n content: \"\";\n width: 100%;\n height: 100%;\n max-width: 1920px;\n margin: 0 auto;\n display: inline-block;\n position: absolute;\n z-index: 0;\n left: 0px;\n top: 0px;\n right: 0px;\n bottom: 0px;\n /* http://colorzilla.com/gradient-editor/#000000+0,000000+100&0+50,0.5+100 */\n background: -moz-radial-gradient(center, ellipse cover, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.5) 100%); /* FF3.6-15 */\n background: -webkit-radial-gradient(center, ellipse cover, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 50%,rgba(0,0,0,0.5) 100%); /* Chrome10-25,Safari5.1-6 */\n background: radial-gradient(ellipse at center, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 50%,rgba(0,0,0,0.5) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#80000000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */\n opacity: 0;\n transition: opacity 0.3s ease;\n}\n\n.infoCardContainer--display:hover::after,\n.infoCardContainer--categories:hover::after,\n.infoCardContainer--full-banner:hover::after,\n.infoCardContainer--full-banner-centered:hover::after {\n opacity: 1;\n}\n\n\n.notificationBarContainer {\n background-color: #FFF;\n}\n\n.notificationBarInner {\n min-height: 2.3em;\n font-size: .875rem;\n}\n\n.logoContainer.sizeDesktop {\n min-width: 200px;\n}\n\n.searchBarContainer {\n width: auto;\n}\n\n.notificationBarContainer {\n background-color: #FFF;\n}\n\n.notificationBarContainer .notificationContent {\n color: #222435;\n}\n\n.newsletter {\n background: inherit;\n}\n\n.newsletter .confirmationTitle,\n.newsletter .confirmationText {\n text-align: inherit;\n}\n\n.newsletter .container {\n padding: 0;\n}\n\n.inputGroup {\n border: none;\n}\n\n.newsletter .label {\n font-size: inherit;\n font-weight: inherit;\n}\n\n.newsletter .form {\n text-align: left;\n}\n\n.discountInsideContainer {\n z-index: 20;\n}\n\n```"
}
] |
code_hardsport-theme_02c2f08b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/styles/css/vtex.store-footer.css from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.row--vertical-menu .rowContainer {\n flex-direction: column;\n align-items: baseline;\n}\n\n.row--vertical-menu :global(.vtex-menu-2-x-styledLinkContainer) {\n margin: 0;\n}\n\n.row--menu {\n padding: 3em 0 4em;\n}\n\n.row--menu .rowContainer {\n align-items: baseline;\n}\n\n```"
}
] |
code_hardsport-theme_8530db61
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/styles/css/vtex.flex-layout.css from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.flexCol--infocard, .flexRow--infocard {\n position: relative;\n}\n\n.flexCol--brand {\n justify-content: center;\n}\n\n.flexRow--brand-bar {\n background: #FFF;\n text-align: center;\n padding: .75em 0;\n}\n\n```"
}
] |
code_hardsport-theme_dde7715f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/styles/css/vtex.shelf.css from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.container .title {\n color: inherit;\n font-weight: inherit;\n}\n\n```"
}
] |
code_hardsport-theme_bc74cbd1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/styles/configs/style.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"typeScale\": [\n 3,\n 2.25,\n 1.5,\n 1.25,\n 1,\n 0.875,\n 0.75\n ],\n \"spacing\": [\n 0.125,\n 0.25,\n 0.5,\n 0.75,\n 1,\n 1.5,\n 2,\n 3,\n 4,\n 8,\n 16\n ],\n \"customMedia\": [\n {\n \"s\": 20\n },\n {\n \"ns\": {\n \"value\": 40,\n \"minWidth\": true\n }\n },\n {\n \"m\": {\n \"value\": 40,\n \"minWidth\": true\n }\n },\n {\n \"l\": {\n \"value\": 64,\n \"minWidth\": true\n }\n },\n {\n \"xl\": {\n \"value\": 80,\n \"minWidth\": true\n }\n }\n ],\n \"colors\": {\n \"black-90\": \"rgba(0,0,0,.9)\",\n \"black-80\": \"rgba(0,0,0,.8)\",\n \"black-70\": \"rgba(0,0,0,.7)\",\n \"black-60\": \"rgba(0,0,0,.6)\",\n \"black-50\": \"rgba(0,0,0,.5)\",\n \"black-40\": \"rgba(0,0,0,.4)\",\n \"black-30\": \"rgba(0,0,0,.3)\",\n \"black-20\": \"rgba(0,0,0,.2)\",\n \"black-10\": \"rgba(0,0,0,.1)\",\n \"black-05\": \"rgba(0,0,0,.05)\",\n \"black-025\": \"rgba(0,0,0,.025)\",\n \"black-0125\": \"rgba(0,0,0,.0125)\",\n \"white-90\": \"rgba(255,255,255,.9)\",\n \"white-80\": \"rgba(255,255,255,.8)\",\n \"white-70\": \"rgba(255,255,255,.7)\",\n \"white-60\": \"rgba(255,255,255,.6)\",\n \"white-50\": \"rgba(255,255,255,.5)\",\n \"white-40\": \"rgba(255,255,255,.4)\",\n \"white-30\": \"rgba(255,255,255,.3)\",\n \"white-20\": \"rgba(255,255,255,.2)\",\n \"white-10\": \"rgba(255,255,255,.1)\",\n \"white-05\": \"rgba(255,255,255,.05)\",\n \"white-025\": \"rgba(255,255,255,.025)\",\n \"white-0125\": \"rgba(255,255,255,.0125)\"\n },\n \"semanticColors\": {\n \"background\": {\n \"base\": \"#F7F9FA\",\n \"base--inverted\": \"#142032\",\n \"action-primary\": \"#FA7C60\",\n \"action-secondary\": \"#eef3f7\",\n \"emphasis\": \"#f71963\",\n \"disabled\": \"#f2f4f5\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"hover-background\": {\n \"action-primary\": \"#de6145\",\n \"action-secondary\": \"#dbe9fd\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#e13232\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"active-background\": {\n \"action-primary\": \"#0c389f\",\n \"action-secondary\": \"#dbe9fd\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"text\": {\n \"action-primary\": \"#FA7C60\",\n \"action-secondary\": \"#eef3f7\",\n \"link\": \"#FA7C60\",\n \"emphasis\": \"#f71963\",\n \"disabled\": \"#979899\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"visited-text\": {\n \"link\": \"#0c389f\"\n },\n \"hover-text\": {\n \"action-primary\": \"#de6145\",\n \"action-secondary\": \"#dbe9fd\",\n \"link\": \"#0c389f\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#e13232\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\"\n },\n \"active-text\": {\n \"link\": \"#0c389f\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\"\n },\n \"border\": {\n \"action-primary\": \"#FA7C60\",\n \"action-secondary\": \"#eef3f7\",\n \"emphasis\": \"#f71963\",\n \"disabled\": \"#e3e4e6\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"hover-border\": {\n \"action-primary\": \"#de6145\",\n \"action-secondary\": \"#dbe9fd\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#e13232\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"active-border\": {\n \"action-primary\": \"#0c389f\",\n \"action-secondary\": \"#dbe9fd\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"on\": {\n \"base\": \"#3f3f40\",\n \"base--inverted\": \"#ffffff\",\n \"action-primary\": \"#ffffff\",\n \"action-secondary\": \"#FA7C60\",\n \"emphasis\": \"#ffffff\",\n \"disabled\": \"#979899\",\n \"success\": \"#ffffff\",\n \"success--faded\": \"#3f3f40\",\n \"danger\": \"#ffffff\",\n \"danger--faded\": \"#3f3f40\",\n \"warning\": \"#ffffff\",\n \"warning--faded\": \"#1a1a1a\",\n \"muted-1\": \"#ffffff\",\n \"muted-2\": \"#ffffff\",\n \"muted-3\": \"#3f3f40\",\n \"muted-4\": \"#3f3f40\",\n \"muted-5\": \"#3f3f40\"\n },\n \"hover-on\": {\n \"action-primary\": \"#ffffff\",\n \"action-secondary\": \"#FA7C60\",\n \"emphasis\": \"#ffffff\",\n \"success\": \"#ffffff\",\n \"success--faded\": \"#3f3f40\",\n \"danger\": \"#ffffff\",\n \"danger--faded\": \"#3f3f40\",\n \"warning\": \"#ffffff\",\n \"warning--faded\": \"#1a1a1a\"\n },\n \"active-on\": {\n \"action-primary\": \"#ffffff\",\n \"action-secondary\": \"#FA7C60\",\n \"emphasis\": \"#ffffff\",\n \"success\": \"#ffffff\",\n \"success--faded\": \"#3f3f40\",\n \"danger\": \"#ffffff\",\n \"danger--faded\": \"#3f3f40\",\n \"warning\": \"#ffffff\",\n \"warning--faded\": \"#1a1a1a\"\n }\n },\n \"borderWidths\": [\n 0,\n 0.125,\n 0.25,\n 0.5,\n 1,\n 2\n ],\n \"borderRadius\": [\n 0,\n 0.125,\n 0.25,\n 0.5,\n 1\n ],\n \"widths\": [\n 1,\n 2,\n 4,\n 8,\n 16\n ],\n \"maxWidths\": [\n 1,\n 2,\n 4,\n 8,\n 16,\n 32,\n 48,\n 64,\n 96\n ],\n \"heights\": [\n 1,\n 2,\n 4,\n 8,\n 16\n ],\n \"sizes\": [\n {\n \"name\": \"small\",\n \"value\": 2\n },\n {\n \"name\": \"regular\",\n \"value\": 2.5\n },\n {\n \"name\": \"large\",\n \"value\": 3\n }\n ],\n \"typography\": {\n \"measure\": [\n 30,\n 34,\n 20\n ],\n \"styles\": {\n \"heading-1\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"700\",\n \"fontSize\": \"3rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-2\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"700\",\n \"fontSize\": \"2.25rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-3\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"700\",\n \"fontSize\": \"1.75rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-4\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1.5rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-5\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1.25rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-6\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1.25rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"body\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"small\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"0.875rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"mini\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"0.75rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"action\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"500\",\n \"fontSize\": \"1rem\",\n \"textTransform\": \"uppercase\",\n \"letterSpacing\": \"0\"\n },\n \"action--small\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"500\",\n \"fontSize\": \"0.875rem\",\n \"textTransform\": \"uppercase\",\n \"letterSpacing\": \"0\"\n },\n \"action--large\": {\n \"fontFamily\": \"Fabriga, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"500\",\n \"fontSize\": \"1.25rem\",\n \"textTransform\": \"uppercase\",\n \"letterSpacing\": \"0\"\n },\n \"code\": {\n \"fontFamily\": \"Consolas, monaco, monospace\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n }\n }\n },\n \"opacity\": [\n 1,\n 0.9,\n 0.8,\n 0.7,\n 0.6,\n 0.5,\n 0.4,\n 0.3,\n 0.2,\n 0.1,\n 0.05,\n 0.025,\n 0\n ]\n}\n\n```"
}
] |
code_hardsport-theme_acc0974f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/home.carousel.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"carousel#home\": {\n \"props\": {\n \"autoplay\": false,\n \"banners\": [\n {\n \"image\": \"https://partnerchallenge29.vteximg.com.br/arquivos/preparate-invierno-81671.png\",\n \"page\": \"/\"\n },\n {\n \"image\": \"https://partnerchallenge29.vteximg.com.br/arquivos/best-shoes-81812.png\",\n \"page\": \"/\"\n }\n ],\n \"height\": 370,\n \"showArrows\": true,\n \"showDots\": false\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_27431d36
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/header.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"header.full\": {\n \"blocks\": [\n \"header-layout.desktop\"\n ]\n },\n \"header-layout.desktop\": {\n \"children\": [\n \"header-row#promo-bar\",\n \"header-row#logo-bar\",\n \"header-row#menu\"\n ]\n }\n}\n\n```"
}
] |
code_hardsport-theme_426c573a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/home.bottom-banner.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#bottom-banner\": {\n \"title\": \"Bottom\",\n \"props\": {\n \"blockClass\": \"infocard\",\n \"fullWidth\": true\n },\n \"children\": [\n \"info-card#bottom-banner\"\n ]\n },\n \"info-card#bottom-banner\": {\n \"title\": \"Banner\",\n \"props\": {\n \"blockClass\": \"full-banner-centered\",\n \"isFullModeStyle\": true,\n \"textPosition\": \"left\",\n \"imageUrl\": \"https://partnerchallenge29.vteximg.com.br/arquivos/mountain-182181.png\",\n \"mobileImageUrl\": \"https://partnerchallenge29.vteximg.com.br/arquivos/mountain-182181.png\",\n \"headline\": \"Cada deporte. Cada temporada.\",\n \"subhead\": \"\",\n \"callToActionMode\": \"none\",\n \"imageActionUrl\": \"#\",\n \"textAlignment\": \"left\"\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_6d8d4d34
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/footer.menu.col-4.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"footer-row#menu-col-4\": {\n \"title\": \"Ofertas Semanales\",\n \"props\": {\n \"inverted\": true,\n \"blockClass\": \"vertical-menu\"\n },\n \"children\": [\n \"rich-text#footer-weekly-deals\",\n \"newsletter#footer\"\n ]\n },\n \"rich-text#footer-weekly-deals\": {\n \"props\": {\n \"textAlignment\": \"LEFT\",\n \"textPosition\": \"LEFT\",\n \"text\": \"Ofertas Semanales\",\n \"textColor\": \"c-action-primary\",\n \"font\": \"t-heading-5\"\n }\n },\n \"newsletter#footer\": {\n \"props\": {\n \"label\": \"¿Quieres ofertas exclusivas y acceso a productos? Regístrate para recibir alertas.\",\n \"placeholder\": \"Tu dirección de correo eletrónico\",\n \"submit\": \"OK\"\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_c34967d3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/home.categories.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#categories\": {\n \"title\": \"Banners de categorías\",\n \"props\": {\n \"colGap\": 8,\n \"marginBottom\": 8\n },\n \"children\": [\n \"flex-layout.col#categories1\",\n \"flex-layout.col#categories2\",\n \"flex-layout.col#categories3\"\n ]\n },\n \"rich-text#categories-title\": {\n \"title\": \"Título de categorías\",\n \"props\": {\n \"blockClass\": \"slim-title\",\n \"textAlignment\": \"CENTER\",\n \"textPosition\": \"CENTER\",\n \"text\": \"Top Categorías\",\n \"textColor\": \"c-on-base\",\n \"font\": \"t-heading-2\"\n }\n },\n \"flex-layout.col#categories1\": {\n \"props\": {\n \"blockClass\": \"infocard\"\n },\n \"children\": [\n \"info-card#categories1\"\n ]\n },\n \"flex-layout.col#categories2\": {\n \"props\": {\n \"blockClass\": \"infocard\"\n },\n \"children\": [\n \"info-card#categories2\"\n ]\n },\n \"flex-layout.col#categories3\": {\n \"props\": {\n \"blockClass\": \"infocard\"\n },\n \"children\": [\n \"info-card#categories3\"\n ]\n },\n \"info-card#categories1\": {\n \"title\": \"banner 1\",\n \"props\": {\n \"blockClass\": \"categories\",\n \"isFullModeStyle\": true,\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://partnerchallenge29.vteximg.com.br/arquivos/bike-infocard-1891b3d.png\",\n \"headline\": \"Bikes\",\n \"subhead\": \"\",\n \"callToActionMode\": \"none\",\n \"imageActionUrl\": \"#\",\n \"textAlignment\": \"center\"\n }\n },\n \"info-card#categories2\": {\n \"title\": \"banner 2\",\n \"props\": {\n \"blockClass\": \"categories\",\n \"isFullModeStyle\": true,\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://partnerchallenge29.vteximg.com.br/arquivos/sky-infocard-08138n1.png\",\n \"headline\": \"Camping\",\n \"subhead\": \"\",\n \"callToActionMode\": \"none\",\n \"imageActionUrl\": \"#\",\n \"textAlignment\": \"center\"\n }\n },\n \"info-card#categories3\": {\n \"title\": \"banner 3\",\n \"props\": {\n \"blockClass\": \"categories\",\n \"isFullModeStyle\": true,\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://partnerchallenge29.vteximg.com.br/arquivos/stepping-up-infocard-1823918.png\",\n \"headline\": \"Calzado\",\n \"subhead\": \"\",\n \"callToActionMode\": \"none\",\n \"imageActionUrl\": \"#\",\n \"textAlignment\": \"center\"\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_fcda9f09
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/footer.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"footer\": {\n \"blocks\": [\n \"footer-layout.desktop\"\n ]\n },\n \"footer-layout.desktop\": {\n \"children\": [\n \"footer-row#menu\",\n \"footer-row#copyright\"\n ]\n }\n}\n\n```"
}
] |
code_hardsport-theme_2ecdb6b1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/footer.menu.col-3.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"footer-row#menu-col-3\": {\n \"title\": \"Redes sociales\",\n \"props\": {\n \"inverted\": true,\n \"blockClass\": \"vertical-menu\"\n },\n \"children\": [\n \"rich-text#footer-get-connected\",\n \"menu#footer-get-connected\"\n ]\n },\n \"rich-text#footer-get-connected\": {\n \"props\": {\n \"textAlignment\": \"LEFT\",\n \"textPosition\": \"LEFT\",\n \"text\": \"Redes sociales\",\n \"textColor\": \"c-action-primary\",\n \"font\": \"t-heading-5\"\n }\n },\n \"menu#footer-get-connected\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#footer-col-3-menu1\",\n \"menu-item#footer-col-3-menu2\",\n \"menu-item#footer-col-3-menu3\"\n ]\n },\n \"menu-item#footer-col-3-menu1\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Facebook\"\n }\n }\n },\n \"menu-item#footer-col-3-menu2\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Twitter\"\n }\n }\n },\n \"menu-item#footer-col-3-menu3\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Instagram\"\n }\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_7d6d8c8c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/footer.copyright.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"footer-row#copyright\": {\n \"title\": \"Derechos\",\n \"props\": {\n \"inverted\": true,\n \"fullWidth\": false\n },\n \"children\": [\n \"rich-text#footer-copyright\",\n \"footer-spacer\",\n \"powered-by\"\n ]\n },\n \"rich-text#footer-copyright\": {\n \"props\": {\n \"textAlignment\": \"LEFT\",\n \"textPosition\": \"LEFT\",\n \"text\": \"©2019 HardSport Artículos Deportivos. Todos los derechos reservados.\",\n \"textColor\": \"c-on-base--inverted\",\n \"font\": \"t-mini\"\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_157e006d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/header.menu.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"header-row#menu\": {\n \"props\": {\n \"inverted\": true\n },\n \"children\": [\n \"header-spacer\",\n \"vtex.menu@2.x:menu#header\",\n \"header-spacer\"\n ]\n },\n \"vtex.menu@2.x:menu#header\": {\n \"children\": [\n \"menu-item#header-menu1\",\n \"menu-item#header-menu2\",\n \"menu-item#header-menu3\",\n \"menu-item#header-menu4\",\n \"menu-item#header-menu5\",\n \"menu-item#header-menu6\"\n ]\n },\n \"menu-item#header-menu1\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"HOMBRE\"\n }\n }\n },\n \"menu-item#header-menu2\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"MUJER\"\n }\n }\n },\n \"menu-item#header-menu3\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"NIÑOS\"\n }\n }\n },\n \"menu-item#header-menu4\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"EQUIPAMENTO\"\n }\n }\n },\n \"menu-item#header-menu5\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"ACCESORIOS\"\n }\n }\n },\n \"menu-item#header-menu6\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"SALE\"\n }\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_ea8a1a5e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/home.display.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#display\": {\n \"title\": \"Destacados\",\n \"props\": {\n \"marginTop\": 8,\n \"marginBottom\": 6,\n \"colGap\": 8,\n \"rowGap\": 8,\n \"fullWidth\": false\n },\n \"children\": [\n \"flex-layout.col#display1\",\n \"flex-layout.col#display2\",\n \"flex-layout.col#display3\"\n ]\n },\n \"flex-layout.col#display1\": {\n \"props\": {\n \"blockClass\": \"infocard\"\n },\n \"children\": [\n \"info-card#display1\"\n ]\n },\n \"flex-layout.col#display2\": {\n \"props\": {\n \"blockClass\": \"infocard\"\n },\n \"children\": [\n \"info-card#display2\"\n ]\n },\n \"flex-layout.col#display3\": {\n \"props\": {\n \"blockClass\": \"infocard\"\n },\n \"children\": [\n \"info-card#display3\"\n ]\n },\n \"info-card#display1\": {\n \"title\": \"Destado 1\",\n \"props\": {\n \"blockClass\": \"display\",\n \"isFullModeStyle\": true,\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://partnerchallenge29.vteximg.com.br/arquivos/stepping-up-infocard-1823918.png\",\n \"headline\": \"Nueva temporada.\",\n \"subhead\": \"\",\n \"callToActionText\": \"Shop Now\",\n \"callToActionUrl\": \"#\",\n \"imageActionUrl\": \"#\",\n \"textAlignment\": \"center\"\n }\n },\n \"info-card#display2\": {\n \"title\": \"Destado 2\",\n \"props\": {\n \"blockClass\": \"display\",\n \"isFullModeStyle\": true,\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://partnerchallenge29.vteximg.com.br/arquivos/man-lifiting.png\",\n \"headline\": \"Zapatillas favoritas.\",\n \"subhead\": \"\",\n \"callToActionText\": \"Shop Now\",\n \"callToActionUrl\": \"#\",\n \"imageActionUrl\": \"#\",\n \"textAlignment\": \"center\"\n }\n },\n \"info-card#display3\": {\n \"title\": \"Destado 3\",\n \"props\": {\n \"blockClass\": \"display\",\n \"isFullModeStyle\": true,\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://partnerchallenge29.vteximg.com.br/arquivos/winter-boots-2811.png\",\n \"headline\": \"Moda de invierno.\",\n \"subhead\": \"\",\n \"callToActionText\": \"Shop Now\",\n \"callToActionUrl\": \"#\",\n \"imageActionUrl\": \"#\",\n \"textAlignment\": \"center\"\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_7817af99
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/footer.menu.col-2.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"footer-row#menu-col-2\": {\n \"title\": \"Acerca de nosotros\",\n \"props\": {\n \"inverted\": true,\n \"blockClass\": \"vertical-menu\"\n },\n \"children\": [\n \"rich-text#footer-about-us\",\n \"menu#footer-about-us\"\n ]\n },\n \"rich-text#footer-about-us\": {\n \"props\": {\n \"textAlignment\": \"LEFT\",\n \"textPosition\": \"LEFT\",\n \"text\": \"Acerca de nosotros\",\n \"textColor\": \"c-action-primary\",\n \"font\": \"t-heading-5\"\n }\n },\n \"menu#footer-about-us\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#footer-col-2-menu1\",\n \"menu-item#footer-col-2-menu2\",\n \"menu-item#footer-col-2-menu3\",\n \"menu-item#footer-col-2-menu4\",\n \"menu-item#footer-col-2-menu5\",\n \"menu-item#footer-col-2-menu6\"\n ]\n },\n \"menu-item#footer-col-2-menu1\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Acerca de nosotros\"\n }\n }\n },\n \"menu-item#footer-col-2-menu2\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Oportunidades de trabajo\"\n }\n }\n },\n \"menu-item#footer-col-2-menu3\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Historia\"\n }\n }\n },\n \"menu-item#footer-col-2-menu4\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Servicios de tienda\"\n }\n }\n },\n \"menu-item#footer-col-2-menu5\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Términos y condiciones\"\n }\n }\n },\n \"menu-item#footer-col-2-menu6\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Opciones de pago\"\n }\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_06d0de2e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/footer.menu.col-1.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"footer-row#menu-col-1\": {\n \"title\": \"Servicio al cliente\",\n \"props\": {\n \"inverted\": true,\n \"blockClass\": \"vertical-menu\"\n },\n \"children\": [\n \"rich-text#footer-services\",\n \"menu#footer-services\"\n ]\n },\n \"rich-text#footer-services\": {\n \"props\": {\n \"textAlignment\": \"LEFT\",\n \"textPosition\": \"LEFT\",\n \"text\": \"Servicio al cliente\",\n \"textColor\": \"c-action-primary\",\n \"font\": \"t-heading-5\"\n }\n },\n \"menu#footer-services\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#footer-col-1-menu1\",\n \"menu-item#footer-col-1-menu2\",\n \"menu-item#footer-col-1-menu3\",\n \"menu-item#footer-col-1-menu4\"\n ]\n },\n \"menu-item#footer-col-1-menu1\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Estatus de la orden\"\n }\n }\n },\n \"menu-item#footer-col-1-menu2\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Devoluciones\"\n }\n }\n },\n \"menu-item#footer-col-1-menu3\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Envío\"\n }\n }\n },\n \"menu-item#footer-col-1-menu4\": {\n \"props\": {\n \"type\": \"custom\",\n \"itemProps\": {\n\t\"href\": \"#\",\n\t\"text\": \"Contáctenos\"\n }\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_0e721586
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/home.brand-bar.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#brand-bar\": {\n \"title\": \"Barra de marcas\",\n \"props\": {\n \"blockClass\": \"brand-bar\",\n \"colGap\": 5\n },\n \"children\": [\n \"flex-layout.col#brand1\",\n \"flex-layout.col#brand2\",\n \"flex-layout.col#brand3\",\n \"flex-layout.col#brand4\",\n \"flex-layout.col#brand5\",\n \"flex-layout.col#brand6\"\n ]\n },\n \"flex-layout.col#brand1\": {\n \"props\": {\n \"blockClass\": \"brand\",\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"image#brand1\"\n ]\n },\n \"flex-layout.col#brand2\": {\n \"props\": {\n \"blockClass\": \"brand\",\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"image#brand2\"\n ]\n },\n \"flex-layout.col#brand3\": {\n \"props\": {\n \"blockClass\": \"brand\",\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"image#brand3\"\n ]\n },\n \"flex-layout.col#brand4\": {\n \"props\": {\n \"blockClass\": \"brand\",\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"image#brand4\"\n ]\n },\n \"flex-layout.col#brand5\": {\n \"props\": {\n \"blockClass\": \"brand\",\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"image#brand5\"\n ]\n },\n \"flex-layout.col#brand6\": {\n \"props\": {\n \"blockClass\": \"brand\",\n \"preventVerticalStretch\": true\n },\n \"children\": [\n \"image#brand6\"\n ]\n },\n \"image#brand1\": {\n \"title\": \"brand 1\",\n \"props\": {\n \"src\": \"https://partnerchallenge29.vteximg.com.br/arquivos/brand-adidas-1238108.png\"\n }\n },\n \"image#brand2\": {\n \"title\": \"brand 2\",\n \"props\": {\n \"src\": \"https://partnerchallenge29.vteximg.com.br/arquivos/brand-mizuno-398108.png\"\n }\n },\n \"image#brand3\": {\n \"title\": \"brand 3\",\n \"props\": {\n \"src\": \"https://partnerchallenge29.vteximg.com.br/arquivos/brand-nike-191.png\"\n }\n },\n \"image#brand4\": {\n \"title\": \"brand 4\",\n \"props\": {\n \"src\": \"https://partnerchallenge29.vteximg.com.br/arquivos/brand-puma-12891371.png\"\n }\n },\n \"image#brand5\": {\n \"title\": \"brand 5\",\n \"props\": {\n \"src\": \"https://partnerchallenge29.vteximg.com.br/arquivos/brand-tnf-89231978.png\"\n }\n },\n \"image#brand6\": {\n \"title\": \"brand 6\",\n \"props\": {\n \"src\": \"https://partnerchallenge29.vteximg.com.br/arquivos/brand-under-amour-12818.png\"\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_92b018c9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/home.custom.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.custom#custom-landing-page\": {\n \"blocks\": [\n \"flex-layout.row#custom-landing-page\"\n ]\n },\n\n \"flex-layout.row#custom-landing-page\": {\n \"title\": \"Contenido\",\n \"props\": {\n \"marginLeft\": 5,\n \"marginRight\": 5\n },\n \"children\": [\n \"flex-layout.col#image-custom-landing-page\",\n \"flex-layout.col#text-custom-landing-page\"\n ]\n },\n\n \"flex-layout.col#image-custom-landing-page\": {\n \"children\": [\n \"image#custom-landing-page\"\n ],\n \"props\": {\n \"preventVerticalStretch\": true,\n \"width\": \"30%\"\n }\n },\n \"flex-layout.col#text-custom-landing-page\": {\n \"children\": [\n \"rich-text#about-title\",\n \"rich-text#about-content\"\n ],\n \"props\": {\n \"preventVerticalStretch\": true,\n \"width\": \"70%\"\n }\n },\n\n \"rich-text#about-title\": {\n \"title\": \"Título\",\n \"props\": {\n \"text\":\n \"# Título\"\n\t\t\t\t\t\t\t\t\t\t }\n },\n\n \"rich-text#about-content\": {\n \"title\": \"Texto\",\n \"props\": {\n \"text\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pretium odio vitae vulputate efficitur. \\n\\n Morbi porta, ligula a sodales sagittis, ex metus molestie nisl, eu efficitur dolor ligula a sapien. Nullam et luctus arcu, nec fringilla tellus. Cras pellentesque leo vitae leo condimentum, in lacinia velit pharetra. Donec vitae velit in dolor ornare hendrerit sit amet at ex. \\n\\n Integer pulvinar sodales justo, eu malesuada diam lacinia ac. Curabitur aliquam, lorem et semper imperdiet, ipsum est dapibus massa, sed consequat dui diam ut arcu. Vestibulum eget massa ligula. Cras ultricies quis nibh vel molestie. Morbi eleifend magna eu diam eleifend commodo. Aenean lobortis urna vel sodales placerat. Proin sed faucibus magna. Quisque in felis eget lacus mattis tempus consequat quis ipsum. Morbi semper risus in tortor aliquet sagittis.\"\n }\n },\n\n \"image#custom-landing-page\": {\n \"title\": \"Imagen\",\n \"props\": {\n \"src\": \"https://partnerchallenge29.vteximg.com.br/arquivos/chile-f81bd.png\",\n \"maxHeight\": \"600px\"\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_7be8f09e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/home.shelf.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"shelf#home\": {\n \"blocks\": [\"product-summary.shelf\"],\n \"props\": {\n \"orderBy\": \"OrderByTopSaleDESC\",\n \"paginationDotsVisibility\": \"desktopOnly\",\n \"productList\": {\n \"maxItems\": 10,\n \"itemsPerPage\": 4,\n \"minItemsPerPage\": 1.5,\n \"scroll\": \"BY_PAGE\",\n \"arrows\": true,\n \"titleText\": \"Los Más Vendidos\"\n }\n }\n },\n \"product-summary.shelf\": {\n \"children\": [\n \"product-summary-image\",\n \"product-summary-name\",\n \"product-summary-space\",\n \"product-summary-price\",\n \"product-summary-buy-button\"\n ]\n },\n \"product-summary-buy-button\": {\n \"props\": {\n \"buyButtonText\": \"Comprar\"\n }\n },\n \"product-summary-image\": {\n \"props\": {\n \"showBadge\": false,\n \"badgeText\": \"\"\n }\n }\n}\n\n```"
}
] |
code_hardsport-theme_8c5992ff
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of hardsport-theme/store/blocks/header.promo-bar.json from the hardsport-theme VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"header-row#promo-bar\": {\n \"props\": {\n \"blockClass\": \"promo-bar\"\n },\n \"children\": [\n \"notification.bar\"\n ]\n },\n \"notification.bar\": {\n \"title\": \"Barra de Promoción\",\n \"props\": {\n \"content\": \"25% DE DESCUENTO USANDO EL CÓDIGO: FIESTASPATRIAS\"\n }\n }\n}\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.