@apextelemed/partner-core 0.23.0-dev.83 → 0.23.0-dev.85

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/README.md CHANGED
@@ -383,6 +383,41 @@ The interface is defined in `src/primitives.tsx`. It is intentionally small —
383
383
  | Tier 3 page components | `/pages` | 3 |
384
384
  | Themes (CSS variables + UnoCSS preset) | `/theme`, `/theme/{admin,flow,affiliate,member-portal}.css` | — |
385
385
  | Consumer seam suite | `/testing` | — |
386
+ | SEO: manifest model, JSON-LD builders, sitemap/robots (Node-safe) | `/seo` | — |
387
+ | SEO: browser runtime (`<SeoProvider>`, `<Seo>`, `useSeo`) | `/seo/solid` | — |
388
+ | SEO: Vite plugin (per-route static heads, sitemap.xml, robots.txt) | `/seo/vite` | build |
389
+
390
+ ### SEO
391
+
392
+ A site states its SEO once, in a manifest (`defineSeo({ site, routes })` from
393
+ `/seo`), and two consumers read it:
394
+
395
+ - **`apexSeo()` from `/seo/vite`** (build): writes every concrete route's
396
+ `<head>` into its own static HTML file (`pricing.html`, …) so crawlers and
397
+ link previews see the right title, description, canonical, robots, Open
398
+ Graph and JSON-LD without running the app; also `sitemap.xml`, `robots.txt`
399
+ and a neutral `app.html` fallback for unlisted URLs. Host with clean URLs and
400
+ rewrite `**` to `/app.html` (Firebase: `cleanUrls: true`, `trailingSlash: false`).
401
+ - **`<SeoProvider>` from `/seo/solid`** (runtime): keeps `document.head` equal to
402
+ the manifest as the visitor navigates, adopting the prerendered tags in place
403
+ (`data-seo` keys), so there is never a second title or canonical. Pages add
404
+ `<Seo>` / `useSeo()` overrides for data only they know.
405
+
406
+ Policies the module enforces rather than leaves to each site:
407
+
408
+ - `site.indexable: false` (every non-production build) → `noindex, nofollow`
409
+ on every page, `Disallow: /`, empty sitemap.
410
+ - Unlisted URLs are `noindex` by default (`site.unlisted`), so a new private page
411
+ is safe without anyone remembering it.
412
+ - A noindex page declares no canonical; `crawl: false` routes go into
413
+ robots.txt and are not prerendered.
414
+ - `{token}` values fill titles/descriptions; a `[[clause]]` whose token has no
415
+ value is dropped whole. Leave live values (prices) to the runtime and the
416
+ static HTML never bakes in a figure that can go stale.
417
+ - Labelled routes get a BreadcrumbList from the manifest's own hierarchy.
418
+
419
+ `/seo` and `/seo/vite` must stay free of solid-js and browser APIs — a site's
420
+ `vite.config` loads them in Node. `tests/published/seo-node.test.mjs` guards it.
386
421
 
387
422
  ### Tier 3 pages
388
423
 
