analytica.click 0.0.389 → 0.0.390

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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ErrorBoundary: ({ children, filterBrowserError, }: {
3
2
  children?: JSX.Element | JSX.Element[] | undefined;
4
3
  filterBrowserError?: ((e: ErrorEvent | Error) => boolean) | undefined;
@@ -0,0 +1,11 @@
1
+ import type { MouseEvent, TouchEvent } from 'react';
2
+ export declare const getChildrenArray: (ref: React.RefObject<HTMLDivElement>) => Element[];
3
+ export declare const getChildrenPositions: (ref: React.RefObject<HTMLDivElement>) => number[];
4
+ export declare const getClientY: (e: React.MouseEvent | React.TouchEvent) => number | undefined;
5
+ export declare function extractQs({ search, sanatise, }: {
6
+ sanatise: boolean;
7
+ search: string;
8
+ }): {
9
+ [a: string]: string;
10
+ };
11
+ export declare const stringify: (p: Record<string, string>) => URLSearchParams;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
1
  export * from './components';
2
2
  export * from './helpers';
3
+
4
+ export * from './types';
5
+
package/dist/src.js ADDED
@@ -0,0 +1,3 @@
1
+ var y=Object.create;var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var M=(e,r)=>{for(var t in r)a(e,t,{get:r[t],enumerable:!0})},u=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of b(r))!w.call(e,o)&&o!==t&&a(e,o,{get:()=>r[o],enumerable:!(n=x(r,o))||n.enumerable});return e};var m=(e,r,t)=>(t=e!=null?y(v(e)):{},u(r||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e)),T=e=>u(a({},"__esModule",{value:!0}),e);var B={};M(B,{ErrorBoundary:()=>c,extractQs:()=>k,getChildrenArray:()=>E,getChildrenPositions:()=>C,getClientY:()=>j,stringify:()=>A});module.exports=T(B);var d=m(require("@emotion/styled")),l=require("ag-common/dist/ui/components/Modal"),i=m(require("react")),R=d.default.div`
2
+ font-size: 2rem;
3
+ `,c=class extends i.Component{constructor(t){super(t);this.state={hasError:void 0}}static getDerivedStateFromError(t){let n=typeof window<"u"&&window?.location?.href;return{hasError:{...t,message:t?.message||t,...t?.stack&&{stack:t?.stack},...n&&{href:n}}}}render(){let{hasError:t}=this.state,{children:n,notify:o}=this.props;return t?(o&&o(t),i.default.createElement(l.Modal,{open:!0,setOpen:()=>{}},i.default.createElement(R,null,"A fatal error has occurred - the admin has been notified.",i.default.createElement("button",{type:"button",onClick:()=>window.location.reload()},"Press here to restart app")))):n}};var f=require("ag-common/dist/common/helpers/log"),g=require("querystring"),E=e=>{let r=e.current?.children??[],t=[];for(let n=0;n<r.length;n+=1)t.push(r[n]);return t},C=e=>E(e).map(r=>r.getBoundingClientRect().top+r.getBoundingClientRect().height),j=e=>{if(!e)return;let r;if(e?.changedTouches||e?.touches){let t=e;r=t.changedTouches?.[0]?.clientY||t.touches?.[0]?.clientY}else e?.clientY&&(r=e.clientY);return r},h=e=>e.replace(/[^a-zA-Z0-9\-_]/gim,"");function k({search:e,sanatise:r}){if(!e)return{};let t=(0,g.parse)(e.replace(/^[?]/,"")),n={};return Object.keys(t).forEach(o=>{let s=r?h(o):o;o!==s&&(0,f.debug)("sanatising qs input key for ",s),Array.isArray(t[s])?n[s]=t[s].join(""):n[s]=t[s];let p=r?h(n[s]):n[s];p!==n[s]&&((0,f.debug)("sanatising qs input for ",s),n[s]=p)}),n}var A=e=>{let r=new URLSearchParams;return Object.entries(e).forEach(([t,n])=>r.append(t,n)),r};0&&(module.exports={ErrorBoundary,extractQs,getChildrenArray,getChildrenPositions,getClientY,stringify});
@@ -0,0 +1,11 @@
1
+ export interface PostError {
2
+ key: string;
3
+ data: PostErrorData;
4
+ }
5
+ export interface PostErrorData {
6
+ message: string;
7
+ name?: string;
8
+ stack?: string;
9
+ href: string;
10
+ filename?: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from './api';
2
+ export * from './widgets';
@@ -0,0 +1,17 @@
1
+ export type TTrackNoEvent = (p: Omit<ITrack, 'eventName'>) => Promise<{
2
+ error?: string;
3
+ }>;
4
+ export type TTrack = (p: ITrack) => Promise<{
5
+ error?: string;
6
+ }>;
7
+ export interface ITrack {
8
+ analyticaToken: string;
9
+ overrideBaseUrl?: string;
10
+ eventName: string;
11
+ }
12
+ export type TErrorMessage = (m: Error | ErrorEvent) => Promise<void>;
13
+ export interface IAnalyticaConfig {
14
+ analyticaToken?: string;
15
+ overrideBaseUrl?: string;
16
+ devMode?: boolean;
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analytica.click",
3
- "version": "0.0.389",
3
+ "version": "0.0.390",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",