analytica.click 0.0.526 → 0.0.528
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/errorTrack.js +1 -1
- package/dist/index.d.ts +42 -30
- package/dist/index.js +1 -1
- package/dist/ui/src/server/schema/index.d.ts +42 -30
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
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}/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}/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});
|
package/dist/index.d.ts
CHANGED
@@ -173,6 +173,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
173
173
|
export const deleteSiteSchema: z.ZodObject<{
|
174
174
|
site: z.ZodString;
|
175
175
|
}, z.core.$strip>;
|
176
|
+
export const updateSiteDetailsSchema: z.ZodObject<{
|
177
|
+
site: z.ZodString;
|
178
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
179
|
+
}, z.core.$strip>;
|
176
180
|
export const createGoogleIntegrationSchema: z.ZodObject<{
|
177
181
|
email: z.ZodString;
|
178
182
|
key: z.ZodString;
|
@@ -211,24 +215,6 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
211
215
|
query: z.ZodString;
|
212
216
|
}, z.core.$strip>>;
|
213
217
|
}, z.core.$strip>;
|
214
|
-
export const GetAccountSchema: z.ZodObject<{
|
215
|
-
site: z.ZodString;
|
216
|
-
account: z.ZodString;
|
217
|
-
apiKey: z.ZodString;
|
218
|
-
adminApiKey: z.ZodString;
|
219
|
-
}, z.core.$strip>;
|
220
|
-
export const GetAccountsSchema: z.ZodObject<{
|
221
|
-
accounts: z.ZodArray<z.ZodObject<{
|
222
|
-
site: z.ZodString;
|
223
|
-
account: z.ZodString;
|
224
|
-
apiKey: z.ZodString;
|
225
|
-
adminApiKey: z.ZodString;
|
226
|
-
}, z.core.$strip>>;
|
227
|
-
googleEmail: z.ZodOptional<z.ZodString>;
|
228
|
-
googleKey: z.ZodOptional<z.ZodString>;
|
229
|
-
bingKey: z.ZodOptional<z.ZodString>;
|
230
|
-
bingAccount: z.ZodOptional<z.ZodString>;
|
231
|
-
}, z.core.$strip>;
|
232
218
|
export const GoogleIntegrationSchema: z.ZodObject<{
|
233
219
|
email: z.ZodString;
|
234
220
|
key: z.ZodString;
|
@@ -471,18 +457,20 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
471
457
|
export const SiteDetailsSchema: z.ZodObject<{
|
472
458
|
site: z.ZodString;
|
473
459
|
account: z.ZodString;
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
460
|
+
datetime: z.ZodOptional<z.ZodNumber>;
|
461
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
462
|
+
}, z.core.$strip>;
|
463
|
+
export const GetAccountSchema: z.ZodObject<{
|
464
|
+
site: z.ZodString;
|
465
|
+
account: z.ZodString;
|
466
|
+
apiKey: z.ZodString;
|
467
|
+
adminApiKey: z.ZodString;
|
468
|
+
siteDetail: z.ZodObject<{
|
469
|
+
site: z.ZodString;
|
470
|
+
account: z.ZodString;
|
471
|
+
datetime: z.ZodOptional<z.ZodNumber>;
|
472
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
473
|
+
}, z.core.$strip>;
|
486
474
|
}, z.core.$strip>;
|
487
475
|
export const SiteDataSchema: z.ZodObject<{
|
488
476
|
accountDetails: z.ZodOptional<z.ZodObject<{
|
@@ -490,6 +478,12 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
490
478
|
account: z.ZodString;
|
491
479
|
apiKey: z.ZodString;
|
492
480
|
adminApiKey: z.ZodString;
|
481
|
+
siteDetail: z.ZodObject<{
|
482
|
+
site: z.ZodString;
|
483
|
+
account: z.ZodString;
|
484
|
+
datetime: z.ZodOptional<z.ZodNumber>;
|
485
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
486
|
+
}, z.core.$strip>;
|
493
487
|
}, z.core.$strip>>;
|
494
488
|
browsers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
495
489
|
account: z.ZodOptional<z.ZodString>;
|
@@ -672,6 +666,24 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
672
666
|
export const ArchiveErrorsSchema: z.ZodObject<{
|
673
667
|
PKs: z.ZodArray<z.ZodString>;
|
674
668
|
}, z.core.$strip>;
|
669
|
+
export const GetAccountsSchema: z.ZodObject<{
|
670
|
+
accounts: z.ZodArray<z.ZodObject<{
|
671
|
+
site: z.ZodString;
|
672
|
+
account: z.ZodString;
|
673
|
+
apiKey: z.ZodString;
|
674
|
+
adminApiKey: z.ZodString;
|
675
|
+
siteDetail: z.ZodObject<{
|
676
|
+
site: z.ZodString;
|
677
|
+
account: z.ZodString;
|
678
|
+
datetime: z.ZodOptional<z.ZodNumber>;
|
679
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
680
|
+
}, z.core.$strip>;
|
681
|
+
}, z.core.$strip>>;
|
682
|
+
googleEmail: z.ZodOptional<z.ZodString>;
|
683
|
+
googleKey: z.ZodOptional<z.ZodString>;
|
684
|
+
bingKey: z.ZodOptional<z.ZodString>;
|
685
|
+
bingAccount: z.ZodOptional<z.ZodString>;
|
686
|
+
}, z.core.$strip>;
|
675
687
|
export type SeoResultValues = z.infer<typeof SeoResultValuesSchema>;
|
676
688
|
export type SeoResult = z.infer<typeof SeoResultSchema>;
|
677
689
|
export type GetAccount = z.infer<typeof GetAccountSchema>;
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
'use client';"use strict";var Y=Object.create;var u=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var re=(e,r)=>{for(var o in r)u(e,o,{get:r[o],enumerable:!0})},N=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of U(r))!ee.call(e,n)&&n!==o&&u(e,n,{get:()=>r[n],enumerable:!(t=Z(r,n))||t.enumerable});return e};var oe=(e,r,o)=>(o=e!=null?Y(V(e)):{},N(r||!e||!e.__esModule?u(o,"default",{value:e,enumerable:!0}):o,e)),te=e=>N(u({},"__esModule",{value:!0}),e);var ce={};re(ce,{AnalyticaClickProvider:()=>ie,AnalyticaConfigContext:()=>m,Modal:()=>C,errorTrack:()=>d,event:()=>I,getErrorKey:()=>D,page:()=>R,tokenMissing:()=>g,useAnalytica:()=>se});module.exports=te(ce);var X=require("react");var h=require("ag-common/dist/common/helpers/log"),k=oe(require("react"));var F=require("react");var le=require("cross-fetch/polyfill"),T=require("ag-common/dist/common/helpers/hashCode"),s=require("ag-common/dist/common/helpers/log"),M=require("ag-common/dist/common/helpers/object"),L=require("ag-common/dist/common/helpers/string/contains");var A=(e,r)=>{let o=[],t={},n=0;return Object.entries(e).forEach(([a,i])=>{n<r?o.push(i):t[a]=i,n+=1}),{part:o,rest:t}};var J=typeof window<"u"&&window.location.hostname==="localhost",p={},v,x,B=async()=>{try{if(Object.keys(p).length>100){let t=Object.keys(p)[0],n=p[t],a=await fetch(`${x}/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify([{key:n.key,data:{...n.data,message:`error overload!: ${n.data.message||"?"}`}}])});if(p={},!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return{}}let{part:e,rest:r}=A(p,10);p=r;let o=await fetch(`${x}/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify(e)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`)}catch(e){let r=e;return{error:r?.message??r.message}}finally{Object.keys(p).length>0?v=setTimeout(B,1e3):v=void 0}},d=async({data:e,overrideBaseUrl:r="https://analytica.click/api",ignoreBrowserErrors:o=["will be removed","performing full reload","tracking error","fetch RSC payload","perform a full reload","warnings#debug_enabled",'"digest"'],devMode:t})=>{if(r||(r="https://analytica.click/api"),r.startsWith("/")&&typeof window>"u"&&(r="https://analytica.click/api"),o.length>0){let a=(0,L.containsInsensitive)(e.data.message,...o);if(a){(0,s.debug)("ignoring error, contains=",a);return}}if(J&&t)(0,s.debug)("allowing local error tracking due to devmode=true");else if(J)return(0,s.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${r}`),{};if(!ne(e.data.message))return{};(0,s.debug)("error track",e.data.message,JSON.stringify(e));let n=D({...e.data,name:e.data.name??"unknown"});return p[n]=e,x=r,v??=setTimeout(B,500),{}};function ne(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,s.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,s.info)("empty message payload?"),!1):!0:((0,s.info)("no message?"),!1)}var D=e=>{try{let r=/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/gim,o=/(at \S+?) \(\S+\)\s/gim,t=/^((%[cs])+\s*)+$/gim,n=/^color:/gim,a=[],i=e.message;(0,M.isJson)(i)?a=JSON.parse(i):a=[i];let c=a.findIndex(f=>f.match(t)),E=a.findIndex(f=>f.match(n));c>=0&&E>=0&&E===c+1&&(a=a.filter((f,Q)=>![c,E].includes(Q))),a=a.map(f=>f.includes(".js:")||f.includes("node_modules")?f.replace(o,"$1 (stacktrace)"):f.replace(r,"[date]")),i=JSON.stringify(a);let $=(0,T.hashCode)(i).toString();return(0,s.debug)("got errorKey=",i,$),$}catch{return(0,T.hashCode)(e.message).toString()}};async function b({ev:e,values:r}){if(!r.analyticaToken)return;let o={message:e.message,href:window.location.href,filename:e.filename,name:"",stack:e.error.stack};await d({...r,data:{key:r.analyticaToken,data:o}})}function z(e){(0,F.useEffect)(()=>{let r=o=>b({ev:o,values:e});if(e.analyticaToken)return window.addEventListener("error",r),()=>{try{window.removeEventListener("error",r)}catch{}}},[])}var H=require("react");function j(e){(0,H.useEffect)(()=>{if(window.consoleset||!e.analyticaToken)return;window.consoleset=!0;let r=window.console.error;window.console.error=(...t)=>{d({...e,data:{data:{href:window.location.href,message:JSON.stringify(t)},key:e.analyticaToken}}),r(...t)};let o=window.console.warn;window.console.warn=(...t)=>{d({...e,data:{data:{href:window.location.href,message:JSON.stringify(t)},key:e.analyticaToken}}),o(...t)}},[])}var g=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=(...t)=>{d({...e,data:{data:{href:"server",message:JSON.stringify(t)},key:e.analyticaToken}}),r(...t)};let o=global.console.warn;global.console.warn=(...t)=>{d({...e,data:{data:{href:"server",message:JSON.stringify(t)},key:e.analyticaToken}}),o(...t)}}var K=require("react");var y=require("react/jsx-runtime"),ae={fontSize:"2rem"},w=class extends K.Component{constructor(r){super(r),this.state={hasError:void 0},this.seenError=!1}static getDerivedStateFromError(r){let o=typeof window<"u"&&window.location.href;return{hasError:{...r,message:r?.message??r,...r?.stack&&{error:{stack:r?.stack}},...o&&{href:o}}}}render(){let{hasError:r}=this.state,{children:o,notify:t}=this.props;return r?(t&&t(r),(0,y.jsx)(C,{open:!0,setOpen:()=>{},children:(0,y.jsxs)("div",{style:ae,children:["A fatal error has occurred - the admin has been notified.",(0,y.jsx)("button",{type:"button",onClick:()=>window.location.reload(),children:"Press here to restart app"})]})})):o}};var P=require("react/jsx-runtime"),_=({children:e})=>{let r=(0,k.useContext)(m);return j(r),z(r),W(r),(0,h.debug)("installed analytica.click error handlers"),r.analyticaToken?(0,P.jsx)(w,{notify:o=>b({ev:o,values:r}),children:e}):((0,h.warn)(g("ErrorBoundary")),(0,P.jsx)(k.default.Fragment,{children:e}))};var O=require("react/jsx-runtime"),m=(0,X.createContext)(void 0),ie=({children:e,values:r})=>(0,O.jsx)(m.Provider,{value:r,children:(0,O.jsx)(_,{children:e})});var S=require("react/jsx-runtime"),C=({open:e,setOpen:r,children:o})=>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:t=>t.stopPropagation(),children:o})}):null;var De=require("cross-fetch/polyfill"),l=require("ag-common/dist/common/helpers/log"),I=async({analyticaToken:e,overrideBaseUrl:r="https://analytica.click/api",eventName:o,devMode:t,valueOverrides:n})=>{let a={eventName:o,browserFingerprint:n?.browserFingerprint,pageLocation:""};if(typeof window<"u"&&(a={...a,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),!t&&typeof window<"u"&&window.location.hostname==="localhost")return(0,l.debug)(`local page ignored: ${JSON.stringify(a)}, to ${r}`),{};try{let i=await fetch(`${r}/site/event`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:e,data:a})});if(!i.ok){let c=await i.text();return(0,l.warn)("tracking error:"+c),{error:c}}}catch(i){let c=i instanceof Error?i.message:"Unknown error";return(0,l.warn)("tracking error:"+c),{error:c}}return{}},R=async({analyticaToken:e,overrideBaseUrl:r="https://analytica.click/api",devMode:o,valueOverrides:t})=>{let n={pageLocation:"",browserFingerprint:t?.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}),!o&&typeof window<"u"&&window.location.hostname==="localhost")return(0,l.debug)(`local page ignored: ${JSON.stringify(n)}, to ${r}`),{};if(!n.pageLocation)return(0,l.warn)("no pageLocation"),{};try{let a=await fetch(`${r}/site/tracking`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:e,data:n})});if(!a.ok){let i=await a.text();return(0,l.warn)("tracking error:"+i),{error:i}}}catch(a){let i=a instanceof Error?a.message:"Unknown error";return(0,l.warn)("tracking error:"+i),{error:i}}return{}};var q=require("ag-common/dist/common/helpers/log"),G=require("react");var se=()=>{let e=(0,G.useContext)(m);if(!e.analyticaToken){(0,q.warn)(g("useAnalytica"));let r=async()=>({error:"no token"});return{event:r,page:r}}return{event:r=>I({...r,...e}),page:r=>R({...r,...e})}};0&&(module.exports={AnalyticaClickProvider,AnalyticaConfigContext,Modal,errorTrack,event,getErrorKey,page,tokenMissing,useAnalytica});
|
1
|
+
'use client';"use strict";var Y=Object.create;var u=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var re=(e,r)=>{for(var o in r)u(e,o,{get:r[o],enumerable:!0})},N=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of U(r))!ee.call(e,n)&&n!==o&&u(e,n,{get:()=>r[n],enumerable:!(t=Z(r,n))||t.enumerable});return e};var oe=(e,r,o)=>(o=e!=null?Y(V(e)):{},N(r||!e||!e.__esModule?u(o,"default",{value:e,enumerable:!0}):o,e)),te=e=>N(u({},"__esModule",{value:!0}),e);var ce={};re(ce,{AnalyticaClickProvider:()=>ie,AnalyticaConfigContext:()=>m,Modal:()=>C,errorTrack:()=>d,event:()=>I,getErrorKey:()=>D,page:()=>R,tokenMissing:()=>g,useAnalytica:()=>se});module.exports=te(ce);var X=require("react");var h=require("ag-common/dist/common/helpers/log"),k=oe(require("react"));var F=require("react");var le=require("cross-fetch/polyfill"),T=require("ag-common/dist/common/helpers/hashCode"),s=require("ag-common/dist/common/helpers/log"),M=require("ag-common/dist/common/helpers/object"),L=require("ag-common/dist/common/helpers/string/contains");var A=(e,r)=>{let o=[],t={},n=0;return Object.entries(e).forEach(([a,i])=>{n<r?o.push(i):t[a]=i,n+=1}),{part:o,rest:t}};var J=typeof window<"u"&&window.location.hostname==="localhost",p={},v,x,B=async()=>{try{if(Object.keys(p).length>100){let t=Object.keys(p)[0],n=p[t],a=await fetch(`${x}/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify([{key:n.key,data:{...n.data,message:`error overload!: ${n.data.message||"?"}`}}])});if(p={},!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return{}}let{part:e,rest:r}=A(p,10);p=r;let o=await fetch(`${x}/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify(e)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`)}catch(e){let r=e;return{error:r?.message??r.message}}finally{Object.keys(p).length>0?v=setTimeout(B,1e3):v=void 0}},d=async({data:e,overrideBaseUrl:r="https://analytica.click/api",ignoreBrowserErrors:o=["will be removed","performing full reload","tracking error","fetch RSC payload","perform a full reload","warnings#debug_enabled",'"digest"',"punycode"],devMode:t})=>{if(r||(r="https://analytica.click/api"),r.startsWith("/")&&typeof window>"u"&&(r="https://analytica.click/api"),o.length>0){let a=(0,L.containsInsensitive)(e.data.message,...o);if(a){(0,s.debug)("ignoring error, contains=",a);return}}if(J&&t)(0,s.debug)("allowing local error tracking due to devmode=true");else if(J)return(0,s.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${r}`),{};if(!ne(e.data.message))return{};(0,s.debug)("error track",e.data.message,JSON.stringify(e));let n=D({...e.data,name:e.data.name??"unknown"});return p[n]=e,x=r,v??=setTimeout(B,500),{}};function ne(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,s.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,s.info)("empty message payload?"),!1):!0:((0,s.info)("no message?"),!1)}var D=e=>{try{let r=/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/gim,o=/(at \S+?) \(\S+\)\s/gim,t=/^((%[cs])+\s*)+$/gim,n=/^color:/gim,a=[],i=e.message;(0,M.isJson)(i)?a=JSON.parse(i):a=[i];let c=a.findIndex(f=>f.match(t)),E=a.findIndex(f=>f.match(n));c>=0&&E>=0&&E===c+1&&(a=a.filter((f,Q)=>![c,E].includes(Q))),a=a.map(f=>f.includes(".js:")||f.includes("node_modules")?f.replace(o,"$1 (stacktrace)"):f.replace(r,"[date]")),i=JSON.stringify(a);let $=(0,T.hashCode)(i).toString();return(0,s.debug)("got errorKey=",i,$),$}catch{return(0,T.hashCode)(e.message).toString()}};async function b({ev:e,values:r}){if(!r.analyticaToken)return;let o={message:e.message,href:window.location.href,filename:e.filename,name:"",stack:e.error.stack};await d({...r,data:{key:r.analyticaToken,data:o}})}function z(e){(0,F.useEffect)(()=>{let r=o=>b({ev:o,values:e});if(e.analyticaToken)return window.addEventListener("error",r),()=>{try{window.removeEventListener("error",r)}catch{}}},[])}var H=require("react");function j(e){(0,H.useEffect)(()=>{if(window.consoleset||!e.analyticaToken)return;window.consoleset=!0;let r=window.console.error;window.console.error=(...t)=>{d({...e,data:{data:{href:window.location.href,message:JSON.stringify(t)},key:e.analyticaToken}}),r(...t)};let o=window.console.warn;window.console.warn=(...t)=>{d({...e,data:{data:{href:window.location.href,message:JSON.stringify(t)},key:e.analyticaToken}}),o(...t)}},[])}var g=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=(...t)=>{d({...e,data:{data:{href:"server",message:JSON.stringify(t)},key:e.analyticaToken}}),r(...t)};let o=global.console.warn;global.console.warn=(...t)=>{d({...e,data:{data:{href:"server",message:JSON.stringify(t)},key:e.analyticaToken}}),o(...t)}}var K=require("react");var y=require("react/jsx-runtime"),ae={fontSize:"2rem"},w=class extends K.Component{constructor(r){super(r),this.state={hasError:void 0},this.seenError=!1}static getDerivedStateFromError(r){let o=typeof window<"u"&&window.location.href;return{hasError:{...r,message:r?.message??r,...r?.stack&&{error:{stack:r?.stack}},...o&&{href:o}}}}render(){let{hasError:r}=this.state,{children:o,notify:t}=this.props;return r?(t&&t(r),(0,y.jsx)(C,{open:!0,setOpen:()=>{},children:(0,y.jsxs)("div",{style:ae,children:["A fatal error has occurred - the admin has been notified.",(0,y.jsx)("button",{type:"button",onClick:()=>window.location.reload(),children:"Press here to restart app"})]})})):o}};var P=require("react/jsx-runtime"),_=({children:e})=>{let r=(0,k.useContext)(m);return j(r),z(r),W(r),(0,h.debug)("installed analytica.click error handlers"),r.analyticaToken?(0,P.jsx)(w,{notify:o=>b({ev:o,values:r}),children:e}):((0,h.warn)(g("ErrorBoundary")),(0,P.jsx)(k.default.Fragment,{children:e}))};var O=require("react/jsx-runtime"),m=(0,X.createContext)(void 0),ie=({children:e,values:r})=>(0,O.jsx)(m.Provider,{value:r,children:(0,O.jsx)(_,{children:e})});var S=require("react/jsx-runtime"),C=({open:e,setOpen:r,children:o})=>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:t=>t.stopPropagation(),children:o})}):null;var De=require("cross-fetch/polyfill"),l=require("ag-common/dist/common/helpers/log"),I=async({analyticaToken:e,overrideBaseUrl:r="https://analytica.click/api",eventName:o,devMode:t,valueOverrides:n})=>{let a={eventName:o,browserFingerprint:n?.browserFingerprint,pageLocation:""};if(typeof window<"u"&&(a={...a,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),!t&&typeof window<"u"&&window.location.hostname==="localhost")return(0,l.debug)(`local page ignored: ${JSON.stringify(a)}, to ${r}`),{};try{let i=await fetch(`${r}/site/event`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:e,data:a})});if(!i.ok){let c=await i.text();return(0,l.warn)("tracking error:"+c),{error:c}}}catch(i){let c=i instanceof Error?i.message:"Unknown error";return(0,l.warn)("tracking error:"+c),{error:c}}return{}},R=async({analyticaToken:e,overrideBaseUrl:r="https://analytica.click/api",devMode:o,valueOverrides:t})=>{let n={pageLocation:"",browserFingerprint:t?.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}),!o&&typeof window<"u"&&window.location.hostname==="localhost")return(0,l.debug)(`local page ignored: ${JSON.stringify(n)}, to ${r}`),{};if(!n.pageLocation)return(0,l.warn)("no pageLocation"),{};try{let a=await fetch(`${r}/site/tracking`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:e,data:n})});if(!a.ok){let i=await a.text();return(0,l.warn)("tracking error:"+i),{error:i}}}catch(a){let i=a instanceof Error?a.message:"Unknown error";return(0,l.warn)("tracking error:"+i),{error:i}}return{}};var q=require("ag-common/dist/common/helpers/log"),G=require("react");var se=()=>{let e=(0,G.useContext)(m);if(!e.analyticaToken){(0,q.warn)(g("useAnalytica"));let r=async()=>({error:"no token"});return{event:r,page:r}}return{event:r=>I({...r,...e}),page:r=>R({...r,...e})}};0&&(module.exports={AnalyticaClickProvider,AnalyticaConfigContext,Modal,errorTrack,event,getErrorKey,page,tokenMissing,useAnalytica});
|
@@ -5,6 +5,10 @@ export declare const createSiteSchema: z.ZodObject<{
|
|
5
5
|
export declare const deleteSiteSchema: z.ZodObject<{
|
6
6
|
site: z.ZodString;
|
7
7
|
}, z.core.$strip>;
|
8
|
+
export declare const updateSiteDetailsSchema: z.ZodObject<{
|
9
|
+
site: z.ZodString;
|
10
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
11
|
+
}, z.core.$strip>;
|
8
12
|
export declare const createGoogleIntegrationSchema: z.ZodObject<{
|
9
13
|
email: z.ZodString;
|
10
14
|
key: z.ZodString;
|
@@ -43,24 +47,6 @@ export declare const SeoResultSchema: z.ZodObject<{
|
|
43
47
|
query: z.ZodString;
|
44
48
|
}, z.core.$strip>>;
|
45
49
|
}, z.core.$strip>;
|
46
|
-
export declare const GetAccountSchema: z.ZodObject<{
|
47
|
-
site: z.ZodString;
|
48
|
-
account: z.ZodString;
|
49
|
-
apiKey: z.ZodString;
|
50
|
-
adminApiKey: z.ZodString;
|
51
|
-
}, z.core.$strip>;
|
52
|
-
export declare const GetAccountsSchema: z.ZodObject<{
|
53
|
-
accounts: z.ZodArray<z.ZodObject<{
|
54
|
-
site: z.ZodString;
|
55
|
-
account: z.ZodString;
|
56
|
-
apiKey: z.ZodString;
|
57
|
-
adminApiKey: z.ZodString;
|
58
|
-
}, z.core.$strip>>;
|
59
|
-
googleEmail: z.ZodOptional<z.ZodString>;
|
60
|
-
googleKey: z.ZodOptional<z.ZodString>;
|
61
|
-
bingKey: z.ZodOptional<z.ZodString>;
|
62
|
-
bingAccount: z.ZodOptional<z.ZodString>;
|
63
|
-
}, z.core.$strip>;
|
64
50
|
export declare const GoogleIntegrationSchema: z.ZodObject<{
|
65
51
|
email: z.ZodString;
|
66
52
|
key: z.ZodString;
|
@@ -303,18 +289,20 @@ export declare const PostErrorSchema: z.ZodObject<{
|
|
303
289
|
export declare const SiteDetailsSchema: z.ZodObject<{
|
304
290
|
site: z.ZodString;
|
305
291
|
account: z.ZodString;
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
292
|
+
datetime: z.ZodOptional<z.ZodNumber>;
|
293
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
294
|
+
}, z.core.$strip>;
|
295
|
+
export declare const GetAccountSchema: z.ZodObject<{
|
296
|
+
site: z.ZodString;
|
297
|
+
account: z.ZodString;
|
298
|
+
apiKey: z.ZodString;
|
299
|
+
adminApiKey: z.ZodString;
|
300
|
+
siteDetail: z.ZodObject<{
|
301
|
+
site: z.ZodString;
|
302
|
+
account: z.ZodString;
|
303
|
+
datetime: z.ZodOptional<z.ZodNumber>;
|
304
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
305
|
+
}, z.core.$strip>;
|
318
306
|
}, z.core.$strip>;
|
319
307
|
export declare const SiteDataSchema: z.ZodObject<{
|
320
308
|
accountDetails: z.ZodOptional<z.ZodObject<{
|
@@ -322,6 +310,12 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
322
310
|
account: z.ZodString;
|
323
311
|
apiKey: z.ZodString;
|
324
312
|
adminApiKey: z.ZodString;
|
313
|
+
siteDetail: z.ZodObject<{
|
314
|
+
site: z.ZodString;
|
315
|
+
account: z.ZodString;
|
316
|
+
datetime: z.ZodOptional<z.ZodNumber>;
|
317
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
318
|
+
}, z.core.$strip>;
|
325
319
|
}, z.core.$strip>>;
|
326
320
|
browsers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
327
321
|
account: z.ZodOptional<z.ZodString>;
|
@@ -504,6 +498,24 @@ export declare const DeleteAccountSchema: z.ZodObject<{
|
|
504
498
|
export declare const ArchiveErrorsSchema: z.ZodObject<{
|
505
499
|
PKs: z.ZodArray<z.ZodString>;
|
506
500
|
}, z.core.$strip>;
|
501
|
+
export declare const GetAccountsSchema: z.ZodObject<{
|
502
|
+
accounts: z.ZodArray<z.ZodObject<{
|
503
|
+
site: z.ZodString;
|
504
|
+
account: z.ZodString;
|
505
|
+
apiKey: z.ZodString;
|
506
|
+
adminApiKey: z.ZodString;
|
507
|
+
siteDetail: z.ZodObject<{
|
508
|
+
site: z.ZodString;
|
509
|
+
account: z.ZodString;
|
510
|
+
datetime: z.ZodOptional<z.ZodNumber>;
|
511
|
+
healthCheckPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
512
|
+
}, z.core.$strip>;
|
513
|
+
}, z.core.$strip>>;
|
514
|
+
googleEmail: z.ZodOptional<z.ZodString>;
|
515
|
+
googleKey: z.ZodOptional<z.ZodString>;
|
516
|
+
bingKey: z.ZodOptional<z.ZodString>;
|
517
|
+
bingAccount: z.ZodOptional<z.ZodString>;
|
518
|
+
}, z.core.$strip>;
|
507
519
|
export type SeoResultValues = z.infer<typeof SeoResultValuesSchema>;
|
508
520
|
export type SeoResult = z.infer<typeof SeoResultSchema>;
|
509
521
|
export type GetAccount = z.infer<typeof GetAccountSchema>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "analytica.click",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.528",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"typings": "dist/index.d.ts",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"license": "ISC",
|
9
9
|
"dependencies": {
|
10
10
|
"@types/react": "^19.0.0",
|
11
|
-
"ag-common": "0.0.
|
11
|
+
"ag-common": "0.0.762",
|
12
12
|
"cross-env": "^10.0.0",
|
13
13
|
"cross-fetch": "^4.0.0",
|
14
14
|
"nodemon": "^3",
|