Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/cross-browser-testing-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'BrowserStack Beta Browsers Test'
on: [push, workflow_dispatch]

jobs:
browserstack-beta-test:
name: 'BrowserStack Beta Browsers Test'
runs-on: ubuntu-latest
steps:
- name: 'BrowserStack Env Setup'
uses: browserstack/github-actions/setup-env@master
with:
username: ${{ secrets.BROWSERSTACK_USERNAME }}
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

- name: 'BrowserStack Local Tunnel Setup'
uses: browserstack/github-actions/setup-local@master
with:
local-testing: start
local-identifier: random

- name: 'Checkout the repository'
uses: actions/checkout@v3

- name: 'Run NPM CI'
run: npm ci

- name: Run Build IIFE
run: npm run build:iife

- name: 'Run Build test bundle'
run: npm run build:test-bundle

- name: 'Run BrowserStack Beta Browsers Test'
run: npm run test:browserstack-beta

- name: 'BrowserStackLocal Stop'
uses: browserstack/github-actions/setup-local@master
with:
local-testing: stop

14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# [2.50.0](https://github.com/mParticle/mparticle-web-sdk/compare/v2.49.0...v2.50.0) (2025-11-13)


### Features

* SDKE-221 Support hashedEmailUserIdentityType for "other" identity type ([#1052](https://github.com/mParticle/mparticle-web-sdk/issues/1052)) ([3fb8cb1](https://github.com/mParticle/mparticle-web-sdk/commit/3fb8cb123e6213d6a832a9455f5285e1c9989271))

# [2.49.0](https://github.com/mParticle/mparticle-web-sdk/compare/v2.48.0...v2.49.0) (2025-11-10)


### Features

* add BrowserStack beta suite and workflow ([#1074](https://github.com/mParticle/mparticle-web-sdk/issues/1074)) ([8c5749d](https://github.com/mParticle/mparticle-web-sdk/commit/8c5749d42bdfe3c4a2ef0ca8e58d17705132218e))

# [2.48.0](https://github.com/mParticle/mparticle-web-sdk/compare/v2.47.1...v2.48.0) (2025-10-27)


Expand Down
15 changes: 8 additions & 7 deletions dist/mparticle.common.js

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions dist/mparticle.esm.js

Large diffs are not rendered by default.

79 changes: 55 additions & 24 deletions dist/mparticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ var mParticle = (function () {
Base64: Base64$1
};

var version = "2.48.0";
var version = "2.50.0";

var Constants = {
sdkVersion: version,
Expand Down Expand Up @@ -5612,11 +5612,7 @@ var mParticle = (function () {
self.update();
};
this.resetPersistence = function () {
removeLocalStorage(StorageNames.localStorageName);
removeLocalStorage(StorageNames.localStorageNameV3);
removeLocalStorage(StorageNames.localStorageNameV4);
removeLocalStorage(mpInstance._Store.storageName);
removeLocalStorage(StorageNames.localStorageProductsV4);
localStorage.clear();
self.expireCookies(StorageNames.cookieName);
self.expireCookies(StorageNames.cookieNameV2);
self.expireCookies(StorageNames.cookieNameV3);
Expand Down Expand Up @@ -9713,10 +9709,14 @@ var mParticle = (function () {
* @throws Logs error to console if placementAttributesMapping parsing fails
*/
RoktManager.prototype.init = function (roktConfig, filteredUser, identityService, store, logger, options) {
var _a = roktConfig || {},
userAttributeFilters = _a.userAttributeFilters,
settings = _a.settings;
var placementAttributesMapping = (settings || {}).placementAttributesMapping;
var _a;
var _b = roktConfig || {},
userAttributeFilters = _b.userAttributeFilters,
settings = _b.settings;
var _c = settings || {},
placementAttributesMapping = _c.placementAttributesMapping,
hashedEmailUserIdentityType = _c.hashedEmailUserIdentityType;
this.mappedEmailShaIdentityType = (_a = hashedEmailUserIdentityType === null || hashedEmailUserIdentityType === void 0 ? void 0 : hashedEmailUserIdentityType.toLowerCase()) !== null && _a !== void 0 ? _a : null;
this.identityService = identityService;
this.store = store;
this.logger = logger;
Expand Down Expand Up @@ -9766,7 +9766,7 @@ var mParticle = (function () {
RoktManager.prototype.selectPlacements = function (options) {
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var attributes, sandboxValue, mappedAttributes, currentUserIdentities_1, currentEmail, newEmail_1, error_1, enrichedAttributes, enrichedOptions, error_2;
var attributes, sandboxValue, mappedAttributes, currentUserIdentities_1, currentEmail, newEmail, currentHashedEmail, newHashedEmail, emailChanged, hashedEmailChanged, newIdentities_1, error_1, enrichedAttributes, enrichedOptions, error_2;
var _this = this;
return __generator(this, function (_c) {
switch (_c.label) {
Expand All @@ -9784,19 +9784,34 @@ var mParticle = (function () {
this.currentUser = this.identityService.getCurrentUser();
currentUserIdentities_1 = ((_b = (_a = this.currentUser) === null || _a === void 0 ? void 0 : _a.getUserIdentities()) === null || _b === void 0 ? void 0 : _b.userIdentities) || {};
currentEmail = currentUserIdentities_1.email;
newEmail_1 = mappedAttributes.email;
if (!(newEmail_1 && (!currentEmail || currentEmail !== newEmail_1))) return [3 /*break*/, 5];
if (currentEmail && currentEmail !== newEmail_1) {
this.logger.warning("Email mismatch detected. Current email, ".concat(currentEmail, " differs from email passed to selectPlacements call, ").concat(newEmail_1, ". Proceeding to call identify with ").concat(newEmail_1, ". Please verify your implementation."));
newEmail = mappedAttributes.email;
currentHashedEmail = void 0;
newHashedEmail = void 0;
// Hashed email identity is valid if it is set to Other-Other10
if (this.mappedEmailShaIdentityType && IdentityType.getIdentityType(this.mappedEmailShaIdentityType) !== false) {
currentHashedEmail = currentUserIdentities_1[this.mappedEmailShaIdentityType];
newHashedEmail = mappedAttributes['emailsha256'] || mappedAttributes[this.mappedEmailShaIdentityType] || undefined;
}
emailChanged = this.hasIdentityChanged(currentEmail, newEmail);
hashedEmailChanged = this.hasIdentityChanged(currentHashedEmail, newHashedEmail);
newIdentities_1 = {};
if (emailChanged) {
newIdentities_1.email = newEmail;
if (newEmail) {
this.logger.warning("Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.");
}
}
if (hashedEmailChanged) {
newIdentities_1[this.mappedEmailShaIdentityType] = newHashedEmail;
this.logger.warning("emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.");
}
if (!!isEmpty(newIdentities_1)) return [3 /*break*/, 5];
_c.label = 2;
case 2:
_c.trys.push([2, 4,, 5]);
return [4 /*yield*/, new Promise(function (resolve, reject) {
_this.identityService.identify({
userIdentities: __assign(__assign({}, currentUserIdentities_1), {
email: newEmail_1
})
userIdentities: __assign(__assign({}, currentUserIdentities_1), newIdentities_1)
}, function () {
resolve();
});
Expand Down Expand Up @@ -9954,6 +9969,28 @@ var mParticle = (function () {
}
this.messageQueue["delete"](messageId);
};
/**
* Checks if an identity value has changed by comparing current and new values
*
* @param {string | undefined} currentValue - The current identity value
* @param {string | undefined} newValue - The new identity value to compare against
* @returns {boolean} True if the identity has changed (new value exists and differs from current), false otherwise
*/
RoktManager.prototype.hasIdentityChanged = function (currentValue, newValue) {
if (!newValue) {
return false;
}
if (!currentValue) {
return true; // New value exists but no current value
}

if (currentValue !== newValue) {
return true; // Values are different
}

return false; // Values are the same
};

return RoktManager;
}();

Expand Down Expand Up @@ -11400,12 +11437,6 @@ var mParticle = (function () {
this.setPosition = function (lat, lng) {
self.getInstance().setPosition(lat, lng);
};
this.startNewSession = function () {
self.getInstance().startNewSession();
};
this.endSession = function () {
self.getInstance().endSession();
};
this.logBaseEvent = function (event, eventOptions) {
self.getInstance().logBaseEvent(event, eventOptions);
};
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mparticle/web-sdk",
"version": "2.48.0",
"version": "2.50.0",
"description": "mParticle core SDK for web applications",
"license": "Apache-2.0",
"keywords": [
Expand Down Expand Up @@ -43,6 +43,8 @@
"test": "npm run build && npm run build:test-bundle && cross-env DEBUG=false karma start test/karma.config.js",
"test:browserstack": "karma start test/cross-browser-testing/browserstack.karma.config.js",
"test:browserstack:debug": "cross-env DEBUG=true karma start test/cross-browser-testing/browserstack.karma.config.js",
"test:browserstack-beta": "karma start test/cross-browser-testing/browserstack.karma.beta.config.js",
"test:browserstack-beta:debug": "cross-env DEBUG=true karma start test/cross-browser-testing/browserstack.karma.beta.config.js",
"test:debug": "cross-env DEBUG=true karma start test/karma.config.js",
"test:stub": "cross-env TESTTYPE=stub ENVIRONMENT=prod rollup --config rollup.test.config.js && karma start test/stub/karma.stub.config.js",
"test:integrations": "npm run test:requirejs && npm run test:integrations:cjs && npm run test:integrations:module",
Expand Down
6 changes: 1 addition & 5 deletions src/persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,11 +949,7 @@ export default function _Persistence(mpInstance) {
};

this.resetPersistence = function() {
removeLocalStorage(StorageNames.localStorageName);
removeLocalStorage(StorageNames.localStorageNameV3);
removeLocalStorage(StorageNames.localStorageNameV4);
removeLocalStorage(mpInstance._Store.storageName);
removeLocalStorage(StorageNames.localStorageProductsV4);
localStorage.clear();

self.expireCookies(StorageNames.cookieName);
self.expireCookies(StorageNames.cookieNameV2);
Expand Down
Loading
Loading