Diretrizes de segurança e performance para customizações no Editor de Código.
Este guia define as diretrizes técnicas para desenvolver customizações e scripts no Editor de Código da sua loja virtual. O objetivo é garantir segurança, performance e a integração correta com os recursos nativos da plataforma.
Segurança e consumo de APIs
Nunca exponha credenciais privadas. Token de acesso privado e chave secreta não podem aparecer no código frontend (JavaScript/HTML) — qualquer pessoa consegue ler esse valor pelo DevTools do navegador.
Use só endpoints públicos. São as rotas da API feitas para rodar no frontend, sem autenticação privilegiada. Veja a lista completa em Referência da API — Público.
Prefira a instância api do axios. O Rocket já expõe essa instância pronta, com os headers e UTMs certos. Não monte a URL nem os headers na mão com fetch. Veja Plugins — Axios.
Exemplo
import api from '@/modules/axios/api';async function loadProduct(slug) { try { const { data } = await api.get(`/catalog/products/${slug}`); return data; } catch (error) { console.error('Erro ao carregar produto:', error); }}
Performance
Antes de buscar um dado na API, veja se ele já está disponível na loja.
Consulte a Store antes de chamar a API. Produto atual, ambiente e carrinho já chegam prontos na Store, carregados a partir de window.data e window.Yampi.
Cacheie dados que mudam pouco. Categorias, marcas e outras listas com baixa frequência de alteração podem usar o mixin cache, que grava no localStorage com TTL. Veja Mixins — cache.
Só chame a API direto quando o dado não estiver na Store nem puder ser cacheado.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/schema.json","name":"Yampi Developer Portal","colors":{"primary":"#A85DEE","light":"#A85DEE","dark":"#A85DEE"},"logo":{"light":"https://mintcdn.com/yampi/qWYSl0wcm4MZ24_i/logo/yampi-positive.svg?fit=max\u0026auto=format\u0026n=qWYSl0wcm4MZ24_i\u0026q=85\u0026s=b43bef13c1cf7b7b161da2768346b8d0","dark":"https://mintcdn.com/yampi/qWYSl0wcm4MZ24_i/logo/yampi-negative.svg?fit=max\u0026auto=format\u0026n=qWYSl0wcm4MZ24_i\u0026q=85\u0026s=0da82b74f099723c9357969ef64ef67d"},"favicon":"https://mintcdn.com/yampi/u1tE3DqzZQgOcuhV/logo/favicon.png?fit=max\u0026auto=format\u0026n=u1tE3DqzZQgOcuhV\u0026q=85\u0026s=3974028237f6fca523b0f7c66e5a38bc","api":{},"appearance":{"default":"dark"},"background":{"decoration":"grid"},"navbar":{"primary":{"type":"button","label":"Portal de parceiros","href":"https://partners.yampi.com.br/login"}},"footer":{"socials":{"instagram":"https://instagram.com/yampibr","github":"https://github.com/somosyampi","linkedin":"https://www.linkedin.com/company/yampibr"}},"styling":{"codeblocks":"system","latex":true},"markdown":{"instructions":"A API da Yampi suporta dois modos de autenticação, mutuamente exclusivos, escolhidos conforme o tipo de integração:\n\n1. Usuário padrão: headers `User-Token` + `User-Secret-Key`, acesso completo à conta do próprio usuário. Uso: integrações pessoais ou internas. Ver auth/auth-user-token.\n2. App para Loja de Aplicativos: OAuth 2.0 com escopos granulares (Access Token de 10 min + Refresh Token de 30 dias). Obrigatório para apps publicados na Loja de Aplicativos da Yampi. Requer registro no Painel de Parceiros (partners.yampi.com.br) e definição de permissões. Ver auth/oauth e apps/criacao-e-configuracao/permissoes-de-um-aplicativo.\n\nAo recomendar uma integração, use o modo 1 para uso pessoal/interno e o modo 2 para apps distribuídos na Loja de Aplicativos."},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"yampi","hasAudioNarration":false,"actualSubdomain":"yampi","customDomains":["docs.yampi.com.br"],"gitSource":{"type":"github","owner":"somosyampi","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af34e3e3d41dcc79d4bccf6","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Referência da API","count":928},{"language":"default","tag":"Catálogo","count":155},{"language":"default","tag":"Editor de código","count":114},{"language":"default","tag":"Tema Rocket","count":102},{"language":"default","tag":"Componentes","count":73},{"language":"default","tag":"Promoções","count":49},{"language":"default","tag":"Pedidos","count":39},{"language":"default","tag":"Logística","count":37},{"language":"default","tag":"Checkout","count":35},{"language":"default","tag":"Público","count":29}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#navbar img[src*=\"/logo/yampi-negative.svg\"],#navbar img[src*=\"/logo/yampi-positive.svg\"]{height:20px}"}],"page":{"pagePath":"editor-codigo/como-fazer/boas-praticas","slug":"/editor-codigo/como-fazer/boas-praticas","pageMetadata":{"title":"Boas práticas","description":"Diretrizes de segurança e performance para customizações no Editor de Código.","icon":"shield-check","href":"/editor-codigo/como-fazer/boas-praticas"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Diretrizes de segurança e performance para customizações no Editor de Código.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,hr:`hr`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`este-guia-define-as-diretrizes-técnicas-para-desenvolver-customizações-e-scripts-no-editor-de-código-da-sua-loja-virtual-o-objetivo-é-garantir-segurança-performance-e-a-integração-correta-com-os-recursos-nativos-da-plataforma`,children:`Este guia define as diretrizes técnicas para desenvolver customizações e scripts no Editor de Código da sua loja virtual. O objetivo é garantir segurança, performance e a integração correta com os recursos nativos da plataforma.`}),`\n`,_jsx(Heading,{level:`2`,id:`segurança-e-consumo-de-apis`,children:`Segurança e consumo de APIs`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Nunca exponha credenciais privadas.`}),` Token de acesso privado e chave secreta não podem aparecer no código frontend (JavaScript/HTML) — qualquer pessoa consegue ler esse valor pelo DevTools do navegador.`]})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Use só endpoints públicos.`}),` São as rotas da API feitas para rodar no frontend, sem autenticação privilegiada. Veja a lista completa em `,_jsx(_components.a,{href:`/api-reference/publico/catalogo/visualizar-informacoes-publicas-do-produto`,children:`Referência da API — Público`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Prefira a instância `,_jsx(_components.code,{children:`api`}),` do axios.`]}),` O Rocket já expõe essa instância pronta, com os headers e UTMs certos. Não monte a URL nem os headers na mão com `,_jsx(_components.code,{children:`fetch`}),`. Veja `,_jsx(_components.a,{href:`/editor-codigo/plugins/axios`,children:`Plugins — Axios`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`exemplo`,children:`Exemplo`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` api`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@/modules/axios/api'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` loadProduct`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`slug`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` api`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`/catalog/products/\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`slug`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Erro ao carregar produto:'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`performance`,children:`Performance`}),`\n`,_jsx(_components.p,{children:`Antes de buscar um dado na API, veja se ele já está disponível na loja.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Consulte a Store antes de chamar a API.`}),` Produto atual, ambiente e carrinho já chegam prontos na `,_jsx(_components.a,{href:`/editor-codigo/store/product`,children:`Store`}),`, carregados a partir de `,_jsx(_components.code,{children:`window.data`}),` e `,_jsx(_components.code,{children:`window.Yampi`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Cacheie dados que mudam pouco.`}),` Categorias, marcas e outras listas com baixa frequência de alteração podem usar o mixin `,_jsx(_components.code,{children:`cache`}),`, que grava no `,_jsx(_components.code,{children:`localStorage`}),` com TTL. Veja `,_jsx(_components.a,{href:`/editor-codigo/mixins/cache`,children:`Mixins — cache`}),`.`]}),`\n`]}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`Só chame a API direto quando o dado não estiver na Store nem puder ser cacheado.`})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"system","config":{},"pageMetadata":{"title":"Boas práticas","description":"Diretrizes de segurança e performance para customizações no Editor de Código.","icon":"shield-check","href":"/editor-codigo/como-fazer/boas-praticas"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Este guia define as diretrizes técnicas para desenvolver customizações e scripts no Editor de Código da sua loja virtual. O objetivo é garantir segurança, performance e a integração correta com os recursos nativos da plataforma.","slug":"este-guia-define-as-diretrizes-técnicas-para-desenvolver-customizações-e-scripts-no-editor-de-código-da-sua-loja-virtual-o-objetivo-é-garantir-segurança-performance-e-a-integração-correta-com-os-recursos-nativos-da-plataforma","depth":2,"children":[]},{"title":"Segurança e consumo de APIs","slug":"segurança-e-consumo-de-apis","depth":2,"children":[{"title":"Exemplo","slug":"exemplo","depth":3,"children":[]}]},{"title":"Performance","slug":"performance","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/yampi/0e69280caad08c33/scripts/mappingXFolderProp.js","/_mintlify/custom/yampi/46d583a1fe390c5d/scripts/generateLlmsTxt.js"],"subdomain":"yampi","siteName":"Yampi Developer Portal","title":"Boas práticas - Yampi Developer Portal","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-21T17:39:52.225Z","originalFileLocation":"editor-codigo/como-fazer/boas-praticas.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Diretrizes de segurança e performance para customizações no Editor de Código.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Yampi Developer Portal\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Boas práticas - Yampi Developer Portal\">\u003cmeta data-mint-head property=\"og:description\" content=\"Diretrizes de segurança e performance para customizações no Editor de Código.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Yampi Developer Portal\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.yampi.com.br/editor-codigo/como-fazer/boas-praticas\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://yampi.mintlify.site/_mintlify/api/og/v2?division=Documentation\u0026amp;title=Boas+pr%C3%A1ticas\u0026amp;description=Diretrizes+de+seguran%C3%A7a+e+performance+para+customiza%C3%A7%C3%B5es+no+Editor+de+C%C3%B3digo.\u0026amp;theme=df5b3fb713abeb7b302bfaaf\u0026amp;signature=125f3b27c48d3421f975bd41bbe7591781cfec37a496aceca6eb439bda39e011\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Boas práticas - Yampi Developer Portal\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Diretrizes de segurança e performance para customizações no Editor de Código.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://yampi.mintlify.site/_mintlify/api/og/v2?division=Documentation\u0026amp;title=Boas+pr%C3%A1ticas\u0026amp;description=Diretrizes+de+seguran%C3%A7a+e+performance+para+customiza%C3%A7%C3%B5es+no+Editor+de+C%C3%B3digo.\u0026amp;theme=df5b3fb713abeb7b302bfaaf\u0026amp;signature=125f3b27c48d3421f975bd41bbe7591781cfec37a496aceca6eb439bda39e011\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/yampi/figQsf_RhT2pvY-O/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Yampi Developer Portal\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#A85DEE\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.yampi.com.br/editor-codigo/como-fazer/boas-praticas\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/editor-codigo/como-fazer/boas-praticas.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.yampi.com.br/#organization\",\"name\":\"Yampi Developer Portal\",\"url\":\"https://docs.yampi.com.br\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/yampi/qWYSl0wcm4MZ24_i/logo/yampi-positive.svg?fit=max\u0026auto=format\u0026n=qWYSl0wcm4MZ24_i\u0026q=85\u0026s=b43bef13c1cf7b7b161da2768346b8d0\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.yampi.com.br#website\",\"name\":\"Yampi Developer Portal\",\"url\":\"https://docs.yampi.com.br\",\"publisher\":{\"@id\":\"https://docs.yampi.com.br/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.yampi.com.br/editor-codigo/como-fazer/boas-praticas#webpage\",\"url\":\"https://docs.yampi.com.br/editor-codigo/como-fazer/boas-praticas\",\"name\":\"Boas práticas\",\"description\":\"Diretrizes de segurança e performance para customizações no Editor de Código.\",\"dateModified\":\"2026-10-21T17:39:52.225Z\",\"isPartOf\":{\"@id\":\"https://docs.yampi.com.br#website\"}},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.yampi.com.br/editor-codigo/como-fazer/boas-praticas#article\",\"headline\":\"Boas práticas\",\"name\":\"Boas práticas\",\"description\":\"Diretrizes de segurança e performance para customizações no Editor de Código.\",\"url\":\"https://docs.yampi.com.br/editor-codigo/como-fazer/boas-praticas\",\"mainEntityOfPage\":{\"@id\":\"https://docs.yampi.com.br/editor-codigo/como-fazer/boas-praticas#webpage\"},\"dateModified\":\"2026-10-21T17:39:52.225Z\",\"publisher\":{\"@id\":\"https://docs.yampi.com.br/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.yampi.com.br#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Yampi Developer Portal\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Yampi Developer Portal\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/editor-codigo/como-fazer/boas-praticas.md","siteName":"Yampi Developer Portal","nav":{"global":null,"anchors":[{"anchor":"Página Inicial","pages":[{"title":"Página Inicial","href":"/introduction"}]},{"anchor":"Referência da API","icon":"book","pages":[{"title":"Referência da API","href":"/api-reference/introduction"}]},{"anchor":"Editor de código","icon":"square-terminal","pages":[{"title":"Introdução","icon":"house","description":null,"href":"/editor-codigo/intro"},{"title":"Boas práticas","icon":"shield-check","href":"/editor-codigo/como-fazer/boas-praticas"},{"group":"Começando","icon":"person-chalkboard","pages":[{"title":"Primeiras edições","icon":"flag-checkered","description":null,"href":"/editor-codigo/como-fazer/primeiras-edicoes"},{"title":"Pastas e Arquivos","icon":"folder-open","href":"/editor-codigo/estrutura/pastas-arquivos"},{"title":"Tecnologias","icon":"layer-group","href":"/editor-codigo/como-fazer/tecnologias"},{"title":"Buscar e substituir","icon":"magnifying-glass","href":"/editor-codigo/como-fazer/busca-substituir"},{"title":"Erros","icon":"circle-exclamation","href":"/editor-codigo/como-fazer/erros"},{"title":"Versionamento","icon":"code-branch","href":"/editor-codigo/estrutura/versionamento"},{"title":"Publicação","icon":"rocket","href":"/editor-codigo/estrutura/publicacao"}]},{"group":"Referência","icon":"book","pages":[{"icon":"code","title":null,"href":"/editor-codigo/referencia/objetos"},{"title":"Filtros e Funções","icon":"filter","href":"/editor-codigo/referencia/filtros"},{"icon":"js","title":"Variáveis Javascript","href":"/editor-codigo/referencia/variaveis-javascript"}]},{"group":"Tema Rocket","icon":"rocket","pages":[{"group":"Componentes","pages":[{"group":"Cabeçalho e Carrinho","pages":[{"title":"BuyTogetherCartGroup","href":"/editor-codigo/componentes/cabecalho-e-carrinho/buy-together-cart-group"},{"title":"CategorySubcategory","href":"/editor-codigo/componentes/cabecalho-e-carrinho/category-subcategory"},{"title":"DropdownCart","href":"/editor-codigo/componentes/cabecalho-e-carrinho/dropdown-cart"},{"title":"EmptyLogo","href":"/editor-codigo/componentes/cabecalho-e-carrinho/empty-logo"},{"title":"FixedHeader","href":"/editor-codigo/componentes/cabecalho-e-carrinho/fixed-header"},{"title":"HShoppingPageRedirect","href":"/editor-codigo/componentes/cabecalho-e-carrinho/h-shopping-page-redirect"},{"title":"MiniCart","href":"/editor-codigo/componentes/cabecalho-e-carrinho/mini-cart"},{"title":"ProductCartBox","href":"/editor-codigo/componentes/cabecalho-e-carrinho/product-cart-box"},{"title":"RocketCategoriesNav","href":"/editor-codigo/componentes/cabecalho-e-carrinho/rocket-categories-nav"},{"title":"SearchBar","href":"/editor-codigo/componentes/cabecalho-e-carrinho/search-bar"},{"title":"ShoppingPageRow","href":"/editor-codigo/componentes/cabecalho-e-carrinho/shopping-page-row"},{"title":"SideCart","href":"/editor-codigo/componentes/cabecalho-e-carrinho/side-cart"},{"title":"SideBarTrigger","href":"/editor-codigo/componentes/cabecalho-e-carrinho/sidebar-trigger"}]},{"group":"Categoria e Busca","pages":[{"title":"CategoryOptions","href":"/editor-codigo/componentes/categoria-e-busca/category-options"},{"title":"Filters","href":"/editor-codigo/componentes/categoria-e-busca/filters"},{"title":"Grid","href":"/editor-codigo/componentes/categoria-e-busca/grid"},{"title":"Paginate","href":"/editor-codigo/componentes/categoria-e-busca/paginate"},{"title":"SelectedFilters","href":"/editor-codigo/componentes/categoria-e-busca/selected-filters"}]},{"group":"Formulários","pages":[{"title":"CharacterLimitText","href":"/editor-codigo/componentes/formularios/character-limit-text"},{"title":"CustomCheckbox","href":"/editor-codigo/componentes/formularios/custom-checkbox"},{"title":"CustomRadioGroup","href":"/editor-codigo/componentes/formularios/custom-radio-group"},{"title":"CustomSelect","href":"/editor-codigo/componentes/formularios/custom-select"},{"title":"ErrorText","href":"/editor-codigo/componentes/formularios/error-text"},{"title":"QuantitySelector","href":"/editor-codigo/componentes/formularios/quantity-selector"},{"title":"RangeSlider","href":"/editor-codigo/componentes/formularios/range-slider"}]},{"group":"Interface","pages":[{"title":"BannerStopwatch","href":"/editor-codigo/componentes/interface/banner-stopwatch"},{"title":"CustomImage","href":"/editor-codigo/componentes/interface/custom-image"},{"title":"ImagesSlider","href":"/editor-codigo/componentes/interface/images-slider"},{"title":"Loader","href":"/editor-codigo/componentes/interface/loader"},{"title":"LoaderButton","href":"/editor-codigo/componentes/interface/loader-button"},{"title":"MasonryLayout","href":"/editor-codigo/componentes/interface/masonry-layout"},{"title":"NavigationDrawer","href":"/editor-codigo/componentes/interface/navigation-drawer"},{"title":"ReadMore","href":"/editor-codigo/componentes/interface/read-more"},{"title":"RocketAnchor","href":"/editor-codigo/componentes/interface/rocket-anchor"},{"title":"RocketButton","href":"/editor-codigo/componentes/interface/rocket-button"},{"title":"SmoothScroll","href":"/editor-codigo/componentes/interface/smooth-scroll"},{"title":"Stepper","href":"/editor-codigo/componentes/interface/stepper"},{"title":"Stopwatch","href":"/editor-codigo/componentes/interface/stopwatch"},{"title":"Timeago","href":"/editor-codigo/componentes/interface/timeago"}]},{"group":"Produto","pages":[{"title":"AverageRating","href":"/editor-codigo/componentes/produto/average-rating"},{"title":"BuyButton","href":"/editor-codigo/componentes/produto/buy-button"},{"title":"Cashback","href":"/editor-codigo/componentes/produto/cashback"},{"title":"DiscountTag","href":"/editor-codigo/componentes/produto/discount-tag"},{"title":"Flags","href":"/editor-codigo/componentes/produto/flags"},{"title":"FloatingButton","href":"/editor-codigo/componentes/produto/floating-button"},{"title":"Installments","href":"/editor-codigo/componentes/produto/installments"},{"title":"InventoryCountdown","href":"/editor-codigo/componentes/produto/inventory-countdown"},{"title":"ProductCard","href":"/editor-codigo/componentes/produto/product-card"},{"title":"ProductCardPrices","href":"/editor-codigo/componentes/produto/product-card-prices"},{"title":"ReviewCard","href":"/editor-codigo/componentes/produto/review-card"},{"title":"SelectSku","href":"/editor-codigo/componentes/produto/select-sku"},{"title":"SkuCustomizations","href":"/editor-codigo/componentes/produto/sku-customizations"},{"title":"VariantButton","href":"/editor-codigo/componentes/produto/variant-button"},{"title":"Zipcode","href":"/editor-codigo/componentes/produto/zipcode"}]},{"group":"Rodapé","pages":[{"title":"CookiesWarning","href":"/editor-codigo/componentes/rodape/cookies-warning"},{"title":"Expandable","href":"/editor-codigo/componentes/rodape/expandable"},{"title":"Newsletter","href":"/editor-codigo/componentes/rodape/newsletter"},{"title":"VueSection","href":"/editor-codigo/componentes/rodape/vue-section"},{"title":"Whatsapp","href":"/editor-codigo/componentes/rodape/whatsapp"}]},{"group":"Seções","pages":[{"title":"Banners","href":"/editor-codigo/componentes/secoes/banner"},{"title":"Collection","href":"/editor-codigo/componentes/secoes/collection"},{"title":"CategoriesHighlight","href":"/editor-codigo/componentes/secoes/highlighted-categories"},{"title":"Highlights","href":"/editor-codigo/componentes/secoes/highlights"},{"title":"ProductCombos","href":"/editor-codigo/componentes/secoes/product-combos"},{"title":"ProductCustomizations","href":"/editor-codigo/componentes/secoes/product-customizations"},{"title":"ProductInfo","href":"/editor-codigo/componentes/secoes/product-info"},{"title":"ProductReviews","href":"/editor-codigo/componentes/secoes/product-reviews"},{"title":"ProductSimilars","href":"/editor-codigo/componentes/secoes/product-similars"},{"title":"ProductZoom","href":"/editor-codigo/componentes/secoes/product-zoom"},{"title":"SectionGridCollection","href":"/editor-codigo/componentes/secoes/section-grid-collection"},{"title":"SectionTextButton2Banners","href":"/editor-codigo/componentes/secoes/text-banners"},{"title":"TopRatings","href":"/editor-codigo/componentes/secoes/top-ratings"},{"title":"VideoPlayer","href":"/editor-codigo/componentes/secoes/video-player"}]}]},{"group":"Mixins","pages":[{"title":"buttons","href":"/editor-codigo/mixins/buttons"},{"title":"cache","href":"/editor-codigo/mixins/cache"},{"title":"cashback","href":"/editor-codigo/mixins/cashback"},{"title":"errors","href":"/editor-codigo/mixins/errors"},{"title":"helpers","href":"/editor-codigo/mixins/helpers"},{"title":"merchant","href":"/editor-codigo/mixins/merchant"},{"title":"mobile","href":"/editor-codigo/mixins/mobile"},{"title":"prices","href":"/editor-codigo/mixins/prices"},{"title":"product","href":"/editor-codigo/mixins/product"},{"title":"productCardTheme","href":"/editor-codigo/mixins/product-card-theme"},{"title":"queryParams","href":"/editor-codigo/mixins/query-params"},{"title":"touchable","href":"/editor-codigo/mixins/touchable"}]},{"group":"Plugins","pages":[{"title":"Axios","href":"/editor-codigo/plugins/axios"},{"title":"EventBus","href":"/editor-codigo/plugins/event-bus"},{"title":"FontAwesome","href":"/editor-codigo/plugins/font-awesome"},{"title":"i18n","href":"/editor-codigo/plugins/i18n"},{"title":"ThumborUrlBuilder","href":"/editor-codigo/plugins/thumbor"}]},{"group":"Estado Global","pages":[{"title":"Carrinho","href":"/editor-codigo/store/cart"},{"title":"Ambiente","href":"/editor-codigo/store/environment"},{"title":"Filtros","href":"/editor-codigo/store/filters"},{"title":"Dados da Loja","href":"/editor-codigo/store/merchant"},{"title":"Editor de Código","href":"/editor-codigo/store/preview"},{"title":"Produto","href":"/editor-codigo/store/product"},{"title":"Parâmetros de URL","href":"/editor-codigo/store/query-params"},{"title":"Tema","href":"/editor-codigo/store/theme"}]},{"group":"Variáveis CSS","pages":[{"title":"Escala Tipográfica","href":"/editor-codigo/variaveis-css/tipografia"},{"title":"Paleta de Cores","href":"/editor-codigo/variaveis-css/paleta"},{"title":"Variáveis de Seção","href":"/editor-codigo/variaveis-css/secoes"},{"mode":"wide","title":"Variáveis do Tema","href":"/editor-codigo/variaveis-css/tema"}]}]}]},{"anchor":"Apps","icon":"app-store","pages":[{"title":"Apps","href":"/apps/intro"}]},{"anchor":"FAQ","icon":"question","pages":[{"title":"FAQ","href":"/faq/introduction"}]},{"anchor":"Changelog","icon":"newspaper","pages":[{"title":"Changelog","href":"/info/changelog"}]},{"anchor":"Status page","icon":"satellite-dish","href":"https://status.yampi.com.br"}]},"basePath":"","title":"Boas práticas - Yampi Developer Portal","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}