@shware/analytics 2.1.5 → 2.1.7

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.
@@ -1,5 +1,5 @@
1
1
  import { CreateFeedbackDTO } from '../schema/index.cjs';
2
- import 'zod/v4-mini';
2
+ import 'zod/mini';
3
3
 
4
4
  declare function sendFeedback(dto: CreateFeedbackDTO): Promise<void>;
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { CreateFeedbackDTO } from '../schema/index.js';
2
- import 'zod/v4-mini';
2
+ import 'zod/mini';
3
3
 
4
4
  declare function sendFeedback(dto: CreateFeedbackDTO): Promise<void>;
5
5
 
package/dist/index.d.cts CHANGED
@@ -8,5 +8,5 @@ export { stripeMinorUnits } from './utils/stripe.cjs';
8
8
  export { AllowedPropertyValues, TrackProperties, TrackTags, UserProvidedData } from './track/types.cjs';
9
9
  export { VisitorProperties } from './visitor/types.cjs';
10
10
  import 'axios';
11
- import 'zod/v4-mini';
11
+ import 'zod/mini';
12
12
  import './track/gtag.cjs';
package/dist/index.d.ts CHANGED
@@ -8,5 +8,5 @@ export { stripeMinorUnits } from './utils/stripe.js';
8
8
  export { AllowedPropertyValues, TrackProperties, TrackTags, UserProvidedData } from './track/types.js';
9
9
  export { VisitorProperties } from './visitor/types.js';
10
10
  import 'axios';
11
- import 'zod/v4-mini';
11
+ import 'zod/mini';
12
12
  import './track/gtag.js';
@@ -1,5 +1,5 @@
1
1
  import { CreateLinkDTO } from '../schema/index.cjs';
2
- import 'zod/v4-mini';
2
+ import 'zod/mini';
3
3
 
4
4
  interface Link extends CreateLinkDTO {
5
5
  id: string;
@@ -1,5 +1,5 @@
1
1
  import { CreateLinkDTO } from '../schema/index.js';
2
- import 'zod/v4-mini';
2
+ import 'zod/mini';
3
3
 
4
4
  interface Link extends CreateLinkDTO {
5
5
  id: string;
@@ -70,6 +70,7 @@ function Analytics({
70
70
  nonce,
71
71
  debugMode,
72
72
  pixelId,
73
+ hotjarId,
73
74
  facebookAppId,
74
75
  reportWebVitals = true
75
76
  }) {
@@ -136,34 +137,53 @@ function Analytics({
136
137
  }
137
138
  )
138
139
  ] }),
139
- pixelId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
140
+ pixelId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
140
141
  import_script.default,
141
142
  {
142
143
  id: "pixel",
143
144
  strategy: "afterInteractive",
144
145
  dangerouslySetInnerHTML: {
145
146
  __html: `
146
- !(function (f, b, e, v, n, t, s) {
147
- if (f.fbq) return;
148
- n = f.fbq = function () {
149
- n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
150
- };
151
- if (!f._fbq) f._fbq = n;
152
- n.push = n;
153
- n.loaded = !0;
154
- n.version = '2.0';
155
- n.queue = [];
156
- t = b.createElement(e);
157
- t.async = !0;
158
- t.src = v;
159
- s = b.getElementsByTagName(e)[0];
160
- s.parentNode.insertBefore(t, s);
161
- })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
162
- fbq('init', '${pixelId}');
163
- fbq('track', 'PageView');`
147
+ !(function (f, b, e, v, n, t, s) {
148
+ if (f.fbq) return;
149
+ n = f.fbq = function () {
150
+ n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
151
+ };
152
+ if (!f._fbq) f._fbq = n;
153
+ n.push = n;
154
+ n.loaded = !0;
155
+ n.version = '2.0';
156
+ n.queue = [];
157
+ t = b.createElement(e);
158
+ t.async = !0;
159
+ t.src = v;
160
+ s = b.getElementsByTagName(e)[0];
161
+ s.parentNode.insertBefore(t, s);
162
+ })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
163
+ fbq('init', '${pixelId}');
164
+ fbq('track', 'PageView');`
164
165
  }
165
166
  }
166
- ) })
167
+ ),
168
+ hotjarId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
169
+ import_script.default,
170
+ {
171
+ id: "hotjar",
172
+ strategy: "afterInteractive",
173
+ dangerouslySetInnerHTML: {
174
+ __html: `
175
+ (function(h,o,t,j,a,r){
176
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
177
+ h._hjSettings={hjid:${hotjarId},hjsv:6};
178
+ a=o.getElementsByTagName('head')[0];
179
+ r=o.createElement('script');r.async=1;
180
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
181
+ a.appendChild(r);
182
+ })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
183
+ `
184
+ }
185
+ }
186
+ )
167
187
  ] });
168
188
  }
169
189
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/next/index.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport Script from 'next/script';\nimport { useReportWebVitals } from 'next/web-vitals';\nimport { useEffect } from 'react';\nimport { getLink, type Link } from '../link/index';\nimport { mapFBEvent } from '../track/fbq';\nimport { track } from '../track/index';\nimport type { Pixel, PixelId } from '../track/fbq';\nimport type { Gtag, GaId, GtmId } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ndeclare global {\n interface Window extends Gtag, Pixel {}\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n pixelId?: PixelId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (!window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n pixelId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const pathname = usePathname();\n\n useEffect(() => {\n const trackUTM = async () => {\n const params = new URLSearchParams(document.location.search);\n let link: Link | null = null;\n if (params.has('s')) link = await getLink(params.get('s')!);\n\n const properties = {\n pathname,\n referrer: document.referrer,\n fbclid: params.get('fbclid'),\n gclid: params.get('gclid'),\n gad_source: params.get('gad_source'),\n gad_campaignid: params.get('gad_campaignid'),\n utm_source: link?.utm_source ?? params.get('utm_source'),\n utm_medium: link?.utm_medium ?? params.get('utm_medium'),\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign'),\n utm_term: link?.utm_term ?? params.get('utm_term'),\n utm_content: link?.utm_content ?? params.get('utm_content'),\n };\n\n track('page_view', properties, { enableThirdPartyTracking: false });\n };\n\n trackUTM();\n }, [pathname]);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <Script\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <Script\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {pixelId && (\n <>\n <Script\n id=\"pixel\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${pixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n </>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wBAA4B;AAC5B,oBAAmB;AACnB,wBAAmC;AACnC,mBAA0B;AAC1B,kBAAmC;AACnC,iBAA2B;AAC3B,mBAAsB;AAoGE;AAjFjB,SAAS,YACd,MACA,YACA;AACA,MAAI,CAAC,OAAO,MAAM;AAChB,YAAQ,KAAK,6BAA6B;AAC1C;AAAA,EACF;AACA,SAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEO,SAAS,YACd,MACA,YACA,UACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,UAAU,EAAE,SAAS,SAAS;AACpC,QAAM,CAAC,MAAM,aAAa,iBAAiB,QAAI,uBAAW,MAAM,UAAU;AAC1E,MAAI,SAAS,SAAS;AACpB,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD,OAAO;AACL,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD;AACF;AAEO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AACpB,GAAU;AACR,QAAM,eAAW,+BAAY;AA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AA+C,IAAI;AAAA;AAAA,MAC1D;AAAA,MACA;AAAA,QAAC,cAAAA;AAAA,QAAA;AAAA,UACC;AAAA,UACA,IAAG;AAAA,UACH,yBAAyB;AAAA,YACvB,QAAQ;AAAA;AAAA;AAAA;AAAA,gCAIU,IAAI,IAAI,YAAY,6BAA6B,EAAE;AAAA;AAAA,UAEvE;AAAA;AAAA,MACF;AAAA,OACF;AAAA,IAED,WACC,2EACE;AAAA,MAAC,cAAAA;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,UAAS;AAAA,QACT,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAiBO,OAAO;AAAA;AAAA,QAExB;AAAA;AAAA,IACF,GACF;AAAA,KAEJ;AAEJ;","names":["Script"]}
1
+ {"version":3,"sources":["../../src/next/index.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport Script from 'next/script';\nimport { useReportWebVitals } from 'next/web-vitals';\nimport { useEffect } from 'react';\nimport { getLink, type Link } from '../link/index';\nimport { mapFBEvent } from '../track/fbq';\nimport { track } from '../track/index';\nimport type { Pixel, PixelId } from '../track/fbq';\nimport type { Gtag, GaId, GtmId } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ntype HotjarId = `${number}`;\n\ndeclare global {\n interface Window extends Gtag, Pixel {}\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n pixelId?: PixelId;\n hotjarId?: HotjarId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (!window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n pixelId,\n hotjarId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const pathname = usePathname();\n\n useEffect(() => {\n const trackUTM = async () => {\n const params = new URLSearchParams(document.location.search);\n let link: Link | null = null;\n if (params.has('s')) link = await getLink(params.get('s')!);\n\n const properties = {\n pathname,\n referrer: document.referrer,\n fbclid: params.get('fbclid'),\n gclid: params.get('gclid'),\n gad_source: params.get('gad_source'),\n gad_campaignid: params.get('gad_campaignid'),\n utm_source: link?.utm_source ?? params.get('utm_source'),\n utm_medium: link?.utm_medium ?? params.get('utm_medium'),\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign'),\n utm_term: link?.utm_term ?? params.get('utm_term'),\n utm_content: link?.utm_content ?? params.get('utm_content'),\n };\n\n track('page_view', properties, { enableThirdPartyTracking: false });\n };\n\n trackUTM();\n }, [pathname]);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <Script\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <Script\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {pixelId && (\n <Script\n id=\"pixel\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${pixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n )}\n {hotjarId && (\n <Script\n id=\"hotjar\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:${hotjarId},hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n `,\n }}\n />\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wBAA4B;AAC5B,oBAAmB;AACnB,wBAAmC;AACnC,mBAA0B;AAC1B,kBAAmC;AACnC,iBAA2B;AAC3B,mBAAsB;AAwGE;AAlFjB,SAAS,YACd,MACA,YACA;AACA,MAAI,CAAC,OAAO,MAAM;AAChB,YAAQ,KAAK,6BAA6B;AAC1C;AAAA,EACF;AACA,SAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEO,SAAS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AA,QAOlC;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":["Script"]}
@@ -3,6 +3,7 @@ import { Pixel, PixelId } from '../track/fbq.cjs';
3
3
  import { Gtag, GaId, GtmId } from '../track/gtag.cjs';
