refactor(tealium): resolv lint issues

This commit is contained in:
Daniel Sogl 2021-12-25 20:47:29 +00:00 committed by GitHub
parent 104e66db28
commit 7d52794933

View File

@ -1,141 +1,148 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core';
import {
Plugin,
Cordova,
CordovaProperty,
CordovaInstance,
InstanceProperty,
AwesomeCordovaNativePlugin,
} from '@awesome-cordova-plugins/core';
import { Observable } from 'rxjs';
export enum Collectors {
AppData = 'AppData',
Connectivity = 'Connectivity',
DeviceData = 'DeviceData',
Lifecycle = 'Lifecycle',
AppData = 'AppData',
Connectivity = 'Connectivity',
DeviceData = 'DeviceData',
Lifecycle = 'Lifecycle',
}
export enum Dispatchers {
Collect = 'Collect',
TagManagement = 'TagManagement',
RemoteCommands = 'RemoteCommands',
Collect = 'Collect',
TagManagement = 'TagManagement',
RemoteCommands = 'RemoteCommands',
}
export enum Expiry {
forever = 'forever',
untilRestart = 'untilRestart',
session = 'session',
forever = 'forever',
untilRestart = 'untilRestart',
session = 'session',
}
export enum ConsentPolicy {
ccpa = 'ccpa',
gdpr = 'gdpr',
ccpa = 'ccpa',
gdpr = 'gdpr',
}
export interface TealiumDispatch {
dataLayer: Map<string, any>;
type: string;
toJson(): string;
dataLayer: Map<string, any>;
type: string;
toJson(): string;
}
export class TealiumView implements TealiumDispatch {
public type: string = 'view';
constructor(public viewName: string, public dataLayer: Map<string, any>) {}
toJson() {
let dictionary: any = {};
dictionary['type'] = this.type;
dictionary['dataLayer'] = {};
public type = 'view';
constructor(public viewName: string, public dataLayer: Map<string, any>) {}
toJson() {
const dictionary: any = {};
dictionary['type'] = this.type;
dictionary['dataLayer'] = {};
this.dataLayer.forEach((k, v) => {
dictionary['dataLayer'][k] = v;
});
dictionary['type'] = this.type;
dictionary['viewName'] = this.viewName;
return JSON.stringify(dictionary);
}
dictionary['type'] = this.type;
dictionary['viewName'] = this.viewName;
return JSON.stringify(dictionary);
}
}
export class TealiumEvent implements TealiumDispatch {
public type: string = 'event';
constructor(public eventName: string, public dataLayer: Map<string, any>) {}
toJson() {
let dictionary: any = {};
dictionary['type'] = this.type;
dictionary['dataLayer'] = {};
public type = 'event';
constructor(public eventName: string, public dataLayer: Map<string, any>) {}
toJson() {
const dictionary: any = {};
dictionary['type'] = this.type;
dictionary['dataLayer'] = {};
this.dataLayer.forEach((k, v) => {
dictionary['dataLayer'][k] = v;
});
dictionary['type'] = this.type;
dictionary['eventName'] = this.eventName;
return JSON.stringify(dictionary);
}
dictionary['type'] = this.type;
dictionary['eventName'] = this.eventName;
return JSON.stringify(dictionary);
}
}
export class ConsentExpiry {
constructor(public time: number, public unit: TimeUnit) {}
constructor(public time: number, public unit: TimeUnit) {}
}
export enum TimeUnit {
minutes = 'minutes',
hours = 'hours',
days = 'days',
months = 'months',
minutes = 'minutes',
hours = 'hours',
days = 'days',
months = 'months',
}
export enum ConsentStatus {
consented = 'consented',
notConsented = 'notConsented',
unknown = 'unknown',
consented = 'consented',
notConsented = 'notConsented',
unknown = 'unknown',
}
export enum LogLevel {
dev = 'dev',
qa = 'qa',
prod = 'prod',
silent = 'silent',
dev = 'dev',
qa = 'qa',
prod = 'prod',
silent = 'silent',
}
export enum TealiumEnvironment {
dev = 'dev',
qa = 'qa',
prod = 'prod',
dev = 'dev',
qa = 'qa',
prod = 'prod',
}
export enum ConsentCategories {
analytics = 'analytics',
affiliates = 'affiliates',
displayAds = 'display_ads',
email = 'email',
personalization = 'personalization',
search = 'search',
social = 'social',
bigData = 'big_data',
mobile = 'mobile',
engagement = 'engagement',
monitoring = 'monitoring',
crm = 'crm',
cdp = 'cdp',
cookieMatch = 'cookiematch',
misc = 'misc',
analytics = 'analytics',
affiliates = 'affiliates',
displayAds = 'display_ads',
email = 'email',
personalization = 'personalization',
search = 'search',
social = 'social',
bigData = 'big_data',
mobile = 'mobile',
engagement = 'engagement',
monitoring = 'monitoring',
crm = 'crm',
cdp = 'cdp',
cookieMatch = 'cookiematch',
misc = 'misc',
}
export interface TealiumConfig {
account: string;
profile: string;
environment: TealiumEnvironment;
dataSource?: string;
collectors: Collectors[];
dispatchers: Dispatchers[];
customVisitorId?: string;
memoryReportingEnabled?: boolean;
overrideCollectURL?: string;
overrideCollectBatchURL?: string;
overrideCollectDomain?: string;
overrideLibrarySettingsURL?: string;
overrideTagManagementURL?: string;
deepLinkTrackingEnabled?: boolean;
qrTraceEnabled?: boolean;
loglevel?: LogLevel;
consentLoggingEnabled?: boolean;
consentPolicy?: ConsentPolicy;
consentExpiry?: ConsentExpiry;
lifecycleAutotrackingEnabled?: boolean;
useRemoteLibrarySettings?: boolean;
visitorServiceEnabled?: boolean;
visitorServiceRefreshInterval?: string;
account: string;
profile: string;
environment: TealiumEnvironment;
dataSource?: string;
collectors: Collectors[];
dispatchers: Dispatchers[];
customVisitorId?: string;
memoryReportingEnabled?: boolean;
overrideCollectURL?: string;
overrideCollectBatchURL?: string;
overrideCollectDomain?: string;
overrideLibrarySettingsURL?: string;
overrideTagManagementURL?: string;
deepLinkTrackingEnabled?: boolean;
qrTraceEnabled?: boolean;
loglevel?: LogLevel;
consentLoggingEnabled?: boolean;
consentPolicy?: ConsentPolicy;
consentExpiry?: ConsentExpiry;
lifecycleAutotrackingEnabled?: boolean;
useRemoteLibrarySettings?: boolean;
visitorServiceEnabled?: boolean;
visitorServiceRefreshInterval?: string;
}
/**
@ -178,11 +185,10 @@ export interface TealiumConfig {
repo: 'https://github.com/Tealium/cordova-plugin', // the github repository URL for the plugin
install: '', // OPTIONAL install command, in case the plugin requires variables
installVariables: [], // OPTIONAL the plugin requires variables
platforms: ['Android', 'iOS'] // Array of platforms supported
platforms: ['Android', 'iOS'], // Array of platforms supported
})
@Injectable()
export class Tealium extends AwesomeCordovaNativePlugin {
/**
* This function initializes the Tealium Cordova Plugin
* @param config {TealiumConfig}