@webtrekk-smart-pixel/angular 1.0.0 → 1.1.1

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.
package/CHANGELOG.md CHANGED
@@ -1,21 +1,45 @@
1
- <a name="1.0.0"></a>
2
- ## 1.0.0 (2019-11-20)
3
-
4
- ### Features
5
-
6
- * Support new tracking module ([see](https://docs.webtrekk.com/display/WSPD/Angular#Angular-WebtrekkSmartPixelModule))
7
- * Support tracking directives ([see](https://docs.webtrekk.com/display/WSPD/Angular#Angular-Directives))
8
- * Support new tracking functionalities ([see](https://docs.webtrekk.com/display/WSPD/Angular#Angular-WebtrekkSmartPixelAngular))
9
-
10
- <a name="0.1.1"></a>
11
- ## 0.1.1 (2019-06-12)
12
-
13
- ### Documentation
14
-
15
- * Extension for Content Engagement ([Content Engagement](https://docs.webtrekk.com/display/WSPD/Content+Engagement))
16
- * Extension for Cookie Control ([Cookie Control](https://docs.webtrekk.com/display/WSPD/Cookie+Control))
17
-
18
- <a name="0.1.0"></a>
19
- ## 0.1.0 (2019-05-17)
20
-
21
- * Beta release
1
+ <a name="1.1.1"></a>
2
+ ## 1.1.1 (2021-12-20)
3
+
4
+ ### Features
5
+
6
+ * Add a property to configure request limitation ([wt-advanced-data](https://documentation.mapp.com/latest/en/angular-15741405.html#id-.SMPAngularv1.0-wt-advanced-data) and [advanced](https://documentation.mapp.com/latest/en/angular-15741405.html#id-.SMPAngularv1.0-advanced))
7
+
8
+ <a name="1.1.0"></a>
9
+ ## 1.1.0 (2021-10-14)
10
+
11
+ ### Features
12
+
13
+ * Optimize directives property types
14
+
15
+ <a name="1.0.2"></a>
16
+ ## 1.0.2(2021-03-18)
17
+
18
+ * Update peer dependencies (support v4 - v12)
19
+
20
+ <a name="1.0.1"></a>
21
+ ## 1.0.1 (2019-11-22)
22
+
23
+ * Change README and package
24
+
25
+ <a name="1.0.0"></a>
26
+ ## 1.0.0 (2019-11-20)
27
+
28
+ ### Features
29
+
30
+ * Support new tracking module ([see](https://documentation.mapp.com/latest/en/angular-15741405.html#id-.SMPAngularv1.0-WebtrekkSmartPixelModule))
31
+ * Support tracking directives ([see](https://documentation.mapp.com/latest/en/angular-15741405.html#id-.SMPAngularv1.0-Directives))
32
+ * Support new tracking functionalities ([see](https://documentation.mapp.com/latest/en/angular-15741405.html#id-.SMPAngularv1.0-WebtrekkSmartPixelAngular))
33
+
34
+ <a name="0.1.1"></a>
35
+ ## 0.1.1 (2019-06-12)
36
+
37
+ ### Documentation
38
+
39
+ * Extension for Content Engagement ([Content Engagement](https://documentation.mapp.com/latest/en/content-engagement-15741314.html))
40
+ * Extension for Cookie Control ([Cookie Control](https://documentation.mapp.com/latest/en/cookie-control-15741322.html))
41
+
42
+ <a name="0.1.0"></a>
43
+ ## 0.1.0 (2019-05-17)
44
+
45
+ * Beta release
package/README.md CHANGED
@@ -1,8 +1,22 @@
1
1
  # Webtrekk Smart Pixel - Angular
2
2
 
3
3
  [Site](https://www.webtrekk.com/) |
4
- [Docs](https://docs.webtrekk.com/display/WSPD/Angular) |
5
- [Support](https://support.webtrekk.com/) |
4
+ [Docs](https://documentation.mapp.com/latest/en/angular-15741405.html) |
5
+ [Support](https://github.com/Webtrekk/Webtrekk-Smart-Pixel/issues) |
6
6
  [Changelog](./CHANGELOG.md)
7
7
 
8
8
  A Angular implementation of the Webtrekk Smart Pixel.
9
+
10
+ ## Installation
11
+
12
+ Using npm:
13
+
14
+ ```sh
15
+ $ npm install --save @webtrekk-smart-pixel/angular
16
+ ```
17
+
18
+ ## Integration
19
+
20
+ ```js
21
+ import * as wtSmart from '@webtrekk-smart-pixel/angular';
22
+ ```
@@ -2,21 +2,23 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@webtrekk-smart-pixel/core'), require('@angular/router'), require('rxjs/operators')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@webtrekk-smart-pixel/core', '@angular/router', 'rxjs/operators'], factory) :
4
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';
5
+ }(this, (function (exports, core, wtSmart, router, operators) { 'use strict';
6
+
7
+ wtSmart = wtSmart && Object.prototype.hasOwnProperty.call(wtSmart, 'default') ? wtSmart['default'] : wtSmart;
6
8
 
7
9
  /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation. All rights reserved.
9
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10
- this file except in compliance with the License. You may obtain a copy of the
11
- License at http://www.apache.org/licenses/LICENSE-2.0
10
+ Copyright (c) Microsoft Corporation.
12
11
 
13
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
- MERCHANTABLITY OR NON-INFRINGEMENT.
12
+ Permission to use, copy, modify, and/or distribute this software for any
13
+ purpose with or without fee is hereby granted.
17
14
 
18
- See the Apache Version 2.0 License for specific language governing permissions
19
- and limitations under the License.
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.
20
22
  ***************************************************************************** */
21
23
 
22
24
  var __assign = function() {
@@ -41,431 +43,424 @@
41
43
  return function (target, key) { decorator(target, key, paramIndex); }
42
44
  }
43
45
 
44
- var directiveSelector = '[wt-advanced-data],'
45
- + '[wt-campaign-data],'
46
- + '[wt-customer-data],'
47
- + '[wt-init-data],'
48
- + '[wt-order-data],'
49
- + '[wt-page-data],'
50
- + '[wt-product-data],'
51
- + '[wt-session-data]';
52
- var DataDirective = /** @class */ (function () {
53
- function DataDirective(pixel) {
54
- this.pixel = pixel;
55
- }
56
- DataDirective.prototype.ngAfterContentInit = function () {
57
- var _this = this;
58
- if (this.wtAdvancedData) {
59
- this.pixel.advanced(this.wtAdvancedData);
60
- }
61
- if (this.wtCampaignData) {
62
- this.pixel.campaign(this.wtCampaignData);
63
- }
64
- if (this.wtCustomerData) {
65
- this.pixel.customer(this.wtCustomerData.id, this.wtCustomerData, this.wtCustomerData.validation);
66
- }
67
- if (this.wtInitData) {
68
- this.pixel.init(this.wtInitData);
69
- }
70
- if (this.wtOrderData) {
71
- this.pixel.order(this.wtOrderData);
72
- }
73
- if (this.wtPageData) {
74
- this.pixel.page(this.wtPageData.name, this.wtPageData);
75
- }
76
- if (this.wtProductData) {
77
- this.pixel.product(this.wtProductData.action, this.wtProductData);
78
- }
79
- if (this.wtSessionData) {
80
- this.pixel.session(this.wtSessionData);
81
- }
82
- if (typeof this.wtTrack !== 'undefined') {
83
- setTimeout(function () {
84
- _this.pixel.track();
85
- }, 0);
86
- }
87
- };
88
- __decorate([
89
- core.Input('wt-advanced-data')
90
- ], DataDirective.prototype, "wtAdvancedData", void 0);
91
- __decorate([
92
- core.Input('wt-campaign-data')
93
- ], DataDirective.prototype, "wtCampaignData", void 0);
94
- __decorate([
95
- core.Input('wt-customer-data')
96
- ], DataDirective.prototype, "wtCustomerData", void 0);
97
- __decorate([
98
- core.Input('wt-init-data')
99
- ], DataDirective.prototype, "wtInitData", void 0);
100
- __decorate([
101
- core.Input('wt-order-data')
102
- ], DataDirective.prototype, "wtOrderData", void 0);
103
- __decorate([
104
- core.Input('wt-page-data')
105
- ], DataDirective.prototype, "wtPageData", void 0);
106
- __decorate([
107
- core.Input('wt-product-data')
108
- ], DataDirective.prototype, "wtProductData", void 0);
109
- __decorate([
110
- core.Input('wt-session-data')
111
- ], DataDirective.prototype, "wtSessionData", void 0);
112
- __decorate([
113
- core.Input('wt-track')
114
- ], DataDirective.prototype, "wtTrack", void 0);
115
- DataDirective = __decorate([
116
- core.Directive({
117
- selector: directiveSelector
118
- })
119
- ], DataDirective);
120
- return DataDirective;
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;
121
123
  }());
122
124
 
123
- var TeaserDirective = /** @class */ (function () {
124
- function TeaserDirective(elementRef, pixel) {
125
- this.elementRef = elementRef;
126
- this.pixel = pixel;
127
- }
128
- TeaserDirective.prototype.ngAfterContentInit = function () {
129
- var _this = this;
130
- this.pixel.call(function (pix) {
131
- pix.extension.teaser_tracking.add({
132
- selector: ((_this.wtTeaserElement.selector) ? _this.wtTeaserElement.selector : _this.elementRef.nativeElement),
133
- data: _this.wtTeaserElement,
134
- conversion: _this.wtTeaserElement
135
- });
136
- });
137
- };
138
- __decorate([
139
- core.Input('wt-teaser')
140
- ], TeaserDirective.prototype, "wtTeaserElement", void 0);
141
- TeaserDirective = __decorate([
142
- core.Directive({
143
- selector: '[wt-teaser]',
144
- exportAs: 'wt-teaser'
145
- })
146
- ], TeaserDirective);
147
- return TeaserDirective;
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;
148
150
  }());
149
151
 
150
- var ProductListDirective = /** @class */ (function () {
151
- function ProductListDirective(elementRef, pixel) {
152
- this.elementRef = elementRef;
153
- this.pixel = pixel;
154
- }
155
- ProductListDirective.prototype.ngAfterContentInit = function () {
156
- var _this = this;
157
- this.pixel.call(function (pix) {
158
- pix.extension.product_list_tracking.add({
159
- selector: ((_this.wtProductListElement.selector) ? _this.wtProductListElement.selector : _this.elementRef.nativeElement),
160
- data: _this.wtProductListElement
161
- });
162
- });
163
- };
164
- __decorate([
165
- core.Input('wt-product-list')
166
- ], ProductListDirective.prototype, "wtProductListElement", void 0);
167
- ProductListDirective = __decorate([
168
- core.Directive({
169
- selector: '[wt-product-list]',
170
- exportAs: 'wt-product-list'
171
- })
172
- ], ProductListDirective);
173
- return ProductListDirective;
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;
174
176
  }());
175
177
 
176
- var ContentEngagementDirective = /** @class */ (function () {
177
- function ContentEngagementDirective(elementRef, pixel) {
178
- this.elementRef = elementRef;
179
- this.pixel = pixel;
180
- }
181
- ContentEngagementDirective.prototype.ngAfterContentInit = function () {
182
- var _this = this;
183
- this.pixel.call(function (pix) {
184
- pix.extension.content_engagement.add({
185
- selector: ((_this.wtContentEngagementElement.selector) ? _this.wtContentEngagementElement.selector : _this.elementRef.nativeElement),
186
- name: _this.wtContentEngagementElement.name,
187
- config: _this.wtContentEngagementElement
188
- });
189
- });
190
- };
191
- __decorate([
192
- core.Input('wt-content-engagement')
193
- ], ContentEngagementDirective.prototype, "wtContentEngagementElement", void 0);
194
- ContentEngagementDirective = __decorate([
195
- core.Directive({
196
- selector: '[wt-content-engagement]',
197
- exportAs: 'wt-content-engagement'
198
- })
199
- ], ContentEngagementDirective);
200
- return ContentEngagementDirective;
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;
201
203
  }());
202
204
 
203
- var ExtensionDirective = /** @class */ (function () {
204
- function ExtensionDirective(pixel) {
205
- this.pixel = pixel;
206
- }
207
- ExtensionDirective.prototype.ngAfterContentInit = function () {
208
- this.pixel.extension(this.wtExtensionData.name, this.wtExtensionData.action, this.wtExtensionData.config);
209
- };
210
- __decorate([
211
- core.Input('wt-extension')
212
- ], ExtensionDirective.prototype, "wtExtensionData", void 0);
213
- ExtensionDirective = __decorate([
214
- core.Directive({
215
- selector: '[wt-extension]',
216
- exportAs: 'wt-extension'
217
- })
218
- ], ExtensionDirective);
219
- return ExtensionDirective;
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;
220
222
  }());
221
223
 
222
- var pixel_ = null;
223
- var getWindow_ = function () {
224
- return ((typeof window !== 'undefined') ? window : null);
225
- };
226
- var getDocument_ = function () {
227
- return ((typeof window !== 'undefined' && typeof window.document !== 'undefined') ? window.document : null);
228
- };
229
- var emptyObject = {};
230
- var init_ = function () {
231
- var window_ = getWindow_();
232
- var document_ = getDocument_();
233
- if (window_ !== null && document_ !== null) {
234
- pixel_ = wtSmart.use(window_, document_);
235
- window_['wtSmart'] = pixel_;
236
- }
237
- };
238
- var WebtrekkSmartPixelAngular = /** @class */ (function () {
239
- function WebtrekkSmartPixelAngular() {
240
- }
241
- WebtrekkSmartPixelAngular.prototype.call = function (call) {
242
- if (pixel_ === null) {
243
- init_();
244
- }
245
- if (pixel_ !== null) {
246
- pixel_.push(call);
247
- }
248
- };
249
- WebtrekkSmartPixelAngular.prototype.init = function (data) {
250
- if (data === void 0) { data = { trackId: '', trackDomain: '' }; }
251
- this.call(function (pix) {
252
- pix.init.add(data);
253
- });
254
- };
255
- WebtrekkSmartPixelAngular.prototype.advanced = function (data) {
256
- if (data === void 0) { data = emptyObject; }
257
- this.call(function (pix) {
258
- pix.advanced.add(data);
259
- });
260
- };
261
- WebtrekkSmartPixelAngular.prototype.page = function (name, data) {
262
- if (name === void 0) { name = ''; }
263
- if (data === void 0) { data = emptyObject; }
264
- this.call(function (pix) {
265
- pix.page.data.add(name, data);
266
- });
267
- };
268
- WebtrekkSmartPixelAngular.prototype.action = function (data) {
269
- if (data === void 0) { data = emptyObject; }
270
- this.call(function (pix) {
271
- pix.action.data.add(data);
272
- });
273
- };
274
- WebtrekkSmartPixelAngular.prototype.session = function (data) {
275
- if (data === void 0) { data = emptyObject; }
276
- this.call(function (pix) {
277
- pix.session.data.add(data);
278
- });
279
- };
280
- WebtrekkSmartPixelAngular.prototype.campaign = function (data) {
281
- if (data === void 0) { data = { id: '' }; }
282
- this.call(function (pix) {
283
- pix.campaign.data.add(data);
284
- });
285
- };
286
- WebtrekkSmartPixelAngular.prototype.customer = function (id, data, validation) {
287
- if (id === void 0) { id = ''; }
288
- if (data === void 0) { data = emptyObject; }
289
- if (validation === void 0) { validation = false; }
290
- this.call(function (pix) {
291
- pix.customer.data.add(id, data, validation);
292
- });
293
- };
294
- WebtrekkSmartPixelAngular.prototype.product = function (action, data) {
295
- if (action === void 0) { action = 'view'; }
296
- if (data === void 0) { data = { id: '' }; }
297
- this.call(function (pix) {
298
- var method = (action === 'view' || action === 'basket') ? 'set' : 'add';
299
- pix.product[action].data[method]([data]);
300
- });
301
- };
302
- WebtrekkSmartPixelAngular.prototype.products = function (action, data) {
303
- if (action === void 0) { action = 'view'; }
304
- if (data === void 0) { data = []; }
305
- this.call(function (pix) {
306
- var method = (action === 'view' || action === 'basket') ? 'set' : 'add';
307
- pix.product[action].data[method](data);
308
- });
309
- };
310
- WebtrekkSmartPixelAngular.prototype.order = function (data) {
311
- if (data === void 0) { data = { value: '' }; }
312
- this.call(function (pix) {
313
- pix.order.data.add(data);
314
- });
315
- };
316
- WebtrekkSmartPixelAngular.prototype.extension = function (extension, action, config) {
317
- if (extension === void 0) { extension = ''; }
318
- if (action === void 0) { action = 'activate'; }
319
- if (config === void 0) { config = emptyObject; }
320
- if (!extension) {
321
- return;
322
- }
323
- this.call(function (pix) {
324
- pix.extension[extension][action](config);
325
- });
326
- };
327
- WebtrekkSmartPixelAngular.prototype.track = function (keepData) {
328
- if (keepData === void 0) { keepData = false; }
329
- this.call(function (pix) {
330
- pix.track(keepData);
331
- });
332
- };
333
- WebtrekkSmartPixelAngular.prototype.trackPage = function (keepData) {
334
- if (keepData === void 0) { keepData = false; }
335
- this.call(function (pix) {
336
- pix.trackPage(keepData);
337
- });
338
- };
339
- WebtrekkSmartPixelAngular.prototype.trackAction = function (keepData) {
340
- if (keepData === void 0) { keepData = false; }
341
- this.call(function (pix) {
342
- pix.trackAction(keepData);
343
- });
344
- };
345
- WebtrekkSmartPixelAngular = __decorate([
346
- core.Injectable()
347
- ], WebtrekkSmartPixelAngular);
348
- return WebtrekkSmartPixelAngular;
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;
349
347
  }());
350
348
 
351
349
  var WEBTREKK_SMART_PIXEL_TOKEN = new core.InjectionToken('WEBTREKK-SMART-PIXEL-ANGULAR');
352
350
 
353
- var WebtrekkSmartPixelAutoTracking = /** @class */ (function () {
354
- function WebtrekkSmartPixelAutoTracking(router$1, pixel, config) {
355
- var _this = this;
356
- this.router = router$1;
357
- this.pixel = pixel;
358
- this.config = config;
359
- this.pixel.init(this.config);
360
- if (this.config.activateActions) {
361
- this.pixel.extension('action', 'activate');
362
- }
363
- if (this.config.activateTeaser) {
364
- this.pixel.extension('teaser_tracking', 'activate');
365
- }
366
- if (this.config.activateProductList) {
367
- this.pixel.extension('product_list_tracking', 'activate');
368
- }
369
- if (this.config.activateContentEngagement) {
370
- this.pixel.extension('content_engagement', 'activate');
371
- }
372
- if (this.config.activateAutoTracking || this.config.activateActions) {
373
- this.router.events.pipe(operators.filter(function (e) { return e instanceof router.NavigationEnd; }), operators.delay(0)).subscribe(function () {
374
- if (_this.config.activateAutoTracking) {
375
- _this.pixel.trackPage();
376
- }
377
- if (_this.config.activateActions) {
378
- _this.pixel.extension('action', 'reload');
379
- }
380
- });
381
- }
382
- }
383
- WebtrekkSmartPixelAutoTracking = __decorate([
384
- core.NgModule(),
385
- __param(2, core.Inject(WEBTREKK_SMART_PIXEL_TOKEN))
386
- ], WebtrekkSmartPixelAutoTracking);
387
- return WebtrekkSmartPixelAutoTracking;
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;
388
386
  }());
389
387
 
390
- var DefaultConfig = /** @class */ (function () {
391
- function DefaultConfig() {
392
- this.trackId = '';
393
- this.trackDomain = '';
394
- this.activateAutoTracking = true;
395
- this.activateActions = false;
396
- this.activateTeaser = false;
397
- this.activateProductList = false;
398
- this.activateContentEngagement = false;
399
- }
400
- return DefaultConfig;
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;
401
399
  }());
402
400
 
403
- // compatibility for v0
404
- var webtrekkSmartPixelAngular = new WebtrekkSmartPixelAngular();
405
-
406
- var defaultConfig = new DefaultConfig();
407
- var WebtrekkSmartPixelModule = /** @class */ (function () {
408
- function WebtrekkSmartPixelModule() {
409
- }
410
- WebtrekkSmartPixelModule_1 = WebtrekkSmartPixelModule;
411
- WebtrekkSmartPixelModule.forRoot = function (conf) {
412
- if (conf === void 0) { conf = {}; }
413
- return {
414
- ngModule: WebtrekkSmartPixelModule_1,
415
- providers: [
416
- {
417
- provide: WEBTREKK_SMART_PIXEL_TOKEN,
418
- useValue: __assign({}, defaultConfig, conf)
419
- },
420
- {
421
- provide: WebtrekkSmartPixelAngular,
422
- useValue: webtrekkSmartPixelAngular
423
- }
424
- ]
425
- };
426
- };
427
- var WebtrekkSmartPixelModule_1;
428
- WebtrekkSmartPixelModule = WebtrekkSmartPixelModule_1 = __decorate([
429
- core.NgModule({
430
- declarations: [
431
- DataDirective,
432
- ExtensionDirective,
433
- TeaserDirective,
434
- ProductListDirective,
435
- ContentEngagementDirective
436
- ],
437
- exports: [
438
- DataDirective,
439
- ExtensionDirective,
440
- TeaserDirective,
441
- ProductListDirective,
442
- ContentEngagementDirective,
443
- WebtrekkSmartPixelAutoTracking
444
- ],
445
- imports: [
446
- WebtrekkSmartPixelAutoTracking
447
- ],
448
- providers: [],
449
- bootstrap: []
450
- })
451
- ], WebtrekkSmartPixelModule);
452
- return WebtrekkSmartPixelModule;
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;
453
448
  }());
454
449
 
455
- // compatibility for v0
456
- var webtrekkSmartPixelAngular$1 = new WebtrekkSmartPixelAngular();
457
- var index = {
458
- WebtrekkSmartPixelModule: WebtrekkSmartPixelModule,
459
- WebtrekkSmartPixelAngular: WebtrekkSmartPixelAngular,
460
- // compatibility for v0
461
- webtrekkSmartPixelAngular: webtrekkSmartPixelAngular$1
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
462
457
  };
463
458
 
464
459
  exports.WebtrekkSmartPixelAngular = WebtrekkSmartPixelAngular;
465
460
  exports.WebtrekkSmartPixelModule = WebtrekkSmartPixelModule;
466
461
  exports.default = index;
467
- exports.webtrekkSmartPixelAngular = webtrekkSmartPixelAngular$1;
462
+ exports.webtrekkSmartPixelAngular = webtrekkSmartPixelAngular;
468
463
 
469
464
  Object.defineProperty(exports, '__esModule', { value: true });
470
465
 
471
- }));
466
+ })));
package/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@webtrekk-smart-pixel/angular",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "title": "Webtrekk Smart Pixel for Angular",
5
5
  "description": "A Angular implementation of the Webtrekk Smart Pixel.",
6
6
  "main": "./index.js",
7
7
  "types": "./types/index.d.ts",
8
8
  "author": "Webtrekk GmbH",
9
9
  "license": "MIT",
10
- "homepage": "https://github.com/Webtrekk/Webtrekk-Smart-Pixel/packages/angular#readme",
10
+ "homepage": "https://github.com/Webtrekk/Webtrekk-Smart-Pixel/tree/master/packages/angular#readme",
11
11
  "repository": {
12
12
  "type": "git",
13
13
  "url": "https://github.com/Webtrekk/Webtrekk-Smart-Pixel"
@@ -19,7 +19,7 @@
19
19
  "node": ">=6.0.0"
20
20
  },
21
21
  "peerDependencies": {
22
- "@angular/core": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
22
+ "@angular/core": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0",
23
23
  "rxjs": "^5.0.0 || ^6.0.0",
24
24
  "zone.js": "^0.8.4"
25
25
  },