Skip to content

Enable configuration of intro flows per level#71424

Open
molly-moen wants to merge 20 commits intostagingfrom
molly/lb-intro-flows
Open

Enable configuration of intro flows per level#71424
molly-moen wants to merge 20 commits intostagingfrom
molly/lb-intro-flows

Conversation

@molly-moen
Copy link
Contributor

@molly-moen molly-moen commented Mar 17, 2026

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:

  • New level editing setup. As of now only python lab and web lab 2 have intro flow configuration enabled, as those were the only labs using the resource panel onboarding and validation flows.
  • Consolidated configuration of intro flows (productToursPerLab.ts). Additional lab2 intro flows should have a configuration added to this file.
  • Consolidated logic for showing flows. Previously the logic for showing onboarding and validation was spread among multiple files, now it's entirely in useResourcePanelShepherdTours.
  • Unit tests for useResourcePanelShepherdTours and productToursPerLab

Per 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

Screenshot 2026-03-18 at 11 05 03 AM

Web Lab 2

Screenshot 2026-03-18 at 11 05 20 AM

Links

Testing story

Tested locally and with unit tests.

This comment was marked as duplicate.

This comment was marked as duplicate.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@molly-moen molly-moen marked this pull request as ready for review March 18, 2026 18:06
@molly-moen molly-moen requested review from a team March 18, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants