@spartacus/tracking
Version:
Spartacus tracking and personalization library
63 lines (57 loc) • 2.94 kB
JavaScript
import * as i0 from '@angular/core';
import { Injectable, NgModule } from '@angular/core';
import * as i1 from '@spartacus/core';
import { provideDefaultConfig } from '@spartacus/core';
/**
* Default Adobe Experience Platform Launch collector.
*/
class AepCollectorService {
constructor(scriptLoader) {
this.scriptLoader = scriptLoader;
}
/**
* If the `TmsCollectorConfig.dataLayerProperty` is not specified, it uses the default `digitalData`
*/
init(config, windowObject) {
var _a, _b;
const dataLayerProperty = (_a = config.dataLayerProperty) !== null && _a !== void 0 ? _a : 'digitalData';
windowObject[dataLayerProperty] = (_b = windowObject[dataLayerProperty]) !== null && _b !== void 0 ? _b : {};
if (config.scriptUrl) {
this.scriptLoader.embedScript({ src: config.scriptUrl });
}
}
pushEvent(config, windowObject, event) {
var _a;
const dataLayerProperty = (_a = config.dataLayerProperty) !== null && _a !== void 0 ? _a : 'digitalData';
windowObject[dataLayerProperty] = Object.assign(Object.assign({}, windowObject[dataLayerProperty]), event);
}
}
AepCollectorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: AepCollectorService, deps: [{ token: i1.ScriptLoader }], target: i0.ɵɵFactoryTarget.Injectable });
AepCollectorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: AepCollectorService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: AepCollectorService, decorators: [{
type: Injectable,
args: [{ providedIn: 'root' }]
}], ctorParameters: function () { return [{ type: i1.ScriptLoader }]; } });
const defaultAdobeExperiencePlatformConfig = {
tagManager: {
aep: {
collector: AepCollectorService,
},
},
};
class AepModule {
}
AepModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: AepModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
AepModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: AepModule });
AepModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: AepModule, providers: [provideDefaultConfig(defaultAdobeExperiencePlatformConfig)] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: AepModule, decorators: [{
type: NgModule,
args: [{
providers: [provideDefaultConfig(defaultAdobeExperiencePlatformConfig)],
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { AepCollectorService, AepModule };
//# sourceMappingURL=spartacus-tracking-tms-aep.js.map