@@ -0,0 +1,330 @@
1
+ // src/seo/core.ts
2
+ function defineSeo(manifest) {
3
+ const { site, routes } = manifest;
4
+ if (!/^https?:\/\/[^/]+$/.test(site.origin)) {
5
+ throw new Error(`seo: site.origin must be an origin with no path or trailing slash, got "${site.origin}"`);
6
+ }
7
+ const seen = /* @__PURE__ */ new Set();
8
+ for (const r of routes) {
9
+ if (!r.path.startsWith("/")) throw new Error(`seo: route path must start with "/", got "${r.path}"`);
10
+ const key = normalizePath(r.path);
11
+ if (seen.has(key)) throw new Error(`seo: route "${r.path}" is listed twice`);
12
+ seen.add(key);
13
+ }
14
+ return manifest;
15
+ }
16
+ function normalizePath(path) {
17
+ let p = path.split(/[?#]/)[0] || "/";
18
+ if (!p.startsWith("/")) p = `/${p}`;
19
+ if (p.length > 1) p = p.replace(/\/+$/, "");
20
+ return p || "/";
21
+ }
22
+ function isGroup(route) {
23
+ return route.path.endsWith("/*");
24
+ }
25
+ function hasParams(route) {
26
+ return /\/:/.test(route.path);
27
+ }
28
+ function isConcrete(route) {
29
+ return !isGroup(route) && !hasParams(route);
30
+ }
31
+ function matchRoute(routes, pathname) {
32
+ const path = normalizePath(pathname);
33
+ const segs = path.split("/").filter(Boolean);
34
+ for (const route of routes) {
35
+ if (isConcrete(route) && normalizePath(route.path) === path) return { route, params: {} };
36
+ }
37
+ for (const route of routes) {
38
+ if (!hasParams(route) || isGroup(route)) continue;
39
+ const pat = normalizePath(route.path).split("/").filter(Boolean);
40
+ if (pat.length !== segs.length) continue;
41
+ const params = {};
42
+ let ok = true;
43
+ for (let i = 0; i < pat.length; i++) {
44
+ if (pat[i].startsWith(":")) params[pat[i].slice(1)] = decodeURIComponent(segs[i]);
45
+ else if (pat[i] !== segs[i]) {
46
+ ok = false;
47
+ break;
48
+ }
49
+ }
50
+ if (ok) return { route, params };
51
+ }
52
+ let best = null;
53
+ for (const route of routes) {
54
+ if (!isGroup(route)) continue;
55
+ const prefix = normalizePath(route.path.slice(0, -2));
56
+ const inside = prefix === "/" || path === prefix || path.startsWith(`${prefix}/`);
57
+ if (inside && (!best || route.path.length > best.path.length)) best = route;
58
+ }
59
+ return best ? { route: best, params: {} } : null;
60
+ }
61
+ function absoluteUrl(site, href) {
62
+ if (/^https?:\/\//.test(href)) return href;
63
+ return `${site.origin}${href.startsWith("/") ? "" : "/"}${href}`;
64
+ }
65
+ function canonicalUrl(site, path) {
66
+ const p = normalizePath(path);
67
+ return p === "/" ? `${site.origin}/` : `${site.origin}${p}`;
68
+ }
69
+ var UnresolvedTokenError = class extends Error {
70
+ constructor(token, text) {
71
+ super(`seo: no value for {${token}} in "${text}". Wrap the clause in [[ ]] if it may be left out.`);
72
+ this.token = token;
73
+ this.text = text;
74
+ }
75
+ token;
76
+ text;
77
+ };
78
+ var present = (v) => v !== null && v !== void 0 && v !== "";
79
+ function interpolate(text, vars, strict = false) {
80
+ const fill = (s, onMissing) => s.replace(/\{(\w+)\}/g, (_, t) => present(vars[t]) ? String(vars[t]) : onMissing(t));
81
+ const MISSING = "\0";
82
+ const withClauses = text.replace(/\[\[([\s\S]*?)\]\]/g, (_, clause) => {
83
+ const out2 = fill(clause, () => MISSING);
84
+ return out2.includes(MISSING) ? "" : out2;
85
+ });
86
+ const out = fill(withClauses, (t) => {
87
+ if (strict) throw new UnresolvedTokenError(t, text);
88
+ return "";
89
+ });
90
+ return out.replace(/\s{2,}/g, " ").replace(/\s+([,.;:!?])/g, "$1").trim();
91
+ }
92
+ function resolvePage(manifest, pathname, opts = {}) {
93
+ const { site, routes } = manifest;
94
+ const path = normalizePath(pathname);
95
+ const match = matchRoute(routes, path);
96
+ const route = { ...match?.route ?? {}, ...opts.overrides ?? {} };
97
+ const unlisted = !match && !opts.overrides;
98
+ const vars = { ...site.vars ?? {}, ...match?.params ?? {}, ...opts.vars ?? {} };
99
+ const pageTitle = route.title ? interpolate(route.title, vars, opts.strict) : site.defaultTitle;
100
+ const template = site.titleTemplate ?? `%s | ${site.name}`;
101
+ const title = route.title && !route.titleAbsolute ? template.replace("%s", pageTitle) : pageTitle;
102
+ const description = route.description ? interpolate(route.description, vars, opts.strict) : site.defaultDescription;
103
+ const blocked = route.crawl === false;
104
+ const noindex = !site.indexable || blocked || route.noindex === true || unlisted && (site.unlisted ?? "noindex") === "noindex";
105
+ const nofollow = !site.indexable || route.nofollow === true;
106
+ const robots = `${noindex ? "noindex" : "index"}, ${nofollow ? "nofollow" : "follow"}`;
107
+ const canonical = noindex ? null : absoluteUrl(site, route.canonical ?? canonicalUrl(site, path));
108
+ const img = route.image ?? site.defaultImage ?? null;
109
+ const image = img ? { ...img, url: absoluteUrl(site, img.url) } : null;
110
+ const page = {
111
+ path,
112
+ title,
113
+ pageTitle,
114
+ description,
115
+ canonical,
116
+ robots,
117
+ indexable: !noindex,
118
+ image,
119
+ ogType: route.ogType ?? "website",
120
+ alternates: (route.alternates ?? []).map((a) => ({ ...a, href: absoluteUrl(site, a.href) })),
121
+ jsonLd: [],
122
+ unlisted
123
+ };
124
+ if (!noindex) {
125
+ const crumbs = autoBreadcrumbs(manifest, path, route.label);
126
+ const own = typeof route.jsonLd === "function" ? route.jsonLd({ site, url: canonical ?? canonicalUrl(site, path), page, vars }) : route.jsonLd ?? [];
127
+ page.jsonLd = [...own, ...crumbs ? [crumbs] : []];
128
+ }
129
+ return page;
130
+ }
131
+ function autoBreadcrumbs(manifest, path, label) {
132
+ if (path === "/" || !label) return null;
133
+ const { site, routes } = manifest;
134
+ const items = [{ name: site.homeLabel ?? "Home", path: "/" }];
135
+ const segs = path.split("/").filter(Boolean);
136
+ for (let i = 1; i < segs.length; i++) {
137
+ const p = `/${segs.slice(0, i).join("/")}`;
138
+ const r = routes.find((x) => isConcrete(x) && normalizePath(x.path) === p);
139
+ if (r?.label) items.push({ name: r.label, path: p });
140
+ }
141
+ items.push({ name: label, path });
142
+ return breadcrumbList(items.map((c) => ({ name: c.name, url: canonicalUrl(site, c.path) })));
143
+ }
144
+ function headTags(site, page) {
145
+ const tags = [];
146
+ const meta = (kind, id, content) => {
147
+ if (content) tags.push({ key: `meta:${kind}:${id}`, tag: "meta", attrs: { [kind]: id, content } });
148
+ };
149
+ tags.push({ key: "title", tag: "title", attrs: {}, text: page.title });
150
+ meta("name", "description", page.description);
151
+ meta("name", "robots", page.robots);
152
+ if (page.canonical) tags.push({ key: "link:canonical", tag: "link", attrs: { rel: "canonical", href: page.canonical } });
153
+ for (const a of page.alternates) {
154
+ tags.push({ key: `link:alternate:${a.hreflang}`, tag: "link", attrs: { rel: "alternate", hreflang: a.hreflang, href: a.href } });
155
+ }
156
+ meta("name", "theme-color", site.themeColor);
157
+ meta("property", "og:site_name", site.name);
158
+ meta("property", "og:type", page.ogType);
159
+ meta("property", "og:title", page.pageTitle);
160
+ meta("property", "og:description", page.description);
161
+ meta("property", "og:url", page.canonical);
162
+ meta("property", "og:locale", site.locale);
163
+ if (page.image) {
164
+ meta("property", "og:image", page.image.url);
165
+ meta("property", "og:image:width", page.image.width?.toString());
166
+ meta("property", "og:image:height", page.image.height?.toString());
167
+ meta("property", "og:image:alt", page.image.alt);
168
+ }
169
+ meta("name", "twitter:card", page.image ? "summary_large_image" : "summary");
170
+ meta("name", "twitter:site", site.twitterSite);
171
+ meta("name", "twitter:title", page.pageTitle);
172
+ meta("name", "twitter:description", page.description);
173
+ if (page.image) meta("name", "twitter:image", page.image.url);
174
+ page.jsonLd.forEach((node, i) => {
175
+ tags.push({
176
+ key: `ld:${i}`,
177
+ tag: "script",
178
+ attrs: { type: "application/ld+json" },
179
+ text: jsonLdText(node)
180
+ });
181
+ });
182
+ return tags;
183
+ }
184
+ var SEO_ATTR = "data-seo";
185
+ var escAttr = (s) => s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
186
+ var escText = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
187
+ function jsonLdText(node) {
188
+ return JSON.stringify({ "@context": "https://schema.org", ...node }).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
189
+ }
190
+ function renderHeadTags(tags) {
191
+ return tags.map((t) => {
192
+ const attrs = Object.entries({ ...t.attrs, [SEO_ATTR]: t.key }).map(([k, v]) => ` ${k}="${escAttr(v)}"`).join("");
193
+ if (t.tag === "meta" || t.tag === "link") return `<${t.tag}${attrs}>`;
194
+ const body = t.tag === "script" ? t.text ?? "" : escText(t.text ?? "");
195
+ return `<${t.tag}${attrs}>${body}</${t.tag}>`;
196
+ }).join("\n ");
197
+ }
198
+ function stripManagedHead(html) {
199
+ return html.replace(/\s*<title\b[^>]*>[\s\S]*?<\/title>/gi, "").replace(/\s*<script\b[^>]*\bdata-seo=[^>]*>[\s\S]*?<\/script>/gi, "").replace(/\s*<(meta|link)\b[^>]*\bdata-seo=[^>]*>/gi, "").replace(/\s*<meta\b(?=[^>]*\bname=["'](?:description|robots)["'])[^>]*>/gi, "");
200
+ }
201
+ function injectHead(html, headHtml) {
202
+ const anchor = /<meta\b[^>]*name=["']viewport["'][^>]*>/i.exec(html) ?? /<meta\b[^>]*charset[^>]*>/i.exec(html);
203
+ if (anchor) {
204
+ const at = anchor.index + anchor[0].length;
205
+ return `${html.slice(0, at)}
206
+ ${headHtml}${html.slice(at)}`;
207
+ }
208
+ return html.replace(/<head\b[^>]*>/i, (m) => `${m}
209
+ ${headHtml}`);
210
+ }
211
+ function renderDocument(html, manifest, pathname, opts = {}) {
212
+ const page = resolvePage(manifest, pathname, opts);
213
+ return injectHead(stripManagedHead(html), renderHeadTags(headTags(manifest.site, page)));
214
+ }
215
+ var escXml = escText;
216
+ function sitemapXml(manifest, extra = []) {
217
+ const { site, routes } = manifest;
218
+ const entries = [];
219
+ if (site.indexable) {
220
+ const seen = /* @__PURE__ */ new Set();
221
+ const add = (path, lastmod) => {
222
+ const page = resolvePage(manifest, path);
223
+ if (!page.indexable || !page.canonical || seen.has(page.canonical)) return;
224
+ seen.add(page.canonical);
225
+ entries.push({ loc: page.canonical, lastmod });
226
+ };
227
+ for (const r of routes) if (isConcrete(r) && r.sitemap !== false) add(r.path, r.lastmod);
228
+ for (const e of extra) add(e.path, e.lastmod);
229
+ }
230
+ const body = entries.map((e) => ` <url><loc>${escXml(e.loc)}</loc>${e.lastmod ? `<lastmod>${escXml(e.lastmod)}</lastmod>` : ""}</url>`).join("\n");
231
+ return `<?xml version="1.0" encoding="UTF-8"?>
232
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
233
+ ${body}${body ? "\n" : ""}</urlset>
234
+ `;
235
+ }
236
+ function robotsTxt(manifest, opts = {}) {
237
+ const { site, routes } = manifest;
238
+ if (!site.indexable) return "User-agent: *\nDisallow: /\n";
239
+ const disallow = routes.filter((r) => r.crawl === false).map((r) => isGroup(r) ? normalizePath(r.path.slice(0, -2)) : normalizePath(r.path.replace(/\/:[^/]+.*$/, "/"))).sort();
240
+ const lines = ["User-agent: *", ...disallow.length ? disallow.map((p) => `Disallow: ${p}`) : ["Allow: /"]];
241
+ return `${lines.join("\n")}
242
+
243
+ Sitemap: ${site.origin}${opts.sitemapPath ?? "/sitemap.xml"}
244
+ `;
245
+ }
246
+ function clean(o) {
247
+ const out = {};
248
+ for (const [k, v] of Object.entries(o)) {
249
+ if (v === void 0 || v === null || v === "") continue;
250
+ if (Array.isArray(v) && v.length === 0) continue;
251
+ out[k] = v;
252
+ }
253
+ return out;
254
+ }
255
+ function organization(o) {
256
+ return clean({
257
+ "@type": o.type ?? "Organization",
258
+ "@id": o.id ?? `${o.url.replace(/\/$/, "")}/#organization`,
259
+ name: o.name,
260
+ url: o.url,
261
+ logo: o.logo,
262
+ sameAs: o.sameAs,
263
+ email: o.email,
264
+ telephone: o.telephone,
265
+ address: o.address ? { "@type": "PostalAddress", addressCountry: "US", ...o.address } : void 0
266
+ });
267
+ }
268
+ function webSite(o) {
269
+ return clean({
270
+ "@type": "WebSite",
271
+ "@id": `${o.url.replace(/\/$/, "")}/#website`,
272
+ name: o.name,
273
+ url: o.url,
274
+ publisher: o.publisherId ? { "@id": o.publisherId } : void 0,
275
+ potentialAction: o.searchUrlTemplate ? { "@type": "SearchAction", target: o.searchUrlTemplate, "query-input": "required name=search_term_string" } : void 0
276
+ });
277
+ }
278
+ function breadcrumbList(items) {
279
+ return {
280
+ "@type": "BreadcrumbList",
281
+ itemListElement: items.map((c, i) => ({ "@type": "ListItem", position: i + 1, name: c.name, item: c.url }))
282
+ };
283
+ }
284
+ function faqPage(items) {
285
+ return {
286
+ "@type": "FAQPage",
287
+ mainEntity: items.map((q) => ({
288
+ "@type": "Question",
289
+ name: q.question,
290
+ acceptedAnswer: { "@type": "Answer", text: q.answer }
291
+ }))
292
+ };
293
+ }
294
+ function webPage(o) {
295
+ return clean({
296
+ "@type": o.type ?? "WebPage",
297
+ "@id": `${o.url}#webpage`,
298
+ url: o.url,
299
+ name: o.name,
300
+ description: o.description,
301
+ about: o.about,
302
+ lastReviewed: o.lastReviewed,
303
+ reviewedBy: o.reviewedBy,
304
+ audience: o.audience ? { "@type": "MedicalAudience", audienceType: o.audience } : void 0,
305
+ publisher: o.publisherId ? { "@id": o.publisherId } : void 0
306
+ });
307
+ }
308
+ function article(o) {
309
+ return clean({
310
+ "@type": "Article",
311
+ "@id": `${o.url}#article`,
312
+ mainEntityOfPage: o.url,
313
+ headline: o.headline,
314
+ description: o.description,
315
+ image: o.image,
316
+ datePublished: o.datePublished,
317
+ dateModified: o.dateModified ?? o.datePublished,
318
+ author: o.author,
319
+ publisher: o.publisherId ? { "@id": o.publisherId } : void 0,
320
+ reviewedBy: o.reviewedBy,
321
+ lastReviewed: o.lastReviewed
322
+ });
323
+ }
324
+ function drug(o) {
325
+ return clean({ "@type": "Drug", name: o.name, nonProprietaryName: o.nonProprietaryName, url: o.url });
326
+ }
327
+
328
+ export { SEO_ATTR, UnresolvedTokenError, absoluteUrl, article, autoBreadcrumbs, breadcrumbList, canonicalUrl, defineSeo, drug, faqPage, hasParams, headTags, injectHead, interpolate, isConcrete, isGroup, jsonLdText, matchRoute, normalizePath, organization, renderDocument, renderHeadTags, resolvePage, robotsTxt, sitemapXml, stripManagedHead, webPage, webSite };
329
+ //# sourceMappingURL=AGPFMEFL.js.map
330
+ //# sourceMappingURL=AGPFMEFL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/seo/core.ts"],"names":["out"],"mappings":";AA0JO,SAAS,UAAU,QAAA,EAAoC;AAC5D,EAAA,MAAM,EAAE,IAAA,EAAM,MAAA,EAAO,GAAI,QAAA;AACzB,EAAA,IAAI,CAAC,oBAAA,CAAqB,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA,EAAG;AAC3C,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,wEAAA,EAA2E,IAAA,CAAK,MAAM,CAAA,CAAA,CAAG,CAAA;AAAA,EAC3G;AACA,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,KAAA,MAAW,KAAK,MAAA,EAAQ;AACtB,IAAA,IAAI,CAAC,CAAA,CAAE,IAAA,CAAK,UAAA,CAAW,GAAG,CAAA,EAAG,MAAM,IAAI,KAAA,CAAM,CAAA,0CAAA,EAA6C,CAAA,CAAE,IAAI,CAAA,CAAA,CAAG,CAAA;AACnG,IAAA,MAAM,GAAA,GAAM,aAAA,CAAc,CAAA,CAAE,IAAI,CAAA;AAChC,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA,EAAG,MAAM,IAAI,KAAA,CAAM,CAAA,YAAA,EAAe,CAAA,CAAE,IAA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AAc,CAAA,CAAE;AAAA,GACjB,CAAA;AACH;AAGO,SAAS,KAAK,CAAA,EAAwE;AAC3F,EAAA,OAAO,KAAA,CAAM,EAAE,OAAA,EAAS,MAAA,EAAQ,IAAA,EAAM,CAAA,CAAE,IAAA,EAAM,kBAAA,EAAoB,CAAA,CAAE,kBAAA,EAAoB,GAAA,EAAK,CAAA,CAAE,KAAK,CAAA;AACtG","file":"AGPFMEFL.js","sourcesContent":["/**\n * The SEO model, shared by the browser runtime (`./index.tsx`) and the build\n * plugin (`./vite.tsx`).\n *\n * Pure and DOM-free on purpose: the Vite plugin loads this module in Node while\n * the site's vite.config runs, so nothing here may import solid-js or touch\n * `document`. Everything a site states about a page lives in ONE manifest, and\n * both sides resolve it through `resolvePage()` → `headTags()`, so the static\n * head a crawler reads and the head the running app maintains cannot disagree.\n */\n\n/* ------------------------------------------------------------------ types */\n\n/** An image for social previews. `url` may be site-relative (\"/og.png\"). */\nexport interface SeoImage {\n url: string;\n width?: number;\n height?: number;\n alt?: string;\n}\n\n/** A JSON-LD node. Builders below return these; any schema.org object works. */\nexport type JsonLd = { '@type': string | string[]; [key: string]: unknown };\n\n/** Values substituted into `{name}` tokens in titles and descriptions. */\nexport type SeoVars = Record<string, string | number | null | undefined>;\n\n/** What the site states once, for every page. */\nexport interface SeoSite {\n /** Canonical origin, no trailing slash: \"https://healthyberri.com\". */\n origin: string;\n /** Brand name as it should appear in titles and og:site_name. */\n name: string;\n /**\n * How a page title becomes the document title. `%s` is the page title.\n * Default `\"%s | <name>\"`. A route can opt out with `titleAbsolute`.\n */\n titleTemplate?: string;\n /** Title for routes that state none (and for unlisted routes). */\n defaultTitle: string;\n /** Description for routes that state none (and for unlisted routes). */\n defaultDescription: string;\n /** Social preview image used when a route names none. */\n defaultImage?: SeoImage;\n /** og:locale, e.g. \"en_US\". */\n locale?: string;\n /** twitter:site handle, e.g. \"@acme\". */\n twitterSite?: string;\n /** <meta name=\"theme-color\">. */\n themeColor?: string;\n /**\n * False on every non-production deploy. Forces `noindex, nofollow` onto every\n * page and turns robots.txt into `Disallow: /`, so a dev site on a public\n * URL can never be indexed or compete with production.\n */\n indexable: boolean;\n /**\n * What a URL the manifest does not list gets. `noindex` (default) means a\n * new private page is safe by default: only pages someone deliberately\n * listed can be indexed.\n */\n unlisted?: 'noindex' | 'index';\n /** Label for the root in auto-generated breadcrumbs. Default \"Home\". */\n homeLabel?: string;\n /** Values available to every `{token}` (support email, brand phrases...). */\n vars?: SeoVars;\n}\n\n/** Context handed to a route's `jsonLd` function. */\nexport interface JsonLdContext {\n site: SeoSite;\n /** Absolute canonical URL of this page. */\n url: string;\n /** This page, already resolved (final title, description, image). */\n page: ResolvedPage;\n vars: SeoVars;\n}\n\n/** What one route states. Every field is optional except `path`. */\nexport interface SeoRoute {\n /**\n * \"/\", \"/pricing\", \"/guides/:slug\" (params become vars), or a prefix group\n * \"/admin/*\". A group is never prerendered or put in the sitemap; use it to\n * mark whole private areas.\n */\n path: string;\n /** Page title, before `titleTemplate`. Supports `{tokens}` and `[[optional clauses]]`. */\n title?: string;\n /** Use `title` as the whole document title, without the template. */\n titleAbsolute?: boolean;\n /** Meta description. Supports `{tokens}` and `[[optional clauses]]`. */\n description?: string;\n /** Short name for breadcrumbs and nav (\"Semaglutide\"). Enables auto breadcrumbs. */\n label?: string;\n image?: SeoImage;\n /** og:type. Default \"website\". */\n ogType?: string;\n /** Exclude from search results. The page can still be crawled. */\n noindex?: boolean;\n /** Ask crawlers not to follow links on this page. */\n nofollow?: boolean;\n /**\n * Keep crawlers out entirely (robots.txt Disallow). Implies noindex. For\n * account, checkout and admin areas — not for pages that only need to stay\n * out of results, because a blocked page's noindex is never seen.\n */\n crawl?: false;\n /** Override the canonical URL (absolute or site-relative). Default: this path. */\n canonical?: string;\n /** hreflang alternates. */\n alternates?: { hreflang: string; href: string }[];\n /** Structured data for this page. Breadcrumbs are added automatically. */\n jsonLd?: JsonLd[] | ((ctx: JsonLdContext) => JsonLd[]);\n /** Leave out of sitemap.xml (it still prerenders). */\n sitemap?: false;\n /** sitemap <lastmod>, \"YYYY-MM-DD\". */\n lastmod?: string;\n}\n\nexport interface SeoManifest {\n site: SeoSite;\n routes: SeoRoute[];\n}\n\n/** A page after templates, tokens, defaults and robots policy are applied. */\nexport interface ResolvedPage {\n path: string;\n /** Final document title. */\n title: string;\n /** The page title before the template (for og:title). */\n pageTitle: string;\n description: string;\n /** Absolute canonical URL, or null when the page should not declare one. */\n canonical: string | null;\n /** Content of <meta name=\"robots\">. */\n robots: string;\n indexable: boolean;\n image: SeoImage | null;\n ogType: string;\n alternates: { hreflang: string; href: string }[];\n jsonLd: JsonLd[];\n /** True when no manifest entry matched. */\n unlisted: boolean;\n}\n\n/** Per-page overrides a component can apply on top of its manifest entry. */\nexport type SeoOverrides = Partial<Omit<SeoRoute, 'path'>>;\n\n/* ------------------------------------------------------------ define */\n\n/**\n * Declare the manifest. Validates it eagerly so a typo fails the build, not a\n * crawl three weeks later.\n */\nexport function defineSeo(manifest: SeoManifest): SeoManifest {\n const { site, routes } = manifest;\n if (!/^https?:\\/\\/[^/]+$/.test(site.origin)) {\n throw new Error(`seo: site.origin must be an origin with no path or trailing slash, got \"${site.origin}\"`);\n }\n const seen = new Set<string>();\n for (const r of routes) {\n if (!r.path.startsWith('/')) throw new Error(`seo: route path must start with \"/\", got \"${r.path}\"`);\n const key = normalizePath(r.path);\n if (seen.has(key)) throw new Error(`seo: route \"${r.path}\" is listed twice`);\n seen.add(key);\n }\n return manifest;\n}\n\n/* ------------------------------------------------------------- paths */\n\n/** \"/pricing/\" → \"/pricing\"; \"\" → \"/\". Query and hash are dropped. */\nexport function normalizePath(path: string): string {\n let p = path.split(/[?#]/)[0] || '/';\n if (!p.startsWith('/')) p = `/${p}`;\n if (p.length > 1) p = p.replace(/\\/+$/, '');\n return p || '/';\n}\n\nexport function isGroup(route: SeoRoute): boolean {\n return route.path.endsWith('/*');\n}\n\nexport function hasParams(route: SeoRoute): boolean {\n return /\\/:/.test(route.path);\n}\n\n/** A route that names exactly one URL — the ones that prerender and go in the sitemap. */\nexport function isConcrete(route: SeoRoute): boolean {\n return !isGroup(route) && !hasParams(route);\n}\n\nexport interface RouteMatch {\n route: SeoRoute;\n params: Record<string, string>;\n}\n\n/**\n * The manifest entry for a pathname. Exact paths beat param patterns, which\n * beat groups; among groups the longest prefix wins.\n */\nexport function matchRoute(routes: SeoRoute[], pathname: string): RouteMatch | null {\n const path = normalizePath(pathname);\n const segs = path.split('/').filter(Boolean);\n\n for (const route of routes) {\n if (isConcrete(route) && normalizePath(route.path) === path) return { route, params: {} };\n }\n for (const route of routes) {\n if (!hasParams(route) || isGroup(route)) continue;\n const pat = normalizePath(route.path).split('/').filter(Boolean);\n if (pat.length !== segs.length) continue;\n const params: Record<string, string> = {};\n let ok = true;\n for (let i = 0; i < pat.length; i++) {\n if (pat[i].startsWith(':')) params[pat[i].slice(1)] = decodeURIComponent(segs[i]);\n else if (pat[i] !== segs[i]) {\n ok = false;\n break;\n }\n }\n if (ok) return { route, params };\n }\n let best: SeoRoute | null = null;\n for (const route of routes) {\n if (!isGroup(route)) continue;\n const prefix = normalizePath(route.path.slice(0, -2));\n const inside = prefix === '/' || path === prefix || path.startsWith(`${prefix}/`);\n if (inside && (!best || route.path.length > best.path.length)) best = route;\n }\n return best ? { route: best, params: {} } : null;\n}\n\n/** Site-relative or absolute → absolute against the origin. */\nexport function absoluteUrl(site: SeoSite, href: string): string {\n if (/^https?:\\/\\//.test(href)) return href;\n return `${site.origin}${href.startsWith('/') ? '' : '/'}${href}`;\n}\n\n/** Canonical URL for a path: the origin with a slash for the root, no trailing slash otherwise. */\nexport function canonicalUrl(site: SeoSite, path: string): string {\n const p = normalizePath(path);\n return p === '/' ? `${site.origin}/` : `${site.origin}${p}`;\n}\n\n/* --------------------------------------------------------- templating */\n\nexport class UnresolvedTokenError extends Error {\n constructor(public token: string, public text: string) {\n super(`seo: no value for {${token}} in \"${text}\". Wrap the clause in [[ ]] if it may be left out.`);\n }\n}\n\nconst present = (v: unknown): v is string | number => v !== null && v !== undefined && v !== '';\n\n/**\n * Fill `{token}`s from `vars`.\n *\n * A clause in `[[ ]]` is optional: it is dropped whole when any token inside it\n * has no value. That is how a description can carry a live price without\n * hard-coding one — \"Plans[[ from {fromPrice}/month]], if prescribed.\" reads\n * \"Plans, if prescribed.\" until the price is known, and never shows a stale or\n * empty figure. A token outside any clause must resolve: in `strict` mode\n * (the build) a missing one throws; otherwise it renders empty.\n */\nexport function interpolate(text: string, vars: SeoVars, strict = false): string {\n const fill = (s: string, onMissing: (t: string) => string) =>\n s.replace(/\\{(\\w+)\\}/g, (_, t: string) => (present(vars[t]) ? String(vars[t]) : onMissing(t)));\n\n const MISSING = '\\u0000';\n const withClauses = text.replace(/\\[\\[([\\s\\S]*?)\\]\\]/g, (_, clause: string) => {\n const out = fill(clause, () => MISSING);\n return out.includes(MISSING) ? '' : out;\n });\n const out = fill(withClauses, (t) => {\n if (strict) throw new UnresolvedTokenError(t, text);\n return '';\n });\n return out.replace(/\\s{2,}/g, ' ').replace(/\\s+([,.;:!?])/g, '$1').trim();\n}\n\n/* ----------------------------------------------------------- resolve */\n\nexport interface ResolveOptions {\n /** Runtime values for `{tokens}`; merged over `site.vars` and route params. */\n vars?: SeoVars;\n /** Per-page overrides (from a `<Seo>` in the page). */\n overrides?: SeoOverrides;\n /** Throw on an unresolved required token (the build does; the browser does not). */\n strict?: boolean;\n}\n\n/** Turn a pathname into the exact head the page should have. */\nexport function resolvePage(manifest: SeoManifest, pathname: string, opts: ResolveOptions = {}): ResolvedPage {\n const { site, routes } = manifest;\n const path = normalizePath(pathname);\n const match = matchRoute(routes, path);\n const route: SeoOverrides = { ...(match?.route ?? {}), ...(opts.overrides ?? {}) };\n const unlisted = !match && !opts.overrides;\n const vars: SeoVars = { ...(site.vars ?? {}), ...(match?.params ?? {}), ...(opts.vars ?? {}) };\n\n const pageTitle = route.title ? interpolate(route.title, vars, opts.strict) : site.defaultTitle;\n const template = site.titleTemplate ?? `%s | ${site.name}`;\n const title = route.title && !route.titleAbsolute ? template.replace('%s', pageTitle) : pageTitle;\n const description = route.description\n ? interpolate(route.description, vars, opts.strict)\n : site.defaultDescription;\n\n const blocked = route.crawl === false;\n const noindex =\n !site.indexable || blocked || route.noindex === true || (unlisted && (site.unlisted ?? 'noindex') === 'noindex');\n const nofollow = !site.indexable || route.nofollow === true;\n const robots = `${noindex ? 'noindex' : 'index'}, ${nofollow ? 'nofollow' : 'follow'}`;\n\n // A page kept out of the index declares no canonical: pointing one at\n // itself would contradict the noindex, and pointing it anywhere else would\n // be a claim about a page we know nothing about.\n const canonical = noindex ? null : absoluteUrl(site, route.canonical ?? canonicalUrl(site, path));\n\n const img = route.image ?? site.defaultImage ?? null;\n const image = img ? { ...img, url: absoluteUrl(site, img.url) } : null;\n\n const page: ResolvedPage = {\n path,\n title,\n pageTitle,\n description,\n canonical,\n robots,\n indexable: !noindex,\n image,\n ogType: route.ogType ?? 'website',\n alternates: (route.alternates ?? []).map((a) => ({ ...a, href: absoluteUrl(site, a.href) })),\n jsonLd: [],\n unlisted,\n };\n\n if (!noindex) {\n const crumbs = autoBreadcrumbs(manifest, path, route.label);\n const own = typeof route.jsonLd === 'function'\n ? route.jsonLd({ site, url: canonical ?? canonicalUrl(site, path), page, vars })\n : route.jsonLd ?? [];\n page.jsonLd = [...own, ...(crumbs ? [crumbs] : [])];\n }\n return page;\n}\n\n/**\n * BreadcrumbList from the manifest's own hierarchy: every ancestor path that\n * is listed with a `label` becomes a crumb, under the root. Emitted only for a\n * labelled, non-root page, so adding `label` is the whole opt-in.\n */\nexport function autoBreadcrumbs(manifest: SeoManifest, path: string, label?: string): JsonLd | null {\n if (path === '/' || !label) return null;\n const { site, routes } = manifest;\n const items: { name: string; path: string }[] = [{ name: site.homeLabel ?? 'Home', path: '/' }];\n const segs = path.split('/').filter(Boolean);\n for (let i = 1; i < segs.length; i++) {\n const p = `/${segs.slice(0, i).join('/')}`;\n const r = routes.find((x) => isConcrete(x) && normalizePath(x.path) === p);\n if (r?.label) items.push({ name: r.label, path: p });\n }\n items.push({ name: label, path });\n return breadcrumbList(items.map((c) => ({ name: c.name, url: canonicalUrl(site, c.path) })));\n}\n\n/* ---------------------------------------------------------- head tags */\n\n/**\n * One element the head should contain. `key` identifies it so the runtime can\n * update an existing element instead of adding a second one (one canonical,\n * one description — never two).\n */\nexport interface HeadTag {\n key: string;\n tag: 'title' | 'meta' | 'link' | 'script';\n attrs: Record<string, string>;\n text?: string;\n}\n\n/** The complete, ordered set of managed head elements for a page. */\nexport function headTags(site: SeoSite, page: ResolvedPage): HeadTag[] {\n const tags: HeadTag[] = [];\n const meta = (kind: 'name' | 'property', id: string, content: string | undefined | null) => {\n if (content) tags.push({ key: `meta:${kind}:${id}`, tag: 'meta', attrs: { [kind]: id, content } });\n };\n\n tags.push({ key: 'title', tag: 'title', attrs: {}, text: page.title });\n meta('name', 'description', page.description);\n meta('name', 'robots', page.robots);\n if (page.canonical) tags.push({ key: 'link:canonical', tag: 'link', attrs: { rel: 'canonical', href: page.canonical } });\n for (const a of page.alternates) {\n tags.push({ key: `link:alternate:${a.hreflang}`, tag: 'link', attrs: { rel: 'alternate', hreflang: a.hreflang, href: a.href } });\n }\n meta('name', 'theme-color', site.themeColor);\n\n meta('property', 'og:site_name', site.name);\n meta('property', 'og:type', page.ogType);\n meta('property', 'og:title', page.pageTitle);\n meta('property', 'og:description', page.description);\n meta('property', 'og:url', page.canonical);\n meta('property', 'og:locale', site.locale);\n if (page.image) {\n meta('property', 'og:image', page.image.url);\n meta('property', 'og:image:width', page.image.width?.toString());\n meta('property', 'og:image:height', page.image.height?.toString());\n meta('property', 'og:image:alt', page.image.alt);\n }\n meta('name', 'twitter:card', page.image ? 'summary_large_image' : 'summary');\n meta('name', 'twitter:site', site.twitterSite);\n meta('name', 'twitter:title', page.pageTitle);\n meta('name', 'twitter:description', page.description);\n if (page.image) meta('name', 'twitter:image', page.image.url);\n\n page.jsonLd.forEach((node, i) => {\n tags.push({\n key: `ld:${i}`,\n tag: 'script',\n attrs: { type: 'application/ld+json' },\n text: jsonLdText(node),\n });\n });\n return tags;\n}\n\n/** The attribute that marks an element as owned by this module. */\nexport const SEO_ATTR = 'data-seo';\n\nconst escAttr = (s: string) => s.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\nconst escText = (s: string) => s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\n/** JSON-LD text safe to place inside a <script> element. */\nexport function jsonLdText(node: JsonLd): string {\n return JSON.stringify({ '@context': 'https://schema.org', ...node })\n .replace(/</g, '\\\\u003c')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n\n/** Static HTML for a set of head tags, each marked so the runtime adopts it. */\nexport function renderHeadTags(tags: HeadTag[]): string {\n return tags\n .map((t) => {\n const attrs = Object.entries({ ...t.attrs, [SEO_ATTR]: t.key })\n .map(([k, v]) => ` ${k}=\"${escAttr(v)}\"`)\n .join('');\n if (t.tag === 'meta' || t.tag === 'link') return `<${t.tag}${attrs}>`;\n const body = t.tag === 'script' ? (t.text ?? '') : escText(t.text ?? '');\n return `<${t.tag}${attrs}>${body}</${t.tag}>`;\n })\n .join('\\n ');\n}\n\n/**\n * Remove what this module manages from an HTML document's head: any element\n * carrying `data-seo`, plus the hand-written <title>, description and robots\n * that a site's index.html starts with. Returns the document ready for\n * `injectHead()`.\n */\nexport function stripManagedHead(html: string): string {\n return html\n .replace(/\\s*<title\\b[^>]*>[\\s\\S]*?<\\/title>/gi, '')\n .replace(/\\s*<script\\b[^>]*\\bdata-seo=[^>]*>[\\s\\S]*?<\\/script>/gi, '')\n .replace(/\\s*<(meta|link)\\b[^>]*\\bdata-seo=[^>]*>/gi, '')\n .replace(/\\s*<meta\\b(?=[^>]*\\bname=[\"'](?:description|robots)[\"'])[^>]*>/gi, '');\n}\n\n/** Insert rendered tags at the top of <head>, after <meta charset> and viewport if present. */\nexport function injectHead(html: string, headHtml: string): string {\n const anchor = /<meta\\b[^>]*name=[\"']viewport[\"'][^>]*>/i.exec(html) ?? /<meta\\b[^>]*charset[^>]*>/i.exec(html);\n if (anchor) {\n const at = anchor.index + anchor[0].length;\n return `${html.slice(0, at)}\\n ${headHtml}${html.slice(at)}`;\n }\n return html.replace(/<head\\b[^>]*>/i, (m) => `${m}\\n ${headHtml}`);\n}\n\n/** The whole document for one path: strip, resolve, render, inject. */\nexport function renderDocument(html: string, manifest: SeoManifest, pathname: string, opts: ResolveOptions = {}): string {\n const page = resolvePage(manifest, pathname, opts);\n return injectHead(stripManagedHead(html), renderHeadTags(headTags(manifest.site, page)));\n}\n\n/* ------------------------------------------------- sitemap and robots */\n\nconst escXml = escText;\n\n/**\n * sitemap.xml: every concrete, indexable, listed route. Empty on a site that\n * is not indexable — a sitemap advertising pages that all say noindex is a\n * Search Console error, not a hint.\n */\nexport function sitemapXml(manifest: SeoManifest, extra: { path: string; lastmod?: string }[] = []): string {\n const { site, routes } = manifest;\n const entries: { loc: string; lastmod?: string }[] = [];\n if (site.indexable) {\n const seen = new Set<string>();\n const add = (path: string, lastmod?: string) => {\n const page = resolvePage(manifest, path);\n if (!page.indexable || !page.canonical || seen.has(page.canonical)) return;\n seen.add(page.canonical);\n entries.push({ loc: page.canonical, lastmod });\n };\n for (const r of routes) if (isConcrete(r) && r.sitemap !== false) add(r.path, r.lastmod);\n for (const e of extra) add(e.path, e.lastmod);\n }\n const body = entries\n .map((e) => ` <url><loc>${escXml(e.loc)}</loc>${e.lastmod ? `<lastmod>${escXml(e.lastmod)}</lastmod>` : ''}</url>`)\n .join('\\n');\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\\n${body}${body ? '\\n' : ''}</urlset>\\n`;\n}\n\n/**\n * robots.txt. On an indexable site: allow everything except routes marked\n * `crawl: false` (groups included), and point at the sitemap. Otherwise:\n * disallow everything.\n */\nexport function robotsTxt(manifest: SeoManifest, opts: { sitemapPath?: string } = {}): string {\n const { site, routes } = manifest;\n if (!site.indexable) return 'User-agent: *\\nDisallow: /\\n';\n const disallow = routes\n .filter((r) => r.crawl === false)\n // robots.txt rules are prefixes: \"/admin\" blocks /admin, /admin/x (and\n // /admin-anything, which is acceptable for a private area). A param\n // route blocks everything under its static prefix.\n .map((r) => (isGroup(r) ? normalizePath(r.path.slice(0, -2)) : normalizePath(r.path.replace(/\\/:[^/]+.*$/, '/'))))\n .sort();\n const lines = ['User-agent: *', ...(disallow.length ? disallow.map((p) => `Disallow: ${p}`) : ['Allow: /'])];\n return `${lines.join('\\n')}\\n\\nSitemap: ${site.origin}${opts.sitemapPath ?? '/sitemap.xml'}\\n`;\n}\n\n/* -------------------------------------------------- JSON-LD builders */\n\n/** Drop undefined / empty values so builders can take optional fields freely. */\nfunction clean<T extends Record<string, unknown>>(o: T): T {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(o)) {\n if (v === undefined || v === null || v === '') continue;\n if (Array.isArray(v) && v.length === 0) continue;\n out[k] = v;\n }\n return out as T;\n}\n\nexport interface PostalAddressInput {\n streetAddress: string;\n addressLocality: string;\n addressRegion: string;\n postalCode: string;\n addressCountry?: string;\n}\n\nexport interface OrganizationInput {\n name: string;\n url: string;\n logo?: string;\n /** Profiles that are verifiably this organization (social, directories). */\n sameAs?: string[];\n email?: string;\n telephone?: string;\n address?: PostalAddressInput;\n /** schema.org type. Default \"Organization\". */\n type?: 'Organization' | 'MedicalOrganization' | 'MedicalBusiness' | 'OnlineBusiness';\n /** Stable node id so other nodes can reference it. Default `<url>#organization`. */\n id?: string;\n}\n\nexport function organization(o: OrganizationInput): JsonLd {\n return clean({\n '@type': o.type ?? 'Organization',\n '@id': o.id ?? `${o.url.replace(/\\/$/, '')}/#organization`,\n name: o.name,\n url: o.url,\n logo: o.logo,\n sameAs: o.sameAs,\n email: o.email,\n telephone: o.telephone,\n address: o.address ? { '@type': 'PostalAddress', addressCountry: 'US', ...o.address } : undefined,\n });\n}\n\nexport function webSite(o: { name: string; url: string; publisherId?: string; searchUrlTemplate?: string }): JsonLd {\n return clean({\n '@type': 'WebSite',\n '@id': `${o.url.replace(/\\/$/, '')}/#website`,\n name: o.name,\n url: o.url,\n publisher: o.publisherId ? { '@id': o.publisherId } : undefined,\n potentialAction: o.searchUrlTemplate\n ? { '@type': 'SearchAction', target: o.searchUrlTemplate, 'query-input': 'required name=search_term_string' }\n : undefined,\n });\n}\n\nexport function breadcrumbList(items: { name: string; url: string }[]): JsonLd {\n return {\n '@type': 'BreadcrumbList',\n itemListElement: items.map((c, i) => ({ '@type': 'ListItem', position: i + 1, name: c.name, item: c.url })),\n };\n}\n\n/**\n * FAQPage. Pass the SAME question/answer data the page renders — structured\n * data must describe content that is visible on the page.\n */\nexport function faqPage(items: { question: string; answer: string }[]): JsonLd {\n return {\n '@type': 'FAQPage',\n mainEntity: items.map((q) => ({\n '@type': 'Question',\n name: q.question,\n acceptedAnswer: { '@type': 'Answer', text: q.answer },\n })),\n };\n}\n\nexport interface WebPageInput {\n url: string;\n name: string;\n description?: string;\n /** \"MedicalWebPage\" for health content. */\n type?: 'WebPage' | 'MedicalWebPage' | 'AboutPage' | 'ContactPage' | 'FAQPage' | 'CollectionPage';\n /** What the page is about, e.g. `{ '@type': 'Drug', name: 'Semaglutide' }`. */\n about?: JsonLd | JsonLd[];\n /** \"YYYY-MM-DD\" of the last medical/editorial review. */\n lastReviewed?: string;\n /** Who reviewed it — a real, named Person or Organization only. */\n reviewedBy?: JsonLd;\n /** e.g. \"Patient\" | \"Clinician\" for MedicalWebPage. */\n audience?: string;\n publisherId?: string;\n}\n\nexport function webPage(o: WebPageInput): JsonLd {\n return clean({\n '@type': o.type ?? 'WebPage',\n '@id': `${o.url}#webpage`,\n url: o.url,\n name: o.name,\n description: o.description,\n about: o.about,\n lastReviewed: o.lastReviewed,\n reviewedBy: o.reviewedBy,\n audience: o.audience ? { '@type': 'MedicalAudience', audienceType: o.audience } : undefined,\n publisher: o.publisherId ? { '@id': o.publisherId } : undefined,\n });\n}\n\nexport interface ArticleInput {\n url: string;\n headline: string;\n description?: string;\n image?: string;\n datePublished: string;\n dateModified?: string;\n author: JsonLd;\n publisherId?: string;\n /** Medical review, for health articles. */\n reviewedBy?: JsonLd;\n lastReviewed?: string;\n}\n\n/** Article for guides and blog posts (the kind of page a \"semaglutide vs tirzepatide\" guide is). */\nexport function article(o: ArticleInput): JsonLd {\n return clean({\n '@type': 'Article',\n '@id': `${o.url}#article`,\n mainEntityOfPage: o.url,\n headline: o.headline,\n description: o.description,\n image: o.image,\n datePublished: o.datePublished,\n dateModified: o.dateModified ?? o.datePublished,\n author: o.author,\n publisher: o.publisherId ? { '@id': o.publisherId } : undefined,\n reviewedBy: o.reviewedBy,\n lastReviewed: o.lastReviewed,\n });\n}\n\n/** A drug as a page's subject. Name only unless you can state more accurately. */\nexport function drug(o: { name: string; nonProprietaryName?: string; url?: string }): JsonLd {\n return clean({ '@type': 'Drug', name: o.name, nonProprietaryName: o.nonProprietaryName, url: o.url });\n}\n"]}
@@ -10,6 +10,7 @@ import {
10
10
  MATCH_DEPENDENT_WARNINGS,
11
11
  MATCH_HOW_LABEL,
12
12
  ORPHAN_REASON,
13
+ PHONE_ERROR,
13
14
  READINESS_LABEL,
14
15
  SOURCE_FIELD_NOTE,
15
16
  SUPPORT_CATEGORIES,
@@ -47,6 +48,7 @@ import {
47
48
  isCatalogItemId,
48
49
  isCssColorValue,
49
50
  isImageAttachment,
51
+ isValidUsPhone,
50
52
  lifecycleReason,
51
53
  markEmailGateAnswered,
52
54
  matchKey,
@@ -83,18 +85,15 @@ import {
83
85
  useSurveyV2Flow,
84
86
  useUpdatePaymentMethodFlow,
85
87
  visibleWarnings
86
- } from "./GYVEVOH7.jsx";
87
- import {
88
- fetchFunnelConfig
89
- } from "./UWWII3GE.jsx";
90
- import {
91
- usePrimitives
92
- } from "./J63XPQP4.jsx";
88
+ } from "./GGAM2AJR.jsx";
93
89
  import {
94
90
  affiliateAuth_default,
95
91
  auth_default,
96
92
  cart_default
97
93
  } from "./3PC2Z2QD.jsx";
94
+ import {
95
+ fetchFunnelConfig
96
+ } from "./UWWII3GE.jsx";
98
97
  import {
99
98
  ADMIN_ROLES,
100
99
  ApiError,
@@ -112,6 +111,9 @@ import {
112
111
  subscriptionsApi,
113
112
  usersApi
114
113
  } from "./XWGLSZKD.jsx";
114
+ import {
115
+ usePrimitives
116
+ } from "./J63XPQP4.jsx";
115
117
 
116
118
  // src/pages/Survey.tsx
117
119
  import { Show, For, createEffect, on } from "solid-js";
@@ -23543,7 +23545,7 @@ function TemplateRow(props) {
23543
23545
  </div>
23544
23546
 
23545
23547
  <div class="app-admin-btn-row">
23546
- <button type="button" class="app-admin-btn app-admin-btn-sm" disabled={testing()} onClick={() => void sendTest()}>
23548
+ <button type="button" class="app-admin-btn app-admin-btn-sm" disabled={testing() || !props.canTest} onClick={() => void sendTest()}>
23547
23549
  {testing() ? "Sending\u2026" : "Send test to my phone"}
23548
23550
  </button>
23549
23551
  </div>
@@ -23558,17 +23560,97 @@ function TemplateRow(props) {
23558
23560
  </Show68>
23559
23561
  </div>;
23560
23562
  }
23563
+ function TestPhoneBlock(props) {
23564
+ const [value, setValue] = createSignal48("");
23565
+ const [saving, setSaving] = createSignal48(false);
23566
+ const [error, setError] = createSignal48("");
23567
+ const [note, setNote] = createSignal48(null);
23568
+ const [loaded] = createResource30(async () => {
23569
+ try {
23570
+ const res = await usersApi.getProfile();
23571
+ const raw = res.data?.phone;
23572
+ const phone = typeof raw === "string" ? raw : "";
23573
+ setValue(phone);
23574
+ props.onLoaded(phone);
23575
+ } catch {
23576
+ }
23577
+ return true;
23578
+ });
23579
+ const save = async () => {
23580
+ if (saving()) return;
23581
+ const phone = value().trim();
23582
+ setNote(null);
23583
+ if (!isValidUsPhone(phone)) {
23584
+ setError(PHONE_ERROR);
23585
+ return;
23586
+ }
23587
+ setError("");
23588
+ setSaving(true);
23589
+ try {
23590
+ await usersApi.updateProfile({ phone });
23591
+ props.onSaved(phone);
23592
+ setNote({ tone: "ok", text: "Saved to your account." });
23593
+ } catch (e) {
23594
+ setNote({ tone: "bad", text: e instanceof Error ? e.message : "Could not save your number." });
23595
+ } finally {
23596
+ setSaving(false);
23597
+ }
23598
+ };
23599
+ return <div class="app-admin-card-soft" data-testid="sms-test-phone" style={{ padding: "0.875rem", display: "grid", gap: "0.5rem" }}>
23600
+ <label class="app-admin-label" for="sms-test-phone-input" style={{ "font-size": "0.875rem", "font-weight": "600" }}>
23601
+ Your phone for test texts
23602
+ </label>
23603
+ <div style={muted3}>
23604
+ Test texts are sent to this number. It is the phone on your own account.
23605
+ </div>
23606
+ <div class="app-admin-btn-row">
23607
+ <input
23608
+ id="sms-test-phone-input"
23609
+ class="app-admin-input"
23610
+ type="tel"
23611
+ inputmode="tel"
23612
+ autocomplete="tel"
23613
+ placeholder="(555) 555-1234"
23614
+ value={value()}
23615
+ disabled={loaded.loading}
23616
+ onInput={(e) => {
23617
+ setValue(e.currentTarget.value);
23618
+ setError("");
23619
+ setNote(null);
23620
+ }}
23621
+ />
23622
+ <button type="button" class="app-admin-btn app-admin-btn-sm" disabled={saving() || loaded.loading} onClick={() => void save()}>
23623
+ {saving() ? "Saving\u2026" : "Save"}
23624
+ </button>
23625
+ </div>
23626
+ <Show68 when={error()}>
23627
+ <div class="app-admin-notice" role="alert" style={{ color: "var(--app-admin-danger-fg)" }}>
23628
+ {error()}
23629
+ </div>
23630
+ </Show68>
23631
+ <Show68 when={note()}>
23632
+ {(r) => <div class="app-admin-notice" role="status" style={r().tone === "bad" ? { color: "var(--app-admin-danger-fg)" } : void 0}>
23633
+ {r().text}
23634
+ </div>}
23635
+ </Show68>
23636
+ </div>;
23637
+ }
23561
23638
  function SmsTemplatesCard(props) {
23562
23639
  const [data] = createResource30(async () => {
23563
23640
  const res = await adminApi.getSmsTemplates();
23564
23641
  props.onLoaded?.(res.templates);
23565
23642
  return res;
23566
23643
  });
23644
+ const [phone, setPhone] = createSignal48("");
23567
23645
  const templates = () => data.error ? [] : data()?.templates ?? [];
23568
23646
  return <SmsCard
23569
23647
  title="What the texts say"
23570
23648
  note="Every text below is sent automatically once texts are set up. The wording is fixed."
23571
23649
  >
23650
+ <TestPhoneBlock onSaved={setPhone} onLoaded={setPhone} />
23651
+ <Show68 when={!isValidUsPhone(phone())}>
23652
+ <div style={muted3}>Save your phone number above to send a test.</div>
23653
+ </Show68>
23572
23654
  <Show68 when={data.error}>
23573
23655
  <div class="app-admin-notice" role="alert">
23574
23656
  The texts could not be loaded. {data.error?.message}
@@ -23577,7 +23659,7 @@ function SmsTemplatesCard(props) {
23577
23659
  <Show68 when={!data.error && data.loading}>
23578
23660
  <LoadingSpinner />
23579
23661
  </Show68>
23580
- <For53 each={templates()}>{(t) => <TemplateRow template={t} />}</For53>
23662
+ <For53 each={templates()}>{(t) => <TemplateRow template={t} canTest={isValidUsPhone(phone())} />}</For53>
23581
23663
  </SmsCard>;
23582
23664
  }
23583
23665
 
@@ -28972,4 +29054,4 @@ export {
28972
29054
  AffiliateForgotPassword,
28973
29055
  AffiliateResetPassword
28974
29056
  };
28975
- //# sourceMappingURL=5LMCRJ6Y.jsx.map
29057
+ //# sourceMappingURL=CHLMWPRS.jsx.map