@getvitops/astro 8.1.0 → 8.2.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/CHANGELOG.md +824 -33
- package/dist/config-adapters-CbTywgEY.mjs +71 -0
- package/dist/config-adapters-CbTywgEY.mjs.map +1 -0
- package/dist/exports/tracking.d.mts +1 -1
- package/dist/exports/tracking.mjs +1 -1
- package/dist/index.d.mts +65 -48
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +240 -32
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.d.mts +23 -0
- package/dist/middleware.d.mts.map +1 -0
- package/dist/middleware.mjs +34 -0
- package/dist/middleware.mjs.map +1 -0
- package/dist/routes/conversion.d.mts +131 -16
- package/dist/routes/conversion.d.mts.map +1 -1
- package/dist/routes/conversion.mjs +133 -28
- package/dist/routes/conversion.mjs.map +1 -1
- package/dist/{tracking-CmSfxWC3.mjs → tracking-Cb3A0BrC.mjs} +3 -4
- package/dist/tracking-Cb3A0BrC.mjs.map +1 -0
- package/dist/{tracking-DdEKExlE.d.mts → tracking-D2xOzjFD.d.mts} +6 -26
- package/dist/tracking-D2xOzjFD.d.mts.map +1 -0
- package/package.json +12 -8
- package/src/ads.ts +52 -16
- package/src/analytics.ts +98 -11
- package/src/components/Analytics.astro +5 -1
- package/src/components/CookieConsent.astro +2 -1
- package/src/components/Icon.astro +8 -1
- package/src/components/ReviewCardBody.astro +5 -2
- package/src/components/Tracking.astro +2 -1
- package/src/schemas/Article.astro +2 -1
- package/src/schemas/BookActions.astro +2 -1
- package/src/schemas/Breadcrumb.astro +2 -1
- package/src/schemas/Carousel.astro +2 -1
- package/src/schemas/CourseList.astro +2 -1
- package/src/schemas/Dataset.astro +2 -1
- package/src/schemas/DiscussionForum.astro +2 -1
- package/src/schemas/EducationQA.astro +2 -1
- package/src/schemas/EmployerAggregateRating.astro +2 -1
- package/src/schemas/Event.astro +2 -1
- package/src/schemas/FAQ.astro +2 -1
- package/src/schemas/FactCheck.astro +2 -1
- package/src/schemas/ImageMetadata.astro +2 -1
- package/src/schemas/JobPosting.astro +2 -1
- package/src/schemas/LocalBusiness.astro +2 -1
- package/src/schemas/MathSolver.astro +2 -1
- package/src/schemas/MovieCarousel.astro +2 -1
- package/src/schemas/Organization.astro +2 -1
- package/src/schemas/Product.astro +2 -1
- package/src/schemas/ProfilePage.astro +2 -1
- package/src/schemas/QAPage.astro +2 -1
- package/src/schemas/Recipe.astro +2 -1
- package/src/schemas/Review.astro +2 -1
- package/src/schemas/SoftwareApp.astro +2 -1
- package/src/scripts/tracking.ts +114 -21
- package/src/seo.ts +6 -5
- package/src/tracking.ts +6 -10
- package/virtual.d.ts +17 -1
- package/dist/tracking-CmSfxWC3.mjs.map +0 -1
- package/dist/tracking-DdEKExlE.d.mts.map +0 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { t } from "@getvitops/utils/content";
|
|
2
|
+
|
|
3
|
+
// src/routes/config-adapters.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the one display name for a site's organization — `organization.name`
|
|
6
|
+
* (localizable; `locale` picks which one, defaulting to `site.defaultLocale`,
|
|
7
|
+
* which is also the fallback if the pick has no entry), falling back to
|
|
8
|
+
* `legalName` when `name` isn't set at all, and to `undefined` (never `''`)
|
|
9
|
+
* when neither resolves to anything — `t()` returns `''` for a genuinely
|
|
10
|
+
* missing translation, and an empty name is worse than none.
|
|
11
|
+
*
|
|
12
|
+
* This is the one place that fallback chain is written. An EmDash site's own
|
|
13
|
+
* `getSiteSettings().title` is a separate, runtime-only fact (EmDash's
|
|
14
|
+
* settings aren't readable at Astro build/config time at all — see
|
|
15
|
+
* AGENTS.md's "EmDash plugin as the design-system editing surface") and stays
|
|
16
|
+
* authoritative for what it drives (the rendered page chrome); this helper is
|
|
17
|
+
* for the build-time-only consumers that can't reach EmDash at all — favicon
|
|
18
|
+
* generation, generated legal documents, notification emails — so a scaffold
|
|
19
|
+
* needing a name in `astro.config.mjs` has one real source instead of a third
|
|
20
|
+
* hardcoded string.
|
|
21
|
+
*/
|
|
22
|
+
function resolveOrganizationName(config, locale) {
|
|
23
|
+
const org = config.organization;
|
|
24
|
+
const resolvedLocale = locale ?? config.site.defaultLocale;
|
|
25
|
+
return (org?.name != null ? t(org.name, resolvedLocale, config.site.defaultLocale) || void 0 : void 0) ?? org?.legalName;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Builds the `context` option `createConversionRoute()` expects, straight from a
|
|
29
|
+
* resolved `Config` — instead of every consumer hand-writing a `NotifyContext`
|
|
30
|
+
* literal.
|
|
31
|
+
*
|
|
32
|
+
* `locationEmails` is primary-first, then every other location with an `email`,
|
|
33
|
+
* in `organization.locations`' own key order — `planNotifications` picks the
|
|
34
|
+
* first that's set, so order here is the whole precedence.
|
|
35
|
+
*/
|
|
36
|
+
function toNotifyContext(config, locale) {
|
|
37
|
+
const org = config.organization;
|
|
38
|
+
const primaryKey = org?.primaryLocation;
|
|
39
|
+
const locationEmails = Object.entries(org?.locations ?? {}).sort(([a], [b]) => a === primaryKey ? -1 : b === primaryKey ? 1 : 0).map(([, loc]) => loc.email).filter((email) => !!email);
|
|
40
|
+
return {
|
|
41
|
+
notifications: config.site.notifications,
|
|
42
|
+
canonical: config.site.domains?.canonical,
|
|
43
|
+
organizationName: resolveOrganizationName(config, locale),
|
|
44
|
+
locationEmails
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* `site.crm` IS `CrmConfig` — both are the schema's inferred type from `@getvitops/config` — so
|
|
49
|
+
* this returns its argument's field unchanged.
|
|
50
|
+
*
|
|
51
|
+
* @deprecated Pass `config.site.crm` directly. Kept so existing callers keep compiling; it
|
|
52
|
+
* stopped being an adapter when the type stopped being a copy.
|
|
53
|
+
*/
|
|
54
|
+
function toCrmConfig(config) {
|
|
55
|
+
return config.site.crm;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* `site.ads.google`'s three server-side-relevant fields, for
|
|
59
|
+
* `createConversionRoute`'s `googleAdsOffline.config`. Undefined when the site has no Google Ads
|
|
60
|
+
* property configured at all, which `createConversionRoute` reads the same way `crm` being
|
|
61
|
+
* omitted does: the upload never runs.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Pass `config.site.ads?.google` directly — it is already assignable. Kept so existing
|
|
64
|
+
* callers keep compiling.
|
|
65
|
+
*/
|
|
66
|
+
function toGoogleAdsConfig(config) {
|
|
67
|
+
return config.site.ads?.google;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { toNotifyContext as i, toCrmConfig as n, toGoogleAdsConfig as r, resolveOrganizationName as t };
|
|
71
|
+
//# sourceMappingURL=config-adapters-CbTywgEY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-adapters-CbTywgEY.mjs","names":[],"sources":["../src/routes/config-adapters.ts"],"sourcesContent":["/**\n * Adapts a resolved `Config` (`@getvitops/generator`) into the structural shapes\n * `createConversionRoute()` expects — `context: NotifyContext` and `crm.config:\n * CrmConfig`. Neither of those types can import `Config` themselves (they live in\n * `@getvitops/utils`, which the generator already depends on — importing back\n * would be a cycle), which is why `conversion.ts`'s own docblock used to describe\n * `toNotifyContext(config)` as a helper that \"does not exist.\" This package\n * already depends on both the generator and utils, so it's the one place the\n * adapter can live.\n *\n * `import type` only — erased at build, so pulling in `Config`'s type costs\n * nothing at runtime and doesn't drag the generator's `node:fs`/lightningcss\n * entry point into a Worker bundle.\n */\nimport type { Config } from '@getvitops/generator';\n// The `/content` subpath, not the root barrel: the root re-exports `favicon` (sharp), and a\n// Worker route should not depend on tree-shaking to keep it out.\nimport { t, type Localizable } from '@getvitops/utils/content';\nimport type { AdPropertySetup } from '@getvitops/utils/ads';\nimport type { CrmConfig } from '@getvitops/utils/crm';\nimport type { NotifyContext } from '@getvitops/utils/notify';\n\n/**\n * The slice of a `Config` that `resolveOrganizationName` reads. Structural on\n * purpose: `import config from './site.json'` types its literals widened\n * (`colors.utilities` becomes `string[]`, not the schema's union), so it is not\n * assignable to the full `Config`, and every scaffolded site calls this with\n * exactly such an import. A resolved `Config` still satisfies it.\n */\nexport interface OrganizationNameSource {\n organization?: { name?: Localizable | undefined; legalName?: string | undefined } | undefined;\n site: { defaultLocale: string };\n}\n\n/**\n * Resolves the one display name for a site's organization — `organization.name`\n * (localizable; `locale` picks which one, defaulting to `site.defaultLocale`,\n * which is also the fallback if the pick has no entry), falling back to\n * `legalName` when `name` isn't set at all, and to `undefined` (never `''`)\n * when neither resolves to anything — `t()` returns `''` for a genuinely\n * missing translation, and an empty name is worse than none.\n *\n * This is the one place that fallback chain is written. An EmDash site's own\n * `getSiteSettings().title` is a separate, runtime-only fact (EmDash's\n * settings aren't readable at Astro build/config time at all — see\n * AGENTS.md's \"EmDash plugin as the design-system editing surface\") and stays\n * authoritative for what it drives (the rendered page chrome); this helper is\n * for the build-time-only consumers that can't reach EmDash at all — favicon\n * generation, generated legal documents, notification emails — so a scaffold\n * needing a name in `astro.config.mjs` has one real source instead of a third\n * hardcoded string.\n */\nexport function resolveOrganizationName(\n config: OrganizationNameSource,\n locale?: string,\n): string | undefined {\n const org = config.organization;\n const resolvedLocale = locale ?? config.site.defaultLocale;\n const name =\n org?.name != null\n ? t(org.name, resolvedLocale, config.site.defaultLocale) || undefined\n : undefined;\n return name ?? org?.legalName;\n}\n\n/**\n * Builds the `context` option `createConversionRoute()` expects, straight from a\n * resolved `Config` — instead of every consumer hand-writing a `NotifyContext`\n * literal.\n *\n * `locationEmails` is primary-first, then every other location with an `email`,\n * in `organization.locations`' own key order — `planNotifications` picks the\n * first that's set, so order here is the whole precedence.\n */\nexport function toNotifyContext(config: Config, locale?: string): NotifyContext {\n const org = config.organization;\n const primaryKey = org?.primaryLocation;\n const locationEmails = Object.entries(org?.locations ?? {})\n .sort(([a], [b]) => (a === primaryKey ? -1 : b === primaryKey ? 1 : 0))\n .map(([, loc]) => loc.email)\n .filter((email): email is string => !!email);\n\n return {\n notifications: config.site.notifications,\n canonical: config.site.domains?.canonical,\n organizationName: resolveOrganizationName(config, locale),\n locationEmails,\n };\n}\n\n/**\n * `site.crm` IS `CrmConfig` — both are the schema's inferred type from `@getvitops/config` — so\n * this returns its argument's field unchanged.\n *\n * @deprecated Pass `config.site.crm` directly. Kept so existing callers keep compiling; it\n * stopped being an adapter when the type stopped being a copy.\n */\nexport function toCrmConfig(config: Config): CrmConfig | undefined {\n return config.site.crm;\n}\n\n/**\n * `site.ads.google`'s three server-side-relevant fields, for\n * `createConversionRoute`'s `googleAdsOffline.config`. Undefined when the site has no Google Ads\n * property configured at all, which `createConversionRoute` reads the same way `crm` being\n * omitted does: the upload never runs.\n *\n * @deprecated Pass `config.site.ads?.google` directly — it is already assignable. Kept so existing\n * callers keep compiling.\n */\nexport function toGoogleAdsConfig(\n config: Config,\n): Pick<AdPropertySetup, 'accountId' | 'conversionActionId' | 'reporting'> | undefined {\n return config.site.ads?.google;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,wBACd,QACA,QACoB;CACpB,MAAM,MAAM,OAAO;CACnB,MAAM,iBAAiB,UAAU,OAAO,KAAK;CAK7C,QAHE,KAAK,QAAQ,OACT,EAAE,IAAI,MAAM,gBAAgB,OAAO,KAAK,aAAa,KAAK,SAC1D,WACS,KAAK;AACtB;;;;;;;;;;AAWA,SAAgB,gBAAgB,QAAgB,QAAgC;CAC9E,MAAM,MAAM,OAAO;CACnB,MAAM,aAAa,KAAK;CACxB,MAAM,iBAAiB,OAAO,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,CACxD,MAAM,CAAC,IAAI,CAAC,OAAQ,MAAM,aAAa,KAAK,MAAM,aAAa,IAAI,CAAE,CAAC,CACtE,KAAK,GAAG,SAAS,IAAI,KAAK,CAAC,CAC3B,QAAQ,UAA2B,CAAC,CAAC,KAAK;CAE7C,OAAO;EACL,eAAe,OAAO,KAAK;EAC3B,WAAW,OAAO,KAAK,SAAS;EAChC,kBAAkB,wBAAwB,QAAQ,MAAM;EACxD;CACF;AACF;;;;;;;;AASA,SAAgB,YAAY,QAAuC;CACjE,OAAO,OAAO,KAAK;AACrB;;;;;;;;;;AAWA,SAAgB,kBACd,QACqF;CACrF,OAAO,OAAO,KAAK,KAAK;AAC1B"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { i as TRACKING_COOKIE, n as ResolveTrackingContext, o as TrackingCategory, r as ResolvedTracking, s as resolveTracking, t as GetvitopsTrackingOptions } from "./tracking-
|
|
2
|
-
import { LegalOutput, SiteFont, StylesheetFormat } from "@getvitops/generator";
|
|
1
|
+
import { i as TRACKING_COOKIE, n as ResolveTrackingContext, o as TrackingCategory, r as ResolvedTracking, s as resolveTracking, t as GetvitopsTrackingOptions } from "./tracking-D2xOzjFD.mjs";
|
|
2
|
+
import { Config, LegalOutput, SiteFont, StylesheetFormat } from "@getvitops/generator";
|
|
3
3
|
import { generateIconInclude } from "@getvitops/utils";
|
|
4
4
|
import { AdProvider } from "@getvitops/utils/ads";
|
|
5
|
+
import { AdPropertyConfig } from "@getvitops/config";
|
|
5
6
|
import { OutputKind } from "@getvitops/utils/media";
|
|
6
7
|
import { AstroIntegration } from "astro";
|
|
7
8
|
export * from "@getvitops/utils";
|
|
8
|
-
|
|
9
|
-
//#region src/analytics.d.ts
|
|
10
9
|
/**
|
|
11
10
|
* The `<Analytics />` resolution layer — provider config in, the exact tags to
|
|
12
11
|
* emit out.
|
|
@@ -152,6 +151,19 @@ interface ResolvedAnalytics {
|
|
|
152
151
|
interface ResolveAnalyticsContext {
|
|
153
152
|
/** Is the consent gate enabled on this site (`vitops({ consent })`)? */
|
|
154
153
|
consent?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Enabled `site.experiments` entries, keyed the same way, each carrying the
|
|
156
|
+
* resolved cookie name `vitopsAbTesting()`'s middleware assigns
|
|
157
|
+
* (`_ab_<key>` unless overridden). When set, each provider's bootstrap
|
|
158
|
+
* reads these cookies client-side and reports the assignment via that
|
|
159
|
+
* provider's own custom-dimension/property mechanism — a no-op when this
|
|
160
|
+
* is empty, so a site not using experiments sees no behavior change.
|
|
161
|
+
*/
|
|
162
|
+
experiments?: Record<string, {
|
|
163
|
+
cookieName: string;
|
|
164
|
+
}>;
|
|
165
|
+
/** `site.analytics.matomo.abVariantDimensions` — Matomo's pre-created custom-dimension index per experiment key. */
|
|
166
|
+
matomoAbVariantDimensions?: Record<string, number>;
|
|
155
167
|
}
|
|
156
168
|
/**
|
|
157
169
|
* Resolve the configured providers into the tags to emit.
|
|
@@ -160,11 +172,9 @@ interface ResolveAnalyticsContext {
|
|
|
160
172
|
* malformed ID should not take down a build, and a missing tag is visible in the
|
|
161
173
|
* output while a failed build is just a red wall.
|
|
162
174
|
*/
|
|
163
|
-
declare function resolveAnalytics(opts: GetvitopsAnalyticsOptions | undefined, ctx?: ResolveAnalyticsContext): ResolvedAnalytics;
|
|
175
|
+
export declare function resolveAnalytics(opts: GetvitopsAnalyticsOptions | undefined, ctx?: ResolveAnalyticsContext): ResolvedAnalytics;
|
|
164
176
|
/** Which optional categories a set of tags actually needs a visitor to decide. */
|
|
165
|
-
declare function consentCategories(tags: GatedTag[]): OptionalConsentCategory[];
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/seo.d.ts
|
|
177
|
+
export declare function consentCategories(tags: GatedTag[]): OptionalConsentCategory[];
|
|
168
178
|
/**
|
|
169
179
|
* The `<Seo />` resolution layer — site-level defaults merged with per-page props
|
|
170
180
|
* into the exact tags to emit.
|
|
@@ -184,11 +194,12 @@ type SeoOgType = 'website' | 'article' | 'profile';
|
|
|
184
194
|
* Site-level SEO defaults, passed to `vitops({ seo })` and baked into the
|
|
185
195
|
* `virtual:getvitops/head` module. Per-page `<Seo />` props override these.
|
|
186
196
|
*
|
|
187
|
-
*
|
|
188
|
-
* (
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
197
|
+
* `site.seo` in the site config is the source (`@getvitops/config`'s `SeoSchema`);
|
|
198
|
+
* `resolveSeoDefaults()` turns it into this shape for a build locale, and `vitops({ seo })` is merged
|
|
199
|
+
* over the result as an override. This interface is therefore the *resolved* shape — plain strings,
|
|
200
|
+
* `Localizable` already picked — and must stay JSON-serialisable: it is `JSON.stringify`d into the
|
|
201
|
+
* virtual module, so no functions, no `URL`s, no dates. `seo-defaults.test.ts` fails when a
|
|
202
|
+
* `site.seo` field is added to the schema and not read here (ADR-0002).
|
|
192
203
|
*/
|
|
193
204
|
interface GetvitopsSeoOptions {
|
|
194
205
|
/** `og:site_name`, and the `<title>` when a page passes none. */
|
|
@@ -216,9 +227,13 @@ interface GetvitopsSeoOptions {
|
|
|
216
227
|
/** Bing Webmaster Tools verification token. */
|
|
217
228
|
bingSiteVerification?: string;
|
|
218
229
|
openGraph?: {
|
|
219
|
-
/** Default `og:type` (default `'website'`). */
|
|
220
|
-
|
|
221
|
-
|
|
230
|
+
/** Default `og:type` (default `'website'`). */
|
|
231
|
+
type?: SeoOgType;
|
|
232
|
+
/** `og:locale`. Written either way — `en-CA` and `en_CA` both emit `en_CA`. */
|
|
233
|
+
locale?: string;
|
|
234
|
+
/** Additional locales the same content exists in → `og:locale:alternate`. */
|
|
235
|
+
localeAlternates?: string[];
|
|
236
|
+
/** Fallback share image. Relative URLs resolve against `site`. */
|
|
222
237
|
image?: {
|
|
223
238
|
url: string;
|
|
224
239
|
alt?: string;
|
|
@@ -228,8 +243,11 @@ interface GetvitopsSeoOptions {
|
|
|
228
243
|
};
|
|
229
244
|
};
|
|
230
245
|
twitter?: {
|
|
231
|
-
/** Card type when no image resolves (default `'summary'`). */
|
|
232
|
-
|
|
246
|
+
/** Card type when no image resolves (default `'summary'`). */
|
|
247
|
+
card?: SeoTwitterCard;
|
|
248
|
+
/** The site's own handle, `@acme`. */
|
|
249
|
+
site?: string;
|
|
250
|
+
/** Default author handle, `@ada`. */
|
|
233
251
|
creator?: string;
|
|
234
252
|
};
|
|
235
253
|
}
|
|
@@ -341,9 +359,7 @@ interface SeoContext {
|
|
|
341
359
|
* through its three arguments, which is what makes it testable and what keeps the
|
|
342
360
|
* package free of the consumer-global coupling that sank the previous site model.
|
|
343
361
|
*/
|
|
344
|
-
declare function resolveSeo(defaults: GetvitopsSeoOptions, props: SeoProps, ctx: SeoContext): ResolvedSeo;
|
|
345
|
-
//#endregion
|
|
346
|
-
//#region src/integration.d.ts
|
|
362
|
+
export declare function resolveSeo(defaults: GetvitopsSeoOptions, props: SeoProps, ctx: SeoContext): ResolvedSeo;
|
|
347
363
|
interface GetvitopsFaviconOptions {
|
|
348
364
|
/** Source SVG or PNG. */
|
|
349
365
|
source: string;
|
|
@@ -624,8 +640,11 @@ interface GetvitopsOptions {
|
|
|
624
640
|
sitemap?: boolean | GetvitopsSitemapOptions;
|
|
625
641
|
/**
|
|
626
642
|
* Site-level defaults for `<Seo />` (`@getvitops/astro/Seo.astro`) — site name,
|
|
627
|
-
* title template, Open Graph + Twitter defaults, verification tokens.
|
|
628
|
-
*
|
|
643
|
+
* title template, Open Graph + Twitter defaults, verification tokens.
|
|
644
|
+
*
|
|
645
|
+
* These come from `site.seo` in the site config (with `organization.name` as the site
|
|
646
|
+
* name); this option is an **override** merged over that, field by field, for a value
|
|
647
|
+
* an app wants to set in code. Per-page props override both.
|
|
629
648
|
*
|
|
630
649
|
* Needs the `site` astro.config option for canonical and `og:url`; without it
|
|
631
650
|
* `<Seo />` omits every absolute-URL tag rather than deriving one from the
|
|
@@ -750,25 +769,14 @@ interface GetvitopsIconsOptions {
|
|
|
750
769
|
/** Aliases applied before the semantic map — legacy names, or values stored in CMS content. */
|
|
751
770
|
overrides?: Record<string, string>;
|
|
752
771
|
}
|
|
753
|
-
|
|
754
|
-
//#endregion
|
|
755
|
-
//#region src/ads.d.ts
|
|
772
|
+
export default function vitops(opts?: GetvitopsOptions): AstroIntegration;
|
|
756
773
|
/**
|
|
757
|
-
* One ad property,
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
761
|
-
* component surface must stay usable by a consumer who passes a plain object.
|
|
774
|
+
* One ad property, as `<Ads />` reads it: the fields of a `site.ads` entry that decide what is
|
|
775
|
+
* emitted. A subset of `AdPropertyConfig` from `@getvitops/config` — the schema's own inferred
|
|
776
|
+
* type, not a copy — so a plain object is still enough for a consumer to pass, and a field the
|
|
777
|
+
* schema renames fails here instead of silently reading `undefined`.
|
|
762
778
|
*/
|
|
763
|
-
|
|
764
|
-
accountId?: string;
|
|
765
|
-
pixelId?: string;
|
|
766
|
-
conversionLabel?: string;
|
|
767
|
-
/** Default `marketing`. `analytics` for a property used purely for measurement. */
|
|
768
|
-
category?: 'marketing' | 'analytics';
|
|
769
|
-
/** False keeps the property on record without emitting its tag. */
|
|
770
|
-
enabled?: boolean;
|
|
771
|
-
}
|
|
779
|
+
type GetvitopsAdProperty = Pick<AdPropertyConfig, 'accountId' | 'pixelId' | 'conversionLabel' | 'conversionActionId' | 'reporting' | 'category' | 'enabled'>;
|
|
772
780
|
type GetvitopsAdsOptions = Partial<Record<AdProvider, GetvitopsAdProperty>>;
|
|
773
781
|
/** One ad tag. `key` is the platform, so a caller can find one without matching prose. */
|
|
774
782
|
interface ResolvedAdTag extends GatedTag {
|
|
@@ -792,9 +800,7 @@ interface ResolveAdsContext {
|
|
|
792
800
|
strategy?: AnalyticsStrategy;
|
|
793
801
|
}
|
|
794
802
|
/** Resolve the configured ad properties into the tags `<Ads />` emits. */
|
|
795
|
-
declare function resolveAds(ads: GetvitopsAdsOptions | undefined, ctx?: ResolveAdsContext): ResolvedAds;
|
|
796
|
-
//#endregion
|
|
797
|
-
//#region src/lastmod.d.ts
|
|
803
|
+
export declare function resolveAds(ads: GetvitopsAdsOptions | undefined, ctx?: ResolveAdsContext): ResolvedAds;
|
|
798
804
|
interface GitLastmodOptions {
|
|
799
805
|
/** Directories to read history from (default `src/pages`, `src/content`, `src/data`). */
|
|
800
806
|
dirs?: string[];
|
|
@@ -810,9 +816,9 @@ interface GitLastmodOptions {
|
|
|
810
816
|
* commit date describes the template rather than any of them. Stamping every
|
|
811
817
|
* generated page with the template's date is exactly the "wrong date" case above.
|
|
812
818
|
*/
|
|
813
|
-
declare function routeFromPage(file: string): string | undefined;
|
|
819
|
+
export declare function routeFromPage(file: string): string | undefined;
|
|
814
820
|
/** The slug a content entry is most likely published under. */
|
|
815
|
-
declare function slugFromContent(file: string): string | undefined;
|
|
821
|
+
export declare function slugFromContent(file: string): string | undefined;
|
|
816
822
|
/**
|
|
817
823
|
* Build a `serialize` function that stamps `lastmod` from git history.
|
|
818
824
|
*
|
|
@@ -821,7 +827,18 @@ declare function slugFromContent(file: string): string | undefined;
|
|
|
821
827
|
* is dropped rather than guessed at, since picking either one would be a coin
|
|
822
828
|
* flip presented as a fact.
|
|
823
829
|
*/
|
|
824
|
-
declare function gitLastmod(options?: GitLastmodOptions): Promise<(item: GetvitopsSitemapEntry) => GetvitopsSitemapEntry>;
|
|
825
|
-
|
|
826
|
-
|
|
830
|
+
export declare function gitLastmod(options?: GitLastmodOptions): Promise<(item: GetvitopsSitemapEntry) => GetvitopsSitemapEntry>;
|
|
831
|
+
interface ResolveSeoDefaultsOptions {
|
|
832
|
+
/** Build locale. Default `site.defaultLocale`; a value with no entry falls back to the default. */
|
|
833
|
+
locale?: string;
|
|
834
|
+
/** Which `site.environments` entry to read `robots` from. Default `'production'`. */
|
|
835
|
+
env?: string;
|
|
836
|
+
}
|
|
837
|
+
export declare function resolveSeoDefaults(config: Config, options?: ResolveSeoDefaultsOptions): GetvitopsSeoOptions;
|
|
838
|
+
/**
|
|
839
|
+
* Merge `vitops({ seo })` over config-derived defaults. The two nested objects merge key by key, so
|
|
840
|
+
* setting `openGraph.locale` in code doesn't discard the config's fallback image.
|
|
841
|
+
*/
|
|
842
|
+
export declare function mergeSeoDefaults(fromConfig: GetvitopsSeoOptions, override: GetvitopsSeoOptions | undefined): GetvitopsSeoOptions;
|
|
843
|
+
export { type AnalyticsStrategy, type ClarityOptions, type ConsentCategory, type GatedTag, type GetvitopsAdProperty, type GetvitopsAdsOptions, type GetvitopsAnalyticsOptions, type GetvitopsConsentOptions, type GetvitopsCssOptions, type GetvitopsFaviconOptions, type GetvitopsMediaOptions, type GetvitopsOptions, type GetvitopsSeoOptions, type GetvitopsSitemapChangeFreq, type GetvitopsSitemapEntry, type GetvitopsSitemapOptions, type GetvitopsTrackingOptions, type GitLastmodOptions, type GoogleAnalyticsOptions, type MatomoOptions, type OptionalConsentCategory, type PlausibleOptions, type ResolveAdsContext, type ResolveAnalyticsContext, type ResolveSeoDefaultsOptions, type ResolveTrackingContext, type ResolvedAdTag, type ResolvedAds, type ResolvedAnalytics, type ResolvedSeo, type ResolvedTag, type ResolvedTracking, type SeoContext, type SeoNameTag, type SeoOgType, type SeoPropertyTag, type SeoProps, type SeoTwitterCard, TRACKING_COOKIE, type TrackingCategory, resolveTracking };
|
|
827
844
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/analytics.ts","../src/seo.ts","../src/integration.ts","../src/ads.ts","../src/lastmod.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["MediaOutputKind"],"sources":["../src/analytics.ts","../src/seo.ts","../src/integration.ts","../src/ads.ts","../src/lastmod.ts","../src/seo-defaults.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BY;;;;;;;KAQA;KAEA,0BAA0B,QAAQ;UAE7B;;EAEf;;;;;EAKA,WAAW;;EAEX,SAAS;;UAGM;;EAEf;EACA,WAAW;;UAGI;;EAEf;;EAEA;;;;;;;;;EASA;;UAGe;;EAEf;;EAEA;;UAGe;EACf,2BAA2B;EAC3B,mBAAmB;EACnB,SAAS;EACT,qBAAqB;;EAErB,WAAW;;;;;;;;;;UAWI;;;;;EAKf,aAAa;;EAEb;;;;;;;;;;;;;;;;;UAkB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