• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 968e1951319a69b551587c91336c23b536bcefce

28 Mar 2024 08:42AM UTC coverage: 53.779%. First build
968e1951319a69b551587c91336c23b536bcefce

push

github

igorschoester
Merge branch 'trunk' of github.com:Yoast/wordpress-seo into feature/woo-new-editor

# Conflicts:
#	config/webpack/webpack.config.base.js

7588 of 13915 branches covered (54.53%)

Branch coverage included in aggregate %.

31 of 47 new or added lines in 18 files covered. (65.96%)

29666 of 55358 relevant lines covered (53.59%)

40476.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/js/src/ai-generator/components/modal-content.js
1
/* eslint-disable complexity */
2
import { useDispatch, useSelect } from "@wordpress/data";
3
import { useMemo } from "@wordpress/element";
4
import { AiGenerateTitlesAndDescriptionsUpsell } from "../../shared-admin/components";
5
import { __, sprintf } from "@wordpress/i18n";
6

7
const STORE = "yoast-seo/editor";
×
8

9
/**
10
 * @returns {JSX.Element} The element.
11
 */
12
export const ModalContent = () => {
×
NEW
13
        const learnMoreLink = useSelect( select => select( STORE ).selectLink( "https://yoa.st/ai-generator-learn-more" ), [] );
×
14
        const upsellLinkPremium = useSelect( select => select( STORE ).selectLink( "https://yoa.st/ai-generator-upsell" ), [] );
×
15
        const upsellLinkWooPremiumBundle = useSelect( select => select( STORE ).selectLink( "https://yoa.st/ai-generator-upsell-woo-seo-premium-bundle" ), [] );
×
16
        const upsellLinkWoo = useSelect( select => select( STORE ).selectLink( "https://yoa.st/ai-generator-upsell-woo-seo" ), [] );
×
17
        const isPremium = useSelect( select => select( STORE ).getIsPremium(), [] );
×
18
        const isWooSeoUpsell = useSelect( select => select( STORE ).getIsWooSeoUpsell(), [] );
×
19
        const isProduct = useSelect( select => select( STORE ).getIsProduct(), [] );
×
20
        const wooSeoNoPremium = isProduct && ! isWooSeoUpsell && ! isPremium;
×
21
        const isProductCopy = !! ( isWooSeoUpsell || wooSeoNoPremium );
×
22
        const postModalprops = {
×
23
                isProductCopy,
24
                upsellLink: upsellLinkPremium,
25
        };
26

27
        if ( isProductCopy ) {
×
28
                const upsellPremiumWooLabel = sprintf(
×
29
                        /* translators: %1$s expands to Yoast SEO Premium, %2$s expands to Yoast WooCommerce SEO. */
30
                        __( "%1$s + %2$s", "wordpress-seo" ),
31
                        "Yoast SEO Premium",
32
                        "Yoast WooCommerce SEO"
33
                );
34
                postModalprops.newToText = sprintf(
×
35
                        /* translators: %1$s expands to Yoast SEO Premium and Yoast WooCommerce SEO. */
36
                        __( "New in %1$s", "wordpress-seo" ),
37
                        upsellPremiumWooLabel
38
                );
39
                postModalprops.title = __( "Generate product titles & descriptions with AI!", "wordpress-seo" );
×
40
                if ( ! isPremium && isWooSeoUpsell ) {
×
41
                        postModalprops.upsellLabel = `${ sprintf(
×
42
                                /* translators: %1$s expands to Woo Premium bundle. */
43
                                __( "Unlock with the %1$s", "wordpress-seo" ),
44
                                "Woo Premium bundle"
45
                        )}*`;
46
                        postModalprops.bundleNote = <div className="yst-text-xs yst-text-slate-500 yst-mt-2">
×
47
                                { `*${upsellPremiumWooLabel}` }
48
                        </div>;
49
                        postModalprops.upsellLink = upsellLinkWooPremiumBundle;
×
50
                }
51
                if ( isPremium ) {
×
52
                        postModalprops.upsellLabel = sprintf(
×
53
                                /* translators: %1$s expands to Yoast WooCommerce SEO. */
54
                                __( "Unlock with %1$s", "wordpress-seo" ),
55
                                "Yoast WooCommerce SEO"
56
                        );
57
                        postModalprops.upsellLink = upsellLinkWoo;
×
58
                }
59
        }
60

61

62
        const imageLink = useSelect( select => select( STORE ).selectImageLink( "ai-generator-preview.png" ), [] );
×
63
        const thumbnail = useMemo( () => ( {
×
64
                src: imageLink,
65
                width: "432",
66
                height: "244",
67
        } ), [ imageLink ] );
68

69
        const value = useSelect( select => select( STORE ).selectWistiaEmbedPermissionValue(), [] );
×
70
        const status = useSelect( select => select( STORE ).selectWistiaEmbedPermissionStatus(), [] );
×
71
        const { setWistiaEmbedPermission: set } = useDispatch( STORE );
×
72
        const wistiaEmbedPermission = useMemo( () => ( { value, status, set } ), [ value, status, set ] );
×
73

74

75
        return (
×
76
                <AiGenerateTitlesAndDescriptionsUpsell
77
                        learnMoreLink={ learnMoreLink }
78
                        thumbnail={ thumbnail }
79
                        wistiaEmbedPermission={ wistiaEmbedPermission }
80
                        { ...postModalprops }
81
                />
82
        );
83
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc