@jmp-technologies/analytics 0.1.30 → 0.1.32

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 (86) hide show
  1. package/dist/astro/client.cjs +30 -2
  2. package/dist/astro/client.cjs.map +1 -1
  3. package/dist/astro/client.d.cts +2 -2
  4. package/dist/astro/client.d.ts +2 -2
  5. package/dist/astro/client.js +1 -1
  6. package/dist/astro/content.cjs +55 -0
  7. package/dist/astro/content.cjs.map +1 -1
  8. package/dist/astro/content.d.cts +6 -4
  9. package/dist/astro/content.d.ts +6 -4
  10. package/dist/astro/content.js +6 -2
  11. package/dist/astro/integration.cjs.map +1 -1
  12. package/dist/astro/integration.js +2 -2
  13. package/dist/astro/middleware.d.cts +2 -2
  14. package/dist/astro/middleware.d.ts +2 -2
  15. package/dist/astro/register.cjs.map +1 -1
  16. package/dist/astro/register.js +2 -2
  17. package/dist/{chunk-ZEC22LFP.js → chunk-7623G3XL.js} +2 -2
  18. package/dist/{chunk-YCVHRMM6.js → chunk-G5BMWPQ6.js} +2 -3
  19. package/dist/{chunk-YCVHRMM6.js.map → chunk-G5BMWPQ6.js.map} +1 -1
  20. package/dist/{chunk-FS4BZ7DR.js → chunk-HKMDWTA2.js} +28 -2
  21. package/dist/chunk-HKMDWTA2.js.map +1 -0
  22. package/dist/{chunk-LTPLLPOR.js → chunk-KPTMZQCY.js} +2 -2
  23. package/dist/{chunk-LLTB7ZFC.js → chunk-NDSPSAWQ.js} +18 -8
  24. package/dist/chunk-NDSPSAWQ.js.map +1 -0
  25. package/dist/{chunk-GTPKRBFR.js → chunk-NI7R6QZQ.js} +64 -3
  26. package/dist/chunk-NI7R6QZQ.js.map +1 -0
  27. package/dist/chunk-RI3KKDPX.js +75 -0
  28. package/dist/chunk-RI3KKDPX.js.map +1 -0
  29. package/dist/{create-jmp-analytics-Ce2CrhhR.d.cts → create-jmp-analytics-D1dUsqCQ.d.cts} +1 -2
  30. package/dist/{create-jmp-analytics-BeuuU6as.d.ts → create-jmp-analytics-htx2oOEf.d.ts} +1 -2
  31. package/dist/index.cjs +63 -2
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +8 -6
  34. package/dist/index.d.ts +8 -6
  35. package/dist/index.js +5 -1
  36. package/dist/next/content.cjs +57 -0
  37. package/dist/next/content.cjs.map +1 -1
  38. package/dist/next/content.d.cts +6 -4
  39. package/dist/next/content.d.ts +6 -4
  40. package/dist/next/content.js +8 -2
  41. package/dist/next/content.js.map +1 -1
  42. package/dist/next/instrumentation.cjs.map +1 -1
  43. package/dist/next/instrumentation.js +1 -1
  44. package/dist/next/landing-capture-script-server.cjs +1 -2
  45. package/dist/next/landing-capture-script-server.cjs.map +1 -1
  46. package/dist/next/landing-capture-script-server.js +1 -1
  47. package/dist/next/landing-pages.cjs.map +1 -1
  48. package/dist/next/landing-pages.d.cts +3 -14
  49. package/dist/next/landing-pages.d.ts +3 -14
  50. package/dist/next/landing-pages.js +13 -65
  51. package/dist/next/landing-pages.js.map +1 -1
  52. package/dist/next/locations.cjs +737 -0
  53. package/dist/next/locations.cjs.map +1 -0
  54. package/dist/next/locations.d.cts +55 -0
  55. package/dist/next/locations.d.ts +55 -0
  56. package/dist/next/locations.js +158 -0
  57. package/dist/next/locations.js.map +1 -0
  58. package/dist/next/middleware.d.cts +2 -2
  59. package/dist/next/middleware.d.ts +2 -2
  60. package/dist/next/site-root-server.cjs +31 -4
  61. package/dist/next/site-root-server.cjs.map +1 -1
  62. package/dist/next/site-root-server.js +4 -4
  63. package/dist/next.cjs +44 -8
  64. package/dist/next.cjs.map +1 -1
  65. package/dist/next.d.cts +3 -3
  66. package/dist/next.d.ts +3 -3
  67. package/dist/next.js +3 -3
  68. package/dist/react.cjs +163 -127
  69. package/dist/react.cjs.map +1 -1
  70. package/dist/react.d.cts +2 -2
  71. package/dist/react.d.ts +2 -2
  72. package/dist/react.js +2 -2
  73. package/dist/{site-config-DIFmnwqv.d.cts → site-config-B7USGGzu.d.cts} +1 -1
  74. package/dist/{site-config-B4uEj4xX.d.ts → site-config-C4bcUoLI.d.ts} +1 -1
  75. package/dist/{track-page-view-Bv0BAvxG.d.cts → track-page-view-C4TbbULE.d.cts} +1 -1
  76. package/dist/{track-page-view-CkgIp9-j.d.ts → track-page-view-RiB-xgIx.d.ts} +1 -1
  77. package/dist/{types-B2iP79lb.d.cts → types-DRljY1Yy.d.cts} +34 -2
  78. package/dist/{types-B2iP79lb.d.ts → types-DRljY1Yy.d.ts} +34 -2
  79. package/dist/utils-BajG58pj.d.cts +15 -0
  80. package/dist/utils-CHT3SQFv.d.ts +15 -0
  81. package/package.json +7 -2
  82. package/dist/chunk-FS4BZ7DR.js.map +0 -1
  83. package/dist/chunk-GTPKRBFR.js.map +0 -1
  84. package/dist/chunk-LLTB7ZFC.js.map +0 -1
  85. /package/dist/{chunk-ZEC22LFP.js.map → chunk-7623G3XL.js.map} +0 -0
  86. /package/dist/{chunk-LTPLLPOR.js.map → chunk-KPTMZQCY.js.map} +0 -0
package/dist/next.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { m as JmpAnalyticsConfig } from './types-B2iP79lb.cjs';
3
+ import { o as JmpAnalyticsConfig } from './types-DRljY1Yy.cjs';
4
4
  export { b as buildLandingCaptureInlineScript } from './landing-capture-C8pyZWuF.cjs';
5
- import { J as JmpAnalytics } from './create-jmp-analytics-Ce2CrhhR.cjs';
6
- export { i as isJmpTrackingConsentGranted, s as setJmpTrackingConsent, a as subscribeJmpTrackingConsent } from './create-jmp-analytics-Ce2CrhhR.cjs';
5
+ import { J as JmpAnalytics } from './create-jmp-analytics-D1dUsqCQ.cjs';
6
+ export { i as isJmpTrackingConsentGranted, s as setJmpTrackingConsent, a as subscribeJmpTrackingConsent } from './create-jmp-analytics-D1dUsqCQ.cjs';
7
7
  export { r as readJmpPublicEnvFromProcess } from './env-public-B6Y0DG68.cjs';
8
8
  export { JmpTrackedMailtoLink, JmpTrackedTelLink } from './react.cjs';
9
9
  export { JmpGoogleTag } from './next/google-tag.cjs';
package/dist/next.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { m as JmpAnalyticsConfig } from './types-B2iP79lb.js';
3
+ import { o as JmpAnalyticsConfig } from './types-DRljY1Yy.js';
4
4
  export { b as buildLandingCaptureInlineScript } from './landing-capture-C8pyZWuF.js';
