@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.
@@ -0,0 +1,358 @@
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 {
329
+ defineSeo,
330
+ normalizePath,
331
+ isGroup,
332
+ hasParams,
333
+ isConcrete,
334
+ matchRoute,
335
+ absoluteUrl,
336
+ canonicalUrl,
337
+ UnresolvedTokenError,
338
+ interpolate,
339
+ resolvePage,
340
+ autoBreadcrumbs,
341
+ headTags,
342
+ SEO_ATTR,
343
+ jsonLdText,
344
+ renderHeadTags,
345
+ stripManagedHead,
346
+ injectHead,
347
+ renderDocument,
348
+ sitemapXml,
349
+ robotsTxt,
350
+ organization,
351
+ webSite,
352
+ breadcrumbList,
353
+ faqPage,
354
+ webPage,
355
+ article,
356
+ drug
357
+ };
358
+ //# sourceMappingURL=RQIWEB6V.jsx.map
@@ -25,7 +25,7 @@ import {
25
25
  useCatalogAvailability,
26
26
  useSmsConsent,
27
27
  validateAddress
28
- } from "./GYVEVOH7.jsx";
28
+ } from "./GGAM2AJR.jsx";
29
29
  import {
30
30
  auth_default,
31
31
  cart_default
@@ -661,4 +661,4 @@ export {
661
661
  restoreCartFromLink,
662
662
  startCartCapture
663
663
  };
664
- //# sourceMappingURL=JQEJL7HE.jsx.map
664
+ //# sourceMappingURL=SHSR6S3O.jsx.map
@@ -1,5 +1,5 @@
1
- import { fetchSmsConfig, fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft, resetSmsConfigCache } from './TUIMLDLN.js';
2
1
  import { cart_default, medication_default, auth_default, affiliateAuth_default } from './DFZFYIME.js';
2
+ import { fetchSmsConfig, fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft, resetSmsConfigCache } from './TUIMLDLN.js';
3
3
  import { newIdempotencyKey, apexApi, usersApi, addressesApi, catalogApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, adminApi, adminCatalogApi, adminProductPharmaciesApi, ApiError, ordersApi, adminCatalogConversionApi, messagesApi, authApi } from './FFHPVSPW.js';
4
4
  import { getConfig } from './2IFPDU4D.js';
5
5
  import { createSignal, onMount, createEffect, on, onCleanup, createResource, createMemo } from 'solid-js';
@@ -6555,5 +6555,5 @@ function useSmsPreferences() {
6555
6555
  }
6556
6556
 
6557
6557
  export { ACCOUNT_SOURCE_LABEL, DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, MATCH_DEPENDENT_WARNINGS, MATCH_HOW_LABEL, ORPHAN_REASON, PHONE_ERROR, READINESS_LABEL, SOURCE_FIELD_NOTE, SUPPORT_CATEGORIES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, addCatalogItemAsProduct, applyPriceDrafts, availableStateOptions, availableStates, bestOfferDiscount, buildFulfillmentRows, buildMatrixView, buildRefillView, buildSaveBody, buildStrengthRows, buildTimeline, buildTrackerView, buildTrackingUrl, canLeaveUnmatched, canOfferConversion, captureFunnelEmail, catalogUnavailableMessage, categoryColor, categoryLabel, classifyAddPharmacyError, classifyCatalogError, classifyConversionError, compareStrengths, createCatalogProduct, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, emailGateAnswered, explainFinding, findStoredDosePrice, firstAddressError, flaggedSubscribers, fmtDay, formatCalendarDate, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, formatUsPhone, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, hasStateRestrictions, initialMatches, intakeEvidence, invalidDraftKeys, isCatalogItemId, isCssColorValue, isImageAttachment, isLive, isQuestionVisible, isReconcilable, isValidUsPhone, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchKey, matchProblem, matchesComplete, missingPrices, moveInOrder, needsReview, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, orphanKey, parseMoney, pharmacyIsOnProduct, pharmacyLabel, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, resolveSurveyV2DrugIntent, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, stateAvailabilityNote, strengthsChanged, subscribeToSupportTopic, toChoices, toTrackerRequest, uploadPrescriptionPhoto, upsertDosePrice, useAddPharmacy, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useSmsConsent, useSmsPreferences, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress, visibleWarnings };
6558
- //# sourceMappingURL=ANR4H6TB.js.map
6559
- //# sourceMappingURL=ANR4H6TB.js.map
6558
+ //# sourceMappingURL=Y3KQOUKX.js.map
6559
+ //# sourceMappingURL=Y3KQOUKX.js.map