@nuvler/cli 0.5.6 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/nuvler.js +49 -9
  2. package/dist/nuvler.js.map +1 -1
  3. package/dist/preview/launcher.js +4 -3
  4. package/dist/preview/launcher.js.map +1 -1
  5. package/dist/templates/nuvler-default/nuvler.theme.json +150 -7
  6. package/dist/templates/nuvler-default/package.json +1 -1
  7. package/dist/templates/nuvler-default/src/assets/not-found-cloud.png +0 -0
  8. package/dist/templates/nuvler-default/src/assets/not-found-cloud.svg +131 -0
  9. package/dist/templates/nuvler-default/src/assets/not-found-illustration.png +0 -0
  10. package/dist/templates/nuvler-default/src/banner-carousel.tsx +11 -0
  11. package/dist/templates/nuvler-default/src/carousel-frame.tsx +8 -4
  12. package/dist/templates/nuvler-default/src/definition.ts +2 -1
  13. package/dist/templates/nuvler-default/src/footer.tsx +4 -2
  14. package/dist/templates/nuvler-default/src/header-interactions.tsx +30 -17
  15. package/dist/templates/nuvler-default/src/header.tsx +25 -10
  16. package/dist/templates/nuvler-default/src/home.tsx +37 -25
  17. package/dist/templates/nuvler-default/src/index.ts +2 -0
  18. package/dist/templates/nuvler-default/src/not-found.tsx +29 -0
  19. package/dist/templates/nuvler-default/src/product-carousel.tsx +1 -1
  20. package/dist/templates/nuvler-default/src/product-detail-interactive.tsx +7 -1
  21. package/dist/templates/nuvler-default/src/product-detail.tsx +27 -5
  22. package/dist/templates/nuvler-default/src/products.tsx +13 -2
  23. package/dist/templates/nuvler-default/src/server-shell.tsx +5 -5
  24. package/dist/templates/nuvler-default/src/styles.d.ts +15 -0
  25. package/dist/templates/nuvler-default/src/theme-component.tsx +27 -8
  26. package/dist/templates/nuvler-default/src/theme-config.ts +12 -12
  27. package/dist/templates/nuvler-default/src/theme.css +1724 -169
  28. package/package.json +1 -1
  29. package/preview-host/src/main.tsx +16 -1
  30. package/preview-host/src/preview-path.d.mts +4 -1
  31. package/preview-host/src/preview-path.mjs +32 -1
  32. package/preview-host/vendor/theme-runtime/default-theme.tsx +57 -5
  33. package/preview-host/vendor/theme-runtime/index.ts +1 -1
@@ -1,16 +1,31 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
1
4
  import type { HeaderProps } from "@nuvler/theme-sdk";
2
- import { CategoryNavigation, ConfiguredNavigation, MobileStoreMenu, SmartProductSearch } from "./header-interactions.js";
3
- import { ThemeImageView, type ThemeImageComponent } from "./shared.js";
5
+ import { ConfiguredNavigation, MobileStoreMenu, SmartProductSearch } from "./header-interactions.js";
6
+ import { ThemeImageView } from "./shared.js";
4
7
 
5
- function SupplementaryLinks({ site, pages }: Pick<HeaderProps, "site" | "pages">) {
6
- return <>{site.modules.includes("BLOG") && <a href="/blog">Blog</a>}{site.modules.includes("SERVICES") && <a href="/servicos">Serviços</a>}{site.modules.includes("CASES") && <a href="/cases">Cases</a>}{pages.slice(0, 6).map((page) => <a key={page.slug} href={`/${page.slug}`}>{page.title}</a>)}</>;
7
- }
8
+ type ClientHeaderProps = Omit<HeaderProps, "template" | "pages" | "searchProducts">;
8
9
 
9
- export function Header({ site, categories, pages, menu = [], headerButton, template, cart, suggestionsEndpoint, suggestionsQueryParam, searchProducts, ImageComponent = ThemeImageView }: HeaderProps & { ImageComponent?: ThemeImageComponent }) {
10
+ export function Header({ site, categories, menu = [], headerButton, cart, suggestionsEndpoint, suggestionsQueryParam }: ClientHeaderProps) {
11
+ const [compact, setCompact] = useState(false);
10
12
  const name = site.settings?.siteName || site.tenant.name;
11
- const hasCategories = categories.length > 0;
12
13
  const configuredMenu = [...menu].sort((left, right) => left.order - right.order);
13
- const hasConfiguredMenu = configuredMenu.length > 0;
14
- const hasExtra = !hasConfiguredMenu && (site.modules.some((module) => ["BLOG", "SERVICES", "CASES"].includes(module)) || pages.length > 0);
15
- return <><div className="announcement"><div className="store-container announcement-inner"><span>{template.announcement}</span>{site.settings?.contact.phone && <span>{site.settings.contact.phone}</span>}</div></div><header className="store-header"><div className={`store-container header-inner${hasCategories && hasExtra ? "" : " header-inner-simple"}`}><MobileStoreMenu site={site} categories={categories} pages={pages} menu={configuredMenu} headerButton={headerButton} /><a className="brand" href="/" aria-label={`${name} — início`}>{site.settings?.logo?.url ? <ImageComponent image={site.settings.logo} fallbackAlt={name} className="brand-logo" sizes="200px" fallbackWidth={240} fallbackHeight={96} /> : <><span className="brand-mark">7</span><span>{name}</span></>}</a>{site.modules.includes("PRODUCTS") && <SmartProductSearch endpoint={suggestionsEndpoint} queryParam={suggestionsQueryParam} searchProducts={searchProducts} />}<div className="header-message"><span className="header-message-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="m12 3 2.1 4.9L19 10l-4.9 2.1L12 17l-2.1-4.9L5 10l4.9-2.1L12 3Z" /></svg></span><span className="header-message-copy"><small>Nossa loja</small><strong>{site.settings?.description?.trim() || template.announcement}</strong></span></div>{hasCategories && hasExtra && <div className="header-actions"><details className="header-more-menu"><summary>Mais <span aria-hidden="true">⌄</span></summary><div className="header-more-panel"><SupplementaryLinks site={site} pages={pages} /></div></details></div>}{headerButton?.enabled && <a className="header-highlight-link" href={headerButton.href} target={headerButton.openInNewTab ? "_blank" : undefined} rel={headerButton.openInNewTab ? "noopener noreferrer" : undefined} style={{ backgroundColor: headerButton.backgroundColor, color: headerButton.textColor }}>{headerButton.label}</a>}{cart}</div>{hasConfiguredMenu ? <ConfiguredNavigation menu={configuredMenu} categories={categories} /> : hasCategories ? <CategoryNavigation categories={categories} /> : <div className="primary-nav-shell"><nav className="store-container main-nav" aria-label="Navegação principal"><a href="/">Início</a>{site.modules.includes("PRODUCTS") && <a href="/produtos">Produtos</a>}<SupplementaryLinks site={site} pages={pages} /></nav></div>}</header></>;
14
+
15
+ useEffect(() => {
16
+ const update = () => {
17
+ const scrollTop = window.scrollY;
18
+ setCompact((isCompact) => {
19
+ // A diferença entre entrada e saída evita que a mudança de altura do
20
+ // próprio header alterne o estado quando o scroll está perto do topo.
21
+ if (isCompact) return scrollTop > 16;
22
+ return scrollTop > 80;
23
+ });
24
+ };
25
+ update();
26
+ window.addEventListener("scroll", update, { passive: true });
27
+ return () => window.removeEventListener("scroll", update);
28
+ }, []);
29
+
30
+ return <header className={`store-header${compact ? " is-compact" : ""}`}><div className="store-container header-inner"><MobileStoreMenu site={site} categories={categories} menu={configuredMenu} headerButton={headerButton} /><a className="brand" href="/" aria-label={`${name} — início`}>{site.settings?.logo?.url ? <ThemeImageView image={site.settings.logo} fallbackAlt={name} className="brand-logo" sizes="200px" fallbackWidth={240} fallbackHeight={96} /> : <><span className="brand-mark">7</span><span>{name}</span></>}</a>{configuredMenu.length > 0 && <ConfiguredNavigation inline menu={configuredMenu} categories={categories} />}<div className="header-tools">{site.modules.includes("PRODUCTS") && <SmartProductSearch endpoint={suggestionsEndpoint} queryParam={suggestionsQueryParam} />}{headerButton?.enabled && <a className="header-highlight-link" href={headerButton.href} target={headerButton.openInNewTab ? "_blank" : undefined} rel={headerButton.openInNewTab ? "noopener noreferrer" : undefined} style={{ backgroundColor: headerButton.backgroundColor, color: headerButton.textColor }}>{headerButton.label}</a>}{cart}</div></div></header>;
16
31
  }
@@ -69,18 +69,25 @@ function banners(data: Record<string, unknown>): ThemeBanner[] {
69
69
  });