5
- import { J as JmpAnalytics } from './create-jmp-analytics-BeuuU6as.js';
6
- export { i as isJmpTrackingConsentGranted, s as setJmpTrackingConsent, a as subscribeJmpTrackingConsent } from './create-jmp-analytics-BeuuU6as.js';
5
+ import { J as JmpAnalytics } from './create-jmp-analytics-htx2oOEf.js';
6
+ export { i as isJmpTrackingConsentGranted, s as setJmpTrackingConsent, a as subscribeJmpTrackingConsent } from './create-jmp-analytics-htx2oOEf.js';
7
7
  export { r as readJmpPublicEnvFromProcess } from './env-public-B6Y0DG68.js';
8
8
  export { JmpTrackedMailtoLink, JmpTrackedTelLink } from './react.js';
9
9
  export { JmpGoogleTag } from './next/google-tag.js';
package/dist/next.js CHANGED
@@ -5,19 +5,19 @@ import {
5
5
  JmpSiteRoot,
6
6
  getOrCreateJmpAnalyticsForNextApp,
7
7
  useJmpAnalytics
8
- } from "./chunk-LTPLLPOR.js";
8
+ } from "./chunk-KPTMZQCY.js";
9
9
  import {
10
10
  JmpGoogleTag
11
11
  } from "./chunk-2KAGOVRZ.js";
12
12
  import {
13
13
  JmpTrackedMailtoLink,
14
14
  JmpTrackedTelLink
15
- } from "./chunk-LLTB7ZFC.js";
15
+ } from "./chunk-NDSPSAWQ.js";
16
16
  import {
17
17
  isJmpTrackingConsentGranted,
18
18
  setJmpTrackingConsent,
19
19
  subscribeJmpTrackingConsent
20
- } from "./chunk-GTPKRBFR.js";
20
+ } from "./chunk-NI7R6QZQ.js";
21
21
  import {
22
22
  buildLandingCaptureInlineScript
23
23
  } from "./chunk-TCZ6TC2L.js";
