Skip to content

feat(rokt): send the current mParticle session id as a selectPlacements attribute - #1324

Closed
jamesnrokt wants to merge 47 commits into
mainfrom
feature/rokt-kit-mparticle-session-attribute
Closed

jamesnrokt wants to merge 47 commits into
mainfrom
feature/rokt-kit-mparticle-session-attribute

Conversation

@jamesnrokt

@jamesnrokt jamesnrokt commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Applies the same change as mparticle-integrations/mparticle-javascript-integration-rokt#116 to the in-repo copy of the Rokt kit, so the two do not drift while the monorepo migration is in progress.

The kit read the mParticle session id once, when creating the launcher, and passed it through as the mpSessionId launcher option. That option is no longer used, and reading the value at launcher-creation time meant it went stale for the life of the page: mParticle mints a new session id on inactivity timeout (sessionTimeout, 30 minutes by default), when another tab starts a new session, and after an explicit endSession() / startNewSession(). None of that reached the launcher.

This PR:

  • Sends the session id as the mparticle_session_id attribute on each selectPlacements call. Because it is read per call, a rotated session is reflected on the next call.
  • Removes the mpSessionId launcher option from attachLauncher.
  • Adds readMpSessionId(), which reads SessionManager.getSessionId() if the facade exposes it and otherwise falls back to getSession().

Review follow-ups applied:

  • Reinstated the getSession() fallback. An earlier revision dropped it on the assumption that getSessionId() was available from core v2.23.3; that is true of the internal _SessionManager but not of the public mParticle.sessionManager facade, which exposes only getSession() in every published core through 2.78.0:

    // mparticle-instance-manager.ts
    this.sessionManager = {
        getSession: function() {
            return self.getInstance()._SessionManager.getSessionId();
        },
    };

    Dropping the fallback made the attribute silently absent — isFunction(undefined) is false, so readMpSessionId() always returned undefined. Confirmed in production against the standalone kit 1.33.0 on core 2.78.0, where the attribute was absent from all 79,987 wsdk events in a sampled window. The public getSession() is not deprecated and emits no warning: it calls _SessionManager.getSessionId() directly, bypassing the deprecated internal _SessionManager.getSession(). Only the internal method carries @deprecated and logDeprecatedMethodUsage.

  • Widened the sessionManager interface back to accept both accessors. It had been narrowed to an optional getSessionId?(), so TypeScript could not catch the absence.

  • Added an isFunction helper and used it for all five typeof x === 'function' checks in the kit rather than leaving the new one inconsistent with the rest.

Testing Plan

  • kits/rokt: 237/237 tests pass; vite build clean.

  • New unit tests cover: the session id current at the time of each call (asserted across a rotation between two calls), the attribute being omitted when sessionManager is unavailable, a facade exposing only getSession (the real shape) yielding the attribute, getSessionId being preferred when both are present, the attribute being omitted when neither accessor exists, and createLauncher no longer receiving mpSessionId.

  • 35 existing full-payload toEqual assertions were updated, since the attribute is present on every call. The #selectPlacements beforeEach now pins a known sessionManager; previously these tests depended on an earlier test deleting window.mParticle.sessionManager without restoring it, which made results order-dependent.

  • Test fixtures in test/vitest.setup.ts and tests.spec.ts use getSession, matching the real public facade. An earlier revision moved them to getSessionId, which is why the suite went green against a facade that does not exist.

  • kits/rokt/dist is intentionally not included. Note this copy has no src/utils.ts, so isFunction sits with the existing module-level helpers rather than in a utils module.

  • kits/rokt has 7,771 pre-existing prettier/prettier lint errors on a pristine tree (an indentation-width mismatch across all four files). This PR does not change that count materially and does not attempt to reformat the kit.

  • Additional testing worth doing: confirm on a long-lived page that a session which times out is reflected on the next selectPlacements call, and that the offers request body carries attributes.mparticle_session_id.

  • Note for reviewers running tests locally: kits/rokt uses vitest 4, which needs Node 22. On Node 20 it fails with bad option: --no-experimental-webstorage.

nickolas-dimitrakas and others added 30 commits August 6, 2026 10:20
* feat: migrate amplitude

* formatting

* added job to build and run kit tests

* align pull request workflow

* slight pull request needs adjustments

* add kits to release process

* add homepage url

* Revert "slight pull request needs adjustments"

This reverts commit aaf8416.

* reuse mockhttprequest from root

* address @alexs-mparticle comments

* add mparticle core dependency