4
4
  import { EventName, TrackName, TrackProperties } from '../track/types.cjs';
5
5
 
6
+ type HotjarId = `${number}`;
6
7
  declare global {
7
8
  interface Window extends Gtag, Pixel {
8
9
  }
@@ -11,6 +12,7 @@ interface Props {
11
12
  gaId?: GaId;
12
13
  gtmId?: GtmId;
13
14
  pixelId?: PixelId;
15
+ hotjarId?: HotjarId;
14
16
  facebookAppId?: string;
15
17
  nonce?: string;
16
18
  debugMode?: boolean;
@@ -18,6 +20,6 @@ interface Props {
18
20
  }
19
21
  declare function sendGAEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): void;
20
22
  declare function sendFBEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string): void;
21
- declare function Analytics({ gaId, nonce, debugMode, pixelId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
23
+ declare function Analytics({ gaId, nonce, debugMode, pixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
22
24
 
23
25
  export { Analytics, sendFBEvent, sendGAEvent };
@@ -3,6 +3,7 @@ import { Pixel, PixelId } from '../track/fbq.js';
3
3
  import { Gtag, GaId, GtmId } from '../track/gtag.js';
4
4
  import { EventName, TrackName, TrackProperties } from '../track/types.js';
5
5
 
6
+ type HotjarId = `${number}`;
6
7
  declare global {
7
8
  interface Window extends Gtag, Pixel {
8
9
  }
@@ -11,6 +12,7 @@ interface Props {
11
12
  gaId?: GaId;
12
13
  gtmId?: GtmId;
13
14
  pixelId?: PixelId;
15
+ hotjarId?: HotjarId;
14
16
  facebookAppId?: string;
15
17
  nonce?: string;
16
18
  debugMode?: boolean;
@@ -18,6 +20,6 @@ interface Props {
18
20
  }
19
21
  declare function sendGAEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): void;
20
22
  declare function sendFBEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string): void;
21
- declare function Analytics({ gaId, nonce, debugMode, pixelId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
23
+ declare function Analytics({ gaId, nonce, debugMode, pixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
22
24
 
23
25
  export { Analytics, sendFBEvent, sendGAEvent };
@@ -35,6 +35,7 @@ function Analytics({
35
35
  nonce,
36
36
  debugMode,
37
37
  pixelId,
38
+ hotjarId,
38
39
  facebookAppId,
39
40
  reportWebVitals = true
40
41
  }) {
@@ -101,34 +102,53 @@ function Analytics({
101
102
  }
102
103
  )
103
104
  ] }),
104
- pixelId && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
105
+ pixelId && /* @__PURE__ */ jsx(
105
106
  Script,
106
107
  {
107
108
  id: "pixel",
108
109
  strategy: "afterInteractive",
109
110
  dangerouslySetInnerHTML: {
110
111
  __html: `
111
- !(function (f, b, e, v, n, t, s) {
112
- if (f.fbq) return;
113
- n = f.fbq = function () {
114
- n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
115
- };
116
- if (!f._fbq) f._fbq = n;
117
- n.push = n;
118
- n.loaded = !0;
119
- n.version = '2.0';
120
- n.queue = [];
121
- t = b.createElement(e);
122
- t.async = !0;
123
- t.src = v;
124
- s = b.getElementsByTagName(e)[0];
125
- s.parentNode.insertBefore(t, s);
126
- })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
127
- fbq('init', '${pixelId}');
128
- fbq('track', 'PageView');`
112
+ !(function (f, b, e, v, n, t, s) {
113
+ if (f.fbq) return;
114
+ n = f.fbq = function () {
115
+ n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
116
+ };
117
+ if (!f._fbq) f._fbq = n;
118
+ n.push = n;
119
+ n.loaded = !0;
120
+ n.version = '2.0';
121
+ n.queue = [];
122
+ t = b.createElement(e);
123
+ t.async = !0;
124
+ t.src = v;
125
+ s = b.getElementsByTagName(e)[0];
126
+ s.parentNode.insertBefore(t, s);
127
+ })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
128
+ fbq('init', '${pixelId}');
129
+ fbq('track', 'PageView');`
129
130
  }
130
131
  }
131
- ) })
132
+ ),
133
+ hotjarId && /* @__PURE__ */ jsx(
134
+ Script,
135
+ {
136
+ id: "hotjar",
137
+ strategy: "afterInteractive",
138
+ dangerouslySetInnerHTML: {
139
+ __html: `
140
+ (function(h,o,t,j,a,r){
141
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
142
+ h._hjSettings={hjid:${hotjarId},hjsv:6};
143
+ a=o.getElementsByTagName('head')[0];
144
+ r=o.createElement('script');r.async=1;
145
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
146
+ a.appendChild(r);
147
+ })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
148
+ `
149
+ }
150
+ }
151
+ )
132
152
  ] });
133
153
  }
134
154
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/next/index.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport Script from 'next/script';\nimport { useReportWebVitals } from 'next/web-vitals';\nimport { useEffect } from 'react';\nimport { getLink, type Link } from '../link/index';\nimport { mapFBEvent } from '../track/fbq';\nimport { track } from '../track/index';\nimport type { Pixel, PixelId } from '../track/fbq';\nimport type { Gtag, GaId, GtmId } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ndeclare global {\n interface Window extends Gtag, Pixel {}\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n pixelId?: PixelId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (!window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n pixelId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const pathname = usePathname();\n\n useEffect(() => {\n const trackUTM = async () => {\n const params = new URLSearchParams(document.location.search);\n let link: Link | null = null;\n if (params.has('s')) link = await getLink(params.get('s')!);\n\n const properties = {\n pathname,\n referrer: document.referrer,\n fbclid: params.get('fbclid'),\n gclid: params.get('gclid'),\n gad_source: params.get('gad_source'),\n gad_campaignid: params.get('gad_campaignid'),\n utm_source: link?.utm_source ?? params.get('utm_source'),\n utm_medium: link?.utm_medium ?? params.get('utm_medium'),\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign'),\n utm_term: link?.utm_term ?? params.get('utm_term'),\n utm_content: link?.utm_content ?? params.get('utm_content'),\n };\n\n track('page_view', properties, { enableThirdPartyTracking: false });\n };\n\n trackUTM();\n }, [pathname]);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <Script\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <Script\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {pixelId && (\n <>\n <Script\n id=\"pixel\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${pixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n </>\n )}\n </>\n );\n}\n"],"mappings":";;;AAEA,SAAS,mBAAmB;AAC5B,OAAO,YAAY;AACnB,SAAS,0BAA0B;AACnC,SAAS,iBAAiB;AAC1B,SAAS,eAA0B;AACnC,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AAoGE,SAEhB,UAFgB,KAEhB,YAFgB;AAjFjB,SAAS,YACd,MACA,YACA;AACA,MAAI,CAAC,OAAO,MAAM;AAChB,YAAQ,KAAK,6BAA6B;AAC1C;AAAA,EACF;AACA,SAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEO,SAAS,YACd,MACA,YACA,UACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,UAAU,EAAE,SAAS,SAAS;AACpC,QAAM,CAAC,MAAM,aAAa,iBAAiB,IAAI,W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d,iBAAiB,OAAO;AAAA,MACxB,iBAAiB;AAAA;AAAA,IACnB;AACA,UAAM,OAAO,MAAM,UAAU;AAAA,EAC/B,CAAC;AAED,SACE,iCACG;AAAA,qBAAiB,oBAAC,UAAK,UAAS,aAAY,SAAS,eAAe;AAAA,IACpE,QACC,iCACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,IAAG;AAAA,UACH;AAAA,UACA,KAAK,+CAA+C,IAAI;AAAA;AAAA,MAC1D;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,IAAG;AAAA,UACH,yBAAyB;AAAA,YACvB,QAAQ;AAAA;AAAA;AAAA;AAAA,gCAIU,IAAI,IAAI,YAAY,6BAA6B,EAAE;AAAA;AAAA,UAEvE;AAAA;AAAA,MACF;AAAA,OACF;AAAA,IAED,WACC,gCACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAG;AAAA,QACH,UAAS;AAAA,QACT,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAiBO,OAAO;AAAA;AAAA,QAExB;AAAA;AAAA,IACF,GACF;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/next/index.tsx"],"sourcesContent":["'use client';\n\nimport { usePathname } from 'next/navigation';\nimport Script from 'next/script';\nimport { useReportWebVitals } from 'next/web-vitals';\nimport { useEffect } from 'react';\nimport { getLink, type Link } from '../link/index';\nimport { mapFBEvent } from '../track/fbq';\nimport { track } from '../track/index';\nimport type { Pixel, PixelId } from '../track/fbq';\nimport type { Gtag, GaId, GtmId } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ntype HotjarId = `${number}`;\n\ndeclare global {\n interface Window extends Gtag, Pixel {}\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n pixelId?: PixelId;\n hotjarId?: HotjarId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (!window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n pixelId,\n hotjarId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const pathname = usePathname();\n\n useEffect(() => {\n const trackUTM = async () => {\n const params = new URLSearchParams(document.location.search);\n let link: Link | null = null;\n if (params.has('s')) link = await getLink(params.get('s')!);\n\n const properties = {\n pathname,\n referrer: document.referrer,\n fbclid: params.get('fbclid'),\n gclid: params.get('gclid'),\n gad_source: params.get('gad_source'),\n gad_campaignid: params.get('gad_campaignid'),\n utm_source: link?.utm_source ?? params.get('utm_source'),\n utm_medium: link?.utm_medium ?? params.get('utm_medium'),\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign'),\n utm_term: link?.utm_term ?? params.get('utm_term'),\n utm_content: link?.utm_content ?? params.get('utm_content'),\n };\n\n track('page_view', properties, { enableThirdPartyTracking: false });\n };\n\n trackUTM();\n }, [pathname]);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <Script\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <Script\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {pixelId && (\n <Script\n id=\"pixel\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${pixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n )}\n {hotjarId && (\n <Script\n id=\"hotjar\"\n strategy=\"afterInteractive\"\n dangerouslySetInnerHTML={{\n __html: `\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:${hotjarId},hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n `,\n }}\n />\n )}\n </>\n );\n}\n"],"mappings":";;;AAEA,SAAS,mBAAmB;AAC5B,OAAO,YAAY;AACnB,SAAS,0BAA0B;AACnC,SAAS,iBAAiB;AAC1B,SAAS,eAA0B;AACnC,S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;AAAA,MAAC;AAAA;AAAA,QACC,IAAG;AAAA,QACH,UAAS;AAAA,QACT,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA,oCAGgB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOlC;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":[]}
@@ -67,6 +67,7 @@ function Analytics({
67
67
  nonce,
68
68
  debugMode,
69
69
  pixelId,
70
+ hotjarId,
70
71
  facebookAppId,
71
72
  reportWebVitals = true
72
73
  }) {
@@ -135,33 +136,53 @@ function Analytics({
135
136
  }
136
137
  )
137
138
  ] }),
138
- pixelId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
139
+ pixelId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
139
140
  "script",
140
141
  {
142
+ async: true,
141
143
  id: "pixel",
142
144
  dangerouslySetInnerHTML: {
143
145
  __html: `
144
- !(function (f, b, e, v, n, t, s) {
145
- if (f.fbq) return;
146
- n = f.fbq = function () {
147
- n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
148
- };
149
- if (!f._fbq) f._fbq = n;
150
- n.push = n;
151
- n.loaded = !0;
152
- n.version = '2.0';
153
- n.queue = [];
154
- t = b.createElement(e);
155
- t.async = !0;
156
- t.src = v;
157
- s = b.getElementsByTagName(e)[0];
158
- s.parentNode.insertBefore(t, s);
159
- })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
160
- fbq('init', '${pixelId}');
161
- fbq('track', 'PageView');`
146
+ !(function (f, b, e, v, n, t, s) {
147
+ if (f.fbq) return;
148
+ n = f.fbq = function () {
149
+ n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
150
+ };
151
+ if (!f._fbq) f._fbq = n;
152
+ n.push = n;
153
+ n.loaded = !0;
154
+ n.version = '2.0';
155
+ n.queue = [];
156
+ t = b.createElement(e);
157
+ t.async = !0;
158
+ t.src = v;
159
+ s = b.getElementsByTagName(e)[0];
160
+ s.parentNode.insertBefore(t, s);
161
+ })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
162
+ fbq('init', '${pixelId}');
163
+ fbq('track', 'PageView');`
162
164
  }
163
165
  }
164
- ) })
166
+ ),
167
+ hotjarId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
168
+ "script",
169
+ {
170
+ async: true,
171
+ id: "hotjar",
172
+ dangerouslySetInnerHTML: {
173
+ __html: `
174
+ (function(h,o,t,j,a,r){
175
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
176
+ h._hjSettings={hjid:${hotjarId},hjsv:6};
177
+ a=o.getElementsByTagName('head')[0];
178
+ r=o.createElement('script');r.async=1;
179
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
180
+ a.appendChild(r);
181
+ })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
182
+ `
183
+ }
184
+ }
185
+ )
165
186
  ] });
