mixpanel-browser 2.78.0 → 2.79.0

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.
Files changed (66) hide show
  1. package/.claude/settings.local.json +6 -11
  2. package/.eslintrc.json +12 -0
  3. package/.github/workflows/openfeature-provider-tests.yml +31 -0
  4. package/CHANGELOG.md +8 -1
  5. package/build.sh +2 -2
  6. package/dist/async-modules/{mixpanel-recorder-BjSlYaNJ.min.js → mixpanel-recorder-D5HJyV2E.min.js} +2 -2
  7. package/dist/async-modules/mixpanel-recorder-D5HJyV2E.min.js.map +1 -0
  8. package/dist/async-modules/{mixpanel-recorder-zMBXIyeG.js → mixpanel-recorder-P6SEnnPV.js} +57 -33
  9. package/dist/async-modules/mixpanel-targeting-1L9FyetZ.min.js +2 -0
  10. package/dist/async-modules/mixpanel-targeting-1L9FyetZ.min.js.map +1 -0
  11. package/dist/async-modules/{mixpanel-targeting-UHf4eBfC.js → mixpanel-targeting-BBMVbgJF.js} +24 -13
  12. package/dist/mixpanel-core.cjs.d.ts +45 -1
  13. package/dist/mixpanel-core.cjs.js +565 -197
  14. package/dist/mixpanel-recorder.js +57 -33
  15. package/dist/mixpanel-recorder.min.js +1 -1
  16. package/dist/mixpanel-recorder.min.js.map +1 -1
  17. package/dist/mixpanel-targeting.js +24 -13
  18. package/dist/mixpanel-targeting.min.js +1 -1
  19. package/dist/mixpanel-targeting.min.js.map +1 -1
  20. package/dist/mixpanel-with-async-modules.cjs.d.ts +45 -1
  21. package/dist/mixpanel-with-async-modules.cjs.js +567 -199
  22. package/dist/mixpanel-with-async-recorder.cjs.d.ts +45 -1
  23. package/dist/mixpanel-with-async-recorder.cjs.js +567 -199
  24. package/dist/mixpanel-with-recorder.d.ts +45 -1
  25. package/dist/mixpanel-with-recorder.js +490 -122
  26. package/dist/mixpanel-with-recorder.min.d.ts +45 -1
  27. package/dist/mixpanel-with-recorder.min.js +1 -1
  28. package/dist/mixpanel.amd.d.ts +45 -1
  29. package/dist/mixpanel.amd.js +490 -122
  30. package/dist/mixpanel.cjs.d.ts +45 -1
  31. package/dist/mixpanel.cjs.js +490 -122
  32. package/dist/mixpanel.globals.js +567 -199
  33. package/dist/mixpanel.min.js +199 -189
  34. package/dist/mixpanel.module.d.ts +45 -1
  35. package/dist/mixpanel.module.js +490 -122
  36. package/dist/mixpanel.umd.d.ts +45 -1
  37. package/dist/mixpanel.umd.js +490 -122
  38. package/package.json +1 -1
  39. package/packages/openfeature-web-provider/README.md +357 -0
  40. package/packages/openfeature-web-provider/package-lock.json +1636 -0
  41. package/packages/openfeature-web-provider/package.json +51 -0
  42. package/packages/openfeature-web-provider/rollup.config.browser.mjs +26 -0
  43. package/packages/openfeature-web-provider/src/MixpanelProvider.ts +302 -0
  44. package/packages/openfeature-web-provider/src/index.ts +1 -0
  45. package/packages/openfeature-web-provider/src/types.ts +72 -0
  46. package/packages/openfeature-web-provider/test/MixpanelProvider.spec.ts +484 -0
  47. package/packages/openfeature-web-provider/tsconfig.json +15 -0
  48. package/src/autocapture/index.js +7 -2
  49. package/src/config.js +1 -1
  50. package/src/flags/flags-persistence.js +176 -0
  51. package/src/flags/index.js +174 -23
  52. package/src/index.d.ts +45 -1
  53. package/src/mixpanel-core.js +24 -7
  54. package/src/recorder/idb-config.js +16 -0
  55. package/src/recorder/recording-registry.js +7 -2
  56. package/src/recorder/session-recording.js +9 -4
  57. package/src/recorder-manager.js +7 -2
  58. package/src/request-queue.js +1 -2
  59. package/src/shared-lock.js +2 -3
  60. package/src/storage/indexed-db.js +16 -15
  61. package/src/storage/local-storage.js +5 -3
  62. package/src/utils.js +25 -12
  63. package/tsconfig.base.json +9 -0
  64. package/dist/async-modules/mixpanel-recorder-BjSlYaNJ.min.js.map +0 -1
  65. package/dist/async-modules/mixpanel-targeting-BSHal4N9.min.js +0 -2
  66. package/dist/async-modules/mixpanel-targeting-BSHal4N9.min.js.map +0 -1
