@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.
Files changed (82) hide show
  1. package/README.md +1 -1
  2. package/dist/astro/client.cjs +143 -4
  3. package/dist/astro/client.cjs.map +1 -1
  4. package/dist/astro/client.d.cts +2 -2
  5. package/dist/astro/client.d.ts +2 -2
  6. package/dist/astro/client.js +1 -1
  7. package/dist/astro/content.cjs +150 -5
  8. package/dist/astro/content.cjs.map +1 -1
  9. package/dist/astro/content.d.cts +3 -3
  10. package/dist/astro/content.d.ts +3 -3
  11. package/dist/astro/content.js +2 -2
  12. package/dist/astro/integration.cjs +143 -4
  13. package/dist/astro/integration.cjs.map +1 -1
  14. package/dist/astro/integration.js +2 -2
  15. package/dist/astro/middleware.d.cts +2 -2
  16. package/dist/astro/middleware.d.ts +2 -2
  17. package/dist/astro/register.cjs +143 -4
  18. package/dist/astro/register.cjs.map +1 -1
  19. package/dist/astro/register.js +2 -2
  20. package/dist/{chunk-NCF3J4HV.js → chunk-BXPMVR7M.js} +2 -2
  21. package/dist/{chunk-JVFN7MF2.js → chunk-JJ3JP3RV.js} +2 -2
  22. package/dist/{chunk-WHUHCTBQ.js → chunk-M66PHSBO.js} +2 -2
  23. package/dist/{chunk-PQOTEV6O.js → chunk-OCIOQIE4.js} +2 -2
  24. package/dist/{chunk-EBU4DKHW.js → chunk-XAEWXWSP.js} +153 -6
  25. package/dist/chunk-XAEWXWSP.js.map +1 -0
  26. package/dist/constants-DTZMYgi4.d.cts +12 -0
  27. package/dist/constants-DTZMYgi4.d.ts +12 -0
  28. package/dist/{create-jmp-analytics-DMSXmVIH.d.cts → create-jmp-analytics-C1IH32ZF.d.cts} +1 -1
  29. package/dist/{create-jmp-analytics-JZ3pqNBQ.d.ts → create-jmp-analytics-CjVYSmPJ.d.ts} +1 -1
  30. package/dist/index.cjs +154 -5
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +7 -13
  33. package/dist/index.d.ts +7 -13
  34. package/dist/index.js +5 -1
  35. package/dist/next/content.cjs +154 -5
  36. package/dist/next/content.cjs.map +1 -1
  37. package/dist/next/content.d.cts +3 -2
  38. package/dist/next/content.d.ts +3 -2
  39. package/dist/next/content.js +7 -2
  40. package/dist/next/content.js.map +1 -1
  41. package/dist/next/instrumentation.cjs +143 -4
  42. package/dist/next/instrumentation.cjs.map +1 -1
  43. package/dist/next/instrumentation.js +1 -1
  44. package/dist/next/landing-pages.cjs +150 -5
  45. package/dist/next/landing-pages.cjs.map +1 -1
  46. package/dist/next/landing-pages.d.cts +2 -2
  47. package/dist/next/landing-pages.d.ts +2 -2
  48. package/dist/next/landing-pages.js +2 -2
  49. package/dist/next/locations.cjs +150 -5
  50. package/dist/next/locations.cjs.map +1 -1
  51. package/dist/next/locations.d.cts +2 -2
  52. package/dist/next/locations.d.ts +2 -2
  53. package/dist/next/locations.js +2 -2
  54. package/dist/next/middleware.d.cts +2 -2
  55. package/dist/next/middleware.d.ts +2 -2
  56. package/dist/next/site-root-server.cjs +150 -5
  57. package/dist/next/site-root-server.cjs.map +1 -1
  58. package/dist/next/site-root-server.js +3 -3
  59. package/dist/next.cjs +143 -4
  60. package/dist/next.cjs.map +1 -1
  61. package/dist/next.d.cts +3 -3
  62. package/dist/next.d.ts +3 -3
  63. package/dist/next.js +3 -3
  64. package/dist/react.cjs +143 -4
  65. package/dist/react.cjs.map +1 -1
  66. package/dist/react.d.cts +2 -2
  67. package/dist/react.d.ts +2 -2
  68. package/dist/react.js +2 -2
  69. package/dist/{site-config-BLnwuRC2.d.ts → site-config-BEaYpZ3X.d.ts} +1 -1
  70. package/dist/{site-config-BZJS8Hp_.d.cts → site-config-BN6Z2zIf.d.cts} +1 -1
  71. package/dist/{track-page-view-DGKRUIxm.d.ts → track-page-view-B3OwUOYl.d.ts} +1 -1
  72. package/dist/{track-page-view-BJQqn2Bg.d.cts → track-page-view-BeVjC-pV.d.cts} +1 -1
  73. package/dist/{types-CYrgEwUF.d.ts → types-uwXEaMD6.d.cts} +29 -0
  74. package/dist/{types-CYrgEwUF.d.cts → types-uwXEaMD6.d.ts} +29 -0
  75. package/dist/{utils-B1Nt3sBU.d.ts → utils-6a6lNKsg.d.ts} +1 -1
  76. package/dist/{utils-U6TGMIAB.d.cts → utils-Cbb3CO3i.d.cts} +1 -1
  77. package/package.json +1 -1
  78. package/dist/chunk-EBU4DKHW.js.map +0 -1
  79. /package/dist/{chunk-NCF3J4HV.js.map → chunk-BXPMVR7M.js.map} +0 -0
  80. /package/dist/{chunk-JVFN7MF2.js.map → chunk-JJ3JP3RV.js.map} +0 -0
  81. /package/dist/{chunk-WHUHCTBQ.js.map → chunk-M66PHSBO.js.map} +0 -0
  82. /package/dist/{chunk-PQOTEV6O.js.map → chunk-OCIOQIE4.js.map} +0 -0
