@su-labs/visit-tracker 19.1.2 → 20.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.
package/README.md
CHANGED
|
@@ -54,17 +54,17 @@ A lightweight Angular service to track user visits. Provides reactive signals fo
|
|
|
54
54
|
You can install this library via npm:
|
|
55
55
|
|
|
56
56
|
```sh
|
|
57
|
-
npm install @su-labs/visit-tracker@
|
|
57
|
+
npm install @su-labs/visit-tracker@ng20
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
This is the Angular
|
|
60
|
+
This is the Angular 20 version. For the newest Angular, install `@su-labs/visit-tracker` without a tag.
|
|
61
61
|
|
|
62
62
|
## Peer Dependencies
|
|
63
63
|
|
|
64
64
|
This library requires the following peer dependencies:
|
|
65
65
|
|
|
66
66
|
```sh
|
|
67
|
-
npm install @angular/common@^
|
|
67
|
+
npm install @angular/common@^20 @angular/core@^20
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
## Quick Start
|
|
@@ -217,7 +217,7 @@ The service can be configured to fit your application's needs. You can customize
|
|
|
217
217
|
|
|
218
218
|
Works in all modern browsers that support:
|
|
219
219
|
- localStorage API
|
|
220
|
-
- Angular
|
|
220
|
+
- Angular 20
|
|
221
221
|
- ES2022+
|
|
222
222
|
|
|
223
223
|
| Browser | Version |
|
|
@@ -252,7 +252,7 @@ Milestones are only checked when `init()` runs, once per visit.
|
|
|
252
252
|
|
|
253
253
|
### TypeScript errors?
|
|
254
254
|
|
|
255
|
-
Ensure you have Angular
|
|
255
|
+
Ensure you have Angular 20 and TypeScript 5.8+ installed.
|
|
256
256
|
|
|
257
257
|
## Support
|
|
258
258
|
|
|
@@ -12,11 +12,11 @@ class SuVisitTrackerService {
|
|
|
12
12
|
/** Framework-agnostic visit tracking logic */
|
|
13
13
|
controller = new SuVisitTrackerController();
|
|
14
14
|
/** Current visit count (0 until {@link init} runs) */
|
|
15
|
-
count = signal(0);
|
|
15
|
+
count = signal(0, ...(ngDevMode ? [{ debugName: "count" }] : []));
|
|
16
16
|
/** Start of the previous visit as an ISO string, or null on the first visit */
|
|
17
|
-
lastVisit = signal(null);
|
|
17
|
+
lastVisit = signal(null, ...(ngDevMode ? [{ debugName: "lastVisit" }] : []));
|
|
18
18
|
/** The number of the milestone reached on the current visit, or null */
|
|
19
|
-
milestone = signal(null);
|
|
19
|
+
milestone = signal(null, ...(ngDevMode ? [{ debugName: "milestone" }] : []));
|
|
20
20
|
/** Stops syncing the controller's state into the signals */
|
|
21
21
|
unsubscribe = this.controller.visit.subscribe((visit) => {
|
|
22
22
|
this.count.set(visit.count);
|
|
@@ -35,10 +35,10 @@ class SuVisitTrackerService {
|
|
|
35
35
|
ngOnDestroy() {
|
|
36
36
|
this.unsubscribe();
|
|
37
37
|
}
|
|
38
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
39
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
38
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: SuVisitTrackerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
39
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: SuVisitTrackerService, providedIn: 'root' });
|
|
40
40
|
}
|
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: SuVisitTrackerService, decorators: [{
|
|
42
42
|
type: Injectable,
|
|
43
43
|
args: [{ providedIn: 'root' }]
|
|
44
44
|
}] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"su-labs-visit-tracker.mjs","sources":["../../../../compat/angular-
|
|
1
|
+
{"version":3,"file":"su-labs-visit-tracker.mjs","sources":["../../../../compat/angular-20/build/visit-tracker/src/lib/visit-tracker.service.ts","../../../../compat/angular-20/build/visit-tracker/src/su-labs-visit-tracker.ts"],"sourcesContent":["import { Injectable, OnDestroy, signal, WritableSignal } from '@angular/core';\nimport { SuVisitTrackerConfig, SuVisitTrackerController } from '@su-labs/core/visit-tracker';\n\n/**\n * Angular service for tracking user visits.\n *\n * Thin wrapper around the framework-agnostic `SuVisitTrackerController` from\n * `@su-labs/core/visit-tracker` that exposes the visit data as Angular signals.\n */\n@Injectable({ providedIn: 'root' })\nexport class SuVisitTrackerService implements OnDestroy {\n /** Framework-agnostic visit tracking logic */\n private readonly controller = new SuVisitTrackerController();\n\n /** Current visit count (0 until {@link init} runs) */\n public count: WritableSignal<number> = signal(0);\n\n /** Start of the previous visit as an ISO string, or null on the first visit */\n public lastVisit: WritableSignal<string | null> = signal(null);\n\n /** The number of the milestone reached on the current visit, or null */\n public milestone: WritableSignal<number | null> = signal(null);\n\n /** Stops syncing the controller's state into the signals */\n private readonly unsubscribe = this.controller.visit.subscribe((visit) => {\n this.count.set(visit.count);\n this.lastVisit.set(visit.lastVisit);\n this.milestone.set(visit.milestone);\n });\n\n /**\n * Record the current visit and update the signals.\n * Call once at application startup.\n * @param config Optional storage key and milestones.\n */\n public init(config?: SuVisitTrackerConfig): void {\n this.controller.init(config);\n }\n\n /** Angular lifecycle hook for service destruction */\n ngOnDestroy(): void {\n this.unsubscribe();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAGA;;;;;AAKG;MAEU,qBAAqB,CAAA;;AAEf,IAAA,UAAU,GAAG,IAAI,wBAAwB,EAAE;;AAGrD,IAAA,KAAK,GAA2B,MAAM,CAAC,CAAC,iDAAC;;AAGzC,IAAA,SAAS,GAAkC,MAAM,CAAC,IAAI,qDAAC;;AAGvD,IAAA,SAAS,GAAkC,MAAM,CAAC,IAAI,qDAAC;;AAG7C,IAAA,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,KAAI;QACvE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;AACrC,IAAA,CAAC,CAAC;AAEF;;;;AAIG;AACI,IAAA,IAAI,CAAC,MAA6B,EAAA;AACvC,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;IAC9B;;IAGA,WAAW,GAAA;QACT,IAAI,CAAC,WAAW,EAAE;IACpB;wGAhCW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAArB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cADR,MAAM,EAAA,CAAA;;4FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACTlC;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
|
+
import { SuVisitTrackerConfig } from '@su-labs/core/visit-tracker';
|
|
2
|
+
export { SuVisitData, SuVisitTrackerConfig } from '@su-labs/core/visit-tracker';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { OnDestroy, WritableSignal } from '@angular/core';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
|
-
*
|
|
7
|
+
* Angular service for tracking user visits.
|
|
8
|
+
*
|
|
9
|
+
* Thin wrapper around the framework-agnostic `SuVisitTrackerController` from
|
|
10
|
+
* `@su-labs/core/visit-tracker` that exposes the visit data as Angular signals.
|
|
3
11
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
12
|
+
declare class SuVisitTrackerService implements OnDestroy {
|
|
13
|
+
/** Framework-agnostic visit tracking logic */
|
|
14
|
+
private readonly controller;
|
|
15
|
+
/** Current visit count (0 until {@link init} runs) */
|
|
16
|
+
count: WritableSignal<number>;
|
|
17
|
+
/** Start of the previous visit as an ISO string, or null on the first visit */
|
|
18
|
+
lastVisit: WritableSignal<string | null>;
|
|
19
|
+
/** The number of the milestone reached on the current visit, or null */
|
|
20
|
+
milestone: WritableSignal<number | null>;
|
|
21
|
+
/** Stops syncing the controller's state into the signals */
|
|
22
|
+
private readonly unsubscribe;
|
|
23
|
+
/**
|
|
24
|
+
* Record the current visit and update the signals.
|
|
25
|
+
* Call once at application startup.
|
|
26
|
+
* @param config Optional storage key and milestones.
|
|
27
|
+
*/
|
|
28
|
+
init(config?: SuVisitTrackerConfig): void;
|
|
29
|
+
/** Angular lifecycle hook for service destruction */
|
|
30
|
+
ngOnDestroy(): void;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SuVisitTrackerService, never>;
|
|
32
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SuVisitTrackerService>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { SuVisitTrackerService };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@su-labs/visit-tracker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.1.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"angular",
|
|
6
6
|
"user-tracking",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"metrics"
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@angular/common": "^
|
|
18
|
-
"@angular/core": "^
|
|
17
|
+
"@angular/common": "^20.0.0",
|
|
18
|
+
"@angular/core": "^20.0.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@su-labs/core": "1.9.0",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { OnDestroy, WritableSignal } from '@angular/core';
|
|
2
|
-
import { SuVisitTrackerConfig } from '@su-labs/core/visit-tracker';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* Angular service for tracking user visits.
|
|
6
|
-
*
|
|
7
|
-
* Thin wrapper around the framework-agnostic `SuVisitTrackerController` from
|
|
8
|
-
* `@su-labs/core/visit-tracker` that exposes the visit data as Angular signals.
|
|
9
|
-
*/
|
|
10
|
-
export declare class SuVisitTrackerService implements OnDestroy {
|
|
11
|
-
/** Framework-agnostic visit tracking logic */
|
|
12
|
-
private readonly controller;
|
|
13
|
-
/** Current visit count (0 until {@link init} runs) */
|
|
14
|
-
count: WritableSignal<number>;
|
|
15
|
-
/** Start of the previous visit as an ISO string, or null on the first visit */
|
|
16
|
-
lastVisit: WritableSignal<string | null>;
|
|
17
|
-
/** The number of the milestone reached on the current visit, or null */
|
|
18
|
-
milestone: WritableSignal<number | null>;
|
|
19
|
-
/** Stops syncing the controller's state into the signals */
|
|
20
|
-
private readonly unsubscribe;
|
|
21
|
-
/**
|
|
22
|
-
* Record the current visit and update the signals.
|
|
23
|
-
* Call once at application startup.
|
|
24
|
-
* @param config Optional storage key and milestones.
|
|
25
|
-
*/
|
|
26
|
-
init(config?: SuVisitTrackerConfig): void;
|
|
27
|
-
/** Angular lifecycle hook for service destruction */
|
|
28
|
-
ngOnDestroy(): void;
|
|
29
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuVisitTrackerService, never>;
|
|
30
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<SuVisitTrackerService>;
|
|
31
|
-
}
|
package/public-api.d.ts
DELETED