@jmp-technologies/analytics 0.1.26 → 0.1.30
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 +43 -0
- package/bin/jmp-init.mjs +34 -0
- package/dist/astro/client.cjs +227 -10
- 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 +340 -14
- package/dist/astro/content.cjs.map +1 -1
- package/dist/astro/content.d.cts +16 -3
- package/dist/astro/content.d.ts +16 -3
- package/dist/astro/content.js +11 -3
- package/dist/astro/integration.cjs +229 -11
- 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 +229 -11
- package/dist/astro/register.cjs.map +1 -1
- package/dist/astro/register.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-TFHOTBOL.js → chunk-FS4BZ7DR.js} +66 -6
- package/dist/chunk-FS4BZ7DR.js.map +1 -0
- package/dist/{chunk-RCOHQAGL.js → chunk-GTPKRBFR.js} +284 -12
- package/dist/chunk-GTPKRBFR.js.map +1 -0
- package/dist/{chunk-HODG4NJQ.js → chunk-HFLU7HQE.js} +2 -2
- package/dist/{chunk-WFTTIRDJ.js → chunk-LLTB7ZFC.js} +2 -2
- package/dist/{chunk-PKGUBYZR.js → chunk-LTPLLPOR.js} +3 -3
- package/dist/{chunk-XQZOGWF2.js → chunk-ZEC22LFP.js} +3 -3
- package/dist/{create-jmp-analytics-JKAsJAWb.d.ts → create-jmp-analytics-BeuuU6as.d.ts} +1 -1
- package/dist/{create-jmp-analytics-Mau-oxji.d.cts → create-jmp-analytics-Ce2CrhhR.d.cts} +1 -1
- package/dist/index.cjs +289 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -7
- package/dist/index.d.ts +16 -7
- package/dist/index.js +12 -2
- package/dist/next/content.cjs +343 -14
- package/dist/next/content.cjs.map +1 -1
- package/dist/next/content.d.cts +8 -5
- package/dist/next/content.d.ts +8 -5
- package/dist/next/content.js +14 -3
- package/dist/next/content.js.map +1 -1
- package/dist/next/instrumentation.cjs +229 -11
- package/dist/next/instrumentation.cjs.map +1 -1
- package/dist/next/instrumentation.js +2 -2
- package/dist/next/landing-pages.cjs +875 -0
- package/dist/next/landing-pages.cjs.map +1 -0
- package/dist/next/landing-pages.d.cts +103 -0
- package/dist/next/landing-pages.d.ts +103 -0
- package/dist/next/landing-pages.js +297 -0
- package/dist/next/landing-pages.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 +229 -11
- package/dist/next/site-root-server.cjs.map +1 -1
- package/dist/next/site-root-server.js +4 -4
- package/dist/next.cjs +227 -10
- 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 +227 -10
- 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-CXUdGLqw.d.cts → site-config-B4uEj4xX.d.ts} +22 -2
- package/dist/{site-config-w_Db9YSk.d.ts → site-config-DIFmnwqv.d.cts} +22 -2
- package/dist/{track-page-view-CkuSYuco.d.cts → track-page-view-Bv0BAvxG.d.cts} +1 -1
- package/dist/{track-page-view-QRSk8vap.d.ts → track-page-view-CkgIp9-j.d.ts} +1 -1
- package/dist/{types-C1eq8E5u.d.ts → types-B2iP79lb.d.cts} +99 -2
- package/dist/{types-C1eq8E5u.d.cts → types-B2iP79lb.d.ts} +99 -2
- package/package.json +11 -2
- package/dist/chunk-RCOHQAGL.js.map +0 -1
- package/dist/chunk-TFHOTBOL.js.map +0 -1
- /package/dist/{chunk-HODG4NJQ.js.map → chunk-HFLU7HQE.js.map} +0 -0
- /package/dist/{chunk-WFTTIRDJ.js.map → chunk-LLTB7ZFC.js.map} +0 -0
- /package/dist/{chunk-PKGUBYZR.js.map → chunk-LTPLLPOR.js.map} +0 -0
- /package/dist/{chunk-XQZOGWF2.js.map → chunk-ZEC22LFP.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,9 @@ __export(index_exports, {
|
|
|
36
36
|
getJmpBrowserAnalyticsConfigFromEnv: () => getJmpBrowserAnalyticsConfigFromEnv,
|
|
37
37
|
getJmpContentConfig: () => getJmpContentConfig,
|
|
38
38
|
getJmpFaqs: () => getJmpFaqs,
|
|
39
|
+
getJmpLandingPageDetail: () => getJmpLandingPageDetail,
|
|
40
|
+
getJmpLandingPageSitemap: () => getJmpLandingPageSitemap,
|
|
41
|
+
getJmpLandingPages: () => getJmpLandingPages,
|
|
39
42
|
getJmpRobotsTxt: () => getJmpRobotsTxt,
|
|
40
43
|
getJmpServerContentConfigFromEnv: () => getJmpServerContentConfigFromEnv,
|
|
41
44
|
getJmpSiteDefinition: () => getJmpSiteDefinition,
|
|
@@ -47,10 +50,12 @@ __export(index_exports, {
|
|
|
47
50
|
isJmpServerContentEnvConfigured: () => isJmpServerContentEnvConfigured,
|
|
48
51
|
isJmpTrackingConsentGranted: () => isJmpTrackingConsentGranted,
|
|
49
52
|
markContentWrapper: () => markContentWrapper,
|
|
53
|
+
normalizeJmpContentManifest: () => normalizeJmpContentManifest,
|
|
50
54
|
readJmpPublicEnvFromProcess: () => readJmpPublicEnvFromProcess,
|
|
51
55
|
registerJmpContentWrappers: () => registerJmpContentWrappers,
|
|
52
56
|
resetContentWrapperDiscoveryForTests: () => resetContentWrapperDiscoveryForTests,
|
|
53
57
|
setJmpTrackingConsent: () => setJmpTrackingConsent,
|
|
58
|
+
stableJmpManifestFingerprint: () => stableJmpManifestFingerprint,
|
|
54
59
|
subscribeJmpTrackingConsent: () => subscribeJmpTrackingConsent,
|
|
55
60
|
trackJmpServerPageView: () => trackJmpServerPageView
|
|
56
61
|
});
|
|
@@ -318,7 +323,7 @@ function classifyContactHref(href) {
|
|
|
318
323
|
}
|
|
319
324
|
|
|
320
325
|
// src/constants.ts
|
|
321
|
-
var JMP_ANALYTICS_SDK_VERSION = "0.1.
|
|
326
|
+
var JMP_ANALYTICS_SDK_VERSION = "0.1.26";
|
|
322
327
|
var JMP_TRACKING_CONSENT_STORAGE_KEY = "jmp_analytics_consent_v1";
|
|
323
328
|
var DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS = 2500;
|
|
324
329
|
|
|
@@ -859,6 +864,209 @@ async function trackJmpServerPageView(config, options = {}) {
|
|
|
859
864
|
}
|
|
860
865
|
}
|
|
861
866
|
|
|
867
|
+
// src/content/manifest.ts
|
|
868
|
+
var JMP_CONTENT_MANIFEST_VERSION = 1;
|
|
869
|
+
var TRUST_SECTIONS = /* @__PURE__ */ new Set([
|
|
870
|
+
"summary",
|
|
871
|
+
"testimonials",
|
|
872
|
+
"reviews",
|
|
873
|
+
"stats",
|
|
874
|
+
"logos",
|
|
875
|
+
"credentials"
|
|
876
|
+
]);
|
|
877
|
+
function normalizeKey(value) {
|
|
878
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
879
|
+
}
|
|
880
|
+
function isValidExtraKey(key) {
|
|
881
|
+
return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(key);
|
|
882
|
+
}
|
|
883
|
+
var MAX_EXTERNAL_ADMIN_LINKS = 10;
|
|
884
|
+
var MAX_EXTERNAL_ADMIN_LINK_LABEL_LENGTH = 80;
|
|
885
|
+
var EXTERNAL_ADMIN_LINK_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
886
|
+
function tryNormalizeHttpUrl(input) {
|
|
887
|
+
if (typeof input !== "string" || !input.trim()) {
|
|
888
|
+
return null;
|
|
889
|
+
}
|
|
890
|
+
try {
|
|
891
|
+
const url = new URL(input.trim());
|
|
892
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
893
|
+
return null;
|
|
894
|
+
}
|
|
895
|
+
return url.toString().replace(/\/$/, "");
|
|
896
|
+
} catch {
|
|
897
|
+
return null;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
function normalizeShopifyExternalSource(shopify) {
|
|
901
|
+
if (!shopify || typeof shopify !== "object") {
|
|
902
|
+
return null;
|
|
903
|
+
}
|
|
904
|
+
const adminUrl = tryNormalizeHttpUrl(shopify.adminUrl);
|
|
905
|
+
const storeUrl = tryNormalizeHttpUrl(shopify.storeUrl);
|
|
906
|
+
if (!adminUrl && !storeUrl) {
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
return {
|
|
910
|
+
...adminUrl ? { adminUrl } : {},
|
|
911
|
+
...storeUrl ? { storeUrl } : {}
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
function normalizeExternalAdminLinkEntries(links) {
|
|
915
|
+
if (!Array.isArray(links)) {
|
|
916
|
+
return [];
|
|
917
|
+
}
|
|
918
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
919
|
+
const out = [];
|
|
920
|
+
for (const raw of links) {
|
|
921
|
+
if (!raw || typeof raw !== "object" || out.length >= MAX_EXTERNAL_ADMIN_LINKS) {
|
|
922
|
+
continue;
|
|
923
|
+
}
|
|
924
|
+
const id = typeof raw.id === "string" ? raw.id.trim().toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "") : "";
|
|
925
|
+
const label = typeof raw.label === "string" ? raw.label.trim().slice(0, MAX_EXTERNAL_ADMIN_LINK_LABEL_LENGTH) : "";
|
|
926
|
+
const url = tryNormalizeHttpUrl(raw.url);
|
|
927
|
+
if (!id || !label || !url || !EXTERNAL_ADMIN_LINK_ID_PATTERN.test(id) || seenIds.has(id)) {
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
seenIds.add(id);
|
|
931
|
+
out.push({ id, label, url });
|
|
932
|
+
}
|
|
933
|
+
return out;
|
|
934
|
+
}
|
|
935
|
+
function normalizeExternalSources(externalSources) {
|
|
936
|
+
if (!externalSources || typeof externalSources !== "object") {
|
|
937
|
+
return null;
|
|
938
|
+
}
|
|
939
|
+
const studioUrl = tryNormalizeHttpUrl(externalSources.sanity?.studioUrl);
|
|
940
|
+
const shopify = normalizeShopifyExternalSource(externalSources.shopify);
|
|
941
|
+
const links = normalizeExternalAdminLinkEntries(externalSources.links);
|
|
942
|
+
if (!studioUrl && !shopify && links.length === 0) {
|
|
943
|
+
return null;
|
|
944
|
+
}
|
|
945
|
+
return {
|
|
946
|
+
...studioUrl ? { sanity: { studioUrl } } : {},
|
|
947
|
+
...shopify ? { shopify } : {},
|
|
948
|
+
...links.length > 0 ? { links } : {}
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function normalizeJmpContentManifest(input) {
|
|
952
|
+
if (!input || typeof input !== "object") {
|
|
953
|
+
return null;
|
|
954
|
+
}
|
|
955
|
+
const routes = normalizeRoutes(input.routes);
|
|
956
|
+
const externalSources = normalizeExternalSources(input.externalSources);
|
|
957
|
+
const trust = normalizeTrust(input.trust);
|
|
958
|
+
const contact = normalizeContact(input.contact);
|
|
959
|
+
if (routes.length === 0 && !externalSources && !trust && !contact) {
|
|
960
|
+
return null;
|
|
961
|
+
}
|
|
962
|
+
return {
|
|
963
|
+
version: JMP_CONTENT_MANIFEST_VERSION,
|
|
964
|
+
...routes.length > 0 ? { routes } : {},
|
|
965
|
+
...externalSources ? { externalSources } : {},
|
|
966
|
+
...trust ? { trust } : {},
|
|
967
|
+
...contact ? { contact } : {}
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
function normalizeRoutes(routes) {
|
|
971
|
+
if (!Array.isArray(routes)) {
|
|
972
|
+
return [];
|
|
973
|
+
}
|
|
974
|
+
const seen = /* @__PURE__ */ new Set();
|
|
975
|
+
const out = [];
|
|
976
|
+
for (const raw of routes) {
|
|
977
|
+
if (!raw || typeof raw !== "object") continue;
|
|
978
|
+
const wrapper = typeof raw.wrapper === "string" ? raw.wrapper.trim().toLowerCase() : "";
|
|
979
|
+
const pattern = typeof raw.pattern === "string" ? raw.pattern.trim() : "";
|
|
980
|
+
if (!wrapper || !pattern) continue;
|
|
981
|
+
const dedupe = `${wrapper}:${pattern}`;
|
|
982
|
+
if (seen.has(dedupe)) continue;
|
|
983
|
+
seen.add(dedupe);
|
|
984
|
+
out.push({
|
|
985
|
+
wrapper,
|
|
986
|
+
pattern,
|
|
987
|
+
...typeof raw.index === "string" && raw.index.trim() ? { index: raw.index.trim() } : {},
|
|
988
|
+
...typeof raw.label === "string" && raw.label.trim() ? { label: raw.label.trim() } : {}
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
return out;
|
|
992
|
+
}
|
|
993
|
+
function normalizeTrust(trust) {
|
|
994
|
+
if (!trust || typeof trust !== "object") return null;
|
|
995
|
+
const blocks = normalizeTrustBlocks(trust.blocks);
|
|
996
|
+
const labels = normalizeTrustLabels(trust.labels);
|
|
997
|
+
const mergeTestimonialsReviews = trust.mergeTestimonialsReviews === true;
|
|
998
|
+
if (blocks.length === 0 && !labels && !mergeTestimonialsReviews) return null;
|
|
999
|
+
return {
|
|
1000
|
+
...blocks.length > 0 ? { blocks } : {},
|
|
1001
|
+
...labels ? { labels } : {},
|
|
1002
|
+
...mergeTestimonialsReviews ? { mergeTestimonialsReviews: true } : {}
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
function normalizeTrustBlocks(blocks) {
|
|
1006
|
+
if (!Array.isArray(blocks)) return [];
|
|
1007
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1008
|
+
const out = [];
|
|
1009
|
+
for (const raw of blocks) {
|
|
1010
|
+
if (!raw || typeof raw !== "object") continue;
|
|
1011
|
+
const section = typeof raw.section === "string" ? raw.section.trim().toLowerCase() : "";
|
|
1012
|
+
if (!TRUST_SECTIONS.has(section) || seen.has(section)) continue;
|
|
1013
|
+
seen.add(section);
|
|
1014
|
+
out.push({
|
|
1015
|
+
section,
|
|
1016
|
+
...typeof raw.label === "string" && raw.label.trim() ? { label: raw.label.trim() } : {}
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
return out;
|
|
1020
|
+
}
|
|
1021
|
+
function normalizeTrustLabels(labels) {
|
|
1022
|
+
if (!labels || typeof labels !== "object") return null;
|
|
1023
|
+
const out = {};
|
|
1024
|
+
for (const [key, value] of Object.entries(labels)) {
|
|
1025
|
+
if (TRUST_SECTIONS.has(key) && typeof value === "string" && value.trim()) {
|
|
1026
|
+
out[key] = value.trim();
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
1030
|
+
}
|
|
1031
|
+
function normalizeContact(contact) {
|
|
1032
|
+
if (!contact || typeof contact !== "object") return null;
|
|
1033
|
+
const extras = normalizeContactExtras(contact.extras);
|
|
1034
|
+
return extras.length > 0 ? { extras } : null;
|
|
1035
|
+
}
|
|
1036
|
+
function normalizeContactExtras(extras) {
|
|
1037
|
+
if (!Array.isArray(extras)) return [];
|
|
1038
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1039
|
+
const out = [];
|
|
1040
|
+
for (const raw of extras) {
|
|
1041
|
+
if (!raw || typeof raw !== "object") continue;
|
|
1042
|
+
const label = typeof raw.label === "string" ? raw.label.trim() : "";
|
|
1043
|
+
const key = normalizeKey(
|
|
1044
|
+
typeof raw.key === "string" && raw.key.trim() ? raw.key : label
|
|
1045
|
+
);
|
|
1046
|
+
if (!key || !label || !isValidExtraKey(key) || seen.has(key)) continue;
|
|
1047
|
+
seen.add(key);
|
|
1048
|
+
out.push({ key, label });
|
|
1049
|
+
}
|
|
1050
|
+
return out;
|
|
1051
|
+
}
|
|
1052
|
+
function stableJmpManifestFingerprint(manifest) {
|
|
1053
|
+
return manifest ? JSON.stringify(manifest) : "";
|
|
1054
|
+
}
|
|
1055
|
+
function inferWrapperSlotsFromManifest(manifest) {
|
|
1056
|
+
const slots = /* @__PURE__ */ new Set();
|
|
1057
|
+
for (const route of manifest?.routes ?? []) {
|
|
1058
|
+
slots.add(route.wrapper);
|
|
1059
|
+
}
|
|
1060
|
+
for (const block of manifest?.trust?.blocks ?? []) {
|
|
1061
|
+
slots.add(`trust.${block.section}`);
|
|
1062
|
+
slots.add("trust");
|
|
1063
|
+
}
|
|
1064
|
+
if (manifest?.contact?.extras?.length) {
|
|
1065
|
+
slots.add("contact");
|
|
1066
|
+
}
|
|
1067
|
+
return [...slots];
|
|
1068
|
+
}
|
|
1069
|
+
|
|
862
1070
|
// src/content/fetch.ts
|
|
863
1071
|
async function getContent(config, path) {
|
|
864
1072
|
const text = await getContentText(config, path);
|
|
@@ -973,16 +1181,22 @@ function inferTrustWrapperSlots(bundle) {
|
|
|
973
1181
|
function getDiscoveredContentWrappers() {
|
|
974
1182
|
return sortWrapperSlots([...discovered]);
|
|
975
1183
|
}
|
|
1184
|
+
function resolveContentManifestForReport(config) {
|
|
1185
|
+
return normalizeJmpContentManifest(config.contentManifest);
|
|
1186
|
+
}
|
|
976
1187
|
function resolveContentWrappersForReport(config) {
|
|
977
1188
|
const explicit = config.contentWrappers ?? [];
|
|
978
1189
|
const auto = getDiscoveredContentWrappers();
|
|
1190
|
+
const fromManifest = inferWrapperSlotsFromManifest(
|
|
1191
|
+
resolveContentManifestForReport(config)
|
|
1192
|
+
);
|
|
979
1193
|
if (config.contentWrapperMode === "manual") {
|
|
980
|
-
return sortWrapperSlots([...explicit]);
|
|
1194
|
+
return sortWrapperSlots([...explicit, ...fromManifest]);
|
|
981
1195
|
}
|
|
982
1196
|
if (config.contentWrapperMode === "explicit-only") {
|
|
983
|
-
return sortWrapperSlots([...explicit]);
|
|
1197
|
+
return sortWrapperSlots([...explicit, ...fromManifest]);
|
|
984
1198
|
}
|
|
985
|
-
const merged = /* @__PURE__ */ new Set([...explicit, ...auto]);
|
|
1199
|
+
const merged = /* @__PURE__ */ new Set([...explicit, ...auto, ...fromManifest]);
|
|
986
1200
|
return sortWrapperSlots([...merged]);
|
|
987
1201
|
}
|
|
988
1202
|
function hasReportedContentWrappers(dedupeKey) {
|
|
@@ -1073,6 +1287,53 @@ async function getJmpFaqs(config) {
|
|
|
1073
1287
|
afterContentWrapperUse(config);
|
|
1074
1288
|
return data.faqs;
|
|
1075
1289
|
}
|
|
1290
|
+
async function getJmpLandingPages(config, filters) {
|
|
1291
|
+
const params = new URLSearchParams();
|
|
1292
|
+
if (filters?.kind) {
|
|
1293
|
+
params.set("kind", filters.kind);
|
|
1294
|
+
}
|
|
1295
|
+
if (filters?.locale) {
|
|
1296
|
+
params.set("locale", filters.locale);
|
|
1297
|
+
}
|
|
1298
|
+
const query = params.toString();
|
|
1299
|
+
const data = await getContent(
|
|
1300
|
+
config,
|
|
1301
|
+
`/api/content/landing-pages${query ? `?${query}` : ""}`
|
|
1302
|
+
);
|
|
1303
|
+
markContentWrapper("landing");
|
|
1304
|
+
afterContentWrapperUse(config);
|
|
1305
|
+
return data.pages;
|
|
1306
|
+
}
|
|
1307
|
+
async function getJmpLandingPageDetail(config, kind, slug, locale) {
|
|
1308
|
+
const params = new URLSearchParams();
|
|
1309
|
+
if (locale) {
|
|
1310
|
+
params.set("locale", locale);
|
|
1311
|
+
}
|
|
1312
|
+
const query = params.toString();
|
|
1313
|
+
try {
|
|
1314
|
+
const detail = await getContent(
|
|
1315
|
+
config,
|
|
1316
|
+
`/api/content/landing-pages/${encodeURIComponent(kind)}/${encodeURIComponent(slug)}${query ? `?${query}` : ""}`
|
|
1317
|
+
);
|
|
1318
|
+
markContentWrapper("landing");
|
|
1319
|
+
afterContentWrapperUse(config);
|
|
1320
|
+
return detail;
|
|
1321
|
+
} catch (error) {
|
|
1322
|
+
if (error instanceof Error && error.message.includes("HTTP 404")) {
|
|
1323
|
+
return null;
|
|
1324
|
+
}
|
|
1325
|
+
throw error;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
async function getJmpLandingPageSitemap(config) {
|
|
1329
|
+
const data = await getContent(
|
|
1330
|
+
config,
|
|
1331
|
+
"/api/content/landing-pages/sitemap"
|
|
1332
|
+
);
|
|
1333
|
+
markContentWrapper("landing");
|
|
1334
|
+
afterContentWrapperUse(config);
|
|
1335
|
+
return data.entries;
|
|
1336
|
+
}
|
|
1076
1337
|
async function getJmpTrustBundle(config) {
|
|
1077
1338
|
const bundle = await getContent(config, "/api/content/trust");
|
|
1078
1339
|
markTrustBundleWrappers(bundle);
|
|
@@ -1096,7 +1357,8 @@ async function registerJmpContentWrappers(config) {
|
|
|
1096
1357
|
if (!wrappers.length) {
|
|
1097
1358
|
return { ok: false, skipped: true };
|
|
1098
1359
|
}
|
|
1099
|
-
const
|
|
1360
|
+
const manifest = resolveContentManifestForReport(config);
|
|
1361
|
+
const dedupeKey = `${config.trackingKey}:${[...wrappers].sort().join(",")}:${stableJmpManifestFingerprint(manifest)}`;
|
|
1100
1362
|
if (hasReportedContentWrappers(dedupeKey)) {
|
|
1101
1363
|
return { ok: true, wrappers };
|
|
1102
1364
|
}
|
|
@@ -1109,7 +1371,17 @@ async function registerJmpContentWrappers(config) {
|
|
|
1109
1371
|
}
|
|
1110
1372
|
const url = `${baseUrl}/api/content/capabilities`;
|
|
1111
1373
|
if (config.debug) {
|
|
1112
|
-
console.debug("[@jmp-technologies/analytics]", "POST", url, {
|
|
1374
|
+
console.debug("[@jmp-technologies/analytics]", "POST", url, {
|
|
1375
|
+
wrappers,
|
|
1376
|
+
manifest
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
const body = {
|
|
1380
|
+
wrappers,
|
|
1381
|
+
sdkVersion: JMP_ANALYTICS_SDK_VERSION
|
|
1382
|
+
};
|
|
1383
|
+
if (manifest) {
|
|
1384
|
+
body.manifest = manifest;
|
|
1113
1385
|
}
|
|
1114
1386
|
const res = await resolvedFetch(url, {
|
|
1115
1387
|
method: "POST",
|
|
@@ -1117,10 +1389,7 @@ async function registerJmpContentWrappers(config) {
|
|
|
1117
1389
|
"Content-Type": "application/json",
|
|
1118
1390
|
"X-JMP-Tracking-Key": config.trackingKey
|
|
1119
1391
|
},
|
|
1120
|
-
body: JSON.stringify(
|
|
1121
|
-
wrappers,
|
|
1122
|
-
sdkVersion: JMP_ANALYTICS_SDK_VERSION
|
|
1123
|
-
})
|
|
1392
|
+
body: JSON.stringify(body)
|
|
1124
1393
|
});
|
|
1125
1394
|
const text = await res.text();
|
|
1126
1395
|
if (!res.ok) {
|
|
@@ -1146,6 +1415,9 @@ function createJmpContentClient(config) {
|
|
|
1146
1415
|
getBlogPosts: () => getJmpBlogPosts(config),
|
|
1147
1416
|
getBlogPost: (slug) => getJmpBlogPost(config, slug),
|
|
1148
1417
|
getFaqs: () => getJmpFaqs(config),
|
|
1418
|
+
getLandingPages: (filters) => getJmpLandingPages(config, filters),
|
|
1419
|
+
getLandingPageDetail: (kind, slug, locale) => getJmpLandingPageDetail(config, kind, slug, locale),
|
|
1420
|
+
getLandingPageSitemap: () => getJmpLandingPageSitemap(config),
|
|
1149
1421
|
getTrustBundle: () => getJmpTrustBundle(config),
|
|
1150
1422
|
getSiteProfile: () => getJmpSiteProfile(config),
|
|
1151
1423
|
getRobotsTxt: () => getJmpRobotsTxt(config),
|
|
@@ -1216,7 +1488,8 @@ function getJmpContentConfig() {
|
|
|
1216
1488
|
return {
|
|
1217
1489
|
baseUrl: analyticsUrl,
|
|
1218
1490
|
trackingKey,
|
|
1219
|
-
contentWrappers: site?.contentWrappers ?? void 0
|
|
1491
|
+
contentWrappers: site?.contentWrappers ?? void 0,
|
|
1492
|
+
contentManifest: site?.contentManifest ?? void 0
|
|
1220
1493
|
};
|
|
1221
1494
|
}
|
|
1222
1495
|
|
|
@@ -1282,6 +1555,9 @@ function createJmpContentClientFromServerEnv(overrides) {
|
|
|
1282
1555
|
getJmpBrowserAnalyticsConfigFromEnv,
|
|
1283
1556
|
getJmpContentConfig,
|
|
1284
1557
|
getJmpFaqs,
|
|
1558
|
+
getJmpLandingPageDetail,
|
|
1559
|
+
getJmpLandingPageSitemap,
|
|
1560
|
+
getJmpLandingPages,
|
|
1285
1561
|
getJmpRobotsTxt,
|
|
1286
1562
|
getJmpServerContentConfigFromEnv,
|
|
1287
1563
|
getJmpSiteDefinition,
|
|
@@ -1293,10 +1569,12 @@ function createJmpContentClientFromServerEnv(overrides) {
|
|
|
1293
1569
|
isJmpServerContentEnvConfigured,
|
|
1294
1570
|
isJmpTrackingConsentGranted,
|
|
1295
1571
|
markContentWrapper,
|
|
1572
|
+
normalizeJmpContentManifest,
|
|
1296
1573
|
readJmpPublicEnvFromProcess,
|
|
1297
1574
|
registerJmpContentWrappers,
|
|
1298
1575
|
resetContentWrapperDiscoveryForTests,
|
|
1299
1576
|
setJmpTrackingConsent,
|
|
1577
|
+
stableJmpManifestFingerprint,
|
|
1300
1578
|
subscribeJmpTrackingConsent,
|
|
1301
1579
|
trackJmpServerPageView
|
|
1302
1580
|
});
|