analytica.click 0.0.636 → 0.0.637

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 +1 @@
1
- "use strict";var d=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var j=(e,r)=>{for(var s in r)d(e,s,{get:r[s],enumerable:!0})},J=(e,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of E(r))!P.call(e,o)&&o!==s&&d(e,o,{get:()=>r[o],enumerable:!(n=$(r,o))||n.enumerable});return e};var x=e=>J(d({},"__esModule",{value:!0}),e);var H={};j(H,{errorTrack:()=>N,getErrorKey:()=>S});module.exports=x(H);var I=require("cross-fetch/polyfill"),m=require("ag-common/dist/common/helpers/hashCode"),a=require("ag-common/dist/common/helpers/log"),T=require("ag-common/dist/common/helpers/object"),w=require("ag-common/dist/common/helpers/string/contains");var h=(e,r)=>{let s=[],n={},o=0;return Object.entries(e).forEach(([t,i])=>{o<r?s.push(i):n[t]=i,o+=1}),{part:s,rest:n}};var k=typeof window<"u"&&window.location.hostname==="localhost",g={},u,p,O=async()=>{try{if(Object.keys(g).length>100){let n=Object.keys(g)[0],o=g[n],t=await fetch(`${p}/site/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify([{key:o.key,data:{...o.data,message:`error overload!: ${o.data.message||"?"}`}}])});if(g={},!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return{}}let{part:e,rest:r}=h(g,10);g=r;let s=await fetch(`${p}/site/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify(e)});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`)}catch(e){let r=e;return{error:r?.message??r.message}}finally{Object.keys(g).length>0?u=setTimeout(O,1e3):u=void 0}},N=async({data:e,overrideBaseUrl:r="https://analytica.click/api",ignoreBrowserErrors:s=["will be removed","performing full reload","tracking error","fetch RSC payload","perform a full reload","warnings#debug_enabled",'"digest"',"punycode"],devMode:n})=>{if(r||(r="https://analytica.click/api"),r.startsWith("/")&&typeof window>"u"&&(r="https://analytica.click/api"),s.length>0){let t=(0,w.containsInsensitive)(e.data.message,...s);if(t){(0,a.debug)("ignoring error, contains=",t);return}}if(k&&n)(0,a.debug)("allowing local error tracking due to devmode=true");else if(k)return(0,a.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${r}`),{};if(!R(e.data.message))return{};(0,a.debug)("error track",e.data.message,JSON.stringify(e));let o=S({...e.data,name:e.data.name??"unknown"});return g[o]=e,p=r,u??=setTimeout(O,500),{}};function R(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,a.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,a.info)("empty message payload?"),!1):!0:((0,a.info)("no message?"),!1)}var S=e=>{try{let r=/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/gim,s=/(at \S+?) \(\S+\)\s/gim,n=/^((%[cs])+\s*)+$/gim,o=/^color:/gim,t=[],i=e.message;(0,T.isJson)(i)?t=JSON.parse(i):t=[i];let f=t.findIndex(c=>c.match(n)),l=t.findIndex(c=>c.match(o));f>=0&&l>=0&&l===f+1&&(t=t.filter((c,b)=>![f,l].includes(b))),t=t.map(c=>c.includes(".js:")||c.includes("node_modules")?c.replace(s,"$1 (stacktrace)"):c.replace(r,"[date]")),i=JSON.stringify(t);let y=(0,m.hashCode)(i).toString();return(0,a.debug)("got errorKey=",i,y),y}catch{return(0,m.hashCode)(e.message).toString()}};0&&(module.exports={errorTrack,getErrorKey});
1
+ "use strict";var d=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var j=(e,t)=>{for(var s in t)d(e,s,{get:t[s],enumerable:!0})},J=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of E(t))!P.call(e,o)&&o!==s&&d(e,o,{get:()=>t[o],enumerable:!(n=$(t,o))||n.enumerable});return e};var x=e=>J(d({},"__esModule",{value:!0}),e);var H={};j(H,{errorTrack:()=>N,getErrorKey:()=>S});module.exports=x(H);var I=require("cross-fetch/polyfill"),m=require("ag-common/dist/common/helpers/hashCode"),a=require("ag-common/dist/common/helpers/log"),T=require("ag-common/dist/common/helpers/object"),w=require("ag-common/dist/common/helpers/string/contains");var h=(e,t)=>{let s=[],n={},o=0;return Object.entries(e).forEach(([r,i])=>{o<t?s.push(i):n[r]=i,o+=1}),{part:s,rest:n}};var k=typeof window<"u"&&window.location.hostname==="localhost",g={},u,p,O=async()=>{try{if(Object.keys(g).length>100){let n=Object.keys(g)[0],o=g[n],r=await fetch(`${p}/site/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify([{key:o.key,data:{...o.data,message:`error overload!: ${o.data.message||"?"}`}}])});if(g={},!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return{}}let{part:e,rest:t}=h(g,10);g=t;let s=await fetch(`${p}/site/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify(e)});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`)}catch(e){let t=e;return{error:t?.message??t.message}}finally{Object.keys(g).length>0?u=setTimeout(O,1e3):u=void 0}},N=async({data:e,overrideBaseUrl:t="https://analytica.click/api",ignoreBrowserErrors:s=["will be removed","performing full reload","tracking error","fetch RSC payload","perform a full reload","warnings#debug_enabled",'"digest"',"punycode"],devMode:n})=>{if(t||(t="https://analytica.click/api"),t.startsWith("/")&&typeof window>"u"&&(t="https://analytica.click/api"),s.length>0){let r=(0,w.containsInsensitive)(e.data.message,...s);if(r){(0,a.debug)("ignoring error, contains=",r);return}}if(k&&n)(0,a.debug)("allowing local error tracking due to devmode=true");else if(k)return(0,a.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${t}`),{};if(!R(e.data.message))return{};(0,a.debug)("error track",e.data.message,JSON.stringify(e));let o=S({...e.data,name:e.data.name??"unknown"});return g[o]=e,p=t,u??=setTimeout(O,500),{}};function R(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,a.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,a.info)("empty message payload?"),!1):!0:((0,a.info)("no message?"),!1)}var S=e=>{try{let t=/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/gim,s=/(at \S+?) \(\S+\)\s/gim,n=/^((%[cs])+\s*)+$/gim,o=/^color:/gim,r=[],i=e.message;(0,T.isJson)(i)?r=JSON.parse(i):r=[i];let f=r.findIndex(c=>c.match(n)),l=r.findIndex(c=>c.match(o));f>=0&&l>=0&&l===f+1&&(r=r.filter((c,b)=>![f,l].includes(b))),r=r.map(c=>c.includes(".js:")||c.includes("node_modules")?c.replace(s,"$1 (stacktrace)"):c.replace(t,"[date]")),i=JSON.stringify(r);let y=(0,m.hashCode)(i).toString();return(0,a.debug)("got errorKey=",i,y),y}catch{return(0,m.hashCode)(e.message).toString()}};0&&(module.exports={errorTrack,getErrorKey});
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- declare module 'analytica.click/dist/components/AnalyticaClickProvider/index' {
1
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/components/AnalyticaClickProvider/index' {
2
2
  import React from 'react';
3
- import type { IAnalyticaConfig } from 'analytica.click/dist/types';
3
+ import type { IAnalyticaConfig } from 'analytica.click/dist/packages/analytica.click/dist/src/types';
4
4
  export const AnalyticaConfigContext: React.Context<IAnalyticaConfig>;
5
5
  export const AnalyticaClickProvider: ({ children, values, }: {
6
6
  children: React.ReactNode;
@@ -8,9 +8,9 @@ declare module 'analytica.click/dist/components/AnalyticaClickProvider/index' {
8
8
  }) => import("react/jsx-runtime").JSX.Element;
9
9
 
10
10
  }
11
- declare module 'analytica.click/dist/components/ErrorBoundary/Comp' {
11
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/components/ErrorBoundary/Comp' {
12
12
  import React, { Component } from 'react';
13
- import type { TErrorMessage } from 'analytica.click/dist/types';
13
+ import type { TErrorMessage } from 'analytica.click/dist/packages/analytica.click/dist/src/types';
14
14
  export interface IErrorBoundaryProps {
15
15
  notify?: TErrorMessage;
16
16
  children?: React.ReactNode;
@@ -27,7 +27,7 @@ declare module 'analytica.click/dist/components/ErrorBoundary/Comp' {
27
27
  }
28
28
 
29
29
  }
30
- declare module 'analytica.click/dist/components/ErrorBoundary/index' {
30
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/components/ErrorBoundary/index' {
31
31
  import type { JSX } from 'react';
32
32
  import React from 'react';
33
33
  export const ErrorBoundary: ({ children, }: {
@@ -35,7 +35,7 @@ declare module 'analytica.click/dist/components/ErrorBoundary/index' {
35
35
  }) => JSX.Element;
36
36
 
37
37
  }
38
- declare module 'analytica.click/dist/components/Modal/index' {
38
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/components/Modal/index' {
39
39
  import React from 'react';
40
40
  export interface ModalProps {
41
41
  open: boolean;
@@ -45,13 +45,62 @@ declare module 'analytica.click/dist/components/Modal/index' {
45
45
  export const Modal: React.FC<ModalProps>;
46
46
 
47
47
  }
48
- declare module 'analytica.click/dist/components/index' {
49
- export * from 'analytica.click/dist/components/AnalyticaClickProvider/index';
50
- export * from 'analytica.click/dist/components/Modal/index';
48
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/components/index' {
49
+ export * from 'analytica.click/dist/packages/analytica.click/dist/src/components/AnalyticaClickProvider/index';
50
+ export * from 'analytica.click/dist/packages/analytica.click/dist/src/components/Modal/index';
51
51
 
52
52
  }
53
- declare module 'analytica.click/dist/helpers/browser' {
54
- import type { IAnalyticaConfig } from 'analytica.click/dist/types';
53
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/apiTypes' {
54
+ export interface PostEventData {
55
+ eventName: string;
56
+ pageReferrer?: string;
57
+ pageTitle?: string;
58
+ browserResolution?: string;
59
+ browserLanguage?: string;
60
+ browserFingerprint?: string;
61
+ pageLocation: string;
62
+ browser?: string;
63
+ }
64
+ export interface PostEvent {
65
+ key: string;
66
+ data: PostEventData;
67
+ }
68
+ export interface PostSiteTrackData {
69
+ pageReferrer?: string;
70
+ pageTitle?: string;
71
+ browserResolution?: string;
72
+ browserLanguage?: string;
73
+ browserFingerprint?: string;
74
+ pageLocation: string;
75
+ browser?: string;
76
+ }
77
+ export interface PostSiteTrack {
78
+ key: string;
79
+ data: PostSiteTrackData;
80
+ }
81
+ export interface PostErrorData {
82
+ message: string;
83
+ name?: string;
84
+ stack?: string;
85
+ href: string;
86
+ filename?: string;
87
+ }
88
+ export interface PostError {
89
+ data: PostErrorData;
90
+ key: string;
91
+ }
92
+ export interface PostMetricData {
93
+ type: string;
94
+ value: number;
95
+ }
96
+ export interface PostMetric {
97
+ key: string;
98
+ data: PostMetricData;
99
+ }
100
+
101
+ }
102
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/browser' {
103
+ import type { IAnalyticaConfig } from 'analytica.click/dist/packages/analytica.click/dist/src/types';
55
104
  export function onBrowserError({ ev, values, }: {
56
105
  ev: ErrorEvent;
57
106
  values: IAnalyticaConfig;
@@ -59,14 +108,14 @@ declare module 'analytica.click/dist/helpers/browser' {
59
108
  export function OverloadBrowser(values: IAnalyticaConfig): void;
60
109
 
61
110
  }
62
- declare module 'analytica.click/dist/helpers/console' {
63
- import type { IAnalyticaConfig } from 'analytica.click/dist/types';
111
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/console' {
112
+ import type { IAnalyticaConfig } from 'analytica.click/dist/packages/analytica.click/dist/src/types';
64
113
  export function OverloadConsole(values: IAnalyticaConfig): void;
65
114
 
66
115
  }
67
- declare module 'analytica.click/dist/helpers/errorTrack' {
116
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/errorTrack' {
68
117
  import 'cross-fetch/polyfill';
69
- import type { PostError, PostErrorData } from '@ui/src/server/schema/api';
118
+ import type { PostError, PostErrorData } from 'analytica.click/dist/packages/analytica.click/dist/src/helpers/apiTypes';
70
119
  export const errorTrack: ({ data, overrideBaseUrl, ignoreBrowserErrors, devMode, }: {
71
120
  data: PostError;
72
121
  overrideBaseUrl?: string;
@@ -77,32 +126,32 @@ declare module 'analytica.click/dist/helpers/errorTrack' {
77
126
  export const getErrorKey: (p: PostErrorData) => string;
78
127
 
79
128
  }
80
- declare module 'analytica.click/dist/helpers/index' {
81
- export * from 'analytica.click/dist/helpers/errorTrack';
82
- export * from 'analytica.click/dist/helpers/log';
83
- export * from 'analytica.click/dist/helpers/server';
84
- export * from 'analytica.click/dist/helpers/useAnalytica';
129
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/index' {
130
+ export * from 'analytica.click/dist/packages/analytica.click/dist/src/helpers/errorTrack';
131
+ export * from 'analytica.click/dist/packages/analytica.click/dist/src/helpers/log';
132
+ export * from 'analytica.click/dist/packages/analytica.click/dist/src/helpers/server';
133
+ export * from 'analytica.click/dist/packages/analytica.click/dist/src/helpers/useAnalytica';
85
134
 
86
135
  }
87
- declare module 'analytica.click/dist/helpers/log' {
136
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/log' {
88
137
  export const tokenMissing: (comp: string) => string;
89
138
 
90
139
  }
91
- declare module 'analytica.click/dist/helpers/node' {
92
- import type { IAnalyticaConfig } from 'analytica.click/dist/types';
140
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/node' {
141
+ import type { IAnalyticaConfig } from 'analytica.click/dist/packages/analytica.click/dist/src/types';
93
142
  export function OverloadNode(values: IAnalyticaConfig): void;
94
143
 
95
144
  }
96
- declare module 'analytica.click/dist/helpers/object' {
145
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/object' {
97
146
  export const takeObject: <T>(ob: Record<string, T>, num: number) => {
98
147
  part: T[];
99
148
  rest: Record<string, T>;
100
149
  };
101
150
 
102
151
  }
103
- declare module 'analytica.click/dist/helpers/server' {
152
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/server' {
104
153
  import 'cross-fetch/polyfill';
105
- import type { TEvent, TMetric, TPage } from 'analytica.click/dist/types';
154
+ import type { TEvent, TMetric, TPage } from 'analytica.click/dist/packages/analytica.click/dist/src/types';
106
155
  /** used for tracking arbitrary events */
107
156
  export const event: TEvent;
108
157
  /** used for tracking visits to a page */
@@ -111,8 +160,8 @@ declare module 'analytica.click/dist/helpers/server' {
111
160
  export const metric: TMetric;
112
161
 
113
162
  }
114
- declare module 'analytica.click/dist/helpers/useAnalytica' {
115
- import type { IEvent, IMetric, IPage } from 'analytica.click/dist/types';
163
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/helpers/useAnalytica' {
164
+ import type { IEvent, IMetric, IPage } from 'analytica.click/dist/packages/analytica.click/dist/src/types';
116
165
  export const useAnalytica: () => {
117
166
  event: (d: Omit<IEvent, "analyticaToken" | "overrideBaseUrl">) => void;
118
167
  page: (d: Omit<IPage, "analyticaToken" | "overrideBaseUrl">) => void;
@@ -120,13 +169,12 @@ declare module 'analytica.click/dist/helpers/useAnalytica' {
120
169
  };
121
170
 
122
171
  }
123
- declare module 'analytica.click/dist/index' {
124
-
125
- export * from 'analytica.click/dist/components/index';
126
- export * from 'analytica.click/dist/helpers/index';
172
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/index' {
173
+ export * from 'analytica.click/dist/packages/analytica.click/dist/src/components/index';
174
+ export * from 'analytica.click/dist/packages/analytica.click/dist/src/helpers/index';
127
175
 
128
176
  }
129
- declare module 'analytica.click/dist/types' {
177
+ declare module 'analytica.click/dist/packages/analytica.click/dist/src/types' {
130
178
  export type TEvent = (p: IEvent) => Promise<{
131
179
  error?: string;
132
180
  }>;
@@ -178,97 +226,6 @@ declare module 'analytica.click/dist/types' {
178
226
  };
179
227
  }
180
228
 
181
- }
182
- declare module 'analytica.click/dist/ui/src/server/schema/api' {
183
- import { z } from 'zod';
184
- export const PostEventDataSchema: z.ZodObject<{
185
- eventName: z.ZodString;
186
- pageReferrer: z.ZodOptional<z.ZodString>;
187
- pageTitle: z.ZodOptional<z.ZodString>;
188
- browserResolution: z.ZodOptional<z.ZodString>;
189
- browserLanguage: z.ZodOptional<z.ZodString>;
190
- browserFingerprint: z.ZodOptional<z.ZodString>;
191
- pageLocation: z.ZodString;
192
- browser: z.ZodOptional<z.ZodString>;
193
- }, z.core.$strip>;
194
- export const PostEventSchema: z.ZodObject<{
195
- key: z.ZodString;
196
- data: z.ZodObject<{
197
- eventName: z.ZodString;
198
- pageReferrer: z.ZodOptional<z.ZodString>;
199
- pageTitle: z.ZodOptional<z.ZodString>;
200
- browserResolution: z.ZodOptional<z.ZodString>;
201
- browserLanguage: z.ZodOptional<z.ZodString>;
202
- browserFingerprint: z.ZodOptional<z.ZodString>;
203
- pageLocation: z.ZodString;
204
- browser: z.ZodOptional<z.ZodString>;
205
- }, z.core.$strip>;
206
- }, z.core.$strip>;
207
- export const PostSiteTrackDataSchema: z.ZodObject<{
208
- pageReferrer: z.ZodOptional<z.ZodString>;
209
- pageTitle: z.ZodOptional<z.ZodString>;
210
- browserResolution: z.ZodOptional<z.ZodString>;
211
- browserLanguage: z.ZodOptional<z.ZodString>;
212
- browserFingerprint: z.ZodOptional<z.ZodString>;
213
- pageLocation: z.ZodString;
214
- browser: z.ZodOptional<z.ZodString>;
215
- }, z.core.$strip>;
216
- export const PostSiteTrackSchema: z.ZodObject<{
217
- key: z.ZodString;
218
- data: z.ZodObject<{
219
- pageReferrer: z.ZodOptional<z.ZodString>;
220
- pageTitle: z.ZodOptional<z.ZodString>;
221
- browserResolution: z.ZodOptional<z.ZodString>;
222
- browserLanguage: z.ZodOptional<z.ZodString>;
223
- browserFingerprint: z.ZodOptional<z.ZodString>;
224
- pageLocation: z.ZodString;
225
- browser: z.ZodOptional<z.ZodString>;
226
- }, z.core.$strip>;
227
- }, z.core.$strip>;
228
- export const PostErrorDataSchema: z.ZodObject<{
229
- message: z.ZodString;
230
- name: z.ZodOptional<z.ZodString>;
231
- stack: z.ZodOptional<z.ZodString>;
232
- href: z.ZodString;
233
- filename: z.ZodOptional<z.ZodString>;
234
- }, z.core.$strip>;
235
- export const PostErrorSchema: z.ZodObject<{
236
- data: z.ZodObject<{
237
- message: z.ZodString;
238
- name: z.ZodOptional<z.ZodString>;
239
- stack: z.ZodOptional<z.ZodString>;
240
- href: z.ZodString;
241
- filename: z.ZodOptional<z.ZodString>;
242
- }, z.core.$strip>;
243
- key: z.ZodString;
244
- }, z.core.$strip>;
245
- export const PostMetricDataSchema: z.ZodObject<{
246
- type: z.ZodString;
247
- value: z.ZodNumber;
248
- }, z.core.$strip>;
249
- export const PostMetricSchema: z.ZodObject<{
250
- key: z.ZodString;
251
- data: z.ZodObject<{
252
- type: z.ZodString;
253
- value: z.ZodNumber;
254
- }, z.core.$strip>;
255
- }, z.core.$strip>;
256
- export type PostEventData = z.infer<typeof PostEventDataSchema>;
257
- export type PostEvent = z.infer<typeof PostEventSchema>;
258
- export type PostSiteTrackData = z.infer<typeof PostSiteTrackDataSchema>;
259
- export type PostSiteTrack = z.infer<typeof PostSiteTrackSchema>;
260
- export type PostErrorData = z.infer<typeof PostErrorDataSchema>;
261
- export type PostError = z.infer<typeof PostErrorSchema>;
262
- export type PostMetricData = z.infer<typeof PostMetricDataSchema>;
263
- export type PostMetric = z.infer<typeof PostMetricSchema>;
264
- export type GoogleScraperEvent = {
265
- type: 'webmaster';
266
- min: number;
267
- max: number;
268
- } | {
269
- type: 'sentiment';
270
- };
271
-
272
229
  }
273
230
  declare module 'analytica.click' {
274
231
  import main = require('analytica.click/dist/index');
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use client';"use strict";var Y=Object.create;var w=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var te=(e,r)=>{for(var t in r)w(e,t,{get:r[t],enumerable:!0})},N=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of V(r))!re.call(e,i)&&i!==t&&w(e,i,{get:()=>r[i],enumerable:!(o=Z(r,i))||o.enumerable});return e};var oe=(e,r,t)=>(t=e!=null?Y(ee(e)):{},N(r||!e||!e.__esModule?w(t,"default",{value:e,enumerable:!0}):t,e)),ne=e=>N(w({},"__esModule",{value:!0}),e);var de={};te(de,{AnalyticaClickProvider:()=>se,AnalyticaConfigContext:()=>g,Modal:()=>C,errorTrack:()=>p,event:()=>I,getErrorKey:()=>F,metric:()=>$,page:()=>M,tokenMissing:()=>y,useAnalytica:()=>ce});module.exports=ne(de);var X=require("react");var k=require("ag-common/dist/common/helpers/log"),v=oe(require("react"));var z=require("react");var pe=require("cross-fetch/polyfill"),T=require("ag-common/dist/common/helpers/hashCode"),f=require("ag-common/dist/common/helpers/log"),B=require("ag-common/dist/common/helpers/object"),D=require("ag-common/dist/common/helpers/string/contains");var A=(e,r)=>{let t=[],o={},i=0;return Object.entries(e).forEach(([n,a])=>{i<r?t.push(a):o[n]=a,i+=1}),{part:t,rest:o}};var J=typeof window<"u"&&window.location.hostname==="localhost",m={},E,x,L=async()=>{try{if(Object.keys(m).length>100){let o=Object.keys(m)[0],i=m[o],n=await fetch(`${x}/site/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify([{key:i.key,data:{...i.data,message:`error overload!: ${i.data.message||"?"}`}}])});if(m={},!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return{}}let{part:e,rest:r}=A(m,10);m=r;let t=await fetch(`${x}/site/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`)}catch(e){let r=e;return{error:r?.message??r.message}}finally{Object.keys(m).length>0?E=setTimeout(L,1e3):E=void 0}},p=async({data:e,overrideBaseUrl:r="https://analytica.click/api",ignoreBrowserErrors:t=["will be removed","performing full reload","tracking error","fetch RSC payload","perform a full reload","warnings#debug_enabled",'"digest"',"punycode"],devMode:o})=>{if(r||(r="https://analytica.click/api"),r.startsWith("/")&&typeof window>"u"&&(r="https://analytica.click/api"),t.length>0){let n=(0,D.containsInsensitive)(e.data.message,...t);if(n){(0,f.debug)("ignoring error, contains=",n);return}}if(J&&o)(0,f.debug)("allowing local error tracking due to devmode=true");else if(J)return(0,f.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${r}`),{};if(!ae(e.data.message))return{};(0,f.debug)("error track",e.data.message,JSON.stringify(e));let i=F({...e.data,name:e.data.name??"unknown"});return m[i]=e,x=r,E??=setTimeout(L,500),{}};function ae(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,f.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,f.info)("empty message payload?"),!1):!0:((0,f.info)("no message?"),!1)}var F=e=>{try{let r=/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/gim,t=/(at \S+?) \(\S+\)\s/gim,o=/^((%[cs])+\s*)+$/gim,i=/^color:/gim,n=[],a=e.message;(0,B.isJson)(a)?n=JSON.parse(a):n=[a];let s=n.findIndex(l=>l.match(o)),c=n.findIndex(l=>l.match(i));s>=0&&c>=0&&c===s+1&&(n=n.filter((l,Q)=>![s,c].includes(Q))),n=n.map(l=>l.includes(".js:")||l.includes("node_modules")?l.replace(t,"$1 (stacktrace)"):l.replace(r,"[date]")),a=JSON.stringify(n);let R=(0,T.hashCode)(a).toString();return(0,f.debug)("got errorKey=",a,R),R}catch{return(0,T.hashCode)(e.message).toString()}};async function b({ev:e,values:r}){if(!r.analyticaToken)return;let t={message:e.message,href:window.location.href,filename:e.filename,name:"",stack:e.error.stack};await p({...r,data:{key:r.analyticaToken,data:t}})}function H(e){(0,z.useEffect)(()=>{let r=t=>b({ev:t,values:e});if(e.analyticaToken)return window.addEventListener("error",r),()=>{try{window.removeEventListener("error",r)}catch{}}},[])}var U=require("react");function j(e){(0,U.useEffect)(()=>{if(window.consoleset||!e.analyticaToken)return;window.consoleset=!0;let r=window.console.error;window.console.error=(...o)=>{p({...e,data:{data:{href:window.location.href,message:JSON.stringify(o)},key:e.analyticaToken}}),r(...o)};let t=window.console.warn;window.console.warn=(...o)=>{p({...e,data:{data:{href:window.location.href,message:JSON.stringify(o)},key:e.analyticaToken}}),t(...o)}},[])}var y=e=>`[Analytica.${e}] Please load analytica token in AnalyticaClickProvider to use this component`;function W(e){if(global.nodeset||typeof window<"u"||!e.analyticaToken)return;global.nodeset=!0;let r=global.console.error;global.console.error=(...o)=>{p({...e,data:{data:{href:"server",message:JSON.stringify(o)},key:e.analyticaToken}}),r(...o)};let t=global.console.warn;global.console.warn=(...o)=>{p({...e,data:{data:{href:"server",message:JSON.stringify(o)},key:e.analyticaToken}}),t(...o)}}var K=require("react");var u=require("react/jsx-runtime"),ie={fontSize:"2rem"},h=class extends K.Component{constructor(r){super(r),this.state={hasError:void 0},this.seenError=!1}static getDerivedStateFromError(r){let t=typeof window<"u"&&window.location.href;return{hasError:{...r,message:r?.message??r,...r?.stack&&{error:{stack:r?.stack}},...t&&{href:t}}}}render(){let{hasError:r}=this.state,{children:t,notify:o}=this.props;return r?(o&&o(r),(0,u.jsx)(C,{open:!0,setOpen:()=>{},children:(0,u.jsxs)("div",{style:ie,children:["A fatal error has occurred - the admin has been notified.",(0,u.jsx)("button",{type:"button",onClick:()=>window.location.reload(),children:"Press here to restart app"})]})})):t}};var O=require("react/jsx-runtime"),_=({children:e})=>{let r=(0,v.useContext)(g);return j(r),H(r),W(r),(0,k.debug)("installed analytica.click error handlers"),r.analyticaToken?(0,O.jsx)(h,{notify:t=>b({ev:t,values:r}),children:e}):((0,k.warn)(y("ErrorBoundary")),(0,O.jsx)(v.default.Fragment,{children:e}))};var P=require("react/jsx-runtime"),g=(0,X.createContext)(void 0),se=({children:e,values:r})=>(0,P.jsx)(g.Provider,{value:r,children:(0,P.jsx)(_,{children:e})});var S=require("react/jsx-runtime"),C=({open:e,setOpen:r,children:t})=>e?(0,S.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>r(!1),children:(0,S.jsx)("div",{style:{backgroundColor:"white",padding:"2rem",borderRadius:"8px",maxWidth:"500px",maxHeight:"80vh",overflow:"auto",position:"relative",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)"},onClick:o=>o.stopPropagation(),children:t})}):null;var Fe=require("cross-fetch/polyfill"),d=require("ag-common/dist/common/helpers/log"),I=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",eventName:o,devMode:i,valueOverrides:n}=e;if(!i&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local page ignored: ${JSON.stringify(e)}, to ${t}`),{};let a={eventName:o,browserFingerprint:n?.browserFingerprint,pageLocation:""};typeof window<"u"&&(a={...a,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof navigator<"u"&&(a={...a,browser:navigator.userAgent});try{let s=await fetch(`${t}/site/event`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:a})});if(!s.ok){let c=await s.text();return(0,d.warn)("tracking error:"+c),{error:c}}}catch(s){let c=s instanceof Error?s.message:"Unknown error";return(0,d.warn)("tracking error:"+c),{error:c}}return{}},M=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",devMode:o,valueOverrides:i}=e;if(!o&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local page ignored: ${JSON.stringify(e)}, to ${t}`),{};let n={pageLocation:"",browserFingerprint:i?.browserFingerprint};if(typeof window<"u"&&(n={...n,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof document<"u"&&(n={...n,pageReferrer:document.referrer,pageTitle:document.title}),typeof navigator<"u"&&(n={...n,browserLanguage:navigator.language,browser:navigator.userAgent}),!n.pageLocation)return(0,d.warn)("no pageLocation"),{};try{let a=await fetch(`${t}/site/tracking`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:n})});if(!a.ok){let s=await a.text();return(0,d.warn)("tracking error:"+s),{error:s}}}catch(a){let s=a instanceof Error?a.message:"Unknown error";return(0,d.warn)("tracking error:"+s),{error:s}}return{}},$=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",type:o,value:i,devMode:n}=e;if(!n&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local metric ignored: ${JSON.stringify(e)}, to ${t}`),{};if(o==="health")return(0,d.warn)('Type "health" is reserved for system metrics'),{error:'Type "health" is reserved for system metrics'};let a={type:o,value:i};try{let s=await fetch(`${t}/site/metric`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:a})});if(!s.ok){let c=await s.text();return(0,d.warn)("metric tracking error:"+c),{error:c}}}catch(s){let c=s instanceof Error?s.message:"Unknown error";return(0,d.warn)("metric tracking error:"+c),{error:c}}return{}};var q=require("ag-common/dist/common/helpers/log"),G=require("react");var ce=()=>{let e=(0,G.useContext)(g);if(!e.analyticaToken){(0,q.warn)(y("useAnalytica"));let r=async()=>({error:"no token"});return{event:r,page:r,metric:r}}return{event:r=>I({...r,...e}),page:r=>M({...r,...e}),metric:r=>$({...r,...e})}};0&&(module.exports={AnalyticaClickProvider,AnalyticaConfigContext,Modal,errorTrack,event,getErrorKey,metric,page,tokenMissing,useAnalytica});
1
+ 'use client';"use strict";var Y=Object.create;var w=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var te=(e,r)=>{for(var t in r)w(e,t,{get:r[t],enumerable:!0})},R=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of V(r))!re.call(e,a)&&a!==t&&w(e,a,{get:()=>r[a],enumerable:!(n=Z(r,a))||n.enumerable});return e};var oe=(e,r,t)=>(t=e!=null?Y(ee(e)):{},R(r||!e||!e.__esModule?w(t,"default",{value:e,enumerable:!0}):t,e)),ne=e=>R(w({},"__esModule",{value:!0}),e);var de={};te(de,{AnalyticaClickProvider:()=>se,AnalyticaConfigContext:()=>y,Modal:()=>C,errorTrack:()=>p,event:()=>I,getErrorKey:()=>_,metric:()=>M,page:()=>N,tokenMissing:()=>g,useAnalytica:()=>ce});module.exports=ne(de);var K=require("react");var k=require("ag-common/dist/common/helpers/log"),T=oe(require("react"));var F=require("react");var pe=require("cross-fetch/polyfill"),v=require("ag-common/dist/common/helpers/hashCode"),f=require("ag-common/dist/common/helpers/log"),B=require("ag-common/dist/common/helpers/object"),D=require("ag-common/dist/common/helpers/string/contains");var A=(e,r)=>{let t=[],n={},a=0;return Object.entries(e).forEach(([o,i])=>{a<r?t.push(i):n[o]=i,a+=1}),{part:t,rest:n}};var J=typeof window<"u"&&window.location.hostname==="localhost",m={},E,x,L=async()=>{try{if(Object.keys(m).length>100){let n=Object.keys(m)[0],a=m[n],o=await fetch(`${x}/site/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify([{key:a.key,data:{...a.data,message:`error overload!: ${a.data.message||"?"}`}}])});if(m={},!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return{}}let{part:e,rest:r}=A(m,10);m=r;let t=await fetch(`${x}/site/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`)}catch(e){let r=e;return{error:r?.message??r.message}}finally{Object.keys(m).length>0?E=setTimeout(L,1e3):E=void 0}},p=async({data:e,overrideBaseUrl:r="https://analytica.click/api",ignoreBrowserErrors:t=["will be removed","performing full reload","tracking error","fetch RSC payload","perform a full reload","warnings#debug_enabled",'"digest"',"punycode"],devMode:n})=>{if(r||(r="https://analytica.click/api"),r.startsWith("/")&&typeof window>"u"&&(r="https://analytica.click/api"),t.length>0){let o=(0,D.containsInsensitive)(e.data.message,...t);if(o){(0,f.debug)("ignoring error, contains=",o);return}}if(J&&n)(0,f.debug)("allowing local error tracking due to devmode=true");else if(J)return(0,f.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${r}`),{};if(!ae(e.data.message))return{};(0,f.debug)("error track",e.data.message,JSON.stringify(e));let a=_({...e.data,name:e.data.name??"unknown"});return m[a]=e,x=r,E??=setTimeout(L,500),{}};function ae(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,f.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,f.info)("empty message payload?"),!1):!0:((0,f.info)("no message?"),!1)}var _=e=>{try{let r=/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/gim,t=/(at \S+?) \(\S+\)\s/gim,n=/^((%[cs])+\s*)+$/gim,a=/^color:/gim,o=[],i=e.message;(0,B.isJson)(i)?o=JSON.parse(i):o=[i];let s=o.findIndex(l=>l.match(n)),c=o.findIndex(l=>l.match(a));s>=0&&c>=0&&c===s+1&&(o=o.filter((l,Q)=>![s,c].includes(Q))),o=o.map(l=>l.includes(".js:")||l.includes("node_modules")?l.replace(t,"$1 (stacktrace)"):l.replace(r,"[date]")),i=JSON.stringify(o);let $=(0,v.hashCode)(i).toString();return(0,f.debug)("got errorKey=",i,$),$}catch{return(0,v.hashCode)(e.message).toString()}};async function b({ev:e,values:r}){if(!r.analyticaToken)return;let t={message:e.message,href:window.location.href,filename:e.filename,name:"",stack:e.error.stack};await p({...r,data:{key:r.analyticaToken,data:t}})}function z(e){(0,F.useEffect)(()=>{let r=t=>b({ev:t,values:e});if(e.analyticaToken)return window.addEventListener("error",r),()=>{try{window.removeEventListener("error",r)}catch{}}},[])}var H=require("react");function U(e){(0,H.useEffect)(()=>{if(window.consoleset||!e.analyticaToken)return;window.consoleset=!0;let r=window.console.error;window.console.error=(...n)=>{p({...e,data:{data:{href:window.location.href,message:JSON.stringify(n)},key:e.analyticaToken}}),r(...n)};let t=window.console.warn;window.console.warn=(...n)=>{p({...e,data:{data:{href:window.location.href,message:JSON.stringify(n)},key:e.analyticaToken}}),t(...n)}},[])}var g=e=>`[Analytica.${e}] Please load analytica token in AnalyticaClickProvider to use this component`;function j(e){let r=globalThis,t=globalThis.console;if(r.__analyticaNodeSet||typeof window<"u"||!e.analyticaToken)return;r.__analyticaNodeSet=!0;let n=t.error.bind(t);t.error=(...o)=>{p({...e,data:{data:{href:"server",message:JSON.stringify(o)},key:e.analyticaToken}}),n(...o)};let a=t.warn.bind(t);t.warn=(...o)=>{p({...e,data:{data:{href:"server",message:JSON.stringify(o)},key:e.analyticaToken}}),a(...o)}}var W=require("react");var u=require("react/jsx-runtime"),ie={fontSize:"2rem"},h=class extends W.Component{constructor(r){super(r),this.state={hasError:void 0},this.seenError=!1}static getDerivedStateFromError(r){let t=typeof window<"u"&&window.location.href;return{hasError:{...r,message:r?.message??r,...r?.stack&&{error:{stack:r?.stack}},...t&&{href:t}}}}render(){let{hasError:r}=this.state,{children:t,notify:n}=this.props;return r?(n&&n(r),(0,u.jsx)(C,{open:!0,setOpen:()=>{},children:(0,u.jsxs)("div",{style:ie,children:["A fatal error has occurred - the admin has been notified.",(0,u.jsx)("button",{type:"button",onClick:()=>window.location.reload(),children:"Press here to restart app"})]})})):t}};var S=require("react/jsx-runtime"),G=({children:e})=>{let r=(0,T.useContext)(y);return U(r),z(r),j(r),(0,k.debug)("installed analytica.click error handlers"),r.analyticaToken?(0,S.jsx)(h,{notify:t=>b({ev:t,values:r}),children:e}):((0,k.warn)(g("ErrorBoundary")),(0,S.jsx)(T.default.Fragment,{children:e}))};var O=require("react/jsx-runtime"),y=(0,K.createContext)(void 0),se=({children:e,values:r})=>(0,O.jsx)(y.Provider,{value:r,children:(0,O.jsx)(G,{children:e})});var P=require("react/jsx-runtime"),C=({open:e,setOpen:r,children:t})=>e?(0,P.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>r(!1),children:(0,P.jsx)("div",{style:{backgroundColor:"white",padding:"2rem",borderRadius:"8px",maxWidth:"500px",maxHeight:"80vh",overflow:"auto",position:"relative",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)"},onClick:n=>n.stopPropagation(),children:t})}):null;var _e=require("cross-fetch/polyfill"),d=require("ag-common/dist/common/helpers/log"),I=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",eventName:n,devMode:a,valueOverrides:o}=e;if(!a&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local page ignored: ${JSON.stringify(e)}, to ${t}`),{};let i={eventName:n,browserFingerprint:o?.browserFingerprint,pageLocation:""};typeof window<"u"&&(i={...i,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof navigator<"u"&&(i={...i,browser:navigator.userAgent});try{let s=await fetch(`${t}/site/event`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:i})});if(!s.ok){let c=await s.text();return(0,d.warn)("tracking error:"+c),{error:c}}}catch(s){let c=s instanceof Error?s.message:"Unknown error";return(0,d.warn)("tracking error:"+c),{error:c}}return{}},N=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",devMode:n,valueOverrides:a}=e;if(!n&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local page ignored: ${JSON.stringify(e)}, to ${t}`),{};let o={pageLocation:"",browserFingerprint:a?.browserFingerprint};if(typeof window<"u"&&(o={...o,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof document<"u"&&(o={...o,pageReferrer:document.referrer,pageTitle:document.title}),typeof navigator<"u"&&(o={...o,browserLanguage:navigator.language,browser:navigator.userAgent}),!o.pageLocation)return(0,d.warn)("no pageLocation"),{};try{let i=await fetch(`${t}/site/tracking`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:o})});if(!i.ok){let s=await i.text();return(0,d.warn)("tracking error:"+s),{error:s}}}catch(i){let s=i instanceof Error?i.message:"Unknown error";return(0,d.warn)("tracking error:"+s),{error:s}}return{}},M=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",type:n,value:a,devMode:o}=e;if(!o&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local metric ignored: ${JSON.stringify(e)}, to ${t}`),{};if(n==="health")return(0,d.warn)('Type "health" is reserved for system metrics'),{error:'Type "health" is reserved for system metrics'};let i={type:n,value:a};try{let s=await fetch(`${t}/site/metric`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:i})});if(!s.ok){let c=await s.text();return(0,d.warn)("metric tracking error:"+c),{error:c}}}catch(s){let c=s instanceof Error?s.message:"Unknown error";return(0,d.warn)("metric tracking error:"+c),{error:c}}return{}};var X=require("ag-common/dist/common/helpers/log"),q=require("react");var ce=()=>{let e=(0,q.useContext)(y);if(!e.analyticaToken){(0,X.warn)(g("useAnalytica"));let r=async()=>({error:"no token"});return{event:r,page:r,metric:r}}return{event:r=>I({...r,...e}),page:r=>N({...r,...e}),metric:r=>M({...r,...e})}};0&&(module.exports={AnalyticaClickProvider,AnalyticaConfigContext,Modal,errorTrack,event,getErrorKey,metric,page,tokenMissing,useAnalytica});
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { IAnalyticaConfig } from '../../types';
3
+ export declare const AnalyticaConfigContext: React.Context<IAnalyticaConfig>;
4
+ export declare const AnalyticaClickProvider: ({ children, values, }: {
5
+ children: React.ReactNode;
6
+ values: IAnalyticaConfig;
7
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import React, { Component } from 'react';
2
+ import type { TErrorMessage } from '../../types';
3
+ export interface IErrorBoundaryProps {
4
+ notify?: TErrorMessage;
5
+ children?: React.ReactNode;
6
+ }
7
+ export declare class ErrorBoundary extends Component<IErrorBoundaryProps, {
8
+ hasError: ErrorEvent | undefined;
9
+ }> {
10
+ seenError: boolean;
11
+ constructor(props: any);
12
+ static getDerivedStateFromError(errorV: any): {
13
+ hasError: any;
14
+ };
15
+ render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
16
+ }
@@ -0,0 +1,5 @@
1
+ import type { JSX } from 'react';
2
+ import React from 'react';
3
+ export declare const ErrorBoundary: ({ children, }: {
4
+ children?: React.ReactNode;
5
+ }) => JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface ModalProps {
3
+ open: boolean;
4
+ setOpen: (open: boolean) => void;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const Modal: React.FC<ModalProps>;
@@ -0,0 +1,2 @@
1
+ export * from './AnalyticaClickProvider';
2
+ export * from './Modal';
@@ -0,0 +1,46 @@
1
+ export interface PostEventData {
2
+ eventName: string;
3
+ pageReferrer?: string;
4
+ pageTitle?: string;
5
+ browserResolution?: string;
6
+ browserLanguage?: string;
7
+ browserFingerprint?: string;
8
+ pageLocation: string;
9
+ browser?: string;
10
+ }
11
+ export interface PostEvent {
12
+ key: string;
13
+ data: PostEventData;
14
+ }
15
+ export interface PostSiteTrackData {
16
+ pageReferrer?: string;
17
+ pageTitle?: string;
18
+ browserResolution?: string;
19
+ browserLanguage?: string;
20
+ browserFingerprint?: string;
21
+ pageLocation: string;
22
+ browser?: string;
23
+ }
24
+ export interface PostSiteTrack {
25
+ key: string;
26
+ data: PostSiteTrackData;
27
+ }
28
+ export interface PostErrorData {
29
+ message: string;
30
+ name?: string;
31
+ stack?: string;
32
+ href: string;
33
+ filename?: string;
34
+ }
35
+ export interface PostError {
36
+ data: PostErrorData;
37
+ key: string;
38
+ }
39
+ export interface PostMetricData {
40
+ type: string;
41
+ value: number;
42
+ }
43
+ export interface PostMetric {
44
+ key: string;
45
+ data: PostMetricData;
46
+ }
@@ -0,0 +1,6 @@
1
+ import type { IAnalyticaConfig } from '../types';
2
+ export declare function onBrowserError({ ev, values, }: {
3
+ ev: ErrorEvent;
4
+ values: IAnalyticaConfig;
5
+ }): Promise<void>;
6
+ export declare function OverloadBrowser(values: IAnalyticaConfig): void;
@@ -0,0 +1,2 @@
1
+ import type { IAnalyticaConfig } from '../types';
2
+ export declare function OverloadConsole(values: IAnalyticaConfig): void;
@@ -1,5 +1,5 @@
1
1
  import 'cross-fetch/polyfill';
2
- import type { PostError, PostErrorData } from '@ui/src/server/schema/api';
2
+ import type { PostError, PostErrorData } from './apiTypes';
3
3
  export declare const errorTrack: ({ data, overrideBaseUrl, ignoreBrowserErrors, devMode, }: {
4
4
  data: PostError;
5
5
  overrideBaseUrl?: string;
@@ -0,0 +1,4 @@
1
+ export * from './errorTrack';
2
+ export * from './log';
3
+ export * from './server';
4
+ export * from './useAnalytica';
@@ -0,0 +1 @@
1
+ export declare const tokenMissing: (comp: string) => string;
@@ -0,0 +1,2 @@
1
+ import type { IAnalyticaConfig } from '../types';
2
+ export declare function OverloadNode(values: IAnalyticaConfig): void;
@@ -0,0 +1,4 @@
1
+ export declare const takeObject: <T>(ob: Record<string, T>, num: number) => {
2
+ part: T[];
3
+ rest: Record<string, T>;
4
+ };
@@ -0,0 +1,6 @@
1
+ import type { IEvent, IMetric, IPage } from '../types';
2
+ export declare const useAnalytica: () => {
3
+ event: (d: Omit<IEvent, "analyticaToken" | "overrideBaseUrl">) => void;
4
+ page: (d: Omit<IPage, "analyticaToken" | "overrideBaseUrl">) => void;
5
+ metric: (d: Omit<IMetric, "analyticaToken" | "overrideBaseUrl">) => void;
6
+ };
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ export * from './helpers';
@@ -0,0 +1,50 @@
1
+ export type TEvent = (p: IEvent) => Promise<{
2
+ error?: string;
3
+ }>;
4
+ export interface IEvent {
5
+ analyticaToken: string;
6
+ overrideBaseUrl?: string;
7
+ eventName: string;
8
+ /** internal testing only. also allows local sending of errors */
9
+ devMode?: boolean;
10
+ valueOverrides?: {
11
+ browserFingerprint?: string;
12
+ };
13
+ }
14
+ export type TPage = (p: IPage) => Promise<{
15
+ error?: string;
16
+ }>;
17
+ export interface IPage {
18
+ analyticaToken: string;
19
+ overrideBaseUrl?: string;
20
+ /** internal testing only. also allows local sending of errors */
21
+ devMode?: boolean;
22
+ valueOverrides?: {
23
+ browserFingerprint?: string;
24
+ };
25
+ }
26
+ export type TMetric = (p: IMetric) => Promise<{
27
+ error?: string;
28
+ }>;
29
+ export interface IMetric {
30
+ analyticaToken: string;
31
+ overrideBaseUrl?: string;
32
+ type: string;
33
+ value: number;
34
+ /** internal testing only. also allows local sending of errors */
35
+ devMode?: boolean;
36
+ }
37
+ export type TErrorMessage = (m: ErrorEvent) => Promise<void>;
38
+ export interface IAnalyticaConfig {
39
+ analyticaToken: string;
40
+ overrideBaseUrl?: string;
41
+ /** internal testing only. also allows local sending of errors */
42
+ devMode?: boolean;
43
+ /** ignore any browser errors that include these words.
44
+ * default: 'will be removed', 'performing full reload', 'tracking error', 'fetch RSC payload',
45
+ */
46
+ ignoreBrowserErrors?: string[];
47
+ valueOverrides?: {
48
+ browserFingerprint?: string;
49
+ };
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analytica.click",
3
- "version": "0.0.636",
3
+ "version": "0.0.637",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "nodemon": "^3",
19
19
  "react": "^19.0.0",
20
20
  "ts-node": "^10",
21
- "typescript": "^5"
21
+ "typescript": "^6.0.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "25.6.0",
@@ -1,88 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const PostEventDataSchema: z.ZodObject<{
3
- eventName: z.ZodString;
4
- pageReferrer: z.ZodOptional<z.ZodString>;
5
- pageTitle: z.ZodOptional<z.ZodString>;
6
- browserResolution: z.ZodOptional<z.ZodString>;
7
- browserLanguage: z.ZodOptional<z.ZodString>;
8
- browserFingerprint: z.ZodOptional<z.ZodString>;
9
- pageLocation: z.ZodString;
10
- browser: z.ZodOptional<z.ZodString>;
11
- }, z.core.$strip>;
12
- export declare const PostEventSchema: z.ZodObject<{
13
- key: z.ZodString;
14
- data: z.ZodObject<{
15
- eventName: z.ZodString;
16
- pageReferrer: z.ZodOptional<z.ZodString>;
17
- pageTitle: z.ZodOptional<z.ZodString>;
18
- browserResolution: z.ZodOptional<z.ZodString>;
19
- browserLanguage: z.ZodOptional<z.ZodString>;
20
- browserFingerprint: z.ZodOptional<z.ZodString>;
21
- pageLocation: z.ZodString;
22
- browser: z.ZodOptional<z.ZodString>;
23
- }, z.core.$strip>;
24
- }, z.core.$strip>;
25
- export declare const PostSiteTrackDataSchema: z.ZodObject<{
26
- pageReferrer: z.ZodOptional<z.ZodString>;
27
- pageTitle: z.ZodOptional<z.ZodString>;
28
- browserResolution: z.ZodOptional<z.ZodString>;
29
- browserLanguage: z.ZodOptional<z.ZodString>;
30
- browserFingerprint: z.ZodOptional<z.ZodString>;
31
- pageLocation: z.ZodString;
32
- browser: z.ZodOptional<z.ZodString>;
33
- }, z.core.$strip>;
34
- export declare const PostSiteTrackSchema: z.ZodObject<{
35
- key: z.ZodString;
36
- data: z.ZodObject<{
37
- pageReferrer: z.ZodOptional<z.ZodString>;
38
- pageTitle: z.ZodOptional<z.ZodString>;
39
- browserResolution: z.ZodOptional<z.ZodString>;
40
- browserLanguage: z.ZodOptional<z.ZodString>;
41
- browserFingerprint: z.ZodOptional<z.ZodString>;
42
- pageLocation: z.ZodString;
43
- browser: z.ZodOptional<z.ZodString>;
44
- }, z.core.$strip>;
45
- }, z.core.$strip>;
46
- export declare const PostErrorDataSchema: z.ZodObject<{
47
- message: z.ZodString;
48
- name: z.ZodOptional<z.ZodString>;
49
- stack: z.ZodOptional<z.ZodString>;
50
- href: z.ZodString;
51
- filename: z.ZodOptional<z.ZodString>;
52
- }, z.core.$strip>;
53
- export declare const PostErrorSchema: z.ZodObject<{
54
- data: z.ZodObject<{
55
- message: z.ZodString;
56
- name: z.ZodOptional<z.ZodString>;
57
- stack: z.ZodOptional<z.ZodString>;
58
- href: z.ZodString;
59
- filename: z.ZodOptional<z.ZodString>;
60
- }, z.core.$strip>;
61
- key: z.ZodString;
62
- }, z.core.$strip>;
63
- export declare const PostMetricDataSchema: z.ZodObject<{
64
- type: z.ZodString;
65
- value: z.ZodNumber;
66
- }, z.core.$strip>;
67
- export declare const PostMetricSchema: z.ZodObject<{
68
- key: z.ZodString;
69
- data: z.ZodObject<{
70
- type: z.ZodString;
71
- value: z.ZodNumber;
72
- }, z.core.$strip>;
73
- }, z.core.$strip>;
74
- export type PostEventData = z.infer<typeof PostEventDataSchema>;
75
- export type PostEvent = z.infer<typeof PostEventSchema>;
76
- export type PostSiteTrackData = z.infer<typeof PostSiteTrackDataSchema>;
77
- export type PostSiteTrack = z.infer<typeof PostSiteTrackSchema>;
78
- export type PostErrorData = z.infer<typeof PostErrorDataSchema>;
79
- export type PostError = z.infer<typeof PostErrorSchema>;
80
- export type PostMetricData = z.infer<typeof PostMetricDataSchema>;
81
- export type PostMetric = z.infer<typeof PostMetricSchema>;
82
- export type GoogleScraperEvent = {
83
- type: 'webmaster';
84
- min: number;
85
- max: number;
86
- } | {
87
- type: 'sentiment';
88
- };
File without changes