@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
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,8 @@ __export(index_exports, {
|
|
|
23
23
|
BOOKING_LINK_HOSTS: () => BOOKING_LINK_HOSTS,
|
|
24
24
|
DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS: () => DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS,
|
|
25
25
|
JMP_ANALYTICS_SDK_VERSION: () => JMP_ANALYTICS_SDK_VERSION,
|
|
26
|
+
JMP_CONTENT_CACHE_TAG: () => JMP_CONTENT_CACHE_TAG,
|
|
27
|
+
JMP_CONTENT_REVALIDATE_SECONDS: () => JMP_CONTENT_REVALIDATE_SECONDS,
|
|
26
28
|
JMP_TRACKING_CONSENT_STORAGE_KEY: () => JMP_TRACKING_CONSENT_STORAGE_KEY,
|
|
27
29
|
buildLandingCaptureInlineScript: () => buildLandingCaptureInlineScript,
|
|
28
30
|
classifyContactHref: () => classifyContactHref,
|
|
@@ -350,12 +352,14 @@ function extractMailtoTarget(href) {
|
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
// package.json
|
|
353
|
-
var version = "0.1.
|
|
355
|
+
var version = "0.1.39";
|
|
354
356
|
|
|
355
357
|
// src/constants.ts
|
|
356
358
|
var JMP_ANALYTICS_SDK_VERSION = version;
|
|
357
359
|
var JMP_TRACKING_CONSENT_STORAGE_KEY = "jmp_analytics_consent_v1";
|
|
358
360
|
var DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS = 2500;
|
|
361
|
+
var JMP_CONTENT_CACHE_TAG = "jmp-content";
|
|
362
|
+
var JMP_CONTENT_REVALIDATE_SECONDS = 3600;
|
|
359
363
|
|
|
360
364
|
// src/consent.ts
|
|
361
365
|
var moduleTrackingConsentGranted = true;
|
|
@@ -1092,7 +1096,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
1092
1096
|
const externalSources = normalizeExternalSources(input.externalSources);
|
|
1093
1097
|
const trust = normalizeTrust(input.trust);
|
|
1094
1098
|
const contact = normalizeContact(input.contact);
|
|
1095
|
-
|
|
1099
|
+
const defaults = normalizeManifestDefaults(input.defaults);
|
|
1100
|
+
if (routes.length === 0 && !externalSources && !trust && !contact && !defaults) {
|
|
1096
1101
|
return null;
|
|
1097
1102
|
}
|
|
1098
1103
|
return {
|
|
@@ -1100,7 +1105,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
1100
1105
|
...routes.length > 0 ? { routes } : {},
|
|
1101
1106
|
...externalSources ? { externalSources } : {},
|
|
1102
1107
|
...trust ? { trust } : {},
|
|
1103
|
-
...contact ? { contact } : {}
|
|
1108
|
+
...contact ? { contact } : {},
|
|
1109
|
+
...defaults ? { defaults } : {}
|
|
1104
1110
|
};
|
|
1105
1111
|
}
|
|
1106
1112
|
function normalizeRoutes(routes) {
|
|
@@ -1164,6 +1170,85 @@ function normalizeTrustLabels(labels) {
|
|
|
1164
1170
|
}
|
|
1165
1171
|
return Object.keys(out).length > 0 ? out : null;
|
|
1166
1172
|
}
|
|
1173
|
+
function readDefaultText(value, max = 500) {
|
|
1174
|
+
if (typeof value !== "string") return void 0;
|
|
1175
|
+
const trimmed = value.trim();
|
|
1176
|
+
if (!trimmed) return void 0;
|
|
1177
|
+
return trimmed.slice(0, max);
|
|
1178
|
+
}
|
|
1179
|
+
function normalizeManifestDefaults(defaults) {
|
|
1180
|
+
if (!defaults || typeof defaults !== "object") return null;
|
|
1181
|
+
const contactRaw = defaults.contact;
|
|
1182
|
+
const contact = {};
|
|
1183
|
+
if (contactRaw && typeof contactRaw === "object") {
|
|
1184
|
+
const displayName = readDefaultText(contactRaw.displayName, 120);
|
|
1185
|
+
const email = readDefaultText(contactRaw.email, 200);
|
|
1186
|
+
const phone = readDefaultText(contactRaw.phone, 40);
|
|
1187
|
+
const address = readDefaultText(contactRaw.address, 400);
|
|
1188
|
+
const hours = readDefaultText(contactRaw.hours, 400);
|
|
1189
|
+
const serviceArea = readDefaultText(contactRaw.serviceArea, 200);
|
|
1190
|
+
const googleMapsUrl = readDefaultText(contactRaw.googleMapsUrl, 2048);
|
|
1191
|
+
const linkedinUrl = readDefaultText(contactRaw.linkedinUrl, 2048);
|
|
1192
|
+
const instagramUrl = readDefaultText(contactRaw.instagramUrl, 2048);
|
|
1193
|
+
const facebookUrl = readDefaultText(contactRaw.facebookUrl, 2048);
|
|
1194
|
+
const xUrl = readDefaultText(contactRaw.xUrl, 2048);
|
|
1195
|
+
const youtubeUrl = readDefaultText(contactRaw.youtubeUrl, 2048);
|
|
1196
|
+
if (displayName) contact.displayName = displayName;
|
|
1197
|
+
if (email) contact.email = email;
|
|
1198
|
+
if (phone) contact.phone = phone;
|
|
1199
|
+
if (address) contact.address = address;
|
|
1200
|
+
if (hours) contact.hours = hours;
|
|
1201
|
+
if (serviceArea) contact.serviceArea = serviceArea;
|
|
1202
|
+
if (googleMapsUrl) contact.googleMapsUrl = googleMapsUrl;
|
|
1203
|
+
if (linkedinUrl) contact.linkedinUrl = linkedinUrl;
|
|
1204
|
+
if (instagramUrl) contact.instagramUrl = instagramUrl;
|
|
1205
|
+
if (facebookUrl) contact.facebookUrl = facebookUrl;
|
|
1206
|
+
if (xUrl) contact.xUrl = xUrl;
|
|
1207
|
+
if (youtubeUrl) contact.youtubeUrl = youtubeUrl;
|
|
1208
|
+
if (contactRaw.extras && typeof contactRaw.extras === "object") {
|
|
1209
|
+
const extras = {};
|
|
1210
|
+
for (const [rawKey, rawValue] of Object.entries(contactRaw.extras)) {
|
|
1211
|
+
if (Object.keys(extras).length >= 10) break;
|
|
1212
|
+
const key = normalizeKey(rawKey);
|
|
1213
|
+
const value = readDefaultText(rawValue, 200);
|
|
1214
|
+
if (key && isValidExtraKey(key) && value) extras[key] = value;
|
|
1215
|
+
}
|
|
1216
|
+
if (Object.keys(extras).length > 0) contact.extras = extras;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
const faq = [];
|
|
1220
|
+
if (Array.isArray(defaults.faq)) {
|
|
1221
|
+
for (const raw of defaults.faq) {
|
|
1222
|
+
if (!raw || typeof raw !== "object" || faq.length >= 40) continue;
|
|
1223
|
+
const question = readDefaultText(raw.question, 300);
|
|
1224
|
+
const answer = readDefaultText(raw.answer, 8e3);
|
|
1225
|
+
if (!question || !answer) continue;
|
|
1226
|
+
const category = readDefaultText(raw.category, 80);
|
|
1227
|
+
faq.push({ question, answer, ...category ? { category } : {} });
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
const trustRaw = defaults.trust;
|
|
1231
|
+
const trust = {};
|
|
1232
|
+
if (trustRaw && typeof trustRaw === "object") {
|
|
1233
|
+
const assign = (key, max) => {
|
|
1234
|
+
const value = readDefaultText(trustRaw[key], max);
|
|
1235
|
+
if (value) trust[key] = value;
|
|
1236
|
+
};
|
|
1237
|
+
assign("googleReviewsUrl", 2048);
|
|
1238
|
+
assign("googlePlaceId", 128);
|
|
1239
|
+
assign("yelpUrl", 2048);
|
|
1240
|
+
assign("trustpilotUrl", 2048);
|
|
1241
|
+
assign("disclaimer", 1e3);
|
|
1242
|
+
}
|
|
1243
|
+
const hasContact = Object.keys(contact).length > 0;
|
|
1244
|
+
const hasTrust = Object.keys(trust).length > 0;
|
|
1245
|
+
if (!hasContact && faq.length === 0 && !hasTrust) return null;
|
|
1246
|
+
return {
|
|
1247
|
+
...hasContact ? { contact } : {},
|
|
1248
|
+
...faq.length > 0 ? { faq } : {},
|
|
1249
|
+
...hasTrust ? { trust } : {}
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1167
1252
|
function normalizeContact(contact) {
|
|
1168
1253
|
if (!contact || typeof contact !== "object") return null;
|
|
1169
1254
|
const extras = normalizeContactExtras(contact.extras);
|
|
@@ -1231,7 +1316,11 @@ async function getContentText(config, path) {
|
|
|
1231
1316
|
}
|
|
1232
1317
|
const res = await resolvedFetch(url, {
|
|
1233
1318
|
method: "GET",
|
|
1234
|
-
headers: jmpContentRequestHeaders(config)
|
|
1319
|
+
headers: jmpContentRequestHeaders(config),
|
|
1320
|
+
next: {
|
|
1321
|
+
revalidate: JMP_CONTENT_REVALIDATE_SECONDS,
|
|
1322
|
+
tags: [JMP_CONTENT_CACHE_TAG]
|
|
1323
|
+
}
|
|
1235
1324
|
});
|
|
1236
1325
|
const text = await res.text();
|
|
1237
1326
|
if (!res.ok) {
|
|
@@ -1322,7 +1411,65 @@ function getDiscoveredContentWrappers() {
|
|
|
1322
1411
|
return sortWrapperSlots([...discovered]);
|
|
1323
1412
|
}
|
|
1324
1413
|
function resolveContentManifestForReport(config) {
|
|
1325
|
-
|
|
1414
|
+
const site = getJmpSiteDefinition();
|
|
1415
|
+
const fallback = site?.contactFallback;
|
|
1416
|
+
const existing = config.contentManifest;
|
|
1417
|
+
const fromFallback = fallbackToManifestDefaults(fallback);
|
|
1418
|
+
if (!existing && !fromFallback) {
|
|
1419
|
+
return null;
|
|
1420
|
+
}
|
|
1421
|
+
const merged = {
|
|
1422
|
+
...existing ?? {},
|
|
1423
|
+
defaults: {
|
|
1424
|
+
...fromFallback ?? {},
|
|
1425
|
+
...existing?.defaults ?? {},
|
|
1426
|
+
contact: {
|
|
1427
|
+
...fromFallback?.contact ?? {},
|
|
1428
|
+
...existing?.defaults?.contact ?? {},
|
|
1429
|
+
extras: {
|
|
1430
|
+
...fromFallback?.contact?.extras ?? {},
|
|
1431
|
+
...existing?.defaults?.contact?.extras ?? {}
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
trust: {
|
|
1435
|
+
...fromFallback?.trust ?? {},
|
|
1436
|
+
...existing?.defaults?.trust ?? {}
|
|
1437
|
+
},
|
|
1438
|
+
faq: existing?.defaults?.faq?.length ? existing.defaults.faq : fromFallback?.faq
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
return normalizeJmpContentManifest(merged);
|
|
1442
|
+
}
|
|
1443
|
+
function fallbackToManifestDefaults(fallback) {
|
|
1444
|
+
if (!fallback) return null;
|
|
1445
|
+
const contact = {};
|
|
1446
|
+
if (fallback.displayName?.trim()) contact.displayName = fallback.displayName.trim();
|
|
1447
|
+
if (fallback.email?.trim()) contact.email = fallback.email.trim();
|
|
1448
|
+
if (typeof fallback.phone === "string" && fallback.phone.trim()) {
|
|
1449
|
+
contact.phone = fallback.phone.trim();
|
|
1450
|
+
}
|
|
1451
|
+
if (fallback.address?.trim()) contact.address = fallback.address.trim();
|
|
1452
|
+
if (fallback.hours?.trim()) contact.hours = fallback.hours.trim();
|
|
1453
|
+
if (fallback.serviceArea?.trim()) contact.serviceArea = fallback.serviceArea.trim();
|
|
1454
|
+
if (fallback.googleMapsUrl?.trim()) {
|
|
1455
|
+
contact.googleMapsUrl = fallback.googleMapsUrl.trim();
|
|
1456
|
+
}
|
|
1457
|
+
if (fallback.linkedin?.trim()) contact.linkedinUrl = fallback.linkedin.trim();
|
|
1458
|
+
if (fallback.instagram?.trim()) contact.instagramUrl = fallback.instagram.trim();
|
|
1459
|
+
if (fallback.facebook?.trim()) contact.facebookUrl = fallback.facebook.trim();
|
|
1460
|
+
if (fallback.x?.trim()) contact.xUrl = fallback.x.trim();
|
|
1461
|
+
if (fallback.youtube?.trim()) contact.youtubeUrl = fallback.youtube.trim();
|
|
1462
|
+
const trust = {};
|
|
1463
|
+
if (fallback.googleMapsUrl?.trim()) {
|
|
1464
|
+
trust.googleReviewsUrl = fallback.googleMapsUrl.trim();
|
|
1465
|
+
}
|
|
1466
|
+
const hasContact = Object.keys(contact).length > 0;
|
|
1467
|
+
const hasTrust = Object.keys(trust).length > 0;
|
|
1468
|
+
if (!hasContact && !hasTrust) return null;
|
|
1469
|
+
return {
|
|
1470
|
+
...hasContact ? { contact } : {},
|
|
1471
|
+
...hasTrust ? { trust } : {}
|
|
1472
|
+
};
|
|
1326
1473
|
}
|
|
1327
1474
|
function resolveContentWrappersForReport(config) {
|
|
1328
1475
|
const explicit = config.contentWrappers ?? [];
|
|
@@ -1749,6 +1896,8 @@ function createJmpContentClientFromServerEnv(overrides) {
|
|
|
1749
1896
|
BOOKING_LINK_HOSTS,
|
|
1750
1897
|
DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS,
|
|
1751
1898
|
JMP_ANALYTICS_SDK_VERSION,
|
|
1899
|
+
JMP_CONTENT_CACHE_TAG,
|
|
1900
|
+
JMP_CONTENT_REVALIDATE_SECONDS,
|
|
1752
1901
|
JMP_TRACKING_CONSENT_STORAGE_KEY,
|
|
1753
1902
|
buildLandingCaptureInlineScript,
|
|
1754
1903
|
classifyContactHref,
|