@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.
Files changed (95) hide show
  1. package/README.md +1 -1
  2. package/dist/astro/client.cjs +144 -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 +2 -2
  7. package/dist/astro/content.cjs +190 -8
  8. package/dist/astro/content.cjs.map +1 -1
  9. package/dist/astro/content.d.cts +5 -4
  10. package/dist/astro/content.d.ts +5 -4
  11. package/dist/astro/content.js +5 -3
  12. package/dist/astro/integration.cjs +149 -6
  13. package/dist/astro/integration.cjs.map +1 -1
  14. package/dist/astro/integration.js +3 -3
  15. package/dist/astro/middleware.cjs +5 -2
  16. package/dist/astro/middleware.cjs.map +1 -1
  17. package/dist/astro/middleware.d.cts +2 -2
  18. package/dist/astro/middleware.d.ts +2 -2
  19. package/dist/astro/middleware.js +2 -2
  20. package/dist/astro/register.cjs +149 -6
  21. package/dist/astro/register.cjs.map +1 -1
  22. package/dist/astro/register.js +3 -3
  23. package/dist/{chunk-EMZXL6VF.js → chunk-6WQMWPEY.js} +6 -3
  24. package/dist/chunk-6WQMWPEY.js.map +1 -0
  25. package/dist/{chunk-D43AEUXU.js → chunk-BXPMVR7M.js} +3 -3
  26. package/dist/{chunk-TN6PGIB5.js → chunk-JJ3JP3RV.js} +2 -2
  27. package/dist/{chunk-UHXWHKHJ.js → chunk-M66PHSBO.js} +16 -3
  28. package/dist/chunk-M66PHSBO.js.map +1 -0
  29. package/dist/{chunk-VQF6QYLR.js → chunk-OCIOQIE4.js} +3 -3
  30. package/dist/{chunk-PTXPNIMF.js → chunk-ONIPLMOY.js} +2 -2
  31. package/dist/{chunk-RT2YYDCK.js → chunk-XAEWXWSP.js} +189 -8
  32. package/dist/chunk-XAEWXWSP.js.map +1 -0
  33. package/dist/constants-DTZMYgi4.d.cts +12 -0
  34. package/dist/constants-DTZMYgi4.d.ts +12 -0
  35. package/dist/{create-jmp-analytics-Bz0-K0Af.d.cts → create-jmp-analytics-C1IH32ZF.d.cts} +1 -1
  36. package/dist/{create-jmp-analytics-DRjrlWUn.d.ts → create-jmp-analytics-CjVYSmPJ.d.ts} +1 -1
  37. package/dist/index.cjs +196 -8
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.cts +11 -13
  40. package/dist/index.d.ts +11 -13
  41. package/dist/index.js +10 -2
  42. package/dist/next/content.cjs +195 -8
  43. package/dist/next/content.cjs.map +1 -1
  44. package/dist/next/content.d.cts +6 -4
  45. package/dist/next/content.d.ts +6 -4
  46. package/dist/next/content.js +11 -3
  47. package/dist/next/content.js.map +1 -1
  48. package/dist/next/instrumentation.cjs +149 -6
  49. package/dist/next/instrumentation.cjs.map +1 -1
  50. package/dist/next/instrumentation.js +2 -2
  51. package/dist/next/landing-pages.cjs +156 -7
  52. package/dist/next/landing-pages.cjs.map +1 -1
  53. package/dist/next/landing-pages.d.cts +2 -2
  54. package/dist/next/landing-pages.d.ts +2 -2
  55. package/dist/next/landing-pages.js +3 -3
  56. package/dist/next/locations.cjs +156 -7
  57. package/dist/next/locations.cjs.map +1 -1
  58. package/dist/next/locations.d.cts +2 -2
  59. package/dist/next/locations.d.ts +2 -2
  60. package/dist/next/locations.js +3 -3
  61. package/dist/next/middleware.cjs +5 -2
  62. package/dist/next/middleware.cjs.map +1 -1
  63. package/dist/next/middleware.d.cts +2 -2
  64. package/dist/next/middleware.d.ts +2 -2
  65. package/dist/next/middleware.js +2 -2
  66. package/dist/next/site-root-server.cjs +156 -7
  67. package/dist/next/site-root-server.cjs.map +1 -1
  68. package/dist/next/site-root-server.js +4 -4
  69. package/dist/next.cjs +144 -4
  70. package/dist/next.cjs.map +1 -1
  71. package/dist/next.d.cts +3 -3
  72. package/dist/next.d.ts +3 -3
  73. package/dist/next.js +4 -4
  74. package/dist/react.cjs +144 -4
  75. package/dist/react.cjs.map +1 -1
  76. package/dist/react.d.cts +2 -2
  77. package/dist/react.d.ts +2 -2
  78. package/dist/react.js +3 -3
  79. package/dist/{site-config-BxEmJxBB.d.ts → site-config-BEaYpZ3X.d.ts} +9 -3
  80. package/dist/{site-config-Cgq67uQ1.d.cts → site-config-BN6Z2zIf.d.cts} +9 -3
  81. package/dist/{track-page-view-74Su6lQY.d.ts → track-page-view-B3OwUOYl.d.ts} +1 -1
  82. package/dist/{track-page-view-BCX1Dsfk.d.cts → track-page-view-BeVjC-pV.d.cts} +1 -1
  83. package/dist/{types-yNgoakwk.d.ts → types-uwXEaMD6.d.cts} +45 -2
  84. package/dist/{types-yNgoakwk.d.cts → types-uwXEaMD6.d.ts} +45 -2
  85. package/dist/{utils-BLoWWfSw.d.ts → utils-6a6lNKsg.d.ts} +1 -1
  86. package/dist/{utils-UPTIdK1D.d.cts → utils-Cbb3CO3i.d.cts} +1 -1
  87. package/docs/legal-and-privacy.md +2 -2
  88. package/package.json +1 -1
  89. package/dist/chunk-EMZXL6VF.js.map +0 -1
  90. package/dist/chunk-RT2YYDCK.js.map +0 -1
  91. package/dist/chunk-UHXWHKHJ.js.map +0 -1
  92. /package/dist/{chunk-D43AEUXU.js.map → chunk-BXPMVR7M.js.map} +0 -0
  93. /package/dist/{chunk-TN6PGIB5.js.map → chunk-JJ3JP3RV.js.map} +0 -0
  94. /package/dist/{chunk-VQF6QYLR.js.map → chunk-OCIOQIE4.js.map} +0 -0
  95. /package/dist/{chunk-PTXPNIMF.js.map → chunk-ONIPLMOY.js.map} +0 -0
package/README.md CHANGED
@@ -355,6 +355,6 @@ After publish, on client sites:
355
355
  npm install @jmp-technologies/analytics@latest
356
356
  ```
357
357
 
358
- Use **≥ 0.1.8** for `getJmpSiteProfile` / `extras`. Use **≥ 0.1.10** for `email_click` tracking and `JmpTrackedMailtoLink`. Use **≥ 0.1.37** so server content fetches and server page views send `Origin` from `siteUrl` / `NEXT_PUBLIC_SITE_URL` (required for capabilities writes after the matching dashboard deploy).
358
+ Use **≥ 0.1.8** for `getJmpSiteProfile` / `extras`. Use **≥ 0.1.10** for `email_click` tracking and `JmpTrackedMailtoLink`. Use **≥ 0.1.37** so server content fetches and server page views send `Origin` from `siteUrl` / `NEXT_PUBLIC_SITE_URL` (required for capabilities writes after the matching dashboard deploy). Use **≥ 0.1.38** so `contentManifest.routes` with wrapper `legal` or `pages` reports page URLs to the dashboard Pages tab. Use **≥ 0.1.39** so JMP content `fetch` uses the `jmp-content` cache tag (client webhooks revalidate it).
359
359
 
360
360
  Ensure the **dashboard** is deployed with migrations **020** and **021** and `/api/content/site` is live before relying on `getJmpSiteProfile` in production.
@@ -308,7 +308,7 @@ function extractMailtoTarget(href) {
308
308
  }
309
309
 
310
310
  // package.json
311
- var version = "0.1.37";
311
+ var version = "0.1.39";
312
312
 
313
313
  // src/constants.ts
314
314
  var JMP_ANALYTICS_SDK_VERSION = version;
@@ -951,7 +951,8 @@ function normalizeJmpContentManifest(input) {
951
951
  const externalSources = normalizeExternalSources(input.externalSources);
952
952
  const trust = normalizeTrust(input.trust);
953
953
  const contact = normalizeContact(input.contact);
954
- if (routes.length === 0 && !externalSources && !trust && !contact) {
954
+ const defaults = normalizeManifestDefaults(input.defaults);
955
+ if (routes.length === 0 && !externalSources && !trust && !contact && !defaults) {
955
956
  return null;
956
957
  }
957
958
  return {
@@ -959,7 +960,8 @@ function normalizeJmpContentManifest(input) {
959
960
  ...routes.length > 0 ? { routes } : {},
960
961
  ...externalSources ? { externalSources } : {},
961
962
  ...trust ? { trust } : {},
962
- ...contact ? { contact } : {}
963
+ ...contact ? { contact } : {},
964
+ ...defaults ? { defaults } : {}
963
965
  };
964
966
  }
965
967
  function normalizeRoutes(routes) {
@@ -1023,6 +1025,85 @@ function normalizeTrustLabels(labels) {
1023
1025
  }
1024
1026
  return Object.keys(out).length > 0 ? out : null;
1025
1027
  }
1028
+ function readDefaultText(value, max = 500) {
1029
+ if (typeof value !== "string") return void 0;
1030
+ const trimmed = value.trim();
1031
+ if (!trimmed) return void 0;
1032
+ return trimmed.slice(0, max);
1033
+ }
1034
+ function normalizeManifestDefaults(defaults) {
1035
+ if (!defaults || typeof defaults !== "object") return null;
1036
+ const contactRaw = defaults.contact;
1037
+ const contact = {};
1038
+ if (contactRaw && typeof contactRaw === "object") {
1039
+ const displayName = readDefaultText(contactRaw.displayName, 120);
1040
+ const email = readDefaultText(contactRaw.email, 200);
1041
+ const phone = readDefaultText(contactRaw.phone, 40);
1042
+ const address = readDefaultText(contactRaw.address, 400);
1043
+ const hours = readDefaultText(contactRaw.hours, 400);
1044
+ const serviceArea = readDefaultText(contactRaw.serviceArea, 200);
1045
+ const googleMapsUrl = readDefaultText(contactRaw.googleMapsUrl, 2048);
1046
+ const linkedinUrl = readDefaultText(contactRaw.linkedinUrl, 2048);
1047
+ const instagramUrl = readDefaultText(contactRaw.instagramUrl, 2048);
1048
+ const facebookUrl = readDefaultText(contactRaw.facebookUrl, 2048);
1049
+ const xUrl = readDefaultText(contactRaw.xUrl, 2048);
1050
+ const youtubeUrl = readDefaultText(contactRaw.youtubeUrl, 2048);
1051
+ if (displayName) contact.displayName = displayName;
1052
+ if (email) contact.email = email;
1053
+ if (phone) contact.phone = phone;
1054
+ if (address) contact.address = address;
1055
+ if (hours) contact.hours = hours;
1056
+ if (serviceArea) contact.serviceArea = serviceArea;
1057
+ if (googleMapsUrl) contact.googleMapsUrl = googleMapsUrl;
1058
+ if (linkedinUrl) contact.linkedinUrl = linkedinUrl;
1059
+ if (instagramUrl) contact.instagramUrl = instagramUrl;
1060
+ if (facebookUrl) contact.facebookUrl = facebookUrl;
1061
+ if (xUrl) contact.xUrl = xUrl;
1062
+ if (youtubeUrl) contact.youtubeUrl = youtubeUrl;
1063
+ if (contactRaw.extras && typeof contactRaw.extras === "object") {
1064
+ const extras = {};
1065
+ for (const [rawKey, rawValue] of Object.entries(contactRaw.extras)) {
1066
+ if (Object.keys(extras).length >= 10) break;
1067
+ const key = normalizeKey(rawKey);
1068
+ const value = readDefaultText(rawValue, 200);
1069
+ if (key && isValidExtraKey(key) && value) extras[key] = value;
1070
+ }
1071
+ if (Object.keys(extras).length > 0) contact.extras = extras;
1072
+ }
1073
+ }
1074
+ const faq = [];
1075
+ if (Array.isArray(defaults.faq)) {
1076
+ for (const raw of defaults.faq) {
1077
+ if (!raw || typeof raw !== "object" || faq.length >= 40) continue;
1078
+ const question = readDefaultText(raw.question, 300);
1079
+ const answer = readDefaultText(raw.answer, 8e3);
1080
+ if (!question || !answer) continue;
1081
+ const category = readDefaultText(raw.category, 80);
1082
+ faq.push({ question, answer, ...category ? { category } : {} });
1083
+ }
1084
+ }
1085
+ const trustRaw = defaults.trust;
1086
+ const trust = {};
1087
+ if (trustRaw && typeof trustRaw === "object") {
1088
+ const assign = (key, max) => {
1089
+ const value = readDefaultText(trustRaw[key], max);
1090
+ if (value) trust[key] = value;
1091
+ };
1092
+ assign("googleReviewsUrl", 2048);
1093
+ assign("googlePlaceId", 128);
1094
+ assign("yelpUrl", 2048);
1095
+ assign("trustpilotUrl", 2048);
1096
+ assign("disclaimer", 1e3);
1097
+ }
1098
+ const hasContact = Object.keys(contact).length > 0;
1099
+ const hasTrust = Object.keys(trust).length > 0;
1100
+ if (!hasContact && faq.length === 0 && !hasTrust) return null;
1101
+ return {
1102
+ ...hasContact ? { contact } : {},
1103
+ ...faq.length > 0 ? { faq } : {},
1104
+ ...hasTrust ? { trust } : {}
1105
+ };
1106
+ }
1026
1107
  function normalizeContact(contact) {
1027
1108
  if (!contact || typeof contact !== "object") return null;
1028
1109
  const extras = normalizeContactExtras(contact.extras);
@@ -1074,6 +1155,7 @@ var WRAPPER_SLOT_ORDER = [
1074
1155
  "blog",
1075
1156
  "faq",
1076
1157
  "contact",
1158
+ "legal",
1077
1159
  "trust",
1078
1160
  "trust.summary",
1079
1161
  "trust.testimonials",
@@ -1089,7 +1171,65 @@ function getDiscoveredContentWrappers() {
1089
1171
  return sortWrapperSlots([...discovered]);
1090
1172
  }
1091
1173
  function resolveContentManifestForReport(config) {
1092
- return normalizeJmpContentManifest(config.contentManifest);
1174
+ const site = getJmpSiteDefinition();
1175
+ const fallback = site?.contactFallback;
1176
+ const existing = config.contentManifest;
1177
+ const fromFallback = fallbackToManifestDefaults(fallback);
1178
+ if (!existing && !fromFallback) {
1179
+ return null;
1180
+ }
1181
+ const merged = {
1182
+ ...existing ?? {},
1183
+ defaults: {
1184
+ ...fromFallback ?? {},
1185
+ ...existing?.defaults ?? {},
1186
+ contact: {
1187
+ ...fromFallback?.contact ?? {},
1188
+ ...existing?.defaults?.contact ?? {},
1189
+ extras: {
1190
+ ...fromFallback?.contact?.extras ?? {},
1191
+ ...existing?.defaults?.contact?.extras ?? {}
1192
+ }
1193
+ },
1194
+ trust: {
1195
+ ...fromFallback?.trust ?? {},
1196
+ ...existing?.defaults?.trust ?? {}
1197
+ },
1198
+ faq: existing?.defaults?.faq?.length ? existing.defaults.faq : fromFallback?.faq
1199
+ }
1200
+ };
1201
+ return normalizeJmpContentManifest(merged);
1202
+ }
1203
+ function fallbackToManifestDefaults(fallback) {
1204
+ if (!fallback) return null;
1205
+ const contact = {};
1206
+ if (fallback.displayName?.trim()) contact.displayName = fallback.displayName.trim();
1207
+ if (fallback.email?.trim()) contact.email = fallback.email.trim();
1208
+ if (typeof fallback.phone === "string" && fallback.phone.trim()) {
1209
+ contact.phone = fallback.phone.trim();
1210
+ }
1211
+ if (fallback.address?.trim()) contact.address = fallback.address.trim();
1212
+ if (fallback.hours?.trim()) contact.hours = fallback.hours.trim();
1213
+ if (fallback.serviceArea?.trim()) contact.serviceArea = fallback.serviceArea.trim();
1214
+ if (fallback.googleMapsUrl?.trim()) {
1215
+ contact.googleMapsUrl = fallback.googleMapsUrl.trim();
1216
+ }
1217
+ if (fallback.linkedin?.trim()) contact.linkedinUrl = fallback.linkedin.trim();
1218
+ if (fallback.instagram?.trim()) contact.instagramUrl = fallback.instagram.trim();
1219
+ if (fallback.facebook?.trim()) contact.facebookUrl = fallback.facebook.trim();
1220
+ if (fallback.x?.trim()) contact.xUrl = fallback.x.trim();
1221
+ if (fallback.youtube?.trim()) contact.youtubeUrl = fallback.youtube.trim();
1222
+ const trust = {};
1223
+ if (fallback.googleMapsUrl?.trim()) {
1224
+ trust.googleReviewsUrl = fallback.googleMapsUrl.trim();
1225
+ }
1226
+ const hasContact = Object.keys(contact).length > 0;
1227
+ const hasTrust = Object.keys(trust).length > 0;
1228
+ if (!hasContact && !hasTrust) return null;
1229
+ return {
1230
+ ...hasContact ? { contact } : {},
1231
+ ...hasTrust ? { trust } : {}
1232
+ };
1093
1233
  }
1094
1234
  function resolveContentWrappersForReport(config) {
1095
1235
  const explicit = config.contentWrappers ?? [];