@jmp-technologies/analytics 0.1.25 → 0.1.27
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 +103 -0
- 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 +5 -3
- package/dist/astro/client.js.map +1 -1
- package/dist/astro/content.cjs +271 -1
- package/dist/astro/content.cjs.map +1 -1
- package/dist/astro/content.d.cts +9 -3
- package/dist/astro/content.d.ts +9 -3
- package/dist/astro/content.js +10 -3
- package/dist/astro/integration.cjs +56 -10
- package/dist/astro/integration.cjs.map +1 -1
- package/dist/astro/integration.js +4 -3
- package/dist/astro/integration.js.map +1 -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 +56 -10
- package/dist/astro/register.cjs.map +1 -1
- package/dist/astro/register.js +4 -3
- package/dist/{chunk-MOX7RJUU.js → chunk-A4RRTY5D.js} +1 -1
- package/dist/{chunk-MOX7RJUU.js.map → chunk-A4RRTY5D.js.map} +1 -1
- package/dist/{chunk-L67PVZYL.js → chunk-DNYJF7BG.js} +3 -24
- package/dist/chunk-DNYJF7BG.js.map +1 -0
- package/dist/{chunk-5GORAM7J.js → chunk-FNWE2DT5.js} +2 -2
- package/dist/{chunk-7MLPSL6T.js → chunk-HODG4NJQ.js} +2 -2
- package/dist/{chunk-OLWCYWVB.js → chunk-KZ4WVDGL.js} +3 -3
- package/dist/{chunk-AJ33NQVZ.js → chunk-PG3IOI5O.js} +42 -3
- package/dist/chunk-PG3IOI5O.js.map +1 -0
- package/dist/chunk-TCZ6TC2L.js +149 -0
- package/dist/chunk-TCZ6TC2L.js.map +1 -0
- package/dist/{chunk-VRDPVKAN.js → chunk-UVYF33XE.js} +213 -157
- package/dist/chunk-UVYF33XE.js.map +1 -0
- package/dist/chunk-YCVHRMM6.js +28 -0
- package/dist/chunk-YCVHRMM6.js.map +1 -0
- package/dist/{create-jmp-analytics-ClLOMb9p.d.cts → create-jmp-analytics-D4Qw_d6o.d.cts} +1 -1
- package/dist/{create-jmp-analytics-COxo3-yg.d.ts → create-jmp-analytics-DpG5Hdl5.d.ts} +1 -1
- package/dist/index.cjs +213 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -7
- package/dist/index.d.ts +22 -7
- package/dist/index.js +19 -3
- package/dist/next/content.cjs +274 -1
- package/dist/next/content.cjs.map +1 -1
- package/dist/next/content.d.cts +7 -4
- package/dist/next/content.d.ts +7 -4
- package/dist/next/content.js +13 -3
- package/dist/next/content.js.map +1 -1
- package/dist/next/instrumentation.cjs +56 -10
- package/dist/next/instrumentation.cjs.map +1 -1
- package/dist/next/instrumentation.js +3 -2
- package/dist/next/instrumentation.js.map +1 -1
- package/dist/next/landing-capture-script-server.cjs +61 -0
- package/dist/next/landing-capture-script-server.cjs.map +1 -0
- package/dist/next/landing-capture-script-server.d.cts +14 -0
- package/dist/next/landing-capture-script-server.d.ts +14 -0
- package/dist/next/landing-capture-script-server.js +8 -0
- package/dist/next/landing-capture-script-server.js.map +1 -0
- package/dist/next/landing-pages.cjs +659 -0
- package/dist/next/landing-pages.cjs.map +1 -0
- package/dist/next/landing-pages.d.cts +104 -0
- package/dist/next/landing-pages.d.ts +104 -0
- package/dist/next/landing-pages.js +299 -0
- package/dist/next/landing-pages.js.map +1 -0
- 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 +159 -23
- package/dist/next/site-root-server.cjs.map +1 -1
- package/dist/next/site-root-server.js +9 -4
- package/dist/next/site-root-server.js.map +1 -1
- package/dist/next.cjs +152 -70
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +7 -15
- package/dist/next.d.ts +7 -15
- package/dist/next.js +7 -7
- package/dist/react.cjs +103 -0
- 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 +4 -3
- package/dist/{site-config-BSMVyUjk.d.ts → site-config-CJqYnZm7.d.cts} +6 -3
- package/dist/{site-config-8TTHIW6w.d.cts → site-config-UTzDG-UG.d.ts} +6 -3
- package/dist/{track-page-view-DtxbdM5q.d.ts → track-page-view-CMAqyhD_.d.ts} +1 -1
- package/dist/{track-page-view-BweavmXz.d.cts → track-page-view-tX0Magkd.d.cts} +1 -1
- package/dist/{types-Bk0ST1aH.d.ts → types-B-111Wht.d.cts} +52 -5
- package/dist/{types-Bk0ST1aH.d.cts → types-B-111Wht.d.ts} +52 -5
- package/docs/astro-integration.md +1 -1
- package/package.json +16 -2
- package/dist/chunk-AJ33NQVZ.js.map +0 -1
- package/dist/chunk-L67PVZYL.js.map +0 -1
- package/dist/chunk-VRDPVKAN.js.map +0 -1
- /package/dist/{chunk-5GORAM7J.js.map → chunk-FNWE2DT5.js.map} +0 -0
- /package/dist/{chunk-7MLPSL6T.js.map → chunk-HODG4NJQ.js.map} +0 -0
- /package/dist/{chunk-OLWCYWVB.js.map → chunk-KZ4WVDGL.js.map} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildLandingCaptureInlineScript
|
|
3
|
+
} from "./chunk-TCZ6TC2L.js";
|
|
4
|
+
|
|
5
|
+
// src/next/landing-capture-script-server.tsx
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function JmpLandingCaptureScriptServer({
|
|
8
|
+
trackingKey
|
|
9
|
+
} = {}) {
|
|
10
|
+
if (!trackingKey?.trim()) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
"script",
|
|
15
|
+
{
|
|
16
|
+
dangerouslySetInnerHTML: {
|
|
17
|
+
__html: buildLandingCaptureInlineScript()
|
|
18
|
+
},
|
|
19
|
+
id: "jmp-landing-capture",
|
|
20
|
+
suppressHydrationWarning: true
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
JmpLandingCaptureScriptServer
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=chunk-YCVHRMM6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/next/landing-capture-script-server.tsx"],"sourcesContent":["import { buildLandingCaptureInlineScript } from \"../landing-capture\"\n\ntype JmpLandingCaptureScriptServerProps = {\n trackingKey?: string\n}\n\n/**\n * SSR-only landing referrer / UTM capture. Render in root layout `<head>`.\n *\n * Do not use `next/script` or a client component — React 19 will warn and\n * deferred client mounts miss the first referrer anyway.\n */\nexport function JmpLandingCaptureScriptServer({\n trackingKey,\n}: JmpLandingCaptureScriptServerProps = {}) {\n if (!trackingKey?.trim()) {\n return null\n }\n\n return (\n <script\n dangerouslySetInnerHTML={{\n __html: buildLandingCaptureInlineScript(),\n }}\n id=\"jmp-landing-capture\"\n suppressHydrationWarning\n />\n )\n}\n"],"mappings":";;;;;AAoBI;AARG,SAAS,8BAA8B;AAAA,EAC5C;AACF,IAAwC,CAAC,GAAG;AAC1C,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,yBAAyB;AAAA,QACvB,QAAQ,gCAAgC;AAAA,MAC1C;AAAA,MACA,IAAG;AAAA,MACH,0BAAwB;AAAA;AAAA,EAC1B;AAEJ;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as JmpAnalyticsConfig, m as JmpEventType, T as TrackPageViewOptions, n as TrackLeadOptions } from './types-B-111Wht.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Classify outbound contact links for auto-tracking.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as JmpAnalyticsConfig, m as JmpEventType, T as TrackPageViewOptions, n as TrackLeadOptions } from './types-B-111Wht.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Classify outbound contact links for auto-tracking.
|
package/dist/index.cjs
CHANGED
|
@@ -30,22 +30,29 @@ __export(index_exports, {
|
|
|
30
30
|
createJmpContentClient: () => createJmpContentClient,
|
|
31
31
|
createJmpContentClientFromServerEnv: () => createJmpContentClientFromServerEnv,
|
|
32
32
|
defineJmpSite: () => defineJmpSite,
|
|
33
|
+
getDiscoveredContentWrappers: () => getDiscoveredContentWrappers,
|
|
33
34
|
getJmpBlogPost: () => getJmpBlogPost,
|
|
34
35
|
getJmpBlogPosts: () => getJmpBlogPosts,
|
|
35
36
|
getJmpBrowserAnalyticsConfigFromEnv: () => getJmpBrowserAnalyticsConfigFromEnv,
|
|
36
37
|
getJmpContentConfig: () => getJmpContentConfig,
|
|
37
38
|
getJmpFaqs: () => getJmpFaqs,
|
|
39
|
+
getJmpLandingPageDetail: () => getJmpLandingPageDetail,
|
|
40
|
+
getJmpLandingPageSitemap: () => getJmpLandingPageSitemap,
|
|
41
|
+
getJmpLandingPages: () => getJmpLandingPages,
|
|
38
42
|
getJmpRobotsTxt: () => getJmpRobotsTxt,
|
|
39
43
|
getJmpServerContentConfigFromEnv: () => getJmpServerContentConfigFromEnv,
|
|
40
44
|
getJmpSiteDefinition: () => getJmpSiteDefinition,
|
|
41
45
|
getJmpSiteProfile: () => getJmpSiteProfile,
|
|
42
46
|
getJmpTrustBundle: () => getJmpTrustBundle,
|
|
43
47
|
getOrCreateJmpAnalyticsFromBrowserEnv: () => getOrCreateJmpAnalyticsFromBrowserEnv,
|
|
48
|
+
inferTrustWrapperSlots: () => inferTrustWrapperSlots,
|
|
44
49
|
isJmpBrowserAnalyticsEnvConfigured: () => isJmpBrowserAnalyticsEnvConfigured,
|
|
45
50
|
isJmpServerContentEnvConfigured: () => isJmpServerContentEnvConfigured,
|
|
46
51
|
isJmpTrackingConsentGranted: () => isJmpTrackingConsentGranted,
|
|
52
|
+
markContentWrapper: () => markContentWrapper,
|
|
47
53
|
readJmpPublicEnvFromProcess: () => readJmpPublicEnvFromProcess,
|
|
48
54
|
registerJmpContentWrappers: () => registerJmpContentWrappers,
|
|
55
|
+
resetContentWrapperDiscoveryForTests: () => resetContentWrapperDiscoveryForTests,
|
|
49
56
|
setJmpTrackingConsent: () => setJmpTrackingConsent,
|
|
50
57
|
subscribeJmpTrackingConsent: () => subscribeJmpTrackingConsent,
|
|
51
58
|
trackJmpServerPageView: () => trackJmpServerPageView
|
|
@@ -314,7 +321,7 @@ function classifyContactHref(href) {
|
|
|
314
321
|
}
|
|
315
322
|
|
|
316
323
|
// src/constants.ts
|
|
317
|
-
var JMP_ANALYTICS_SDK_VERSION = "0.1.
|
|
324
|
+
var JMP_ANALYTICS_SDK_VERSION = "0.1.26";
|
|
318
325
|
var JMP_TRACKING_CONSENT_STORAGE_KEY = "jmp_analytics_consent_v1";
|
|
319
326
|
var DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS = 2500;
|
|
320
327
|
|
|
@@ -902,12 +909,146 @@ async function getContentText(config, path) {
|
|
|
902
909
|
return text;
|
|
903
910
|
}
|
|
904
911
|
|
|
912
|
+
// src/content/wrapper-discovery.ts
|
|
913
|
+
var WRAPPER_SLOT_ORDER = [
|
|
914
|
+
"blog",
|
|
915
|
+
"faq",
|
|
916
|
+
"contact",
|
|
917
|
+
"trust",
|
|
918
|
+
"trust.summary",
|
|
919
|
+
"trust.testimonials",
|
|
920
|
+
"trust.reviews",
|
|
921
|
+
"trust.stats",
|
|
922
|
+
"trust.logos",
|
|
923
|
+
"trust.credentials"
|
|
924
|
+
];
|
|
925
|
+
var discovered = /* @__PURE__ */ new Set();
|
|
926
|
+
var syncTimer = null;
|
|
927
|
+
var pendingSyncConfig = null;
|
|
928
|
+
var reportedDedupeKeys = /* @__PURE__ */ new Set();
|
|
929
|
+
var syncHandler = null;
|
|
930
|
+
function markContentWrapper(slot) {
|
|
931
|
+
const normalized = slot.trim().toLowerCase();
|
|
932
|
+
if (!normalized) {
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
discovered.add(normalized);
|
|
936
|
+
}
|
|
937
|
+
function markTrustBundleWrappers(bundle) {
|
|
938
|
+
for (const slot of inferTrustWrapperSlots(bundle)) {
|
|
939
|
+
discovered.add(slot);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
function inferTrustWrapperSlots(bundle) {
|
|
943
|
+
const slots = /* @__PURE__ */ new Set(["trust"]);
|
|
944
|
+
const { summary, testimonials, stats, logos, credentials } = bundle;
|
|
945
|
+
const hasSummary = summary.google_rating != null || summary.google_review_count != null || Boolean(summary.google_reviews_url?.trim()) || Boolean(summary.yelp_url?.trim()) || Boolean(summary.trustpilot_url?.trim()) || Boolean(summary.disclaimer?.trim());
|
|
946
|
+
if (hasSummary) {
|
|
947
|
+
slots.add("trust.summary");
|
|
948
|
+
}
|
|
949
|
+
let hasTestimonials = false;
|
|
950
|
+
let hasReviews = false;
|
|
951
|
+
for (const item of testimonials) {
|
|
952
|
+
const bucket = item.placement?.trim().toLowerCase();
|
|
953
|
+
if (bucket === "reviews") {
|
|
954
|
+
hasReviews = true;
|
|
955
|
+
} else {
|
|
956
|
+
hasTestimonials = true;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
if (hasTestimonials) {
|
|
960
|
+
slots.add("trust.testimonials");
|
|
961
|
+
}
|
|
962
|
+
if (hasReviews) {
|
|
963
|
+
slots.add("trust.reviews");
|
|
964
|
+
}
|
|
965
|
+
if (stats.length > 0) {
|
|
966
|
+
slots.add("trust.stats");
|
|
967
|
+
}
|
|
968
|
+
if (logos.length > 0) {
|
|
969
|
+
slots.add("trust.logos");
|
|
970
|
+
}
|
|
971
|
+
if (credentials.length > 0) {
|
|
972
|
+
slots.add("trust.credentials");
|
|
973
|
+
}
|
|
974
|
+
return sortWrapperSlots([...slots]);
|
|
975
|
+
}
|
|
976
|
+
function getDiscoveredContentWrappers() {
|
|
977
|
+
return sortWrapperSlots([...discovered]);
|
|
978
|
+
}
|
|
979
|
+
function resolveContentWrappersForReport(config) {
|
|
980
|
+
const explicit = config.contentWrappers ?? [];
|
|
981
|
+
const auto = getDiscoveredContentWrappers();
|
|
982
|
+
if (config.contentWrapperMode === "manual") {
|
|
983
|
+
return sortWrapperSlots([...explicit]);
|
|
984
|
+
}
|
|
985
|
+
if (config.contentWrapperMode === "explicit-only") {
|
|
986
|
+
return sortWrapperSlots([...explicit]);
|
|
987
|
+
}
|
|
988
|
+
const merged = /* @__PURE__ */ new Set([...explicit, ...auto]);
|
|
989
|
+
return sortWrapperSlots([...merged]);
|
|
990
|
+
}
|
|
991
|
+
function hasReportedContentWrappers(dedupeKey) {
|
|
992
|
+
return reportedDedupeKeys.has(dedupeKey);
|
|
993
|
+
}
|
|
994
|
+
function rememberReportedContentWrappers(dedupeKey) {
|
|
995
|
+
reportedDedupeKeys.add(dedupeKey);
|
|
996
|
+
}
|
|
997
|
+
function setContentWrapperSyncHandler(handler) {
|
|
998
|
+
syncHandler = handler;
|
|
999
|
+
}
|
|
1000
|
+
function scheduleContentWrapperSync(config) {
|
|
1001
|
+
if (!syncHandler) {
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
pendingSyncConfig = config;
|
|
1005
|
+
if (syncTimer) {
|
|
1006
|
+
clearTimeout(syncTimer);
|
|
1007
|
+
}
|
|
1008
|
+
syncTimer = setTimeout(() => {
|
|
1009
|
+
syncTimer = null;
|
|
1010
|
+
const cfg = pendingSyncConfig;
|
|
1011
|
+
pendingSyncConfig = null;
|
|
1012
|
+
if (!cfg || !syncHandler) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
void syncHandler(cfg).catch(() => {
|
|
1016
|
+
});
|
|
1017
|
+
}, 750);
|
|
1018
|
+
}
|
|
1019
|
+
function resetContentWrapperDiscoveryForTests() {
|
|
1020
|
+
discovered.clear();
|
|
1021
|
+
reportedDedupeKeys.clear();
|
|
1022
|
+
syncHandler = null;
|
|
1023
|
+
if (syncTimer) {
|
|
1024
|
+
clearTimeout(syncTimer);
|
|
1025
|
+
syncTimer = null;
|
|
1026
|
+
}
|
|
1027
|
+
pendingSyncConfig = null;
|
|
1028
|
+
}
|
|
1029
|
+
function sortWrapperSlots(slots) {
|
|
1030
|
+
const order = new Map(WRAPPER_SLOT_ORDER.map((slot, index) => [slot, index]));
|
|
1031
|
+
return [...new Set(slots)].sort((a, b) => {
|
|
1032
|
+
const ai = order.get(a) ?? 999;
|
|
1033
|
+
const bi = order.get(b) ?? 999;
|
|
1034
|
+
if (ai !== bi) {
|
|
1035
|
+
return ai - bi;
|
|
1036
|
+
}
|
|
1037
|
+
return a.localeCompare(b);
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
|
|
905
1041
|
// src/content/api.ts
|
|
1042
|
+
function afterContentWrapperUse(config) {
|
|
1043
|
+
scheduleContentWrapperSync(config);
|
|
1044
|
+
}
|
|
906
1045
|
async function getJmpBlogPosts(config) {
|
|
907
1046
|
const data = await getContent(
|
|
908
1047
|
config,
|
|
909
1048
|
"/api/content/blog"
|
|
910
1049
|
);
|
|
1050
|
+
markContentWrapper("blog");
|
|
1051
|
+
afterContentWrapperUse(config);
|
|
911
1052
|
return data.posts;
|
|
912
1053
|
}
|
|
913
1054
|
async function getJmpBlogPost(config, slug) {
|
|
@@ -916,6 +1057,8 @@ async function getJmpBlogPost(config, slug) {
|
|
|
916
1057
|
config,
|
|
917
1058
|
`/api/content/blog/${encodeURIComponent(slug)}`
|
|
918
1059
|
);
|
|
1060
|
+
markContentWrapper("blog");
|
|
1061
|
+
afterContentWrapperUse(config);
|
|
919
1062
|
return data.post;
|
|
920
1063
|
} catch (error) {
|
|
921
1064
|
if (error instanceof Error && error.message.includes("HTTP 404")) {
|
|
@@ -929,35 +1072,82 @@ async function getJmpFaqs(config) {
|
|
|
929
1072
|
config,
|
|
930
1073
|
"/api/content/faqs"
|
|
931
1074
|
);
|
|
1075
|
+
markContentWrapper("faq");
|
|
1076
|
+
afterContentWrapperUse(config);
|
|
932
1077
|
return data.faqs;
|
|
933
1078
|
}
|
|
1079
|
+
async function getJmpLandingPages(config, filters) {
|
|
1080
|
+
const params = new URLSearchParams();
|
|
1081
|
+
if (filters?.kind) {
|
|
1082
|
+
params.set("kind", filters.kind);
|
|
1083
|
+
}
|
|
1084
|
+
if (filters?.locale) {
|
|
1085
|
+
params.set("locale", filters.locale);
|
|
1086
|
+
}
|
|
1087
|
+
const query = params.toString();
|
|
1088
|
+
const data = await getContent(
|
|
1089
|
+
config,
|
|
1090
|
+
`/api/content/landing-pages${query ? `?${query}` : ""}`
|
|
1091
|
+
);
|
|
1092
|
+
markContentWrapper("landing");
|
|
1093
|
+
afterContentWrapperUse(config);
|
|
1094
|
+
return data.pages;
|
|
1095
|
+
}
|
|
1096
|
+
async function getJmpLandingPageDetail(config, kind, slug, locale) {
|
|
1097
|
+
const params = new URLSearchParams();
|
|
1098
|
+
if (locale) {
|
|
1099
|
+
params.set("locale", locale);
|
|
1100
|
+
}
|
|
1101
|
+
const query = params.toString();
|
|
1102
|
+
try {
|
|
1103
|
+
const detail = await getContent(
|
|
1104
|
+
config,
|
|
1105
|
+
`/api/content/landing-pages/${encodeURIComponent(kind)}/${encodeURIComponent(slug)}${query ? `?${query}` : ""}`
|
|
1106
|
+
);
|
|
1107
|
+
markContentWrapper("landing");
|
|
1108
|
+
afterContentWrapperUse(config);
|
|
1109
|
+
return detail;
|
|
1110
|
+
} catch (error) {
|
|
1111
|
+
if (error instanceof Error && error.message.includes("HTTP 404")) {
|
|
1112
|
+
return null;
|
|
1113
|
+
}
|
|
1114
|
+
throw error;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
async function getJmpLandingPageSitemap(config) {
|
|
1118
|
+
const data = await getContent(
|
|
1119
|
+
config,
|
|
1120
|
+
"/api/content/landing-pages/sitemap"
|
|
1121
|
+
);
|
|
1122
|
+
markContentWrapper("landing");
|
|
1123
|
+
afterContentWrapperUse(config);
|
|
1124
|
+
return data.entries;
|
|
1125
|
+
}
|
|
934
1126
|
async function getJmpTrustBundle(config) {
|
|
935
|
-
|
|
1127
|
+
const bundle = await getContent(config, "/api/content/trust");
|
|
1128
|
+
markTrustBundleWrappers(bundle);
|
|
1129
|
+
afterContentWrapperUse(config);
|
|
1130
|
+
return bundle;
|
|
936
1131
|
}
|
|
937
1132
|
async function getJmpSiteProfile(config) {
|
|
938
1133
|
const data = await getContent(
|
|
939
1134
|
config,
|
|
940
1135
|
"/api/content/site"
|
|
941
1136
|
);
|
|
1137
|
+
markContentWrapper("contact");
|
|
1138
|
+
afterContentWrapperUse(config);
|
|
942
1139
|
return data.site;
|
|
943
1140
|
}
|
|
944
1141
|
async function getJmpRobotsTxt(config) {
|
|
945
1142
|
return getContentText(config, "/api/content/robots");
|
|
946
1143
|
}
|
|
947
|
-
var registeredContentWrappers = /* @__PURE__ */ new Set();
|
|
948
|
-
function resolveContentWrappersFromConfig(config) {
|
|
949
|
-
if (config.contentWrappers?.length) {
|
|
950
|
-
return [...config.contentWrappers];
|
|
951
|
-
}
|
|
952
|
-
return [];
|
|
953
|
-
}
|
|
954
1144
|
async function registerJmpContentWrappers(config) {
|
|
955
|
-
const wrappers =
|
|
1145
|
+
const wrappers = resolveContentWrappersForReport(config);
|
|
956
1146
|
if (!wrappers.length) {
|
|
957
1147
|
return { ok: false, skipped: true };
|
|
958
1148
|
}
|
|
959
1149
|
const dedupeKey = `${config.trackingKey}:${[...wrappers].sort().join(",")}`;
|
|
960
|
-
if (
|
|
1150
|
+
if (hasReportedContentWrappers(dedupeKey)) {
|
|
961
1151
|
return { ok: true, wrappers };
|
|
962
1152
|
}
|
|
963
1153
|
const baseUrl = normalizeBaseUrl(config.baseUrl);
|
|
@@ -994,10 +1184,11 @@ async function registerJmpContentWrappers(config) {
|
|
|
994
1184
|
[`JMP content wrappers HTTP ${res.status}`, parsed.error, parsed.hint].filter(Boolean).join(" \u2014 ")
|
|
995
1185
|
);
|
|
996
1186
|
}
|
|
997
|
-
|
|
1187
|
+
rememberReportedContentWrappers(dedupeKey);
|
|
998
1188
|
const data = JSON.parse(text);
|
|
999
1189
|
return { ok: true, wrappers: data.wrappers ?? wrappers };
|
|
1000
1190
|
}
|
|
1191
|
+
setContentWrapperSyncHandler(registerJmpContentWrappers);
|
|
1001
1192
|
|
|
1002
1193
|
// src/content/client.ts
|
|
1003
1194
|
function createJmpContentClient(config) {
|
|
@@ -1005,6 +1196,9 @@ function createJmpContentClient(config) {
|
|
|
1005
1196
|
getBlogPosts: () => getJmpBlogPosts(config),
|
|
1006
1197
|
getBlogPost: (slug) => getJmpBlogPost(config, slug),
|
|
1007
1198
|
getFaqs: () => getJmpFaqs(config),
|
|
1199
|
+
getLandingPages: (filters) => getJmpLandingPages(config, filters),
|
|
1200
|
+
getLandingPageDetail: (kind, slug, locale) => getJmpLandingPageDetail(config, kind, slug, locale),
|
|
1201
|
+
getLandingPageSitemap: () => getJmpLandingPageSitemap(config),
|
|
1008
1202
|
getTrustBundle: () => getJmpTrustBundle(config),
|
|
1009
1203
|
getSiteProfile: () => getJmpSiteProfile(config),
|
|
1010
1204
|
getRobotsTxt: () => getJmpRobotsTxt(config),
|
|
@@ -1135,22 +1329,29 @@ function createJmpContentClientFromServerEnv(overrides) {
|
|
|
1135
1329
|
createJmpContentClient,
|
|
1136
1330
|
createJmpContentClientFromServerEnv,
|
|
1137
1331
|
defineJmpSite,
|
|
1332
|
+
getDiscoveredContentWrappers,
|
|
1138
1333
|
getJmpBlogPost,
|
|
1139
1334
|
getJmpBlogPosts,
|
|
1140
1335
|
getJmpBrowserAnalyticsConfigFromEnv,
|
|
1141
1336
|
getJmpContentConfig,
|
|
1142
1337
|
getJmpFaqs,
|
|
1338
|
+
getJmpLandingPageDetail,
|
|
1339
|
+
getJmpLandingPageSitemap,
|
|
1340
|
+
getJmpLandingPages,
|
|
1143
1341
|
getJmpRobotsTxt,
|
|
1144
1342
|
getJmpServerContentConfigFromEnv,
|
|
1145
1343
|
getJmpSiteDefinition,
|
|
1146
1344
|
getJmpSiteProfile,
|
|
1147
1345
|
getJmpTrustBundle,
|
|
1148
1346
|
getOrCreateJmpAnalyticsFromBrowserEnv,
|
|
1347
|
+
inferTrustWrapperSlots,
|
|
1149
1348
|
isJmpBrowserAnalyticsEnvConfigured,
|
|
1150
1349
|
isJmpServerContentEnvConfigured,
|
|
1151
1350
|
isJmpTrackingConsentGranted,
|
|
1351
|
+
markContentWrapper,
|
|
1152
1352
|
readJmpPublicEnvFromProcess,
|
|
1153
1353
|
registerJmpContentWrappers,
|
|
1354
|
+
resetContentWrapperDiscoveryForTests,
|
|
1154
1355
|
setJmpTrackingConsent,
|
|
1155
1356
|
subscribeJmpTrackingConsent,
|
|
1156
1357
|
trackJmpServerPageView
|