@aircall/tracker
Advanced tools
Comparing version 2.1.3 to 2.2.0
@@ -0,1 +1,9 @@ | ||
export declare class AnalyticsJS extends Array { | ||
SNIPPET_VERSION: string; | ||
identify(...args: (string | object)[]): void; | ||
track(...args: (string | object)[]): void; | ||
} | ||
export declare interface WindowWithAnalytics extends Window { | ||
analytics: AnalyticsJS; | ||
} | ||
export declare enum TRACKER_ENVIRONMENT { | ||
@@ -27,4 +35,4 @@ DEVELOPMENT = "development", | ||
export declare type ICompanyBillingPeriod = 'annually' | 'monthly'; | ||
export declare type ICompanyTierLevel = 'tier_a' | 'tier_1' | 'tier_2' | 'tier_3' | 'tier_4' | 'tier_5' | 'no_tier'; | ||
export declare type ICompanyPlan = 'friend' | 'partner' | 'trial' | 'starter' | 'pro' | 'pro_oct_2014' | 'starter_june_2015' | 'premium_june_2015' | 'enterprise_june_2015' | 'starter_sept_2015' | 'premium_sept_2015' | 'enterprise_sept_2015' | 'starter_august_2016' | 'premium_august_2016' | 'enterprise_august_2016' | 'premium_march_2017' | 'enterprise_march_2017' | 'premium_custom_nov_2017' | 'enterprise_custom_nov_2017' | 'essentials_july_2018' | 'professional_july_2018' | 'custom_july_2018' | 'essentials_custom_august_2018' | 'professional_custom_august_2018' | 'custom'; | ||
export declare type ICompanyTierLevel = string; | ||
export declare type ICompanyPlan = string; | ||
export declare interface CompanyTrackerIdentification { | ||
@@ -41,10 +49,2 @@ billing_period: ICompanyBillingPeriod; | ||
} | ||
export declare interface WindowWithAnalytics extends Window { | ||
analytics: AnalyticsJS; | ||
} | ||
export declare class AnalyticsJS extends Array { | ||
SNIPPET_VERSION: string; | ||
identify(...args: (string | object)[]): void; | ||
track(...args: (string | object)[]): void; | ||
} | ||
export declare const defaultIdentification: TrackerIdentification; | ||
@@ -55,5 +55,5 @@ export default class Tracker { | ||
private identification; | ||
private readonly isDevelopment; | ||
readonly isIdentified: boolean; | ||
private readonly sdk; | ||
private get isDevelopment(); | ||
get isIdentified(): boolean; | ||
private get sdk(); | ||
private getScriptTag; | ||
@@ -60,0 +60,0 @@ init(options: TrackerInitOptions): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var TRACKER_ENVIRONMENT; | ||
(function (TRACKER_ENVIRONMENT) { | ||
TRACKER_ENVIRONMENT["DEVELOPMENT"] = "development"; | ||
TRACKER_ENVIRONMENT["TEST"] = "test"; | ||
TRACKER_ENVIRONMENT["STAGING"] = "staging"; | ||
TRACKER_ENVIRONMENT["BETA"] = "beta"; | ||
TRACKER_ENVIRONMENT["PRODUCTION"] = "production"; | ||
})(TRACKER_ENVIRONMENT = exports.TRACKER_ENVIRONMENT || (exports.TRACKER_ENVIRONMENT = {})); | ||
class AnalyticsJS extends Array { | ||
@@ -26,2 +18,10 @@ constructor() { | ||
exports.AnalyticsJS = AnalyticsJS; | ||
var TRACKER_ENVIRONMENT; | ||
(function (TRACKER_ENVIRONMENT) { | ||
TRACKER_ENVIRONMENT["DEVELOPMENT"] = "development"; | ||
TRACKER_ENVIRONMENT["TEST"] = "test"; | ||
TRACKER_ENVIRONMENT["STAGING"] = "staging"; | ||
TRACKER_ENVIRONMENT["BETA"] = "beta"; | ||
TRACKER_ENVIRONMENT["PRODUCTION"] = "production"; | ||
})(TRACKER_ENVIRONMENT = exports.TRACKER_ENVIRONMENT || (exports.TRACKER_ENVIRONMENT = {})); | ||
exports.defaultIdentification = { | ||
@@ -75,3 +75,3 @@ user_id: 0, | ||
else { | ||
this.sdk.track(message, Object.assign({}, properties, this.identification)); | ||
this.sdk.track(message, Object.assign(Object.assign({}, properties), this.identification)); | ||
} | ||
@@ -78,0 +78,0 @@ } |
{ | ||
"name": "@aircall/tracker", | ||
"version": "2.1.3", | ||
"version": "2.2.0", | ||
"main": "dist/index.js", | ||
@@ -13,9 +13,6 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "cafa7581944cae66f2c69b79baf6867ca9318a8c", | ||
"gitHead": "fa017790b7c1007725b7200c24df33afae396955", | ||
"devDependencies": { | ||
"@types/segment-analytics": "^0.0.31" | ||
}, | ||
"dependencies": { | ||
"redux": "4.0.1" | ||
"@types/segment-analytics": "^0.0.32" | ||
} | ||
} |
import Tracker, { AnalyticsJS, ICompanyBillingPeriod, ICompanyTierLevel, IUserOS, TRACKER_ENVIRONMENT, WindowWithAnalytics } from './Tracker'; | ||
declare const window: WindowWithAnalytics; | ||
const initOptions = { key: 'FOO' }; | ||
@@ -28,4 +30,2 @@ | ||
const message = 'MESSAGE'; | ||
@@ -48,13 +48,12 @@ | ||
it('should mock the analyticsJS SDK while the script is loading', (): void => { | ||
const analytics = (window as WindowWithAnalytics).analytics as AnalyticsJS; | ||
const [trackEvent, trackPayload] = [ 'FOO', { foo: 'BAR' } ]; | ||
const [identifyEvent, identifyPayload] = [ 'FOO', { foo: 'BAR' } ]; | ||
expect(analytics).toBeInstanceOf(AnalyticsJS); | ||
expect(window.analytics).toBeInstanceOf(AnalyticsJS); | ||
analytics.identify(identifyEvent, identifyPayload); | ||
analytics.track(trackEvent, trackPayload); | ||
window.analytics.identify(identifyEvent, identifyPayload); | ||
window.analytics.track(trackEvent, trackPayload); | ||
expect(analytics[0]).toEqual(['identify', identifyEvent, identifyPayload]); | ||
expect(analytics[1]).toEqual(['track', trackEvent, trackPayload]); | ||
expect(window.analytics[0]).toEqual(['identify', identifyEvent, identifyPayload]); | ||
expect(window.analytics[1]).toEqual(['track', trackEvent, trackPayload]); | ||
}); | ||
@@ -88,3 +87,3 @@ | ||
it('should call analytics.track', (): void => { | ||
const spy: jest.SpyInstance = jest.spyOn((window as WindowWithAnalytics).analytics, 'track'); | ||
const spy: jest.SpyInstance = jest.spyOn(window.analytics, 'track'); | ||
@@ -91,0 +90,0 @@ tracker.init(initOptions); |
@@ -0,1 +1,21 @@ | ||
export class AnalyticsJS extends Array { | ||
public SNIPPET_VERSION = '4.1.0'; | ||
public identify(...args: (string | object)[]): void { | ||
args.unshift('identify'); | ||
this.push(args); | ||
} | ||
public track(...args: (string | object)[]): void { | ||
args.unshift('track'); | ||
this.push(args); | ||
} | ||
} | ||
export declare interface WindowWithAnalytics extends Window { | ||
analytics: AnalyticsJS; | ||
} | ||
declare const window: WindowWithAnalytics; | ||
export enum TRACKER_ENVIRONMENT { | ||
@@ -29,36 +49,4 @@ DEVELOPMENT = 'development', | ||
export type ICompanyBillingPeriod = 'annually' | 'monthly'; | ||
export type ICompanyTierLevel = | ||
| 'tier_a' | ||
| 'tier_1' | ||
| 'tier_2' | ||
| 'tier_3' | ||
| 'tier_4' | ||
| 'tier_5' | ||
| 'no_tier'; | ||
export type ICompanyPlan = | ||
| 'friend' | ||
| 'partner' | ||
| 'trial' | ||
| 'starter' | ||
| 'pro' | ||
| 'pro_oct_2014' | ||
| 'starter_june_2015' | ||
| 'premium_june_2015' | ||
| 'enterprise_june_2015' | ||
| 'starter_sept_2015' | ||
| 'premium_sept_2015' | ||
| 'enterprise_sept_2015' | ||
| 'starter_august_2016' | ||
| 'premium_august_2016' | ||
| 'enterprise_august_2016' | ||
| 'premium_march_2017' | ||
| 'enterprise_march_2017' | ||
| 'premium_custom_nov_2017' | ||
| 'enterprise_custom_nov_2017' | ||
| 'essentials_july_2018' | ||
| 'professional_july_2018' | ||
| 'custom_july_2018' | ||
| 'essentials_custom_august_2018' | ||
| 'professional_custom_august_2018' | ||
| 'custom'; | ||
export type ICompanyTierLevel = string; | ||
export type ICompanyPlan = string; | ||
@@ -78,20 +66,2 @@ export declare interface CompanyTrackerIdentification { | ||
export declare interface WindowWithAnalytics extends Window { | ||
analytics: AnalyticsJS; | ||
} | ||
export class AnalyticsJS extends Array { | ||
public SNIPPET_VERSION: string = '4.1.0'; | ||
public identify(...args: (string | object)[]): void { | ||
args.unshift('identify'); | ||
this.push(args); | ||
} | ||
public track(...args: (string | object)[]): void { | ||
args.unshift('track'); | ||
this.push(args); | ||
} | ||
} | ||
export const defaultIdentification: TrackerIdentification = { | ||
@@ -113,6 +83,6 @@ user_id: 0, | ||
public constructor() { | ||
(window as WindowWithAnalytics).analytics = new AnalyticsJS(); | ||
window.analytics = new AnalyticsJS(); | ||
} | ||
private identified: boolean = false; | ||
private identified = false; | ||
@@ -130,3 +100,3 @@ private identification: TrackerIdentification = defaultIdentification; | ||
private get sdk(): AnalyticsJS { | ||
return (window as WindowWithAnalytics).analytics; | ||
return window.analytics; | ||
} | ||
@@ -133,0 +103,0 @@ |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
0
0
16223
18
421
- Removedredux@4.0.1
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedredux@4.0.1(transitive)
- Removedsymbol-observable@1.2.0(transitive)