Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(smartlook): update to 1.6.0 #3562

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 55 additions & 6 deletions src/@ionic-native/plugins/smartlook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export class SmartlookSetupConfigBuilder {
return this;
}

renderingMode(renderingMode: string): SmartlookSetupConfigBuilder {
this._smartlookSetupConfig.renderingMode = renderingMode;
renderingMode(renderingMode: SmartlookRenderingMode): SmartlookSetupConfigBuilder {
this._smartlookSetupConfig.renderingMode = renderingMode.getRenderingModeString();
return this;
}

Expand All @@ -28,6 +28,11 @@ export class SmartlookSetupConfigBuilder {
return this;
}

eventTrackingModes(eventTrackingModes: SmartlookEventTrackingModes): SmartlookSetupConfigBuilder {
this._smartlookSetupConfig.eventTrackingModes = eventTrackingModes.getEventTrackingModeStringArray();
return this;
}

build(): SmartlookSetupConfig {
return this._smartlookSetupConfig;
}
Expand All @@ -39,6 +44,7 @@ export class SmartlookSetupConfig {
renderingMode: string;
startNewSession: boolean;
startNewSessionAndUser: boolean;
eventTrackingModes: string[];

constructor(smartlookAPIKey: string) {
this.smartlookAPIKey = smartlookAPIKey;
Expand Down Expand Up @@ -74,15 +80,41 @@ export class SmartlookEventTrackingMode {
return new SmartlookEventTrackingMode('ignore_user_interaction');
}

static IGNORE_NAVIGATION_INTERACTION(): SmartlookEventTrackingMode {
return new SmartlookEventTrackingMode('ignore_navigation_interaction');
}

static IGNORE_RAGE_CLICKS(): SmartlookEventTrackingMode {
return new SmartlookEventTrackingMode('ignore_rage_clicks');
}

static NO_TRACKING(): SmartlookEventTrackingMode {
return new SmartlookEventTrackingMode('no_tracking');
}

getEventTrackingModeString(): string {
return this.eventTrackingMode;
}

constructor(eventTrackingMode: string) {
this.eventTrackingMode = eventTrackingMode;
}
}

export class SmartlookEventTrackingModes {
private eventTrackingModes: string[];

constructor(eventTrackingModes: SmartlookEventTrackingMode[]) {
this.eventTrackingModes = eventTrackingModes.map(eventTrackingMode =>
eventTrackingMode.getEventTrackingModeString()
);
}

getEventTrackingModeStringArray(): string[] {
return this.eventTrackingModes;
}
}

export class SmartlookViewState {
static START = 'start';
static STOP = 'stop';
Expand Down Expand Up @@ -204,6 +236,10 @@ export class SmartlookRenderingMode {
return new SmartlookRenderingMode('native');
}

getRenderingModeString(): string {
return this.renderingMode;
}

constructor(renderingMode: string) {
this.renderingMode = renderingMode;
}
Expand Down Expand Up @@ -248,6 +284,8 @@ export class SmartlookRenderingMode {
* SmartlookReferrer
* SmartlookDashboardSessionUrl
* SmartlookRenderingMode
* SmartlookEventTrackingMode
* SmartlookEventTrackingModes
*/
@Plugin({
pluginName: 'Smartlook',
Expand Down Expand Up @@ -361,16 +399,27 @@ export class Smartlook extends IonicNativePlugin {
/**
* You can configure which events are being tracked by setting eventTrackingMode.
* @param eventTrackingMode Can be on of:
* - SmartlookEventTrackingMode.FULL_TRACKING() tracks everything.
* - SmartlookEventTrackingMode.IGNORE_USER_INTERACTION() will not track touches,
* focus, keyboard, selector events.
* - SmartlookEventTrackingMode.NO_TRACKING() not gonna track any events .
* - EventTrackingMode.FULL_TRACKING ... track everything
* - EventTrackingMode.IGNORE_USER_INTERACTION ... will not track touches
* focus, keyboard, selector events
* - EventTrackingMode.IGNORE_NAVIGATION_INTERACTION ... will not track screen names
* - EventTrackingMode.IGNORE_RAGE_CLICKS ... will not track rage clicks
* - EventTrackingMode.NO_TRACKING ... not gonna track any events
*/
@Cordova({ sync: true })
setEventTrackingMode(eventTrackingMode: SmartlookEventTrackingMode): void {
return;
}

/**
* You can configure which events are being tracked by setting eventTrackingMode.
* @param eventTrackingModes Array of EventTrackingModes.
*/
@Cordova({ sync: true })
setEventTrackingModes(eventTrackingModes: SmartlookEventTrackingModes): void {
return;
}

/**
* Track custom navigation event.
* @param navigationEvent SmartlookNavigationEvent object.
Expand Down