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
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
var Config = {
|
|
30
|
-
LIB_VERSION: '2.
|
|
30
|
+
LIB_VERSION: '2.79.0'
|
|
31
31
|
};
|
|
32
32
|
var RECORDER_GLOBAL_NAME = '__mp_recorder';
|
|
33
33
|
|
|
@@ -19089,6 +19089,7 @@
|
|
|
19089
19089
|
var console_with_prefix = function(prefix) {
|
|
19090
19090
|
return {
|
|
19091
19091
|
log: log_func_with_prefix(console$1.log, prefix),
|
|
19092
|
+
warn: log_func_with_prefix(console$1.warn, prefix),
|
|
19092
19093
|
error: log_func_with_prefix(console$1.error, prefix),
|
|
19093
19094
|
critical: log_func_with_prefix(console$1.critical, prefix)
|
|
19094
19095
|
};
|
|
@@ -20012,7 +20013,8 @@
|
|
|
20012
20013
|
if (_localStorageSupported !== null && !forceCheck) {
|
|
20013
20014
|
return _localStorageSupported;
|
|
20014
20015
|
}
|
|
20015
|
-
|
|
20016
|
+
|
|
20017
|
+
return _localStorageSupported = _testStorageSupported(storage);
|
|
20016
20018
|
};
|
|
20017
20019
|
|
|
20018
20020
|
var _sessionStorageSupported = null;
|
|
@@ -20020,7 +20022,8 @@
|
|
|
20020
20022
|
if (_sessionStorageSupported !== null && !forceCheck) {
|
|
20021
20023
|
return _sessionStorageSupported;
|
|
20022
20024
|
}
|
|
20023
|
-
|
|
20025
|
+
|
|
20026
|
+
return _sessionStorageSupported = _testStorageSupported(storage);
|
|
20024
20027
|
};
|
|
20025
20028
|
|
|
20026
20029
|
function _storageWrapper(storage, name, is_supported_fn) {
|
|
@@ -20070,17 +20073,26 @@
|
|
|
20070
20073
|
};
|
|
20071
20074
|
}
|
|
20072
20075
|
|
|
20073
|
-
// Safari
|
|
20074
|
-
//
|
|
20075
|
-
var
|
|
20076
|
-
|
|
20077
|
-
|
|
20078
|
-
|
|
20079
|
-
|
|
20080
|
-
|
|
20076
|
+
// Safari and other browsers may error out accessing localStorage/sessionStorage
|
|
20077
|
+
// when cookies are disabled, so wrap access in a try-catch.
|
|
20078
|
+
var getLocalStorage = function() {
|
|
20079
|
+
try {
|
|
20080
|
+
return win.localStorage; // eslint-disable-line no-restricted-properties
|
|
20081
|
+
} catch (_err) {
|
|
20082
|
+
return null;
|
|
20083
|
+
}
|
|
20084
|
+
};
|
|
20081
20085
|
|
|
20082
|
-
|
|
20083
|
-
|
|
20086
|
+
var getSessionStorage = function() {
|
|
20087
|
+
try {
|
|
20088
|
+
return win.sessionStorage; // eslint-disable-line no-restricted-properties
|
|
20089
|
+
} catch (_err) {
|
|
20090
|
+
return null;
|
|
20091
|
+
}
|
|
20092
|
+
};
|
|
20093
|
+
|
|
20094
|
+
_.localStorage = _storageWrapper(getLocalStorage(), 'localStorage', localStorageSupported);
|
|
20095
|
+
_.sessionStorage = _storageWrapper(getSessionStorage(), 'sessionStorage', sessionStorageSupported);
|
|
20084
20096
|
|
|
20085
20097
|
_.register_event = (function() {
|
|
20086
20098
|
// written by Dean Edwards, 2005
|
|
@@ -20735,29 +20747,26 @@
|
|
|
20735
20747
|
_['toArray'] = _.toArray;
|
|
20736
20748
|
_['NPO'] = NpoPromise;
|
|
20737
20749
|
|
|
20738
|
-
var MIXPANEL_DB_NAME = 'mixpanelBrowserDb';
|
|
20739
|
-
|
|
20740
|
-
var RECORDING_EVENTS_STORE_NAME = 'mixpanelRecordingEvents';
|
|
20741
|
-
var RECORDING_REGISTRY_STORE_NAME = 'mixpanelRecordingRegistry';
|
|
20742
|
-
|
|
20743
|
-
// note: increment the version number when adding new object stores
|
|
20744
|
-
var DB_VERSION = 1;
|
|
20745
|
-
var OBJECT_STORES = [RECORDING_EVENTS_STORE_NAME, RECORDING_REGISTRY_STORE_NAME];
|
|
20746
|
-
|
|
20747
20750
|
/**
|
|
20748
20751
|
* @type {import('./wrapper').StorageWrapper}
|
|
20749
20752
|
*/
|
|
20750
|
-
var IDBStorageWrapper = function (storeName) {
|
|
20753
|
+
var IDBStorageWrapper = function (dbName, storeName, versionData) {
|
|
20754
|
+
this.dbName = dbName;
|
|
20755
|
+
this.storeName = storeName;
|
|
20756
|
+
this.version = versionData.version;
|
|
20757
|
+
this.storeNamesInDb = versionData.storeNames;
|
|
20751
20758
|
/**
|
|
20752
20759
|
* @type {Promise<IDBDatabase>|null}
|
|
20753
20760
|
*/
|
|
20754
20761
|
this.dbPromise = null;
|
|
20755
|
-
this.storeName = storeName;
|
|
20756
20762
|
};
|
|
20757
20763
|
|
|
20758
20764
|
IDBStorageWrapper.prototype._openDb = function () {
|
|
20765
|
+
var dbName = this.dbName;
|
|
20766
|
+
var version = this.version;
|
|
20767
|
+
var storeNamesInDb = this.storeNamesInDb;
|
|
20759
20768
|
return new PromisePolyfill(function (resolve, reject) {
|
|
20760
|
-
var openRequest = win.indexedDB.open(
|
|
20769
|
+
var openRequest = win.indexedDB.open(dbName, version);
|
|
20761
20770
|
openRequest['onerror'] = function () {
|
|
20762
20771
|
reject(openRequest.error);
|
|
20763
20772
|
};
|
|
@@ -20769,8 +20778,10 @@
|
|
|
20769
20778
|
openRequest['onupgradeneeded'] = function (ev) {
|
|
20770
20779
|
var db = ev.target.result;
|
|
20771
20780
|
|
|
20772
|
-
|
|
20773
|
-
db.
|
|
20781
|
+
storeNamesInDb.forEach(function (storeName) {
|
|
20782
|
+
if (!db.objectStoreNames.contains(storeName)) {
|
|
20783
|
+
db.createObjectStore(storeName);
|
|
20784
|
+
}
|
|
20774
20785
|
});
|
|
20775
20786
|
};
|
|
20776
20787
|
});
|
|
@@ -20862,6 +20873,16 @@
|
|
|
20862
20873
|
});
|
|
20863
20874
|
};
|
|
20864
20875
|
|
|
20876
|
+
var MIXPANEL_BROWSER_DB_NAME = 'mixpanelBrowserDb';
|
|
20877
|
+
var RECORDING_EVENTS_STORE_NAME = 'mixpanelRecordingEvents';
|
|
20878
|
+
var RECORDING_REGISTRY_STORE_NAME = 'mixpanelRecordingRegistry';
|
|
20879
|
+
|
|
20880
|
+
// Keeping these two properties closeby, as adding additional stores to a DB in IndexedDB requires a version increment
|
|
20881
|
+
var RECORDER_VERSION_DATA = {
|
|
20882
|
+
version: 1,
|
|
20883
|
+
storeNames: [RECORDING_EVENTS_STORE_NAME, RECORDING_REGISTRY_STORE_NAME]
|
|
20884
|
+
};
|
|
20885
|
+
|
|
20865
20886
|
/**
|
|
20866
20887
|
* GDPR utils
|
|
20867
20888
|
*
|
|
@@ -21056,7 +21077,7 @@
|
|
|
21056
21077
|
options = options || {};
|
|
21057
21078
|
|
|
21058
21079
|
this.storageKey = key;
|
|
21059
|
-
this.storage = options.storage ||
|
|
21080
|
+
this.storage = options.storage || getLocalStorage();
|
|
21060
21081
|
this.pollIntervalMS = options.pollIntervalMS || 100;
|
|
21061
21082
|
this.timeoutMS = options.timeoutMS || 2000;
|
|
21062
21083
|
|
|
@@ -21184,10 +21205,13 @@
|
|
|
21184
21205
|
* @type {import('./wrapper').StorageWrapper}
|
|
21185
21206
|
*/
|
|
21186
21207
|
var LocalStorageWrapper = function (storageOverride) {
|
|
21187
|
-
this.storage = storageOverride ||
|
|
21208
|
+
this.storage = storageOverride || getLocalStorage();
|
|
21188
21209
|
};
|
|
21189
21210
|
|
|
21190
21211
|
LocalStorageWrapper.prototype.init = function () {
|
|
21212
|
+
if (!this.storage) {
|
|
21213
|
+
return PromisePolyfill.reject(new Error('localStorage is not available'));
|
|
21214
|
+
}
|
|
21191
21215
|
return PromisePolyfill.resolve();
|
|
21192
21216
|
};
|
|
21193
21217
|
|
|
@@ -21254,7 +21278,7 @@
|
|
|
21254
21278
|
if (this.usePersistence) {
|
|
21255
21279
|
this.queueStorage = options.queueStorage || new LocalStorageWrapper();
|
|
21256
21280
|
this.lock = new SharedLock(storageKey, {
|
|
21257
|
-
storage: options.sharedLockStorage
|
|
21281
|
+
storage: options.sharedLockStorage,
|
|
21258
21282
|
timeoutMS: options.sharedLockTimeoutMS,
|
|
21259
21283
|
});
|
|
21260
21284
|
}
|
|
@@ -22909,11 +22933,11 @@
|
|
|
22909
22933
|
|
|
22910
22934
|
// disable persistence if localStorage is not supported
|
|
22911
22935
|
// request-queue will automatically disable persistence if indexedDB fails to initialize
|
|
22912
|
-
var usePersistence = localStorageSupported(options.sharedLockStorage, true) && !this.getConfig('disable_persistence');
|
|
22936
|
+
var usePersistence = localStorageSupported(options.sharedLockStorage || getLocalStorage(), true) && !this.getConfig('disable_persistence');
|
|
22913
22937
|
|
|
22914
22938
|
// each replay has its own batcher key to avoid conflicts between rrweb events of different recordings
|
|
22915
22939
|
this.batcherKey = '__mprec_' + this.getConfig('name') + '_' + this.getConfig('token') + '_' + this.replayId;
|
|
22916
|
-
this.queueStorage = new IDBStorageWrapper(RECORDING_EVENTS_STORE_NAME);
|
|
22940
|
+
this.queueStorage = new IDBStorageWrapper(MIXPANEL_BROWSER_DB_NAME, RECORDING_EVENTS_STORE_NAME, RECORDER_VERSION_DATA);
|
|
22917
22941
|
this.batcher = new RequestBatcher(this.batcherKey, {
|
|
22918
22942
|
errorReporter: this.reportError.bind(this),
|
|
22919
22943
|
flushOnlyOnInterval: true,
|
|
@@ -23403,7 +23427,7 @@
|
|
|
23403
23427
|
*/
|
|
23404
23428
|
var RecordingRegistry = function (options) {
|
|
23405
23429
|
/** @type {IDBStorageWrapper} */
|
|
23406
|
-
this.idb = new IDBStorageWrapper(RECORDING_REGISTRY_STORE_NAME);
|
|
23430
|
+
this.idb = new IDBStorageWrapper(MIXPANEL_BROWSER_DB_NAME, RECORDING_REGISTRY_STORE_NAME, RECORDER_VERSION_DATA);
|
|
23407
23431
|
this.errorReporter = options.errorReporter;
|
|
23408
23432
|
this.mixpanelInstance = options.mixpanelInstance;
|
|
23409
23433
|
this.sharedLockStorage = options.sharedLockStorage;
|