package/dist/react.cjs CHANGED
@@ -28,6 +28,145 @@ __export(react_exports, {
28
28
  module.exports = __toCommonJS(react_exports);
29
29
  var import_react = require("react");
30
30
 
31
+ // src/contact-link-classifier.ts
32
+ var BOOKING_LINK_HOSTS = [
33
+ "calendly.com",
34
+ "cal.com",
35
+ "acuityscheduling.com",
36
+ "calendar.google.com",
37
+ "calendar.app.google",
38
+ "bookings.microsoft.com",
39
+ "outlook.office.com",
40
+ "outlook.office365.com",
41
+ "book.ms",
42
+ "setmore.com",
43
+ "simplybook.me",
44
+ "oncehub.com",
45
+ "scheduleonce.com",
46
+ "youcanbook.me",
47
+ "savvycal.com",
48
+ "tidycal.com",
49
+ "zohobookings.com",
50
+ "square.site",
51
+ "squareup.com",
52
+ "meetings.hubspot.com",
53
+ "jobber.com",
54
+ "housecallpro.com",
55
+ "servicetitan.com",
56
+ "thryv.com",
57
+ "honeybook.com",
58
+ "dubsado.com",
59
+ "fresha.com",
60
+ "booksy.com",
61
+ "vagaro.com",
62
+ "mindbodyonline.com",
63
+ "mindbody.io",
64
+ "janeapp.com",
65
+ "cliniko.com",
66
+ "practicebetter.io"
67
+ ];
68
+ var WHATSAPP_HOSTS = ["wa.me", "api.whatsapp.com", "whatsapp.com"];
69
+ function hostnameMatches(host, pattern) {
70
+ const h = host.toLowerCase();
71
+ const p = pattern.toLowerCase();
72
+ return h === p || h.endsWith(`.${p}`);
73
+ }
74
+ function isMapsHost(host, pathname) {
75
+ if (hostnameMatches(host, "maps.apple.com")) {
76
+ return true;
77
+ }
78
+ if (hostnameMatches(host, "maps.app.goo.gl")) {
79
+ return true;
80
+ }
81
+ if (hostnameMatches(host, "google.com") || hostnameMatches(host, "google.co")) {
82
+ return pathname === "/maps" || pathname.startsWith("/maps/") || pathname.startsWith("/local");
83
+ }
84
+ return false;
85
+ }
86
+ function isWhatsAppHost(host, pathname) {
87
+ for (const pattern of WHATSAPP_HOSTS) {
88
+ if (!hostnameMatches(host, pattern)) {
89
+ continue;
90
+ }
91
+ if (pattern === "whatsapp.com") {
92
+ return pathname.startsWith("/send");
93
+ }
94
+ return true;
95
+ }
96
+ return false;
97
+ }
98
+ function isBookingHost(host) {
99
+ for (const pattern of BOOKING_LINK_HOSTS) {
100
+ if (hostnameMatches(host, pattern)) {
101
+ return true;
102
+ }
103
+ }
104
+ return false;
105
+ }
106
+ function classifyContactHref(href) {
107
+ const raw = href.trim();
108
+ if (!raw || raw.startsWith("#") || raw.startsWith("javascript:")) {
109
+ return null;
110
+ }
111
+ const lower = raw.toLowerCase();
112
+ if (lower.startsWith("tel:")) {
113
+ return { kind: "call" };
114
+ }
115
+ if (lower.startsWith("mailto:")) {
116
+ return { kind: "email" };
117
+ }
118
+ if (lower.startsWith("sms:") || lower.startsWith("smsto:")) {
119
+ return { kind: "contact_click", channel: "sms", linkHost: null };
120
+ }
121
+ if (lower.startsWith("geo:")) {
122
+ return { kind: "contact_click", channel: "maps", linkHost: null };
123
+ }
124
+ if (raw.startsWith("/") || raw.startsWith("?")) {
125
+ return null;
126
+ }
127
+ let url;
128
+ try {
129
+ url = new URL(raw);
130
+ } catch {
131
+ return null;
132
+ }
133
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
134
+ return null;
135
+ }
136
+ const host = url.hostname.toLowerCase();
137
+ const pathname = url.pathname.toLowerCase();
138
+ if (isWhatsAppHost(host, pathname)) {
139
+ return { kind: "contact_click", channel: "whatsapp", linkHost: host };
140
+ }
141
+ if (isMapsHost(host, pathname)) {
142
+ return { kind: "contact_click", channel: "maps", linkHost: host };
143
+ }
144
+ if (isBookingHost(host)) {
145
+ return { kind: "contact_click", channel: "booking", linkHost: host };
146
+ }
147
+ return null;
148
+ }
149
+ function extractTelTarget(href) {
150
+ const raw = href.trim();
151
+ if (!raw.toLowerCase().startsWith("tel:")) {
152
+ return null;
153
+ }
154
+ const target = decodeURIComponent(
155
+ raw.slice(4).split("?")[0]?.split(";")[0] ?? ""
156
+ ).trim();
157
+ return target || null;
158
+ }
159
+ function extractMailtoTarget(href) {
160
+ const raw = href.trim();
161
+ if (!raw.toLowerCase().startsWith("mailto:")) {
162
+ return null;
163
+ }
164
+ const target = decodeURIComponent(
165
+ raw.slice(7).split("?")[0]?.split(",")[0] ?? ""
166
+ ).trim();
167
+ return target || null;
168
+ }
169
+
31
170
  // src/landing-capture.ts
32
171
  var JMP_SESSION_ID_KEY = "jmp_analytics_sid";
33
172
  var JMP_LANDING_REFERER_KEY = "jmp_analytics_landing_referer";
@@ -166,125 +305,6 @@ function getOrCreateSessionIdFromStorage() {
166
305
  }
167
306
  }
168
307
 
