@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.
Files changed (111) hide show
  1. package/README.md +1 -1
  2. package/dist/astro/client.cjs +82 -42
  3. package/dist/astro/client.cjs.map +1 -1
  4. package/dist/astro/client.d.cts +18 -0
  5. package/dist/astro/client.d.ts +18 -0
  6. package/dist/astro/client.js +2 -2
  7. package/dist/astro/content.cjs +99 -69
  8. package/dist/astro/content.cjs.map +1 -1
  9. package/dist/astro/content.d.cts +53 -0
  10. package/dist/astro/content.d.ts +53 -0
  11. package/dist/astro/content.js +3 -3
  12. package/dist/astro/integration.cjs +100 -66
  13. package/dist/astro/integration.cjs.map +1 -1
  14. package/dist/astro/integration.d.cts +36 -0
  15. package/dist/astro/integration.d.ts +36 -0
  16. package/dist/astro/integration.js +3 -3
  17. package/dist/astro/middleware.cjs +93 -66
  18. package/dist/astro/middleware.cjs.map +1 -1
  19. package/dist/astro/middleware.d.cts +19 -0
  20. package/dist/astro/middleware.d.ts +19 -0
  21. package/dist/astro/middleware.js +2 -2
  22. package/dist/astro/register.cjs +100 -66
  23. package/dist/astro/register.cjs.map +1 -1
  24. package/dist/astro/register.d.cts +7 -0
  25. package/dist/astro/register.d.ts +7 -0
  26. package/dist/astro/register.js +3 -3
  27. package/dist/{chunk-VUCOCFVE.js → chunk-D43AEUXU.js} +3 -3
  28. package/dist/{chunk-AIFJ7DVO.js → chunk-EMZXL6VF.js} +193 -105
  29. package/dist/chunk-EMZXL6VF.js.map +1 -0
  30. package/dist/{chunk-HFLU7HQE.js → chunk-PTXPNIMF.js} +2 -2
  31. package/dist/{chunk-6SMPRPQ3.js → chunk-RT2YYDCK.js} +12 -8
  32. package/dist/chunk-RT2YYDCK.js.map +1 -0
  33. package/dist/{chunk-4ZUW24F6.js → chunk-TN6PGIB5.js} +2 -2
  34. package/dist/{chunk-3ET7F6MZ.js → chunk-UHXWHKHJ.js} +3 -3
  35. package/dist/chunk-UHXWHKHJ.js.map +1 -0
  36. package/dist/{chunk-G322JCI3.js → chunk-VQF6QYLR.js} +3 -3
  37. package/dist/create-jmp-analytics-Bz0-K0Af.d.cts +69 -0
  38. package/dist/create-jmp-analytics-DRjrlWUn.d.ts +69 -0
  39. package/dist/env-public-B6Y0DG68.d.cts +14 -0
  40. package/dist/env-public-B6Y0DG68.d.ts +14 -0
  41. package/dist/index.cjs +105 -75
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.cts +110 -0
  44. package/dist/index.d.ts +110 -0
  45. package/dist/index.js +2 -2
  46. package/dist/landing-capture-C8pyZWuF.d.cts +4 -0
  47. package/dist/landing-capture-C8pyZWuF.d.ts +4 -0
  48. package/dist/next/content.cjs +99 -69
  49. package/dist/next/content.cjs.map +1 -1
  50. package/dist/next/content.d.cts +23 -0
  51. package/dist/next/content.d.ts +23 -0
  52. package/dist/next/content.js +3 -3
  53. package/dist/next/google-tag.d.cts +17 -0
  54. package/dist/next/google-tag.d.ts +17 -0
  55. package/dist/next/instrumentation.cjs +100 -66
  56. package/dist/next/instrumentation.cjs.map +1 -1
  57. package/dist/next/instrumentation.d.cts +7 -0
  58. package/dist/next/instrumentation.d.ts +7 -0
  59. package/dist/next/instrumentation.js +2 -2
  60. package/dist/next/landing-capture-script-server.d.cts +14 -0
  61. package/dist/next/landing-capture-script-server.d.ts +14 -0
  62. package/dist/next/landing-pages.cjs +151 -129
  63. package/dist/next/landing-pages.cjs.map +1 -1
  64. package/dist/next/landing-pages.d.cts +92 -0
  65. package/dist/next/landing-pages.d.ts +92 -0
  66. package/dist/next/landing-pages.js +7 -8
  67. package/dist/next/landing-pages.js.map +1 -1
  68. package/dist/next/locations.cjs +110 -88
  69. package/dist/next/locations.cjs.map +1 -1
  70. package/dist/next/locations.d.cts +55 -0
  71. package/dist/next/locations.d.ts +55 -0
  72. package/dist/next/locations.js +7 -8
  73. package/dist/next/locations.js.map +1 -1
  74. package/dist/next/middleware.cjs +93 -66
  75. package/dist/next/middleware.cjs.map +1 -1
  76. package/dist/next/middleware.d.cts +10 -0
  77. package/dist/next/middleware.d.ts +10 -0
  78. package/dist/next/middleware.js +2 -2
  79. package/dist/next/site-root-server.cjs +99 -69
  80. package/dist/next/site-root-server.cjs.map +1 -1
  81. package/dist/next/site-root-server.d.cts +24 -0
  82. package/dist/next/site-root-server.d.ts +24 -0
  83. package/dist/next/site-root-server.js +4 -4
  84. package/dist/next.cjs +36 -2
  85. package/dist/next.cjs.map +1 -1
  86. package/dist/next.d.cts +50 -0
  87. package/dist/next.d.ts +50 -0
  88. package/dist/next.js +4 -4
  89. package/dist/react.cjs +87 -53
  90. package/dist/react.cjs.map +1 -1
  91. package/dist/react.d.cts +22 -0
  92. package/dist/react.d.ts +22 -0
  93. package/dist/react.js +3 -3
  94. package/dist/site-config-BxEmJxBB.d.ts +74 -0
  95. package/dist/site-config-Cgq67uQ1.d.cts +74 -0
  96. package/dist/track-page-view-74Su6lQY.d.ts +12 -0
  97. package/dist/track-page-view-BCX1Dsfk.d.cts +12 -0
  98. package/dist/types-yNgoakwk.d.cts +397 -0
  99. package/dist/types-yNgoakwk.d.ts +397 -0
  100. package/dist/utils-BLoWWfSw.d.ts +15 -0
  101. package/dist/utils-UPTIdK1D.d.cts +15 -0
  102. package/package.json +3 -2
  103. package/dist/chunk-3ET7F6MZ.js.map +0 -1
  104. package/dist/chunk-6SMPRPQ3.js.map +0 -1
  105. package/dist/chunk-AIFJ7DVO.js.map +0 -1
  106. package/dist/chunk-RI3KKDPX.js +0 -75
  107. package/dist/chunk-RI3KKDPX.js.map +0 -1
  108. /package/dist/{chunk-VUCOCFVE.js.map → chunk-D43AEUXU.js.map} +0 -0
  109. /package/dist/{chunk-HFLU7HQE.js.map → chunk-PTXPNIMF.js.map} +0 -0
  110. /package/dist/{chunk-4ZUW24F6.js.map → chunk-TN6PGIB5.js.map} +0 -0
  111. /package/dist/{chunk-G322JCI3.js.map → chunk-VQF6QYLR.js.map} +0 -0