70
70
  }
71
71
 
72
- function Heading({ data, title, href }: { data: Record<string, unknown>; title: string; href: string }) {
73
- return <div className="section-heading"><div><span>{text(data, "eyebrow", "Em destaque")}</span><h2>{text(data, "title", title)}</h2></div><a href={href}>Ver todos</a></div>;
72
+ function Heading({ data, href }: { data: Record<string, unknown>; href: string }) {
73
+ const eyebrow = text(data, "eyebrow");
74
+ const title = text(data, "title");
75
+ const actionLabel = text(data, "buttonLabel");
76
+ const actionHref = text(data, "buttonUrl", href);
77
+ if (!eyebrow && !title && !actionLabel) return null;
78
+ return <div className="section-heading"><div>{eyebrow && <span>{eyebrow}</span>}{title && <h2>{title}</h2>}</div>{actionLabel && actionHref && <a href={actionHref}>{actionLabel}</a>}</div>;
74
79
  }
75
80
 
76
- function Hero({ section, site, action, priority, ImageComponent = ThemeImageView }: { section: ThemeHomeSection; site: ThemeSite; action: { label: string; href: string }; priority: boolean; ImageComponent?: ThemeImageComponent }) {
77
- const name = site.settings?.siteName || site.tenant.name;
78
- const title = text(section.data, "title", "Tudo o que você procura, em um só lugar.");
79
- const description = text(section.data, "description", site.settings?.description || `Conheça a seleção de produtos da ${name}.`);
81
+ function Hero({ section, priority, ImageComponent = ThemeImageView }: { section: ThemeHomeSection; priority: boolean; ImageComponent?: ThemeImageComponent }) {
82
+ const title = text(section.data, "title");
83
+ const description = text(section.data, "description");
84
+ const eyebrow = text(section.data, "eyebrow");
85
+ const buttonLabel = text(section.data, "buttonLabel");
86
+ const buttonUrl = text(section.data, "buttonUrl");
80
87
  const image = sectionImage(section.data, title);
81
- const copy = <div className="hero-copy"><span className="hero-eyebrow">{text(section.data, "eyebrow", "Bem-vindo à nossa loja")}</span><h1>{title}</h1><p>{description}</p><div className="hero-actions"><a className="button button-primary" href={text(section.data, "buttonUrl", action.href)}>{text(section.data, "buttonLabel", action.label)}</a>{site.modules.includes("PRODUCTS") && <a className="text-link" href="/produtos">Ver catálogo completo <span>→</span></a>}</div></div>;
88
+ const copy = <div className="hero-copy">{eyebrow && <span className="hero-eyebrow">{eyebrow}</span>}{title && <h1>{title}</h1>}{description && <p>{description}</p>}{buttonLabel && buttonUrl && <div className="hero-actions"><a className="button button-primary" href={buttonUrl}>{buttonLabel}</a></div>}</div>;
82
89
  if (image) return <section className="hero-section hero-section-image"><ImageComponent image={image} fallbackAlt={title} className="hero-background-image" priority={priority} sizes="100vw" fallbackWidth={1600} fallbackHeight={700} /><div className="hero-background-overlay" aria-hidden="true" /><div className="store-container hero-image-content">{copy}</div></section>;
83
- return <section className="hero-section"><div className="store-container hero-grid">{copy}<div className="hero-art" aria-hidden="true"><div className="hero-orbit hero-orbit-one" /><div className="hero-orbit hero-orbit-two" /><div className="hero-seven">7</div><span className="hero-card hero-card-top">Seleção especial</span><span className="hero-card hero-card-bottom">Atendimento humano</span></div></div></section>;
90
+ return <section className="hero-section"><div className="store-container hero-grid">{copy}<div className="hero-art" aria-hidden="true"><div className="hero-orbit hero-orbit-one" /><div className="hero-orbit hero-orbit-two" /><div className="hero-seven">7</div></div></div></section>;
84
91
  }
85
92
 
86
93
  function EditorialGrid({ items, basePath, ImageComponent = ThemeImageView }: { items: ThemeEditorialItem[]; basePath: string; ImageComponent?: ThemeImageComponent }) {
@@ -89,11 +96,11 @@ function EditorialGrid({ items, basePath, ImageComponent = ThemeImageView }: { i
89
96
  }
90
97
 
91
98
  function TextSection({ section, ImageComponent = ThemeImageView }: { section: ThemeHomeSection; ImageComponent?: ThemeImageComponent }) {
92
- const title = text(section.data, "title", "Conteúdo");
99
+ const title = text(section.data, "title");
93
100
  const description = text(section.data, "description", text(section.data, "text"));
94
101
  const image = sectionImage(section.data, title);
95
- if (section.type === "image-text") return <section className="store-section image-text-section"><div className="store-container image-text-layout" data-position={section.data.imagePosition === "right" ? "right" : "left"}>{image && <div className="image-text-media"><ImageComponent image={image} fallbackAlt={title} sizes="(max-width: 900px) 100vw, 50vw" fallbackWidth={800} fallbackHeight={600} /></div>}<div className="image-text-copy">{text(section.data, "eyebrow") && <span>{text(section.data, "eyebrow")}</span>}<h2>{title}</h2>{description && <p>{description}</p>}</div></div></section>;
96
- return <section className="store-section editorial-section"><div className="store-container editorial-content">{text(section.data, "eyebrow") && <span>{text(section.data, "eyebrow")}</span>}<h2>{title}</h2>{description && <p>{description}</p>}{section.type === "cta" && text(section.data, "buttonLabel") && text(section.data, "buttonUrl") && <a className="button button-primary" href={text(section.data, "buttonUrl")}>{text(section.data, "buttonLabel")}</a>}</div></section>;
102
+ if (section.type === "image-text") return <section className="store-section image-text-section"><div className="store-container image-text-layout" data-position={section.data.imagePosition === "right" ? "right" : "left"}>{image && <div className="image-text-media"><ImageComponent image={image} fallbackAlt={title} sizes="(max-width: 900px) 100vw, 50vw" fallbackWidth={800} fallbackHeight={600} /></div>}<div className="image-text-copy">{text(section.data, "eyebrow") && <span>{text(section.data, "eyebrow")}</span>}{title && <h2>{title}</h2>}{description && <p>{description}</p>}</div></div></section>;
103
+ return <section className="store-section editorial-section"><div className="store-container editorial-content">{text(section.data, "eyebrow") && <span>{text(section.data, "eyebrow")}</span>}{title && <h2>{title}</h2>}{description && <p>{description}</p>}{section.type === "cta" && text(section.data, "buttonLabel") && text(section.data, "buttonUrl") && <a className="button button-primary" href={text(section.data, "buttonUrl")}>{text(section.data, "buttonLabel")}</a>}</div></section>;
97
104
  }
98
105
 
99
106
  function ContactForm({ section, submitContact }: { section: ThemeHomeSection; submitContact?: (submission: ThemeContactSubmissionInput) => Promise<unknown> }) {
@@ -145,23 +152,28 @@ function ContactForm({ section, submitContact }: { section: ThemeHomeSection; su
145
152
  })}<div className="contact-form-wide"><button className="button button-primary" disabled={status === "sending"} type="submit">{status === "sending" ? "" : text(props, "submitLabel")}</button>{status === "success" && text(props, "successMessage") && <p className="contact-form-feedback" role="status">{text(props, "successMessage")}</p>}{status === "error" && <p className="contact-form-feedback contact-form-error" role="alert">{error}</p>}</div></form></div></section>;
146
153
  }
147
154
 
148
- function ThemeComponent({ section, submitContact }: { section: ThemeHomeSection; submitContact?: HomeProps["submitContact"] }) {
155
+ function ThemeComponent({ section, submitContact, ImageComponent = ThemeImageView }: { section: ThemeHomeSection; submitContact?: HomeProps["submitContact"]; ImageComponent?: ThemeImageComponent }) {
149
156
  const componentKey = text(section.data, "componentKey");
150
157
  const props = record(section.data, "props");
151
158
  if (componentKey === "contact-form" || componentKey.endsWith("-form")) return <ContactForm section={section} submitContact={submitContact} />;
159
+ if (componentKey === "benefits" || componentKey === "brands") {
160
+ const items = records(props, "items");
161
+ if (!items.length) return null;
162
+ const isBrands = componentKey === "brands";
163
+ return <section className={`store-section home-${componentKey}-section`}><div className="store-container">{(text(props, "eyebrow") || text(props, "title")) && <div className="section-heading"><div>{text(props, "eyebrow") && <span>{text(props, "eyebrow")}</span>}{text(props, "title") && <h2>{text(props, "title")}</h2>}</div></div>}<div className={isBrands ? "home-brands-grid" : "home-benefits-grid"}>{items.map((item, index) => { const title = text(item, "title", text(item, "value")); const image = imageValue(item.image); const href = text(item, "url"); const content = <>{isBrands && image ? <ImageComponent image={image} fallbackAlt={title} sizes="160px" fallbackWidth={320} fallbackHeight={160} /> : null}{!isBrands && <span className="home-benefit-index" aria-hidden="true">{String(index + 1).padStart(2, "0")}</span>}{title && <strong>{title}</strong>}{text(item, "description") && <p>{text(item, "description")}</p>}</>; return href ? <a href={href} key={`${title}-${index}`}>{content}</a> : <article key={`${title}-${index}`}>{content}</article>; })}</div></div></section>;
164
+ }
152
165
  if (componentKey === "video") return <section className="store-section theme-component-section" data-component-key="video"><div className="store-container">{text(props, "eyebrow") && <span>{text(props, "eyebrow")}</span>}{text(props, "title") && <h2>{text(props, "title")}</h2>}{text(props, "description") && <p>{text(props, "description")}</p>}{text(props, "videoUrl") && <video className="theme-component-video" controls playsInline poster={text(props, "posterImageUrl") || undefined} src={text(props, "videoUrl")} />}</div></section>;
153
166
  const items = records(props, "items");
154
167
  return <section className="store-section theme-component-section" data-component-key={componentKey || undefined}><div className="store-container">{text(props, "eyebrow") && <span>{text(props, "eyebrow")}</span>}{text(props, "title") && <h2>{text(props, "title")}</h2>}{text(props, "description") && <p>{text(props, "description")}</p>}{items.length > 0 && <div className="theme-component-items">{items.map((item, index) => { const itemTitle = text(item, "value", text(item, "title", text(item, "question"))); return <article key={index}>{itemTitle && <strong>{itemTitle}</strong>}{text(item, "description", text(item, "answer")) && <p>{text(item, "description", text(item, "answer"))}</p>}</article>; })}</div>}</div></section>;
155
168
  }
156
169
 
157
- export function Home({ sections, products, posts, services, cases, site, template, submitContact, ImageComponent = ThemeImageView }: HomeProps & { ImageComponent?: ThemeImageComponent }) {
170
+ export function Home({ sections, products, posts, services, cases, site, submitContact, ImageComponent = ThemeImageView }: HomeProps & { ImageComponent?: ThemeImageComponent }) {
158
171
  const visible = [...sections].filter((section) => section.enabled).sort((a, b) => a.order - b.order);
159
- const rendered = visible.length ? visible : template.fallbackSections(site.modules);
160
- const catalog = site.settings?.catalog ?? { showCategory: true, showDescription: true, desktopColumns: 4 as const };
161
- return <>{rendered.map((section, index) => {
162
- if (section.type === "hero") return <Hero key={section.id || index} section={section} site={site} action={template.primaryAction(site.modules)} priority={index === 0} ImageComponent={ImageComponent} />;
163
- if (section.type === "banner-carousel") return <BannerCarousel key={section.id || index} banners={banners(section.data)} autoplay={section.data.autoplay !== false} desktopHeight={typeof section.data.desktopHeight === "number" ? section.data.desktopHeight : undefined} mobileHeight={typeof section.data.mobileHeight === "number" ? section.data.mobileHeight : undefined} imageFit={section.data.imageFit === "CONTAIN" || section.data.imageFit === "NATURAL" ? section.data.imageFit : "COVER"} priority={index === 0} ImageComponent={ImageComponent} />;
164
- if (section.type === "theme-component") return <ThemeComponent key={section.id || index} section={section} submitContact={submitContact} />;
172
+ const catalog = site.settings?.catalog;
173
+ return <>{visible.map((section, index) => {
174
+ if (section.type === "hero") return <Hero key={section.id || index} section={section} priority={index === 0} ImageComponent={ImageComponent} />;
175
+ if (section.type === "banner-carousel") return <section className="home-banner-section" key={section.id || index}><BannerCarousel banners={banners(section.data)} autoplay={section.data.autoplay !== false} desktopHeight={typeof section.data.desktopHeight === "number" ? section.data.desktopHeight : undefined} mobileHeight={typeof section.data.mobileHeight === "number" ? section.data.mobileHeight : undefined} imageFit={section.data.imageFit === "CONTAIN" || section.data.imageFit === "NATURAL" ? section.data.imageFit : "COVER"} priority={index === 0} ImageComponent={ImageComponent} /></section>;
176
+ if (section.type === "theme-component") return <ThemeComponent key={section.id || index} section={section} submitContact={submitContact} ImageComponent={ImageComponent} />;
165
177
  if (["image-text", "rich-text", "cta"].includes(section.type)) return <TextSection key={section.id || index} section={section} ImageComponent={ImageComponent} />;
166
178
  if (section.type === "products-grid" || section.type === "products-carousel") {
167
179
  const category = productCategory(section.data);
@@ -174,11 +186,11 @@ export function Home({ sections, products, posts, services, cases, site, templat
174
186
  ? categoryUrl(matchingPath.slice(0, categoryIndex + 1))
175
187
  : category ? `/produtos?categoria=${encodeURIComponent(category)}` : "/produtos";
176
188
  const productsView = section.type === "products-grid"
177
- ? <ProductGrid products={items} columns={catalog.desktopColumns} showCategory={catalog.showCategory} showDescription={catalog.showDescription} ImageComponent={ImageComponent} />
178
- : <ProductCarousel products={items} showCategory={catalog.showCategory} showDescription={catalog.showDescription} ImageComponent={ImageComponent} />;
179
- return <section className="store-section" key={section.id || index}><div className="store-container"><Heading data={section.data} title={section.type === "products-grid" ? "Produtos em destaque" : "Vitrine de produtos"} href={allProductsHref} />{productsView}</div></section>;
189
+ ? <ProductGrid products={items} columns={catalog?.desktopColumns} showCategory={catalog?.showCategory} showDescription={catalog?.showDescription} ImageComponent={ImageComponent} />
190
+ : <ProductCarousel products={items} showCategory={catalog?.showCategory} showDescription={catalog?.showDescription} ImageComponent={ImageComponent} />;
191
+ return <section className="store-section home-products-section" data-layout={section.type === "products-carousel" ? "carousel" : "grid"} key={section.id || index}><div className="store-container"><Heading data={section.data} href={allProductsHref} />{productsView}</div></section>;
180
192
  }
181
- const map = section.type === "services-grid" ? { items: services, path: "/servicos", title: "Nossos serviços" } : section.type === "cases-grid" ? { items: cases, path: "/cases", title: "Cases e resultados" } : { items: posts, path: "/blog", title: "Conteúdos recentes" };
182
- return <section className="store-section" key={section.id || index}><div className="store-container"><Heading data={section.data} title={map.title} href={map.path} /><EditorialGrid items={map.items.slice(0, limit(section.data))} basePath={map.path} ImageComponent={ImageComponent} /></div></section>;
183
- })}<section className="benefits-section"><div className="store-container benefits-grid">{template.benefits.map((benefit) => <div key={benefit.title}><strong>{benefit.title}</strong><span>{benefit.description}</span></div>)}</div></section></>;
193
+ const map = section.type === "services-grid" ? { items: services, path: "/servicos" } : section.type === "cases-grid" ? { items: cases, path: "/cases" } : { items: posts, path: "/blog" };
194
+ return <section className="store-section home-editorial-section" key={section.id || index}><div className="store-container"><Heading data={section.data} href={map.path} /><EditorialGrid items={map.items.slice(0, limit(section.data))} basePath={map.path} ImageComponent={ImageComponent} /></div></section>;
195
+ })}</>;
184
196
  }
@@ -7,11 +7,13 @@ export type { NuvlerDefaultFooterProps } from "./footer.js";
7
7
  export { Home } from "./home.js";
8
8
  export { ProductGrid, ProductCard } from "./products.js";
9
9
  export { ProductDetail } from "./product-detail.js";
10
+ export { NotFound } from "./not-found.js";
10
11
  export type {
11
12
  FooterProps,
12
13
  HeaderProps,
13
14
  HomeProps,
14
15
  NuvlerStoreThemeDefinition,
16
+ NotFoundProps,
15
17
  ProductDetailProps,
16
18
  ProductGridProps,
17
19
  SiteTemplate,
@@ -0,0 +1,29 @@
1
+ "use client";
2
+
3
+ import type { NotFoundProps } from "@nuvler/theme-sdk";
4
+ import cloudIllustration from "./assets/not-found-cloud.svg?raw";
5
+
6
+ export function NotFound({ homeHref = "/" }: NotFoundProps) {
7
+ const goBack = () => {
8
+ if (window.history.length > 1) {
9
+ window.history.back();
10
+ return;
11
+ }
12
+ window.location.assign(homeHref);
13
+ };
14
+
15
+ return <main className="nuvler-not-found">
16
+ <div className="nuvler-not-found-content">
17
+ <div className="nuvler-not-found-visual" aria-hidden="true">
18
+ <span className="nuvler-not-found-cloud-svg" dangerouslySetInnerHTML={{ __html: cloudIllustration }} />
19
+ <span className="nuvler-not-found-code">404</span>
20
+ </div>
21
+ <h1>Página não encontrada</h1>
22
+ <p>Parece que esta página foi movida, removida ou nunca existiu.</p>
23
+ <div className="nuvler-not-found-actions">
24
+ <a className="button button-primary" href={homeHref}>Ir para o início</a>
25
+ <button className="button button-secondary" type="button" onClick={goBack}>Voltar</button>
26
+ </div>
27
+ </div>
28
+ </main>;
29
+ }
@@ -4,7 +4,7 @@ import { ProductCarouselFrame } from "./carousel-frame.js";
4
4
  import { ProductCard } from "./products.js";
5
5
  import type { ThemeImageComponent } from "./shared.js";
6
6
 
7
- export function ProductCarousel({ products, showCategory, showDescription, ImageComponent }: { products: ThemeProduct[]; showCategory: boolean; showDescription: boolean; ImageComponent?: ThemeImageComponent }) {
7
+ export function ProductCarousel({ products, showCategory, showDescription, ImageComponent }: { products: ThemeProduct[]; showCategory?: boolean; showDescription?: boolean; ImageComponent?: ThemeImageComponent }) {
8
8
  if (!products.length) return <div className="empty-state"><span>7</span><h2>Nenhum produto encontrado</h2><p>Escolha outra categoria ou publique produtos para esta vitrine.</p></div>;
9
9
  return (
10
10
  <ProductCarouselFrame>
@@ -31,13 +31,17 @@ export function ProductCardAction({
31
31
  href,
32
32
  item,
33
33
  hasVariants,
34
+ unavailable = false,
34
35
  }: {
35
36
  href: string;
36
37
  item: ThemeCartItem;
37
38
  hasVariants: boolean;
39
+ unavailable?: boolean;
38
40
  }) {
39
41
  const { onAddToCart } = useContext(ThemeInteractionContext);
40
42
 
43
+ if (unavailable) return <span className="button button-secondary button-block product-card-action product-card-action-unavailable">Indisponível</span>;
44
+
41
45
  if (hasVariants) {
42
46
  return <a className="button button-secondary button-block product-card-action" href={href}>Escolher opções</a>;
43
47
  }
@@ -113,7 +117,8 @@ export function ProductDetailInteractive({
113
117
  const message = `Olá! Gostaria de solicitar um orçamento para ${product.title}${variantDescription ? ` (${variantDescription})` : ""}${variant?.sku ? ` — ref. ${variant.sku}` : ""}.${productUrl ? ` ${productUrl}` : ""}`;
114
118
  const whatsapp = phone ? `https://wa.me/${phone}?text=${encodeURIComponent(message)}` : null;
115
119
  const hasVariants = product.variantOptions.length > 0;
116
- const canPurchase = !hasVariants || Boolean(variant);
120
+ const outOfStock = product.stockQuantity === 0;
121
+ const canPurchase = !outOfStock && (!hasVariants || Boolean(variant));
117
122
 
118
123
  useEffect(() => {
119
124
  const gallery = galleryRef.current;
@@ -236,6 +241,7 @@ export function ProductDetailInteractive({
236
241
  ? <p className="selected-variant"><strong>{variant.name || variantDescription}</strong>{variant.sku && <span>Referência: {variant.sku}</span>}</p>
237
242
  : <p className="variant-unavailable">Esta combinação não está disponível.</p>}
238
243
  </div>}
244
+ {outOfStock && <p className="product-purchase-unavailable" role="status">Este produto está indisponível no momento.</p>}
239
245
  {canPurchase && addToCart && <button
240
246
  type="button"
241
247
  className="button button-primary button-block"
@@ -1,7 +1,12 @@
1
1
  import type { ProductDetailProps, ThemeImage } from "@nuvler/theme-sdk";
2
2
 
3
3
  import { ProductDetailInteractive } from "./product-detail-interactive.js";
4
- import { ThemeImageView, type ThemeImageComponent } from "./shared.js";
4
+ import { displayPrice, ThemeImageView, type ThemeImageComponent } from "./shared.js";
5
+
6
+ function discountPercent(price: number | null, promotionalPrice: number | null) {
7
+ if (price === null || promotionalPrice === null || promotionalPrice >= price || price <= 0) return null;
8
+ return Math.round((1 - promotionalPrice / price) * 100);
9
+ }
5
10
 
6
11
  export function ProductDetail({
7
12
  product,
@@ -60,15 +65,32 @@ export function ProductDetail({
60
65
  </button>
61
66
  ))
62
67
  : null;
68
+ const previousPrice = product.promotionalPrice !== null && product.price !== null && product.promotionalPrice < product.price
69
+ ? displayPrice({ ...product, promotionalPrice: null })
70
+ : null;
71
+ const currentPrice = displayPrice(product);
72
+ const discount = discountPercent(product.price, product.promotionalPrice);
73
+ const details = [
74
+ product.brand && { label: "Marca", value: product.brand },
75
+ product.model && { label: "Modelo", value: product.model },
76
+ product.ean && { label: "EAN", value: product.ean },
77
+ product.sku && { label: "Referência", value: product.sku },
78
+ ].filter((detail): detail is { label: string; value: string } => Boolean(detail));
79
+ const stockLabel = product.stockQuantity === 0
80
+ ? "Indisponível no momento"
81
+ : product.stockQuantity !== null
82
+ ? "Disponível"
83
+ : null;
63
84
  const information = <>
64
85
  {product.categories[0] && <span className="product-category">{product.categories[0].name}</span>}
65
86
  <h1>{product.title}</h1>
87
+ <div className="product-price-block">{previousPrice && <s>{previousPrice}</s>}{currentPrice ? <strong>{currentPrice}</strong> : <span>Consulte condições com a loja</span>}{discount && <small>{discount}% de desconto</small>}</div>
88
+ {stockLabel && <p className={`product-availability${product.stockQuantity === 0 ? " unavailable" : ""}`}>{stockLabel}</p>}
89
+ {product.sku && <p className="product-reference">Ref. {product.sku}</p>}
66
90
  <div className="product-description">{descriptionContent}</div>
91
+ {details.length > 0 && <section className="product-specifications" aria-labelledby="product-specifications-title"><h2 id="product-specifications-title">Informações do produto</h2><dl>{details.map((detail) => <div key={detail.label}><dt>{detail.label}</dt><dd>{detail.value}</dd></div>)}</dl></section>}
67
92
  </>;
68
- const benefits = <div className="purchase-benefits">
69
- <span><strong>Atendimento direto</strong> Fale com quem entende do produto</span>
70
- <span><strong>Orçamento personalizado</strong> Condições para a sua necessidade</span>
71
- </div>;
93
+ const benefits = (contact?.whatsapp || contact?.email || contact?.phone) ? <div className="purchase-benefits"><span><strong>Precisa de ajuda?</strong> Fale com a loja para tirar dúvidas sobre este produto.</span></div> : null;
72
94
 
73
95
  return (
74
96
  <ProductDetailInteractive
@@ -1,6 +1,11 @@
1
1
  import { productUrl, type ProductGridProps, type ThemeProduct } from "@nuvler/theme-sdk";
2
2
  import { ProductCardAction } from "./product-detail-interactive.js";
3
- import { plainText, ThemeImageView, type ThemeImageComponent } from "./shared.js";
3
+ import { displayPrice, plainText, ThemeImageView, type ThemeImageComponent } from "./shared.js";
4
+
5
+ function discountPercent(price: number | null, promotionalPrice: number | null) {
6
+ if (price === null || promotionalPrice === null || promotionalPrice >= price || price <= 0) return null;
7
+ return Math.round((1 - promotionalPrice / price) * 100);
8
+ }
4
9
 
5
10
  export function ProductCard({ product, showCategory = true, showDescription = true, ImageComponent = ThemeImageView }: {
6
11
  product: ThemeProduct;
@@ -9,7 +14,13 @@ export function ProductCard({ product, showCategory = true, showDescription = tr
9
14
  ImageComponent?: ThemeImageComponent;
10
15
  }) {
11
16
  const href = productUrl(product);
12
- return <article className="product-card"><a className="product-card-image" href={href} aria-label={`Ver ${product.title}`}><ImageComponent image={product.image} fallbackAlt={product.title} sizes="(max-width: 720px) 92vw, (max-width: 1100px) 45vw, 25vw" fallbackWidth={720} fallbackHeight={720} /></a><div className="product-card-content">{showCategory && <span className={`product-category${product.categories[0] ? "" : " product-category-empty"}`}>{product.categories[0]?.name || "Sem categoria"}</span>}<h3><a className="product-card-details-link" href={href}>{product.title}</a></h3>{showDescription && product.description && <p className="product-card-description">{plainText(product.description)}</p>}<ProductCardAction href={href} hasVariants={product.variantOptions.length > 0} item={{ productSlug: product.slug, productUrl: href, title: product.title, sku: product.sku, image: product.image, unitPrice: product.promotionalPrice ?? product.price }} /></div></article>;
17
+ const unavailable = product.stockQuantity === 0;
18
+ const discount = discountPercent(product.price, product.promotionalPrice);
19
+ const currentPrice = displayPrice(product);
20
+ const previousPrice = product.promotionalPrice !== null && product.price !== null && product.promotionalPrice < product.price
21
+ ? displayPrice({ ...product, promotionalPrice: null })
22
+ : null;
23
+ return <article className="product-card" data-unavailable={unavailable || undefined}><a className="product-card-image" href={href} aria-label={`Ver ${product.title}`}>{discount && <span className="product-card-badge">-{discount}%</span>}{unavailable && <span className="product-card-stock">Indisponível</span>}<ImageComponent image={product.image} fallbackAlt={product.title} sizes="(max-width: 720px) 92vw, (max-width: 1100px) 45vw, 25vw" fallbackWidth={720} fallbackHeight={720} /></a><div className="product-card-content">{showCategory && <span className={`product-category${product.categories[0] ? "" : " product-category-empty"}`}>{product.categories[0]?.name || "Sem categoria"}</span>}<h3><a className="product-card-details-link" href={href}>{product.title}</a></h3>{showDescription && product.description && <p className="product-card-description">{plainText(product.description)}</p>}<div className="product-card-price">{previousPrice && <s>{previousPrice}</s>}{currentPrice ? <strong>{currentPrice}</strong> : <span>Consulte condições</span>}</div>{product.sku && <small className="product-card-sku">Ref. {product.sku}</small>}<ProductCardAction href={href} hasVariants={product.variantOptions.length > 0} unavailable={unavailable} item={{ productSlug: product.slug, productUrl: href, title: product.title, sku: product.sku, image: product.image, unitPrice: product.promotionalPrice ?? product.price }} /></div></article>;
13
24
  }
14
25
 
15
26
  export function ProductGrid({ products, columns = 4, showCategory = true, showDescription = true, ImageComponent = ThemeImageView }: ProductGridProps & { ImageComponent?: ThemeImageComponent }) {
@@ -42,6 +42,8 @@ export function NuvlerDefaultShell({
42
42
  colors: { ...nuvlerDefaultTokens.colors, ...configured?.colors },
43
43
  layout: { ...nuvlerDefaultTokens.layout, ...configured?.layout },
44
44
  };
45
+ const containerWidth = Math.min(1600, Math.max(960, Number(tokens.layout.containerWidth) || nuvlerDefaultTokens.layout.containerWidth));
46
+ const borderRadius = Math.min(32, Math.max(0, Number(tokens.layout.borderRadius) || 0));
45
47
  const style = {
46
48
  "--color-primary": tokens.colors.primary,
47
49
  "--color-primary-text": tokens.colors.primaryText,
@@ -58,8 +60,8 @@ export function NuvlerDefaultShell({
58
60
  "--store-header-text": tokens.colors.headerText,
59
61
  "--store-footer-background": tokens.colors.footerBackground,
60
62
  "--store-footer-text": tokens.colors.footerText,
61
- "--container-width": `${tokens.layout.containerWidth}px`,
62
- "--border-radius": `${tokens.layout.borderRadius}px`,
63
+ "--container-width": `${containerWidth}px`,
64
+ "--border-radius": `${borderRadius}px`,
63
65
  } as CSSProperties;
64
66
 
65
67
  return (
@@ -73,14 +75,11 @@ export function NuvlerDefaultShell({
73
75
  <Header
74
76
  site={site}
75
77
  categories={categories}
76
- pages={pages}
77
78
  menu={menu}
78
79
  headerButton={headerButton}
79
- template={nuvlerDefaultTemplate}
80
80
  cart={cart}
81
81
  suggestionsEndpoint={suggestionsEndpoint}
82
82
  suggestionsQueryParam={suggestionsQueryParam}
83
- ImageComponent={ImageComponent}
84
83
  />
85
84
  <div className="store-page">{children}</div>
86
85
  <Footer
@@ -88,6 +87,7 @@ export function NuvlerDefaultShell({
88
87
  pages={pages}
89
88
  template={nuvlerDefaultTemplate}
90
89
  platformBrand={platformBrand}
90
+ ImageComponent={ImageComponent}
91
91
  />
92
92
  </div>
93
93
  );
@@ -1 +1,16 @@
1
1
  declare module "*.css";
2
+
3
+ declare module "*.png" {
4
+ const source: string;
5
+ export default source;
6
+ }
7
+
8
+ declare module "*.svg" {
9
+ const source: string;
10
+ export default source;
11
+ }
12
+
13
+ declare module "*.svg?raw" {
14
+ const source: string;
15
+ export default source;
16
+ }
@@ -43,21 +43,37 @@ function catalogHref(route: Extract<PreviewRoute, { type: "catalog" }>, page: nu
43
43
  return params.size ? `${pathname}?${params}` : pathname;
44
44
  }
45
45
 
46
+ function editorialMeta(basePath: string) {
47
+ if (basePath === "/servicos") return { eyebrow: "Soluções", action: "Conhecer serviço", empty: "Nenhum serviço publicado" };
48
+ if (basePath === "/cases") return { eyebrow: "Cases", action: "Ver case", empty: "Nenhum case publicado" };
49
+ return { eyebrow: "Conteúdo", action: "Ler artigo", empty: "Nenhum conteúdo publicado" };
50
+ }
51
+
52
+ function publishedDate(value: string | null) {
53
+ if (!value) return null;
54
+ const date = new Date(value);
55
+ return Number.isNaN(date.getTime()) ? null : new Intl.DateTimeFormat("pt-BR", { dateStyle: "medium" }).format(date);
56
+ }
57
+
46
58
  function EditorialPreview({ items, basePath }: { items: ThemeEditorialItem[]; basePath: string }) {
47
- return <div className="editorial-grid">{items.map((item) => <article className="editorial-card" key={item.slug}><div className="editorial-card-content"><h2><a href={`${basePath}/${item.slug}`}>{item.title}</a></h2><p>{item.description}</p><a className="text-link" href={`${basePath}/${item.slug}`}>Saiba mais <span>→</span></a></div></article>)}</div>;
59
+ const meta = editorialMeta(basePath);
60
+ if (!items.length) return <div className="empty-state"><span>7</span><h2>{meta.empty}</h2><p>Novas publicações aparecerão aqui quando estiverem disponíveis.</p></div>;
61
+ return <div className="editorial-grid editorial-list-grid">{items.map((item) => <article className="editorial-card" key={item.slug}><a className="editorial-card-image" href={`${basePath}/${item.slug}`}><ThemeImageView image={item.image || item.thumbnail || item.coverImage} fallbackAlt={item.title} sizes="(max-width: 720px) 92vw, 33vw" fallbackWidth={720} fallbackHeight={480} /></a><div className="editorial-card-content">{(item.category?.title || item.category?.name) && <span>{item.category.title || item.category.name}</span>}<h2><a href={`${basePath}/${item.slug}`}>{item.title}</a></h2>{publishedDate(item.publishedAt) && <small className="editorial-card-date">{publishedDate(item.publishedAt)}</small>}<p>{item.description}</p><a className="text-link" href={`${basePath}/${item.slug}`}>{meta.action} <span>→</span></a></div></article>)}</div>;
48
62
  }
49
63
 
50
64
  export function createNuvlerDefaultRuntime(themeDefinition: NuvlerStoreThemeDefinition) {
51
65
  function Theme({ context, route = { type: "home" }, adapters, sdk }: NuvlerDefaultThemeProps) {
52
66
  const [cartItems, setCartItems] = useState<PreviewCartItem[]>([]);
53
67
  const [cartOpen, setCartOpen] = useState(false);
54
- const { Header, Footer, Home, ProductDetail, ProductGrid } = themeDefinition.components;
68
+ const { Header, Footer, Home, ProductDetail, ProductGrid, NotFound } = themeDefinition.components;
55
69
  const site: ThemeSite = { tenant: context.store, modules: context.site.modules, settings: context.site.settings };
56
70
  const configured = site.settings?.theme;
57
71
  const tokens = {
58
72
  colors: { ...themeDefinition.tokens.colors, ...configured?.colors },
59
73
  layout: { ...themeDefinition.tokens.layout, ...configured?.layout },
60
74
  };
75
+ const containerWidth = Math.min(1600, Math.max(960, Number(tokens.layout.containerWidth) || 1280));
76
+ const borderRadius = Math.min(32, Math.max(0, Number(tokens.layout.borderRadius) || 0));
61
77
  const style = {
62
78
  "--color-primary": tokens.colors.primary,
63
79
  "--color-primary-text": tokens.colors.primaryText,
@@ -74,8 +90,8 @@ export function createNuvlerDefaultRuntime(themeDefinition: NuvlerStoreThemeDefi
74
90
  "--store-header-text": tokens.colors.headerText,
75
91
  "--store-footer-background": tokens.colors.footerBackground,
76
92
  "--store-footer-text": tokens.colors.footerText,
77
- "--container-width": `${tokens.layout.containerWidth}px`,
78
- "--border-radius": `${tokens.layout.borderRadius}px`,
93
+ "--container-width": `${containerWidth}px`,
94
+ "--border-radius": `${borderRadius}px`,
79
95
  } as CSSProperties;
80
96
  const cartCount = cartItems.reduce((total, item) => total + item.quantity, 0);
81
97
  const cartMessage = useMemo(() => `Olá! Gostaria de solicitar um orçamento para os itens abaixo:\n\n${cartItems.map((item, index) => `${index + 1}. ${item.quantity}x ${item.title}${item.variantName ? ` (${item.variantName})` : ""}${item.sku ? ` — ref. ${item.sku}` : ""}`).join("\n\n")}`, [cartItems]);
@@ -97,10 +113,13 @@ export function createNuvlerDefaultRuntime(themeDefinition: NuvlerStoreThemeDefi
97
113
  if (route.type === "home") content = <main><Home sections={context.home.content.sections} products={context.catalog.products} posts={context.editorial.posts} services={context.editorial.services} cases={context.editorial.cases} site={site} submitContact={sdk?.contact?.submit} template={themeDefinition.template} /></main>;
98
114
  else if (route.type === "product") content = <main className="product-page"><div className="store-container"><nav className="breadcrumbs" aria-label="Navegação estrutural"><a href="/">Início</a><span>/</span><a href="/produtos">Produtos</a><span>/</span><strong>{route.product.title}</strong></nav><ProductDetail product={route.product} contact={site.settings?.contact} productUrl={window.location.href} descriptionContent={<p>{plainText(route.product.description)}</p>} onAddToCart={addToCart} /></div></main>;
99
115
  else if (route.type === "catalog") content = <main className="catalog-page"><section className="catalog-hero"><div className="store-container"><span>Nosso catálogo</span><h1>{route.search ? `Busca por “${route.search}”` : "Todos os produtos"}</h1><p>{route.pagination.total} produto(s)</p></div></section><div className="store-container catalog-layout"><aside className="category-filter catalog-filters"><form action={route.categoryPath.length ? `/${route.categoryPath.join("/")}` : "/produtos"} className="catalog-filter-form"><label htmlFor="preview-catalog-search">Buscar no catálogo</label><div className="catalog-filter-search"><input id="preview-catalog-search" name="busca" type="search" defaultValue={route.search} placeholder="Nome do produto" /><button type="submit" aria-label="Pesquisar">⌕</button></div></form>{route.facets.length > 0 && <form className="catalog-variant-filters">{route.search && <input type="hidden" name="busca" value={route.search} />}{route.facets.map((facet) => <fieldset className="catalog-filter-section" key={facet.name}><legend>{facet.name}</legend>{facet.values.map(({ value, count }) => { const token = `${facet.name}::${value}`; return <label className="catalog-filter-checkbox" key={token}><input type="checkbox" name="variante" value={token} defaultChecked={route.variants.includes(token)} /><span>{value}</span><small>{count}</small></label>; })}</fieldset>)}<button type="submit" className="button button-primary button-block">Aplicar filtros</button></form>}</aside><section className="catalog-results"><ProductGrid products={route.products} columns={site.settings?.catalog?.desktopColumns || 3} showCategory={site.settings?.catalog?.showCategory} showDescription={site.settings?.catalog?.showDescription} />{route.pagination.totalPages > 1 && <nav className="catalog-pagination" aria-label="Paginação dos produtos"><a className={route.pagination.hasPreviousPage ? "" : "disabled"} href={catalogHref(route, Math.max(1, route.pagination.page - 1))}><span>‹</span> Anterior</a><div className="catalog-pagination-pages"><span className="catalog-pagination-item"><a className="active" href={catalogHref(route, route.pagination.page)}>{route.pagination.page}</a></span></div><a className={route.pagination.hasNextPage ? "" : "disabled"} href={catalogHref(route, Math.min(route.pagination.totalPages, route.pagination.page + 1))}>Próxima <span>›</span></a></nav>}</section></div></main>;
100
- else if (route.type === "editorial-list") content = <main className="catalog-page"><section className="catalog-hero"><div className="store-container"><span>Conteúdo</span><h1>{route.title}</h1></div></section><section className="store-section"><div className="store-container"><EditorialPreview items={route.items} basePath={route.basePath} /></div></section></main>;
101
- else if (route.type === "editorial-detail") content = <main className="store-section"><article className="store-container editorial-content"><span>Conteúdo</span><h1>{route.item.title}</h1><p>{route.item.description}</p></article></main>;
102
- else content = <main className="not-found-page"><div className="not-found-card"><span>{route.type === "loading" ? "Carregando" : "404"}</span><h1>{route.title || (route.type === "loading" ? "Buscando conteúdo da loja" : "Conteúdo não encontrado")}</h1></div></main>;
103
- return <ThemeInteractionProvider onAddToCart={addToCart}><div className="store-shell nuvler-default-theme" data-theme-id={themeDefinition.manifest.id} data-theme-version={themeDefinition.manifest.version} style={style}><Header site={site} categories={context.navigation.categories} pages={context.navigation.pages} menu={context.navigation.menu} headerButton={context.navigation.headerButton} template={themeDefinition.template} searchProducts={adapters?.searchProducts} cart={cartButton} /><div className="store-page">{content}</div><Footer site={site} pages={context.navigation.pages} template={themeDefinition.template} />{cartOpen && <div className="cart-backdrop" role="presentation" onPointerDown={(event) => event.target === event.currentTarget && setCartOpen(false)}><aside className="cart-drawer" aria-label="Carrinho de orçamento"><div className="cart-heading"><div><small>Seu orçamento</small><strong>{cartCount} {cartCount === 1 ? "item" : "itens"}</strong></div><button type="button" onClick={() => setCartOpen(false)} aria-label="Fechar carrinho">×</button></div><div className="cart-items">{!cartItems.length && <div className="cart-empty"><strong>Seu carrinho está vazio</strong><p>Abra um produto e adicione-o para montar a solicitação.</p><button type="button" onClick={() => setCartOpen(false)}>Continuar navegando</button></div>}{cartItems.map((item) => <article className="cart-item" key={item.key}><a href={item.productUrl || productUrl({ slug: item.productSlug })} onClick={() => setCartOpen(false)}><ThemeImageView image={item.image} fallbackAlt={item.title} /></a><div><strong>{item.title}</strong>{item.variantName && <small>{item.variantName}</small>}{item.sku && <small>Ref. {item.sku}</small>}<div className="cart-quantity"><button type="button" onClick={() => setCartItems((current) => current.flatMap((candidate) => candidate.key !== item.key ? [candidate] : candidate.quantity > 1 ? [{ ...candidate, quantity: candidate.quantity - 1 }] : []))}>−</button><span>{item.quantity}</span><button type="button" onClick={() => setCartItems((current) => current.map((candidate) => candidate.key === item.key ? { ...candidate, quantity: Math.min(99, candidate.quantity + 1) } : candidate))}>+</button><button type="button" className="cart-remove" onClick={() => setCartItems((current) => current.filter((candidate) => candidate.key !== item.key))}>Remover</button></div></div></article>)}</div>{cartItems.length > 0 && <footer className="cart-footer"><p>O valor e a disponibilidade serão confirmados pela loja.</p>{checkoutUrl ? <a className="button button-primary button-block" href={checkoutUrl} target="_blank" rel="noreferrer">Enviar orçamento pelo WhatsApp</a> : <p className="cart-warning">Configure o WhatsApp da loja para enviar o orçamento.</p>}</footer>}</aside></div>}</div></ThemeInteractionProvider>;
116
+ else if (route.type === "editorial-list") { const meta = editorialMeta(route.basePath); content = <main className="editorial-list-page"><section className="theme-page-hero"><div className="store-container"><span className="page-kicker">{meta.eyebrow}</span><h1>{route.title}</h1></div></section><section className="store-section"><div className="store-container"><EditorialPreview items={route.items} basePath={route.basePath} /></div></section></main>; }
117
+ else if (route.type === "editorial-detail") { const meta = editorialMeta(route.basePath); const image = route.item.image || route.item.coverImage || route.item.thumbnail; content = <main className="article-page"><article className="store-container article-shell"><nav className="breadcrumbs" aria-label="Navegação estrutural"><a href="/">Início</a><span>/</span><a href={route.basePath}>{route.basePath === "/blog" ? "Blog" : route.basePath === "/servicos" ? "Serviços" : "Cases"}</a><span>/</span><strong>{route.item.title}</strong></nav><header className="article-header">{(route.item.category?.title || route.item.category?.name) ? <span>{route.item.category.title || route.item.category.name}</span> : <span>{meta.eyebrow}</span>}<h1>{route.item.title}</h1>{route.item.description && <p>{route.item.description}</p>}{publishedDate(route.item.publishedAt) && <small>{publishedDate(route.item.publishedAt)}</small>}</header>{image && <ThemeImageView image={image} fallbackAlt={route.item.title} className="article-cover" priority sizes="(max-width: 1100px) 100vw, 1040px" fallbackWidth={1600} fallbackHeight={900} />}<div className="article-content"><a className="text-link" href={route.basePath}>← Voltar para {route.basePath === "/blog" ? "o blog" : route.basePath === "/servicos" ? "serviços" : "cases"}</a></div></article></main>; }
118
+ else if (route.type === "not-found") content = NotFound ? <NotFound homeHref="/" /> : <main className="not-found-page"><div className="not-found-card"><span>404</span><h1>Conteúdo não encontrado</h1></div></main>;
119
+ else content = <main className="not-found-page"><div className="not-found-card"><span>Carregando</span><h1>{route.title || "Buscando conteúdo da loja"}</h1></div></main>;
120
+ // A 404 mantém a mesma moldura das demais páginas, inclusive o footer.
121
+ const isNotFound = false;
122
+ return <ThemeInteractionProvider onAddToCart={addToCart}><div className="store-shell nuvler-default-theme" data-theme-id={themeDefinition.manifest.id} data-theme-version={themeDefinition.manifest.version} style={style}><Header site={site} categories={context.navigation.categories} pages={context.navigation.pages} menu={context.navigation.menu} headerButton={context.navigation.headerButton} template={themeDefinition.template} searchProducts={adapters?.searchProducts} cart={cartButton} /><div className={`store-page${isNotFound ? " store-page-not-found" : ""}`}>{content}</div>{!isNotFound && <Footer site={site} pages={context.navigation.pages} template={themeDefinition.template} />}{cartOpen && <div className="cart-backdrop" role="presentation" onPointerDown={(event) => event.target === event.currentTarget && setCartOpen(false)}><aside className="cart-drawer" aria-label="Carrinho de orçamento"><div className="cart-heading"><div><small>Seu orçamento</small><strong>{cartCount} {cartCount === 1 ? "item" : "itens"}</strong></div><button type="button" onClick={() => setCartOpen(false)} aria-label="Fechar carrinho">×</button></div><div className="cart-items">{!cartItems.length && <div className="cart-empty"><strong>Seu carrinho está vazio</strong><p>Abra um produto e adicione-o para montar a solicitação.</p><button type="button" onClick={() => setCartOpen(false)}>Continuar navegando</button></div>}{cartItems.map((item) => <article className="cart-item" key={item.key}><a href={item.productUrl || productUrl({ slug: item.productSlug })} onClick={() => setCartOpen(false)}><ThemeImageView image={item.image} fallbackAlt={item.title} /></a><div><strong>{item.title}</strong>{item.variantName && <small>{item.variantName}</small>}{item.sku && <small>Ref. {item.sku}</small>}<div className="cart-quantity"><button type="button" onClick={() => setCartItems((current) => current.flatMap((candidate) => candidate.key !== item.key ? [candidate] : candidate.quantity > 1 ? [{ ...candidate, quantity: candidate.quantity - 1 }] : []))}>−</button><span>{item.quantity}</span><button type="button" onClick={() => setCartItems((current) => current.map((candidate) => candidate.key === item.key ? { ...candidate, quantity: Math.min(99, candidate.quantity + 1) } : candidate))}>+</button><button type="button" className="cart-remove" onClick={() => setCartItems((current) => current.filter((candidate) => candidate.key !== item.key))}>Remover</button></div></div></article>)}</div>{cartItems.length > 0 && <footer className="cart-footer"><p>O valor e a disponibilidade serão confirmados pela loja.</p>{checkoutUrl ? <a className="button button-primary button-block" href={checkoutUrl} target="_blank" rel="noreferrer">Enviar orçamento pelo WhatsApp</a> : <p className="cart-warning">Configure o WhatsApp da loja para enviar o orçamento.</p>}</footer>}</aside></div>}</div></ThemeInteractionProvider>;
104
123
  }
105
124
 
106
125
  Theme.displayName = `NuvlerThemeRuntime(${themeDefinition.manifest.id})`;
@@ -19,30 +19,30 @@ export const nuvlerDefaultTokens = {
19
19
  secondary: "#d99b31",
20
20
  secondaryText: "#18221b",
21
21
  accent: "#b45309",
22
- background: "#f7f7f2",
22
+ background: "#fbfcfa",
23
23
  surface: "#ffffff",
24
- surfaceAlt: "#eef2e9",
25
- text: "#18221b",
24
+ surfaceAlt: "#f4f7f3",
25
+ text: "#172019",
26
26
  textMuted: "#657068",
27
- border: "#dfe4dd",
27
+ border: "#dce3dc",
28
28
  headerBackground: "#ffffff",
29
29
  headerText: "#18221b",
30
30
  footerBackground: "#14251a",
31
31
  footerText: "#f7f7f2",
32
32
  },
33
- layout: { containerWidth: 1280, borderRadius: 18 },
33
+ layout: { containerWidth: 1280, borderRadius: 16 },
34
34
  } satisfies NuvlerStoreThemeDefinition["tokens"];
35
35
 
36
36
  export const nuvlerDefaultTemplate = {
37
- announcement: "Soluções, conteúdo e atendimento para o seu negócio",
38
- footerTagline: "Soluções, conteúdo e atendimento próximo para aproximar sua marca das pessoas.",
37
+ announcement: "Produtos selecionados e atendimento para você comprar com confiança",
38
+ footerTagline: "Produtos, conteúdo e atendimento para tornar sua experiência de compra mais simples.",
39
39
  footerNavigationLabel: "Navegação",
40
- footerNote: "Conteúdo e atendimento que geram confiança",
41
- socialLabel: "Acompanhe a empresa",
40
+ footerNote: "Uma experiência de compra feita para você",
41
+ socialLabel: "Acompanhe a loja",
42
42
  benefits: [
43
- { title: "Soluções sob medida", description: "Serviços pensados para o seu momento" },
44
- { title: "Conteúdo relevante", description: "Informação para ajudar nas decisões" },
45
- { title: "Atendimento próximo", description: "Fale diretamente com a empresa" },
43
+ { title: "Compra com confiança", description: "Informações claras para decidir melhor" },
44
+ { title: "Seleção para você", description: "Produtos organizados para facilitar sua busca" },
45
+ { title: "Atendimento próximo", description: "Conte com a loja sempre que precisar" },
46
46
  ],
47
47
  fallbackSections(modules) {
48
48
  const sections = [section("default-hero", "hero", 0)];