169
- // src/contact-link-classifier.ts
170
- var BOOKING_LINK_HOSTS = [
171
- "calendly.com",
172
- "cal.com",
173
- "acuityscheduling.com",
174
- "calendar.google.com",
175
- "calendar.app.google",
176
- "bookings.microsoft.com",
177
- "outlook.office.com",
178
- "outlook.office365.com",
179
- "book.ms",
180
- "setmore.com",
181
- "simplybook.me",
182
- "oncehub.com",
183
- "scheduleonce.com",
184
- "youcanbook.me",
185
- "savvycal.com",
186
- "tidycal.com",
187
- "zohobookings.com",
188
- "square.site",
189
- "squareup.com",
190
- "meetings.hubspot.com",
191
- "jobber.com",
192
- "housecallpro.com",
193
- "servicetitan.com",
194
- "thryv.com",
195
- "honeybook.com",
196
- "dubsado.com",
197
- "fresha.com",
198
- "booksy.com",
199
- "vagaro.com",
200
- "mindbodyonline.com",
201
- "mindbody.io",
202
- "janeapp.com",
203
- "cliniko.com",
204
- "practicebetter.io"
205
- ];
206
- var WHATSAPP_HOSTS = ["wa.me", "api.whatsapp.com", "whatsapp.com"];
207
- function hostnameMatches(host, pattern) {
208
- const h = host.toLowerCase();
209
- const p = pattern.toLowerCase();
210
- return h === p || h.endsWith(`.${p}`);
211
- }
212
- function isMapsHost(host, pathname) {
213
- if (hostnameMatches(host, "maps.apple.com")) {
214
- return true;
215
- }
216
- if (hostnameMatches(host, "maps.app.goo.gl")) {
217
- return true;
218
- }
219
- if (hostnameMatches(host, "google.com") || hostnameMatches(host, "google.co")) {
220
- return pathname === "/maps" || pathname.startsWith("/maps/") || pathname.startsWith("/local");
221
- }
222
- return false;
223
- }
224
- function isWhatsAppHost(host, pathname) {
225
- for (const pattern of WHATSAPP_HOSTS) {
226
- if (!hostnameMatches(host, pattern)) {
227
- continue;
228
- }
229
- if (pattern === "whatsapp.com") {
230
- return pathname.startsWith("/send");
231
- }
232
- return true;
233
- }
234
- return false;
235
- }
236
- function isBookingHost(host) {
237
- for (const pattern of BOOKING_LINK_HOSTS) {
238
- if (hostnameMatches(host, pattern)) {
239
- return true;
240
- }
241
- }
242
- return false;
243
- }
244
- function classifyContactHref(href) {
245
- const raw = href.trim();
246
- if (!raw || raw.startsWith("#") || raw.startsWith("javascript:")) {
247
- return null;
248
- }
249
- const lower = raw.toLowerCase();
250
- if (lower.startsWith("tel:")) {
251
- return { kind: "call" };
252
- }
253
- if (lower.startsWith("mailto:")) {
254
- return { kind: "email" };
255
- }
256
- if (lower.startsWith("sms:") || lower.startsWith("smsto:")) {
257
- return { kind: "contact_click", channel: "sms", linkHost: null };
258
- }
259
- if (lower.startsWith("geo:")) {
260
- return { kind: "contact_click", channel: "maps", linkHost: null };
261
- }
262
- if (raw.startsWith("/") || raw.startsWith("?")) {
263
- return null;
264
- }
265
- let url;
266
- try {
267
- url = new URL(raw);
268
- } catch {
269
- return null;
270
- }
271
- if (url.protocol !== "http:" && url.protocol !== "https:") {
272
- return null;
273
- }
274
- const host = url.hostname.toLowerCase();
275
- const pathname = url.pathname.toLowerCase();
276
- if (isWhatsAppHost(host, pathname)) {
277
- return { kind: "contact_click", channel: "whatsapp", linkHost: host };
278
- }
279
- if (isMapsHost(host, pathname)) {
280
- return { kind: "contact_click", channel: "maps", linkHost: host };
281
- }
282
- if (isBookingHost(host)) {
283
- return { kind: "contact_click", channel: "booking", linkHost: host };
284
- }
285
- return null;
286
- }
287
-
288
308
  // src/constants.ts