* only use root .gitignore

* use root prettier

* inherit from root eslintrc

* cleanup kit directory readme

* restore original readme

* peerDependency already states mP Core

* cleanup matrix

* update to kit track package name

* adjust semantic release to update kit versions in lock step

* pass proper commit sha

* unique artifact names and align jest matrix

* add cleanup step for deleting release branch

* publish kits upon success of core and fix issues in implementation

* Configure dependabot for amplitude kit track

* Update kits/README.md

Co-authored-by: Robert Ing <rmi22186@gmail.com>

* run format to fix ci

* add canonical repo chart in readme

* addressed @rmi22186 comments

---------

Co-authored-by: Robert Ing <rmi22186@gmail.com>
* feat: migrate OneTrust kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to onetrust kit

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Intercom kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to intercom kit

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Optimizely kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to optimizely kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Criteo kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to criteo kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate SimpleReach kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to simplereach kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Dynamic Yield kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to dynamic-yield kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Google Tag Manager kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to google-tag-manager kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Rokt kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to rokt kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Heap kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to heap kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Inspectlet kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to inspectlet kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate KissMetrics kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to kissmetrics kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate DoubleClick kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to doubleclick kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Adwords kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to adwords kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Facebook kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to facebook kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Taplytics kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to taplytics kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Bing Ads kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to bingads kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Adobe Target kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to adobe-target kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Twitter kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to twitter kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate Device Match kit to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): apply prettier formatting to device-match kit

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-localytics-4 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-id5-1 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-leanplum-1 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-mixpanel-2 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-braze-3 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-braze-4 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate mparticle-javascript-integration-braze-5 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate adobe kit to monorepo

Migrates mparticle-javascript-integration-adobe into the web SDK
monorepo under kits/adobe/.

The Adobe kit uses a repo-level build and test orchestration — the
root rollup.config.js concatenates AdobeSDKs vendor files with each
package's source before bundling, and tests run from the root using
Jest with MODULE env vars. The full repo structure is preserved under
kits/adobe/ to keep this working correctly.

Structure:
- kits/adobe/packages/AdobeClient  (@mparticle/web-adobe-client-kit v2.1.3)
- kits/adobe/packages/AdobeServer  (@mparticle/web-adobe-server-kit v2.1.2)
- kits/adobe/HeartbeatKit
- kits/adobe/AdobeSDKs             (VisitorAPI.js, AppMeasurement.js)
- kits/adobe/test                  (Jest tests for client + server)
- Updated package.json repository field to point to monorepo
- Added kits/adobe to kits/matrix.json for CI coverage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): exclude adobe vendor files from prettier and kit tests from jest

- Add kits/adobe/AdobeSDKs/ and babel.config.js to .prettierignore to
  exclude third-party vendor files from formatting checks
- Add testPathIgnorePatterns to jest.config.js to prevent root jest
  runner from picking up kit test files (kits use karma, not jest)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): create dist directories before build in adobe kit

Fresh git checkouts don't include empty dist/ directories (git doesn't
track empty directories and .gitignore excludes dist/). Add mkdir -p to
the build:client:* and build:server:* scripts so the build succeeds
in a clean CI environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): add missing suffix to adobe server kit test config

Server kit registers with suffix 'Server' creating key 'Adobe-Server'
in mParticle's forwarder constructors map. Without suffix: 'Server' in
the test kitConfig, configureUIEnabledKit cannot match the constructor
and initForwarder is never called, causing all integration tests to fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(jest): narrow testPathIgnorePatterns to kits/adobe only

Previously excluded all kits/ which was overly broad. Only the Adobe
kit uses Jest (with test.js / server.test.js filenames that match
Jest's default testMatch). Other kits use Karma and name their files
tests.js (plural), so they don't need an explicit exclusion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(jest): remove redundant node_modules from testPathIgnorePatterns

Jest ignores node_modules by default; the explicit entry was unnecessary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(adobe): align prettier config with root, add eslintrc root flag

- Remove kits/adobe/.prettierrc so Adobe inherits root prettier settings.
  Only difference was trailingComma: "none" vs root's "es5"; Adobe source
  files reformatted accordingly (trailing commas added, no logic changes).
- Update .prettierignore: remove kits/adobe/babel.config.js (no longer
  needed once trailing comma conflict is resolved); keep AdobeSDKs/ vendor
  exclusion.
- Add "root": true to kits/adobe/.eslintrc to prevent ESLint from walking
  up to root config when run from within the kit directory.

Part of ongoing effort to consolidate all configs at the repo root.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate google-analytics-4 kit to monorepo

Migrates GA4Client and GA4Server packages from
mparticle-javascript-integration-google-analytics-4 into the web SDK
monorepo under kits/google-analytics-4/.

- kits/google-analytics-4/ga4-client (@mparticle/web-google-analytics-4-client-kit v1.5.1)
- kits/google-analytics-4/ga4-server (@mparticle/web-google-analytics-4-server-kit v1.0.3)
- Updated package.json repository fields to point to monorepo
- Added both kits to kits/matrix.json for CI coverage
- Applied Prettier formatting to match monorepo code style conventions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): add missing karma devDependencies to ga4-server