@@ -35,12 +35,14 @@ __export(site_root_server_exports, {
35
35
  module.exports = __toCommonJS(site_root_server_exports);
36
36
 
37
37
  // package.json
38
- var version = "0.1.38";
38
+ var version = "0.1.39";
39
39
 
40
40
  // src/constants.ts
41
41
  var JMP_ANALYTICS_SDK_VERSION = version;
42
42
  var JMP_TRACKING_CONSENT_STORAGE_KEY = "jmp_analytics_consent_v1";
43
43
  var DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS = 2500;
44
+ var JMP_CONTENT_CACHE_TAG = "jmp-content";
45
+ var JMP_CONTENT_REVALIDATE_SECONDS = 3600;
44
46
 
45
47
  // src/http.ts
46
48
  function responseLooksLikeHtml(body) {
@@ -199,7 +201,11 @@ async function getContentText(config, path) {
199
201
  }
200
202
  const res = await resolvedFetch(url, {
201
203
  method: "GET",
202
- headers: jmpContentRequestHeaders(config)
204
+ headers: jmpContentRequestHeaders(config),
205
+ next: {
206
+ revalidate: JMP_CONTENT_REVALIDATE_SECONDS,
207
+ tags: [JMP_CONTENT_CACHE_TAG]
208
+ }
203
209
  });
204
210
  const text = await res.text();
205
211
  if (!res.ok) {
@@ -313,7 +319,8 @@ function normalizeJmpContentManifest(input) {
313
319
  const externalSources = normalizeExternalSources(input.externalSources);
314
320
  const trust = normalizeTrust(input.trust);
315
321
  const contact = normalizeContact(input.contact);
316
- if (routes.length === 0 && !externalSources && !trust && !contact) {
322
+ const defaults = normalizeManifestDefaults(input.defaults);
323
+ if (routes.length === 0 && !externalSources && !trust && !contact && !defaults) {
317
324
  return null;
318
325
  }
319
326
  return {
@@ -321,7 +328,8 @@ function normalizeJmpContentManifest(input) {
321
328
  ...routes.length > 0 ? { routes } : {},
322
329
  ...externalSources ? { externalSources } : {},
323
330
  ...trust ? { trust } : {},
324
- ...contact ? { contact } : {}
331
+ ...contact ? { contact } : {},
332
+ ...defaults ? { defaults } : {}
325
333
  };
326
334
  }
327
335
  function normalizeRoutes(routes) {
@@ -385,6 +393,85 @@ function normalizeTrustLabels(labels) {
385
393
  }
386
394
  return Object.keys(out).length > 0 ? out : null;
387
395
  }
396
+ function readDefaultText(value, max = 500) {
397
+ if (typeof value !== "string") return void 0;
398
+ const trimmed = value.trim();
399
+ if (!trimmed) return void 0;
400
+ return trimmed.slice(0, max);
401
+ }
402
+ function normalizeManifestDefaults(defaults) {
403
+ if (!defaults || typeof defaults !== "object") return null;
404
+ const contactRaw = defaults.contact;
405
+ const contact = {};
406
+ if (contactRaw && typeof contactRaw === "object") {
407
+ const displayName = readDefaultText(contactRaw.displayName, 120);
408
+ const email = readDefaultText(contactRaw.email, 200);
409
+ const phone = readDefaultText(contactRaw.phone, 40);
410
+ const address = readDefaultText(contactRaw.address, 400);
411
+ const hours = readDefaultText(contactRaw.hours, 400);
412
+ const serviceArea = readDefaultText(contactRaw.serviceArea, 200);
413
+ const googleMapsUrl = readDefaultText(contactRaw.googleMapsUrl, 2048);
414
+ const linkedinUrl = readDefaultText(contactRaw.linkedinUrl, 2048);
415
+ const instagramUrl = readDefaultText(contactRaw.instagramUrl, 2048);
416
+ const facebookUrl = readDefaultText(contactRaw.facebookUrl, 2048);
417
+ const xUrl = readDefaultText(contactRaw.xUrl, 2048);
418
+ const youtubeUrl = readDefaultText(contactRaw.youtubeUrl, 2048);
419
+ if (displayName) contact.displayName = displayName;
420
+ if (email) contact.email = email;
421
+ if (phone) contact.phone = phone;
422
+ if (address) contact.address = address;
423
+ if (hours) contact.hours = hours;
424
+ if (serviceArea) contact.serviceArea = serviceArea;
425
+ if (googleMapsUrl) contact.googleMapsUrl = googleMapsUrl;
426
+ if (linkedinUrl) contact.linkedinUrl = linkedinUrl;
427
+ if (instagramUrl) contact.instagramUrl = instagramUrl;
428
+ if (facebookUrl) contact.facebookUrl = facebookUrl;
429
+ if (xUrl) contact.xUrl = xUrl;
430
+ if (youtubeUrl) contact.youtubeUrl = youtubeUrl;
431
+ if (contactRaw.extras && typeof contactRaw.extras === "object") {
432
+ const extras = {};
433
+ for (const [rawKey, rawValue] of Object.entries(contactRaw.extras)) {
434
+ if (Object.keys(extras).length >= 10) break;
435
+ const key = normalizeKey(rawKey);
436
+ const value = readDefaultText(rawValue, 200);
437
+ if (key && isValidExtraKey(key) && value) extras[key] = value;
438
+ }
439
+ if (Object.keys(extras).length > 0) contact.extras = extras;
440
+ }
441
+ }
442
+ const faq = [];
443
+ if (Array.isArray(defaults.faq)) {
444
+ for (const raw of defaults.faq) {
445
+ if (!raw || typeof raw !== "object" || faq.length >= 40) continue;
446
+ const question = readDefaultText(raw.question, 300);
447
+ const answer = readDefaultText(raw.answer, 8e3);
448
+ if (!question || !answer) continue;
449
+ const category = readDefaultText(raw.category, 80);
450
+ faq.push({ question, answer, ...category ? { category } : {} });
451
+ }
452
+ }
453
+ const trustRaw = defaults.trust;
454
+ const trust = {};
455
+ if (trustRaw && typeof trustRaw === "object") {
456
+ const assign = (key, max) => {
457
+ const value = readDefaultText(trustRaw[key], max);
458
+ if (value) trust[key] = value;
459
+ };
460
+ assign("googleReviewsUrl", 2048);
461
+ assign("googlePlaceId", 128);
462
+ assign("yelpUrl", 2048);
463
+ assign("trustpilotUrl", 2048);
464
+ assign("disclaimer", 1e3);
465
+ }
466
+ const hasContact = Object.keys(contact).length > 0;
467
+ const hasTrust = Object.keys(trust).length > 0;
468
+ if (!hasContact && faq.length === 0 && !hasTrust) return null;
469
+ return {
470
+ ...hasContact ? { contact } : {},
471
+ ...faq.length > 0 ? { faq } : {},
472
+ ...hasTrust ? { trust } : {}
473
+ };
474
+ }
388
475
  function normalizeContact(contact) {
389
476
  if (!contact || typeof contact !== "object") return null;
390
477
  const extras = normalizeContactExtras(contact.extras);
@@ -454,7 +541,65 @@ function getDiscoveredContentWrappers() {
454
541
  return sortWrapperSlots([...discovered]);
455
542
  }
456
543
  function resolveContentManifestForReport(config) {
457
- return normalizeJmpContentManifest(config.contentManifest);
544
+ const site = getJmpSiteDefinition();
545
+ const fallback = site?.contactFallback;
546
+ const existing = config.contentManifest;
547
+ const fromFallback = fallbackToManifestDefaults(fallback);
548
+ if (!existing && !fromFallback) {
549
+ return null;
550
+ }
551
+ const merged = {
552
+ ...existing ?? {},
553
+ defaults: {
554
+ ...fromFallback ?? {},
555
+ ...existing?.defaults ?? {},
556
+ contact: {
557
+ ...fromFallback?.contact ?? {},
558
+ ...existing?.defaults?.contact ?? {},
559
+ extras: {
560
+ ...fromFallback?.contact?.extras ?? {},
561
+ ...existing?.defaults?.contact?.extras ?? {}
562
+ }
563
+ },
564
+ trust: {
565
+ ...fromFallback?.trust ?? {},
566
+ ...existing?.defaults?.trust ?? {}
567
+ },
568
+ faq: existing?.defaults?.faq?.length ? existing.defaults.faq : fromFallback?.faq
569
+ }
570
+ };
571
+ return normalizeJmpContentManifest(merged);
572
+ }
573
+ function fallbackToManifestDefaults(fallback) {
574
+ if (!fallback) return null;
575
+ const contact = {};
576
+ if (fallback.displayName?.trim()) contact.displayName = fallback.displayName.trim();
577
+ if (fallback.email?.trim()) contact.email = fallback.email.trim();
578
+ if (typeof fallback.phone === "string" && fallback.phone.trim()) {
579
+ contact.phone = fallback.phone.trim();
580
+ }
581
+ if (fallback.address?.trim()) contact.address = fallback.address.trim();
582
+ if (fallback.hours?.trim()) contact.hours = fallback.hours.trim();
583
+ if (fallback.serviceArea?.trim()) contact.serviceArea = fallback.serviceArea.trim();
584
+ if (fallback.googleMapsUrl?.trim()) {
585
+ contact.googleMapsUrl = fallback.googleMapsUrl.trim();
586
+ }
587
+ if (fallback.linkedin?.trim()) contact.linkedinUrl = fallback.linkedin.trim();
588
+ if (fallback.instagram?.trim()) contact.instagramUrl = fallback.instagram.trim();
589
+ if (fallback.facebook?.trim()) contact.facebookUrl = fallback.facebook.trim();
590
+ if (fallback.x?.trim()) contact.xUrl = fallback.x.trim();
591
+ if (fallback.youtube?.trim()) contact.youtubeUrl = fallback.youtube.trim();
592
+ const trust = {};
593
+ if (fallback.googleMapsUrl?.trim()) {
594
+ trust.googleReviewsUrl = fallback.googleMapsUrl.trim();
595
+ }
596
+ const hasContact = Object.keys(contact).length > 0;
597
+ const hasTrust = Object.keys(trust).length > 0;
598
+ if (!hasContact && !hasTrust) return null;
599
+ return {
600
+ ...hasContact ? { contact } : {},
601
+ ...hasTrust ? { trust } : {}
602
+ };
458
603
  }
459
604
  function resolveContentWrappersForReport(config) {
460
605
  const explicit = config.contentWrappers ?? [];