289
309
  var JMP_ANALYTICS_SDK_VERSION = "0.1.26";
290
310
  var JMP_TRACKING_CONSENT_STORAGE_KEY = "jmp_analytics_consent_v1";
@@ -700,14 +720,22 @@ function createJmpAnalytics(config) {
700
720
  if (dedupeContactClick(`call_click:${path}`)) {
701
721
  return;
702
722
  }
703
- void trackCallClick(path);
723
+ const contactTarget = extractTelTarget(href);
724
+ void trackCallClick(
725
+ path,
726
+ contactTarget ? { contactTarget } : void 0
727
+ );
704
728
  return;
705
729
  }
706
730
  if (classified.kind === "email") {
707
731
  if (dedupeContactClick(`email_click:${path}`)) {
708
732
  return;
709
733
  }
710
- void trackEmailClick(path);
734
+ const contactTarget = extractMailtoTarget(href);
735
+ void trackEmailClick(
736
+ path,
737
+ contactTarget ? { contactTarget } : void 0
738
+ );
711
739
  return;
712
740
  }
713
741
  if (dedupeContactClick(`contact_click:${classified.channel}:${path}`)) {
@@ -1154,13 +1182,21 @@ var import_jsx_runtime = require("react/jsx-runtime");
1154
1182
  function useJmpAnalytics() {
1155
1183
  return (0, import_react.useMemo)(() => getOrCreateJmpAnalyticsFromBrowserEnv(), []);
1156
1184
  }
1157
- function trackCallClickFromCurrentPath() {
1185
+ function trackCallClickFromHref(href) {
1158
1186
  const path = typeof window !== "undefined" ? window.location.pathname : "/";
1159
- void getOrCreateJmpAnalyticsFromBrowserEnv()?.trackCallClick(path);
1187
+ const contactTarget = extractTelTarget(href);
1188
+ void getOrCreateJmpAnalyticsFromBrowserEnv()?.trackCallClick(
1189
+ path,
1190
+ contactTarget ? { contactTarget } : void 0
1191
+ );
1160
1192
  }
1161
- function trackEmailClickFromCurrentPath() {
1193
+ function trackEmailClickFromHref(href) {
1162
1194
  const path = typeof window !== "undefined" ? window.location.pathname : "/";
1163
- void getOrCreateJmpAnalyticsFromBrowserEnv()?.trackEmailClick(path);
1195
+ const contactTarget = extractMailtoTarget(href);
1196
+ void getOrCreateJmpAnalyticsFromBrowserEnv()?.trackEmailClick(
1197
+ path,
1198
+ contactTarget ? { contactTarget } : void 0
1199
+ );
1164
1200
  }
1165
1201
  function JmpTrackedTelLink({
1166
1202
  href,
@@ -1174,7 +1210,7 @@ function JmpTrackedTelLink({
1174
1210
  "data-jmp-tracked": "true",
1175
1211
  ...rest,
1176
1212
  onClick: (e) => {
1177
- trackCallClickFromCurrentPath();
1213
+ trackCallClickFromHref(href);
1178
1214
  onClick?.(e);
1179
1215
  }
1180
1216
  }
@@ -1192,7 +1228,7 @@ function JmpTrackedMailtoLink({
1192
1228
  "data-jmp-tracked": "true",
1193
1229
  ...rest,
1194
1230
  onClick: (e) => {
1195
- trackEmailClickFromCurrentPath();
1231
+ trackEmailClickFromHref(href);
1196
1232
  onClick?.(e);
1197
1233
  }
1198
1234
  }