| @@ -8,9 +8,11 @@ | ||
| 8 | 8 | |
| 9 | 9 | defined('ABSPATH') || die('No direct access.'); |
| 10 | 10 | |
| 11 | 11 | use Extendify\Config; |
| 12 | +use Extendify\Insights; | |
| 12 | 13 | use Extendify\PartnerData; |
| 14 | +use Extendify\Shared\Services\LaunchUpdate\LaunchUpdater; | |
| 13 | 15 | |
| 14 | 16 | /** |
| 15 | 17 | * This class handles any file loading for the admin area. |
| 16 | 18 | */ |
| @@ -65,13 +67,19 @@ | ||
| 65 | 67 | ]), |
| 66 | 68 | ]); |
| 67 | 69 | } |
| 68 | 70 | |
| 71 | + $showLaunchUpdate = PartnerData::setting('showLaunchUpdate'); | |
| 72 | + $launchUpdate = $showLaunchUpdate ? LaunchUpdater::claimPendingUpdates() : []; | |
| 69 | 73 | \wp_add_inline_script( |
| 70 | 74 | Config::$slug . '-launch-scripts', |
| 71 | 75 | 'window.extLaunchData = ' . \wp_json_encode([ |
| 72 | 76 | 'editorStyles' => \get_block_editor_settings([], new \WP_Block_Editor_Context()), |
| 73 | 77 | 'wpRoot' => \rest_url(), |
| 78 | + 'activeTests' => \get_option(Insights::ACTIVE_TESTS_OPTION, []), | |
| 79 | + 'showLaunchTitle' => (bool) PartnerData::setting('showLaunchTitle'), | |
| 80 | + 'customDesign' => PartnerData::setting('customDesign'), | |
| 81 | + 'partnerStrings' => PartnerData::setting('strings'), | |
| 74 | 82 | 'resetSiteInformation' => [ |
| 75 | 83 | 'pagesIds' => array_map('esc_attr', $this->getLaunchCreatedPages()), |
| 76 | 84 | 'navigationsIds' => array_map('esc_attr', $this->getLaunchCreatedNavigations()), |
| 77 | 85 | 'templatePartsIds' => array_map('esc_attr', $this->getTemplatePartIds()), |
| @@ -84,8 +92,14 @@ | ||
| 84 | 92 | 'hello-world', |
| 85 | 93 | 'Default post slug' |
| 86 | 94 | ), |
| 87 | 95 | 'hideAutoLaunchExitLink' => (bool) PartnerData::setting('hideLaunchExitLink'), |
| 96 | + 'themeUpdateNeeded' => !empty($launchUpdate['theme']), | |
| 97 | + 'pluginUpdateNeeded' => !empty($launchUpdate['plugin']), | |
| 98 | + 'launchUpdateAttempt' => $launchUpdate['attempt'] ?? 0, | |
| 99 | + 'launchUpdateStale' => (object) ($launchUpdate['stale'] ?? []), | |
| 100 | + 'pluginUpdateViaRest' => LaunchUpdater::isWpOrgBuild(), | |
| 101 | + 'pluginSlug' => Config::$slug, | |
| 88 | 102 | ]), |
| 89 | 103 | 'before' |
| 90 | 104 | ); |
| 91 | 105 | |