@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/astro/client.js
CHANGED
package/dist/astro/content.cjs
CHANGED
|
@@ -46,10 +46,12 @@ module.exports = __toCommonJS(content_exports);
|
|
|
46
46
|
var LANDING_REFERER_COOKIE_MAX_AGE_SEC = 30 * 60;
|
|
47
47
|
|
|
48
48
|
// package.json
|
|
49
|
-
var version = "0.1.
|
|
49
|
+
var version = "0.1.39";
|
|
50
50
|
|
|
51
51
|
// src/constants.ts
|
|
52
52
|
var JMP_ANALYTICS_SDK_VERSION = version;
|
|
53
|
+
var JMP_CONTENT_CACHE_TAG = "jmp-content";
|
|
54
|
+
var JMP_CONTENT_REVALIDATE_SECONDS = 3600;
|
|
53
55
|
|
|
54
56
|
// src/http.ts
|
|
55
57
|
function responseLooksLikeHtml(body) {
|
|
@@ -246,7 +248,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
246
248
|
const externalSources = normalizeExternalSources(input.externalSources);
|
|
247
249
|
const trust = normalizeTrust(input.trust);
|
|
248
250
|
const contact = normalizeContact(input.contact);
|
|
249
|
-
|
|
251
|
+
const defaults = normalizeManifestDefaults(input.defaults);
|
|
252
|
+
if (routes.length === 0 && !externalSources && !trust && !contact && !defaults) {
|
|
250
253
|
return null;
|
|
251
254
|
}
|
|
252
255
|
return {
|
|
@@ -254,7 +257,8 @@ function normalizeJmpContentManifest(input) {
|
|
|
254
257
|
...routes.length > 0 ? { routes } : {},
|
|
255
258
|
...externalSources ? { externalSources } : {},
|
|
256
259
|
...trust ? { trust } : {},
|
|
257
|
-
...contact ? { contact } : {}
|
|
260
|
+
...contact ? { contact } : {},
|
|
261
|
+
...defaults ? { defaults } : {}
|
|
258
262
|
};
|
|
259
263
|
}
|
|
260
264
|
function normalizeRoutes(routes) {
|
|
@@ -318,6 +322,85 @@ function normalizeTrustLabels(labels) {
|
|
|
318
322
|
}
|
|
319
323
|
return Object.keys(out).length > 0 ? out : null;
|
|
320
324
|
}
|
|
325
|
+
function readDefaultText(value, max = 500) {
|
|
326
|
+
if (typeof value !== "string") return void 0;
|
|
327
|
+
const trimmed = value.trim();
|
|
328
|
+
if (!trimmed) return void 0;
|
|
329
|
+
return trimmed.slice(0, max);
|
|
330
|
+
}
|
|
331
|
+
function normalizeManifestDefaults(defaults) {
|
|
332
|
+
if (!defaults || typeof defaults !== "object") return null;
|
|
333
|
+
const contactRaw = defaults.contact;
|
|
334
|
+
const contact = {};
|
|
335
|
+
if (contactRaw && typeof contactRaw === "object") {
|
|
336
|
+
const displayName = readDefaultText(contactRaw.displayName, 120);
|
|
337
|
+
const email = readDefaultText(contactRaw.email, 200);
|
|
338
|
+
const phone = readDefaultText(contactRaw.phone, 40);
|
|
339
|
+
const address = readDefaultText(contactRaw.address, 400);
|
|
340
|
+
const hours = readDefaultText(contactRaw.hours, 400);
|
|
341
|
+
const serviceArea = readDefaultText(contactRaw.serviceArea, 200);
|
|
342
|
+
const googleMapsUrl = readDefaultText(contactRaw.googleMapsUrl, 2048);
|
|
343
|
+
const linkedinUrl = readDefaultText(contactRaw.linkedinUrl, 2048);
|
|
344
|
+
const instagramUrl = readDefaultText(contactRaw.instagramUrl, 2048);
|
|
345
|
+
const facebookUrl = readDefaultText(contactRaw.facebookUrl, 2048);
|
|
346
|
+
const xUrl = readDefaultText(contactRaw.xUrl, 2048);
|
|
347
|
+
const youtubeUrl = readDefaultText(contactRaw.youtubeUrl, 2048);
|
|
348
|
+
if (displayName) contact.displayName = displayName;
|
|
349
|
+
if (email) contact.email = email;
|
|
350
|
+
if (phone) contact.phone = phone;
|
|
351
|
+
if (address) contact.address = address;
|
|
352
|
+
if (hours) contact.hours = hours;
|
|
353
|
+
if (serviceArea) contact.serviceArea = serviceArea;
|
|
354
|
+
if (googleMapsUrl) contact.googleMapsUrl = googleMapsUrl;
|
|
355
|
+
if (linkedinUrl) contact.linkedinUrl = linkedinUrl;
|
|
356
|
+
if (instagramUrl) contact.instagramUrl = instagramUrl;
|
|
357
|
+
if (facebookUrl) contact.facebookUrl = facebookUrl;
|
|
358
|
+
if (xUrl) contact.xUrl = xUrl;
|
|
359
|
+
if (youtubeUrl) contact.youtubeUrl = youtubeUrl;
|
|
360
|
+
if (contactRaw.extras && typeof contactRaw.extras === "object") {
|
|
361
|
+
const extras = {};
|
|
362
|
+
for (const [rawKey, rawValue] of Object.entries(contactRaw.extras)) {
|
|
363
|
+
if (Object.keys(extras).length >= 10) break;
|
|
364
|
+
const key = normalizeKey(rawKey);
|
|
365
|
+
const value = readDefaultText(rawValue, 200);
|
|
366
|
+
if (key && isValidExtraKey(key) && value) extras[key] = value;
|
|
367
|
+
}
|
|
368
|
+
if (Object.keys(extras).length > 0) contact.extras = extras;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const faq = [];
|
|
372
|
+
if (Array.isArray(defaults.faq)) {
|
|
373
|
+
for (const raw of defaults.faq) {
|
|
374
|
+
if (!raw || typeof raw !== "object" || faq.length >= 40) continue;
|
|
375
|
+
const question = readDefaultText(raw.question, 300);
|
|
376
|
+
const answer = readDefaultText(raw.answer, 8e3);
|
|
377
|
+
if (!question || !answer) continue;
|
|
378
|
+
const category = readDefaultText(raw.category, 80);
|
|
379
|
+
faq.push({ question, answer, ...category ? { category } : {} });
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const trustRaw = defaults.trust;
|
|
383
|
+
const trust = {};
|
|
384
|
+
if (trustRaw && typeof trustRaw === "object") {
|
|
385
|
+
const assign = (key, max) => {
|
|
386
|
+
const value = readDefaultText(trustRaw[key], max);
|
|
387
|
+
if (value) trust[key] = value;
|
|
388
|
+
};
|
|
389
|
+
assign("googleReviewsUrl", 2048);
|
|
390
|
+
assign("googlePlaceId", 128);
|
|
391
|
+
assign("yelpUrl", 2048);
|
|
392
|
+
assign("trustpilotUrl", 2048);
|
|
393
|
+
assign("disclaimer", 1e3);
|
|
394
|
+
}
|
|
395
|
+
const hasContact = Object.keys(contact).length > 0;
|
|
396
|
+
const hasTrust = Object.keys(trust).length > 0;
|
|
397
|
+
if (!hasContact && faq.length === 0 && !hasTrust) return null;
|
|
398
|
+
return {
|
|
399
|
+
...hasContact ? { contact } : {},
|
|
400
|
+
...faq.length > 0 ? { faq } : {},
|
|
401
|
+
...hasTrust ? { trust } : {}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
321
404
|
function normalizeContact(contact) {
|
|
322
405
|
if (!contact || typeof contact !== "object") return null;
|
|
323
406
|
const extras = normalizeContactExtras(contact.extras);
|
|
@@ -385,7 +468,11 @@ async function getContentText(config, path) {
|
|
|
385
468
|
}
|
|
386
469
|
const res = await resolvedFetch(url, {
|
|
387
470
|
method: "GET",
|
|
388
|
-
headers: jmpContentRequestHeaders(config)
|
|
471
|
+
headers: jmpContentRequestHeaders(config),
|
|
472
|
+
next: {
|
|
473
|
+
revalidate: JMP_CONTENT_REVALIDATE_SECONDS,
|
|
474
|
+
tags: [JMP_CONTENT_CACHE_TAG]
|
|
475
|
+
}
|
|
389
476
|
});
|
|
390
477
|
const text = await res.text();
|
|
391
478
|
if (!res.ok) {
|
|
@@ -476,7 +563,65 @@ function getDiscoveredContentWrappers() {
|
|
|
476
563
|
return sortWrapperSlots([...discovered]);
|
|
477
564
|
}
|
|
478
565
|
function resolveContentManifestForReport(config) {
|
|
479
|
-
|
|
566
|
+
const site = getJmpSiteDefinition();
|
|
567
|
+
const fallback = site?.contactFallback;
|
|
568
|
+
const existing = config.contentManifest;
|
|
569
|
+
const fromFallback = fallbackToManifestDefaults(fallback);
|
|
570
|
+
if (!existing && !fromFallback) {
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
const merged = {
|
|
574
|
+
...existing ?? {},
|
|
575
|
+
defaults: {
|
|
576
|
+
...fromFallback ?? {},
|
|
577
|
+
...existing?.defaults ?? {},
|
|
578
|
+
contact: {
|
|
579
|
+
...fromFallback?.contact ?? {},
|
|
580
|
+
...existing?.defaults?.contact ?? {},
|
|
581
|
+
extras: {
|
|
582
|
+
...fromFallback?.contact?.extras ?? {},
|
|
583
|
+
...existing?.defaults?.contact?.extras ?? {}
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
trust: {
|
|
587
|
+
...fromFallback?.trust ?? {},
|
|
588
|
+
...existing?.defaults?.trust ?? {}
|
|
589
|
+
},
|
|
590
|
+
faq: existing?.defaults?.faq?.length ? existing.defaults.faq : fromFallback?.faq
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
return normalizeJmpContentManifest(merged);
|
|
594
|
+
}
|
|
595
|
+
function fallbackToManifestDefaults(fallback) {
|
|
596
|
+
if (!fallback) return null;
|
|
597
|
+
const contact = {};
|
|
598
|
+
if (fallback.displayName?.trim()) contact.displayName = fallback.displayName.trim();
|
|
599
|
+
if (fallback.email?.trim()) contact.email = fallback.email.trim();
|
|
600
|
+
if (typeof fallback.phone === "string" && fallback.phone.trim()) {
|
|
601
|
+
contact.phone = fallback.phone.trim();
|
|
602
|
+
}
|
|
603
|
+
if (fallback.address?.trim()) contact.address = fallback.address.trim();
|
|
604
|
+
if (fallback.hours?.trim()) contact.hours = fallback.hours.trim();
|
|
605
|
+
if (fallback.serviceArea?.trim()) contact.serviceArea = fallback.serviceArea.trim();
|
|
606
|
+
if (fallback.googleMapsUrl?.trim()) {
|
|
607
|
+
contact.googleMapsUrl = fallback.googleMapsUrl.trim();
|
|
608
|
+
}
|
|
609
|
+
if (fallback.linkedin?.trim()) contact.linkedinUrl = fallback.linkedin.trim();
|
|
610
|
+
if (fallback.instagram?.trim()) contact.instagramUrl = fallback.instagram.trim();
|
|
611
|
+
if (fallback.facebook?.trim()) contact.facebookUrl = fallback.facebook.trim();
|
|
612
|
+
if (fallback.x?.trim()) contact.xUrl = fallback.x.trim();
|
|
613
|
+
if (fallback.youtube?.trim()) contact.youtubeUrl = fallback.youtube.trim();
|
|
614
|
+
const trust = {};
|
|
615
|
+
if (fallback.googleMapsUrl?.trim()) {
|
|
616
|
+
trust.googleReviewsUrl = fallback.googleMapsUrl.trim();
|
|
617
|
+
}
|
|
618
|
+
const hasContact = Object.keys(contact).length > 0;
|
|
619
|
+
const hasTrust = Object.keys(trust).length > 0;
|
|
620
|
+
if (!hasContact && !hasTrust) return null;
|
|
621
|
+
return {
|
|
622
|
+
...hasContact ? { contact } : {},
|
|
623
|
+
...hasTrust ? { trust } : {}
|
|
624
|
+
};
|
|
480
625
|
}
|
|
481
626
|
function resolveContentWrappersForReport(config) {
|
|
482
627
|
const explicit = config.contentWrappers ?? [];
|