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.
- package/.claude/settings.local.json +6 -11
- package/.eslintrc.json +12 -0
- package/.github/workflows/openfeature-provider-tests.yml +31 -0
- package/CHANGELOG.md +8 -1
- package/build.sh +2 -2
- package/dist/async-modules/{mixpanel-recorder-BjSlYaNJ.min.js → mixpanel-recorder-D5HJyV2E.min.js} +2 -2
- package/dist/async-modules/mixpanel-recorder-D5HJyV2E.min.js.map +1 -0
- package/dist/async-modules/{mixpanel-recorder-zMBXIyeG.js → mixpanel-recorder-P6SEnnPV.js} +57 -33
- package/dist/async-modules/mixpanel-targeting-1L9FyetZ.min.js +2 -0
- package/dist/async-modules/mixpanel-targeting-1L9FyetZ.min.js.map +1 -0
- package/dist/async-modules/{mixpanel-targeting-UHf4eBfC.js → mixpanel-targeting-BBMVbgJF.js} +24 -13
- package/dist/mixpanel-core.cjs.d.ts +45 -1
- package/dist/mixpanel-core.cjs.js +565 -197
- package/dist/mixpanel-recorder.js +57 -33
- package/dist/mixpanel-recorder.min.js +1 -1
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-targeting.js +24 -13
- package/dist/mixpanel-targeting.min.js +1 -1
- package/dist/mixpanel-targeting.min.js.map +1 -1
- package/dist/mixpanel-with-async-modules.cjs.d.ts +45 -1
- package/dist/mixpanel-with-async-modules.cjs.js +567 -199
- package/dist/mixpanel-with-async-recorder.cjs.d.ts +45 -1
- package/dist/mixpanel-with-async-recorder.cjs.js +567 -199
- package/dist/mixpanel-with-recorder.d.ts +45 -1
- package/dist/mixpanel-with-recorder.js +490 -122
- package/dist/mixpanel-with-recorder.min.d.ts +45 -1
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.d.ts +45 -1
- package/dist/mixpanel.amd.js +490 -122
- package/dist/mixpanel.cjs.d.ts +45 -1
- package/dist/mixpanel.cjs.js +490 -122
- package/dist/mixpanel.globals.js +567 -199
- package/dist/mixpanel.min.js +199 -189
- package/dist/mixpanel.module.d.ts +45 -1
- package/dist/mixpanel.module.js +490 -122
- package/dist/mixpanel.umd.d.ts +45 -1
- package/dist/mixpanel.umd.js +490 -122
- package/package.json +1 -1
- package/packages/openfeature-web-provider/README.md +357 -0
- package/packages/openfeature-web-provider/package-lock.json +1636 -0
- package/packages/openfeature-web-provider/package.json +51 -0
- package/packages/openfeature-web-provider/rollup.config.browser.mjs +26 -0
- package/packages/openfeature-web-provider/src/MixpanelProvider.ts +302 -0
- package/packages/openfeature-web-provider/src/index.ts +1 -0
- package/packages/openfeature-web-provider/src/types.ts +72 -0
- package/packages/openfeature-web-provider/test/MixpanelProvider.spec.ts +484 -0
- package/packages/openfeature-web-provider/tsconfig.json +15 -0
- package/src/autocapture/index.js +7 -2
- package/src/config.js +1 -1
- package/src/flags/flags-persistence.js +176 -0
- package/src/flags/index.js +174 -23
- package/src/index.d.ts +45 -1
- package/src/mixpanel-core.js +24 -7
- package/src/recorder/idb-config.js +16 -0
- package/src/recorder/recording-registry.js +7 -2
- package/src/recorder/session-recording.js +9 -4
- package/src/recorder-manager.js +7 -2
- package/src/request-queue.js +1 -2
- package/src/shared-lock.js +2 -3
- package/src/storage/indexed-db.js +16 -15
- package/src/storage/local-storage.js +5 -3
- package/src/utils.js +25 -12
- package/tsconfig.base.json +9 -0
- package/dist/async-modules/mixpanel-recorder-BjSlYaNJ.min.js.map +0 -1
- package/dist/async-modules/mixpanel-targeting-BSHal4N9.min.js +0 -2
- package/dist/async-modules/mixpanel-targeting-BSHal4N9.min.js.map +0 -1
package/dist/mixpanel.amd.d.ts
CHANGED
|
@@ -165,8 +165,47 @@ export interface AutocaptureConfig {
|
|
|
165
165
|
block_element_callback?: (element: Element, event: Event) => boolean;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Network-only variant lookup - no persistence. Default behavior.
|
|
170
|
+
*/
|
|
171
|
+
export interface NetworkOnlyFlagsPolicy {
|
|
172
|
+
variantLookupPolicy: "networkOnly";
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Network-first variant lookup - prioritizes freshness.
|
|
177
|
+
* Attempts network fetch first, falls back to persisted variants on failure.
|
|
178
|
+
*/
|
|
179
|
+
export interface NetworkFirstFlagsPolicy {
|
|
180
|
+
variantLookupPolicy: "networkFirst";
|
|
181
|
+
/**
|
|
182
|
+
* Time-to-live in milliseconds. Persisted variants older than this are discarded.
|
|
183
|
+
* Defaults to 24 hours.
|
|
184
|
+
*/
|
|
185
|
+
persistenceTtlMs?: number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Serves persisted variants immediately while a network fetch runs in the background.
|
|
190
|
+
* Once the fetch succeeds, its result replaces the cached variants for the rest of the session.
|
|
191
|
+
*/
|
|
192
|
+
export interface PersistenceUntilNetworkSuccessFlagsPolicy {
|
|
193
|
+
variantLookupPolicy: "persistenceUntilNetworkSuccess";
|
|
194
|
+
/**
|
|
195
|
+
* Time-to-live in milliseconds. Persisted variants older than this are discarded.
|
|
196
|
+
* Defaults to 24 hours.
|
|
197
|
+
*/
|
|
198
|
+
persistenceTtlMs?: number;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export type FlagsPersistencePolicy =
|
|
202
|
+
| NetworkOnlyFlagsPolicy
|
|
203
|
+
| NetworkFirstFlagsPolicy
|
|
204
|
+
| PersistenceUntilNetworkSuccessFlagsPolicy;
|
|
205
|
+
|
|
168
206
|
export interface FlagsConfig {
|
|
169
|
-
context
|
|
207
|
+
context?: Dict;
|
|
208
|
+
persistence?: FlagsPersistencePolicy;
|
|
170
209
|
}
|
|
171
210
|
|
|
172
211
|
export interface BeforeSendHookPayload {
|
|
@@ -349,6 +388,8 @@ export interface FlagsVariant {
|
|
|
349
388
|
experiment_id?: string;
|
|
350
389
|
is_experiment_active?: boolean;
|
|
351
390
|
is_qa_tester?: boolean;
|
|
391
|
+
variant_source?: string;
|
|
392
|
+
persisted_at_in_ms?: number;
|
|
352
393
|
}
|
|
353
394
|
|
|
354
395
|
export interface FlagsUpdateContextOptions {
|
|
@@ -365,12 +406,15 @@ export interface FlagsManager {
|
|
|
365
406
|
get_variant_sync(featureName: string, fallback: FlagsVariant): FlagsVariant;
|
|
366
407
|
get_variant_value(featureName: string, fallbackValue: any): Promise<any>;
|
|
367
408
|
get_variant_value_sync(featureName: string, fallbackValue: any): any;
|
|
409
|
+
get_all_variants(): Promise<Map<string, FlagsVariant>>;
|
|
410
|
+
get_all_variants_sync(): Map<string, FlagsVariant>;
|
|
368
411
|
is_enabled(featureName: string, fallbackValue?: boolean): Promise<boolean>;
|
|
369
412
|
is_enabled_sync(featureName: string, fallbackValue?: boolean): boolean;
|
|
370
413
|
update_context(
|
|
371
414
|
context: Dict,
|
|
372
415
|
options?: FlagsUpdateContextOptions
|
|
373
416
|
): Promise<void>;
|
|
417
|
+
when_ready(): Promise<void>;
|
|
374
418
|
}
|
|
375
419
|
|
|
376
420
|
export interface Mixpanel {
|