| 1 |
<?php |
| 2 |
/** |
| 3 |
* AI-Studio module. |
| 4 |
* |
| 5 |
* "AI Studio" in the cloud sidebar — every site this account generated through |
| 6 |
* Templately AI, so a generation can be re-imported at any time instead of the |
| 7 |
* user having to keep its templately.com link, plus the credit balance and |
| 8 |
* usage history that sit alongside it. |
| 9 |
* |
| 10 |
* Ported from `latest`, where the endpoints lived as `includes/API/AiCredit.php` |
| 11 |
* and the screen as `profile/AiSites.js` + `profile/CreditsTab.js`. |
| 12 |
* |
| 13 |
* The LIST of generations is not here: it is |
| 14 |
* `ai-content/chatbot-conversations` in `modules/ai-fsi`, alongside the |
| 15 |
* single-conversation route it is the plural of, and this module reaches it by |
| 16 |
* URL rather than by importing that module. |
| 17 |
* |
| 18 |
* @package Templately |
| 19 |
*/ |
| 20 |
|
| 21 |
namespace Templately\Modules\AiStudio; |
| 22 |
|
| 23 |
use Templately\Core\Module_Base; |
| 24 |
use Templately\Modules\AiStudio\REST\AiCredit; |
| 25 |
|
| 26 |
class Module extends Module_Base { |
| 27 |
|
| 28 |
public function get_name(): string { |
| 29 |
return 'ai-studio'; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* NOTE: no `get_dependencies()` on ai-fsi or full-site-import. |
| 34 |
* |
| 35 |
* The screen's Import action dispatches `triggerFSIHandleClick` and mounts a |
| 36 |
* headless `FullSiteImport`, which are JS-side imports resolved through the |
| 37 |
* single first-party bundle graph — not a PHP boot-order edge. The endpoint |
| 38 |
* it reads is reached by route string. Declaring a dependency here would |
| 39 |
* assert an ordering constraint that does not exist, and this module boots |
| 40 |
* fine with either of those absent. |
| 41 |
*/ |
| 42 |
public function register_rest_routes(): void { |
| 43 |
AiCredit::get_instance()->register_routes(); |
| 44 |
} |
| 45 |
} |
| 46 |
|