@jmp-technologies/analytics 0.1.38 → 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 +143 -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 +1 -1
- package/dist/astro/content.cjs +150 -5
- package/dist/astro/content.cjs.map +1 -1
- package/dist/astro/content.d.cts +3 -3
- package/dist/astro/content.d.ts +3 -3
- package/dist/astro/content.js +2 -2
- package/dist/astro/integration.cjs +143 -4
- package/dist/astro/integration.cjs.map +1 -1
- package/dist/astro/integration.js +2 -2
- package/dist/astro/middleware.d.cts +2 -2
- package/dist/astro/middleware.d.ts +2 -2
- package/dist/astro/register.cjs +143 -4
- package/dist/astro/register.cjs.map +1 -1
- package/dist/astro/register.js +2 -2
- package/dist/{chunk-NCF3J4HV.js → chunk-BXPMVR7M.js} +2 -2
- package/dist/{chunk-JVFN7MF2.js → chunk-JJ3JP3RV.js} +2 -2
- package/dist/{chunk-WHUHCTBQ.js → chunk-M66PHSBO.js} +2 -2
- package/dist/{chunk-PQOTEV6O.js → chunk-OCIOQIE4.js} +2 -2
- package/dist/{chunk-EBU4DKHW.js → chunk-XAEWXWSP.js} +153 -6
- 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-DMSXmVIH.d.cts → create-jmp-analytics-C1IH32ZF.d.cts} +1 -1
- package/dist/{create-jmp-analytics-JZ3pqNBQ.d.ts → create-jmp-analytics-CjVYSmPJ.d.ts} +1 -1
- package/dist/index.cjs +154 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -13
- package/dist/index.d.ts +7 -13
- package/dist/index.js +5 -1
- package/dist/next/content.cjs +154 -5
- package/dist/next/content.cjs.map +1 -1
- package/dist/next/content.d.cts +3 -2
- package/dist/next/content.d.ts +3 -2
- package/dist/next/content.js +7 -2
- package/dist/next/content.js.map +1 -1
- package/dist/next/instrumentation.cjs +143 -4
- package/dist/next/instrumentation.cjs.map +1 -1
- package/dist/next/instrumentation.js +1 -1
- package/dist/next/landing-pages.cjs +150 -5
- 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 +2 -2
- package/dist/next/locations.cjs +150 -5
- 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 +2 -2
- package/dist/next/middleware.d.cts +2 -2
- package/dist/next/middleware.d.ts +2 -2
- package/dist/next/site-root-server.cjs +150 -5
- package/dist/next/site-root-server.cjs.map +1 -1
- package/dist/next/site-root-server.js +3 -3
- package/dist/next.cjs +143 -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 +3 -3
- package/dist/react.cjs +143 -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 +2 -2
- package/dist/{site-config-BLnwuRC2.d.ts → site-config-BEaYpZ3X.d.ts} +1 -1
- package/dist/{site-config-BZJS8Hp_.d.cts → site-config-BN6Z2zIf.d.cts} +1 -1
- package/dist/{track-page-view-DGKRUIxm.d.ts → track-page-view-B3OwUOYl.d.ts} +1 -1
- package/dist/{track-page-view-BJQqn2Bg.d.cts → track-page-view-BeVjC-pV.d.cts} +1 -1
- package/dist/{types-CYrgEwUF.d.ts → types-uwXEaMD6.d.cts} +29 -0
- package/dist/{types-CYrgEwUF.d.cts → types-uwXEaMD6.d.ts} +29 -0
- package/dist/{utils-B1Nt3sBU.d.ts → utils-6a6lNKsg.d.ts} +1 -1
- package/dist/{utils-U6TGMIAB.d.cts → utils-Cbb3CO3i.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-EBU4DKHW.js.map +0 -1
- /package/dist/{chunk-NCF3J4HV.js.map → chunk-BXPMVR7M.js.map} +0 -0
- /package/dist/{chunk-JVFN7MF2.js.map → chunk-JJ3JP3RV.js.map} +0 -0
- /package/dist/{chunk-WHUHCTBQ.js.map → chunk-M66PHSBO.js.map} +0 -0
- /package/dist/{chunk-PQOTEV6O.js.map → chunk-OCIOQIE4.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) {
|
|
@@ -307,7 +309,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
307
309
|
const externalSources = normalizeExternalSources(input.externalSources);
|
|
308
310
|
const trust = normalizeTrust(input.trust);
|
|
309
311
|
const contact = normalizeContact(input.contact);
|
|
310
|
-
|
|
312
|
+
const defaults = normalizeManifestDefaults(input.defaults);
|
|
313
|
+
if (routes.length === 0 && !externalSources && !trust && !contact && !defaults) {
|
|
311
314
|
return null;
|
|
312
315
|
}
|
|
313
316
|
return {
|
|
@@ -315,7 +318,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
315
318
|
...routes.length > 0 ? { routes } : {},
|
|
316
319
|
...externalSources ? { externalSources } : {},
|
|
317
320
|
...trust ? { trust } : {},
|
|
318
|
-
...contact ? { contact } : {}
|
|
321
|
+
...contact ? { contact } : {},
|
|
322
|
+
...defaults ? { defaults } : {}
|
|
319
323
|
};
|
|
320
324
|
}
|
|
321
325
|
function normalizeRoutes(routes) {
|
|
@@ -379,6 +383,85 @@ function normalizeTrustLabels(labels) {
|
|
|
379
383
|
}
|
|
380
384
|
return Object.keys(out).length > 0 ? out : null;
|
|
381
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
|
+
}
|
|
382
465
|
function normalizeContact(contact) {
|
|
383
466
|
if (!contact || typeof contact !== "object") return null;
|
|
384
467
|
const extras = normalizeContactExtras(contact.extras);
|
|
@@ -446,7 +529,11 @@ async function getContentText(config, path) {
|
|
|
446
529
|
}
|
|
447
530
|
const res = await resolvedFetch(url, {
|
|
448
531
|
method: "GET",
|
|
449
|
-
headers: jmpContentRequestHeaders(config)
|
|
532
|
+
headers: jmpContentRequestHeaders(config),
|
|
533
|
+
next: {
|
|
534
|
+
revalidate: JMP_CONTENT_REVALIDATE_SECONDS,
|
|
535
|
+
tags: [JMP_CONTENT_CACHE_TAG]
|
|
536
|
+
}
|
|
450
537
|
});
|
|
451
538
|
const text = await res.text();
|
|
452
539
|
if (!res.ok) {
|
|
@@ -498,7 +585,65 @@ function getDiscoveredContentWrappers() {
|
|
|
498
585
|
return sortWrapperSlots([...discovered]);
|
|
499
586
|
}
|
|
500
587
|
function resolveContentManifestForReport(config) {
|
|
501
|
-
|
|
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
|
+
};
|
|
502
647
|
}
|
|
503
648
|
function resolveContentWrappersForReport(config) {
|
|
504
649
|
const explicit = config.contentWrappers ?? [];
|