Page MenuHomePhabricator

[Spec] Web Experiments extension Popup window
Closed, ResolvedPublic0 Estimated Story Points

Description

Background

In T373983 we designed a popup window for the Web Experiments Browser Extension that seeks to inform users of the terms of service for this extension and satisfies legal requirements around this extension.

In general, a popup window in an browser extension that appears when clicking on the extension icon. Chrome Popup documentation.

User story

As an extension user, I want to be able to open the extension to understand how it's changing my user experience.

Requirements

Visual Design

  • Design should work in light and dark-mode
  • Design should utilize standard Codex components
  • Design should include the following links
    • link to privacy policy
    • Links to project pages for currently running experiments
    • Links to past experiments
Initial screen - when users haven't agreed to terms of service
image.png (6,124×1,886 px, 556 KB)
Success screen - non-wiki - IF user AGREES to ToS, button link to Wikipedia + list of current experiments
image.png (6,124×1,887 px, 492 KB)
Success screen - wiki - IF user AGREES to ToS AND current tab is Wikipedia, list current experiments
image.png (6,124×1,887 px, 483 KB)
Decline screen - IF user DISAGREES to ToS, ask them to uninstall
image.png (6,124×1,888 px, 664 KB)

Workflow

  • When user has installed browser extension
    • Set terms of service to false
    • Programmatically open initial screen
  • If a user agrees to ToS
    • and they're on Wikipedia, show them a popup with a button to visit Wikipedia
    • and they're not on Wikipedia, show them a popup with experiment information
  • If a user disagrees to ToS
    • Show them a popup stating we can't show them experiments, ask them to reconsider.
  • If a user dismisses ToS popup
    • Remind them by programmatically opening it 3 times

Screenshot 2024-10-18 at 12.29.14 PM.png (2,502×734 px, 243 KB)

Technical notes

State

As illustrated in the diagram above, the behaviour contains a few stateful and stateless parameters.

  1. ToS agreement - stateful - This requires using the chrome.storage() API to add a new key value pair that will persist as long as the extension is installed.
  2. Reminder - stateful - As above, this will require adding a counter to Chrome storage to track that we've reminded the user to agree to the ToS when they're on Wikipedia 3 times.
  3. Current page - stateless - This requires the activeTab permission as well as the chrome.tabs() API to get the current tab

Behaviour

As of Chrome 127, we can programmatically open the popup via the openPopup() method.

Architecture

The behaviour outlined in the diagram can fit into an MVC architecture

  • Model: the ToS and counter storage, as well as background script that contains a window.PostMessage handler to send & modify the values
  • Controller: A background script that retrieves the storage & current tab values and programmatically display the popup based on those values & increment counter.
  • View: An HTML pages with dynamically rendered content based on state. The page will need a call to window.postMessage to set the ToS option.

Event Timeline

Jdlrobson subscribed.

This task is for QA processes. We will pull it in when the specification has been implemented.

Jdrewniak set the point value for this task to 0.Nov 7 2024, 6:49 PM

task pointed 0 since it's intended as a story/epic specification

NBaca-WMF claimed this task.
NBaca-WMF subscribed.

QA was completed in the deploy task: https://phabricator.wikimedia.org/T378098