id
stringlengths 12
53
| messages
listlengths 3
3
|
|---|---|
code_graphql-example_6f01f9ce
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of graphql-example/node/clients/markdown/docs/automaticCacheUpdates/after.ts from the graphql-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport default `\n It's a kind of magic!\n\n The whole magic is made by using the cacheId option available in type Book and supported by InMemoryCache.\n\n Since InMemoryCache is a normalized data store, each element in the list has a unique key in the cache. This key is given by the cacheId field returned from the books.graphql query.\n\n The result of the mutation updates the book object under the key given by the returned cacheId. Since the object under the cacheId key was changed, when clicking in the back button and rerendering the book list, the list will be reconstructed with the new data, thus changing the rendered book info.\n\n Note that this feature can replace the use of Redux in most applications. Also, the name of the field cacheId is a convention and has to be respected\n`\n\n```"
}
] |
code_graphql-example_bc5441a0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of graphql-example/node/clients/markdown/docs/automaticCacheUpdates/index.ts from the graphql-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport after from './after'\nimport before from './before'\n\nexport default {\n after,\n before,\n}\n\n```"
}
] |
code_graphql-example_5c24636e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of graphql-example/node/clients/markdown/docs/automaticCacheUpdates/before.ts from the graphql-example VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport default `\n # Automatic Cache Updates\n\n In this example you will learn how to use\n [Automatic Cache Updates](https://www.apollographql.com/docs/react/advanced/caching.html#automatic-updates)\n\n Automatic Cache Updates let you update the Apollo Client's cache without any code!\n\n This example shows how this feature can be handy. It starts by querying a book list, which is shown by clicking in a row will take you to the detail page. The detail page allows you to edit the name and authors of a book. By clicking in save, a mutation will be made to the GraphQL API, mutating one SINGLE Book object. By click in the back button, the mutated book in the list will also be changed, all in ONE SINGLE MUTATION!\n`\n\n```"
}
] |
code_organizations-challenge_bea23fc1
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/messages/pt.json from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.challenge-permission.title\": \"Desafio de permissão\",\n \"admin/editor.challenge-permission.permissions.title\": \"Permissões\",\n \"admin/editor.challenge-permission.permissions.items.title\": \"Permissões\",\n \"admin/editor.challenge-permission.permissions.items.name\": \"Nome\",\n \"admin/test\": \"teste\",\n \"store/test\": \"teste\"\n}\n```"
}
] |
code_organizations-challenge_b657f974
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/messages/en.json from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.challenge-permission.title\": \"Permission Challenge\",\n \"admin/editor.challenge-permission.permissions.title\": \"Permissions\",\n \"admin/editor.challenge-permission.permissions.items.title\": \"Permissions\",\n \"admin/editor.challenge-permission.permissions.items.name\": \"Name\",\n \"admin/test\": \"test\",\n \"store/test\": \"test\"\n}\n\n```"
}
] |
code_organizations-challenge_9aba0a75
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/messages/context.json from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.challenge-permission.title\": \"Permission Challenge\",\n \"admin/editor.challenge-permission.permissions.title\": \"Permissions\",\n \"admin/editor.challenge-permission.permissions.items.title\": \"Permissions\",\n \"admin/editor.challenge-permission.permissions.items.name\": \"Name\",\n \"admin/test\": \"test\",\n \"store/test\": \"test\"\n}\n```"
}
] |
code_organizations-challenge_243ee1ef
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/messages/es.json from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.challenge-permission.title\": \"Desafío de permisos\",\n \"admin/editor.challenge-permission.permissions.title\": \"Permisos\",\n \"admin/editor.challenge-permission.permissions.items.title\": \"Permisos\",\n \"admin/editor.challenge-permission.permissions.items.name\": \"Nombre\",\n \"admin/test\": \"teste\",\n \"store/test\": \"teste\"\n}\n```"
}
] |
code_organizations-challenge_d54dabfd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/docs/README.md from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Organizations Challenge\n\nOrganizations Challenge is an app that checks if users are allowed to view content, based on their roles and permissions within [Organizations](https://github.com/vtex-apps/organizations).\n\n\n## Prerequisites\n\nBefore using the Organizations Challenge app, please make sure you meet the following prerequisites.\n\n\n### Set up your development environment\n\nBefore starting with the B2B Store Theme setup itself, you must:\n\n1. [Set up a workspace to develop in VTEX IO](https://developers.vtex.com/vtex-developer-docs/docs/vtex-io-documentation-2-basicsetuptodevelopinvtexio) on your machine.\n2. Follow [these instructions](https://developers.vtex.com/vtex-developer-docs/docs/vtex-io-documentation-2-prerequesites) to make sure you meet all the prerequisites to develop using Store Framework.\n3. Make sure your store’s catalog is integrated with VTEX Intelligent Search, as described in [this article](https://help.vtex.com/en/tracks/vtex-intelligent-search--19wrbB7nEQcmwzDPl1l4Cb/6wKQgKmu2FT6084BJT7z5V).\n\n\n### Install required Organizations apps\n\nNow you must install the required apps listed below. They are mandatory for the Organizations Challenge app to work properly.\n\n\n#### Admin Organizations\n\nIn brief, the [Admin Organizations](https://github.com/vtex-apps/admin-organizations) app is responsible for managing the Roles and Permissions modules on your store’s Admin.\n\nRun the command `vtex install vtex.admin-organizations@1.x` on the CLI to install it in your store.\n\n\n#### Organizations\n\nThe [Organizations](https://github.com/vtex-apps/organizations) app allows you to create an organization — a business store — and manage users under that organization with different roles.\n\nRun the command `vtex install vtex.organizations@1.x` on the CLI to install it on your store.\n\n\n\n### Create Master Data schemas\n\nYou must have the following Master Data schemas configured:\n\n* [`BusinessPermission schema`](https://developers.vtex.com/vtex-developer-docs/docs/installing-the-b2b-store-theme#businesspermission-schema)\n* [`BusinessRole schema`](https://developers.vtex.com/vtex-developer-docs/docs/installing-the-b2b-store-theme#businessrole-schema)\n* [`BusinessOrganization schema`](https://developers.vtex.com/vtex-developer-docs/docs/installing-the-b2b-store-theme#businessorganization-schema)\n* [`UserOrganization schema`](https://developers.vtex.com/vtex-developer-docs/docs/installing-the-b2b-store-theme#userorganization-schema)\n\nLearn more about how to create these schemas in the [Create Master Data schemas](https://developers.vtex.com/vtex-developer-docs/docs/installing-the-b2b-store-theme#create-master-data-schemas) section of our guide on [Installing the B2B Store Theme](https://developers.vtex.com/vtex-developer-docs/docs/installing-the-b2b-store-theme).\n\n\n### Create Master Data fields\n\nYou need to have the `isOrgAdmin` and `organizationId` fields configured in Master Data. Learn more about how to create this field in the [Create fields in Master Data](https://developers.vtex.com/vtex-developer-docs/docs/installing-the-b2b-store-theme#create-fields-in-master-data) section of our guide on [Installing the B2B Store Theme](https://developers.vtex.com/vtex-developer-docs/docs/installing-the-b2b-store-theme).\n\n\n## Installation\n\nFirst, add the app as a dependency in your theme’s `manifest.json` file, as follows:\n\n```json\n \"dependencies\": {\n \"vtex.organizations-challenge\": \"1.x\"\n }\n```\n\nThen, follow the instructions below to set your theme’s blocks, manage roles and permissions and add permissions using the **Site Editor**.\n\n\n\n### Set theme blocks\n\nIn your theme’s files, wrap the blocks you want to be visible only to the allowed logged-in users with `challenge-permission`.\n\nThis component will check if the user has permission to see the `allowed-content`, otherwise they will see the `disallowed-content`. \n\nIn the example below, taken from the B2B Store Theme’s `product-summary-prices.jsonc` file, the product prices are only visible to logged-in users with the `view_prices` permission. Otherwise, the store will show the `\"Log in or sign up to view prices\"` message instead.\n\nExample:\n\n```json\n{\n \"challenge-permission#product-summary-price\": {\n \"blocks\": [\n \"allowed-content#product-summary-price\",\n \"disallowed-content#product-summary-price\"\n ],\n \"props\": {\n \"permissions\": [{ \"name\": \"view_prices\" }]\n }\n },\n \"allowed-content#product-summary-price\": {\n \"children\": [\"product-summary-price\"]\n },\n \"disallowed-content#product-summary-price\": {\n \"children\": [\"rich-text#product-summary-price\"]\n },\n \"rich-text#product-summary-price\": {\n \"props\": {\n \"blockClass\": [\"product-summary-price-message\"],\n \"text\": \"Log in or sign up to view prices\"\n }\n }\n}\n```\n\n\n### Manage roles and permissions\n\nTo manage users’ permissions to view prices, you must follow the steps below to associate them with the `view_prices` permission.\n\n1. In the **Account Settings** module on VTEX’s Admin panel, click on **Authorizations** and then on **All Permissions**.\n\n2. Check if the `view_prices` permission exists, as shown in the image below.\n\n \n\n If it already exists, proceed to step 3.\n\n If it does not exist yet, click on `New` and fill in the fields as follows:\n\n * **Name:** view_prices\n * **Label:** View Prices\n\n Click on `Save`.\n\n3. In the **Account Settings** module, click on **Authorizations** and then on **All Roles**.\n4. Check if the **sales_manager** role exists and is associated with the **View Prices** permission, as shown below.\n\n \n\n If it already exists, proceed to step 5.\n\n If it does not exist yet, click on `New` and fill in the fields as follows:\n\n * **Name:** sales_manager\n * **Label:** Sales Manager\n * **Add Permissions:** click on `˅` and then on **View Prices**.\n\n Click on `Save`.\n\n5. Go to the store’s website and log in as the desired user.\n\n6. Click on `Hello, {name}` and then on `My Account`, as shown below. \n\n \n\n7. Click on the **My Organization** tab.\n\n8. Fill the data below and click on `Save`.\n\n * **Name:** organization name.\n * **Phone number:** organization phone number.\n * **Address:** address of the organization.\n * **Email:** email address of the organization.\n\nThe user will then be saved automatically with the **Sales Manager** role and the **View Prices** permission. If you refresh this page, you will be able to add other users as members of the organization and give them roles.\n\n### Edit blocks’ permissions using Site Editor [OPTIONAL]\n\nAfter the steps above, if you must edit the permissions allowed to see the defined blocks, you can do that either directly in the code – as explained in the [Set theme blocks](#set-theme-blocks) section – or using the **Site Editor**, on the VTEX Admin. This section will explain how to use the **Site Editor** with this purpose.\n\nYou should give a list of permissions to `challenge-permission` block from the **Site Editor** to allow or disallow relevant blocks.\n\n1. In the **Store Setup** module on VTEX’s admin panel, click on **CMS** and then on **Site Editor**.\n\n2. In the list of blocks, illustrated below, find the **Permission Challenge** block whose permissions you want to edit and click on it.\n\n \n\n3. You will see the options below on the sidebar.\n\n \n\nBy clicking on the **Untitled content** field, you have the option to name this Permission Challenge block as you wish.\n\nUnder **Permissions**, you can click on `+ Add` to inform the **Name** of a permission allowed to see this block and click on `Apply` to save your changes.\n\n\n\nThe **view_prices** permission is already saved as an **Item** – if you click it you will have the option to change it, the same way you would create a new one.\n\nIf you perform any changes, make sure you click on `Apply`.\n\n> ℹ The permission **Name** used on **Site Editor** must be valid on the **Permissions** page, as described in step 2 of the [Manage roles and permissions](#manage-roles-and-permissions) section.\n\n\n## Customization\n\nIn order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://developers.vtex.com/vtex-developer-docs/docs/vtex-io-documentation-using-css-handles-for-store-customization).\n\nYou can create a file called `vtex.challenge-permission.css` inside the `styles/css` folder to add your custom styles.\n\n| CSS Handle |\n| --------- |\n| `challengeContentWrapper` |\n\n\n\n\n```"
}
] |
code_organizations-challenge_2af08a82
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/PermissionChallenge.tsx from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { ElementType } from 'react'\nimport { ExtensionPoint } from 'vtex.render-runtime'\nimport { defineMessages } from 'react-intl'\n\nimport { useProfileData } from './hooks/useProfileData'\nimport { useOrgAssignment } from './hooks/useOrgAssignment'\nimport { usePermissionIds } from './hooks/usePermissionIds'\nimport { useUserPermissionNames } from './hooks/useUserPermissionNames'\n\ninterface Permission {\n name: string\n}\n\nexport interface MDField {\n key: string\n value: string\n}\n\nexport interface MDSearchData {\n documents?: MDSearchDocument[]\n}\n\nexport interface MDSearchDocument {\n id: string\n fields?: MDField[]\n}\n\ninterface Props {\n permissions: Permission[]\n AllowedContent?: ElementType\n DisallowedContent?: ElementType\n}\n\nfunction PermissionChallenge({\n permissions = [],\n AllowedContent,\n DisallowedContent,\n}: Props) {\n const profileData = useProfileData()\n const orgAssignment = useOrgAssignment(profileData)\n const permissionIds = usePermissionIds(orgAssignment)\n const { userPermissionNames } = useUserPermissionNames(permissionIds)\n\n let hasPermission = false\n\n if (userPermissionNames) {\n hasPermission = permissions.some(permission =>\n userPermissionNames.includes(permission.name)\n )\n }\n\n if (hasPermission) {\n return AllowedContent ? (\n <AllowedContent />\n ) : (\n <ExtensionPoint id=\"allowed-content\" />\n )\n }\n\n return DisallowedContent ? (\n <DisallowedContent />\n ) : (\n <ExtensionPoint id=\"disallowed-content\" />\n )\n}\n\nconst messages = defineMessages({\n permissionChallengeTitle: {\n defaultMessage: '',\n id: 'admin/editor.challenge-permission.title',\n },\n})\n\nPermissionChallenge.schema = {\n // tslint:disable: object-literal-sort-keys\n title: messages.permissionChallengeTitle.id,\n type: 'object',\n properties: {\n permissions: {\n minItems: 0,\n type: 'array',\n title: 'admin/editor.challenge-permission.permissions.title',\n items: {\n title: 'admin/editor.challenge-permission.permissions.items.title',\n type: 'object',\n properties: {\n name: {\n title: 'admin/editor.challenge-permission.permissions.items.name',\n type: 'string',\n },\n },\n },\n },\n },\n}\n\nexport default PermissionChallenge\n\n```"
}
] |
code_organizations-challenge_10ecf909
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/BlockContent.tsx from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport type { PropsWithChildren } from 'react'\nimport { useCssHandles } from 'vtex.css-handles'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\n\nconst CSS_HANDLES = ['challengeContentWrapper'] as const\n\ninterface Props {\n classes?: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n}\n\nfunction BlockContent({ children, classes }: PropsWithChildren<Props>) {\n const { handles } = useCssHandles(CSS_HANDLES, { classes })\n\n return (\n <div className={`mw9 center ${handles.challengeContentWrapper}`}>\n {children}\n </div>\n )\n}\n\nexport default BlockContent\n\n```"
}
] |
code_organizations-challenge_ddaae209
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/package.json from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.3\",\n \"graphql\": \"^14.5.8\",\n \"react\": \"^16.8.6\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.8.6\",\n \"react-intl\": \"3.9.1\"\n },\n \"devDependencies\": {\n \"@types/graphql\": \"^14.5.0\",\n \"@types/jest\": \"^24.0.21\",\n \"@types/node\": \"^12.12.3\",\n \"@vtex/test-tools\": \"^0.3.2\",\n \"@vtex/tsconfig\": \"^0.2.0\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/public/@types/vtex.css-handles\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.126.11/public/@types/vtex.render-runtime\",\n \"vtex.store\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store@2.111.1/public/@types/vtex.store\",\n \"vtex.store-graphql\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.138.0/public/@types/vtex.store-graphql\"\n },\n \"version\": \"1.2.2\"\n}\n\n```"
}
] |
code_organizations-challenge_f5f1ec5b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/store/interfaces.json from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"challenge-permission\": {\n \"component\": \"PermissionChallenge\",\n \"allowed\": [\"allowed-content\", \"disallowed-content\"]\n },\n \"allowed-content\": {\n \"component\": \"BlockContent\",\n \"composition\": \"children\",\n \"allowed\": \"*\"\n },\n \"disallowed-content\": {\n \"component\": \"BlockContent\",\n \"composition\": \"children\",\n \"allowed\": \"*\"\n }\n}\n\n```"
}
] |
code_organizations-challenge_2718c58f
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/typings/graphql.d.ts from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module '*.graphql' {\n import type { DocumentNode } from 'graphql'\n\n const value: DocumentNode\n export default value\n}\n\n```"
}
] |
code_organizations-challenge_2e750a98
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/utils/const.ts from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const PROFILE_FIELDS = 'organizationId'\n\nexport const BUSINESS_ROLE = 'BusinessRole'\nexport const BUSINESS_ROLE_FIELDS = ['permissions']\nexport const BUSINESS_ROLE_SCHEMA = 'business-role-schema-v1'\n\nexport const BUSINESS_PERMISSION = 'BusinessPermission'\nexport const BUSINESS_PERMISSION_FIELDS = ['id', 'name']\nexport const BUSINESS_PERMISSION_SCHEMA = 'business-permission-schema-v1'\n\nexport const ORG_ASSIGNMENT = 'UserOrganization'\nexport const ORG_ASSIGNMENT_FIELDS = ['roleId']\nexport const ORG_ASSIGNMENT_SCHEMA = 'user-organization-schema-v1'\n\n```"
}
] |
code_organizations-challenge_027461fc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/__tests__/index.test.tsx from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\ndescribe('Product description scenario', () => {\n it('should work', () => {\n expect(1).toBe(1)\n })\n})\n\n```"
}
] |
code_organizations-challenge_47a9a432
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/graphql/getProfile.graphql from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery Profile($customFields: String) @context(scope: \"private\") {\n profile(customFields: $customFields) {\n email\n customFields {\n key\n value\n }\n }\n}\n\n```"
}
] |
code_organizations-challenge_ae9b6217
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/graphql/documents.graphql from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```graphql\nquery getDocuments(\n $acronym: String\n $fields: [String]\n $schema: String\n $where: String\n $page: Int\n $pageSize: Int\n) {\n documents(\n acronym: $acronym\n fields: $fields\n schema: $schema\n where: $where\n page: $page\n pageSize: $pageSize\n ) {\n id\n fields {\n key\n value\n }\n }\n}\n\n```"
}
] |
code_organizations-challenge_ad97d0ae
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/hooks/useProfileData.ts from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useQuery } from 'react-apollo'\n\nimport profileQuery from '../graphql/getProfile.graphql'\nimport { PROFILE_FIELDS } from '../utils/const'\nimport type { MDField } from '../PermissionChallenge'\n\ninterface ProfileData {\n profile?: {\n email?: string\n customFields?: MDField[]\n }\n}\n\nexport interface UseProfileDataReturn {\n email?: string\n organizationId?: string\n}\n\nexport function useProfileData(): UseProfileDataReturn {\n const { data: profileData } = useQuery<ProfileData>(profileQuery, {\n variables: { customFields: PROFILE_FIELDS },\n ssr: false,\n })\n\n const email = profileData?.profile?.email\n const customFields = profileData?.profile?.customFields\n\n const organizationId = customFields?.find(\n customField => customField.key === 'organizationId'\n )?.value\n\n return { email, organizationId }\n}\n\n```"
}
] |
code_organizations-challenge_838f9041
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/hooks/useUserPermissionNames.ts from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useQuery } from 'react-apollo'\n\nimport documentQuery from '../graphql/documents.graphql'\nimport {\n BUSINESS_PERMISSION,\n BUSINESS_PERMISSION_FIELDS,\n BUSINESS_PERMISSION_SCHEMA,\n} from '../utils/const'\nimport type { MDSearchData } from '../PermissionChallenge'\nimport type { UsePermissionIdsReturn } from './usePermissionIds'\n\nexport interface UseUserPermissionNames {\n userPermissionNames?: string[] | null\n}\n\nexport function useUserPermissionNames({\n permissionIds,\n}: UsePermissionIdsReturn): UseUserPermissionNames {\n const { data: permissionData } = useQuery<MDSearchData>(documentQuery, {\n skip: !(permissionIds?.length > 0),\n variables: {\n acronym: BUSINESS_PERMISSION,\n fields: BUSINESS_PERMISSION_FIELDS,\n schema: BUSINESS_PERMISSION_SCHEMA,\n },\n })\n\n if (!permissionData || !permissionData.documents) {\n return { userPermissionNames: null }\n }\n\n const userPermissionNames: string[] = permissionData.documents\n .filter(document => permissionIds.includes(document.id))\n .map(\n document =>\n document.fields?.find(field => field.key === 'name')?.value ?? ''\n )\n .filter(Boolean)\n\n return { userPermissionNames }\n}\n\n```"
}
] |
code_organizations-challenge_f35cf2f0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/hooks/useProfileAllowed.ts from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useQuery } from 'react-apollo'\n\nimport checkProfileAllowedQuery from '../graphql/documents.graphql'\n\nexport const useProfileAllowed = (skip: boolean) => {\n const { loading, data, error } = useQuery(checkProfileAllowedQuery, {\n ssr: false,\n skip,\n })\n\n return !loading && data && !error ? !!data.checkProfileAllowed.allowed : null\n}\n\n```"
}
] |
code_organizations-challenge_61ca4699
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/hooks/useOrgAssignment.ts from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useQuery } from 'react-apollo'\n\nimport documentQuery from '../graphql/documents.graphql'\nimport {\n ORG_ASSIGNMENT_FIELDS,\n ORG_ASSIGNMENT_SCHEMA,\n ORG_ASSIGNMENT,\n} from '../utils/const'\nimport type { MDSearchData } from '../PermissionChallenge'\nimport type { UseProfileDataReturn } from './useProfileData'\n\nexport interface UseOrgAssignmentReturn {\n roleId?: string | null\n}\n\nexport function useOrgAssignment({\n email,\n organizationId,\n}: UseProfileDataReturn): UseOrgAssignmentReturn {\n const { data: orgAssignmentData } = useQuery<MDSearchData>(documentQuery, {\n skip: !email || !organizationId,\n variables: {\n acronym: ORG_ASSIGNMENT,\n schema: ORG_ASSIGNMENT_SCHEMA,\n fields: ORG_ASSIGNMENT_FIELDS,\n where: `(email=${email} AND businessOrganizationId=${organizationId})`,\n },\n })\n\n if (!orgAssignmentData || !orgAssignmentData.documents) {\n return { roleId: null }\n }\n\n const lastDocumentIndex = orgAssignmentData?.documents?.length - 1\n const rolePermissionFields =\n orgAssignmentData.documents[lastDocumentIndex]?.fields\n\n const roleId = rolePermissionFields?.find(field => field.key === 'roleId')\n ?.value\n\n return { roleId }\n}\n\n```"
}
] |
code_organizations-challenge_fb6e5439
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of organizations-challenge/react/hooks/usePermissionIds.ts from the organizations-challenge VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { useQuery } from 'react-apollo'\n\nimport documentQuery from '../graphql/documents.graphql'\nimport {\n BUSINESS_ROLE,\n BUSINESS_ROLE_FIELDS,\n BUSINESS_ROLE_SCHEMA,\n} from '../utils/const'\nimport type { MDSearchData } from '../PermissionChallenge'\nimport type { UseOrgAssignmentReturn } from './useOrgAssignment'\n\nconst ARRAY_AS_STRING = '[]'\n\nexport interface UsePermissionIdsReturn {\n permissionIds: string[]\n}\n\nexport function usePermissionIds({\n roleId,\n}: UseOrgAssignmentReturn): UsePermissionIdsReturn {\n const { data: rolePermissionData } = useQuery<MDSearchData>(documentQuery, {\n skip: !roleId,\n variables: {\n acronym: BUSINESS_ROLE,\n fields: BUSINESS_ROLE_FIELDS,\n where: `(id=${roleId})`,\n schema: BUSINESS_ROLE_SCHEMA,\n },\n })\n\n if (!rolePermissionData || !rolePermissionData.documents) {\n return { permissionIds: [] }\n }\n\n const lastDocumentIndex = rolePermissionData.documents.length - 1\n const rolePermissionFields =\n rolePermissionData.documents[lastDocumentIndex]?.fields\n\n const unparsedPermissionIds = rolePermissionFields?.find(\n field => field.key === 'permissions'\n )?.value\n\n const permissionIds: string[] = JSON.parse(\n unparsedPermissionIds ?? ARRAY_AS_STRING\n )\n\n return { permissionIds }\n}\n\n```"
}
] |
code_rich-text_81637518
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/it-IT.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Rich Text\",\n \"admin/editor.rich-text.text.title\": \"Testo\",\n \"admin/editor.rich-text.text.description\": \"Testi da visualizzare in linguaggio markdown\",\n \"admin/editor.rich-text.textPosition.title\": \"Posizione testo\",\n \"admin/editor.rich-text.textPosition.description\": \"Scegli in quale posizione verrà visualizzato il testo del componente: sinistra, centro o destra\",\n \"admin/editor.rich-text.textAlignment.title\": \"Allineamento testo\",\n \"admin/editor.rich-text.textAlignment.description\": \"Controlla l'allineamento del testo all'interno del componente\",\n \"admin/editor.rich-text.textPosition.left\": \"Sinistra\",\n \"admin/editor.rich-text.textPosition.center\": \"Centro\",\n \"admin/editor.rich-text.textPosition.right\": \"Destra\",\n \"admin/editor.rich-text.textAlignment.left\": \"Sinistra\",\n \"admin/editor.rich-text.textAlignment.center\": \"Centro\",\n \"admin/editor.rich-text.textAlignment.right\": \"Destra\",\n \"admin/editor.rich-text.font.title\": \"Token font\",\n \"admin/editor.rich-text.font.description\": \"Specifica il token del font da utilizzare come predefinito\",\n \"admin/editor.rich-text.textColor.title\": \"Token colore del testo\",\n \"admin/editor.rich-text.textColor.description\": \"Specifica il token del colore del testo da utilizzare\",\n \"admin/editor.rich-text.blockClass.title\": \"Classe di blocco\",\n \"admin/editor.rich-text.blockClass.description\": \"Nome di classe univoco da aggiungere alle classi di blocco\"\n}\n\n```"
}
] |
code_rich-text_e4ddebae
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/bs-BA.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"crwdns130176:0crwdne130176:0\",\n \"admin/editor.rich-text.text.title\": \"crwdns130178:0crwdne130178:0\",\n \"admin/editor.rich-text.text.description\": \"crwdns130180:0crwdne130180:0\",\n \"admin/editor.rich-text.textPosition.title\": \"crwdns130182:0crwdne130182:0\",\n \"admin/editor.rich-text.textPosition.description\": \"crwdns130184:0crwdne130184:0\",\n \"admin/editor.rich-text.textAlignment.title\": \"crwdns130186:0crwdne130186:0\",\n \"admin/editor.rich-text.textAlignment.description\": \"crwdns130188:0crwdne130188:0\",\n \"admin/editor.rich-text.textPosition.left\": \"crwdns130190:0crwdne130190:0\",\n \"admin/editor.rich-text.textPosition.center\": \"crwdns130192:0crwdne130192:0\",\n \"admin/editor.rich-text.textPosition.right\": \"crwdns130194:0crwdne130194:0\",\n \"admin/editor.rich-text.textAlignment.left\": \"crwdns130196:0crwdne130196:0\",\n \"admin/editor.rich-text.textAlignment.center\": \"crwdns130198:0crwdne130198:0\",\n \"admin/editor.rich-text.textAlignment.right\": \"crwdns130200:0crwdne130200:0\",\n \"admin/editor.rich-text.font.title\": \"crwdns130202:0crwdne130202:0\",\n \"admin/editor.rich-text.font.description\": \"crwdns130204:0crwdne130204:0\",\n \"admin/editor.rich-text.textColor.title\": \"crwdns130206:0crwdne130206:0\",\n \"admin/editor.rich-text.textColor.description\": \"crwdns130208:0crwdne130208:0\",\n \"admin/editor.rich-text.blockClass.title\": \"crwdns130210:0crwdne130210:0\",\n \"admin/editor.rich-text.blockClass.description\": \"crwdns130212:0crwdne130212:0\"\n}\n\n```"
}
] |
code_rich-text_8756c2c0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/ko-KR.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"리치 텍스트\",\n \"admin/editor.rich-text.text.title\": \"텍스트\",\n \"admin/editor.rich-text.text.description\": \"표시할 마크다운 언어로 된 텍스트\",\n \"admin/editor.rich-text.textPosition.title\": \"텍스트 위치\",\n \"admin/editor.rich-text.textPosition.description\": \"왼쪽, 가운데 또는 오른쪽에 표시될 구성요소 텍스트의 위치 선택\",\n \"admin/editor.rich-text.textAlignment.title\": \"텍스트 정렬\",\n \"admin/editor.rich-text.textAlignment.description\": \"구성 요소 내부의 텍스트 정렬 제어\",\n \"admin/editor.rich-text.textPosition.left\": \"왼쪽\",\n \"admin/editor.rich-text.textPosition.center\": \"가운데\",\n \"admin/editor.rich-text.textPosition.right\": \"오른쪽\",\n \"admin/editor.rich-text.textAlignment.left\": \"왼쪽\",\n \"admin/editor.rich-text.textAlignment.center\": \"가운데\",\n \"admin/editor.rich-text.textAlignment.right\": \"오른쪽\",\n \"admin/editor.rich-text.font.title\": \"폰트 토큰\",\n \"admin/editor.rich-text.font.description\": \"기본값으로 사용할 폰트 토큰 지정\",\n \"admin/editor.rich-text.textColor.title\": \"텍스트 색 토큰\",\n \"admin/editor.rich-text.textColor.description\": \"사용할 텍스트 색 토큰 지정\",\n \"admin/editor.rich-text.blockClass.title\": \"블록 클래스\",\n \"admin/editor.rich-text.blockClass.description\": \"블록 클래스에 추가할 고유 클래스 이름\"\n}\n\n```"
}
] |
code_rich-text_b186abb2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/ja-JP.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"リッチテキスト\",\n \"admin/editor.rich-text.text.title\": \"テキスト\",\n \"admin/editor.rich-text.text.description\": \"表示するマークダウン言語のテキスト\",\n \"admin/editor.rich-text.textPosition.title\": \"テキストの位置\",\n \"admin/editor.rich-text.textPosition.description\": \"コンポーネントテキストが表示される位置を左、中央、右から選びます。\",\n \"admin/editor.rich-text.textAlignment.title\": \"文字揃え\",\n \"admin/editor.rich-text.textAlignment.description\": \"コンポーネント内の文字揃えをコントロールします\",\n \"admin/editor.rich-text.textPosition.left\": \"左\",\n \"admin/editor.rich-text.textPosition.center\": \"中央\",\n \"admin/editor.rich-text.textPosition.right\": \"右\",\n \"admin/editor.rich-text.textAlignment.left\": \"左\",\n \"admin/editor.rich-text.textAlignment.center\": \"中央\",\n \"admin/editor.rich-text.textAlignment.right\": \"右\",\n \"admin/editor.rich-text.font.title\": \"フォントトークン\",\n \"admin/editor.rich-text.font.description\": \"デフォルトで使うフォントトークンを指定する\",\n \"admin/editor.rich-text.textColor.title\": \"テキストカラートークン\",\n \"admin/editor.rich-text.textColor.description\": \"使用するテキストカラートークンを指定する\",\n \"admin/editor.rich-text.blockClass.title\": \"ブロッククラス\",\n \"admin/editor.rich-text.blockClass.description\": \"ブロッククラスに添付する独自のクラス名\"\n}\n\n```"
}
] |
code_rich-text_13926d70
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/bg-BG.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"RTF текст\",\n \"admin/editor.rich-text.text.title\": \"Текст\",\n \"admin/editor.rich-text.text.description\": \"Текст в маркдаун език, който ще се показва\",\n \"admin/editor.rich-text.textPosition.title\": \"Разположение на текста\",\n \"admin/editor.rich-text.textPosition.description\": \"Изберете в коя позиция на компонента ще се показва текстът – ляво, центрирано или дясно\",\n \"admin/editor.rich-text.textAlignment.title\": \"Подравняване на текста\",\n \"admin/editor.rich-text.textAlignment.description\": \"Контролира подравняването на текста в компонента\",\n \"admin/editor.rich-text.textPosition.left\": \"Ляво\",\n \"admin/editor.rich-text.textPosition.center\": \"Центрирано\",\n \"admin/editor.rich-text.textPosition.right\": \"Дясно\",\n \"admin/editor.rich-text.textAlignment.left\": \"Ляво\",\n \"admin/editor.rich-text.textAlignment.center\": \"Центрирано\",\n \"admin/editor.rich-text.textAlignment.right\": \"Дясно\",\n \"admin/editor.rich-text.font.title\": \"Маркер за шрифт\",\n \"admin/editor.rich-text.font.description\": \"Посочете маркера за шрифт, който да се използва по подразбиране\",\n \"admin/editor.rich-text.textColor.title\": \"Маркер за цвят на текст\",\n \"admin/editor.rich-text.textColor.description\": \"Посочете маркера за цвят на текст, който ще се използва\",\n \"admin/editor.rich-text.blockClass.title\": \"Блок клас\",\n \"admin/editor.rich-text.blockClass.description\": \"Уникално име на клас, което да се добавя към блок класовете\"\n}\n\n```"
}
] |
code_rich-text_4a679499
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/pt.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Rich Text\",\n \"admin/editor.rich-text.text.title\": \"Texto\",\n \"admin/editor.rich-text.text.description\": \"Texto em linguagem markdown a ser mostrado\",\n \"admin/editor.rich-text.textPosition.title\": \"Posição do texto\",\n \"admin/editor.rich-text.textPosition.description\": \"Escolha em qual posição o texto deve ser apresentado (esquerda, centro ou direita)\",\n \"admin/editor.rich-text.textAlignment.title\": \"Alinhamento do texto\",\n \"admin/editor.rich-text.textAlignment.description\": \"Controla o alinhamento dos textos dentro do componente\",\n \"admin/editor.rich-text.textPosition.left\": \"Esquerda\",\n \"admin/editor.rich-text.textPosition.center\": \"Centro\",\n \"admin/editor.rich-text.textPosition.right\": \"Direita\",\n \"admin/editor.rich-text.textAlignment.left\": \"Esquerda\",\n \"admin/editor.rich-text.textAlignment.center\": \"Centro\",\n \"admin/editor.rich-text.textAlignment.right\": \"Direita\",\n \"admin/editor.rich-text.font.title\": \"Token de fonte\",\n \"admin/editor.rich-text.font.description\": \"Especifique o token de fonte para ser usado como padrão\",\n \"admin/editor.rich-text.textColor.title\": \"Token de cor\",\n \"admin/editor.rich-text.textColor.description\": \"Especifique o token de cor do texto para ser usado como padrão\",\n \"admin/editor.rich-text.blockClass.title\": \"Classe do bloco\",\n \"admin/editor.rich-text.blockClass.description\": \"Nome da classe do bloco para ser anexado as classes padrão do bloco\"\n}\n\n```"
}
] |
code_rich-text_6ba1c011
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/en.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Rich Text\",\n \"admin/editor.rich-text.text.title\": \"Text\",\n \"admin/editor.rich-text.text.description\": \"Text in markdown language to be displayed\",\n \"admin/editor.rich-text.textPosition.title\": \"Text Position\",\n \"admin/editor.rich-text.textPosition.description\": \"Choose in which position of the component text will be displayed, left, center or right\",\n \"admin/editor.rich-text.textAlignment.title\": \"Text Alignment\",\n \"admin/editor.rich-text.textAlignment.description\": \"Control the text alignment inside component\",\n \"admin/editor.rich-text.textPosition.left\": \"Left\",\n \"admin/editor.rich-text.textPosition.center\": \"Center\",\n \"admin/editor.rich-text.textPosition.right\": \"Right\",\n \"admin/editor.rich-text.textAlignment.left\": \"Left\",\n \"admin/editor.rich-text.textAlignment.center\": \"Center\",\n \"admin/editor.rich-text.textAlignment.right\": \"Right\",\n \"admin/editor.rich-text.font.title\": \"Font token\",\n \"admin/editor.rich-text.font.description\": \"Specify the font token to be used as default\",\n \"admin/editor.rich-text.textColor.title\": \"Text Color token\",\n \"admin/editor.rich-text.textColor.description\": \"Specify the text color token to be used\",\n \"admin/editor.rich-text.blockClass.title\": \"Block class\",\n \"admin/editor.rich-text.blockClass.description\": \"Unique class name to be appended to block classes\"\n}\n\n```"
}
] |
code_rich-text_2e4b62a8
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/ro-RO.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Text îmbogățit\",\n \"admin/editor.rich-text.text.title\": \"Text\",\n \"admin/editor.rich-text.text.description\": \"De afișat text în limbajul markdown\",\n \"admin/editor.rich-text.textPosition.title\": \"Poziție text\",\n \"admin/editor.rich-text.textPosition.description\": \"Alege în care poziție a componentei va fi textul afișat, stânga, centru sau dreapta\",\n \"admin/editor.rich-text.textAlignment.title\": \"Alinierea textului\",\n \"admin/editor.rich-text.textAlignment.description\": \"Controlează alinierea textului în interiorul componentei\",\n \"admin/editor.rich-text.textPosition.left\": \"Stânga\",\n \"admin/editor.rich-text.textPosition.center\": \"Centru\",\n \"admin/editor.rich-text.textPosition.right\": \"Dreapta\",\n \"admin/editor.rich-text.textAlignment.left\": \"Stânga\",\n \"admin/editor.rich-text.textAlignment.center\": \"Centru\",\n \"admin/editor.rich-text.textAlignment.right\": \"Dreapta\",\n \"admin/editor.rich-text.font.title\": \"Token font\",\n \"admin/editor.rich-text.font.description\": \"Specifică token-ul fontului care să fie folosit în calitate de cel prestabilit\",\n \"admin/editor.rich-text.textColor.title\": \"Token culoare text\",\n \"admin/editor.rich-text.textColor.description\": \"Specifică token-ul culorii textului care să fie folosit\",\n \"admin/editor.rich-text.blockClass.title\": \"Clasa de blocuri\",\n \"admin/editor.rich-text.blockClass.description\": \"Denumire unică a clasei care se anexează claselor de blocuri\"\n}\n\n```"
}
] |
code_rich-text_b811567b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/context.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Title of Rich Text component\",\n \"admin/editor.rich-text.text.title\": \"Title of text property\",\n \"admin/editor.rich-text.text.description\": \"Description of text property\",\n \"admin/editor.rich-text.textPosition.title\": \"Title of textPosition property\",\n \"admin/editor.rich-text.textPosition.description\": \"Description of textPosition property\",\n \"admin/editor.rich-text.textAlignment.title\": \"Title of textAlignment property\",\n \"admin/editor.rich-text.textAlignment.description\": \"Description of textAlignment property\",\n \"admin/editor.rich-text.textPosition.left\": \"Name of enum value to make text at left position\",\n \"admin/editor.rich-text.textPosition.center\": \"Name of enum value to make text at center position\",\n \"admin/editor.rich-text.textPosition.right\": \"Name of enum value to make text at right position\",\n \"admin/editor.rich-text.textAlignment.left\": \"Name of enum value to align text to the left\",\n \"admin/editor.rich-text.textAlignment.center\": \"Name of enum value to align text to the center\",\n \"admin/editor.rich-text.textAlignment.right\": \"Name of enum value to align text to the right\",\n \"admin/editor.rich-text.font.title\": \"Title of font property\",\n \"admin/editor.rich-text.font.description\": \"Description of font property\",\n \"admin/editor.rich-text.textColor.title\": \"Title of textColor property\",\n \"admin/editor.rich-text.textColor.description\": \"Description of textColor property\",\n \"admin/editor.rich-text.blockClass.title\": \"Title of blockClass prop on Storefront\",\n \"admin/editor.rich-text.blockClass.description\": \"Description of blockClass prop on Storefront\"\n}\n\n```"
}
] |
code_rich-text_a9876576
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/de-DE.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Rich-Text\",\n \"admin/editor.rich-text.text.title\": \"Text\",\n \"admin/editor.rich-text.text.description\": \"Text in Markdown Sprache angezeigt werden\",\n \"admin/editor.rich-text.textPosition.title\": \"Textposition\",\n \"admin/editor.rich-text.textPosition.description\": \"Wählen Sie, an welcher Position der Text der Komponente angezeigt werden soll: links, mittig oder rechts\",\n \"admin/editor.rich-text.textAlignment.title\": \"Textausrichtung\",\n \"admin/editor.rich-text.textAlignment.description\": \"Steuern Sie die Textausrichtung innerhalb der Komponente\",\n \"admin/editor.rich-text.textPosition.left\": \"Links\",\n \"admin/editor.rich-text.textPosition.center\": \"Mittig\",\n \"admin/editor.rich-text.textPosition.right\": \"Rechts\",\n \"admin/editor.rich-text.textAlignment.left\": \"Links\",\n \"admin/editor.rich-text.textAlignment.center\": \"Mittig\",\n \"admin/editor.rich-text.textAlignment.right\": \"Rechts\",\n \"admin/editor.rich-text.font.title\": \"Font-Token\",\n \"admin/editor.rich-text.font.description\": \"Geben Sie den Font-Token an, der als Standard verwendet werden soll\",\n \"admin/editor.rich-text.textColor.title\": \"Textfarbe Token\",\n \"admin/editor.rich-text.textColor.description\": \"Geben Sie das Textfarbe Token an, das verwendet werden soll\",\n \"admin/editor.rich-text.blockClass.title\": \"Blockklasse\",\n \"admin/editor.rich-text.blockClass.description\": \"Eindeutiger Klassenname, der an Blockklassen angehängt werden soll\"\n}\n\n```"
}
] |
code_rich-text_e8522660
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/fr-FR.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Texte enrichi\",\n \"admin/editor.rich-text.text.title\": \"TextE\",\n \"admin/editor.rich-text.text.description\": \"Texte à afficher dans la langue de démarque\",\n \"admin/editor.rich-text.textPosition.title\": \"Position du texte\",\n \"admin/editor.rich-text.textPosition.description\": \"Choisir la position dans laquelle le texte composant sera affiché, à gauche, au centre ou à droite\",\n \"admin/editor.rich-text.textAlignment.title\": \"Alignement du texte\",\n \"admin/editor.rich-text.textAlignment.description\": \"Contrôler l’alignement du texte à l’intérieur du composant\",\n \"admin/editor.rich-text.textPosition.left\": \"Gauche\",\n \"admin/editor.rich-text.textPosition.center\": \"Centre\",\n \"admin/editor.rich-text.textPosition.right\": \"Droite\",\n \"admin/editor.rich-text.textAlignment.left\": \"Gauche\",\n \"admin/editor.rich-text.textAlignment.center\": \"Centre\",\n \"admin/editor.rich-text.textAlignment.right\": \"Droite\",\n \"admin/editor.rich-text.font.title\": \"Police d’écriture\",\n \"admin/editor.rich-text.font.description\": \"Préciser la police à utiliser par défaut\",\n \"admin/editor.rich-text.textColor.title\": \"Couleur du texte\",\n \"admin/editor.rich-text.textColor.description\": \"Préciser la couleur du texte à utiliser\",\n \"admin/editor.rich-text.blockClass.title\": \"Classe de bloc\",\n \"admin/editor.rich-text.blockClass.description\": \"Nom de classe unique à ajouter aux classes de bloc\"\n}\n\n```"
}
] |
code_rich-text_cb1316da
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/nl-NL.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Rich tekst\",\n \"admin/editor.rich-text.text.title\": \"Tekst\",\n \"admin/editor.rich-text.text.description\": \"Tekst in markdown-taal die moet worden weergegeven\",\n \"admin/editor.rich-text.textPosition.title\": \"Tekstpositie\",\n \"admin/editor.rich-text.textPosition.description\": \"Kies in welke positie de componenttekst wordt weergegeven, links, in het midden of rechts\",\n \"admin/editor.rich-text.textAlignment.title\": \"Tekstuitlijning\",\n \"admin/editor.rich-text.textAlignment.description\": \"Regel de tekstuitlijning binnen het onderdeel\",\n \"admin/editor.rich-text.textPosition.left\": \"Links\",\n \"admin/editor.rich-text.textPosition.center\": \"Midden\",\n \"admin/editor.rich-text.textPosition.right\": \"Rechts\",\n \"admin/editor.rich-text.textAlignment.left\": \"Links\",\n \"admin/editor.rich-text.textAlignment.center\": \"Midden\",\n \"admin/editor.rich-text.textAlignment.right\": \"Rechts\",\n \"admin/editor.rich-text.font.title\": \"Lettertype token\",\n \"admin/editor.rich-text.font.description\": \"Specificeer het lettertype-token dat als standaard moet worden gebruikt\",\n \"admin/editor.rich-text.textColor.title\": \"Tekstkleurtoken\",\n \"admin/editor.rich-text.textColor.description\": \"Geef het tekstkleurtoken op dat moet worden gebruikt\",\n \"admin/editor.rich-text.blockClass.title\": \"Klasse blokkeren\",\n \"admin/editor.rich-text.blockClass.description\": \"Unieke klassenaam die moet worden toegevoegd om klassen te blokkeren\"\n}\n\n```"
}
] |
code_rich-text_dc94e216
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/messages/es.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.rich-text.title\": \"Texto RTF\",\n \"admin/editor.rich-text.text.title\": \"Texto\",\n \"admin/editor.rich-text.text.description\": \"Texto en lenguaje de markdown que se mostrará\",\n \"admin/editor.rich-text.textPosition.title\": \"Posición del texto\",\n \"admin/editor.rich-text.textPosition.description\": \"Elija en que posición del componente se mostrará el texto: izquierda, centro o derecha\",\n \"admin/editor.rich-text.textAlignment.title\": \"Alineación del texto\",\n \"admin/editor.rich-text.textAlignment.description\": \"Controle la alineación del texto dentro del componente\",\n \"admin/editor.rich-text.textPosition.left\": \"Izquierda\",\n \"admin/editor.rich-text.textPosition.center\": \"Centro\",\n \"admin/editor.rich-text.textPosition.right\": \"Derecha\",\n \"admin/editor.rich-text.textAlignment.left\": \"Izquierda\",\n \"admin/editor.rich-text.textAlignment.center\": \"Centro\",\n \"admin/editor.rich-text.textAlignment.right\": \"Derecha\",\n \"admin/editor.rich-text.font.title\": \"Token de fuente\",\n \"admin/editor.rich-text.font.description\": \"Especifique el token de fuente que se utilizará como estándar\",\n \"admin/editor.rich-text.textColor.title\": \"Token de color del texto\",\n \"admin/editor.rich-text.textColor.description\": \"Especifique el token de color de texto que se utilizará\",\n \"admin/editor.rich-text.blockClass.title\": \"Clase del bloque\",\n \"admin/editor.rich-text.blockClass.description\": \"Nombre de clase único que se adjuntará a las clases de los bloques\"\n}\n\n```"
}
] |
code_rich-text_88993801
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/docs/README.md from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n> 📢 Don't fork this project. Use, [contribute](https://github.com/vtex-apps/awesome-io#contributing), or open issues through [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Rich Text\n\nThe Rich Text block converts text written in Markdown to HTML and displays it on your storefront.\n\n\n\nFor example, the following Markdown content\n\n```txt\n[Help](https://developers.vtex.com/vtex-developer-docs/docs/welcome).\\n**Be Bold!**\\n*This is italic*\n```\n\nwould be rendered as\n\n```html\n<div>\n <p>\n <a href=\"https://developers.vtex.com/\">Help</a><br />\n <span class=\"b\">Be Bold!</span><br />\n <span class=\"i\">This is italic</span>\n </p>\n</div>\n```\n\nLearn more in [Markdown documentation](https://www.markdownguide.org/cheat-sheet/).\n\n## Configuration\n\n1. Add the `rich-text` app to your theme’s dependencies in the `manifest.json` file:\n\n```json\n \"dependencies\": {\n \"vtex.rich-text\": \"0.x\"\n }\n```\n\n2. Add the `rich-text` block to your block files in the desired template position. Example:\n\n```json\n\"rich-text\": {\n \"props\": {\n \"textAlignment\": \"CENTER\",\n \"textPosition\": \"CENTER\",\n \"text\": \"Visit our [help](https://developers.vtex.com/) section.\\n**Be Bold!**\\n*This is italic*\",\n \"textColor\": \"c-on-emphasis\",\n \"font\": \"t-heading-5\",\n \"blockClass\": \"help-message\"\n }\n}\n```\n\n## Props\n\n| Prop name | Type | Description |\n| --------------- | ------------------- | ------------------------------------------------------------------------------------------------------------ |\n| `blockClass` | `string` | Unique class name appended to block classes. Default: '' |\n| `font` | `string` | Tachyon token used as font. Default: `t-body`. |\n| `htmlId` | `String` | HTML ID of the element. |\n| `textColor` | `string` | Tachyon token used as text color. Default: `c-on-base`. |\n| `text` | `string` | Text written in Markdown. |\n| `textAlignment` | `TextAlignmentEnum` | Text alignment inside the component. Default: `\"LEFT\"`. |\n| `textPosition` | `TextPostionEnum` | Text position relative to the component. Default: `\"LEFT\"`. |\n\n* **`TextAlignmentEnum` possible values**\n\n| Enum name | Enum value | Description |\n| --------- | ---------- | ------------------------------------- |\n| Left | 'LEFT' | Aligns text to the left. |\n| Center | 'CENTER' | Aligns text to the center. |\n| Right | 'RIGHT' | Aligns text to the right. |\n\n* **`TextPostionEnum` possible values**\n\n| Enum name | Enum value | Description |\n| --------- | ---------- | ------------------------------------- |\n| Left | 'LEFT' | Positions content at the left of the component. |\n| Center | 'CENTER' | Positions content at the horizontal center of the component. |\n| Right | 'RIGHT' | Positions content at the right of the component. |\n\n## Customization\n\nTo apply CSS customizations to this and other blocks, follow the guide [Using CSS handles for store customization](https://developers.vtex.com/docs/guides/vtex-io-documentation-using-css-handles-for-store-customization).\n\n| CSS Handle |\n| --------------- |\n| `container` |\n| `heading` |\n| `headingLevel1` |\n| `headingLevel2` |\n| `headingLevel3` |\n| `headingLevel4` |\n| `headingLevel5` |\n| `headingLevel6` |\n| `image` |\n| `italic` |\n| `link` |\n| `list` |\n| `listItem` |\n| `listOrdered` |\n| `paragraph` |\n| `strong` |\n| `table` |\n| `tableBody` |\n| `tableHead` |\n| `tableTd` |\n| `tableTh` |\n| `tableTr` |\n| `wrapper` |\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n<!-- DOCS-IGNORE:end -->\n\n```"
}
] |
code_rich-text_93602572
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/react/index.tsx from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { memo, useEffect, useState, useRef, useMemo } from 'react'\nimport { useIntl } from 'react-intl'\nimport marked, { Renderer } from 'marked'\nimport escapeHtml from 'escape-html'\nimport insane from '@vtex/insane'\nimport { useCssHandles } from 'vtex.css-handles'\nimport { useResponsiveValue } from 'vtex.responsive-values'\nimport { formatIOMessage } from 'vtex.native-types'\nimport type { CssHandlesTypes } from 'vtex.css-handles'\n\nimport {\n textPositionTypes,\n textAlignmentTypes,\n TextPositionValues,\n TextAlignmentValues,\n} from './typings/SchemaTypes'\nimport styles from './styles/index.css'\n\nconst CSS_HANDLES = [\n 'container',\n 'heading',\n 'headingLevel1',\n 'headingLevel2',\n 'headingLevel3',\n 'headingLevel4',\n 'headingLevel5',\n 'headingLevel6',\n 'image',\n 'italic',\n 'link',\n 'list',\n 'listItem',\n 'listOrdered',\n 'paragraph',\n 'strong',\n 'table',\n 'tableBody',\n 'tableHead',\n 'tableTd',\n 'tableTh',\n 'tableTr',\n 'wrapper',\n] as const\n\nconst JUSTIFY_TOKENS = {\n [TextPositionValues.LEFT]: 'justify-start',\n [TextPositionValues.CENTER]: 'justify-center',\n [TextPositionValues.RIGHT]: 'justify-end',\n} as const\n\nconst ALIGN_TOKENS = {\n [TextAlignmentValues.LEFT]: 'tl',\n [TextAlignmentValues.CENTER]: 'tc',\n [TextAlignmentValues.RIGHT]: 'tr',\n} as const\n\nconst ITEMS_TOKENS = {\n [TextAlignmentValues.LEFT]: 'items-start',\n [TextAlignmentValues.CENTER]: 'items-center',\n [TextAlignmentValues.RIGHT]: 'items-end',\n} as const\n\nconst TYPOGRAPHY = [\n 't-heading-1',\n 't-heading-2',\n 't-heading-3',\n 't-heading-4',\n 't-heading-5',\n 't-heading-6',\n 't-body',\n 't-small',\n 't-mini',\n 't-code',\n] as const\n\ntype PropTokensNames = 'textPosition' | 'textAlignment'\n\nconst DEFAULT_VALUES = {\n textPosition: textPositionTypes.TEXT_POSITION_LEFT.value,\n textAlignment: textAlignmentTypes.TEXT_ALIGNMENT_LEFT.value,\n}\n\nconst safelyGetToken = (\n tokenMap: Record<string, string>,\n valueWanted: string,\n propName: PropTokensNames\n) => tokenMap[valueWanted] || DEFAULT_VALUES[propName]\n\nconst sanitizerConfig = {\n allowedTags: [\n 'a',\n 'br',\n 'div',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'iframe',\n 'img',\n 'li',\n 'ol',\n 'p',\n 'span',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'th',\n 'thead',\n 'tr',\n 'ul',\n ],\n allowedAttributes: {\n '*': ['class', 'title'],\n a: ['href', 'target'],\n img: ['src', 'alt'],\n iframe: ['frameborder', 'height', 'src', 'width', 'style'],\n },\n allowedSchemes: ['http', 'https', 'mailto', 'tel'],\n}\n\nconst getLevel = (level: number) => (level > 0 && level <= 6 ? level : 6)\n\nconst getTargetFromUrl = (url: string) => {\n const urlSplit = url.split('?')\n\n if (urlSplit.length < 2) {\n return ''\n }\n\n const [, qs] = urlSplit\n const hastTargetBlank = qs.includes('target=_blank')\n\n return hastTargetBlank ? 'target=_blank' : ''\n}\n\nconst sanitizeFont = (font: string) => {\n if (!font) {\n return 't-body'\n }\n\n const [first] = font.split(' ')\n\n if (TYPOGRAPHY.indexOf(first as typeof TYPOGRAPHY[number]) === -1) {\n return 't-body'\n }\n\n return first\n}\n\nconst sanitizeColor = (color: string) => {\n if (!color) {\n return 'c-on-base'\n }\n\n const [first] = color.split(' ')\n\n if (first.indexOf('c-') === 0) {\n return first\n }\n\n return 'c-on-base'\n}\n\ntype RichTextCssHandles = CssHandlesTypes.CssHandles<typeof CSS_HANDLES>\n\nconst getHeadingLevelClass = (handles: RichTextCssHandles, level: number) => {\n if (level === 1) return handles.headingLevel1\n if (level === 2) return handles.headingLevel2\n if (level === 3) return handles.headingLevel3\n if (level === 4) return handles.headingLevel4\n if (level === 5) return handles.headingLevel5\n if (level === 6) return handles.headingLevel6\n\n return ''\n}\n\nconst renderHeading = (handles: RichTextCssHandles) => (\n text: string,\n level: number\n) => {\n const levelNumber = getLevel(level)\n const classes = `${\n handles.heading\n } t-heading-${levelNumber} ${getHeadingLevelClass(handles, levelNumber)} ${\n styles[`heading-level-${levelNumber}`]\n }`\n\n return `<h${levelNumber} class=\"${classes}\">${text}</h${levelNumber}>`\n}\n\ntype Props = {\n font?: string\n text?: string\n textAlignment?: TextAlignmentValues\n textColor?: string\n textPosition?: TextPositionValues\n htmlId?: string\n classes?: CssHandlesTypes.CustomClasses<typeof CSS_HANDLES>\n}\n\nfunction RichText({\n font = 't-body',\n text = '',\n textPosition = DEFAULT_VALUES.textPosition,\n textAlignment = DEFAULT_VALUES.textAlignment,\n textColor = 'c-on-base',\n htmlId,\n classes,\n}: Props) {\n const intl = useIntl()\n const { handles } = useCssHandles(CSS_HANDLES, {\n classes,\n })\n\n const [isMounted, setMounted] = useState(false)\n const renderer = useRef<Renderer>()\n const responsiveFont = useResponsiveValue(font)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n if (!isMounted) {\n renderer.current = new Renderer()\n renderer.current.paragraph = (content: string) =>\n `<p class=\"lh-copy ${handles.paragraph}\">${content}</p>`\n renderer.current.strong = (content: string) =>\n `<span class=\"b ${handles.strong}\">${content}</span>`\n renderer.current.em = (content: string) =>\n `<span class=\"i ${handles.italic}\">${content}</span>`\n renderer.current.heading = renderHeading(handles)\n renderer.current.link = (href: string, title: string, content: string) => {\n const targetAtr = getTargetFromUrl(href)\n const targetRemoved = targetAtr\n ? href.replace(/target=_blank/, '').replace(/\\?&/, '?')\n : href\n\n // clean trailing ? or &\n const cleanHref = targetRemoved.replace(/(\\?|&)$/, '')\n const titleAtr = title ? `title=\"${title}\"` : ''\n\n let finalLink = `<a class=\"${handles.link}\" href=\"${cleanHref}\"`\n\n if (titleAtr) {\n finalLink += ` ${titleAtr}`\n }\n\n if (targetAtr) {\n finalLink += ` ${targetAtr}`\n }\n\n finalLink += `>${content}</a>`\n\n return finalLink\n }\n\n renderer.current.html = (html) => escapeHtml(html)\n renderer.current.table = (header, body) => `\n <table class=\"${handles.table}\">\n <thead class=\"${handles.tableHead}\">\n ${header}\n </thead>\n <tbody class=\"${handles.tableBody}\">\n ${body}\n </tbody>\n </table>`\n renderer.current.tablerow = (content) => {\n return `<tr class=${handles.tableTr}>\\n${content}</tr>\\n`\n }\n\n renderer.current.tablecell = (content, flags) => {\n const type = flags.header ? 'th' : 'td'\n const tag = `<${type} class=\"${\n type === 'th' ? handles.tableTh : handles.tableTd\n }\"\n ${flags.align ? ` align=\"${flags.align}\"` : ''}>`\n\n return `${tag + content}</${type}>\\n`\n }\n\n renderer.current.image = (href: string, title: string, content: string) =>\n `<img class=\"${handles.image}\" src=\"${href}\" alt=\"${content}\" ${\n title ? `title=\"${title}\"` : ''\n } />`\n renderer.current.list = (body: string, ordered: boolean) => {\n const tag = ordered ? 'ol' : 'ul'\n\n return `<${tag} class=\"${handles.list} ${\n ordered ? handles.listOrdered : ''\n }\">${body}</${tag}>`\n }\n\n renderer.current.listitem = (content: string) =>\n `<li class=\"${handles.listItem}\">${content}</li>`\n }\n\n const alignToken = safelyGetToken(\n ALIGN_TOKENS,\n textAlignment,\n 'textAlignment'\n )\n\n const itemsToken = safelyGetToken(ITEMS_TOKENS, textPosition, 'textPosition')\n const justifyToken = safelyGetToken(\n JUSTIFY_TOKENS,\n textPosition,\n 'textPosition'\n )\n\n const html = useMemo(() => {\n marked.setOptions({\n gfm: true,\n breaks: true,\n sanitize: false, // Use insane lib for sanitizing\n smartLists: true,\n renderer: renderer.current,\n })\n\n return insane(\n // TODO: While markdown component isn't released, it needs to be done this way.\n marked(formatIOMessage({ id: text, intl })),\n sanitizerConfig\n )\n }, [text, intl])\n\n return (\n <div\n id={htmlId}\n className={`${\n handles.container\n } flex ${alignToken} ${itemsToken} ${justifyToken} ${sanitizeFont(\n responsiveFont\n )} ${sanitizeColor(textColor)}`}\n >\n <div\n className={handles.wrapper}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n </div>\n )\n}\n\nconst MemoizedRichText = memo(RichText)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n;(MemoizedRichText as any).schema = {\n title: 'admin/editor.rich-text.title',\n}\n\nexport default MemoizedRichText\n\n```"
}
] |
code_rich-text_829ef33c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/react/package.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.rich-text\",\n \"scripts\": {\n \"lint\": \"eslint . --ext .ts --ext .tsx\",\n \"lint:fix\": \"eslint --fix . --ext .ts --ext .tsx\",\n \"pretest\": \"yarn\",\n \"test\": \"vtex-test-tools test\"\n },\n \"dependencies\": {\n \"@vtex/insane\": \"^2.8.0\",\n \"escape-html\": \"^1.0.3\",\n \"marked\": \"^0.6.1\",\n \"react-intl\": \"^3.0.0\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^4.0.0\",\n \"@babel/core\": \"^7.3.4\",\n \"@babel/preset-env\": \"^7.3.4\",\n \"@types/escape-html\": \"^0.0.20\",\n \"@types/jest\": \"^24.0.9\",\n \"@types/marked\": \"^0.6.4\",\n \"@types/node\": \"^11.10.0\",\n \"@types/react\": \"^16.8.6\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"react-dom\": \"^16.8.4\",\n \"typescript\": \"3.9.7\",\n \"vtex.native-types\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.native-types@0.7.4/public/@types/vtex.native-types\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/public/@types/vtex.css-handles\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.126.4/public/@types/vtex.render-runtime\",\n \"vtex.responsive-values\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.responsive-values@0.4.0/public/@types/vtex.responsive-values\"\n },\n \"version\": \"0.16.1\"\n}\n\n```"
}
] |
code_rich-text_00ce6bfc
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/store/interfaces.json from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"rich-text\": {\n \"component\": \"index\",\n \"content\": {\n \"title\": \"admin/editor.rich-text.title\",\n \"properties\": {\n \"text\": {\n \"title\": \"admin/editor.rich-text.text.title\",\n \"$ref\": \"app:vtex.native-types#/definitions/richText\",\n \"default\": \"\"\n }\n }\n }\n }\n}\n\n```"
}
] |
code_rich-text_bb3ce828
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/react/__test__/index.test.tsx from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\n\nimport RichText from '../index'\nimport { TextPositionValues, TextAlignmentValues } from '../typings/SchemaTypes'\n\ndescribe('Rich text component', () => {\n const defaultProps = {\n font: 't-body',\n text: '',\n textPosition: TextPositionValues.LEFT,\n textAlignment: TextAlignmentValues.LEFT,\n textColor: 'c-on-base',\n }\n\n it('should render with bold', () => {\n const component = render(<RichText {...defaultProps} text=\"**be bold**\" />)\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render with paragraph', () => {\n const component = render(<RichText {...defaultProps} text=\"IAM BOLD\" />)\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render link with title', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={\n '[I\\'m an inline-style link with title](https://www.google.com \"Google\\'s Homepage\")\\n**Bollllddd**\\n*this is talic*'\n }\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render and sanitize malicious text', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={\n \"Hi everyone! This is **how** you do XSS <script>alert('XSS')</script>\"\n }\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render and sanitize malicious text in an attribute', () => {\n const component = render(\n <RichText {...defaultProps} text=\"[some text](javascript:exec())\" />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render and sanitize malicious javascript', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={'<a href=\"javascript:exec()\">HEHEHE</a>'}\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render and sanitize malicious javascript in css value', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={\n '<DIV STYLE=\"background-image: url(javascript:alert(\\'XSS\\'))\">'\n }\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render with image', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={`Inline-style: \n `}\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render with image no title', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={`Inline-style: \n `}\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render an iframe', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={\n // It must be preceeded by Markdown tag or any other string, otherwise the lib marked escapes the iframe HTML tag.\n '__<iframe frameborder=\"0\" height=\"100%\" src=\"https://invictastores.typeform.com/to/KmycOT?typeform-embed=embed-widget&embed-hide-footer=true&embed-hide-headers=true&embed-opacity=50&typeform-embed-id=d0pe3\" width=\"100%\" style=\"border: 0px;\"></iframe>__'\n }\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render a link with target', () => {\n const { asFragment } = render(\n <RichText\n {...defaultProps}\n text=\"<a href='https://google.com' target='_blank'>bc</a>\"\n />\n )\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should render a link with target as query string on markdown and erase ?', () => {\n const { asFragment } = render(\n <RichText\n {...defaultProps}\n text=\"[text](https://www.google.com?target=_blank) \"\n />\n )\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should render a link with target as query string on markdown and keep others params', () => {\n const { asFragment } = render(\n <RichText\n {...defaultProps}\n text=\"[text](https://www.google.com?target=_blank&foo=tree\\&bar=lala)\"\n />\n )\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should render a link with target as query string on markdown and keep others params, remove trailing &', () => {\n const { asFragment } = render(\n <RichText\n {...defaultProps}\n text=\"[text](https://www.google.com?foo=tree\\&bar=lala&target=_blank)\"\n />\n )\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should render a table', () => {\n const { asFragment } = render(\n <RichText\n {...defaultProps}\n text={`\nfoo|bar\n---|---\nteste|abc\n `}\n />\n )\n\n expect(asFragment()).toMatchSnapshot()\n })\n\n it('should render with two different heading levels', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={`# Heading 1 # \\n ### Heading level 3 ##`}\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render list', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={`Teste \\n * Item 1\\n * Item 2\\n * Item 3`}\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should render ordered list', () => {\n const component = render(\n <RichText\n {...defaultProps}\n text={`Teste \\n 1. Item 1\\n 2. Item 2\\n 3. Item 3`}\n />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should sanitize the font prop', () => {\n const typography = 't-heading-1'\n const { container } = render(\n <RichText {...defaultProps} text=\"foo\" font={`${typography} foo`} />\n )\n\n const element = container.querySelector(`.${typography}`)\n const notFound = container.querySelector('.foo')\n\n expect(element).toBeTruthy()\n expect(notFound).toBeFalsy()\n })\n\n it('should sanitize the textColor prop', () => {\n const color = 'c-muted-1'\n const { container } = render(\n <RichText {...defaultProps} text=\"foo\" textColor={`${color} foo`} />\n )\n\n const element = container.querySelector(`.${color}`)\n const notFound = container.querySelector('.foo')\n\n expect(element).toBeTruthy()\n expect(notFound).toBeFalsy()\n })\n\n it('should allow tel scheme on link', () => {\n const component = render(\n <RichText {...defaultProps} text=\"[Telefone](tel:+18882165252)\" />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should allow mailto scheme on link', () => {\n const component = render(\n <RichText {...defaultProps} text=\"[Mail me](mailto:test@vtex.com.br)\" />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n\n it('should allow sup tag', () => {\n const component = render(\n <RichText {...defaultProps} text=\"Test <sup>(r)</sup>\" />\n )\n\n expect(component).toBeDefined()\n expect(component.asFragment()).toMatchSnapshot()\n })\n})\n\n```"
}
] |
code_rich-text_098057f6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/react/typings/SchemaTypes.ts from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport const enum TextPositionValues {\n CENTER = 'CENTER',\n LEFT = 'LEFT',\n RIGHT = 'RIGHT',\n}\n\nexport const enum TextAlignmentValues {\n CENTER = 'CENTER',\n LEFT = 'LEFT',\n RIGHT = 'RIGHT',\n}\n\nexport const textPositionTypes: Record<\n string,\n { name: string; value: TextPositionValues }\n> = {\n TEXT_POSITION_CENTER: {\n name: 'admin/editor.rich-text.textPosition.center',\n value: TextPositionValues.CENTER,\n },\n TEXT_POSITION_LEFT: {\n name: 'admin/editor.rich-text.textPosition.left',\n value: TextPositionValues.LEFT,\n },\n TEXT_POSITION_RIGHT: {\n name: 'admin/editor.rich-text.textPosition.right',\n value: TextPositionValues.RIGHT,\n },\n}\n\nexport const textAlignmentTypes: Record<\n string,\n { name: string; value: TextAlignmentValues }\n> = {\n TEXT_ALIGNMENT_CENTER: {\n name: 'admin/editor.rich-text.textAlignment.center',\n value: TextAlignmentValues.CENTER,\n },\n TEXT_ALIGNMENT_LEFT: {\n name: 'admin/editor.rich-text.textAlignment.left',\n value: TextAlignmentValues.LEFT,\n },\n TEXT_ALIGNMENT_RIGHT: {\n name: 'admin/editor.rich-text.textAlignment.right',\n value: TextAlignmentValues.RIGHT,\n },\n}\n\n```"
}
] |
code_rich-text_8a5b689a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/react/typings/insane.d.ts from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n// Insane is based on the sanitize-html package.\n// So its types are extremely close to it.\n\ndeclare function insane(dirty: string, options?: insane.IOptions): string\n\ndeclare namespace insane {\n interface IOptions {\n allowedTags?: string[] | boolean\n allowedAttributes?: { [index: string]: string[] } | boolean\n allowedStyles?: { [index: string]: { [index: string]: RegExp[] } }\n allowedClasses?: { [index: string]: string[] } | boolean\n }\n}\n\ndeclare module '@vtex/insane' {\n export = insane\n}\n\n```"
}
] |
code_rich-text_e14901d3
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of rich-text/react/styles/index.css from the rich-text VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.heading-level-1 {\n}\n.heading-level-2 {\n}\n.heading-level-3 {\n}\n.heading-level-4 {\n}\n.heading-level-5 {\n}\n.heading-level-6 {\n}\n\n```"
}
] |
code_storetheme-black-beauty_62f5f347
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/sitemap/sitemap.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"urlset\": {\n \"url\": [\n {\n \"loc\": \"https://storetheme.vtex.com/about-us\"\n }\n ]\n }\n}\n```"
}
] |
code_storetheme-black-beauty_c3031fde
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/docs/README.md from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Black Beauty Theme\nA store theme made for the 2019 VTEX Hackatheme\n\nParticipants:\n- Beatriz Silva\n- Gabriel Vincent\n- Lucas Suzano\n- Lucas Bacic\n- Pedro Alexandria\n\n## Preview\n\n\n## Tutorial\nTo understand how things work check our tutorial [Build a store using VTEX IO](https://help.vtex.com/en/tracks/build-a-store-using-vtex-io)\n\n## Dependencies\nAll store components that you see on this document are open source too. Production ready, you can found those apps in this GitHub organization. \n \nStore framework is the baseline to create any store using _VTEX IO Web Framework_.\n- [Store](https://github.com/vtex-apps/store/blob/master/README.md)\n\nStore GraphQL is a middleware to access all VTEX APIs.\n- [Store GraphQL](https://github.com/vtex-apps/store-graphql/blob/master/README.md)\n\n### Store Component Apps \n- [Header](https://github.com/vtex-apps/store-header/blob/master/README.md)\n- [Footer](https://github.com/vtex-apps/store-footer/blob/master/README.md)\n- [Carousel](https://github.com/vtex-apps/carousel/blob/master/README.md)\n- [Shelf](https://github.com/vtex-apps/shelf/blob/master/README.md)\n- [Telemarketing](https://github.com/vtex-apps/telemarketing/blob/master/README.md)\n- [Menu](https://github.com/vtex-apps/menu/blob/master/README.md)\n- [Login](https://github.com/vtex-apps/login/blob/master/README.md)\n- [Minicart](https://github.com/vtex-apps/minicart/blob/master/README.md)\n- [Category Menu](https://github.com/vtex-apps/category-menu/blob/master/README.md)\n- [Product Summary](https://github.com/vtex-apps/product-summary/blob/master/README.md)\n- [Breadcrumb](https://github.com/vtex-apps/breadcrumb/blob/master/README.md)\n- [Search Result](https://github.com/vtex-apps/search-result/blob/master/README.md)\n- [Product Details](https://github.com/vtex-apps/product-details/blob/master/README.md)\n- [Storecomponents](https://github.com/vtex-apps/store-components/blob/master/README.md)\n- [Product Kit](https://github.com/vtex-apps/product-kit/blob/master/README.md) :construction: under construction\n- [WishList](https://github.com/vtex-apps/wishlist/blob/master/README.md) :construction: under construction\n- [Order Placed](https://github.com/vtex-apps/order-placed/blob/master/README.md) :construction: under construction\n\n### Store Pixel Apps\n \n - [Facebook Pixel](https://github.com/vtex-apps/facebook-pixel/blob/master/README.md)\n - [Google Analytics](https://github.com/vtex-apps/google-analytics/blob/master/README.md)\n - [Google Tag Manager](https://github.com/vtex-apps/google-tag-manager/blob/master/README.md)\n\n## Contributing\n\nCheck it out [how to contribute](https://github.com/vtex-apps/awesome-io#contributing) with this project. \n\n```"
}
] |
code_storetheme-black-beauty_edb6bb20
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n/* Blocks can be defined both on the store/blocks.json file, and in any number of json\n * files inside the store/blocks directory, with any arbitrary directory structure.\n *\n * Additionally, all blocks files can support comments, such as this one, if given the\n * .jsonc file extension.\n *\n * The store/blocks.json file is intended for backwards compatibility, for miscellaneous\n * blocks, or if the app is simple enough that it doesn't warrant splitting the file.\n */\n{\n \"store.orderplaced\": {\n \"blocks\": [\"order-placed\"]\n },\n\n \"store.account\": {\n \"blocks\": [\"my-account\"],\n \"parent\": {\n \"challenge\": \"challenge.profile\"\n }\n },\n\n \"store.login\": {\n \"blocks\": [\"login-content#default\"]\n },\n\n \"login-content#default\": {\n \"props\": {\n \"isInitialScreenOptionOnly\": false,\n \"defaultOption\": 1,\n \"showPasswordVerificationIntoTooltip\": true\n }\n },\n\n \"product-summary.shelf\": {\n \"children\": [\n \"product-summary-add-to-list-button\",\n \"stack-layout#prodsum\",\n \"product-summary-name\",\n \"product-rating-inline\",\n \"product-summary-price\",\n \"product-summary-buy-button\"\n ]\n },\n\n \"product-summary-buy-button\": {\n \"props\": {\n \"buyButtonText\": \"ADD TO CART\"\n }\n },\n\n \"stack-layout#prodsum\": {\n \"children\": [\"product-summary-image\", \"product-summary-specification-badges\"]\n },\n\n \"product-summary-specification-badges\": {\n \"props\": {\n \"specificationGroupName\": \"Group\",\n \"specificationName\": \"On Sale\",\n \"visibleWhen\": \"True\",\n \"displayValue\": \"SPECIFICATION_NAME\"\n }\n },\n\n \"store.product-review-form\": {\n \"blocks\": [\"product-review-form\"]\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_3be3714a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/routes.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.custom#about-us\": {\n \"path\": \"/about-us\"\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_465fa662
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/styles/css/vtex.rich-text.css from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.container {\n padding-right: 36px;\n}\n\n.container > div {\n width: 250px;\n}\n\n.link {\n color: #878695;\n text-decoration: none;\n font-size: 18px;\n line-height: 36px;\n}\n\n.link a:link {\n color: #878695;\n text-decoration: none;\n font-size: 18px;\n line-height: 36px;\n}\n\n.link a:hover {\n color: #222639;\n text-decoration: none;\n font-size: 18px;\n line-height: 36px;\n}\n\n.container--deals {\n color: #ffffff;\n text-align: center;\n justify-content: center;\n}\n\n.container--deals .paragraph {\n margin: 0;\n}\n\n.container--link {\n justify-content: center;\n}\n\n.container--question {\n justify-content: center;\n}\n\n.container--question .paragraph {\n text-align: center;\n max-width: 540px;\n margin: 0 16px;\n padding-top: 120px;\n color: #03034e;\n}\n\n.container--question .strong {\n font-size: 32px;\n line-height: 2rem;\n font-weight: 700;\n}\n\n.container--link .paragraph {\n text-align: center;\n max-width: 540px;\n padding-top: 36px;\n padding-bottom: 84px;\n color: #03034e;\n}\n\n.container--link .strong {\n font-size: 16px;\n font-weight: 700;\n text-transform: uppercase;\n}\n\n.container--link .link {\n text-decoration: none;\n font-size: 36px;\n font-weight: 300;\n color: #03034e;\n}\n\n.container--title {\n color: #03034e;\n font-size: 28px;\n font-weight: 700;\n}\n\n@media only screen and (min-width: 640px) {\n .container--question .strong {\n font-size: 40px;\n line-height: 3rem;\n }\n\n .container--about {\n max-width: 85%;\n }\n\n .container--title {\n color: #03034e;\n font-size: 40px;\n font-weight: 700;\n max-width: 60%;\n }\n\n .container--title .paragraph {\n line-height: 1.3em;\n }\n}\n\n.heading {\n font-family: \"Playfair Display\";\n font-size: 36px;\n}\n\n```"
}
] |
code_storetheme-black-beauty_5fe373c2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/styles/css/vtex.product-summary.css from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.container {\n background-color: white;\n padding-left: 32px;\n padding-right: 32px;\n padding-top: 32px;\n padding-bottom: 32px;\n}\n\n.nameContainer {\n padding-top: 32px;\n padding-bottom: 0px;\n}\n.productBrand {\n font-size: 14px;\n}\n.productNameContainer {\n color: #878695;\n}\n.priceContainer {\n padding-top: 8px;\n padding-bottom: 32px;\n}\n.buyButton > button {\n font-size: 12px;\n letter-spacing: 15%;\n border-style: solid;\n border-width: 0px 0px 1px 0px;\n border-color: #272639;\n border-radius: 0px;\n width: inherit;\n}\n.buyButton > button:hover {\n border-width: 0px 0px 4px 0px;\n border-style: solid;\n border-color: #878695;\n color: #878695;\n background-color: #fff;\n}\n.buyButton > button div {\n padding-left: 0;\n padding-right: 0;\n}\n\n```"
}
] |
code_storetheme-black-beauty_67f02700
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/styles/css/vtex.store-header.css from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n/* .headerRow--menu-link :global(.vtex-menu-2-x-styledLink) {\n color: #ffffff;\n font-size: 14px;\n}\n\n\n\n.headerRow--main-header-mobile .headerRowBackground {\n padding: 10px 0px;\n background-color: #f0f0f0;\n}\n*/\n\n.headerRow--main-header :global(.vtex-menu-2-x-styledLink) {\n color: #555373;\n font-size: 14px;\n height: 138px;\n}\n\n.headerRow--main-header .headerRowBackground {\n background-color: #eccab7;\n}\n\n```"
}
] |
code_storetheme-black-beauty_d522ad66
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/styles/css/vtex.store-components.css from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.infoCardContainer--info-card-home {\n background-color: #e3c5bd;\n}\n\n.notificationBarContainer {\n background-color: #e6f1e6;\n color: #03034e;\n font-weight: 700;\n font-size: 12px;\n text-decoration: underline;\n}\n\n.searchBarContainer {\n max-width: 265px;\n}\n\n.infoCardContainer--main1 {\n height: 760px;\n width: 578px;\n margin-top: 64px;\n margin-bottom: 64px;\n}\n\n.infoCardContainer--main2 {\n height: 760px;\n width: 578px;\n margin-top: 64px;\n margin-bottom: 64px;\n}\n\n.infoCardContainer--info-card-home {\n height: 599px;\n}\n\n.infoCardContainer--info-card-home button {\n border: 0px white;\n}\n\n/* New Makeup Collection Info Cards */\n\n.infoCardContainer--new-makeup-collection {\n height: 680px;\n background-color: #eccab7;\n}\n\n.infoCardTextContainer--new-makeup-collection {\n height: 680px;\n}\n\n.infoCardCallActionContainer--new-makeup-collection {\n position: relative;\n top: 550px;\n}\n\n.infoCardCallActionContainer--new-makeup-collection > button {\n background-color: #272639;\n border-radius: 0px;\n height: 60px;\n width: 185px;\n color: white;\n font-size: 14px;\n letter-spacing: 1.5px;\n}\n\n/* .newsletter {\n background-color: #03054e;\n max-width: 1528px;\n margin: 0 auto;\n}\n\n.newsletter .container {\n padding: 60px 10px;\n}\n\n.label {\n color: #fff;\n font-size: 26px;\n}\n\n.inputGroup {\n padding-bottom: 4px;\n border-bottom: 2px solid #fff;\n display: flex;\n color: #fff;\n}\n\n.inputGroup input {\n background-color: transparent;\n color: #fff;\n border: none;\n padding-left: 0px;\n}\n\n.inputGroup input::placeholder {\n color: #fff;\n font-size: 16px;\n}\n\n.inputGroup button {\n background-color: transparent;\n color: #fff;\n border: none;\n margin-right: -24px;\n}\n\n.buttonContainer {\n padding-top: 0px;\n} */\n\n.imageElement--storePrint {\n max-height: 300px;\n margin-bottom: 20px;\n}\n\n@media only screen and (min-width: 640px) {\n .infoCardContainer--main1 {\n margin-right: 10px;\n }\n\n .infoCardContainer--main2 {\n margin-left: 10px;\n }\n\n .newsletter .container {\n padding: 140px;\n }\n\n .label {\n font-size: 40px;\n }\n\n .infoCardContainer--info-card-home .infoCardTextContainer {\n width: 30%;\n padding-left: 64px;\n }\n\n .infoCardContainer--info-card-home .infoCardImageContainer {\n width: 70%;\n }\n\n .imageElement--storePrint {\n margin-bottom: 0px;\n max-height: 600px;\n }\n}\n\n.newsletter {\n background-color: white;\n width: 334px;\n height: 329px;\n}\n\n.newsletter .container {\n padding: 32px;\n}\n\n.newsletter .label {\n color: #272639;\n font-family: \"Playfair Display\";\n}\n\n.newsletter .form {\n width: 100%;\n text-align: left;\n}\n\n.newsletter .buttonContainer .button {\n background-color: #272639;\n}\n\n.newsletter .inputGroup input::placeholder {\n color: #272639;\n font-size: 12px;\n}\n\n.infoCardContainer--main1-mobile {\n width: 100%;\n height: 720px;\n}\n\n.infoCardContainer--main2-mobile {\n width: 100%;\n height: 720px;\n}\n\n.infoCardContainer--info-card-home-mobile {\n max-width: 720px;\n}\n\n.autoCompleteOuterContainer > div > label > div {\n border-bottom: solid 1px #555373;\n color: #555373;\n border-left: 0;\n border-top: 0;\n border-right: 0;\n background: transparent;\n border-radius: 0px;\n}\n.autoCompleteOuterContainer > div > label > div > input {\n background: transparent;\n}\n.autoCompleteOuterContainer > div > label > div > span {\n background: transparent;\n}\n\n.infoCardHeadline {\n font-size: 80px;\n line-height: 72px;\n color: #272639;\n font-family: \"Playfair Display\";\n}\n\n```"
}
] |
code_storetheme-black-beauty_b1729e76
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/styles/css/vtex.store__template.css from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n@import url(\"https://fonts.googleapis.com/css?family=DM+Sans%7CPlayfair+Display&display=swap\");\n\n```"
}
] |
code_storetheme-black-beauty_6c85777d
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/styles/css/vtex.store-footer.css from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.footerLayout {\n padding: 100px;\n background-color: white;\n}\n\n.row--menu-row {\n padding-right: 24px;\n}\n\n.row--menu-row .rowContainer {\n align-items: flex-start;\n}\n\n.row--payment-methods {\n padding-top: 16px;\n}\n\n```"
}
] |
code_storetheme-black-beauty_cdfd7254
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/styles/css/vtex.flex-layout.css from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```css\n.flexRow--deals {\n background-color: #a7afbd;\n padding: 14px 0px;\n}\n\n.flexRow--deals .stretchChildrenWidth {\n align-items: center;\n}\n\n.flexRow--deals .flexCol {\n align-items: center;\n}\n\n.flexCol--filterCol {\n max-width: 500px;\n min-width: 230px;\n}\n\n.flexCol--productCountCol {\n align-items: flex-start;\n}\n\n.flexCol--orderByCol {\n align-items: flex-end;\n}\n\n.flexCol--orderByMobileCol {\n width: 42%;\n}\n\n.flexCol--filterMobileCol {\n width: 38%;\n}\n\n.flexCol--switcherMobileCol {\n width: 20%;\n}\n\n.flexRow--new-makeup-collection {\n background-color: #eccab7;\n}\n\n.flexRow--info-card-home {\n background-color: #e3c5bd;\n}\n\n```"
}
] |
code_storetheme-black-beauty_de8557f2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/styles/configs/style.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"typeScale\": [\n 3,\n 2.25,\n 1.5,\n 1.25,\n 1,\n 0.875,\n 0.75\n ],\n \"spacing\": [\n 0.125,\n 0.25,\n 0.5,\n 0.75,\n 1,\n 1.5,\n 2,\n 3,\n 4,\n 8,\n 16\n ],\n \"customMedia\": [\n {\n \"s\": 20\n },\n {\n \"ns\": {\n \"value\": 40,\n \"minWidth\": true\n }\n },\n {\n \"m\": {\n \"value\": 40,\n \"minWidth\": true\n }\n },\n {\n \"l\": {\n \"value\": 64,\n \"minWidth\": true\n }\n },\n {\n \"xl\": {\n \"value\": 80,\n \"minWidth\": true\n }\n }\n ],\n \"colors\": {\n \"black-90\": \"rgba(0,0,0,.9)\",\n \"black-80\": \"rgba(0,0,0,.8)\",\n \"black-70\": \"rgba(0,0,0,.7)\",\n \"black-60\": \"rgba(0,0,0,.6)\",\n \"black-50\": \"rgba(0,0,0,.5)\",\n \"black-40\": \"rgba(0,0,0,.4)\",\n \"black-30\": \"rgba(0,0,0,.3)\",\n \"black-20\": \"rgba(0,0,0,.2)\",\n \"black-10\": \"rgba(0,0,0,.1)\",\n \"black-05\": \"rgba(0,0,0,.05)\",\n \"black-025\": \"rgba(0,0,0,.025)\",\n \"black-0125\": \"rgba(0,0,0,.0125)\",\n \"white-90\": \"rgba(255,255,255,.9)\",\n \"white-80\": \"rgba(255,255,255,.8)\",\n \"white-70\": \"rgba(255,255,255,.7)\",\n \"white-60\": \"rgba(255,255,255,.6)\",\n \"white-50\": \"rgba(255,255,255,.5)\",\n \"white-40\": \"rgba(255,255,255,.4)\",\n \"white-30\": \"rgba(255,255,255,.3)\",\n \"white-20\": \"rgba(255,255,255,.2)\",\n \"white-10\": \"rgba(255,255,255,.1)\",\n \"white-05\": \"rgba(255,255,255,.05)\",\n \"white-025\": \"rgba(255,255,255,.025)\",\n \"white-0125\": \"rgba(255,255,255,.0125)\"\n },\n \"semanticColors\": {\n \"background\": {\n \"base\": \"#FAF7F1\",\n \"base--inverted\": \"#03044e\",\n \"action-primary\": \"white\",\n \"action-secondary\": \"#eef3f7\",\n \"emphasis\": \"#f71963\",\n \"disabled\": \"#f2f4f5\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"hover-background\": {\n \"action-primary\": \"#878695\",\n \"action-secondary\": \"#dbe9fd\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#e13232\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"active-background\": {\n \"action-primary\": \"#0c389f\",\n \"action-secondary\": \"#dbe9fd\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"text\": {\n \"action-primary\": \"#0F3E99\",\n \"action-secondary\": \"#eef3f7\",\n \"link\": \"#0F3E99\",\n \"emphasis\": \"#f71963\",\n \"disabled\": \"#979899\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"visited-text\": {\n \"link\": \"#0c389f\"\n },\n \"hover-text\": {\n \"action-primary\": \"#072c75\",\n \"action-secondary\": \"#dbe9fd\",\n \"link\": \"#0c389f\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#e13232\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\"\n },\n \"active-text\": {\n \"link\": \"#0c389f\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\"\n },\n \"border\": {\n \"action-primary\": \"#272639\",\n \"action-secondary\": \"#eef3f7\",\n \"emphasis\": \"#f71963\",\n \"disabled\": \"#e3e4e6\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"hover-border\": {\n \"action-primary\": \"#878695\",\n \"action-secondary\": \"#dbe9fd\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#e13232\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"active-border\": {\n \"action-primary\": \"#0c389f\",\n \"action-secondary\": \"#dbe9fd\",\n \"emphasis\": \"#dd1659\",\n \"success\": \"#8bc34a\",\n \"success--faded\": \"#eafce3\",\n \"danger\": \"#ff4c4c\",\n \"danger--faded\": \"#ffe6e6\",\n \"warning\": \"#ffb100\",\n \"warning--faded\": \"#fff6e0\",\n \"muted-1\": \"#727273\",\n \"muted-2\": \"#979899\",\n \"muted-3\": \"#cacbcc\",\n \"muted-4\": \"#e3e4e6\",\n \"muted-5\": \"#f2f4f5\"\n },\n \"on\": {\n \"base\": \"#3f3f40\",\n \"base--inverted\": \"#ffffff\",\n \"action-primary\": \"#272639\",\n \"action-secondary\": \"#0F3E99\",\n \"emphasis\": \"#ffffff\",\n \"disabled\": \"#979899\",\n \"success\": \"#ffffff\",\n \"success--faded\": \"#3f3f40\",\n \"danger\": \"#ffffff\",\n \"danger--faded\": \"#3f3f40\",\n \"warning\": \"#ffffff\",\n \"warning--faded\": \"#1a1a1a\",\n \"muted-1\": \"#ffffff\",\n \"muted-2\": \"#ffffff\",\n \"muted-3\": \"#3f3f40\",\n \"muted-4\": \"#3f3f40\",\n \"muted-5\": \"#3f3f40\"\n },\n \"hover-on\": {\n \"action-primary\": \"#ffffff\",\n \"action-secondary\": \"#0F3E99\",\n \"emphasis\": \"#ffffff\",\n \"success\": \"#ffffff\",\n \"success--faded\": \"#3f3f40\",\n \"danger\": \"#ffffff\",\n \"danger--faded\": \"#3f3f40\",\n \"warning\": \"#ffffff\",\n \"warning--faded\": \"#1a1a1a\"\n },\n \"active-on\": {\n \"action-primary\": \"#ffffff\",\n \"action-secondary\": \"#0F3E99\",\n \"emphasis\": \"#ffffff\",\n \"success\": \"#ffffff\",\n \"success--faded\": \"#3f3f40\",\n \"danger\": \"#ffffff\",\n \"danger--faded\": \"#3f3f40\",\n \"warning\": \"#ffffff\",\n \"warning--faded\": \"#1a1a1a\"\n }\n },\n \"borderWidths\": [\n 0,\n 0.125,\n 0.25,\n 0.5,\n 1,\n 2\n ],\n \"borderRadius\": [\n 0,\n 0.125,\n 0.25,\n 0.5,\n 1\n ],\n \"widths\": [\n 1,\n 2,\n 4,\n 8,\n 16\n ],\n \"maxWidths\": [\n 1,\n 2,\n 4,\n 8,\n 16,\n 32,\n 48,\n 64,\n 96\n ],\n \"heights\": [\n 1,\n 2,\n 4,\n 8,\n 16\n ],\n \"sizes\": [\n {\n \"name\": \"small\",\n \"value\": 2\n },\n {\n \"name\": \"regular\",\n \"value\": 2.5\n },\n {\n \"name\": \"large\",\n \"value\": 3\n }\n ],\n \"typography\": {\n \"measure\": [\n 30,\n 34,\n 20\n ],\n \"styles\": {\n \"heading-1\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"700\",\n \"fontSize\": \"3rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-2\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"700\",\n \"fontSize\": \"2.25rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-3\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"700\",\n \"fontSize\": \"1.75rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-4\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1.5rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-5\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1.25rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"heading-6\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1.25rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"body\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"small\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"0.875rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"mini\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"0.75rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n },\n \"action\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"500\",\n \"fontSize\": \"1rem\",\n \"textTransform\": \"uppercase\",\n \"letterSpacing\": \"0\"\n },\n \"action--small\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"500\",\n \"fontSize\": \"0.875rem\",\n \"textTransform\": \"uppercase\",\n \"letterSpacing\": \"0\"\n },\n \"action--large\": {\n \"fontFamily\": \"DM Sans, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif\",\n \"fontWeight\": \"500\",\n \"fontSize\": \"1.25rem\",\n \"textTransform\": \"uppercase\",\n \"letterSpacing\": \"0\"\n },\n \"code\": {\n \"fontFamily\": \"Consolas, monaco, monospace\",\n \"fontWeight\": \"normal\",\n \"fontSize\": \"1rem\",\n \"textTransform\": \"initial\",\n \"letterSpacing\": \"0\"\n }\n }\n },\n \"opacity\": [\n 1,\n 0.9,\n 0.8,\n 0.7,\n 0.6,\n 0.5,\n 0.4,\n 0.3,\n 0.2,\n 0.1,\n 0.05,\n 0.025,\n 0\n ]\n}\n```"
}
] |
code_storetheme-black-beauty_70f4be87
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/product-assembly.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"sticky-layout#buy-button\": {\n \"props\": {\n \"position\": \"bottom\"\n },\n \"children\": [\"flex-layout.row#buy-button\"]\n },\n \"product-assembly-options\": {\n \"children\": [\n \"flex-layout.row#product-assembly-options\",\n \"assembly-option-input-values\"\n ]\n },\n \"assembly-option-input-values\": {\n \"props\": {\n \"optionsDisplay\": \"box\"\n }\n },\n \"flex-layout.row#product-assembly-options\": {\n \"props\": {\n \"colGap\": 2,\n \"preserveLayoutOnMobile\": true,\n \"colSizing\": \"auto\"\n },\n \"children\": [\n \"flex-layout.col#product-assembly-image\",\n \"flex-layout.col#product-assembly-middle\",\n \"flex-layout.col#product-assembly-quantity\"\n ]\n },\n \"flex-layout.col#product-assembly-quantity\": {\n \"props\": {\n \"verticalAlign\": \"middle\"\n },\n \"children\": [\n \"assembly-option-item-quantity-selector\"\n ]\n },\n \"flex-layout.col#product-assembly-image\": {\n \"props\": {\n \"marginRight\": 4\n },\n \"children\": [\n \"assembly-option-item-image\"\n ]\n },\n \"flex-layout.col#product-assembly-middle\": {\n \"props\": {\n \"width\": \"grow\",\n \"verticalAlignment\": \"middle\"\n },\n \"children\": [\n \"assembly-option-item-name\",\n \"assembly-option-item-price\",\n \"assembly-option-item-children-description\",\n \"assembly-option-item-customize#first-level\"\n ]\n },\n \"assembly-option-item-customize#first-level\": {\n \"props\": {\n \"buttonProps\": {\n \"collapse\": \"left\"\n }\n },\n \"children\": [\n \"flex-layout.row#item-customize\"\n ]\n },\n \"flex-layout.row#item-customize\": {\n \"props\": {\n \"colGap\": 2,\n \"preserveLayoutOnMobile\": true,\n \"colSizing\": \"auto\"\n },\n \"children\": [\n \"flex-layout.col#product-assembly-image\",\n \"flex-layout.col#item-customize-middle\",\n \"flex-layout.col#item-customize-quantity\"\n ]\n },\n \"flex-layout.col#item-customize-middle\": {\n \"props\": {\n \"width\": \"grow\",\n \"verticalAlignment\": \"middle\"\n },\n \"children\": [\n \"assembly-option-item-name\",\n \"assembly-option-item-price\",\n \"assembly-option-item-children-description\",\n \"assembly-option-item-customize#sec-level\"\n ]\n },\n \"flex-layout.col#item-customize-quantity\": {\n \"props\": {\n \"horizontalAlign\": \"right\",\n \"verticalAlign\": \"middle\"\n },\n \"children\": [\n \"assembly-option-item-quantity-selector\"\n ]\n },\n \"assembly-option-item-customize#sec-level\": {\n \"props\": {\n \"buttonProps\": {\n \"collapse\": \"left\"\n }\n },\n \"children\": [\n \"assembly-option-item-image\",\n \"assembly-option-item-name\",\n \"assembly-option-item-price\",\n \"assembly-option-item-quantity-selector\"\n ]\n }\n}\n```"
}
] |
code_storetheme-black-beauty_3e737df2
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/about-us.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.custom#about-us\": {\n \"blocks\": [\n \"flex-layout.row#about-us\"\n ]\n },\n\n \"flex-layout.row#about-us\": {\n \"children\": [\n \"image#mobile-phone\",\n \"flex-layout.col#text-about-us\"\n ]\n },\n\n \"flex-layout.col#text-about-us\": {\n \"children\": [\n \"rich-text#title-about-us\",\n \"rich-text#about-us\"\n ],\n \"props\": {\n \"blockclass\": \"textColumn\",\n \"preventVerticalStretch\": true\n }\n },\n\n \"rich-text#title-about-us\": {\n \"props\": {\n \"text\":\n \"# Create meaningful and relevant experiences.\",\n \"blockClass\": \"title\"\n }\n },\n\n \"image#mobile-phone\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/mobile-phone.png\",\n \"maxHeight\": \"\",\n \"maxWidth\": \"\",\n \"blockClass\": \"storePrint\"\n }\n },\n\n \"rich-text#about-us\": {\n \"props\": {\n \"text\": \"**Optimized store framework** \\n Free your front-end with our React + Node store framework. Improve usability and SEO, while driving more conversion with modular components, single page applications, and a ready-for-PWA structure. \\n **Multi-currency and language** \\n Go international with multiple storefronts to support different languages and easily manage local currencies and payment conditions. \\n **Serverless development platform** \\n Reduce loading time, improve usability, and make the best out of SEO. Developing scalable components with a comprehensive, easy-to-use toolset, you can build stores faster than ever.\",\n \"blockClass\": \"about\"\n }\n }\n}\n```"
}
] |
code_storetheme-black-beauty_e93fb54e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/product.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.product\": {\n \"children\": [\n \"flex-layout.row#product-breadcrumb\",\n \"flex-layout.row#product-main\",\n \"shelf.relatedProducts\",\n \"product-reviews\",\n \"product-questions-and-answers\"\n ]\n },\n \"flex-layout.row#product-breadcrumb\": {\n \"props\": {\n \"marginTop\": 4\n },\n \"children\": [\"breadcrumb\"]\n },\n \"flex-layout.row#product-main\": {\n \"props\": {\n \"colGap\": 7,\n \"rowGap\": 7,\n \"marginTop\": 4,\n \"marginBottom\": 7,\n \"paddingTop\": 7,\n \"paddingBottom\": 7\n },\n \"children\": [\"flex-layout.col#stack\", \"flex-layout.col#right-col\"]\n },\n\n \"stack-layout\": {\n \"children\": [\n \"flex-layout.row#product-image\",\n \"product-specification-badges\"\n ]\n },\n\n \"product-specification-badges\": {\n \"props\": {\n \"specificationGroupName\": \"Group\",\n \"specificationName\": \"On Sale\",\n \"visibleWhen\": \"True\",\n \"displayValue\": \"SPECIFICATION_NAME\"\n }\n },\n\n \"flex-layout.col#stack\": {\n \"children\": [\"stack-layout\"],\n \"props\": {\n \"width\": \"60%\",\n \"rowGap\": 0\n }\n },\n \"flex-layout.row#product-image\": {\n \"children\": [\"product-images\"]\n },\n \"product-images\": {\n \"props\": {\n \"displayThumbnailsArrows\": true\n }\n },\n \"flex-layout.col#right-col\": {\n \"props\": {\n \"preventVerticalStretch\": true,\n \"rowGap\": 0\n },\n \"children\": [\n \"product-name\",\n \"product-rating-summary\",\n \"product-price#product-details\",\n \"product-separator\",\n \"product-quantity\",\n \"product-identifier.product\",\n \"sku-selector\",\n \"product-assembly-options\",\n \"flex-layout.row#buy-button\",\n \"availability-subscriber\",\n \"shipping-simulator\",\n \"share#default\"\n ]\n },\n\n \"product-price#product-details\": {\n \"props\": {\n \"showInstallments\": true,\n \"showSavings\": true\n }\n },\n\n \"flex-layout.row#buy-button\": {\n \"props\": {\n \"marginTop\": 4,\n \"marginBottom\": 7\n },\n \"children\": [\"buy-button\"]\n },\n\n \"share#default\": {\n \"props\": {\n \"social\": {\n \"Facebook\": true,\n \"WhatsApp\": true,\n \"Twitter\": false,\n \"Pinterest\": true\n }\n }\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_503c38fb
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/search.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.search\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"store.search#brand\": {\n \"blocks\": [\"search-result-layout\"],\n \"props\": {\n \"context\": {\n \"orderByField\": \"OrderByReleaseDateDESC\",\n \"hideUnavailableItems\": true,\n \"maxItemsPerPage\": 10\n }\n }\n },\n\n \"store.search#department\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"store.search#category\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"store.search#subcategory\": {\n \"blocks\": [\"search-result-layout\"]\n },\n\n \"search-result-layout\": {\n \"blocks\": [\n \"search-result-layout.desktop\",\n \"search-result-layout.mobile\",\n \"search-not-found-layout\"\n ]\n },\n\n \"search-result-layout.desktop\": {\n \"children\": [\n \"flex-layout.row#searchbread\",\n \"flex-layout.row#searchtitle\",\n \"flex-layout.row#result\"\n ],\n \"props\": {\n \"pagination\": \"show-more\",\n \"mobileLayout\": {\n \"mode1\": \"small\",\n \"mode2\": \"normal\"\n }\n }\n },\n \"flex-layout.row#searchbread\": {\n \"children\": [\"breadcrumb.search\"],\n \"props\": {\n \"preserveLayoutOnMobile\": true,\n \"fullWidth\": true\n }\n },\n \"flex-layout.row#searchtitle\": {\n \"children\": [\"search-title.v2\"]\n },\n \"flex-layout.row#result\": {\n \"children\": [\"flex-layout.col#filter\", \"flex-layout.col#content\"],\n \"props\": {\n \"preventHorizontalStretch\": true,\n \"fullWidth\": true\n }\n },\n \"flex-layout.col#filter\": {\n \"children\": [\"filter-navigator.v3\"],\n \"props\": {\n \"blockClass\": \"filterCol\"\n }\n },\n \"flex-layout.col#content\": {\n \"children\": [\n \"flex-layout.row#searchinfo\",\n \"flex-layout.row#fetchprevious\",\n \"flex-layout.row#products\",\n \"flex-layout.row#fetchmore\"\n ],\n \"props\": {\n \"width\": \"grow\"\n }\n },\n \"flex-layout.row#searchinfo\": {\n \"children\": [\"flex-layout.col#productCount\", \"flex-layout.col#orderby\"]\n },\n \"flex-layout.col#productCount\": {\n \"children\": [\"total-products.v2\"],\n \"props\": {\n \"blockClass\": \"productCountCol\"\n }\n },\n \"flex-layout.col#orderby\": {\n \"children\": [\"order-by.v2\"],\n \"props\": {\n \"blockClass\": \"orderByCol\"\n }\n },\n \"flex-layout.row#fetchprevious\": {\n \"props\": {\n \"marginBottom\": 3\n },\n \"children\": [\"search-fetch-previous\"]\n },\n \"flex-layout.row#fetchmore\": {\n \"props\": {\n \"marginTop\": 3\n },\n \"children\": [\"search-fetch-more\"]\n },\n \"flex-layout.row#products\": {\n \"children\": [\"search-content\"]\n },\n \"search-content\": {\n \"blocks\": [\"gallery\", \"not-found\"]\n },\n\n \"search-result-layout.mobile\": {\n \"children\": [\n \"flex-layout.row#searchinfomobile\",\n \"flex-layout.row#searchbread\",\n \"flex-layout.row#productCountMobile\",\n \"flex-layout.row#contentmobile\"\n ],\n \"props\": {\n \"pagination\": \"show-more\",\n \"mobileLayout\": {\n \"mode1\": \"small\",\n \"mode2\": \"normal\"\n }\n }\n },\n \"flex-layout.row#contentmobile\": {\n \"children\": [\"search-content\"],\n \"props\": {\n \"preserveLayoutOnMobile\": true\n }\n },\n\n \"flex-layout.row#searchinfomobile\": {\n \"children\": [\n \"flex-layout.col#orderByMobile\",\n \"flex-layout.col#filterMobile\",\n \"flex-layout.col#switcherMobile\"\n ],\n \"props\": {\n \"preserveLayoutOnMobile\": true,\n \"colSizing\": \"auto\",\n \"colJustify\": \"around\"\n }\n },\n\n \"flex-layout.col#orderByMobile\": {\n \"children\": [\"order-by.v2\"],\n \"props\": {\n \"blockClass\": \"orderByMobileCol\"\n }\n },\n\n \"flex-layout.row#productCountMobile\": {\n \"children\": [\"total-products.v2\"],\n \"props\": {\n \"blockClass\": \"productCountMobileRow\"\n }\n },\n\n \"flex-layout.col#filterMobile\": {\n \"children\": [\"filter-navigator.v3\"],\n \"props\": {\n \"blockClass\": \"filterMobileCol\"\n }\n },\n \"flex-layout.col#switcherMobile\": {\n \"children\": [\"search-layout-switcher\"],\n \"props\": {\n \"blockClass\": \"switcherMobileCol\"\n }\n },\n \"search-not-found-layout\": {\n \"children\": [\"flex-layout.row#searchbread\", \"flex-layout.row#notfound\"]\n },\n\n \"flex-layout.row#notfound\": {\n \"children\": [\"not-found\"],\n \"props\": {\n \"fullWidth\": true\n }\n },\n\n \"breadcrumb\": {\n \"props\": {\n \"showOnMobile\": true\n }\n },\n\n \"gallery\": {\n \"blocks\": [\"product-summary.shelf\"]\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_866b983c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/home/secondary-banners-mobile.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#secondary-banners-mobile\": {\n \"children\": [\"image#bannersecondary01-mobile\", \"image#bannersecondary02-mobile\"],\n \"props\": {\n \"blockClass\": \"infocard\",\n \"colSpacing\": \"equal\",\n \"marginTop\": 6,\n \"marginBottom\": 6\n }\n },\n // \"flex-layout.col#infocard01-mobile\": {\n // \"children\": [\"info-card#banner01-mobile\"],\n // \"props\": {\n \n // }\n // },\n // \"flex-layout.col#infocard02-mobile\": {\n // \"children\": [\"info-card#banner02-mobile\"],\n // \"props\": {\n \n // }\n \n \"image#bannersecondary01-mobile\": {\n \"props\": { \n \"maxWidth\": \"100%\",\n \"src\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155722\"\n }\n },\n \n \"image#bannersecondary02-mobile\": {\n \"props\": { \n \"maxWidth\": \"100%\",\n \"src\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155723\"\n }\n }\n}\n \n \n// \"info-card#banner01-mobile\": {\n// \"props\": {\n// // \"headline\": \"Beauty inspired by real life.\",\n// \"isFullModeStyle\": true,\n// \"callToActionMode\": \"none\",\n// \"textPosition\": \"center\",\n// \"imageUrl\": \"https://slack-imgs.com/?c=1&o1=ro&url=https%3A%2F%2Fbeautytheme.vteximg.com.br%2Farquivos%2Fids%2F155720\",\n// \"blockClass\": \"main1-mobile\"\n// }\n// },\n// \"info-card#banner02-mobile\": {\n// \"props\": {\n// // \"headline\": \"SKIN FIRST\",\n// \"isFullModeStyle\": true,\n// \"callToActionMode\": \"none\",\n// \"textPosition\": \"center\",\n// \"imageUrl\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155719\",\n// \"blockClass\": \"main2-mobile\"\n// }\n// }\n// }\n```"
}
] |
code_storetheme-black-beauty_7ecfc750
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/home/main-banners-mobile.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#main-banners-mobile\": {\n \"children\": [\"image#banner01-mobile\", \"image#banner02-mobile\"],\n \"props\": {\n \"blockClass\": \"infocard\",\n \"colSpacing\": \"equal\",\n \"marginTop\": 6,\n \"marginBottom\": 6\n }\n },\n // \"flex-layout.col#infocard01-mobile\": {\n // \"children\": [\"info-card#banner01-mobile\"],\n // \"props\": {\n \n // }\n // },\n // \"flex-layout.col#infocard02-mobile\": {\n // \"children\": [\"info-card#banner02-mobile\"],\n // \"props\": {\n \n // }\n\n\n \"image#banner01-mobile\": {\n \"props\": { \n \"maxWidth\": \"100%\",\n \"src\": \"https://slack-imgs.com/?c=1&o1=ro&url=https%3A%2F%2Fbeautytheme.vteximg.com.br%2Farquivos%2Fids%2F155720\"\n }\n },\n\n \"image#banner02-mobile\": {\n \"props\": { \n \"maxWidth\": \"100%\",\n \"src\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155719\"\n }\n },\n\n \n \"info-card#banner01-mobile\": {\n \"props\": {\n // \"headline\": \"Beauty inspired by real life.\",\n \"isFullModeStyle\": true,\n \"callToActionMode\": \"none\",\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://slack-imgs.com/?c=1&o1=ro&url=https%3A%2F%2Fbeautytheme.vteximg.com.br%2Farquivos%2Fids%2F155720\",\n \"blockClass\": \"main1-mobile\"\n }\n },\n \"info-card#banner02-mobile\": {\n \"props\": {\n // \"headline\": \"SKIN FIRST\",\n \"isFullModeStyle\": true,\n \"callToActionMode\": \"none\",\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155719\",\n \"blockClass\": \"-mobile\"\n }\n }\n}\n```"
}
] |
code_storetheme-black-beauty_d6c57e6b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/home/home.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"store.home\": {\n \"blocks\": [\n \"responsive-layout.desktop\",\n \"responsive-layout.mobile\"\n // \"carousel#home\",\n // /* You can make references to blocks defined in other files.\n // * For example, `flex-layout.row#deals` is defined in the `deals.json` file. */\n // \"flex-layout.row#main-banners\",\n // \"shelf#home\",\n // \"flex-layout.row#secondary-banners\",\n // \"info-card#home\"\n ]\n },\n\n \"responsive-layout.desktop\": {\n \"children\": [\n \"carousel#home\",\n /* You can make references to blocks defined in other files.\n * For example, `flex-layout.row#deals` is defined in the `deals.json` file. */\n \"flex-layout.row#main-banners\",\n \"shelf#home\",\n \"flex-layout.row#secondary-banners\",\n \"info-card#home\"\n ]\n },\n\n \"responsive-layout.mobile\": {\n \"children\": [\n \"carousel#home\",\n /* You can make references to blocks defined in other files.\n * For example, `flex-layout.row#deals` is defined in the `deals.json` file. */\n \"flex-layout.row#main-banners-mobile\",\n \"shelf#home\",\n \"flex-layout.row#secondary-banners-mobile\"\n // \"info-card#home-mobile\"]\n ]\n },\n\n \"carousel#home\": {\n \"props\": {\n \"autoplay\": false,\n \"banners\": [\n {\n \"image\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155721\"\n }\n ],\n \"height\": 740,\n \"showArrows\": false,\n \"showDots\": false\n }\n },\n\n \"shelf#home\": {\n \"blocks\": [\"product-summary.shelf\"],\n \"props\": {\n \"blockClass\": \"home\",\n \"orderBy\": \"OrderByTopSaleDESC\",\n \"paginationDotsVisibility\": \"hidden\",\n \"productList\": {\n \"maxItems\": 10,\n \"itemsPerPage\": 5,\n \"minItemsPerPage\": 1.5,\n \"scroll\": \"BY_PAGE\",\n \"arrows\": true,\n \"titleText\": \"\"\n }\n }\n },\n\n \"flex-layout.row#info-card-home\": {\n \"children\": [\"info-card#home\"],\n \"props\": {\n \"blockClass\": \"info-card-home\"\n }\n },\n\n \"info-card#home\": {\n \"props\": {\n \"id\": \"info-card-home\",\n \"isFullModeStyle\": true,\n \"textPosition\": \"left\",\n \"imageUrl\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155739\",\n \"headline\": \"How to take care of a black skin?\",\n \"callToActionText\": \"LEARN MORE\",\n \"callToActionUrl\": \"/sale/d\",\n \"blockClass\": \"info-card-home\",\n \"textAlignment\": \"left\"\n }\n }\n\n // \"info-card#home-mobile\": {\n // \"props\": {\n // \"id\": \"info-card-home\",\n // \"isFullModeStyle\": false,\n // \"textPosition\": \"left\",\n // \"imageUrl\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155726-500-auto\",\n // \"headline\": \"How to take care of a black skin?\",\n // \"callToActionText\": \"LEARN MORE\",\n // \"callToActionUrl\": \"/sale/d\",\n // \"blockClass\": \"info-card-home-mobile\",\n // \"textAlignment\": \"left\"\n // }\n // }\n}\n\n```"
}
] |
code_storetheme-black-beauty_c5023532
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/home/main-banners.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#main-banners\": {\n \"children\": [\"flex-layout.col#infocard01\", \"flex-layout.col#infocard02\"],\n \"props\": {\n \"blockClass\": \"infocard\",\n \"colSpacing\": \"equal\",\n \"marginTop\": 6,\n \"marginBottom\": 6\n }\n },\n \"flex-layout.col#infocard01\": {\n \"children\": [\"info-card#banner01\"],\n \"props\": {\n \"horizontalAlign\": \"right\"\n }\n },\n \"flex-layout.col#infocard02\": {\n \"children\": [\"info-card#banner02\"],\n \"props\": {\n \"horizontalAlign\": \"left\"\n }\n },\n \"info-card#banner01\": {\n \"props\": {\n // \"headline\": \"Beauty inspired by real life.\",\n \"isFullModeStyle\": true,\n \"callToActionMode\": \"none\",\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://slack-imgs.com/?c=1&o1=ro&url=https%3A%2F%2Fbeautytheme.vteximg.com.br%2Farquivos%2Fids%2F155720\",\n \"blockClass\": \"main1\"\n }\n },\n \"info-card#banner02\": {\n \"props\": {\n // \"headline\": \"SKIN FIRST\",\n \"isFullModeStyle\": true,\n \"callToActionMode\": \"none\",\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155719\",\n \"blockClass\": \"main2\"\n }\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_3cf956be
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/home/deals.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#deals\": {\n \"children\": [\n \"flex-layout.col#deals1\",\n \"flex-layout.col#deals2\",\n \"flex-layout.col#deals3\",\n \"flex-layout.col#deals4\"\n ],\n \"props\": {\n \"blockClass\": \"deals\"\n }\n },\n\n \"flex-layout.col#deals1\": {\n \"children\": [\n \"image#deal1\",\n \"rich-text#deal1\"\n ]\n },\n \"image#deal1\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/box.png\",\n \"maxHeight\": \"24px\"\n }\n },\n \"rich-text#deal1\": {\n \"props\": {\n \"text\": \"Free shipping\",\n \"blockClass\": \"deals\"\n }\n },\n \"flex-layout.col#deals2\": {\n \"children\": [\n \"image#deal2\",\n \"rich-text#deal2\"\n ]\n },\n \"image#deal2\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/delivery-fast.png\",\n \"maxHeight\": \"24px\"\n }\n },\n \"rich-text#deal2\": {\n \"props\": {\n \"text\": \"One day delivery\",\n \"blockClass\": \"deals\"\n }\n },\n \"flex-layout.col#deals3\": {\n \"children\": [\n \"image#deal3\",\n \"rich-text#deal3\"\n ]\n },\n \"image#deal3\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/store.png\",\n \"maxHeight\": \"24px\"\n }\n },\n \"rich-text#deal3\": {\n \"props\": {\n \"text\": \"Pick up in store\",\n \"blockClass\": \"deals\"\n }\n },\n \"flex-layout.col#deals4\": {\n \"children\": [\n \"image#deal4\",\n \"rich-text#deal4\"\n ]\n },\n \"image#deal4\": {\n \"props\": {\n \"src\": \"https://storecomponents.vteximg.com.br/arquivos/coupon.png\",\n \"maxHeight\": \"24px\"\n }\n },\n \"rich-text#deal4\": {\n \"props\": {\n \"text\": \"Exclusive deals\",\n \"blockClass\": \"deals\"\n }\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_651b7ff9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/home/secondary-banners.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"flex-layout.row#secondary-banners\": {\n \"children\": [\"flex-layout.col#secondary-info-card-1\", \"flex-layout.col#secondary-info-card-2\"],\n \"props\": {\n \"blockClass\": \"infocard\",\n \"colSpacing\": \"equal\",\n \"marginTop\": 6,\n \"marginBottom\": 6\n }\n },\n \"flex-layout.col#secondary-info-card-1\": {\n \"children\": [\"info-card#secondary-banner-1\"],\n \"props\": {\n \"horizontalAlign\": \"right\"\n }\n },\n \"flex-layout.col#secondary-info-card-2\": {\n \"children\": [\"info-card#secondary-banner-2\"],\n \"props\": {\n \"horizontalAlign\": \"left\"\n }\n },\n \"info-card#secondary-banner-1\": {\n \"props\": {\n // \"headline\": \"Beauty inspired by real life.\",\n \"isFullModeStyle\": true,\n \"callToActionMode\": \"none\",\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155722\",\n \"blockClass\": \"main1\"\n }\n },\n \"info-card#secondary-banner-2\": {\n \"props\": {\n // \"headline\": \"SKIN FIRST\",\n \"isFullModeStyle\": true,\n \"callToActionMode\": \"none\",\n \"textPosition\": \"center\",\n \"imageUrl\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155723\",\n \"blockClass\": \"main2\"\n }\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_01107273
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/footer/footer.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"footer\": {\n \"blocks\": [\n \"footer-layout.desktop\",\n \"footer-layout.mobile\"\n ]\n },\n \"footer-layout.desktop\": {\n \"children\": [\n \"flex-layout.row#footer-1-desktop\",\n \"flex-layout.row#footer-2-desktop\",\n \"flex-layout.row#footer-3-desktop\"\n ]\n },\n \"flex-layout.row#footer-1-desktop\": {\n \"children\": [\n \"flex-layout.col#info-footer-col\",\n \"flex-layout.col#mailing-list-footer-col\"\n ],\n \"props\": {\n \"blockClass\": \"menu-row\",\n \"paddingTop\": 6,\n \"paddingBottom\": 3,\n \"colSizing\": \"auto\"\n }\n },\n \"flex-layout.col#info-footer-col\": {\n \"children\": [\n \"flex-layout.row#info-footer-row\"\n ]\n },\n \"flex-layout.row#info-footer-row\": {\n \"children\": [\n \"rich-text#about-us-col\",\n \"rich-text#customer-service-col\",\n \"rich-text#connect-col\"\n ]\n },\n \"rich-text#about-us-col\": {\n \"props\": {\n \"textAlignment\": \"left\",\n \"textPosition\": \"left\",\n \"text\": \"### About Us\\n[About Us](https://help.vtex.com/en/faq/what-is-vtex-io)\\n[Regimen](https://help.vtex.com/en/faq/what-is-vtex-io)\\n[Shop all](https://help.vtex.com/en/faq/what-is-vtex-io)\\n\"\n }\n },\n \"rich-text#customer-service-col\": {\n \"props\": {\n \"textAlignment\": \"left\",\n \"textPosition\": \"left\",\n \"text\": \"### Services\\n[FAQ](https://help.vtex.com/en/faq/what-is-vtex-io)\\n[Returns](https://help.vtex.com/en/faq/what-is-vtex-io)\\n\"\n }\n },\n \"rich-text#connect-col\": {\n \"props\": {\n \"textAlignment\": \"left\",\n \"textPosition\": \"left\",\n \"text\": \"### Connect\\n[@afrodeities](https://help.vtex.com/en/faq/what-is-vtex-io)\"\n }\n },\n \"flex-layout.col#mailing-list-footer-col\": {\n \"children\": [\n \"newsletter#footer-newsletter\"\n ]\n },\n \"newsletter#footer-newsletter\": {\n \"props\": {\n \"label\": \"Join Our Mailing List\",\n \"placeholder\": \"ENTER YOUR E-MAIL\",\n \"submit\": \"SEND\"\n }\n },\n \"social-networks\": {\n \"props\": {\n \"socialNetworks\": [\n {\n \"name\": \"Facebook\",\n \"url\": \"https://www.facebook.com/vtexonline/\"\n },\n {\n \"name\": \"Instagram\",\n \"url\": \"https://www.instagram.com/vtextruecloud/\"\n },\n {\n \"name\": \"Twitter\",\n \"url\": \"https://twitter.com/vtexonline\"\n },\n {\n \"name\": \"Youtube\",\n \"url\": \"https://www.youtube.com/user/VTEXTV\"\n }\n ]\n }\n },\n \"flex-layout.row#footer-2-desktop\": {\n \"children\": [\n \"accepted-payment-methods\"\n ],\n \"props\": {\n \"blockClass\": \"payment-methods\"\n }\n },\n \"accepted-payment-methods\": {\n \"props\": {\n \"paymentMethods\": [\n \"MasterCard\",\n \"Visa\",\n \"Diners Club\"\n ]\n }\n },\n \"flex-layout.row#footer-3-desktop\": {\n \"children\": [\n \"rich-text#footer\"\n ],\n \"props\": {\n \"blockClass\": \"credits\"\n }\n },\n \"rich-text#footer\": {\n \"props\": {\n \"text\": \"All stock and product photos are from photos.icons8.com\",\n \"blockClass\": \"footer\"\n }\n },\n \"footer-layout.mobile\": {\n \"children\": [\n \"flex-layout.row#1-footer-mobile\",\n \"flex-layout.row#2-footer-mobile\"\n ]\n },\n \"flex-layout.row#2-footer-mobile\": {\n \"children\": [\n \"flex-layout.col#footer-1-mobile\"\n ],\n \"props\": {\n \"blockClass\": \"payment-methods\",\n \"paddingTop\": 4,\n \"paddingBottom\": 4\n }\n },\n \"flex-layout.col#footer-1-mobile\": {\n \"children\": [\n \"accepted-payment-methods\",\n \"social-networks\",\n \"rich-text#footer-mobile\"\n ],\n \"props\": {\n \"blockClass\": \"payment-methods\",\n \"paddingTop\": 4,\n \"paddingBottom\": 4,\n \"rowGap\": 4\n }\n },\n \"flex-layout.row#1-footer-mobile\": {\n \"props\": {\n \"paddingTop\": 4,\n \"paddingBottom\": 4\n },\n \"children\": [\n \"vtex.menu@2.x:menu#footer-mobile\"\n ]\n },\n \"rich-text#footer-mobile\": {\n \"props\": {\n \"text\": \"All stock and product photos are from photos.icons8.com\",\n \"blockClass\": \"footer\"\n }\n }\n}\n```"
}
] |
code_storetheme-black-beauty_60bb5737
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/footer/menu.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"vtex.menu@2.x:menu#Products\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#news\",\n \"menu-item#blackfriday\",\n \"menu-item#sale\",\n \"menu-item#personalization\"\n ]\n },\n \"menu-item#news\": {\n \"props\": {\n \"id\": \"menu-item-news\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"News\",\n \"text\": \"News\"\n }\n }\n },\n \"menu-item#blackfriday\": {\n \"props\": {\n \"id\": \"menu-item-black-friday\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"BlackFriday\",\n \"text\": \"Black Friday\"\n }\n }\n },\n \"menu-item#sale\": {\n \"props\": {\n \"id\": \"menu-item-sale\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"Sale\",\n \"text\": \"Sale\"\n }\n }\n },\n \"menu-item#personalization\": {\n \"props\": {\n \"id\": \"menu-item-personalization\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"#\",\n \"noFollow\": false,\n \"tagTitle\": \"Personalization\",\n \"text\": \"Personalization\"\n }\n }\n },\n\n \"vtex.menu@2.x:menu#footer-decoration\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#smartphones\",\n \"menu-item#videogames\",\n \"menu-item#tvs\"\n ]\n },\n\n \"menu-item#smartphones\": {\n \"props\": {\n \"id\": \"menu-item-smartphones\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/decoration/smartphones\",\n \"noFollow\": true,\n \"tagTitle\": \"Smartphones\",\n \"text\": \"Smartphones\"\n }\n }\n },\n\n \"menu-item#videogames\": {\n \"props\": {\n \"id\": \"menu-item-videogames\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/decoration/videogames\",\n \"noFollow\": true,\n \"tagTitle\": \"Videogames\",\n \"text\": \"Videogames\"\n }\n }\n },\n\n \"menu-item#tvs\": {\n \"props\": {\n \"id\": \"menu-item-tvs\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/decoration/tvs\",\n \"noFollow\": true,\n \"tagTitle\": \"TVs\",\n \"text\": \"TVs\"\n }\n }\n },\n\n \"vtex.menu@2.x:menu#footer-bags\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#bags\",\n \"menu-item#backpacks\",\n \"menu-item#necessaire\"\n ]\n },\n\n \"menu-item#bags\": {\n \"props\": {\n \"id\": \"menu-item-bags\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/bags/d\",\n \"noFollow\": true,\n \"tagTitle\": \"Bags\",\n \"text\": \"Bags\"\n }\n }\n },\n\n \"menu-item#backpacks\": {\n \"props\": {\n \"id\": \"menu-item-backpacks\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/bags/backpacks\",\n \"noFollow\": true,\n \"tagTitle\": \"Backpacks\",\n \"text\": \"Backpacks\"\n }\n }\n },\n\n \"menu-item#necessaire\": {\n \"props\": {\n \"id\": \"menu-item-necessaire\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/bags/necessaire\",\n \"noFollow\": true,\n \"tagTitle\": \"Necessaire\",\n \"text\": \"Necessaire\"\n }\n }\n },\n\n \"vtex.menu@2.x:menu#footer-clothing\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#clothing\",\n \"menu-item#shorts\",\n \"menu-item#tank-tops\",\n \"menu-item#shirts\",\n \"menu-item#sweatshirt\",\n \"menu-item#cropped\"\n ]\n },\n\n \"vtex.menu@2.x:menu#footer-mobile\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#clothing-mobile\",\n \"menu-item#decoration-mobile\",\n \"menu-item#sale-mobile\"\n ]\n },\n\n \"menu-item#clothing-mobile\": {\n \"props\": {\n \"id\": \"menu-item-category-clothing\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/d\",\n \"noFollow\": true,\n \"tagTitle\": \"Clothing\",\n \"text\": \"Clothing\"\n }\n },\n \"blocks\": [\"vtex.menu@2.x:submenu.accordion#clothing\"]\n },\n \"vtex.menu@2.x:submenu.accordion#clothing\": {\n \"children\": [\"vtex.menu@2.x:menu#clothing-accordion\"]\n },\n\n \"vtex.menu@2.x:menu#clothing-accordion\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#shorts\",\n \"menu-item#tank-tops\",\n \"menu-item#shirts\",\n \"menu-item#sweatshirt\",\n \"menu-item#cropped\"\n ]\n },\n\n \"menu-item#decoration-mobile\": {\n \"props\": {\n \"itemProps\": {\n \"tagTitle\": \"Decoration\",\n \"text\": \"Decoration\"\n }\n },\n \"blocks\": [\"vtex.menu@2.x:submenu.accordion#decoration\"]\n },\n \"vtex.menu@2.x:submenu.accordion#decoration\": {\n \"children\": [\"vtex.menu@2.x:menu#footer-decoration-mobile\"]\n },\n\n \"vtex.menu@2.x:menu#footer-decoration-mobile\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#smartphones\",\n \"menu-item#videogames\",\n \"menu-item#tvs\"\n ]\n },\n\n \"menu-item#sale-mobile\": {\n \"props\": {\n \"itemProps\": {\n \"tagTitle\": \"Sale\",\n \"text\": \"Sale\"\n }\n },\n \"blocks\": [\"vtex.menu@2.x:submenu.accordion#sale\"]\n },\n \"vtex.menu@2.x:submenu.accordion#sale\": {\n \"children\": [\"vtex.menu@2.x:menu#footer-sale-mobile\"]\n },\n\n \"vtex.menu@2.x:menu#footer-sale-mobile\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#smartphones\",\n \"menu-item#videogames\",\n \"menu-item#tvs\"\n ]\n },\n\n \"menu-item#clothing\": {\n \"props\": {\n \"id\": \"menu-item-category-clothing\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/d\",\n \"noFollow\": true,\n \"tagTitle\": \"Clothing\",\n \"text\": \"Clothing\"\n }\n }\n },\n\n \"menu-item#shorts\": {\n \"props\": {\n \"id\": \"menu-item-shorts\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/shorts\",\n \"noFollow\": false,\n \"tagTitle\": \"Shorts\",\n \"text\": \"Shorts\"\n }\n }\n },\n\n \"menu-item#tank-tops\": {\n \"props\": {\n \"id\": \"menu-item-tank-tops\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/tank-tops\",\n \"noFollow\": false,\n \"tagTitle\": \"Tank tops\",\n \"text\": \"Tank tops\"\n }\n }\n },\n\n \"menu-item#shirts\": {\n \"props\": {\n \"id\": \"menu-item-shirts\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/shirts\",\n \"noFollow\": false,\n \"tagTitle\": \"Shirts\",\n \"text\": \"Shirts\"\n }\n }\n },\n\n \"menu-item#sweatshirt\": {\n \"props\": {\n \"id\": \"menu-item-sweat-shirts\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/sweatshirt\",\n \"noFollow\": false,\n \"tagTitle\": \"Sweatshirt\",\n \"text\": \"Sweatshirt\"\n }\n }\n },\n\n \"menu-item#cropped\": {\n \"props\": {\n \"id\": \"menu-item-cropped\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/clothing/cropped\",\n \"noFollow\": false,\n \"tagTitle\": \"Cropped\",\n \"text\": \"Cropped\"\n }\n }\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_bd5824ba
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/header/category-menu.json from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"vtex.menu@2.x:menu#category-menu\": {\n \"children\": [\n \"menu-item#category-hair\",\n \"menu-item#category-make-up\",\n \"menu-item#category-perfume\"\n ]\n },\n \"menu-item#category-hair\": {\n \"props\": {\n \"id\": \"menu-item-category-hair\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/hair/\",\n \"noFollow\": true,\n \"tagTitle\": \"Hair\",\n \"text\": \"HAIR\"\n }\n }\n },\n \"vtex.menu@2.x:submenu#category-hair\": {\n \"props\": {\n \"width\": \"auto\"\n },\n \"children\": [\n \"vtex.menu@2.x:menu#category-hair\"\n ]\n },\n \"vtex.menu@2.x:menu#category-hair\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#category-hair-hats\",\n \"menu-item#category-hair-shoes\",\n \"menu-item#category-hair-bags\"\n ]\n },\n \"menu-item#category-hair-hats\": {\n \"props\": {\n \"id\": \"menu-item-category-hair-hats\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/apparel---accessories/hats/\",\n \"noFollow\": true,\n \"tagTitle\": \"Hats\",\n \"text\": \"Hats\"\n }\n }\n },\n \"menu-item#category-hair-shoes\": {\n \"props\": {\n \"id\": \"menu-item-category-hair-shoes\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/apparel---accessories/shoes/\",\n \"noFollow\": true,\n \"tagTitle\": \"Shoes\",\n \"text\": \"Shoes\"\n }\n }\n },\n \"menu-item#category-hair-bags\": {\n \"props\": {\n \"id\": \"menu-item-category-hair-bags\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/apparel---accessories/bags/\",\n \"noFollow\": true,\n \"tagTitle\": \"Bags\",\n \"text\": \"Bags\"\n }\n }\n },\n \"menu-item#category-make-up\": {\n \"props\": {\n \"id\": \"menu-item-category-make-up\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/make-up\",\n \"noFollow\": true,\n \"tagTitle\": \"Make-Up\",\n \"text\": \"MAKE-UP\"\n }\n }\n },\n \"menu-item#category-perfume\": {\n \"props\": {\n \"id\": \"menu-item-category-perfume\",\n \"type\": \"custom\",\n \"iconId\": null,\n \"highlight\": false,\n \"itemProps\": {\n \"type\": \"internal\",\n \"href\": \"/perfume\",\n \"noFollow\": true,\n \"tagTitle\": \"Perfume\",\n \"text\": \"PERFUME\"\n }\n }\n },\n \"vtex.menu@2.x:submenu#category-perfume\": {\n \"props\": {\n \"width\": \"100%\"\n },\n \"children\": [\n \"vtex.menu@2.x:menu#category-perfume\",\n \"info-card#home\"\n ]\n },\n \"vtex.menu@2.x:menu#category-perfume\": {\n \"props\": {\n \"orientation\": \"vertical\"\n },\n \"children\": [\n \"menu-item#category-hair-hats\",\n \"menu-item#category-hair-shoes\"\n ]\n }\n}\n```"
}
] |
code_storetheme-black-beauty_52924b34
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/header/header.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"header\": {\n \"blocks\": [\"header-layout.desktop\", \"header-layout.mobile\"]\n },\n \"header.full\": {\n \"blocks\": [\"header-layout.desktop\", \"header-layout.mobile\"]\n },\n \"header-layout.desktop\": {\n \"children\": [\"header-row#1-desktop\", \"header-row#4-desktop\"]\n },\n \"header-row#1-desktop\": {\n \"children\": [\"telemarketing\"],\n \"props\": {\n \"fullWidth\": true\n }\n },\n // \"header-row#3-desktop\": {\n // \"children\": [\n // \"vtex.menu@2.x:menu#websites\",\n // \"header-spacer\",\n // \"vtex.menu@2.x:menu#institutional\"\n // ],\n // \"props\": {\n // \"blockClass\": \"menu-link\",\n // \"inverted\": \"true\"\n // }\n // },\n \"header-row#4-desktop\": {\n \"children\": [\n \"vtex.menu@2.x:menu#category-menu\",\n \"header-spacer\",\n \"logo#desktop\",\n \"header-spacer\",\n \"search-bar\",\n \"locale-switcher\",\n \"login\",\n \"minicart\"\n ],\n \"props\": {\n \"sticky\": true,\n \"blockClass\": \"main-header\"\n }\n },\n \"logo#desktop\": {\n \"props\": {\n \"title\": \"Logo\",\n \"href\": \"/\",\n \"url\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155737\",\n \"width\": \"275\"\n }\n },\n \"minicart\": {\n \"blocks\": [\"product-summary\"],\n \"props\": {\n \"type\": \"popup\",\n \"showRemoveButton\": true,\n \"showDiscount\": true,\n \"showSku\": true,\n \"labelMiniCartEmpty\": \"\",\n \"labelButtonFinishShopping\": \"Go to checkout\",\n \"enableQuantitySelector\": true,\n \"maxQuantity\": 10,\n \"labelClasses\": \"gray\"\n }\n },\n \"header-layout.mobile\": {\n \"children\": [\"header-row#1-mobile\"]\n },\n \"header-row#1-mobile\": {\n \"children\": [\"drawer\", \"logo#mobile\", \"header-spacer\", \"login\", \"minicart\"],\n \"props\": {\n \"sticky\": true,\n \"blockClass\": \"main-header-mobile\"\n }\n },\n \"drawer\": {\n \"children\": [\"menu#drawer\"]\n },\n \"menu#drawer\": {\n \"children\": [\"menu-item#category-hair\", \"menu-item#category-make-up\", \"menu-item#category-perfume\"],\n \"props\": {\n \"orientation\": \"vertical\"\n }\n },\n \"logo#mobile\": {\n \"props\": {\n \"title\": \"Logo\",\n \"href\": \"/\",\n \"url\": \"https://beautytheme.vteximg.com.br/arquivos/ids/155737\",\n \"width\": \"70\"\n }\n }\n}\n\n```"
}
] |
code_storetheme-black-beauty_77f9234c
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of storetheme-black-beauty/store/blocks/header/top-menu.jsonc from the storetheme-black-beauty VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n // \"vtex.menu@2.x:menu#websites\": {\n // \"children\": [\n // \"menu-item#shop\",\n // \"menu-item#about-us\"\n // ]\n // },\n // \"menu-item#shop\": {\n // \"props\": {\n // \"id\": \"menu-item-shop\",\n // \"type\": \"custom\",\n // \"iconId\": null,\n // \"highlight\": false,\n // \"itemProps\": {\n // \"type\": \"internal\",\n // \"href\": \"#\",\n // \"noFollow\": false,\n // \"tagTitle\": \"Shop\",\n // \"text\": \"Shop\"\n // }\n // }\n // },\n // \"menu-item#about-us\": {\n // \"props\": {\n // \"id\": \"menu-item-about-us\",\n // \"type\": \"custom\",\n // \"iconId\": null,\n // \"highlight\": false,\n // \"itemProps\": {\n // \"type\": \"internal\",\n // \"href\": \"/about-us\",\n // \"noFollow\": false,\n // \"tagTitle\": \"about-us\",\n // \"text\": \"About Us\"\n // }\n // }\n // },\n // \"vtex.menu@2.x:menu#institutional\": {\n // \"children\": [\n // \"menu-item#vtex-website\"\n // ]\n // },\n // \"menu-item#vtex-website\": {\n // \"props\": {\n // \"id\": \"menu-item-vtex-website\",\n // \"type\": \"custom\",\n // \"iconId\": null,\n // \"highlight\": false,\n // \"itemProps\": {\n // \"type\": \"external\",\n // \"href\": \"http://vtex.com\",\n // \"noFollow\": false,\n // \"tagTitle\": \"visit vtex.com\",\n // \"text\": \"visit vtex.com\"\n // }\n // }\n // }\n}\n\n```"
}
] |
code_condition-layout_808ae97a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/messages/pt.json from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.condition-layout.wrapper\": \"Condição\",\n \"admin/editor.condition-layout.wrapper.product\": \"Condição de produto\",\n \"admin/editor.condition-layout.else\": \"Bloco Padrão\",\n \"admin/editor.condition-layout.condition\": \"Bloco de condições\",\n \"admin/editor.condition-layout.enabled.title\": \"Ativado\",\n \"admin/editor.condition-layout.enabled.description\": \"Uma condição desativada é sempre considerada falsa e seus filhos não serão renderizados.\",\n \"admin/editor.condition-layout.conditions\": \"Condições\",\n \"admin/editor.condition-layout.subject\": \"Sujeito\",\n \"admin/editor.condition-layout.verb\": \"Verbo (operador)\",\n \"admin/editor.condition-layout.object\": \"Objeto\",\n \"admin/editor.condition-layout.match\": \"Tipo de match\",\n \"admin/editor.condition-layout.product.subject.productId\": \"ID do produto\",\n \"admin/editor.condition-layout.product.subject.categoryId\": \"ID da categoria\",\n \"admin/editor.condition-layout.product.subject.brandId\": \"ID da marca\",\n \"admin/editor.condition-layout.product.subject.productClusters\": \"Clusters de produtos\",\n \"admin/editor.condition-layout.product.subject.categoryTree\": \"CategoryTree\",\n \"admin/editor.condition-layout.product.subject.specificationProperties\": \"Propriedades de especificação\",\n \"admin/editor.condition-layout.product.subject.selectedItemId\": \"ID do item selecionado\",\n \"admin/editor.condition-layout.verb.is\": \"é\",\n \"admin/editor.condition-layout.verb.is-not\": \"não é\",\n \"admin/editor.condition-layout.verb.contains\": \"contém\",\n \"admin/editor.condition-layout.verb.does-not-contain\": \"não contém\"\n}\n\n```"
}
] |
code_condition-layout_38990233
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/messages/en.json from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.condition-layout.wrapper\": \"Condition wrapper\",\n \"admin/editor.condition-layout.wrapper.product\": \"Product Condition\",\n \"admin/editor.condition-layout.else\": \"Default block\",\n \"admin/editor.condition-layout.condition\": \"Condition block\",\n \"admin/editor.condition-layout.enabled.title\": \"Enabled\",\n \"admin/editor.condition-layout.enabled.description\": \"A disabled condition is always considered false and it's children will not be rendered.\",\n \"admin/editor.condition-layout.conditions\": \"Conditions\",\n \"admin/editor.condition-layout.subject\": \"Subject\",\n \"admin/editor.condition-layout.verb\": \"Verb (operator)\",\n \"admin/editor.condition-layout.object\": \"Object\",\n \"admin/editor.condition-layout.match\": \"Match type\",\n \"admin/editor.condition-layout.product.subject.productId\": \"Product ID\",\n \"admin/editor.condition-layout.product.subject.categoryId\": \"Category ID\",\n \"admin/editor.condition-layout.product.subject.brandId\": \"Brand ID\",\n \"admin/editor.condition-layout.product.subject.productClusters\": \"Product clusters\",\n \"admin/editor.condition-layout.product.subject.categoryTree\": \"Category tree\",\n \"admin/editor.condition-layout.product.subject.specificationProperties\": \"Specification Properties\",\n \"admin/editor.condition-layout.product.subject.selectedItemId\": \"Selected Item ID\",\n \"admin/editor.condition-layout.verb.is\": \"is\",\n \"admin/editor.condition-layout.verb.is-not\": \"is not\",\n \"admin/editor.condition-layout.verb.contains\": \"contains\",\n \"admin/editor.condition-layout.verb.does-not-contain\": \"does not contain\"\n}\n\n```"
}
] |
code_condition-layout_5573fa72
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/messages/context.json from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.condition-layout.wrapper\": \"Condition wrapper\",\n \"admin/editor.condition-layout.wrapper.product\": \"Product Condition\",\n \"admin/editor.condition-layout.else\": \"Default block\",\n \"admin/editor.condition-layout.condition\": \"Condition block\",\n \"admin/editor.condition-layout.enabled.title\": \"Enabled\",\n \"admin/editor.condition-layout.enabled.description\": \"A disabled condition is always considered false and it's children will not be rendered.\",\n \"admin/editor.condition-layout.conditions\": \"Conditions\",\n \"admin/editor.condition-layout.subject\": \"Subject\",\n \"admin/editor.condition-layout.verb\": \"Verb (operator)\",\n \"admin/editor.condition-layout.object\": \"Object\",\n \"admin/editor.condition-layout.match\": \"Match type\",\n \"admin/editor.condition-layout.product.subject.productId\": \"Product ID\",\n \"admin/editor.condition-layout.product.subject.categoryId\": \"Category ID\",\n \"admin/editor.condition-layout.product.subject.brandId\": \"Brand ID\",\n \"admin/editor.condition-layout.product.subject.productClusters\": \"Product clusters\",\n \"admin/editor.condition-layout.product.subject.categoryTree\": \"Category tree\",\n \"admin/editor.condition-layout.product.subject.specificationProperties\": \"Specification Properties\",\n \"admin/editor.condition-layout.product.subject.selectedItemId\": \"Selected Item ID\",\n \"admin/editor.condition-layout.verb.is\": \"is\",\n \"admin/editor.condition-layout.verb.is-not\": \"is not\",\n \"admin/editor.condition-layout.verb.contains\": \"contains\",\n \"admin/editor.condition-layout.verb.does-not-contain\": \"does not contain\"\n}\n\n```"
}
] |
code_condition-layout_154a53a7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/messages/es.json from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"admin/editor.condition-layout.wrapper\": \"Envoltura de condición\",\n \"admin/editor.condition-layout.wrapper.product\": \"Condición del producto\",\n \"admin/editor.condition-layout.else\": \"Bloque estándar\",\n \"admin/editor.condition-layout.condition\": \"Bloque de condición\",\n \"admin/editor.condition-layout.enabled.title\": \"Habilitado\",\n \"admin/editor.condition-layout.enabled.description\": \"Una condición deshabilitada siempre se considera falsa y sus hijos no se procesarán.\",\n \"admin/editor.condition-layout.conditions\": \"Condiciones\",\n \"admin/editor.condition-layout.subject\": \"Tema\",\n \"admin/editor.condition-layout.verb\": \"Verbo (operador)\",\n \"admin/editor.condition-layout.object\": \"Objeto\",\n \"admin/editor.condition-layout.match\": \"Tipo de match\",\n \"admin/editor.condition-layout.product.subject.productId\": \"ID de producto\",\n \"admin/editor.condition-layout.product.subject.categoryId\": \"ID de categoria\",\n \"admin/editor.condition-layout.product.subject.brandId\": \"ID de marca\",\n \"admin/editor.condition-layout.product.subject.productClusters\": \"Agrupaciones de productos\",\n \"admin/editor.condition-layout.product.subject.categoryTree\": \"CategoryTree\",\n \"admin/editor.condition-layout.product.subject.specificationProperties\": \"Propiedades de especificación\",\n \"admin/editor.condition-layout.product.subject.selectedItemId\": \"ID del artículo seleccionado\",\n \"admin/editor.condition-layout.verb.is\": \"es\",\n \"admin/editor.condition-layout.verb.is-not\": \"no es\",\n \"admin/editor.condition-layout.verb.contains\": \"contiene\",\n \"admin/editor.condition-layout.verb.does-not-contain\": \"no contiene\"\n}\n\n```"
}
] |
code_condition-layout_69b52cd0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/docs/README.md from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/condition-layout) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n>⚠️\n>\n> ***Condition Layout app v1 has been deprecated in favor of Condition Layout app v2**. Although support for the former version is still granted, we strongly recommend you to access the [Migration Guide](https://github.com/vtex-apps/condition-layout/tree/master/docs/MIGRATION-GUIDE.md) and update your store theme with the app's newest version in order to keep up with the components' evolution. If you’re still using the former version, you can find its documentation [here](https://github.com/vtex-apps/condition-layout/tree/master/docs/v1-DOC.md).\n\n# Condition Layout\n\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\nThe Condition Layout app renders a component in your store when predefined conditions are met.\n\n\n\n## Configuration\n\n### Step 1 - Adding the Condition Layout app to your theme dependencies\n\nIn the `manifest.json` file of your theme, add the Condition Layout app as a dependency:\n\n```diff\n \"dependencies\": {\n+ \"vtex.condition-layout\": \"2.x\"\n }\n```\n\nYou can now use all blocks exported by the `condition-layout` app. See the full list below:\n\n| Block name | Description |\n| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `condition-layout.product` | Defines the condition logic in the product context and the children blocks that will be rendered when the predefined conditions are met. |\n| `condition-layout.binding` | Defines the condition logic in the current binding and the children blocks that will be rendered when the predefined conditions are met. |\n| `condition-layout.category` | Defines the condition logic on the current category or department page and the children blocks that will be rendered when the predefined conditions are met. |\n| `condition-layout.telemarketing` | Defines the condition logic in the user role (telemarketing) and the children blocks that will be rendered when the predefined conditions are met. |\n\n### Step 2 - Adding the `condition-layout.product` block to your theme templates\n\nIn the product theme template, add the `condition-layout.product` block as a child. For example:\n\n```\n{\n \"store.product\": {\n \"children\": [\"condition-layout.product\"]\n },\n```\n\nOr the `condition-layout.binding` block. For example:\n\n```json\n{\n \"store.product\": {\n \"children\": [\"condition-layout.binding\"]\n }\n}\n```\n\nOr the `condition-layout.category` block. For example:\n\n```json\n{\n \"store.search#my-category-page\": {\n \"children\": [\"condition-layout.category\"]\n }\n}\n```\n\n>⚠️ Never use `condition-layout` directly. Always use it with a context variant, such as `condition-layout.product`.\n\n### Step 3 - Defining the desired conditions\n\nNow it is time to configure the `condition-layout.product` block!\n\n**Use the block props to define your layout condition**. You can also declare blocks of your choice as children of `condition-layout.product`. These children blocks will be rendered if the condition is met.\n\nFor example:\n\n```diff\n{\n \"store.product\": {\n \"children\": [\"condition-layout.product#cond1\"]\n },\n \"condition-layout.product#cond1\": {\n+ \"props\": {\n+ \"conditions\": [\n+ {\n+ \"subject\": \"productId\",\n+ \"arguments\": {\n+ \"id\": \"12\"\n+ }\n+ }\n+ ]\n+ \"Then\": \"flex-layout.row#custom-pdp-layout-12\",\n+ \"Else\": \"flex-layout.row#default\"\n+ }\n+ }\n```\n\nOr for `condition-layout.binding`:\n\n```diff\n{\n \"store.product\": {\n \"children\": [\"condition-layout.binding#cond42\"]\n },\n \"condition-layout.binding#cond42\": {\n+ \"props\": {\n+ \"conditions\": [\n+ {\n+ \"subject\": \"bindingId\",\n+ \"arguments\": {\n+ \"id\": \"13fb71d0-binding-code-here-87h9c28h9013\"\n+ }\n+ }\n+ ]\n+ \"Then\": \"flex-layout.row#just-for-this-binding\",\n+ \"Else\": \"flex-layout.row#for-other-bindings\"\n+ }\n+ }\n```\n\nOr for `condition-layout.category`:\n\n ```diff\n {\n \"store.product\": {\n \"children\": [\"condition-layout.category#cond42\"]\n },\n \"condition-layout.category#cond42\": {\n + \"props\": {\n + \"conditions\": [\n + {\n + \"subject\": \"department\",\n + \"arguments\": {\n + \"ids\": [\"1\", \"42\"]\n + }\n + }\n + {\n + \"subject\": \"category\",\n + \"arguments\": {\n + \"ids\": [\"301\", \"304\"]\n + }\n + }\n + ]\n + \"matchType\": \"any\",\n + \"Then\": \"flex-layout.row#just-for-this-category-or-department\",\n + \"Else\": \"flex-layout.row#for-other-category-or-department\"\n + }\n + }\n ```\n\nOr for `condition-layout.telemarketing`:\n\n```diff\n{\n \"store.product\": {\n \"children\": [\"condition-layout.telemarketing#show-block\"]\n },\n \"condition-layout.telemarketing#show-block\": {\n+ \"props\": {\n+ \"conditions\": [\n+ {\n+ \"subject\": \"impersonable\",\n+ \"arguments\": {\n+ \"value\": true\n+ }\n+ }\n+ ]\n+ \"Then\": \"flex-layout.row#just-for-telemarketers\",\n+ \"Else\": \"flex-layout.row#for-other-user-roles\"\n+ }\n+ }\n```\n\n>ℹ️ In the example above, whenever users interact with a product whose ID is equal to 12, the `flex-layout.row#custom-pdp-layout-12` block is rendered. If users interact with a product whose ID is not equal to 12, the rendered block is `flex-layout.row#default`.\n\n| Prop name | Type | Description | Default value |\n| - | - | - | - |\n| `conditions` | `object` | List of desired conditions. | `undefined` |\n| `matchType` | `enum` | Layout rendering criteria. Possible values are: `all` (all conditions must be met to render the layout), `any` (at least one of the conditions must be met to render the layout), or `none` (no conditions must be met to render the layout). | `all` |\n| `Then` | `block` | Name of the block to be rendered if the conditions are met. If no value is defined, the blocks declared as children of `condition-layout.product` will be rendered instead. | `undefined` |\n| `Else` | `block` | Name of the block to be rendered if the conditions are not met. | `undefined` |\n\n- **`conditions` object:**\n\n| Prop name | Type | Description | Default value |\n| - | - | - | - |\n| `subject` | `string` | Defines, based on the product context where the block is declared, which information is needed from the UI to validate the value chosen in the `object` prop. See below the possible values for this prop. | `undefined` |\n| `arguments` | `object` | Defines the condition parameters. Note that the value of this prop varies depending on the value set for the `subject` prop. See below the table with the possible values for the `subject` prop and their expected arguments. | `undefined` |\n| `toBe` | `boolean` | Determines whether the data fetched in the `subject` prop must meet the predefined conditions to render the new layout (`true`) or not (`false`). | `true` |\n\nPossible values for `subject` prop of the `condition-layout.product` block:\n\n| Subject | Description | Arguments |\n| - | - | - |\n| `productId` | Product IDs currently displayed on the UI. | `{ id: string }` |\n| `categoryId` | Category IDs currently displayed on the UI. | `{ id: string }` |\n| `brandId` | Brand IDs currently displayed on the UI. | `{ id: string }` |\n| `selectedItemId` | ID of the item currently selected by the user. | `{ id: string }` |\n| `productClusters` | List of product clusters currently displayed on the UI. | `{ id: string }` |\n| `categoryTree` | List of categories currently displayed on the UI. **Note:** Only available on the Product Detail Page. | `{ id: string }` |\n| `specificationProperties` | List of product specifications currently displayed on the UI. | `{ name: string, value: string }`. Note: `value` is an optional prop. If omitted, only the specification name (`name`) will be checked. |\n| `areAllVariationsSelected` | Determines whether all product variations currently available on the UI were selected by the user (`true`) or not (`false`). | No arguments are expected. |\n| `isProductAvailable` | Determines whether the product is available (`true`) or not (`false`). | No arguments are expected. |\n| `hasMoreSellersThan` | Determines whether the number of sellers for a product is greater than the argument passed. | `{ quantity: number }` |\n| `hasBestPrice` | Whether the product is being given a discount on its list price. | `{ value: boolean }` or no arguments. |\n| `sellerId` | Whether any of the sellers of the product are included in the list of IDs passed. | `{ ids: string[] }` |\n\nPossible values for the `subject` prop of the `condition-layout.binding` block:\n\n| Subject | Description | Arguments |\n| ----------- | -------------------------------- | ---------------- |\n| `bindingId` | ID of the desired store binding. | `{ id: string }` |\n\nPossible values for the `subject` prop of the `condition-layout.category` block:\n\n| Subject | Description | Arguments |\n| ------------ | --------------------------------------------- | ------------------- |\n| `category` | Category IDs currently displayed on the UI. | `{ ids: string[] }` |\n| `department` | Department IDs currently displayed on the UI. | `{ ids: string[] }` |\n\nPossible values for the `subject` prop of the `condition-layout.telemarketing` block:\n\n| Subject | Description | Arguments |\n| -------------- | ----------------------------------- | -------------------- |\n| `impersonable` | Value of the impersonation setting. | `{ value: boolean }` |\n\n## App behavior\n\nThe `condition-layout.product` block mainly uses the `matchType` and `conditions` props to respectively set the criteria and the conditions that blocks must meet to be rendered.\n\nThe `conditions` prop does not rely on any automatic grammar to define the desired conditions. Instead, it relies on its two props, namely `subject` and `arguments`, which together define which condition must be met by using an underlying data validation method (with specific arguments) based on the UI behavior.\n\nLastly, the `matchType` prop decides the necessary number of valid conditions for the layout rendering.\n\n## Customization\n\nThe Condition Layout merely establishes a logic to render other blocks. Therefore, the app does not have its own CSS handles for customization.\n\nInstead, you should use the handles of the child blocks.\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes out 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<table>\n <tr>\n <td align=\"center\"><a href=\"https://github.com/LucasCastroAcctGlobal\"><img src=\"https://avatars0.githubusercontent.com/u/55210107?v=4?s=100\" width=\"100px;\" alt=\"\"/><br /><sub><b>LucasCastroAcctGlobal</b></sub></a><br /><a href=\"https://github.com/vtex-apps/condition-layout/commits?author=LucasCastroAcctGlobal\" title=\"Code\">💻</a></td>\n <td align=\"center\"><a href=\"https://github.com/vini-lima-acct\"><img src=\"https://avatars.githubusercontent.com/u/78028684?v=4?s=100\" width=\"100px;\" alt=\"\"/><br /><sub><b>vini-lima-acct</b></sub></a><br /><a href=\"https://github.com/vtex-apps/condition-layout/commits?author=vini-lima-acct\" title=\"Code\">💻</a></td>\n </tr>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\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_condition-layout_ba944bbd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/ConditionLayoutTelemarketing.tsx from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo } from 'react'\nimport type { ComponentType } from 'react'\nimport { useFullSession } from 'vtex.session-client'\n\nimport ConditionLayout from './ConditionLayout'\nimport type { MatchType, Condition, Handlers, NoUndefinedField } from './types'\n\ntype Props = {\n conditions: Array<Condition<ContextValues, HandlerArguments>>\n matchType?: MatchType\n Else?: ComponentType\n Then?: ComponentType\n}\n\ntype ContextValues = {\n impersonable: boolean\n}\n\ntype HandlerArguments = {\n impersonable: { value: boolean }\n}\n\nconst HANDLERS: Handlers<ContextValues, HandlerArguments> = {\n impersonable({ values, args }) {\n return values.impersonable === args?.value\n },\n}\n\nconst ConditionLayoutTelemarketing: StorefrontFunctionComponent<Props> = ({\n Else,\n Then,\n matchType,\n conditions,\n children,\n}) => {\n const { data } = useFullSession()\n\n const impersonable = Boolean(\n data?.session?.namespaces?.impersonate?.canImpersonate?.value\n )\n\n const values = useMemo<ContextValues>(() => {\n const bag = {\n impersonable,\n }\n\n // We use `NoUndefinedField` to remove optionality + undefined values from the type\n return bag as NoUndefinedField<typeof bag>\n }, [impersonable])\n\n return (\n <ConditionLayout\n Else={Else}\n Then={Then}\n matchType={matchType}\n conditions={conditions}\n values={values}\n handlers={HANDLERS}\n >\n {children}\n </ConditionLayout>\n )\n}\n\nexport default ConditionLayoutTelemarketing\n\n```"
}
] |
code_condition-layout_2049d947
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/ConditionLayout.test.tsx from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\n\nimport ConditionLayout from './ConditionLayout'\nimport type { Condition } from './types'\n\ntest('Renders a condition that resolves to true', () => {\n const { queryByText } = render(\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '37' },\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === '37',\n }}\n values={{}}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n})\n\ntest('Renders a condition that resolves to false with toBe: false', () => {\n const { queryByText } = render(\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '100' },\n toBe: false,\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === '37',\n }}\n values={{}}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n})\n\ntest('Renders the Then slot if a condition resolves to true', () => {\n const ThenSlot = () => <>Hooray!</>\n\n const { queryByText } = render(\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '37' },\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === '37',\n }}\n values={{}}\n Then={ThenSlot}\n />\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n})\n\ntest('Prevents children from being rendered if Then is set', () => {\n const ThenSlot = () => <>Hooray!</>\n\n const { queryByText } = render(\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '37' },\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === '37',\n }}\n values={{}}\n Then={ThenSlot}\n >\n Potato!!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n expect(queryByText(/Potato/)).not.toBeInTheDocument()\n})\n\ntest('Renders nothing if no condition matches', () => {\n const { container } = render(\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '39' },\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === '37',\n }}\n values={{}}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(container).toBeEmptyDOMElement()\n})\n\ntest('Renders the else Slot if no condition matches', () => {\n const ElseSlot = () => <>Oh no!</>\n\n const { queryByText } = render(\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '39' },\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === '37',\n }}\n values={{}}\n Else={ElseSlot}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n expect(queryByText(/Oh no!/)).toBeInTheDocument()\n})\n\ntest(\"Doesn't render the else block if some condition match\", () => {\n const ElseSlot = () => <>Oh no!</>\n\n const { queryByText } = render(\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '37' },\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === '37',\n }}\n values={{}}\n Else={ElseSlot}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n expect(queryByText(/Oh no!/)).not.toBeInTheDocument()\n})\n\ntest('Switches from rendering a matched condition to the else component', () => {\n const ElseSlot = () => <>Oh no!</>\n\n let id = '37'\n\n const layout = (\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '37' },\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === id,\n }}\n values={{}}\n Else={ElseSlot}\n >\n Hooray!\n </ConditionLayout>\n )\n\n const { queryByText, rerender } = render(layout)\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n expect(queryByText(/Oh no!/)).not.toBeInTheDocument()\n\n // wrong id\n id = '38'\n\n rerender(layout)\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n expect(queryByText(/Oh no!/)).toBeInTheDocument()\n})\n\ntest('Switches from rendering the else component to a matched condition component', () => {\n const ElseSlot = () => <>Oh no!</>\n\n // wrong id\n let id = '38'\n\n const layout = (\n <ConditionLayout\n conditions={[\n {\n subject: 'selectedItemId',\n arguments: { id: '37' },\n },\n ]}\n handlers={{\n selectedItemId: ({ args }: any) => args.id === id,\n }}\n values={{}}\n Else={ElseSlot}\n >\n Hooray!\n </ConditionLayout>\n )\n\n const { queryByText, rerender } = render(layout)\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n expect(queryByText(/Oh no!/)).toBeInTheDocument()\n\n // correct id\n id = '37'\n\n rerender(layout)\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n expect(queryByText(/Oh no!/)).not.toBeInTheDocument()\n})\n\ndescribe('multiple conditions', () => {\n describe('matchType: all', () => {\n it('returns true for a composed condition', () => {\n const handlers = {\n potatoId({ values, args }: unknown) {\n return values.potatoId === args.potatoId\n },\n kiwiId({ values, args }: unknown) {\n return values.kiwiId === args.kiwiId\n },\n }\n\n const conditions: Condition[] = [\n {\n subject: 'potatoId',\n arguments: {\n potatoId: 'correct',\n },\n },\n {\n subject: 'kiwiId',\n arguments: {\n kiwiId: 'correct',\n },\n },\n ]\n\n const values = {\n potatoId: 'correct',\n kiwiId: 'correct',\n }\n\n const { queryByText } = render(\n <ConditionLayout\n matchType=\"all\"\n conditions={conditions}\n handlers={handlers}\n values={values}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n\n it('returns false for a composed condition', () => {\n const handlers = {\n potatoId({ values, args }: unknown) {\n return values.potatoId === args.potatoId\n },\n kiwiId({ values, args }: unknown) {\n return values.kiwiId === args.kiwiId\n },\n }\n\n const conditions: Condition[] = [\n {\n subject: 'potatoId',\n arguments: {\n potatoId: 'correct',\n },\n },\n {\n subject: 'kiwiId',\n arguments: {\n kiwiId: 'wrong',\n },\n },\n ]\n\n const values = {\n potatoId: 'correct',\n kiwiId: 'correct',\n }\n\n const { queryByText } = render(\n <ConditionLayout\n matchType=\"all\"\n conditions={conditions}\n handlers={handlers}\n values={values}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n })\n })\n\n describe('matchType: any', () => {\n // simple 'any' conditions are the same as 'all' conditions\n\n it('returns true for a composed condition', () => {\n const handlers = {\n potatoId({ values, args }: unknown) {\n return values.potatoId === args.potatoId\n },\n kiwiId({ values, args }: unknown) {\n return values.kiwiId === args.kiwiId\n },\n }\n\n const conditions: Condition[] = [\n {\n subject: 'potatoId',\n arguments: {\n potatoId: 'wrong',\n },\n },\n {\n subject: 'kiwiId',\n arguments: {\n kiwiId: 'correct',\n },\n },\n ]\n\n const values = {\n potatoId: 'correct',\n kiwiId: 'correct',\n }\n\n const { queryByText } = render(\n <ConditionLayout\n matchType=\"any\"\n conditions={conditions}\n handlers={handlers}\n values={values}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n\n it('returns false for a composed condition', () => {\n const handlers = {\n potatoId({ values, args }: unknown) {\n return values.potatoId === args.potatoId\n },\n kiwiId({ values, args }: unknown) {\n return values.kiwiId === args.kiwiId\n },\n }\n\n const conditions: Condition[] = [\n {\n subject: 'potatoId',\n arguments: {\n potatoId: 'wrong',\n },\n },\n {\n subject: 'kiwiId',\n arguments: {\n kiwiId: 'wrong',\n },\n },\n ]\n\n const values = {\n potatoId: 'correct',\n kiwiId: 'correct',\n }\n\n const { queryByText } = render(\n <ConditionLayout\n matchType=\"any\"\n conditions={conditions}\n handlers={handlers}\n values={values}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n })\n })\n\n describe('matchType: none', () => {\n it('returns true for a composed condition', () => {\n const handlers = {\n potatoId({ values, args }: unknown) {\n return values.potatoId === args.potatoId\n },\n kiwiId({ values, args }: unknown) {\n return values.kiwiId === args.kiwiId\n },\n }\n\n const conditions: Condition[] = [\n {\n subject: 'potatoId',\n arguments: {\n potatoId: 'wrong',\n },\n },\n {\n subject: 'kiwiId',\n arguments: {\n kiwiId: 'wrong',\n },\n },\n ]\n\n const values = {\n potatoId: 'correct',\n kiwiId: 'correct',\n }\n\n const { queryByText } = render(\n <ConditionLayout\n matchType=\"none\"\n conditions={conditions}\n handlers={handlers}\n values={values}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n\n it('returns false for a composed condition', () => {\n const handlers = {\n potatoId({ values, args }: unknown) {\n return values.potatoId === args.potatoId\n },\n kiwiId({ values, args }: unknown) {\n return values.kiwiId === args.kiwiId\n },\n }\n\n const conditions: Condition[] = [\n {\n subject: 'potatoId',\n arguments: {\n potatoId: 'wrong',\n },\n },\n {\n subject: 'kiwiId',\n arguments: {\n kiwiId: 'correct',\n },\n },\n ]\n\n const values = {\n potatoId: 'correct',\n kiwiId: 'correct',\n }\n\n const { queryByText } = render(\n <ConditionLayout\n matchType=\"none\"\n conditions={conditions}\n handlers={handlers}\n values={values}\n >\n Hooray!\n </ConditionLayout>\n )\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n })\n })\n})\n\n```"
}
] |
code_condition-layout_079dcf56
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/ConditionLayoutProduct.tsx from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo } from 'react'\nimport { useProduct } from 'vtex.product-context'\nimport type { Product, Item } from 'vtex.product-context/react/ProductTypes'\n\nimport ConditionLayout from './ConditionLayout'\nimport type { NoUndefinedField, MatchType, Condition, Handlers } from './types'\n\ntype Props = {\n conditions: Array<Condition<ContextValues, HandlerArguments>>\n matchType?: MatchType\n Else?: React.ComponentType\n Then?: React.ComponentType\n}\n\ntype ContextValues = {\n productId: Product['productId']\n categoryId: Product['categoryId']\n brandId: Product['brandId']\n productClusters: Product['productClusters']\n categoryTree: Product['categoryTree']\n selectedItemId: Item['itemId']\n specificationProperties: Product['properties']\n areAllVariationsSelected: boolean\n sellers: Item['sellers']\n}\n\ntype HandlerArguments = {\n productId: { id: string }\n categoryId: { id: string }\n brandId: { id: string }\n productClusters: { id: string }\n categoryTree: { id: string }\n selectedItemId: { id: string }\n specificationProperties: { name: string; value?: string }\n areAllVariationsSelected: undefined\n isProductAvailable: undefined\n hasMoreSellersThan: { quantity: number }\n hasBestPrice: { value: boolean } | undefined\n sellerId: { ids: string[] }\n}\n\nexport const HANDLERS: Handlers<ContextValues, HandlerArguments> = {\n productId({ values, args }) {\n return String(values.productId) === String(args?.id)\n },\n categoryId({ values, args }) {\n return String(values.categoryId) === String(args?.id)\n },\n brandId({ values, args }) {\n return String(values.brandId) === String(args?.id)\n },\n selectedItemId({ values, args }) {\n return String(values.selectedItemId) === String(args?.id)\n },\n areAllVariationsSelected({ values }) {\n return values.areAllVariationsSelected\n },\n productClusters({ values, args }) {\n return Boolean(\n values.productClusters?.find(({ id }) => String(id) === String(args?.id))\n )\n },\n categoryTree({ values, args }) {\n return Boolean(\n values?.categoryTree?.find(({ id }) => String(id) === String(args?.id))\n )\n },\n specificationProperties({ values, args }) {\n const specification = values.specificationProperties?.find(\n ({ name }) => name === args?.name\n )\n\n if (specification == null) return false\n if (args?.value == null) return Boolean(specification)\n\n return specification.values.includes(String(args?.value))\n },\n isProductAvailable({ values }) {\n const { sellers } = values\n\n const isAvailable = sellers?.some(\n (seller) => seller.commertialOffer.AvailableQuantity > 0\n )\n\n return Boolean(isAvailable)\n },\n hasMoreSellersThan({ values, args }) {\n const { sellers } = values\n\n const productAvailable = sellers?.filter(\n (seller) => seller.commertialOffer.AvailableQuantity > 0\n )\n\n const isMoreThan = productAvailable?.length > args?.quantity\n\n return isMoreThan\n },\n hasBestPrice({ values, args }) {\n const {\n commertialOffer: { ListPrice, Price },\n } =\n values.sellers?.find(({ sellerDefault }) => sellerDefault) ??\n // Falls back to first seller, if no default is found.\n values.sellers[0]\n\n const expected = args?.value ?? true\n const hasDiscount = ListPrice !== Price\n\n return hasDiscount === expected\n },\n sellerId({ values, args }) {\n const { sellers } = values\n\n const availableSellers = sellers?.filter(\n (seller) => seller.commertialOffer.AvailableQuantity > 0\n )\n\n const matchSellers = availableSellers?.some((availableSeller) =>\n args?.ids?.includes(availableSeller.sellerId)\n )\n\n return matchSellers\n },\n}\n\nconst ConditionLayoutProduct: StorefrontFunctionComponent<Props> = ({\n Else,\n Then,\n matchType,\n conditions,\n children,\n}) => {\n const {\n product,\n selectedItem,\n skuSelector: { areAllVariationsSelected = false } = {},\n } = useProduct() ?? {}\n\n const {\n productId,\n categoryId,\n brandId,\n productClusters,\n categoryTree,\n properties: specificationProperties,\n } = product ?? {}\n\n const { itemId: selectedItemId, sellers } = selectedItem ?? {}\n\n // We use a useMemo to modify the condition layout \"values\"\n // only when some of the context props change.\n const values = useMemo<ContextValues>(() => {\n const bag = {\n productId,\n categoryId,\n brandId,\n productClusters,\n categoryTree,\n selectedItemId,\n specificationProperties,\n areAllVariationsSelected,\n sellers,\n }\n\n // We use `NoUndefinedField` to remove optionality + undefined values from the type\n return bag as NoUndefinedField<typeof bag>\n }, [\n brandId,\n categoryId,\n categoryTree,\n productClusters,\n productId,\n selectedItemId,\n specificationProperties,\n areAllVariationsSelected,\n sellers,\n ])\n\n // Sometimes it takes a while for useProduct() to return the correct results\n if (values.selectedItemId == null || values.productId == null) {\n return null\n }\n\n return (\n <ConditionLayout\n Else={Else}\n Then={Then}\n matchType={matchType}\n conditions={conditions}\n values={values}\n handlers={HANDLERS}\n >\n {children}\n </ConditionLayout>\n )\n}\n\nConditionLayoutProduct.schema = {\n title: 'admin/editor.condition-layout.wrapper.product',\n}\n\nexport default ConditionLayoutProduct\n\n```"
}
] |
code_condition-layout_43500643
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/ConditionLayoutCategory.tsx from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo } from 'react'\nimport type { ComponentType } from 'react'\nimport { useRuntime } from 'vtex.render-runtime'\n\nimport ConditionLayout from './ConditionLayout'\nimport type { NoUndefinedField, MatchType, Condition, Handlers } from './types'\n\ninterface Props {\n conditions: Array<Condition<ContextValues, HandlerArguments>>\n matchType?: MatchType\n Else?: ComponentType\n Then?: ComponentType\n}\n\ninterface ContextValues {\n [key: string]: string\n id: string\n type: 'category' | 'department'\n}\n\ninterface HandlerArguments {\n category: { ids: string[] }\n department: { ids: string[] }\n}\n\nconst handlersMap: Handlers<ContextValues, HandlerArguments> = {\n category({ values, args }) {\n if (values.type !== 'category') {\n return false\n }\n\n return args.ids.includes(values.id)\n },\n department({ values, args }) {\n if (values.type !== 'department') {\n return false\n }\n\n return args.ids.includes(values.id)\n },\n}\n\nconst ConditionLayoutCategory: StorefrontFunctionComponent<Props> = ({\n Else,\n Then,\n matchType,\n conditions,\n children,\n}) => {\n const {\n route: {\n pageContext: { id, type },\n },\n } = useRuntime()\n\n const values = useMemo<ContextValues>(() => {\n const bag = {\n id,\n type,\n }\n\n // We use `NoUndefinedField` to remove optionality + undefined values from the type\n return bag as NoUndefinedField<typeof bag>\n }, [id, type])\n\n return (\n <ConditionLayout\n Else={Else}\n Then={Then}\n matchType={matchType}\n conditions={conditions}\n values={values}\n handlers={handlersMap}\n >\n {children}\n </ConditionLayout>\n )\n}\n\nexport default ConditionLayoutCategory\n\n```"
}
] |
code_condition-layout_81a88a2a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/types.ts from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport type NoUndefinedField<T> = {\n [P in keyof T]-?: Exclude<T[P], undefined>\n}\n\nexport type MatchType = 'any' | 'all' | 'none'\n\ntype SameProps<T> = Record<keyof T, unknown>\n\nexport type Condition<Subjects = unknown, Args = unknown> = {\n toBe?: boolean\n} & (Args extends SameProps<Subjects>\n ? {\n [K in keyof Subjects]: Args[K] extends undefined\n ? { subject: K }\n : { subject: K; arguments: Args[K] }\n }[keyof Subjects]\n : { subject: string; arguments?: unknown })\n\nexport type Handler<Values, Args> = (o: {\n values: Values\n args: Args\n}) => boolean\n\nexport type Handlers<Values, Args> = {\n [K in keyof Args]: Handler<Values, Args[K]>\n}\n\n```"
}
] |
code_condition-layout_d2d7ff2b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/ConditionLayoutProduct.test.tsx from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react'\nimport { render } from '@vtex/test-tools/react'\nimport { useProduct } from 'vtex.product-context'\nimport type { ProductContextState } from 'vtex.product-context/react/ProductContextProvider'\n\nimport ConditionLayoutProduct from './ConditionLayoutProduct'\n\nconst mockedUseProduct = useProduct as jest.Mock<ProductContextState>\n\nfunction getMockedProduct({\n skuId = '37',\n productId = 'prod-id',\n categoryId = 'cat-id',\n brandId = 'brand-id',\n clusterId = 'cluster1',\n catTreeId = 'cat1',\n propName = 'prop1',\n propValue = 'value1',\n areAllVariationsSelected = false,\n} = {}): ProductContextState {\n return ({\n product: {\n productId,\n categoryId,\n brandId,\n productClusters: [{ id: clusterId, name: 'cluster 1' }],\n categoryTree: [{ id: catTreeId, name: 'cat 1', href: '' }],\n properties: [{ name: propName, values: propValue }],\n },\n selectedItem: { itemId: skuId },\n skuSelector: { areAllVariationsSelected },\n } as any) as ProductContextState\n}\n\ntest('renders nothing if no product context is available', () => {\n mockedUseProduct.mockImplementation(() => undefined as any)\n\n const { container } = render(\n <ConditionLayoutProduct\n conditions={[{ subject: 'selectedItemId', arguments: { id: '37' } }]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(container).toBeEmptyDOMElement()\n})\n\ndescribe('subject: selectedItemId', () => {\n it('Renders a condition that resolves to true', () => {\n mockedUseProduct.mockImplementation(() => getMockedProduct({ skuId: '37' }))\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[{ subject: 'selectedItemId', arguments: { id: '37' } }]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n\n it('Renders the Then slot of a condition that resolves to true', () => {\n const thenSlot = () => <>Hooray!</>\n\n mockedUseProduct.mockImplementation(() => getMockedProduct({ skuId: '37' }))\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[{ subject: 'selectedItemId', arguments: { id: '37' } }]}\n Then={thenSlot}\n />\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n\n it('Renders the Else slot of a condition that resolves to false', () => {\n mockedUseProduct.mockImplementation(() => getMockedProduct({ skuId: '37' }))\n\n const ElseComponent = () => <>Nope</>\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[{ subject: 'selectedItemId', arguments: { id: '39' } }]}\n Else={ElseComponent}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n expect(queryByText(/Nope/)).toBeInTheDocument()\n })\n})\n\ndescribe('subject: productId', () => {\n it('Renders a condition that resolves to true', () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ productId: 'prod-2' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[{ subject: 'productId', arguments: { id: 'prod-2' } }]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n})\n\ndescribe('subject: categoryId', () => {\n it('Renders a condition that resolves to true', () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ categoryId: 'cat-2' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[{ subject: 'categoryId', arguments: { id: 'cat-2' } }]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n})\n\ndescribe('subject: brandId', () => {\n it('Renders a condition that resolves to true', () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ brandId: 'brand-2' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[{ subject: 'brandId', arguments: { id: 'brand-2' } }]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n})\n\ndescribe('subject: productClusters', () => {\n it('Renders a condition that resolves to true', () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ clusterId: 'cluster-1' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[\n { subject: 'productClusters', arguments: { id: 'cluster-1' } },\n ]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n})\n\ndescribe('subject: category tree', () => {\n it('Renders a condition that resolves to true', () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ catTreeId: 'cat-1' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[{ subject: 'categoryTree', arguments: { id: 'cat-1' } }]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n})\n\ndescribe('subject: specification properties', () => {\n it('renders a true condition with just the name', () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ propName: 'prop-1' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[\n { subject: 'specificationProperties', arguments: { name: 'prop-1' } },\n ]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n\n it(\"doesn't render when specification doesn't exist\", () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ propName: 'prop-1' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[\n {\n subject: 'specificationProperties',\n arguments: { name: 'non-existing' },\n },\n ]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n })\n\n it('renders a true condition with name and value', () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ propName: 'prop-2', propValue: 'potato' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[\n {\n subject: 'specificationProperties',\n arguments: { name: 'prop-2', value: 'potato' },\n },\n ]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n\n it(\"doens't render when value doesn't exist\", () => {\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ propName: 'prop-2', propValue: 'potato' })\n )\n\n const { queryByText } = render(\n <ConditionLayoutProduct\n conditions={[\n {\n subject: 'specificationProperties',\n arguments: { name: 'prop-2', value: 'ice-cream' },\n },\n ]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n })\n})\n\ndescribe('subject: areAllVariationsSelected', () => {\n it('renders a true condition with name and value', () => {\n const ui = (\n <ConditionLayoutProduct\n conditions={[{ subject: 'areAllVariationsSelected' }]}\n >\n Hooray!\n </ConditionLayoutProduct>\n )\n\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ areAllVariationsSelected: false })\n )\n\n const { queryByText, rerender } = render(ui)\n\n expect(queryByText(/Hooray!/)).not.toBeInTheDocument()\n\n mockedUseProduct.mockImplementation(() =>\n getMockedProduct({ areAllVariationsSelected: true })\n )\n\n rerender(ui)\n\n expect(queryByText(/Hooray!/)).toBeInTheDocument()\n })\n})\n\n```"
}
] |
code_condition-layout_3b510a60
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/ConditionLayout.tsx from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { FC } from 'react'\n\nimport { validateConditions } from './modules/conditions'\nimport type { MatchType, Condition } from './types'\n\ntype Props = {\n matchType?: MatchType\n conditions: Condition[]\n values: Record<string, unknown>\n handlers: Record<string, unknown>\n Else?: React.ComponentType\n Then?: React.ComponentType\n}\n\nconst ConditionLayout: FC<Props> = ({\n Else,\n Then,\n conditions,\n children,\n values,\n handlers,\n matchType,\n}) => {\n const result = validateConditions({ matchType, conditions, values, handlers })\n\n if (result) {\n if (Then) {\n return <Then />\n }\n\n return <>{children}</>\n }\n\n if (Else) {\n return <Else />\n }\n\n return null\n}\n\nexport default ConditionLayout\n\n```"
}
] |
code_condition-layout_63607462
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/package.json from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"version\": \"2.8.2\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test --collect-coverage\",\n \"lint\": \"tsc --noEmit && eslint --ext ts,tsx .\"\n },\n \"dependencies\": {\n \"@vtex/css-handles\": \"^1.1.3\",\n \"classnames\": \"^2.2.6\",\n \"react\": \"^16.13.1\",\n \"react-dom\": \"^16.13.1\",\n \"react-intl\": \"^5.8.3\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^4.0.0\",\n \"@types/classnames\": \"^2.2.10\",\n \"@types/jest\": \"^26.0.14\",\n \"@types/node\": \"^14.11.2\",\n \"@types/prop-types\": \"^15.7.3\",\n \"@types/ramda\": \"^0.27.19\",\n \"@types/react\": \"^16.9.49\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"apollo-client\": \"^2.6.10\",\n \"typescript\": \"3.9.7\",\n \"vtex.product-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-context@0.9.2/public/@types/vtex.product-context\",\n \"vtex.render-runtime\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.122.2/public/@types/vtex.render-runtime\",\n \"vtex.styleguide\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.132.1/public/@types/vtex.styleguide\"\n }\n}\n\n```"
}
] |
code_condition-layout_cb0aa6a7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/ConditionLayoutBinding.tsx from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport React, { useMemo } from 'react'\nimport { useRuntime } from 'vtex.render-runtime'\nimport type { ComponentType } from 'react'\n\nimport ConditionLayout from './ConditionLayout'\nimport type { NoUndefinedField, MatchType, Condition, Handlers } from './types'\n\ntype Props = {\n conditions: Array<Condition<ContextValues, HandlerArguments>>\n matchType?: MatchType\n Else?: ComponentType\n Then?: ComponentType\n}\n\ntype ContextValues = {\n bindingId: string\n}\n\ntype HandlerArguments = {\n bindingId: { id: string }\n}\n\nconst HANDLERS: Handlers<ContextValues, HandlerArguments> = {\n bindingId({ values, args }) {\n return String(values.bindingId) === String(args?.id)\n },\n}\n\nconst ConditionLayoutBinding: StorefrontFunctionComponent<Props> = ({\n Else,\n Then,\n matchType,\n conditions,\n children,\n}) => {\n const {\n binding: { id: bindingId },\n } = useRuntime()\n\n const values = useMemo<ContextValues>(() => {\n const bag = {\n bindingId,\n }\n\n // We use `NoUndefinedField` to remove optionality + undefined values from the type\n return bag as NoUndefinedField<typeof bag>\n }, [bindingId])\n\n return (\n <ConditionLayout\n Else={Else}\n Then={Then}\n matchType={matchType}\n conditions={conditions}\n values={values}\n handlers={HANDLERS}\n >\n {children}\n </ConditionLayout>\n )\n}\n\nexport default ConditionLayoutBinding\n\n```"
}
] |
code_condition-layout_3ec7f8f5
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/Noop.tsx from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nconst Noop = () => {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(\n 'Do not use the \"condition-layout\" block directly. Please use the appropriate variation for your context.'\n )\n }\n\n return null\n}\n\nexport default Noop\n\n```"
}
] |
code_condition-layout_2a9be5ac
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/store/contentSchemas.json from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"definitions\": {\n \"ConditionLayoutProduct\": {\n \"title\": \"admin/editor.condition-layout.wrapper.product\"\n },\n \"ConditionProduct\": {\n \"title\": \"admin/editor.condition-layout.condition\",\n \"type\": \"object\",\n \"properties\": {\n \"enabled\": {\n \"title\": \"admin/editor.condition-layout.enabled.title\",\n \"description\": \"admin/editor.condition-layout.enabled.description\",\n \"default\": true,\n \"type\": \"boolean\"\n }\n },\n \"dependencies\": {\n \"enabled\": {\n \"oneOf\": [\n {\n \"properties\": {\n \"enabled\": {\n \"enum\": [true]\n },\n \"match\": {\n \"default\": \"all\",\n \"enum\": [\"any\", \"none\", \"all\"],\n \"title\": \"admin/editor.condition-layout.match\",\n \"type\": \"string\"\n },\n \"conditions\": {\n \"title\": \"admin/editor.condition-layout.conditions\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"subject\": {\n \"default\": \"\",\n \"type\": \"string\",\n \"title\": \"admin/editor.condition-layout.subject\",\n \"enum\": [\n \"productId\",\n \"categoryId\",\n \"brandId\",\n \"productClusters\",\n \"categoryTree\",\n \"specificationProperties\",\n \"selectedItemId\"\n ],\n \"enumNames\": [\n \"admin/editor.condition-layout.product.subject.productId\",\n \"admin/editor.condition-layout.product.subject.categoryId\",\n \"admin/editor.condition-layout.product.subject.brandId\",\n \"admin/editor.condition-layout.product.subject.productClusters\",\n \"admin/editor.condition-layout.product.subject.categoryTree\",\n \"admin/editor.condition-layout.product.subject.specificationProperties\",\n \"admin/editor.condition-layout.product.subject.selectedItemId\"\n ]\n },\n \"verb\": {\n \"type\": \"string\",\n \"title\": \"admin/editor.condition-layout.verb\"\n },\n \"object\": {\n \"type\": \"string\",\n \"title\": \"admin/editor.condition-layout.object\"\n }\n },\n \"dependencies\": {\n \"subject\": {\n \"oneOf\": [\n {\n \"properties\": {\n \"subject\": {\n \"enum\": [\n \"productClusters\",\n \"categoryTree\",\n \"specificationProperties\"\n ]\n },\n \"verb\": {\n \"default\": \"contains\",\n \"enum\": [\"contains\", \"does-not-contain\"],\n \"enumNames\": [\n \"admin/editor.condition-layout.verb.contains\",\n \"admin/editor.condition-layout.verb.does-not-contain\"\n ]\n }\n }\n },\n {\n \"properties\": {\n \"subject\": {\n \"enum\": [\n \"productId\",\n \"categoryId\",\n \"brandId\",\n \"selectedItemId\"\n ]\n },\n \"verb\": {\n \"default\": \"is\",\n \"enum\": [\"is\", \"is-not\"],\n \"enumNames\": [\n \"admin/editor.condition-layout.verb.is\",\n \"admin/editor.condition-layout.verb.is-not\"\n ]\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n }\n ]\n }\n }\n },\n \"ConditionElse\": {\n \"title\": \"admin/editor.condition-layout.else\",\n \"type\": \"object\",\n \"properties\": {\n \"enabled\": {\n \"default\": true,\n \"title\": \"admin/editor.condition-layout.enabled.title\",\n \"type\": \"boolean\"\n }\n }\n }\n }\n}\n\n```"
}
] |
code_condition-layout_d730a36b
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/store/interfaces.json from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"condition-layout\": {\n \"component\": \"Noop\"\n },\n \"condition-layout.product\": {\n \"component\": \"ConditionLayoutProduct\",\n \"composition\": \"children\",\n \"content\": {\n \"$ref\": \"app:vtex.condition-layout#/definitions/ConditionLayoutProduct\"\n }\n },\n \"condition-layout.binding\": {\n \"component\": \"ConditionLayoutBinding\",\n \"composition\": \"children\"\n },\n \"condition-layout.category\": {\n \"component\": \"ConditionLayoutCategory\",\n \"composition\": \"children\"\n }, \n \"condition-layout.telemarketing\": {\n \"component\": \"ConditionLayoutTelemarketing\",\n \"composition\": \"children\"\n }\n}\n\n```"
}
] |
code_condition-layout_bd36d02e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/typings/storefront.d.ts from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\n/* eslint-disable @typescript-eslint/ban-types */\nimport { FunctionComponent } from 'react'\n\ndeclare global {\n interface StorefrontFunctionComponent<P = {}> extends FunctionComponent<P> {\n getSchema?(props: P): object\n schema?: object\n }\n\n interface StorefrontComponent<P = {}, S = {}> extends Component<P, S> {\n getSchema?(props: P): object\n schema: object\n }\n}\n\n```"
}
] |
code_condition-layout_b22626ad
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of condition-layout/react/modules/conditions.ts from the condition-layout VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nimport { Condition, MatchType } from '../types'\n\nexport function validateConditions({\n matchType = 'all',\n conditions,\n values,\n handlers,\n}: {\n matchType?: MatchType\n conditions: Condition[]\n values: Record<string, unknown>\n handlers: Record<string, unknown>\n}) {\n const matches = conditions.reduce((acc: boolean | null, condition) => {\n const { subject, arguments: args, toBe = true } = condition\n const handler = handlers[subject]\n\n // istanbul ignore next\n if (typeof handler !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n `Invalid subject \"${subject}\". Must be one of \"${Object.keys(\n handlers\n ).join(', ')}\".`\n )\n }\n\n return acc\n }\n\n const conditionMatch = handler({ values, args }) === toBe\n\n if (matchType === 'any') {\n return (acc ?? false) || conditionMatch\n }\n\n if (matchType === 'none') {\n return (acc ?? true) && !conditionMatch\n }\n\n // matchType === all\n return (acc ?? true) && conditionMatch\n }, null)\n\n return matches\n}\n\n```"
}
] |
code_facebook-pixel_8e55d1dd
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of facebook-pixel/docs/README.md from the facebook-pixel VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n# Facebook pixel\n\nVTEX Facebook Pixel first-party app allows you to connect your store to the Facebook ad services. You will be able to create ads and manage campaigns in real time through a Facebook \"Ads Manager\" account.\n\n## Intalling Facebook pixel app\n\n1. Open the [VTEX App Store](https://apps.vtex.com/vtex-facebook-pixel/p) and install this app on your store, or run the following command on the VTEX IO CLI:\n\n```\nvtex install vtex.facebook-pixel@2.x\n```\n\n2. Now, open the app settings on your [store's Admin](https://your-store-name.myvtex.com/admin/apps).\n3. Click on facebook pixel app, and fill in the Facebook Pixel id.\n\n\n```"
}
] |
code_facebook-pixel_4ec5032a
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of facebook-pixel/react/index.tsx from the facebook-pixel VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { ProductOrder, PixelMessage, Product } from './typings/events'\nimport { canUseDOM } from 'vtex.render-runtime'\n\nfunction handleMessages(e: PixelMessage) {\n switch (e.data.eventName) {\n case 'vtex:pageView': {\n fbq('track', 'PageView')\n break\n }\n case 'vtex:orderPlaced': {\n const { currency, transactionTotal, transactionProducts, orderGroup } = e.data\n\n fbq('track', 'Purchase', {\n value: transactionTotal,\n currency,\n content_type: 'product',\n eventID: orderGroup,\n contents: transactionProducts.map(\n (product: ProductOrder) => ({\n id: product.sku,\n quantity: product.quantity,\n item_price: product.sellingPrice\n })\n )\n });\n break\n }\n case 'vtex:productView': {\n const { product: { productName, items }, currency } = e.data\n\n fbq('track', 'ViewContent', {\n content_ids: items.map(({ itemId }) => itemId),\n content_name: productName,\n content_type: 'product',\n currency,\n value: getProductPrice(e.data.product),\n })\n break\n }\n case 'vtex:addToCart': {\n const { items, currency } = e.data\n\n fbq('track', 'AddToCart', {\n value: items.reduce((acc, item) => acc + item.price, 0) / 100,\n content_ids: items.map(sku => sku.skuId),\n contents: items.map(sku => ({\n id: sku.skuId,\n quantity: sku.quantity,\n item_price: sku.price / 100,\n })),\n content_type: 'product',\n currency: currency,\n })\n break\n }\n default:\n break\n }\n}\n\nfunction getProductPrice(product: Product) {\n let price\n try {\n price = product.items[0].sellers[0].commertialOffer.Price\n } catch {\n price = undefined\n }\n return price\n}\n\n\nif (canUseDOM) {\n window.addEventListener('message', handleMessages)\n}\n\n```"
}
] |
code_facebook-pixel_34631c2e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of facebook-pixel/react/package.json from the facebook-pixel VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"vtex.facebook-pixel\",\n \"version\": \"2.2.3\",\n \"dependencies\": {\n \"ramda\": \"^0.25.0\"\n },\n \"scripts\": {\n \"lint\": \"tsc --noEmit --pretty && tslint -c tslint.json './**/*.ts'\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^10.12.18\",\n \"@types/prop-types\": \"^15.5.6\",\n \"@types/ramda\": \"types/npm-ramda#dist\",\n \"@types/react\": \"^16.4.14\",\n \"tslint\": \"^5.11.0\",\n \"tslint-config-vtex\": \"^2.0.0\",\n \"tslint-eslint-rules\": \"^5.4.0\",\n \"typescript\": \"3.9.7\"\n }\n}\n\n```"
}
] |
code_facebook-pixel_3654f8d7
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of facebook-pixel/store/interfaces.json from the facebook-pixel VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"pixel.facebookPixel\": {\n \"component\": \"index\"\n }\n}\n\n```"
}
] |
code_facebook-pixel_05c9ad56
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of facebook-pixel/react/typings/events.d.ts from the facebook-pixel VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\nexport interface PixelMessage extends MessageEvent {\n data: ProductViewData | ProductClickData | OrderPlacedData | PageViewData | ProductImpressionData | AddToCartData | RemoveToCartData | CategoryViewData | DepartmentViewData\n}\n\nexport interface EventData {\n event: string\n eventName: string\n currency: string\n}\n\nexport interface PageViewData extends EventData {\n event: 'pageView'\n eventName: 'vtex:pageView'\n pageTitle: string\n pageUrl: string\n referrer: string\n}\n\nexport interface CategoryViewData extends EventData {\n event: 'categoryView'\n eventName: 'vtex:categoryView'\n products: Product[]\n}\n\nexport interface DepartmentViewData extends EventData {\n event: 'departmentView'\n eventName: 'vtex:departmentView'\n products: Product[]\n}\n\nexport interface AddToCartData extends EventData {\n event: 'addToCart'\n eventName: 'vtex:addToCart'\n items: AddToCartProduct[]\n}\n\nexport interface RemoveToCartData extends EventData {\n event: 'removeFromCart'\n eventName: 'vtex:removeFromCart'\n items: any[]\n}\n\nexport interface OrderPlacedData extends Order, EventData {\n event: 'orderPlaced'\n eventName: 'vtex:orderPlaced'\n}\n\nexport interface ProductViewData extends EventData {\n event: 'productView'\n eventName: 'vtex:productView'\n product: Product\n}\n\nexport interface ProductClickData extends EventData {\n event: 'productClick'\n eventName: 'vtex:productClick'\n product: Product\n}\n\nexport interface ProductImpressionData extends EventData {\n event: 'productImpression'\n eventName: 'vtex:productImpression'\n product: Product\n position: number\n list: string\n}\n\nexport interface Order {\n currency: string\n accountName: string\n orderGroup: string\n salesChannel: string\n coupon: string\n visitorType: string\n visitorContactInfo: string[]\n transactionId: string\n transactionDate: string\n transactionAffiliation: string\n transactionTotal: number,\n transactionShipping: number,\n transactionTax: number,\n transactionCurrency: string,\n transactionPaymentType: PaymentType[],\n transactionShippingMethod: ShippingMethod[]\n transactionProducts: ProductOrder[]\n transactionPayment: {\n id: string\n }\n}\n\ninterface PaymentType {\n group: string\n paymentSystemName: string\n installments: number\n value: number\n}\n\ninterface ShippingMethod {\n itemId: string\n selectedSla: string\n}\n\ninterface ProductOrder {\n id: string,\n name: string,\n sku: string,\n skuRefId: string,\n skuName: string,\n brand: string,\n brandId: string,\n seller: string,\n sellerId: string,\n category: string,\n categoryId: string,\n categoryTree: string[]\n categoryIdTree: string[]\n originalPrice: number\n price: number\n sellingPrice: number\n tax: number\n quantity: number\n components: any[]\n measurementUnit: string\n unitMultiplier: number\n}\n\nexport interface Product {\n brand: string\n categoryId?: string // inconsistency\n categories: string[]\n productId: string\n productName: string\n selectedSku?: string // inconsistency\n items: Item[]\n sku: Item\n [key: string]: any\n}\n\ninterface Item {\n itemId: string\n name: string\n seller?: Seller\n [key: string]: any\n}\n\ninterface Seller {\n commertialOffer: CommertialOffer\n AvailableQuantity: number\n [key: string]: any\n}\n\ninterface CommertialOffer {\n Price: number\n [key: string]: any\n}\n\ninterface AddToCartProduct {\n brand: string\n name: string\n price: number\n quantity: number\n skuId: string\n variant: string\n}\n\n```"
}
] |
code_facebook-pixel_7571f6f0
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of facebook-pixel/react/typings/vtex.render-runtime.d.ts from the facebook-pixel VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare module 'vtex.render-runtime' {\n export const canUseDOM: boolean\n}\n\n```"
}
] |
code_facebook-pixel_27c24f20
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of facebook-pixel/react/typings/global.d.ts from the facebook-pixel VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```typescript\ndeclare function fbq(s: string, t: string, o?: any): void\n\ninterface Event extends Event {\n data: any\n}\n\ninterface Window extends Window {\n __SETTINGS__: {\n pixelId: string\n }\n}\n\n```"
}
] |
code_sponsored-products_135045c9
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of sponsored-products/docs/README.md from the sponsored-products VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```markdown\n📢 Use this project, [contribute](https://github.com/vtex-apps/sponsored-products) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion).\n\n# Sponsored Products\n\n<!-- DOCS-IGNORE:start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n\n[](#contributors-)\n\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- DOCS-IGNORE:end -->\n\nVTEX Sponsored Products is responsible for implementing the necessary frontend apps to properly render the sponsored products.\n\n:warning: Keep in mind that this app alone **will not** request the sponsored products; it will only add the \"Sponsored\" badge and add the Analytics wrapper.\n\n\n\n## Configuration\n\n### Step 1: Adding the Sponsored Products app to your theme's dependency\n\nIn your theme's `manifest.json`, add the Sponsored Products app as a dependency:\n\n```json\n \"dependencies\": {\n \"vtex.sponsored-products\": \"0.x\"\n }\n```\n\nNow, you are able to use all the blocks exported by the `sponsored-products` app. Check out the full list below:\n\n#### `sponsored-products` blocks\n\n| Block name | Description |\n| ----------------- | -------------------------------------------------------------------------------------------------------------- |\n| `sponsored-badge` | Renders the \"Sponsored\" badge in your Product Summary. You can customize its CSS however fits best your store. |\n| `ads-analytics` | Necessary for observing impression and click metrics to assess the performance of the campaigns |\n\n### Step 2: Using the Sponsored Products blocks\n\n#### The sponsored badge\n\nThis is fairly straightforward: simply call it as a child block on you Product Summary shelf. For example:\n\n```diff\n\"product-summary.shelf\": {\n \"children\": [\n \"stack-layout#prodsum\",\n \"product-summary-space\",\n+ \"sponsored-badge\",\n \"product-summary-name\",\n \"flex-layout.col#productRating\",\n \"product-summary-space\",\n \"product-list-price#summary\",\n \"flex-layout.row#selling-price-savings\",\n \"product-installments#summary\",\n \"add-to-cart-button\"\n ]\n},\n```\n\nThey can also be added anywhere where a product is in context. For instance, in a product carrousel.\n\n#### The Ads Analytics wrapper\n\nFor this one, you'll need to use the Ads Analytics directly as children of your Gallery block. For instance:\n\n```diff\n\"gallery\": {\n \"props\": {\n \"layouts\": [\n {\n \"name\": \"grid\",\n \"component\": \"GridSummary\",\n \"itemsPerRow\": {\n \"(min-width:1300px)\": 4,\n \"desktop\": 3,\n \"tablet\": 3,\n \"phone\": 2\n }\n },\n {\n \"name\": \"list\",\n \"component\": \"ListSummary\",\n \"itemsPerRow\": 1\n }\n ],\n+ \"ListSummary\": \"ads-analytics#listLayout\",\n+ \"GridSummary\": \"ads-analytics\"\n }\n},\n\n+ \"ads-analytics\": {\n+ \"props\": {\n+ \"ProductSummary\": \"product-summary.shelf\"\n+ }\n+ },\n\n+ \"ads-analytics#listLayout\": {\n+ \"props\": {\n+ \"ProductSummary\": \"product-summary.shelf#listLayout\"\n+ }\n+ },\n\n```\n\n## Blocks\n\n### `sponsored-badge`\n\nNo props are necessary, this component is able to access the current product via context automatically.\n\n### `ads-analytics`\n\n| Prop name | Type | Description | Default value |\n| ---------------- | -------- | ------------------------------------------- | ------------- |\n| `ProductSummary` | `string` | The component used for the Product Summary. | `undefined` |\n\n## Customization\n\nIn order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://vtex.io/docs/recipes/style/using-css-handles-for-store-customization).\n\n| CSS Handles |\n| ----------------------- |\n| `badgeContainer` |\n| `badgeText` |\n| `adsAnalyticsContainer` |\n\n<!-- DOCS-IGNORE:start -->\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n\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_sponsored-products_e9de3369
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of sponsored-products/react/babel.config.js from the sponsored-products VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```javascript\nmodule.exports = {\n presets: [\n '@babel/preset-env',\n ['@babel/preset-react', { runtime: 'automatic' }],\n '@babel/preset-typescript',\n ],\n}\n\n```"
}
] |
code_sponsored-products_9fccb48e
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of sponsored-products/react/package.json from the sponsored-products VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```json\n{\n \"name\": \"sponsored-products\",\n \"version\": \"0.1.0\",\n \"scripts\": {\n \"test\": \"vtex-test-tools test\"\n },\n \"jest\": {\n \"testEnvironment\": \"jsdom\"\n },\n \"dependencies\": {\n \"apollo-client\": \"^2.6.8\",\n \"react\": \"^16.12.0\",\n \"react-apollo\": \"^3.1.3\",\n \"react-dom\": \"^16.12.0\",\n \"react-intl\": \"^3.12.0\",\n \"vtex.css-handles\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/public/@types/vtex.css-handles\"\n },\n \"devDependencies\": {\n \"@apollo/react-testing\": \"^3.1.3\",\n \"@babel/core\": \"^7.23.0\",\n \"@babel/preset-env\": \"^7.22.20\",\n \"@babel/preset-react\": \"^7.22.15\",\n \"@babel/preset-typescript\": \"^7.23.0\",\n \"@faker-js/faker\": \"^8.1.0\",\n \"@types/node\": \"^13.9.8\",\n \"@types/react\": \"^16.9.31\",\n \"@types/rosie\": \"^0.0.43\",\n \"@vtex/test-tools\": \"^3.3.2\",\n \"@vtex/tsconfig\": \"^0.4.4\",\n \"apollo-cache-inmemory\": \"^1.6.5\",\n \"babel-jest\": \"^29.7.0\",\n \"graphql\": \"^14.6.0\",\n \"jest\": \"^26.0.0\",\n \"jest-environment-jsdom\": \"^26.0.0\",\n \"rosie\": \"^2.1.0\",\n \"ts-jest\": \"^29.1.1\",\n \"typescript\": \"3.9.7\",\n \"vtex.product-summary-context\": \"http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-summary-context@0.10.0/public/@types/vtex.product-summary-context\"\n },\n \"resolutions\": {\n \"@types/jest\": \"26.0.15\"\n }\n}\n\n```"
}
] |
code_sponsored-products_d725f7f6
|
[
{
"role": "system",
"content": "You are an expert VTEX IO developer. You specialize in building VTEX Store Framework apps, React components, GraphQL APIs, and Node.js services for e-commerce platforms."
},
{
"role": "user",
"content": "Show me the implementation of sponsored-products/react/SponsoredBadge.tsx from the sponsored-products VTEX app."
},
{
"role": "assistant",
"content": "Here's the implementation:\n\n```tsx\nimport { SponsoredBadge } from './components/SponsoredBadge'\n\nexport default SponsoredBadge\n\n```"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.