Enable configuration of intro flows per level#71424
Open
molly-moen wants to merge 20 commits intostagingfrom
Open
Enable configuration of intro flows per level#71424molly-moen wants to merge 20 commits intostagingfrom
molly-moen wants to merge 20 commits intostagingfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds per-level configuration for Lab2 “intro flows” (product tours) by introducing a product_tours level property, wiring it into the level editor UI, and updating client-side tour gating logic to respect the per-level setting.
Changes:
- Add a level editor section (“Product Tour Settings”) that saves selected tours into
level[product_tours]. - Add shared product-tour configuration/gating (
ToursPerLab,isTourEnabledOnLevel) and update Resource Panel + Sketchlab tours to use it. - Add unit tests for the new gating logic and Resource Panel tour behavior.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dashboard/app/views/levels/editors/fields/_product_tour_settings.html.haml | New level editor UI section that mounts React editor and passes initial settings/app name via script data. |
| dashboard/app/views/levels/editors/_weblab2.html.haml | Adds the new Product Tour Settings editor section to Web Lab 2 levels. |
| dashboard/app/views/levels/editors/_pythonlab.html.haml | Adds the new Product Tour Settings editor section to Python Lab levels. |
| dashboard/app/models/levels/level.rb | Adds product_tours to serialized properties so it’s permitted and persisted. |
| dashboard/app/controllers/levels_controller.rb | Parses product_tours JSON param into a first-order properties member on save. |
| apps/webpackEntryPoints.js | Registers the new level editor webpack entrypoint. |
| apps/src/sites/studio/pages/levels/editors/fields/_product_tour_settings.js | Mounts the React-based Product Tour Settings editor in levelbuilder. |
| apps/src/lab2/productTours/productToursPerLab.ts | Defines tour IDs/config per lab + the core isTourEnabledOnLevel gating helper. |
| apps/src/lab2/productTours/useResourcePanelShepherdTours.ts | Updates Resource Panel tour gating to depend on per-level productTours. |
| apps/src/lab2/productTours/onboardingTourShepherdSteps.ts | Adds Shepherd steps for the Resource Panel onboarding tour. |
| apps/src/lab2/productTours/validationTourShepherdSteps.ts | Adds Shepherd steps for the Resource Panel validation tour. |
| apps/src/lab2/views/components/Instructions/ResourcePanel/index.tsx | Removes boolean tour props and sources tour eligibility from level properties. |
| apps/src/lab2/types.ts | Adds productTours?: string[] to LevelProperties. |
| apps/src/sketchlab/useSketchlabShepherdTour.ts | Gates Sketchlab tour availability via isTourEnabledOnLevel. |
| apps/src/sketchlab/SketchlabView.tsx | Passes levelProperties.productTours into the Sketchlab tour hook. |
| apps/src/codebridge/InfoPanel/InfoPanel.tsx | Removes now-deleted ResourcePanel tour flag props. |
| apps/test/unit/lab2/productTours/productToursPerLabTest.ts | Unit tests for isTourEnabledOnLevel. |
| apps/test/unit/lab2/productTours/useResourcePanelShepherdToursTest.ts | Unit tests covering Resource Panel tour availability + analytics callbacks. |
| apps/src/lab2/levelEditors/productTourSettings/EditProductTourSettings.tsx | React editor UI for selecting level-triggered tours and writing hidden field payload. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows levelbuilders to set which intro flows are available on a given level. Each lab has a set of intro flows that it can show. Some intro flows will not be available for levelbuilders to trigger, because they will be shown the first time a user encounters them (for example, Sketch Lab onboarding). When an intro flow is available on a level, we will only show it to the user if all other requirements to show it are met; all intro flows will only be shown once per user, per browser, and some flows have additional requirements (such as validation requiring that validation exists on the level).
This PR includes:
productToursPerLab.ts). Additional lab2 intro flows should have a configuration added to this file.useResourcePanelShepherdTours.useResourcePanelShepherdToursandproductToursPerLabPer request from product/curriculum, it is by design that now the onboarding and validation flows will not show up by default. They will need to be turned on by curriculum after this PR goes in.
Note: a lot of lines of this PR are tests!
Editing screenshots
Python Lab
Web Lab 2
Links
Testing story
Tested locally and with unit tests.