| 1 |
# Introductions |
| 2 |
|
| 3 |
Is for showing introductions to a user, on Yoast admin pages. |
| 4 |
Based on plugin version, page, user capabilities and whether the user has seen it already. |
| 5 |
|
| 6 |
- `Introduction_Interface` defines what data is needed |
| 7 |
- `id` as unique identifier |
| 8 |
- `plugin` and `version` to determine if the introduction is new (version > plugin version) |
| 9 |
- `pages` to be able to only show on certain Yoast admin pages |
| 10 |
- `capabilities` to be able to only show for certain users |
| 11 |
- `Introductions_Collector` uses that data to determine whether an introduction should be "shown" to a user |
| 12 |
- uses the `wpseo_introductions` filter to be extendable from our other plugins |
| 13 |
- uses `Introductions_Seen_Repository` to get the data to determine if the user saw an introduction already |
| 14 |
- `Introductions_Seen_Repository` is the doorway whether a user has seen an introduction or not |
| 15 |
- uses the `_yoast_introductions` user metadata |
| 16 |
- `Introduction_Bucket` and `Introduction_Item` are used by the collector to get an array |
| 17 |
- `Introductions_Integration` runs on the Yoast Admin pages and loads the assets |
| 18 |
- only loads on our Yoast admin pages, but never on our installation success pages as to not disturb onboarding |
| 19 |
- only loads assets if there is an introduction to show |
| 20 |
- `js/src/introductions` holds the JS |
| 21 |
- `wpseoIntroductions` is the localized script to transfer data from PHP to JS |
| 22 |
- `css/src/ai-generator.css` holds the CSS |
| 23 |
|
| 24 |
Inside JS, register the modal content via `window.YoastSEO._registerIntroductionComponent`, which takes a |
| 25 |
`id` and a `Component`. The id needs to be the same as the id in the `Introduction_Interface`. |
| 26 |
The action `yoast.introductions.ready` can be used to know whether the registration function is available and ready for |
| 27 |
use. |
| 28 |
|