The test script calls karma but karma was missing from devDependencies.
Add karma and browser launcher packages to match the ga4-client kit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): regenerate ga4-server package-lock.json with karma deps

Updating package-lock.json to include karma and browser launcher
packages added in the previous commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): pin chai to v4 for karma-chai compatibility in ga4-server

karma-chai@0.1.0 requires chai v4's browser bundle at chai/chai.js.
chai v6 changed its file structure, breaking that path. Pinning
chai to ^4.2.0 restores the expected bundle location.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ga4): restore correct kit structure and consolidate matrix entry

The original mparticle-javascript-integration-google-analytics-4 repo
used a packages/GA4Client + packages/GA4Server layout with a root
package.json orchestrator. The migration commit incorrectly flattened
this to ga4-client/ and ga4-server/ at the top level and omitted the
root package.json.

This commit:
- Moves ga4-client/ → packages/GA4Client/ (git mv, history preserved)
- Moves ga4-server/ → packages/GA4Server/ (git mv, history preserved)
- Updates repository.directory in each sub-kit's package.json
- Adds root package.json with build/test scripts that delegate to each
  sub-package via npm --prefix
- Adds root package-lock.json (no root deps; required for npm ci)
- Collapses the two matrix entries into a single "Google Analytics 4"
  entry pointing to kits/google-analytics-4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ga4): add missing root config files omitted from migration

Restores the root-level config files that existed in the original
mparticle-integrations/mparticle-javascript-integration-google-analytics-4
repo but were not included in the monorepo migration:

- .eslintrc  — eslint + prettier config (root: true)
- .gitignore — ignores node_modules
- .prettierrc — singleQuote, trailingComma: es5, tabWidth: 4
- README.md  — usage docs for both client and server kits

Also updates package.json description to match the original.
The .github/workflows/ are omitted as the monorepo has its own CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(matrix): update kit matrix with all migrated kits and braze-6

Merges workstation/3.0-Release and adds all 28 kits to matrix.json:
- Braze 3/4/5 (merged), Braze 6 (open PR)
- Adobe Target, Adwords, Amplitude 8, Bing Ads
- Criteo, Device Match, DoubleClick, Dynamic Yield
- Facebook, Google Tag Manager, Heap, ID5 1
- Inspectlet, Intercom, KissMetrics, Leanplum 1
- Localytics 4, Mixpanel 2, OneTrust, Optimizely
- Rokt, SimpleReach, Taplytics, Twitter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: correct iife filename typo in KissMetrics rollup config

Fixes output filename from KissMetricsForwarder.iffe.js to
KissMetricsForwarder.iife.js.

Made-with: Cursor

* remove dist from root gitignore

* Revert "remove dist from root gitignore"

This reverts commit 2b12aca.

* chore(matrix): remove braze-6 until PR #1194 merges

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
khushi1033 and others added 13 commits August 6, 2026 10:20
* feat: migrate mparticle-javascript-integration-braze-6 to monorepo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(ci): update braze-6 package-lock.json to resolve @braze/web-sdk@6.5.0

Lock file was out of sync — still pinned to 5.5.0 while package.json
requires ^6.0.0. Regenerated with npm install --package-lock-only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: revert matrix.json to base branch (will re-add kit entry separately)

* chore(matrix): add braze-6 to kit matrix

* fix(braze-6): update bundle name and suffix from v5 to v6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…1314)

* breaking: remove deprecated logCheckout, logPurchase, and logRefund methods

These deprecated eCommerce methods have been removed in favor of
logProductAction which provides the same functionality with a more
flexible API. Users should migrate to logProductAction with the
appropriate ProductActionType (Checkout, Purchase, Refund).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add equivalent tests using logProductAction for removed deprecated methods

