| 1 |
<?php |
| 2 |
/** |
| 3 |
* Library tour module (spec 036-library-tour). |
| 4 |
* |
| 5 |
* Relocated: includes/API/Tour.php (the REST controller — 3 endpoints: |
| 6 |
* GET tour/status, POST tour/complete, POST tour/reset) + |
| 7 |
* react-src/app/components/new-components/tour/ (9-file React component |
| 8 |
* tree: LibraryTour, DetailTour, TourTooltip, TourContext, TourMenuItem, |
| 9 |
* TourShortcutListener, useTourShortcut, tourSteps, index barrel). |
| 10 |
* Namespace: Templately\API\Tour -> Templately\Modules\LibraryTour\REST\Tour. |
| 11 |
* |
| 12 |
* No boot-ordering fix needed: Tour::get_instance() was eagerly instantiated |
| 13 |
* in Plugin::apis() (during plugins_loaded) purely to self-register into the |
| 14 |
* platform-adapter Platform_Registry::add($this, 'API') registry — a registration that |
| 15 |
* Plugin::register_routes() already skips for any Templately\Modules\* class |
| 16 |
* (see that method's own skip-comment). The eager call was simply removed; |
| 17 |
* this module's register_rest_routes() wires the real route registration on |
| 18 |
* rest_api_init via Module_Base::boot_rest_routes(), the same lazy pattern |
| 19 |
* every module-owned REST class uses (013-035) — no autoloader-timing hazard |
| 20 |
* for a class only ever resolved at rest_api_init. |
| 21 |
* |
| 22 |
* JS ships inside the main bundle (LibraryTour/DetailTour/TourMenuItem/ |
| 23 |
* TourProvider/TourShortcutListener are all statically imported from |
| 24 |
* App.js, NewItemDetails.js, UserNavigation.js, and |
| 25 |
* modules/template-browsing's TemplatesTypeLayout.js — not a lazy module |
| 26 |
* route), matching the established precedent from specs 034/035 for |
| 27 |
* main-bundle features: no webpack.config.partial.js, no attachReducer/ |
| 28 |
* runSaga (this feature has no Redux state at all — TourContext is a plain |
| 29 |
* React context). |
| 30 |
* |
| 31 |
* @package Templately |
| 32 |
*/ |
| 33 |
|
| 34 |
namespace Templately\Modules\LibraryTour; |
| 35 |
|
| 36 |
use Templately\Core\Module_Base; |
| 37 |
use Templately\Modules\LibraryTour\REST\Tour; |
| 38 |
|
| 39 |
class Module extends Module_Base { |
| 40 |
|
| 41 |
public function get_name(): string { |
| 42 |
return 'library-tour'; |
| 43 |
} |
| 44 |
|
| 45 |
public function register_rest_routes(): void { |
| 46 |
Tour::get_instance()->register_routes(); |
| 47 |
} |
| 48 |
} |
| 49 |
|