@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
package/dist/next/locations.cjs
CHANGED
|
@@ -47,10 +47,12 @@ var import_navigation = require("next/navigation");
|
|
|
47
47
|
var LANDING_REFERER_COOKIE_MAX_AGE_SEC = 30 * 60;
|
|
48
48
|
|
|
49
49
|
// package.json
|
|
50
|
-
var version = "0.1.
|
|
50
|
+
var version = "0.1.39";
|
|
51
51
|
|
|
52
52
|
// src/constants.ts
|
|
53
53
|
var JMP_ANALYTICS_SDK_VERSION = version;
|
|
54
|
+
var JMP_CONTENT_CACHE_TAG = "jmp-content";
|
|
55
|
+
var JMP_CONTENT_REVALIDATE_SECONDS = 3600;
|
|
54
56
|
|
|
55
57
|
// src/http.ts
|
|
56
58
|
function responseLooksLikeHtml(body) {
|
|
@@ -117,11 +119,14 @@ function getJmpContentConfig() {
|
|
|
117
119
|
return null;
|
|
118
120
|
}
|
|
119
121
|
const site = getJmpSiteDefinition();
|
|
122
|
+
const contentWrappers = site?.contentWrappers ?? void 0;
|
|
123
|
+
const inferredMode = contentWrappers && contentWrappers.length > 0 ? "manual" : void 0;
|
|
120
124
|
return {
|
|
121
125
|
baseUrl: analyticsUrl,
|
|
122
126
|
trackingKey,
|
|
123
|
-
contentWrappers
|
|
124
|
-
contentManifest: site?.contentManifest ?? void 0
|
|
127
|
+
contentWrappers,
|
|
128
|
+
contentManifest: site?.contentManifest ?? void 0,
|
|
129
|
+
contentWrapperMode: site?.contentWrapperMode ?? inferredMode
|
|
125
130
|
};
|
|
126
131
|
}
|
|
127
132
|
|
|
@@ -255,7 +260,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
255
260
|
const externalSources = normalizeExternalSources(input.externalSources);
|
|
256
261
|
const trust = normalizeTrust(input.trust);
|
|
257
262
|
const contact = normalizeContact(input.contact);
|
|
258
|
-
|
|
263
|
+
const defaults = normalizeManifestDefaults(input.defaults);
|
|
264
|
+
if (routes.length === 0 && !externalSources && !trust && !contact && !defaults) {
|
|
259
265
|
return null;
|
|
260
266
|
}
|
|
261
267
|
return {
|
|
@@ -263,7 +269,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
263
269
|
...routes.length > 0 ? { routes } : {},
|
|
264
270
|
...externalSources ? { externalSources } : {},
|
|
265
271
|
...trust ? { trust } : {},
|
|
266
|
-
...contact ? { contact } : {}
|
|
272
|
+
...contact ? { contact } : {},
|
|
273
|
+
...defaults ? { defaults } : {}
|
|
267
274
|
};
|
|
268
275
|
}
|
|
269
276
|
function normalizeRoutes(routes) {
|
|
@@ -327,6 +334,85 @@ function normalizeTrustLabels(labels) {
|
|
|
327
334
|
}
|
|
328
335
|
return Object.keys(out).length > 0 ? out : null;
|
|
329
336
|
}
|
|
337
|
+
function readDefaultText(value, max = 500) {
|
|
338
|
+
if (typeof value !== "string") return void 0;
|
|
339
|
+
const trimmed = value.trim();
|
|
340
|
+
if (!trimmed) return void 0;
|
|
341
|
+
return trimmed.slice(0, max);
|
|
342
|
+
}
|
|
343
|
+
function normalizeManifestDefaults(defaults) {
|
|
344
|
+
if (!defaults || typeof defaults !== "object") return null;
|
|
345
|
+
const contactRaw = defaults.contact;
|
|
346
|
+
const contact = {};
|
|
347
|
+
if (contactRaw && typeof contactRaw === "object") {
|
|
348
|
+
const displayName = readDefaultText(contactRaw.displayName, 120);
|
|
349
|
+
const email = readDefaultText(contactRaw.email, 200);
|
|
350
|
+
const phone = readDefaultText(contactRaw.phone, 40);
|
|
351
|
+
const address = readDefaultText(contactRaw.address, 400);
|
|
352
|
+
const hours = readDefaultText(contactRaw.hours, 400);
|
|
353
|
+
const serviceArea = readDefaultText(contactRaw.serviceArea, 200);
|
|
354
|
+
const googleMapsUrl = readDefaultText(contactRaw.googleMapsUrl, 2048);
|
|
355
|
+
const linkedinUrl = readDefaultText(contactRaw.linkedinUrl, 2048);
|
|
356
|
+
const instagramUrl = readDefaultText(contactRaw.instagramUrl, 2048);
|
|
357
|
+
const facebookUrl = readDefaultText(contactRaw.facebookUrl, 2048);
|
|
358
|
+
const xUrl = readDefaultText(contactRaw.xUrl, 2048);
|
|
359
|
+
const youtubeUrl = readDefaultText(contactRaw.youtubeUrl, 2048);
|
|
360
|
+
if (displayName) contact.displayName = displayName;
|
|
361
|
+
if (email) contact.email = email;
|
|
362
|
+
if (phone) contact.phone = phone;
|
|
363
|
+
if (address) contact.address = address;
|
|
364
|
+
if (hours) contact.hours = hours;
|
|
365
|
+
if (serviceArea) contact.serviceArea = serviceArea;
|
|
366
|
+
if (googleMapsUrl) contact.googleMapsUrl = googleMapsUrl;
|
|
367
|
+
if (linkedinUrl) contact.linkedinUrl = linkedinUrl;
|
|
368
|
+
if (instagramUrl) contact.instagramUrl = instagramUrl;
|
|
369
|
+
if (facebookUrl) contact.facebookUrl = facebookUrl;
|
|
370
|
+
if (xUrl) contact.xUrl = xUrl;
|
|
371
|
+
if (youtubeUrl) contact.youtubeUrl = youtubeUrl;
|
|
372
|
+
if (contactRaw.extras && typeof contactRaw.extras === "object") {
|
|
373
|
+
const extras = {};
|
|
374
|
+
for (const [rawKey, rawValue] of Object.entries(contactRaw.extras)) {
|
|
375
|
+
if (Object.keys(extras).length >= 10) break;
|
|
376
|
+
const key = normalizeKey(rawKey);
|
|
377
|
+
const value = readDefaultText(rawValue, 200);
|
|
378
|
+
if (key && isValidExtraKey(key) && value) extras[key] = value;
|
|
379
|
+
}
|
|
380
|
+
if (Object.keys(extras).length > 0) contact.extras = extras;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const faq = [];
|
|
384
|
+
if (Array.isArray(defaults.faq)) {
|
|
385
|
+
for (const raw of defaults.faq) {
|
|
386
|
+
if (!raw || typeof raw !== "object" || faq.length >= 40) continue;
|
|
387
|
+
const question = readDefaultText(raw.question, 300);
|
|
388
|
+
const answer = readDefaultText(raw.answer, 8e3);
|
|
389
|
+
if (!question || !answer) continue;
|
|
390
|
+
const category = readDefaultText(raw.category, 80);
|
|
391
|
+
faq.push({ question, answer, ...category ? { category } : {} });
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const trustRaw = defaults.trust;
|
|
395
|
+
const trust = {};
|
|
396
|
+
if (trustRaw && typeof trustRaw === "object") {
|
|
397
|
+
const assign = (key, max) => {
|
|
398
|
+
const value = readDefaultText(trustRaw[key], max);
|
|
399
|
+
if (value) trust[key] = value;
|
|
400
|
+
};
|
|
401
|
+
assign("googleReviewsUrl", 2048);
|
|
402
|
+
assign("googlePlaceId", 128);
|
|
403
|
+
assign("yelpUrl", 2048);
|
|
404
|
+
assign("trustpilotUrl", 2048);
|
|
405
|
+
assign("disclaimer", 1e3);
|
|
406
|
+
}
|
|
407
|
+
const hasContact = Object.keys(contact).length > 0;
|
|
408
|
+
const hasTrust = Object.keys(trust).length > 0;
|
|
409
|
+
if (!hasContact && faq.length === 0 && !hasTrust) return null;
|
|
410
|
+
return {
|
|
411
|
+
...hasContact ? { contact } : {},
|
|
412
|
+
...faq.length > 0 ? { faq } : {},
|
|
413
|
+
...hasTrust ? { trust } : {}
|
|
414
|
+
};
|
|
415
|
+
}
|
|
330
416
|
function normalizeContact(contact) {
|
|
331
417
|
if (!contact || typeof contact !== "object") return null;
|
|
332
418
|
const extras = normalizeContactExtras(contact.extras);
|
|
@@ -394,7 +480,11 @@ async function getContentText(config, path) {
|
|
|
394
480
|
}
|
|
395
481
|
const res = await resolvedFetch(url, {
|
|
396
482
|
method: "GET",
|
|
397
|
-
headers: jmpContentRequestHeaders(config)
|
|
483
|
+
headers: jmpContentRequestHeaders(config),
|
|
484
|
+
next: {
|
|
485
|
+
revalidate: JMP_CONTENT_REVALIDATE_SECONDS,
|
|
486
|
+
tags: [JMP_CONTENT_CACHE_TAG]
|
|
487
|
+
}
|
|
398
488
|
});
|
|
399
489
|
const text = await res.text();
|
|
400
490
|
if (!res.ok) {
|
|
@@ -421,6 +511,7 @@ var WRAPPER_SLOT_ORDER = [
|
|
|
421
511
|
"blog",
|
|
422
512
|
"faq",
|
|
423
513
|
"contact",
|
|
514
|
+
"legal",
|
|
424
515
|
"trust",
|
|
425
516
|
"trust.summary",
|
|
426
517
|
"trust.testimonials",
|
|
@@ -445,7 +536,65 @@ function getDiscoveredContentWrappers() {
|
|
|
445
536
|
return sortWrapperSlots([...discovered]);
|
|
446
537
|
}
|
|
447
538
|
function resolveContentManifestForReport(config) {
|
|
448
|
-
|
|
539
|
+
const site = getJmpSiteDefinition();
|
|
540
|
+
const fallback = site?.contactFallback;
|
|
541
|
+
const existing = config.contentManifest;
|
|
542
|
+
const fromFallback = fallbackToManifestDefaults(fallback);
|
|
543
|
+
if (!existing && !fromFallback) {
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
const merged = {
|
|
547
|
+
...existing ?? {},
|
|
548
|
+
defaults: {
|
|
549
|
+
...fromFallback ?? {},
|
|
550
|
+
...existing?.defaults ?? {},
|
|
551
|
+
contact: {
|
|
552
|
+
...fromFallback?.contact ?? {},
|
|
553
|
+
...existing?.defaults?.contact ?? {},
|
|
554
|
+
extras: {
|
|
555
|
+
...fromFallback?.contact?.extras ?? {},
|
|
556
|
+
...existing?.defaults?.contact?.extras ?? {}
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
trust: {
|
|
560
|
+
...fromFallback?.trust ?? {},
|
|
561
|
+
...existing?.defaults?.trust ?? {}
|
|
562
|
+
},
|
|
563
|
+
faq: existing?.defaults?.faq?.length ? existing.defaults.faq : fromFallback?.faq
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
return normalizeJmpContentManifest(merged);
|
|
567
|
+
}
|
|
568
|
+
function fallbackToManifestDefaults(fallback) {
|
|
569
|
+
if (!fallback) return null;
|
|
570
|
+
const contact = {};
|
|
571
|
+
if (fallback.displayName?.trim()) contact.displayName = fallback.displayName.trim();
|
|
572
|
+
if (fallback.email?.trim()) contact.email = fallback.email.trim();
|
|
573
|
+
if (typeof fallback.phone === "string" && fallback.phone.trim()) {
|
|
574
|
+
contact.phone = fallback.phone.trim();
|
|
575
|
+
}
|
|
576
|
+
if (fallback.address?.trim()) contact.address = fallback.address.trim();
|
|
577
|
+
if (fallback.hours?.trim()) contact.hours = fallback.hours.trim();
|
|
578
|
+
if (fallback.serviceArea?.trim()) contact.serviceArea = fallback.serviceArea.trim();
|
|
579
|
+
if (fallback.googleMapsUrl?.trim()) {
|
|
580
|
+
contact.googleMapsUrl = fallback.googleMapsUrl.trim();
|
|
581
|
+
}
|
|
582
|
+
if (fallback.linkedin?.trim()) contact.linkedinUrl = fallback.linkedin.trim();
|
|
583
|
+
if (fallback.instagram?.trim()) contact.instagramUrl = fallback.instagram.trim();
|
|
584
|
+
if (fallback.facebook?.trim()) contact.facebookUrl = fallback.facebook.trim();
|
|
585
|
+
if (fallback.x?.trim()) contact.xUrl = fallback.x.trim();
|
|
586
|
+
if (fallback.youtube?.trim()) contact.youtubeUrl = fallback.youtube.trim();
|
|
587
|
+
const trust = {};
|
|
588
|
+
if (fallback.googleMapsUrl?.trim()) {
|
|
589
|
+
trust.googleReviewsUrl = fallback.googleMapsUrl.trim();
|
|
590
|
+
}
|
|
591
|
+
const hasContact = Object.keys(contact).length > 0;
|
|
592
|
+
const hasTrust = Object.keys(trust).length > 0;
|
|
593
|
+
if (!hasContact && !hasTrust) return null;
|
|
594
|
+
return {
|
|
595
|
+
...hasContact ? { contact } : {},
|
|
596
|
+
...hasTrust ? { trust } : {}
|
|
597
|
+
};
|
|
449
598
|
}
|
|
450
599
|
function resolveContentWrappersForReport(config) {
|
|
451
600
|
const explicit = config.contentWrappers ?? [];
|