Adds tests that replace removed logCheckout/logPurchase/logRefund tests
with equivalent coverage using logProductAction:
- Full DTO validation for purchase and refund events
- Badly formed ecommerce input sanitization
- Array of products support for purchase and refund
- Product position null handling
- Expand commerce events with/without summary total (plus-one)
- CustomFlags for checkout, purchase, and refund actions
- Native SDK bridge product list serialization (Android + iOS)
- Clarified expand test names with plus-one context comments

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* breaking: remove deprecated cart API

The cart API has been deprecated for a long time and only logged
deprecation warnings. This removes it entirely.

Removed public APIs:
- mParticle.eCommerce.Cart.add/remove/clear
- mParticle.Identity.getCurrentUser().getCart()
- mParticle.Identity.getCurrentUser().getCart().add/remove/clear/getCartProducts

Also removed:
- SDKCart, ICart, SDKShoppingCart, mParticleUserCart interfaces
- ShoppingCart from SDK event model and server DTO conversion
- convertShoppingCart from events API converter
- NativeSdkPaths for AddToCart/RemoveFromCart/ClearCart
- maxProducts config option
- Cart product storage name constants

Users should use mParticle.eCommerce.logProductAction() with
ProductActionType.AddToCart or ProductActionType.RemoveFromCart instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: remove dead buildProductList and clean up leftover cart test code

- Remove buildProductList from ecommerce.js and its interface (no
  remaining callers after logPurchaseEvent/logRefundEvent removal)
- Remove empty "should return an empty array when no cart products
  exist" test that had no assertions
- Remove orphaned product1/checkProduct code in stub tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: keep deprecated logPurchase while removing unused commerce APIs

Datadog shows mParticle.logPurchase is still reported in production, so
retain it while removing logCheckout, logRefund, and the cart API.

* docs: clarify logPurchase deprecation replacement

Point JSDoc @deprecated and runtime warning at logProductAction with
ProductActionType.Purchase so IDEs and console logs show the migration path.

* fix: restore event interface method ordering

Keep logPromotionEvent in its original position while retaining the intended deprecated commerce API removals.

* test: restore checkout expansion attribute coverage

* test: retain logPurchase public API coverage

Keep the retained deprecated method in the exact API key assertion and exercise its stub so tests match the intended public surface.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* breaking: remove deprecated removeCCPAState method

Remove the deprecated `removeCCPAState` method and associated code/tests.
Users should use `removeCCPAConsentState` instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: remove redundant IConsentState interface

IConsentState was an empty extension of ConsentState that added no
properties. Replace usages with ConsentState directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: remove unnecessary cast in createConsentState

The TODO indicated this cast should be removed once removeCCPAState was
removed. Since removeCCPAState is being removed in this PR, the cast is
no longer needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: remove unused deprecatedMethodLogger import from consent

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: contain cookie sync pixel errors so public API calls cannot throw

* test: skip window.screen delete test on EdgeHTML and restore screen safely

* ci: add BrowserStack job timeout, run concurrency, and karma capture timeouts

* test: raise waitForCondition and BrowserStack mocha timeouts to deflake slow VMs

* ci: pin BrowserStack sessions to the workflow tunnel via local identifier

* test: wait for in-flight identify before retrying failed-config core SDK spec

Firefox 51 on BrowserStack timed out because init's 400 identify was still
in flight when the spec issued a second identify. Raise mocha timeout so
several waitForCondition polls fit in one spec.

* ci: share BrowserStack concurrency group across push and pull_request

github.ref differs for those events, so the previous group still allowed
two matrices for the same branch to contend for BrowserStack sessions.

* style: shorten BrowserStack and EdgeHTML comments to 1-2 lines

* fix(ci): use karma-browserstack-launcher localIdentifier key

The dotted browserstack.localIdentifier key is ignored by the launcher,
so CI sessions were not pinned to the workflow tunnel.

* ci: drop legacy EdgeHTML 15 from the BrowserStack matrix

Edge 15–18 is ~0.02% share. Keep Chromium Edge in the beta workflow.

* test: wait for all instance cookies in multi-instance BrowserStack spec

Firefox 153 on Windows failed because the spec only waited on the default
instance. Cap the beta workflow at 30 minutes and pin its tunnel.

* refactor(ci): share BrowserStack karma settings to clear sonar duplication

* revert: drop EdgeHTML source and test workarounds after removing Edge 15
…ts attribute

The kit read the mParticle session id once, when creating the launcher, and
passed it through as the mpSessionId launcher option, which is no longer used.

