mixpanel-browser 2.77.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 -9
- package/.eslintrc.json +12 -0
- package/.github/workflows/openfeature-provider-tests.yml +31 -0
- package/CHANGELOG.md +11 -0
- package/build.sh +2 -2
- package/dist/async-modules/{mixpanel-recorder-wIWnMDLA.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-DLKbUIEE.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-CmVvUyFM.js → mixpanel-targeting-BBMVbgJF.js} +24 -13
- package/dist/mixpanel-core.cjs.d.ts +46 -1
- package/dist/mixpanel-core.cjs.js +671 -272
- 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 +46 -1
- package/dist/mixpanel-with-async-modules.cjs.js +673 -274
- package/dist/mixpanel-with-async-recorder.cjs.d.ts +46 -1
- package/dist/mixpanel-with-async-recorder.cjs.js +673 -274
- package/dist/mixpanel-with-recorder.d.ts +46 -1
- package/dist/mixpanel-with-recorder.js +596 -197
- package/dist/mixpanel-with-recorder.min.d.ts +46 -1
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.d.ts +46 -1
- package/dist/mixpanel.amd.js +596 -197
- package/dist/mixpanel.cjs.d.ts +46 -1
- package/dist/mixpanel.cjs.js +596 -197
- package/dist/mixpanel.globals.js +673 -274
- package/dist/mixpanel.min.js +200 -189
- package/dist/mixpanel.module.d.ts +46 -1
- package/dist/mixpanel.module.js +596 -197
- package/dist/mixpanel.umd.d.ts +46 -1
- package/dist/mixpanel.umd.js +596 -197
- 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/CLAUDE.md +24 -0
- package/src/flags/flags-persistence.js +176 -0
- package/src/flags/index.js +278 -98
- package/src/index.d.ts +46 -1
- package/src/mixpanel-core.js +27 -8
- 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/testServer.js +2 -0
- package/tsconfig.base.json +9 -0
- package/dist/async-modules/mixpanel-recorder-wIWnMDLA.min.js.map +0 -1
- package/dist/async-modules/mixpanel-targeting-CTcftSJC.min.js +0 -2
- package/dist/async-modules/mixpanel-targeting-CTcftSJC.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 {
|
|
@@ -357,6 +398,7 @@ export interface FlagsUpdateContextOptions {
|
|
|
357
398
|
|
|
358
399
|
export interface FlagsManager {
|
|
359
400
|
are_flags_ready(): boolean;
|
|
401
|
+
load_flags(): Promise<void>;
|
|
360
402
|
get_variant(
|
|
361
403
|
featureName: string,
|
|
362
404
|
fallback: FlagsVariant
|
|
@@ -364,12 +406,15 @@ export interface FlagsManager {
|
|
|
364
406
|
get_variant_sync(featureName: string, fallback: FlagsVariant): FlagsVariant;
|
|
365
407
|
get_variant_value(featureName: string, fallbackValue: any): Promise<any>;
|
|
366
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>;
|
|
367
411
|
is_enabled(featureName: string, fallbackValue?: boolean): Promise<boolean>;
|
|
368
412
|
is_enabled_sync(featureName: string, fallbackValue?: boolean): boolean;
|
|
369
413
|
update_context(
|
|
370
414
|
context: Dict,
|
|
371
415
|
options?: FlagsUpdateContextOptions
|
|
372
416
|
): Promise<void>;
|
|
417
|
+
when_ready(): Promise<void>;
|
|
373
418
|
}
|
|
374
419
|
|
|
375
420
|
export interface Mixpanel {
|