@nommos/events_angular 0.0.44 → 0.0.46
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/README.md +317 -296
- package/fesm2022/nommos-events_angular.mjs +27 -0
- package/fesm2022/nommos-events_angular.mjs.map +1 -1
- package/index.d.ts +22 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,296 +1,317 @@
|
|
|
1
|
-
# @nommos/events_angular
|
|
2
|
-
|
|
3
|
-
An angular library made up of directives, services and modules to set up tracking of users' actions as events on an angular site. This library uses the `@nommos/core` library as base for the capturing of information associated with the url, the action carried, the user and the device used by user to carry out tracked actions on an angular site. These information are then bundled as an event object and published for storage and to be used later for analytics.
|
|
4
|
-
|
|
5
|
-
## 1. Overview
|
|
6
|
-
|
|
7
|
-
`@nommos/events_angular` provides:
|
|
8
|
-
|
|
9
|
-
- A Module that connects to a storage(Rabbit Web socket) and setup an environment for events Tracking.
|
|
10
|
-
- Directives and Services provide features to setup tracking on a particular element or action.
|
|
11
|
-
- Construction of Event Object with the aide of `@nommos/core` library
|
|
12
|
-
- Publishing of tracked events for storage
|
|
13
|
-
|
|
14
|
-
## 2. Compatibility
|
|
15
|
-
| Technology | Version |
|
|
16
|
-
|-----------|---------|
|
|
17
|
-
| **Node.js** | ≥ 14.x |
|
|
18
|
-
| **TypeScript** | ≥ 4.7 |
|
|
19
|
-
| **Angular** | >= 14.0 <= 22.0 |
|
|
20
|
-
| **@nommos/core** | >= 0.0.1 |
|
|
21
|
-
| **Browser Support** | Modern browsers + evergreen versions |
|
|
22
|
-
|
|
23
|
-
## 3. File Structure
|
|
24
|
-
|
|
25
|
-
| Folder | Description |
|
|
26
|
-
|--------|-------------|
|
|
27
|
-
| `services/` | Singleton services for data collection and tracked events publishing used across the domain |
|
|
28
|
-
| `directives/` | directives related to events tracking |
|
|
29
|
-
| `**.module.ts` | modules related to events tracking |
|
|
30
|
-
|
|
31
|
-
## 4. Module Setup
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
// app.module.ts
|
|
35
|
-
import { ActivityTrackerModule } from '@nommos/events_angular';
|
|
36
|
-
import { ConnectionConfig, UrlTrackingKey } from '@nommos/core';
|
|
37
|
-
import { NgModule } from '@angular/core';
|
|
38
|
-
|
|
39
|
-
const trackerConfig: ConnectionConfig = {
|
|
40
|
-
token: 'YOUR_TOKEN',
|
|
41
|
-
mode: 'dev',
|
|
42
|
-
};
|
|
43
|
-
const urlTrackingKey: UrlTrackingKey = { source: 'source' }
|
|
44
|
-
|
|
45
|
-
@NgModule({
|
|
46
|
-
...
|
|
47
|
-
imports: [ActivityTrackerModule.forRoot(trackerConfig, urlTrackingKey)]
|
|
48
|
-
...
|
|
49
|
-
})
|
|
50
|
-
export class AppModule {}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
// main.ts (standalone bootstrap)
|
|
55
|
-
import { bootstrapApplication } from '@angular/platform-browser';
|
|
56
|
-
import { AppComponent } from './app/app.component';
|
|
57
|
-
import { provideActivityTracker } from '@nommos/events_angular';
|
|
58
|
-
import { ConnectionConfig, UrlTrackingKey } from '@nommos/core';
|
|
59
|
-
|
|
60
|
-
const trackerConfig: ConnectionConfig = {
|
|
61
|
-
token: 'YOUR_TOKEN',
|
|
62
|
-
mode: 'dev',
|
|
63
|
-
};
|
|
64
|
-
const urlTrackingKey: UrlTrackingKey = { source: 'source' }
|
|
65
|
-
|
|
66
|
-
bootstrapApplication(AppComponent, {
|
|
67
|
-
providers: [
|
|
68
|
-
...provideActivityTracker(trackerConfig, urlTrackingKey),
|
|
69
|
-
],
|
|
70
|
-
});
|
|
71
|
-
```
|
|
72
|
-
```ts
|
|
73
|
-
// app.config.ts (standalone config)
|
|
74
|
-
import { ApplicationConfig } from '@angular/core';
|
|
75
|
-
import { provideActivityTracker } from '@nommos/events_angular';
|
|
76
|
-
import { ConnectionConfig, UrlTrackingKey } from '@nommos/core';
|
|
77
|
-
|
|
78
|
-
const trackerConfig: ConnectionConfig = {
|
|
79
|
-
token: 'YOUR_TOKEN',
|
|
80
|
-
mode: 'dev',
|
|
81
|
-
};
|
|
82
|
-
const urlTrackingKey: UrlTrackingKey = { source: 'source' }
|
|
83
|
-
|
|
84
|
-
export const appConfig: ApplicationConfig = {
|
|
85
|
-
providers: [
|
|
86
|
-
...provideActivityTracker(trackerConfig, urlTrackingKey),
|
|
87
|
-
// ... other providers
|
|
88
|
-
],
|
|
89
|
-
};
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
```ts
|
|
93
|
-
// main.ts
|
|
94
|
-
import { bootstrapApplication } from '@angular/platform-browser';
|
|
95
|
-
import { appConfig } from './app/app.config';
|
|
96
|
-
import { App } from './app/app';
|
|
97
|
-
|
|
98
|
-
bootstrapApplication(App, appConfig).catch((err) => console.error(err));
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
## 6. API Documentation
|
|
102
|
-
|
|
103
|
-
### 6.1 Services
|
|
104
|
-
#### `Service: TrackerService`
|
|
105
|
-
##### `Method: trackEvent`
|
|
106
|
-
###### Parameters
|
|
107
|
-
| Parameter | Type | Required | Default | Description |
|
|
108
|
-
|-----------|------|----------|---------|-------------|
|
|
109
|
-
|`action` |`ANALYTICS_ACTION`| true | **required** | Action carried by a User being tracked|
|
|
110
|
-
|`state` |`ANALYTICS_ACTION_STATE`| true | **required** | State associated to the action being tracked|
|
|
111
|
-
|`data` |`Record<string, unknown> \| null`| false | `null` | Extra information associated to the action being tracked|
|
|
112
|
-
|`toggle` |`boolean`| false | `true` | Boolean parameter to toggle selection state associated to the action or not|
|
|
113
|
-
|`selected` |`boolean \| null`| false | `null` | Boolean parameter to set the selection state associated to the action. Has priority over the `toggle` parameter |
|
|
114
|
-
|`userId` |`string`| false | `''` | ID of the user whom carried out the action being tracked |
|
|
115
|
-
|
|
116
|
-
###### Returns `void`
|
|
117
|
-
|
|
118
|
-
###### Example
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
// trackerService: TrackerService
|
|
122
|
-
|
|
123
|
-
// Track if the site was visited
|
|
124
|
-
trackerService.trackEvent(ANALYTICS_ACTION.VISIT,
|
|
125
|
-
ANALYTICS_ACTION_STATE.INIT,
|
|
126
|
-
null,
|
|
127
|
-
false,
|
|
128
|
-
null,
|
|
129
|
-
'uid-123-abc'
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
// Track if the registration/signin was selected
|
|
133
|
-
// If this is called a second time with the same parameters registration/signin is marked as unselected
|
|
134
|
-
trackerService.trackEvent(ANALYTICS_ACTION.SIGNIN,
|
|
135
|
-
ANALYTICS_ACTION_STATE.SELECT,
|
|
136
|
-
null,
|
|
137
|
-
true,
|
|
138
|
-
null,
|
|
139
|
-
'uid-123-abc'
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
// Track if the registration/signin was submitted
|
|
143
|
-
trackerService.trackEvent(ANALYTICS_ACTION.SIGNIN,
|
|
144
|
-
ANALYTICS_ACTION_STATE.SUBMIT,
|
|
145
|
-
{
|
|
146
|
-
login: "userName"
|
|
147
|
-
},
|
|
148
|
-
false,
|
|
149
|
-
null,
|
|
150
|
-
'uid-123-abc'
|
|
151
|
-
);
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
|
161
|
-
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
1
|
+
# @nommos/events_angular
|
|
2
|
+
|
|
3
|
+
An angular library made up of directives, services and modules to set up tracking of users' actions as events on an angular site. This library uses the `@nommos/core` library as base for the capturing of information associated with the url, the action carried, the user and the device used by user to carry out tracked actions on an angular site. These information are then bundled as an event object and published for storage and to be used later for analytics.
|
|
4
|
+
|
|
5
|
+
## 1. Overview
|
|
6
|
+
|
|
7
|
+
`@nommos/events_angular` provides:
|
|
8
|
+
|
|
9
|
+
- A Module that connects to a storage(Rabbit Web socket) and setup an environment for events Tracking.
|
|
10
|
+
- Directives and Services provide features to setup tracking on a particular element or action.
|
|
11
|
+
- Construction of Event Object with the aide of `@nommos/core` library
|
|
12
|
+
- Publishing of tracked events for storage
|
|
13
|
+
|
|
14
|
+
## 2. Compatibility
|
|
15
|
+
| Technology | Version |
|
|
16
|
+
|-----------|---------|
|
|
17
|
+
| **Node.js** | ≥ 14.x |
|
|
18
|
+
| **TypeScript** | ≥ 4.7 |
|
|
19
|
+
| **Angular** | >= 14.0 <= 22.0 |
|
|
20
|
+
| **@nommos/core** | >= 0.0.1 |
|
|
21
|
+
| **Browser Support** | Modern browsers + evergreen versions |
|
|
22
|
+
|
|
23
|
+
## 3. File Structure
|
|
24
|
+
|
|
25
|
+
| Folder | Description |
|
|
26
|
+
|--------|-------------|
|
|
27
|
+
| `services/` | Singleton services for data collection and tracked events publishing used across the domain |
|
|
28
|
+
| `directives/` | directives related to events tracking |
|
|
29
|
+
| `**.module.ts` | modules related to events tracking |
|
|
30
|
+
|
|
31
|
+
## 4. Module Setup
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// app.module.ts
|
|
35
|
+
import { ActivityTrackerModule } from '@nommos/events_angular';
|
|
36
|
+
import { ConnectionConfig, UrlTrackingKey } from '@nommos/core';
|
|
37
|
+
import { NgModule } from '@angular/core';
|
|
38
|
+
|
|
39
|
+
const trackerConfig: ConnectionConfig = {
|
|
40
|
+
token: 'YOUR_TOKEN',
|
|
41
|
+
mode: 'dev',
|
|
42
|
+
};
|
|
43
|
+
const urlTrackingKey: UrlTrackingKey = { source: 'source' }
|
|
44
|
+
|
|
45
|
+
@NgModule({
|
|
46
|
+
...
|
|
47
|
+
imports: [ActivityTrackerModule.forRoot(trackerConfig, urlTrackingKey)]
|
|
48
|
+
...
|
|
49
|
+
})
|
|
50
|
+
export class AppModule {}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
// main.ts (standalone bootstrap)
|
|
55
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
56
|
+
import { AppComponent } from './app/app.component';
|
|
57
|
+
import { provideActivityTracker } from '@nommos/events_angular';
|
|
58
|
+
import { ConnectionConfig, UrlTrackingKey } from '@nommos/core';
|
|
59
|
+
|
|
60
|
+
const trackerConfig: ConnectionConfig = {
|
|
61
|
+
token: 'YOUR_TOKEN',
|
|
62
|
+
mode: 'dev',
|
|
63
|
+
};
|
|
64
|
+
const urlTrackingKey: UrlTrackingKey = { source: 'source' }
|
|
65
|
+
|
|
66
|
+
bootstrapApplication(AppComponent, {
|
|
67
|
+
providers: [
|
|
68
|
+
...provideActivityTracker(trackerConfig, urlTrackingKey),
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
```ts
|
|
73
|
+
// app.config.ts (standalone config)
|
|
74
|
+
import { ApplicationConfig } from '@angular/core';
|
|
75
|
+
import { provideActivityTracker } from '@nommos/events_angular';
|
|
76
|
+
import { ConnectionConfig, UrlTrackingKey } from '@nommos/core';
|
|
77
|
+
|
|
78
|
+
const trackerConfig: ConnectionConfig = {
|
|
79
|
+
token: 'YOUR_TOKEN',
|
|
80
|
+
mode: 'dev',
|
|
81
|
+
};
|
|
82
|
+
const urlTrackingKey: UrlTrackingKey = { source: 'source' }
|
|
83
|
+
|
|
84
|
+
export const appConfig: ApplicationConfig = {
|
|
85
|
+
providers: [
|
|
86
|
+
...provideActivityTracker(trackerConfig, urlTrackingKey),
|
|
87
|
+
// ... other providers
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
// main.ts
|
|
94
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
95
|
+
import { appConfig } from './app/app.config';
|
|
96
|
+
import { App } from './app/app';
|
|
97
|
+
|
|
98
|
+
bootstrapApplication(App, appConfig).catch((err) => console.error(err));
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
## 6. API Documentation
|
|
102
|
+
|
|
103
|
+
### 6.1 Services
|
|
104
|
+
#### `Service: TrackerService`
|
|
105
|
+
##### `Method: trackEvent`
|
|
106
|
+
###### Parameters
|
|
107
|
+
| Parameter | Type | Required | Default | Description |
|
|
108
|
+
|-----------|------|----------|---------|-------------|
|
|
109
|
+
|`action` |`ANALYTICS_ACTION`| true | **required** | Action carried by a User being tracked|
|
|
110
|
+
|`state` |`ANALYTICS_ACTION_STATE`| true | **required** | State associated to the action being tracked|
|
|
111
|
+
|`data` |`Record<string, unknown> \| null`| false | `null` | Extra information associated to the action being tracked|
|
|
112
|
+
|`toggle` |`boolean`| false | `true` | Boolean parameter to toggle selection state associated to the action or not|
|
|
113
|
+
|`selected` |`boolean \| null`| false | `null` | Boolean parameter to set the selection state associated to the action. Has priority over the `toggle` parameter |
|
|
114
|
+
|`userId` |`string`| false | `''` | ID of the user whom carried out the action being tracked |
|
|
115
|
+
|
|
116
|
+
###### Returns `void`
|
|
117
|
+
|
|
118
|
+
###### Example
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
// trackerService: TrackerService
|
|
122
|
+
|
|
123
|
+
// Track if the site was visited
|
|
124
|
+
trackerService.trackEvent(ANALYTICS_ACTION.VISIT,
|
|
125
|
+
ANALYTICS_ACTION_STATE.INIT,
|
|
126
|
+
null,
|
|
127
|
+
false,
|
|
128
|
+
null,
|
|
129
|
+
'uid-123-abc'
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// Track if the registration/signin was selected
|
|
133
|
+
// If this is called a second time with the same parameters registration/signin is marked as unselected
|
|
134
|
+
trackerService.trackEvent(ANALYTICS_ACTION.SIGNIN,
|
|
135
|
+
ANALYTICS_ACTION_STATE.SELECT,
|
|
136
|
+
null,
|
|
137
|
+
true,
|
|
138
|
+
null,
|
|
139
|
+
'uid-123-abc'
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// Track if the registration/signin was submitted
|
|
143
|
+
trackerService.trackEvent(ANALYTICS_ACTION.SIGNIN,
|
|
144
|
+
ANALYTICS_ACTION_STATE.SUBMIT,
|
|
145
|
+
{
|
|
146
|
+
login: "userName"
|
|
147
|
+
},
|
|
148
|
+
false,
|
|
149
|
+
null,
|
|
150
|
+
'uid-123-abc'
|
|
151
|
+
);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
##### Web popup methods
|
|
155
|
+
|
|
156
|
+
The SDK draws its own notification bell and tray, so these are only needed to drive popups from your
|
|
157
|
+
own UI. See the **Web Popups** section of `@nommos/core`'s README for the tray's behaviour and the
|
|
158
|
+
`data-nommos-notification-anchor` opt-in for placing the bell in your header.
|
|
159
|
+
|
|
160
|
+
| Method | Parameters | Returns | Description |
|
|
161
|
+
|--------|-----------|---------|-------------|
|
|
162
|
+
| `openPopup` | `popupId?: number` | `Promise<void>` | Opens a popup directly, bypassing the tray. Defaults to the highest-ranked one. |
|
|
163
|
+
| `getPopupInbox` | — | `WebPopupInboxState` | The current items and their unread count, for rendering your own badge. |
|
|
164
|
+
| `setPopupSoundEnabled` | `enabled: boolean` | `void` | Mutes or unmutes the arrival chime. Visitor-level, persisted in `localStorage`. |
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
// trackerService: TrackerService
|
|
168
|
+
|
|
169
|
+
const { items, unreadCount } = trackerService.getPopupInbox();
|
|
170
|
+
if (unreadCount > 0) {
|
|
171
|
+
await trackerService.openPopup(items[0].id);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### 6.2 Directives
|
|
176
|
+
#### `Directive: TrackClickDirective`
|
|
177
|
+
A directive that will set the action being tracked, form the event and publish it on clicking the element where it is set (Buttons, links or any clickable element).
|
|
178
|
+
|
|
179
|
+
##### Selector: `[nommosTrackClick]`
|
|
180
|
+
##### Inputs
|
|
181
|
+
| Input | Type | Default | Description |
|
|
182
|
+
| ------| ---- | ------- |------------ |
|
|
183
|
+
| `nommosTrackClick` | `ANALYTICS_ACTION` | **required** | The action identifier to track |
|
|
184
|
+
| `state` | `ANALYTICS_ACTION_STATE` | `ANALYTICS_ACTION_STATE.SELECT`| State associated with the action (select, unselect, submit, etc.) |
|
|
185
|
+
| `data` | `Record<string, unknown>` | `undefined` | Optional extra data associated to the event |
|
|
186
|
+
| `toggle`| `boolean`| `true`| Enables toggling ( `ANALYTICS_ACTION_STATE.SELECT` to/from `ANALYTICS_ACTION_STATE.UN_SELECT`) of an action selection state by multiple elements|
|
|
187
|
+
| `multi` | `boolean` | `false` | Allows multiple elements to change an action selection state, for each event tracked to have the selection state of the element where the action was triggered. It has priority over the `toggle` input |
|
|
188
|
+
| `userId` | `string` | `''` | Optional user ID linked to the action |
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
###### Example
|
|
193
|
+
- Component Ts
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
// dash-bord.component.ts
|
|
197
|
+
|
|
198
|
+
import { Component } from '@angular/core';
|
|
199
|
+
import { TrackClickDirective } from '@nommos/events_angular';
|
|
200
|
+
import { ANALYTICS_ACTION } from '@nommos/core';
|
|
201
|
+
import { UserService } from '../services/user/user.service'
|
|
202
|
+
|
|
203
|
+
@Component({
|
|
204
|
+
selector: 'app-dashboard',
|
|
205
|
+
standalone: true,
|
|
206
|
+
imports: [TrackClickDirective],
|
|
207
|
+
templateUrl: './dash-bord.component.html'
|
|
208
|
+
})
|
|
209
|
+
export class DashboardComponent {
|
|
210
|
+
action = ANALYTICS_ACTION;
|
|
211
|
+
|
|
212
|
+
construction(private readonly userService: UserService){}
|
|
213
|
+
|
|
214
|
+
get userId() {
|
|
215
|
+
return userService.user.id ?? '';
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- Component template
|
|
222
|
+
|
|
223
|
+
```html
|
|
224
|
+
<!-- dash-board.component.html -->
|
|
225
|
+
<!--
|
|
226
|
+
Tracking of Bet selection
|
|
227
|
+
-->
|
|
228
|
+
<button
|
|
229
|
+
[nommosTrackClick]="action.BET"
|
|
230
|
+
[data]="{outcomeId: event.outcomeId, event_id: event.id}" [userId]="userId">
|
|
231
|
+
{{ event.odd }}
|
|
232
|
+
</button>
|
|
233
|
+
|
|
234
|
+
<!--
|
|
235
|
+
Tracking of Tournament selection
|
|
236
|
+
-->
|
|
237
|
+
<li
|
|
238
|
+
*ngFor="let item of items"
|
|
239
|
+
(click)="selectTournament(item)"
|
|
240
|
+
[nommosTrackClick]="action.TOURNAMENT"
|
|
241
|
+
[data]="{ id: item.id, name: item.name }"
|
|
242
|
+
>
|
|
243
|
+
{{ item.name }}
|
|
244
|
+
</li>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### `Directive: TrackSubmitDirective`
|
|
248
|
+
A directive that will set the action being tracked, form the event and publish it on form submissions.
|
|
249
|
+
|
|
250
|
+
##### Selector: `[nommosTrackClick]`
|
|
251
|
+
##### Inputs
|
|
252
|
+
| Input | Type | Default | Description |
|
|
253
|
+
| ------| ---- | ------- |------------ |
|
|
254
|
+
| `nommosTrackClick` | `ANALYTICS_ACTION` | **required** | The action identifier to track |
|
|
255
|
+
| `data` | `Record<string, unknown>` | `undefined` | Optional extra data associated to the event |
|
|
256
|
+
| `userId` | `string` | `''` | Optional user ID linked to the action |
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
###### Example
|
|
261
|
+
- Component Ts
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
// signin.component.ts
|
|
265
|
+
import { Component } from '@angular/core';
|
|
266
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
267
|
+
import { TrackSubmitDirective } from '@nommos/events_angular-tracker';
|
|
268
|
+
import { ANALYTICS_ACTION } from '@nommos/core';
|
|
269
|
+
|
|
270
|
+
@Component({
|
|
271
|
+
selector: 'app-signin',
|
|
272
|
+
standalone: true,
|
|
273
|
+
imports: [ReactiveFormsModule, TrackSubmitDirective],
|
|
274
|
+
templateUrl: './signin.component.html'
|
|
275
|
+
})
|
|
276
|
+
export class SignInComponent {
|
|
277
|
+
constructor(private fb: FormBuilder) {}
|
|
278
|
+
|
|
279
|
+
form = this.fb.group({
|
|
280
|
+
email: ['', [Validators.required, Validators.email]],
|
|
281
|
+
password: ['', [Validators.required]],
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
onSubmit() {
|
|
285
|
+
if (this.form.invalid) return;
|
|
286
|
+
console.log('Submitting sign-in form:', this.form.value);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
readonly SIGNIN_ACTION = ANALYTICS_ACTION.SIGN_IN;
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
- Component template
|
|
294
|
+
|
|
295
|
+
```html
|
|
296
|
+
<!-- signin.component.html -->
|
|
297
|
+
<form
|
|
298
|
+
[formGroup]="form"
|
|
299
|
+
(ngSubmit)="onSubmit()"
|
|
300
|
+
[nommosTrackSubmit]="SIGNIN_ACTION"
|
|
301
|
+
[data]="form.value"
|
|
302
|
+
>
|
|
303
|
+
<div>
|
|
304
|
+
<label>Email</label>
|
|
305
|
+
<input formControlName="email" type="email" />
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
<div>
|
|
309
|
+
<label>Password</label>
|
|
310
|
+
<input formControlName="password" type="password" />
|
|
311
|
+
</div>
|
|
312
|
+
|
|
313
|
+
<button type="submit">
|
|
314
|
+
Sign In
|
|
315
|
+
</button>
|
|
316
|
+
</form>
|
|
317
|
+
```
|
|
@@ -38,6 +38,33 @@ class TrackerService {
|
|
|
38
38
|
trackEvent(action, state, data = null, toggle = true, selected = null, userId = '') {
|
|
39
39
|
this.eventTracker.trackEvent(action, state, data, toggle, selected, userId, this.router.url);
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Opens a web popup directly, bypassing the notification tray.
|
|
43
|
+
*
|
|
44
|
+
* <p>The SDK already draws its own bell and tray, so a host app needs this only to drive the
|
|
45
|
+
* viewer from its own UI — a "what's new" link, or restoring a popup after a route change.
|
|
46
|
+
*
|
|
47
|
+
* @param popupId - Optional: which popup to open. Defaults to the highest-ranked one.
|
|
48
|
+
*/
|
|
49
|
+
openPopup(popupId) {
|
|
50
|
+
return this.eventTracker.openViewer(popupId);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The current inbox and its unread count, for a host app rendering its own badge instead of
|
|
54
|
+
* (or alongside) the SDK's bell.
|
|
55
|
+
*/
|
|
56
|
+
getPopupInbox() {
|
|
57
|
+
return this.eventTracker.getInbox();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Mutes or unmutes the chime played when a popup arrives mid-session.
|
|
61
|
+
*
|
|
62
|
+
* <p>Visitor-level and persisted in `localStorage`, so it outlives the tab. The tray exposes the
|
|
63
|
+
* same preference as a toggle; this is for host apps that keep sound settings of their own.
|
|
64
|
+
*/
|
|
65
|
+
setPopupSoundEnabled(enabled) {
|
|
66
|
+
this.eventTracker.setPopupSoundEnabled(enabled);
|
|
67
|
+
}
|
|
41
68
|
ngOnDestroy() {
|
|
42
69
|
this.eventTracker.unsubscribe();
|
|
43
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nommos-events_angular.mjs","sources":["../../../../nommos/angular/src/services/tracker/tracker.service.ts","../../../../nommos/angular/src/directives/track-click/track-click.directive.ts","../../../../nommos/angular/src/directives/track-submit/track-submit.directive.ts","../../../../nommos/angular/src/activity-tracker.module.ts","../../../../nommos/angular/src/nommos-events_angular.ts"],"sourcesContent":["import { Injectable, OnDestroy } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport {\r\n ANALYTICS_ACTION,\r\n ANALYTICS_ACTION_STATE,\r\n EventTracker,\r\n} from '@nommos/core';\r\n\r\n/**\r\n * TrackerService\r\n * -----------------------\r\n * An angular utility designed to record user actions such as clicks,\r\n * form submissions, and custom events for analytics of carried out .\r\n *\r\n * @example\r\n * ```ts\r\n * constructor(private tracker: TrackerService) {}\r\n *\r\n * this.tracker.trackEvent(ANALYTICS_ACTION_GROUPS.SIGN_IN, ANALYTICS_ACTION_STATE.SUBMIT, { login: 'johndoh@example.com' }, false, null, 'u123-456-789');\r\n * ```\r\n */\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class TrackerService implements OnDestroy {\r\n constructor(\r\n private readonly eventTracker: EventTracker,\r\n private readonly router: Router\r\n ) {}\r\n\r\n /**\r\n * collects tracked actions carried with associated informations and publishes them for storage.\r\n *\r\n * @param action - Name of action to be tracked.\r\n * @param state - State associated to the action being tracked.\r\n * @param data - Optional: information associated with the action being tracked.\r\n * @param toggle - Enables toggling between two actions(select/unselect) for an action.\r\n * @param selected - State of an event with select action (selected or unselected)\r\n * @param userId - Optional: user ID associated to the current user carrying out the action.\r\n */\r\n trackEvent(\r\n action: ANALYTICS_ACTION,\r\n state: ANALYTICS_ACTION_STATE,\r\n data: Record<string, unknown> | null = null,\r\n toggle = true,\r\n selected: boolean | null = null,\r\n userId = ''\r\n ): void {\r\n this.eventTracker.trackEvent(\r\n action,\r\n state,\r\n data,\r\n toggle,\r\n selected,\r\n userId,\r\n this.router.url\r\n );\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.eventTracker.unsubscribe();\r\n }\r\n}\r\n","import { Directive, HostListener, Input } from '@angular/core';\r\nimport { ANALYTICS_ACTION, ANALYTICS_ACTION_STATE } from '@nommos/core';\r\nimport { TrackerService } from '../../services/tracker/tracker.service';\r\n\r\n/**\r\n * TrackClickDirective\r\n * --------------------\r\n * An attribute directive that automatically pushes setup action with associated information on clicks\r\n *\r\n * @example\r\n * ```html\r\n * <button\r\n * [nommosTrackClick]=\"ANALYTICS_ACTION_GROUPS.REGISTRATION\"\r\n * >\r\n * Sign Up\r\n * </button>\r\n * ```\r\n */\r\n@Directive({\r\n selector: '[nommosTrackClick]',\r\n standalone: false,\r\n})\r\nexport class TrackClickDirective {\r\n /**\r\n * The action to be tracked.\r\n * @type {ANALYTICS_ACTION}\r\n */\r\n @Input('nommosTrackClick') action!: ANALYTICS_ACTION;\r\n\r\n /**\r\n * The state of the action carried to be tracked.\r\n * @default ANALYTICS_ACTION_STATE.SELECT\r\n * @type {ANALYTICS_ACTION_STATE}\r\n */\r\n @Input() state: ANALYTICS_ACTION_STATE = ANALYTICS_ACTION_STATE.SELECT;\r\n\r\n /**\r\n * Optional Information on the action carried out being tracked.\r\n * @type {Record<string, unknown>}\r\n */\r\n @Input() data?: Record<string, unknown>;\r\n\r\n /**\r\n * Permits to toggle the selection state (ANALYTICS_ACTION_STATE.SELECT to/from ANALYTICS_ACTION_STATE.UN_SELECT)\r\n * of an action by any element when clicked.\r\n * **Default:** `true`\r\n * @type {boolean}\r\n */\r\n @Input() toggle = true;\r\n\r\n /**\r\n * Permits multiple elements to change the selection state of an action.\r\n * It has priority over the **toggle** input.\r\n * **Default:** `false`\r\n * @type {boolean}\r\n */\r\n @Input() multi = false;\r\n\r\n /**\r\n * The user ID associated to the current user carrying out the action.\r\n * **Default:** `''`\r\n * @type {string}\r\n */\r\n @Input() userId = '';\r\n clicked = false;\r\n\r\n constructor(private readonly trackerService: TrackerService) {}\r\n\r\n @HostListener('click')\r\n onClick(): void {\r\n if (this.multi) {\r\n this.clicked = !this.clicked;\r\n this.trackerService.trackEvent(\r\n this.action,\r\n this.state,\r\n this.data,\r\n this.toggle,\r\n this.clicked,\r\n this.userId\r\n );\r\n } else {\r\n this.trackerService.trackEvent(\r\n this.action,\r\n this.state,\r\n this.data,\r\n this.toggle,\r\n null,\r\n this.userId\r\n );\r\n }\r\n }\r\n}\r\n","import { Directive, HostListener, Input } from '@angular/core';\r\nimport { ANALYTICS_ACTION, ANALYTICS_ACTION_STATE } from '@nommos/core';\r\nimport { TrackerService } from '../../services/tracker/tracker.service';\r\n\r\n/**\r\n * TrackSubmitDirective\r\n * --------------------\r\n * An attribute directive that automatically pushes setup action with associated information on form submissions\r\n *\r\n * @example\r\n * ```html\r\n * <button\r\n * [nommosTrackSubmit]=\"ANALYTICS_ACTION_GROUPS.REGISTRATION\"\r\n * >\r\n * Sign Up\r\n * </button>\r\n * ```\r\n */\r\n@Directive({\r\n selector: '[nommosTrackSubmit]',\r\n standalone: false,\r\n})\r\nexport class TrackSubmitDirective {\r\n /**\r\n * The action to be tracked.\r\n * @type {ANALYTICS_ACTION}\r\n */\r\n @Input('nommosTrackSubmit') action!: ANALYTICS_ACTION;\r\n\r\n /**\r\n * Optional Information on the action carried out being tracked.\r\n * @type {Record<string, unknown>}\r\n */\r\n @Input() data?: Record<string, unknown>;\r\n\r\n\r\n /**\r\n * The user ID associated to the current user carrying out the action.\r\n * @default ''\r\n * @type {string}\r\n */\r\n @Input() userId = '';\r\n\r\n constructor(private readonly trackerService: TrackerService) {}\r\n\r\n @HostListener('ngSubmit')\r\n @HostListener('submit')\r\n onClick(): void {\r\n this.trackerService.trackEvent(\r\n this.action,\r\n ANALYTICS_ACTION_STATE.SUBMIT,\r\n this.data,\r\n false,\r\n null,\r\n this.userId\r\n );\r\n }\r\n}\r\n","import { ModuleWithProviders, NgModule, Provider } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ConnectionConfig, EventTracker, UrlTrackingKey } from '@nommos/core';\r\nimport { TrackerService } from './services/tracker/tracker.service';\r\nimport { TrackClickDirective, TrackSubmitDirective } from './directives';\r\n\r\n@NgModule({\r\n declarations: [TrackClickDirective, TrackSubmitDirective],\r\n imports: [CommonModule],\r\n exports: [TrackClickDirective, TrackSubmitDirective],\r\n})\r\nexport class ActivityTrackerModule {\r\n /**\r\n * Registers the ActivityTrackerModule using the Angular `forRoot()` pattern.\r\n *\r\n * This is intended for NgModule-based applications. It initializes the\r\n * analytics engine with the provided connection configuration and URL\r\n * tracking key.\r\n *\r\n * @param config - Connection configuration used by the `EventTracker` (a token)\r\n * @param urlTrackingKey - Optional key for extracting tracking identifiers\r\n * from the URL (e.g affiliate key)\r\n * @returns A `ModuleWithProviders` containing the module and its providers\r\n */\r\n\r\n static forRoot(\r\n config: ConnectionConfig,\r\n urlTrackingKey: UrlTrackingKey\r\n ): ModuleWithProviders<ActivityTrackerModule> {\r\n return {\r\n ngModule: ActivityTrackerModule,\r\n providers: [\r\n {\r\n provide: EventTracker,\r\n useValue: new EventTracker(config, urlTrackingKey),\r\n },\r\n TrackerService,\r\n ],\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Standalone-friendly provider registration for the Activity Tracker.\r\n *\r\n * This function is recommended for Angular applications using the\r\n * Standalone API (`bootstrapApplication`) and cannot use `forRoot()`.\r\n *\r\n * @example\r\n * ```ts\r\n * bootstrapApplication(AppComponent, {\r\n * providers: [\r\n * ...provideActivityTracker(config, urlTrackingKey)\r\n * ]\r\n * });\r\n * ```\r\n *\r\n * @param config - Connection configuration used by `EventTracker`\r\n * @param urlTrackingKey - Key used to extract tracking identifiers from URLs\r\n * @returns An array of Angular providers for use in standalone environments\r\n */\r\nexport function provideActivityTracker(\r\n config: ConnectionConfig,\r\n urlTrackingKey: UrlTrackingKey\r\n): Provider[] {\r\n return [\r\n {\r\n provide: EventTracker,\r\n useValue: new EventTracker(config, urlTrackingKey),\r\n },\r\n TrackerService,\r\n ];\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.TrackerService"],"mappings":";;;;;;;AAQA;;;;;;;;;;;;AAYG;MAKU,cAAc,CAAA;AAEN,IAAA,YAAA;AACA,IAAA,MAAA;IAFnB,WAAA,CACmB,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B,CACpC,MAAwB,EACxB,cAA8B,EAAA;IAE9B,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,YAAY;AACrB,YAAA,QAAQ,EAAE,IAAI,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC;AACnD,SAAA;QACD,cAAc;KACf;AACH;;ACxEA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"nommos-events_angular.mjs","sources":["../../../../nommos/angular/src/services/tracker/tracker.service.ts","../../../../nommos/angular/src/directives/track-click/track-click.directive.ts","../../../../nommos/angular/src/directives/track-submit/track-submit.directive.ts","../../../../nommos/angular/src/activity-tracker.module.ts","../../../../nommos/angular/src/nommos-events_angular.ts"],"sourcesContent":["import { Injectable, OnDestroy } from '@angular/core';\nimport { Router } from '@angular/router';\nimport {\n ANALYTICS_ACTION,\n ANALYTICS_ACTION_STATE,\n EventTracker,\n WebPopupInboxState,\n} from '@nommos/core';\n\n/**\n * TrackerService\n * -----------------------\n * An angular utility designed to record user actions such as clicks,\n * form submissions, and custom events for analytics of carried out .\n *\n * @example\n * ```ts\n * constructor(private tracker: TrackerService) {}\n *\n * this.tracker.trackEvent(ANALYTICS_ACTION_GROUPS.SIGN_IN, ANALYTICS_ACTION_STATE.SUBMIT, { login: 'johndoh@example.com' }, false, null, 'u123-456-789');\n * ```\n */\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TrackerService implements OnDestroy {\n constructor(\n private readonly eventTracker: EventTracker,\n private readonly router: Router\n ) {}\n\n /**\n * collects tracked actions carried with associated informations and publishes them for storage.\n *\n * @param action - Name of action to be tracked.\n * @param state - State associated to the action being tracked.\n * @param data - Optional: information associated with the action being tracked.\n * @param toggle - Enables toggling between two actions(select/unselect) for an action.\n * @param selected - State of an event with select action (selected or unselected)\n * @param userId - Optional: user ID associated to the current user carrying out the action.\n */\n trackEvent(\n action: ANALYTICS_ACTION,\n state: ANALYTICS_ACTION_STATE,\n data: Record<string, unknown> | null = null,\n toggle = true,\n selected: boolean | null = null,\n userId = ''\n ): void {\n this.eventTracker.trackEvent(\n action,\n state,\n data,\n toggle,\n selected,\n userId,\n this.router.url\n );\n }\n\n /**\n * Opens a web popup directly, bypassing the notification tray.\n *\n * <p>The SDK already draws its own bell and tray, so a host app needs this only to drive the\n * viewer from its own UI — a \"what's new\" link, or restoring a popup after a route change.\n *\n * @param popupId - Optional: which popup to open. Defaults to the highest-ranked one.\n */\n openPopup(popupId?: number): Promise<void> {\n return this.eventTracker.openViewer(popupId);\n }\n\n /**\n * The current inbox and its unread count, for a host app rendering its own badge instead of\n * (or alongside) the SDK's bell.\n */\n getPopupInbox(): WebPopupInboxState {\n return this.eventTracker.getInbox();\n }\n\n /**\n * Mutes or unmutes the chime played when a popup arrives mid-session.\n *\n * <p>Visitor-level and persisted in `localStorage`, so it outlives the tab. The tray exposes the\n * same preference as a toggle; this is for host apps that keep sound settings of their own.\n */\n setPopupSoundEnabled(enabled: boolean): void {\n this.eventTracker.setPopupSoundEnabled(enabled);\n }\n\n ngOnDestroy(): void {\n this.eventTracker.unsubscribe();\n }\n}\n","import { Directive, HostListener, Input } from '@angular/core';\r\nimport { ANALYTICS_ACTION, ANALYTICS_ACTION_STATE } from '@nommos/core';\r\nimport { TrackerService } from '../../services/tracker/tracker.service';\r\n\r\n/**\r\n * TrackClickDirective\r\n * --------------------\r\n * An attribute directive that automatically pushes setup action with associated information on clicks\r\n *\r\n * @example\r\n * ```html\r\n * <button\r\n * [nommosTrackClick]=\"ANALYTICS_ACTION_GROUPS.REGISTRATION\"\r\n * >\r\n * Sign Up\r\n * </button>\r\n * ```\r\n */\r\n@Directive({\r\n selector: '[nommosTrackClick]',\r\n standalone: false,\r\n})\r\nexport class TrackClickDirective {\r\n /**\r\n * The action to be tracked.\r\n * @type {ANALYTICS_ACTION}\r\n */\r\n @Input('nommosTrackClick') action!: ANALYTICS_ACTION;\r\n\r\n /**\r\n * The state of the action carried to be tracked.\r\n * @default ANALYTICS_ACTION_STATE.SELECT\r\n * @type {ANALYTICS_ACTION_STATE}\r\n */\r\n @Input() state: ANALYTICS_ACTION_STATE = ANALYTICS_ACTION_STATE.SELECT;\r\n\r\n /**\r\n * Optional Information on the action carried out being tracked.\r\n * @type {Record<string, unknown>}\r\n */\r\n @Input() data?: Record<string, unknown>;\r\n\r\n /**\r\n * Permits to toggle the selection state (ANALYTICS_ACTION_STATE.SELECT to/from ANALYTICS_ACTION_STATE.UN_SELECT)\r\n * of an action by any element when clicked.\r\n * **Default:** `true`\r\n * @type {boolean}\r\n */\r\n @Input() toggle = true;\r\n\r\n /**\r\n * Permits multiple elements to change the selection state of an action.\r\n * It has priority over the **toggle** input.\r\n * **Default:** `false`\r\n * @type {boolean}\r\n */\r\n @Input() multi = false;\r\n\r\n /**\r\n * The user ID associated to the current user carrying out the action.\r\n * **Default:** `''`\r\n * @type {string}\r\n */\r\n @Input() userId = '';\r\n clicked = false;\r\n\r\n constructor(private readonly trackerService: TrackerService) {}\r\n\r\n @HostListener('click')\r\n onClick(): void {\r\n if (this.multi) {\r\n this.clicked = !this.clicked;\r\n this.trackerService.trackEvent(\r\n this.action,\r\n this.state,\r\n this.data,\r\n this.toggle,\r\n this.clicked,\r\n this.userId\r\n );\r\n } else {\r\n this.trackerService.trackEvent(\r\n this.action,\r\n this.state,\r\n this.data,\r\n this.toggle,\r\n null,\r\n this.userId\r\n );\r\n }\r\n }\r\n}\r\n","import { Directive, HostListener, Input } from '@angular/core';\r\nimport { ANALYTICS_ACTION, ANALYTICS_ACTION_STATE } from '@nommos/core';\r\nimport { TrackerService } from '../../services/tracker/tracker.service';\r\n\r\n/**\r\n * TrackSubmitDirective\r\n * --------------------\r\n * An attribute directive that automatically pushes setup action with associated information on form submissions\r\n *\r\n * @example\r\n * ```html\r\n * <button\r\n * [nommosTrackSubmit]=\"ANALYTICS_ACTION_GROUPS.REGISTRATION\"\r\n * >\r\n * Sign Up\r\n * </button>\r\n * ```\r\n */\r\n@Directive({\r\n selector: '[nommosTrackSubmit]',\r\n standalone: false,\r\n})\r\nexport class TrackSubmitDirective {\r\n /**\r\n * The action to be tracked.\r\n * @type {ANALYTICS_ACTION}\r\n */\r\n @Input('nommosTrackSubmit') action!: ANALYTICS_ACTION;\r\n\r\n /**\r\n * Optional Information on the action carried out being tracked.\r\n * @type {Record<string, unknown>}\r\n */\r\n @Input() data?: Record<string, unknown>;\r\n\r\n\r\n /**\r\n * The user ID associated to the current user carrying out the action.\r\n * @default ''\r\n * @type {string}\r\n */\r\n @Input() userId = '';\r\n\r\n constructor(private readonly trackerService: TrackerService) {}\r\n\r\n @HostListener('ngSubmit')\r\n @HostListener('submit')\r\n onClick(): void {\r\n this.trackerService.trackEvent(\r\n this.action,\r\n ANALYTICS_ACTION_STATE.SUBMIT,\r\n this.data,\r\n false,\r\n null,\r\n this.userId\r\n );\r\n }\r\n}\r\n","import { ModuleWithProviders, NgModule, Provider } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ConnectionConfig, EventTracker, UrlTrackingKey } from '@nommos/core';\r\nimport { TrackerService } from './services/tracker/tracker.service';\r\nimport { TrackClickDirective, TrackSubmitDirective } from './directives';\r\n\r\n@NgModule({\r\n declarations: [TrackClickDirective, TrackSubmitDirective],\r\n imports: [CommonModule],\r\n exports: [TrackClickDirective, TrackSubmitDirective],\r\n})\r\nexport class ActivityTrackerModule {\r\n /**\r\n * Registers the ActivityTrackerModule using the Angular `forRoot()` pattern.\r\n *\r\n * This is intended for NgModule-based applications. It initializes the\r\n * analytics engine with the provided connection configuration and URL\r\n * tracking key.\r\n *\r\n * @param config - Connection configuration used by the `EventTracker` (a token)\r\n * @param urlTrackingKey - Optional key for extracting tracking identifiers\r\n * from the URL (e.g affiliate key)\r\n * @returns A `ModuleWithProviders` containing the module and its providers\r\n */\r\n\r\n static forRoot(\r\n config: ConnectionConfig,\r\n urlTrackingKey: UrlTrackingKey\r\n ): ModuleWithProviders<ActivityTrackerModule> {\r\n return {\r\n ngModule: ActivityTrackerModule,\r\n providers: [\r\n {\r\n provide: EventTracker,\r\n useValue: new EventTracker(config, urlTrackingKey),\r\n },\r\n TrackerService,\r\n ],\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Standalone-friendly provider registration for the Activity Tracker.\r\n *\r\n * This function is recommended for Angular applications using the\r\n * Standalone API (`bootstrapApplication`) and cannot use `forRoot()`.\r\n *\r\n * @example\r\n * ```ts\r\n * bootstrapApplication(AppComponent, {\r\n * providers: [\r\n * ...provideActivityTracker(config, urlTrackingKey)\r\n * ]\r\n * });\r\n * ```\r\n *\r\n * @param config - Connection configuration used by `EventTracker`\r\n * @param urlTrackingKey - Key used to extract tracking identifiers from URLs\r\n * @returns An array of Angular providers for use in standalone environments\r\n */\r\nexport function provideActivityTracker(\r\n config: ConnectionConfig,\r\n urlTrackingKey: UrlTrackingKey\r\n): Provider[] {\r\n return [\r\n {\r\n provide: EventTracker,\r\n useValue: new EventTracker(config, urlTrackingKey),\r\n },\r\n TrackerService,\r\n ];\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.TrackerService"],"mappings":";;;;;;;AASA;;;;;;;;;;;;AAYG;MAKU,cAAc,CAAA;AAEN,IAAA,YAAA;AACA,IAAA,MAAA;IAFnB,WAAA,CACmB,YAA0B,EAC1B,MAAc,EAAA;QADd,IAAA,CAAA,YAAY,GAAZ,YAAY;QACZ,IAAA,CAAA,MAAM,GAAN,MAAM;IACtB;AAEH;;;;;;;;;AASG;AACH,IAAA,UAAU,CACR,MAAwB,EACxB,KAA6B,EAC7B,OAAuC,IAAI,EAC3C,MAAM,GAAG,IAAI,EACb,QAAA,GAA2B,IAAI,EAC/B,MAAM,GAAG,EAAE,EAAA;QAEX,IAAI,CAAC,YAAY,CAAC,UAAU,CAC1B,MAAM,EACN,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,CAAC,MAAM,CAAC,GAAG,CAChB;IACH;AAEA;;;;;;;AAOG;AACH,IAAA,SAAS,CAAC,OA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CAAC,MAAM,EAAE,cAAc,CAAC;AACnD,SAAA;QACD,cAAc;KACf;AACH;;ACxEA;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { OnDestroy, ModuleWithProviders, Provider } from '@angular/core';
|
|
3
|
-
import { EventTracker, ANALYTICS_ACTION, ANALYTICS_ACTION_STATE, ConnectionConfig, UrlTrackingKey } from '@nommos/core';
|
|
3
|
+
import { EventTracker, ANALYTICS_ACTION, ANALYTICS_ACTION_STATE, WebPopupInboxState, ConnectionConfig, UrlTrackingKey } from '@nommos/core';
|
|
4
4
|
import { Router } from '@angular/router';
|
|
5
5
|
import * as i3 from '@angular/common';
|
|
6
6
|
|
|
@@ -32,6 +32,27 @@ declare class TrackerService implements OnDestroy {
|
|
|
32
32
|
* @param userId - Optional: user ID associated to the current user carrying out the action.
|
|
33
33
|
*/
|
|
34
34
|
trackEvent(action: ANALYTICS_ACTION, state: ANALYTICS_ACTION_STATE, data?: Record<string, unknown> | null, toggle?: boolean, selected?: boolean | null, userId?: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Opens a web popup directly, bypassing the notification tray.
|
|
37
|
+
*
|
|
38
|
+
* <p>The SDK already draws its own bell and tray, so a host app needs this only to drive the
|
|
39
|
+
* viewer from its own UI — a "what's new" link, or restoring a popup after a route change.
|
|
40
|
+
*
|
|
41
|
+
* @param popupId - Optional: which popup to open. Defaults to the highest-ranked one.
|
|
42
|
+
*/
|
|
43
|
+
openPopup(popupId?: number): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* The current inbox and its unread count, for a host app rendering its own badge instead of
|
|
46
|
+
* (or alongside) the SDK's bell.
|
|
47
|
+
*/
|
|
48
|
+
getPopupInbox(): WebPopupInboxState;
|
|
49
|
+
/**
|
|
50
|
+
* Mutes or unmutes the chime played when a popup arrives mid-session.
|
|
51
|
+
*
|
|
52
|
+
* <p>Visitor-level and persisted in `localStorage`, so it outlives the tab. The tray exposes the
|
|
53
|
+
* same preference as a toggle; this is for host apps that keep sound settings of their own.
|
|
54
|
+
*/
|
|
55
|
+
setPopupSoundEnabled(enabled: boolean): void;
|
|
35
56
|
ngOnDestroy(): void;
|
|
36
57
|
static ɵfac: i0.ɵɵFactoryDeclaration<TrackerService, never>;
|
|
37
58
|
static ɵprov: i0.ɵɵInjectableDeclaration<TrackerService>;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nommos/events_angular",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": ">=12.0.0 <=22.0.0",
|
|
6
6
|
"@angular/core": ">=12.0.0 <=22.0.0",
|
|
7
7
|
"@angular/router": ">=12.0.0 <=22.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@nommos/core": "0.0.
|
|
10
|
+
"@nommos/core": "0.0.46",
|
|
11
11
|
"tslib": "^2.3.0"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|