@the-smithy/create-hearth-site 0.17.0 → 0.18.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-smithy/create-hearth-site",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Start a new client website powered by Hearth: pnpm create @the-smithy/hearth-site",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "devDependencies": {
31
31
  "vitest": "^5.0.3",
32
- "@the-smithy/hearth-schema": "^0.17.0"
32
+ "@the-smithy/hearth-schema": "^0.18.0"
33
33
  },
34
34
  "scripts": {
35
35
  "test": "node --test \"test/**/*.test.js\" && vitest run test/blocks.test.ts"
@@ -37,6 +37,10 @@ Do these before writing code, and tell the developer what you found:
37
37
  - **Previews come from the SDK.** `<HearthPreview />` in the root layout shows drafts and refreshes as editors
38
38
  work in Hearth. Don't build a preview banner of your own.
39
39
  - **Forms** post through `submitHearthForm` in `src/app/actions.ts`. Keep the hidden `_gotcha` field.
40
+ - **Analytics comes from the SDK.** `<HearthAnalytics />` in the root layout counts visits for the site's Traffic
41
+ page in Hearth: cookieless, so no consent banner. Don't add Google Analytics or other trackers. Marketing tags
42
+ (ads pixels) need a consent banner and are a separate, opt-in feature. Use `track("name")` from
43
+ `@the-smithy/hearth/analytics` for meaningful actions (a booking, a sign-up).
40
44
 
41
45
  ## Checks
42
46
 
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import { HearthAnalytics } from "@the-smithy/hearth/analytics";
2
3
  import { siteLang } from "@the-smithy/hearth/next";
3
4
  import { HearthPreview } from "@the-smithy/hearth/preview";
4
5
  import { SiteFooter } from "@/components/SiteFooter";
@@ -15,6 +16,7 @@ export const generateMetadata = () => hearthNext.siteMetadata();
15
16
 
16
17
  export default async function RootLayout({ children }: { children: ReactNode }) {
17
18
  const site = await hearthNext.getSite();
19
+ const preview = await hearthNext.isPreview();
18
20
  return (
19
21
  <html lang={siteLang(site)}>
20
22
  <body className="flex min-h-dvh flex-col">
@@ -22,12 +24,14 @@ export default async function RootLayout({ children }: { children: ReactNode })
22
24
  Skip to content
23
25
  </a>
24
26
  {/* Live draft preview from Hearth: shows while an editor previews, refreshes as they edit. */}
25
- {(await hearthNext.isPreview()) ? <HearthPreview /> : null}
27
+ {preview ? <HearthPreview /> : null}
26
28
  <SiteHeader site={site} />
27
29
  <main id="main" className="flex-1">
28
30
  {children}
29
31
  </main>
30
32
  <SiteFooter site={site} />
33
+ {/* Hearth's built-in visitor analytics (cookieless, no banner needed): off in draft preview and when the site turns it off. */}
34
+ {site.analytics && !preview ? <HearthAnalytics config={site.analytics} /> : null}
31
35
  </body>
32
36
  </html>
33
37
  );