@webtrekk-smart-pixel/angular 1.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/bundles/webtrekk-smart-pixel-angular.umd.js +507 -0
  2. package/bundles/webtrekk-smart-pixel-angular.umd.js.map +1 -0
  3. package/esm2015/lib/Directives/ContentEngagementDirective.js +32 -0
  4. package/esm2015/lib/Directives/DataDirective.js +84 -0
  5. package/esm2015/lib/Directives/DataTypes.js +2 -0
  6. package/esm2015/lib/Directives/ExtensionDirective.js +27 -0
  7. package/esm2015/lib/Directives/ProductListDirective.js +31 -0
  8. package/esm2015/lib/Directives/TeaserDirective.js +32 -0
  9. package/esm2015/lib/WebtrekkSmartPixelAngular.js +131 -0
  10. package/esm2015/lib/WebtrekkSmartPixelAutoTracking.js +48 -0
  11. package/esm2015/lib/WebtrekkSmartPixelConfig.js +12 -0
  12. package/esm2015/lib/WebtrekkSmartPixelModule.js +70 -0
  13. package/esm2015/lib/WebtrekkSmartPixelToken.js +3 -0
  14. package/esm2015/public-api.js +22 -0
  15. package/esm2015/webtrekk-smart-pixel-angular.js +5 -0
  16. package/fesm2015/webtrekk-smart-pixel-angular.js +451 -0
  17. package/fesm2015/webtrekk-smart-pixel-angular.js.map +1 -0
  18. package/lib/Directives/ContentEngagementDirective.d.ts +13 -0
  19. package/lib/Directives/DataDirective.d.ts +20 -0
  20. package/lib/Directives/DataTypes.d.ts +174 -0
  21. package/lib/Directives/ExtensionDirective.d.ts +12 -0
  22. package/lib/Directives/ProductListDirective.d.ts +13 -0
  23. package/lib/Directives/TeaserDirective.d.ts +13 -0
  24. package/lib/WebtrekkSmartPixelAngular.d.ts +22 -0
  25. package/lib/WebtrekkSmartPixelAutoTracking.d.ts +13 -0
  26. package/lib/WebtrekkSmartPixelConfig.d.ts +22 -0
  27. package/lib/WebtrekkSmartPixelModule.d.ts +15 -0
  28. package/lib/WebtrekkSmartPixelToken.d.ts +3 -0
  29. package/package.json +18 -6
  30. package/public-api.d.ts +17 -0
  31. package/webtrekk-smart-pixel-angular.d.ts +5 -0
  32. package/CHANGELOG.md +0 -38
  33. package/dist/smart-pixel-angular.umd.js +0 -466
  34. package/index.js +0 -4
