id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_country-flags_2eb28ac0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of country-flags/react/icons/NAM.tsx from the country-flags VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nconst NAM: React.FC = () => (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M24 9L6.00003 21H2.39453L24 6.5965V9Z\" fill=\"#E6E6E6\" />\n <path d=\"M18 3H21.6055L0 17.4035V15L18 3Z\" fill=\"#E6E6E6\" />\n <path d=\"M1 3H18L0 15V4C0 3.4475 0.4475 3 1 3Z\" fill=\"#1A3A73\" />\n <path d=\"M23 21H6L24 9V20C24 20.5525 23.5525 21 23 21Z\" fill=\"#039847\" />\n <path\n d=\"M2.3945 21H1C0.4475 21 0 20.5525 0 20V17.4035L21.6055 3H23C23.5525 3 24 3.4475 24 4V6.5965L2.3945 21Z\"\n fill=\"#BD1D27\"\n />\n <path\n d=\"M4 9C5.10457 9 6 8.10457 6 7C6 5.89543 5.10457 5 4 5C2.89543 5 2 5.89543 2 7C2 8.10457 2.89543 9 4 9Z\"\n fill=\"#F6D031\"\n />\n </svg>\n)\n\nexport default NAM\n\n```"
}
] |
code_country-flags_571741ea
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of country-flags/react/icons/EST.tsx from the country-flags VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nconst EST: React.FC = () => (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M24 20C24 20.5525 23.5525 21 23 21H1C0.4475 21 0 20.5525 0 20V15H24V20Z\"\n fill=\"#E6E6E6\"\n />\n <path d=\"M24 9H0V15H24V9Z\" fill=\"black\" />\n <path\n d=\"M24 9H0V4C0 3.4475 0.4475 3 1 3H23C23.5525 3 24 3.4475 24 4V9Z\"\n fill=\"#3A75C3\"\n />\n </svg>\n)\n\nexport default EST\n\n```"
}
] |
code_country-flags_da3994bc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of country-flags/react/icons/BUR.tsx from the country-flags VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nconst BUR: React.FC = () => (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M24 20C24 20.5525 23.5525 21 23 21H1C0.4475 21 0 20.5525 0 20V15H24V20Z\"\n fill=\"#E72B3E\"\n />\n <path d=\"M24 9H0V15H24V9Z\" fill=\"#3BB03B\" />\n <path\n d=\"M24 9H0V4C0 3.4475 0.4475 3 1 3H23C23.5525 3 24 3.4475 24 4V9Z\"\n fill=\"#FDCA2E\"\n />\n <path\n d=\"M16.1486 10.625H13.2256L12.0001 7.96503L10.7736 10.625H7.85156L9.98606 12.833L9.19706 16.035L12.0001 14.4435L14.8026 16.0355L14.0136 12.8335L16.1486 10.625Z\"\n fill=\"white\"\n />\n </svg>\n)\n\nexport default BUR\n\n```"
}
] |
code_country-flags_661125d8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of country-flags/react/icons/HND.tsx from the country-flags VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nconst HND: React.FC = () => (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M24 9H0V4C0 3.4475 0.4475 3 1 3H23C23.5525 3 24 3.4475 24 4V9Z\"\n fill=\"#0C72C4\"\n />\n <path d=\"M24 9H0V15H24V9Z\" fill=\"#E6E6E6\" />\n <path\n d=\"M24 20C24 20.5525 23.5525 21 23 21H1C0.4475 21 0 20.5525 0 20V15H24V20Z\"\n fill=\"#0C72C4\"\n />\n <path\n d=\"M9.1365 9.684H8.3835L8.0685 9L7.752 9.684H7L7.55 10.254L7.347 11.078L8.0685 10.669L8.79 11.078L8.587 10.254L9.1365 9.684Z\"\n fill=\"#0067C6\"\n />\n <path\n d=\"M9.1365 13.606H8.3835L8.068 12.922L7.7515 13.606H7L7.55 14.176L7.3465 15L8.068 14.591L8.79 15L8.587 14.176L9.1365 13.606Z\"\n fill=\"#0067C6\"\n />\n <path\n d=\"M16.9999 9.684H16.2469L15.9314 9L15.6149 9.684H14.8629L15.4129 10.254L15.2099 11.078L15.9314 10.669L16.6529 11.078L16.4499 10.254L16.9999 9.684Z\"\n fill=\"#0067C6\"\n />\n <path\n d=\"M16.9999 13.606H16.2469L15.9314 12.922L15.6149 13.606H14.8629L15.4129 14.176L15.2099 15L15.9314 14.591L16.6534 15L16.4499 14.1755L16.9999 13.606Z\"\n fill=\"#0067C6\"\n />\n <path\n d=\"M13.0685 11.645H12.3155L12 10.961L11.6835 11.645H10.9315L11.4815 12.215L11.2785 13.039L12 12.63L12.7215 13.039L12.5185 12.215L13.0685 11.645Z\"\n fill=\"#0067C6\"\n />\n </svg>\n)\n\nexport default HND\n\n```"
}
] |
code_country-flags_67065a8c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of country-flags/react/icons/HUN.tsx from the country-flags VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nconst HUN: React.FC = () => (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M24 9H0V4C0 3.4475 0.4475 3 1 3H23C23.5525 3 24 3.4475 24 4V9Z\"\n fill=\"#D32325\"\n />\n <path d=\"M24 9H0V15H24V9Z\" fill=\"#E6E6E6\" />\n <path\n d=\"M24 20C24 20.5525 23.5525 21 23 21H1C0.4475 21 0 20.5525 0 20V15H24V20Z\"\n fill=\"#008E46\"\n />\n </svg>\n)\n\nexport default HUN\n\n```"
}
] |
code_country-flags_b5ffe979
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of country-flags/react/icons/DOM.tsx from the country-flags VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\n\nconst DOM: React.FC = () => (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M10 10H0V4C0 3.4475 0.4475 3 1 3H10V10Z\" fill=\"#002F68\" />\n <path d=\"M24 20C24 20.5525 23.5525 21 23 21H14V14H24V20Z\" fill=\"#002F68\" />\n <path d=\"M0 20C0 20.5525 0.4475 21 1 21H10V14H0V20Z\" fill=\"#CE1127\" />\n <path d=\"M14 10H24V4C24 3.4475 23.5525 3 23 3H14V10Z\" fill=\"#CE1127\" />\n <path d=\"M24 10H14V3H10V10H0V14H10V21H14V14H24V10Z\" fill=\"#E6E6E6\" />\n <path\n d=\"M12 10C10.8955 10 10 10.8955 10 12C10 13.1045 10.8955 14 12 14C13.1045 14 14 13.1045 14 12C14 10.8955 13.1045 10 12 10ZM12 13C11.4475 13 11 12.5525 11 12C11 11.4475 11.4475 11 12 11C12.5525 11 13 11.4475 13 12C13 12.5525 12.5525 13 12 13Z\"\n fill=\"#688671\"\n />\n </svg>\n)\n\nexport default DOM\n\n```"
}
] |
code_service-cloudwatch-example_f20703e2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/docs/README.md from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n\n\n# Service Example\n\nA reference app implementing a VTEX IO service with HTTP route handlers.\n\n\n\nWe use [**KoaJS**](https://koajs.com/) as the web framework, so you might want to get into that\n\nWe also use the [**node-vtex-api**](https://github.com/vtex/node-vtex-api), a VTEX set of utilities for Node services. You can import this package using NPM from `@vtex/api` (already imported on this project)\n\n- Start from `node/index.ts` and follow the comments and imports :)\n\n## Recipes\n\n### Defining routes on _service.json_ \n```json\n{\n \"memory\": 256,\n \"ttl\": 10,\n \"timeout\": 2,\n \"minReplicas\": 2,\n \"maxReplicas\": 4,\n \"routes\": {\n \"status\": {\n \"path\": \"/_v/status/:code\",\n \"public\": true\n }\n }\n}\n```\n\nThe `service.json` file that sits on the root of the `node` folder holds informations about this service, like the maximum timeout and number of replicas, what might be discontinued on the future, but also **sets its routes**. \n\nKoa uses the [path-to-regexp](https://github.com/pillarjs/path-to-regexp) format for defining routes and, as seen on the example, we use the `:code` notation for declaring a **route param** named code, in this case. A HTTP request for `https://{{workspace}}--{{account}}.myvtex.com/_v/status/500` will match the route we've defined. \n\nFor cach _key_ on the `routes` object, there should be a **corresponding entry** on the exported Service object on `node/index.ts`, this will hook your code to a specific route.\n\n### Access Control\nYou can also provide a `public` option for each route. If `true`, that resource will be reachable for everyone on the internet. If `false`, VTEX credentials will be requested as well.\n\nAnother way of controlling access to specific routes is using **ReBACs (Resource-based access)**, that supports more robust configuration. You can read more [on this document](https://docs.google.com/document/d/1ZxNHMFIXfXz3BgTN9xyrHL3V5dYz14wivYgQjRBZ6J8/edit#heading=h.z7pad3qd2qw7) (VTEX only).\n\n#### Query String\nFor `?accepting=query-string`, you **don't need to declare anything**, as any query provided to the URL will already be available for you to use on the code as `ctx.query`, already parsed as an object, or `ctx.queryString`, taken directly from the URL as a string.\n\n#### Route Params\nRoute Params will be available for you to use on the code as `ctx.vtex.params`, already parsed as an object.\nFor a path like `/_v/status/:code`, if you receive the request `/_v/status/200`, `ctx.vtex.params` will return `{ code: '200' }`\n\n#### HTTP methods\nWhen you define a route on the `service.json`, your NodeJS handlers for that route will be triggered **on every HTTP method** (GET, POST, PUT...), so, if you need to handle them separately you need to implement a \"sub-router\". Fortunately, the _node-vtex-api_ provides a helper function `method`, exported from `@vtex/api`, to accomplish that behaviour. Instead of passing your handlers directly to the corresponding route on `index.ts`, you pass a `method` call passing **an object with the desired method as key and one handler as its corresponding value**. Check this example:\n```typescript\nimport { method } from '@vtex/api'\n...\n\nexport default new Service<Clients, State>({\n clients,\n routes: {\n status: method({\n GET: statusGetHandler,\n POST: statusPostHandler,\n }),\n },\n})\n```\n\n### Throwing errors\n\nWhen building a HTTP service, we should follow HTTP rules regarding data types, cache, authorization, and status code. Our example app sets a `ctx.status` value that will be used as a HTTP status code return value, but often we also want to give proper information about errors as well.\n\nThe **node-vtex-api** already exports a handful of **custom error classes** that can be used for that purpose, like the `NotFoundError`. You just need to throw them inside one of the route handlers that the appropriate response will be sent to the server.\n\n```typescript\nimport { UserInputError } from '@vtex/api'\n\nexport async function validate(ctx: Context, next: () => Promise<any>) {\n const { code } = ctx.vtex.route.params\n if (isNaN(code) || code < 100 || code > 600) {\n throw new UserInputError('Code must be a number between 100 and 600')\n }\n...\n```\n\nYou can check all the available errors [here](https://github.com/vtex/node-vtex-api/tree/fd6139349de4e68825b1074f1959dd8d0c8f4d5b/src/errors), but some are not useful for just-HTTP services. Check the most useful ones:\n\n|Error Class | HTTP Code |\n|--|:--:|\n| `UserInputError` | 400 |\n| `AuthenticationError` | 401 |\n| `ForbiddenError` | 403 |\n| `NotFoundError` | 404 |\n\nYou can also **create your custom error**, just see how it's done above ;)\n\n### Reading a JSON body\n\nWhen writing POST or PUT handlers, for example, often you need to have access to the **request body** that comes as a JSON format, which is not provided directly by the handler function.\n\nFor this, you have to use the [co-body](https://www.npmjs.com/package/co-body) package that will parse the request into a readable JSON object, used as below: \n```typescript\nimport { json } from 'co-body'\nexport async function method(ctx: Context, next: () => Promise<any>) {\n const body = await json(ctx.req)\n```\n\n### Other example apps\n\nWe use Node services across all VTEX, and there are a lot inspiring examples. If you want to dive deeper on learning about this subject, don't miss those internal apps: [builder-hub](https://github.com/vtex/builder-hub) or [store-sitemap](https://github.com/vtex-apps/store-sitemap)\n\n\n## Testing\n\n`@vtex/test-tools` and `@types/jest` should be installed on `./node` package as `devDependencies`.\n\nRun `vtex test` and [Jest](https://jestjs.io/) will do its thing.\n\nCheck the `node/__tests__/simple.test.ts` test case and also [Jest's Documentation](https://jestjs.io/docs/en/getting-started).\n\n## Splunk Dashboard\n\nWe have an (for now, VTEX-only, internal) Splunk dashboard to show all metrics related to your app. You can find it [here](https://splunk7.vtex.com/en-US/app/vtex_colossus/node_app_metrics).\n\nAfter linking this app and making some requests, you can select `vtex.service-example` and see the metrics for your app. **Don't forget to check the box Development, as you are linking your app in a development workspace**.\n\nFor convenience, the link for the current version: https://splunk7.vtex.com/en-US/app/vtex_colossus/node_app_metrics?form.time.earliest=-30m%40m&form.time.latest=%40m&form.picked_context=false&form.picked_region=aws-us-east-*&form.picked_service=vtex.service-example\n\n\n**Upcoming documentation:**\n\n - [Bump y18n from 4.0.0 to 4.0.3 in /node](https://github.com/vtex-apps/service-example/pull/40)\n - [Bump handlebars from 4.2.0 to 4.7.7 in /node](https://github.com/vtex-apps/service-example/pull/42)\n - [Bump json5 from 2.1.0 to 2.2.3 in /node](https://github.com/vtex-apps/service-example/pull/71)\n```"
}
] |
code_service-cloudwatch-example_549a2707
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/service.json from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"memory\": 256,\n \"ttl\": 10,\n \"timeout\": 2,\n \"minReplicas\": 2,\n \"maxReplicas\": 4,\n \"workers\": 1,\n \"routes\": {\n \"getip\": {\n \"path\": \"/_v/private/getip\",\n \"public\": true\n }\n }\n}\n\n```"
}
] |
code_service-cloudwatch-example_4125a123
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/package.json from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"aws4\": \"^1.12.0\",\n \"co-body\": \"^6.0.0\",\n \"qs\": \"^6.11.1\",\n \"ramda\": \"^0.25.0\",\n \"url\": \"^0.11.0\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^0.0.3\",\n \"@types/jest\": \"^24.0.18\",\n \"@types/node\": \"^12.0.0\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.45.15\",\n \"@vtex/test-tools\": \"^1.0.0\",\n \"@vtex/tsconfig\": \"^0.5.6\",\n \"typescript\": \"3.9.7\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty\"\n },\n \"version\": \"0.2.20\"\n}\n\n```"
}
] |
code_service-cloudwatch-example_d9ad8eb2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/index.ts from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { ClientsConfig, ServiceContext, RecorderState } from '@vtex/api'\nimport { LRUCache, method, Service } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { getExternalIp } from './middlewares/externalip'\n\nconst TIMEOUT_MS = 800\n\n// Create a LRU memory cache for the Status client.\n// The @vtex/api HttpClient respects Cache-Control headers and uses the provided cache.\nconst memoryCache = new LRUCache<string, any>({ max: 5000 })\n\nmetrics.trackCache('status', memoryCache)\n\n// This is the configuration for clients available in `ctx.clients`.\nconst clients: ClientsConfig<Clients> = {\n // We pass our custom implementation of the clients bag, containing the Status client.\n implementation: Clients,\n options: {\n // All IO Clients will be initialized with these options, unless otherwise specified.\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n },\n // This key will be merged with the default options and add this cache to our Status client.\n status: {\n memoryCache,\n },\n },\n}\n\ndeclare global {\n // We declare a global Context type just to avoid re-writing ServiceContext<Clients, State> in every handler and resolver\n type Context = ServiceContext<Clients, State>\n\n // The shape of our State object found in `ctx.state`. This is used as state bag to communicate between middlewares.\n interface State extends RecorderState {\n code: number\n }\n}\n\n// Export a service that defines route handlers and client options.\nexport default new Service({\n clients,\n routes: {\n // `status` is the route ID from service.json. It maps to an array of middlewares (or a single handler).\n getip: method({\n GET: [getExternalIp],\n }),\n },\n})\n\n```"
}
] |
code_service-cloudwatch-example_7166192f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/clients/ifconfig.ts from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext, IOResponse, Logger } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\n\nexport default class Ifconfig extends ExternalClient {\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n logger: Logger\n constructor(context: IOContext, options?: InstanceOptions) {\n const { authToken, logger } = context\n\n super('', context, {\n ...options,\n headers: {\n 'X-Vtex-Use-Https': 'true',\n 'Proxy-Authorization': authToken,\n // 'X-Vtex-Proxy-To': 'https://ifconfig.me'\n },\n })\n this.logger = logger\n }\n\n public async getExternalIp(): Promise<IOResponse<string>> {\n this.logger.info('Calling https://ifconfig.me server...')\n\n return this.http.getRaw('http://ifconfig.me')\n }\n}\n\n```"
}
] |
code_service-cloudwatch-example_5974d35c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/clients/cloudwatch.d.ts from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport interface CreateLogGroupRequest {\n logGroupName: string\n tags?: LogGroupTags\n kmsKeyId?: string\n}\nexport interface LogGroupTags {\n string: string\n}\nexport interface CreateLogStreamRequest {\n logGroupName: string\n logStreamName: string\n}\nexport interface PutLogEventsRequest {\n logEvents: LogEvent[]\n logGroupName: string\n logStreamName: string\n sequenceToken?: string\n}\nexport interface LogEvent {\n message: string\n timestamp: number\n}\n\n```"
}
] |
code_service-cloudwatch-example_e9b26779
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/clients/cloudwatch.ts from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { IOContext, InstanceOptions } from '@vtex/api'\nimport { Apps, ExternalClient } from '@vtex/api'\n\nimport type { PutLogEventsRequest, LogEvent } from './cloudwatch.d'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst url = require('url')\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst aws4 = require('aws4')\n// eslint-disable-next-line @typescript-eslint/no-var-requires\n// const qs = require('qs')\n\nexport default class CloudWatchLogger extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n const { authToken } = context\n\n super(\n 'https://logs.eu-central-1.amazonaws.com/?Action=PutLogEvents',\n context,\n {\n ...options,\n headers: {\n // ...options?.headers,\n 'Content-Type': 'application/x-amz-json-1.1',\n 'X-Vtex-Use-Https': 'true',\n 'Proxy-Authorization': authToken,\n },\n }\n )\n }\n\n private async getMyAppSettings() {\n const apps = new Apps(this.context)\n const appId = process.env.VTEX_APP_ID as string\n\n // eslint-disable-next-line no-return-await\n return await apps.getAppSettings(appId)\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n public async cwLogger(dataToLog: Object): Promise<any> {\n const { awsconfig } = await this.getMyAppSettings()\n const credentials = {\n accessKeyId: awsconfig.accesskeyid,\n secretAccessKey: awsconfig.secretaccesskey,\n }\n\n // eslint-disable-next-line new-cap\n const cwLogsUrl = new url.parse(\n 'https://logs.eu-central-1.amazonaws.com/?Action=PutLogEvents'\n )\n\n const logEvent: LogEvent = {\n message: JSON.stringify(dataToLog),\n timestamp: Date.now(),\n }\n\n const eventToSend: PutLogEventsRequest = {\n logEvents: [logEvent],\n logGroupName: 'apps',\n logStreamName: 'poc',\n }\n\n const opts = {\n host: 'logs.eu-central-1.amazonaws.com',\n method: 'POST',\n url: cwLogsUrl.href,\n path: cwLogsUrl.path,\n body: JSON.stringify(eventToSend),\n data: JSON.stringify(eventToSend),\n headers: {\n 'X-Amz-Target': 'Logs_20140328.PutLogEvents',\n 'Content-Type': 'application/x-amz-json-1.1',\n },\n }\n\n aws4.sign(opts, credentials)\n\n // eslint-disable-next-line no-console\n console.log(opts)\n\n if (this.options?.baseURL) {\n this.options.baseURL = cwLogsUrl.href\n }\n\n if (this.options?.headers) {\n this.options.headers = {\n ...Object(opts.headers),\n 'X-Vtex-Use-Https': this.options?.headers['X-Vtex-Use-Https'],\n 'Proxy-Authorization': this.options?.headers['Proxy-Authorization'],\n 'X-Vtex-Proxy-To': cwLogsUrl.href,\n 'X-Amz-Target': 'Logs_20140328.PutLogEvents',\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n // eslint-disable-next-line no-return-await\n return await this.http.post(cwLogsUrl.href, eventToSend, {\n headers: this.options?.headers,\n })\n }\n}\n\n```"
}
] |
code_service-cloudwatch-example_82ebdf06
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/clients/index.ts from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport Ifconfig from './ifconfig'\nimport CloudWatchLogger from './cloudwatch'\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {\n public get ifconfig() {\n return this.getOrSet('ifconfig', Ifconfig)\n }\n\n public get cwlogger() {\n return this.getOrSet('cwlogger', CloudWatchLogger)\n }\n}\n\n```"
}
] |
code_service-cloudwatch-example_8f5c6804
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/middlewares/externalip.ts from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport async function getExternalIp(ctx: Context, next: () => Promise<any>) {\n const {\n clients: { ifconfig, cwlogger },\n vtex: { logger },\n } = ctx\n\n console.info('Received request to get external IP...')\n logger.info('Received request to get external IP...')\n\n const ifconfigResponse = await ifconfig.getExternalIp()\n\n // const ifconfigResponsStringified = JSON.stringify(ifconfigResponse, null, 2)\n\n // console.info('ifconfig.me response:\\n', ifconfigResponsStringified)\n\n const { headers, data } = ifconfigResponse\n\n console.info('ifconfig.me headers', headers)\n console.info('ifconfig.me data:', data)\n logger.info(`ifconfig.me data: ${data}`)\n const response = await cwlogger.cwLogger(data)\n\n // eslint-disable-next-line no-console\n console.log(response)\n\n ctx.status = ifconfigResponse.status\n ctx.body = data\n\n await next()\n}\n\n```"
}
] |
code_service-cloudwatch-example_e6709745
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of service-cloudwatch-example/node/__tests__/simple.test.ts from the service-cloudwatch-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// You can import your files here for testing them\n//\n// More info: https://github.com/sapegin/jest-cheat-sheet\n\ndescribe('simpleTest', () => {\n it('one test case', async () => {\n expect(0.2 + 0.1).not.toBe(0.3)\n })\n})\n\n```"
}
] |
code_login_b87e2d63
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/nl.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Sorry, er is een onverwachte fout opgetreden. Probeer het nog eens.\",\n \"store/error.oauth.refresh\": \"Sorry, het is waarschijnlijk dat u tijdens het proces heeft geprobeerd de browser te vernieuwen. Probeer het opnieuw.\",\n \"store/error.oauth.missingEmail\": \"Sorry, we hebben je e-mail niet ontvangen. Controleer uw rechten of neem contact op met het verantwoordelijke bedrijf.\",\n \"store/loginOptions.title\": \"Kies een aanmeldingsoptie\",\n \"store/loginOptions.emailVerification\": \"Ontvang de toegangscode per e-mail\",\n \"store/loginOptions.emailAndPassword\": \"Log in met e-mail en wachtwoord\",\n \"store/loginOptions.oAuth\": \"Meld u aan met\",\n \"store/login.goBack\": \"Ga terug\",\n \"store/login.send\": \"Verstuur\",\n \"store/login.create\": \"Creëer\",\n \"store/login.confirm\": \"Bevestigen\",\n \"store/login.accessCodeTitle\": \"Voer de toegangscode in die naar uw e-mail is gestuurd\",\n \"store/login.myAccount\": \"Mijn account\",\n \"store/login.hello\": \"Hallo,\",\n \"store/login.logoutLabel\": \"Uitloggen\",\n \"store/login.signIn\": \"Aanmelden\",\n \"store/login.code\": \"Toegangscode\",\n \"store/login.notHaveAccount\": \"Heeft u nog geen account? Meld u aan\",\n \"store/login.forgotPassword\": \"Ik heb mijn wachtwoord vergeten\",\n \"store/login.invalidEmail\": \"Log in met een geldig e-mailadres\",\n \"store/login.invalidPassword\": \"Uw wachtwoord moet bestaan uit: ten minste 8 tekens, waaronder cijfers, kleine letters en hoofdletters\",\n \"store/login.invalidMatch\": \"Wachtwoord bevestiging is onjuist\",\n \"store/login.invalidCode\": \"Voer een geldige 6-cijferige toegangscode in\",\n \"store/login.wrongCode\": \"De toegangscode is onjuist\",\n \"store/login.wrongCredentials\": \"Verkeerde gebruiker en/of wachtwoord\",\n \"store/login.userBlocked\": \"U heeft 4 keer een onjuist wachtwoord ingegeven. Uw gebruiker is geblokkeerd voor een uur\",\n \"store/login.createPassword\": \"Bevestig e-mail en maak een nieuw wachtwoord aan\",\n \"store/login.createPasswordSubtitle\": \"Voer de code in die we naar de e-mail {email} hebben gestuurd en maak een nieuw wachtwoord aan\",\n \"admin/editor.login.title\": \"Inloggen\",\n \"admin/editor.loginPage.title\": \"Inlogpagina\",\n \"store/login.confirmPassword\": \"Bevestig wachtwoord\",\n \"store/login.password.uppercaseLetter\": \"Eén hoofdletter\",\n \"store/login.password.lowercaseLetter\": \"Eén kleine letter\",\n \"store/login.password.number\": \"Een nummer\",\n \"store/login.password.eightCharacteres\": \"Ten minste 8 tekens\",\n \"store/login.password.tooltip.title\": \"Uw wachtwoord moet bestaan uit:\",\n \"store/login.email.placeholder\": \"Bijv.: example@mail.com\",\n \"store/login.password.placeholder\": \"Voeg uw wachtwoord toe\",\n \"store/login.accessCode.placeholder\": \"Voeg uw toegangscode toe\",\n \"store/login.autoRedirect.message\": \"U wordt doorgestuurd naar onze {provider} login\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Toon alleen loginopties op het hoofdscherm\",\n \"admin/editor.login.defaultOption.title\": \"Weer te geven formulier voor primaire gegevensinvoer\",\n \"admin/editor.login.defaultOption.token\": \"Toegangscode login\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Email en wachtwoord login\",\n \"admin/editor.login.optionsTitle\": \"Titel van inlogopties\",\n \"admin/editor.login.emailAndPasswordTitle\": \"E-mail en wachtwoord titel van de login\",\n \"admin/editor.login.accessCodeTitle\": \"Titel van toegangscodelogin\",\n \"admin/editor.login.emailPlaceholder\": \"Plaatshouder voor e-mailinvoer\",\n \"admin/editor.login.passwordPlaceholder\": \"Plaatshouder voor wachtwoordinvoer\",\n \"admin/editor.login.accessCodePlaceholder\": \"Toegangscode invoer plaatshouder\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Toon wachtwoordformaatverificatie als tooltip\",\n \"admin/editor.login.showIconProfile\": \"Toon profielicoon\",\n \"admin/editor.login.iconLabel\": \"Login knoplabel\",\n \"admin/editor.login.hideIconLabel\": \"Label van inlogknop verbergen\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Label met inlogknop voor e-mail/wachtwoord\",\n \"admin/editor.login.hasIdentifierExtension\": \"E-mail/wachtwoord gebruikersidentificatie-extensie\",\n \"admin/editor.login.identifierPlaceholder\": \"Identificatie invoer plaatshouder\",\n \"admin/editor.login.invalidIdentifierError\": \"Fout ongeldige identificator\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Spiegel tooltip naar rechts\",\n \"admin/editor.login.logInButtonBehavior\": \"Gedrag inlogknop\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Gedrag accountoptiesknop\",\n \"admin/editor.login.accountOptionLinks\": \"Accountoptiekoppelingen\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Label\",\n \"admin/editor.login.accountOptionPathTitle\": \"Pad\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"CSS-klasse\",\n \"admin/editor.login.termsAndConditions\": \"Algemene voorwaarden korting\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Schakel Google One-tap-aanmelding in\",\n \"admin/editor.login.googleOneTap.alignment\": \"Google One-tap-uitlijning\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Google One-tap bovenmarge\"\n}\n\n```"
}
] |
code_login_53bcda3c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/ja.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"申し訳ありません、想定外のエラーが発生しました。もう一度やり直してください。\",\n \"store/error.oauth.refresh\": \"申し訳ありません、処理中にあなたはブラウザを更新しようとされたようです。もう一度やり直してください。\",\n \"store/error.oauth.missingEmail\": \"申し訳ありません、あなたからのメールを受け取っていません。権限を確認し、担当の会社にお問い合わせください。\",\n \"store/loginOptions.title\": \"サインインオプションを選ぶ\",\n \"store/loginOptions.emailVerification\": \"Eメールでアクセスコードを受け取る\",\n \"store/loginOptions.emailAndPassword\": \"Eメールとパスワードでサインインする\",\n \"store/loginOptions.oAuth\": \"サインインの方法\",\n \"store/login.goBack\": \"戻る\",\n \"store/login.send\": \"送る\",\n \"store/login.create\": \"作成する\",\n \"store/login.confirm\": \"確定\",\n \"store/login.accessCodeTitle\": \"Eメールで届いたアクセスコードを入力する\",\n \"store/login.myAccount\": \"マイアカウント\",\n \"store/login.hello\": \"こんにちは,\",\n \"store/login.logoutLabel\": \"ログアウト\",\n \"store/login.signIn\": \"サインイン\",\n \"store/login.code\": \"アクセスコード\",\n \"store/login.notHaveAccount\": \"アカウントを持っていませんか? サインアップしてください\",\n \"store/login.forgotPassword\": \"パスワードを忘れた場合\",\n \"store/login.invalidEmail\": \"有効なEメールでサインインしてください\",\n \"store/login.invalidPassword\": \"パスワードの条件は以下の通りです: 8文字以上で数字、小文字、大文字を含むこと\",\n \"store/login.invalidMatch\": \"パスワードを正しく確認できません\",\n \"store/login.invalidCode\": \"有効な6桁のアクセスコードを挿入してください\",\n \"store/login.wrongCode\": \"アクセスコードが正しくありません\",\n \"store/login.wrongCredentials\": \"ユーザーまたはパスワードが正しくありません\",\n \"store/login.userBlocked\": \"正しくないパスワードが4回入力されました。1時間ロックされます\",\n \"store/login.createPassword\": \"Eメールを有効にして新しいパスワードを作成します\",\n \"store/login.createPasswordSubtitle\": \"当社からのEメール {email} で届いたコードを挿入し、新しいパスワードを作成してください\",\n \"admin/editor.login.title\": \"ログイン\",\n \"admin/editor.loginPage.title\": \"ログインページ\",\n \"store/login.confirmPassword\": \"パスワードを確認\",\n \"store/login.password.uppercaseLetter\": \"1つの大文字\",\n \"store/login.password.lowercaseLetter\": \"1つの小文字\",\n \"store/login.password.number\": \"1つの数字\",\n \"store/login.password.eightCharacteres\": \"8文字以上\",\n \"store/login.password.tooltip.title\": \"パスワードの必須条件:\",\n \"store/login.email.placeholder\": \"例: example@mail.com\",\n \"store/login.password.placeholder\": \"パスワードを追加します\",\n \"store/login.accessCode.placeholder\": \"アクセスコードを追加します\",\n \"store/login.autoRedirect.message\": \"当社の {provider} ログインへリダイレクト中です\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"メイン画面にのみログインオプションが表示されます\",\n \"admin/editor.login.defaultOption.title\": \"表示されるプライマリデータ入力フォーム\",\n \"admin/editor.login.defaultOption.token\": \"アクセスコードによるログイン\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Eメールおよびパスワードによるログイン\",\n \"admin/editor.login.optionsTitle\": \"ログインオプションのタイトル\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Eメールおよびパスワードによるログインのタイトル\",\n \"admin/editor.login.accessCodeTitle\": \"アクセスコードによるログインのタイトル\",\n \"admin/editor.login.emailPlaceholder\": \"Eメール入力プレースホルダ\",\n \"admin/editor.login.passwordPlaceholder\": \"パスワード入力プレースホルダ\",\n \"admin/editor.login.accessCodePlaceholder\": \"アクセスコード入力プレースホルダ\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"パスワードフォーマット確認をツールチップとして表示する\",\n \"admin/editor.login.showIconProfile\": \"プロフィールアイコンを表示する\",\n \"admin/editor.login.iconLabel\": \"ログインボタンラベル\",\n \"admin/editor.login.hideIconLabel\": \"ログインボタンラベルを非表示にする\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Eメール/パスワードによるログインボタンラベル\",\n \"admin/editor.login.hasIdentifierExtension\": \"Eメール/パスワードユーザー識別子拡張\",\n \"admin/editor.login.identifierPlaceholder\": \"識別子入力プレースホルダ\",\n \"admin/editor.login.invalidIdentifierError\": \"無効な識別子エラー\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"ツールチップを右側にミラーリングする\",\n \"admin/editor.login.logInButtonBehavior\": \"ログインボタンの動作\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"アカウントオプションボタンの動作\",\n \"admin/editor.login.accountOptionLinks\": \"アカウントオプションリンク\",\n \"admin/editor.login.accountOptionLabelTitle\": \"ラベル\",\n \"admin/editor.login.accountOptionPathTitle\": \"パス\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"CSS クラス\",\n \"admin/editor.login.termsAndConditions\": \"利用規約マークダウン\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] は Google ワンタップサインアップを有効にします\",\n \"admin/editor.login.googleOneTap.alignment\": \"Google One-tap アラインメント\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Google One-tap トップマージン\"\n}\n\n```"
}
] |
code_login_0a1e2da9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/fi.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Pahoittelut, tapahtui odottamaton virhe. Yritä uudelleen.\",\n \"store/error.oauth.refresh\": \"Pahoittelut, on todennäköistä, että yritit päivittää selainta prosessin aikana. Yritä uudelleen.\",\n \"store/error.oauth.missingEmail\": \"Pahoittelut, emme saaneet sähköpostiasi. Tarkista käyttöoikeutesi tai ota yhteyttä asiasta vastaavaan yritykseen.\",\n \"store/loginOptions.title\": \"Valitse kirjautumisvaihtoehto\",\n \"store/loginOptions.emailVerification\": \"Kertakäyttöinen salasana sähköpostitse\",\n \"store/loginOptions.emailAndPassword\": \"Kirjaudu sisään sähköpostitse ja salasanalla\",\n \"store/loginOptions.oAuth\": \"Kirjaudu palvelulla\",\n \"store/login.goBack\": \"Palaa\",\n \"store/login.send\": \"Lähetä\",\n \"store/login.create\": \"Luo\",\n \"store/login.confirm\": \"Vahvista\",\n \"store/login.accessCodeTitle\": \"Kirjoita sähköpostiisi lähetetty pääsykoodi\",\n \"store/login.myAccount\": \"Oma tili\",\n \"store/login.hello\": \"Hei,\",\n \"store/login.logoutLabel\": \"Kirjaudu ulos\",\n \"store/login.signIn\": \"Kirjaudu sisään\",\n \"store/login.code\": \"Pääsykoodi\",\n \"store/login.notHaveAccount\": \"Eikö sinulla ole tiliä? Rekisteröidy\",\n \"store/login.forgotPassword\": \"Unohdin salasanani\",\n \"store/login.invalidEmail\": \"Kirjaudu sisään kelpaavalla sähköpostiosoitteella\",\n \"store/login.invalidPassword\": \"Salasanasi tulee sisältää: vähintään 8 merkkiä, mukaan lukien numeroita, pieniä ja isoja kirjaimia\",\n \"store/login.invalidMatch\": \"Salasanan vahvistus on väärin\",\n \"store/login.invalidCode\": \"Anna kelpaava kuusinumeroinen pääsykoodi\",\n \"store/login.wrongCode\": \"Pääsykoodi on virheellinen\",\n \"store/login.wrongCredentials\": \"Väärä käyttäjänimi ja/tai salasana\",\n \"store/login.userBlocked\": \"Olet antanut väärän salasanan 4 kertaa. Käyttäjätilisi on lukittu tunniksi\",\n \"store/login.createPassword\": \"Vahvista sähköpostiosoite ja luo uusi salasana\",\n \"store/login.createPasswordSubtitle\": \"Anna sähköpostiosoitteeseen {email} lähettämämme koodi ja luo uusi salasana\",\n \"admin/editor.login.title\": \"Kirjaudu\",\n \"admin/editor.loginPage.title\": \"Kirjautumissivu\",\n \"store/login.confirmPassword\": \"Vahvista salasana\",\n \"store/login.password.uppercaseLetter\": \"Yksi iso kirjain\",\n \"store/login.password.lowercaseLetter\": \"Yksi pieni kirjain\",\n \"store/login.password.number\": \"Numero\",\n \"store/login.password.eightCharacteres\": \"Vähintään 8 merkkiä\",\n \"store/login.password.tooltip.title\": \"Salasanasi tulee sisältää:\",\n \"store/login.email.placeholder\": \"Esim.: example@mail.com\",\n \"store/login.password.placeholder\": \"Lisää salasanasi\",\n \"store/login.accessCode.placeholder\": \"Lisää pääsykoodisi\",\n \"store/login.autoRedirect.message\": \"Sinut ohjataan palveluntarjoajamme {provider} kirjautumissivulle\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Näytä kirjautumisvaihtoehdot vain päänäkymässä\",\n \"admin/editor.login.defaultOption.title\": \"Näytettävä ensisijaisten tietojen lomake\",\n \"admin/editor.login.defaultOption.token\": \"Kirjautuminen pääsykoodilla\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Kirjautuminen sähköpostiosoitteella ja salasanalla\",\n \"admin/editor.login.optionsTitle\": \"Kirjautumisvaihtoehtojen otsikko\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Sähköposti ja salasana -kirjautumisen otsikko\",\n \"admin/editor.login.accessCodeTitle\": \"Pääsykoodikirjautumisen otsikko\",\n \"admin/editor.login.emailPlaceholder\": \"Sähköpostin syötteen paikkamerkki\",\n \"admin/editor.login.passwordPlaceholder\": \"Salasanan syötteen paikkamerkki\",\n \"admin/editor.login.accessCodePlaceholder\": \"Pääsykoodin syötteen paikkamerkki\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Näytä salasanan muodon vahvistus työkaluvinkkinä\",\n \"admin/editor.login.showIconProfile\": \"Näytä profiilikuvake\",\n \"admin/editor.login.iconLabel\": \"Kirjautumispainikkeen nimi\",\n \"admin/editor.login.hideIconLabel\": \"Piilota kirjautumispainikkeen nimi\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Sähköposti/salasanakirjautumisen painikkeen nimi\",\n \"admin/editor.login.hasIdentifierExtension\": \"Sähköposti/salasana-käyttäjätunnisteen laajennus\",\n \"admin/editor.login.identifierPlaceholder\": \"Tunnisteen syötteen paikkamerkki\",\n \"admin/editor.login.invalidIdentifierError\": \"Virheellinen tunniste -virhe\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Peilaa työkaluvihje oikealle\",\n \"admin/editor.login.logInButtonBehavior\": \"Kirjautumispainikkeen toiminto\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Tiliasetuspainikkeen toiminto\",\n \"admin/editor.login.accountOptionLinks\": \"Tiliasetuslinkit\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Selite\",\n \"admin/editor.login.accountOptionPathTitle\": \"Polku\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"CSS-luokka\",\n \"admin/editor.login.termsAndConditions\": \"Käyttöehtojen merkintä\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Ota käyttöön Google One-tap -rekisteröityminen\",\n \"admin/editor.login.googleOneTap.alignment\": \"Google One-tap -linjaus\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Google One-tap -toiminnon yläreunus\"\n}\n\n```"
}
] |
code_login_53bf56e1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/pt.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Desculpe, ocorreu um erro inesperado. Por favor, tente novamente.\",\n \"store/error.oauth.refresh\": \"Desculpe, é provável que você tentou atualizar o browser durante o processo. Por favor, tente novamente.\",\n \"store/error.oauth.missingEmail\": \"Desculpe, não recebemos o seu e-mail. Por favor, confira suas permissões ou entre em contato com a empresa responsável.\",\n \"store/loginOptions.title\": \"Escolha uma opção para entrar\",\n \"store/loginOptions.emailVerification\": \"Receber código de acesso por e-mail\",\n \"store/loginOptions.emailAndPassword\": \"Entrar com e-mail e senha\",\n \"store/loginOptions.oAuth\": \"Entrar com\",\n \"store/login.goBack\": \"Voltar\",\n \"store/login.send\": \"Enviar\",\n \"store/login.create\": \"Criar\",\n \"store/login.confirm\": \"Confirmar\",\n \"store/login.accessCodeTitle\": \"Digite o código enviado para seu e-mail\",\n \"store/login.myAccount\": \"Minha Conta\",\n \"store/login.hello\": \"Olá,\",\n \"store/login.logoutLabel\": \"Sair\",\n \"store/login.signIn\": \"Entrar\",\n \"store/login.code\": \"Código de Acesso\",\n \"store/login.notHaveAccount\": \"Não tem uma conta? Cadastre-se\",\n \"store/login.forgotPassword\": \"Esqueci minha senha\",\n \"store/login.invalidEmail\": \"Entre com um e-mail válido\",\n \"store/login.invalidPassword\": \"Sua senha deve conter: no mínimo 8 caracteres, incluindo números, letras minúsculas e maiúsculas\",\n \"store/login.invalidMatch\": \"Confirmação de senha está incorreta\",\n \"store/login.invalidCode\": \"Insira um código de acesso válido de 6 dígitos\",\n \"store/login.wrongCode\": \"O código de acesso está incorreto\",\n \"store/login.wrongCredentials\": \"Usuário e/ou senha errada\",\n \"store/login.userBlocked\": \"Você digitou uma senha incorreta 4 vezes. Seu usuário foi bloqueado por uma hora\",\n \"store/login.createPassword\": \"Validar e-mail e criar nova senha\",\n \"store/login.createPasswordSubtitle\": \"Insira o código que enviamos para o e-mail {email} e crie uma nova senha\",\n \"admin/editor.login.title\": \"Login\",\n \"admin/editor.loginPage.title\": \"Página de Login\",\n \"store/login.confirmPassword\": \"Confirmar senha\",\n \"store/login.password.uppercaseLetter\": \"Uma letra maiúscula\",\n \"store/login.password.lowercaseLetter\": \"Uma letra minúscula\",\n \"store/login.password.number\": \"Um número\",\n \"store/login.password.eightCharacteres\": \"No mínimo 8 caracteres\",\n \"store/login.password.tooltip.title\": \"Sua senha precisa conter:\",\n \"store/login.email.placeholder\": \"Ex.: exemplo@mail.com\",\n \"store/login.password.placeholder\": \"Adicione sua senha\",\n \"store/login.accessCode.placeholder\": \"Adicione seu código de acesso\",\n \"store/login.autoRedirect.message\": \"Estamos redirecionando você para o nosso login do {provider}\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Mostrar apenas as opções de login na tela principal\",\n \"admin/editor.login.defaultOption.title\": \"Formulário primário de entrada de dados a ser mostrado\",\n \"admin/editor.login.defaultOption.token\": \"Login por código de acesso\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Login por e-mail e senha\",\n \"admin/editor.login.optionsTitle\": \"Título das opções de login\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Título do login com e-mail e senha\",\n \"admin/editor.login.accessCodeTitle\": \"Título do login por código de acesso\",\n \"admin/editor.login.emailPlaceholder\": \"Placeholder do campo de e-mail\",\n \"admin/editor.login.passwordPlaceholder\": \"Placeholder do campo de senha\",\n \"admin/editor.login.accessCodePlaceholder\": \"Placeholder do campo de código de acesso\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Exibir verificação do formato de senha como tooltip\",\n \"admin/editor.login.showIconProfile\": \"Exibir ícone de perfil\",\n \"admin/editor.login.iconLabel\": \"Título do botão de login\",\n \"admin/editor.login.hideIconLabel\": \"Ocultar título do botão de login\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Texto do botão de login com E-mail/Senha\",\n \"admin/editor.login.hasIdentifierExtension\": \"Extensão do identificador de usuário de E-mail/Senha\",\n \"admin/editor.login.identifierPlaceholder\": \"Placeholder do campo de identificador\",\n \"admin/editor.login.invalidIdentifierError\": \"Erro de identificador inválido\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Espelhar tooltip para a direita\",\n \"admin/editor.login.logInButtonBehavior\": \"Comportamento do botão de login\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Comportamento do botão de opções da conta\",\n \"admin/editor.login.accountOptionLinks\": \"Links de opção da conta\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Label\",\n \"admin/editor.login.accountOptionPathTitle\": \"Path\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"Classe CSS\",\n \"admin/editor.login.termsAndConditions\": \"Markdown de termos e condições\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Habilitar Google One-tap sign-up\",\n \"admin/editor.login.googleOneTap.alignment\": \"Alinhamento do Google One-tap\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Margem superior do Google One-tap\"\n}\n\n```"
}
] |
code_login_22cb0a32
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/en.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Sorry, an unexpected error occurred. Please, try again.\",\n \"store/error.oauth.refresh\": \"Sorry, it is likely that you tried to refresh the browser during the process. Please, try again.\",\n \"store/error.oauth.missingEmail\": \"Sorry, we didn't receive your e-mail. Please, check your permissions or contact the responsible company.\",\n \"store/loginOptions.title\": \"Choose a sign-in option\",\n \"store/loginOptions.emailVerification\": \"Receive access code by e-mail\",\n \"store/loginOptions.emailAndPassword\": \"Sign in with e-mail and password\",\n \"store/loginOptions.oAuth\": \"Sign in with\",\n \"store/login.goBack\": \"Go back\",\n \"store/login.send\": \"Send\",\n \"store/login.create\": \"Create\",\n \"store/login.confirm\": \"Confirm\",\n \"store/login.accessCodeTitle\": \"Enter the access code sent to your e-mail\",\n \"store/login.myAccount\": \"My Account\",\n \"store/login.hello\": \"Hello,\",\n \"store/login.logoutLabel\": \"Logout\",\n \"store/login.signIn\": \"Sign In\",\n \"store/login.code\": \"Access Code\",\n \"store/login.notHaveAccount\": \"Don't have an account? Sign up\",\n \"store/login.forgotPassword\": \"Forgot my password\",\n \"store/login.invalidEmail\": \"Sign in with a valid e-mail\",\n \"store/login.invalidPassword\": \"Your password must contains: at least 8 characters, including numbers, lowercase and uppercase letters\",\n \"store/login.invalidMatch\": \"Password confirmation is incorrect\",\n \"store/login.invalidCode\": \"Insert a valid 6-digit access code\",\n \"store/login.wrongCode\": \"The access code is incorrect\",\n \"store/login.wrongCredentials\": \"Wrong user and/or password\",\n \"store/login.userBlocked\": \"You have entered an incorrect password 4 times. Your user has been blocked for an hour\",\n \"store/login.createPassword\": \"Validate email and create new password\",\n \"store/login.createPasswordSubtitle\": \"Insert the code we sent to the email {email} and create a new password\",\n \"admin/editor.login.title\": \"Login\",\n \"admin/editor.loginPage.title\": \"Login Page\",\n \"store/login.confirmPassword\": \"Confirm password\",\n \"store/login.password.uppercaseLetter\": \"One uppercase letter\",\n \"store/login.password.lowercaseLetter\": \"One lowercase letter\",\n \"store/login.password.number\": \"A number\",\n \"store/login.password.eightCharacteres\": \"At least 8 characters\",\n \"store/login.password.tooltip.title\": \"Your password must contain:\",\n \"store/login.email.placeholder\": \"E.g.: example@mail.com\",\n \"store/login.password.placeholder\": \"Add your password\",\n \"store/login.accessCode.placeholder\": \"Add your access code\",\n \"store/login.autoRedirect.message\": \"You are being redirected to our {provider} login\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Only display login options on the main screen\",\n \"admin/editor.login.defaultOption.title\": \"Primary data entry form to be displayed\",\n \"admin/editor.login.defaultOption.token\": \"Access code login\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Email and password login\",\n \"admin/editor.login.optionsTitle\": \"Login options' title\",\n \"admin/editor.login.emailAndPasswordTitle\": \"E-mail and password login's title\",\n \"admin/editor.login.accessCodeTitle\": \"Access code login's title\",\n \"admin/editor.login.emailPlaceholder\": \"E-mail input placeholder\",\n \"admin/editor.login.passwordPlaceholder\": \"Password input placeholder\",\n \"admin/editor.login.accessCodePlaceholder\": \"Access code input placeholder\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Show password format verification as tooltip\",\n \"admin/editor.login.showIconProfile\": \"Show profile icon\",\n \"admin/editor.login.iconLabel\": \"Login button label\",\n \"admin/editor.login.hideIconLabel\": \"Hide login button label\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"E-mail/Password login button label\",\n \"admin/editor.login.hasIdentifierExtension\": \"E-mail/Password user identifier extension\",\n \"admin/editor.login.identifierPlaceholder\": \"Identifier input placeholder\",\n \"admin/editor.login.invalidIdentifierError\": \"Invalid identifier error\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Mirror tooltip to right\",\n \"admin/editor.login.logInButtonBehavior\": \"Log in button behavior\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Account options button behavior\",\n \"admin/editor.login.accountOptionLinks\": \"Account option links\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Label\",\n \"admin/editor.login.accountOptionPathTitle\": \"Path\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"CSS class\",\n \"admin/editor.login.termsAndConditions\": \"Terms and conditions markdown\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Enable Google One-tap sign-up\",\n \"admin/editor.login.googleOneTap.alignment\": \"Google One-tap alignment\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Google One-tap top margin\"\n}\n\n```"
}
] |
code_login_40eca332
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/it.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Spiacenti, si è verificato un errore imprevisto. Si prega di riprovare.\",\n \"store/error.oauth.refresh\": \"Spiacenti, è probabile che tu abbia provato ad aggiornare il browser durante la procedura. Per favore riprova.\",\n \"store/error.oauth.missingEmail\": \"Spiacenti, non abbiamo ricevuto la tua email. Per favore, controlla le tue autorizzazioni o contatta la società responsabile.\",\n \"store/loginOptions.title\": \"Scegli una modalità di login\",\n \"store/loginOptions.emailVerification\": \"Ricevi il codice di accesso via email\",\n \"store/loginOptions.emailAndPassword\": \"Accedi tramite email e password\",\n \"store/loginOptions.oAuth\": \"Accedi con\",\n \"store/login.goBack\": \"Torna indietro\",\n \"store/login.send\": \"Invia\",\n \"store/login.create\": \"Crea\",\n \"store/login.confirm\": \"Conferma\",\n \"store/login.accessCodeTitle\": \"Inserisci il codice di accesso inviato alla tua email\",\n \"store/login.myAccount\": \"Il mio account\",\n \"store/login.hello\": \"Ciao,\",\n \"store/login.logoutLabel\": \"Esci\",\n \"store/login.signIn\": \"Accedi\",\n \"store/login.code\": \"Codice di accesso\",\n \"store/login.notHaveAccount\": \"Non hai un account? Registrati!\",\n \"store/login.forgotPassword\": \"Ho dimenticato la mia password\",\n \"store/login.invalidEmail\": \"Accedi tramite un indirizzo email valido\",\n \"store/login.invalidPassword\": \"La tua password deve contenere almeno 8 caratteri, inclusi numeri, lettere minuscole e maiuscole.\",\n \"store/login.invalidMatch\": \"La conferma della password non è corretta\",\n \"store/login.invalidCode\": \"Inserisci un codice di accesso a 6 cifre valido\",\n \"store/login.wrongCode\": \"Il codice di accesso non è corretto\",\n \"store/login.wrongCredentials\": \"Utente e/o password errati\",\n \"store/login.userBlocked\": \"Hai inserito una password errata 4 volte. Il tuo utente è stato bloccato per un'ora\",\n \"store/login.createPassword\": \"Convalida l'indirizzo email e crea una nuova password\",\n \"store/login.createPasswordSubtitle\": \"Inserisci il codice che abbiamo inviato all'indirizzo email {email} e crea una nuova password\",\n \"admin/editor.login.title\": \"Accedi\",\n \"admin/editor.loginPage.title\": \"Pagina di login\",\n \"store/login.confirmPassword\": \"Conferma password\",\n \"store/login.password.uppercaseLetter\": \"Una lettera maiuscola\",\n \"store/login.password.lowercaseLetter\": \"Una lettera minuscola\",\n \"store/login.password.number\": \"Un numero\",\n \"store/login.password.eightCharacteres\": \"Almeno 8 caratteri\",\n \"store/login.password.tooltip.title\": \"La password deve contenere:\",\n \"store/login.email.placeholder\": \"Es.: esempio@mail.com\",\n \"store/login.password.placeholder\": \"Aggiungi la password\",\n \"store/login.accessCode.placeholder\": \"Aggiungi il codice di accesso\",\n \"store/login.autoRedirect.message\": \"Stai per essere reindirizzato al login tramite {provider}\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Visualizza le modalità di accesso solamente nella schermata principale\",\n \"admin/editor.login.defaultOption.title\": \"Modulo per l'inserimento dei dati principali da visualizzare\",\n \"admin/editor.login.defaultOption.token\": \"Accesso tramite codice token\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Accesso tramite email e password\",\n \"admin/editor.login.optionsTitle\": \"Titolo modalità di accesso\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Titolo accesso tramite email e password\",\n \"admin/editor.login.accessCodeTitle\": \"Titolo accesso tramite codice token\",\n \"admin/editor.login.emailPlaceholder\": \"Placeholder per l'inserimento dell'email\",\n \"admin/editor.login.passwordPlaceholder\": \"Placeholder per l'inserimento della password\",\n \"admin/editor.login.accessCodePlaceholder\": \"Placeholder per l'inserimento del codice di accesso\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Suggerisci la verifica del formato della password tramite tooltip\",\n \"admin/editor.login.showIconProfile\": \"Mostra l'icona del profilo\",\n \"admin/editor.login.iconLabel\": \"Etichetta del pulsante di accesso\",\n \"admin/editor.login.hideIconLabel\": \"Nascondi etichetta del pulsante di accesso\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Etichetta del pulsante di accesso tramite email/password\",\n \"admin/editor.login.hasIdentifierExtension\": \"Estensione dell'identificativo utente email/password\",\n \"admin/editor.login.identifierPlaceholder\": \"Placehoder per l'inserimento dell'identificativo\",\n \"admin/editor.login.invalidIdentifierError\": \"Errore, l'identificativo non è valido\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Rifletti il tooltip a destra\",\n \"admin/editor.login.logInButtonBehavior\": \"Comportamento del pulsante di accesso\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Comportamento del pulsante delle modalità di account\",\n \"admin/editor.login.accountOptionLinks\": \"Link alle modalità di account\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Etichetta\",\n \"admin/editor.login.accountOptionPathTitle\": \"Percorso\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"Classi CSS\",\n \"admin/editor.login.termsAndConditions\": \"Markdown \\\"Termini e condizioni\\\"\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Abilita la registrazione tramite Google One Tap\",\n \"admin/editor.login.googleOneTap.alignment\": \"Allineamento Google One Tap\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Margine superiore Google One Tap\"\n}\n\n```"
}
] |
code_login_f589f52b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/fr.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Désolé, une erreur inattendue s’est produite. Veuillez réessayer.\",\n \"store/error.oauth.refresh\": \"Désolé, il est probable que vous ayez essayé de rafraîchir le navigateur pendant le processus. Veuillez réessayer.\",\n \"store/error.oauth.missingEmail\": \"Désolé, nous n’avons pas reçu votre email. Veuillez vérifier vos autorisations ou contacter la société responsable.\",\n \"store/loginOptions.title\": \"Choisissez une option de connexion\",\n \"store/loginOptions.emailVerification\": \"Recevoir le code d’accès par email\",\n \"store/loginOptions.emailAndPassword\": \"Connectez-vous avec votre adresse email et votre mot de passe\",\n \"store/loginOptions.oAuth\": \"Entrer\",\n \"store/login.goBack\": \"Retour\",\n \"store/login.send\": \"Envoyer\",\n \"store/login.create\": \"Créer\",\n \"store/login.confirm\": \"Confirmer\",\n \"store/login.accessCodeTitle\": \"Saisissez le code d’accès envoyé par email\",\n \"store/login.myAccount\": \"Mon compte\",\n \"store/login.hello\": \"Bonjour,\",\n \"store/login.logoutLabel\": \"Se déconnecter\",\n \"store/login.signIn\": \"Se connecter\",\n \"store/login.code\": \"Code d’accès\",\n \"store/login.notHaveAccount\": \"Vous n’avez pas encore de compte ? Inscrivez-vous\",\n \"store/login.forgotPassword\": \"Créer un compte maintenant\",\n \"store/login.invalidEmail\": \"Connectez-vous avec une adresse email valide\",\n \"store/login.invalidPassword\": \"Votre mot de passe doit contenir : au moins 8 caractères, dont des chiffres, des minuscules et des majuscules\",\n \"store/login.invalidMatch\": \"La confirmation du mot de passe est incorrecte\",\n \"store/login.invalidCode\": \"Insérez un code d’accès à 6 chiffres valide\",\n \"store/login.wrongCode\": \"Le code d’accès est incorrect\",\n \"store/login.wrongCredentials\": \"Mauvais utilisateur et/ou mot de passe\",\n \"store/login.userBlocked\": \"Vous avez saisi 4 fois un mot de passe incorrect. Votre utilisateur a été bloqué pendant une heure\",\n \"store/login.createPassword\": \"Validez une adresse mail et créez un mot de passe\",\n \"store/login.createPasswordSubtitle\": \"Insérez le code que nous vous avons envoyé par mail {email} et créez un nouveau mot de passe\",\n \"admin/editor.login.title\": \"Entrez avec\",\n \"admin/editor.loginPage.title\": \"Page de connexion\",\n \"store/login.confirmPassword\": \"Confirmer le mot de passe\",\n \"store/login.password.uppercaseLetter\": \"Une lettre majuscule\",\n \"store/login.password.lowercaseLetter\": \"Une lettre minuscule\",\n \"store/login.password.number\": \"Un chiffre\",\n \"store/login.password.eightCharacteres\": \"1 chiffre\",\n \"store/login.password.tooltip.title\": \"Votre mot de passe doit contenir :\",\n \"store/login.email.placeholder\": \"Ex : exemple@mail.com\",\n \"store/login.password.placeholder\": \"Ajoutez votre mot de passe\",\n \"store/login.accessCode.placeholder\": \"Ajoutez votre code d’accès\",\n \"store/login.autoRedirect.message\": \"Vous êtes redirigé vers notre connexion {provider}\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Afficher uniquement les options de connexion sur l’écran principal\",\n \"admin/editor.login.defaultOption.title\": \"Formulaire de saisie des données principales à afficher\",\n \"admin/editor.login.defaultOption.token\": \"Connexion avec code d’accès\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Connexion avec adresse mail et mot de passe\",\n \"admin/editor.login.optionsTitle\": \"Titre Options de connexion\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Titre de connexion avec adresse email et mot de passe\",\n \"admin/editor.login.accessCodeTitle\": \"Titre de connexion avec code d’accès\",\n \"admin/editor.login.emailPlaceholder\": \"Espace réservé pour l’adresse email\",\n \"admin/editor.login.passwordPlaceholder\": \"Espace réservé pour le mot de passe\",\n \"admin/editor.login.accessCodePlaceholder\": \"Espace réservé pour le code d’accès\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Afficher la vérification du format du mot de passe en tant qu’info-bulle\",\n \"admin/editor.login.showIconProfile\": \"Afficher l’icône du profil\",\n \"admin/editor.login.iconLabel\": \"Libellé du bouton de connexion\",\n \"admin/editor.login.hideIconLabel\": \"Masquer le libellé du bouton de connexion\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Libellé du bouton de connexion avec adresse email/mot de passe\",\n \"admin/editor.login.hasIdentifierExtension\": \"Extension de l’identifiant de l’utilisateur par adresse email/mot de passe\",\n \"admin/editor.login.identifierPlaceholder\": \"Espace réservé à l’identifiant\",\n \"admin/editor.login.invalidIdentifierError\": \"Erreur d’identifiant non valable\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Info-bulle du miroir à droite\",\n \"admin/editor.login.logInButtonBehavior\": \"Comportement du bouton de connexion\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Comportement du bouton Options du compte\",\n \"admin/editor.login.accountOptionLinks\": \"Liens vers Option de compte\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Étiquette\",\n \"admin/editor.login.accountOptionPathTitle\": \"Chemin d’accès\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"Classe CSS\",\n \"admin/editor.login.termsAndConditions\": \"Conditions d’utilisation Markdown\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Activer l’inscription avec Google en un clic\",\n \"admin/editor.login.googleOneTap.alignment\": \"Alignement avec Google en un clic\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Marge supérieure de Google en un clic\"\n}\n\n```"
}
] |
code_login_5062d22d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/bg.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Съжаляваме, възникна неочаквана грешка. Моля, опитайте отново.\",\n \"store/error.oauth.refresh\": \"Съжаляваме, изглежда, че се опитахте да обновите браузъра си по време на процеса. Моля, опитайте отново.\",\n \"store/error.oauth.missingEmail\": \"Съжаляваме, не получихме имейла ви. Моля, проверете разрешенията си или се свържете с отговорната компания.\",\n \"store/loginOptions.title\": \"Изберете опция за влизане\",\n \"store/loginOptions.emailVerification\": \"Получете код за достъп по имейл\",\n \"store/loginOptions.emailAndPassword\": \"Влизане с имейл и парола\",\n \"store/loginOptions.oAuth\": \"Влизане с\",\n \"store/login.goBack\": \"Назад\",\n \"store/login.send\": \"Изпращане\",\n \"store/login.create\": \"Създаване\",\n \"store/login.confirm\": \"Потвърждаване\",\n \"store/login.accessCodeTitle\": \"Въведете кода за достъп, изпратен на имейла ви\",\n \"store/login.myAccount\": \"Моят акаунт\",\n \"store/login.hello\": \"Здравейте,\",\n \"store/login.logoutLabel\": \"Излизане\",\n \"store/login.signIn\": \"Влизане\",\n \"store/login.code\": \"Код за достъп\",\n \"store/login.notHaveAccount\": \"Нямате акаунт? Регистриране\",\n \"store/login.forgotPassword\": \"Забравих си паролата\",\n \"store/login.invalidEmail\": \"Влизане с валиден имейл адрес\",\n \"store/login.invalidPassword\": \"Паролата ви трябва да съдържа: най-малко 8 знака, включително числа, малки букви и главни букви\",\n \"store/login.invalidMatch\": \"Потвърждаването на паролата е неправилно\",\n \"store/login.invalidCode\": \"Въведете валиден 6-цифрен код за достъп\",\n \"store/login.wrongCode\": \"Кодът за достъп е неправилен\",\n \"store/login.wrongCredentials\": \"Грешно потребителско име и/или парола\",\n \"store/login.userBlocked\": \"Въвели сте грешна парола 4 пъти. Потребителското ви име е блокирано за един час\",\n \"store/login.createPassword\": \"Валидирайте имейл адреса и създайте нова парола\",\n \"store/login.createPasswordSubtitle\": \"Въведете кода, който изпратихме на имейл адреса {email}, и създайте нова парола\",\n \"admin/editor.login.title\": \"Влизане\",\n \"admin/editor.loginPage.title\": \"Страница за влизане\",\n \"store/login.confirmPassword\": \"Потвърждаване на паролата\",\n \"store/login.password.uppercaseLetter\": \"Една главна буква\",\n \"store/login.password.lowercaseLetter\": \"Една малка буква\",\n \"store/login.password.number\": \"Число\",\n \"store/login.password.eightCharacteres\": \"Най-малко 8 знака\",\n \"store/login.password.tooltip.title\": \"Паролата ви трябва да съдържа:\",\n \"store/login.email.placeholder\": \"Напр.: example@mail.com\",\n \"store/login.password.placeholder\": \"Добавете паролата си\",\n \"store/login.accessCode.placeholder\": \"Добавете кода си за достъп\",\n \"store/login.autoRedirect.message\": \"Пренасочваме ви към нашия логин на {provider}\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Показване на опции за влизане само на главния екран\",\n \"admin/editor.login.defaultOption.title\": \"Първичен формуляр за въвеждане на данни за показване\",\n \"admin/editor.login.defaultOption.token\": \"Влизане с код за достъп\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Влизане с имейл адрес и парола\",\n \"admin/editor.login.optionsTitle\": \"Заглавие на опции за влизане\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Заглавие за влизане с имейл адрес и парола\",\n \"admin/editor.login.accessCodeTitle\": \"Заглавие за влизане с код за достъп\",\n \"admin/editor.login.emailPlaceholder\": \"Параметър за попълване за въвеждане на имейл\",\n \"admin/editor.login.passwordPlaceholder\": \"Параметър за попълване за въвеждане на парола\",\n \"admin/editor.login.accessCodePlaceholder\": \"Параметър за попълване за въвеждане на код за достъп\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Показване на потвърждението за формата на паролата като пояснение\",\n \"admin/editor.login.showIconProfile\": \"Показване на иконата на профила\",\n \"admin/editor.login.iconLabel\": \"Етикет на бутона за влизане\",\n \"admin/editor.login.hideIconLabel\": \"Скриване на етикета на бутона за влизане\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Етикет на бутон за влизане с имейл адрес / парола\",\n \"admin/editor.login.hasIdentifierExtension\": \"Разширение за потребителски идентификатор за имейл адрес / парола\",\n \"admin/editor.login.identifierPlaceholder\": \"Параметър за попълване за въвеждане на идентификатор\",\n \"admin/editor.login.invalidIdentifierError\": \"Грешка с невалиден идентификатор\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Дублиране на пояснение вдясно\",\n \"admin/editor.login.logInButtonBehavior\": \"Поведение на бутона за влизане\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Поведение на бутона за опции на акаунта\",\n \"admin/editor.login.accountOptionLinks\": \"Връзки към опции на акаунта\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Етикет\",\n \"admin/editor.login.accountOptionPathTitle\": \"Път\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"Клас на CSS\",\n \"admin/editor.login.termsAndConditions\": \"Маркдаун за общите условия\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Активиране на влизане с едно докосване на Google\",\n \"admin/editor.login.googleOneTap.alignment\": \"Подравняване с едно докосване на Google\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Горен марж с едно докосване на Google\"\n}\n```"
}
] |
code_login_3f57ed9f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/ro.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Ne cerem scuze, am întâmpinat o eroare neașteptată. Te rugăm să încerci mai târziu.\",\n \"store/error.oauth.refresh\": \"Ne cerem scuze, este posibil să fi încercat să reîncarci browser-ul pe durata acestui proces. Te rugăm să încerci din nou.\",\n \"store/error.oauth.missingEmail\": \"Ne cerem scuze, nu am primit e-mailul tău. Te rugăm să verifici ce drepturi ai sau să contactezi compania responsabilă.\",\n \"store/loginOptions.title\": \"Alege o opțiune de autentificare\",\n \"store/loginOptions.emailVerification\": \"Primește codul de acces prin e-mail\",\n \"store/loginOptions.emailAndPassword\": \"Autentifică-te cu e-mailul și parola\",\n \"store/loginOptions.oAuth\": \"Înregistrare cu\",\n \"store/login.goBack\": \"Înapoi\",\n \"store/login.send\": \"Trimite\",\n \"store/login.create\": \"Creează\",\n \"store/login.confirm\": \"Confirmare\",\n \"store/login.accessCodeTitle\": \"Introdu codul de acces trimis pe adresa ta de e-mail\",\n \"store/login.myAccount\": \"Contul meu\",\n \"store/login.hello\": \"Salut,\",\n \"store/login.logoutLabel\": \"Deconectează-te\",\n \"store/login.signIn\": \"Autentificare\",\n \"store/login.code\": \"Cod de acces\",\n \"store/login.notHaveAccount\": \"Nu ai un cont? Înregistrează-te\",\n \"store/login.forgotPassword\": \"Mi-am uitat parola\",\n \"store/login.invalidEmail\": \"Înregistrează-te cu o adresă de e-mail validă\",\n \"store/login.invalidPassword\": \"Parola ta trebuie să conțină: cel puțin 8 caractere, inclusiv numere, majuscule și minuscule\",\n \"store/login.invalidMatch\": \"Confirmarea parolei este incorectă\",\n \"store/login.invalidCode\": \"Introdu un cod de acces valid de 6 cifre\",\n \"store/login.wrongCode\": \"Codul de acces este incorect\",\n \"store/login.wrongCredentials\": \"Nume de utilizator și/sau parolă greșite\",\n \"store/login.userBlocked\": \"Ai introdus greșit o parolă incorectă de 4 ori. Contul tău este blocat pentru o oră\",\n \"store/login.createPassword\": \"Validează adresa de e-mail și creează o parolă nouă\",\n \"store/login.createPasswordSubtitle\": \"Introdu codul trimis pe adresa de e-mail {email} și creează o nouă parolă\",\n \"admin/editor.login.title\": \"Autentificare\",\n \"admin/editor.loginPage.title\": \"Pagina de autentificare\",\n \"store/login.confirmPassword\": \"Confirmă parola\",\n \"store/login.password.uppercaseLetter\": \"1 literă majusculă\",\n \"store/login.password.lowercaseLetter\": \"1 literă mică\",\n \"store/login.password.number\": \"1 număr\",\n \"store/login.password.eightCharacteres\": \"Cel puțin 8 caractere\",\n \"store/login.password.tooltip.title\": \"Parola ta trebuie să conțină:\",\n \"store/login.email.placeholder\": \"Ex.: example@mail.com\",\n \"store/login.password.placeholder\": \"Adaugă-ți parola\",\n \"store/login.accessCode.placeholder\": \"Adaugă codul tău de acces\",\n \"store/login.autoRedirect.message\": \"Ești redirecționat către autentificarea {provider}\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Afișează doar opțiunile de autentificare pe pagina principală\",\n \"admin/editor.login.defaultOption.title\": \"Se afișează formularul de introducere a datelor primare\",\n \"admin/editor.login.defaultOption.token\": \"Autentificare cod de acces\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Autentificare adresă de e-mail și parolă\",\n \"admin/editor.login.optionsTitle\": \"Titlu opțiuni de autentificare\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Titlu autentificare adresă de e-mail și parolă\",\n \"admin/editor.login.accessCodeTitle\": \"Titlul de autentificare a codului de acces\",\n \"admin/editor.login.emailPlaceholder\": \"Substituent introducere e-mail\",\n \"admin/editor.login.passwordPlaceholder\": \"Substituent introducere parolă\",\n \"admin/editor.login.accessCodePlaceholder\": \"Substituent introducere cod de acces\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Arată verificarea formatului parolei ca sfat de ecran\",\n \"admin/editor.login.showIconProfile\": \"Arată iconița profilului\",\n \"admin/editor.login.iconLabel\": \"Etichetă buton autentificare\",\n \"admin/editor.login.hideIconLabel\": \"Ascunde eticheta butonului de autentificare\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Etichetă buton autentificare e-mail/parolă\",\n \"admin/editor.login.hasIdentifierExtension\": \"Extensie identificator utilizator e-mail/parolă\",\n \"admin/editor.login.identifierPlaceholder\": \"Substituent introducere identificator\",\n \"admin/editor.login.invalidIdentifierError\": \"Eroare identificator invalid\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Oglindește pontul pe ecran în dreapta\",\n \"admin/editor.login.logInButtonBehavior\": \"Comportament buton autentificare\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Comportament buton opțiuni cont\",\n \"admin/editor.login.accountOptionLinks\": \"Link-uri opțiuni cont\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Etichetă\",\n \"admin/editor.login.accountOptionPathTitle\": \"Cale\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"Clasa CSS\",\n \"admin/editor.login.termsAndConditions\": \"Markdown termene și condiții\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Activează Google One-tap sign-up\",\n \"admin/editor.login.googleOneTap.alignment\": \"Aliniere Google One-tap\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Margine de sus Google One-tap\"\n}\n\n```"
}
] |
code_login_31368ec6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/context.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"store/error.oauth.unknown\",\n \"store/error.oauth.refresh\": \"store/error.oauth.refresh\",\n \"store/error.oauth.missingEmail\": \"store/error.oauth.missingEmail\",\n \"store/loginOptions.title\": \"store/loginOptions.title\",\n \"store/loginOptions.emailVerification\": \"store/loginOptions.emailVerification\",\n \"store/loginOptions.emailAndPassword\": \"store/loginOptions.emailAndPassword\",\n \"store/loginOptions.oAuth\": \"store/loginOptions.oAuth\",\n \"store/login.goBack\": \"store/login.goBack\",\n \"store/login.send\": \"store/login.send\",\n \"store/login.create\": \"store/login.create\",\n \"store/login.confirm\": \"store/login.confirm\",\n \"store/login.accessCodeTitle\": \"store/login.accessCodeTitle\",\n \"store/login.myAccount\": \"store/login.myAccount\",\n \"store/login.hello\": \"store/login.hello\",\n \"store/login.logoutLabel\": \"store/login.logoutLabel\",\n \"store/login.signIn\": \"store/login.signIn\",\n \"store/login.code\": \"store/login.code\",\n \"store/login.notHaveAccount\": \"store/login.notHaveAccount\",\n \"store/login.forgotPassword\": \"store/login.forgotPassword\",\n \"store/login.invalidEmail\": \"store/login.invalidEmail\",\n \"store/login.invalidPassword\": \"store/login.invalidPassword\",\n \"store/login.invalidCode\": \"store/login.invalidCode\",\n \"store/login.invalidMatch\": \"store/login.invalidMatch\",\n \"store/login.wrongCode\": \"store/login.wrongCode\",\n \"store/login.wrongCredentials\": \"store/login.wrongCredentials\",\n \"store/login.userBlocked\": \"store/login.userBlocked\",\n \"store/login.createPassword\": \"store/login.createPassword\",\n \"store/login.createPasswordSubtitle\": \"store/login.createPasswordSubtitle\",\n \"admin/editor.login.title\": \"admin/editor.login.title\",\n \"admin/editor.loginPage.title\": \"admin/editor.loginPage.title\",\n \"store/login.confirmPassword\": \"store/login.confirmPassword\",\n \"store/login.password.uppercaseLetter\": \"store/login.password.uppercaseLetter\",\n \"store/login.password.lowercaseLetter\": \"store/login.password.lowercaseLetter\",\n \"store/login.password.number\": \"store/login.password.number\",\n \"store/login.password.eightCharacteres\": \"store/login.password.eightCharacteres\",\n \"store/login.password.tooltip.title\": \"store/login.password.tooltip.title\",\n \"store/login.email.placeholder\": \"store/login.email.placeholder\",\n \"store/login.password.placeholder\": \"store/login.password.placeholder\",\n \"store/login.accessCode.placeholder\": \"store/login.accessCode.placeholder\",\n \"store/login.autoRedirect.message\": \"store/login.autoRedirect.message\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"admin/editor.login.isInitialScreenOptionOnly.title\",\n \"admin/editor.login.defaultOption.title\": \"admin/editor.login.defaultOption.title\",\n \"admin/editor.login.defaultOption.token\": \"admin/editor.login.defaultOption.token\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"admin/editor.login.defaultOption.emailAndPassword\",\n \"admin/editor.login.optionsTitle\": \"admin/editor.login.optionsTitle\",\n \"admin/editor.login.emailAndPasswordTitle\": \"admin/editor.login.emailAndPasswordTitle\",\n \"admin/editor.login.accessCodeTitle\": \"admin/editor.login.accessCodeTitle\",\n \"admin/editor.login.emailPlaceholder\": \"admin/editor.login.emailPlaceholder\",\n \"admin/editor.login.passwordPlaceholder\": \"admin/editor.login.passwordPlaceholder\",\n \"admin/editor.login.accessCodePlaceholder\": \"admin/editor.login.accessCodePlaceholder\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"admin/editor.login.showPasswordVerificationIntoTooltip.title\",\n \"admin/editor.login.showIconProfile\": \"admin/editor.login.showIconProfile\",\n \"admin/editor.login.iconLabel\": \"admin/editor.login.iconLabel\",\n \"admin/editor.login.hideIconLabel\": \"admin/editor.login.hideIconLabel\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"admin/editor.login.providerPasswordButtonLabel\",\n \"admin/editor.login.hasIdentifierExtension\": \"admin/editor.login.hasIdentifierExtension\",\n \"admin/editor.login.identifierPlaceholder\": \"admin/editor.login.identifierPlaceholder\",\n \"admin/editor.login.invalidIdentifierError\": \"admin/editor.login.invalidIdentifierError\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"admin/editor.login.mirrorTooltipToRightTitle\",\n \"admin/editor.login.logInButtonBehavior\": \"admin/editor.login.logInButtonBehavior\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"admin/editor.login.accountOptionsButtonBehavior\",\n \"admin/editor.login.accountOptionLinks\": \"admin/editor.login.accountOptionLinks\",\n \"admin/editor.login.accountOptionLabelTitle\": \"admin/editor.login.accountOptionLabelTitle\",\n \"admin/editor.login.accountOptionPathTitle\": \"admin/editor.login.accountOptionPathTitle\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"admin/editor.login.accountOptionCssClassTitle\",\n \"admin/editor.login.termsAndConditions\": \"admin/editor.login.termsAndConditions\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Enable Google One-tap sign-up\",\n \"admin/editor.login.googleOneTap.alignment\": \"Google One-tap alignment\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Google One-tap top margin\"\n}\n\n```"
}
] |
code_login_c32d4fa2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/ko.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"죄송합니다. 예기치 않은 오류가 발생했습니다. 다시 시도하십시오.\",\n \"store/error.oauth.refresh\": \"프로세스 중에 브라우저를 새로 고침하려고 했을 가능성이 있습니다. 다시 시도하십시오.\",\n \"store/error.oauth.missingEmail\": \"죄송합니다. 귀하의 이메일을 받지 못했습니다. 권한을 확인하거나 담당 회사에 문의하십시오.\",\n \"store/loginOptions.title\": \"로그인 옵션 선택\",\n \"store/loginOptions.emailVerification\": \"이메일로 액세스 코드 받기\",\n \"store/loginOptions.emailAndPassword\": \"이메일 및 비밀번호로 로그인\",\n \"store/loginOptions.oAuth\": \"로그인하기\",\n \"store/login.goBack\": \"돌아가기\",\n \"store/login.send\": \"전송\",\n \"store/login.create\": \"생성\",\n \"store/login.confirm\": \"확인\",\n \"store/login.accessCodeTitle\": \"이메일로 전송된 액세스 코드를 입력하십시오.\",\n \"store/login.myAccount\": \"나의 계정\",\n \"store/login.hello\": \"안녕하세요,\",\n \"store/login.logoutLabel\": \"로그아웃\",\n \"store/login.signIn\": \"로그인\",\n \"store/login.code\": \"액세스 코드\",\n \"store/login.notHaveAccount\": \"계정이 없으신가요? 등록하세요\",\n \"store/login.forgotPassword\": \"비밀번호를 잊어버림\",\n \"store/login.invalidEmail\": \"유효한 이메일로 로그인\",\n \"store/login.invalidPassword\": \"암호는 숫자, 소문자 및 대문자 등 8자 이상이어야 합니다.\",\n \"store/login.invalidMatch\": \"비밀번호 확인이 올바르지 않습니다.\",\n \"store/login.invalidCode\": \"유효한 6자리 액세스 코드를 삽입하세요\",\n \"store/login.wrongCode\": \"액세스 코드가 잘못되었습니다.\",\n \"store/login.wrongCredentials\": \"잘못된 사용자 및/또는 암호\",\n \"store/login.userBlocked\": \"비밀번호를 4번 잘못 입력했습니다. 사용자가 한 시간 동안 차단됩니다.\",\n \"store/login.createPassword\": \"이메일 확인 및 새 암호 만들기\",\n \"store/login.createPasswordSubtitle\": \"{email}로 보낸 코드를 입력하고 새 암호를 생성합니다.\",\n \"admin/editor.login.title\": \"로그인\",\n \"admin/editor.loginPage.title\": \"로그인 페이지\",\n \"store/login.confirmPassword\": \"비밀번호 확인\",\n \"store/login.password.uppercaseLetter\": \"1개의 대문자\",\n \"store/login.password.lowercaseLetter\": \"1개의 소문자\",\n \"store/login.password.number\": \"1개의 숫자\",\n \"store/login.password.eightCharacteres\": \"최소 8개의 글자\",\n \"store/login.password.tooltip.title\": \"비밀번호는 반드시 다음을 포함해야 합니다:\",\n \"store/login.email.placeholder\": \"예: example@mail.com\",\n \"store/login.password.placeholder\": \"비밀번호 추가\",\n \"store/login.accessCode.placeholder\": \"액세스 코드 추가\",\n \"store/login.autoRedirect.message\": \"{provider} 로그인으로 리디렉션됩니다.\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"기본 화면에 로그인 옵션만 표시\",\n \"admin/editor.login.defaultOption.title\": \"표시할 기본 데이터 입력 양식\",\n \"admin/editor.login.defaultOption.token\": \"액세스 코드 로그인\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"이메일 및 암호 로그인\",\n \"admin/editor.login.optionsTitle\": \"로그인 옵션 제목\",\n \"admin/editor.login.emailAndPasswordTitle\": \"이메일 및 비밀번호 로그인 제목\",\n \"admin/editor.login.accessCodeTitle\": \"액세스 코드 로그인 제목\",\n \"admin/editor.login.emailPlaceholder\": \"이메일 입력 플레이스홀더\",\n \"admin/editor.login.passwordPlaceholder\": \"비밀번호 입력 플레이스홀더\",\n \"admin/editor.login.accessCodePlaceholder\": \"액세스 코드 입력 플레이스홀더\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"툴팁으로 암호 형식 확인 표시\",\n \"admin/editor.login.showIconProfile\": \"프로필 아이콘 표시\",\n \"admin/editor.login.iconLabel\": \"로그인 버튼 라벨\",\n \"admin/editor.login.hideIconLabel\": \"로그인 버튼 라벨 숨기기\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"이메일/비밀번호 로그인 버튼 라벨\",\n \"admin/editor.login.hasIdentifierExtension\": \"이메일/비밀번호 사용자 식별자 확장\",\n \"admin/editor.login.identifierPlaceholder\": \"식별자 입력 플레이스홀더\",\n \"admin/editor.login.invalidIdentifierError\": \"잘못된 식별자 오류\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"툴팁을 오른쪽으로 미러링\",\n \"admin/editor.login.logInButtonBehavior\": \"로그인 버튼 동작\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"계정 옵션 버튼 동작\",\n \"admin/editor.login.accountOptionLinks\": \"계정 옵션 링크\",\n \"admin/editor.login.accountOptionLabelTitle\": \"라벨\",\n \"admin/editor.login.accountOptionPathTitle\": \"길\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"CSS class\",\n \"admin/editor.login.termsAndConditions\": \"이용 약관 마크다운\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Google 원 탭 등록 활성화\",\n \"admin/editor.login.googleOneTap.alignment\": \"Google 원 탭 정렬\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Google 원 탭 상단 여백\"\n}\n\n```"
}
] |
code_login_cacf5c12
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/da.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Beklager, der opstod en uventet fejl. Prøv igen.\",\n \"store/error.oauth.refresh\": \"Beklager, det er sandsynligt, at du har forsøgt at opdatere browseren under processen. Prøv igen.\",\n \"store/error.oauth.missingEmail\": \"Vi beklager, vi modtog ikke din e-mail. Kontroller dine tilladelser eller kontakt det ansvarlige firma.\",\n \"store/loginOptions.title\": \"Vælg en log ind mulighed\",\n \"store/loginOptions.emailVerification\": \"Modtag adgangskode via e-mail\",\n \"store/loginOptions.emailAndPassword\": \"Log ind med e-mailadresse og adgangskode\",\n \"store/loginOptions.oAuth\": \"Log ind med\",\n \"store/login.goBack\": \"Gå tilbage\",\n \"store/login.send\": \"Send\",\n \"store/login.create\": \"Opret\",\n \"store/login.confirm\": \"Bekræft\",\n \"store/login.accessCodeTitle\": \"Indtast adgangskoden sendt til din e-mail\",\n \"store/login.myAccount\": \"Min konto\",\n \"store/login.hello\": \"Hej,\",\n \"store/login.logoutLabel\": \"Log ud\",\n \"store/login.signIn\": \"Log ind\",\n \"store/login.code\": \"Adgangskode\",\n \"store/login.notHaveAccount\": \"Har du ikke konto? Tilmeld dig nu\",\n \"store/login.forgotPassword\": \"Glemt min adgangskode\",\n \"store/login.invalidEmail\": \"Log ind med en gyldig e-mail\",\n \"store/login.invalidPassword\": \"Din adgangskode skal indeholde: mindst 8 tegn, inklusive tal, små og store bogstaver\",\n \"store/login.invalidMatch\": \"Bekræftelse af adgangskode er forkert\",\n \"store/login.invalidCode\": \"Indsæt en gyldig 6-cifret adgangskode\",\n \"store/login.wrongCode\": \"Adgangskoden er forkert\",\n \"store/login.wrongCredentials\": \"Forkert bruger og / eller adgangskode\",\n \"store/login.userBlocked\": \"Du har mistet din adgangskode 4 gange. Din bruger er låst i en time\",\n \"store/login.createPassword\": \"Valider e-mail, og opret ny adgangskode\",\n \"store/login.createPasswordSubtitle\": \"Indsæt koden, vi sendte til e-mailen {email}, og opret en ny adgangskode\",\n \"admin/editor.login.title\": \"Log ind\",\n \"admin/editor.loginPage.title\": \"Login-side\",\n \"store/login.confirmPassword\": \"Bekræft adgangskode\",\n \"store/login.password.uppercaseLetter\": \"1 stort bogstav\",\n \"store/login.password.lowercaseLetter\": \"1 lille bogstav\",\n \"store/login.password.number\": \"1 tal\",\n \"store/login.password.eightCharacteres\": \"Mindst 8 karakterer\",\n \"store/login.password.tooltip.title\": \"Din adgangskode skal have:\",\n \"store/login.email.placeholder\": \"Eksempel: eksempel@mail.com\",\n \"store/login.password.placeholder\": \"Tilføj din adgangskode\",\n \"store/login.accessCode.placeholder\": \"Tilføj din adgangskode\",\n \"store/login.autoRedirect.message\": \"Du omdirigeres til vores {provider} login\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Vis kun loginindstillinger på hovedskærmen\",\n \"admin/editor.login.defaultOption.title\": \"Primær dataindtastningsformular, der skal vises\",\n \"admin/editor.login.defaultOption.token\": \"Adgangskode login\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Login med e-mail og adgangskode\",\n \"admin/editor.login.optionsTitle\": \"Titel på loginindstillinger\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Login med e-mail og adgangskode\",\n \"admin/editor.login.accessCodeTitle\": \"Adgangskode login titel\",\n \"admin/editor.login.emailPlaceholder\": \"E-mail-input pladsholder\",\n \"admin/editor.login.passwordPlaceholder\": \"Adgangskodeindtastningsholder\",\n \"admin/editor.login.accessCodePlaceholder\": \"Adgangskode input pladsholder\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Vis bekræftelse af adgangskodeformat som værktøjstip\",\n \"admin/editor.login.showIconProfile\": \"Vis profilikon\",\n \"admin/editor.login.iconLabel\": \"Etiket på login-knappen\",\n \"admin/editor.login.hideIconLabel\": \"Skjul etiketten på login-knappen\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"E-mail / adgangskode login-knap etiket\",\n \"admin/editor.login.hasIdentifierExtension\": \"E-mail / adgangskode-brugeridentifikationsudvidelse\",\n \"admin/editor.login.identifierPlaceholder\": \"Identifikator input pladsholder\",\n \"admin/editor.login.invalidIdentifierError\": \"Ugyldig identifikationsfejl\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Spejl værktøjstip til højre\",\n \"admin/editor.login.logInButtonBehavior\": \"Log på knappen adfærd\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Kontoindstillinger knapadfærd\",\n \"admin/editor.login.accountOptionLinks\": \"Kontoindstilling links\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Mærkat\",\n \"admin/editor.login.accountOptionPathTitle\": \"Sti\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"CSS klasse\",\n \"admin/editor.login.termsAndConditions\": \"Vilkår og betingelser markdown\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Aktivér Google One-tap-tilmelding\",\n \"admin/editor.login.googleOneTap.alignment\": \"Google One-tap-justering\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Google One-tap-topmargen\"\n}\n\n```"
}
] |
code_login_84871f73
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/messages/es.json from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store/error.oauth.unknown\": \"Lo sentimos, se produjo un error inesperado. Por favor, inténtelo de nuevo.\",\n \"store/error.oauth.refresh\": \"Lo sentimos, probablemente trató de actualizar su navegador durante el proceso. Por favor, inténtelo de nuevo.\",\n \"store/error.oauth.missingEmail\": \"Lo sentimos, no recibimos su correo electrónico. Por favor, compruebe sus permisos o póngase en contacto con la empresa responsable.\",\n \"store/loginOptions.title\": \"Escoja una opción para entrar\",\n \"store/loginOptions.emailVerification\": \"Recibir código de acceso por e-mail\",\n \"store/loginOptions.emailAndPassword\": \"Entrar con e-mail y contraseña\",\n \"store/loginOptions.oAuth\": \"Entrar con\",\n \"store/login.goBack\": \"Volver\",\n \"store/login.send\": \"Enviar\",\n \"store/login.create\": \"Crear\",\n \"store/login.confirm\": \"Confirmar\",\n \"store/login.accessCodeTitle\": \"Digite el código enviado a su e-mail\",\n \"store/login.myAccount\": \"Mi Cuenta\",\n \"store/login.hello\": \"Hola,\",\n \"store/login.logoutLabel\": \"Salir\",\n \"store/login.signIn\": \"Entrar\",\n \"store/login.code\": \"Código de Acceso\",\n \"store/login.notHaveAccount\": \"¿No tiene una cuenta? Regístrese\",\n \"store/login.forgotPassword\": \"Olvidé mi contraseña\",\n \"store/login.invalidEmail\": \"Entre con un e-mail válido\",\n \"store/login.invalidPassword\": \"Su contraseña debe contener: 8 caracteres, números y letras minúsculas y mayúsculas\",\n \"store/login.invalidMatch\": \"Confirmación de contraseña está incorrecta\",\n \"store/login.invalidCode\": \"Ingrese un código de acceso válido de 6 dígitos\",\n \"store/login.wrongCode\": \"El código de acceso es incorrecto\",\n \"store/login.wrongCredentials\": \"Usuario y/o contraseña equivocada\",\n \"store/login.userBlocked\": \"Usted se equivocó 4 veces al ingresar su contraseña. Su usuario fue bloqueado por una hora\",\n \"store/login.createPassword\": \"Validar correo electrónico y crear una nueva contraseña\",\n \"store/login.createPasswordSubtitle\": \"Ingrese el código que enviamos a {email} y cree una nueva contraseña\",\n \"admin/editor.login.title\": \"Login\",\n \"admin/editor.loginPage.title\": \"Página de Login\",\n \"store/login.confirmPassword\": \"Confirmar contraseña\",\n \"store/login.password.uppercaseLetter\": \"Una letra mayúscula\",\n \"store/login.password.lowercaseLetter\": \"Una letra minúscula\",\n \"store/login.password.number\": \"Un número\",\n \"store/login.password.eightCharacteres\": \"Mínimo 8 caracteres\",\n \"store/login.password.tooltip.title\": \"Su contraseña necesita tener:\",\n \"store/login.email.placeholder\": \"Ej.: ejemplo@mail.com\",\n \"store/login.password.placeholder\": \"Ingrese su contraseña \",\n \"store/login.accessCode.placeholder\": \"Ingrese su código de acceso\",\n \"store/login.autoRedirect.message\": \"Estamos redirigiéndolo a nuestro login de {provider}\",\n \"admin/editor.login.isInitialScreenOptionOnly.title\": \"Mostrar apenas las opciones de login en la pantalla inicial\",\n \"admin/editor.login.defaultOption.title\": \"Formulario inicial a ser mostrado\",\n \"admin/editor.login.defaultOption.token\": \"Login por código de acceso\",\n \"admin/editor.login.defaultOption.emailAndPassword\": \"Login por e-mail y contraseña \",\n \"admin/editor.login.optionsTitle\": \"Título de las opciones de login\",\n \"admin/editor.login.emailAndPasswordTitle\": \"Título del login con e-mail y contraseña\",\n \"admin/editor.login.accessCodeTitle\": \"Título del login por código de acceso\",\n \"admin/editor.login.emailPlaceholder\": \"Placeholder del campo de e-mail\",\n \"admin/editor.login.passwordPlaceholder\": \"Placeholder del campo de contraseña\",\n \"admin/editor.login.accessCodePlaceholder\": \"Placeholder del campo de código de acceso\",\n \"admin/editor.login.showPasswordVerificationIntoTooltip.title\": \"Mostrar verificación del formato de contraseña como tooltip\",\n \"admin/editor.login.showIconProfile\": \"Mostrar ícono de perfil\",\n \"admin/editor.login.iconLabel\": \"Título del botón de login\",\n \"admin/editor.login.hideIconLabel\": \"\",\n \"admin/editor.login.providerPasswordButtonLabel\": \"Etiqueta del botón de login con Email/Password\",\n \"admin/editor.login.hasIdentifierExtension\": \"Extensión del identificador de usuario de Email/Password\",\n \"admin/editor.login.identifierPlaceholder\": \"Placeholder del campo de identificador\",\n \"admin/editor.login.invalidIdentifierError\": \"Error de identificador inválido\",\n \"admin/editor.login.mirrorTooltipToRightTitle\": \"Reflejar tooltip a la derecha\",\n \"admin/editor.login.logInButtonBehavior\": \"Comportamiento del botón de login\",\n \"admin/editor.login.accountOptionsButtonBehavior\": \"Comportamiento del botón de opciones de la cuenta\",\n \"admin/editor.login.accountOptionLinks\": \"Enlaces de opción de la cuenta\",\n \"admin/editor.login.accountOptionLabelTitle\": \"Label\",\n \"admin/editor.login.accountOptionPathTitle\": \"Path\",\n \"admin/editor.login.accountOptionCssClassTitle\": \"Clase CSS\",\n \"admin/editor.login.termsAndConditions\": \"Markdown de términos y condiciones\",\n \"admin/editor.login.googleOneTap.title\": \"[Experimental] Habilitar Google One-tap sign-up\",\n \"admin/editor.login.googleOneTap.alignment\": \"Alineación de Google One-tap\",\n \"admin/editor.login.googleOneTap.marginTop\": \"Margen superior de Google One-tap\"\n}\n\n```"
}
] |
code_login_11933419
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of login/docs/README.md from the login VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Login\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nThe VTEX Login app handles user login in your store.\n\n\n\n## Configuration\n\n1. Add the Login app to your theme dependencies in the `manifest.json` file:\n\n```diff\n \"dependencies\": {\n+ \"vtex.login\": \"2.x\"\n }\n```\n\nNow, you can use all the blocks exported by the Login app. See the full list below:\n\n| Block name | Description |\n|:---------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|\n| `login` |  Renders the Login component, as shown above. |\n| `login-content` | Only renders the login form. |\n\n2. Add the `login` block and its props to your store header. For example:\n\n```json\n\"login\": {\n \"props\": {\n \"emailAndPasswordTitle\": \"LOG-IN\",\n \"accessCodeTitle\": \"Acess Code LOG-IN\",\n \"emailPlaceholder\": \"e-mail\",\n \"passwordPlaceholder\": \"password\",\n \"showPasswordVerificationIntoTooltip\": true,\n }\n}\n```\n\n### `login` props\n\n| Prop name | Type | Description | Default value |\n|:-------------------------------------:|:----------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------:|\n| `optionsTitle` | `string` | Title text for login options. | `undefined` |\n| `emailAndPasswordTitle` | `string` | Text that will display with the email and password option. | `undefined` |\n| `accessCodeTitle` | `string` | Text that will display with the access code option. | `undefined` |\n| `emailPlaceholder` | `string` | Text that will display as a placeholder for the email input. | `undefined` |\n| `passwordPlaceholder` | `string` | Text that will display as a placeholder for the password input. | `undefined` |\n| `acessCodePlaceholder` | `string` | Text that will display as a placeholder for the access code input. | `undefined` |\n| `showPasswordVerificationIntoTooltip` | `boolean` | Determines whether a tooltip for checking the password format should be shown (`true`) or not (`false`). | `true` |\n| `showIconProfile` | `boolean` | Determines whether the `hpa-profile` icon from [Store Icons](https://developers.vtex.com/docs/guides/vtex-store-icons/) should be displayed in the Login component (`true`) or not (`false`). | `true` |\n| `iconLabel` | `string` | Title text for the Login icon. | `undefined` |\n| `hideIconLabel` | `boolean` | Determines whether the text string defined for the Login icon should be hidden (`true`) or not (`false`). | `false` |\n| `labelClasses` | `[string]` | Login icon classnames. | `undefined` |\n| `providerPasswordButtonLabel` | `string` | Text that will display as the password button label. | `undefined` |\n| `hasIdentifierExtension` | `boolean` | Whether the identifier extension configurations should be enabled (`true`) or not (`false`). For more information, see the Advanced Configuration section below. | `true` |\n| `identifierPlaceholder` | `string` | Text that will display as a placeholder for the extension input. | `undefined` |\n| `invalidIdentifierError` | `string` | Error message for invalid user identifier. | `undefined` |\n| `mirrorTooltipToRight` | `boolean` | Whether the Login tooltip should open on the right side of the screen (`true`) or not (`false`). | `false` |\n| `logInButtonBehavior` | `enum` | Expected behavior of the Login component when clicked. Possible values are: `popover` (opens a popover tab) and `link` (redirects the user to the `/login` page). | `popover` |\n| `accountOptionsButtonBehavior` | `enum` | Expected behavior of the My account button when clicked. Possible values are: `popover` (opens a popover tab) and `link` (redirects the user to the `/account` page). | `popover` |\n| `accountOptionLinks` | `[object]` | Creates a custom link to replace the `accountOptionsButtonBehavior` set default `link` value (`/account`). See below the available props for the object. | `undefined` |\n| `termsAndConditions` | `string` | Text that will display below the login options regarding terms and conditions. | `undefined` |\n| `hasGoogleOneTap` | `boolean` |  Determines whether the [Google One Tap sign-up and auto sign-in](https://developers.google.com/identity/gsi/web/guides/overview) is displayed. | `false` |\n| `googleOneTapAlignment` | `enum` |  Defines the pop-up alignment for Google One Tap login. Possible values are `left` and `right`. | `right` |\n| `googleOneTapMarginTop` | `string` |  Defines the top margin for the Google One Tap login pop-up. The supported values are the same values supported by the CSS `top` property. | `3rem` |\n| `disabledEmailInputs` | `boolean` | Determines whether user email editing should be allowed (`true`) or not (`false`). | `false` |\n\n> ⚠️ _Keep in mind that the Google One Tap props are still in beta. Although they are ready to be used, UX improvements should be expected._\n\n- **`accountOptionLinks` object:**\n\n| Prop name | Type | Description | Default value |\n|:----------:|:----------:|:-------------------------------:|:-------------:|\n| `label` | `string` | Text label for the custom link. | `undefined` |\n| `path` | `string` | Custom link path. | `undefined` |\n| `cssClass` | `[string]` | Login icon classnames. | `undefined` |\n\n### `login-content` props\n\n| Prop name | Type | Description | Default value |\n|:-------------------------------------:|:---------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------:|\n| `isInitialScreenOptionOnly` | `boolean` | Determines whether only the login options will be displayed on the initial screen (`true`) or not (`false`). | `true` |\n| `defaultOption` | `enum` | Defines the default login options that will be shown. Possible values are: `0` (shows the access code option), `1` (shows the email/password option), and `2` (shows the corporate option). | `0` |\n| `optionsTitle` | `string` | Title text for login options. | `undefined` |\n| `emailAndPasswordTitle` | `String` | Text that will display with the email and password option. | `undefined` |\n| `accessCodeTitle` | `string` | Text that will display with the access code option. | `undefined` |\n| `emailPlaceholder` | `string` | Text that will display as a placeholder for the email input. | `undefined` |\n| `passwordPlaceholder` | `string` | Text that will display as a placeholder for the password input. | `undefined` |\n| `showPasswordVerificationIntoTooltip` | `boolean` | Determines whether a tooltip for checking the password format should be shown (`true`) or not (`false`). | `true` |\n| `acessCodePlaceholder` | `string` | Text that will display as a placeholder for the access code input. | `undefined` |\n| `providerPasswordButtonLabel` | `string` | Text that will display as the password button label. | `undefined` |\n| `hasIdentifierExtension` | `boolean` | Whether the identifier extension configurations should be enabled (`true`) or not (`false`). For more information, see the Advanced Configuration section below. | `true` |\n| `identifierPlaceholder` | `string` | Text that will display as a placeholder for the extension input. | `undefined` |\n| `invalidIdentifierError` | `string` | Error message for invalid user identifier. | `undefined` |\n| `termsAndConditions` | `string` | Text that will display below the login options regarding terms and conditions. | `undefined` |\n| `disabledEmailInputs` | `boolean` | Determines whether user email editing should be allowed (`true`) or not (`false`). | `false` |\n\n### Advanced configuration\n\nBy default, the email/password login asks two inputs from users:\n\n- Email (_user identifier_)\n- Password\n\nYou can set up the User Identifier Extension to allow other identifiers to be used in the Login form as long as they can be resolved to the user email in the background.\n\nFor example: If your account stores the national identity document of each user, the email/password login could be changed to ask for the following two inputs:\n\n- National identity document (_user identifier_)\n- Password\n\nIn order to display an identifier other than the user email, you have to create an **extension app** of your own to run in the background alongside the Login component.\n\nThe new extension app should be set up to receive the custom user identifier from the interface, such as the national identity document, and link it to the right user using store data. After that, the app should fetch the user email and return it to the Login app, which will behave as if the user had entered their email.\n\nBelow, you can find the instructions for running the User Identifier Extension in your store:\n\n> ⚠️ Only enterprise clients can use this extension. You can check your account plan in your VTEX contract.\n\n1. Make sure that the Login app is added as the extension app dependency and that the `store` builder is listed as one of its builders, as shown below:\n\n```json\n\"dependencies\": {\n \"vtex.login\": \"2.x\"\n},\n```\n\n```json\n\"builders\": {\n \"store\": \"0.x\",\n},\n```\n\n2. [Develop a new component](https://vtex.io/docs/getting-started/desenvolva-componentes-usando-vtex-io-e-react/1) to replace the `email` input in the login form. This can be anything you want in its place, such as a file uploader or a simple text input which gets the national identity document.\n\nWhen developing the component, remember that it must know how to convert the custom identifier to an email. This should be done by adding a callback function that returns an email within the Login app in the `react/{{ComponentName}}.js` file. For example:\n\n```js\nimport { useState, useCallback, useEffect } from \"react\";\n\nconst ComponentName = ({\n renderInput,\n identifierPlaceholder,\n registerSubmitter,\n}) => {\n // The component receives 3 props:\n // - renderInput is a function that returns the same input component used by the login app, defined in styleguide.\n // It receives an object with three named parameters, trivially used by Inputs with react: value, onChange, placeholder.\n // When \"onChange\" is called, the login app clears the \"email is invalid\" error, if it exists.\n // - identifierPlaceholder is the value of the configuration \"identifierPlaceholder\" defined in the storefront. It has a\n // fallback to the value of the configuration \"emailPlaceholder\".\n // - registerSubmitter is a function that receives your async callback function defined in this file. Your callback will be called\n // when the user submits the form.\n\n // This code controls the state of the rendered Input component.\n const [inputValue, setInputValue] = useState(\"\");\n const onChangeInput = useCallback(\n (e) => setInputValue(e.target.value),\n [setInputValue]\n );\n\n // This callback function (onSubmit) should return the resolved email. In the example below, it adds `@email.com` to the current\n // value in the Input component (e.g.: \"john\" would be resolved to \"john@email.com\").\n const onSubmit = useCallback(async () => {\n const email = `${inputValue}@email.com`;\n return email;\n }, [inputValue]);\n\n // This code adds the async callback function you defined in the login app when this component mounts.\n useEffect(() => {\n registerSubmitter(onSubmit);\n }, [registerSubmitter, onSubmit]);\n\n // The component calls \"renderInput\" and renders its result.\n return renderInput({\n value: inputValue,\n onChange: onChangeInput,\n placeholder: identifierPlaceholder,\n });\n};\n\nexport default ComponentName;\n```\n\n3. In the `store/interfaces.json` file, create a new [interface](https://developers.vtex.com/docs/guides/vtex-io-documentation-interface) for `user-identifier`, declaring the component you created in the previous step:\n\n```json\n\"user-identifier.{{InterfaceName}}\": {\n \"component\": \"{{ComponentName}}\"\n},\n```\n\n> ℹ️ The interface name, which is represented in the example above as `{{InterfaceName}}` can be anything your want. In the example above, the component created in step 2 is represented by `{{ComponentName}}`.\n\n4. In the `store/plugins.json` file, add the new interface (`user-identifier`) for the Login app:\n\n```json\n\"login > user-identifier\": \"user-identifier.{{InterfaceName}}\",\n\"login-content > user-identifier\": \"user-identifier.{{InterfaceName}}\",\n```\n\n> ℹ️ If the `store/plugins.json` file is not available, you should create it.\n\n> ⚠️ Since the Login app behaves as if users were typing their emails, error messages like `The email is invalid` may appear even if the component is requesting other identifiers from users. This message, and others, can be edited via the Store Editor in the Admin.\n\n## App behavior\n\nThe Login app reads the following query-string parameters:\n\n- `returnUrl` - Redirects users to the given `returnUrl` once they are logged in. Caution: This parameter only works for the store domain and should be UTF-8 encoded (like javascript's `encodeURIComponent`).\n- `oAuthRedirect` - Redirects users to the given OAuth provider page instead of displaying the native login options. For this to work, the given OAuth provider must be listed in the component as one of the login options. Caution: The parameter value is case-sensitive and must be `Google`, `Facebook`, or the name of the chosen OAuth provider.\n- `userEmail` - User email information.\n- `flowState` - Default state of the login flow. Possible values:\n - `createPass` - Sends an email to users with the code required to create a new password. Caution: When used, this parameter also requires the `userEmail` query string in the same URL.\n\n> ℹ️ _Use the parameters above to build the desired Login URLs that will allow you to set the expected behavior for the component._\n\n## Customization\n\nIn order to apply CSS customizations in this and other blocks, follow the instructions in the recipe for [Using CSS handles for store customization](https://developers.vtex.com/docs/guides/vtex-io-documentation-using-css-handles-for-store-customization).\n\n| CSS handles |\n|:----------------------------:|\n| `container` |\n| `contentInitialScreen` |\n| `contentFormVisible` |\n| `profile` |\n| `label` |\n| `optionsSticky` |\n| `optionsList` |\n| `optionsListItem` |\n| `optionsListItemContainer` |\n| `accessCodeOptionBtn` |\n| `emailPasswordOptionBtn` |\n| `corporateOptionBtn` |\n| `facebookOptionBtn` |\n| `googleOptionBtn` |\n| `customOAuthOptionBtn` |\n| `oauthProvider` |\n| `inputContainer` |\n| `inputContainerAccessCode` |\n| `inputContainerPassword` |\n| `inputContainerEmail` |\n| `emailVerification` |\n| `emailForm` |\n| `emailAndPasswordForm` |\n| `forgotPasswordForm` |\n| `formLinkContainer` |\n| `arrowUp` |\n| `buttonLink` |\n| `formError` |\n| `content` |\n| `content--emailVerification` |\n| `content--emailAndPassword` |\n| `content--codeConfirmation` |\n| `content--accountOptions` |\n| `content--recoveryPassword` |\n| `button` |\n| `sendButton` |\n| `buttonSocial` |\n| `buttonDanger` |\n| `backButton` |\n| `accountOptions` |\n| `codeConfirmation` |\n| `corporateEmail` |\n| `formTitle` |\n| `formSubtitle` |\n| `box` |\n| `contentContainer` |\n| `formFooter` |\n| `contentForm` |\n| `contentAlwaysWithOptions` |\n| `options` |\n| `tooltipContainer` |\n| `tooltipContainerTop` |\n| `tooltipContainerLeft` |\n| `loginOptionsContainer` |\n| `termsAndConditions` |\n| `forgotPasswordLink` |\n| `dontHaveAccount` |\n| `eyeIcon` |\n\n<!-- DOCS-IGNORE:start -->\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n<!-- DOCS-IGNORE:end -->\n\n```"
}
] |
code_text-link-fixer_7b171271
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of text-link-fixer/docs/README.md from the text-link-fixer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Text link fixer\n\nApp in VTEX that receives a notification when a SKU is changed or created, if the associated product contains spaces in its text-link, this will be cleaned from spaces.\n\n## How it works?\n\n\n\n## How to install\n\n⚠️ First, make sure the broadcaster app is installed.\n\n\nRun command: `vtex install vtex.text-link-fixer`\n\n```"
}
] |
code_text-link-fixer_e78086ef
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of text-link-fixer/node/service.json from the text-link-fixer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"memory\": 128,\n \"ttl\": 10,\n \"timeout\": 2,\n \"minReplicas\": 2,\n \"maxReplicas\": 10,\n \"workers\": 4,\n \"events\": {\n \"skuChange\": {\n \"keys\": [\"broadcaster.notification\"]\n }\n }\n}\n\n```"
}
] |
code_text-link-fixer_5d3cdaf6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of text-link-fixer/node/package.json from the text-link-fixer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"dependencies\": {\n \"co-body\": \"^6.0.0\"\n },\n \"devDependencies\": {\n \"@types/co-body\": \"^0.0.3\",\n \"@types/node\": \"12.x\",\n \"@vtex/api\": \"6.45.13\",\n \"@vtex/tsconfig\": \"^0.5.6\",\n \"typescript\": \"3.9.7\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty && eslint -c .eslintrc.json --fix './**/*.ts'\"\n },\n \"version\": \"0.7.2\"\n}\n\n```"
}
] |
code_text-link-fixer_60cdb7c3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of text-link-fixer/node/index.ts from the text-link-fixer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type {\n IOClients,\n ParamsContext,\n ServiceContext,\n RecorderState,\n ClientsConfig,\n} from '@vtex/api'\nimport { Service } from '@vtex/api'\n\nimport { skuChange } from './events/skuChange'\nimport { Clients } from './clients'\n\nconst TIMEOUT_MS = 10000\nconst CONCURRENCY = 10\n\ndeclare global {\n type Context = ServiceContext<IOClients, State>\n\n interface State extends RecorderState {\n code: number\n }\n}\n\nconst clients: ClientsConfig<Clients> = {\n // We pass our custom implementation of the clients bag, containing the Status client.\n implementation: Clients,\n options: {\n // All IO Clients will be initialized with these options, unless otherwise specified.\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n },\n events: {\n exponentialTimeoutCoefficient: 2,\n exponentialBackoffCoefficient: 2,\n initialBackoffDelay: 50,\n retries: 1,\n timeout: TIMEOUT_MS,\n concurrency: CONCURRENCY,\n },\n },\n}\n\nexport default new Service<Clients, State, ParamsContext>({\n clients,\n events: {\n skuChange,\n },\n})\n\n```"
}
] |
code_text-link-fixer_b3a28173
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of text-link-fixer/node/clients/index.ts from the text-link-fixer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport Catalog from './catalog'\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {\n public get catalog() {\n return this.getOrSet('catalog', Catalog)\n }\n}\n\n```"
}
] |
code_text-link-fixer_a972aef1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of text-link-fixer/node/clients/catalog.ts from the text-link-fixer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\n\ninterface UpdateBody {\n Name: string\n CategoryId: number\n BrandId: number\n LinkId: string\n}\n\nconst PRODUCT_URL = '/catalog/pvt/product/'\nconst SKU_URL = '/catalog_system/pvt/sku/stockkeepingunitbyid/'\n\nexport default class Catalog extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(`http://${context.account}.myvtex.com/api`, context, {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie:\n context.adminUserAuthToken ?? context.authToken ?? '',\n 'X-Vtex-Use-Https': 'true',\n },\n })\n }\n\n public async getSku(skuId: string) {\n return this.http.get(`${SKU_URL}${skuId}`, {\n metric: 'get-product-by-sku-id',\n })\n }\n\n public async getProduct(productId: string) {\n return this.http.get(`${PRODUCT_URL}${productId}`, {\n metric: 'get-product-by-product-id',\n })\n }\n\n public async updateProduct(data: UpdateBody, productId: string) {\n return this.http.put(`${PRODUCT_URL}${productId}`, data, {\n metric: 'update-product-by-product-id',\n })\n }\n}\n\n```"
}
] |
code_text-link-fixer_908a2807
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of text-link-fixer/node/utils/clearString.ts from the text-link-fixer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nconst removeSpecialCharacters = (url: string) => {\n let newUrl = ''\n\n const str =\n '\\'.,\" !@#$%\\x00a8&+,´`*()-?:;={}][/\\x00c4\\x00c5\\x00c1\\x00c2\\x00c0\\x00c3\\x00e4\\x00e1\\x00e2\\x00e0\\x00e3\\x00c9\\x00ca\\x00cb\\x00c8\\x00e9\\x00ea\\x00eb\\x00e8\\x00cd\\x00ce\\x00cf\\x00cc\\x00ed\\x00ee\\x00ef\\x00ec\\x00d6\\x00d3\\x00d4\\x00d2\\x00d5\\x00f6\\x00f3\\x00f4\\x00f2\\x00f5\\x00dc\\x00da\\x00db\\x00fc\\x00fa\\x00fb\\x00f9\\x00c7\\x00e7 /'\n\n const str2 =\n '-----------------------------AAAAAAaaaaaEEEEeeeeIIIIiiiiOOOOOoooooUUUuuuuCc--'\n\n for (let i = 0; i < str.length; i++) {\n newUrl = url.replace(str[i], str2[i])\n }\n\n // Remove special spaces\n newUrl = url.replace(/\\s+/g, '-')\n\n return newUrl\n}\n\nexport function clearString(url: string) {\n const newUrl = removeSpecialCharacters(url).toLowerCase()\n\n return newUrl\n}\n\n```"
}
] |
code_text-link-fixer_76737732
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of text-link-fixer/node/events/skuChange.ts from the text-link-fixer VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { EventContext } from '@vtex/api'\nimport { LogLevel, NotFoundError, ResolverError } from '@vtex/api'\n\nimport { clearString } from '../utils/clearString'\nimport type { Clients } from '../clients'\n\nexport async function skuChange(ctx: EventContext<Clients>) {\n const {\n clients: { catalog: catalogClient },\n } = ctx\n\n const { IdSku, HasStockKeepingUnitModified } = ctx.body\n\n if (!HasStockKeepingUnitModified) return\n\n let sku\n let product\n let newTextLink\n let productId\n\n try {\n sku = await catalogClient.getSku(IdSku)\n\n productId = sku.ProductId\n\n product = await catalogClient.getProduct(productId)\n\n if (!/\\s/.test(product.LinkId)) return\n\n newTextLink = clearString(product.LinkId)\n } catch (error) {\n const erroMessage = `SKU ${IdSku} not found.`\n const splunkError = {\n error: erroMessage,\n detail: error,\n }\n\n ctx.vtex.logger.log(splunkError, LogLevel.Error)\n throw new NotFoundError(erroMessage)\n }\n\n try {\n const bodyPayload = {\n Name: product.Name,\n CategoryId: product.CategoryId,\n BrandId: product.BrandId,\n LinkId: newTextLink,\n }\n\n await catalogClient.updateProduct(bodyPayload, productId)\n } catch (error) {\n const erroMessage = `Product ${productId} cannot be updated.`\n const splunkError = {\n error: erroMessage,\n detail: error,\n }\n\n ctx.vtex.logger.log(splunkError, LogLevel.Error)\n throw new ResolverError(erroMessage)\n }\n\n return true\n}\n\n```"
}
] |
code_b2b-organizations-graphql_e374b346
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/docs/README.md from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# B2B Organizations GraphQL\n\nGraphQL backend for [B2B Organizations](https://github.com/vtex-apps/b2b-organizations).\n\n```"
}
] |
code_b2b-organizations-graphql_3585f160
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/graphql/schema.graphql from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ntype Query {\n getAppSettings: SettingsResponse\n @cacheControl(scope: PUBLIC, maxAge: SHORT)\n @auditAccess\n getOrganizationRequests(\n status: [String]\n search: String\n page: Int = 1\n pageSize: Int = 25\n sortOrder: String = \"DESC\"\n sortedBy: String = \"created\"\n ): OrganizationRequestResult\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n @validateAdminUserAccess\n getOrganizationRequestById(id: ID!): OrganizationRequest\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n @validateAdminUserAccess\n getOrganizations(\n status: [String]\n search: String\n page: Int = 1\n pageSize: Int = 25\n sortOrder: String = \"ASC\"\n sortedBy: String = \"name\"\n ): OrganizationResult\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n @validateStoreUserAccess\n\n getOrganizationsWithoutSalesManager: [Organization]\n @cacheControl(scope: PRIVATE)\n @validateAdminUserAccess\n\n getOrganizationById(id: ID): Organization\n @cacheControl(scope: PRIVATE)\n @validateStoreUserAccess\n getOrganizationByIdStorefront(id: ID): Organization\n @withSession\n @cacheControl(scope: PRIVATE)\n @validateStoreUserAccess\n getCostCenters(\n search: String\n page: Int = 1\n pageSize: Int = 25\n sortOrder: String = \"ASC\"\n sortedBy: String = \"name\"\n ): CostCenterResult\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n @validateStoreUserAccess\n getCostCentersByOrganizationId(\n id: ID\n search: String\n page: Int = 1\n pageSize: Int = 25\n sortOrder: String = \"ASC\"\n sortedBy: String = \"name\"\n ): CostCenterResult\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n @validateStoreUserAccess\n getCostCentersByOrganizationIdStorefront(\n id: ID\n search: String\n page: Int = 1\n pageSize: Int = 25\n sortOrder: String = \"ASC\"\n sortedBy: String = \"name\"\n ): CostCenterResult\n @withSession\n @cacheControl(scope: PRIVATE)\n @validateStoreUserAccess\n getCostCenterById(id: ID!): CostCenter\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n @validateStoreUserAccess\n getCostCenterByIdStorefront(id: ID): CostCenter\n @withSession\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n @validateStoreUserAccess\n getUsers(organizationId: ID, costCenterId: ID): [B2BUser]\n @withSession\n @validateStoreUserAccess\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n getUsersPaginated(\n organizationId: ID\n costCenterId: ID\n page: Int\n pageSize: Int\n search: String\n sortOrder: String\n sortedBy: String\n ): B2BUserPagination\n @withSession\n @validateStoreUserAccess\n @cacheControl(scope: PRIVATE, maxAge: SHORT)\n getPaymentTerms: [PaymentTerm]\n @cacheControl(scope: PUBLIC, maxAge: SHORT)\n @auditAccess\n\n getOrganizationsByEmail(email: String): [B2BOrganization]\n @validateStoreUserAccess\n @cacheControl(scope: PRIVATE)\n\n getActiveOrganizationsByEmail(email: String): [B2BOrganization]\n @cacheControl(scope: PRIVATE)\n @validateStoreUserAccess\n\n getOrganizationsPaginatedByEmail(\n email: String\n page: Int = 1\n pageSize: Int = 25\n ): B2BOrganizationPaginated\n @validateStoreUserAccess\n @cacheControl(scope: PRIVATE)\n\n checkOrganizationIsActive(id: String): Boolean\n @cacheControl(scope: PRIVATE)\n @auditAccess\n getSalesChannels: [Channels]\n @cacheControl(scope: PUBLIC, maxAge: SHORT)\n @auditAccess\n getBinding(email: String!): Boolean\n @withSession\n @cacheControl(scope: PUBLIC, maxAge: SHORT)\n @auditAccess\n getMarketingTags(costId: ID!): MarketingTags\n @cacheControl(scope: PUBLIC, maxAge: SHORT)\n @auditAccess\n getB2BSettings: B2BSettings\n @cacheControl(scope: PUBLIC, maxAge: SHORT)\n @auditAccess\n getSellers: [Seller] @validateAdminUserAccess @cacheControl(scope: PRIVATE)\n getSellersPaginated(page: Int, pageSize: Int): GetSellersPaginatedResponse\n @validateAdminUserAccess\n @cacheControl(scope: PRIVATE)\n getAccount: Account @validateAdminUserAccess @cacheControl(scope: PRIVATE)\n}\n\ntype Account {\n id: ID\n name: String\n accountName: String\n tradingName: String\n isActive: Boolean\n}\n\ntype PaginationResponse {\n page: Int\n pageSize: Int\n total: Int\n}\n\ntype GetSellersPaginatedResponse {\n items: [Seller]\n pagination: PaginationResponse\n}\n\ntype Mutation {\n saveAppSettings: MutationResponse @cacheControl(scope: PRIVATE) @auditAccess\n createOrganizationRequest(\n input: OrganizationInput!\n notifyUsers: Boolean\n ): MasterDataResponse @auditAccess\n updateOrganizationRequest(\n id: ID!\n status: String!\n notes: String\n notifyUsers: Boolean\n ): MutationResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n deleteOrganizationRequest(id: ID!): MutationResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n createOrganization(\n input: OrganizationInput!\n notifyUsers: Boolean\n ): OrganizationCostCenterResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n createOrganizationAndCostCentersWithId(\n input: NormalizedOrganizationInput!\n ): MasterDataResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n createCostCenter(\n organizationId: ID\n input: CostCenterInput!\n ): MasterDataResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n createCostCenterWithId(\n organizationId: ID\n input: CostCenterInput!\n ): MasterDataResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n updateOrganization(\n id: ID!\n name: String!\n tradeName: String\n status: String!\n collections: [CollectionInput]\n paymentTerms: [PaymentTermInput]\n priceTables: [String]\n customFields: [CustomFieldInput]\n salesChannel: String\n sellers: [SellerInput]\n permissions: PermissionsInput\n notifyUsers: Boolean\n ): MutationResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n updateCostCenter(id: ID!, input: CostCenterInput!): MutationResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n createCostCenterAddress(\n costCenterId: ID\n address: AddressInput\n ): MutationResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n updateCostCenterAddress(\n costCenterId: ID\n address: AddressInput\n ): MutationResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n deleteOrganization(id: ID!): MutationResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n deleteCostCenter(id: ID!): MutationResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n saveUser(\n id: ID\n roleId: ID!\n userId: ID\n orgId: ID\n costId: ID\n clId: ID\n canImpersonate: Boolean = false\n name: String!\n email: String!\n ): MutationResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n \"\"\"\n addUser will create an user with the provided parameters.\n This is called either from the Admin UI or the storefront UI (where\n the buyer org manager/admin can add a new member to its own org/cost center).\n Although the mutation allows an id/userId/clId to be provided, these are not\n exposed/collected on the UIs.\n \"\"\"\n addUser(\n id: ID\n roleId: ID!\n userId: ID\n orgId: ID\n costId: ID\n clId: ID\n canImpersonate: Boolean = false\n name: String!\n email: String!\n ): MutationResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n \"\"\"\n createUserWithEmail is a simplified version of addUser. Both\n mutations will create an user for the org/cost center,\n but createUserWithEmail expect all fields (except canImpersonate) as\n required and does not allow the user to provide its own id/userId/clId,\n which will be automatically created by the mutation. In this case, the\n email is clearly used as an identifier for the user. This is currently\n used by the bulk import use case, but could be used by other use cases\n as well. This function also has stricter permissions to be used by the\n store admin only, but could have less strict permissions in the future.\n \"\"\"\n createUserWithEmail(\n orgId: ID!\n costId: ID!\n roleId: ID!\n name: String!\n email: String!\n canImpersonate: Boolean = false\n ): MutationResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n removeUserWithEmail(\n orgId: ID!\n costId: ID!\n email: String!\n ): MutationResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n updateUser(\n id: ID\n roleId: ID!\n userId: ID\n orgId: ID\n costId: ID\n clId: ID\n canImpersonate: Boolean = false\n name: String\n email: String\n ): MutationResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n removeUser(id: ID!, userId: ID, email: String!, clId: ID!): MutationResponse\n @withSession\n @withPermissions\n @validateStoreUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n impersonateUser(clId: ID, userId: ID): MutationResponse\n @deprecated(reason: \"Use impersonateB2BUser instead\")\n @withSession\n @withPermissions\n @cacheControl(scope: PRIVATE)\n @auditAccess\n impersonateB2BUser(id: ID!): MutationResponse\n @withSession\n @withPermissions\n @cacheControl(scope: PRIVATE)\n @auditAccess\n saveSalesChannels(channels: [SalesChannelsInput]!): MutationResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @cacheControl(scope: PRIVATE)\n\n setMarketingTags(costId: ID!, tags: [String]!): MutationResponse\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n @withSession\n @withPermissions\n @cacheControl(scope: PRIVATE)\n\n saveB2BSettings(input: B2BSettingsInput): MutationResponse\n @withSession\n @withPermissions\n @validateAdminUserAccess(adminPermission: \"B2B_ORGANIZATIONS_EDIT\")\n}\n\ntype SettingsResponse {\n adminSetup: Data\n}\n\ntype OrganizationRequestResult {\n data: [OrganizationRequest]\n pagination: Pagination\n}\n\ntype OrganizationResult {\n data: [Organization]\n pagination: Pagination\n}\n\ntype CostCenterResult {\n data: [CostCenter]\n pagination: Pagination\n}\n\ntype Pagination {\n page: Int\n pageSize: Int\n total: Int\n}\n\ntype OrganizationRequest {\n id: ID\n name: String\n tradeName: String\n defaultCostCenter: DefaultCostCenter\n b2bCustomerAdmin: B2BUserSimple\n status: String\n notes: String\n created: String\n customFields: [CustomField]\n}\n\ntype B2BUserSimple {\n firstName: String\n lastName: String\n email: String\n}\n\ntype Seller {\n id: String\n name: String\n email: String\n}\n\ntype DefaultCostCenter {\n name: String\n address: Address\n phoneNumber: String\n businessDocument: String\n customFields: [CustomField]\n stateRegistration: String\n sellers: [Seller]\n}\n\ntype Organization {\n id: ID\n name: String\n tradeName: String\n collections: [Collection]\n paymentTerms: [PaymentTerm]\n priceTables: [String]\n sellers: [Seller]\n customFields: [CustomField]\n permissions: Permissions\n salesChannel: String\n costCenters: [ID]\n status: String\n created: String\n}\n\ntype Collection {\n id: String\n name: String\n}\n\ntype PaymentTerm {\n id: ID\n name: String\n}\n\ntype CostCenter {\n id: ID\n name: String\n organization: ID\n addresses: [Address]\n paymentTerms: [PaymentTerm]\n phoneNumber: String\n businessDocument: String\n customFields: [CustomField]\n stateRegistration: String\n sellers: [Seller]\n}\n\ntype Address {\n addressId: String\n addressType: String\n addressQuery: String\n postalCode: String\n country: String\n receiverName: String\n city: String\n state: String\n street: String\n number: String\n complement: String\n neighborhood: String\n geoCoordinates: [Float]\n reference: String\n}\n\ntype MasterDataResponse {\n id: String\n href: String\n status: String\n}\n\ntype OrganizationCostCenterResponse {\n id: String\n costCenterId: String\n href: String\n status: String\n}\n\ntype MutationResponse {\n id: String\n status: String\n message: String\n}\n\ntype B2BUserPagination {\n data: [B2BUser]\n pagination: Pagination\n}\n\ntype B2BUser {\n id: ID\n roleId: ID\n userId: ID\n clId: ID\n orgId: ID\n costId: ID\n name: String!\n email: String!\n canImpersonate: Boolean\n role: SimpleRole\n organizationName: String\n costCenterName: String\n}\n\ntype B2BOrganization {\n id: ID\n clId: ID\n costId: ID\n orgId: ID\n roleId: ID\n role: SimpleRole\n organizationName: String\n organizationStatus: String\n costCenterName: String\n}\n\ntype B2BOrganizationPaginated {\n data: [B2BOrganization]\n pagination: Pagination\n}\n\ntype SimpleRole {\n id: ID\n name: String!\n slug: String\n}\n\ntype Channels {\n id: String\n name: String\n}\n\ntype MarketingTags {\n tags: [String]\n}\n\ntype B2BSettings {\n autoApprove: Boolean\n businessReadOnly: Boolean\n stateReadOnly: Boolean\n defaultPaymentTerms: [PaymentTerm]\n defaultPriceTables: [String]\n organizationCustomFields: [SettingsCustomField]\n costCenterCustomFields: [SettingsCustomField]\n uiSettings: UISettings\n transactionEmailSettings: TransactionEmailSettings\n}\n\ntype TransactionEmailSettings {\n organizationApproved: Boolean\n organizationCreated: Boolean\n organizationDeclined: Boolean\n organizationRequestCreated: Boolean\n organizationStatusChanged: Boolean\n}\n\ntype TopBarSettings {\n name: String\n hexColor: String\n}\n\ntype UISettings {\n showModal: Boolean\n clearCart: Boolean\n fullImpersonation: Boolean\n topBar: TopBarSettings\n}\n\nscalar Data\n\ninput OrganizationInput {\n id: String\n name: String\n tradeName: String\n b2bCustomerAdmin: B2BUserInput\n defaultCostCenter: DefaultCostCenterInput\n costCenters: [DefaultCostCenterInput]\n paymentTerms: [PaymentTermInput]\n priceTables: [String]\n salesChannel: String\n sellers: [SellerInput]\n customFields: [CustomFieldInput]\n collections: [CollectionInput]\n}\n\n\"\"\"\nNormalizedOrganizationInput is basically the same as OrganizationInput,\nbut with the fields in a normalized format, i.e. the following fields\nare expected as a list of names only instead of objects with id and name:\npaymentTerms, sellers and collections.\n\"\"\"\ninput NormalizedOrganizationInput {\n id: String\n name: String\n tradeName: String\n b2bCustomerAdmin: B2BUserInput\n defaultCostCenter: DefaultCostCenterInput\n costCenters: [DefaultCostCenterInput]\n paymentTerms: [String]\n priceTables: [String]\n salesChannel: String\n sellers: [String]\n collections: [String]\n customFields: [CustomFieldInput]\n}\n\ninput B2BUserInput {\n firstName: String\n lastName: String\n email: String\n}\n\ninput DefaultCostCenterInput {\n id: String\n name: String\n address: AddressInput\n paymentTerms: [PaymentTermInput]\n phoneNumber: String\n businessDocument: String\n customFields: [CustomFieldInput]\n stateRegistration: String\n marketingTags: [String]\n user: B2BUserInput\n sellers: [SellerInput]\n}\n\ninput CostCenterInput {\n id: String\n name: String\n addresses: [AddressInput]\n paymentTerms: [PaymentTermInput]\n phoneNumber: String\n businessDocument: String\n customFields: [CustomFieldInput]\n stateRegistration: String\n}\n\ninput PermissionsInput {\n createQuote: Boolean\n}\n\ntype Permissions {\n createQuote: Boolean\n}\n\ninput AddressInput {\n addressId: String\n addressType: String\n addressQuery: String\n postalCode: String\n country: String\n receiverName: String\n city: String\n state: String\n street: String\n number: String\n complement: String\n neighborhood: String\n geoCoordinates: [Float]\n reference: String\n}\n\ninput CollectionInput {\n id: String\n name: String\n}\n\ninput SellerInput {\n id: String\n name: String\n}\n\ninput PaymentTermInput {\n id: ID\n name: String\n}\n\nenum CustomFieldType {\n text\n dropdown\n}\n\ntype CustomField {\n name: String\n type: CustomFieldType\n value: String\n dropdownValues: [DropdownValue]\n useOnRegistration: Boolean\n}\n\ntype SettingsCustomField {\n name: String\n type: CustomFieldType\n dropdownValues: [DropdownValue]\n useOnRegistration: Boolean\n}\n\ninput CustomFieldInput {\n name: String!\n type: CustomFieldType!\n value: String\n dropdownValues: [DropdownValueInput]\n useOnRegistration: Boolean\n}\n\ninput SalesChannelsInput {\n id: String\n name: String\n}\n\ninput TransactionEmailSettingsInput {\n organizationApproved: Boolean\n organizationCreated: Boolean\n organizationDeclined: Boolean\n organizationRequestCreated: Boolean\n organizationStatusChanged: Boolean\n}\n\ninput TopBarSettingsInput {\n name: String\n hexColor: String\n}\n\ninput UISettingsInput {\n showModal: Boolean\n clearCart: Boolean\n fullImpersonation: Boolean\n topBar: TopBarSettingsInput\n}\n\ninput B2BSettingsInput {\n autoApprove: Boolean\n businessReadOnly: Boolean\n stateReadOnly: Boolean\n defaultPaymentTerms: [PaymentTermInput]\n defaultPriceTables: [String]\n uiSettings: UISettingsInput\n organizationCustomFields: [CustomFieldInput]\n costCenterCustomFields: [CustomFieldInput]\n transactionEmailSettings: TransactionEmailSettingsInput\n}\n\ntype DropdownValue {\n value: String\n label: String\n}\n\ninput DropdownValueInput {\n value: String\n label: String\n}\n\n```"
}
] |
code_b2b-organizations-graphql_ee746cf4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/graphql/directives.graphql from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\ndirective @withSession on FIELD | FIELD_DEFINITION\ndirective @withPermissions on FIELD | FIELD_DEFINITION\ndirective @validateAdminUserAccess(\n adminPermission: String = \"B2B_ORGANIZATIONS_VIEW\"\n) on FIELD | FIELD_DEFINITION\ndirective @validateStoreUserAccess(\n adminPermission: String = \"B2B_ORGANIZATIONS_VIEW\"\n) on FIELD | FIELD_DEFINITION\ndirective @checkUserAccess on FIELD | FIELD_DEFINITION\ndirective @checkAdminAccess on FIELD | FIELD_DEFINITION\ndirective @auditAccess on FIELD | FIELD_DEFINITION\n\n```"
}
] |
code_b2b-organizations-graphql_cbd57013
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/service.json from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"stack\": \"nodejs\",\n \"memory\": 1024,\n \"ttl\": 300,\n \"timeout\": 60,\n \"cpu\": {\n \"type\": \"shared\",\n \"value\": 5,\n \"scalingPercentage\": 20\n },\n \"minReplicas\": 8,\n \"maxReplicas\": 80,\n \"workers\": 1,\n \"routes\": {\n \"orders\": {\n \"path\": \"/_v/private/b2b/oms/user/orders/\",\n \"public\": true\n },\n \"checkout\": {\n \"path\": \"/b2b/oms/user/checkout/\",\n \"public\": true\n },\n \"order\": {\n \"path\": \"/_v/private/b2b/oms/user/orders/:orderId\",\n \"public\": true\n },\n \"requestCancellation\": {\n \"path\": \"/_v/private/b2b/checkout/pub/orders/:orderId/user-cancel-request\",\n \"public\": true\n },\n \"__graphql\": {\n \"path\": \"/_v/graphql\",\n \"policies\": [\n {\n \"effect\": \"allow\",\n \"actions\": [\"get\"],\n \"principals\": [\n \"vrn:apps:*:{{account}}:*:app/vtex.storefront-permissions@*\"\n ]\n }\n ]\n }\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_46ac9dad
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/typings.d.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Logger } from '@vtex/api/lib/service/logger/logger'\n\ninterface ReqContext {\n account: string\n workspace: string\n authToken: string\n region: string\n production: boolean\n userAgent: string\n}\n\ninterface OperationState {\n orderFormId: string\n ctx: ReqContext\n data?: OperationData\n logger: Logger\n}\n\ninterface OperationData {\n orderForm?: any\n userProfileId: string\n cookie: string\n}\n\ntype ProcessPaymentStep = (\n state: OperationState,\n next: () => Promise<void>\n) => Promise<void>\n\ntype LogLevel = 'info' | 'error' | 'warning'\n\ntype Timings = { [middleware: string]: [number, number] }\n\ndeclare module '*.json' {\n const value: any\n export default value\n}\ninterface Seller {\n id: string\n name: string\n}\n\ninterface OrganizationInput {\n id?: string\n name: string\n tradeName?: string\n b2bCustomerAdmin: B2BCustomerInput\n defaultCostCenter?: DefaultCostCenterInput\n costCenters?: DefaultCostCenterInput[]\n customFields?: CustomField[]\n paymentTerms?: PaymentTerm[]\n priceTables?: Price[]\n salesChannel?: string\n sellers?: Seller[]\n collections?: Collection[]\n}\n\ninterface NormalizedOrganizationInput {\n id?: string\n name: string\n tradeName?: string\n b2bCustomerAdmin: B2BCustomerInput\n defaultCostCenter?: DefaultCostCenterInput\n costCenters?: DefaultCostCenterInput[]\n customFields?: CustomField[]\n paymentTerms?: string[]\n priceTables?: Price[]\n salesChannel?: string\n sellers?: string[]\n collections?: string[]\n}\n\ninterface B2BCustomerInput {\n firstName: string\n lastName: string\n email: string\n}\n\ninterface DefaultCostCenterInput {\n id?: string\n name: string\n address: AddressInput\n phoneNumber?: string\n businessDocument?: string\n customFields?: CustomField[]\n stateRegistration?: string\n sellers?: Seller[]\n marketingTags?: string[]\n user?: B2BUserInput\n}\n\ninterface CostCenterInput {\n id?: string\n name: string\n addresses?: AddressInput[]\n paymentTerms?: PaymentTerm[]\n phoneNumber?: string\n businessDocument?: string\n customFields?: CustomField[]\n stateRegistration?: string\n marketingTags?: string[]\n user?: B2BCustomerInput\n sellers?: Seller[]\n}\n\ninterface CostCenterInputWithId {\n id: string\n name: string\n addresses?: AddressInput[]\n paymentTerms?: PaymentTerm[]\n phoneNumber?: string\n businessDocument?: string\n customFields?: CustomField[]\n stateRegistration?: string\n marketingTags?: string[]\n user?: B2BCustomerInput\n sellers?: Seller[]\n}\n\ninterface AddressInput {\n addressId: string\n addressType: string\n postalCode: string\n country: string\n receiverName: string\n city: string\n state: string\n street: string\n number: string\n complement: string\n neighborhood: string\n geoCoordinates: [number]\n}\n\ninterface OrganizationRequest {\n costCenters: DefaultCostCenterInput[]\n name: string\n tradeName?: string\n defaultCostCenter: DefaultCostCenterInput\n b2bCustomerAdmin: B2BCustomerInput\n status: string\n created: string\n paymentTerms?: PaymentTerm[]\n priceTables?: Price[]\n salesChannel?: string\n sellers?: Seller[]\n customFields?: CustomField[]\n}\n\ninterface Organization {\n id: string\n name: string\n tradeName?: string\n collections: Collection[]\n costCenters: string[]\n paymentTerms: PaymentTerm[]\n priceTables?: string[]\n permissions?: Permissions\n status: string\n created: string\n customFields?: CustomField[]\n salesChannel?: string\n sellers?: Seller[]\n}\n\ninterface Collection {\n id: string\n name: string\n}\ninterface GetOrganizationsByEmailWithStatus {\n costId: string\n orgId: string\n roleId: string\n id: string\n clId: string\n status: string\n}\n\ninterface CostCenter {\n id: string\n name: string\n organization: string\n addresses: Address[]\n paymentTerms: PaymentTerm[]\n salesChannel: string\n priceTables: Price[]\n phoneNumber?: string\n businessDocument?: string\n customFields: CustomField[]\n}\n\ninterface Address {\n addressId: string\n addressType: string\n addressQuery: string\n postalCode: string\n country: string\n receiverName: string\n city: string\n state: string\n street: string\n number: string\n complement: string\n neighborhood: string\n geoCoordinates: number[]\n reference: string\n checked?: boolean\n}\n\ninterface B2BSettings {\n autoApprove: boolean\n businessReadOnly: boolean\n stateReadOnly: boolean\n defaultPaymentTerms: PaymentTerm[]\n defaultPriceTables: [string]\n organizationCustomFields: SettingsCustomField[]\n costCenterCustomFields: SettingsCustomField[]\n}\n\ninterface UserArgs {\n id?: string\n roleId: string\n userId?: string\n orgId?: string\n costId?: string\n clId?: string\n canImpersonate?: boolean\n name: string\n email: string\n}\n\ninterface PaymentTerm {\n name: string\n id: string\n}\n\ninterface Price {\n name: string\n id: string\n}\n\ninterface TopBarSetting {\n name: string\n hexColor: string\n}\n\ninterface UISettings {\n showModal: boolean\n clearCart: boolean\n fullImpersonation: boolean\n topBar?: TopBarSetting | null\n}\n\ninterface CustomField {\n name: string\n type: 'text' | 'dropdown'\n value: string\n dropdownValues?: Array<{ label: string; value: string }> | null\n useOnRegistration?: boolean\n}\n\ninterface SettingsCustomField {\n name: string\n type: 'text' | 'dropdown'\n dropdownValues?: Array<{ label: string; value: string }> | null\n useOnRegistration?: boolean\n}\n\ninterface CustomFieldSetting {\n name: string\n type: 'text' | 'dropdown'\n}\n\ninterface TransactionEmailSetting {\n organizationCreated: boolean\n organizationApproved: boolean\n organizationDeclined: boolean\n organizationStatusChanged: boolean\n organizationRequestCreated: boolean\n}\n\ninterface B2BSettingsInput {\n autoApprove: boolean\n businessReadOnly: boolean\n stateReadOnly: boolean\n defaultPaymentTerms: PaymentTerm[]\n defaultPriceTables: Price[]\n uiSettings: UISettings\n organizationCustomFields: CustomFieldSetting[]\n costCenterCustomFields: CustomFieldSetting[]\n transactionEmailSettings: TransactionEmailSetting\n}\n\ninterface Result {\n href: string\n id: string\n status: string\n}\n\n```"
}
] |
code_b2b-organizations-graphql_1ca615eb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/package.json from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.b2b-organizations\",\n \"version\": \"2.3.0\",\n \"dependencies\": {\n \"@types/lodash\": \"4.14.74\",\n \"@vtex/api\": \"6.50.1\",\n \"atob\": \"^2.1.2\",\n \"co-body\": \"^6.0.0\",\n \"graphql\": \"^14.5.0\",\n \"graphql-tag\": \"^2.12.6\",\n \"graphql-tools\": \"^4.0.6\",\n \"qs\": \"^6.9.4\",\n \"ramda\": \"^0.25.0\"\n },\n \"devDependencies\": {\n \"@ngneat/falso\": \"^6.4.0\",\n \"@types/atob\": \"^2.1.2\",\n \"@types/co-body\": \"0.0.3\",\n \"@types/jest\": \"27.4.1\",\n \"@types/jsonwebtoken\": \"^8.5.0\",\n \"@types/node\": \"^12.12.21\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@vtex/api\": \"6.50.1\",\n \"@vtex/prettier-config\": \"^0.3.1\",\n \"@vtex/tsconfig\": \"^0.6.0\",\n \"jest\": \"27.5.1\",\n \"ts-jest\": \"^27.1.4\",\n \"ts-node\": \"^10.9.1\",\n \"tslint\": \"^5.12.0\",\n \"tslint-config-prettier\": \"^1.18.0\",\n \"tslint-config-vtex\": \"^2.1.0\",\n \"typescript\": \"3.9.7\",\n \"vtex.storefront-permissions\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.storefront-permissions@1.35.3/public/@types/vtex.storefront-permissions\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit && tslint -c tslint.json './**/*.ts'\",\n \"test\": \"jest\"\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_ac0ae0da
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/constants.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const PROMISSORY_CONNECTOR = {\n PROMISSORY: 'Vtex.PaymentGateway.Connectors.PromissoryConnector',\n} as const\n\nexport const CREDIT_CARDS = [\n 'Visa',\n 'Mastercard',\n 'Diners',\n 'American Express',\n 'Hipercard',\n 'Discover',\n 'Aura',\n 'Elo',\n 'Banricompras',\n 'JCB',\n 'Cabal',\n 'Nativa',\n 'Naranja',\n 'Nevada',\n 'Shopping',\n 'Credz',\n]\n\nexport const enum StatusAddUserError {\n DUPLICATED = 'duplicated',\n DUPLICATED_ORGANIZATION = 'duplicated-organization',\n ERROR = 'error',\n}\n\nexport const enum MessageSFPUserAddError {\n DUPLICATED = 'already exists in another organization',\n DUPLICATED_ORGANIZATION = 'already exists in the organization',\n}\n\nexport const LICENSE_MANAGER_ROLES = {\n B2B_ORGANIZATIONS_VIEW: 'buyer_organization_view',\n B2B_ORGANIZATIONS_EDIT: 'buyer_organization_edit',\n} as const\n\nexport const B2B_LM_PRODUCT_CODE = 97\n\n```"
}
] |
code_b2b-organizations-graphql_8155d1e3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/index.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type {\n ClientsConfig,\n ParamsContext,\n RecorderState,\n ServiceContext,\n} from '@vtex/api'\nimport { LRUCache, Service } from '@vtex/api'\n\nimport { Clients } from './clients'\nimport { resolvers } from './resolvers'\nimport { schemaDirectives } from './resolvers/directives'\n\nconst TIMEOUT_MS = 4000\n\n// Create a LRU memory cache for the Status client.\n// The @vtex/api HttpClient respects Cache-Control headers and uses the provided cache.\nconst memoryCache = new LRUCache<string, any>({ max: 5000 })\n\nmetrics.trackCache('status', memoryCache)\n\n// This is the configuration for clients available in `ctx.clients`.\nconst clients: ClientsConfig<Clients> = {\n // We pass our custom implementation of the clients bag, containing the Status client.\n implementation: Clients,\n options: {\n // All IO Clients will be initialized with these options, unless otherwise specified.\n default: {\n retries: 2,\n timeout: TIMEOUT_MS,\n },\n // This key will be merged with the default options and add this cache to our Status client.\n status: {\n memoryCache,\n },\n },\n}\n\ndeclare global {\n type Context = ServiceContext<Clients>\n}\n\nexport default new Service<Clients, RecorderState, ParamsContext>({\n clients,\n graphql: {\n resolvers: {\n B2BOrganization: resolvers.B2BOrganization,\n B2BUser: resolvers.B2BUser,\n Mutation: resolvers.Mutation,\n Query: resolvers.Query,\n },\n schemaDirectives,\n },\n routes: resolvers.Routes,\n})\n\n```"
}
] |
code_b2b-organizations-graphql_18863004
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/mdSchema.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const ORGANIZATION_REQUEST_DATA_ENTITY = 'organization_requests'\nexport const ORGANIZATION_REQUEST_FIELDS = [\n 'id',\n 'name',\n 'tradeName',\n 'defaultCostCenter',\n 'b2bCustomerAdmin',\n 'costCenters',\n 'status',\n 'notes',\n 'created',\n 'priceTables',\n 'paymentTerms',\n 'salesChannel',\n 'sellers',\n 'customFields',\n]\nexport const ORGANIZATION_REQUEST_SCHEMA_VERSION = 'v0.1.1'\n\nexport const ORGANIZATION_DATA_ENTITY = 'organizations'\nexport const ORGANIZATION_FIELDS = [\n 'id',\n 'name',\n 'tradeName',\n 'collections',\n 'paymentTerms',\n 'priceTables',\n 'salesChannel',\n 'costCenters',\n 'sellers',\n 'status',\n 'created',\n 'customFields',\n 'permissions',\n]\nexport const ORGANIZATION_SCHEMA_VERSION = 'v0.0.8'\n\nexport const COST_CENTER_DATA_ENTITY = 'cost_centers'\nexport const COST_CENTER_FIELDS = [\n 'id',\n 'name',\n 'addresses',\n 'paymentTerms',\n 'organization',\n 'phoneNumber',\n 'businessDocument',\n 'customFields',\n 'stateRegistration',\n 'sellers',\n]\nexport const COST_CENTER_SCHEMA_VERSION = 'v0.0.8'\n\nexport const schemas = [\n {\n name: ORGANIZATION_REQUEST_DATA_ENTITY,\n version: ORGANIZATION_REQUEST_SCHEMA_VERSION,\n body: {\n properties: {\n name: {\n type: 'string',\n title: 'Name',\n },\n tradeName: {\n type: ['string', 'null'],\n title: 'Trade Name',\n },\n defaultCostCenter: {\n type: 'object',\n title: 'Default Cost Center',\n },\n b2bCustomerAdmin: {\n type: 'object',\n title: 'B2B Customer Admin',\n properties: {\n email: {\n type: 'string',\n },\n },\n 'v-indexed': ['email'],\n },\n costCenters: {\n type: 'array',\n title: 'All Cost Centers',\n },\n status: {\n type: 'string',\n title: 'Status',\n },\n notes: {\n type: 'string',\n title: 'Notes',\n },\n created: {\n type: 'string',\n title: 'Created',\n format: 'date-time',\n },\n priceTables: {\n type: 'array',\n title: 'Price Tables',\n },\n paymentTerms: {\n type: 'array',\n title: 'Payment Terms',\n },\n salesChannel: {\n type: ['string', 'null'],\n title: 'Sales Channel',\n },\n customFields: {\n type: 'array',\n title: 'Custom Fields',\n },\n },\n 'v-indexed': ['name', 'b2bCustomerAdmin', 'status', 'created'],\n 'v-immediate-indexing': true,\n 'v-cache': false,\n },\n },\n {\n name: ORGANIZATION_DATA_ENTITY,\n version: ORGANIZATION_SCHEMA_VERSION,\n body: {\n properties: {\n name: {\n type: 'string',\n title: 'Name',\n },\n tradeName: {\n type: ['string', 'null'],\n title: 'Trade Name',\n },\n collections: {\n type: 'array',\n title: 'Collections',\n },\n paymentTerms: {\n type: 'array',\n title: 'Payment Terms',\n },\n priceTables: {\n type: 'array',\n title: 'Price Tables',\n },\n salesChannel: {\n type: ['string', 'null'],\n title: 'Sales Channel',\n },\n costCenters: {\n type: 'array',\n title: 'Cost Centers',\n },\n sellers: {\n type: ['array', 'null'],\n title: 'Sellers',\n },\n status: {\n type: 'string',\n title: 'Status',\n },\n created: {\n type: 'string',\n title: 'Created',\n format: 'date-time',\n },\n customFields: {\n type: 'array',\n title: 'Custom Fields',\n },\n permissions: {\n type: 'object',\n title: 'Permissions',\n properties: {\n createQuote: {\n type: 'boolean',\n },\n },\n },\n },\n 'v-indexed': ['name', 'status', 'created'],\n 'v-immediate-indexing': true,\n 'v-cache': false,\n },\n },\n {\n name: COST_CENTER_DATA_ENTITY,\n version: COST_CENTER_SCHEMA_VERSION,\n body: {\n properties: {\n name: {\n type: 'string',\n title: 'Name',\n },\n addresses: {\n type: 'array',\n title: 'Addresses',\n },\n paymentTerms: {\n type: 'array',\n title: 'Payment Terms',\n },\n organization: {\n type: 'string',\n title: 'Organization',\n },\n businessDocument: {\n type: ['string', 'null'],\n title: 'Business Document',\n },\n stateRegistration: {\n type: ['string', 'null'],\n title: 'State Registration',\n },\n phoneNumber: {\n type: ['string', 'null'],\n title: 'Phone Number',\n },\n customFields: {\n type: ['array', 'null'],\n title: 'Custom Fields',\n },\n sellers: {\n type: ['array', 'null'],\n title: 'Sellers',\n },\n },\n 'v-indexed': [\n 'name',\n 'organization',\n 'businessDocument',\n 'stateRegistration',\n ],\n 'v-immediate-indexing': true,\n 'v-cache': false,\n },\n },\n]\n\n```"
}
] |
code_b2b-organizations-graphql_5113edd2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/storefrontPermissions.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { AppGraphQLClient } from '@vtex/api'\n\nimport addUser from '../mutations/addUser'\nimport deleteUser from '../mutations/deleteUser'\nimport impersonateUser from '../mutations/impersonateUser'\nimport saveUser from '../mutations/saveUser'\nimport updateUser from '../mutations/updateUser'\nimport getB2BUser from '../queries/getB2BUser'\nimport getOrganizationsByEmail from '../queries/getOrganizationsByEmail'\nimport getOrganizationsPaginatedByEmail from '../queries/getOrganizationsPaginatedByEmail'\nimport getPermission from '../queries/getPermission'\nimport getRole from '../queries/getRole'\nimport getUser from '../queries/getUser'\nimport getUsersByEmail from '../queries/getUsersByEmail'\nimport listAllUsers from '../queries/listAllUsers'\nimport listRoles from '../queries/listRoles'\nimport listUsers from '../queries/listUsers'\nimport listUsersPaginated from '../queries/listUsersPaginated'\n\nexport default class StorefrontPermissions extends AppGraphQLClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super('vtex.storefront-permissions@3.x', ctx, options)\n }\n\n public checkUserPermission = async (app?: string): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(app),\n query: getPermission,\n variables: {},\n })\n }\n\n public getOrganizationsByEmail = async (email: string): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: getOrganizationsByEmail,\n variables: {\n email,\n },\n })\n }\n\n public getOrganizationsPaginatedByEmail = async (\n email: string,\n page: number,\n pageSize: number\n ): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: getOrganizationsPaginatedByEmail,\n variables: {\n email,\n page,\n pageSize,\n },\n })\n }\n\n public listRoles = async (): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: listRoles,\n variables: {},\n })\n }\n\n public getRole = async (roleId: string): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: getRole,\n variables: { id: roleId },\n })\n }\n\n public listAllUsers = async (): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: listAllUsers,\n variables: {},\n })\n }\n\n public listUsers = async ({\n roleId,\n organizationId,\n costCenterId,\n }: {\n roleId?: string\n organizationId?: string\n costCenterId?: string\n }): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: listUsers,\n variables: {\n roleId,\n ...(organizationId && { organizationId }),\n ...(costCenterId && { costCenterId }),\n },\n })\n }\n\n public listUsersPaginated = async ({\n roleId,\n organizationId,\n costCenterId,\n search = '',\n page = 1,\n pageSize = 25,\n sortOrder = 'asc',\n sortedBy = 'email',\n }: {\n roleId?: string\n organizationId?: string\n costCenterId?: string\n search?: string\n page?: number\n pageSize?: number\n sortOrder?: string\n sortedBy?: string\n }): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: listUsersPaginated,\n variables: {\n page,\n pageSize,\n roleId,\n search,\n sortOrder,\n sortedBy,\n ...(organizationId && { organizationId }),\n ...(costCenterId && { costCenterId }),\n },\n })\n }\n\n public getUser = async (userId: string): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: getUser,\n variables: { id: userId },\n })\n }\n\n public getUsersByEmail = async (\n email: string,\n orgId: string,\n costId: string\n ): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: getUsersByEmail,\n variables: { email, orgId, costId },\n })\n }\n\n public getB2BUser = async (id: string): Promise<any> => {\n return this.query({\n extensions: this.getPersistedQuery(),\n query: getB2BUser,\n variables: { id },\n })\n }\n\n public addUser = async ({\n id,\n roleId,\n userId,\n orgId,\n costId,\n name,\n email,\n }: {\n id?: string\n roleId: string\n userId?: string\n orgId?: string\n costId?: string\n clId?: string\n name: string\n email: string\n }): Promise<any> => {\n return this.graphql.mutate(\n {\n mutate: addUser,\n variables: {\n canImpersonate: false,\n costId,\n email,\n id,\n name,\n orgId,\n roleId,\n userId,\n },\n },\n {\n headers: this.getTokenToHeader(),\n }\n )\n }\n\n public updateUser = async ({\n id,\n roleId,\n userId,\n orgId,\n costId,\n clId,\n name,\n email,\n }: {\n id?: string\n roleId: string\n userId?: string\n orgId?: string\n costId?: string\n clId?: string\n name: string\n email: string\n }): Promise<any> => {\n return this.graphql.mutate(\n {\n mutate: updateUser,\n variables: {\n canImpersonate: false,\n clId,\n costId,\n email,\n id,\n name,\n orgId,\n roleId,\n userId,\n },\n },\n {\n headers: this.getTokenToHeader(),\n }\n )\n }\n\n // deprecated\n public saveUser = async ({\n id,\n roleId,\n userId,\n orgId,\n costId,\n clId,\n name,\n email,\n }: {\n id?: string\n roleId: string\n userId?: string\n orgId?: string\n costId?: string\n clId?: string\n name: string\n email: string\n }): Promise<any> => {\n return this.graphql.mutate(\n {\n mutate: saveUser,\n variables: {\n canImpersonate: false,\n clId,\n costId,\n email,\n id,\n name,\n orgId,\n roleId,\n userId,\n },\n },\n {\n headers: this.getTokenToHeader(),\n }\n )\n }\n\n public deleteUser = async ({\n id,\n userId,\n email,\n }: {\n id?: string\n userId?: string\n email: string\n }): Promise<any> => {\n return this.graphql.mutate(\n {\n mutate: deleteUser,\n variables: {\n email,\n id,\n userId,\n },\n },\n {\n headers: this.getTokenToHeader(),\n }\n )\n }\n\n public impersonateUser = async ({\n userId,\n }: {\n userId?: string\n }): Promise<any> => {\n const graphqlResult = this.graphql.mutate(\n {\n mutate: impersonateUser,\n variables: {\n userId,\n },\n },\n {\n headers: this.getTokenToHeader(),\n params: {\n locale: this.context.locale,\n },\n }\n )\n\n return graphqlResult\n }\n\n private getTokenToHeader = () => {\n // provide authToken (app token) as an admin token as this is a call\n // between b2b suite apps and no further token validation is needed\n const adminToken = this.context.authToken\n const userToken = this.context.storeUserAuthToken ?? null\n const { sessionToken, account } = this.context\n\n let allCookies = `VtexIdclientAutCookie=${adminToken}`\n\n if (userToken) {\n allCookies += `; VtexIdclientAutCookie_${account}=${userToken}`\n }\n\n return {\n 'x-vtex-credential': this.context.authToken,\n VtexIdclientAutCookie: adminToken,\n cookie: allCookies,\n ...(sessionToken && {\n 'x-vtex-session': sessionToken,\n }), // The axios client http doesn't allow undefined headers\n }\n }\n\n private getPersistedQuery = (\n sender = 'vtex.b2b-organizations-graphql@2.x'\n ) => {\n return {\n persistedQuery: {\n provider: 'vtex.storefront-permissions@3.x',\n sender,\n },\n }\n }\n\n private query = async (param: {\n query: string\n variables: any\n extensions: any\n }): Promise<any> => {\n const { query, variables, extensions } = param\n\n return this.graphql.query(\n {\n extensions,\n query,\n variables,\n },\n {\n headers: this.getTokenToHeader(),\n params: {\n locale: this.context.locale,\n },\n }\n )\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_2f4aba0a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/analytics.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\n\nconst ENDPOINT = 'http://rc.vtex.com'\nconst METRICS_PATH = '/api/analytics/schemaless-events'\nconst MAX_RETRIES = 2\nconst RETRY_INTERVAL = 1000 // 1 second\n\nexport const B2B_METRIC_NAME = 'b2b-suite-buyerorg-data'\n\nexport interface Metric {\n readonly account: string\n readonly kind: string\n readonly description: string\n readonly name: typeof B2B_METRIC_NAME\n}\n\nexport default class AnalyticsClient extends ExternalClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(ENDPOINT, context, {\n ...options,\n headers: {\n 'X-Vtex-Use-Https': 'true',\n },\n })\n }\n\n public async sendMetric(metric: Metric, retries = 0) {\n try {\n await this.http.post(METRICS_PATH, metric)\n } catch (error) {\n if (retries < MAX_RETRIES) {\n await new Promise((resolve) => setTimeout(resolve, RETRY_INTERVAL))\n await this.sendMetric(metric, retries + 1)\n } else {\n throw new Error(`${error.message} - after ${MAX_RETRIES} retries.`)\n }\n }\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_f30776cb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/checkout.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { IOContext, InstanceOptions } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\nexport default class Checkout extends JanusClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(ctx, { ...options })\n }\n\n public async requestCancellation(orderId: string, reason: string) {\n return this.http.postRaw(\n `${this.routes.requestCancellation(orderId)}`,\n { reason },\n {\n headers: {\n VtexIdclientAutCookie: this.context.authToken,\n },\n metric: 'checkout-requestCancellation',\n }\n )\n }\n\n private get routes() {\n const basePvt = '/api/checkout/pvt'\n\n return {\n requestCancellation: (orderId: string) =>\n `${basePvt}/orders/${orderId}/cancelation-request`,\n }\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_1f83fe36
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/email.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\nconst MAIL_SERVICE_PATH = '/api/mail-service/pvt/sendmail'\nconst TEMPLATE_RENDER_PATH = '/api/template-render/pvt/templates'\n\nexport default class MailClient extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, {\n ...options,\n headers: {\n VtexIdClientAutCookie: context.authToken,\n },\n })\n }\n\n public async sendMail(mailData: MailData): Promise<string> {\n return this.http.post(MAIL_SERVICE_PATH, mailData, {\n metric: 'mail-post-send',\n })\n }\n\n public getTemplate(name: string) {\n return this.http.get<Template>(`${TEMPLATE_RENDER_PATH}/${name}`, {\n metric: 'mail-get-template',\n })\n }\n\n public publishTemplate(template: Template) {\n return this.http.post(TEMPLATE_RENDER_PATH, template, {\n metric: 'mail-post-template',\n })\n }\n}\n\nexport interface MailData {\n templateName: string\n jsonData: JsonData\n}\n\nexport interface JsonData {\n message: {\n to: string\n }\n organization: {\n name: string\n admin?: string\n note?: string\n status?: string\n }\n}\n\ninterface Template {\n AccountId?: string\n AccountName?: string\n ApplicationId?: string\n Description?: string\n FriendlyName: string\n IsDefaultTemplate: boolean\n IsPersisted: boolean\n IsRemoved: boolean\n Name: string\n Type: string\n Templates: {\n email: {\n To: string\n CC?: string\n BCC?: string\n Subject: string\n Message: string\n Type: string\n ProviderId: string\n ProviderName?: string\n IsActive: boolean\n withError: boolean\n }\n sms: {\n Type: string\n ProviderId?: string\n ProviderName?: string\n IsActive: boolean\n withError: boolean\n Parameters: string[]\n }\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_c7d5e9cd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/vtexId.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\ninterface AuthenticatedUser {\n user: string\n}\n\nexport default class VtexId extends JanusClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(ctx, { ...options })\n }\n\n public async getAuthenticatedUser(\n authToken: string\n ): Promise<AuthenticatedUser> {\n return this.http.get('/api/vtexid/pub/authenticated/user/', {\n params: { authToken },\n metric: 'authenticated-user-get',\n })\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_01e97ade
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/sellers.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\nimport { isNaN, orderBy } from 'lodash'\n\nconst SELLERS_PATH = '/api/seller-register/pvt/sellers'\n\nexport interface Seller {\n id: string\n name: string\n email: string\n}\n\nexport interface GetSellersResponse {\n items: Seller[]\n pagination: {\n page: number\n pageSize: number\n total: number\n }\n}\n\nexport interface GetSellersOpts {\n page: number\n pageSize: number\n}\n\nexport default class SellersClient extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, {\n ...options,\n headers: {\n VtexIdClientAutCookie: context.authToken,\n },\n })\n }\n\n public async getSellers(): Promise<{ items: Seller[] }> {\n return this.http.get(SELLERS_PATH)\n }\n\n public async getSellersPaginated(\n opts?: GetSellersOpts\n ): Promise<GetSellersResponse> {\n const INITIAL_LIST_OPTIONS = {\n page: 1,\n pageSize: 100,\n }\n\n const argsWithDefaults = {\n ...INITIAL_LIST_OPTIONS,\n ...opts,\n }\n\n const { page, pageSize } = argsWithDefaults\n\n if (page < 1 || pageSize < 1) {\n throw new Error(\n `Please make sure you are passing valid values for 'page' and 'pageSize'. Received: page=${page}, pageSize=${pageSize}`\n )\n }\n\n const from = (page - 1) * pageSize\n const to = page * pageSize\n\n const result = await this.http.get<{\n items: Seller[]\n paging: {\n from: number\n to: number\n total: number\n }\n }>(SELLERS_PATH, {\n metric: 'sellers-paginated-get',\n params: { from, to },\n })\n\n if (!result.items) {\n return {\n items: [],\n pagination: {\n page: 1,\n pageSize: 0,\n total: 0,\n },\n }\n }\n\n if (result.items.length > 1) {\n result.items = this.sortSellers(result.items)\n }\n\n return {\n items: result.items,\n pagination: {\n page,\n pageSize,\n total: result.paging.total,\n },\n }\n }\n\n private sortSellers(sellers: Seller[]) {\n // Sorts the sellers first based on whether the name is a number, then sorts by the actual name\n return orderBy(\n sellers,\n [\n (seller: Seller) => {\n const name = seller.name ?? ''\n // Check if the name is a number and not an empty string\n const isNumber = !isNaN(name) && name !== ''\n\n // Returns 1 if the name is a number, or 0 if not, to prioritize sorting numbers first\n return isNumber ? 1 : 0\n },\n (seller: Seller) => {\n const name = seller.name ?? ''\n\n // If the name is not a number, return the name as a string for alphabetical sorting\n // If it is a number, convert it to a number for numeric sorting\n\n return isNaN(name) ? name : Number(name)\n },\n ],\n // Sort both criteria in ascending order\n ['asc', 'asc']\n )\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_f6b78661
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/Orders.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext, RequestConfig } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\nimport { statusToError } from '../utils'\n\nexport default class OrdersClient extends JanusClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(ctx, {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie: ctx.authToken,\n },\n })\n }\n\n public order = (id: string) =>\n this.get(this.routes.order(id), { metric: 'orders' })\n\n protected get = <T>(url: string, config: RequestConfig = {}) => {\n config.headers = {\n ...config.headers,\n }\n\n return this.http.get<T>(url, config).catch(statusToError)\n }\n\n private get routes() {\n const base = '/api/orders'\n\n return {\n order: (id: string) => `${base}/pvt/document/${id}`,\n }\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_b579fbc4
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/Oms.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext, RequestConfig } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\nimport { statusToError } from '../utils'\n\nexport default class OMSClient extends JanusClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(ctx, {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie: ctx.authToken,\n },\n })\n }\n\n public order = (id: string) =>\n this.get(this.routes.order(id), { metric: 'oms-order' })\n\n public search = (query: string) =>\n this.get(this.routes.search(query), { metric: 'oms-order-search' })\n\n protected get = <T>(url: string, config: RequestConfig = {}) => {\n config.headers = {\n ...config.headers,\n }\n\n return this.http.get<T>(url, config).catch(statusToError)\n }\n\n private get routes() {\n const base = '/api/oms'\n\n return {\n order: (id: string) => `${base}/pvt/admin/orders/${id}`,\n search: (query: string) => `${base}/pvt/orders?${query}`,\n }\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_5d1f246a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/LMClient.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { ExternalClient } from '@vtex/api'\n\nexport default class LMClient extends ExternalClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(`http://${ctx.account}.vtexcommercestable.com.br/`, ctx, {\n ...options,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n VtexIdclientAutCookie: ctx.authToken,\n },\n })\n }\n\n public getUserAdminPermissions = async (account: string, userId: string) => {\n return this.get(\n `/api/license-manager/pvt/accounts/${encodeURI(\n account\n )}/logins/${encodeURI(userId)}/granted`\n ).then((res: any) => {\n return res\n })\n }\n\n public checkUserSpecificRole = async (\n account: string,\n userEmail: string,\n productCode: number,\n resourceCode: string\n ) => {\n return this.get(\n `/api/license-manager/pvt/accounts/${encodeURI(\n account\n )}/products/${productCode}/logins/${encodeURI(\n userEmail\n )}/resources/${encodeURI(resourceCode)}/granted`\n ).then((res: any) => {\n return res\n })\n }\n\n public getAccount = async () => {\n return this.get<GetAccountResponse>(`/api/license-manager/account`).then(\n (res) => {\n return res\n }\n )\n }\n\n protected get = <T>(url: string) => {\n return this.http.get<T>(url)\n }\n}\n\ninterface GetAccountResponse {\n isActive: boolean\n id: string\n name: string\n accountName: string\n lv: unknown\n isOperating: boolean\n defaultUrl: unknown\n district: unknown\n country: unknown\n complement: unknown\n compunknownName: string\n cnpj: string\n haveParentAccount: boolean\n parentAccountId: unknown\n parentAccountName: unknown\n city: unknown\n address: unknown\n logo: unknown\n hasLogo: boolean\n number: unknown\n postalCode: unknown\n state: unknown\n telephone: string\n tradingName: string\n licenses: unknown[]\n sponsor: {\n name: string\n email: string\n phone: string\n }\n contact: {\n name: string\n email: string\n phone: string\n }\n operationDate: unknown\n inactivationDate: unknown\n creationDate: string\n hosts: unknown[]\n sites: unknown[]\n appKeys: unknown[]\n}\n\n```"
}
] |
code_b2b-organizations-graphql_14c8c726
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/index.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { IOClients } from '@vtex/api'\n\nimport LMClient from './LMClient'\nimport AnalyticsClient from './analytics'\nimport VtexId from './vtexId'\nimport PaymentsClient from './payments'\nimport MailClient from './email'\nimport Checkout from './checkout'\nimport OMSClient from './Oms'\nimport OrdersClient from './Orders'\nimport StorefrontPermissions from './storefrontPermissions'\nimport IdentityClient from './IdentityClient'\nimport Catalog from './catalog'\nimport SellersClient from './sellers'\n\n// Extend the default IOClients implementation with our own custom clients.\nexport class Clients extends IOClients {\n public get lm() {\n return this.getOrSet('lm', LMClient)\n }\n\n public get analytics() {\n return this.getOrSet('analytics', AnalyticsClient)\n }\n\n public get checkout() {\n return this.getOrSet('checkout', Checkout)\n }\n\n public get payments() {\n return this.getOrSet('payments', PaymentsClient)\n }\n\n public get mail() {\n return this.getOrSet('mail', MailClient)\n }\n\n public get oms() {\n return this.getOrSet('oms', OMSClient)\n }\n\n public get orders() {\n return this.getOrSet('orders', OrdersClient)\n }\n\n public get storefrontPermissions() {\n return this.getOrSet('storefrontPermissions', StorefrontPermissions)\n }\n\n public get vtexId() {\n return this.getOrSet('vtexId', VtexId)\n }\n\n public get identity() {\n return this.getOrSet('identity', IdentityClient)\n }\n\n public get catalog() {\n return this.getOrSet('catalog', Catalog)\n }\n\n public get sellers() {\n return this.getOrSet('sellers', SellersClient)\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_6694d947
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/IdentityClient.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\nexport default class IdentityClient extends JanusClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(ctx, {\n ...options,\n headers: {\n ...options?.headers,\n },\n })\n }\n\n public async validateToken({ token }: { token: string }): Promise<any> {\n return this.http.post('/api/vtexid/credential/validate', { token })\n }\n\n public async getToken({\n appkey,\n apptoken,\n }: {\n appkey: string\n apptoken: string\n }): Promise<any> {\n return this.http.post('/api/vtexid/apptoken/login', { appkey, apptoken })\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_8dccbedd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/payments.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\nimport { CREDIT_CARDS } from '../constants'\n\nexport default class PaymentsClient extends JanusClient {\n constructor(context: IOContext, options?: InstanceOptions) {\n super(context, {\n ...options,\n headers: {\n ...options?.headers,\n VtexIdclientAutCookie: context.authToken,\n },\n })\n }\n\n public rules = () =>\n this.http.get<Rule[]>(`api/payments/pvt/rules`, {\n metric: 'payments-get-rules',\n })\n\n public async getPaymentTerms() {\n const paymentRules = await this.rules()\n\n const enabledConnectors = paymentRules.filter(\n (rule) => rule.enabled === true\n )\n\n const enabledPaymentSystems = enabledConnectors.map(\n (connector) => connector.paymentSystem\n )\n\n const uniquePaymentSystems = enabledPaymentSystems.filter(\n (value, index, self) => {\n return (\n index ===\n self.findIndex((t) => t.id === value.id && t.name === value.name)\n )\n }\n )\n\n const uniquePaymentSystemsWithoutCreditCards = uniquePaymentSystems.filter(\n (value) => {\n return !CREDIT_CARDS.includes(value.name)\n }\n )\n\n uniquePaymentSystemsWithoutCreditCards.unshift({\n id: 999999,\n implementation: null,\n name: 'Credit card',\n })\n\n return uniquePaymentSystemsWithoutCreditCards\n }\n}\n\ninterface Rule {\n id: string\n name: string\n salesChannels: Array<{\n id: string\n }>\n paymentSystem: { id: number; name: string; implementation: string | null }\n connector: {\n implementation: string\n affiliationId: string\n }\n issuer: { name: string | null }\n antifraud: { implementation: string | null; affiliationId: string | null }\n installmentOptions: string | null\n isSelfAuthorized: string | null\n requiresAuthentication: string | null\n enabled: boolean\n installmentsService: boolean\n isDefault: string | null\n beginDate: string | null\n endDate: string | null\n condition: string | null\n multiMerchantList: string | null\n country: string | null\n dateIntervals: string | null\n externalInterest: boolean\n minimumValue: string | null\n deadlines: string[]\n cobrand: { name: string | null }\n cardLevel: { name: string | null }\n excludedBinsRanges: string | null\n}\n\n```"
}
] |
code_b2b-organizations-graphql_0b5db764
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/clients/catalog.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { InstanceOptions, IOContext } from '@vtex/api'\nimport { JanusClient } from '@vtex/api'\n\nexport default class Catalog extends JanusClient {\n constructor(ctx: IOContext, options?: InstanceOptions) {\n super(ctx, {\n ...options,\n headers: {\n VtexIdClientAutCookie: ctx.authToken,\n },\n })\n }\n\n public async salesChannelAvailable(email: string) {\n return this.http.get<SalesChannelAvailable[]>(\n `/api/catalog_system/pub/saleschannel/available?email=${encodeURIComponent(\n email\n )}`,\n {\n metric: 'catalog-sales-channel-available',\n }\n )\n }\n\n public async collectionsAvailable(searchTerm: string) {\n return this.http.get<PagedCollectionsResponseAPI>(\n `/api/catalog_system/pvt/collection/search/${encodeURI(searchTerm)}`,\n {\n metric: 'catalog-collections-available',\n }\n )\n }\n}\n\ninterface SalesChannelAvailable {\n Id: number\n Name: string\n IsActive: boolean\n ProductClusterId: string | null\n CountryCode: string\n CultureInfo: string\n TimeZone: string\n CurrencyCode: string\n CurrencySymbol: string\n CurrencyLocale: number\n CurrencyFormatInfo: unknown\n Position: number\n ConditionRule: string | null\n CurrencyDecimalDigits: null | number\n}\n\ninterface Paging {\n pages: number\n page: number\n perPage: number\n total: number\n}\n\ninterface CollectionItem {\n id: number\n name: string\n searchable: boolean\n highlight: boolean\n dateFrom: string\n dateTo: string\n totalProducts: number\n type: 'Hybrid' | 'Manual' | 'Automatic'\n lastModifiedBy: string | null\n}\n\ninterface PagedCollectionsResponseAPI {\n paging: Paging\n items: CollectionItem[]\n}\n\n```"
}
] |
code_b2b-organizations-graphql_0737cd69
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/mutations/addUser.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n mutation (\n $id: ID\n $userId: ID\n $roleId: ID!\n $orgId: ID!\n $costId: ID!\n $name: String!\n $canImpersonate: Boolean!\n $email: String!\n ) {\n addUser(\n id: $id\n userId: $userId\n roleId: $roleId\n orgId: $orgId\n costId: $costId\n name: $name\n canImpersonate: $canImpersonate\n email: $email\n ) {\n id\n status\n message\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_6881e9d2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/mutations/deleteUser.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n mutation deleteUser($id: ID!, $userId: ID, $email: String!) {\n deleteUser(id: $id, userId: $userId, email: $email) {\n id\n status\n message\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_55edeb28
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/mutations/updateUser.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n mutation (\n $id: ID\n $clId: ID!\n $userId: ID\n $roleId: ID!\n $orgId: ID!\n $costId: ID!\n $canImpersonate: Boolean!\n $name: String\n $email: String\n ) {\n updateUser(\n id: $id\n clId: $clId\n userId: $userId\n roleId: $roleId\n orgId: $orgId\n costId: $costId\n canImpersonate: $canImpersonate\n name: $name\n email: $email\n ) {\n id\n status\n message\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_cf69c736
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/mutations/saveUser.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n mutation saveUser(\n $id: ID\n $roleId: ID!\n $userId: ID\n $orgId: ID\n $costId: ID\n $clId: ID\n $canImpersonate: Boolean\n $name: String!\n $email: String!\n ) {\n saveUser(\n id: $id\n roleId: $roleId\n userId: $userId\n orgId: $orgId\n costId: $costId\n clId: $clId\n canImpersonate: $canImpersonate\n name: $name\n email: $email\n ) {\n id\n status\n message\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_34cac5c8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/mutations/impersonateUser.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n mutation impersonateUser($userId: ID) {\n impersonateUser(userId: $userId) {\n id\n status\n message\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_370ab6b6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/getB2BUser.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query user($id: ID!) {\n getB2BUser(id: $id) {\n id\n roleId\n userId\n clId\n orgId\n costId\n name\n email\n canImpersonate\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_95285464
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/getRole.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query role($id: ID!) {\n getRole(id: $id) {\n id\n name\n slug\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_6c46435b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/getUsersByEmail.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query getUsersByEmail($orgId: ID, $costId: ID, $email: String!) {\n getUsersByEmail(orgId: $orgId, costId: $costId, email: $email) {\n id\n roleId\n userId\n orgId\n costId\n name\n email\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_26684de2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/getOrganizationsPaginatedByEmail.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query OrganizationsPaginated($email: String!, $page: Int, $pageSize: Int) {\n getOrganizationsPaginatedByEmail(\n email: $email\n page: $page\n pageSize: $pageSize\n ) {\n data {\n costId\n orgId\n roleId\n id\n clId\n }\n pagination {\n page\n pageSize\n total\n }\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_0b5c414a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/getUser.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query user($id: ID!) {\n getUser(id: $id) {\n id\n roleId\n userId\n clId\n orgId\n costId\n name\n email\n canImpersonate\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_90120f2d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/listUsersPaginated.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query users(\n $organizationId: ID\n $costCenterId: ID\n $roleId: ID\n $page: Int\n $pageSize: Int\n $search: String\n $sortOrder: String\n $sortedBy: String\n ) {\n listUsersPaginated(\n organizationId: $organizationId\n costCenterId: $costCenterId\n roleId: $roleId\n page: $page\n pageSize: $pageSize\n search: $search\n sortOrder: $sortOrder\n sortedBy: $sortedBy\n ) {\n data {\n id\n roleId\n userId\n clId\n orgId\n costId\n name\n email\n canImpersonate\n }\n pagination {\n total\n }\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_9dcc23ae
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/getPermission.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query permissions {\n checkUserPermission {\n role {\n id\n name\n slug\n }\n permissions\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_b0fef109
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/listRoles.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query roles {\n listRoles {\n id\n name\n slug\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_b876cadf
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/listUsers.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query users($organizationId: ID, $costCenterId: ID, $roleId: ID) {\n listUsers(\n organizationId: $organizationId\n costCenterId: $costCenterId\n roleId: $roleId\n ) {\n id\n roleId\n userId\n clId\n orgId\n costId\n name\n email\n canImpersonate\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_770765ef
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/checkImpersonation.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query checkImpersonation {\n checkImpersonation {\n firstName\n lastName\n email\n userId\n error\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_f0a43c60
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/listAllUsers.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query users {\n listAllUsers {\n id\n orgId\n costId\n name\n email\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_a371109f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/queries/getOrganizationsByEmail.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { print } from 'graphql'\nimport gql from 'graphql-tag'\n\nexport default print(gql`\n query organizations($email: String!) {\n getOrganizationsByEmail(email: $email) {\n costId\n orgId\n roleId\n id\n clId\n }\n }\n`)\n\n```"
}
] |
code_b2b-organizations-graphql_3a1f0fef
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/readFile.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport fs from 'fs'\nimport path from 'path'\n\nconst readFile = (filePath: string) =>\n fs.readFileSync(path.resolve(__dirname, filePath), 'utf8')\n\nexport default readFile\n\n```"
}
] |
code_b2b-organizations-graphql_12e2fea2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/constants.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const ORGANIZATION_STATUSES = {\n ACTIVE: 'active',\n INACTIVE: 'inactive',\n ON_HOLD: 'on-hold',\n SUCCESS: 'success',\n}\n\nexport const ORGANIZATION_REQUEST_STATUSES = {\n APPROVED: 'approved',\n DECLINED: 'declined',\n PENDING: 'pending',\n}\n\nexport const MARKETING_TAGS = {\n VBASE_BUCKET: 'b2b_marketing_tags',\n}\n\n```"
}
] |
code_b2b-organizations-graphql_71d448a8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/GraphQLError.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport default class GraphQLError extends Error {\n public extensions: any\n\n constructor(message: string, details?: any) {\n super(message)\n this.extensions = { message, ...details }\n }\n}\n\nexport const getErrorMessage = (e: any) => {\n return e.message ?? e.response?.data?.message ?? e\n}\n\n```"
}
] |
code_b2b-organizations-graphql_b37eb950
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/index.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as crypto from 'crypto'\n\nimport { AuthenticationError, ForbiddenError, UserInputError } from '@vtex/api'\nimport type { AxiosError } from 'axios'\n\nimport { schemas } from '../mdSchema'\n\nexport const toHash = (obj: any) => {\n return crypto.createHash('md5').update(JSON.stringify(obj)).digest('hex')\n}\n\nexport const currentSchema = (entity: string) => {\n return schemas.find((item: any) => {\n return item.name === entity\n })\n}\n\nexport function statusToError(e: any) {\n if (!e.response) {\n throw e\n }\n\n const { response } = e as AxiosError\n const { status } = response!\n\n if (status === 401) {\n throw new AuthenticationError(e)\n }\n\n if (status === 403) {\n throw new ForbiddenError(e)\n }\n\n if (status === 400) {\n throw new UserInputError(e)\n }\n\n throw e\n}\n\n```"
}
] |
code_b2b-organizations-graphql_c4ebba2b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/resolvers/directives.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { WithSession } from './directives/withSession'\nimport { WithPermissions } from './directives/withPermissions'\nimport { ValidateAdminUserAccess } from './directives/validateAdminUserAccess'\nimport { ValidateStoreUserAccess } from './directives/validateStoreUserAccess'\nimport { AuditAccess } from './directives/auditAccess'\n\nexport const schemaDirectives = {\n validateAdminUserAccess: ValidateAdminUserAccess as any,\n validateStoreUserAccess: ValidateStoreUserAccess as any,\n withPermissions: WithPermissions as any,\n withSession: WithSession as any,\n auditAccess: AuditAccess as any,\n}\n\n```"
}
] |
code_b2b-organizations-graphql_57529c1d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/resolvers/fieldResolvers.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport {\n COST_CENTER_DATA_ENTITY,\n COST_CENTER_FIELDS,\n ORGANIZATION_DATA_ENTITY,\n ORGANIZATION_FIELDS,\n} from '../mdSchema'\nimport GraphQLError, { getErrorMessage } from '../utils/GraphQLError'\nimport type { CostCenter, Organization } from '../typings'\n\nexport const organizationName = async (\n { orgId }: { orgId: string },\n _: any,\n ctx: Context\n) => {\n const {\n clients: { masterdata },\n vtex: { logger },\n } = ctx\n\n try {\n const organization: Organization = await masterdata.getDocument({\n dataEntity: ORGANIZATION_DATA_ENTITY,\n fields: ORGANIZATION_FIELDS,\n id: orgId,\n })\n\n return organization.name\n } catch (error) {\n logger.error({\n error,\n message: 'getOrganizationName-error',\n })\n throw new GraphQLError(getErrorMessage(error))\n }\n}\n\nexport const organizationStatus = async (\n { orgId }: { orgId: string },\n _: any,\n ctx: Context\n) => {\n const {\n clients: { masterdata },\n vtex: { logger },\n } = ctx\n\n try {\n const organization: Organization = await masterdata.getDocument({\n dataEntity: ORGANIZATION_DATA_ENTITY,\n fields: ORGANIZATION_FIELDS,\n id: orgId,\n })\n\n return organization.status\n } catch (error) {\n logger.error({\n error,\n message: 'getOrganizationStatus-error',\n })\n throw new GraphQLError(getErrorMessage(error))\n }\n}\n\nexport const costCenterName = async (\n { costId }: { costId: string },\n _: any,\n ctx: Context\n) => {\n const {\n clients: { masterdata },\n vtex: { logger },\n } = ctx\n\n try {\n const costCenter: CostCenter = await masterdata.getDocument({\n dataEntity: COST_CENTER_DATA_ENTITY,\n fields: COST_CENTER_FIELDS,\n id: costId,\n })\n\n return costCenter.name\n } catch (error) {\n logger.error({\n error,\n message: 'getCostCenterName-error',\n })\n throw new GraphQLError(getErrorMessage(error))\n }\n}\n\nexport const role = async (\n { roleId }: { roleId: string },\n _: any,\n ctx: Context\n) => {\n const {\n clients: { storefrontPermissions },\n vtex: { logger },\n } = ctx\n\n return storefrontPermissions\n .getRole(roleId)\n .then((result: any) => {\n return result.data.getRole\n })\n .catch((error: any) => {\n logger.error({\n error,\n message: 'getRoleError',\n })\n })\n}\n\n```"
}
] |
code_b2b-organizations-graphql_d1858797
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/resolvers/message.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable max-params */\nimport type { Logger } from '@vtex/api'\n\nimport type MailClient from '../clients/email'\nimport type StorefrontPermissions from '../clients/storefrontPermissions'\n\nconst getUsers = async (\n storefrontPermissions: StorefrontPermissions,\n roleSlug: string,\n organizationId?: string\n) => {\n const {\n data: { listRoles },\n }: any = await storefrontPermissions.listRoles()\n\n const roles = listRoles.filter((r: any) => r.slug.match(roleSlug))\n\n if (!roles.length) {\n return []\n }\n\n return Promise.all(\n roles.map(async (role: any) => {\n const {\n data: { listUsers },\n }: any = await storefrontPermissions.listUsers({\n roleId: role.id,\n ...(organizationId && { organizationId }),\n })\n\n return listUsers\n })\n ).then((users: any) => users.flat())\n}\n\nconst message = ({\n storefrontPermissions,\n logger,\n mail,\n}: {\n storefrontPermissions: StorefrontPermissions\n logger: Logger\n mail: MailClient\n}) => {\n const organizationCreated = async (name: string) => {\n let users: any[] = []\n\n try {\n users = await getUsers(storefrontPermissions, 'sales-admin')\n } catch (err) {\n logger.error(err)\n }\n\n const promises = []\n\n for (const user of users) {\n promises.push(\n mail\n .sendMail({\n jsonData: {\n message: { to: user.email },\n organization: { name, admin: user.name },\n },\n templateName: 'organization-created',\n })\n .catch((err) =>\n logger.error({\n message: {\n error: err,\n message: 'Error sending organization created email',\n },\n })\n )\n )\n }\n\n return Promise.all(promises)\n }\n\n const organizationApproved = async (\n name: string,\n admin: string,\n email: string,\n note: string\n ) => {\n return mail\n .sendMail({\n jsonData: {\n message: { to: email },\n organization: { name, admin, note },\n },\n templateName: 'organization-approved',\n })\n .catch((err) =>\n logger.error({\n message: {\n error: err,\n message: 'Error sending organization approved email',\n },\n })\n )\n }\n\n const organizationRequestCreated = async (\n name: string,\n admin: string,\n email: string,\n note: string\n ) => {\n return mail\n .sendMail({\n jsonData: {\n message: { to: email },\n organization: { name, admin, note },\n },\n templateName: 'organization-request-created',\n })\n .catch((err) =>\n logger.error({\n message: {\n error: err,\n message: 'Error sending organization approved email',\n },\n })\n )\n }\n\n const organizationDeclined = async (\n name: string,\n admin: string,\n email: string,\n note: string\n ) => {\n return mail\n .sendMail({\n jsonData: {\n message: { to: email },\n organization: { name, admin, note },\n },\n templateName: 'organization-declined',\n })\n .catch((err) =>\n logger.error({\n message: {\n error: err,\n message: 'Error sending organization declined email',\n },\n })\n )\n }\n\n const organizationStatusChanged = async (\n name: string,\n id: string,\n status: string\n ) => {\n let users: any[] = []\n\n try {\n users = [\n ...new Map(\n (await getUsers(storefrontPermissions, 'customer-admin', id)).map(\n (user: any) => [user.email, user]\n )\n ).values(),\n ]\n } catch (err) {\n logger.error(err)\n }\n\n const promises = []\n\n for (const user of users) {\n promises.push(\n mail\n .sendMail({\n jsonData: {\n message: { to: user.email },\n organization: { name, admin: user.name, status },\n },\n templateName: 'organization-status-changed',\n })\n .catch((err) =>\n logger.error({\n message: {\n error: err,\n message: 'Error sending organization status changed email',\n },\n })\n )\n )\n }\n\n return Promise.all(promises)\n }\n\n return {\n organizationApproved,\n organizationCreated,\n organizationDeclined,\n organizationRequestCreated,\n organizationStatusChanged,\n }\n}\n\nexport default message\n\n```"
}
] |
code_b2b-organizations-graphql_f3e919c1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/resolvers/index.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport {\n costCenterName,\n organizationName,\n organizationStatus,\n role,\n} from './fieldResolvers'\nimport CostCentersMutation from './Mutations/CostCenters'\nimport MarketingTagsMutation from './Mutations/MarketingTags'\nimport OrganizationsMutation from './Mutations/Organizations'\nimport SettingsMutation from './Mutations/Settings'\nimport UsersMutation from './Mutations/Users'\nimport CostCentersQuery from './Queries/CostCenters'\nimport MarketingTagsQuery from './Queries/MarketingTags'\nimport OrganizationsQuery from './Queries/Organizations'\nimport SettingsQuery from './Queries/Settings'\nimport UsersQuery from './Queries/Users'\nimport Routes from './Routes'\n\nexport const resolvers = {\n B2BOrganization: {\n costCenterName,\n organizationName,\n organizationStatus,\n role,\n },\n B2BUser: {\n costCenterName,\n organizationName,\n role,\n },\n Mutation: {\n ...CostCentersMutation,\n ...MarketingTagsMutation,\n ...OrganizationsMutation,\n ...SettingsMutation,\n ...UsersMutation,\n },\n Query: {\n ...CostCentersQuery,\n ...MarketingTagsQuery,\n ...OrganizationsQuery,\n ...SettingsQuery,\n ...UsersQuery,\n },\n Routes,\n}\n\n```"
}
] |
code_b2b-organizations-graphql_6da3d9e2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/resolvers/config.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { schemas } from '../mdSchema'\nimport templates from '../templates'\nimport { toHash } from '../utils'\n\nexport interface Settings {\n schemaHash: string | null\n templateHash: string | null\n}\n\nconst defaultSettings = {\n schemaHash: null,\n templateHash: null,\n}\n\nexport const getAppId = (): string => {\n const app = process.env.VTEX_APP_ID\n const [appName] = String(app).split('@')\n\n return appName\n}\n\nconst checkConfig = async (ctx: Context) => {\n const {\n vtex: { logger },\n clients: { mail, masterdata, vbase },\n } = ctx\n\n let settings: Settings = await vbase.getJSON('mdSchema', 'settings', true)\n\n let schemaChanged = false\n let templatesChanged = false\n\n if (!settings?.schemaHash || !settings?.templateHash) {\n settings = defaultSettings\n }\n\n const currSchemaHash = toHash(schemas)\n const currTemplateHash = toHash(templates)\n\n if (!settings?.schemaHash || settings.schemaHash !== currSchemaHash) {\n const updates: any = []\n\n logger.info({\n message: 'checkConfig-updatingSchema',\n })\n\n schemas.forEach((schema) => {\n updates.push(\n masterdata\n .createOrUpdateSchema({\n dataEntity: schema.name,\n schemaBody: schema.body,\n schemaName: schema.version,\n })\n .then(() => true)\n .catch((error: any) => {\n if (error?.response?.status !== 304) {\n logger.error({\n error,\n message: 'checkConfig-createOrUpdateSchemaError',\n })\n\n return false\n }\n\n return true\n })\n )\n })\n try {\n await Promise.all(updates).then((results) => {\n if (results.every((res) => res === true)) {\n settings.schemaHash = currSchemaHash\n schemaChanged = true\n }\n })\n } catch (error) {\n logger.error({\n error,\n message: 'checkConfig-createOrUpdateSchemaError',\n })\n }\n }\n\n if (!settings?.templateHash || settings.templateHash !== currTemplateHash) {\n const updates: any = []\n\n logger.info({\n message: 'checkConfig-updatingTemplates',\n })\n\n try {\n await Promise.all(\n templates.map(async (template) => {\n const existingData = await mail.getTemplate(template.Name)\n\n if (!existingData) {\n updates.push(mail.publishTemplate(template))\n }\n\n return null\n })\n )\n } catch (error) {\n logger.error({\n error,\n message: 'checkConfig-updatingTemplatesError',\n })\n }\n\n await Promise.all(updates)\n .then(() => {\n settings.templateHash = currTemplateHash\n templatesChanged = true\n })\n .catch((error) => {\n logger.error({\n error,\n message: 'checkConfig-publishTemplateError',\n })\n throw new Error(error)\n })\n }\n\n if (schemaChanged || templatesChanged) {\n try {\n await vbase.saveJSON('mdSchema', 'settings', settings)\n } catch (error) {\n logger.error({\n error,\n message: 'checkConfig-saveSettingsError',\n })\n }\n }\n\n return settings\n}\n\nexport default checkConfig\n\n```"
}
] |
code_b2b-organizations-graphql_b7c5f8df
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/templates/organizationCreated.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport readFile from '../utils/readFile'\n\nconst MESSAGE_BODY = readFile('../assets/organizationCreated.html')\n\nexport const organizationCreatedMessage = {\n Name: 'organization-created',\n FriendlyName: 'Organization Created',\n // Description: null,\n IsDefaultTemplate: false,\n // AccountId: null,\n // AccountName: null,\n // ApplicationId: null,\n IsPersisted: true,\n IsRemoved: false,\n Type: '',\n Templates: {\n email: {\n To: '{{message.to}}',\n // CC: null,\n // BCC: null,\n Subject: 'Organization Created',\n Message: MESSAGE_BODY,\n Type: 'E',\n ProviderId: '00000000-0000-0000-0000-000000000000',\n // ProviderName: null,\n IsActive: true,\n withError: false,\n },\n sms: {\n Type: 'S',\n // ProviderId: null,\n // ProviderName: null,\n IsActive: false,\n withError: false,\n Parameters: [],\n },\n },\n}\n\n```"
}
] |
code_b2b-organizations-graphql_8b7cd1b9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/templates/organizationAccepted.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport readFile from '../utils/readFile'\n\nconst MESSAGE_BODY = readFile('../assets/organizationAccepted.html')\n\nexport const organizationAcceptedMessage = {\n Name: 'organization-approved',\n FriendlyName: 'Organization Approved',\n // Description: null,\n IsDefaultTemplate: false,\n // AccountId: null,\n // AccountName: null,\n // ApplicationId: null,\n IsPersisted: true,\n IsRemoved: false,\n Type: '',\n Templates: {\n email: {\n To: '{{message.to}}',\n // CC: null,\n // BCC: null,\n Subject: 'Organization Approved',\n Message: MESSAGE_BODY,\n Type: 'E',\n ProviderId: '00000000-0000-0000-0000-000000000000',\n // ProviderName: null,\n IsActive: true,\n withError: false,\n },\n sms: {\n Type: 'S',\n // ProviderId: null,\n // ProviderName: null,\n IsActive: false,\n withError: false,\n Parameters: [],\n },\n },\n}\n\n```"
}
] |
code_b2b-organizations-graphql_445e4ca7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/templates/organizationStatusChanged.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport readFile from '../utils/readFile'\n\nconst MESSAGE_BODY = readFile('../assets/organizationStatusChange.html')\n\nexport const organizationStatusChangedMessage = {\n Name: 'organization-status-changed',\n FriendlyName: 'Organization Status Changed',\n // Description: null,\n IsDefaultTemplate: false,\n // AccountId: null,\n // AccountName: null,\n // ApplicationId: null,\n IsPersisted: true,\n IsRemoved: false,\n Type: '',\n Templates: {\n email: {\n To: '{{message.to}}',\n // CC: null,\n // BCC: null,\n Subject: 'Organization Status Change',\n Message: MESSAGE_BODY,\n Type: 'E',\n ProviderId: '00000000-0000-0000-0000-000000000000',\n // ProviderName: null,\n IsActive: true,\n withError: false,\n },\n sms: {\n Type: 'S',\n // ProviderId: null,\n // ProviderName: null,\n IsActive: false,\n withError: false,\n Parameters: [],\n },\n },\n}\n\n```"
}
] |
code_b2b-organizations-graphql_0189723b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/templates/organizationRequestCreated.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport readFile from '../utils/readFile'\n\nconst MESSAGE_BODY = readFile('../assets/organizationRequestCreated.html')\n\nexport const organizationRequestCreatedMessage = {\n Name: 'organization-request-created',\n FriendlyName: 'Organization Request Created',\n // Description: null,\n IsDefaultTemplate: false,\n // AccountId: null,\n // AccountName: null,\n // ApplicationId: null,\n IsPersisted: true,\n IsRemoved: false,\n Type: '',\n Templates: {\n email: {\n To: '{{message.to}}',\n // CC: null,\n // BCC: null,\n Subject: 'Organization Request Created',\n Message: MESSAGE_BODY,\n Type: 'E',\n ProviderId: '00000000-0000-0000-0000-000000000000',\n // ProviderName: null,\n IsActive: true,\n withError: false,\n },\n sms: {\n Type: 'S',\n // ProviderId: null,\n // ProviderName: null,\n IsActive: false,\n withError: false,\n Parameters: [],\n },\n },\n}\n\n```"
}
] |
code_b2b-organizations-graphql_8e4f3434
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/templates/index.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { organizationAcceptedMessage } from './organizationAccepted'\nimport { organizationCreatedMessage } from './organizationCreated'\nimport { organizationDeclinedMessage } from './organizationDeclined'\nimport { organizationStatusChangedMessage } from './organizationStatusChanged'\nimport { organizationRequestCreatedMessage } from './organizationRequestCreated'\n\nconst templates = [\n organizationCreatedMessage,\n organizationAcceptedMessage,\n organizationDeclinedMessage,\n organizationStatusChangedMessage,\n organizationRequestCreatedMessage,\n]\n\nexport default templates\n\n```"
}
] |
code_b2b-organizations-graphql_534668c9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/templates/organizationDeclined.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport readFile from '../utils/readFile'\n\nconst MESSAGE_BODY = readFile('../assets/organizationDeclined.html')\n\nexport const organizationDeclinedMessage = {\n Name: 'organization-declined',\n FriendlyName: 'Organization Declined',\n // Description: null,\n IsDefaultTemplate: false,\n // AccountId: null,\n // AccountName: null,\n // ApplicationId: null,\n IsPersisted: true,\n IsRemoved: false,\n Type: '',\n Templates: {\n email: {\n To: '{{message.to}}',\n // CC: null,\n // BCC: null,\n Subject: 'Organization Declined',\n Message: MESSAGE_BODY,\n Type: 'E',\n ProviderId: '00000000-0000-0000-0000-000000000000',\n // ProviderName: null,\n IsActive: true,\n withError: false,\n },\n sms: {\n Type: 'S',\n // ProviderId: null,\n // ProviderName: null,\n IsActive: false,\n withError: false,\n Parameters: [],\n },\n },\n}\n\n```"
}
] |
code_b2b-organizations-graphql_9400bdb0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/metrics/user.test.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { randEmail, randWord } from '@ngneat/falso'\nimport type { Logger } from '@vtex/api/lib/service/logger/logger'\n\nimport { B2B_METRIC_NAME } from '../../clients/analytics'\nimport type { UserArgs } from '../../typings'\nimport {\n sendAddUserMetric,\n sendRemoveUserMetric,\n sendUpdateUserMetric,\n} from './user'\n\njest.mock('@vtex/api')\njest.mock('@vtex/diagnostics-nodejs', () => ({}))\n\nconst mockContext = () => {\n return {\n clients: {\n analytics: {\n sendMetric: jest.fn(),\n },\n },\n } as unknown as Context\n}\n\nafterEach(() => {\n jest.resetAllMocks()\n})\n\ndescribe('given an action for a user', () => {\n describe('when add user', () => {\n const context = mockContext()\n\n const logger = jest.fn() as unknown as Logger\n\n const account = randWord()\n\n const userArgs: Partial<UserArgs> = {\n email: randEmail(),\n id: randWord(),\n userId: randWord(),\n }\n\n beforeEach(async () => {\n await sendAddUserMetric(context, logger, account, userArgs)\n })\n\n it('should metrify the action', () => {\n const metricParam = {\n account,\n description: 'Add User Action - Graphql',\n fields: userArgs,\n kind: 'add-user-graphql-event',\n name: B2B_METRIC_NAME,\n }\n\n expect(context.clients.analytics.sendMetric).toHaveBeenCalledWith(\n metricParam\n )\n })\n })\n\n describe('when remove user', () => {\n const context = mockContext()\n\n const logger = jest.fn() as unknown as Logger\n\n const account = randWord()\n\n const userArgs: Partial<UserArgs> = {\n email: randEmail(),\n id: randWord(),\n userId: randWord(),\n }\n\n beforeEach(async () => {\n await sendRemoveUserMetric(context, logger, account, userArgs)\n })\n\n it('should metrify the action', () => {\n const metricParam = {\n account,\n description: 'Remove User Action - Graphql',\n fields: userArgs,\n kind: 'remove-user-graphql-event',\n name: B2B_METRIC_NAME,\n }\n\n expect(context.clients.analytics.sendMetric).toHaveBeenCalledWith(\n metricParam\n )\n })\n })\n\n describe('when update user', () => {\n const context = mockContext()\n\n const logger = jest.fn() as unknown as Logger\n\n const account = randWord()\n\n const userArgs: Partial<UserArgs> = {\n email: randEmail(),\n id: randWord(),\n userId: randWord(),\n }\n\n beforeEach(async () => {\n await sendUpdateUserMetric(context, logger, account, userArgs)\n })\n\n it('should metrify the action', () => {\n const metricParam = {\n account,\n description: 'Update User Action - Graphql',\n fields: userArgs,\n kind: 'update-user-graphql-event',\n name: B2B_METRIC_NAME,\n }\n\n expect(context.clients.analytics.sendMetric).toHaveBeenCalledWith(\n metricParam\n )\n })\n })\n})\n\n```"
}
] |
code_b2b-organizations-graphql_e74c7a6a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/metrics/organization.test.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport {\n randAirportName,\n randAlpha,\n randAlphaNumeric,\n randCompanyName,\n randFirstName,\n randFullName,\n randLastName,\n randPastDate,\n randStatus,\n randSuperheroName,\n randWord,\n} from '@ngneat/falso'\nimport type { Logger } from '@vtex/api/lib/service/logger/logger'\n\nimport { B2B_METRIC_NAME } from '../../clients/analytics'\nimport type { Seller } from '../../clients/sellers'\nimport type {\n Collection,\n CustomField,\n Organization,\n PaymentTerm,\n} from '../../typings'\nimport { ORGANIZATION_REQUEST_STATUSES } from '../constants'\nimport type {\n OrganizationStatusParams,\n UpdateOrganizationParams,\n} from './organization'\nimport {\n sendOrganizationStatusMetric,\n sendUpdateOrganizationMetric,\n} from './organization'\n\njest.mock('@vtex/api')\njest.mock('@vtex/diagnostics-nodejs', () => ({}))\n\nconst mockContext = () => {\n return {\n clients: {\n analytics: {\n sendMetric: jest.fn(),\n },\n },\n } as unknown as Context\n}\n\nafterEach(() => {\n jest.resetAllMocks()\n})\n\ndescribe('given an organization to update data', () => {\n describe('when change all properties', () => {\n const context = mockContext()\n\n const logger = jest.fn() as unknown as Logger\n\n const account = randWord()\n\n const currentOrganization: Organization = {\n collections: [{ name: randWord() } as Collection],\n costCenters: [],\n created: randPastDate().toISOString(),\n customFields: [{ name: randWord() } as CustomField],\n id: randAlphaNumeric().toString(),\n name: randCompanyName(),\n paymentTerms: [{ name: randAlphaNumeric() } as PaymentTerm],\n priceTables: [randAlpha()],\n salesChannel: randAlpha(),\n sellers: [{ name: randFullName() } as Seller],\n status: randAlpha(),\n tradeName: randCompanyName(),\n }\n\n const fieldsUpdated: Partial<Organization> = {\n collections: [{ name: randSuperheroName() } as Collection],\n costCenters: [],\n customFields: [{ name: randAirportName() } as CustomField],\n name: randCompanyName(),\n paymentTerms: [{ name: randLastName() } as PaymentTerm],\n priceTables: [randFirstName()],\n salesChannel: randAirportName(),\n sellers: [{ name: randFullName() } as Seller],\n status: randStatus(),\n tradeName: randCompanyName(),\n }\n\n const updateOrganizationParams: UpdateOrganizationParams = {\n account,\n currentOrganizationData: currentOrganization,\n updatedProperties: fieldsUpdated,\n }\n\n beforeEach(async () => {\n await sendUpdateOrganizationMetric(\n context,\n logger,\n updateOrganizationParams\n )\n })\n\n it('should metrify that all properties changed', () => {\n const metricParam = {\n account,\n description: 'Update Organization Action - Graphql',\n fields: {\n update_details: {\n properties: [\n 'collections',\n 'customFields',\n 'name',\n 'paymentTerms',\n 'priceTables',\n 'salesChannel',\n 'sellers',\n 'status',\n 'tradeName',\n ],\n },\n },\n kind: 'update-organization-graphql-event',\n name: B2B_METRIC_NAME,\n }\n\n expect(context.clients.analytics.sendMetric).toHaveBeenCalledWith(\n metricParam\n )\n })\n })\n\n describe('when no change properties data', () => {\n const context = mockContext()\n\n const logger = jest.fn() as unknown as Logger\n\n const account = randWord()\n\n const collections = [{ name: randWord() } as Collection]\n const customFields = [{ name: randWord() } as CustomField]\n const name = randWord()\n const paymentTerms = [{ name: randWord() } as PaymentTerm]\n const priceTables = [randWord()]\n const salesChannel = randWord()\n const sellers = [{ name: randFullName() } as Seller]\n const status = randWord()\n const tradeName = randWord()\n\n const currentOrganization: Organization = {\n collections,\n costCenters: [],\n created: randWord(),\n customFields,\n id: randWord(),\n name,\n paymentTerms,\n priceTables,\n salesChannel,\n sellers,\n status,\n tradeName,\n }\n\n const fieldsUpdated = {\n collections,\n customFields,\n name,\n paymentTerms,\n priceTables,\n salesChannel,\n sellers,\n status,\n tradeName,\n }\n\n const updateOrganizationParams: UpdateOrganizationParams = {\n account,\n currentOrganizationData: currentOrganization,\n updatedProperties: fieldsUpdated,\n }\n\n beforeEach(async () => {\n await sendUpdateOrganizationMetric(\n context,\n logger,\n updateOrganizationParams\n )\n })\n\n it('should metric no properties changed', () => {\n const metricParam = {\n account,\n description: 'Update Organization Action - Graphql',\n fields: {\n update_details: {\n properties: [],\n },\n },\n kind: 'update-organization-graphql-event',\n name: B2B_METRIC_NAME,\n }\n\n expect(context.clients.analytics.sendMetric).toHaveBeenCalledWith(\n metricParam\n )\n })\n })\n describe('when just the name, status and tradeName', () => {\n const context = mockContext()\n\n const logger = jest.fn() as unknown as Logger\n\n const account = randWord()\n\n const currentOrganization: Organization = {\n collections: [{ id: '149', name: 'Teste 2 Jay' }],\n costCenters: [],\n created: '2023-05-26T17:59:51.665Z',\n customFields: [],\n id: '166d3921-fbef-11ed-83ab-16759f4a0add',\n name: 'Antes',\n paymentTerms: [],\n priceTables: [],\n salesChannel: '1',\n sellers: [],\n status: 'inactive',\n tradeName: 'Antes',\n }\n\n const fieldsUpdated = {\n collections: [{ id: '149', name: 'Teste 2 Jay' }],\n customFields: [],\n name: 'Depois',\n paymentTerms: [],\n priceTables: [],\n salesChannel: '1',\n sellers: [],\n status: 'active',\n tradeName: 'Depois',\n }\n\n const updateOrganizationParams: UpdateOrganizationParams = {\n account,\n currentOrganizationData: currentOrganization,\n updatedProperties: fieldsUpdated,\n }\n\n beforeEach(async () => {\n await sendUpdateOrganizationMetric(\n context,\n logger,\n updateOrganizationParams\n )\n })\n\n it('should metric just the properties changed', () => {\n const metricParam = {\n account,\n description: 'Update Organization Action - Graphql',\n fields: {\n update_details: {\n properties: ['name', 'status', 'tradeName'],\n },\n },\n kind: 'update-organization-graphql-event',\n name: B2B_METRIC_NAME,\n }\n\n expect(context.clients.analytics.sendMetric).toHaveBeenCalledWith(\n metricParam\n )\n })\n })\n\n describe('when need to update status', () => {\n const context = mockContext()\n\n const logger = jest.fn() as unknown as Logger\n\n const account = randWord()\n\n const updateOrganizationParams: OrganizationStatusParams = {\n account,\n status: ORGANIZATION_REQUEST_STATUSES.APPROVED,\n }\n\n beforeEach(async () => {\n await sendOrganizationStatusMetric(\n context,\n logger,\n updateOrganizationParams\n )\n })\n\n it('should metrify the status changed', () => {\n const metricParam = {\n account,\n description: 'Change Organization Status Action - Graphql',\n fields: {\n status: ORGANIZATION_REQUEST_STATUSES.APPROVED,\n },\n kind: 'change-organization-status-graphql-event',\n name: B2B_METRIC_NAME,\n }\n\n expect(context.clients.analytics.sendMetric).toHaveBeenCalledWith(\n metricParam\n )\n })\n })\n})\n\n```"
}
] |
code_b2b-organizations-graphql_044df3f2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/metrics/organization.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Logger } from '@vtex/api/lib/service/logger/logger'\nimport { isEqual } from 'lodash'\n\nimport type { Organization } from '../../typings'\nimport type { Metric } from '../../clients/analytics'\nimport { B2B_METRIC_NAME } from '../../clients/analytics'\n\ninterface UpdateOrganizationFieldsMetric {\n update_details: { properties: string[] }\n}\n\ntype UpdateOrganization = Metric & {\n fields: UpdateOrganizationFieldsMetric\n}\n\nexport interface UpdateOrganizationParams {\n account: string\n currentOrganizationData?: Organization\n updatedProperties: Partial<Organization>\n}\n\nexport interface OrganizationStatusParams {\n account: string\n status: string\n}\n\nclass UpdateOrganizationMetric implements Metric {\n public readonly description = 'Update Organization Action - Graphql'\n public readonly kind = 'update-organization-graphql-event'\n public readonly account: string\n public readonly fields: UpdateOrganizationFieldsMetric\n public readonly name = B2B_METRIC_NAME\n\n constructor(account: string, fields: UpdateOrganizationFieldsMetric) {\n this.account = account\n this.fields = fields\n }\n}\n\nconst buildUpdateOrganizationMetric = (\n account: string,\n updatedProperties: string[]\n): UpdateOrganization => {\n const updateOrganizationFields: UpdateOrganizationFieldsMetric = {\n update_details: { properties: updatedProperties },\n }\n\n return new UpdateOrganizationMetric(account, updateOrganizationFields)\n}\n\nconst getPropNamesByUpdateParams = (\n updateOrganizationParams: UpdateOrganizationParams\n): string[] => {\n const updatedPropName: string[] = []\n\n const { currentOrganizationData, updatedProperties } =\n updateOrganizationParams\n\n if (!currentOrganizationData) {\n return updatedPropName\n }\n\n Object.entries(updatedProperties).forEach(\n ([updatedPropertyKey, updatedPropertyValue]) => {\n if (\n !isEqual(\n updatedPropertyValue,\n currentOrganizationData[updatedPropertyKey as keyof Organization]\n )\n ) {\n updatedPropName.push(updatedPropertyKey)\n }\n }\n )\n\n return updatedPropName\n}\n\nexport const sendUpdateOrganizationMetric = async (\n ctx: Context,\n logger: Logger,\n updateOrganizationParams: UpdateOrganizationParams\n) => {\n const {\n clients: { analytics },\n } = ctx\n\n try {\n const fieldsNamesUpdated = getPropNamesByUpdateParams(\n updateOrganizationParams\n )\n\n const metric = buildUpdateOrganizationMetric(\n updateOrganizationParams.account,\n fieldsNamesUpdated\n )\n\n await analytics.sendMetric(metric)\n } catch (error) {\n logger.error({\n error,\n message: 'Error to send metrics from updateOrganization',\n })\n }\n}\n\nexport const sendOrganizationStatusMetric = async (\n ctx: Context,\n logger: Logger,\n statusParams: OrganizationStatusParams\n) => {\n const {\n clients: { analytics },\n } = ctx\n\n try {\n await analytics.sendMetric({\n account: statusParams.account,\n description: 'Change Organization Status Action - Graphql',\n fields: {\n status: statusParams.status,\n },\n kind: 'change-organization-status-graphql-event',\n name: B2B_METRIC_NAME,\n } as unknown as Metric)\n } catch (error) {\n logger.error({\n error,\n message: 'Error to send metrics from organization status change',\n })\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_81c00ab3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/metrics/impersonate.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Metric } from '../../clients/analytics'\nimport { B2B_METRIC_NAME } from '../../clients/analytics'\n\ntype ImpersonatePerson = {\n email: string\n buyer_org_id: string\n cost_center_id: string\n person_id: string\n}\n\ntype ImpersonateFieldsMetric = {\n user?: ImpersonatePerson\n target: ImpersonatePerson\n date: string\n}\n\ntype ImpersonateMetric = Metric & { fields: ImpersonateFieldsMetric }\n\ntype ImpersonatePersonParams = {\n costCenterId: string\n organizationId: string\n email: string\n id: string\n}\n\nexport type ImpersonateMetricParams = {\n account: string\n target: ImpersonatePersonParams\n user?: ImpersonatePersonParams\n}\n\nconst buildMetric = (metricParams: ImpersonateMetricParams) => {\n const { account, user, target } = metricParams\n\n const userParam = user\n ? {\n email: user?.email,\n buyer_org_id: user?.organizationId,\n cost_center_id: user?.costCenterId,\n person_id: user?.id,\n }\n : undefined\n\n const metric = {\n name: B2B_METRIC_NAME,\n account,\n fields: {\n user: userParam,\n target: {\n email: target.email,\n buyer_org_id: target.organizationId,\n cost_center_id: target.costCenterId,\n person_id: target.id,\n },\n date: new Date().toISOString(),\n },\n }\n\n return metric\n}\n\nconst buildImpersonateUserMetric = (\n metricParams: ImpersonateMetricParams\n): ImpersonateMetric => {\n return {\n kind: 'impersonate-user-graphql-event',\n description: 'Impersonate User Action - Graphql',\n ...buildMetric(metricParams),\n } as ImpersonateMetric\n}\n\nconst buildImpersonateB2BUserMetric = (\n metricParams: ImpersonateMetricParams\n): ImpersonateMetric => {\n return {\n kind: 'impersonate-b2b-user-graphql-event',\n description: 'Impersonate B2B User Action - Graphql',\n ...buildMetric(metricParams),\n } as ImpersonateMetric\n}\n\nexport const sendImpersonateUserMetric = async (\n ctx: Context,\n metricParams: ImpersonateMetricParams\n) => {\n const {\n clients: { analytics },\n } = ctx\n\n try {\n const metric = buildImpersonateUserMetric(metricParams)\n\n await analytics.sendMetric(metric)\n } catch (error) {\n console.warn('Unable to log metrics', error)\n }\n}\n\nexport const sendImpersonateB2BUserMetric = async (\n ctx: Context,\n metricParams: ImpersonateMetricParams\n) => {\n const {\n clients: { analytics },\n } = ctx\n\n try {\n const metric = buildImpersonateB2BUserMetric(metricParams)\n\n await analytics.sendMetric(metric)\n } catch (error) {\n console.warn('Unable to log metrics', error)\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_e606a192
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/metrics/user.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Logger } from '@vtex/api/lib/service/logger/logger'\n\nimport type { UserArgs } from '../../typings'\nimport type { Metric } from '../../clients/analytics'\nimport { B2B_METRIC_NAME } from '../../clients/analytics'\n\ninterface UserMetricType {\n description: string\n kind: string\n}\n\nconst userMetricType = {\n add: {\n description: 'Add User Action - Graphql',\n kind: 'add-user-graphql-event',\n } as UserMetricType,\n remove: {\n description: 'Remove User Action - Graphql',\n kind: 'remove-user-graphql-event',\n } as UserMetricType,\n update: {\n description: 'Update User Action - Graphql',\n kind: 'update-user-graphql-event',\n } as UserMetricType,\n}\n\nclass UserMetric implements Metric {\n public readonly description: string\n public readonly kind: string\n public readonly account: string\n public readonly fields: Partial<UserArgs>\n public readonly name = B2B_METRIC_NAME\n\n constructor(\n account: string,\n { kind, description }: UserMetricType,\n fields: Partial<UserArgs>\n ) {\n this.account = account\n this.fields = fields\n this.kind = kind\n this.description = description\n }\n}\n\nconst sendUserMetric = async (\n ctx: Context,\n logger: Logger,\n userMetric: UserMetric\n) => {\n const {\n clients: { analytics },\n } = ctx\n\n try {\n await analytics.sendMetric(userMetric)\n } catch (error) {\n logger.error({\n error,\n message: `Error to send metrics from user action ${userMetric.kind}`,\n })\n }\n}\n\nexport const sendRemoveUserMetric = async (\n ctx: Context,\n logger: Logger,\n account: string,\n userArgs: Partial<UserArgs>\n) => {\n await sendUserMetric(\n ctx,\n logger,\n new UserMetric(account, userMetricType.remove, userArgs)\n )\n}\n\nexport const sendAddUserMetric = async (\n ctx: Context,\n logger: Logger,\n account: string,\n userArgs: Partial<UserArgs>\n) => {\n await sendUserMetric(\n ctx,\n logger,\n new UserMetric(account, userMetricType.add, userArgs)\n )\n}\n\nexport const sendUpdateUserMetric = async (\n ctx: Context,\n logger: Logger,\n account: string,\n userArgs: Partial<UserArgs>\n) => {\n await sendUserMetric(\n ctx,\n logger,\n new UserMetric(account, userMetricType.update, userArgs)\n )\n}\n\n```"
}
] |
code_b2b-organizations-graphql_1f04a7f6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/utils/metrics/auth.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { Logger } from '@vtex/api/lib/service/logger/logger'\n\nimport type { Metric } from '../../clients/analytics'\nimport { B2B_METRIC_NAME } from '../../clients/analytics'\n\nexport interface AuthAuditMetric {\n operation: string\n forwardedHost: string\n caller: string\n userAgent: string\n role?: string\n permissions?: string[]\n hasAdminToken?: boolean\n hasValidAdminToken?: boolean\n hasValidAdminRole?: boolean\n hasStoreToken?: boolean\n hasCurrentValidStoreToken?: boolean\n hasValidStoreToken?: boolean\n hasApiToken?: boolean\n hasValidApiToken?: boolean\n hasValidApiRole?: boolean\n hasAdminTokenOnHeader?: boolean\n hasValidAdminTokenOnHeader?: boolean\n hasValidAdminRoleOnHeader?: boolean\n}\n\nexport class AuthMetric implements Metric {\n public readonly description: string\n public readonly kind: string\n public readonly account: string\n public readonly fields: AuthAuditMetric\n public readonly name = B2B_METRIC_NAME\n\n constructor(account: string, fields: AuthAuditMetric, description?: string) {\n this.account = account\n this.fields = fields\n this.kind = 'b2b-organizations-graphql-auth-event'\n this.description = description ?? 'Auth metric event'\n }\n}\n\nconst sendAuthMetric = async (\n ctx: Context,\n logger: Logger,\n authMetric: AuthMetric\n) => {\n const {\n clients: { analytics },\n } = ctx\n\n try {\n await analytics.sendMetric(authMetric)\n } catch (error) {\n logger.error({\n error,\n message: `Error to send metrics from auth metric`,\n })\n }\n}\n\nexport default sendAuthMetric\n\n```"
}
] |
code_b2b-organizations-graphql_ec005bea
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/resolvers/directives/auditAccess.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport type { GraphQLField } from 'graphql'\nimport { defaultFieldResolver } from 'graphql'\nimport { SchemaDirectiveVisitor } from 'graphql-tools'\n\nimport sendAuthMetric, { AuthMetric } from '../../utils/metrics/auth'\nimport {\n validateAdminToken,\n validateAdminTokenOnHeader,\n validateApiToken,\n validateStoreToken,\n} from './helper'\n\nexport class AuditAccess extends SchemaDirectiveVisitor {\n public visitFieldDefinition(field: GraphQLField<any, any>) {\n const { resolve = defaultFieldResolver } = field\n\n field.resolve = async (\n root: any,\n args: any,\n context: Context,\n info: any\n ) => {\n this.sendAuthMetric(field, context)\n\n return resolve(root, args, context, info)\n }\n }\n\n private async sendAuthMetric(field: GraphQLField<any, any>, context: any) {\n const {\n vtex: { adminUserAuthToken, storeUserAuthToken, logger },\n } = context\n\n const { hasAdminToken, hasValidAdminToken } = await validateAdminToken(\n context,\n adminUserAuthToken as string\n )\n\n const { hasAdminTokenOnHeader, hasValidAdminTokenOnHeader } =\n await validateAdminTokenOnHeader(context)\n\n const { hasApiToken, hasValidApiToken } = await validateApiToken(context)\n\n const { hasStoreToken, hasValidStoreToken } = await validateStoreToken(\n context,\n storeUserAuthToken as string\n )\n\n // now we emit a metric with all the collected data before we proceed\n const operation = field?.astNode?.name?.value ?? context?.request?.url\n const userAgent = context?.request?.headers['user-agent'] as string\n const caller = context?.request?.headers['x-vtex-caller'] as string\n const forwardedHost = context?.request?.headers[\n 'x-forwarded-host'\n ] as string\n\n const auditMetric = new AuthMetric(context?.vtex?.account, {\n operation,\n forwardedHost,\n caller,\n userAgent,\n hasAdminToken,\n hasValidAdminToken,\n hasApiToken,\n hasValidApiToken,\n hasStoreToken,\n hasValidStoreToken,\n hasAdminTokenOnHeader,\n hasValidAdminTokenOnHeader,\n })\n\n await sendAuthMetric(context, logger, auditMetric)\n }\n}\n\n```"
}
] |
code_b2b-organizations-graphql_7be4c1b0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of b2b-organizations-graphql/node/resolvers/directives/helper.ts from the b2b-organizations-graphql VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { isUserPartOfBuyerOrg } from '../Queries/Users'\nimport { LICENSE_MANAGER_ROLES, B2B_LM_PRODUCT_CODE } from '../../constants'\n\nexport const validateAdminToken = async (\n context: Context,\n adminUserAuthToken: string,\n requiredRole: string = LICENSE_MANAGER_ROLES.B2B_ORGANIZATIONS_VIEW\n): Promise<{\n hasAdminToken: boolean\n hasValidAdminToken: boolean\n hasCurrentValidAdminToken: boolean\n hasValidAdminRole: boolean\n}> => {\n const {\n clients: { identity, lm },\n vtex: { account, logger },\n } = context\n\n // check if has admin token and if it is valid\n const hasAdminToken = !!adminUserAuthToken\n let hasValidAdminToken = false\n // this is used to check if the token is valid by current standards\n let hasCurrentValidAdminToken = false\n let hasValidAdminRole = false\n\n if (hasAdminToken) {\n try {\n const authUser = await identity.validateToken({\n token: adminUserAuthToken,\n })\n\n // we set this flag to true if the token is valid by current standards\n // in the future we should remove this line\n hasCurrentValidAdminToken = true\n\n if (authUser?.audience === 'admin' && authUser?.account === account) {\n hasValidAdminToken = await lm.getUserAdminPermissions(\n account,\n authUser.id\n )\n // Check for specific role using the new endpoint\n const roleCheckResponse = await lm.checkUserSpecificRole(\n account,\n authUser.id,\n B2B_LM_PRODUCT_CODE,\n requiredRole\n )\n\n hasValidAdminRole = !!roleCheckResponse\n }\n } catch (err) {\n // noop so we leave hasValidAdminToken as false\n logger.warn({\n message: 'Error validating admin token',\n err,\n })\n }\n }\n\n return {\n hasAdminToken,\n hasValidAdminToken,\n hasCurrentValidAdminToken,\n hasValidAdminRole,\n }\n}\n\nexport const validateApiToken = async (\n context: Context,\n requiredRole: string = LICENSE_MANAGER_ROLES.B2B_ORGANIZATIONS_VIEW\n): Promise<{\n hasApiToken: boolean\n hasValidApiToken: boolean\n hasCurrentValidApiToken: boolean\n hasValidApiRole: boolean\n}> => {\n const {\n clients: { identity, lm },\n vtex: { account, logger },\n } = context\n\n // check if has api token and if it is valid\n const apiToken = context?.headers['vtex-api-apptoken'] as string\n const appKey = context?.headers['vtex-api-appkey'] as string\n const hasApiToken = !!(apiToken?.length && appKey?.length)\n let hasValidApiToken = false\n\n // this is used to check if the token is valid by current standards\n let hasCurrentValidApiToken = false\n let hasValidApiRole = false\n\n if (hasApiToken) {\n try {\n const { token } = await identity.getToken({\n appkey: appKey,\n apptoken: apiToken,\n })\n\n const authUser = await identity.validateToken({\n token,\n })\n\n // we set this flag to true if the token is valid by current standards\n // in the future we should remove this line\n hasCurrentValidApiToken = true\n // keeping this behavior for now, but we should remove it in the future as well\n context.cookies.set('VtexIdclientAutCookie', token)\n context.vtex.adminUserAuthToken = token\n\n if (authUser?.audience === 'admin' && authUser?.account === account) {\n hasValidApiToken = await lm.getUserAdminPermissions(\n account,\n authUser.id\n )\n // Check for specific role using the new endpoint\n const roleCheckResponse = await lm.checkUserSpecificRole(\n account,\n authUser.id,\n B2B_LM_PRODUCT_CODE,\n requiredRole\n )\n\n hasValidApiRole = !!roleCheckResponse\n }\n } catch (err) {\n // noop so we leave hasValidApiToken as false\n logger.warn({\n message: 'Error validating API token',\n err,\n })\n }\n }\n\n return {\n hasApiToken,\n hasValidApiToken,\n hasCurrentValidApiToken,\n hasValidApiRole,\n }\n}\n\nexport const validateStoreToken = async (\n context: Context,\n storeUserAuthToken: string\n): Promise<{\n hasStoreToken: boolean\n hasValidStoreToken: boolean\n hasCurrentValidStoreToken: boolean\n}> => {\n const {\n clients: { vtexId },\n vtex: { logger },\n } = context\n\n // check if has store token and if it is valid\n const hasStoreToken = !!storeUserAuthToken\n let hasValidStoreToken = false\n // this is used to check if the token is valid by current standards\n let hasCurrentValidStoreToken = false\n\n if (hasStoreToken) {\n try {\n const authUser = await vtexId.getAuthenticatedUser(storeUserAuthToken)\n\n if (authUser?.user) {\n // we set this flag to true if the token is valid by current standards\n // in the future we should remove this line\n hasCurrentValidStoreToken = true\n\n const userIsPartOfBuyerOrg = await isUserPartOfBuyerOrg(\n authUser?.user,\n context\n )\n\n if (userIsPartOfBuyerOrg) {\n hasValidStoreToken = true\n }\n\n // adding log to better understand invalid store token use cases\n // in the future we should remove this log\n if (hasCurrentValidStoreToken && !hasValidStoreToken) {\n logger.warn({\n message: 'Invalid store token:',\n operation: context?.request?.url,\n userAgent: context?.request?.headers['user-agent'] as string,\n caller: context?.request?.headers['x-vtex-caller'] as string,\n forwardedHost: context?.request?.headers[\n 'x-forwarded-host'\n ] as string,\n authUser,\n })\n }\n }\n } catch (err) {\n // noop so we leave hasValidStoreToken as false\n logger.warn({\n message: 'Error validating store token:',\n err,\n })\n }\n }\n\n return { hasStoreToken, hasValidStoreToken, hasCurrentValidStoreToken }\n}\n\nexport const validateAdminTokenOnHeader = async (\n context: Context,\n requiredRole: string = LICENSE_MANAGER_ROLES.B2B_ORGANIZATIONS_VIEW\n): Promise<{\n hasAdminTokenOnHeader: boolean\n hasValidAdminTokenOnHeader: boolean\n hasCurrentValidAdminTokenOnHeader: boolean\n hasValidAdminRoleOnHeader: boolean\n}> => {\n const adminUserAuthToken = context?.headers.vtexidclientautcookie as string\n const hasAdminTokenOnHeader = !!adminUserAuthToken?.length\n\n if (!hasAdminTokenOnHeader) {\n return {\n hasAdminTokenOnHeader: false,\n hasValidAdminTokenOnHeader: false,\n hasCurrentValidAdminTokenOnHeader: false,\n hasValidAdminRoleOnHeader: false,\n }\n }\n\n const {\n hasAdminToken,\n hasCurrentValidAdminToken,\n hasValidAdminToken,\n hasValidAdminRole,\n } = await validateAdminToken(context, adminUserAuthToken, requiredRole)\n\n return {\n hasAdminTokenOnHeader: hasAdminToken,\n hasValidAdminTokenOnHeader: hasValidAdminToken,\n hasCurrentValidAdminTokenOnHeader: hasCurrentValidAdminToken,\n hasValidAdminRoleOnHeader: hasValidAdminRole,\n }\n}\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.