@jmp-technologies/analytics 0.1.37 → 0.1.39
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 +1 -1
- package/dist/astro/client.cjs +144 -4
- package/dist/astro/client.cjs.map +1 -1
- package/dist/astro/client.d.cts +2 -2
- package/dist/astro/client.d.ts +2 -2
- package/dist/astro/client.js +2 -2
- package/dist/astro/content.cjs +190 -8
- package/dist/astro/content.cjs.map +1 -1
- package/dist/astro/content.d.cts +5 -4
- package/dist/astro/content.d.ts +5 -4
- package/dist/astro/content.js +5 -3
- package/dist/astro/integration.cjs +149 -6
- package/dist/astro/integration.cjs.map +1 -1
- package/dist/astro/integration.js +3 -3
- package/dist/astro/middleware.cjs +5 -2
- package/dist/astro/middleware.cjs.map +1 -1
- package/dist/astro/middleware.d.cts +2 -2
- package/dist/astro/middleware.d.ts +2 -2
- package/dist/astro/middleware.js +2 -2
- package/dist/astro/register.cjs +149 -6
- package/dist/astro/register.cjs.map +1 -1
- package/dist/astro/register.js +3 -3
- package/dist/{chunk-EMZXL6VF.js → chunk-6WQMWPEY.js} +6 -3
- package/dist/chunk-6WQMWPEY.js.map +1 -0
- package/dist/{chunk-D43AEUXU.js → chunk-BXPMVR7M.js} +3 -3
- package/dist/{chunk-TN6PGIB5.js → chunk-JJ3JP3RV.js} +2 -2
- package/dist/{chunk-UHXWHKHJ.js → chunk-M66PHSBO.js} +16 -3
- package/dist/chunk-M66PHSBO.js.map +1 -0
- package/dist/{chunk-VQF6QYLR.js → chunk-OCIOQIE4.js} +3 -3
- package/dist/{chunk-PTXPNIMF.js → chunk-ONIPLMOY.js} +2 -2
- package/dist/{chunk-RT2YYDCK.js → chunk-XAEWXWSP.js} +189 -8
- package/dist/chunk-XAEWXWSP.js.map +1 -0
- package/dist/constants-DTZMYgi4.d.cts +12 -0
- package/dist/constants-DTZMYgi4.d.ts +12 -0
- package/dist/{create-jmp-analytics-Bz0-K0Af.d.cts → create-jmp-analytics-C1IH32ZF.d.cts} +1 -1
- package/dist/{create-jmp-analytics-DRjrlWUn.d.ts → create-jmp-analytics-CjVYSmPJ.d.ts} +1 -1
- package/dist/index.cjs +196 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +10 -2
- package/dist/next/content.cjs +195 -8
- package/dist/next/content.cjs.map +1 -1
- package/dist/next/content.d.cts +6 -4
- package/dist/next/content.d.ts +6 -4
- package/dist/next/content.js +11 -3
- package/dist/next/content.js.map +1 -1
- package/dist/next/instrumentation.cjs +149 -6
- package/dist/next/instrumentation.cjs.map +1 -1
- package/dist/next/instrumentation.js +2 -2
- package/dist/next/landing-pages.cjs +156 -7
- package/dist/next/landing-pages.cjs.map +1 -1
- package/dist/next/landing-pages.d.cts +2 -2
- package/dist/next/landing-pages.d.ts +2 -2
- package/dist/next/landing-pages.js +3 -3
- package/dist/next/locations.cjs +156 -7
- package/dist/next/locations.cjs.map +1 -1
- package/dist/next/locations.d.cts +2 -2
- package/dist/next/locations.d.ts +2 -2
- package/dist/next/locations.js +3 -3
- package/dist/next/middleware.cjs +5 -2
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.d.cts +2 -2
- package/dist/next/middleware.d.ts +2 -2
- package/dist/next/middleware.js +2 -2
- package/dist/next/site-root-server.cjs +156 -7
- package/dist/next/site-root-server.cjs.map +1 -1
- package/dist/next/site-root-server.js +4 -4
- package/dist/next.cjs +144 -4
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +3 -3
- package/dist/next.d.ts +3 -3
- package/dist/next.js +4 -4
- package/dist/react.cjs +144 -4
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +3 -3
- package/dist/{site-config-BxEmJxBB.d.ts → site-config-BEaYpZ3X.d.ts} +9 -3
- package/dist/{site-config-Cgq67uQ1.d.cts → site-config-BN6Z2zIf.d.cts} +9 -3
- package/dist/{track-page-view-74Su6lQY.d.ts → track-page-view-B3OwUOYl.d.ts} +1 -1
- package/dist/{track-page-view-BCX1Dsfk.d.cts → track-page-view-BeVjC-pV.d.cts} +1 -1
- package/dist/{types-yNgoakwk.d.ts → types-uwXEaMD6.d.cts} +45 -2
- package/dist/{types-yNgoakwk.d.cts → types-uwXEaMD6.d.ts} +45 -2
- package/dist/{utils-BLoWWfSw.d.ts → utils-6a6lNKsg.d.ts} +1 -1
- package/dist/{utils-UPTIdK1D.d.cts → utils-Cbb3CO3i.d.cts} +1 -1
- package/docs/legal-and-privacy.md +2 -2
- package/package.json +1 -1
- package/dist/chunk-EMZXL6VF.js.map +0 -1
- package/dist/chunk-RT2YYDCK.js.map +0 -1
- package/dist/chunk-UHXWHKHJ.js.map +0 -1
- /package/dist/{chunk-D43AEUXU.js.map → chunk-BXPMVR7M.js.map} +0 -0
- /package/dist/{chunk-TN6PGIB5.js.map → chunk-JJ3JP3RV.js.map} +0 -0
- /package/dist/{chunk-VQF6QYLR.js.map → chunk-OCIOQIE4.js.map} +0 -0
- /package/dist/{chunk-PTXPNIMF.js.map → chunk-ONIPLMOY.js.map} +0 -0
|
@@ -55,10 +55,12 @@ var import_navigation = require("next/navigation");
|
|
|
55
55
|
var LANDING_REFERER_COOKIE_MAX_AGE_SEC = 30 * 60;
|
|
56
56
|
|
|
57
57
|
// package.json
|
|
58
|
-
var version = "0.1.
|
|
58
|
+
var version = "0.1.39";
|
|
59
59
|
|
|
60
60
|
// src/constants.ts
|
|
61
61
|
var JMP_ANALYTICS_SDK_VERSION = version;
|
|
62
|
+
var JMP_CONTENT_CACHE_TAG = "jmp-content";
|
|
63
|
+
var JMP_CONTENT_REVALIDATE_SECONDS = 3600;
|
|
62
64
|
|
|
63
65
|
// src/http.ts
|
|
64
66
|
function responseLooksLikeHtml(body) {
|
|
@@ -125,11 +127,14 @@ function getJmpContentConfig() {
|
|
|
125
127
|
return null;
|
|
126
128
|
}
|
|
127
129
|
const site = getJmpSiteDefinition();
|
|
130
|
+
const contentWrappers = site?.contentWrappers ?? void 0;
|
|
131
|
+
const inferredMode = contentWrappers && contentWrappers.length > 0 ? "manual" : void 0;
|
|
128
132
|
return {
|
|
129
133
|
baseUrl: analyticsUrl,
|
|
130
134
|
trackingKey,
|
|
131
|
-
contentWrappers
|
|
132
|
-
contentManifest: site?.contentManifest ?? void 0
|
|
135
|
+
contentWrappers,
|
|
136
|
+
contentManifest: site?.contentManifest ?? void 0,
|
|
137
|
+
contentWrapperMode: site?.contentWrapperMode ?? inferredMode
|
|
133
138
|
};
|
|
134
139
|
}
|
|
135
140
|
|
|
@@ -304,7 +309,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
304
309
|
const externalSources = normalizeExternalSources(input.externalSources);
|
|
305
310
|
const trust = normalizeTrust(input.trust);
|
|
306
311
|
const contact = normalizeContact(input.contact);
|
|
307
|
-
|
|
312
|
+
const defaults = normalizeManifestDefaults(input.defaults);
|
|
313
|
+
if (routes.length === 0 && !externalSources && !trust && !contact && !defaults) {
|
|
308
314
|
return null;
|
|
309
315
|
}
|
|
310
316
|
return {
|
|
@@ -312,7 +318,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
312
318
|
...routes.length > 0 ? { routes } : {},
|
|
313
319
|
...externalSources ? { externalSources } : {},
|
|
314
320
|
...trust ? { trust } : {},
|
|
315
|
-
...contact ? { contact } : {}
|
|
321
|
+
...contact ? { contact } : {},
|
|
322
|
+
...defaults ? { defaults } : {}
|
|
316
323
|
};
|
|
317
324
|
}
|
|
318
325
|
function normalizeRoutes(routes) {
|
|
@@ -376,6 +383,85 @@ function normalizeTrustLabels(labels) {
|
|
|
376
383
|
}
|
|
377
384
|
return Object.keys(out).length > 0 ? out : null;
|
|
378
385
|
}
|
|
386
|
+
function readDefaultText(value, max = 500) {
|
|
387
|
+
if (typeof value !== "string") return void 0;
|
|
388
|
+
const trimmed = value.trim();
|
|
389
|
+
if (!trimmed) return void 0;
|
|
390
|
+
return trimmed.slice(0, max);
|
|
391
|
+
}
|
|
392
|
+
function normalizeManifestDefaults(defaults) {
|
|
393
|
+
if (!defaults || typeof defaults !== "object") return null;
|
|
394
|
+
const contactRaw = defaults.contact;
|
|
395
|
+
const contact = {};
|
|
396
|
+
if (contactRaw && typeof contactRaw === "object") {
|
|
397
|
+
const displayName = readDefaultText(contactRaw.displayName, 120);
|
|
398
|
+
const email = readDefaultText(contactRaw.email, 200);
|
|
399
|
+
const phone = readDefaultText(contactRaw.phone, 40);
|
|
400
|
+
const address = readDefaultText(contactRaw.address, 400);
|
|
401
|
+
const hours = readDefaultText(contactRaw.hours, 400);
|
|
402
|
+
const serviceArea = readDefaultText(contactRaw.serviceArea, 200);
|
|
403
|
+
const googleMapsUrl = readDefaultText(contactRaw.googleMapsUrl, 2048);
|
|
404
|
+
const linkedinUrl = readDefaultText(contactRaw.linkedinUrl, 2048);
|
|
405
|
+
const instagramUrl = readDefaultText(contactRaw.instagramUrl, 2048);
|
|
406
|
+
const facebookUrl = readDefaultText(contactRaw.facebookUrl, 2048);
|
|
407
|
+
const xUrl = readDefaultText(contactRaw.xUrl, 2048);
|
|
408
|
+
const youtubeUrl = readDefaultText(contactRaw.youtubeUrl, 2048);
|
|
409
|
+
if (displayName) contact.displayName = displayName;
|
|
410
|
+
if (email) contact.email = email;
|
|
411
|
+
if (phone) contact.phone = phone;
|
|
412
|
+
if (address) contact.address = address;
|
|
413
|
+
if (hours) contact.hours = hours;
|
|
414
|
+
if (serviceArea) contact.serviceArea = serviceArea;
|
|
415
|
+
if (googleMapsUrl) contact.googleMapsUrl = googleMapsUrl;
|
|
416
|
+
if (linkedinUrl) contact.linkedinUrl = linkedinUrl;
|
|
417
|
+
if (instagramUrl) contact.instagramUrl = instagramUrl;
|
|
418
|
+
if (facebookUrl) contact.facebookUrl = facebookUrl;
|
|
419
|
+
if (xUrl) contact.xUrl = xUrl;
|
|
420
|
+
if (youtubeUrl) contact.youtubeUrl = youtubeUrl;
|
|
421
|
+
if (contactRaw.extras && typeof contactRaw.extras === "object") {
|
|
422
|
+
const extras = {};
|
|
423
|
+
for (const [rawKey, rawValue] of Object.entries(contactRaw.extras)) {
|
|
424
|
+
if (Object.keys(extras).length >= 10) break;
|
|
425
|
+
const key = normalizeKey(rawKey);
|
|
426
|
+
const value = readDefaultText(rawValue, 200);
|
|
427
|
+
if (key && isValidExtraKey(key) && value) extras[key] = value;
|
|
428
|
+
}
|
|
429
|
+
if (Object.keys(extras).length > 0) contact.extras = extras;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const faq = [];
|
|
433
|
+
if (Array.isArray(defaults.faq)) {
|
|
434
|
+
for (const raw of defaults.faq) {
|
|
435
|
+
if (!raw || typeof raw !== "object" || faq.length >= 40) continue;
|
|
436
|
+
const question = readDefaultText(raw.question, 300);
|
|
437
|
+
const answer = readDefaultText(raw.answer, 8e3);
|
|
438
|
+
if (!question || !answer) continue;
|
|
439
|
+
const category = readDefaultText(raw.category, 80);
|
|
440
|
+
faq.push({ question, answer, ...category ? { category } : {} });
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const trustRaw = defaults.trust;
|
|
444
|
+
const trust = {};
|
|
445
|
+
if (trustRaw && typeof trustRaw === "object") {
|
|
446
|
+
const assign = (key, max) => {
|
|
447
|
+
const value = readDefaultText(trustRaw[key], max);
|
|
448
|
+
if (value) trust[key] = value;
|
|
449
|
+
};
|
|
450
|
+
assign("googleReviewsUrl", 2048);
|
|
451
|
+
assign("googlePlaceId", 128);
|
|
452
|
+
assign("yelpUrl", 2048);
|
|
453
|
+
assign("trustpilotUrl", 2048);
|
|
454
|
+
assign("disclaimer", 1e3);
|
|
455
|
+
}
|
|
456
|
+
const hasContact = Object.keys(contact).length > 0;
|
|
457
|
+
const hasTrust = Object.keys(trust).length > 0;
|
|
458
|
+
if (!hasContact && faq.length === 0 && !hasTrust) return null;
|
|
459
|
+
return {
|
|
460
|
+
...hasContact ? { contact } : {},
|
|
461
|
+
...faq.length > 0 ? { faq } : {},
|
|
462
|
+
...hasTrust ? { trust } : {}
|
|
463
|
+
};
|
|
464
|
+
}
|
|
379
465
|
function normalizeContact(contact) {
|
|
380
466
|
if (!contact || typeof contact !== "object") return null;
|
|
381
467
|
const extras = normalizeContactExtras(contact.extras);
|
|
@@ -443,7 +529,11 @@ async function getContentText(config, path) {
|
|
|
443
529
|
}
|
|
444
530
|
const res = await resolvedFetch(url, {
|
|
445
531
|
method: "GET",
|
|
446
|
-
headers: jmpContentRequestHeaders(config)
|
|
532
|
+
headers: jmpContentRequestHeaders(config),
|
|
533
|
+
next: {
|
|
534
|
+
revalidate: JMP_CONTENT_REVALIDATE_SECONDS,
|
|
535
|
+
tags: [JMP_CONTENT_CACHE_TAG]
|
|
536
|
+
}
|
|
447
537
|
});
|
|
448
538
|
const text = await res.text();
|
|
449
539
|
if (!res.ok) {
|
|
@@ -470,6 +560,7 @@ var WRAPPER_SLOT_ORDER = [
|
|
|
470
560
|
"blog",
|
|
471
561
|
"faq",
|
|
472
562
|
"contact",
|
|
563
|
+
"legal",
|
|
473
564
|
"trust",
|
|
474
565
|
"trust.summary",
|
|
475
566
|
"trust.testimonials",
|
|
@@ -494,7 +585,65 @@ function getDiscoveredContentWrappers() {
|
|
|
494
585
|
return sortWrapperSlots([...discovered]);
|
|
495
586
|
}
|
|
496
587
|
function resolveContentManifestForReport(config) {
|
|
497
|
-
|
|
588
|
+
const site = getJmpSiteDefinition();
|
|
589
|
+
const fallback = site?.contactFallback;
|
|
590
|
+
const existing = config.contentManifest;
|
|
591
|
+
const fromFallback = fallbackToManifestDefaults(fallback);
|
|
592
|
+
if (!existing && !fromFallback) {
|
|
593
|
+
return null;
|
|
594
|
+
}
|
|
595
|
+
const merged = {
|
|
596
|
+
...existing ?? {},
|
|
597
|
+
defaults: {
|
|
598
|
+
...fromFallback ?? {},
|
|
599
|
+
...existing?.defaults ?? {},
|
|
600
|
+
contact: {
|
|
601
|
+
...fromFallback?.contact ?? {},
|
|
602
|
+
...existing?.defaults?.contact ?? {},
|
|
603
|
+
extras: {
|
|
604
|
+
...fromFallback?.contact?.extras ?? {},
|
|
605
|
+
...existing?.defaults?.contact?.extras ?? {}
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
trust: {
|
|
609
|
+
...fromFallback?.trust ?? {},
|
|
610
|
+
...existing?.defaults?.trust ?? {}
|
|
611
|
+
},
|
|
612
|
+
faq: existing?.defaults?.faq?.length ? existing.defaults.faq : fromFallback?.faq
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
return normalizeJmpContentManifest(merged);
|
|
616
|
+
}
|
|
617
|
+
function fallbackToManifestDefaults(fallback) {
|
|
618
|
+
if (!fallback) return null;
|
|
619
|
+
const contact = {};
|
|
620
|
+
if (fallback.displayName?.trim()) contact.displayName = fallback.displayName.trim();
|
|
621
|
+
if (fallback.email?.trim()) contact.email = fallback.email.trim();
|
|
622
|
+
if (typeof fallback.phone === "string" && fallback.phone.trim()) {
|
|
623
|
+
contact.phone = fallback.phone.trim();
|
|
624
|
+
}
|
|
625
|
+
if (fallback.address?.trim()) contact.address = fallback.address.trim();
|
|
626
|
+
if (fallback.hours?.trim()) contact.hours = fallback.hours.trim();
|
|
627
|
+
if (fallback.serviceArea?.trim()) contact.serviceArea = fallback.serviceArea.trim();
|
|
628
|
+
if (fallback.googleMapsUrl?.trim()) {
|
|
629
|
+
contact.googleMapsUrl = fallback.googleMapsUrl.trim();
|
|
630
|
+
}
|
|
631
|
+
if (fallback.linkedin?.trim()) contact.linkedinUrl = fallback.linkedin.trim();
|
|
632
|
+
if (fallback.instagram?.trim()) contact.instagramUrl = fallback.instagram.trim();
|
|
633
|
+
if (fallback.facebook?.trim()) contact.facebookUrl = fallback.facebook.trim();
|
|
634
|
+
if (fallback.x?.trim()) contact.xUrl = fallback.x.trim();
|
|
635
|
+
if (fallback.youtube?.trim()) contact.youtubeUrl = fallback.youtube.trim();
|
|
636
|
+
const trust = {};
|
|
637
|
+
if (fallback.googleMapsUrl?.trim()) {
|
|
638
|
+
trust.googleReviewsUrl = fallback.googleMapsUrl.trim();
|
|
639
|
+
}
|
|
640
|
+
const hasContact = Object.keys(contact).length > 0;
|
|
641
|
+
const hasTrust = Object.keys(trust).length > 0;
|
|
642
|
+
if (!hasContact && !hasTrust) return null;
|
|
643
|
+
return {
|
|
644
|
+
...hasContact ? { contact } : {},
|
|
645
|
+
...hasTrust ? { trust } : {}
|
|
646
|
+
};
|
|
498
647
|
}
|
|
499
648
|
function resolveContentWrappersForReport(config) {
|
|
500
649
|
const explicit = config.contentWrappers ?? [];
|