@networkpro/web 1.26.8 → 1.26.10
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/.github/workflows/build-and-publish.yml +3 -3
- package/.github/workflows/lighthouse.yml +1 -1
- package/.github/workflows/playwright.yml +1 -1
- package/.github/workflows/publish-test.yml +3 -3
- package/.github/workflows/templates/publish.template.yml +3 -3
- package/.node-version +1 -1
- package/.nvmrc +1 -1
- package/CHANGELOG.md +61 -3
- package/package.json +17 -16
- package/src/app.html +1 -1
- package/src/lib/pages/LicenseContent.svelte +0 -3
- package/src/lib/stores/posthog.js +68 -13
- package/tests/unit/client/lib/utils/utm.test.js +6 -9
|
@@ -45,7 +45,7 @@ jobs:
|
|
|
45
45
|
- name: Upgrade npm
|
|
46
46
|
run: |
|
|
47
47
|
corepack enable
|
|
48
|
-
npm install -g npm@11.
|
|
48
|
+
npm install -g npm@11.10.0
|
|
49
49
|
|
|
50
50
|
- name: Install Node.js dependencies
|
|
51
51
|
run: npm ci
|
|
@@ -130,7 +130,7 @@ jobs:
|
|
|
130
130
|
- name: Upgrade npm
|
|
131
131
|
run: |
|
|
132
132
|
corepack enable
|
|
133
|
-
npm install -g npm@11.
|
|
133
|
+
npm install -g npm@11.10.0
|
|
134
134
|
|
|
135
135
|
- name: Install Node.js dependencies
|
|
136
136
|
run: npm ci
|
|
@@ -186,7 +186,7 @@ jobs:
|
|
|
186
186
|
- name: Upgrade npm
|
|
187
187
|
run: |
|
|
188
188
|
corepack enable
|
|
189
|
-
npm install -g npm@11.
|
|
189
|
+
npm install -g npm@11.10.0
|
|
190
190
|
|
|
191
191
|
- name: Install Node.js dependencies
|
|
192
192
|
run: npm ci
|
|
@@ -48,7 +48,7 @@ jobs:
|
|
|
48
48
|
- name: Upgrade npm
|
|
49
49
|
run: |
|
|
50
50
|
corepack enable
|
|
51
|
-
npm install -g npm@11.
|
|
51
|
+
npm install -g npm@11.10.0
|
|
52
52
|
|
|
53
53
|
- name: Install Node.js dependencies
|
|
54
54
|
run: npm ci
|
|
@@ -134,7 +134,7 @@ jobs:
|
|
|
134
134
|
- name: Upgrade npm
|
|
135
135
|
run: |
|
|
136
136
|
corepack enable
|
|
137
|
-
npm install -g npm@11.
|
|
137
|
+
npm install -g npm@11.10.0
|
|
138
138
|
|
|
139
139
|
- name: Install Node.js dependencies
|
|
140
140
|
run: npm ci
|
|
@@ -195,7 +195,7 @@ jobs:
|
|
|
195
195
|
- name: Upgrade npm
|
|
196
196
|
run: |
|
|
197
197
|
corepack enable
|
|
198
|
-
npm install -g npm@11.
|
|
198
|
+
npm install -g npm@11.10.0
|
|
199
199
|
|
|
200
200
|
- name: Install Node.js dependencies
|
|
201
201
|
run: npm ci
|
|
@@ -53,7 +53,7 @@ jobs:
|
|
|
53
53
|
- name: Upgrade npm
|
|
54
54
|
run: |
|
|
55
55
|
corepack enable
|
|
56
|
-
npm install -g npm@11.
|
|
56
|
+
npm install -g npm@11.10.0
|
|
57
57
|
|
|
58
58
|
- name: Install Node.js dependencies
|
|
59
59
|
run: npm ci
|
|
@@ -134,7 +134,7 @@ jobs:
|
|
|
134
134
|
- name: Upgrade npm
|
|
135
135
|
run: |
|
|
136
136
|
corepack enable
|
|
137
|
-
npm install -g npm@11.
|
|
137
|
+
npm install -g npm@11.10.0
|
|
138
138
|
|
|
139
139
|
- name: Install Node.js dependencies
|
|
140
140
|
run: npm ci
|
|
@@ -190,7 +190,7 @@ jobs:
|
|
|
190
190
|
- name: Upgrade npm
|
|
191
191
|
run: |
|
|
192
192
|
corepack enable
|
|
193
|
-
npm install -g npm@11.
|
|
193
|
+
npm install -g npm@11.10.0
|
|
194
194
|
|
|
195
195
|
- name: Install Node.js dependencies
|
|
196
196
|
run: npm ci
|
package/.node-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
24.13.
|
|
1
|
+
24.13.1
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
24.13.
|
|
1
|
+
24.13.1
|
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- =====================================================================
|
|
2
2
|
CHANGELOG.md
|
|
3
3
|
|
|
4
|
-
Copyright © 2025-2026
|
|
4
|
+
Copyright © 2025-2026 Network Pro Strategies (Network Pro™)
|
|
5
5
|
SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
====================================================================== -->
|
|
@@ -24,6 +24,62 @@ version increments reflecting both user-visible and operational impact.
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
+
## [1.26.10] - 2026-02-21
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Refactored PostHog store to centralize environment gating across `initPostHog()`, `capture()`, and `identify()` via a shared `shouldSkipAnalytics()` helper.
|
|
32
|
+
- Cached environment detection results to avoid repeated evaluation and ensure consistent behavior across analytics APIs.
|
|
33
|
+
- Reintroduced hostname-based audit detection (`audit.netwk.pro`) as a defense-in-depth fallback alongside environment-mode audit detection.
|
|
34
|
+
- Removed unnecessary comments from `src/lib/stores/posthog.js` and `src/lib/pages/LicenseContent.svelte`.
|
|
35
|
+
- Corrected `tests/unit/client/lib/utils/utm.test.js` to import `vi` variable before first use.
|
|
36
|
+
- Updated generator metadata in `src/app.html` to reflect **SvelteKit 2.53.0**.
|
|
37
|
+
- Bumped project version to `v1.26.10`.
|
|
38
|
+
- Updated dependencies:
|
|
39
|
+
- `@sveltejs/adapter-netlify` `^6.0.0` → `^6.0.3`
|
|
40
|
+
- `@sveltejs/adapter-vercel` `^6.3.1` → `^6.3.2`
|
|
41
|
+
- `globby` `^16.1.0` → `^16.1.1`
|
|
42
|
+
- `@sveltejs/kit` `2.51.0` → `2.53.0`
|
|
43
|
+
- `eslint-plugin-jsdoc` `^62.5.4` → `^62.7.0`
|
|
44
|
+
- `jsdom` `28.0.0` → `28.1.0`
|
|
45
|
+
- `posthog-js` `^1.347.0` → `^1.352.0`
|
|
46
|
+
- `prettier-plugin-svelte` `^3.4.1` → `^3.5.0`
|
|
47
|
+
- `stylelint` `^17.2.0` → `^17.3.0`
|
|
48
|
+
- `svelte` `5.50.3` → `5.53.2`
|
|
49
|
+
- `svelte-check` `^4.3.6` → `^4.4.3`
|
|
50
|
+
- `markdownlint-cli2` `0.20.0` → `0.21.0`
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Prevented analytics gating logic from executing during SSR by adding an explicit `typeof window === 'undefined'` guard.
|
|
55
|
+
- Improved test isolation by updating `\_resetPostHog()` to reset cached environment state and tracking-related stores.
|
|
56
|
+
|
|
57
|
+
### Security
|
|
58
|
+
|
|
59
|
+
- Pinned the `tar` package to `^7.5.9` in transitive dependencies, in order to address CVE-2026-26960.
|
|
60
|
+
- Pinned transitive `minimatch` to `>=10.2.1` to address an `npm audit`-reported high-severity ReDoS/DoS issue in older minimatch versions.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## [1.26.9] - 2026-02-12
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- Updated all GitHub Actions workflows to utilize **npm 11.10.0**.
|
|
69
|
+
- Updated `.nvmrc` and `.node-version` to utilize **Node.js** `v24.13.1`.
|
|
70
|
+
- Bumped project version to `v1.26.9`.
|
|
71
|
+
- Updated dependencies:
|
|
72
|
+
- `eslint-plugin-jsdoc` `^62.5.3` → `^62.5.4`
|
|
73
|
+
- `svelte` `5.50.0` → `5.50.3`
|
|
74
|
+
- `@sveltejs/kit` `2.50.2` → `2.51.0`
|
|
75
|
+
- `eslint-plugin-svelte` `^3.14.0` → `^3.15.0`
|
|
76
|
+
- `posthog-js` `^1.342.1` → `^1.347.0`
|
|
77
|
+
- `stylelint` `^17.1.1` → `^17.2.0`
|
|
78
|
+
- `vite-tsconfig-paths` `^6.0.5` → `^6.1.1`
|
|
79
|
+
- `@sveltejs/adapter-netlify` `^5.2.4` → `^6.0.0`
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
27
83
|
## [1.26.8] - 2026-02-07
|
|
28
84
|
|
|
29
85
|
### Changed
|
|
@@ -39,7 +95,7 @@ version increments reflecting both user-visible and operational impact.
|
|
|
39
95
|
- `svelte` `5.49.1` → `5.50.0`
|
|
40
96
|
- `@playwright/test` `^1.58.1` → `^1.58.2`
|
|
41
97
|
- `@sveltejs/kit` `2.50.1` → `2.50.2`
|
|
42
|
-
- `eslint-plugin-
|
|
98
|
+
- `eslint-plugin-jsdoc` `^62.5.0` → `^62.5.3`
|
|
43
99
|
- `jsdom` `27.4.0` → `28.0.0`
|
|
44
100
|
- `playwright` `^1.58.1` → `^1.58.2`
|
|
45
101
|
- `stylelint` `^17.1.0` → `^17.1.1`
|
|
@@ -2391,7 +2447,9 @@ This enables analytics filtering and CSP hardening for the audit environment.
|
|
|
2391
2447
|
|
|
2392
2448
|
<!-- Link references -->
|
|
2393
2449
|
|
|
2394
|
-
[Unreleased]: https://github.com/netwk-pro/netwk-pro.github.io/compare/v1.26.
|
|
2450
|
+
[Unreleased]: https://github.com/netwk-pro/netwk-pro.github.io/compare/v1.26.10...HEAD
|
|
2451
|
+
[1.26.10]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.26.10
|
|
2452
|
+
[1.26.9]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.26.9
|
|
2395
2453
|
[1.26.8]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.26.8
|
|
2396
2454
|
[1.26.7]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.26.7
|
|
2397
2455
|
[1.26.6]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.26.6
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@networkpro/web",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.26.
|
|
4
|
+
"version": "1.26.10",
|
|
5
5
|
"description": "Locking Down Networks, Unlocking Confidence™ | Security, Networking, Privacy — Network Pro Strategies",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"advocacy",
|
|
@@ -90,18 +90,18 @@
|
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"dompurify": "^3.3.1",
|
|
93
|
-
"posthog-js": "^1.
|
|
93
|
+
"posthog-js": "^1.352.0",
|
|
94
94
|
"semver": "^7.7.4",
|
|
95
|
-
"svelte": "5.
|
|
95
|
+
"svelte": "5.53.2"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@eslint/compat": "^2.0.2",
|
|
99
99
|
"@eslint/js": "9.39.2",
|
|
100
100
|
"@lhci/cli": "^0.15.1",
|
|
101
101
|
"@playwright/test": "^1.58.2",
|
|
102
|
-
"@sveltejs/adapter-netlify": "^
|
|
103
|
-
"@sveltejs/adapter-vercel": "^6.3.
|
|
104
|
-
"@sveltejs/kit": "2.
|
|
102
|
+
"@sveltejs/adapter-netlify": "^6.0.3",
|
|
103
|
+
"@sveltejs/adapter-vercel": "^6.3.2",
|
|
104
|
+
"@sveltejs/kit": "2.53.0",
|
|
105
105
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
106
106
|
"@testing-library/jest-dom": "^6.9.1",
|
|
107
107
|
"@testing-library/svelte": "^5.3.1",
|
|
@@ -110,32 +110,32 @@
|
|
|
110
110
|
"browserslist": "^4.28.1",
|
|
111
111
|
"eslint": "9.39.2",
|
|
112
112
|
"eslint-config-prettier": "^10.1.8",
|
|
113
|
-
"eslint-plugin-jsdoc": "^62.
|
|
114
|
-
"eslint-plugin-svelte": "^3.
|
|
113
|
+
"eslint-plugin-jsdoc": "^62.7.0",
|
|
114
|
+
"eslint-plugin-svelte": "^3.15.0",
|
|
115
115
|
"globals": "^17.3.0",
|
|
116
|
-
"globby": "^16.1.
|
|
117
|
-
"jsdom": "28.
|
|
116
|
+
"globby": "^16.1.1",
|
|
117
|
+
"jsdom": "28.1.0",
|
|
118
118
|
"lightningcss": "^1.31.1",
|
|
119
119
|
"markdownlint": "^0.40.0",
|
|
120
|
-
"markdownlint-cli2": "0.
|
|
120
|
+
"markdownlint-cli2": "0.21.0",
|
|
121
121
|
"npm-run-all": "^4.1.5",
|
|
122
122
|
"playwright": "^1.58.2",
|
|
123
123
|
"postcss": "^8.5.6",
|
|
124
124
|
"prettier": "3.8.1",
|
|
125
|
-
"prettier-plugin-svelte": "^3.
|
|
125
|
+
"prettier-plugin-svelte": "^3.5.0",
|
|
126
126
|
"simple-git-hooks": "^2.13.1",
|
|
127
|
-
"stylelint": "^17.
|
|
127
|
+
"stylelint": "^17.3.0",
|
|
128
128
|
"stylelint-config-html": "^1.1.0",
|
|
129
129
|
"stylelint-config-recommended": "^18.0.0",
|
|
130
130
|
"stylelint-order": "^7.0.1",
|
|
131
|
-
"svelte-check": "^4.3
|
|
131
|
+
"svelte-check": "^4.4.3",
|
|
132
132
|
"svelte-eslint-parser": "^1.4.1",
|
|
133
133
|
"svelte-preprocess": "^6.0.3",
|
|
134
134
|
"typescript": "^5.9.3",
|
|
135
135
|
"vite": "^7.3.1",
|
|
136
136
|
"vite-plugin-devtools-json": "^1.0.0",
|
|
137
137
|
"vite-plugin-lightningcss": "^0.0.5",
|
|
138
|
-
"vite-tsconfig-paths": "^6.
|
|
138
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
139
139
|
"vitest": "4.0.18"
|
|
140
140
|
},
|
|
141
141
|
"overrides": {
|
|
@@ -143,8 +143,9 @@
|
|
|
143
143
|
"glob": "^11.1.0",
|
|
144
144
|
"js-yaml": "^4.1.1",
|
|
145
145
|
"lodash": "^4.17.23",
|
|
146
|
+
"minimatch": ">=10.2.1",
|
|
146
147
|
"qs": "^6.14.1",
|
|
147
|
-
"tar": "^7.5.
|
|
148
|
+
"tar": "^7.5.9",
|
|
148
149
|
"tmp": "^0.2.4"
|
|
149
150
|
}
|
|
150
151
|
}
|
package/src/app.html
CHANGED
|
@@ -11,9 +11,6 @@ This file is part of Network Pro.
|
|
|
11
11
|
import { ccSvg, bySvg } from '$lib';
|
|
12
12
|
import { CONSTANTS } from '$lib';
|
|
13
13
|
|
|
14
|
-
// Log the base path to verify its value
|
|
15
|
-
//console.log("Base path:", base);
|
|
16
|
-
|
|
17
14
|
const { COMPANY_INFO, CONTACT, PAGE, LINKS, NAV } = CONSTANTS;
|
|
18
15
|
|
|
19
16
|
/**
|
|
@@ -9,7 +9,9 @@ This file is part of Network Pro.
|
|
|
9
9
|
/**
|
|
10
10
|
* @file posthog.js
|
|
11
11
|
* @description Privacy-aware PostHog tracking store with reactive state and safe API surface.
|
|
12
|
+
* @author Scott Lopez
|
|
12
13
|
* @module src/lib/stores
|
|
14
|
+
* @updated 2026-02-21
|
|
13
15
|
*/
|
|
14
16
|
|
|
15
17
|
import {
|
|
@@ -37,6 +39,60 @@ let initialized = false;
|
|
|
37
39
|
/** @type {import("posthog-js").PostHog | null} Loaded PostHog instance */
|
|
38
40
|
let ph = null;
|
|
39
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Cache environment detection so capture/identify/init share the same policy
|
|
44
|
+
* without duplicating logic or repeatedly re-evaluating.
|
|
45
|
+
* @type {ReturnType<typeof detectEnvironment> | null}
|
|
46
|
+
*/
|
|
47
|
+
let _env = null;
|
|
48
|
+
|
|
49
|
+
/** @type {RegExp} Audit hostname matcher (defense-in-depth) */
|
|
50
|
+
const AUDIT_HOST_RE = /(^|\.)audit\.netwk\.pro$/i;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns (and caches) the environment detection result so all callers
|
|
54
|
+
* share the same policy without recomputing.
|
|
55
|
+
*
|
|
56
|
+
* @returns {ReturnType<typeof detectEnvironment>}
|
|
57
|
+
*/
|
|
58
|
+
function getEnv() {
|
|
59
|
+
if (_env) return _env;
|
|
60
|
+
_env = detectEnvironment();
|
|
61
|
+
return _env;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Determines whether this build/runtime is a Codex environment.
|
|
66
|
+
*
|
|
67
|
+
* @returns {boolean}
|
|
68
|
+
*/
|
|
69
|
+
function isCodexEnvironment() {
|
|
70
|
+
return (
|
|
71
|
+
import.meta.env.PUBLIC_CODEX === 'true' || import.meta.env.CODEX === 'true'
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Central analytics gate:
|
|
77
|
+
* - Skip entirely in Codex
|
|
78
|
+
* - Skip in audit context (mode or audit hostname)
|
|
79
|
+
* - Skip in debug context (dev/test)
|
|
80
|
+
* - Skip during SSR
|
|
81
|
+
*
|
|
82
|
+
* @returns {boolean} True if analytics should be skipped in the current runtime.
|
|
83
|
+
*/
|
|
84
|
+
function shouldSkipAnalytics() {
|
|
85
|
+
// Explicit SSR guard: never attempt analytics server-side
|
|
86
|
+
if (typeof window === 'undefined') return true;
|
|
87
|
+
|
|
88
|
+
const { isAudit, isDebug } = getEnv();
|
|
89
|
+
const host = window.location?.hostname || '';
|
|
90
|
+
const isAuditHost = AUDIT_HOST_RE.test(host);
|
|
91
|
+
const effectiveAudit = isAudit || isAuditHost;
|
|
92
|
+
|
|
93
|
+
return isCodexEnvironment() || effectiveAudit || isDebug;
|
|
94
|
+
}
|
|
95
|
+
|
|
40
96
|
/**
|
|
41
97
|
* Initializes the PostHog analytics client if tracking is permitted.
|
|
42
98
|
* Uses dynamic import to avoid SSR failures.
|
|
@@ -46,21 +102,16 @@ let ph = null;
|
|
|
46
102
|
export async function initPostHog() {
|
|
47
103
|
if (initialized || typeof window === 'undefined') return;
|
|
48
104
|
|
|
49
|
-
const { isAudit, isDebug, isDev, isTest, mode, effective } =
|
|
50
|
-
detectEnvironment();
|
|
51
|
-
|
|
52
|
-
const isCodex =
|
|
53
|
-
import.meta.env.PUBLIC_CODEX === 'true' || import.meta.env.CODEX === 'true';
|
|
105
|
+
const { isAudit, isDebug, isDev, isTest, mode, effective } = getEnv();
|
|
54
106
|
|
|
55
107
|
// 🤖 Skip analytics entirely in Codex environments
|
|
56
|
-
if (
|
|
108
|
+
if (isCodexEnvironment()) {
|
|
57
109
|
console.info('[PostHog] Skipping analytics (Codex environment).');
|
|
58
110
|
return;
|
|
59
111
|
}
|
|
60
112
|
|
|
61
|
-
// 🌐 Hybrid hostname + environment guard
|
|
62
113
|
const host = window.location.hostname;
|
|
63
|
-
const isAuditHost =
|
|
114
|
+
const isAuditHost = AUDIT_HOST_RE.test(host);
|
|
64
115
|
const effectiveAudit = isAudit || isAuditHost;
|
|
65
116
|
|
|
66
117
|
// 🧭 Log environment context before any conditional logic
|
|
@@ -69,6 +120,8 @@ export async function initPostHog() {
|
|
|
69
120
|
buildMode: mode,
|
|
70
121
|
effectiveMode: effective,
|
|
71
122
|
host,
|
|
123
|
+
isAudit,
|
|
124
|
+
isAuditHost,
|
|
72
125
|
effectiveAudit,
|
|
73
126
|
isDev,
|
|
74
127
|
isTest,
|
|
@@ -107,7 +160,6 @@ export async function initPostHog() {
|
|
|
107
160
|
|
|
108
161
|
// ✅ Load public key from env
|
|
109
162
|
const key = import.meta.env.PUBLIC_POSTHOG_PROJECT_KEY;
|
|
110
|
-
//console.log('✅ Key in runtime:', key);
|
|
111
163
|
|
|
112
164
|
if (!key) {
|
|
113
165
|
console.warn('[PostHog] ⚠️ PUBLIC_POSTHOG_PROJECT_KEY is not set.');
|
|
@@ -145,8 +197,7 @@ export async function initPostHog() {
|
|
|
145
197
|
* @param {Record<string, any>} [properties={}] - Optional event properties
|
|
146
198
|
*/
|
|
147
199
|
export function capture(event, properties = {}) {
|
|
148
|
-
|
|
149
|
-
if (isDev || ph === null || !get(trackingEnabled)) return;
|
|
200
|
+
if (shouldSkipAnalytics() || ph === null || !get(trackingEnabled)) return;
|
|
150
201
|
|
|
151
202
|
try {
|
|
152
203
|
ph.capture(event, properties);
|
|
@@ -161,8 +212,7 @@ export function capture(event, properties = {}) {
|
|
|
161
212
|
* @param {Record<string, any>} [properties={}] - Optional user traits
|
|
162
213
|
*/
|
|
163
214
|
export function identify(id, properties = {}) {
|
|
164
|
-
|
|
165
|
-
if (isDev || ph === null || !get(trackingEnabled)) return;
|
|
215
|
+
if (shouldSkipAnalytics() || ph === null || !get(trackingEnabled)) return;
|
|
166
216
|
|
|
167
217
|
try {
|
|
168
218
|
ph.identify(id, properties);
|
|
@@ -184,4 +234,9 @@ export function _resetPostHog() {
|
|
|
184
234
|
|
|
185
235
|
initialized = false;
|
|
186
236
|
ph = null;
|
|
237
|
+
_env = null;
|
|
238
|
+
|
|
239
|
+
// Reset stores for clean test isolation
|
|
240
|
+
trackingEnabled.set(false);
|
|
241
|
+
showReminder.set(false);
|
|
187
242
|
}
|
|
@@ -14,16 +14,15 @@ This file is part of Network Pro.
|
|
|
14
14
|
* @updated 2026-01-15
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { writable } from 'svelte/store';
|
|
18
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
19
|
+
|
|
17
20
|
// Mock SvelteKit environment and store
|
|
18
21
|
vi.mock('$app/environment', () => ({ browser: true }));
|
|
19
22
|
|
|
20
|
-
import { writable } from 'svelte/store';
|
|
21
|
-
|
|
22
23
|
vi.mock('$app/stores', () => {
|
|
23
24
|
const mockPageStore = writable({
|
|
24
|
-
url: {
|
|
25
|
-
pathname: '/contact',
|
|
26
|
-
},
|
|
25
|
+
url: { pathname: '/contact' },
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
return {
|
|
@@ -33,16 +32,14 @@ vi.mock('$app/stores', () => {
|
|
|
33
32
|
};
|
|
34
33
|
});
|
|
35
34
|
|
|
35
|
+
// Import *after* mocks
|
|
36
36
|
import { appendUTM } from '$lib/utils/utm.js';
|
|
37
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
38
37
|
|
|
39
38
|
describe('appendUTM', () => {
|
|
40
39
|
const originalWindow = globalThis.window;
|
|
41
40
|
|
|
42
41
|
beforeEach(() => {
|
|
43
|
-
globalThis.window = {
|
|
44
|
-
location: { search: '' },
|
|
45
|
-
};
|
|
42
|
+
globalThis.window = { location: { search: '' } };
|
|
46
43
|
});
|
|
47
44
|
|
|
48
45
|
afterEach(() => {
|