@networkpro/web 1.26.9 → 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/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- =====================================================================
2
2
  CHANGELOG.md
3
3
 
4
- Copyright © 2025-2026-2026 Network Pro Strategies (Network Pro™)
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,43 @@ 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
+
27
64
  ## [1.26.9] - 2026-02-12
28
65
 
29
66
  ### Changed
@@ -58,7 +95,7 @@ version increments reflecting both user-visible and operational impact.
58
95
  - `svelte` `5.49.1` → `5.50.0`
59
96
  - `@playwright/test` `^1.58.1` → `^1.58.2`
60
97
  - `@sveltejs/kit` `2.50.1` → `2.50.2`
61
- - `eslint-plugin-doc` `^62.5.0` → `^62.5.3`
98
+ - `eslint-plugin-jsdoc` `^62.5.0` → `^62.5.3`
62
99
  - `jsdom` `27.4.0` → `28.0.0`
63
100
  - `playwright` `^1.58.1` → `^1.58.2`
64
101
  - `stylelint` `^17.1.0` → `^17.1.1`
@@ -2410,7 +2447,8 @@ This enables analytics filtering and CSP hardening for the audit environment.
2410
2447
 
2411
2448
  <!-- Link references -->
2412
2449
 
2413
- [Unreleased]: https://github.com/netwk-pro/netwk-pro.github.io/compare/v1.26.9...HEAD
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
2414
2452
  [1.26.9]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.26.9
2415
2453
  [1.26.8]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.26.8
2416
2454
  [1.26.7]: https://github.com/netwk-pro/netwk-pro.github.io/releases/tag/v1.26.7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@networkpro/web",
3
3
  "private": false,
4
- "version": "1.26.9",
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.347.0",
93
+ "posthog-js": "^1.352.0",
94
94
  "semver": "^7.7.4",
95
- "svelte": "5.50.3"
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": "^6.0.0",
103
- "@sveltejs/adapter-vercel": "^6.3.1",
104
- "@sveltejs/kit": "2.51.0",
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,25 +110,25 @@
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.5.4",
113
+ "eslint-plugin-jsdoc": "^62.7.0",
114
114
  "eslint-plugin-svelte": "^3.15.0",
115
115
  "globals": "^17.3.0",
116
- "globby": "^16.1.0",
117
- "jsdom": "28.0.0",
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.20.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.4.1",
125
+ "prettier-plugin-svelte": "^3.5.0",
126
126
  "simple-git-hooks": "^2.13.1",
127
- "stylelint": "^17.2.0",
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.6",
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",
@@ -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.7",
148
+ "tar": "^7.5.9",
148
149
  "tmp": "^0.2.4"
149
150
  }
150
151
  }
package/src/app.html CHANGED
@@ -53,7 +53,7 @@
53
53
  content="bx4ham0zkpvzztzu213bhpt76m9siq" />
54
54
  <!-- cspell:enable -->
55
55
 
56
- <meta name="generator" content="SvelteKit 2.50.2" />
56
+ <meta name="generator" content="SvelteKit 2.53.0" />
57
57
 
58
58
  <script src="/disableSw.js"></script>
59
59
 
@@ -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 (isCodex) {
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 = /(^|\.)audit\.netwk\.pro$/i.test(host);
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
- const isDev = import.meta.env.MODE === 'development';
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
- const isDev = import.meta.env.MODE === 'development';
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(() => {