id
stringlengths
12
53
messages
listlengths
3
3
code_mycheckout-store-framework_37a238e9
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/createLink.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport async function createLink(\n _: unknown,\n { accountApprover }: { accountApprover: string },\n { clients: { checkoutless }, vtex: { account } }: Context\n) {\n const data = (await checkoutless.createLink({\n accountRequester: account,\n accountApprover,\n })) as unknown as {\n accountApprover: string\n accountRequester: string\n }\n\n return {\n ...data,\n account:\n account === data.accountApprover\n ? data.accountRequester\n : data.accountApprover,\n approver: account === data.accountApprover,\n }\n}\n\n```" } ]
code_mycheckout-store-framework_60171ca7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/createPaymentsMethods.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface PaymentMethodsInput {\n type: string\n isActive: boolean\n paymentMethodName: string\n}\n\nexport function createPaymentMethod(\n _: unknown,\n args: PaymentMethodsInput,\n { clients: { paymentsClient } }: Context\n) {\n return paymentsClient.createPaymentMethod(args)\n}\n\n```" } ]
code_mycheckout-store-framework_91ee0cbf
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/saveToken.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { buildPayments } from '../../utils/config'\nimport { createPaymentMethod } from './createPaymentsMethods'\nimport type { IPayment, IPaymentRules } from '../../typings/payments'\n\nconst configPaymentsMethods = async (ctx: Context) => {\n const {\n clients: { paymentsClient, paymentGateway },\n vtex: { account },\n } = ctx\n\n const paymentsCreated: IPaymentRules[] =\n await paymentsClient.getPaymentsMethods()\n\n if (paymentsCreated?.length > 0) return\n\n const paymentRules: any[] = await paymentGateway.getPaymentRules()\n\n const paymentsRules = buildPayments(account, paymentsCreated, paymentRules)\n\n await Promise.all(\n paymentsRules.map(async (payment) => {\n await createPaymentMethod('', payment as IPayment, ctx)\n })\n )\n}\n\nexport async function saveToken(\n _: unknown,\n {\n paymentMethodId,\n cvcRequired,\n buttonMessage,\n visualization,\n }: {\n paymentMethodId: string\n cvcRequired: boolean\n buttonMessage: string\n visualization: Array<{ type: string; key: string }>\n },\n ctx: Context\n) {\n const {\n clients: { checkoutless },\n vtex: { account },\n } = ctx\n\n await checkoutless.create({\n account,\n paymentMethodId,\n cvcRequired,\n buttonMessage,\n visualization,\n })\n\n try {\n await configPaymentsMethods(ctx)\n } catch (error) {\n console.error('configPaymentsMethods', error)\n }\n\n return 'ok'\n}\n\n```" } ]
code_mycheckout-store-framework_431ac5c2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/token.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/no-shadow */\nexport function token(_: unknown, __: unknown, ctx: Context) {\n return ctx.clients.vbase\n .getJSON<{ token: string }>('account.example', 'configs')\n .then(({ token }) => token)\n}\n\n```" } ]
code_mycheckout-store-framework_f4b53eca
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/admin/metrics.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const categoryMetrics = async (\n _: unknown,\n { data }: { data: unknown },\n { clients: { adminMetrics: AdminMetricsClient } }: Context\n) => {\n return AdminMetricsClient.categoryMetrics(data)\n}\n\nexport const subcategoryMetrics = async (\n _: unknown,\n { category, data }: { category: string; data: unknown },\n { clients: { adminMetrics: AdminMetricsClient } }: Context\n) => {\n return AdminMetricsClient.subcategoryMetrics(category, data)\n}\n\nexport const ticketAverage = async (\n _: unknown,\n { data }: { data: unknown },\n { clients: { adminMetrics: AdminMetricsClient } }: Context\n) => {\n return AdminMetricsClient.ticketAverage(data)\n}\n\nexport const checkout = async (\n _: unknown,\n { data }: { data: unknown },\n { clients: { adminMetrics: AdminMetricsClient } }: Context\n) => {\n return AdminMetricsClient.checkout(data)\n}\n\nexport const button = async (\n _: unknown,\n { data }: { data: unknown },\n { clients: { adminMetrics: AdminMetricsClient } }: Context\n) => {\n return AdminMetricsClient.button(data)\n}\n\nexport const conversionRate = async (\n _: unknown,\n { data }: { data: unknown },\n { clients: { adminMetrics: AdminMetricsClient } }: Context\n) => {\n return AdminMetricsClient.conversionRate(data)\n}\n\n```" } ]
code_mycheckout-store-framework_a2c10abf
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/credit.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const validateCredit = (\n _: unknown,\n args: { email: string; totals: number },\n { clients: { credit: CreditClient } }: Context\n) => {\n return CreditClient.validateCredit(args)\n}\n\n```" } ]
code_mycheckout-store-framework_174d24ba
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/ecommerce.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const sessionCookie = 'x-ecommerce-session'\nconst sessionMaxTime = 30 * 60 * 1000\n\nexport const ecommerce = async (\n _: unknown,\n { args }: { args: EcommerceInput },\n { clients: { ecommerce: EcommerceClient }, cookies, request }: Context\n) => {\n const session = cookies.get(sessionCookie)\n\n if (session?.match(/^[a-z0-9]+$/i)) args.session = session\n const response = (await EcommerceClient.log(args)) as { session?: string }\n const origin = request.get('origin').split('://')\n\n if (response.session?.match(/^[a-z0-9]+$/i)) {\n cookies.set(sessionCookie, response.session, {\n httpOnly: false,\n domain: origin[1],\n overwrite: true,\n maxAge: sessionMaxTime,\n })\n }\n\n return response\n}\n\n```" } ]
code_mycheckout-store-framework_d5a79006
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/orders.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const createOrder = (\n _: unknown,\n { orderArgs }: { orderArgs: OrderInput },\n { clients: { orders: OrdersClient }, request }: Context\n) => {\n if (\n orderArgs.payment?.additionalData &&\n orderArgs.payment.additionalData instanceof Array\n ) {\n orderArgs.payment.additionalData = orderArgs.payment.additionalData.reduce<\n Record<string, string>\n >((prev: Record<string, string>, item: { key: string; value: string }) => {\n return {\n ...prev,\n [item.key]: item.value,\n }\n }, {})\n }\n\n const origin = request.get('origin').split('://')\n\n return OrdersClient.createOrder(orderArgs, origin[1])\n}\n\nexport const getPaymentProcessStatus = (\n _: unknown,\n { orderId }: { orderId: string },\n { clients: { orders: OrdersClient } }: Context\n) => OrdersClient.getPaymentProcessStatus(orderId)\n\n```" } ]
code_mycheckout-store-framework_86405adc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/documents.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const getDocumentTypes = async (\n _: unknown,\n __: unknown,\n { clients: { documents: DocumentsClient } }: Context\n) => ((await DocumentsClient.getDocumentTypes()) as { data: unknown }).data\n\n```" } ]
code_mycheckout-store-framework_8e53b6d0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/accounts.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const accounts = async (\n _: unknown,\n __: unknown,\n { clients: { accounts: AccountsClient } }: Context\n) => AccountsClient.accounts()\n\n```" } ]
code_mycheckout-store-framework_9981305b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/payments.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { authCookie } from './auth'\n\nexport const getPayments = (\n _: unknown,\n { email }: User,\n { clients: { payments: PaymentsClient }, cookies }: Context\n) => PaymentsClient.getPayments(email, cookies.get(authCookie) as string)\n\nexport const deletePayment = (\n _: unknown,\n { id }: Payments,\n { clients: { payments: PaymentsClient }, cookies }: Context\n) => PaymentsClient.deletePayment(id, cookies.get(authCookie) as string)\n\n```" } ]
code_mycheckout-store-framework_3a15fdfc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/countries.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const getCountries = async (\n _: unknown,\n __: unknown,\n { clients: { countries: CountriesClient } }: Context\n) => {\n const resp = await CountriesClient.getCountries()\n\n return {\n count: 1,\n total: 1,\n current: 1,\n prev: 1,\n next: 1,\n data: resp,\n }\n}\n\nexport const getCountry = (\n _: unknown,\n { id }: Countries,\n { clients: { countries: CountriesClient } }: Context\n) => CountriesClient.getCountry(id)\n\nexport const getStateCities = (\n _: unknown,\n { country, state }: { country: string; state: string },\n { clients: { countries: CountriesClient } }: Context\n) => CountriesClient.getStateCities(country, state)\n\nexport const getCities = (\n _: unknown,\n { city }: { city: string },\n { clients: { countries: CountriesClient } }: Context\n) => CountriesClient.getCities(city)\n\n```" } ]
code_mycheckout-store-framework_ca6dfa10
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/user.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { authCookie } from './auth'\n\nexport const formatCardContent = (cardContent: Record<string, string>) => {\n const newCardContent: Array<{ key: string; value: string }> = []\n\n for (const key in cardContent) {\n newCardContent.push({ key, value: cardContent[key] })\n }\n\n return newCardContent\n}\n\nconst getDurationInMilliseconds = (start: [number, number]) => {\n const NS_PER_SEC = 1e9\n const NS_TO_MS = 1e6\n const diff = process.hrtime(start)\n\n return (diff[0] * NS_PER_SEC + diff[1]) / NS_TO_MS\n}\n\nexport const getUser = async (\n _: unknown,\n { email }: { email: string },\n { clients: { user: UserClient }, cookies, vtex: { account, logger } }: Context\n) => {\n const start = process.hrtime()\n\n logger.info(`[STARTED] ${start}`)\n const resp = (await UserClient.getUser(\n email,\n account,\n cookies.get(authCookie) as string\n )) as User\n\n const durationInMilliseconds = getDurationInMilliseconds(start)\n\n logger.info(`[FINISHED] ${durationInMilliseconds}`)\n resp.id_type = resp.documentType\n resp.id_number = resp.document\n resp.phone_code = resp.phoneCode\n resp.phone_number = resp.phoneNumber\n\n if (resp.selectedPayment?.card?.cardContent) {\n resp.selectedPayment.card.cardContent = formatCardContent(\n resp.selectedPayment.card.cardContent as Record<string, string>\n )\n\n resp.cards = resp.cards.map((card: { cardContent: unknown }) => {\n if (card?.cardContent) {\n return {\n ...card,\n cardContent: formatCardContent(\n card.cardContent as Record<string, string>\n ),\n }\n }\n\n return card\n })\n }\n\n return resp\n}\n\nexport const updateUser = async (\n _: unknown,\n { userArgs }: { userArgs: UserInput },\n { clients: { user: UserClient }, cookies }: Context\n) => {\n const resp = (await UserClient.updateUser(\n userArgs,\n cookies.get(authCookie) as string\n )) as { data: User } & User\n\n resp.id_type = resp.documentType\n resp.id_number = resp.document\n resp.phone_code = resp.phoneCode\n resp.phone_number = resp.phoneNumber\n\n if (resp.data.selectedPayment?.card?.cardContent) {\n resp.data.selectedPayment.card.cardContent = formatCardContent(\n resp.data.selectedPayment.card.cardContent as Record<string, string>\n )\n\n resp.data.cards = resp.data.cards.map((card: { cardContent: unknown }) => {\n if (card?.cardContent) {\n return {\n ...card,\n cardContent: formatCardContent(\n card.cardContent as Record<string, string>\n ),\n }\n }\n\n return card\n })\n }\n\n return resp\n}\n\nexport const createUser = async (\n _: unknown,\n args: User,\n { clients: { user: UserClient } }: Context\n) => {\n const resp = (await UserClient.createUser(args)) as User\n\n resp.id_type = resp.documentType\n resp.id_number = resp.document\n resp.phone_code = resp.phoneCode\n resp.phone_number = resp.phoneNumber\n\n return resp\n}\n\n```" } ]
code_mycheckout-store-framework_82aae21a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/auth.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { formatCardContent } from './user'\n\nexport const authCookie = 'x-checkoutless-auth'\n\nexport const login = (\n _: unknown,\n { email }: Auth,\n { clients: { auth: AuthClient }, origin }: Context\n) => {\n const formatOrigin = origin.split('://')\n\n return AuthClient.login(email, formatOrigin[1])\n}\n\nexport const verifyCode = async (\n _: unknown,\n { email, code }: Auth,\n { clients: { auth: AuthClient }, cookies, origin }: Context\n) => {\n const response = (await AuthClient.verifyCode({ email, code })) as {\n data: {\n selectedPayment: {\n card: { cardContent: unknown }\n }\n accessToken: string\n cards: Array<{ cardContent: unknown }>\n }\n }\n\n const formatOrigin = origin.split('://')\n\n cookies.set(authCookie, response.data.accessToken, {\n httpOnly: false,\n domain: formatOrigin[1],\n })\n\n if (response.data.selectedPayment?.card?.cardContent) {\n response.data.selectedPayment.card.cardContent = formatCardContent(\n response.data.selectedPayment.card.cardContent as Record<string, string>\n )\n\n response.data.cards = response.data.cards.map(\n (card: { cardContent: unknown }) => {\n if (card?.cardContent) {\n return {\n ...card,\n cardContent: formatCardContent(\n card.cardContent as Record<string, string>\n ),\n }\n }\n\n return card\n }\n )\n }\n\n return response\n}\n\n```" } ]
code_mycheckout-store-framework_61a6fdf6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/resolvers/checkout/address.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { authCookie } from './auth'\n\nexport const getAddress = (\n _: unknown,\n { email }: User,\n { clients: { address: AddressClient }, cookies }: Context\n) => AddressClient.getAddress(email, cookies.get(authCookie) as string)\n\nexport const createAddress = (\n _: unknown,\n args: unknown,\n { clients: { address: AddressClient } }: Context\n) => AddressClient.createAddress(args as never)\n\nexport const externalAddress = (\n _: unknown,\n { args }: { args: unknown },\n { clients: { address: AddressClient } }: Context\n) => AddressClient.externalAddress(args as never)\n\nexport const updateAddress = (\n _: unknown,\n args: unknown,\n { clients: { address: AddressClient }, cookies }: Context\n) =>\n AddressClient.updateAddress(args as never, cookies.get(authCookie) as string)\n\nexport const deleteAddress = (\n _: unknown,\n { id }: { id: string },\n { clients: { address: AddressClient }, cookies }: Context\n) => AddressClient.deleteAddress(id, cookies.get(authCookie) as string)\n\n```" } ]
code_mycheckout-store-framework_697dd9a1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/orders.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface OrderInput {\n items: [ItemInput]\n payment: PaymentDataInput\n profile: ProfileInput\n shipping: ShippingInput\n account: AccountInput\n channel: string\n oms: string\n customApps: CustomDataInput\n}\n\ninterface CustomDataInput {\n customApps: [CustomAppsInput]\n}\n\ninterface CustomAppsInput {\n id: string\n major: number\n fields: [CustomFieldsInput]\n}\n\ninterface CustomFieldsInput {\n key: string\n value: string\n}\n\ninterface ShippingInput {\n addressId: string\n externalAddress: unknown\n logisticsInfo: [LogisticInfoInput]\n}\n\ninterface ItemInput {\n id: string\n quantity: number\n seller: string\n}\n\ninterface LogisticInfoInput {\n itemIndex: number\n selectedSla: string\n selectedDeliveryChannel: string\n}\n\n```" } ]
code_mycheckout-store-framework_55e3bfd0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/addresses.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface IAddress {\n getAddress(email: User['email'], auth: string): unknown | Promise<unknown>\n createAddress(args: unknown): Promise<unknown>\n updateAddress(args: unknown, auth: string): Promise<GeneralAddressResponse>\n deleteAddress(id: string, auth: string): Promise<unknown>\n}\n\ninterface GeneralAddressResponse {\n message: string\n data: unknown\n}\n\n```" } ]
code_mycheckout-store-framework_ce1c636b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/users.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface UserInput {\n name?: string\n lastname?: string\n phone_code?: string\n phone_number?: string\n selectedAddress?: string\n selectedPayment?: string\n}\n\ninterface User {\n access_token?: string\n addresses?: unknown\n cards: Array<{ cardContent: unknown }>\n document: string\n documentType: string\n email: string\n id_number: string\n id_type: string\n id: string\n ip: string\n lastname: string\n name: string\n phone_code: string\n phone_number: string\n phoneCode: string\n phoneNumber: string\n selectedAddress?: unknown\n selectedPayment?: Payments\n}\n\ninterface GeneralResponse {\n message: string\n}\n\ninterface GeneralUserResponse {\n message: string\n data: User\n}\n\ninterface ProfileInput {\n email: string\n habeasData: boolean\n}\n\ninterface Auth {\n email: User['email']\n code: number\n}\n\ninterface PaginatedUserResponse {\n count: number\n total: number\n current: number\n prev: number\n next: number\n data: User[]\n}\n\ninterface IAuth {\n login(email: Auth['email'], origin: string): Promise<unknown>\n verifyCode(args: Auth): Promise<unknown>\n}\n\ninterface IUser {\n getUser(\n email: User['email'],\n account: string,\n auth: string\n ): User | Promise<unknown>\n createUser(args: User): Promise<unknown>\n updateUser(args: UserInput, auth: string): Promise<unknown>\n}\n\n```" } ]
code_mycheckout-store-framework_4758bdc6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/ecommerce.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface DataInput {\n products: [ProductsInput]\n}\n\ninterface EcommerceInput {\n event: string\n userEmail: string\n account: string\n data: DataInput\n session: string\n}\n\ninterface IEcommerceService {\n log(args: EcommerceInput): unknown\n}\n\n```" } ]
code_mycheckout-store-framework_fb7dfc95
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/countries.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface PaginatedCountriesResponse {\n count: number\n total: number\n current: number\n prev: number\n next: number\n data: Countries[]\n}\n\ninterface Countries {\n id: string\n country: string\n iso: string\n phone: string\n postal_code_regex: string\n states: States[]\n}\n\ninterface States {\n state: string\n cities: Cities[]\n}\n\ninterface Cities {\n city_id: string\n city: string\n}\n\ninterface CountriesServiceImpl {\n getCountries(): unknown\n getCountry(id: string): unknown\n getStateCities(country: string, state: string): unknown\n}\n\n```" } ]
code_mycheckout-store-framework_fc0c5886
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/payments.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface PaymentMethodsInput {\n type: string\n isActive: boolean\n paymentMethodName: string\n accountName: string\n}\n\ninterface PaymentMethods {\n id: ID\n type: string\n isActive: boolean\n paymentMethodName: string\n accountName: string\n}\n\ninterface PaymentDataInput {\n cardId?: string\n gateway: string\n paymentMethod: string\n token?: string\n franchise?: string\n number?: string\n bin?: string\n holderName?: string\n holderDocument?: string\n cvv?: string\n expirationDate?: string\n cardNumber?: string\n additionalData: Array<{ key: string; value: string }> | Record<string, string>\n}\n\ninterface Payments {\n id: string\n email: User['email']\n franchise: string\n number: string\n ccToken: string\n bin?: string\n card: { cardContent: unknown }\n}\n\ninterface IPayments {\n deletePayment(id: Payments['id'], auth: string): Promise<unknown>\n}\n\n```" } ]
code_mycheckout-store-framework_45afe73c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/documents.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface PaginatedDocumentResponse {\n count: number\n total: number\n current: number\n prev: number\n next: number\n data: DocumentTypes[]\n}\n\ninterface DocumentTypes {\n id: string\n name: string\n type: string\n}\n\ninterface DocumentServiceImpl {\n getDocumentTypes(): unknown\n}\n\n```" } ]
code_mycheckout-store-framework_a3d778f0
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/scheduler.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface SchedulerArgs {\n id: string\n scheduler: { expression: string; endDate: string }\n request: {\n uri: string\n method: string\n body: unknown\n }\n}\n\n```" } ]
code_mycheckout-store-framework_2eae6689
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/products.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface ProductsInput {\n sku: string\n quantity: number\n price: number\n category: string\n subcategory: string\n}\n\n```" } ]
code_mycheckout-store-framework_4dbf5972
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/node/base/typings/accounts.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ninterface AccountInput {\n accountName: string\n hostname: string\n storePreferences: StorePreferencesInput\n}\n\ninterface StorePreferencesInput {\n currencyCode: string\n countryCode: string\n salesChannel: string\n}\n\n```" } ]
code_mycheckout-store-framework_fa66a22d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/fragments/address.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nfragment Address on Address {\n addressId\n addressType\n city\n complement\n country\n neighborhood\n number\n postalCode\n receiverName\n reference\n state\n street\n isDisposable\n geoCoordinates\n}\n\n```" } ]
code_mycheckout-store-framework_920dfb82
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/fragments/orderForm.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\n#import './address.graphql'\n#import './item.graphql'\n\nfragment OrderFormFragment on OrderForm {\n id\n items {\n ...ItemFragment\n }\n canEditData\n loggedIn\n userProfileId\n userType\n marketingData {\n coupon\n utmCampaign\n utmMedium\n utmSource\n utmiCampaign\n utmiPart\n utmiPage\n }\n totalizers {\n id\n name\n value\n }\n shipping {\n countries\n availableAddresses {\n ...Address\n }\n selectedAddress {\n ...Address\n }\n deliveryOptions {\n id\n deliveryChannel\n price\n estimate\n isSelected\n }\n pickupOptions {\n id\n address {\n ...Address\n }\n deliveryChannel\n price\n estimate\n isSelected\n friendlyName\n additionalInfo\n storeDistance\n transitTime\n businessHours {\n dayNumber\n closed\n closingTime\n openingTime\n }\n }\n isValid\n }\n paymentData {\n paymentSystems {\n id\n name\n groupName\n validator {\n regex\n mask\n cardCodeRegex\n cardCodeMask\n weights\n useCvv\n useExpirationDate\n useCardHolderName\n useBillingAddress\n }\n stringId\n requiresDocument\n isCustom\n description\n requiresAuthentication\n dueDate\n }\n payments {\n paymentSystem\n bin\n accountId\n tokenId\n installments\n referenceValue\n value\n }\n installmentOptions {\n paymentSystem\n installments {\n count\n hasInterestRate\n interestRate\n value\n total\n }\n }\n availableAccounts {\n accountId\n paymentSystem\n paymentSystemName\n cardNumber\n bin\n }\n isValid\n }\n clientProfileData {\n email\n firstName\n lastName\n document\n documentType\n phone\n isValid\n }\n clientPreferencesData {\n locale\n optInNewsletter\n }\n messages {\n couponMessages {\n code\n }\n generalMessages {\n code\n text\n status\n }\n }\n value\n allowManualPrice\n}\n\n```" } ]
code_mycheckout-store-framework_7c355235
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/fragments/item.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\n#import './bundleItem.graphql'\n\nfragment ItemFragment on Item {\n additionalInfo {\n brandName\n }\n attachments {\n name\n content\n }\n attachmentOfferings {\n name\n required\n schema\n }\n bundleItems {\n ...BundleItemFragment\n }\n parentAssemblyBinding\n parentItemIndex\n sellingPriceWithAssemblies\n options {\n assemblyId\n id\n quantity\n seller\n inputValues\n options {\n assemblyId\n id\n quantity\n seller\n inputValues\n options {\n assemblyId\n id\n quantity\n seller\n inputValues\n }\n }\n }\n availability\n detailUrl\n id\n imageUrls {\n at1x\n at2x\n at3x\n }\n listPrice\n manualPrice\n measurementUnit\n name\n offerings {\n id\n name\n price\n type\n attachmentOfferings {\n name\n required\n schema\n }\n }\n price\n priceTags {\n identifier\n isPercentual\n name\n rawValue\n value\n }\n productCategories\n productCategoryIds\n productRefId\n productId\n quantity\n seller\n sellingPrice\n skuName\n skuSpecifications {\n fieldName\n fieldValues\n }\n unitMultiplier\n uniqueId\n refId\n priceTags {\n identifier\n isPercentual\n rawValue\n value\n name\n ratesAndBenefitsIdentifier {\n description\n id\n featured\n name\n matchedParameters\n }\n }\n isGift\n priceDefinition {\n calculatedSellingPrice\n total\n sellingPrices {\n quantity\n value\n }\n }\n}\n\n```" } ]
code_mycheckout-store-framework_17443684
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/fragments/bundleItem.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nfragment BundleItemFragment on Item {\n additionalInfo {\n brandName\n }\n attachments {\n name\n content\n }\n attachmentOfferings {\n name\n required\n schema\n }\n availability\n detailUrl\n id\n imageUrls {\n at1x\n at2x\n at3x\n }\n listPrice\n measurementUnit\n name\n offerings {\n id\n name\n price\n type\n attachmentOfferings {\n name\n required\n schema\n }\n }\n price\n productCategories\n productCategoryIds\n productRefId\n productId\n quantity\n seller\n sellingPrice\n skuName\n skuSpecifications {\n fieldName\n fieldValues\n }\n unitMultiplier\n uniqueId\n refId\n}\n\n```" } ]
code_mycheckout-store-framework_cbb5ad2f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/mutations/addItemOffering.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation AddItemOffering($offeringInput: OfferingInput) {\n addItemOffering(offeringInput: $offeringInput) {\n ...OrderFormFragment\n }\n}\n\n```" } ]
code_mycheckout-store-framework_f50d667d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/mutations/removeItemOffering.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\n# import '../fragments/orderForm.graphql'\n\nmutation RemoveItemOffering($offeringInput: OfferingInput) {\n removeItemOffering(offeringInput: $offeringInput) {\n ...OrderFormFragment\n }\n}\n\n```" } ]
code_mycheckout-store-framework_aff0dc86
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/typings/gql.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.gql' {\n import type { DocumentNode } from 'graphql'\n\n const Schema: DocumentNode\n\n export default Schema\n}\n\ndeclare module '*.graphql' {\n import type { DocumentNode } from 'graphql'\n\n const schema: DocumentNode\n\n export default Schema\n}\n\ninterface Runtime {\n production: boolean\n account: string\n workspace: string\n culture: {\n language: string\n }\n query: {\n theme: string\n }\n platform: string\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\ndeclare const __RUNTIME__: Runtime\n\n```" } ]
code_mycheckout-store-framework_732c677c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/typings/css.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.css' {\n type Styles = {\n [selector: string]: string\n }\n\n const styles: Styles\n\n export default styles\n}\n\n```" } ]
code_mycheckout-store-framework_4459c84b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/styles.css from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.containerMetrics {\n display: grid;\n width: 100%;\n grid-template-columns: repeat(4, 1fr);\n border: 1px solid grey;\n height: 70px;\n}\n\n.containerMetrics div {\n border-right: 0.1px solid grey;\n cursor: pointer;\n}\n\n.containerMetrics div:last-child {\n border-right: none;\n}\n\n.containerMetrics small {\n display: flex;\n align-items: center;\n margin: 4px 8px;\n border-bottom: 1px solid black;\n /* font-size: 13px; */\n color: grey;\n}\n\n.containerMetrics img {\n width: 20px;\n height: 20px;\n margin-right: 5px;\n margin-bottom: 4px;\n}\n\n.dateIcon {\n height: 24px;\n margin-top: 0px;\n}\n\n.arrowDown {\n position: relative;\n top: 5px;\n}\n\n.selectedCard {\n border-bottom: 5px solid #eb5b2b;\n}\n\n.selectedCard small {\n color: black;\n font-weight: bold;\n}\n\n.containerGraph .tagDescription {\n display: inline-block;\n margin-right: 20px;\n /* font-size: 13px; */\n}\n\n:global(.kuikpay-my-checkout-0-x-containerGraph)\n :global(.kuikpay-kuikpay-admin-1-x-tagDescription div) {\n padding: 6px !important;\n margin-right: 4px !important;\n}\n\n:global(.kuikpay-my-checkout-0-x-containerGraph)\n :global(.recharts-default-legend) {\n display: none !important;\n}\n\n.btnFilters {\n background-color: transparent;\n color: black;\n border: none;\n border-bottom: 1px solid black;\n margin-bottom: 10px;\n cursor: pointer;\n position: relative;\n top: -9px;\n}\n\n.btnFilters[disabled] {\n color: grey;\n cursor: not-allowed;\n}\n\n/* Container filters styles */\n.hidden {\n display: none;\n}\n\n.containerFilters {\n border: 2px solid #cfcece;\n width: auto;\n position: absolute !important;\n padding: 20px 40px !important;\n background: white;\n box-shadow: 2px 3px 7px #d1d0d0;\n z-index: 1;\n border-radius: 5px;\n margin-top: -5px;\n}\n\n:global(.vtex-dropdown__button) {\n width: 255px;\n}\n\n:global(.vtex-styleguide-9-x-container) {\n margin-left: 16px;\n}\n\n:global(.vtex-dropdown__label) {\n display: contents;\n}\n\n.containerFilters label {\n display: flex;\n align-items: baseline;\n}\n\n.btnAccept {\n background-color: #eb5b2b;\n color: white;\n border: none;\n width: 160px;\n border-radius: 3px;\n padding: 5px 0;\n}\n\n.btnCancel {\n margin-left: 20px;\n background: transparent;\n border: none;\n text-decoration: underline;\n}\n\n.containerDatePicker {\n padding: 10px 0 0px 63px;\n display: flex;\n}\n\n.firstContainerPicker :global(.vtex-input-prefix__group) {\n border: 2px solid #eb5b2b;\n}\n\n.secondContainerPicker :global(.vtex-input-prefix__group) {\n border: 2px solid #284859;\n}\n\n.containerDatePicker input {\n margin-right: 15px;\n}\n\n.checkCompare {\n display: inline-block;\n margin-right: 4px;\n position: relative;\n top: 2px;\n}\n\n/*Styles radio buttons*/\n\n:global(.kuikpay-my-checkout-0-x-containerGraph)\n :global(.vtex-radioGroup__fieldset) {\n display: flex !important;\n}\n\n:global(.kuikpay-my-checkout-0-x-containerGraph)\n :global(.vtex-radioGroup__fieldset label) {\n border: none !important;\n}\n\n:global(.kuikpay-my-checkout-0-x-containerGraph)\n :global(.vtex-radioGroup__radioContainer) {\n margin-right: 10px;\n}\n\n:global(.kuikpay-my-checkout-0-x-containerGraph) :global(.vtex-radio__label) {\n /* font-size: 13px; */\n padding-top: 5px;\n}\n\n.tagsAndRadioBtns {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n/*Styles chart*/\n\n:global(.vtex-radio__fakeRadio.b--action-primary) {\n border-color: #368369 !important;\n}\n\n:global(.vtex-radio__fakeRadioInner.bg-action-primary) {\n background-color: #368369 !important;\n}\n\ninput[type='checkbox'] {\n width: 16px !important;\n height: 16px !important;\n -webkit-appearance: none;\n -moz-appearance: none;\n -o-appearance: none;\n appearance: none;\n outline: 1px solid gray;\n box-shadow: none;\n font-size: 0.8em;\n text-align: center;\n line-height: 1em;\n background: white;\n border-radius: 3px;\n}\n\ninput[type='checkbox']:checked:after {\n content: '✔';\n color: white;\n width: 8px;\n background: #368369;\n height: 8px;\n padding: 4px;\n position: absolute;\n top: 0px;\n left: 0px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.containerLoader {\n position: relative;\n display: flex;\n justify-content: center;\n top: -37px;\n}\n\n.containerLoader svg {\n position: absolute;\n}\n\n.textCompare {\n padding-left: 8px;\n}\n\n.containerTags {\n display: grid;\n}\n\n.chart {\n width: 100%;\n height: 500px;\n}\n\n.chartContainer {\n width: 100%;\n height: 100%;\n}\n\n@media screen and (max-width: 768px) {\n .containerFilters {\n width: 50%;\n }\n :global(.vtex-dropdown__button) {\n width: 30.1vw;\n }\n .containerDatePicker {\n display: block;\n }\n}\n\n@media screen and (max-width: 652px) {\n .containerFilters {\n width: 75%;\n }\n}\n\n@media screen and (max-width: 566px) {\n .containerFilters {\n width: 75%;\n }\n}\n\n@media screen and (max-width: 480px) {\n :global(.vtex-dropdown__button) {\n width: 42.1vw;\n }\n .btnAccept {\n width: 100px;\n }\n}\n\n```" } ]
code_mycheckout-store-framework_01c5390a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/utils/index.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const CONSTANTS = {\n platform: 'vtex-io',\n}\n\nexport const getOrderForm = async (oderFormId: string) => {\n const response = await fetch(`/api/checkout/pub/orderForm/${oderFormId}`, {\n method: 'GET',\n redirect: 'follow',\n })\n\n return response.json()\n}\n\n```" } ]
code_mycheckout-store-framework_54e756a7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/interfaces/index.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport interface ItemToAdd {\n id?: number | string\n quantity?: number\n seller?: string\n}\n\nexport interface ItemToRemove {\n id?: number | string\n index?: number\n quantity: number\n seller?: string\n uniqueId?: string\n}\n\nexport interface OfferingInput {\n itemIndex: number\n offeringId: string\n}\n\nexport interface ResponseValidateItem {\n id: string\n message: string\n imageUrl?: string\n name?: string\n}\n\nexport interface Config {\n mainSellerId?: string\n salesChannel?: string\n customItems?: CustomItems[]\n customSubTotalItems?: CustomSubTotalItems[]\n}\n\nexport interface CustomSubTotalItems {\n name: string\n value: number\n}\n\nexport interface CustomItems {\n sku: string\n customClassName?: string\n name?: string\n sendToFinish?: boolean\n showTotalMount?: boolean\n remove?: boolean\n}\n\nexport interface Card {\n paymentSystemName: string\n accountId: string\n cardNumber: string\n}\n\nexport interface MarketingData {\n coupon?: string\n}\n\nexport interface Message {\n code: string\n}\n\nexport interface PaymentMethod {\n id?: string\n gateway?: string\n email?: string\n franchise?: string\n number?: string\n ccToken?: string\n paymentMethod: string\n bin?: string\n}\n\nexport interface PaymentData {\n availablePaymentMethods?: PaymentMethod[] | null\n selectedPaymentMethod?: PaymentMethod | null\n paymentMethod?: PaymentMethod | null\n completed?: boolean\n otherAvailablePaymentMethods?: PaymentMethod[] | null\n bin?: string | null\n}\n\ntype TotalizerId = 'Items' | 'Shipping' | 'Tax' | 'Discounts'\n\nexport interface Totalizer {\n id: TotalizerId\n name: string\n value: number\n}\n\nexport interface BundleItem {\n id: string\n name: string\n price: number\n}\n\nexport interface Offering {\n allowGiftMessage: boolean\n id: string\n name: string\n price: number\n type: string\n}\n\nexport interface Item {\n uniqueId: string\n id: string\n name: string\n quantity: number\n sellingPrice: number\n imageUrl: string\n availability: string\n index: number\n seller: string\n offerings: Offering[]\n bundleItems: BundleItem[]\n isGift: boolean\n price: number\n skuSpecifications: SkuSpecification[]\n productCategories?: any[]\n listPrice: number\n imageUrls?: {\n at1x: string\n }\n unitMultiplier: number\n measurementUnit: string\n priceTags: any\n}\n\ninterface GeoCoordinates {\n latitude: string\n longitude: string\n}\n\nexport interface Address {\n addressId: string\n addressType: string\n city: string\n complement?: string\n country: string\n geoCoordinates: GeoCoordinates\n isDisposable?: boolean\n neighborhood: string\n number?: string\n postalCode: string\n receiverName: string\n reference?: string\n state: string\n street: string\n completed?: boolean\n selectedSlaId?: string\n}\n\nexport interface OrderForm {\n clientProfileData?: {\n email?: string\n }\n shippingData?: {\n selectedAddress?: Address | null\n }\n items: Item[]\n totalizers: Totalizer[]\n value: number\n paymentData?: PaymentData\n messages?: Message[]\n marketingData?: MarketingData\n}\n\nexport interface CustomData {\n customApps: CustomApp[]\n}\n\ninterface CustomApp {\n id: string\n major: number\n fields: CustomAppField[]\n}\n\ninterface CustomAppField {\n key: string\n value: string\n}\n\nexport interface Seller {\n commertialOffer: CommertialOffer\n}\n\ninterface CommertialOffer {\n AvailableQuantity: number\n}\n\nexport interface Profile {\n email?: string\n firstName?: string\n lastName?: string\n document?: string\n phone?: string\n documentType?: string\n isCorporate?: boolean\n corporateName?: string\n tradeName?: string\n corporateDocument?: string\n stateInscription?: string\n}\n\nexport interface ProductItem {\n itemId: string\n name: string\n images: Image[]\n variations: Array<{\n name: string\n values: string[]\n }>\n sellers: Array<{\n sellerDefault: boolean\n commertialOffer: {\n Price: number\n ListPrice: number\n AvailableQuantity: number\n }\n }>\n}\n\nexport interface Image {\n imageId?: string\n imageLabel?: string | null\n imageTag?: string\n imageUrl?: string\n imageText?: string\n}\n\nexport interface CartSimulation {\n items: ItemToAdd\n postalCode: string\n geoCoordinates: GeoCoordinates\n country: string\n shippingData?: ShippingData\n logisticsInfo: LogisticsInfo[]\n totals: Totalizer[]\n paymentData: {\n installmentOptions: InstallmentOption[]\n }\n}\n\nexport interface ShippingData {\n logisticsInfo: LogisticsInfo[]\n}\n\nexport interface LogisticsInfo {\n addressId?: string\n itemIndex: number\n selectedSla: string\n selectedDeliveryChannel: string\n slas?: Sla[]\n deliveryWindow?: DeliveryWindow\n deliveryChannel?: string\n}\n\nexport interface DeliveryWindow {\n startDateUtc: string\n endDateUtc: string\n price?: number\n}\n\nexport interface Sla {\n itemIndex?: number[]\n id: string\n deliveryChannel: string\n name: string\n shippingEstimate: string\n shippingEstimateDate: string\n availableDeliveryWindows: DeliveryWindow[]\n price: number\n prices: Prices[]\n index?: number\n pickupStoreInfo?: PickupStoreInfo\n}\n\ninterface PickupStoreInfo {\n additionalInfo?: string\n friendlyName?: string\n address?: Address\n}\n\ninterface Prices {\n [n: string]: number\n}\n\nexport interface SkuSpecification {\n field: SkuSpecificationField\n values: SkuSpecificationValues[]\n}\n\nexport interface SkuSpecificationField {\n name: string\n originalName: string\n}\n\nexport interface SkuSpecificationValues {\n name: string\n originalName: string\n}\n\nexport interface InstallmentOption {\n bin?: string\n installments: Installment[] | null\n paymentName: string\n value: number\n}\n\nexport interface Installment {\n count: number\n value: number\n total: number\n}\n\nexport interface ResponseManageBag {\n quantity: number | string\n price: number\n}\n\nexport interface StoreTermsAndConditionsContent {\n id: string\n content: string\n}\nexport interface BlockedShipping {\n categories: ICategory[]\n}\n\nexport interface ShowPaymentMethod {\n id: string\n show: boolean\n}\n\ninterface ICategory {\n name: string\n id: string\n}\n\n```" } ]
code_mycheckout-store-framework_8a7d8b4e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/typings/graphql.d.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\ndeclare module '*.graphql' {\n import type { DocumentNode } from 'graphql'\n\n const value: DocumentNode\n export default value\n}\n\n```" } ]
code_mycheckout-store-framework_ed1d530c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/LinkItemAction.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { FC } from 'react'\nimport {\n ButtonWithIcon,\n IconSuccess,\n IconFailure,\n IconDelete,\n} from 'vtex.styleguide'\nimport { useMutation } from 'react-apollo'\n\nimport UPDATE_LINK from '../graphql/updateLink.graphql'\nimport DELETE_LINK from '../graphql/deleteLink.graphql'\n\ninterface Props {\n rowData: {\n approver: boolean\n status: string\n id: string\n }\n refetch: () => Promise<void>\n setShowAlert: (state: boolean) => void\n setMessageId: (state: string) => void\n}\n\nconst LinkItemAction: FC<Props> = ({\n rowData,\n refetch,\n setMessageId,\n setShowAlert,\n}) => {\n const [updateLink, { loading }] = useMutation(UPDATE_LINK)\n const [deleteLink, { loading: loadingDelete }] = useMutation(DELETE_LINK)\n\n return (\n <div className=\"flex justify-between\">\n {rowData.status === 'pending' && rowData.approver ? (\n <>\n <div className=\"mr2\">\n <ButtonWithIcon\n isLoading={loading}\n variation=\"secondary\"\n onClick={() =>\n updateLink({\n variables: {\n id: rowData.id,\n status: 'approved',\n },\n }).then(() => {\n refetch()\n setMessageId('approvedMessage')\n setShowAlert(true)\n })\n }\n icon={<IconSuccess />}\n />\n </div>\n <div className=\"mr2\">\n <ButtonWithIcon\n isLoading={loading}\n variation=\"secondary\"\n onClick={() =>\n updateLink({\n variables: {\n id: rowData.id,\n status: 'rejected',\n },\n }).then(() => {\n refetch()\n setMessageId('rejectedMessage')\n setShowAlert(true)\n })\n }\n icon={<IconFailure />}\n />\n </div>\n </>\n ) : (\n <div className=\"mr2\">\n <ButtonWithIcon\n isLoading={loadingDelete}\n variation=\"secondary\"\n onClick={() =>\n deleteLink({\n variables: {\n id: rowData.id,\n },\n }).then(() => {\n refetch()\n setMessageId('deleteMessage')\n setShowAlert(true)\n })\n }\n icon={<IconDelete />}\n />\n </div>\n )}\n </div>\n )\n}\n\nexport default LinkItemAction\n\n```" } ]
code_mycheckout-store-framework_899670a7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/utils/utilsStatistics.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* eslint-disable no-restricted-imports */\nimport { pathOr } from 'ramda'\n\nexport const getDateByOption = (range: number, initialDate: string) => {\n const today = new Date(initialDate)\n\n today.setDate(today.getDate() - range)\n const formatDate = `${today.getUTCFullYear()}${\n today.getMonth() <= 10 ? '-0' : '-'\n }${today.getMonth() + 1}-${today.getUTCDate()}`\n\n initialDate = formatDate\n\n return initialDate\n}\n\nexport const formatCurrentDay = (today: any) => {\n const thisDay = new Date()\n const formatDate = `${thisDay.getUTCFullYear()}${\n thisDay.getMonth() <= 10 ? '-0' : '-'\n }${thisDay.getMonth() + 1}-${thisDay.getUTCDate()}`\n\n today = formatDate\n\n return today\n}\n\nexport const formatCurrentDayPicker = (today: any) => {\n const thisDay = new Date(today)\n const formatDate = `${thisDay.getUTCFullYear()}${\n thisDay.getMonth() <= 10 ? '-0' : '-'\n }${thisDay.getMonth() + 1}-${thisDay.getUTCDate()}`\n\n today = formatDate\n\n return today\n}\n\nexport const days = {\n today: 0,\n yesterday: 1,\n lastWeek: 7,\n lastMonth: 31,\n person: 0,\n}\n\nexport const getDateIntoOptionValue = (\n value: string,\n stateInitial: any,\n stateFinal: any\n) => {\n return {\n initial: getDateByOption(pathOr(0, [value], days), stateInitial),\n final: formatCurrentDayPicker(stateFinal),\n }\n}\n\nconst selectArray = (\n selected: any,\n previous: any\n): { arrayToIterate: any[]; arrayToCompare: any[] } => {\n const arrayToIterate = selected.length > previous.length ? selected : previous\n\n const arrayToCompare = selected.length < previous.length ? selected : previous\n\n return {\n arrayToIterate,\n arrayToCompare,\n }\n}\n\nexport const generateDataForChart = (\n selected: any,\n previous: any,\n name: string\n) => {\n const selectedItems = selectArray(selected, previous)\n const { arrayToCompare, arrayToIterate } = Object.assign(selectedItems, {})\n\n const data = arrayToIterate.map((item) => {\n const prvArray =\n selectedItems[\n selected.length > previous.length ? 'arrayToIterate' : 'arrayToCompare'\n ]\n\n const useArray =\n selectedItems[\n selected.length > previous.length ? 'arrayToCompare' : 'arrayToIterate'\n ]\n\n return {\n name: item?._id,\n isEqual: arrayToCompare.some((compare: any) => item._id === compare._id),\n previous: pathOr(\n 0,\n [name],\n prvArray.find((prv) => prv._id === item._id)\n ),\n use: pathOr(\n 0,\n [name],\n useArray.find((use) => use._id === item._id)\n ),\n }\n })\n\n return data\n}\n\nexport const showDataInGraphic = (\n arrSelected: any,\n arrPrevious: any,\n name: string\n): any[] => {\n if (arrPrevious?.length === 0) {\n return arrSelected?.map((item: any) => ({\n name: item._id,\n use: item[name],\n }))\n }\n\n const allData = [...arrSelected, ...arrPrevious]\n const data = allData?.map((item: any) => ({\n name: item._id,\n use: item[name],\n previous: null,\n }))\n\n if (data.length === 1) {\n return data\n }\n\n return generateDataForChart(arrSelected, arrPrevious, name)\n}\n\nexport const formatDate = (date: string) => {\n const info = date.split('-')\n const newDate = `${pathOr('', [1], info)}-${pathOr('', [0], info)}-${pathOr(\n '',\n [2],\n info\n )}`\n\n return new Date(newDate)\n}\n\n```" } ]
code_mycheckout-store-framework_9406866a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/__tests__/index.test.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\ndescribe('Orders List Scenarios', () => {\n it('should work', () => {\n expect(1).toBe(1)\n })\n})\n\n```" } ]
code_mycheckout-store-framework_c9dea9c6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/getCategories.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery {\n getCategories @context(provider: \"kuikpay.my-checkout\") {\n id\n url\n name\n hasChildren\n children {\n id\n url\n name\n hasChildren\n children {\n id\n url\n name\n hasChildren\n }\n }\n }\n}\n\n```" } ]
code_mycheckout-store-framework_a228ec1a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/token.gql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery token @context(provider: \"kuikpay.my-checkout\") {\n token\n}\n\n```" } ]
code_mycheckout-store-framework_376b6597
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/updateLink.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation UpdateLink($id: String, $status: String) {\n updateLink(id: $id, status: $status)\n @context(provider: \"kuikpay.my-checkout\") {\n id\n account\n approver\n status\n date\n }\n}\n\n```" } ]
code_mycheckout-store-framework_8959d856
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/handleVisualization.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation ($visualization: [VisualizationInput]) {\n handleVisualization(visualization: $visualization)\n @context(provider: \"kuikpay.my-checkout\") {\n visualization {\n type\n key\n }\n }\n}\n\n```" } ]
code_mycheckout-store-framework_9e461435
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/deleteLink.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation DeleteLink($id: String) {\n deleteLink(id: $id) @context(provider: \"kuikpay.my-checkout\") {\n removed\n id\n }\n}\n\n```" } ]
code_mycheckout-store-framework_c6fc791d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/createLink.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation CreateLink($accountApprover: String) {\n createLink(accountApprover: $accountApprover)\n @context(provider: \"kuikpay.my-checkout\") {\n account\n status\n date\n approver\n }\n}\n\n```" } ]
code_mycheckout-store-framework_1c1cd46a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/saveToken.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation saveToken(\n $key: String\n $token: String\n $paymentMethodId: String\n $cvcRequired: Boolean\n $buttonMessage: String\n $visualization: [VisualizationInput]\n) {\n saveToken(\n key: $key\n token: $token\n paymentMethodId: $paymentMethodId\n cvcRequired: $cvcRequired\n buttonMessage: $buttonMessage\n visualization: $visualization\n ) @context(provider: \"kuikpay.my-checkout\")\n}\n\n```" } ]
code_mycheckout-store-framework_54d3a7a6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/getListPayments.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery {\n getPaymentsMethods @context(provider: \"kuikpay.my-checkout\") {\n id\n isActive\n paymentMethodName\n accountName\n type\n }\n}\n\n```" } ]
code_mycheckout-store-framework_0fbed8a7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/getLinksByAccount.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\n{\n getLinksByAccount @context(provider: \"kuikpay.my-checkout\") {\n account\n status\n date\n approver\n id\n }\n}\n\n```" } ]
code_mycheckout-store-framework_9e28e841
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/createPaymentMethod.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nmutation (\n $id: ID!\n $type: String\n $isActive: Boolean\n $paymentMethodName: String\n $accountName: String\n) {\n createPaymentMethod(\n id: $id\n type: $type\n isActive: $isActive\n paymentMethodName: $paymentMethodName\n accountName: $accountName\n ) @context(provider: \"kuikpay.my-checkout\") {\n id\n }\n}\n\n```" } ]
code_mycheckout-store-framework_bb2c21ec
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/getAccount.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\n{\n getAccount @context(provider: \"kuikpay.my-checkout\") {\n account\n paymentMethodId\n cvcRequired\n isConfigured\n buttonMessage\n isConfigured\n visualization {\n type\n key\n }\n }\n}\n\n```" } ]
code_mycheckout-store-framework_e861ac89
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/graphql/getPayments.graphql from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```graphql\nquery {\n paymentsRules {\n rules {\n id\n name\n salesChannels {\n id\n }\n paymentSystem {\n name\n id\n }\n enabled\n }\n }\n}\n\n```" } ]
code_mycheckout-store-framework_09477003
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/statistics/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-fallthrough */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-restricted-imports */\nimport React, {\n createContext,\n useMemo,\n useState,\n useContext,\n useEffect,\n} from 'react'\nimport { useLazyQuery } from 'react-apollo'\nimport { pathOr } from 'ramda'\n\nimport getButtonUses from '../../graphql/metrics/getButtonUses.graphql'\nimport getCheckout from '../../graphql/metrics/getCheckout.graphql'\nimport getConversionRate from '../../graphql/metrics/getConversionRate.graphql'\nimport getTicketAverage from '../../graphql/metrics/getTicketAverage.graphql'\nimport StatisticsView from './Statistics'\nimport { showDataInGraphic, formatDate } from '../../utils/utilsStatistics'\nimport { defaultFilters } from './default'\nimport type { IFilter } from './interfaces'\n\nexport enum Statistic {\n buttonUse = 1,\n checkout = 2,\n conversionRate = 3,\n ticketAverage = 4,\n}\n\nexport interface StatisticsContext {\n statisticSelected: Statistic\n setStadisticsSelected: (state: Statistic) => void\n filters: IFilter\n setFilters: (state: IFilter) => void\n onSubmitFilters: (\n forceVisualization?: string,\n forceSelectectFrom?: string,\n forceSelectedUntil?: string,\n forcePreviousFrom?: string,\n forcePreviousUntil?: string\n ) => void\n graphicInfo: any[]\n setChecked: (state: boolean) => void\n checked: boolean\n firstPicker: any\n setFirstPicker: (state: any) => void | null\n secondPicker: any\n setSecondPicker: (state: any) => void | null\n thirdPicker: any\n setThirdPicker: (state: any) => void | null\n fourPicker: any\n setFourPicker: (state: any) => void | null\n firstSelectOption: string\n setFirstSelectOption: (state: string) => void\n secondSelectOption: string\n setSecondSelectOption: (state: string) => void\n loading: boolean\n}\n\nconst statisticsContext = createContext<StatisticsContext>({} as any)\nconst { Provider } = statisticsContext\n\nexport const useStatisticsContext = () => useContext(statisticsContext)\n\nconst Statistics = () => {\n const [checked, setChecked] = useState<boolean>(false)\n const [statisticSelected, setStadisticsSelected] = useState<Statistic>(\n Statistic.buttonUse\n )\n\n const [loading, setLoading] = useState<boolean>(false)\n const [filters, setFilters] = useState<IFilter>(defaultFilters)\n const [graphicInfo, setGraphicInfo] = useState<any[]>([])\n const [firstPicker, setFirstPicker] = useState<any>('')\n const [secondPicker, setSecondPicker] = useState<any>('')\n const [thirdPicker, setThirdPicker] = useState<any>('')\n const [fourPicker, setFourPicker] = useState<any>('')\n const [firstSelectOption, setFirstSelectOption] = useState<string>('')\n const [secondSelectOption, setSecondSelectOption] = useState<string>('')\n\n const [lazyButtonUses, { data: buttonUses }] = useLazyQuery(getButtonUses, {\n fetchPolicy: 'network-only',\n })\n\n const [lazyCheckout, { data: checkoutUse }] = useLazyQuery(getCheckout, {\n fetchPolicy: 'network-only',\n })\n\n const [lazyConversion, { data: conversionUse }] = useLazyQuery(\n getConversionRate,\n { fetchPolicy: 'network-only' }\n )\n\n const [lazyTicket, { data: ticketUse }] = useLazyQuery(getTicketAverage, {\n fetchPolicy: 'network-only',\n })\n\n useEffect(() => {\n setLoading(true)\n if (buttonUses) {\n const previousPeriod = pathOr(\n [],\n ['button', 'previousPeriodButton'],\n buttonUses\n )\n\n const selectedPeriod = pathOr(\n [],\n ['button', 'selectedPeriodButton'],\n buttonUses\n )\n\n setGraphicInfo(\n showDataInGraphic(previousPeriod, selectedPeriod, 'use').sort(\n (a: any, b: any) => {\n const fist: any = formatDate(a?.name)\n const last: any = formatDate(b?.name)\n\n return fist - last\n }\n )\n )\n setLoading(false)\n }\n }, [buttonUses])\n\n useEffect(() => {\n setLoading(true)\n if (checkoutUse) {\n const previousPeriod = pathOr(\n [],\n ['checkout', 'previousPeriodCheckout'],\n checkoutUse\n )\n\n const selectedPeriod = pathOr(\n [],\n ['checkout', 'selectedPeriodCheckout'],\n checkoutUse\n )\n\n setGraphicInfo(\n showDataInGraphic(\n previousPeriod,\n selectedPeriod,\n 'closedPurchases'\n ).sort((a: any, b: any) => {\n const fist: any = formatDate(a?.name)\n const last: any = formatDate(b?.name)\n\n return fist - last\n })\n )\n }\n\n setLoading(false)\n }, [checkoutUse])\n\n useEffect(() => {\n setLoading(true)\n if (conversionUse) {\n const previousPeriod = pathOr(\n [],\n ['conversionRate', 'previousPeriodCR'],\n conversionUse\n )\n\n const selectedPeriod = pathOr(\n [],\n ['conversionRate', 'selectedPeriodCR'],\n conversionUse\n )\n\n setGraphicInfo(\n showDataInGraphic(previousPeriod, selectedPeriod, 'cr').sort(\n (a: any, b: any) => {\n const fist: any = formatDate(a?.name)\n const last: any = formatDate(b?.name)\n\n return fist - last\n }\n )\n )\n }\n\n setLoading(false)\n }, [conversionUse])\n\n useEffect(() => {\n setLoading(true)\n if (ticketUse) {\n const previousPeriod = pathOr(\n [],\n ['ticketAverage', 'previousPeriodTicket'],\n ticketUse\n )\n\n const selectedPeriod = pathOr(\n [],\n ['ticketAverage', 'selectedPeriodTicket'],\n ticketUse\n )\n\n setGraphicInfo(\n showDataInGraphic(previousPeriod, selectedPeriod, 'ticketAverage').sort(\n (a: any, b: any) => {\n const fist: any = formatDate(a?.name)\n const last: any = formatDate(b?.name)\n\n return fist - last\n }\n )\n )\n }\n\n setLoading(false)\n }, [ticketUse])\n\n const onSubmitFilters = (\n forceVisualization?: string,\n forceSelectectFrom?: string,\n forceSelectedUntil?: string,\n forcePreviousFrom?: string,\n forcePreviousUntil?: string\n ) => {\n const { timeZone: timezone = 'America/Bogota' } =\n Intl.DateTimeFormat().resolvedOptions()\n\n switch (statisticSelected) {\n case Statistic.buttonUse:\n lazyButtonUses({\n variables: {\n ...filters,\n visualization: forceVisualization || filters.visualization,\n selectedFrom: forceSelectectFrom || filters.selectedFrom,\n selectedUntil: forceSelectedUntil || filters.selectedUntil,\n previousFrom: forcePreviousFrom || filters.previousFrom,\n previousUntil: forcePreviousUntil || filters.previousUntil,\n timezone,\n },\n })\n break\n\n case Statistic.checkout:\n lazyCheckout({\n variables: {\n ...filters,\n visualization: forceVisualization || filters.visualization,\n selectedFrom: forceSelectectFrom || filters.selectedFrom,\n selectedUntil: forceSelectedUntil || filters.selectedUntil,\n previousFrom: forcePreviousFrom || filters.previousFrom,\n previousUntil: forcePreviousUntil || filters.previousUntil,\n timezone,\n },\n })\n break\n\n case Statistic.conversionRate:\n lazyConversion({\n variables: {\n ...filters,\n visualization: forceVisualization || filters.visualization,\n selectedFrom: forceSelectectFrom || filters.selectedFrom,\n selectedUntil: forceSelectedUntil || filters.selectedUntil,\n previousFrom: forcePreviousFrom || filters.previousFrom,\n previousUntil: forcePreviousUntil || filters.previousUntil,\n timezone,\n },\n })\n break\n\n case Statistic.ticketAverage:\n lazyTicket({\n variables: {\n ...filters,\n visualization: forceVisualization || filters.visualization,\n selectedFrom: forceSelectectFrom || filters.selectedFrom,\n selectedUntil: forceSelectedUntil || filters.selectedUntil,\n previousFrom: forcePreviousFrom || filters.previousFrom,\n previousUntil: forcePreviousUntil || filters.previousUntil,\n timezone,\n },\n })\n\n default:\n break\n }\n }\n\n useEffect(() => {\n setLoading(true)\n onSubmitFilters()\n }, [statisticSelected])\n\n const context = useMemo<StatisticsContext>(\n () => ({\n statisticSelected,\n setStadisticsSelected,\n filters,\n setFilters,\n onSubmitFilters,\n graphicInfo,\n setChecked,\n checked,\n firstPicker,\n setFirstPicker,\n secondPicker,\n setSecondPicker,\n thirdPicker,\n setThirdPicker,\n fourPicker,\n setFourPicker,\n firstSelectOption,\n setFirstSelectOption,\n secondSelectOption,\n setSecondSelectOption,\n loading,\n }),\n [\n statisticSelected,\n filters,\n graphicInfo,\n checked,\n firstPicker,\n secondPicker,\n thirdPicker,\n firstSelectOption,\n secondSelectOption,\n loading,\n ]\n )\n\n return (\n <Provider value={context}>\n <StatisticsView />\n </Provider>\n )\n}\n\nexport default Statistics\n\n```" } ]
code_mycheckout-store-framework_8c24fcc3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/statistics/GraphicStatistics.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport {\n ResponsiveContainer,\n Line,\n XAxis,\n YAxis,\n CartesianGrid,\n Tooltip,\n Legend,\n LineChart,\n} from 'recharts'\nimport { Tag, RadioGroup, Spinner } from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\n\nimport { useStatisticsContext } from './index'\nimport { formatCurrentDayPicker } from '../../utils/utilsStatistics'\nimport styles from '../../styles.css'\n\nconst GraphicStatistics = () => {\n const {\n graphicInfo,\n filters,\n setFilters,\n onSubmitFilters,\n checked,\n firstPicker,\n secondPicker,\n thirdPicker,\n fourPicker,\n firstSelectOption,\n secondSelectOption,\n loading,\n } = useStatisticsContext()\n\n const getFirstPicker = formatCurrentDayPicker(firstPicker)\n const getSecondPicker = formatCurrentDayPicker(secondPicker)\n const getThirdPicker = formatCurrentDayPicker(thirdPicker)\n const getFourPicker = formatCurrentDayPicker(fourPicker)\n\n return (\n <div>\n <div className={styles.containerGraph}>\n <div className={styles.tagsAndRadioBtns}>\n <div className={styles.containerTags}>\n <span className={`${styles.tagDescription} mt2`}>\n <Tag bgColor=\"#EB5B2B\" color=\"#fff\" />\n {firstSelectOption === 'person' && onSubmitFilters\n ? `${getFirstPicker} | ${getSecondPicker}`\n : `${filters.selectedFrom}`}\n </span>\n {typeof filters.selectedFrom === typeof filters.previousFrom &&\n onSubmitFilters &&\n checked && (\n <span className={`${styles.tagDescription} mt1`}>\n <Tag bgColor=\"#284859\" color=\"#fff\" />\n {secondSelectOption === 'person'\n ? `${getThirdPicker} | ${getFourPicker}`\n : `${filters.previousFrom}`}\n </span>\n )}\n </div>\n <RadioGroup\n name=\"period\"\n options={[\n {\n value: 'd',\n label: <FormattedMessage id=\"checkoutless.statistics.day\" />,\n },\n {\n value: 'm',\n label: <FormattedMessage id=\"checkoutless.statistics.month\" />,\n },\n {\n value: 'y',\n label: <FormattedMessage id=\"checkoutless.statistics.year\" />,\n },\n ]}\n value={filters?.visualization}\n onChange={(e: any) => {\n setFilters({\n ...filters,\n visualization: e.target.value,\n })\n onSubmitFilters(e.target.value)\n }}\n />\n </div>\n {loading && (\n <div className={styles.containerLoader}>\n <Spinner />\n </div>\n )}\n <div className={styles.chart}>\n <div className={styles.chartContainer}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <LineChart\n width={1000}\n height={500}\n data={graphicInfo}\n margin={{\n top: 20,\n right: 30,\n left: 20,\n bottom: 5,\n }}\n >\n <CartesianGrid strokeDasharray=\"3 3\" />\n <XAxis dataKey=\"name\" />\n <YAxis />\n <Tooltip />\n <Legend />\n <Line\n type=\"monotone\"\n dataKey=\"use\"\n stroke=\"#EB5B2B\"\n activeDot={{ r: 8 }}\n />\n <Line type=\"monotone\" dataKey=\"previous\" stroke=\"#284859\" />\n </LineChart>\n </ResponsiveContainer>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\nexport default GraphicStatistics\n\n```" } ]
code_mycheckout-store-framework_a65de140
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/statistics/OptionsMessage.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { FormattedMessage } from 'react-intl'\n\nexport const OptionsMessage = () => {\n return (\n <div className=\"dn\">\n <FormattedMessage id=\"checkoutless.statistics.filter.select\" />\n <FormattedMessage id=\"checkoutless.statistics.filter.today\" />\n <FormattedMessage id=\"checkoutless.statistics.filter.yesterday\" />\n <FormattedMessage id=\"checkoutless.statistics.filter.lastWeek\" />\n <FormattedMessage id=\"checkoutless.statistics.filter.lastMonth\" />\n <FormattedMessage id=\"checkoutless.statistics.filter.person\" />\n </div>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_4aa957d7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/statistics/Statistics.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { Layout, PageHeader, PageBlock } from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\n\nimport StatisticType from './SelectStatistic'\nimport Filters from './FiltersDates'\nimport GraphicStatistics from './GraphicStatistics'\n\nconst Statistics = () => {\n return (\n <Layout\n fullWidth\n pageHeader={\n <PageHeader\n title={<FormattedMessage id=\"checkoutless.statistics.title\" />}\n />\n }\n >\n <PageBlock variation=\"full\">\n <h5>\n + <FormattedMessage id=\"checkoutless.statistics.subtitle\" />\n </h5>\n <Filters />\n <StatisticType />\n <GraphicStatistics />\n </PageBlock>\n </Layout>\n )\n}\n\nexport default Statistics\n\n```" } ]
code_mycheckout-store-framework_be6fa71a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/statistics/FiltersDates.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-restricted-imports */\nimport React, { useEffect, useMemo, useState } from 'react'\nimport { Dropdown, DatePicker } from 'vtex.styleguide'\nimport { FormattedMessage, useIntl } from 'react-intl'\nimport { pathOr } from 'ramda'\n\nimport styles from '../../styles.css'\nimport dateIcon from '../../assets/icons/outline-today.svg'\nimport arrowDown from '../../assets/icons/arrow_down.svg'\nimport {\n getDateIntoOptionValue,\n formatCurrentDayPicker,\n} from '../../utils/utilsStatistics'\nimport { OptionsMessage } from './OptionsMessage'\nimport { useStatisticsContext } from './index'\n\nconst Filters = () => {\n const intl = useIntl()\n const selectOptions = [\n {\n label: intl.formatMessage({\n id: 'checkoutless.statistics.filter.select',\n }),\n value: '',\n },\n {\n label: intl.formatMessage({ id: 'checkoutless.statistics.filter.today' }),\n value: 'today',\n },\n {\n label: intl.formatMessage({\n id: 'checkoutless.statistics.filter.yesterday',\n }),\n value: 'yesterday',\n },\n {\n label: intl.formatMessage({\n id: 'checkoutless.statistics.filter.lastWeek',\n }),\n value: 'lastWeek',\n },\n {\n label: intl.formatMessage({\n id: 'checkoutless.statistics.filter.lastMonth',\n }),\n value: 'lastMonth',\n },\n {\n label: intl.formatMessage({\n id: 'checkoutless.statistics.filter.person',\n }),\n value: 'person',\n },\n ]\n\n const {\n filters,\n setFilters,\n onSubmitFilters,\n setChecked: setCompare,\n checked: compare,\n setFirstPicker,\n setSecondPicker,\n setThirdPicker,\n setFourPicker,\n setFirstSelectOption,\n setSecondSelectOption,\n } = useStatisticsContext()\n\n const [open, setOpen] = useState(false)\n\n const [optionFirstValue, setOptionFirstValue] = useState('')\n const [initialFirstPicker, setInitialFirstPicker] = useState(new Date())\n const [finalFirstPicker, setFinalFirstPicker] = useState(new Date())\n\n const [optionSecondValue, setOptionSecondValue] = useState('')\n const [initialSecondPicker, setInitialSecondPicker] = useState(new Date())\n const [finalSecondPicker, setFinalSecondPicker] = useState(new Date())\n\n const currentDate = useMemo(() => new Date().toLocaleDateString(), [])\n\n const [onPreviousFrom, setOnPreviousFrom] = useState<any>()\n const [onPreviousUntil, setOnPreviousUntil] = useState<any>()\n\n const [onSelectedFrom, setOnSelectedFrom] = useState<any>()\n const [onSelectedUntil, setOnSelectedUntil] = useState<any>()\n\n const onHandleState = () => {\n setOpen(!open)\n setOnPreviousFrom(formatCurrentDayPicker(new Date()))\n }\n\n useEffect(() => {\n const parse = getDateIntoOptionValue(\n optionSecondValue,\n initialSecondPicker,\n finalSecondPicker\n )\n\n setOnPreviousFrom(pathOr(new Date(), ['initial'], parse))\n setOnPreviousUntil(pathOr(new Date(), ['final'], parse))\n setFilters({\n ...filters,\n previousFrom: pathOr(new Date(), ['initial'], parse),\n previousUntil: pathOr(new Date(), ['final'], parse),\n })\n }, [optionSecondValue, initialSecondPicker, finalSecondPicker])\n\n useEffect(() => {\n const parse = getDateIntoOptionValue(\n optionFirstValue,\n initialFirstPicker,\n finalFirstPicker\n )\n\n setOnSelectedFrom(pathOr(new Date(), ['initial'], parse))\n setOnSelectedUntil(pathOr(new Date(), ['final'], parse))\n setFilters({\n ...filters,\n selectedFrom: pathOr(new Date(), ['initial'], parse),\n selectedUntil: pathOr(new Date(), ['final'], parse),\n })\n }, [optionFirstValue, initialFirstPicker, finalFirstPicker])\n\n useEffect(() => {\n setFirstPicker(initialFirstPicker)\n }, [initialFirstPicker])\n\n useEffect(() => {\n setSecondPicker(finalFirstPicker)\n }, [finalFirstPicker])\n\n useEffect(() => {\n setThirdPicker(initialSecondPicker)\n }, [initialSecondPicker])\n\n useEffect(() => {\n setFourPicker(finalSecondPicker)\n }, [finalSecondPicker])\n\n useEffect(() => {\n setFirstSelectOption(optionFirstValue)\n }, [optionFirstValue])\n\n useEffect(() => {\n setSecondSelectOption(optionSecondValue)\n }, [optionSecondValue])\n\n return (\n <>\n <div className=\"flex\">\n <img src={dateIcon} alt=\"date-icon\" className={styles.dateIcon} />\n <button onClick={onHandleState} className={styles.btnFilters}>\n {currentDate}\n <img src={arrowDown} alt=\"arrow-down\" className={styles.arrowDown} />\n </button>\n </div>\n <div className={open ? `${styles.containerFilters}` : `${styles.hidden}`}>\n <div>\n <OptionsMessage />\n <div className=\"mb5\">\n <Dropdown\n label={<FormattedMessage id=\"checkoutless.statistics.period\" />}\n size=\"small\"\n options={selectOptions}\n value={optionFirstValue}\n onChange={(e: any) => setOptionFirstValue(e.target.value)}\n />\n {optionFirstValue === 'person' && (\n <div\n className={`${styles.containerDatePicker} ${styles.firstContainerPicker}`}\n >\n <DatePicker\n size=\"small\"\n name=\"initialFirstPicker\"\n value={initialFirstPicker}\n onChange={(date: any) => setInitialFirstPicker(date)}\n locale=\"en-US\"\n />\n <div className=\"mr3 ml3\">_</div>\n <DatePicker\n size=\"small\"\n name=\"finalFirstPicker\"\n value={finalFirstPicker}\n onChange={(date: any) => setFinalFirstPicker(date)}\n locale=\"en-US\"\n />\n </div>\n )}\n </div>\n <div className=\"mb5\">\n <input\n type=\"checkbox\"\n onChange={() => setCompare(!compare)}\n checked={compare}\n className={styles.checkCompare}\n />\n <span className={`${styles.tagDescription} ${styles.textCompare}`}>\n <FormattedMessage id=\"checkoutless.statistics.compare\" />\n </span>\n </div>\n <div className=\"mb5\">\n <Dropdown\n label={<FormattedMessage id=\"checkoutless.statistics.period\" />}\n size=\"small\"\n disabled={!compare}\n options={selectOptions}\n value={optionSecondValue}\n onChange={(e: any) => setOptionSecondValue(e.target.value)}\n />\n {optionSecondValue === 'person' && (\n <div\n className={`${styles.containerDatePicker} ${styles.secondContainerPicker}`}\n >\n <DatePicker\n size=\"small\"\n name=\"initialSecondPicker\"\n value={initialSecondPicker}\n onChange={(date: any) => setInitialSecondPicker(date)}\n locale=\"en-US\"\n />\n <div className=\"mr3 ml3\">_</div>\n <DatePicker\n size=\"small\"\n name=\"finalSecondPicker\"\n value={finalSecondPicker}\n onChange={(date: any) => setFinalSecondPicker(date)}\n locale=\"en-US\"\n />\n </div>\n )}\n </div>\n </div>\n <button\n className={styles.btnAccept}\n onClick={() => {\n onSubmitFilters(\n filters.visualization,\n onSelectedFrom,\n onSelectedUntil,\n onPreviousFrom,\n onPreviousUntil\n )\n onHandleState()\n }}\n >\n <FormattedMessage id=\"checkoutless.statistics.accept\" />\n </button>\n <button onClick={onHandleState} className={styles.btnCancel}>\n <FormattedMessage id=\"checkoutless.statistics.cancel\" />\n </button>\n </div>\n </>\n )\n}\n\nexport default Filters\n\n```" } ]
code_mycheckout-store-framework_02bf9116
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/statistics/SelectStatistic.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport React from 'react'\nimport { FormattedMessage } from 'react-intl'\n\nimport { useStatisticsContext, Statistic } from './index'\nimport buttonUseIcon from '../../assets/icons/button_use.svg'\nimport buttonUseIconActive from '../../assets/icons/use_button_active.svg'\nimport shoppingIcon from '../../assets/icons/shopping.svg'\nimport shoppingIconActive from '../../assets/icons/shopping_active.svg'\nimport conversionIcon from '../../assets/icons/conversion_rate.svg'\nimport conversionIconActive from '../../assets/icons/conversion_rate_active.svg'\nimport ticketIcon from '../../assets/icons/ticket_average.svg'\nimport ticketActiveIcon from '../../assets/icons/ticket_average_active.svg'\nimport styles from '../../styles.css'\n\nconst StatisticItem = ({\n isActive,\n onClick,\n type,\n label,\n Icon,\n IconActive,\n}: {\n isActive: boolean\n onClick: (type: Statistic) => void\n type: Statistic\n label: any\n Icon: any\n IconActive: any\n}) => {\n return (\n <div\n className={`${isActive && styles.selectedCard}`}\n onClick={() => onClick(type)}\n >\n <small>\n <img src={isActive ? IconActive : Icon} alt=\"button-use\" />\n {label}\n </small>\n </div>\n )\n}\n\nconst StatisticType = () => {\n const { statisticSelected, setStadisticsSelected } =\n useStatisticsContext() as any\n\n return (\n <div className={styles.containerMetrics}>\n <StatisticItem\n isActive={statisticSelected === Statistic.buttonUse}\n label={\n <FormattedMessage id=\"checkoutless.statistics.admin.useButton\" />\n }\n type={Statistic.buttonUse}\n onClick={setStadisticsSelected}\n Icon={buttonUseIcon}\n IconActive={buttonUseIconActive}\n />\n <StatisticItem\n isActive={statisticSelected === Statistic.checkout}\n label={<FormattedMessage id=\"checkoutless.statistics.checkout\" />}\n type={Statistic.checkout}\n onClick={setStadisticsSelected}\n Icon={shoppingIcon}\n IconActive={shoppingIconActive}\n />\n <StatisticItem\n isActive={statisticSelected === Statistic.conversionRate}\n label={<FormattedMessage id=\"checkoutless.statistics.conversion\" />}\n type={Statistic.conversionRate}\n onClick={setStadisticsSelected}\n Icon={conversionIcon}\n IconActive={conversionIconActive}\n />\n <StatisticItem\n isActive={statisticSelected === Statistic.ticketAverage}\n label={<FormattedMessage id=\"checkoutless.statistics.ticket\" />}\n type={Statistic.ticketAverage}\n onClick={setStadisticsSelected}\n Icon={ticketIcon}\n IconActive={ticketActiveIcon}\n />\n </div>\n )\n}\n\nexport default StatisticType\n\n```" } ]
code_mycheckout-store-framework_1d7ea9b1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nimport { StyleSettingsProvider } from './hooks'\nimport { Preview, Menu } from './components'\nimport styles from './styles.css'\n\nconst StyleSettings = () => {\n return (\n <StyleSettingsProvider>\n <div className={styles.StyleSettingsContainer}>\n <div className={styles.StyleSettingsContent}>\n <div className={styles.StyleSettingsPreview}>\n <Preview />\n </div>\n\n <div className={styles.StyleSettingsMenu}>\n <Menu />\n </div>\n </div>\n </div>\n </StyleSettingsProvider>\n )\n}\n\nexport default StyleSettings\n\n```" } ]
code_mycheckout-store-framework_d7db2744
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/styles.css from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.StyleSettingsContainer {\n background-color: #f2f4f5;\n padding: 26px;\n margin-right: 300px;\n min-height: 100vh;\n}\n\n.StyleSettingsContent {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n align-items: flex-start;\n height: 100%;\n}\n\n.StyleSettingsPreview {\n align-items: center;\n display: flex;\n flex-direction: column;\n justify-content: center;\n width: 100%;\n}\n\n.StyleSettingsMenu {\n background: #fff;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n width: 300px;\n}\n```" } ]
code_mycheckout-store-framework_4a3f35e3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/utils.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { AddButonStyleArgs } from './interfaces'\n\nexport const setStyles = (\n element: Element,\n styles: Array<{ name: string; value: string }>\n) => {\n let stylesToString = ''\n\n const lastStyles = element\n .getAttribute('style')\n ?.split(';')\n .map((elementStyle) => {\n const [name, value] = elementStyle?.split(':')\n\n return {\n name,\n value,\n }\n })\n\n styles.forEach(({ name, value }) => (stylesToString += `${name}:${value};`))\n\n lastStyles?.forEach(({ name, value }) => {\n const exist = !!styles?.find((style) => style.name === name)?.name\n\n if (!exist && name) {\n stylesToString += `${name}:${value};`\n }\n })\n\n element.setAttribute('style', stylesToString)\n}\n\nexport const setStylesButton = (\n element: Element,\n styles: AddButonStyleArgs\n) => {\n const {\n backgroundColor,\n borderRadius,\n outlineColor,\n textColor,\n font,\n width,\n } = styles\n\n const stylesArgs = [\n { name: 'background-color', value: backgroundColor },\n { name: 'border-radius', value: `${borderRadius}px` },\n { name: 'border', value: `solid 1px ${outlineColor}` },\n { name: 'color', value: textColor },\n { name: 'width', value: `${width}%` },\n ]\n\n if (font) stylesArgs.push({ name: 'font-family', value: font })\n if (borderRadius) {\n stylesArgs.push({\n name: 'border-radius',\n value: `${borderRadius}px`,\n })\n }\n\n setStyles(element, stylesArgs)\n}\n\nexport const addButtonEvent = (\n event: string,\n element: Element,\n styles: AddButonStyleArgs\n) => element.addEventListener(event, () => setStylesButton(element, styles))\n\n```" } ]
code_mycheckout-store-framework_ddc84e0f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/constants.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { IStyleSettings } from './interfaces'\n\nconst defaultButtonText = ''\nconst defaultFont = '\"Calibri\", sans-serif'\nconst defaultRadio = 8\n\nexport const fonts = {\n sansSerifFamily: [\n 'SANS SERIF',\n 'Helvetica',\n 'Arial',\n 'Verdana',\n 'Tahoma',\n 'Open Sans',\n ],\n serifFamily: [\n 'SERIF',\n 'Times New Roman',\n 'Georgia',\n 'Garamond',\n 'Lora',\n 'PT Serif',\n ],\n}\n\nexport const defaultStyleSettingState: IStyleSettings = {\n modalStyles: {\n font: defaultFont,\n button: {\n borderRadius: defaultRadio,\n normal: {\n textColor: '#FFFFFF',\n backgroundColor: '#EB5B2B',\n outlineColor: '#EB5B2B',\n },\n hover: {\n textColor: '#FFFFFF',\n backgroundColor: '#F47146',\n outlineColor: '#EB5B2B',\n },\n },\n icons: {\n color: '#222326',\n },\n backgroundColor: '#FFFFFF',\n },\n buttonStyles: {\n font: 'Helvetica',\n value: defaultButtonText,\n borderRadius: defaultRadio,\n normal: {\n textColor: '#FF572D',\n backgroundColor: '#FFFFFF',\n outlineColor: '#1B998B',\n },\n hover: {\n textColor: '#FF572D',\n backgroundColor: '#FFFFFF',\n outlineColor: '#1B998B',\n },\n width: 100,\n },\n}\n\n```" } ]
code_mycheckout-store-framework_24435b23
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/interfaces.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { Dispatch } from 'react'\n\nexport type Device = 'mobile' | 'desktop'\n\nexport type CustomizableComponent = 'modal' | 'payButton'\n\nexport type TypeColorStyle =\n | 'normal_text'\n | 'normal_background'\n | 'normal_outline'\n | 'hover_text'\n | 'hover_background'\n | 'hover_outline'\nexport interface ColorStyles {\n textColor: string\n backgroundColor: string\n outlineColor: string\n}\n\ninterface ModalButton {\n borderRadius: number\n normal: ColorStyles\n hover: ColorStyles\n}\n\ninterface ModalIcon {\n color: string\n}\nexport interface ModalStyles {\n font: string\n icons: ModalIcon\n backgroundColor: string\n button: ModalButton\n}\n\nexport interface PayButtonStyles {\n borderRadius: number\n font: string\n hover: ColorStyles\n normal: ColorStyles\n value: string\n width: number\n}\n\nexport interface IStyleSettings {\n modalStyles: ModalStyles\n buttonStyles: PayButtonStyles\n}\n\nexport interface IStyleSettingsCtx {\n alert: IAlert\n componentSelected: CustomizableComponent\n deviceSelected: Device\n loadingStyles: boolean\n state: IStyleSettings\n clearAlert: () => void\n dispatch: Dispatch<Actions>\n restoreStyles: () => Promise<void>\n setAlert: React.Dispatch<React.SetStateAction<IAlert>>\n setComponentSelected: Dispatch<React.SetStateAction<CustomizableComponent>>\n setDeviceSelected: Dispatch<React.SetStateAction<Device>>\n updateStyles: () => Promise<void>\n}\n\nexport interface IStyleSettingsQuery {\n modal: ModalStyles\n button: PayButtonStyles\n}\n\nexport interface IAlert {\n message: {\n id: string\n }\n type: 'warning' | 'error' | 'success'\n}\n\nexport interface AddButonStyleArgs {\n backgroundColor: string\n borderRadius?: number\n font?: string\n outlineColor: string\n textColor: string\n width?: number\n}\n\ntype Action<K, V = void> = V extends void ? { type: K } : { type: K } & V\n\nexport type Actions =\n | Action<'SET_PAYBUTTON_VALUE', { args: { value: string } }>\n | Action<'SET_PAYBUTTON_FONT', { args: { font: string } }>\n | Action<'SET_PAYBUTTON_RADIO', { args: { borderRadius: number } }>\n | Action<'SET_PAYBUTTON_NORMAL_TEXT_COLOR', { args: { color: string } }>\n | Action<'SET_PAYBUTTON_NORMAL_BACKGROUND_COLOR', { args: { color: string } }>\n | Action<'SET_PAYBUTTON_NORMAL_OUTLINE_COLOR', { args: { color: string } }>\n | Action<'SET_PAYBUTTON_HOVER_TEXT_COLOR', { args: { color: string } }>\n | Action<'SET_PAYBUTTON_HOVER_BACKGROUND_COLOR', { args: { color: string } }>\n | Action<'SET_PAYBUTTON_HOVER_OUTLINE_COLOR', { args: { color: string } }>\n | Action<'SET_PAYBUTTON_STYLES', { args: { styles: PayButtonStyles } }>\n | Action<'SET_PAYBUTTON_WIDTH', { args: { width: number } }>\n | Action<'SET_MODAL_FONT', { args: { font: string } }>\n | Action<'SET_MODAL_ICONS_COLOR', { args: { iconsColor: string } }>\n | Action<'SET_MODAL_BACKGROUND_COLOR', { args: { backgroundColor: string } }>\n | Action<'SET_MODAL_RADIO', { args: { borderRadiusBtn: number } }>\n | Action<'SET_MODAL_BTN_NORMAL_TEXT_COLOR', { args: { color: string } }>\n | Action<'SET_MODAL_BTN_NORMAL_BACKGROUND_COLOR', { args: { color: string } }>\n | Action<'SET_MODAL_BTN_NORMAL_OUTLINE_COLOR', { args: { color: string } }>\n | Action<'SET_MODAL_BTN_HOVER_TEXT_COLOR', { args: { color: string } }>\n | Action<'SET_MODAL_BTN_HOVER_BACKGROUND_COLOR', { args: { color: string } }>\n | Action<'SET_MODAL_BTN_HOVER_OUTLINE_COLOR', { args: { color: string } }>\n | Action<'SET_MODAL_STYLES', { args: { styles: ModalStyles } }>\n\n```" } ]
code_mycheckout-store-framework_b57ba6bf
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/PaymentList/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\n/* eslint-disable no-restricted-imports */\nimport React, { useEffect, useState, createContext } from 'react'\nimport {\n Layout,\n PageBlock,\n PageHeader,\n Table,\n Alert,\n Toggle,\n} from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\nimport { useQuery, useMutation } from 'react-apollo'\nimport { pathOr, uniqBy } from 'ramda'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport GET_PAYMENTS from '../../graphql/getPayments.graphql'\nimport CREATE_PAYMENTS from '../../graphql/createPaymentMethod.graphql'\nimport GET_LIST_PAYMENTS from '../../graphql/getListPayments.graphql'\nimport type { IPaymentRules, IPayment, PaymentListContext } from './interfaces'\nimport { kuikpayPayments } from './constants'\n\nconst paymentListContext = createContext<PaymentListContext | null>(null)\n\nexport const defaultSchema = {\n properties: {\n payment: {\n title: <FormattedMessage id=\"checkoutless.paymentsList.table.name\" />,\n },\n isActive: {\n title: <FormattedMessage id=\"checkoutless.paymentsList.table.status\" />,\n cellRenderer: ({\n rowData,\n }: {\n cellData: string\n rowData: { isActive: boolean }\n }) => {\n return (\n <paymentListContext.Consumer>\n {(value) => (\n <Toggle\n checked={rowData?.isActive}\n onChange={() => {\n value?.onChangeState(rowData)\n }}\n />\n )}\n </paymentListContext.Consumer>\n )\n },\n },\n type: {\n title: <FormattedMessage id=\"checkoutless.paymentsList.table.origin\" />,\n },\n },\n}\n\nconst PaymentList = () => {\n const [createPayment] = useMutation(CREATE_PAYMENTS)\n const { data, loading, called } = useQuery(GET_PAYMENTS)\n const { data: listData } = useQuery(GET_LIST_PAYMENTS)\n const { account } = useRuntime()\n const [payments, setPayments] = useState<IPayment[]>([])\n const [showWarningAlert, setShowWarningAlert] = useState<boolean>(false)\n const [disabledChange, setDisabledChange] = useState<boolean>(false)\n\n useEffect(() => {\n if (data && listData) {\n const paymentsList = pathOr<any[]>([], ['getPaymentsMethods'], listData)\n const paymentsRules = uniqBy(\n (e) => pathOr('', ['paymentSystem', 'id'], e),\n [\n ...kuikpayPayments,\n ...pathOr<IPaymentRules[]>(\n [],\n ['paymentsRules', 'rules'],\n data\n ).filter(\n (ruler) => ruler.enabled && ruler?.paymentSystem?.name !== 'Kuikpay'\n ),\n ]\n ).map((ruler) => {\n const payment = paymentsList.find(\n (p) =>\n p?.paymentMethodName === pathOr('', ['paymentSystem', 'id'], ruler)\n )\n\n return {\n id: pathOr('', ['id'], payment),\n paymentMethodName: pathOr('', ['paymentSystem', 'id'], ruler),\n payment: pathOr('', ['paymentSystem', 'name'], ruler),\n isActive: pathOr(true, ['isActive'], payment),\n type: pathOr((ruler as any)?.type || 'store', ['type'], payment),\n accountName: account,\n }\n })\n\n setPayments(paymentsRules)\n }\n }, [data, account, listData])\n\n useEffect(() => {\n if (payments.length && called) {\n const elements = payments.filter((payment) => payment.isActive)\n\n setDisabledChange(elements.length === 1)\n }\n }, [payments, called])\n\n useEffect(() => {\n if (payments && payments.length) {\n const paymentWithoutId = payments.filter((p) => !p?.id)\n\n if (!paymentWithoutId.length) return\n const newPayments = Object.assign(payments, [])\n\n newPayments.map(async (payment) => {\n if (!payment.id) {\n const p = await createPayment({\n variables: {\n ...payment,\n },\n })\n\n payment.id = pathOr('', ['data', 'createPaymentMethod', 'id'], p)\n }\n\n return payment\n })\n setPayments(newPayments)\n }\n }, [payments])\n\n const onChangeState = (element: IPayment) => {\n const index = payments.findIndex((payment) => payment.id === element.id)\n const lPayments: any = Object.assign([], payments)\n\n if (index !== -1) {\n lPayments[index].isActive = !element.isActive\n const peyment = lPayments[index]\n\n delete peyment?.peyment\n createPayment({\n variables: {\n ...peyment,\n },\n })\n setPayments(lPayments)\n }\n }\n\n const onShowAlert = () => setShowWarningAlert(true)\n\n return (\n <paymentListContext.Provider\n value={{ onChangeState, disabledChange, onShowAlert }}\n >\n <Layout\n pageHeader={\n <PageHeader\n title={<FormattedMessage id=\"checkoutless.paymentsList.title\" />}\n />\n }\n >\n <PageBlock variation=\"full\">\n {showWarningAlert && (\n <div className=\"mb5\">\n <Alert autoClose={5000} type=\"warning\">\n <FormattedMessage id=\"checkoutless.paymentsList.table.warning\" />\n </Alert>\n </div>\n )}\n <Alert autoClose={5000} type=\"success\">\n <FormattedMessage id=\"checkoutless.paymentsList.auto-save\" />\n </Alert>\n <Table\n fullWidth\n schema={defaultSchema}\n items={payments}\n loading={loading}\n />\n </PageBlock>\n </Layout>\n </paymentListContext.Provider>\n )\n}\n\nexport default PaymentList\n\n```" } ]
code_mycheckout-store-framework_4e6144ed
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/PaymentList/constants.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const kuikpayPayments = [\n {\n name: 'Orion',\n paymentSystem: {\n name: 'Orion',\n id: 'Orion',\n },\n type: 'own',\n enabled: true,\n },\n]\n\n```" } ]
code_mycheckout-store-framework_85f7b660
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/PaymentList/interfaces.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport interface IPaymentSystem {\n name: string\n}\n\nexport interface ISalesChannels {\n id: string\n}\n\nexport interface IPaymentRules {\n enabled: boolean\n id: string\n name: string\n paymentSystem: IPaymentSystem\n salesChannels: ISalesChannels[]\n}\n\nexport interface IPayment {\n id: string\n paymentMethodName: string\n isActive: boolean\n type: string\n accountName: string\n}\n\nexport interface PaymentListContext {\n onChangeState: (index: any) => void\n disabledChange: boolean\n onShowAlert: () => void\n}\n\n```" } ]
code_mycheckout-store-framework_7c426736
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/categories/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { AutocompleteInput, Table, Tag } from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\n\nimport { useHandleCategories } from './useHandleCategories'\n\n// eslint-disable-next-line react/prop-types\nconst Categories = ({ visualization, onChange }: any) => {\n const { hidde, input, options, onHandle } = useHandleCategories(\n visualization,\n onChange\n )\n\n return (\n <div>\n <h3>\n <FormattedMessage id=\"checkoutless.categories.title\" />\n </h3>\n <p className=\"lh-copy c-muted-1\">\n <FormattedMessage id=\"checkoutless.categories.description\" />\n </p>\n <div>\n <AutocompleteInput input={input} options={options} />\n </div>\n <div>\n <Table\n fullWidth\n schema={{\n properties: {\n id: {\n title: (\n <FormattedMessage id=\"checkoutless.categories.table.id\" />\n ),\n },\n name: {\n title: (\n <FormattedMessage id=\"checkoutless.categories.table.name\" />\n ),\n },\n type: {\n title: (\n <FormattedMessage id=\"checkoutless.categories.table.type\" />\n ),\n cellRenderer: ({\n rowData,\n }: {\n cellData: string\n rowData: { type: string }\n }) => <Tag bgColor=\"#00bbd4\">{rowData?.type}</Tag>,\n },\n },\n }}\n items={hidde}\n lineActions={[\n {\n // eslint-disable-next-line react/display-name\n label: () => (\n <FormattedMessage id=\"checkoutless.categories.table.active\" />\n ),\n onClick: ({ rowData }: any) => onHandle(rowData),\n },\n ]}\n />\n </div>\n </div>\n )\n}\n\nexport default Categories\n\n```" } ]
code_mycheckout-store-framework_40265d9d
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/categories/useHandleCategories.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* eslint-disable react-hooks/exhaustive-deps */\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { useQuery } from 'react-apollo'\n// eslint-disable-next-line no-restricted-imports\nimport { pathOr, take } from 'ramda'\n\nimport GET_CATEGORIES from '../../graphql/getCategories.graphql'\nimport { onRemoveReference } from './utils'\n\nexport const useHandleCategories = (\n visualization: any[],\n onChange: (element: any[]) => void\n) => {\n const { data } = useQuery(GET_CATEGORIES)\n const [categories, setCategories] = useState<any[]>([])\n const [hidde, setHiddeElement] = useState<any[]>([])\n const [term, setTerm] = useState('')\n const [loading, setLoading] = useState(false)\n\n const timeoutRef = useRef<any>(null)\n\n const value = useMemo(\n () =>\n take(\n 10,\n categories\n .filter(\n (category) =>\n category.label.toLowerCase().includes(term.toLowerCase()) ||\n category.id.toLowerCase().includes(term.toLowerCase())\n )\n .reverse()\n ),\n [categories, term]\n )\n\n const onHandle = useCallback(\n (element: any) => {\n const index = hidde.findIndex((h: any) => h?.id === element?.id)\n const localHidde = onRemoveReference(hidde)\n\n if (index === -1) {\n localHidde.push(element)\n } else {\n localHidde.splice(index, 1)\n }\n\n setHiddeElement(localHidde)\n },\n [hidde]\n )\n\n const options = {\n onSelect: (args: any) => {\n onHandle(args)\n setTerm('')\n },\n loading,\n value,\n }\n\n const input = {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n onChange: (term: any) => {\n if (term) {\n setLoading(true)\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n }\n\n timeoutRef.current = setTimeout(() => {\n setLoading(false)\n setTerm(term)\n timeoutRef.current = null\n }, 1000)\n } else {\n setTerm(term)\n }\n },\n onClear: () => setTerm(''),\n placeholder: 'Search category... (e.g.: Technology)',\n value: term,\n }\n\n useEffect(() => {\n onChange(\n hidde.map((h) => ({\n key: h?.value,\n type: 'category',\n }))\n )\n }, [hidde])\n\n useEffect(() => {\n if (data) {\n const element: any[] = []\n const forceHidden: any[] = []\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const categories = pathOr<any[]>([], ['getCategories'], data)\n const onRecursive = (item: any, tree?: string) => {\n if (item.children && item.children.length) {\n item.children.map((child: any) => {\n return onRecursive(child, `${tree}/${child.name}`)\n })\n }\n\n element.push({\n ...item,\n label: item?.name,\n value: `${tree}/`,\n type: 'Category',\n })\n }\n\n categories.map((category) => {\n return onRecursive(category, `/${category?.name}`)\n })\n // eslint-disable-next-line array-callback-return\n visualization.map((v) => {\n const e = element.find((f) => f?.value === v?.key)\n\n if (e) forceHidden.push(e)\n })\n setHiddeElement(forceHidden)\n setCategories(element)\n }\n }, [data, visualization])\n\n return useMemo(\n () => ({\n options,\n input,\n hidde,\n onHandle,\n }),\n [options, input, hidde, onHandle]\n )\n}\n\n```" } ]
code_mycheckout-store-framework_f80c47d2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/categories/utils.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport const onRemoveReference = (element: any) =>\n JSON.parse(JSON.stringify(element))\n\n```" } ]
code_mycheckout-store-framework_c5ae0c83
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/statistics/default/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { IFilter } from '../interfaces'\nimport { formatCurrentDay } from '../../../utils/utilsStatistics'\n\nexport const defaultFilters: IFilter = {\n visualization: 'd',\n selectedFrom: formatCurrentDay(new Date()),\n selectedUntil: formatCurrentDay(new Date()),\n previousUntil: new Date(),\n previousFrom: new Date(),\n}\n\n```" } ]
code_mycheckout-store-framework_cdb4529f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/statistics/interfaces/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nexport interface IFilter {\n visualization: 'd' | 'm' | 'y'\n selectedFrom: string | Date\n selectedUntil: string | Date\n previousFrom: null | Date\n previousUntil: null | Date\n}\n\n```" } ]
code_mycheckout-store-framework_3a9d538b
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/index.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport * from './Menu'\nexport * from './Preview'\nexport * from './ActionMenuLabel'\n\n```" } ]
code_mycheckout-store-framework_cbfbd81c
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/ActionMenuLabel.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { IconCheck } from 'vtex.styleguide'\n\ninterface Props {\n text: string\n selected: boolean\n}\n\nexport const ActionMenuLabel = ({ text, selected }: Props) => {\n return (\n <div style={{ display: 'flex' }}>\n <div style={{ width: 20 }}>{selected && <IconCheck />}</div>\n <div> {text}</div>\n </div>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_6e7203f3
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/hooks/usePayButtonPreview.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport { useEffect, useRef } from 'react'\n\nimport { useStyleSettings } from './context'\nimport { addButtonEvent, setStylesButton } from '../utils'\n\nconst CLASS = '_kuikpay-myCheckoutButton__myCheckoutButtonContent'\n\nexport const usePayButtonPreview = () => {\n const refPayButton = useRef(null)\n const {\n deviceSelected,\n state: { buttonStyles },\n } = useStyleSettings()\n\n useEffect(() => {\n if (refPayButton === null) return\n const { normal, borderRadius, font, width } = buttonStyles\n const payButton = document.getElementsByClassName(CLASS)\n\n setStylesButton(payButton[0], { ...normal, borderRadius, font, width })\n addButtonEvent('mouseout', payButton[0], {\n ...normal,\n borderRadius,\n font,\n width,\n })\n }, [refPayButton, buttonStyles])\n\n useEffect(() => {\n if (refPayButton === null) return\n const { hover, borderRadius, font, width } = buttonStyles\n const payButton = document.getElementsByClassName(CLASS)\n\n addButtonEvent('mouseover', payButton[0], {\n ...hover,\n borderRadius,\n font,\n width,\n })\n }, [refPayButton, buttonStyles.hover, buttonStyles])\n\n return { refPayButton, deviceSelected, value: buttonStyles.value }\n}\n\n```" } ]
code_mycheckout-store-framework_508ada41
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/hooks/useKuikpayModal.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\n/* eslint-disable react-hooks/exhaustive-deps */\nimport { useEffect, useRef, useState } from 'react'\n\nimport { useStyleSettings } from './context'\nimport { setStyles, setStylesButton, addButtonEvent } from '../utils'\nimport styles from '../components/Preview/Body/styles.css'\n\nconst CLASS_MODAL_CONTAINER = '_kuikpay-modal__modalContainer'\nconst CLASS_CHECKOUTLESS = '_kuikpay-myCheckout-styles-module__Checkoutless'\nconst CLASS_BUY_BUTTON = '_kuikpay-myCheckout-styles-module__buyButtonContainer'\nconst CLASS_ICONS = '_kuikpay-myCheckout-styles-module__iconAlternative'\nconst NEW_CLASS_ICONS = '_kuikpay-myCheckout-styles-module__iconAlternative'\nconst CLASS_BUTTONS = '_kuikpay-button__buttonContainer'\nconst CLASS_BUY_BUTTONS = '_kuikpay-button__buttonContainer'\nconst CLASS_MODAL_INPUTS = '_kuikpay-input__input'\nconst CLASS_STROKE_ICON =\n '_kuikpay-myCheckout-styles-module__strokeCheckiconAlternative'\n\nconst CLASS_SUMMARY_CONTAINER = '_kuikpay-summary-modules__summaryContainer'\n\nexport const useKuikpayModal = () => {\n const refModal = useRef(null)\n const [iconsClass, setIconsClass] = useState('')\n const {\n deviceSelected,\n state: { modalStyles },\n } = useStyleSettings()\n\n const isMobile = deviceSelected === 'mobile'\n\n useEffect(() => {\n if (refModal === null) return\n const checkoutless = document.getElementsByClassName(CLASS_CHECKOUTLESS)\n const buyButton = document.getElementsByClassName(CLASS_BUY_BUTTON)\n const iconsContainer = document.getElementsByClassName(CLASS_ICONS)\n const modalContainer = document.getElementsByClassName(\n CLASS_MODAL_CONTAINER\n )\n\n modalContainer[0].classList.add(styles.modalPositionContainer)\n checkoutless[0].classList.add(styles.modalCheckoutlessHeight)\n buyButton[0].classList.add(styles.modalBuyButtonPosition)\n\n const iconsContainerArray = Array.from(iconsContainer)\n\n iconsContainerArray.forEach((element) =>\n element.classList.replace(CLASS_ICONS, NEW_CLASS_ICONS)\n )\n\n setIconsClass(NEW_CLASS_ICONS)\n }, [refModal])\n\n useEffect(() => {\n if (refModal === null) return\n const { backgroundColor } = modalStyles\n const modalContainer = document.getElementsByClassName(\n CLASS_MODAL_CONTAINER\n )\n\n const modalInputs = document.getElementsByClassName(CLASS_MODAL_INPUTS)\n const summaryContainer = document.getElementsByClassName(\n CLASS_SUMMARY_CONTAINER\n )\n\n const buyButton = document.getElementsByClassName(CLASS_BUY_BUTTON)\n\n const modalContainerArray = Array.from(modalContainer)\n const modalInputsArray = Array.from(modalInputs)\n const summaryContainerArray = Array.from(summaryContainer)\n const buyButtonArray = Array.from(buyButton)\n const modalElementArray = [\n ...modalContainerArray,\n ...modalInputsArray,\n ...summaryContainerArray,\n ...buyButtonArray,\n ]\n\n modalElementArray.forEach((element) =>\n setStyles(element, [{ name: 'background-color', value: backgroundColor }])\n )\n }, [refModal, modalStyles.backgroundColor])\n\n useEffect(() => {\n if (refModal === null || !iconsClass) return\n const { icons } = modalStyles\n const iconsContainer = document.getElementsByClassName(iconsClass)\n const strokeIconContainer =\n document.getElementsByClassName(CLASS_STROKE_ICON)\n\n const iconsContainerArray = Array.from(iconsContainer)\n const strokeIconsContainerArray = Array.from(strokeIconContainer)\n\n strokeIconsContainerArray.forEach((element) =>\n setStyles(element, [{ name: 'stroke', value: icons.color }])\n )\n\n iconsContainerArray.forEach((element) =>\n setStyles(element, [{ name: 'fill', value: icons.color }])\n )\n }, [refModal, modalStyles.icons.color, iconsClass])\n\n useEffect(() => {\n if (refModal === null) return\n const { font } = modalStyles\n\n const fontDiv = document.querySelectorAll(`.${CLASS_CHECKOUTLESS} div`)\n const fontP = document.querySelectorAll(`.${CLASS_CHECKOUTLESS} p`)\n const fontA = document.querySelectorAll(`.${CLASS_CHECKOUTLESS} select`)\n const fontInput = document.querySelectorAll(`.${CLASS_CHECKOUTLESS} input`)\n const fontSelect = document.querySelectorAll(\n `.${CLASS_CHECKOUTLESS} select`\n )\n\n const fontDivArray = Array.from(fontDiv)\n const fontPArray = Array.from(fontP)\n const fontAArray = Array.from(fontA)\n const fontInputArray = Array.from(fontInput)\n const fontSelectArray = Array.from(fontSelect)\n const fontArray = [\n ...fontDivArray,\n ...fontPArray,\n ...fontAArray,\n ...fontInputArray,\n ...fontSelectArray,\n ]\n\n if (fontArray.length) {\n fontArray.forEach((element) =>\n setStyles(element, [{ name: 'font-family', value: font }])\n )\n }\n }, [refModal, modalStyles.font])\n\n useEffect(() => {\n if (refModal === null) return\n const {\n button: { normal, borderRadius },\n } = modalStyles\n\n const buttons = document.getElementsByClassName(CLASS_BUTTONS)\n const buyButton = document.getElementsByClassName(CLASS_BUY_BUTTONS)\n\n const buttonsArray = Array.from(buttons)\n const buyButtonArray = Array.from(buyButton)\n const buttonsConcat = [...buttonsArray, ...buyButtonArray]\n\n buttonsConcat.forEach((element) => {\n setStylesButton(element, { ...normal, borderRadius })\n addButtonEvent('mouseout', element, { ...normal, borderRadius })\n })\n }, [refModal, modalStyles.button.normal, modalStyles.button.borderRadius])\n\n useEffect(() => {\n if (refModal === null) return\n const {\n button: { hover, borderRadius },\n } = modalStyles\n\n const buttons = document.getElementsByClassName(CLASS_BUTTONS)\n const buyButton = document.getElementsByClassName(CLASS_BUY_BUTTONS)\n\n const buttonsArray = Array.from(buttons)\n const buyButtonArray = Array.from(buyButton)\n const buttonsConcat = [...buttonsArray, ...buyButtonArray]\n\n buttonsConcat.forEach((element) => {\n addButtonEvent('mouseover', element, { ...hover, borderRadius })\n })\n }, [refModal, modalStyles.button.hover, modalStyles.button.borderRadius])\n\n return { refModal, isMobile }\n}\n\n```" } ]
code_mycheckout-store-framework_b63b73fa
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/hooks/usePayButtonMenu.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { TypeColorStyle } from '../interfaces'\nimport { useStyleSettings } from './context'\n\nexport const usePayButtonMenu = () => {\n const {\n state: {\n buttonStyles: {\n borderRadius,\n font,\n hover: hoverStyles,\n normal: normalStyles,\n value: valueButton,\n width,\n },\n },\n dispatch,\n } = useStyleSettings()\n\n const handleNameAction = (value: string) =>\n dispatch({ type: 'SET_PAYBUTTON_VALUE', args: { value } })\n\n const handleFontAction = (fontValue: string) =>\n dispatch({ type: 'SET_PAYBUTTON_FONT', args: { font: fontValue } })\n\n const handleBorderRadiusAction = (radio: number) =>\n dispatch({ type: 'SET_PAYBUTTON_RADIO', args: { borderRadius: radio } })\n\n const handleWidthAction = (value: number) =>\n dispatch({ type: 'SET_PAYBUTTON_WIDTH', args: { width: value } })\n\n const handleButtonStyleAction = (type: TypeColorStyle, color: string) => {\n switch (type) {\n case 'normal_text':\n dispatch({\n type: 'SET_PAYBUTTON_NORMAL_TEXT_COLOR',\n args: { color },\n })\n break\n\n case 'normal_background':\n dispatch({\n type: 'SET_PAYBUTTON_NORMAL_BACKGROUND_COLOR',\n args: { color },\n })\n break\n\n case 'normal_outline':\n dispatch({\n type: 'SET_PAYBUTTON_NORMAL_OUTLINE_COLOR',\n args: { color },\n })\n break\n\n case 'hover_text':\n dispatch({\n type: 'SET_PAYBUTTON_HOVER_TEXT_COLOR',\n args: { color },\n })\n break\n\n case 'hover_background':\n dispatch({\n type: 'SET_PAYBUTTON_HOVER_BACKGROUND_COLOR',\n args: { color },\n })\n break\n\n case 'hover_outline':\n dispatch({\n type: 'SET_PAYBUTTON_HOVER_OUTLINE_COLOR',\n args: { color },\n })\n break\n\n default:\n break\n }\n }\n\n const getColorStyle = (type: TypeColorStyle) => {\n let color = ''\n\n switch (type) {\n case 'normal_text':\n color = normalStyles.textColor\n break\n\n case 'normal_background':\n color = normalStyles.backgroundColor\n break\n\n case 'normal_outline':\n color = normalStyles.outlineColor\n break\n\n case 'hover_text':\n color = hoverStyles.textColor\n break\n\n case 'hover_background':\n color = hoverStyles.backgroundColor\n break\n\n case 'hover_outline':\n color = hoverStyles.outlineColor\n break\n\n default:\n break\n }\n\n return color\n }\n\n return {\n borderRadius,\n font,\n valueButton,\n width,\n getColorStyle,\n handleBorderRadiusAction,\n handleButtonStyleAction,\n handleFontAction,\n handleNameAction,\n handleWidthAction,\n }\n}\n\n```" } ]
code_mycheckout-store-framework_67a6a334
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/hooks/useModalMenu.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nimport type { TypeColorStyle } from '../interfaces'\nimport { useStyleSettings } from './context'\n\nexport const useModalMenu = () => {\n const {\n state: {\n modalStyles: {\n font,\n icons: { color: iconsColor },\n backgroundColor,\n button: { borderRadius, hover: hoverStyles, normal: noramlStyles },\n },\n },\n dispatch,\n } = useStyleSettings()\n\n const handleFontAction = (fontValue: string) =>\n dispatch({ type: 'SET_MODAL_FONT', args: { font: fontValue } })\n\n const handleIconsColorAction = (color: string) =>\n dispatch({ type: 'SET_MODAL_ICONS_COLOR', args: { iconsColor: color } })\n\n const handleBorderRadiusAction = (radio: number) =>\n dispatch({ type: 'SET_MODAL_RADIO', args: { borderRadiusBtn: radio } })\n\n const handleBackgroundAction = (color: string) =>\n dispatch({\n type: 'SET_MODAL_BACKGROUND_COLOR',\n args: { backgroundColor: color },\n })\n\n const handleButtonStyleAction = (type: TypeColorStyle, color: string) => {\n switch (type) {\n case 'normal_text':\n dispatch({\n type: 'SET_MODAL_BTN_NORMAL_TEXT_COLOR',\n args: { color },\n })\n break\n\n case 'normal_background':\n dispatch({\n type: 'SET_MODAL_BTN_NORMAL_BACKGROUND_COLOR',\n args: { color },\n })\n break\n\n case 'normal_outline':\n dispatch({\n type: 'SET_MODAL_BTN_NORMAL_OUTLINE_COLOR',\n args: { color },\n })\n break\n\n case 'hover_text':\n dispatch({\n type: 'SET_MODAL_BTN_HOVER_TEXT_COLOR',\n args: { color },\n })\n break\n\n case 'hover_background':\n dispatch({\n type: 'SET_MODAL_BTN_HOVER_BACKGROUND_COLOR',\n args: { color },\n })\n break\n\n case 'hover_outline':\n dispatch({\n type: 'SET_MODAL_BTN_HOVER_OUTLINE_COLOR',\n args: { color },\n })\n break\n\n default:\n break\n }\n }\n\n const getColorStyle = (type: TypeColorStyle) => {\n let color = ''\n\n switch (type) {\n case 'normal_text':\n color = noramlStyles.textColor\n break\n\n case 'normal_background':\n color = noramlStyles.backgroundColor\n break\n\n case 'normal_outline':\n color = noramlStyles.outlineColor\n break\n\n case 'hover_text':\n color = hoverStyles.textColor\n break\n\n case 'hover_background':\n color = hoverStyles.backgroundColor\n break\n\n case 'hover_outline':\n color = hoverStyles.outlineColor\n break\n\n default:\n break\n }\n\n return color\n }\n\n return {\n font,\n iconsColor,\n backgroundColor,\n borderRadius,\n handleFontAction,\n handleIconsColorAction,\n handleBackgroundAction,\n handleBorderRadiusAction,\n handleButtonStyleAction,\n getColorStyle,\n }\n}\n\n```" } ]
code_mycheckout-store-framework_f0f40e06
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/hooks/index.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport * from './context'\nexport * from './reducer'\nexport * from './useModalMenu'\nexport * from './usePayButtonMenu'\nexport * from './usePayButtonPreview'\nexport * from './useKuikpayModal'\n\n```" } ]
code_mycheckout-store-framework_ae010621
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState } from 'react'\nimport { Button, Modal, Spinner } from 'vtex.styleguide'\nimport { messages, defineMessages, useIntl } from 'react-intl'\n\nimport { PayButtonMenu } from './PayButtonMenu'\nimport { ModalMenu } from './ModalMenu'\nimport { useStyleSettings } from '../../hooks'\nimport styles from './styles.css'\n\nconst messages = defineMessages({\n saveLabel: {\n id: 'checkoutless.button-save',\n },\n restoreLabel: {\n id: 'checkoutless.button-restore',\n },\n yesLabel: {\n id: 'checkoutless.button-yes',\n },\n cancelLabel: {\n id: 'checkoutless.button-cancel',\n },\n restoreConfirmationMessage: {\n id: 'checkoutless.styleSettings.menu-restore-confirmation-message',\n },\n updateConfirmationMessage: {\n id: 'checkoutless.styleSettings.menu-update-confirmation-message',\n },\n updateSuccessMessage: {\n id: 'checkoutless.styleSettings.success-update-styles',\n },\n restoreSuccessMessage: {\n id: 'checkoutless.styleSettings.success-restore-styles',\n },\n})\n\nexport const Menu = () => {\n const {\n componentSelected,\n updateStyles,\n restoreStyles,\n setAlert,\n loadingStyles,\n } = useStyleSettings()\n\n const { formatMessage } = useIntl()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [isLoadinConfirmBtn, setIsLoadinConfirmBtn] = useState(false)\n const [modalMessage, setModalMessage] = useState({\n title: {\n id: '',\n },\n description: {\n id: '',\n },\n })\n\n const handleCloseModal = () => setIsModalOpen(false)\n\n const handleOpenModal = (\n title: { id: string },\n description: { id: string }\n ) => {\n setModalMessage({ title, description })\n setIsModalOpen(true)\n }\n\n const handleUpdateStyles = async () => {\n setIsLoadinConfirmBtn(true)\n await updateStyles()\n setIsLoadinConfirmBtn(false)\n handleCloseModal()\n setAlert({\n message: messages.updateSuccessMessage,\n type: 'success',\n })\n }\n\n const handleRestoreStyles = async () => {\n setIsLoadinConfirmBtn(true)\n await restoreStyles()\n setIsLoadinConfirmBtn(false)\n handleCloseModal()\n setAlert({\n message: messages.restoreSuccessMessage,\n type: 'success',\n })\n }\n\n return (\n <div className={styles.menuContainer}>\n <div className={styles.settingsContainer}>\n {loadingStyles ? (\n <div className={styles.loadingContainer}>\n <Spinner />\n </div>\n ) : componentSelected === 'payButton' ? (\n <PayButtonMenu />\n ) : (\n <ModalMenu />\n )}\n </div>\n <div className={styles.buttonsContainer}>\n <div className=\"mb3\">\n <Button\n variation=\"primary\"\n onClick={() =>\n handleOpenModal(\n messages.saveLabel,\n messages.updateConfirmationMessage\n )\n }\n block\n >\n {formatMessage(messages.saveLabel)}\n </Button>\n </div>\n <div>\n <Button\n variation=\"secondary\"\n onClick={() =>\n handleOpenModal(\n messages.restoreLabel,\n messages.restoreConfirmationMessage\n )\n }\n block\n >\n {formatMessage(messages.restoreLabel)}\n </Button>\n <Modal\n isOpen={isModalOpen}\n title={modalMessage.title.id && formatMessage(modalMessage.title)}\n responsiveFullScreen\n bottomBar={\n <div className=\"nowrap\">\n <span className=\"mr4\">\n <Button variation=\"tertiary\" onClick={handleCloseModal}>\n {formatMessage(messages.cancelLabel)}\n </Button>\n </span>\n <span>\n <Button\n variation=\"primary\"\n onClick={\n modalMessage.title === messages.restoreLabel\n ? handleRestoreStyles\n : handleUpdateStyles\n }\n isLoading={isLoadinConfirmBtn}\n >\n {formatMessage(messages.yesLabel)}\n </Button>\n </span>\n </div>\n }\n onClose={handleCloseModal}\n >\n <div className=\"flex flex-column flex-row-ns\">\n {modalMessage.description.id && (\n <p>{formatMessage(modalMessage.description)}</p>\n )}\n </div>\n </Modal>\n </div>\n </div>\n </div>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_bbac9bee
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/styles.css from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.menuContainer {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n\n.settingsContainer {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 75vh;\n overflow-y: scroll;\n}\n\n.settingsContainer::-webkit-scrollbar {\n width: 2px;\n}\n\n.settingsContainer::-webkit-scrollbar-track {\n background: #f1f4f5;\n}\n\n.settingsContainer::-webkit-scrollbar-thumb {\n background: #c2c3c4;\n border-radius: 5px;\n}\n\n.buttonsContainer {\n height: 25vh;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n box-shadow: 0px -1px 0px rgba(227, 228, 230, 0.7);\n padding: 0px 14px 8px 14px;\n}\n\n.buttonsContainer div {\n width: 100%;\n}\n\n.loadingContainer {\n width: 100%;\n height: 75vh;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n```" } ]
code_mycheckout-store-framework_426d0f2a
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/PayButtonMenu.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { defineMessages } from 'react-intl'\n\nimport {\n ButtonSettings,\n FontSettings,\n NameSettings,\n RadioSettings,\n} from './Rows'\nimport { usePayButtonMenu } from '../../hooks'\n\nconst messages = defineMessages({\n radioLabel: { id: 'checkoutless.styleSettings.menu-radio' },\n widthLabel: { id: 'checkoutless.styleSettings.menu-width' },\n})\n\nexport const PayButtonMenu = () => {\n const {\n borderRadius,\n font,\n valueButton,\n // width,\n getColorStyle,\n handleBorderRadiusAction,\n handleButtonStyleAction,\n handleFontAction,\n handleNameAction,\n // handleWidthAction,\n } = usePayButtonMenu()\n\n return (\n <>\n <NameSettings value={valueButton} action={handleNameAction} />\n <FontSettings value={font} action={handleFontAction} />\n <RadioSettings\n label={messages.radioLabel}\n value={borderRadius}\n action={handleBorderRadiusAction}\n />\n {/* <RadioSettings\n label={messages.widthLabel}\n maxValue={999}\n value={width}\n action={handleWidthAction}\n /> */}\n <ButtonSettings\n getColorStyle={getColorStyle}\n action={handleButtonStyleAction}\n />\n </>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_52467c95
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/ModalMenu.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { defineMessages } from 'react-intl'\n\nimport { RadioSettings } from './Rows/RadioSettings'\nimport { ButtonSettings } from './Rows/ButtonSettings'\nimport { FontSettings } from './Rows/FontSettings'\nimport { IconsSettings } from './Rows/IconsSettings'\nimport { BackgroundSettings } from './Rows/BackgroundSettings'\nimport { useModalMenu } from '../../hooks'\n\nconst messages = defineMessages({\n radioLabel: { id: 'checkoutless.styleSettings.menu-radio' },\n})\n\nexport const ModalMenu = () => {\n const {\n font,\n iconsColor,\n borderRadius,\n backgroundColor,\n handleFontAction,\n handleIconsColorAction,\n handleBackgroundAction,\n handleBorderRadiusAction,\n getColorStyle,\n handleButtonStyleAction,\n } = useModalMenu()\n\n return (\n <>\n <FontSettings value={font} action={handleFontAction} />\n <IconsSettings color={iconsColor} action={handleIconsColorAction} />\n <BackgroundSettings\n color={backgroundColor}\n action={handleBackgroundAction}\n />\n <RadioSettings\n label={messages.radioLabel}\n value={borderRadius}\n action={handleBorderRadiusAction}\n />\n <ButtonSettings\n action={handleButtonStyleAction}\n getColorStyle={getColorStyle}\n />\n </>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_0f5db6e6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Preview/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { PageBlock } from 'vtex.styleguide'\nimport { FormattedMessage } from 'react-intl'\n\nimport { AlertMessage } from './AlertMessage'\nimport { Header } from './Header'\nimport { Body } from './Body'\nimport { useStyleSettings } from '../../hooks'\nimport styles from './styles.css'\n\nexport const Preview = () => {\n const { deviceSelected } = useStyleSettings()\n\n return (\n <div\n className={`${styles.previewContainer} ${\n deviceSelected === 'mobile' && styles.previewContainerMobile\n }`}\n >\n <PageBlock title={<FormattedMessage id=\"checkoutless.styleSettings\" />}>\n <AlertMessage />\n <Header />\n <Body />\n </PageBlock>\n </div>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_f28e6ede
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Preview/styles.css from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.previewContainer {\n transition-duration: 0.3s;\n transition-timing-function: ease;\n transition-property: width;\n width: 100%;\n}\n\n.previewContainerMobile {\n display: flex;\n justify-content: center;\n max-width: 350px;\n}\n\n```" } ]
code_mycheckout-store-framework_c34b7197
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Preview/AlertMessage.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { Alert } from 'vtex.styleguide'\nimport { useIntl } from 'react-intl'\n\nimport { useStyleSettings } from '../../hooks'\n\nexport const AlertMessage = () => {\n const { alert, clearAlert } = useStyleSettings()\n const { formatMessage } = useIntl()\n\n return alert.message.id !== '' ? (\n <div className=\"mb5\">\n <Alert type={alert.type} onClose={clearAlert}>\n {formatMessage(alert.message)}\n </Alert>\n </div>\n ) : null\n}\n\n```" } ]
code_mycheckout-store-framework_2fabdfa7
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/BackgroundSettings.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { defineMessages, messages } from 'react-intl'\n\nimport { Row } from './Row'\nimport { ColorPicker } from './ColorPicker'\n\nconst messages = defineMessages({\n iconsLabel: { id: 'checkoutless.styleSettings.menu-background' },\n iconsColorLabel: { id: 'checkoutless.styleSettings.menu.background-color' },\n})\n\ninterface Props {\n color: string\n action: (color: string) => void\n}\n\nexport const BackgroundSettings = ({ color, action }: Props) => {\n return (\n <Row label={messages.iconsLabel}>\n <div style={{ paddingTop: 8 }}>\n <ColorPicker\n label={messages.iconsColorLabel}\n action={action}\n color={color}\n />\n </div>\n </Row>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_0746cdc6
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/NameSettings.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { ChangeEvent } from 'react'\nimport React from 'react'\nimport { Input } from 'vtex.styleguide'\nimport { defineMessages, messages, useIntl } from 'react-intl'\n\nimport { Row } from './Row'\n\nconst messages = defineMessages({\n nameLabel: { id: 'checkoutless.styleSettings.menu-name' },\n nameInputPlaceholder: {\n id: 'checkoutless.styleSettings.menu.button.input-placeholder',\n },\n})\n\ninterface Props {\n value: string\n action: (args: string) => void\n}\n\nexport const NameSettings = ({ value, action }: Props) => {\n const { formatMessage } = useIntl()\n\n return (\n <Row label={messages.nameLabel}>\n <Input\n placeholder={formatMessage(messages.nameInputPlaceholder)}\n value={value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => action(e.target.value)}\n maxLength={32}\n />\n </Row>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_101eaa60
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/IconsSettings.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { defineMessages, messages } from 'react-intl'\n\nimport { Row } from './Row'\nimport { ColorPicker } from './ColorPicker'\n\nconst messages = defineMessages({\n iconsLabel: { id: 'checkoutless.styleSettings.menu-icons' },\n iconsColorLabel: { id: 'checkoutless.styleSettings.menu.icons-color' },\n})\n\ninterface Props {\n color: string\n action: (color: string) => void\n}\n\nexport const IconsSettings = ({ color, action }: Props) => {\n return (\n <Row label={messages.iconsLabel}>\n <div style={{ paddingTop: 8 }}>\n <ColorPicker\n label={messages.iconsColorLabel}\n color={color}\n action={action}\n position=\"bottom\"\n />\n </div>\n </Row>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_94ad43fc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/ButtonSettings.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState } from 'react'\nimport { Tabs, Tab } from 'vtex.styleguide'\nimport { defineMessages, messages } from 'react-intl'\n\nimport { Row } from './Row'\nimport { ColorStyles } from './ColorStyles'\nimport type { TypeColorStyle } from '../../../interfaces'\n\nconst messages = defineMessages({\n buttonLabel: { id: 'checkoutless.styleSettings.menu-button' },\n})\n\ninterface Props {\n action: (type: TypeColorStyle, color: string) => void\n getColorStyle: (type: TypeColorStyle) => string\n}\n\nexport const ButtonSettings = ({ getColorStyle, action }: Props) => {\n const [currentTab, setCurrentTab] = useState(1)\n\n return (\n <Row label={messages.buttonLabel}>\n <Tabs fullWidth>\n <Tab\n label=\"Normal\"\n active={currentTab === 1}\n onClick={() => setCurrentTab(1)}\n >\n <ColorStyles\n key=\"normal\"\n getColorStyle={getColorStyle}\n action={action}\n buttonStyle=\"normal\"\n />\n </Tab>\n <Tab\n label=\"Hover\"\n active={currentTab === 2}\n onClick={() => setCurrentTab(2)}\n >\n <ColorStyles\n key=\"hover\"\n getColorStyle={getColorStyle}\n action={action}\n buttonStyle=\"hover\"\n />\n </Tab>\n </Tabs>\n </Row>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_d61b2dcc
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/index.ts from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```typescript\nexport { ButtonSettings } from './ButtonSettings'\nexport { FontSettings } from './FontSettings'\nexport { NameSettings } from './NameSettings'\nexport { RadioSettings } from './RadioSettings'\n\n```" } ]
code_mycheckout-store-framework_36f72cf2
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/ColorStyles/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { defineMessages, messages } from 'react-intl'\n\nimport type { TypeColorStyle } from '../../../../interfaces'\nimport { ColorPicker } from '../ColorPicker'\nimport styles from './styles.css'\n\nconst messages = defineMessages({\n textLabel: { id: 'checkoutless.styleSettings.menu.button.color-text' },\n outlineLabel: { id: 'checkoutless.styleSettings.menu.button.color-outline' },\n backgroundLabel: {\n id: 'checkoutless.styleSettings.menu.button.color-background',\n },\n})\n\ninterface Props {\n action: (type: TypeColorStyle, color: string) => void\n getColorStyle: (type: TypeColorStyle) => string\n buttonStyle: 'normal' | 'hover'\n}\n\nexport const ColorStyles = ({ buttonStyle, getColorStyle, action }: Props) => {\n const isNormal = buttonStyle === 'normal'\n const textType = isNormal ? 'normal_text' : 'hover_text'\n const backgroundType = isNormal ? 'normal_background' : 'hover_background'\n const outlineType = isNormal ? 'normal_outline' : 'hover_outline'\n\n return (\n <div>\n <div className={styles.colorPickerContainer}>\n <ColorPicker\n label={messages.textLabel}\n action={(color) => action(textType, color)}\n color={getColorStyle(textType)}\n />\n </div>\n <div className={styles.colorPickerContainer}>\n <ColorPicker\n label={messages.backgroundLabel}\n action={(color) => action(backgroundType, color)}\n color={getColorStyle(backgroundType)}\n />\n </div>\n <div className={styles.colorPickerContainer}>\n <ColorPicker\n label={messages.outlineLabel}\n action={(color) => action(outlineType, color)}\n color={getColorStyle(outlineType)}\n />\n </div>\n </div>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_b5ba1a11
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/ColorStyles/styles.css from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.colorPickerContainer {\n padding: 22px 0px 0px 0px;\n}\n\n```" } ]
code_mycheckout-store-framework_75c6b959
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/RadioSettings/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { ChangeEvent } from 'react'\nimport { Input, Slider } from 'vtex.styleguide'\n\nimport { Row } from '../Row'\nimport styles from './styles.css'\n\ninterface Props {\n label: { id: string }\n maxValue?: number\n value: number\n action: (args: number) => void\n}\n\nexport const RadioSettings = ({\n label,\n maxValue = 99,\n value,\n action,\n}: Props) => {\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const val = e.target.value ? parseInt(e.target.value, 10) : 0\n\n const left = Math.max(value || 0, 0)\n const right = Math.min(value || maxValue, maxValue)\n\n if (left > right) return\n action(val)\n }\n\n return (\n <Row label={label}>\n <div className={styles.radioContainer}>\n <div className={styles.sliderContainer}>\n <Slider\n onChange={(text: number[]) => action(text[0])}\n min={0}\n max={maxValue}\n step={1}\n defaultValues={[value]}\n values={[value]}\n />\n </div>\n\n <div className={styles.sliderInputContainer}>\n <Input id=\"input_radio\" value={value} onChange={handleChange} />\n <label htmlFor=\"input_radio\" className={styles.sliderInputLabel}>\n PX\n </label>\n </div>\n </div>\n </Row>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_74ea9dd4
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/RadioSettings/styles.css from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.radioContainer {\n display: flex;\n}\n\n.sliderContainer {\n width: calc(100% - 34px);\n padding: 0 0.5rem;\n margin: auto;\n}\n\n.sliderContainer div div label {\n display: none;\n}\n\n.sliderInputContainer {\n align-items: center;\n display: flex;\n justify-content: center;\n position: relative;\n width: 50px;\n}\n\n.sliderInputContainer label {\n width: 50px;\n}\n\n.sliderInputContainer input {\n border-radius: 4px;\n border: 1px solid #e3e4e6;\n font-size: 12px;\n line-height: 20px;\n padding: 1px;\n text-align: end;\n width: 100%;\n}\n\n.sliderInputContainer div {\n border: none;\n height: auto;\n}\n\n.sliderInputLabel {\n margin: 0;\n padding: 0;\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 20px;\n position: relative;\n width: 28px !important;\n}\n\n```" } ]
code_mycheckout-store-framework_5fa86ed1
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/Row/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { useIntl } from 'react-intl'\n\nimport styles from './styles.css'\n\ninterface Props {\n label: { id: string }\n children: JSX.Element\n}\n\nexport const Row = ({ label, children }: Props) => {\n const { formatMessage } = useIntl()\n\n return (\n <div className={styles.rowContainer}>\n <h4 className={styles.rowLabel}>{formatMessage(label)}</h4>\n <div className={styles.rowChildrenContainer}>{children}</div>\n </div>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_e4b3cbff
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/Row/styles.css from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.rowContainer {\n padding: 17.5px 14px 35px 14px;\n box-shadow: 0px -1px 0px rgba(227, 228, 230, 0.7);\n}\n\n.rowLabel {\n margin: 0;\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n color: #3F3F40;\n}\n\n.rowChildrenContainer {\n background: #ffffff;\n padding: 0;\n margin: 0;\n}\n\n```" } ]
code_mycheckout-store-framework_4f2a7b5f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/FontSettings/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport type { ChangeEvent } from 'react'\nimport React, { useState, useMemo } from 'react'\nimport { Button, Modal, Input } from 'vtex.styleguide'\nimport { defineMessages, messages, useIntl } from 'react-intl'\n\nimport { Dropdown } from './Dropdown'\nimport { fonts } from '../../../../constants'\nimport { Row } from '../Row'\nimport styles from './styles.css'\n\nconst messages = defineMessages({\n fontLabel: { id: 'checkoutless.styleSettings.menu-font' },\n advancedBtnLabel: { id: 'checkoutless.styleSettings.menu-font-advanced-btn' },\n advancedDescription: {\n id: 'checkoutless.styleSettings.menu-font-advanced-description',\n },\n selectBtnLabel: { id: 'checkoutless.button-select' },\n})\n\ninterface Props {\n value: string\n action: (args: string) => void\n}\n\nconst fontsExample = '\"Gill Sans Extrabol\", Helvetica, sans-serif'\n\nexport const FontSettings = ({ value, action }: Props) => {\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [advanceFont, setAdvanceFont] = useState('')\n\n const { formatMessage } = useIntl()\n\n const handleOpenModal = () => setIsModalOpen(true)\n const handleCloseModal = () => setIsModalOpen(false)\n\n const handleSetFont = () => {\n if (!advanceFont) return\n action(advanceFont)\n handleCloseModal()\n }\n\n const AdvancedButton = useMemo(() => {\n return (\n <div className={styles.advancedButtonContainer}>\n <Button\n onClick={handleOpenModal}\n variation=\"secondary\"\n size=\"regular\"\n block\n >\n {formatMessage(messages.advancedBtnLabel)}\n </Button>\n </div>\n )\n }, [formatMessage])\n\n const getFonts = (arrayFonts: string[]) =>\n arrayFonts.map((font, i) => ({\n label: font,\n onClick: () => action(font),\n disabled: i === 0,\n }))\n\n const options = [\n ...getFonts(fonts.sansSerifFamily),\n ...getFonts(fonts.serifFamily),\n ]\n\n return (\n <Row label={messages.fontLabel}>\n <>\n <div className={styles.actionMenuContainer}>\n <Dropdown options={options} button={AdvancedButton} value={value} />\n </div>\n <Modal\n title={formatMessage(messages.advancedBtnLabel)}\n centered\n isOpen={isModalOpen}\n onClose={handleCloseModal}\n >\n <div className={styles.modalBody}>\n <p> {formatMessage(messages.advancedDescription)}</p>\n <p\n className={`${styles.modalCode} t-code`}\n >{`{ font-family: ${fontsExample} }`}</p>\n <div className={styles.modalFrom}>\n <div className=\"mv4\">\n <Input\n value={advanceFont}\n placeholder={`${fontsExample}`}\n label=\"Font-Family\"\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n setAdvanceFont(e.target.value)\n }\n />\n </div>\n\n <div className=\"mv4\">\n <Button\n variation=\"primary\"\n size=\"regular\"\n onClick={handleSetFont}\n >\n {formatMessage(messages.selectBtnLabel)}\n </Button>\n </div>\n </div>\n </div>\n </Modal>\n </>\n </Row>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_dda1185f
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/FontSettings/styles.css from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```css\n.dropdownContainer {\n position: relative;\n max-width: 100%;\n text-overflow: ellipsis;\n}\n\n.advancedButtonContainer {\n width: 100%;\n}\n\n.dropdownInputContainer {\n background: #ffffff;\n}\n\n.dropdownInput {\n background: none;\n border: 2px solid #e3e4e6;\n border-radius: 4px;\n width: 100%;\n font-family: 'Fabriga';\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n display: flex;\n align-items: center;\n padding: 0.5rem 1rem;\n text-align: start;\n position: relative;\n z-index: 2;\n height: 40px;\n cursor: pointer;\n}\n\n.dropdownInput p {\n text-overflow: ellipsis;\n margin: 0;\n padding: 0;\n width: 90%;\n height: 100%;\n max-height: 100%;\n overflow: hidden;\n word-break: break-all;\n}\n\n.dropdownInputIconContainer {\n position: absolute;\n z-index: 1;\n top: 35%;\n right: 10%;\n}\n\n.modalContainer {\n width: 100%;\n background: #ffffff;\n border: 2px solid #e3e4e6;\n box-shadow: 0px 5px 12px rgba(0, 0, 0, 0.1);\n border-radius: 4px;\n position: absolute;\n z-index: 4;\n margin-top: 2px;\n min-width: 200px;\n}\n\n.dropdownButtonContainer {\n padding: 10px 17.5px;\n border: 1px solid #e3e4e6;\n}\n\n.dropdownElementContainer {\n padding: 0;\n overflow-y: auto;\n max-height: 300px;\n}\n\n.dropdownElementContainer::-webkit-scrollbar {\n width: 2px;\n}\n\n.dropdownElementContainer::-webkit-scrollbar-track {\n background: #f1f4f5;\n}\n\n.dropdownElementContainer::-webkit-scrollbar-thumb {\n background: #c2c3c4;\n border-radius: 5px;\n}\n\n.dropdownElement {\n font-family: 'Fabriga';\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n display: flex;\n align-items: center;\n color: #585959;\n margin: 0;\n}\n\n.dropdownButton {\n background: none;\n border: 0;\n line-height: normal;\n font-family: 'Fabriga';\n font-style: normal;\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n width: 100%;\n padding: 12px 0 12px 22px;\n text-align: start;\n}\n\n.dropdownButton:hover {\n background: #f2f4f5;\n}\n\n.dropdownButton:disabled {\n background: none;\n}\n\n.dropdownButtonSelected {\n background: #e0e9ff;\n}\n\n.modalBody {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.modalFrom {\n width: 60%;\n}\n\n.modalCode {\n background: #f2f2f1;\n padding: 1rem;\n}\n\n.modalFrom div {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n```" } ]
code_mycheckout-store-framework_ce2f3a69
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/FontSettings/Dropdown.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\nimport React, { useState } from 'react'\nimport { IconCaretDown } from 'vtex.styleguide'\n\nimport styles from './styles.css'\n\ninterface Option {\n label: string\n onClick: () => void\n disabled?: boolean\n}\n\ninterface Props {\n options: Option[]\n button?: JSX.Element\n value: string\n}\n\nexport const Dropdown = ({ options, button, value }: Props) => {\n const [showOptions, setShowOptions] = useState(false)\n\n const handleClick = (option: Option) => {\n if (option?.onClick) {\n option.onClick()\n }\n\n setShowOptions(!showOptions)\n }\n\n return (\n <div className={styles.dropdownContainer}>\n <div className={styles.dropdownInputContainer}>\n <button\n className={styles.dropdownInput}\n onClick={() => setShowOptions(!showOptions)}\n onBlur={() => setTimeout(() => setShowOptions(false), 200)}\n >\n <p>{value}</p>\n </button>\n <div\n className={`c-action-primary ${styles.dropdownInputIconContainer}`}\n >\n <IconCaretDown />\n </div>\n </div>\n\n {showOptions && (\n <div className={styles.modalContainer}>\n {button && (\n <div className={styles.dropdownButtonContainer}>{button}</div>\n )}\n\n <div className={styles.dropdownElementContainer}>\n {options.map((option, i) => (\n <div\n key={`${option.label}_${i}`}\n className={`${styles.dropdownElement} ${\n value && styles.labelContainer\n }`}\n >\n <button\n className={`${styles.dropdownButton} ${\n value === option.label && styles.dropdownButtonSelected\n } `}\n disabled={option?.disabled}\n onClick={() => handleClick(option)}\n >\n {option.label}\n </button>\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n )\n}\n\n```" } ]
code_mycheckout-store-framework_09fae27e
[ { "role": "system", "content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms." }, { "role": "user", "content": "Show me the implementation of mycheckout-store-framework/react/admin/component/StyleSettings/components/Menu/Rows/ColorPicker/index.tsx from the mycheckout-store-framework VTEX app." }, { "role": "assistant", "content": "Here's the implementation:\n\n```tsx\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport React, { useState, useEffect } from 'react'\nimport { useIntl } from 'react-intl'\nimport { ChromePicker } from 'react-color'\n\nimport styles from './styles.css'\n\ninterface Props {\n label: { id: string }\n color: string\n action: (color: string) => void\n position?: 'top' | 'bottom'\n}\n\nexport const ColorPicker = ({\n label,\n color,\n action,\n position = 'top',\n}: Props) => {\n const { formatMessage } = useIntl()\n const [currentColor, setCurrentColor] = useState<string>()\n const [showColorPicker, setShowColorPicker] = useState<boolean>(false)\n\n const handleChange = (e: { hex: string }) => {\n setCurrentColor(e.hex)\n }\n\n const handleChangeComplete = (e: { hex: string }) => {\n action(e.hex)\n }\n\n useEffect(() => {\n setCurrentColor(color)\n }, [color])\n\n return (\n <div className={styles.inputColorContainer}>\n <button\n className={styles.buttonColor}\n style={{ background: currentColor }}\n onClick={() => setShowColorPicker(true)}\n />\n {showColorPicker ? (\n <div\n className={`${styles.chromePickerContainer} ${\n position === 'top' ? styles.positionTop : styles.positionBottom\n } `}\n >\n <div\n className={styles.chromePickerFixed}\n onClick={() => setShowColorPicker(false)}\n />\n <ChromePicker\n color={currentColor}\n onChangeComplete={handleChangeComplete}\n onChange={handleChange}\n disableAlpha\n />\n </div>\n ) : null}\n <p className={styles.inputColorlabel}>{formatMessage(label)}</p>\n </div>\n )\n}\n\n```" } ]