@@ -0,0 +1,110 @@
1
+ export { b as buildLandingCaptureInlineScript } from './landing-capture-C8pyZWuF.cjs';
2
+ import { J as JmpAnalytics } from './create-jmp-analytics-Bz0-K0Af.cjs';
3
+ export { B as BOOKING_LINK_HOSTS, C as ClassifiedContactLink, b as ContactLinkChannel, c as classifyContactHref, d as createJmpAnalytics, i as isJmpTrackingConsentGranted, s as setJmpTrackingConsent, a as subscribeJmpTrackingConsent } from './create-jmp-analytics-Bz0-K0Af.cjs';
4
+ import { n as JmpContentConfig, s as TrackServerPageViewOptions, i as JmpTrustBundle, l as JmpContentWrapper, d as JmpLandingPageKind, b as JmpLandingPage, c as JmpLandingPageDetail, f as JmpPopularPagesResult, J as JmpBlogPost, t as JmpBlogPostDetail, u as JmpFaqItemDetail, a as JmpFaqItem, e as JmpLandingPageSitemapEntry, k as JmpWebsiteLocationDetail, j as JmpWebsiteLocation, g as JmpSiteProfile, p as JmpAnalyticsConfig } from './types-yNgoakwk.cjs';
5
+ export { v as JmpContactExtraManifest, w as JmpContentLocaleAlternate, m as JmpContentManifest, x as JmpContentRouteManifest, y as JmpContentWrapperReportMode, z as JmpCredential, q as JmpEventType, A as JmpPartnerLogo, B as JmpPopularPage, o as JmpServerRequestLike, h as JmpTestimonial, C as JmpTrustBlockManifest, D as JmpTrustSection, E as JmpTrustStat, F as JmpTrustSummary, L as LeadMetadata, G as LeadMetadataValue, r as TrackLeadOptions, T as TrackPageViewOptions, H as normalizeJmpContentManifest, I as stableJmpManifestFingerprint } from './types-yNgoakwk.cjs';
6
+ export { J as JmpPublicEnv, r as readJmpPublicEnvFromProcess } from './env-public-B6Y0DG68.cjs';
7
+ export { a as JmpSiteContactFallback, b as JmpSiteDefinition, d as defineJmpSite, g as getJmpContentConfig, c as getJmpSiteDefinition } from './site-config-Cgq67uQ1.cjs';
8
+
9
+ /** Published package version — sent with capabilities for admin readiness. */
10
+ declare const JMP_ANALYTICS_SDK_VERSION: string;
11
+ /** `localStorage` key when {@link JmpAnalyticsConfig.requireConsent} is enabled. */
12
+ declare const JMP_TRACKING_CONSENT_STORAGE_KEY = "jmp_analytics_consent_v1";
13
+ /** Default `pageViewDedupeMs` when resolving browser config from env (Strict Mode / SPA). */
14
+ declare const DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS = 2500;
15
+
16
+ declare function trackJmpServerPageView(config: JmpContentConfig, options?: TrackServerPageViewOptions): Promise<void>;
17
+
18
+ declare function markContentWrapper(slot: JmpContentWrapper | string): void;
19
+ declare function inferTrustWrapperSlots(bundle: JmpTrustBundle): string[];
20
+ declare function getDiscoveredContentWrappers(): string[];
21
+ declare function resetContentWrapperDiscoveryForTests(): void;
22
+
23
+ declare function getJmpBlogPosts(config: JmpContentConfig, filters?: {
24
+ locale?: string;
25
+ }): Promise<JmpBlogPost[]>;
26
+ declare function getJmpBlogPost(config: JmpContentConfig, slug: string, locale?: string): Promise<JmpBlogPost | null>;
27
+ declare function getJmpBlogPostDetail(config: JmpContentConfig, slug: string, locale?: string): Promise<JmpBlogPostDetail | null>;
28
+ declare function getJmpFaqs(config: JmpContentConfig, filters?: {
29
+ locale?: string;
30
+ }): Promise<JmpFaqItem[]>;
31
+ declare function getJmpFaqDetail(config: JmpContentConfig, slug: string, locale?: string): Promise<JmpFaqItemDetail | null>;
32
+ declare function getJmpLandingPages(config: JmpContentConfig, filters?: {
33
+ kind?: JmpLandingPageKind;
34
+ locale?: string;
35
+ }): Promise<JmpLandingPage[]>;
36
+ declare function getJmpLandingPageDetail(config: JmpContentConfig, kind: JmpLandingPageKind, slug: string, locale?: string): Promise<JmpLandingPageDetail | null>;
37
+ declare function getJmpLandingPageSitemap(config: JmpContentConfig): Promise<JmpLandingPageSitemapEntry[]>;
38
+ declare function getJmpLocations(config: JmpContentConfig): Promise<JmpWebsiteLocation[]>;
39
+ declare function getJmpLocationDetail(config: JmpContentConfig, slug: string): Promise<JmpWebsiteLocationDetail | null>;
40
+ declare function getJmpTrustBundle(config: JmpContentConfig): Promise<JmpTrustBundle>;
41
+ declare function getJmpSiteProfile(config: JmpContentConfig): Promise<JmpSiteProfile>;
42
+ declare function getJmpRobotsTxt(config: JmpContentConfig): Promise<string>;
43
+ declare function getJmpPopularPages(config: JmpContentConfig, filters?: {
44
+ prefix?: string;
45
+ days?: number;
46
+ limit?: number;
47
+ }): Promise<JmpPopularPagesResult>;
48
+ /**
49
+ * Tell the JMP dashboard which content wrappers this site wires (blog, faq, trust.*, contact).
50
+ * Uses auto-discovered slots from content API usage unless `contentWrapperMode` is `manual`.
51
+ * Safe to call on every cold start; dedupes by tracking key + wrapper list.
52
+ */
53
+ declare function registerJmpContentWrappers(config: JmpContentConfig): Promise<{
54
+ ok: true;
55
+ wrappers: string[];
56
+ } | {
57
+ ok: false;
58
+ skipped: true;
59
+ }>;
60
+
61
+ declare function createJmpContentClient(config: JmpContentConfig): {
62
+ getBlogPosts: (filters?: {
63
+ locale?: string;
64
+ }) => Promise<JmpBlogPost[]>;
65
+ getBlogPost: (slug: string, locale?: string) => Promise<JmpBlogPost | null>;
66
+ getFaqs: (filters?: {
67
+ locale?: string;
68
+ }) => Promise<JmpFaqItem[]>;
69
+ getLandingPages: (filters?: Parameters<typeof getJmpLandingPages>[1]) => Promise<JmpLandingPage[]>;
70
+ getLandingPageDetail: (kind: Parameters<typeof getJmpLandingPageDetail>[1], slug: string, locale?: string) => Promise<JmpLandingPageDetail | null>;
71
+ getLandingPageSitemap: () => Promise<JmpLandingPageSitemapEntry[]>;
72
+ getTrustBundle: () => Promise<JmpTrustBundle>;
73
+ getSiteProfile: () => Promise<JmpSiteProfile>;
74
+ getRobotsTxt: () => Promise<string>;
75
+ getPopularPages: (filters?: Parameters<typeof getJmpPopularPages>[1]) => Promise<JmpPopularPagesResult>;
76
+ registerContentWrappers: () => Promise<{
77
+ ok: true;
78
+ wrappers: string[];
79
+ } | {
80
+ ok: false;
81
+ skipped: true;
82
+ }>;
83
+ };
84
+ type JmpContentClient = ReturnType<typeof createJmpContentClient>;
85
+
86
+ /**
87
+ * Browser / client bundle: reads `NEXT_PUBLIC_*` or Astro `PUBLIC_*` vars.
88
+ * Use for `createJmpAnalytics` on the client. Returns `null` if incomplete.
89
+ */
90
+ declare function getJmpBrowserAnalyticsConfigFromEnv(overrides?: Partial<JmpAnalyticsConfig>): JmpAnalyticsConfig | null;
91
+ /**
92
+ * Server / Node (SSR, Route Handlers, `getStaticProps`, etc.):
93
+ * Same **`NEXT_PUBLIC_*`** vars as the browser (`NEXT_PUBLIC_JMP_ANALYTICS_URL` +
94
+ * `NEXT_PUBLIC_JMP_TRACKING_KEY`). Next.js injects these on the server for RSC/fetches.
95
+ * Returns `null` if incomplete.
96
+ */
97
+ declare function getJmpServerContentConfigFromEnv(overrides?: Partial<JmpContentConfig>): JmpContentConfig | null;
98
+ declare function isJmpBrowserAnalyticsEnvConfigured(): boolean;
99
+ declare function isJmpServerContentEnvConfigured(): boolean;
100
+ /**
101
+ * One `JmpAnalytics` instance per browser tab (module singleton). Safe for page views and events.
102
+ * Returns `null` on the server or when public env vars are missing.
103
+ */
104
+ declare function getOrCreateJmpAnalyticsFromBrowserEnv(overrides?: Partial<JmpAnalyticsConfig>): JmpAnalytics | null;
105
+ /**
106
+ * `createJmpContentClient` using server env resolution. Returns `null` if env is incomplete.
107
+ */
108
+ declare function createJmpContentClientFromServerEnv(overrides?: Partial<JmpContentConfig>): JmpContentClient | null;
109
+
110
+ export { DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS, JMP_ANALYTICS_SDK_VERSION, JMP_TRACKING_CONSENT_STORAGE_KEY, JmpAnalytics, JmpAnalyticsConfig, JmpBlogPost, JmpBlogPostDetail, type JmpContentClient, JmpContentConfig, JmpContentWrapper, JmpFaqItem, JmpFaqItemDetail, JmpLandingPage, JmpLandingPageDetail, JmpLandingPageKind, JmpLandingPageSitemapEntry, JmpPopularPagesResult, JmpSiteProfile, JmpTrustBundle, JmpWebsiteLocation, JmpWebsiteLocationDetail, TrackServerPageViewOptions, createJmpContentClient, createJmpContentClientFromServerEnv, getDiscoveredContentWrappers, getJmpBlogPost, getJmpBlogPostDetail, getJmpBlogPosts, getJmpBrowserAnalyticsConfigFromEnv, getJmpFaqDetail, getJmpFaqs, getJmpLandingPageDetail, getJmpLandingPageSitemap, getJmpLandingPages, getJmpLocationDetail, getJmpLocations, getJmpPopularPages, getJmpRobotsTxt, getJmpServerContentConfigFromEnv, getJmpSiteProfile, getJmpTrustBundle, getOrCreateJmpAnalyticsFromBrowserEnv, inferTrustWrapperSlots, isJmpBrowserAnalyticsEnvConfigured, isJmpServerContentEnvConfigured, markContentWrapper, registerJmpContentWrappers, resetContentWrapperDiscoveryForTests, trackJmpServerPageView };
@@ -0,0 +1,110 @@
1
+ export { b as buildLandingCaptureInlineScript } from './landing-capture-C8pyZWuF.js';
2
+ import { J as JmpAnalytics } from './create-jmp-analytics-DRjrlWUn.js';
3
+ export { B as BOOKING_LINK_HOSTS, C as ClassifiedContactLink, b as ContactLinkChannel, c as classifyContactHref, d as createJmpAnalytics, i as isJmpTrackingConsentGranted, s as setJmpTrackingConsent, a as subscribeJmpTrackingConsent } from './create-jmp-analytics-DRjrlWUn.js';
4
+ import { n as JmpContentConfig, s as TrackServerPageViewOptions, i as JmpTrustBundle, l as JmpContentWrapper, d as JmpLandingPageKind, b as JmpLandingPage, c as JmpLandingPageDetail, f as JmpPopularPagesResult, J as JmpBlogPost, t as JmpBlogPostDetail, u as JmpFaqItemDetail, a as JmpFaqItem, e as JmpLandingPageSitemapEntry, k as JmpWebsiteLocationDetail, j as JmpWebsiteLocation, g as JmpSiteProfile, p as JmpAnalyticsConfig } from './types-yNgoakwk.js';
5
+ export { v as JmpContactExtraManifest, w as JmpContentLocaleAlternate, m as JmpContentManifest, x as JmpContentRouteManifest, y as JmpContentWrapperReportMode, z as JmpCredential, q as JmpEventType, A as JmpPartnerLogo, B as JmpPopularPage, o as JmpServerRequestLike, h as JmpTestimonial, C as JmpTrustBlockManifest, D as JmpTrustSection, E as JmpTrustStat, F as JmpTrustSummary, L as LeadMetadata, G as LeadMetadataValue, r as TrackLeadOptions, T as TrackPageViewOptions, H as normalizeJmpContentManifest, I as stableJmpManifestFingerprint } from './types-yNgoakwk.js';
6
+ export { J as JmpPublicEnv, r as readJmpPublicEnvFromProcess } from './env-public-B6Y0DG68.js';
7
+ export { a as JmpSiteContactFallback, b as JmpSiteDefinition, d as defineJmpSite, g as getJmpContentConfig, c as getJmpSiteDefinition } from './site-config-BxEmJxBB.js';
8
+
9
+ /** Published package version — sent with capabilities for admin readiness. */
10
+ declare const JMP_ANALYTICS_SDK_VERSION: string;
11
+ /** `localStorage` key when {@link JmpAnalyticsConfig.requireConsent} is enabled. */
12
+ declare const JMP_TRACKING_CONSENT_STORAGE_KEY = "jmp_analytics_consent_v1";
13
+ /** Default `pageViewDedupeMs` when resolving browser config from env (Strict Mode / SPA). */
14
+ declare const DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS = 2500;
15
+
16
+ declare function trackJmpServerPageView(config: JmpContentConfig, options?: TrackServerPageViewOptions): Promise<void>;
17
+
18
+ declare function markContentWrapper(slot: JmpContentWrapper | string): void;
19
+ declare function inferTrustWrapperSlots(bundle: JmpTrustBundle): string[];
20
+ declare function getDiscoveredContentWrappers(): string[];
21
+ declare function resetContentWrapperDiscoveryForTests(): void;
22
+
23
+ declare function getJmpBlogPosts(config: JmpContentConfig, filters?: {
24
+ locale?: string;
25
+ }): Promise<JmpBlogPost[]>;
26
+ declare function getJmpBlogPost(config: JmpContentConfig, slug: string, locale?: string): Promise<JmpBlogPost | null>;
27
+ declare function getJmpBlogPostDetail(config: JmpContentConfig, slug: string, locale?: string): Promise<JmpBlogPostDetail | null>;
28
+ declare function getJmpFaqs(config: JmpContentConfig, filters?: {
29
+ locale?: string;
30
+ }): Promise<JmpFaqItem[]>;
31
+ declare function getJmpFaqDetail(config: JmpContentConfig, slug: string, locale?: string): Promise<JmpFaqItemDetail | null>;
32
+ declare function getJmpLandingPages(config: JmpContentConfig, filters?: {
33
+ kind?: JmpLandingPageKind;
34
+ locale?: string;
35
+ }): Promise<JmpLandingPage[]>;
36
+ declare function getJmpLandingPageDetail(config: JmpContentConfig, kind: JmpLandingPageKind, slug: string, locale?: string): Promise<JmpLandingPageDetail | null>;
37
+ declare function getJmpLandingPageSitemap(config: JmpContentConfig): Promise<JmpLandingPageSitemapEntry[]>;
38
+ declare function getJmpLocations(config: JmpContentConfig): Promise<JmpWebsiteLocation[]>;
39
+ declare function getJmpLocationDetail(config: JmpContentConfig, slug: string): Promise<JmpWebsiteLocationDetail | null>;
40
+ declare function getJmpTrustBundle(config: JmpContentConfig): Promise<JmpTrustBundle>;
41
+ declare function getJmpSiteProfile(config: JmpContentConfig): Promise<JmpSiteProfile>;
42
+ declare function getJmpRobotsTxt(config: JmpContentConfig): Promise<string>;
43
+ declare function getJmpPopularPages(config: JmpContentConfig, filters?: {
44
+ prefix?: string;
45
+ days?: number;
46
+ limit?: number;
47
+ }): Promise<JmpPopularPagesResult>;
48
+ /**
49
+ * Tell the JMP dashboard which content wrappers this site wires (blog, faq, trust.*, contact).
50
+ * Uses auto-discovered slots from content API usage unless `contentWrapperMode` is `manual`.
51
+ * Safe to call on every cold start; dedupes by tracking key + wrapper list.
52
+ */
53
+ declare function registerJmpContentWrappers(config: JmpContentConfig): Promise<{
54
+ ok: true;
55
+ wrappers: string[];
56
+ } | {
57
+ ok: false;
58
+ skipped: true;
59
+ }>;
60
+
61
+ declare function createJmpContentClient(config: JmpContentConfig): {
62
+ getBlogPosts: (filters?: {
63
+ locale?: string;
64
+ }) => Promise<JmpBlogPost[]>;
65
+ getBlogPost: (slug: string, locale?: string) => Promise<JmpBlogPost | null>;
66
+ getFaqs: (filters?: {
67
+ locale?: string;
68
+ }) => Promise<JmpFaqItem[]>;
69
+ getLandingPages: (filters?: Parameters<typeof getJmpLandingPages>[1]) => Promise<JmpLandingPage[]>;
70
+ getLandingPageDetail: (kind: Parameters<typeof getJmpLandingPageDetail>[1], slug: string, locale?: string) => Promise<JmpLandingPageDetail | null>;
71
+ getLandingPageSitemap: () => Promise<JmpLandingPageSitemapEntry[]>;
72
+ getTrustBundle: () => Promise<JmpTrustBundle>;
73
+ getSiteProfile: () => Promise<JmpSiteProfile>;
74
+ getRobotsTxt: () => Promise<string>;
75
+ getPopularPages: (filters?: Parameters<typeof getJmpPopularPages>[1]) => Promise<JmpPopularPagesResult>;
76
+ registerContentWrappers: () => Promise<{
77
+ ok: true;
78
+ wrappers: string[];
79
+ } | {
80
+ ok: false;
81
+ skipped: true;
82
+ }>;
83
+ };
84
+ type JmpContentClient = ReturnType<typeof createJmpContentClient>;
85
+
86
+ /**
87
+ * Browser / client bundle: reads `NEXT_PUBLIC_*` or Astro `PUBLIC_*` vars.
88
+ * Use for `createJmpAnalytics` on the client. Returns `null` if incomplete.
89
+ */
90
+ declare function getJmpBrowserAnalyticsConfigFromEnv(overrides?: Partial<JmpAnalyticsConfig>): JmpAnalyticsConfig | null;
91
+ /**
92
+ * Server / Node (SSR, Route Handlers, `getStaticProps`, etc.):
93
+ * Same **`NEXT_PUBLIC_*`** vars as the browser (`NEXT_PUBLIC_JMP_ANALYTICS_URL` +
94
+ * `NEXT_PUBLIC_JMP_TRACKING_KEY`). Next.js injects these on the server for RSC/fetches.
95
+ * Returns `null` if incomplete.
96
+ */
97
+ declare function getJmpServerContentConfigFromEnv(overrides?: Partial<JmpContentConfig>): JmpContentConfig | null;
98
+ declare function isJmpBrowserAnalyticsEnvConfigured(): boolean;
99
+ declare function isJmpServerContentEnvConfigured(): boolean;
100
+ /**
101
+ * One `JmpAnalytics` instance per browser tab (module singleton). Safe for page views and events.
102
+ * Returns `null` on the server or when public env vars are missing.
103
+ */
104
+ declare function getOrCreateJmpAnalyticsFromBrowserEnv(overrides?: Partial<JmpAnalyticsConfig>): JmpAnalytics | null;
105
+ /**
106
+ * `createJmpContentClient` using server env resolution. Returns `null` if env is incomplete.
107
+ */
108
+ declare function createJmpContentClientFromServerEnv(overrides?: Partial<JmpContentConfig>): JmpContentClient | null;
109
+
110
+ export { DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS, JMP_ANALYTICS_SDK_VERSION, JMP_TRACKING_CONSENT_STORAGE_KEY, JmpAnalytics, JmpAnalyticsConfig, JmpBlogPost, JmpBlogPostDetail, type JmpContentClient, JmpContentConfig, JmpContentWrapper, JmpFaqItem, JmpFaqItemDetail, JmpLandingPage, JmpLandingPageDetail, JmpLandingPageKind, JmpLandingPageSitemapEntry, JmpPopularPagesResult, JmpSiteProfile, JmpTrustBundle, JmpWebsiteLocation, JmpWebsiteLocationDetail, TrackServerPageViewOptions, createJmpContentClient, createJmpContentClientFromServerEnv, getDiscoveredContentWrappers, getJmpBlogPost, getJmpBlogPostDetail, getJmpBlogPosts, getJmpBrowserAnalyticsConfigFromEnv, getJmpFaqDetail, getJmpFaqs, getJmpLandingPageDetail, getJmpLandingPageSitemap, getJmpLandingPages, getJmpLocationDetail, getJmpLocations, getJmpPopularPages, getJmpRobotsTxt, getJmpServerContentConfigFromEnv, getJmpSiteProfile, getJmpTrustBundle, getOrCreateJmpAnalyticsFromBrowserEnv, inferTrustWrapperSlots, isJmpBrowserAnalyticsEnvConfigured, isJmpServerContentEnvConfigured, markContentWrapper, registerJmpContentWrappers, resetContentWrapperDiscoveryForTests, trackJmpServerPageView };
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  setJmpTrackingConsent,
37
37
  stableJmpManifestFingerprint,
