Repository navigation
♻️ [Core] Allow passing a session store factory to startSessionManager - #5130
BeltranBulbarellaDD wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Bundles Sizes Evolution
|
There was a problem hiding this comment.
More details
Existing callers retain default storage selection, while an unavailable injected store stops session startup without falling back to browser storage. The shared cookie store can disable legacy document.cookie reads for DOM-free adapters.
🤖 Bits Code Review · Commit 9b3faa3
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 9b3faa3 | Docs | View more details | Give us feedback! |
Motivation
Following the question about whether the custom / Shopify store could call
register: yes, the idea is for the Shopify SDK to own the registration and pass its store to browser-core.This PR contains the browser-core changes needed for that. The Shopify side lives in #5108.
Changes
Browser-core receives a third parameter in
startSessionManager:The Shopify SDK would call
register(startRegisteredWebPixel)and create the factory inside that callback:The important part is that
createShopifySessionStoreFactory(api.browser)lives in the Shopify SDK. Browser-core only receives the factory, so we don't need to putbrowser.cookiein the public initialization configuration.Existing callers keep the default store selection, and
sessionPersistencestays as it is. If the supplied factory cannot provide a store, the session manager doesn't start.This also exposes the cookie string builder and shared cookie session store so the Shopify adapter can reuse them. Legacy
document.cookielookup can be disabled for environments without a DOM, and the cookie availability check handles a factory that throws.Test instructions
Passed locally:
yarn lint,yarn typecheck,yarn format,yarn build, and 145 targeted unit tests covering cookie access, session storage, and the session manager.The added tests cover the injected store, unavailable storage without fallback, a throwing cookie-access factory, and disabling legacy cookie reads.
Checklist