@@ -1,16 +1,11 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "Bash(mkdir:*)",
5
- "Bash(cat:*)",
6
- "Bash(node --input-type=module -e \"import { expect } from 'chai'; console.log\\('works'\\);\":*)",
7
- "Bash(BABEL_ENV=test node:*)",
8
- "Bash(npm test)",
9
- "Bash(grep -E \"\\\\.\\(js|json\\)$\")",
10
- "mcp__plugin_Notion_notion__notion-fetch",
11
- "Bash(grep -rn \"sessionStorage\" /home/jakub_grzegorzewski/mixpanel-js/src/*.js)"
12
- ],
13
- "deny": [],
14
- "ask": []
4
+ "WebFetch(domain:docs.saucelabs.com)",
5
+ "WebSearch",
6
+ "WebFetch(domain:raw.githubusercontent.com)",
7
+ "Bash(gh api *)",
8
+ "Bash(python3 -c \"import sys,json; [print\\(f['path']\\) for f in json.load\\(sys.stdin\\)]\")"
9
+ ]
15
10
  }
16
11
  }
package/.eslintrc.json CHANGED
@@ -28,6 +28,18 @@
28
28
  "semi": [
29
29
  "error",
30
30
  "always"
31
+ ],
32
+ "no-restricted-properties": ["error",
33
+ {
34
+ "object": "window",
35
+ "property": "localStorage",
36
+ "message": "Use getLocalStorage() from utils.js instead to handle browsers that block storage access."
37
+ },
38
+ {
39
+ "object": "window",
40
+ "property": "sessionStorage",
41
+ "message": "Use getSessionStorage() from utils.js instead to handle browsers that block storage access."
42
+ }
31
43
  ]
32
44
  },
33
45
  "overrides": [{
@@ -0,0 +1,31 @@
1
+ name: OpenFeature Web Provider Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ strategy:
17
+ matrix:
18
+ node-version: [20.x, 22.x]
19
+
20
+ steps:
21
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22
+ - name: Use Node.js ${{ matrix.node-version }}
23
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
24
+ with:
25
+ node-version: ${{ matrix.node-version }}
26
+ - name: Install OpenFeature Web Provider dependencies
27
+ working-directory: packages/openfeature-web-provider
28
+ run: npm ci
29
+ - name: Run OpenFeature Web Provider tests
30
+ working-directory: packages/openfeature-web-provider
31
+ run: npm test
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
- **2.77.0** (8 Apr 2026)
1
+ **2.79.0** (14 May 2026)
2
+
3
+ - Adds support for feature flag variant persistence: variants can now be cached in IndexedDB with a configurable TTL so flag values stay stable across page loads and remain available before the next fetch completes.
4
+ - Enables pageview events for free during session recording when record_heatmap_data is enabled, so heatmaps get accompanying pageview context without separately enabling pageview autocapture.
5
+ - Event-triggered session recordings now wait for remote settings to finish loading (or fail) before deciding whether to start, preventing missed recordings when a triggering event fires during init.
6
+ - Hardens all window.localStorage and window.sessionStorage access with exhaustive try/catch guards, so SDK initialization no longer throws in environments where storage access raises (e.g., strict privacy modes, sandboxed iframes).
7
+
8
+ **2.78.0** (8 Apr 2026)
2
9
  - Adds `loadFlags` method to the `mixpanel.flags` to manually refresh feature flags.
3
10
  - Adds `whenReady` method to the `mixpanel.flags`, which returns a Promise that resolves when feature flags are done fetching.
4
11
 
package/build.sh CHANGED
@@ -6,7 +6,7 @@ set -e
6
6
  if [ ! -z "$DIST" ]; then
7
7
  export FULL=1
8
8
  rm -r -f build
9
- npm install
9
+ npm ci
10
10
  fi
11
11
 
12
12
  echo 'Building main bundles'
@@ -21,7 +21,7 @@ if [ ! -z "$DIST" ]; then
21
21
 
22
22
  # typescript examples require dist files
23
23
  echo 'Building TypeScript examples'
24
- pushd examples/typescript; npm install && npm run build; popd
24
+ pushd examples/typescript; npm ci && npm run build; popd
25
25
  fi
26
26
 
27
27
  if [ ! -z "$FULL" ]; then