166
187
  }
167
188
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react-router/index.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLocation, useSearchParams } from 'react-router';\nimport { onLCP, onCLS, onINP, onFCP, onTTFB, type Metric } from 'web-vitals';\nimport { getLink, type Link } from '../link/index';\nimport { mapFBEvent } from '../track/fbq';\nimport { track } from '../track/index';\nimport type { Pixel, PixelId } from '../track/fbq';\nimport type { Gtag, GaId, GtmId } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\nfunction useReportWebVitals(reportWebVitalsFn: (metric: Metric) => void) {\n useEffect(() => {\n onCLS(reportWebVitalsFn);\n onLCP(reportWebVitalsFn);\n onINP(reportWebVitalsFn);\n onFCP(reportWebVitalsFn);\n onTTFB(reportWebVitalsFn);\n }, [reportWebVitalsFn]);\n}\n\ndeclare global {\n interface Window extends Gtag, Pixel {}\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n pixelId?: PixelId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('gtag has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n pixelId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const { pathname } = useLocation();\n const [params] = useSearchParams();\n\n useEffect(() => {\n const trackUTM = async () => {\n let link: Link | null = null;\n if (params.has('s')) link = await getLink(params.get('s')!);\n\n const properties = {\n pathname,\n referrer: document.referrer,\n fbclid: params.get('fbclid'),\n gclid: params.get('gclid'),\n gad_source: params.get('gad_source'),\n gad_campaignid: params.get('gad_campaignid'),\n utm_source: link?.utm_source ?? params.get('utm_source'),\n utm_medium: link?.utm_medium ?? params.get('utm_medium'),\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign'),\n utm_term: link?.utm_term ?? params.get('utm_term'),\n utm_content: link?.utm_content ?? params.get('utm_content'),\n };\n\n /**\n * Pixel:\n * Each time the Pixel loads, it automatically calls fbq('track', 'PageView') to track a\n * PageView standard event.\n */\n track('page_view', properties, { enableThirdPartyTracking: false });\n };\n\n trackUTM();\n }, [pathname, params]);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <script\n async\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <script\n async\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {pixelId && (\n <>\n <script\n id=\"pixel\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${pixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n </>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAC1B,0BAA6C;AAC7C,wBAAgE;AAChE,kBAAmC;AACnC,iBAA2B;AAC3B,mBAAsB;AAmHE;AA9GxB,SAAS,mBAAmB,mBAA6C;AACvE,8BAAU,MAAM;AACd,iCAAM,iBAAiB;AACvB,iCAAM,iBAAiB;AACvB,iCAAM,iBAAiB;AACvB,iCAAM,iBAAiB;AACvB,kCAAO,iBA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A,IACF,GACF;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/react-router/index.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLocation, useSearchParams } from 'react-router';\nimport { onLCP, onCLS, onINP, onFCP, onTTFB, type Metric } from 'web-vitals';\nimport { getLink, type Link } from '../link/index';\nimport { mapFBEvent } from '../track/fbq';\nimport { track } from '../track/index';\nimport type { Pixel, PixelId } from '../track/fbq';\nimport type { Gtag, GaId, GtmId } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ntype HotjarId = `${number}`;\n\nfunction useReportWebVitals(reportWebVitalsFn: (metric: Metric) => void) {\n useEffect(() => {\n onCLS(reportWebVitalsFn);\n onLCP(reportWebVitalsFn);\n onINP(reportWebVitalsFn);\n onFCP(reportWebVitalsFn);\n onTTFB(reportWebVitalsFn);\n }, [reportWebVitalsFn]);\n}\n\ndeclare global {\n interface Window extends Gtag, Pixel {}\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n pixelId?: PixelId;\n hotjarId?: HotjarId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('gtag has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n pixelId,\n hotjarId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const { pathname } = useLocation();\n const [params] = useSearchParams();\n\n useEffect(() => {\n const trackUTM = async () => {\n let link: Link | null = null;\n if (params.has('s')) link = await getLink(params.get('s')!);\n\n const properties = {\n pathname,\n referrer: document.referrer,\n fbclid: params.get('fbclid'),\n gclid: params.get('gclid'),\n gad_source: params.get('gad_source'),\n gad_campaignid: params.get('gad_campaignid'),\n utm_source: link?.utm_source ?? params.get('utm_source'),\n utm_medium: link?.utm_medium ?? params.get('utm_medium'),\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign'),\n utm_term: link?.utm_term ?? params.get('utm_term'),\n utm_content: link?.utm_content ?? params.get('utm_content'),\n };\n\n /**\n * Pixel:\n * Each time the Pixel loads, it automatically calls fbq('track', 'PageView') to track a\n * PageView standard event.\n */\n track('page_view', properties, { enableThirdPartyTracking: false });\n };\n\n trackUTM();\n }, [pathname, params]);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <script\n async\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <script\n async\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {pixelId && (\n <script\n async\n id=\"pixel\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${pixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n )}\n {hotjarId && (\n <script\n async\n id=\"hotjar\"\n dangerouslySetInnerHTML={{\n __html: `\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:${hotjarId},hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n `,\n }}\n />\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAC1B,0BAA6C;AAC7C,wBAAgE;AAChE,kBAAmC;AACnC,iBAA2B;AAC3B,mBAAsB;AAuHE;AAhHxB,SAAS,mBAAmB,mBAA6C;AACvE,8BAAU,MAAM;AACd,iCAAM,iBAAiB;AACvB,iCAAM,iBAAiB;AACvB,iCAAM,iBAAiB;AACvB,iCAAM,iBAAiB;AACvB,kCAAO,iBAAiB;AAAA,EAC1B,GAAG,CAAC,iBAAiB,CAAC;AACxB;AAiBO,SAAS,YACd,MACA,YACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;AACjD,YAAQ,KAAK,+BAA+B;AAC5C;AAAA,EACF;AACA,SAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEO,SAAS,YACd,MACA,YACA,UACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ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track/fbq.cjs';
3
3
  import { Gtag, GaId, GtmId } from '../track/gtag.cjs';
4
4
  import { EventName, TrackName, TrackProperties } from '../track/types.cjs';
5
5
 
6
+ type HotjarId = `${number}`;
6
7
  declare global {
7
8
  interface Window extends Gtag, Pixel {
8
9
  }
@@ -11,6 +12,7 @@ interface Props {
11
12
  gaId?: GaId;
12
13
  gtmId?: GtmId;
13
14
  pixelId?: PixelId;
15
+ hotjarId?: HotjarId;
14
16
  facebookAppId?: string;
15
17
  nonce?: string;
16
18
  debugMode?: boolean;
@@ -18,6 +20,6 @@ interface Props {
18
20
  }
19
21
  declare function sendGAEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): void;
20
22
  declare function sendFBEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string): void;
21
- declare function Analytics({ gaId, nonce, debugMode, pixelId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
23
+ declare function Analytics({ gaId, nonce, debugMode, pixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
22
24
 
23
25
  export { Analytics, sendFBEvent, sendGAEvent };
@@ -3,6 +3,7 @@ import { Pixel, PixelId } from '../track/fbq.js';
3
3
  import { Gtag, GaId, GtmId } from '../track/gtag.js';
4
4
  import { EventName, TrackName, TrackProperties } from '../track/types.js';
5
5
 
6
+ type HotjarId = `${number}`;
6
7
  declare global {
7
8
  interface Window extends Gtag, Pixel {
8
9
  }
@@ -11,6 +12,7 @@ interface Props {
11
12
  gaId?: GaId;
12
13
  gtmId?: GtmId;
13
14
  pixelId?: PixelId;
15
+ hotjarId?: HotjarId;
14
16
  facebookAppId?: string;
15
17
  nonce?: string;
16
18
  debugMode?: boolean;
@@ -18,6 +20,6 @@ interface Props {
18
20
  }
19
21
  declare function sendGAEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): void;
20
22
  declare function sendFBEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string): void;
21
- declare function Analytics({ gaId, nonce, debugMode, pixelId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
23
+ declare function Analytics({ gaId, nonce, debugMode, pixelId, hotjarId, facebookAppId, reportWebVitals, }: Props): react_jsx_runtime.JSX.Element;
22
24
 
23
25
  export { Analytics, sendFBEvent, sendGAEvent };
@@ -41,6 +41,7 @@ function Analytics({
41
41
  nonce,
42
42
  debugMode,
43
43
  pixelId,
44
+ hotjarId,
44
45
  facebookAppId,
45
46
  reportWebVitals = true
46
47
  }) {
@@ -109,33 +110,53 @@ function Analytics({
109
110
  }
110
111
  )
111
112
  ] }),
112
- pixelId && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
113
+ pixelId && /* @__PURE__ */ jsx(
113
114
  "script",
114
115
  {
116
+ async: true,
115
117
  id: "pixel",
116
118
  dangerouslySetInnerHTML: {
117
119
  __html: `
118
- !(function (f, b, e, v, n, t, s) {
119
- if (f.fbq) return;
120
- n = f.fbq = function () {
121
- n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
122
- };
123
- if (!f._fbq) f._fbq = n;
124
- n.push = n;
125
- n.loaded = !0;
126
- n.version = '2.0';
127
- n.queue = [];
128
- t = b.createElement(e);
129
- t.async = !0;
130
- t.src = v;
131
- s = b.getElementsByTagName(e)[0];
132
- s.parentNode.insertBefore(t, s);
133
- })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
134
- fbq('init', '${pixelId}');
135
- fbq('track', 'PageView');`
120
+ !(function (f, b, e, v, n, t, s) {
121
+ if (f.fbq) return;
122
+ n = f.fbq = function () {
123
+ n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
124
+ };
125
+ if (!f._fbq) f._fbq = n;
126
+ n.push = n;
127
+ n.loaded = !0;
128
+ n.version = '2.0';
129
+ n.queue = [];
130
+ t = b.createElement(e);
131
+ t.async = !0;
132
+ t.src = v;
133
+ s = b.getElementsByTagName(e)[0];
134
+ s.parentNode.insertBefore(t, s);
135
+ })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
136
+ fbq('init', '${pixelId}');
137
+ fbq('track', 'PageView');`
136
138
  }
137
139
  }
138
- ) })
140
+ ),
141
+ hotjarId && /* @__PURE__ */ jsx(
142
+ "script",
143
+ {
144
+ async: true,
145
+ id: "hotjar",
146
+ dangerouslySetInnerHTML: {
147
+ __html: `
148
+ (function(h,o,t,j,a,r){
149
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
150
+ h._hjSettings={hjid:${hotjarId},hjsv:6};
151
+ a=o.getElementsByTagName('head')[0];
152
+ r=o.createElement('script');r.async=1;
153
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
154
+ a.appendChild(r);
155
+ })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
156
+ `
157
+ }
158
+ }
159
+ )
139
160
  ] });
140
161
  }
141
162
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react-router/index.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLocation, useSearchParams } from 'react-router';\nimport { onLCP, onCLS, onINP, onFCP, onTTFB, type Metric } from 'web-vitals';\nimport { getLink, type Link } from '../link/index';\nimport { mapFBEvent } from '../track/fbq';\nimport { track } from '../track/index';\nimport type { Pixel, PixelId } from '../track/fbq';\nimport type { Gtag, GaId, GtmId } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\nfunction useReportWebVitals(reportWebVitalsFn: (metric: Metric) => void) {\n useEffect(() => {\n onCLS(reportWebVitalsFn);\n onLCP(reportWebVitalsFn);\n onINP(reportWebVitalsFn);\n onFCP(reportWebVitalsFn);\n onTTFB(reportWebVitalsFn);\n }, [reportWebVitalsFn]);\n}\n\ndeclare global {\n interface Window extends Gtag, Pixel {}\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n pixelId?: PixelId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('gtag has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n pixelId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const { pathname } = useLocation();\n const [params] = useSearchParams();\n\n useEffect(() => {\n const trackUTM = async () => {\n let link: Link | null = null;\n if (params.has('s')) link = await getLink(params.get('s')!);\n\n const properties = {\n pathname,\n referrer: document.referrer,\n fbclid: params.get('fbclid'),\n gclid: params.get('gclid'),\n gad_source: params.get('gad_source'),\n gad_campaignid: params.get('gad_campaignid'),\n utm_source: link?.utm_source ?? params.get('utm_source'),\n utm_medium: link?.utm_medium ?? params.get('utm_medium'),\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign'),\n utm_term: link?.utm_term ?? params.get('utm_term'),\n utm_content: link?.utm_content ?? params.get('utm_content'),\n };\n\n /**\n * Pixel:\n * Each time the Pixel loads, it automatically calls fbq('track', 'PageView') to track a\n * PageView standard event.\n */\n track('page_view', properties, { enableThirdPartyTracking: false });\n };\n\n trackUTM();\n }, [pathname, params]);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <script\n async\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <script\n async\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {pixelId && (\n <>\n <script\n id=\"pixel\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${pixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n </>\n )}\n </>\n );\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,uBAAuB;AAC7C,SAAS,OAAO,OAAO,OAAO,OAAO,cAA2B;AAChE,SAAS,eAA0B;AACnC,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AAmHE,SAEhB,UAFgB,KAEhB,YAFgB;AA9GxB,SAAS,mBAAmB,mBAA6C;AACvE,YAAU,MAAM;AACd,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,WAAO,iBAAiB;AAAA,EAC1B,GAAG,CAAC,iBAAiB,CAAC;AACxB;AAgBO,SAAS,YACd,MACA,YACA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ent":["import { useEffect } from 'react';\nimport { useLocation, useSearchParams } from 'react-router';\nimport { onLCP, onCLS, onINP, onFCP, onTTFB, type Metric } from 'web-vitals';\nimport { getLink, type Link } from '../link/index';\nimport { mapFBEvent } from '../track/fbq';\nimport { track } from '../track/index';\nimport type { Pixel, PixelId } from '../track/fbq';\nimport type { Gtag, GaId, GtmId } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ntype HotjarId = `${number}`;\n\nfunction useReportWebVitals(reportWebVitalsFn: (metric: Metric) => void) {\n useEffect(() => {\n onCLS(reportWebVitalsFn);\n onLCP(reportWebVitalsFn);\n onINP(reportWebVitalsFn);\n onFCP(reportWebVitalsFn);\n onTTFB(reportWebVitalsFn);\n }, [reportWebVitalsFn]);\n}\n\ndeclare global {\n interface Window extends Gtag, Pixel {}\n}\n\ninterface Props {\n gaId?: GaId;\n gtmId?: GtmId;\n pixelId?: PixelId;\n hotjarId?: HotjarId;\n facebookAppId?: string;\n nonce?: string;\n debugMode?: boolean;\n reportWebVitals?: boolean;\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('gtag has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function Analytics({\n gaId,\n nonce,\n debugMode,\n pixelId,\n hotjarId,\n facebookAppId,\n reportWebVitals = true,\n}: Props) {\n const { pathname } = useLocation();\n const [params] = useSearchParams();\n\n useEffect(() => {\n const trackUTM = async () => {\n let link: Link | null = null;\n if (params.has('s')) link = await getLink(params.get('s')!);\n\n const properties = {\n pathname,\n referrer: document.referrer,\n fbclid: params.get('fbclid'),\n gclid: params.get('gclid'),\n gad_source: params.get('gad_source'),\n gad_campaignid: params.get('gad_campaignid'),\n utm_source: link?.utm_source ?? params.get('utm_source'),\n utm_medium: link?.utm_medium ?? params.get('utm_medium'),\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign'),\n utm_term: link?.utm_term ?? params.get('utm_term'),\n utm_content: link?.utm_content ?? params.get('utm_content'),\n };\n\n /**\n * Pixel:\n * Each time the Pixel loads, it automatically calls fbq('track', 'PageView') to track a\n * PageView standard event.\n */\n track('page_view', properties, { enableThirdPartyTracking: false });\n };\n\n trackUTM();\n }, [pathname, params]);\n\n useReportWebVitals((metric) => {\n if (!reportWebVitals) return;\n const properties = {\n id: metric.id,\n rating: metric.rating,\n value: metric.value,\n delta: metric.delta,\n navigation_type: metric.navigationType,\n non_interaction: true, // avoids affecting bounce rate.\n };\n track(metric.name, properties);\n });\n\n return (\n <>\n {facebookAppId && <meta property=\"fb:app_id\" content={facebookAppId} />}\n {gaId && (\n <>\n <script\n async\n id=\"gtag\"\n nonce={nonce}\n src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}\n />\n <script\n async\n nonce={nonce}\n id=\"gtag-init\"\n dangerouslySetInnerHTML={{\n __html: `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}'${debugMode ? \" ,{ 'debug_mode': true }\" : ''});\n `,\n }}\n />\n </>\n )}\n {pixelId && (\n <script\n async\n id=\"pixel\"\n dangerouslySetInnerHTML={{\n __html: `\n !(function (f, b, e, v, n, t, s) {\n if (f.fbq) return;\n n = f.fbq = function () {\n n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n n.push = n;\n n.loaded = !0;\n n.version = '2.0';\n n.queue = [];\n t = b.createElement(e);\n t.async = !0;\n t.src = v;\n s = b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t, s);\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '${pixelId}');\n fbq('track', 'PageView');`,\n }}\n />\n )}\n {hotjarId && (\n <script\n async\n id=\"hotjar\"\n dangerouslySetInnerHTML={{\n __html: `\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:${hotjarId},hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n `,\n }}\n />\n )}\n </>\n );\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,uBAAuB;AAC7C,SAAS,OAAO,OAAO,OAAO,OAAO,cAA2B;AAChE,SAAS,eAA0B;AACnC,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AAuHE,SAEhB,UAFgB,KAEhB,YAFgB;AAhHxB,SAAS,mBAAmB,mBAA6C;AACvE,YAAU,MAAM;AACd,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,UAAM,iBAAiB;AACvB,WAAO,iBAAiB;AAAA,EAC1B,GAAG,CAAC,iBAAiB,CAAC;AACxB;AAiBO,SAAS,YACd,MACA,YACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;AACjD,YAAQ,KAAK,+BAA+B;AAC5C;AAAA,EACF;AACA,SAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEO,SAAS,YACd,MACA,YACA,UACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,QAAM,EAAE,IAAI,IAAI;AA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jB,IAAI,OAAO;AAAA,MACX,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,OAAO,OAAO;AAAA,MACd,iBAAiB,OAAO;AAAA,MACxB,iBAAiB;AAAA;AAAA,IACnB;AACA,UAAM,OAAO,MAAM,UAAU;AAAA,EAC/B,CAAC;AAED,SACE,iCACG;AAAA,qBAAiB,oBAAC,UAAK,UAAS,aAAY,SAAS,eAAe;AAAA,IACpE,QACC,iCACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,OAAK;AAAA,UACL,IAAG;AAAA,UACH;AAAA,UACA,KAAK,+CAA+C,IAAI;AAAA;AAAA,MAC1D;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,OAAK;AAAA,UACL;AAAA,UACA,IAAG;AAAA,UACH,yBAAyB;AAAA,YACvB,QAAQ;AAAA;AAAA;AAAA;AAAA,gCAIU,IAAI,IAAI,YAAY,6BAA6B,EAAE;AAAA;AAAA,UAEvE;AAAA;AAAA,MACF;AAAA,OACF;AAAA,IAED,WACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAK;AAAA,QACL,IAAG;AAAA,QACH,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAiBO,OAAO;AAAA;AAAA,QAExB;AAAA;AAAA,IACF;AAAA,IAED,YACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAK;AAAA,QACL,IAAG;AAAA,QACH,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA;AAAA,oCAGgB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOlC;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":[]}
@@ -28,174 +28,174 @@ __export(schema_exports, {
28
28
  updateVisitorSchema: () => updateVisitorSchema
29
29
  });
30
30
  module.exports = __toCommonJS(schema_exports);
31
- var import_v4_mini = require("zod/v4-mini");
32
- var items = (0, import_v4_mini.array)(
33
- (0, import_v4_mini.record)(
34
- (0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(128)),
35
- (0, import_v4_mini.union)([(0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(512)), (0, import_v4_mini.number)(), (0, import_v4_mini.boolean)(), (0, import_v4_mini.null)()])
31
+ var import_mini = require("zod/mini");
32
+ var items = (0, import_mini.array)(
33
+ (0, import_mini.record)(
34
+ (0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(128)),
35
+ (0, import_mini.union)([(0, import_mini.string)().check((0, import_mini.maxLength)(512)), (0, import_mini.number)(), (0, import_mini.boolean)(), (0, import_mini.null)()])
36
36
  )
37
37
  );
38
- var createTrackEventSchemaV1 = (0, import_v4_mini.array)(
39
- (0, import_v4_mini.object)({
40
- name: (0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(64)),
41
- visitor_id: import_v4_mini.coerce.bigint(),
42
- timestamp: import_v4_mini.iso.datetime(),
43
- tags: (0, import_v4_mini.object)({
44
- os: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
45
- os_name: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
46
- os_version: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
47
- browser: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
48
- browser_name: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
49
- browser_version: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
50
- platform: (0, import_v4_mini.optional)((0, import_v4_mini.enum)(["ios", "android", "web", "macos", "windows", "linux", "unknown"])),
51
- device: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
52
- device_id: (0, import_v4_mini.optional)((0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(36))),
53
- device_type: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
54
- device_vendor: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
55
- device_pixel_ratio: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
56
- screen_resolution: (0, import_v4_mini.optional)(
57
- (0, import_v4_mini.pipe)(
58
- (0, import_v4_mini.string)().check((0, import_v4_mini.regex)(/^\d+x\d+$/)),
59
- (0, import_v4_mini.transform)((v) => v)
38
+ var createTrackEventSchemaV1 = (0, import_mini.array)(
39
+ (0, import_mini.object)({
40
+ name: (0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(64)),
41
+ visitor_id: import_mini.coerce.bigint(),
42
+ timestamp: import_mini.iso.datetime(),
43
+ tags: (0, import_mini.object)({
44
+ os: (0, import_mini.optional)((0, import_mini.string)()),
45
+ os_name: (0, import_mini.optional)((0, import_mini.string)()),
46
+ os_version: (0, import_mini.optional)((0, import_mini.string)()),
47
+ browser: (0, import_mini.optional)((0, import_mini.string)()),
48
+ browser_name: (0, import_mini.optional)((0, import_mini.string)()),
49
+ browser_version: (0, import_mini.optional)((0, import_mini.string)()),
50
+ platform: (0, import_mini.optional)((0, import_mini.enum)(["ios", "android", "web", "macos", "windows", "linux", "unknown"])),
51
+ device: (0, import_mini.optional)((0, import_mini.string)()),
52
+ device_id: (0, import_mini.optional)((0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(36))),
53
+ device_type: (0, import_mini.optional)((0, import_mini.string)()),
54
+ device_vendor: (0, import_mini.optional)((0, import_mini.string)()),
55
+ device_pixel_ratio: (0, import_mini.optional)((0, import_mini.string)()),
56
+ screen_resolution: (0, import_mini.optional)(
57
+ (0, import_mini.pipe)(
58
+ (0, import_mini.string)().check((0, import_mini.regex)(/^\d+x\d+$/)),
59
+ (0, import_mini.transform)((v) => v)
60
60
  )
61
61
  ),
62
- release: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
63
- language: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
64
- time_zone: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
65
- environment: (0, import_v4_mini.optional)((0, import_v4_mini.enum)(["development", "production"])),
66
- source_url: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
67
- source: (0, import_v4_mini.optional)((0, import_v4_mini.enum)(["web", "app", "offline"])),
68
- fbc: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
69
- fbp: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
70
- gclid: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
71
- advertising_id: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
72
- utm_source: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
73
- utm_medium: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
74
- utm_campaign: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
75
- utm_term: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
76
- utm_content: (0, import_v4_mini.optional)((0, import_v4_mini.string)())
62
+ release: (0, import_mini.optional)((0, import_mini.string)()),
63
+ language: (0, import_mini.optional)((0, import_mini.string)()),
64
+ time_zone: (0, import_mini.optional)((0, import_mini.string)()),
65
+ environment: (0, import_mini.optional)((0, import_mini.enum)(["development", "production"])),
66
+ source_url: (0, import_mini.optional)((0, import_mini.string)()),
67
+ source: (0, import_mini.optional)((0, import_mini.enum)(["web", "app", "offline"])),
68
+ fbc: (0, import_mini.optional)((0, import_mini.string)()),
69
+ fbp: (0, import_mini.optional)((0, import_mini.string)()),
70
+ gclid: (0, import_mini.optional)((0, import_mini.string)()),
71
+ advertising_id: (0, import_mini.optional)((0, import_mini.string)()),
72
+ utm_source: (0, import_mini.optional)((0, import_mini.string)()),
73
+ utm_medium: (0, import_mini.optional)((0, import_mini.string)()),
74
+ utm_campaign: (0, import_mini.optional)((0, import_mini.string)()),
75
+ utm_term: (0, import_mini.optional)((0, import_mini.string)()),
76
+ utm_content: (0, import_mini.optional)((0, import_mini.string)())
77
77
  }),
78
- properties: (0, import_v4_mini.optional)(
79
- (0, import_v4_mini.record)(
80
- (0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(128)),
81
- (0, import_v4_mini.union)([(0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(512)), (0, import_v4_mini.number)(), (0, import_v4_mini.boolean)(), (0, import_v4_mini.null)(), items])
82
- ).check((0, import_v4_mini.refine)((data) => Object.keys(data).length <= 64))
78
+ properties: (0, import_mini.optional)(
79
+ (0, import_mini.record)(
80
+ (0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(128)),
81
+ (0, import_mini.union)([(0, import_mini.string)().check((0, import_mini.maxLength)(512)), (0, import_mini.number)(), (0, import_mini.boolean)(), (0, import_mini.null)(), items])
82
+ ).check((0, import_mini.refine)((data) => Object.keys(data).length <= 64))
83
83
  )
84
84
  })
85
- ).check((0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(100));
86
- var createTrackEventSchema = (0, import_v4_mini.array)(
87
- (0, import_v4_mini.object)({
88
- name: (0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(64)),
89
- visitor_id: (0, import_v4_mini.uuid)(),
90
- timestamp: import_v4_mini.iso.datetime(),
91
- tags: (0, import_v4_mini.object)({
92
- os: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
93
- os_name: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
94
- os_version: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
95
- browser: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
96
- browser_name: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
97
- browser_version: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
98
- platform: (0, import_v4_mini.optional)((0, import_v4_mini.enum)(["ios", "android", "web", "macos", "windows", "linux", "unknown"])),
99
- device: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
100
- device_id: (0, import_v4_mini.optional)((0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(36))),
101
- device_type: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
102
- device_vendor: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
103
- device_pixel_ratio: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
104
- screen_resolution: (0, import_v4_mini.optional)(
105
- (0, import_v4_mini.pipe)(
106
- (0, import_v4_mini.string)().check((0, import_v4_mini.regex)(/^\d+x\d+$/)),
107
- (0, import_v4_mini.transform)((v) => v)
85
+ ).check((0, import_mini.minLength)(1), (0, import_mini.maxLength)(100));
86
+ var createTrackEventSchema = (0, import_mini.array)(
87
+ (0, import_mini.object)({
88
+ name: (0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(64)),
89
+ visitor_id: (0, import_mini.uuid)(),
90
+ timestamp: import_mini.iso.datetime(),
91
+ tags: (0, import_mini.object)({
92
+ os: (0, import_mini.optional)((0, import_mini.string)()),
93
+ os_name: (0, import_mini.optional)((0, import_mini.string)()),
94
+ os_version: (0, import_mini.optional)((0, import_mini.string)()),
95
+ browser: (0, import_mini.optional)((0, import_mini.string)()),
96
+ browser_name: (0, import_mini.optional)((0, import_mini.string)()),
97
+ browser_version: (0, import_mini.optional)((0, import_mini.string)()),
98
+ platform: (0, import_mini.optional)((0, import_mini.enum)(["ios", "android", "web", "macos", "windows", "linux", "unknown"])),
99
+ device: (0, import_mini.optional)((0, import_mini.string)()),
100
+ device_id: (0, import_mini.optional)((0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(36))),
101
+ device_type: (0, import_mini.optional)((0, import_mini.string)()),
102
+ device_vendor: (0, import_mini.optional)((0, import_mini.string)()),
103
+ device_pixel_ratio: (0, import_mini.optional)((0, import_mini.string)()),
104
+ screen_resolution: (0, import_mini.optional)(
105
+ (0, import_mini.pipe)(
106
+ (0, import_mini.string)().check((0, import_mini.regex)(/^\d+x\d+$/)),
107
+ (0, import_mini.transform)((v) => v)
108
108
  )
109
109
  ),
110
- release: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
111
- language: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
112
- time_zone: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
113
- environment: (0, import_v4_mini.optional)((0, import_v4_mini.enum)(["development", "production"])),
114
- source_url: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
115
- source: (0, import_v4_mini.optional)((0, import_v4_mini.enum)(["web", "app", "offline"])),
116
- fbc: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
117
- fbp: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
118
- gclid: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
119
- advertising_id: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
120
- utm_source: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
121
- utm_medium: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
122
- utm_campaign: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
123
- utm_term: (0, import_v4_mini.optional)((0, import_v4_mini.string)()),
124
- utm_content: (0, import_v4_mini.optional)((0, import_v4_mini.string)())
110
+ release: (0, import_mini.optional)((0, import_mini.string)()),
111
+ language: (0, import_mini.optional)((0, import_mini.string)()),
112
+ time_zone: (0, import_mini.optional)((0, import_mini.string)()),
113
+ environment: (0, import_mini.optional)((0, import_mini.enum)(["development", "production"])),
114
+ source_url: (0, import_mini.optional)((0, import_mini.string)()),
115
+ source: (0, import_mini.optional)((0, import_mini.enum)(["web", "app", "offline"])),
116
+ fbc: (0, import_mini.optional)((0, import_mini.string)()),
117
+ fbp: (0, import_mini.optional)((0, import_mini.string)()),
118
+ gclid: (0, import_mini.optional)((0, import_mini.string)()),
119
+ advertising_id: (0, import_mini.optional)((0, import_mini.string)()),
120
+ utm_source: (0, import_mini.optional)((0, import_mini.string)()),
121
+ utm_medium: (0, import_mini.optional)((0, import_mini.string)()),
122
+ utm_campaign: (0, import_mini.optional)((0, import_mini.string)()),
123
+ utm_term: (0, import_mini.optional)((0, import_mini.string)()),
124
+ utm_content: (0, import_mini.optional)((0, import_mini.string)())
125
125
  }),
126
- properties: (0, import_v4_mini.optional)(
127
- (0, import_v4_mini.record)(
128
- (0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(128)),
129
- (0, import_v4_mini.union)([(0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(512)), (0, import_v4_mini.number)(), (0, import_v4_mini.boolean)(), (0, import_v4_mini.null)(), items])
130
- ).check((0, import_v4_mini.refine)((data) => Object.keys(data).length <= 64))
126
+ properties: (0, import_mini.optional)(
127
+ (0, import_mini.record)(
128
+ (0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(128)),
129
+ (0, import_mini.union)([(0, import_mini.string)().check((0, import_mini.maxLength)(512)), (0, import_mini.number)(), (0, import_mini.boolean)(), (0, import_mini.null)(), items])
130
+ ).check((0, import_mini.refine)((data) => Object.keys(data).length <= 64))
131
131
  )
132
132
  })
133
- ).check((0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(100));
134
- var createVisitorSchema = (0, import_v4_mini.object)({
135
- device_id: (0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(36)),
136
- properties: (0, import_v4_mini.optional)(
137
- (0, import_v4_mini.record)(
138
- (0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(128)),
139
- (0, import_v4_mini.union)([(0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(512)), (0, import_v4_mini.number)(), (0, import_v4_mini.boolean)(), (0, import_v4_mini.null)()])
140
- ).check((0, import_v4_mini.refine)((data) => Object.keys(data).length <= 64))
133
+ ).check((0, import_mini.minLength)(1), (0, import_mini.maxLength)(100));
134
+ var createVisitorSchema = (0, import_mini.object)({
135
+ device_id: (0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(36)),
136
+ properties: (0, import_mini.optional)(
137
+ (0, import_mini.record)(
138
+ (0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(128)),
139
+ (0, import_mini.union)([(0, import_mini.string)().check((0, import_mini.maxLength)(512)), (0, import_mini.number)(), (0, import_mini.boolean)(), (0, import_mini.null)()])
140
+ ).check((0, import_mini.refine)((data) => Object.keys(data).length <= 64))
141
141
  )
142
142
  });
143
- var updateVisitorSchema = (0, import_v4_mini.object)({
144
- user_id: (0, import_v4_mini.optional)((0, import_v4_mini.uuid)()),
145
- properties: (0, import_v4_mini.optional)(
146
- (0, import_v4_mini.record)(
147
- (0, import_v4_mini.string)().check((0, import_v4_mini.trim)(), (0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(128)),
148
- (0, import_v4_mini.union)([(0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(512)), (0, import_v4_mini.number)(), (0, import_v4_mini.boolean)(), (0, import_v4_mini.null)()])
149
- ).check((0, import_v4_mini.refine)((data) => Object.keys(data).length <= 64))
143
+ var updateVisitorSchema = (0, import_mini.object)({
144
+ user_id: (0, import_mini.optional)((0, import_mini.uuid)()),
145
+ properties: (0, import_mini.optional)(
146
+ (0, import_mini.record)(
147
+ (0, import_mini.string)().check((0, import_mini.trim)(), (0, import_mini.minLength)(1), (0, import_mini.maxLength)(128)),
148
+ (0, import_mini.union)([(0, import_mini.string)().check((0, import_mini.maxLength)(512)), (0, import_mini.number)(), (0, import_mini.boolean)(), (0, import_mini.null)()])
149
+ ).check((0, import_mini.refine)((data) => Object.keys(data).length <= 64))
150
150
  )
151
151
  });
152
- var createFeedbackSchema = (0, import_v4_mini.object)({
153
- name: (0, import_v4_mini.string)().check((0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(256)),
154
- email: (0, import_v4_mini.email)().check((0, import_v4_mini.maxLength)(320)),
155
- message: (0, import_v4_mini.string)().check((0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(65536))
152
+ var createFeedbackSchema = (0, import_mini.object)({
153
+ name: (0, import_mini.string)().check((0, import_mini.minLength)(1), (0, import_mini.maxLength)(256)),
154
+ email: (0, import_mini.email)().check((0, import_mini.maxLength)(320)),
155
+ message: (0, import_mini.string)().check((0, import_mini.minLength)(1), (0, import_mini.maxLength)(65536))
156
156
  });
157
- var createLinkSchema = (0, import_v4_mini.object)({
157
+ var createLinkSchema = (0, import_mini.object)({
158
158
  /** The URL that the user is redirected to. */
159
- url: (0, import_v4_mini.url)().check((0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(1024)),
159
+ url: (0, import_mini.url)().check((0, import_mini.minLength)(1), (0, import_mini.maxLength)(1024)),
160
160
  // required
161
161
  /**
162
162
  * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4
163
163
  * data import. Use the same IDs that you use when uploading campaign cost data.
164
164
  */
165
- utm_id: (0, import_v4_mini.optional)((0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(256))),
165
+ utm_id: (0, import_mini.optional)((0, import_mini.string)().check((0, import_mini.maxLength)(256))),
166
166
  /** Referrer, for example: google, newsletter4, billboard */
167
- utm_source: (0, import_v4_mini.string)().check((0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(256)),
167
+ utm_source: (0, import_mini.string)().check((0, import_mini.minLength)(1), (0, import_mini.maxLength)(256)),
168
168
  // required
169
169
  /** Marketing medium, for example: cpc, banner, email */
170
- utm_medium: (0, import_v4_mini.string)().check((0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(256)),
170
+ utm_medium: (0, import_mini.string)().check((0, import_mini.minLength)(1), (0, import_mini.maxLength)(256)),
171
171
  // required
172
172
  /** Product, slogan, promo code, for example: spring_sale */
173
- utm_campaign: (0, import_v4_mini.string)().check((0, import_v4_mini.minLength)(1), (0, import_v4_mini.maxLength)(256)),
173
+ utm_campaign: (0, import_mini.string)().check((0, import_mini.minLength)(1), (0, import_mini.maxLength)(256)),
174
174
  // required
175
175
  /** Paid keyword */
176
- utm_term: (0, import_v4_mini.optional)((0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(256))),
176
+ utm_term: (0, import_mini.optional)((0, import_mini.string)().check((0, import_mini.maxLength)(256))),
177
177
  /**
178
178
  * Use to differentiate creatives. For example, if you have two call-to-action links within the
179
179
  * same email message, you can use utm_content and set different values for each so you can tell
180
180
  * which version is more effective.
181
181
  */
182
- utm_content: (0, import_v4_mini.optional)((0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(256))),
182
+ utm_content: (0, import_mini.optional)((0, import_mini.string)().check((0, import_mini.maxLength)(256))),
183
183
  /**
184
184
  * The platform responsible for directing traffic to a given Analytics property (such as a buying
185
185
  * platform that sets budgets and targeting criteria or a platform that manages organic traffic
186
186
  * data). For example: Search Ads 360 or Display & Video 360.
187
187
  */
188
- utm_source_platform: (0, import_v4_mini.optional)((0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(256))),
188
+ utm_source_platform: (0, import_mini.optional)((0, import_mini.string)().check((0, import_mini.maxLength)(256))),
189
189
  /**
190
190
  * Type of creative, for example: display, native, video, search, utm_creative_format is not
191
191
  * currently reported in Google Analytics 4 properties.
192
192
  */
193
- utm_creative_format: (0, import_v4_mini.optional)((0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(256))),
193
+ utm_creative_format: (0, import_mini.optional)((0, import_mini.string)().check((0, import_mini.maxLength)(256))),
194
194
  /**
195
195
  * Targeting criteria applied to a campaign, for example: remarketing, prospecting,
196
196
  * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.
197
197
  * */
198
- utm_marketing_tactic: (0, import_v4_mini.optional)((0, import_v4_mini.string)().check((0, import_v4_mini.maxLength)(256)))
198
+ utm_marketing_tactic: (0, import_mini.optional)((0, import_mini.string)().check((0, import_mini.maxLength)(256)))
199
199
  });
200
200
  // Annotate the CommonJS export names for ESM import in node:
201
201
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n optional,\n object,\n string,\n regex,\n number,\n boolean,\n null as _null,\n coerce,\n enum as _enum,\n trim,\n union,\n record,\n array,\n iso,\n minLength,\n maxLength,\n refine,\n pipe,\n transform,\n email,\n type z,\n uuid,\n url,\n} from 'zod/v4-mini';\n\nconst items = array(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n )\n);\n\n/** @deprecated */\nexport const createTrackEventSchemaV1 = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: coerce.bigint(),\n timestamp: iso.datetime(),\n tags: object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: optional(_enum(['ios', 'android', 'web', 'macos', 'windows', 'linux', 'unknown'])),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(string()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: optional(_enum(['development', 'production'])),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n fbc: optional(string()),\n fbp: optional(string()),\n gclid: optional(string()),\n advertising_id: optional(string()),\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n }),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n })\n).check(minLength(1), maxLength(100));\n\nexport const createTrackEventSchema = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: uuid(),\n timestamp: iso.datetime(),\n tags: object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: optional(_enum(['ios', 'android', 'web', 'macos', 'windows', 'linux', 'unknown'])),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(string()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: optional(_enum(['development', 'production'])),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n fbc: optional(string()),\n fbp: optional(string()),\n gclid: optional(string()),\n advertising_id: optional(string()),\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n }),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n })\n).check(minLength(1), maxLength(100));\n\nexport const createVisitorSchema = object({\n device_id: string().check(trim(), minLength(1), maxLength(36)),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const updateVisitorSchema = object({\n user_id: optional(uuid()),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const createFeedbackSchema = object({\n name: string().check(minLength(1), maxLength(256)),\n email: email().check(maxLength(320)),\n message: string().check(minLength(1), maxLength(65536)),\n});\n\n/**\n * The schema for creating a link.\n * @see https://support.google.com/analytics/answer/10917952\n * */\nexport const createLinkSchema = object({\n /** The URL that the user is redirected to. */\n url: url().check(minLength(1), maxLength(1024)), // required\n\n /**\n * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4\n * data import. Use the same IDs that you use when uploading campaign cost data.\n */\n utm_id: optional(string().check(maxLength(256))),\n\n /** Referrer, for example: google, newsletter4, billboard */\n utm_source: string().check(minLength(1), maxLength(256)), // required\n\n /** Marketing medium, for example: cpc, banner, email */\n utm_medium: string().check(minLength(1), maxLength(256)), // required\n\n /** Product, slogan, promo code, for example: spring_sale */\n utm_campaign: string().check(minLength(1), maxLength(256)), // required\n\n /** Paid keyword */\n utm_term: optional(string().check(maxLength(256))),\n\n /**\n * Use to differentiate creatives. For example, if you have two call-to-action links within the\n * same email message, you can use utm_content and set different values for each so you can tell\n * which version is more effective.\n */\n utm_content: optional(string().check(maxLength(256))),\n\n /**\n * The platform responsible for directing traffic to a given Analytics property (such as a buying\n * platform that sets budgets and targeting criteria or a platform that manages organic traffic\n * data). For example: Search Ads 360 or Display & Video 360.\n */\n utm_source_platform: optional(string().check(maxLength(256))),\n\n /**\n * Type of creative, for example: display, native, video, search, utm_creative_format is not\n * currently reported in Google Analytics 4 properties.\n */\n utm_creative_format: optional(string().check(maxLength(256))),\n\n /**\n * Targeting criteria applied to a campaign, for example: remarketing, prospecting,\n * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.\n * */\n utm_marketing_tactic: optional(string().check(maxLength(256))),\n});\n\nexport type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;\nexport type CreateLinkDTO = z.output<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,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD,iBAAa,6BAAS,uBAAO,EAAE,UAAM,0BAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpD,yBAAqB,6BAAS,uBAAO,EAAE,UAAM,0BAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,yBAAqB,6BAAS,uBAAO,EAAE,UAAM,0BAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,0BAAsB,6BAAS,uBAAO,EAAE,UAAM,0BAAU,GAAG,CAAC,CAAC;AAC/D,CAAC;","names":["_null","_enum"]}
1
+ {"version":3,"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n optional,\n object,\n string,\n regex,\n number,\n boolean,\n null as _null,\n coerce,\n enum as _enum,\n trim,\n union,\n record,\n array,\n iso,\n minLength,\n maxLength,\n refine,\n pipe,\n transform,\n email,\n type z,\n uuid,\n url,\n} from 'zod/mini';\n\nconst items = array(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n )\n);\n\n/** @deprecated */\nexport const createTrackEventSchemaV1 = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: coerce.bigint(),\n timestamp: iso.datetime(),\n tags: object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: optional(_enum(['ios', 'android', 'web', 'macos', 'windows', 'linux', 'unknown'])),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(string()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: optional(_enum(['development', 'production'])),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n fbc: optional(string()),\n fbp: optional(string()),\n gclid: optional(string()),\n advertising_id: optional(string()),\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n }),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n })\n).check(minLength(1), maxLength(100));\n\nexport const createTrackEventSchema = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: uuid(),\n timestamp: iso.datetime(),\n tags: object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: optional(_enum(['ios', 'android', 'web', 'macos', 'windows', 'linux', 'unknown'])),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(string()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: optional(_enum(['development', 'production'])),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n fbc: optional(string()),\n fbp: optional(string()),\n gclid: optional(string()),\n advertising_id: optional(string()),\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n }),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n })\n).check(minLength(1), maxLength(100));\n\nexport const createVisitorSchema = object({\n device_id: string().check(trim(), minLength(1), maxLength(36)),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const updateVisitorSchema = object({\n user_id: optional(uuid()),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const createFeedbackSchema = object({\n name: string().check(minLength(1), maxLength(256)),\n email: email().check(maxLength(320)),\n message: string().check(minLength(1), maxLength(65536)),\n});\n\n/**\n * The schema for creating a link.\n * @see https://support.google.com/analytics/answer/10917952\n * */\nexport const createLinkSchema = object({\n /** The URL that the user is redirected to. */\n url: url().check(minLength(1), maxLength(1024)), // required\n\n /**\n * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4\n * data import. Use the same IDs that you use when uploading campaign cost data.\n */\n utm_id: optional(string().check(maxLength(256))),\n\n /** Referrer, for example: google, newsletter4, billboard */\n utm_source: string().check(minLength(1), maxLength(256)), // required\n\n /** Marketing medium, for example: cpc, banner, email */\n utm_medium: string().check(minLength(1), maxLength(256)), // required\n\n /** Product, slogan, promo code, for example: spring_sale */\n utm_campaign: string().check(minLength(1), maxLength(256)), // required\n\n /** Paid keyword */\n utm_term: optional(string().check(maxLength(256))),\n\n /**\n * Use to differentiate creatives. For example, if you have two call-to-action links within the\n * same email message, you can use utm_content and set different values for each so you can tell\n * which version is more effective.\n */\n utm_content: optional(string().check(maxLength(256))),\n\n /**\n * The platform responsible for directing traffic to a given Analytics property (such as a buying\n * platform that sets budgets and targeting criteria or a platform that manages organic traffic\n * data). For example: Search Ads 360 or Display & Video 360.\n */\n utm_source_platform: optional(string().check(maxLength(256))),\n\n /**\n * Type of creative, for example: display, native, video, search, utm_creative_format is not\n * currently reported in Google Analytics 4 properties.\n */\n utm_creative_format: optional(string().check(maxLength(256))),\n\n /**\n * Targeting criteria applied to a campaign, for example: remarketing, prospecting,\n * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.\n * */\n utm_marketing_tactic: optional(string().check(maxLength(256))),\n});\n\nexport type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;\nexport type CreateLinkDTO = z.output<typeof createLinkSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAwBO;AAEP,IAAM,YAAQ;AAAA,MACZ;AAAA,QACE,oBAAO,EAAE,UAAM,kBAAK,OAAG,uBAAU,CAAC,OAAG,uBAAU,GAAG,CAAC;AAAA,QACnD,mBAAM,KAAC,oBAAO,EAAE,UAAM,uBAAU,GAAG,CAAC,OAAG,oBAAO,OAAG,qBAAQ,OAAG,YAAAA,MAAM,CAAC,CAAC;AAAA,EACtE;AACF;AAGO,IAAM,+BAA2B;AAAA,MACtC,oBAAO;AAAA,IACL,UAAM,oBAAO,EAAE,UAAM,kBAAK,OAAG,uBAAU,CAAC,OAAG,uBAAU,EAAE,CAAC;AAAA,IACxD,YAAY,mBAAO,OAAO;AAAA,IAC1B,WAAW,gBAAI,SAAS;AAAA,IACxB,UAAM,oBAAO;AAAA,MACX,QAAI,0BAAS,oBAAO,CAAC;AAAA,MACrB,aAAS,0BAAS,oBAAO,CAAC;AAAA,MAC1B,gBAAY,0BAAS,oBAAO,CAAC;AAAA,MAC7B,aAAS,0BAAS,oBAAO,CAAC;AAAA,MAC1B,kBAAc,0BAAS,oBAAO,CAAC;AAAA,MAC/B,qBAAiB,0BAAS,oBAAO,CAAC;AAAA,MAClC,cAAU,0BAAS,YAAAC,MAAM,CAAC,OAAO,WAAW,OAAO,SAAS,WAAW,SAAS,SAAS,CAAC,CAAC;AAAA,MAC3F,YAAQ,0BAAS,oBAAO,CAAC;AAAA,MACzB,eAAW,0BAAS,oBAAO,EAAE,UAAM,kBAAK,OAAG,uBAAU,CAAC,OAAG,uBAAU,EAAE,CAAC,CAAC;AAA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AAAA,EAGvD,kBAAc,oBAAO,EAAE,UAAM,uBAAU,CAAC,OAAG,uBAAU,GAAG,CAAC;AAAA;AAAA;AAAA,EAGzD,cAAU,0BAAS,oBAAO,EAAE,UAAM,uBAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD,iBAAa,0BAAS,oBAAO,EAAE,UAAM,uBAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpD,yBAAqB,0BAAS,oBAAO,EAAE,UAAM,uBAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,yBAAqB,0BAAS,oBAAO,EAAE,UAAM,uBAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,0BAAsB,0BAAS,oBAAO,EAAE,UAAM,uBAAU,GAAG,CAAC,CAAC;AAC/D,CAAC;","names":["_null","_enum"]}
@@ -1,4 +1,4 @@
1
- import { z, iso } from 'zod/v4-mini';
1
+ import { z, iso } from 'zod/mini';
2
2
 
3
3
  /** @deprecated */
4
4
  declare const createTrackEventSchemaV1: z.ZodMiniArray<z.ZodMiniObject<{
@@ -1,4 +1,4 @@
1
- import { z, iso } from 'zod/v4-mini';
1
+ import { z, iso } from 'zod/mini';
2
2
 
3
3
  /** @deprecated */
4
4
  declare const createTrackEventSchemaV1: z.ZodMiniArray<z.ZodMiniObject<{
@@ -22,7 +22,7 @@ import {
22
22
  email,
23
23
  uuid,
24
24
  url
25
- } from "zod/v4-mini";
25
+ } from "zod/mini";
26
26
  var items = array(
27
27
  record(
28
28
  string().check(trim(), minLength(1), maxLength(128)),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n optional,\n object,\n string,\n regex,\n number,\n boolean,\n null as _null,\n coerce,\n enum as _enum,\n trim,\n union,\n record,\n array,\n iso,\n minLength,\n maxLength,\n refine,\n pipe,\n transform,\n email,\n type z,\n uuid,\n url,\n} from 'zod/v4-mini';\n\nconst items = array(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n )\n);\n\n/** @deprecated */\nexport const createTrackEventSchemaV1 = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: coerce.bigint(),\n timestamp: iso.datetime(),\n tags: object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: optional(_enum(['ios', 'android', 'web', 'macos', 'windows', 'linux', 'unknown'])),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(string()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: optional(_enum(['development', 'production'])),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n fbc: optional(string()),\n fbp: optional(string()),\n gclid: optional(string()),\n advertising_id: optional(string()),\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n }),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n })\n).check(minLength(1), maxLength(100));\n\nexport const createTrackEventSchema = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: uuid(),\n timestamp: iso.datetime(),\n tags: object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: optional(_enum(['ios', 'android', 'web', 'macos', 'windows', 'linux', 'unknown'])),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(string()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: optional(_enum(['development', 'production'])),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n fbc: optional(string()),\n fbp: optional(string()),\n gclid: optional(string()),\n advertising_id: optional(string()),\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n }),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n })\n).check(minLength(1), maxLength(100));\n\nexport const createVisitorSchema = object({\n device_id: string().check(trim(), minLength(1), maxLength(36)),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const updateVisitorSchema = object({\n user_id: optional(uuid()),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const createFeedbackSchema = object({\n name: string().check(minLength(1), maxLength(256)),\n email: email().check(maxLength(320)),\n message: string().check(minLength(1), maxLength(65536)),\n});\n\n/**\n * The schema for creating a link.\n * @see https://support.google.com/analytics/answer/10917952\n * */\nexport const createLinkSchema = object({\n /** The URL that the user is redirected to. */\n url: url().check(minLength(1), maxLength(1024)), // required\n\n /**\n * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4\n * data import. Use the same IDs that you use when uploading campaign cost data.\n */\n utm_id: optional(string().check(maxLength(256))),\n\n /** Referrer, for example: google, newsletter4, billboard */\n utm_source: string().check(minLength(1), maxLength(256)), // required\n\n /** Marketing medium, for example: cpc, banner, email */\n utm_medium: string().check(minLength(1), maxLength(256)), // required\n\n /** Product, slogan, promo code, for example: spring_sale */\n utm_campaign: string().check(minLength(1), maxLength(256)), // required\n\n /** Paid keyword */\n utm_term: optional(string().check(maxLength(256))),\n\n /**\n * Use to differentiate creatives. For example, if you have two call-to-action links within the\n * same email message, you can use utm_content and set different values for each so you can tell\n * which version is more effective.\n */\n utm_content: optional(string().check(maxLength(256))),\n\n /**\n * The platform responsible for directing traffic to a given Analytics property (such as a buying\n * platform that sets budgets and targeting criteria or a platform that manages organic traffic\n * data). For example: Search Ads 360 or Display & Video 360.\n */\n utm_source_platform: optional(string().check(maxLength(256))),\n\n /**\n * Type of creative, for example: display, native, video, search, utm_creative_format is not\n * currently reported in Google Analytics 4 properties.\n */\n utm_creative_format: optional(string().check(maxLength(256))),\n\n /**\n * Targeting criteria applied to a campaign, for example: remarketing, prospecting,\n * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.\n * */\n utm_marketing_tactic: optional(string().check(maxLength(256))),\n});\n\nexport type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;\nexport type CreateLinkDTO = z.output<typeof createLinkSchema>;\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,QAAQ;AAAA,EACZ;AAAA,IACE,OAAO,EAAE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;AAAA,IACnD,MAAM,CAAC,OAAO,EAAE,MAAM,UAAU,GAAG,C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CAAC,GAAG,UAAU,KAAK,CAAC;AACxD,CAAC;AAMM,IAAM,mBAAmB,OAAO;AAAA;AAAA,EAErC,KAAK,IAAI,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9C,QAAQ,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA,EAG/C,YAAY,OAAO,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;AAAA;AAAA;AAAA,EAGvD,YAAY,OAAO,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;AAAA;AAAA;AAAA,EAGvD,cAAc,OAAO,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;AAAA;AAAA;AAAA,EAGzD,UAAU,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD,aAAa,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpD,qBAAqB,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,qBAAqB,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,sBAAsB,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAC/D,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n optional,\n object,\n string,\n regex,\n number,\n boolean,\n null as _null,\n coerce,\n enum as _enum,\n trim,\n union,\n record,\n array,\n iso,\n minLength,\n maxLength,\n refine,\n pipe,\n transform,\n email,\n type z,\n uuid,\n url,\n} from 'zod/mini';\n\nconst items = array(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n )\n);\n\n/** @deprecated */\nexport const createTrackEventSchemaV1 = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: coerce.bigint(),\n timestamp: iso.datetime(),\n tags: object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: optional(_enum(['ios', 'android', 'web', 'macos', 'windows', 'linux', 'unknown'])),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(string()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: optional(_enum(['development', 'production'])),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n fbc: optional(string()),\n fbp: optional(string()),\n gclid: optional(string()),\n advertising_id: optional(string()),\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n }),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n })\n).check(minLength(1), maxLength(100));\n\nexport const createTrackEventSchema = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: uuid(),\n timestamp: iso.datetime(),\n tags: object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: optional(_enum(['ios', 'android', 'web', 'macos', 'windows', 'linux', 'unknown'])),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(string()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: optional(_enum(['development', 'production'])),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n fbc: optional(string()),\n fbp: optional(string()),\n gclid: optional(string()),\n advertising_id: optional(string()),\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n }),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n })\n).check(minLength(1), maxLength(100));\n\nexport const createVisitorSchema = object({\n device_id: string().check(trim(), minLength(1), maxLength(36)),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const updateVisitorSchema = object({\n user_id: optional(uuid()),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const createFeedbackSchema = object({\n name: string().check(minLength(1), maxLength(256)),\n email: email().check(maxLength(320)),\n message: string().check(minLength(1), maxLength(65536)),\n});\n\n/**\n * The schema for creating a link.\n * @see https://support.google.com/analytics/answer/10917952\n * */\nexport const createLinkSchema = object({\n /** The URL that the user is redirected to. */\n url: url().check(minLength(1), maxLength(1024)), // required\n\n /**\n * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4\n * data import. Use the same IDs that you use when uploading campaign cost data.\n */\n utm_id: optional(string().check(maxLength(256))),\n\n /** Referrer, for example: google, newsletter4, billboard */\n utm_source: string().check(minLength(1), maxLength(256)), // required\n\n /** Marketing medium, for example: cpc, banner, email */\n utm_medium: string().check(minLength(1), maxLength(256)), // required\n\n /** Product, slogan, promo code, for example: spring_sale */\n utm_campaign: string().check(minLength(1), maxLength(256)), // required\n\n /** Paid keyword */\n utm_term: optional(string().check(maxLength(256))),\n\n /**\n * Use to differentiate creatives. For example, if you have two call-to-action links within the\n * same email message, you can use utm_content and set different values for each so you can tell\n * which version is more effective.\n */\n utm_content: optional(string().check(maxLength(256))),\n\n /**\n * The platform responsible for directing traffic to a given Analytics property (such as a buying\n * platform that sets budgets and targeting criteria or a platform that manages organic traffic\n * data). For example: Search Ads 360 or Display & Video 360.\n */\n utm_source_platform: optional(string().check(maxLength(256))),\n\n /**\n * Type of creative, for example: display, native, video, search, utm_creative_format is not\n * currently reported in Google Analytics 4 properties.\n */\n utm_creative_format: optional(string().check(maxLength(256))),\n\n /**\n * Targeting criteria applied to a campaign, for example: remarketing, prospecting,\n * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.\n * */\n utm_marketing_tactic: optional(string().check(maxLength(256))),\n});\n\nexport type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;\nexport type CreateLinkDTO = z.output<typeof createLinkSchema>;\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,QAAQ;AAAA,EACZ;AAAA,IACE,OAAO,EAAE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;AAAA,IACnD,MAAM,CAAC,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAC;AAAA,EACtE;AACF;AA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;AAAA,EAErC,KAAK,IAAI,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9C,QAAQ,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA,EAG/C,YAAY,OAAO,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;AAAA;AAAA;AAAA,EAGvD,YAAY,OAAO,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;AAAA;AAAA;AAAA,EAGvD,cAAc,OAAO,EAAE,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;AAAA;AAAA;AAAA,EAGzD,UAAU,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD,aAAa,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpD,qBAAqB,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,qBAAqB,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5D,sBAAsB,SAAS,OAAO,EAAE,MAAM,UAAU,GAAG,CAAC,CAAC;AAC/D,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shware/analytics",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -57,7 +57,7 @@
57
57
  "cookie": "^1.0.2",
58
58
  "uuid": "^11.1.0",
59
59
  "web-vitals": "^5.0.3",
60
- "zod": "^3.25.76"
60
+ "zod": "^4.0.2"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@repo/eslint-config": "workspace:*",