@kano/kbc-telemetry
Advanced tools
Comparing version 2.1.7 to 2.2.0
@@ -1,5 +0,5 @@ | ||
import { track, trackError, useTracking, withTracking, ITrackingProps, ITracking } from './utils/react-tracking'; | ||
import { track, trackError, useTracking, withTracking, ITrackingProps } from './utils/react-tracking'; | ||
export * from './telemetry'; | ||
export * from './offlineClient'; | ||
export { track, trackError, useTracking, withTracking, ITrackingProps, ITracking }; | ||
export { track, trackError, useTracking, withTracking, ITrackingProps }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { ITracking, ITrackEvent, ITrackingData } from '../utils/react-tracking'; | ||
import { ITrackingProps, ITrackEvent, ITrackingData } from '../utils/react-tracking'; | ||
import { ITelemetryProviderConfig } from './provider'; | ||
@@ -8,5 +8,4 @@ interface ITelemetryClientConfig extends ITelemetryProviderConfig { | ||
} | ||
interface ITelemetryClientParameters { | ||
interface ITelemetryClientParameters extends ITrackingProps { | ||
config: ITelemetryClientConfig; | ||
tracking: ITracking; | ||
} | ||
@@ -13,0 +12,0 @@ declare type ISessionEventType = 'start_session' | 'pause_session' | 'resume_session' | 'refresh_session'; |
@@ -17,6 +17,5 @@ "use strict"; | ||
const React = __importStar(require("react")); | ||
const react_tracking_1 = require("react-tracking"); | ||
const react_router_dom_1 = require("react-router-dom"); | ||
const cookies_1 = require("../utils/cookies"); | ||
const react_tracking_2 = require("../utils/react-tracking"); | ||
const react_tracking_1 = require("../utils/react-tracking"); | ||
const offlineClient_1 = require("../offlineClient"); | ||
@@ -94,3 +93,3 @@ const client_1 = require("./client"); | ||
const { refreshIdleSession, sessionPaused, resumeSession, clearRefreshIdleSession } = telemetryClient; | ||
const eventName = react_tracking_2.isEventError(data) ? 'error' : data.event; | ||
const eventName = react_tracking_1.isEventError(data) ? 'error' : data.event; | ||
if (!refreshIdleSession && sessionPaused && eventName !== 'pause_session' && eventName !== 'resume_session') { | ||
@@ -97,0 +96,0 @@ resumeSession(data); |
@@ -0,1 +1,3 @@ | ||
/// <reference types="react" /> | ||
import { ITrackingProps } from './react-tracking'; | ||
import '../styles/main.scss'; | ||
@@ -5,4 +7,9 @@ declare const setCookie: (cookie: string) => void; | ||
declare const getCookiePermissions: (storeName: string) => string; | ||
declare const CookiePermissions: any; | ||
interface ICookiePermissionsProps extends ITrackingProps { | ||
storeName: string; | ||
cookieName: string; | ||
saveCookie: () => void; | ||
} | ||
declare const CookiePermissions: ({ tracking, storeName, cookieName, saveCookie }: ICookiePermissionsProps) => JSX.Element; | ||
export { setCookie, getCookie, getCookiePermissions, CookiePermissions, }; | ||
//# sourceMappingURL=cookies.d.ts.map |
@@ -48,3 +48,3 @@ "use strict"; | ||
setCookiePermissions(storeName, 'allow'); | ||
return ''; | ||
return null; | ||
} | ||
@@ -51,0 +51,0 @@ const intl = kbc_intl_1.useIntl(); |
@@ -0,1 +1,3 @@ | ||
import React from 'react'; | ||
import { Track, Options, useTracking as _useTracking } from 'react-tracking'; | ||
export interface ITrackEventData { | ||
@@ -29,3 +31,2 @@ event: string; | ||
} | ||
export declare type ITrackData = ITrackEventData | ITrackErrorData | ITrackModuleData; | ||
export interface IAppTrackingData { | ||
@@ -38,2 +39,11 @@ app: string; | ||
} | ||
export interface ITrackPageData { | ||
page: string; | ||
module?: never; | ||
event?: never; | ||
data?: never; | ||
action?: never; | ||
userId?: never; | ||
error?: never; | ||
} | ||
export interface ITrackingEventData extends ITrackEventData, IAppTrackingData { | ||
@@ -44,5 +54,11 @@ } | ||
export declare type ITrackingData = ITrackingEventData | ITrackingErrorData; | ||
export declare type ITrackData = IAppTrackingData | ITrackEventData | ITrackErrorData | ITrackModuleData | ITrackPageData; | ||
export declare const isEventError: (e: ITrackingData) => e is ITrackingErrorData; | ||
export declare type TrackingInfo<T, P, S> = T | ((props: P, state: S, args: any[any], [value, err]: [any, any]) => T); | ||
export declare function track(trackingInfo: TrackingInfo<ITrackData, any, any>, options?: Options<Partial<ITrackData>>): <C extends object | React.ComponentClass<{}, any>, ITrackingProps_1>(Component_0: C) => C; | ||
export declare const trackError: Track<ITrackData>; | ||
export declare const useTracking: typeof _useTracking; | ||
export declare type ITrackEvent = (trackingData: ITrackData) => void; | ||
export declare type IGetTrackingData = () => IAppTrackingData; | ||
export interface ITracking { | ||
export interface ITrackingMethods { | ||
trackEvent: ITrackEvent; | ||
@@ -52,9 +68,11 @@ getTrackingData: IGetTrackingData; | ||
export interface ITrackingProps { | ||
tracking: ITracking; | ||
tracking?: ITrackingMethods; | ||
} | ||
export declare const useTracking: any; | ||
export declare const withTracking: any; | ||
export declare const track: (trackingInfo: ITrackEventData | ITrackModuleData | ITrackErrorData | ((props?: any, state?: any, args?: any) => ITrackData), options?: any) => any; | ||
export declare const trackError: (trackingInfo: ITrackingEventData | ITrackingErrorData | ((props?: any, state?: any, args?: any) => ITrackingData), options?: any) => any; | ||
export declare const isEventError: (e: ITrackingData) => e is ITrackingErrorData; | ||
export declare function withTracking<P extends ITrackingProps>(Component: React.ComponentType<P>): { | ||
(props: Pick<P, import("utility-types").SetDifference<keyof P, "tracking">> & { | ||
wrappedComponentRef?: React.Ref<any>; | ||
}): JSX.Element; | ||
displayName: string; | ||
WrappedComponent: React.ComponentType<P>; | ||
}; | ||
//# sourceMappingURL=react-tracking.d.ts.map |
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) | ||
t[p[i]] = s[p[i]]; | ||
return t; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = __importDefault(require("react")); | ||
const hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics")); | ||
const react_tracking_1 = require("react-tracking"); | ||
exports.useTracking = react_tracking_1.useTracking; | ||
exports.withTracking = react_tracking_1.withTracking(); | ||
exports.track = (trackingInfo, options) => react_tracking_1.track(trackingInfo, options); | ||
exports.trackError = (trackingInfo, options) => react_tracking_1.track(trackingInfo, options); | ||
const withTrackingComponentDecorator_1 = __importStar(require("react-tracking/build/withTrackingComponentDecorator")); | ||
exports.isEventError = (e) => { | ||
return e.error !== undefined; | ||
}; | ||
function track(trackingInfo, options) { | ||
return function decorator(...Component) { | ||
return withTrackingComponentDecorator_1.default(trackingInfo, options)(...Component); | ||
}; | ||
} | ||
exports.track = track; | ||
exports.trackError = react_tracking_1.track; | ||
exports.useTracking = react_tracking_1.useTracking; | ||
function withTracking(Component) { | ||
const displayName = `withTelemetry(${Component.displayName || Component.name})`; | ||
const C = (props) => { | ||
const { wrappedComponentRef } = props, remainingProps = __rest(props, ["wrappedComponentRef"]); | ||
return (react_1.default.createElement(withTrackingComponentDecorator_1.ReactTrackingContext.Consumer, null, context => react_1.default.createElement(Component, Object.assign({}, remainingProps, context, { ref: wrappedComponentRef })))); | ||
}; | ||
C.displayName = displayName; | ||
C.WrappedComponent = Component; | ||
return hoist_non_react_statics_1.default(C, Component); | ||
} | ||
exports.withTracking = withTracking; | ||
//# sourceMappingURL=react-tracking.js.map |
{ | ||
"name": "@kano/kbc-telemetry", | ||
"version": "2.1.7", | ||
"version": "2.2.0", | ||
"description": "Telemetry module for boilerplate apps, using react-tracking", | ||
@@ -30,3 +30,3 @@ "author": "Kano Computing", | ||
"@kano/kbc-icons": "^1.4.9", | ||
"@kano/kbc-intl": "^1.6.3", | ||
"@kano/kbc-intl": "^1.7.0", | ||
"@kano/kbc-utils": "^1.4.2", | ||
@@ -45,3 +45,3 @@ "fingerprintjs2": "^2.1.2", | ||
}, | ||
"gitHead": "561df03f0f0e7c536ab6f324ea2c3c3cd1eed632" | ||
"gitHead": "56f40f831038a429ab71f299809469e5ee32a85e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94848
1068
Updated@kano/kbc-intl@^1.7.0