| @@ -1643,30 +1643,18 @@ | ||
| 1643 | 1643 | return array(); |
| 1644 | 1644 | } |
| 1645 | 1645 | |
| 1646 | 1646 | /** |
| 1647 | - * Whether the AI Launchpad is enabled for this site, for the requesting user. | |
| 1647 | + * Whether the AI Launchpad is enabled for this site. Mirrors AI_Launchpad::is_enabled_for_site() in jetpack-mu-wpcom. | |
| 1648 | 1648 | * |
| 1649 | - * The launchpad-personalization assignment is user-scoped: every site of an | |
| 1650 | - * ai_launchpad user gets the AI Launchpad, however the site was created. Mirrors | |
| 1651 | - * AI_Launchpad::is_enabled_for_site() in jetpack-mu-wpcom, so wp-admin and the | |
| 1652 | - * Calypso-facing payload agree. Like the capabilities in this payload, the value | |
| 1653 | - * is relative to the current user. | |
| 1654 | - * | |
| 1655 | 1649 | * @return bool |
| 1656 | 1650 | */ |
| 1657 | 1651 | public function is_ai_launchpad_enabled() { |
| 1658 | - if ( (bool) get_option( 'wpcom_ai_launchpad_enabled' ) ) { | |
| 1659 | - return true; | |
| 1660 | - } | |
| 1661 | - | |
| 1662 | - return class_exists( '\Automattic\Jetpack\Jetpack_Mu_Wpcom\Launchpad_Personalization_Experiment' ) | |
| 1663 | - // @phan-suppress-next-line PhanUndeclaredClassMethod -- Lives in jetpack-mu-wpcom, outside this plugin's dependency graph; the class_exists guard above covers contexts where it isn't loaded. | |
| 1664 | - && 'ai_launchpad' === \Automattic\Jetpack\Jetpack_Mu_Wpcom\Launchpad_Personalization_Experiment::get_variation(); | |
| 1652 | + return (bool) get_option( 'wpcom_ai_launchpad_enabled' ) && ! $this->is_ai_launchpad_no_guidance(); | |
| 1665 | 1653 | } |
| 1666 | 1654 | |
| 1667 | 1655 | /** |
| 1668 | - * Whether the AI Launchpad was dismissed, reverting the site to the regular launchpad. | |
| 1656 | + * Whether the AI Launchpad was dismissed (skipped), which leaves the site with no setup guidance. | |
| 1669 | 1657 | * |
| 1670 | 1658 | * @return bool |
| 1671 | 1659 | */ |
| 1672 | 1660 | public function is_ai_launchpad_dismissed() { |
| @@ -1682,8 +1670,22 @@ | ||
| 1682 | 1670 | return (bool) get_option( 'wpcom_ai_launchpad_completed' ); |
| 1683 | 1671 | } |
| 1684 | 1672 | |
| 1685 | 1673 | /** |
| 1674 | + * Whether the site gets no setup guidance: no My Home, Site Setup, or launchpad. Mirrors | |
| 1675 | + * wpcom_launchpad_is_no_guidance() in jetpack-mu-wpcom, which also counts a skipped AI Launchpad. | |
| 1676 | + * | |
| 1677 | + * @return bool | |
| 1678 | + */ | |
| 1679 | + public function is_ai_launchpad_no_guidance() { | |
| 1680 | + if ( get_option( 'wpcom_ai_launchpad_no_guidance' ) ) { | |
| 1681 | + return true; | |
| 1682 | + } | |
| 1683 | + | |
| 1684 | + return (bool) get_option( 'wpcom_ai_launchpad_enabled' ) && (bool) get_option( 'wpcom_ai_launchpad_dismissed' ); | |
| 1685 | + } | |
| 1686 | + | |
| 1687 | + /** | |
| 1686 | 1688 | * Get site option for migration source site domain |
| 1687 | 1689 | * |
| 1688 | 1690 | * @return string |
| 1689 | 1691 | */ |
| @@ -1892,6 +1894,16 @@ | ||
| 1892 | 1894 | */ |
| 1893 | 1895 | public function get_jetpack_recovery_mode_status() { |
| 1894 | 1896 | $status = get_option( 'jetpack_recovery_mode_status' ); |
| 1895 | 1897 | return is_array( $status ) ? $status : null; |
| 1898 | + } | |
| 1899 | + | |
| 1900 | + /** | |
| 1901 | + * Whether WordPress.com accounts must have two-step authentication to log in through SSO. | |
| 1902 | + * | |
| 1903 | + * @return bool | |
| 1904 | + */ | |
| 1905 | + public function get_jetpack_sso_require_two_step() { | |
| 1906 | + /** This filter is documented in projects/packages/connection/src/sso/class-helpers.php */ | |
| 1907 | + return (bool) apply_filters( 'jetpack_sso_require_two_step', get_option( 'jetpack_sso_require_two_step', false ) ); | |
| 1896 | 1908 | } |
| 1897 | 1909 | } |