Send it as the mparticle_session_id attribute on each selectPlacements call
instead. Reading it per call means a session that has rotated — on inactivity
timeout, when another tab starts a new session, or after an explicit
endSession() — is reflected on the next call, rather than being pinned to
whatever was current when the launcher was created.

Prefer SessionManager.getSessionId() over the deprecated getSession(), falling
back only for core SDK versions that predate it. getSession() logs a
deprecation warning and reports MP_DEPRECATED_METHOD_USAGE, so every launcher
creation was emitting one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jamesnrokt
jamesnrokt requested a review from a team as a code owner August 17, 2026 15:41
@jamesnrokt
jamesnrokt changed the base branch from master to main August 17, 2026 15:42
Calls mp() once instead of twice and reads more directly. No behaviour change:
mp() returns window.mParticle, which may be undefined, and the following guard
handles that case either way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes the integration contract for Rokt (attribute vs launcher option) and touches the hot selectPlacements path; behavior is well-covered by tests but partners consuming the old launcher field need to migrate.

Overview
Moves the mParticle session id from launcher creation to every selectPlacements call, so rotated sessions (timeout, new tab, endSession / startNewSession) show up on the next placement instead of staying stuck at the value read when the launcher was created.

  • Removes passing mpSessionId into createLauncher / createLocalLauncher in attachLauncher.
  • Adds mparticle_session_id to the merged selectPlacements attributes when a session id is available, via new readMpSessionId() (prefers sessionManager.getSessionId, falls back to getSession).
  • Introduces shared isFunction and uses it for callable checks (launcher readiness, integration attributes, local session attributes, test helper export).

Tests now assert the attribute on placement payloads (not on launcher options), cover rotation between calls and missing session APIs, and pin sessionManager in selectPlacements setup for stable ordering.

Reviewed by Cursor Bugbot for commit 3125de4. Bugbot is set up for automated code reviews on this repo. Configure here.

…Function util

The kit requires @mparticle/web-sdk ^2.62.0 and getSessionId() has shipped
since v2.23.3, so the getSession() fallback was unreachable for every
supported core version. Removing it also removes the last caller of a
deprecated method.

Adds an isFunction helper and uses it for all five typeof-function checks in
the kit, rather than leaving the new one inconsistent with the rest. The
standalone kit repo keeps this in src/utils.ts; this copy has no utils module,
so it sits with the existing module-level helpers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d11c9e1. Configure here.

Comment thread kits/rokt/src/Rokt-Kit.ts
jamesnrokt and others added 2 commits August 17, 2026 14:10
This copy has no utils module or utils spec, so isFunction is exposed through
testHelpers alongside the other module-level helpers and covered in the kit
spec.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…er facade

readMpSessionId called mParticle.sessionManager.getSessionId(), which does not
exist. The public facade exposes only getSession(); getSessionId() lives on the
internal _SessionManager and has never been re-exported. Verified against the
published bundles for core 2.62.0, 2.75.1 and 2.78.0 — all identical.

isFunction(undefined) was therefore always false, readMpSessionId always
returned undefined, and mparticle_session_id was never added to the
selectPlacements attributes. Confirmed in production against the standalone
kit 1.33.0 on core 2.78.0, where the attribute was absent from all 79,987 wsdk
events in a sampled window.

Read getSessionId if the facade exposes it and fall back to getSession, so this
works on every supported core and picks up the non-deprecated name if one is
ever added. An earlier revision of this branch dropped that fallback on the
assumption that getSessionId() was public from v2.23.3; that holds for the
internal _SessionManager but not for the public facade.

The public getSession() is not deprecated and emits no warning: it calls
_SessionManager.getSessionId() directly, bypassing the deprecated internal
_SessionManager.getSession(). Widen the interface back to accept both
accessors — it had been narrowed to an optional getSessionId, so TypeScript
could not catch the absence.

Move the test fixtures back to getSession so the suite exercises the real
facade shape, and add coverage for the getSession-only shape, getSessionId
preference, and the neither-accessor case.

Mirrors mparticle-integrations/mparticle-javascript-integration-rokt#117.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@crisryantan

Copy link
Copy Markdown
Contributor

Closing: this change shipped upstream in the standalone kit repo as mparticle-integrations/mparticle-javascript-integration-rokt#116 (released in kit 1.33.0) and was then corrected upstream by #117, which reads the session id from the public sessionManager facade instead. Both are now in main via the v1.35.0 sync (#1365), so merging this PR would reapply the uncorrected version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants