@jmp-technologies/analytics 0.1.20 → 0.1.22
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 +7 -7
- package/dist/astro/client.cjs +93 -108
- package/dist/astro/client.cjs.map +1 -1
- package/dist/astro/client.d.cts +3 -12
- package/dist/astro/client.d.ts +3 -12
- package/dist/astro/client.js +4 -2
- package/dist/astro/client.js.map +1 -1
- package/dist/astro/content.cjs +106 -98
- package/dist/astro/content.cjs.map +1 -1
- package/dist/astro/content.d.cts +2 -2
- package/dist/astro/content.d.ts +2 -2
- package/dist/astro/content.js +3 -2
- package/dist/astro/integration.cjs +68 -60
- package/dist/astro/integration.cjs.map +1 -1
- package/dist/astro/integration.js +3 -2
- package/dist/astro/integration.js.map +1 -1
- package/dist/astro/middleware.cjs +66 -63
- 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 +68 -60
- package/dist/astro/register.cjs.map +1 -1
- package/dist/astro/register.js +3 -2
- package/dist/{chunk-UDNKWFBM.js → chunk-3U2BSIYX.js} +5 -3
- package/dist/{chunk-UDNKWFBM.js.map → chunk-3U2BSIYX.js.map} +1 -1
- package/dist/chunk-4OOWA55U.js +215 -0
- package/dist/chunk-4OOWA55U.js.map +1 -0
- package/dist/{chunk-GFCBZN6S.js → chunk-AHRVNEFV.js} +80 -276
- package/dist/chunk-AHRVNEFV.js.map +1 -0
- package/dist/{chunk-ALTSW5DB.js → chunk-DQ6A6HTY.js} +12 -8
- package/dist/chunk-DQ6A6HTY.js.map +1 -0
- package/dist/{chunk-QIWGUF7V.js → chunk-IYFVJ2EY.js} +6 -4
- package/dist/{chunk-QIWGUF7V.js.map → chunk-IYFVJ2EY.js.map} +1 -1
- package/dist/{chunk-NZS4M3V3.js → chunk-TEFKM3GW.js} +2 -2
- package/dist/chunk-TEFKM3GW.js.map +1 -0
- package/dist/create-jmp-analytics-BdGOgPxl.d.ts +70 -0
- package/dist/create-jmp-analytics-DxhHOmtR.d.cts +70 -0
- package/dist/env-public-B6Y0DG68.d.cts +14 -0
- package/dist/env-public-B6Y0DG68.d.ts +14 -0
- package/dist/index.cjs +203 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -340
- package/dist/index.d.ts +16 -340
- package/dist/index.js +9 -5
- package/dist/landing-capture-C8pyZWuF.d.cts +4 -0
- package/dist/landing-capture-C8pyZWuF.d.ts +4 -0
- package/dist/next/content.cjs +106 -98
- package/dist/next/content.cjs.map +1 -1
- package/dist/next/content.d.cts +2 -1
- package/dist/next/content.d.ts +2 -1
- package/dist/next/content.js +3 -2
- package/dist/next/content.js.map +1 -1
- package/dist/next/instrumentation.cjs +68 -60
- package/dist/next/instrumentation.cjs.map +1 -1
- package/dist/next/instrumentation.js +4 -2
- package/dist/next/instrumentation.js.map +1 -1
- package/dist/next/middleware.cjs +66 -63
- 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.cjs +152 -123
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +15 -3
- package/dist/next.d.ts +15 -3
- package/dist/next.js +45 -7
- package/dist/next.js.map +1 -1
- package/dist/react.cjs +115 -118
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -1
- package/dist/react.d.ts +2 -1
- package/dist/react.js +3 -2
- package/dist/site-config-BRuZWGSW.d.cts +46 -0
- package/dist/site-config-hkGMSeT7.d.ts +46 -0
- package/dist/{track-page-view-CoYo96n0.d.cts → track-page-view-BLS0YfL-.d.ts} +1 -1
- package/dist/{track-page-view-DAy0I0Vb.d.ts → track-page-view-DfCyWHqe.d.cts} +1 -1
- package/dist/types-BtiK_Acj.d.cts +224 -0
- package/dist/types-BtiK_Acj.d.ts +224 -0
- package/package.json +2 -4
- package/dist/chunk-ALTSW5DB.js.map +0 -1
- package/dist/chunk-GFCBZN6S.js.map +0 -1
- package/dist/chunk-NZS4M3V3.js.map +0 -1
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
-
import { JmpAnalytics } from './
|
|
3
|
+
import { J as JmpAnalytics } from './create-jmp-analytics-BdGOgPxl.js';
|
|
4
|
+
import './types-BtiK_Acj.js';
|
|
4
5
|
|
|
5
6
|
declare function useJmpAnalytics(): JmpAnalytics | null;
|
|
6
7
|
type JmpTrackedTelLinkProps = ComponentPropsWithoutRef<"a"> & {
|
package/dist/react.js
CHANGED
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
JmpTrackedMailtoLink,
|
|
4
4
|
JmpTrackedTelLink,
|
|
5
5
|
useJmpAnalytics
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-DQ6A6HTY.js";
|
|
7
|
+
import "./chunk-AHRVNEFV.js";
|
|
8
|
+
import "./chunk-4OOWA55U.js";
|
|
8
9
|
export {
|
|
9
10
|
JmpTrackedMailtoLink,
|
|
10
11
|
JmpTrackedTelLink,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { e as JmpContentWrapper, f as JmpContentConfig } from './types-BtiK_Acj.cjs';
|
|
2
|
+
|
|
3
|
+
/** Per-site values used when the dashboard profile is missing or fields are empty. */
|
|
4
|
+
type JmpSiteContactFallback = {
|
|
5
|
+
displayName?: string;
|
|
6
|
+
founderName?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
phone?: string | null;
|
|
9
|
+
linkedin?: string | null;
|
|
10
|
+
hours?: string | null;
|
|
11
|
+
serviceArea?: string | null;
|
|
12
|
+
dashboardDemoUrl?: string;
|
|
13
|
+
profilePhotoSrc?: string;
|
|
14
|
+
privacyUrl?: string;
|
|
15
|
+
termsUrl?: string;
|
|
16
|
+
};
|
|
17
|
+
type JmpSiteDefinition = {
|
|
18
|
+
/** Content tabs this site uses — reported via instrumentation capabilities. */
|
|
19
|
+
contentWrappers: JmpContentWrapper[];
|
|
20
|
+
/**
|
|
21
|
+
* Public site origin (no trailing slash), e.g. `https://example.com`.
|
|
22
|
+
* Used to resolve relative profile image paths in structured data.
|
|
23
|
+
*/
|
|
24
|
+
siteUrl?: string;
|
|
25
|
+
contactFallback?: JmpSiteContactFallback;
|
|
26
|
+
/**
|
|
27
|
+
* `extras` keys to read from the dashboard site profile (hyphenated keys from admin).
|
|
28
|
+
*/
|
|
29
|
+
contactExtraKeys?: {
|
|
30
|
+
founderName?: readonly string[];
|
|
31
|
+
dashboardDemoUrl?: readonly string[];
|
|
32
|
+
profilePhotoSrc?: readonly string[];
|
|
33
|
+
hours?: readonly string[];
|
|
34
|
+
serviceArea?: readonly string[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Register site-specific JMP integration options once (typically from `jmp.config.ts`).
|
|
39
|
+
* Call at module load time before server content or instrumentation runs.
|
|
40
|
+
*/
|
|
41
|
+
declare function defineJmpSite(definition: JmpSiteDefinition): JmpSiteDefinition;
|
|
42
|
+
declare function getJmpSiteDefinition(): JmpSiteDefinition | null;
|
|
43
|
+
/** Server content + lead config: env vars + wrappers from {@link defineJmpSite}. */
|
|
44
|
+
declare function getJmpContentConfig(): JmpContentConfig | null;
|
|
45
|
+
|
|
46
|
+
export { type JmpSiteContactFallback as J, type JmpSiteDefinition as a, getJmpSiteDefinition as b, defineJmpSite as d, getJmpContentConfig as g };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { e as JmpContentWrapper, f as JmpContentConfig } from './types-BtiK_Acj.js';
|
|
2
|
+
|
|
3
|
+
/** Per-site values used when the dashboard profile is missing or fields are empty. */
|
|
4
|
+
type JmpSiteContactFallback = {
|
|
5
|
+
displayName?: string;
|
|
6
|
+
founderName?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
phone?: string | null;
|
|
9
|
+
linkedin?: string | null;
|
|
10
|
+
hours?: string | null;
|
|
11
|
+
serviceArea?: string | null;
|
|
12
|
+
dashboardDemoUrl?: string;
|
|
13
|
+
profilePhotoSrc?: string;
|
|
14
|
+
privacyUrl?: string;
|
|
15
|
+
termsUrl?: string;
|
|
16
|
+
};
|
|
17
|
+
type JmpSiteDefinition = {
|
|
18
|
+
/** Content tabs this site uses — reported via instrumentation capabilities. */
|
|
19
|
+
contentWrappers: JmpContentWrapper[];
|
|
20
|
+
/**
|
|
21
|
+
* Public site origin (no trailing slash), e.g. `https://example.com`.
|
|
22
|
+
* Used to resolve relative profile image paths in structured data.
|
|
23
|
+
*/
|
|
24
|
+
siteUrl?: string;
|
|
25
|
+
contactFallback?: JmpSiteContactFallback;
|
|
26
|
+
/**
|
|
27
|
+
* `extras` keys to read from the dashboard site profile (hyphenated keys from admin).
|
|
28
|
+
*/
|
|
29
|
+
contactExtraKeys?: {
|
|
30
|
+
founderName?: readonly string[];
|
|
31
|
+
dashboardDemoUrl?: readonly string[];
|
|
32
|
+
profilePhotoSrc?: readonly string[];
|
|
33
|
+
hours?: readonly string[];
|
|
34
|
+
serviceArea?: readonly string[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Register site-specific JMP integration options once (typically from `jmp.config.ts`).
|
|
39
|
+
* Call at module load time before server content or instrumentation runs.
|
|
40
|
+
*/
|
|
41
|
+
declare function defineJmpSite(definition: JmpSiteDefinition): JmpSiteDefinition;
|
|
42
|
+
declare function getJmpSiteDefinition(): JmpSiteDefinition | null;
|
|
43
|
+
/** Server content + lead config: env vars + wrappers from {@link defineJmpSite}. */
|
|
44
|
+
declare function getJmpContentConfig(): JmpContentConfig | null;
|
|
45
|
+
|
|
46
|
+
export { type JmpSiteContactFallback as J, type JmpSiteDefinition as a, getJmpSiteDefinition as b, defineJmpSite as d, getJmpContentConfig as g };
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
type JmpEventType = "page_view" | "form_submit" | "call_click" | "email_click" | "contact_click";
|
|
2
|
+
type JmpAnalyticsConfig = {
|
|
3
|
+
/** Dashboard origin, e.g. https://analytics.example.com (no trailing slash) */
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** Per-website key from JMP admin */
|
|
6
|
+
trackingKey: string;
|
|
7
|
+
/** Log requests to console */
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
/** Override fetch (tests, React Native) */
|
|
10
|
+
fetchImpl?: typeof fetch;
|
|
11
|
+
/**
|
|
12
|
+
* Suppress duplicate `page_view` for the same path within this window (ms).
|
|
13
|
+
* Helps with React Strict Mode double-mount; typical: 500–1000.
|
|
14
|
+
*/
|
|
15
|
+
pageViewDedupeMs?: number;
|
|
16
|
+
/**
|
|
17
|
+
* When true, no events are sent until {@link setJmpTrackingConsent}(true).
|
|
18
|
+
* Pair with your cookie banner; see `NEXT_PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT`.
|
|
19
|
+
*/
|
|
20
|
+
requireConsent?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* When true, register a single delegated `click` listener that classifies links
|
|
23
|
+
* (SMS, WhatsApp, maps, scheduling) and records them via {@link trackContactClick}.
|
|
24
|
+
*
|
|
25
|
+
* Off by default — pair with privacy disclosure / consent before enabling.
|
|
26
|
+
* `tel:` / `mailto:` continue to use {@link trackCallClick} / {@link trackEmailClick}.
|
|
27
|
+
*
|
|
28
|
+
* Opt out per-link with `data-jmp-no-track` on an `<a>` (or an ancestor).
|
|
29
|
+
*/
|
|
30
|
+
autoTrackContactLinks?: boolean;
|
|
31
|
+
};
|
|
32
|
+
type JmpContentConfig = Pick<JmpAnalyticsConfig, "baseUrl" | "trackingKey" | "debug" | "fetchImpl"> & {
|
|
33
|
+
/**
|
|
34
|
+
* Content wrappers wired in this site's template (blog, faq, trust.*, contact).
|
|
35
|
+
* Reported via POST /api/content/capabilities so unused dashboard tabs stay hidden.
|
|
36
|
+
* Call {@link registerJmpContentWrappers} at startup / deploy.
|
|
37
|
+
*/
|
|
38
|
+
contentWrappers?: JmpContentWrapper[];
|
|
39
|
+
};
|
|
40
|
+
/** Top-level and trust sub-wrappers the client can declare. */
|
|
41
|
+
type JmpContentWrapper = "blog" | "faq" | "contact" | "trust" | "trust.summary" | "trust.testimonials" | "trust.reviews" | "trust.stats" | "trust.logos" | "trust.credentials";
|
|
42
|
+
type JmpBlogPost = {
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
slug: string;
|
|
46
|
+
excerpt: string | null;
|
|
47
|
+
body: string;
|
|
48
|
+
seo_title: string | null;
|
|
49
|
+
meta_description: string | null;
|
|
50
|
+
featured_image_url: string | null;
|
|
51
|
+
published_at: string | null;
|
|
52
|
+
updated_at: string;
|
|
53
|
+
};
|
|
54
|
+
type JmpFaqItem = {
|
|
55
|
+
id: string;
|
|
56
|
+
slug: string;
|
|
57
|
+
question: string;
|
|
58
|
+
answer: string;
|
|
59
|
+
category?: string | null;
|
|
60
|
+
sort_order: number;
|
|
61
|
+
updated_at: string;
|
|
62
|
+
};
|
|
63
|
+
type JmpTrustSummary = {
|
|
64
|
+
google_rating: number | null;
|
|
65
|
+
google_review_count: number | null;
|
|
66
|
+
google_reviews_url: string | null;
|
|
67
|
+
yelp_url: string | null;
|
|
68
|
+
trustpilot_url: string | null;
|
|
69
|
+
disclaimer: string | null;
|
|
70
|
+
};
|
|
71
|
+
type JmpTestimonial = {
|
|
72
|
+
id: string;
|
|
73
|
+
slug: string;
|
|
74
|
+
body: string;
|
|
75
|
+
author_name: string;
|
|
76
|
+
author_descriptor: string | null;
|
|
77
|
+
location: string | null;
|
|
78
|
+
/** 1–10 (half-star steps on a 5-star scale; 10 = 5.0 stars). */
|
|
79
|
+
rating: number | null;
|
|
80
|
+
image_url: string | null;
|
|
81
|
+
video_url: string | null;
|
|
82
|
+
/** Optional topic or service line (e.g. roofing). */
|
|
83
|
+
category: string | null;
|
|
84
|
+
/** Site section key — filter like FAQ `category` (e.g. testimonials, reviews). */
|
|
85
|
+
placement: string | null;
|
|
86
|
+
source: string | null;
|
|
87
|
+
/** Optional link to the original review on Google, Yelp, etc. */
|
|
88
|
+
source_url: string | null;
|
|
89
|
+
featured: boolean;
|
|
90
|
+
sort_order: number;
|
|
91
|
+
updated_at: string;
|
|
92
|
+
};
|
|
93
|
+
type JmpTrustStat = {
|
|
94
|
+
id: string;
|
|
95
|
+
slug: string;
|
|
96
|
+
label: string;
|
|
97
|
+
value: string;
|
|
98
|
+
sort_order: number;
|
|
99
|
+
updated_at: string;
|
|
100
|
+
};
|
|
101
|
+
type JmpPartnerLogo = {
|
|
102
|
+
id: string;
|
|
103
|
+
slug: string;
|
|
104
|
+
name: string;
|
|
105
|
+
image_url: string | null;
|
|
106
|
+
link_url: string | null;
|
|
107
|
+
sort_order: number;
|
|
108
|
+
updated_at: string;
|
|
109
|
+
};
|
|
110
|
+
type JmpCredential = {
|
|
111
|
+
id: string;
|
|
112
|
+
slug: string;
|
|
113
|
+
title: string;
|
|
114
|
+
issuer: string | null;
|
|
115
|
+
year: string | null;
|
|
116
|
+
image_url: string | null;
|
|
117
|
+
category: string | null;
|
|
118
|
+
sort_order: number;
|
|
119
|
+
updated_at: string;
|
|
120
|
+
};
|
|
121
|
+
type JmpTrustBundle = {
|
|
122
|
+
summary: JmpTrustSummary;
|
|
123
|
+
testimonials: JmpTestimonial[];
|
|
124
|
+
stats: JmpTrustStat[];
|
|
125
|
+
logos: JmpPartnerLogo[];
|
|
126
|
+
credentials: JmpCredential[];
|
|
127
|
+
};
|
|
128
|
+
type JmpSiteProfile = {
|
|
129
|
+
name: string;
|
|
130
|
+
display_name: string | null;
|
|
131
|
+
email: string | null;
|
|
132
|
+
phone: string | null;
|
|
133
|
+
address: string | null;
|
|
134
|
+
hours: string | null;
|
|
135
|
+
service_area: string | null;
|
|
136
|
+
google_maps_url: string | null;
|
|
137
|
+
social: {
|
|
138
|
+
linkedin: string | null;
|
|
139
|
+
instagram: string | null;
|
|
140
|
+
facebook: string | null;
|
|
141
|
+
x: string | null;
|
|
142
|
+
youtube: string | null;
|
|
143
|
+
};
|
|
144
|
+
cta: {
|
|
145
|
+
label: string | null;
|
|
146
|
+
url: string | null;
|
|
147
|
+
};
|
|
148
|
+
legal: {
|
|
149
|
+
privacy_policy_url: string | null;
|
|
150
|
+
terms_url: string | null;
|
|
151
|
+
};
|
|
152
|
+
/** Developer-defined keys; values filled by the client. */
|
|
153
|
+
extras: Record<string, string | null>;
|
|
154
|
+
};
|
|
155
|
+
type TrackPageViewOptions = {
|
|
156
|
+
path?: string;
|
|
157
|
+
source?: string;
|
|
158
|
+
device?: string;
|
|
159
|
+
country?: string;
|
|
160
|
+
metadata?: Record<string, unknown>;
|
|
161
|
+
};
|
|
162
|
+
type TrackLeadOptions = {
|
|
163
|
+
/** Path where the lead was submitted, e.g. /contact */
|
|
164
|
+
path?: string;
|
|
165
|
+
name?: string;
|
|
166
|
+
email?: string;
|
|
167
|
+
phone?: string;
|
|
168
|
+
company?: string;
|
|
169
|
+
website?: string;
|
|
170
|
+
subject?: string;
|
|
171
|
+
message?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Optional flexible metadata for dynamic lead forms.
|
|
174
|
+
* Prefer the normalized envelope (formId/formVersion/answers/derived/attribution),
|
|
175
|
+
* but unknown keys are also accepted by the API.
|
|
176
|
+
*/
|
|
177
|
+
metadata?: LeadMetadata;
|
|
178
|
+
/**
|
|
179
|
+
* Optional session id (from createJmpAnalytics internal session) if your app wants to pass it explicitly.
|
|
180
|
+
* Most callers should omit this.
|
|
181
|
+
*/
|
|
182
|
+
sessionId?: string;
|
|
183
|
+
};
|
|
184
|
+
type LeadMetadataValue = string | number | boolean | null | undefined | LeadMetadataValue[] | {
|
|
185
|
+
[key: string]: LeadMetadataValue;
|
|
186
|
+
};
|
|
187
|
+
type LeadMetadata = {
|
|
188
|
+
formId?: string;
|
|
189
|
+
formVersion?: string;
|
|
190
|
+
leadKind?: string;
|
|
191
|
+
answers?: Record<string, LeadMetadataValue>;
|
|
192
|
+
derived?: Record<string, LeadMetadataValue>;
|
|
193
|
+
attribution?: {
|
|
194
|
+
utm_source?: string;
|
|
195
|
+
utm_medium?: string;
|
|
196
|
+
utm_campaign?: string;
|
|
197
|
+
utm_content?: string;
|
|
198
|
+
utm_term?: string;
|
|
199
|
+
gclid?: string;
|
|
200
|
+
fbclid?: string;
|
|
201
|
+
msclkid?: string;
|
|
202
|
+
ttclid?: string;
|
|
203
|
+
[key: string]: LeadMetadataValue | undefined;
|
|
204
|
+
};
|
|
205
|
+
tags?: string[];
|
|
206
|
+
[key: string]: LeadMetadataValue | undefined;
|
|
207
|
+
};
|
|
208
|
+
type JmpServerRequestLike = {
|
|
209
|
+
url?: string;
|
|
210
|
+
headers: Pick<Headers, "get"> | Record<string, string | string[] | undefined | null>;
|
|
211
|
+
};
|
|
212
|
+
type TrackServerPageViewOptions = {
|
|
213
|
+
request?: JmpServerRequestLike;
|
|
214
|
+
/** Overrides request URL path. Use pathname + search when possible. */
|
|
215
|
+
path?: string;
|
|
216
|
+
/** Original visitor user agent. Useful when not passing `request`. */
|
|
217
|
+
userAgent?: string | null;
|
|
218
|
+
/** Original visitor referrer. Useful when not passing `request`. */
|
|
219
|
+
referer?: string | null;
|
|
220
|
+
metadata?: Record<string, unknown>;
|
|
221
|
+
sessionId?: string;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export type { JmpBlogPost as J, LeadMetadata as L, TrackPageViewOptions as T, JmpFaqItem as a, JmpSiteProfile as b, JmpTestimonial as c, JmpTrustBundle as d, JmpContentWrapper as e, JmpContentConfig as f, JmpServerRequestLike as g, JmpAnalyticsConfig as h, JmpEventType as i, TrackLeadOptions as j, TrackServerPageViewOptions as k, JmpCredential as l, JmpPartnerLogo as m, JmpTrustStat as n, JmpTrustSummary as o, LeadMetadataValue as p };
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
type JmpEventType = "page_view" | "form_submit" | "call_click" | "email_click" | "contact_click";
|
|
2
|
+
type JmpAnalyticsConfig = {
|
|
3
|
+
/** Dashboard origin, e.g. https://analytics.example.com (no trailing slash) */
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** Per-website key from JMP admin */
|
|
6
|
+
trackingKey: string;
|
|
7
|
+
/** Log requests to console */
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
/** Override fetch (tests, React Native) */
|
|
10
|
+
fetchImpl?: typeof fetch;
|
|
11
|
+
/**
|
|
12
|
+
* Suppress duplicate `page_view` for the same path within this window (ms).
|
|
13
|
+
* Helps with React Strict Mode double-mount; typical: 500–1000.
|
|
14
|
+
*/
|
|
15
|
+
pageViewDedupeMs?: number;
|
|
16
|
+
/**
|
|
17
|
+
* When true, no events are sent until {@link setJmpTrackingConsent}(true).
|
|
18
|
+
* Pair with your cookie banner; see `NEXT_PUBLIC_JMP_ANALYTICS_REQUIRE_CONSENT`.
|
|
19
|
+
*/
|
|
20
|
+
requireConsent?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* When true, register a single delegated `click` listener that classifies links
|
|
23
|
+
* (SMS, WhatsApp, maps, scheduling) and records them via {@link trackContactClick}.
|
|
24
|
+
*
|
|
25
|
+
* Off by default — pair with privacy disclosure / consent before enabling.
|
|
26
|
+
* `tel:` / `mailto:` continue to use {@link trackCallClick} / {@link trackEmailClick}.
|
|
27
|
+
*
|
|
28
|
+
* Opt out per-link with `data-jmp-no-track` on an `<a>` (or an ancestor).
|
|
29
|
+
*/
|
|
30
|
+
autoTrackContactLinks?: boolean;
|
|
31
|
+
};
|
|
32
|
+
type JmpContentConfig = Pick<JmpAnalyticsConfig, "baseUrl" | "trackingKey" | "debug" | "fetchImpl"> & {
|
|
33
|
+
/**
|
|
34
|
+
* Content wrappers wired in this site's template (blog, faq, trust.*, contact).
|
|
35
|
+
* Reported via POST /api/content/capabilities so unused dashboard tabs stay hidden.
|
|
36
|
+
* Call {@link registerJmpContentWrappers} at startup / deploy.
|
|
37
|
+
*/
|
|
38
|
+
contentWrappers?: JmpContentWrapper[];
|
|
39
|
+
};
|
|
40
|
+
/** Top-level and trust sub-wrappers the client can declare. */
|
|
41
|
+
type JmpContentWrapper = "blog" | "faq" | "contact" | "trust" | "trust.summary" | "trust.testimonials" | "trust.reviews" | "trust.stats" | "trust.logos" | "trust.credentials";
|
|
42
|
+
type JmpBlogPost = {
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
slug: string;
|
|
46
|
+
excerpt: string | null;
|
|
47
|
+
body: string;
|
|
48
|
+
seo_title: string | null;
|
|
49
|
+
meta_description: string | null;
|
|
50
|
+
featured_image_url: string | null;
|
|
51
|
+
published_at: string | null;
|
|
52
|
+
updated_at: string;
|
|
53
|
+
};
|
|
54
|
+
type JmpFaqItem = {
|
|
55
|
+
id: string;
|
|
56
|
+
slug: string;
|
|
57
|
+
question: string;
|
|
58
|
+
answer: string;
|
|
59
|
+
category?: string | null;
|
|
60
|
+
sort_order: number;
|
|
61
|
+
updated_at: string;
|
|
62
|
+
};
|
|
63
|
+
type JmpTrustSummary = {
|
|
64
|
+
google_rating: number | null;
|
|
65
|
+
google_review_count: number | null;
|
|
66
|
+
google_reviews_url: string | null;
|
|
67
|
+
yelp_url: string | null;
|
|
68
|
+
trustpilot_url: string | null;
|
|
69
|
+
disclaimer: string | null;
|
|
70
|
+
};
|
|
71
|
+
type JmpTestimonial = {
|
|
72
|
+
id: string;
|
|
73
|
+
slug: string;
|
|
74
|
+
body: string;
|
|
75
|
+
author_name: string;
|
|
76
|
+
author_descriptor: string | null;
|
|
77
|
+
location: string | null;
|
|
78
|
+
/** 1–10 (half-star steps on a 5-star scale; 10 = 5.0 stars). */
|
|
79
|
+
rating: number | null;
|
|
80
|
+
image_url: string | null;
|
|
81
|
+
video_url: string | null;
|
|
82
|
+
/** Optional topic or service line (e.g. roofing). */
|
|
83
|
+
category: string | null;
|
|
84
|
+
/** Site section key — filter like FAQ `category` (e.g. testimonials, reviews). */
|
|
85
|
+
placement: string | null;
|
|
86
|
+
source: string | null;
|
|
87
|
+
/** Optional link to the original review on Google, Yelp, etc. */
|
|
88
|
+
source_url: string | null;
|
|
89
|
+
featured: boolean;
|
|
90
|
+
sort_order: number;
|
|
91
|
+
updated_at: string;
|
|
92
|
+
};
|
|
93
|
+
type JmpTrustStat = {
|
|
94
|
+
id: string;
|
|
95
|
+
slug: string;
|
|
96
|
+
label: string;
|
|
97
|
+
value: string;
|
|
98
|
+
sort_order: number;
|
|
99
|
+
updated_at: string;
|
|
100
|
+
};
|
|
101
|
+
type JmpPartnerLogo = {
|
|
102
|
+
id: string;
|
|
103
|
+
slug: string;
|
|
104
|
+
name: string;
|
|
105
|
+
image_url: string | null;
|
|
106
|
+
link_url: string | null;
|
|
107
|
+
sort_order: number;
|
|
108
|
+
updated_at: string;
|
|
109
|
+
};
|
|
110
|
+
type JmpCredential = {
|
|
111
|
+
id: string;
|
|
112
|
+
slug: string;
|
|
113
|
+
title: string;
|
|
114
|
+
issuer: string | null;
|
|
115
|
+
year: string | null;
|
|
116
|
+
image_url: string | null;
|
|
117
|
+
category: string | null;
|
|
118
|
+
sort_order: number;
|
|
119
|
+
updated_at: string;
|
|
120
|
+
};
|
|
121
|
+
type JmpTrustBundle = {
|
|
122
|
+
summary: JmpTrustSummary;
|
|
123
|
+
testimonials: JmpTestimonial[];
|
|
124
|
+
stats: JmpTrustStat[];
|
|
125
|
+
logos: JmpPartnerLogo[];
|
|
126
|
+
credentials: JmpCredential[];
|
|
127
|
+
};
|
|
128
|
+
type JmpSiteProfile = {
|
|
129
|
+
name: string;
|
|
130
|
+
display_name: string | null;
|
|
131
|
+
email: string | null;
|
|
132
|
+
phone: string | null;
|
|
133
|
+
address: string | null;
|
|
134
|
+
hours: string | null;
|
|
135
|
+
service_area: string | null;
|
|
136
|
+
google_maps_url: string | null;
|
|
137
|
+
social: {
|
|
138
|
+
linkedin: string | null;
|
|
139
|
+
instagram: string | null;
|
|
140
|
+
facebook: string | null;
|
|
141
|
+
x: string | null;
|
|
142
|
+
youtube: string | null;
|
|
143
|
+
};
|
|
144
|
+
cta: {
|
|
145
|
+
label: string | null;
|
|
146
|
+
url: string | null;
|
|
147
|
+
};
|
|
148
|
+
legal: {
|
|
149
|
+
privacy_policy_url: string | null;
|
|
150
|
+
terms_url: string | null;
|
|
151
|
+
};
|
|
152
|
+
/** Developer-defined keys; values filled by the client. */
|
|
153
|
+
extras: Record<string, string | null>;
|
|
154
|
+
};
|
|
155
|
+
type TrackPageViewOptions = {
|
|
156
|
+
path?: string;
|
|
157
|
+
source?: string;
|
|
158
|
+
device?: string;
|
|
159
|
+
country?: string;
|
|
160
|
+
metadata?: Record<string, unknown>;
|
|
161
|
+
};
|
|
162
|
+
type TrackLeadOptions = {
|
|
163
|
+
/** Path where the lead was submitted, e.g. /contact */
|
|
164
|
+
path?: string;
|
|
165
|
+
name?: string;
|
|
166
|
+
email?: string;
|
|
167
|
+
phone?: string;
|
|
168
|
+
company?: string;
|
|
169
|
+
website?: string;
|
|
170
|
+
subject?: string;
|
|
171
|
+
message?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Optional flexible metadata for dynamic lead forms.
|
|
174
|
+
* Prefer the normalized envelope (formId/formVersion/answers/derived/attribution),
|
|
175
|
+
* but unknown keys are also accepted by the API.
|
|
176
|
+
*/
|
|
177
|
+
metadata?: LeadMetadata;
|
|
178
|
+
/**
|
|
179
|
+
* Optional session id (from createJmpAnalytics internal session) if your app wants to pass it explicitly.
|
|
180
|
+
* Most callers should omit this.
|
|
181
|
+
*/
|
|
182
|
+
sessionId?: string;
|
|
183
|
+
};
|
|
184
|
+
type LeadMetadataValue = string | number | boolean | null | undefined | LeadMetadataValue[] | {
|
|
185
|
+
[key: string]: LeadMetadataValue;
|
|
186
|
+
};
|
|
187
|
+
type LeadMetadata = {
|
|
188
|
+
formId?: string;
|
|
189
|
+
formVersion?: string;
|
|
190
|
+
leadKind?: string;
|
|
191
|
+
answers?: Record<string, LeadMetadataValue>;
|
|
192
|
+
derived?: Record<string, LeadMetadataValue>;
|
|
193
|
+
attribution?: {
|
|
194
|
+
utm_source?: string;
|
|
195
|
+
utm_medium?: string;
|
|
196
|
+
utm_campaign?: string;
|
|
197
|
+
utm_content?: string;
|
|
198
|
+
utm_term?: string;
|
|
199
|
+
gclid?: string;
|
|
200
|
+
fbclid?: string;
|
|
201
|
+
msclkid?: string;
|
|
202
|
+
ttclid?: string;
|
|
203
|
+
[key: string]: LeadMetadataValue | undefined;
|
|
204
|
+
};
|
|
205
|
+
tags?: string[];
|
|
206
|
+
[key: string]: LeadMetadataValue | undefined;
|
|
207
|
+
};
|
|
208
|
+
type JmpServerRequestLike = {
|
|
209
|
+
url?: string;
|
|
210
|
+
headers: Pick<Headers, "get"> | Record<string, string | string[] | undefined | null>;
|
|
211
|
+
};
|
|
212
|
+
type TrackServerPageViewOptions = {
|
|
213
|
+
request?: JmpServerRequestLike;
|
|
214
|
+
/** Overrides request URL path. Use pathname + search when possible. */
|
|
215
|
+
path?: string;
|
|
216
|
+
/** Original visitor user agent. Useful when not passing `request`. */
|
|
217
|
+
userAgent?: string | null;
|
|
218
|
+
/** Original visitor referrer. Useful when not passing `request`. */
|
|
219
|
+
referer?: string | null;
|
|
220
|
+
metadata?: Record<string, unknown>;
|
|
221
|
+
sessionId?: string;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export type { JmpBlogPost as J, LeadMetadata as L, TrackPageViewOptions as T, JmpFaqItem as a, JmpSiteProfile as b, JmpTestimonial as c, JmpTrustBundle as d, JmpContentWrapper as e, JmpContentConfig as f, JmpServerRequestLike as g, JmpAnalyticsConfig as h, JmpEventType as i, TrackLeadOptions as j, TrackServerPageViewOptions as k, JmpCredential as l, JmpPartnerLogo as m, JmpTrustStat as n, JmpTrustSummary as o, LeadMetadataValue as p };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmp-technologies/analytics",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "JMP Analytics tracking plus blog, FAQ, trust content, and site contact profile for client websites",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"keywords": [
|
|
@@ -118,7 +118,5 @@
|
|
|
118
118
|
"tsup": "^8.5.1",
|
|
119
119
|
"typescript": "^5.9.3"
|
|
120
120
|
},
|
|
121
|
-
"dependencies": {
|
|
122
|
-
"@jmp-technologies/analytics": "^0.1.10"
|
|
123
|
-
}
|
|
121
|
+
"dependencies": {}
|
|
124
122
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react.tsx"],"sourcesContent":["\"use client\"\n\nimport { useMemo, type ComponentPropsWithoutRef } from \"react\"\nimport type { JmpAnalytics } from \"./index\"\nimport { getOrCreateJmpAnalyticsFromBrowserEnv } from \"./index\"\n\nexport function useJmpAnalytics(): JmpAnalytics | null {\n return useMemo(() => getOrCreateJmpAnalyticsFromBrowserEnv(), [])\n}\n\nexport type JmpTrackedTelLinkProps = ComponentPropsWithoutRef<\"a\"> & {\n href: string\n}\n\n/**\n * `tel:` (or other) link that records a `call_click` with the current path.\n */\nexport function JmpTrackedTelLink({\n href,\n onClick,\n ...rest\n}: JmpTrackedTelLinkProps) {\n return (\n <a\n href={href}\n {...rest}\n onClick={(e) => {\n const client = getOrCreateJmpAnalyticsFromBrowserEnv()\n const path =\n typeof window !== \"undefined\" ? window.location.pathname : \"/\"\n void client?.trackCallClick(path)\n onClick?.(e)\n }}\n />\n )\n}\n\nexport type JmpTrackedMailtoLinkProps = ComponentPropsWithoutRef<\"a\"> & {\n href: string\n}\n\n/**\n * `mailto:` link that records an `email_click` with the current path.\n */\nexport function JmpTrackedMailtoLink({\n href,\n onClick,\n ...rest\n}: JmpTrackedMailtoLinkProps) {\n return (\n <a\n href={href}\n {...rest}\n onClick={(e) => {\n const client = getOrCreateJmpAnalyticsFromBrowserEnv()\n const path =\n typeof window !== \"undefined\" ? window.location.pathname : \"/\"\n void client?.trackEmailClick(path)\n onClick?.(e)\n }}\n />\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,eAA8C;AAqBnD;AAjBG,SAAS,kBAAuC;AACrD,SAAO,QAAQ,MAAM,sCAAsC,GAAG,CAAC,CAAC;AAClE;AASO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA2B;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG;AAAA,MACJ,SAAS,CAAC,MAAM;AACd,cAAM,SAAS,sCAAsC;AACrD,cAAM,OACJ,OAAO,WAAW,cAAc,OAAO,SAAS,WAAW;AAC7D,aAAK,QAAQ,eAAe,IAAI;AAChC,kBAAU,CAAC;AAAA,MACb;AAAA;AAAA,EACF;AAEJ;AASO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA8B;AAC5B,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG;AAAA,MACJ,SAAS,CAAC,MAAM;AACd,cAAM,SAAS,sCAAsC;AACrD,cAAM,OACJ,OAAO,WAAW,cAAc,OAAO,SAAS,WAAW;AAC7D,aAAK,QAAQ,gBAAgB,IAAI;AACjC,kBAAU,CAAC;AAAA,MACb;AAAA;AAAA,EACF;AAEJ;","names":[]}
|