38
38
  subscribeJmpTrackingConsent
39
- } from "./chunk-6SMPRPQ3.js";
39
+ } from "./chunk-RT2YYDCK.js";
40
40
  import {
41
41
  buildLandingCaptureInlineScript
42
42
  } from "./chunk-TCZ6TC2L.js";
@@ -46,7 +46,7 @@ import {
46
46
  getJmpSiteDefinition,
47
47
  readJmpPublicEnvFromProcess,
48
48
  trackJmpServerPageView
49
- } from "./chunk-AIFJ7DVO.js";
49
+ } from "./chunk-EMZXL6VF.js";
50
50
  export {
51
51
  BOOKING_LINK_HOSTS,
52
52
  DEFAULT_JMP_BROWSER_PAGE_VIEW_DEDUPE_MS,
@@ -0,0 +1,4 @@
1
+ /** Inline script for Next.js `beforeInteractive` — capture referrer/UTM only (no network). */
2
+ declare function buildLandingCaptureInlineScript(): string;
3
+
4
+ export { buildLandingCaptureInlineScript as b };
@@ -0,0 +1,4 @@
1
+ /** Inline script for Next.js `beforeInteractive` — capture referrer/UTM only (no network). */
2
+ declare function buildLandingCaptureInlineScript(): string;
3
+
4
+ export { buildLandingCaptureInlineScript as b };
@@ -46,7 +46,7 @@ var import_react = require("react");
46
46
  var LANDING_REFERER_COOKIE_MAX_AGE_SEC = 30 * 60;
47
47
 
48
48
  // package.json
49
- var version = "0.1.35";
49
+ var version = "0.1.37";
50
50
 
51
51
  // src/constants.ts
52
52
  var JMP_ANALYTICS_SDK_VERSION = version;
@@ -60,6 +60,97 @@ function normalizeBaseUrl(baseUrl) {
60
60
  return baseUrl.replace(/\/$/, "");
61
61
  }
62
62
 
63
+ // src/env-public.ts
64
+ function firstDefined(...values) {
65
+ for (const v of values) {
66
+ if (v) return v;
67
+ }
68
+ return void 0;
69
+ }
70
+ function readJmpPublicEnvFromProcessEnv() {
71
+ if (typeof process === "undefined" || !process.env) {
72
+ return {};
73
+ }
74
+ const { env } = process;
75
+ const analyticsUrl = firstDefined(
76
+ env.NEXT_PUBLIC_JMP_ANALYTICS_URL,
77
+ env.PUBLIC_JMP_ANALYTICS_URL
78
+ );
79
+ const trackingKey = firstDefined(
80
+ env.NEXT_PUBLIC_JMP_TRACKING_KEY,
81
+ env.PUBLIC_JMP_TRACKING_KEY
82
+ );
83
+ const requireConsentRaw = firstDefined(
84
+ env.NEXT_PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT,
85
+ env.PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT
86
+ );
87
+ const autoContactRaw = firstDefined(
88
+ env.NEXT_PUBLIC_JMP_AUTO_CONTACT_LINKS,
89
+ env.PUBLIC_JMP_AUTO_CONTACT_LINKS
90
+ );
91
+ return {
92
+ analyticsUrl,
93
+ trackingKey,
94
+ requireConsent: requireConsentRaw === "true",
95
+ autoContactLinks: autoContactRaw === "true"
96
+ };
97
+ }
98
+ function readJmpPublicEnvFromProcess(overrides) {
99
+ const fromEnv = readJmpPublicEnvFromProcessEnv();
100
+ return {
101
+ analyticsUrl: firstDefined(overrides?.analyticsUrl, fromEnv.analyticsUrl),
102
+ trackingKey: firstDefined(overrides?.trackingKey, fromEnv.trackingKey),
103
+ requireConsent: overrides?.requireConsent ?? fromEnv.requireConsent,
104
+ autoContactLinks: overrides?.autoContactLinks ?? fromEnv.autoContactLinks
105
+ };
106
+ }
107
+
108
+ // src/site-config.ts
109
+ var registeredSite = null;
110
+ function getJmpSiteDefinition() {
111
+ return registeredSite;
112
+ }
113
+ function getJmpContentConfig() {
114
+ const { analyticsUrl, trackingKey } = readJmpPublicEnvFromProcess();
115
+ if (!analyticsUrl || !trackingKey) {
116
+ return null;
117
+ }
118
+ const site = getJmpSiteDefinition();
119
+ return {
120
+ baseUrl: analyticsUrl,
121
+ trackingKey,
122
+ contentWrappers: site?.contentWrappers ?? void 0,
123
+ contentManifest: site?.contentManifest ?? void 0
124
+ };
125
+ }
126
+
127
+ // src/landing-pages/utils.ts
128
+ function resolveJmpSiteUrl(override) {
129
+ const fromArg = override?.trim().replace(/\/$/, "");
130
+ if (fromArg) return fromArg;
131
+ const fromConfig = getJmpSiteDefinition()?.siteUrl?.trim().replace(/\/$/, "");
132
+ return fromConfig || null;
133
+ }
134
+
135
+ // src/request-origin.ts
136
+ function resolveJmpRequestOrigin() {
137
+ const fromSite = resolveJmpSiteUrl();
138
+ if (fromSite) {
139
+ return fromSite;
140
+ }
141
+ if (typeof process === "undefined") {
142
+ return null;
143
+ }
144
+ return process.env.NEXT_PUBLIC_SITE_URL?.trim().replace(/\/$/, "") || null;
145
+ }
146
+ function withJmpOriginHeader(headers) {
147
+ const origin = resolveJmpRequestOrigin();
148
+ if (!origin) {
149
+ return headers;
150
+ }
151
+ return { ...headers, Origin: origin };
152
+ }
153
+
63
154
  // src/content/manifest.ts
64
155
  var JMP_CONTENT_MANIFEST_VERSION = 1;
65
156
  var TRUST_SECTIONS = /* @__PURE__ */ new Set([
@@ -264,6 +355,11 @@ function inferWrapperSlotsFromManifest(manifest) {
264
355
  }
265
356
 
266
357
  // src/content/fetch.ts
358
+ function jmpContentRequestHeaders(config) {
359
+ return withJmpOriginHeader({
360
+ "X-JMP-Tracking-Key": config.trackingKey
361
+ });
362
+ }
267
363
  async function getContent(config, path) {
268
364
  const text = await getContentText(config, path);
269
365
  try {
@@ -286,9 +382,7 @@ async function getContentText(config, path) {
286
382
  }
287
383
  const res = await resolvedFetch(url, {
288
384
  method: "GET",
289
- headers: {
290
- "X-JMP-Tracking-Key": config.trackingKey
291
- }
385
+ headers: jmpContentRequestHeaders(config)
292
386
  });
293
387
  const text = await res.text();
294
388
  if (!res.ok) {
@@ -631,7 +725,7 @@ async function registerJmpContentWrappers(config) {
631
725
  method: "POST",
632
726
  headers: {
633
727
  "Content-Type": "application/json",
634
- "X-JMP-Tracking-Key": config.trackingKey
728
+ ...jmpContentRequestHeaders(config)
635
729
  },
636
730
  body: JSON.stringify(body)
637
731
  });
@@ -653,70 +747,6 @@ async function registerJmpContentWrappers(config) {
653
747
  }
654
748
  setContentWrapperSyncHandler(registerJmpContentWrappers);
655
749
 
656
- // src/env-public.ts
657
- function firstDefined(...values) {
658
- for (const v of values) {
659
- if (v) return v;
660
- }
661
- return void 0;
662
- }
663
- function readJmpPublicEnvFromProcessEnv() {
664
- if (typeof process === "undefined" || !process.env) {
665
- return {};
666
- }
667
- const { env } = process;
668
- const analyticsUrl = firstDefined(
669
- env.NEXT_PUBLIC_JMP_ANALYTICS_URL,
670
- env.PUBLIC_JMP_ANALYTICS_URL
671
- );
672
- const trackingKey = firstDefined(
673
- env.NEXT_PUBLIC_JMP_TRACKING_KEY,
674
- env.PUBLIC_JMP_TRACKING_KEY
675
- );
676
- const requireConsentRaw = firstDefined(
677
- env.NEXT_PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT,
678
- env.PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT
679
- );
680
- const autoContactRaw = firstDefined(
681
- env.NEXT_PUBLIC_JMP_AUTO_CONTACT_LINKS,
682
- env.PUBLIC_JMP_AUTO_CONTACT_LINKS
683
- );
684
- return {
685
- analyticsUrl,
686
- trackingKey,
687
- requireConsent: requireConsentRaw === "true",
688
- autoContactLinks: autoContactRaw === "true"
689
- };
690
- }
691
- function readJmpPublicEnvFromProcess(overrides) {
692
- const fromEnv = readJmpPublicEnvFromProcessEnv();
693
- return {
694
- analyticsUrl: firstDefined(overrides?.analyticsUrl, fromEnv.analyticsUrl),
695
- trackingKey: firstDefined(overrides?.trackingKey, fromEnv.trackingKey),
696
- requireConsent: overrides?.requireConsent ?? fromEnv.requireConsent,
697
- autoContactLinks: overrides?.autoContactLinks ?? fromEnv.autoContactLinks
698
- };
699
- }
700
-
701
- // src/site-config.ts
702
- var registeredSite = null;
703
- function getJmpSiteDefinition() {
704
- return registeredSite;
705
- }
706
- function getJmpContentConfig() {
707
- const { analyticsUrl, trackingKey } = readJmpPublicEnvFromProcess();
708
- if (!analyticsUrl || !trackingKey) {
709
- return null;
710
- }
711
- const site = getJmpSiteDefinition();
712
- return {
713
- baseUrl: analyticsUrl,
714
- trackingKey,
715
- contentWrappers: site?.contentWrappers ?? void 0,
716
- contentManifest: site?.contentManifest ?? void 0
717
- };
718
- }
719
-
720
750
  // src/content/site-content.ts
721
751
  var DEFAULT_EXTRA_KEYS = {
722
752
  founderName: ["founder-name", "founder_name"],