@jmp-technologies/analytics 0.1.35 → 0.1.37
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 +82 -42
- package/dist/astro/client.cjs.map +1 -1
- package/dist/astro/client.d.cts +18 -0
- package/dist/astro/client.d.ts +18 -0
- package/dist/astro/client.js +2 -2
- package/dist/astro/content.cjs +99 -69
- package/dist/astro/content.cjs.map +1 -1
- package/dist/astro/content.d.cts +53 -0
- package/dist/astro/content.d.ts +53 -0
- package/dist/astro/content.js +3 -3
- package/dist/astro/integration.cjs +100 -66
- package/dist/astro/integration.cjs.map +1 -1
- package/dist/astro/integration.d.cts +36 -0
- package/dist/astro/integration.d.ts +36 -0
- package/dist/astro/integration.js +3 -3
- package/dist/astro/middleware.cjs +93 -66
- package/dist/astro/middleware.cjs.map +1 -1
- package/dist/astro/middleware.d.cts +19 -0
- package/dist/astro/middleware.d.ts +19 -0
- package/dist/astro/middleware.js +2 -2
- package/dist/astro/register.cjs +100 -66
- package/dist/astro/register.cjs.map +1 -1
- package/dist/astro/register.d.cts +7 -0
- package/dist/astro/register.d.ts +7 -0
- package/dist/astro/register.js +3 -3
- package/dist/{chunk-VUCOCFVE.js → chunk-D43AEUXU.js} +3 -3
- package/dist/{chunk-AIFJ7DVO.js → chunk-EMZXL6VF.js} +193 -105
- package/dist/chunk-EMZXL6VF.js.map +1 -0
- package/dist/{chunk-HFLU7HQE.js → chunk-PTXPNIMF.js} +2 -2
- package/dist/{chunk-6SMPRPQ3.js → chunk-RT2YYDCK.js} +12 -8
- package/dist/chunk-RT2YYDCK.js.map +1 -0
- package/dist/{chunk-4ZUW24F6.js → chunk-TN6PGIB5.js} +2 -2
- package/dist/{chunk-3ET7F6MZ.js → chunk-UHXWHKHJ.js} +3 -3
- package/dist/chunk-UHXWHKHJ.js.map +1 -0
- package/dist/{chunk-G322JCI3.js → chunk-VQF6QYLR.js} +3 -3
- package/dist/create-jmp-analytics-Bz0-K0Af.d.cts +69 -0
- package/dist/create-jmp-analytics-DRjrlWUn.d.ts +69 -0
- package/dist/env-public-B6Y0DG68.d.cts +14 -0
- package/dist/env-public-B6Y0DG68.d.ts +14 -0
- package/dist/index.cjs +105 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +2 -2
- package/dist/landing-capture-C8pyZWuF.d.cts +4 -0
- package/dist/landing-capture-C8pyZWuF.d.ts +4 -0
- package/dist/next/content.cjs +99 -69
- package/dist/next/content.cjs.map +1 -1
- package/dist/next/content.d.cts +23 -0
- package/dist/next/content.d.ts +23 -0
- package/dist/next/content.js +3 -3
- package/dist/next/google-tag.d.cts +17 -0
- package/dist/next/google-tag.d.ts +17 -0
- package/dist/next/instrumentation.cjs +100 -66
- package/dist/next/instrumentation.cjs.map +1 -1
- package/dist/next/instrumentation.d.cts +7 -0
- package/dist/next/instrumentation.d.ts +7 -0
- package/dist/next/instrumentation.js +2 -2
- 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-pages.cjs +151 -129
- package/dist/next/landing-pages.cjs.map +1 -1
- package/dist/next/landing-pages.d.cts +92 -0
- package/dist/next/landing-pages.d.ts +92 -0
- package/dist/next/landing-pages.js +7 -8
- package/dist/next/landing-pages.js.map +1 -1
- package/dist/next/locations.cjs +110 -88
- package/dist/next/locations.cjs.map +1 -1
- package/dist/next/locations.d.cts +55 -0
- package/dist/next/locations.d.ts +55 -0
- package/dist/next/locations.js +7 -8
- package/dist/next/locations.js.map +1 -1
- package/dist/next/middleware.cjs +93 -66
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.d.cts +10 -0
- package/dist/next/middleware.d.ts +10 -0
- package/dist/next/middleware.js +2 -2
- package/dist/next/site-root-server.cjs +99 -69
- package/dist/next/site-root-server.cjs.map +1 -1
- package/dist/next/site-root-server.d.cts +24 -0
- package/dist/next/site-root-server.d.ts +24 -0
- package/dist/next/site-root-server.js +4 -4
- package/dist/next.cjs +36 -2
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +50 -0
- package/dist/next.d.ts +50 -0
- package/dist/next.js +4 -4
- package/dist/react.cjs +87 -53
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +22 -0
- package/dist/react.d.ts +22 -0
- package/dist/react.js +3 -3
- package/dist/site-config-BxEmJxBB.d.ts +74 -0
- package/dist/site-config-Cgq67uQ1.d.cts +74 -0
- package/dist/track-page-view-74Su6lQY.d.ts +12 -0
- package/dist/track-page-view-BCX1Dsfk.d.cts +12 -0
- package/dist/types-yNgoakwk.d.cts +397 -0
- package/dist/types-yNgoakwk.d.ts +397 -0
- package/dist/utils-BLoWWfSw.d.ts +15 -0
- package/dist/utils-UPTIdK1D.d.cts +15 -0
- package/package.json +3 -2
- package/dist/chunk-3ET7F6MZ.js.map +0 -1
- package/dist/chunk-6SMPRPQ3.js.map +0 -1
- package/dist/chunk-AIFJ7DVO.js.map +0 -1
- package/dist/chunk-RI3KKDPX.js +0 -75
- package/dist/chunk-RI3KKDPX.js.map +0 -1
- /package/dist/{chunk-VUCOCFVE.js.map → chunk-D43AEUXU.js.map} +0 -0
- /package/dist/{chunk-HFLU7HQE.js.map → chunk-PTXPNIMF.js.map} +0 -0
- /package/dist/{chunk-4ZUW24F6.js.map → chunk-TN6PGIB5.js.map} +0 -0
- /package/dist/{chunk-G322JCI3.js.map → chunk-VQF6QYLR.js.map} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { h as JmpTestimonial, J as JmpBlogPost, a as JmpFaqItem, d as JmpLandingPageKind, c as JmpLandingPageDetail, e as JmpLandingPageSitemapEntry, b as JmpLandingPage, k as JmpWebsiteLocationDetail, j as JmpWebsiteLocation, f as JmpPopularPagesResult, g as JmpSiteProfile, i as JmpTrustBundle } from '../types-yNgoakwk.cjs';
|
|
2
|
+
import { J as JmpSiteSocialLinks } from '../site-config-Cgq67uQ1.cjs';
|
|
3
|
+
export { g as getJmpContentConfig } from '../site-config-Cgq67uQ1.cjs';
|
|
4
|
+
|
|
5
|
+
type ResolvedSiteContact = {
|
|
6
|
+
displayName: string;
|
|
7
|
+
email: string;
|
|
8
|
+
founderName: string;
|
|
9
|
+
dashboardDemoUrl: string;
|
|
10
|
+
profilePhotoSrc: string;
|
|
11
|
+
linkedin: string | null;
|
|
12
|
+
social: JmpSiteSocialLinks;
|
|
13
|
+
phone: string | null;
|
|
14
|
+
address: string | null;
|
|
15
|
+
googleMapsUrl: string | null;
|
|
16
|
+
googleMapsEmbedUrl: string | null;
|
|
17
|
+
hours: string | null;
|
|
18
|
+
serviceArea: string | null;
|
|
19
|
+
privacyUrl: string;
|
|
20
|
+
termsUrl: string;
|
|
21
|
+
cta: {
|
|
22
|
+
label: string | null;
|
|
23
|
+
url: string | null;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/** Resolve a path or URL against {@link defineJmpSite}'s `siteUrl`. */
|
|
27
|
+
declare function absoluteSiteAssetUrl(src: string): string;
|
|
28
|
+
declare function loadSiteProfile(): Promise<JmpSiteProfile | null>;
|
|
29
|
+
declare function resolveSiteContact(profile: JmpSiteProfile | null): ResolvedSiteContact;
|
|
30
|
+
declare function getResolvedSiteContact(): Promise<ResolvedSiteContact>;
|
|
31
|
+
/** Non-null social profile URLs in a stable order for JSON-LD `sameAs`. */
|
|
32
|
+
declare function listResolvedSocialUrls(social: JmpSiteSocialLinks): string[];
|
|
33
|
+
declare function loadBlogPosts(locale?: string): Promise<JmpBlogPost[]>;
|
|
34
|
+
declare function loadBlogPost(slug: string, locale?: string): Promise<JmpBlogPost | null>;
|
|
35
|
+
declare function loadFaqs(locale?: string): Promise<JmpFaqItem[]>;
|
|
36
|
+
declare function loadFaqBySlug(slug: string, locale?: string): Promise<JmpFaqItem | null>;
|
|
37
|
+
declare function loadLandingPages(filters?: {
|
|
38
|
+
kind?: JmpLandingPageKind;
|
|
39
|
+
locale?: string;
|
|
40
|
+
}): Promise<JmpLandingPage[]>;
|
|
41
|
+
declare function loadLandingPageDetail(kind: JmpLandingPageKind, slug: string, locale?: string): Promise<JmpLandingPageDetail | null>;
|
|
42
|
+
declare function loadLandingPageSitemap(): Promise<JmpLandingPageSitemapEntry[]>;
|
|
43
|
+
declare function loadLocations(): Promise<JmpWebsiteLocation[]>;
|
|
44
|
+
declare function loadLocationDetail(slug: string): Promise<JmpWebsiteLocationDetail | null>;
|
|
45
|
+
declare function loadTrustBundle(): Promise<JmpTrustBundle | null>;
|
|
46
|
+
declare function filterFeaturedTrustQuotes(testimonials: JmpTestimonial[], placement: "testimonials" | "reviews", limit?: number): JmpTestimonial[];
|
|
47
|
+
declare function loadPopularPages(filters?: {
|
|
48
|
+
prefix?: string;
|
|
49
|
+
days?: number;
|
|
50
|
+
limit?: number;
|
|
51
|
+
}): Promise<JmpPopularPagesResult | null>;
|
|
52
|
+
|
|
53
|
+
export { JmpBlogPost, JmpFaqItem, JmpLandingPage, JmpLandingPageDetail, JmpLandingPageKind, JmpLandingPageSitemapEntry, JmpPopularPagesResult, JmpSiteProfile, JmpSiteSocialLinks, JmpTestimonial, JmpTrustBundle, JmpWebsiteLocation, JmpWebsiteLocationDetail, type ResolvedSiteContact, absoluteSiteAssetUrl, filterFeaturedTrustQuotes, getResolvedSiteContact, listResolvedSocialUrls, loadBlogPost, loadBlogPosts, loadFaqBySlug, loadFaqs, loadLandingPageDetail, loadLandingPageSitemap, loadLandingPages, loadLocationDetail, loadLocations, loadPopularPages, loadSiteProfile, loadTrustBundle, resolveSiteContact };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { h as JmpTestimonial, J as JmpBlogPost, a as JmpFaqItem, d as JmpLandingPageKind, c as JmpLandingPageDetail, e as JmpLandingPageSitemapEntry, b as JmpLandingPage, k as JmpWebsiteLocationDetail, j as JmpWebsiteLocation, f as JmpPopularPagesResult, g as JmpSiteProfile, i as JmpTrustBundle } from '../types-yNgoakwk.js';
|
|
2
|
+
import { J as JmpSiteSocialLinks } from '../site-config-BxEmJxBB.js';
|
|
3
|
+
export { g as getJmpContentConfig } from '../site-config-BxEmJxBB.js';
|
|
4
|
+
|
|
5
|
+
type ResolvedSiteContact = {
|
|
6
|
+
displayName: string;
|
|
7
|
+
email: string;
|
|
8
|
+
founderName: string;
|
|
9
|
+
dashboardDemoUrl: string;
|
|
10
|
+
profilePhotoSrc: string;
|
|
11
|
+
linkedin: string | null;
|
|
12
|
+
social: JmpSiteSocialLinks;
|
|
13
|
+
phone: string | null;
|
|
14
|
+
address: string | null;
|
|
15
|
+
googleMapsUrl: string | null;
|
|
16
|
+
googleMapsEmbedUrl: string | null;
|
|
17
|
+
hours: string | null;
|
|
18
|
+
serviceArea: string | null;
|
|
19
|
+
privacyUrl: string;
|
|
20
|
+
termsUrl: string;
|
|
21
|
+
cta: {
|
|
22
|
+
label: string | null;
|
|
23
|
+
url: string | null;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/** Resolve a path or URL against {@link defineJmpSite}'s `siteUrl`. */
|
|
27
|
+
declare function absoluteSiteAssetUrl(src: string): string;
|
|
28
|
+
declare function loadSiteProfile(): Promise<JmpSiteProfile | null>;
|
|
29
|
+
declare function resolveSiteContact(profile: JmpSiteProfile | null): ResolvedSiteContact;
|
|
30
|
+
declare function getResolvedSiteContact(): Promise<ResolvedSiteContact>;
|
|
31
|
+
/** Non-null social profile URLs in a stable order for JSON-LD `sameAs`. */
|
|
32
|
+
declare function listResolvedSocialUrls(social: JmpSiteSocialLinks): string[];
|
|
33
|
+
declare function loadBlogPosts(locale?: string): Promise<JmpBlogPost[]>;
|
|
34
|
+
declare function loadBlogPost(slug: string, locale?: string): Promise<JmpBlogPost | null>;
|
|
35
|
+
declare function loadFaqs(locale?: string): Promise<JmpFaqItem[]>;
|
|
36
|
+
declare function loadFaqBySlug(slug: string, locale?: string): Promise<JmpFaqItem | null>;
|
|
37
|
+
declare function loadLandingPages(filters?: {
|
|
38
|
+
kind?: JmpLandingPageKind;
|
|
39
|
+
locale?: string;
|
|
40
|
+
}): Promise<JmpLandingPage[]>;
|
|
41
|
+
declare function loadLandingPageDetail(kind: JmpLandingPageKind, slug: string, locale?: string): Promise<JmpLandingPageDetail | null>;
|
|
42
|
+
declare function loadLandingPageSitemap(): Promise<JmpLandingPageSitemapEntry[]>;
|
|
43
|
+
declare function loadLocations(): Promise<JmpWebsiteLocation[]>;
|
|
44
|
+
declare function loadLocationDetail(slug: string): Promise<JmpWebsiteLocationDetail | null>;
|
|
45
|
+
declare function loadTrustBundle(): Promise<JmpTrustBundle | null>;
|
|
46
|
+
declare function filterFeaturedTrustQuotes(testimonials: JmpTestimonial[], placement: "testimonials" | "reviews", limit?: number): JmpTestimonial[];
|
|
47
|
+
declare function loadPopularPages(filters?: {
|
|
48
|
+
prefix?: string;
|
|
49
|
+
days?: number;
|
|
50
|
+
limit?: number;
|
|
51
|
+
}): Promise<JmpPopularPagesResult | null>;
|
|
52
|
+
|
|
53
|
+
export { JmpBlogPost, JmpFaqItem, JmpLandingPage, JmpLandingPageDetail, JmpLandingPageKind, JmpLandingPageSitemapEntry, JmpPopularPagesResult, JmpSiteProfile, JmpSiteSocialLinks, JmpTestimonial, JmpTrustBundle, JmpWebsiteLocation, JmpWebsiteLocationDetail, type ResolvedSiteContact, absoluteSiteAssetUrl, filterFeaturedTrustQuotes, getResolvedSiteContact, listResolvedSocialUrls, loadBlogPost, loadBlogPosts, loadFaqBySlug, loadFaqs, loadLandingPageDetail, loadLandingPageSitemap, loadLandingPages, loadLocationDetail, loadLocations, loadPopularPages, loadSiteProfile, loadTrustBundle, resolveSiteContact };
|
package/dist/astro/content.js
CHANGED
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
loadSiteProfile,
|
|
17
17
|
loadTrustBundle,
|
|
18
18
|
resolveSiteContact
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import "../chunk-
|
|
19
|
+
} from "../chunk-UHXWHKHJ.js";
|
|
20
|
+
import "../chunk-RT2YYDCK.js";
|
|
21
21
|
import "../chunk-TCZ6TC2L.js";
|
|
22
22
|
import {
|
|
23
23
|
getJmpContentConfig
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-EMZXL6VF.js";
|
|
25
25
|
export {
|
|
26
26
|
absoluteSiteAssetUrl,
|
|
27
27
|
filterFeaturedTrustQuotes,
|
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(integration_exports);
|
|
|
28
28
|
var LANDING_REFERER_COOKIE_MAX_AGE_SEC = 30 * 60;
|
|
29
29
|
|
|
30
30
|
// package.json
|
|
31
|
-
var version = "0.1.
|
|
31
|
+
var version = "0.1.37";
|
|
32
32
|
|
|
33
33
|
// src/constants.ts
|
|
34
34
|
var JMP_ANALYTICS_SDK_VERSION = version;
|
|
@@ -38,6 +38,97 @@ function normalizeBaseUrl(baseUrl) {
|
|
|
38
38
|
return baseUrl.replace(/\/$/, "");
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// src/env-public.ts
|
|
42
|
+
function firstDefined(...values) {
|
|
43
|
+
for (const v of values) {
|
|
44
|
+
if (v) return v;
|
|
45
|
+
}
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
function readJmpPublicEnvFromProcessEnv() {
|
|
49
|
+
if (typeof process === "undefined" || !process.env) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
const { env } = process;
|
|
53
|
+
const analyticsUrl = firstDefined(
|
|
54
|
+
env.NEXT_PUBLIC_JMP_ANALYTICS_URL,
|
|
55
|
+
env.PUBLIC_JMP_ANALYTICS_URL
|
|
56
|
+
);
|
|
57
|
+
const trackingKey = firstDefined(
|
|
58
|
+
env.NEXT_PUBLIC_JMP_TRACKING_KEY,
|
|
59
|
+
env.PUBLIC_JMP_TRACKING_KEY
|
|
60
|
+
);
|
|
61
|
+
const requireConsentRaw = firstDefined(
|
|
62
|
+
env.NEXT_PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT,
|
|
63
|
+
env.PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT
|
|
64
|
+
);
|
|
65
|
+
const autoContactRaw = firstDefined(
|
|
66
|
+
env.NEXT_PUBLIC_JMP_AUTO_CONTACT_LINKS,
|
|
67
|
+
env.PUBLIC_JMP_AUTO_CONTACT_LINKS
|
|
68
|
+
);
|
|
69
|
+
return {
|
|
70
|
+
analyticsUrl,
|
|
71
|
+
trackingKey,
|
|
72
|
+
requireConsent: requireConsentRaw === "true",
|
|
73
|
+
autoContactLinks: autoContactRaw === "true"
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function readJmpPublicEnvFromProcess(overrides) {
|
|
77
|
+
const fromEnv = readJmpPublicEnvFromProcessEnv();
|
|
78
|
+
return {
|
|
79
|
+
analyticsUrl: firstDefined(overrides?.analyticsUrl, fromEnv.analyticsUrl),
|
|
80
|
+
trackingKey: firstDefined(overrides?.trackingKey, fromEnv.trackingKey),
|
|
81
|
+
requireConsent: overrides?.requireConsent ?? fromEnv.requireConsent,
|
|
82
|
+
autoContactLinks: overrides?.autoContactLinks ?? fromEnv.autoContactLinks
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/site-config.ts
|
|
87
|
+
var registeredSite = null;
|
|
88
|
+
function getJmpSiteDefinition() {
|
|
89
|
+
return registeredSite;
|
|
90
|
+
}
|
|
91
|
+
function getJmpContentConfig() {
|
|
92
|
+
const { analyticsUrl, trackingKey } = readJmpPublicEnvFromProcess();
|
|
93
|
+
if (!analyticsUrl || !trackingKey) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const site = getJmpSiteDefinition();
|
|
97
|
+
return {
|
|
98
|
+
baseUrl: analyticsUrl,
|
|
99
|
+
trackingKey,
|
|
100
|
+
contentWrappers: site?.contentWrappers ?? void 0,
|
|
101
|
+
contentManifest: site?.contentManifest ?? void 0
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/landing-pages/utils.ts
|
|
106
|
+
function resolveJmpSiteUrl(override) {
|
|
107
|
+
const fromArg = override?.trim().replace(/\/$/, "");
|
|
108
|
+
if (fromArg) return fromArg;
|
|
109
|
+
const fromConfig = getJmpSiteDefinition()?.siteUrl?.trim().replace(/\/$/, "");
|
|
110
|
+
return fromConfig || null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/request-origin.ts
|
|
114
|
+
function resolveJmpRequestOrigin() {
|
|
115
|
+
const fromSite = resolveJmpSiteUrl();
|
|
116
|
+
if (fromSite) {
|
|
117
|
+
return fromSite;
|
|
118
|
+
}
|
|
119
|
+
if (typeof process === "undefined") {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
return process.env.NEXT_PUBLIC_SITE_URL?.trim().replace(/\/$/, "") || null;
|
|
123
|
+
}
|
|
124
|
+
function withJmpOriginHeader(headers) {
|
|
125
|
+
const origin = resolveJmpRequestOrigin();
|
|
126
|
+
if (!origin) {
|
|
127
|
+
return headers;
|
|
128
|
+
}
|
|
129
|
+
return { ...headers, Origin: origin };
|
|
130
|
+
}
|
|
131
|
+
|
|
41
132
|
// src/content/manifest.ts
|
|
42
133
|
var JMP_CONTENT_MANIFEST_VERSION = 1;
|
|
43
134
|
var TRUST_SECTIONS = /* @__PURE__ */ new Set([
|
|
@@ -241,6 +332,13 @@ function inferWrapperSlotsFromManifest(manifest) {
|
|
|
241
332
|
return [...slots];
|
|
242
333
|
}
|
|
243
334
|
|
|
335
|
+
// src/content/fetch.ts
|
|
336
|
+
function jmpContentRequestHeaders(config) {
|
|
337
|
+
return withJmpOriginHeader({
|
|
338
|
+
"X-JMP-Tracking-Key": config.trackingKey
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
244
342
|
// src/content/wrapper-discovery.ts
|
|
245
343
|
var WRAPPER_SLOT_ORDER = [
|
|
246
344
|
"blog",
|
|
@@ -335,7 +433,7 @@ async function registerJmpContentWrappers(config) {
|
|
|
335
433
|
method: "POST",
|
|
336
434
|
headers: {
|
|
337
435
|
"Content-Type": "application/json",
|
|
338
|
-
|
|
436
|
+
...jmpContentRequestHeaders(config)
|
|
339
437
|
},
|
|
340
438
|
body: JSON.stringify(body)
|
|
341
439
|
});
|
|
@@ -357,70 +455,6 @@ async function registerJmpContentWrappers(config) {
|
|
|
357
455
|
}
|
|
358
456
|
setContentWrapperSyncHandler(registerJmpContentWrappers);
|
|
359
457
|
|
|
360
|
-
// src/env-public.ts
|
|
361
|
-
function firstDefined(...values) {
|
|
362
|
-
for (const v of values) {
|
|
363
|
-
if (v) return v;
|
|
364
|
-
}
|
|
365
|
-
return void 0;
|
|
366
|
-
}
|
|
367
|
-
function readJmpPublicEnvFromProcessEnv() {
|
|
368
|
-
if (typeof process === "undefined" || !process.env) {
|
|
369
|
-
return {};
|
|
370
|
-
}
|
|
371
|
-
const { env } = process;
|
|
372
|
-
const analyticsUrl = firstDefined(
|
|
373
|
-
env.NEXT_PUBLIC_JMP_ANALYTICS_URL,
|
|
374
|
-
env.PUBLIC_JMP_ANALYTICS_URL
|
|
375
|
-
);
|
|
376
|
-
const trackingKey = firstDefined(
|
|
377
|
-
env.NEXT_PUBLIC_JMP_TRACKING_KEY,
|
|
378
|
-
env.PUBLIC_JMP_TRACKING_KEY
|
|
379
|
-
);
|
|
380
|
-
const requireConsentRaw = firstDefined(
|
|
381
|
-
env.NEXT_PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT,
|
|
382
|
-
env.PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT
|
|
383
|
-
);
|
|
384
|
-
const autoContactRaw = firstDefined(
|
|
385
|
-
env.NEXT_PUBLIC_JMP_AUTO_CONTACT_LINKS,
|
|
386
|
-
env.PUBLIC_JMP_AUTO_CONTACT_LINKS
|
|
387
|
-
);
|
|
388
|
-
return {
|
|
389
|
-
analyticsUrl,
|
|
390
|
-
trackingKey,
|
|
391
|
-
requireConsent: requireConsentRaw === "true",
|
|
392
|
-
autoContactLinks: autoContactRaw === "true"
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
function readJmpPublicEnvFromProcess(overrides) {
|
|
396
|
-
const fromEnv = readJmpPublicEnvFromProcessEnv();
|
|
397
|
-
return {
|
|
398
|
-
analyticsUrl: firstDefined(overrides?.analyticsUrl, fromEnv.analyticsUrl),
|
|
399
|
-
trackingKey: firstDefined(overrides?.trackingKey, fromEnv.trackingKey),
|
|
400
|
-
requireConsent: overrides?.requireConsent ?? fromEnv.requireConsent,
|
|
401
|
-
autoContactLinks: overrides?.autoContactLinks ?? fromEnv.autoContactLinks
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
// src/site-config.ts
|
|
406
|
-
var registeredSite = null;
|
|
407
|
-
function getJmpSiteDefinition() {
|
|
408
|
-
return registeredSite;
|
|
409
|
-
}
|
|
410
|
-
function getJmpContentConfig() {
|
|
411
|
-
const { analyticsUrl, trackingKey } = readJmpPublicEnvFromProcess();
|
|
412
|
-
if (!analyticsUrl || !trackingKey) {
|
|
413
|
-
return null;
|
|
414
|
-
}
|
|
415
|
-
const site = getJmpSiteDefinition();
|
|
416
|
-
return {
|
|
417
|
-
baseUrl: analyticsUrl,
|
|
418
|
-
trackingKey,
|
|
419
|
-
contentWrappers: site?.contentWrappers ?? void 0,
|
|
420
|
-
contentManifest: site?.contentManifest ?? void 0
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
|
|
424
458
|
// src/astro/register.ts
|
|
425
459
|
async function registerJmpAstroContent() {
|
|
426
460
|
const config = getJmpContentConfig();
|