Bug 1840156 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

We don't yet have guidance on the toolbar button / page action button, how it will look, where it will live (page action vs toolbar button), or how it will behave.

This is a placeholder bug to hold the final decision from UX when available.
This bug covers creating a shopping page action button.

If the shopping experience is enabled, that is, `browser.shopping.experience2023.enabled` is true, then this button should appear in the URLBar when the user visits a supported product page.

If the shopping experience is disabled, that is, `browser.shopping.experience2023.enabled` is false, we don't want to show the page action button at all.

There is a pref that tells us whether a user has opted in or out of the experience, `browser.shopping.experience2023.optedIn`. (Note this is different from the `browser.shopping.experience2023.enabled` pref, which simply puts a user in the experimental population that might be shown the experience.)

If the `browser.shopping.experience2023.optedIn` pref value is false, then when the user visits a supported shopping page, we want to display the shopping page action button in an inactive state. (The sidebar will not pop open automatically in this case.)

If the `browser.shopping.experience2023.optedIn` pref value is true, then when the user visits a supported product page, the page action button will be shown in an active state, and the sidebar will appear.

Whenever the user clicks the page action button, the `browser.shopping.experience2023.optedIn` pref value should be flipped (note, this behavior may change in the next few days), and the button should toggle between active/inactive states.

Figma designs: https://www.figma.com/file/Wu4kaHSfKSQnzkym7qek3R/Shopping-Experience-MVP?type=design&node-id=67-23327&mode=design&t=VvOstFKWe7hwylJc-4

To notify your button component when the user arrives on a product page, you can make a call directly from either branch of the `if (this._isProductPage)` conditional [here](https://searchfox.org/mozilla-central/rev/f29deb388a7675b93f040b0e89a37822cdbd8d58/browser/base/content/browser.js#9991), inside the onLocationChange listener.

Explicit non-goals for this bug:
* we don't yet have a final icon, so don't spend too much time styling the placeholder shopping cart svg; flipping a color is enough.
* after the page action button is clicked, the sidebar toggling behavior is still not fully signed off, but flipping the pref is a good enough guess for now.

Implementation notes:

To notify your button component when the user arrives on a product page, you can make a call directly from either branch of the `if (this._isProductPage)` conditional [here](https://searchfox.org/mozilla-central/rev/f29deb388a7675b93f040b0e89a37822cdbd8d58/browser/base/content/browser.js#9991).

I would guess Gijs is the right person to review patches, as he's familiar with toolbar button code (I'm not sure if anyone else on the team is).

Back to Bug 1840156 Comment 0