@@ -1,466 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@webtrekk-smart-pixel/core'), require('@angular/router'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@webtrekk-smart-pixel/core', '@angular/router', 'rxjs/operators'], factory) :
4
- (global = global || self, factory(global['@webtrekk-smart-pixel/angular'] = {}, global.ng.core, global.wtSmart, global.ng.router, global.Rx.operators));
5
- }(this, (function (exports, core, wtSmart, router, operators) { 'use strict';
6
-
7
- wtSmart = wtSmart && Object.prototype.hasOwnProperty.call(wtSmart, 'default') ? wtSmart['default'] : wtSmart;
8
-
9
- /*! *****************************************************************************
10
- Copyright (c) Microsoft Corporation.
11
-
12
- Permission to use, copy, modify, and/or distribute this software for any
13
- purpose with or without fee is hereby granted.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
16
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
18
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
- PERFORMANCE OF THIS SOFTWARE.
22
- ***************************************************************************** */
23
-
24
- var __assign = function() {
25
- __assign = Object.assign || function __assign(t) {
26
- for (var s, i = 1, n = arguments.length; i < n; i++) {
27
- s = arguments[i];
28
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
29
- }
30
- return t;
31
- };
32
- return __assign.apply(this, arguments);
33
- };
34
-
35
- function __decorate(decorators, target, key, desc) {
36
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
37
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
39
- return c > 3 && r && Object.defineProperty(target, key, r), r;
40
- }
41
-
42
- function __param(paramIndex, decorator) {
43
- return function (target, key) { decorator(target, key, paramIndex); }
44
- }
45
-
46
- var directiveSelector = '[wt-advanced-data],'
47
- + '[wt-campaign-data],'
48
- + '[wt-customer-data],'
49
- + '[wt-init-data],'
50
- + '[wt-order-data],'
51
- + '[wt-page-data],'
52
- + '[wt-product-data],'
53
- + '[wt-session-data]';
54
- var DataDirective = /** @class */ (function () {
55
- function DataDirective(pixel) {
56
- this.pixel = pixel;
57
- }
58
- DataDirective.prototype.ngAfterContentInit = function () {
59
- var _this = this;
60
- if (this.wtAdvancedData) {
61
- this.pixel.advanced(this.wtAdvancedData);
62
- }
63
- if (this.wtCampaignData) {
64
- this.pixel.campaign(this.wtCampaignData);
65
- }
66
- if (this.wtCustomerData) {
67
- this.pixel.customer(this.wtCustomerData.id, this.wtCustomerData, this.wtCustomerData.validation);
68
- }
69
- if (this.wtInitData) {
70
- this.pixel.init(this.wtInitData);
71
- }
72
- if (this.wtOrderData) {
73
- this.pixel.order(this.wtOrderData);
74
- }
75
- if (this.wtPageData) {
76
- this.pixel.page(this.wtPageData.name, this.wtPageData);
77
- }
78
- if (this.wtProductData) {
79
- this.pixel.product(this.wtProductData.action, this.wtProductData);
80
- }
81
- if (this.wtSessionData) {
82
- this.pixel.session(this.wtSessionData);
83
- }
84
- if (typeof this.wtTrack !== 'undefined') {
85
- setTimeout(function () {
86
- _this.pixel.track();
87
- }, 0);
88
- }
89
- };
90
- __decorate([
91
- core.Input('wt-advanced-data')
92
- ], DataDirective.prototype, "wtAdvancedData", void 0);
93
- __decorate([
94
- core.Input('wt-campaign-data')
95
- ], DataDirective.prototype, "wtCampaignData", void 0);
96
- __decorate([
97
- core.Input('wt-customer-data')
98
- ], DataDirective.prototype, "wtCustomerData", void 0);
99
- __decorate([
100
- core.Input('wt-init-data')
101
- ], DataDirective.prototype, "wtInitData", void 0);
102
- __decorate([
103
- core.Input('wt-order-data')
104
- ], DataDirective.prototype, "wtOrderData", void 0);
105
- __decorate([
106
- core.Input('wt-page-data')
107
- ], DataDirective.prototype, "wtPageData", void 0);
108
- __decorate([
109
- core.Input('wt-product-data')
110
- ], DataDirective.prototype, "wtProductData", void 0);
111
- __decorate([
112
- core.Input('wt-session-data')
113
- ], DataDirective.prototype, "wtSessionData", void 0);
114
- __decorate([
115
- core.Input('wt-track')
116
- ], DataDirective.prototype, "wtTrack", void 0);
117
- DataDirective = __decorate([
118
- core.Directive({
119
- selector: directiveSelector
120
- })
121
- ], DataDirective);
122
- return DataDirective;
123
- }());
124
-
125
- var TeaserDirective = /** @class */ (function () {
126
- function TeaserDirective(elementRef, pixel) {
127
- this.elementRef = elementRef;
128
- this.pixel = pixel;
129
- }
130
- TeaserDirective.prototype.ngAfterContentInit = function () {
131
- var _this = this;
132
- this.pixel.call(function (pix) {
133
- pix.extension.teaser_tracking.add({
134
- selector: ((_this.wtTeaserElement.selector) ? _this.wtTeaserElement.selector : _this.elementRef.nativeElement),
135
- data: _this.wtTeaserElement,
136
- conversion: _this.wtTeaserElement
137
- });
138
- });
139
- };
140
- __decorate([
141
- core.Input('wt-teaser')
142
- ], TeaserDirective.prototype, "wtTeaserElement", void 0);
143
- TeaserDirective = __decorate([
144
- core.Directive({
145
- selector: '[wt-teaser]',
146
- exportAs: 'wt-teaser'
147
- })
148
- ], TeaserDirective);
149
- return TeaserDirective;
150
- }());
151
-
152
- var ProductListDirective = /** @class */ (function () {
153
- function ProductListDirective(elementRef, pixel) {
154
- this.elementRef = elementRef;
155
- this.pixel = pixel;
156
- }
157
- ProductListDirective.prototype.ngAfterContentInit = function () {
158
- var _this = this;
159
- this.pixel.call(function (pix) {
160
- pix.extension.product_list_tracking.add({
161
- selector: ((_this.wtProductListElement.selector) ? _this.wtProductListElement.selector : _this.elementRef.nativeElement),
162
- data: _this.wtProductListElement
163
- });
164
- });
165
- };
166
- __decorate([
167
- core.Input('wt-product-list')
168
- ], ProductListDirective.prototype, "wtProductListElement", void 0);
169
- ProductListDirective = __decorate([
170
- core.Directive({
171
- selector: '[wt-product-list]',
172
- exportAs: 'wt-product-list'
173
- })
174
- ], ProductListDirective);
175
- return ProductListDirective;
176
- }());
177
-
178
- var ContentEngagementDirective = /** @class */ (function () {
179
- function ContentEngagementDirective(elementRef, pixel) {
180
- this.elementRef = elementRef;
181
- this.pixel = pixel;
182
- }
183
- ContentEngagementDirective.prototype.ngAfterContentInit = function () {
184
- var _this = this;
185
- this.pixel.call(function (pix) {
186
- pix.extension.content_engagement.add({
187
- selector: ((_this.wtContentEngagementElement.selector) ? _this.wtContentEngagementElement.selector : _this.elementRef.nativeElement),
188
- name: _this.wtContentEngagementElement.name,
189
- config: _this.wtContentEngagementElement
190
- });
191
- });
192
- };
193
- __decorate([
194
- core.Input('wt-content-engagement')
195
- ], ContentEngagementDirective.prototype, "wtContentEngagementElement", void 0);
196
- ContentEngagementDirective = __decorate([
197
- core.Directive({
198
- selector: '[wt-content-engagement]',
199
- exportAs: 'wt-content-engagement'
200
- })
201
- ], ContentEngagementDirective);
202
- return ContentEngagementDirective;
203
- }());
204
-
205
- var ExtensionDirective = /** @class */ (function () {
206
- function ExtensionDirective(pixel) {
207
- this.pixel = pixel;
208
- }
209
- ExtensionDirective.prototype.ngAfterContentInit = function () {
210
- this.pixel.extension(this.wtExtensionData.name, this.wtExtensionData.action, this.wtExtensionData.config);
211
- };
212
- __decorate([
213
- core.Input('wt-extension')
214
- ], ExtensionDirective.prototype, "wtExtensionData", void 0);
215
- ExtensionDirective = __decorate([
216
- core.Directive({
217
- selector: '[wt-extension]',
218
- exportAs: 'wt-extension'
219
- })
220
- ], ExtensionDirective);
221
- return ExtensionDirective;
222
- }());
223
-
224
- var pixel_ = null;
225
- var getWindow_ = function () {
226
- return ((typeof window !== 'undefined') ? window : null);
227
- };
228
- var getDocument_ = function () {
229
- return ((typeof window !== 'undefined' && typeof window.document !== 'undefined') ? window.document : null);
230
- };
231
- var init_ = function () {
232
- var window_ = getWindow_();
233
- var document_ = getDocument_();
234
- if (window_ !== null && document_ !== null) {
235
- pixel_ = wtSmart.use(window_, document_);
236
- window_['wtSmart'] = pixel_;
237
- }
238
- };
239
- var WebtrekkSmartPixelAngular = /** @class */ (function () {
240
- function WebtrekkSmartPixelAngular() {
241
- }
242
- WebtrekkSmartPixelAngular.prototype.call = function (call) {
243
- if (pixel_ === null) {
244
- init_();
245
- }
246
- if (pixel_ !== null) {
247
- pixel_.push(call);
248
- }
249
- };
250
- WebtrekkSmartPixelAngular.prototype.init = function (data) {
251
- this.call(function (pix) {
252
- pix.init.add(data);
253
- });
254
- };
255
- WebtrekkSmartPixelAngular.prototype.advanced = function (data) {
256
- this.call(function (pix) {
257
- pix.advanced.add(data);
258
- });
259
- };
260
- WebtrekkSmartPixelAngular.prototype.page = function (name, data) {
261
- this.call(function (pix) {
262
- if (typeof name === 'string') {
263
- pix.page.data.add(name, data);
264
- }
265
- else {
266
- pix.page.data.add(name);
267
- }
268
- });
269
- };
270
- WebtrekkSmartPixelAngular.prototype.action = function (name, data) {
271
- this.call(function (pix) {
272
- if (typeof name === 'string') {
273
- pix.action.data.add(name, data);
274
- }
275
- else {
276
- pix.action.data.add(name);
277
- }
278
- });
279
- };
280
- WebtrekkSmartPixelAngular.prototype.session = function (data) {
281
- this.call(function (pix) {
282
- pix.session.data.add(data);
283
- });
284
- };
285
- WebtrekkSmartPixelAngular.prototype.campaign = function (data) {
286
- this.call(function (pix) {
287
- pix.campaign.data.add(data);
288
- });
289
- };
290
- WebtrekkSmartPixelAngular.prototype.customer = function (id, data, validation) {
291
- this.call(function (pix) {
292
- if (typeof id === 'string') {
293
- pix.customer.data.add(id, data, validation);
294
- }
295
- else {
296
- pix.customer.data.add(id);
297
- }
298
- });
299
- };
300
- WebtrekkSmartPixelAngular.prototype.product = function (action, data) {
301
- this.call(function (pix) {
302
- var method = (action === 'view' || action === 'basket') ? 'set' : 'add';
303
- pix.product[action].data[method]([data]);
304
- });
305
- };
306
- WebtrekkSmartPixelAngular.prototype.products = function (action, data) {
307
- this.call(function (pix) {
308
- var method = (action === 'view' || action === 'basket') ? 'set' : 'add';
309
- pix.product[action].data[method](data);
310
- });
311
- };
312
- WebtrekkSmartPixelAngular.prototype.order = function (data) {
313
- this.call(function (pix) {
314
- pix.order.data.add(data);
315
- });
316
- };
317
- WebtrekkSmartPixelAngular.prototype.extension = function (extension, action, config) {
318
- if (!extension) {
319
- return;
320
- }
321
- if (!action) {
322
- action = 'activate';
323
- }
324
- this.call(function (pix) {
325
- pix.extension[extension][action](config);
326
- });
327
- };
328
- WebtrekkSmartPixelAngular.prototype.track = function (keepData) {
329
- this.call(function (pix) {
330
- pix.track(keepData);
331
- });
332
- };
333
- WebtrekkSmartPixelAngular.prototype.trackPage = function (keepData) {
334
- this.call(function (pix) {
335
- pix.trackPage(keepData);
336
- });
337
- };
338
- WebtrekkSmartPixelAngular.prototype.trackAction = function (keepData) {
339
- this.call(function (pix) {
340
- pix.trackAction(keepData);
341
- });
342
- };
343
- WebtrekkSmartPixelAngular = __decorate([
344
- core.Injectable()
345
- ], WebtrekkSmartPixelAngular);
346
- return WebtrekkSmartPixelAngular;
347
- }());
348
-
349
- var WEBTREKK_SMART_PIXEL_TOKEN = new core.InjectionToken('WEBTREKK-SMART-PIXEL-ANGULAR');
350
-
351
- var WebtrekkSmartPixelAutoTracking = /** @class */ (function () {
352
- function WebtrekkSmartPixelAutoTracking(router$1, pixel, config) {
353
- var _this = this;
354
- this.router = router$1;
355
- this.pixel = pixel;
356
- this.config = config;
357
- this.pixel.init(this.config);
358
- if (this.config.activateActions) {
359
- this.pixel.extension('action', 'activate');
360
- }
361
- if (this.config.activateTeaser) {
362
- this.pixel.extension('teaser_tracking', 'activate');
363
- }
364
- if (this.config.activateProductList) {
365
- this.pixel.extension('product_list_tracking', 'activate');
366
- }
367
- if (this.config.activateContentEngagement) {
368
- this.pixel.extension('content_engagement', 'activate');
369
- }
370
- if (this.config.activateAutoTracking || this.config.activateActions) {
371
- this.router.events.pipe(operators.filter(function (e) { return e instanceof router.NavigationEnd; }), operators.delay(0)).subscribe(function () {
372
- if (_this.config.activateAutoTracking) {
373
- _this.pixel.trackPage();
374
- }
375
- if (_this.config.activateActions) {
376
- _this.pixel.extension('action', 'reload');
377
- }
378
- });
379
- }
380
- }
381
- WebtrekkSmartPixelAutoTracking = __decorate([
382
- core.NgModule(),
383
- __param(2, core.Inject(WEBTREKK_SMART_PIXEL_TOKEN))
384
- ], WebtrekkSmartPixelAutoTracking);
385
- return WebtrekkSmartPixelAutoTracking;
386
- }());
387
-
388
- var DefaultConfig = /** @class */ (function () {
389
- function DefaultConfig() {
390
- this.trackId = '';
391
- this.trackDomain = '';
392
- this.activateAutoTracking = true;
393
- this.activateActions = false;
394
- this.activateTeaser = false;
395
- this.activateProductList = false;
396
- this.activateContentEngagement = false;
397
- }
398
- return DefaultConfig;
399
- }());
400
-
401
- var defaultConfig = new DefaultConfig();
402
- var WebtrekkSmartPixelModule = /** @class */ (function () {
403
- function WebtrekkSmartPixelModule() {
404
- }
405
- WebtrekkSmartPixelModule_1 = WebtrekkSmartPixelModule;
406
- WebtrekkSmartPixelModule.forRoot = function (conf) {
407
- if (conf === void 0) { conf = {}; }
408
- return {
409
- ngModule: WebtrekkSmartPixelModule_1,
410
- providers: [
411
- {
412
- provide: WEBTREKK_SMART_PIXEL_TOKEN,
413
- useValue: __assign({}, defaultConfig, conf)
414
- },
415
- {
416
- provide: WebtrekkSmartPixelAngular,
417
- useValue: webtrekkSmartPixelAngular
418
- }
419
- ]
420
- };
421
- };
422
- var WebtrekkSmartPixelModule_1;
423
- WebtrekkSmartPixelModule = WebtrekkSmartPixelModule_1 = __decorate([
424
- core.NgModule({
425
- declarations: [
426
- DataDirective,
427
- ExtensionDirective,
428
- TeaserDirective,
429
- ProductListDirective,
430
- ContentEngagementDirective
431
- ],
432
- exports: [
433
- DataDirective,
434
- ExtensionDirective,
435
- TeaserDirective,
436
- ProductListDirective,
437
- ContentEngagementDirective,
438
- WebtrekkSmartPixelAutoTracking
439
- ],
440
- imports: [
441
- WebtrekkSmartPixelAutoTracking
442
- ],
443
- providers: [],
444
- bootstrap: []
445
- })
446
- ], WebtrekkSmartPixelModule);
447
- return WebtrekkSmartPixelModule;
448
- }());
449
-
450
- // compatibility for v0
451
- var webtrekkSmartPixelAngular = new WebtrekkSmartPixelAngular();
452
- var index = {
453
- WebtrekkSmartPixelModule: WebtrekkSmartPixelModule,
454
- WebtrekkSmartPixelAngular: WebtrekkSmartPixelAngular,
455
- // compatibility for v0
456
- webtrekkSmartPixelAngular: webtrekkSmartPixelAngular
457
- };
458
-
459
- exports.WebtrekkSmartPixelAngular = WebtrekkSmartPixelAngular;
460
- exports.WebtrekkSmartPixelModule = WebtrekkSmartPixelModule;
461
- exports.default = index;
462
- exports.webtrekkSmartPixelAngular = webtrekkSmartPixelAngular;
463
-
464
- Object.defineProperty(exports, '__esModule', { value: true });
465
-
466
- })));
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * @type {exports|module.exports}
3
- */
4
- module.exports = require('./dist/smart-pixel-angular.umd');