New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aircall/tracker

Package Overview
Dependencies
Maintainers
5
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aircall/tracker - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

6

CHANGELOG.md
# Change Log
## 3.0.3
### Patch Changes
- 26cec53: Add page method to record website’s page views
## 3.0.2

@@ -4,0 +10,0 @@

2

package.json
{
"name": "@aircall/tracker",
"version": "3.0.2",
"version": "3.0.3",
"main": "src/index.ts",

@@ -5,0 +5,0 @@ "types": "src/index.ts",

@@ -11,4 +11,5 @@ import { initTracker, track, TRACKER } from './actions';

expect(initTracker().type).toEqual(TRACKER.INIT);
expect(page(properties).type).toEqual(TRACKER.PAGE);
});
});
});
export enum TRACKER {
INIT = 'TRACKER_INIT',
TRACK = 'TRACKER_TRACK'
TRACK = 'TRACKER_TRACK',
PAGE = 'TRACKER_PAGE'
}

@@ -12,2 +13,7 @@

export interface PageAction {
type: TRACKER.PAGE;
properties: object;
}
export const initTracker = (): { type: TRACKER.INIT } => ({

@@ -22,1 +28,6 @@ type: TRACKER.INIT

});
export const page = (properties: object = {}): PageAction => ({
type: TRACKER.PAGE,
properties
});

@@ -9,2 +9,3 @@ import * as rudderanalytics from 'rudder-sdk-js';

track: jest.fn(),
page: jest.fn(),
reset: jest.fn()

@@ -101,2 +102,19 @@ }));

describe('page', (): void => {
it('should call rudderanalytics.page in production with correct arguments', () => {
tracker.identify({ ...identifyOptions, environment: TRACKER_ENVIRONMENT.PRODUCTION });
tracker.page(properties);
expect(rudderanalytics.page).toHaveBeenCalledWith(properties);
});
it('should call console.log in development', (): void => {
tracker.identify({ ...identifyOptions, environment: TRACKER_ENVIRONMENT.DEVELOPMENT });
tracker.page(properties);
expect(rudderanalytics.page).not.toHaveBeenCalled();
expect(console.log).toHaveBeenCalledWith('PAGE', properties); // eslint-disable-line no-console
});
});
describe('reset', () => {

@@ -103,0 +121,0 @@ it('should call rudderanalytics.reset', () => {

@@ -9,2 +9,3 @@ import * as rudderanalytics from 'rudder-sdk-js';

track: (eventName: string, properties: { [key: string]: any }) => void;
page: (properties: { [key: string]: any }) => void;
reset: () => void;

@@ -137,2 +138,18 @@ }

/**
* Record a page view event
* Add the local context to the given property.
* Log it in the console when in development mode, send it to RudderStack otherwise.
* @param options
*/
public page(properties: object = {}): void {
const propertiesWithContext = { ...properties, ...this.context };
if (this.isDevelopment) {
console.log('PAGE', propertiesWithContext); // eslint-disable-line no-console
} else {
this.sdk?.page(propertiesWithContext);
}
}
// Resets the id, including anonymousId, and clears traits for the currently identified user

@@ -139,0 +156,0 @@ public reset(): void {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc