== User story
As an advanced contributor, I would like to know when my workflows can be simplified
== Designs
| taps on Talk (or History, Desktop, etc.) | page transitions, drawer appears, taps on "Enable..." | advanced mode enabled, toast displays
| {F29605075} | {F29605482} | {F29605385}
This flow needs to be discussed with engineering. The main questions are:
# is it possible to limit the amount of times we show these to people? I think the ideal logic would be that it happens the first time you tap any of the given button/hooks. Example: you tap "Talk" (for the first time since this has been enabled), the drawer appears, you press "No thanks". Next time you tap "Talk" the drawer would not appear, however if you tapped "History" it would.
# is it possible to turn the setting on without going to the settings page?
- If so, can we have a custom toast message, (e.g. "Advanced contributions mode is now enabled. You can turn it off in your settings.") rather than the generic "Settings were saved." message.?
# should the drawer/dialog should appear before or after the page transitions to the intended destination (e.g. the Talk or History page)? We discussed at our offsite that appearing after you've arrived at your destination might be less intrusive/disruptive, however if we can ensure that it will only appear once it might be more effective if it appears before the page transitions (in the case of a user tapping on the "Desktop" link this would be necessary).
- is it possible to show this drawer without dimming the screen and blocking other clicks? More like an optional little panel than a blocking dialog/modal.
== Acceptance Criteria
[] Display toast/modal when user performs any of the following actions on the mobile site: selecting talk link at the bottom of the page, selecting the history page link, selecting the desktop link
[] Toast/modal must only display once
[] Selecting "try it out" will turn on AMC (without requiring user to go to the settings page)
[] Desktop link:
- Selecting "try it out" will turn on AMC. It will not open the desktop version of the site
- Selecting "no thanks" will turn on the desktop version of the site (nice to have: we still show the toast that says where you can try it out)
[] Talk link:
- Selecting "try it out" will turn on AMC. It will then load the talk modal
- Selecting "no thanks" will load the talk modal
[] History link:
- Selecting "try it out" will turn on AMC. It will then load the AMC history page
- Selecting "no thanks" will load the mobile history page
== Open questions
- We currently lazy load the drawer. When the user selects a link and is eligible to see the drawer, what should we do while the drawer is loading?
- Do nothing?
- Show the drawer immediately and make use of the [[ https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/src/mobile.startup/promisedView.js | promisedView ]] pattern?
- Remove the lazy loading and eager load the drawer (will add to the initial JS payload)
== Dev notes
[[ https://phabricator.wikimedia.org/T226069#5380969 | Some questions remain ]] about what actions should trigger the outreach drawer, but the general outline needed to complete this ticket will probably look something like this:
1) Add new action(s) to [[ https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/e3646c15466db8755cdaa5f7cbc5fae511abf4d9/src/mobile.startup/amcOutreach/amcOutreach.js#L10-L12 | ACTIONS object ]] in `mobile.startup/amcOutreach/amcOutreach.js`. The `onLoad` action has already been added here. It can be anything, but make sure the key and value are the same.
2) Export `mobile.startup/amcOutreach/amcOutreach.js` in `mobile.startup.js` so that Minerva can access it
3) When something triggers an action in Minerva (e.g. talk overlay shows), the following code will be needed:
```
var mobile = M.require( 'mobile.startup' );
var promoCampaign = mobile.amcOutreach.loadCampaign();
promoCampaign.showIfEligible( mobile.amcOutreach.ACTIONS.whateverNewAction );
```
You can check out the [[ https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/e3646c15466db8755cdaa5f7cbc5fae511abf4d9/src/mobile.init/mobile.init.js#L140-L141 | `onLoad` action in mobile.init ]] as an example.