@jmp-technologies/analytics 0.1.27 → 0.1.32
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/dist/astro/client.cjs +256 -11
- 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 +308 -13
- package/dist/astro/content.cjs.map +1 -1
- package/dist/astro/content.d.cts +12 -3
- package/dist/astro/content.d.ts +12 -3
- package/dist/astro/content.js +9 -3
- package/dist/astro/integration.cjs +228 -10
- package/dist/astro/integration.cjs.map +1 -1
- package/dist/astro/integration.js +3 -3
- package/dist/astro/middleware.cjs +2 -1
- 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 +228 -10
- package/dist/astro/register.cjs.map +1 -1
- package/dist/astro/register.js +3 -3
- package/dist/{chunk-KZ4WVDGL.js → chunk-7623G3XL.js} +3 -3
- package/dist/{chunk-A4RRTY5D.js → chunk-AIFJ7DVO.js} +3 -2
- package/dist/{chunk-A4RRTY5D.js.map → chunk-AIFJ7DVO.js.map} +1 -1
- package/dist/{chunk-YCVHRMM6.js → chunk-G5BMWPQ6.js} +2 -3
- package/dist/{chunk-YCVHRMM6.js.map → chunk-G5BMWPQ6.js.map} +1 -1
- package/dist/{chunk-HODG4NJQ.js → chunk-HFLU7HQE.js} +2 -2
- package/dist/{chunk-PG3IOI5O.js → chunk-HKMDWTA2.js} +53 -6
- package/dist/chunk-HKMDWTA2.js.map +1 -0
- package/dist/{chunk-DNYJF7BG.js → chunk-KPTMZQCY.js} +3 -3
- package/dist/{chunk-FNWE2DT5.js → chunk-NDSPSAWQ.js} +18 -8
- package/dist/chunk-NDSPSAWQ.js.map +1 -0
- package/dist/{chunk-UVYF33XE.js → chunk-NI7R6QZQ.js} +293 -13
- package/dist/chunk-NI7R6QZQ.js.map +1 -0
- package/dist/chunk-RI3KKDPX.js +75 -0
- package/dist/chunk-RI3KKDPX.js.map +1 -0
- package/dist/{create-jmp-analytics-D4Qw_d6o.d.cts → create-jmp-analytics-D1dUsqCQ.d.cts} +1 -2
- package/dist/{create-jmp-analytics-DpG5Hdl5.d.ts → create-jmp-analytics-htx2oOEf.d.ts} +1 -2
- package/dist/index.cjs +295 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +10 -2
- package/dist/next/content.cjs +310 -13
- package/dist/next/content.cjs.map +1 -1
- package/dist/next/content.d.cts +7 -5
- package/dist/next/content.d.ts +7 -5
- package/dist/next/content.js +11 -3
- package/dist/next/content.js.map +1 -1
- package/dist/next/instrumentation.cjs +228 -10
- package/dist/next/instrumentation.cjs.map +1 -1
- package/dist/next/instrumentation.js +2 -2
- package/dist/next/landing-capture-script-server.cjs +1 -2
- package/dist/next/landing-capture-script-server.cjs.map +1 -1
- package/dist/next/landing-capture-script-server.js +1 -1
- package/dist/next/landing-pages.cjs +228 -12
- package/dist/next/landing-pages.cjs.map +1 -1
- package/dist/next/landing-pages.d.cts +4 -16
- package/dist/next/landing-pages.d.ts +4 -16
- package/dist/next/landing-pages.js +13 -67
- package/dist/next/landing-pages.js.map +1 -1
- package/dist/next/locations.cjs +737 -0
- package/dist/next/locations.cjs.map +1 -0
- package/dist/next/locations.d.cts +55 -0
- package/dist/next/locations.d.ts +55 -0
- package/dist/next/locations.js +158 -0
- package/dist/next/locations.js.map +1 -0
- package/dist/next/middleware.cjs +2 -1
- 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 +259 -14
- package/dist/next/site-root-server.cjs.map +1 -1
- package/dist/next/site-root-server.js +5 -5
- package/dist/next.cjs +270 -17
- 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 +389 -136
- 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-UTzDG-UG.d.ts → site-config-B7USGGzu.d.cts} +22 -2
- package/dist/{site-config-CJqYnZm7.d.cts → site-config-C4bcUoLI.d.ts} +22 -2
- package/dist/{track-page-view-tX0Magkd.d.cts → track-page-view-C4TbbULE.d.cts} +1 -1
- package/dist/{track-page-view-CMAqyhD_.d.ts → track-page-view-RiB-xgIx.d.ts} +1 -1
- package/dist/{types-B-111Wht.d.ts → types-DRljY1Yy.d.cts} +92 -2
- package/dist/{types-B-111Wht.d.cts → types-DRljY1Yy.d.ts} +92 -2
- package/dist/utils-BajG58pj.d.cts +15 -0
- package/dist/utils-CHT3SQFv.d.ts +15 -0
- package/package.json +7 -2
- package/dist/chunk-FNWE2DT5.js.map +0 -1
- package/dist/chunk-PG3IOI5O.js.map +0 -1
- package/dist/chunk-UVYF33XE.js.map +0 -1
- /package/dist/{chunk-KZ4WVDGL.js.map → chunk-7623G3XL.js.map} +0 -0
- /package/dist/{chunk-HODG4NJQ.js.map → chunk-HFLU7HQE.js.map} +0 -0
- /package/dist/{chunk-DNYJF7BG.js.map → chunk-KPTMZQCY.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -39,6 +39,8 @@ __export(index_exports, {
|
|
|
39
39
|
getJmpLandingPageDetail: () => getJmpLandingPageDetail,
|
|
40
40
|
getJmpLandingPageSitemap: () => getJmpLandingPageSitemap,
|
|
41
41
|
getJmpLandingPages: () => getJmpLandingPages,
|
|
42
|
+
getJmpLocationDetail: () => getJmpLocationDetail,
|
|
43
|
+
getJmpLocations: () => getJmpLocations,
|
|
42
44
|
getJmpRobotsTxt: () => getJmpRobotsTxt,
|
|
43
45
|
getJmpServerContentConfigFromEnv: () => getJmpServerContentConfigFromEnv,
|
|
44
46
|
getJmpSiteDefinition: () => getJmpSiteDefinition,
|
|
@@ -50,10 +52,12 @@ __export(index_exports, {
|
|
|
50
52
|
isJmpServerContentEnvConfigured: () => isJmpServerContentEnvConfigured,
|
|
51
53
|
isJmpTrackingConsentGranted: () => isJmpTrackingConsentGranted,
|
|
52
54
|
markContentWrapper: () => markContentWrapper,
|
|
55
|
+
normalizeJmpContentManifest: () => normalizeJmpContentManifest,
|
|
53
56
|
readJmpPublicEnvFromProcess: () => readJmpPublicEnvFromProcess,
|
|
54
57
|
registerJmpContentWrappers: () => registerJmpContentWrappers,
|
|
55
58
|
resetContentWrapperDiscoveryForTests: () => resetContentWrapperDiscoveryForTests,
|
|
56
59
|
setJmpTrackingConsent: () => setJmpTrackingConsent,
|
|
60
|
+
stableJmpManifestFingerprint: () => stableJmpManifestFingerprint,
|
|
57
61
|
subscribeJmpTrackingConsent: () => subscribeJmpTrackingConsent,
|
|
58
62
|
trackJmpServerPageView: () => trackJmpServerPageView
|
|
59
63
|
});
|
|
@@ -319,6 +323,26 @@ function classifyContactHref(href) {
|
|
|
319
323
|
}
|
|
320
324
|
return null;
|
|
321
325
|
}
|
|
326
|
+
function extractTelTarget(href) {
|
|
327
|
+
const raw = href.trim();
|
|
328
|
+
if (!raw.toLowerCase().startsWith("tel:")) {
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
const target = decodeURIComponent(
|
|
332
|
+
raw.slice(4).split("?")[0]?.split(";")[0] ?? ""
|
|
333
|
+
).trim();
|
|
334
|
+
return target || null;
|
|
335
|
+
}
|
|
336
|
+
function extractMailtoTarget(href) {
|
|
337
|
+
const raw = href.trim();
|
|
338
|
+
if (!raw.toLowerCase().startsWith("mailto:")) {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
const target = decodeURIComponent(
|
|
342
|
+
raw.slice(7).split("?")[0]?.split(",")[0] ?? ""
|
|
343
|
+
).trim();
|
|
344
|
+
return target || null;
|
|
345
|
+
}
|
|
322
346
|
|
|
323
347
|
// src/constants.ts
|
|
324
348
|
var JMP_ANALYTICS_SDK_VERSION = "0.1.26";
|
|
@@ -766,14 +790,22 @@ function createJmpAnalytics(config) {
|
|
|
766
790
|
if (dedupeContactClick(`call_click:${path}`)) {
|
|
767
791
|
return;
|
|
768
792
|
}
|
|
769
|
-
|
|
793
|
+
const contactTarget = extractTelTarget(href);
|
|
794
|
+
void trackCallClick(
|
|
795
|
+
path,
|
|
796
|
+
contactTarget ? { contactTarget } : void 0
|
|
797
|
+
);
|
|
770
798
|
return;
|
|
771
799
|
}
|
|
772
800
|
if (classified.kind === "email") {
|
|
773
801
|
if (dedupeContactClick(`email_click:${path}`)) {
|
|
774
802
|
return;
|
|
775
803
|
}
|
|
776
|
-
|
|
804
|
+
const contactTarget = extractMailtoTarget(href);
|
|
805
|
+
void trackEmailClick(
|
|
806
|
+
path,
|
|
807
|
+
contactTarget ? { contactTarget } : void 0
|
|
808
|
+
);
|
|
777
809
|
return;
|
|
778
810
|
}
|
|
779
811
|
if (dedupeContactClick(`contact_click:${classified.channel}:${path}`)) {
|
|
@@ -862,6 +894,209 @@ async function trackJmpServerPageView(config, options = {}) {
|
|
|
862
894
|
}
|
|
863
895
|
}
|
|
864
896
|
|
|
897
|
+
// src/content/manifest.ts
|
|
898
|
+
var JMP_CONTENT_MANIFEST_VERSION = 1;
|
|
899
|
+
var TRUST_SECTIONS = /* @__PURE__ */ new Set([
|
|
900
|
+
"summary",
|
|
901
|
+
"testimonials",
|
|
902
|
+
"reviews",
|
|
903
|
+
"stats",
|
|
904
|
+
"logos",
|
|
905
|
+
"credentials"
|
|
906
|
+
]);
|
|
907
|
+
function normalizeKey(value) {
|
|
908
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
909
|
+
}
|
|
910
|
+
function isValidExtraKey(key) {
|
|
911
|
+
return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(key);
|
|
912
|
+
}
|
|
913
|
+
var MAX_EXTERNAL_ADMIN_LINKS = 10;
|
|
914
|
+
var MAX_EXTERNAL_ADMIN_LINK_LABEL_LENGTH = 80;
|
|
915
|
+
var EXTERNAL_ADMIN_LINK_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
916
|
+
function tryNormalizeHttpUrl(input) {
|
|
917
|
+
if (typeof input !== "string" || !input.trim()) {
|
|
918
|
+
return null;
|
|
919
|
+
}
|
|
920
|
+
try {
|
|
921
|
+
const url = new URL(input.trim());
|
|
922
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
923
|
+
return null;
|
|
924
|
+
}
|
|
925
|
+
return url.toString().replace(/\/$/, "");
|
|
926
|
+
} catch {
|
|
927
|
+
return null;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
function normalizeShopifyExternalSource(shopify) {
|
|
931
|
+
if (!shopify || typeof shopify !== "object") {
|
|
932
|
+
return null;
|
|
933
|
+
}
|
|
934
|
+
const adminUrl = tryNormalizeHttpUrl(shopify.adminUrl);
|
|
935
|
+
const storeUrl = tryNormalizeHttpUrl(shopify.storeUrl);
|
|
936
|
+
if (!adminUrl && !storeUrl) {
|
|
937
|
+
return null;
|
|
938
|
+
}
|
|
939
|
+
return {
|
|
940
|
+
...adminUrl ? { adminUrl } : {},
|
|
941
|
+
...storeUrl ? { storeUrl } : {}
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
function normalizeExternalAdminLinkEntries(links) {
|
|
945
|
+
if (!Array.isArray(links)) {
|
|
946
|
+
return [];
|
|
947
|
+
}
|
|
948
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
949
|
+
const out = [];
|
|
950
|
+
for (const raw of links) {
|
|
951
|
+
if (!raw || typeof raw !== "object" || out.length >= MAX_EXTERNAL_ADMIN_LINKS) {
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
const id = typeof raw.id === "string" ? raw.id.trim().toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "") : "";
|
|
955
|
+
const label = typeof raw.label === "string" ? raw.label.trim().slice(0, MAX_EXTERNAL_ADMIN_LINK_LABEL_LENGTH) : "";
|
|
956
|
+
const url = tryNormalizeHttpUrl(raw.url);
|
|
957
|
+
if (!id || !label || !url || !EXTERNAL_ADMIN_LINK_ID_PATTERN.test(id) || seenIds.has(id)) {
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
seenIds.add(id);
|
|
961
|
+
out.push({ id, label, url });
|
|
962
|
+
}
|
|
963
|
+
return out;
|
|
964
|
+
}
|
|
965
|
+
function normalizeExternalSources(externalSources) {
|
|
966
|
+
if (!externalSources || typeof externalSources !== "object") {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
const studioUrl = tryNormalizeHttpUrl(externalSources.sanity?.studioUrl);
|
|
970
|
+
const shopify = normalizeShopifyExternalSource(externalSources.shopify);
|
|
971
|
+
const links = normalizeExternalAdminLinkEntries(externalSources.links);
|
|
972
|
+
if (!studioUrl && !shopify && links.length === 0) {
|
|
973
|
+
return null;
|
|
974
|
+
}
|
|
975
|
+
return {
|
|
976
|
+
...studioUrl ? { sanity: { studioUrl } } : {},
|
|
977
|
+
...shopify ? { shopify } : {},
|
|
978
|
+
...links.length > 0 ? { links } : {}
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
function normalizeJmpContentManifest(input) {
|
|
982
|
+
if (!input || typeof input !== "object") {
|
|
983
|
+
return null;
|
|
984
|
+
}
|
|
985
|
+
const routes = normalizeRoutes(input.routes);
|
|
986
|
+
const externalSources = normalizeExternalSources(input.externalSources);
|
|
987
|
+
const trust = normalizeTrust(input.trust);
|
|
988
|
+
const contact = normalizeContact(input.contact);
|
|
989
|
+
if (routes.length === 0 && !externalSources && !trust && !contact) {
|
|
990
|
+
return null;
|
|
991
|
+
}
|
|
992
|
+
return {
|
|
993
|
+
version: JMP_CONTENT_MANIFEST_VERSION,
|
|
994
|
+
...routes.length > 0 ? { routes } : {},
|
|
995
|
+
...externalSources ? { externalSources } : {},
|
|
996
|
+
...trust ? { trust } : {},
|
|
997
|
+
...contact ? { contact } : {}
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
function normalizeRoutes(routes) {
|
|
1001
|
+
if (!Array.isArray(routes)) {
|
|
1002
|
+
return [];
|
|
1003
|
+
}
|
|
1004
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1005
|
+
const out = [];
|
|
1006
|
+
for (const raw of routes) {
|
|
1007
|
+
if (!raw || typeof raw !== "object") continue;
|
|
1008
|
+
const wrapper = typeof raw.wrapper === "string" ? raw.wrapper.trim().toLowerCase() : "";
|
|
1009
|
+
const pattern = typeof raw.pattern === "string" ? raw.pattern.trim() : "";
|
|
1010
|
+
if (!wrapper || !pattern) continue;
|
|
1011
|
+
const dedupe = `${wrapper}:${pattern}`;
|
|
1012
|
+
if (seen.has(dedupe)) continue;
|
|
1013
|
+
seen.add(dedupe);
|
|
1014
|
+
out.push({
|
|
1015
|
+
wrapper,
|
|
1016
|
+
pattern,
|
|
1017
|
+
...typeof raw.index === "string" && raw.index.trim() ? { index: raw.index.trim() } : {},
|
|
1018
|
+
...typeof raw.label === "string" && raw.label.trim() ? { label: raw.label.trim() } : {}
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
return out;
|
|
1022
|
+
}
|
|
1023
|
+
function normalizeTrust(trust) {
|
|
1024
|
+
if (!trust || typeof trust !== "object") return null;
|
|
1025
|
+
const blocks = normalizeTrustBlocks(trust.blocks);
|
|
1026
|
+
const labels = normalizeTrustLabels(trust.labels);
|
|
1027
|
+
const mergeTestimonialsReviews = trust.mergeTestimonialsReviews === true;
|
|
1028
|
+
if (blocks.length === 0 && !labels && !mergeTestimonialsReviews) return null;
|
|
1029
|
+
return {
|
|
1030
|
+
...blocks.length > 0 ? { blocks } : {},
|
|
1031
|
+
...labels ? { labels } : {},
|
|
1032
|
+
...mergeTestimonialsReviews ? { mergeTestimonialsReviews: true } : {}
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
function normalizeTrustBlocks(blocks) {
|
|
1036
|
+
if (!Array.isArray(blocks)) return [];
|
|
1037
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1038
|
+
const out = [];
|
|
1039
|
+
for (const raw of blocks) {
|
|
1040
|
+
if (!raw || typeof raw !== "object") continue;
|
|
1041
|
+
const section = typeof raw.section === "string" ? raw.section.trim().toLowerCase() : "";
|
|
1042
|
+
if (!TRUST_SECTIONS.has(section) || seen.has(section)) continue;
|
|
1043
|
+
seen.add(section);
|
|
1044
|
+
out.push({
|
|
1045
|
+
section,
|
|
1046
|
+
...typeof raw.label === "string" && raw.label.trim() ? { label: raw.label.trim() } : {}
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
return out;
|
|
1050
|
+
}
|
|
1051
|
+
function normalizeTrustLabels(labels) {
|
|
1052
|
+
if (!labels || typeof labels !== "object") return null;
|
|
1053
|
+
const out = {};
|
|
1054
|
+
for (const [key, value] of Object.entries(labels)) {
|
|
1055
|
+
if (TRUST_SECTIONS.has(key) && typeof value === "string" && value.trim()) {
|
|
1056
|
+
out[key] = value.trim();
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
1060
|
+
}
|
|
1061
|
+
function normalizeContact(contact) {
|
|
1062
|
+
if (!contact || typeof contact !== "object") return null;
|
|
1063
|
+
const extras = normalizeContactExtras(contact.extras);
|
|
1064
|
+
return extras.length > 0 ? { extras } : null;
|
|
1065
|
+
}
|
|
1066
|
+
function normalizeContactExtras(extras) {
|
|
1067
|
+
if (!Array.isArray(extras)) return [];
|
|
1068
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1069
|
+
const out = [];
|
|
1070
|
+
for (const raw of extras) {
|
|
1071
|
+
if (!raw || typeof raw !== "object") continue;
|
|
1072
|
+
const label = typeof raw.label === "string" ? raw.label.trim() : "";
|
|
1073
|
+
const key = normalizeKey(
|
|
1074
|
+
typeof raw.key === "string" && raw.key.trim() ? raw.key : label
|
|
1075
|
+
);
|
|
1076
|
+
if (!key || !label || !isValidExtraKey(key) || seen.has(key)) continue;
|
|
1077
|
+
seen.add(key);
|
|
1078
|
+
out.push({ key, label });
|
|
1079
|
+
}
|
|
1080
|
+
return out;
|
|
1081
|
+
}
|
|
1082
|
+
function stableJmpManifestFingerprint(manifest) {
|
|
1083
|
+
return manifest ? JSON.stringify(manifest) : "";
|
|
1084
|
+
}
|
|
1085
|
+
function inferWrapperSlotsFromManifest(manifest) {
|
|
1086
|
+
const slots = /* @__PURE__ */ new Set();
|
|
1087
|
+
for (const route of manifest?.routes ?? []) {
|
|
1088
|
+
slots.add(route.wrapper);
|
|
1089
|
+
}
|
|
1090
|
+
for (const block of manifest?.trust?.blocks ?? []) {
|
|
1091
|
+
slots.add(`trust.${block.section}`);
|
|
1092
|
+
slots.add("trust");
|
|
1093
|
+
}
|
|
1094
|
+
if (manifest?.contact?.extras?.length) {
|
|
1095
|
+
slots.add("contact");
|
|
1096
|
+
}
|
|
1097
|
+
return [...slots];
|
|
1098
|
+
}
|
|
1099
|
+
|
|
865
1100
|
// src/content/fetch.ts
|
|
866
1101
|
async function getContent(config, path) {
|
|
867
1102
|
const text = await getContentText(config, path);
|
|
@@ -976,16 +1211,22 @@ function inferTrustWrapperSlots(bundle) {
|
|
|
976
1211
|
function getDiscoveredContentWrappers() {
|
|
977
1212
|
return sortWrapperSlots([...discovered]);
|
|
978
1213
|
}
|
|
1214
|
+
function resolveContentManifestForReport(config) {
|
|
1215
|
+
return normalizeJmpContentManifest(config.contentManifest);
|
|
1216
|
+
}
|
|
979
1217
|
function resolveContentWrappersForReport(config) {
|
|
980
1218
|
const explicit = config.contentWrappers ?? [];
|
|
981
1219
|
const auto = getDiscoveredContentWrappers();
|
|
1220
|
+
const fromManifest = inferWrapperSlotsFromManifest(
|
|
1221
|
+
resolveContentManifestForReport(config)
|
|
1222
|
+
);
|
|
982
1223
|
if (config.contentWrapperMode === "manual") {
|
|
983
|
-
return sortWrapperSlots([...explicit]);
|
|
1224
|
+
return sortWrapperSlots([...explicit, ...fromManifest]);
|
|
984
1225
|
}
|
|
985
1226
|
if (config.contentWrapperMode === "explicit-only") {
|
|
986
|
-
return sortWrapperSlots([...explicit]);
|
|
1227
|
+
return sortWrapperSlots([...explicit, ...fromManifest]);
|
|
987
1228
|
}
|
|
988
|
-
const merged = /* @__PURE__ */ new Set([...explicit, ...auto]);
|
|
1229
|
+
const merged = /* @__PURE__ */ new Set([...explicit, ...auto, ...fromManifest]);
|
|
989
1230
|
return sortWrapperSlots([...merged]);
|
|
990
1231
|
}
|
|
991
1232
|
function hasReportedContentWrappers(dedupeKey) {
|
|
@@ -1123,6 +1364,35 @@ async function getJmpLandingPageSitemap(config) {
|
|
|
1123
1364
|
afterContentWrapperUse(config);
|
|
1124
1365
|
return data.entries;
|
|
1125
1366
|
}
|
|
1367
|
+
async function getJmpLocations(config) {
|
|
1368
|
+
const data = await getContent(
|
|
1369
|
+
config,
|
|
1370
|
+
"/api/content/locations"
|
|
1371
|
+
);
|
|
1372
|
+
markContentWrapper("locations");
|
|
1373
|
+
afterContentWrapperUse(config);
|
|
1374
|
+
return data.locations;
|
|
1375
|
+
}
|
|
1376
|
+
async function getJmpLocationDetail(config, slug) {
|
|
1377
|
+
const normalized = slug.trim();
|
|
1378
|
+
if (!normalized) {
|
|
1379
|
+
return null;
|
|
1380
|
+
}
|
|
1381
|
+
try {
|
|
1382
|
+
const detail = await getContent(
|
|
1383
|
+
config,
|
|
1384
|
+
`/api/content/locations/${encodeURIComponent(normalized)}`
|
|
1385
|
+
);
|
|
1386
|
+
markContentWrapper("locations");
|
|
1387
|
+
afterContentWrapperUse(config);
|
|
1388
|
+
return detail;
|
|
1389
|
+
} catch (error) {
|
|
1390
|
+
if (error instanceof Error && error.message.includes("HTTP 404")) {
|
|
1391
|
+
return null;
|
|
1392
|
+
}
|
|
1393
|
+
throw error;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1126
1396
|
async function getJmpTrustBundle(config) {
|
|
1127
1397
|
const bundle = await getContent(config, "/api/content/trust");
|
|
1128
1398
|
markTrustBundleWrappers(bundle);
|
|
@@ -1146,7 +1416,8 @@ async function registerJmpContentWrappers(config) {
|
|
|
1146
1416
|
if (!wrappers.length) {
|
|
1147
1417
|
return { ok: false, skipped: true };
|
|
1148
1418
|
}
|
|
1149
|
-
const
|
|
1419
|
+
const manifest = resolveContentManifestForReport(config);
|
|
1420
|
+
const dedupeKey = `${config.trackingKey}:${[...wrappers].sort().join(",")}:${stableJmpManifestFingerprint(manifest)}`;
|
|
1150
1421
|
if (hasReportedContentWrappers(dedupeKey)) {
|
|
1151
1422
|
return { ok: true, wrappers };
|
|
1152
1423
|
}
|
|
@@ -1159,7 +1430,17 @@ async function registerJmpContentWrappers(config) {
|
|
|
1159
1430
|
}
|
|
1160
1431
|
const url = `${baseUrl}/api/content/capabilities`;
|
|
1161
1432
|
if (config.debug) {
|
|
1162
|
-
console.debug("[@jmp-technologies/analytics]", "POST", url, {
|
|
1433
|
+
console.debug("[@jmp-technologies/analytics]", "POST", url, {
|
|
1434
|
+
wrappers,
|
|
1435
|
+
manifest
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
const body = {
|
|
1439
|
+
wrappers,
|
|
1440
|
+
sdkVersion: JMP_ANALYTICS_SDK_VERSION
|
|
1441
|
+
};
|
|
1442
|
+
if (manifest) {
|
|
1443
|
+
body.manifest = manifest;
|
|
1163
1444
|
}
|
|
1164
1445
|
const res = await resolvedFetch(url, {
|
|
1165
1446
|
method: "POST",
|
|
@@ -1167,10 +1448,7 @@ async function registerJmpContentWrappers(config) {
|
|
|
1167
1448
|
"Content-Type": "application/json",
|
|
1168
1449
|
"X-JMP-Tracking-Key": config.trackingKey
|
|
1169
1450
|
},
|
|
1170
|
-
body: JSON.stringify(
|
|
1171
|
-
wrappers,
|
|
1172
|
-
sdkVersion: JMP_ANALYTICS_SDK_VERSION
|
|
1173
|
-
})
|
|
1451
|
+
body: JSON.stringify(body)
|
|
1174
1452
|
});
|
|
1175
1453
|
const text = await res.text();
|
|
1176
1454
|
if (!res.ok) {
|
|
@@ -1269,7 +1547,8 @@ function getJmpContentConfig() {
|
|
|
1269
1547
|
return {
|
|
1270
1548
|
baseUrl: analyticsUrl,
|
|
1271
1549
|
trackingKey,
|
|
1272
|
-
contentWrappers: site?.contentWrappers ?? void 0
|
|
1550
|
+
contentWrappers: site?.contentWrappers ?? void 0,
|
|
1551
|
+
contentManifest: site?.contentManifest ?? void 0
|
|
1273
1552
|
};
|
|
1274
1553
|
}
|
|
1275
1554
|
|
|
@@ -1338,6 +1617,8 @@ function createJmpContentClientFromServerEnv(overrides) {
|
|
|
1338
1617
|
getJmpLandingPageDetail,
|
|
1339
1618
|
getJmpLandingPageSitemap,
|
|
1340
1619
|
getJmpLandingPages,
|
|
1620
|
+
getJmpLocationDetail,
|
|
1621
|
+
getJmpLocations,
|
|
1341
1622
|
getJmpRobotsTxt,
|
|
1342
1623
|
getJmpServerContentConfigFromEnv,
|
|
1343
1624
|
getJmpSiteDefinition,
|
|
@@ -1349,10 +1630,12 @@ function createJmpContentClientFromServerEnv(overrides) {
|
|
|
1349
1630
|
isJmpServerContentEnvConfigured,
|
|
1350
1631
|
isJmpTrackingConsentGranted,
|
|
1351
1632
|
markContentWrapper,
|
|
1633
|
+
normalizeJmpContentManifest,
|
|
1352
1634
|
readJmpPublicEnvFromProcess,
|
|
1353
1635
|
registerJmpContentWrappers,
|
|
1354
1636
|
resetContentWrapperDiscoveryForTests,
|
|
1355
1637
|
setJmpTrackingConsent,
|
|
1638
|
+
stableJmpManifestFingerprint,
|
|
1356
1639
|
subscribeJmpTrackingConsent,
|
|
1357
1640
|
trackJmpServerPageView
|
|
1358
1641
|
});
|