*/ private const DEFAULT_KEYS = array( Generators::DESCRIPTION => 'balanced', Generators::TAXONOMY => 'category_standard', Generators::TITLE => 'brand_first', Generators::SEO_META => 'standard', Generators::FAQ => 'use_care_compat', Generators::IMAGE_ALT => 'concise', ); /** * Ordered, labelled templates for one generator, including the full * BlueprintDefinition for each. * * @param string $generator One of Generators::all(). * @return array */ public static function templatesFor( string $generator ): array { $default_key = self::defaultKey( $generator ); $result = array(); foreach ( self::rawTemplates( $generator ) as $key => $raw ) { $result[] = array( 'key' => $key, 'name' => $raw['name'], 'description' => $raw['description'], 'isDefault' => ( $key === $default_key ), 'definition' => self::buildDefinition( $generator, $raw['structure'] ), ); } return $result; } /** * One named template's full entry. * * @param string $generator One of Generators::all(). * @param string $key Template key. * @return array{key:string,name:string,description:string,isDefault:bool,definition:array}|null */ public static function get( string $generator, string $key ): ?array { foreach ( self::templatesFor( $generator ) as $template ) { if ( $template['key'] === $key ) { return $template; } } return null; } /** * The template key the resolver falls back to when a generator has no * store default assignment (the "Safe default"). * * @param string $generator One of Generators::all(). * @return string */ public static function defaultKey( string $generator ): string { return self::DEFAULT_KEYS[ $generator ] ?? 'blank'; } /** * The default template's full definition. * * @param string $generator One of Generators::all(). * @return array */ public static function defaultDefinition( string $generator ): array { $template = self::get( $generator, self::defaultKey( $generator ) ); return null !== $template ? $template['definition'] : ( new DefinitionNormalizer() )->defaults( $generator )['structure']; } /** * The structure-level `instruction` each of $generator's starter * templates ships with, trimmed, empty ones left out. Only Image alt's * templates carry one: the seven retired Template Library presets are * those instructions, and running a template's own instruction is not * the paid custom-instruction capability, so `EntitlementPolicy` lets a * structure that still holds one of them run with it on every plan. * * @param string $generator One of Generators::all(). * @return string[] */ public static function starterInstructions( string $generator ): array { $instructions = array(); foreach ( self::rawTemplates( $generator ) as $raw ) { $instruction = trim( (string) ( $raw['structure']['instruction'] ?? '' ) ); if ( '' !== $instruction ) { $instructions[] = $instruction; } } if ( Generators::IMAGE_ALT === $generator ) { $instructions[] = 'Describe the visible product clearly and naturally.'; } return $instructions; } /** * One starter template's own instruction, in the current locale: what * a structure that names it as its `starter` runs with on a plan * without extra instructions. * * @param string $generator One of Generators::all(). * @param string $key Template key. * @return string Trimmed instruction, or '' for an unknown key or a template without one. */ public static function starterInstruction( string $generator, string $key ): string { $raw = self::rawTemplates( $generator )[ $key ] ?? null; return null !== $raw ? trim( (string) ( $raw['structure']['instruction'] ?? '' ) ) : ''; } /** * Every group's own `instruction` across $generator's starter templates, * trimmed, empty ones left out, keyed by group id: the FAQ counterpart * of {@see starterInstructions()} for a generator whose structure holds * several per-unit instructions (one per group) instead of one. Keyed * by id, not flattened, so a clamp recognizes a group's own shipped * default and does not free-pass a different group's default text * copied into this one. A generator whose templates carry no `groups` * (every one but FAQ today) simply returns no entries. * * @param string $generator One of Generators::all(). * @return array Group id => its templates' distinct non-empty instructions. */ public static function starterGroupInstructions( string $generator ): array { $by_group = array(); foreach ( self::rawTemplates( $generator ) as $raw ) { foreach ( (array) ( $raw['structure']['groups'] ?? array() ) as $group ) { $id = is_array( $group ) ? (string) ( $group['id'] ?? '' ) : ''; $instruction = is_array( $group ) ? trim( (string) ( $group['instruction'] ?? '' ) ) : ''; if ( '' === $id || '' === $instruction ) { continue; } $by_group[ $id ][] = $instruction; } } return $by_group; } /** * Assemble a full BlueprintDefinition from a built-in structure: shared * voice/sources/rules defaults (no template changes these) plus the * template's own structure. * * @param string $generator One of Generators::all(). * @param array $structure Template-specific structure. * @return array */ private static function buildDefinition( string $generator, array $structure ): array { $defaults = ( new DefinitionNormalizer() )->defaults( $generator ); return array( 'schemaVersion' => $defaults['schemaVersion'], 'structure' => $structure, 'voice' => $defaults['voice'], 'sources' => $defaults['sources'], 'rules' => $defaults['rules'], ); } /** * Raw template rows (name, description, structure) for one generator. * * @param string $generator One of Generators::all(). * @return array */ private static function rawTemplates( string $generator ): array { switch ( $generator ) { case Generators::DESCRIPTION: return self::descriptionTemplates(); case Generators::TAXONOMY: return self::taxonomyTemplates(); case Generators::TITLE: return self::titleTemplates(); case Generators::SEO_META: return self::seoMetaTemplates(); case Generators::FAQ: return self::faqTemplates(); case Generators::IMAGE_ALT: return self::imageAltTemplates(); default: return array(); } } /** * @return array */ private static function descriptionTemplates(): array { $companions = self::defaultCompanions(); return array( 'balanced' => array( 'name' => __( 'Balanced Product Description', 'ai-product-tools' ), 'description' => __( 'An opening, key features, specs and a short summary. Works for most catalogs.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'opening', array( 'id' => 'sec_bal_opening', 'length' => array( 'targetMin' => 60, 'targetMax' => 90, 'hardMax' => null ) ) ), SectionCatalog::newSection( 'features', array( 'id' => 'sec_bal_features', 'items' => array( 'max' => 5 ) ) ), SectionCatalog::newSection( 'specs', array( 'id' => 'sec_bal_specs' ) ), SectionCatalog::newSection( 'summary', array( 'id' => 'sec_bal_summary' ) ), ), 'companions' => $companions, ), ), 'detailed' => array( 'name' => __( 'Detailed Product Description', 'ai-product-tools' ), 'description' => __( 'Two paragraphs, features, benefits, specs, warranty and a footer.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'opening', array( 'id' => 'sec_det_opening', 'length' => array( 'targetMin' => 80, 'targetMax' => 120, 'hardMax' => null ) ) ), SectionCatalog::newSection( 'supporting', array( 'id' => 'sec_det_supporting', 'length' => array( 'targetMin' => 60, 'targetMax' => 100, 'hardMax' => null ) ) ), SectionCatalog::newSection( 'features', array( 'id' => 'sec_det_features', 'items' => array( 'max' => 6 ) ) ), SectionCatalog::newSection( 'benefits', array( 'id' => 'sec_det_benefits', 'items' => array( 'max' => 5 ) ) ), SectionCatalog::newSection( 'specs', array( 'id' => 'sec_det_specs', 'fields' => array( 'mode' => 'selected', 'keys' => array( 'core:sku', 'core:weight', 'core:dimensions' ) ), ) ), SectionCatalog::newSection( 'warranty', array( 'id' => 'sec_det_warranty' ) ), SectionCatalog::newSection( 'cta', array( 'id' => 'sec_det_footer', 'name' => __( 'Summary / Footer', 'ai-product-tools' ), 'focus' => __( 'Invite the shopper to contact the store with any questions about choosing the right product', 'ai-product-tools' ), 'missing' => array( 'policy' => 'fallback', 'fallbackText' => __( 'Have questions about choosing the right product? Get in touch with our team, we are happy to help.', 'ai-product-tools' ), ), ) ), ), 'companions' => $companions, ), ), 'technical' => array( 'name' => __( 'Technical Product', 'ai-product-tools' ), 'description' => __( 'Spec-led: a short opening, then the numbers buyers compare.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'opening', array( 'id' => 'sec_tech_opening', 'length' => array( 'targetMin' => 40, 'targetMax' => 70, 'hardMax' => null ) ) ), SectionCatalog::newSection( 'specs', array( 'id' => 'sec_tech_specs' ) ), SectionCatalog::newSection( 'compatibility', array( 'id' => 'sec_tech_compat', 'mode' => 'ai', 'format' => 'bullets' ) ), SectionCatalog::newSection( 'care', array( 'id' => 'sec_tech_care' ) ), SectionCatalog::newSection( 'warranty', array( 'id' => 'sec_tech_warranty' ) ), ), 'companions' => $companions, ), ), 'fashion' => array( 'name' => __( 'Fashion Product', 'ai-product-tools' ), 'description' => __( 'Look and feel first, then fit, fabric and care.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'opening', array( 'id' => 'sec_fash_opening', 'focus' => __( 'How it looks, feels and wears', 'ai-product-tools' ), 'length' => array( 'targetMin' => 60, 'targetMax' => 90, 'hardMax' => null ), ) ), SectionCatalog::newSection( 'custom', array( 'id' => 'sec_fash_fit', 'name' => __( 'Fit & fabric', 'ai-product-tools' ), 'format' => 'bullets', 'items' => array( 'max' => 4 ), ) ), SectionCatalog::newSection( 'care', array( 'id' => 'sec_fash_care' ) ), SectionCatalog::newSection( 'summary', array( 'id' => 'sec_fash_summary' ) ), ), 'companions' => $companions, ), ), 'minimal' => array( 'name' => __( 'Minimal Description', 'ai-product-tools' ), 'description' => __( 'One short paragraph and three features.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'opening', array( 'id' => 'sec_min_opening', 'length' => array( 'targetMin' => 40, 'targetMax' => 60, 'hardMax' => null ) ) ), SectionCatalog::newSection( 'features', array( 'id' => 'sec_min_features', 'items' => array( 'max' => 3 ) ) ), ), 'companions' => $companions, ), ), 'blank' => array( 'name' => __( 'Start blank', 'ai-product-tools' ), 'description' => __( 'An empty template. You add sections from the library.', 'ai-product-tools' ), 'structure' => array( 'sections' => array(), 'companions' => $companions, ), ), ); } /** * @return array */ private static function taxonomyTemplates(): array { return array( 'category_standard' => array( 'name' => __( 'Category Introduction', 'ai-product-tools' ), 'description' => __( 'Intro, product groups, a short buying guide and a closing line.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'category_intro', array( 'id' => 'sec_cat_intro' ) ), SectionCatalog::newSection( 'product_groups', array( 'id' => 'sec_cat_groups' ) ), SectionCatalog::newSection( 'buying_guide', array( 'id' => 'sec_cat_guide' ) ), SectionCatalog::newSection( 'category_closing', array( 'id' => 'sec_cat_close', 'mode' => 'ai', 'format' => 'paragraph', 'focus' => __( 'A short, friendly line for shoppers who are still deciding, inviting them to reach out for help choosing', 'ai-product-tools' ), 'length' => array( 'targetMin' => 10, 'targetMax' => 30, 'hardMax' => null ), 'missing' => array( 'policy' => 'fallback', 'fallbackText' => __( 'Still deciding? Our team is happy to help you choose the right option.', 'ai-product-tools' ), ), ) ), ), 'sampleProducts' => 10, ), ), 'seo_description' => array( 'name' => __( 'SEO Description', 'ai-product-tools' ), 'description' => __( 'An intro and buying guide written around the terms shoppers search for.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'category_intro', array( 'id' => 'sec_taxseo_intro', 'focus' => __( 'Likely search terms and what shoppers are looking for', 'ai-product-tools' ), 'length' => array( 'targetMin' => 60, 'targetMax' => 100, 'hardMax' => null ), ) ), SectionCatalog::newSection( 'product_groups', array( 'id' => 'sec_taxseo_groups', 'focus' => __( 'Product types shoppers search for within this category', 'ai-product-tools' ), ) ), SectionCatalog::newSection( 'buying_guide', array( 'id' => 'sec_taxseo_guide', 'focus' => __( 'Questions shoppers search before choosing in this category', 'ai-product-tools' ), ) ), SectionCatalog::newSection( 'category_closing', array( 'id' => 'sec_taxseo_close', 'mode' => 'ai', 'format' => 'paragraph', 'focus' => __( 'A short line inviting shoppers to browse the full range below to find the best match for what they searched for', 'ai-product-tools' ), 'length' => array( 'targetMin' => 10, 'targetMax' => 30, 'hardMax' => null ), 'missing' => array( 'policy' => 'fallback', 'fallbackText' => __( 'Browse the full range below to find the best match for your search.', 'ai-product-tools' ), ), ) ), ), 'sampleProducts' => 10, ), ), 'marketing_overview' => array( 'name' => __( 'Marketing Overview', 'ai-product-tools' ), 'description' => __( 'A benefit-led intro and a persuasive closing line, built to sell the category.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'category_intro', array( 'id' => 'sec_taxmkt_intro', 'focus' => __( 'The benefits and emotional appeal of shopping this category', 'ai-product-tools' ), 'length' => array( 'targetMin' => 70, 'targetMax' => 110, 'hardMax' => null ), ) ), SectionCatalog::newSection( 'product_groups', array( 'id' => 'sec_taxmkt_groups', 'focus' => __( 'What makes each group worth a closer look', 'ai-product-tools' ), ) ), SectionCatalog::newSection( 'category_closing', array( 'id' => 'sec_taxmkt_close', 'mode' => 'ai', 'format' => 'paragraph', 'focus' => __( 'A persuasive line inviting the shopper to explore the category', 'ai-product-tools' ), 'length' => array( 'targetMin' => 10, 'targetMax' => 30, 'hardMax' => null ), ) ), ), 'sampleProducts' => 10, ), ), 'technical_summary' => array( 'name' => __( 'Technical Summary', 'ai-product-tools' ), 'description' => __( 'A factual intro and a data-driven list of product groups, with no sales language.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'category_intro', array( 'id' => 'sec_taxtech_intro', 'focus' => __( 'The product types and categories included here, stated plainly', 'ai-product-tools' ), 'length' => array( 'targetMin' => 40, 'targetMax' => 70, 'hardMax' => null ), ) ), SectionCatalog::newSection( 'product_groups', array( 'id' => 'sec_taxtech_groups', 'mode' => 'data', 'format' => 'bullets', ) ), SectionCatalog::newSection( 'buying_guide', array( 'id' => 'sec_taxtech_guide', 'focus' => __( 'Objective criteria for comparing items in this category', 'ai-product-tools' ), ) ), SectionCatalog::newSection( 'category_closing', array( 'id' => 'sec_taxtech_close', 'mode' => 'ai', 'format' => 'paragraph', 'focus' => __( 'A short, factual line noting that full specifications are listed on each product page', 'ai-product-tools' ), 'length' => array( 'targetMin' => 10, 'targetMax' => 30, 'hardMax' => null ), 'missing' => array( 'policy' => 'fallback', 'fallbackText' => __( 'Full specifications are listed on each product page.', 'ai-product-tools' ), ), ) ), ), 'sampleProducts' => 10, ), ), 'brand_story' => array( 'name' => __( 'Brand Story', 'ai-product-tools' ), 'description' => __( 'An intro and closing that connect this category to your brand story.', 'ai-product-tools' ), 'structure' => array( 'sections' => array( SectionCatalog::newSection( 'category_intro', array( 'id' => 'sec_taxbrand_intro', 'focus' => __( 'How this category fits the brand story and the lifestyle it serves', 'ai-product-tools' ), 'length' => array( 'targetMin' => 70, 'targetMax' => 120, 'hardMax' => null ), ) ), SectionCatalog::newSection( 'product_groups', array( 'id' => 'sec_taxbrand_groups', 'focus' => __( 'How each group fits the lifestyle this category represents', 'ai-product-tools' ), ) ), SectionCatalog::newSection( 'category_closing', array( 'id' => 'sec_taxbrand_close', 'mode' => 'ai', 'format' => 'paragraph', 'focus' => __( 'A closing line that ties back to the brand values', 'ai-product-tools' ), 'length' => array( 'targetMin' => 10, 'targetMax' => 30, 'hardMax' => null ), ) ), ), 'sampleProducts' => 10, ), ), 'blank' => array( 'name' => __( 'Start blank', 'ai-product-tools' ), 'description' => __( 'An empty template. You add sections from the library.', 'ai-product-tools' ), 'structure' => array( 'sections' => array(), 'sampleProducts' => 10, ), ), ); } /** * @return array */ private static function titleTemplates(): array { return array( 'brand_first' => array( 'name' => __( 'Brand-first title', 'ai-product-tools' ), 'description' => __( 'Brand, then product type, key feature and the product\'s own name, up to 60 characters total.', 'ai-product-tools' ), 'structure' => array( 'parts' => array( self::titlePart( 'part_brand', 'brand', 'data', 'core:brand' ), self::titlePart( 'part_type', 'product_type', 'data', 'core:categories' ), self::titlePart( 'part_feature', 'key_feature', 'ai', '' ), self::titlePart( 'part_name', 'product_name', 'data', 'core:name' ), ), 'separator' => 'dash', 'maxChars' => 60, 'overflowDropPartId' => 'part_type', 'dedupe' => true, ), ), 'feature_first' => array( 'name' => __( 'Feature-first title', 'ai-product-tools' ), 'description' => __( 'Product type and key feature, then brand and the product\'s own name, for search-led catalogs.', 'ai-product-tools' ), 'structure' => array( 'parts' => array( self::titlePart( 'part_type2', 'product_type', 'data', 'core:categories' ), self::titlePart( 'part_feature2', 'key_feature', 'ai', '' ), self::titlePart( 'part_brand2', 'brand', 'data', 'core:brand' ), self::titlePart( 'part_name2', 'product_name', 'data', 'core:name' ), ), 'separator' => 'dash', 'maxChars' => 60, 'overflowDropPartId' => 'part_type2', 'dedupe' => true, ), ), ); } /** * @param string $id Part id. * @param string $key TitlePartKey. * @param string $mode 'data' | 'ai' | 'fixed'. * @param string $field FieldRef (data mode) or ''. * @return array TitlePart-shaped array. */ private static function titlePart( string $id, string $key, string $mode, string $field ): array { return array( 'id' => $id, 'key' => $key, 'enabled' => true, 'mode' => $mode, 'field' => $field, 'text' => '', 'maxChars' => null, 'missing' => 'skip', 'fallback' => '', ); } /** * @return array */ private static function seoMetaTemplates(): array { return array( 'standard' => array( 'name' => __( 'Standard meta', 'ai-product-tools' ), 'description' => __( 'Name, key feature and store name; a benefit-led description.', 'ai-product-tools' ), 'structure' => array( 'title' => array( 'tokens' => array( self::seoToken( 'tok_title_name', 'product_name', 'data', 'core:name' ), self::seoToken( 'tok_title_feature', 'key_feature', 'ai', '' ), self::seoToken( 'tok_title_store', 'store_name', 'data', '' ), ), 'separator' => 'pipe', 'targetMin' => 40, 'targetMax' => 60, 'hardMax' => 60, ), 'description' => array( 'tokens' => array( self::seoToken( 'tok_desc_benefit', 'benefit', 'ai', '' ), self::seoToken( 'tok_desc_spec', 'key_spec', 'ai', '' ), self::seoToken( 'tok_desc_cta', 'cta', 'ai', '' ), ), 'targetMin' => 120, 'targetMax' => 160, 'hardMax' => 160, ), 'keyword' => array( 'source' => 'focus_keyword', 'once' => true ), ), ), ); } /** * @param string $id Token id. * @param string $key SeoTokenKey. * @param string $mode 'data' | 'ai' | 'fixed'. * @param string $field FieldRef (data mode) or ''. * @return array SeoToken-shaped array. */ private static function seoToken( string $id, string $key, string $mode, string $field ): array { return array( 'id' => $id, 'key' => $key, 'mode' => $mode, 'field' => $field, 'text' => '', ); } /** * @return array */ private static function faqTemplates(): array { $disabled_condition = array( 'enabled' => false, 'field' => '', 'operator' => 'not_empty', 'value' => '' ); $no_sources = array( 'inherit' => true, 'refs' => array() ); $answer = array( 'targetMax' => 150, 'hardMax' => 300 ); return array( 'use_care_compat' => array( 'name' => __( 'Use, care & compatibility FAQ', 'ai-product-tools' ), 'description' => __( 'Four groups, up to 8 questions per product.', 'ai-product-tools' ), 'structure' => array( 'groups' => array( array( 'id' => 'grp_using', 'name' => __( 'Using it', 'ai-product-tools' ), 'topic' => __( 'How to use this product and what to know before buying it', 'ai-product-tools' ), 'enabled' => true, 'count' => 2, 'answer' => $answer, 'sources' => $no_sources, 'condition' => $disabled_condition, 'instruction' => __( 'Leave care, compatibility and warranty questions to their own groups.', 'ai-product-tools' ), ), array( 'id' => 'grp_care', 'name' => __( 'Care', 'ai-product-tools' ), 'topic' => __( 'Caring for this product', 'ai-product-tools' ), 'enabled' => true, 'count' => 2, 'answer' => $answer, 'sources' => $no_sources, 'condition' => $disabled_condition, 'instruction' => '', ), array( 'id' => 'grp_compat', 'name' => __( 'Compatibility', 'ai-product-tools' ), 'topic' => __( 'What this works with', 'ai-product-tools' ), 'enabled' => true, 'count' => 2, 'answer' => $answer, 'sources' => $no_sources, 'condition' => $disabled_condition, 'instruction' => '', ), array( 'id' => 'grp_warranty', 'name' => __( 'Warranty', 'ai-product-tools' ), 'topic' => __( 'Warranty coverage', 'ai-product-tools' ), 'enabled' => true, 'count' => 1, 'answer' => $answer, 'sources' => $no_sources, 'condition' => SectionCatalog::warrantyCondition(), 'instruction' => '', ), ), 'maxQuestions' => 8, 'mode' => 'both', ), ), ); } /** * @return array */ private static function imageAltTemplates(): array { $rules = array( 'noImageOf' => true, 'keywordOnce' => true, 'varyAcrossImages' => true, 'includeColor' => true, 'includeProductName' => true, ); $templates = array( 'concise' => array( 'name' => __( 'Concise alt text', 'ai-product-tools' ), 'description' => __( 'Product name, up to 125 characters. Never "image of".', 'ai-product-tools' ), 'structure' => array( 'context' => 'product_data', 'maxChars' => 125, 'rules' => $rules, 'instruction' => '', ), ), 'general_product' => array( 'name' => __( 'General product alt text', 'ai-product-tools' ), 'description' => __( 'Clear, natural alt text written from product data, up to 125 characters.', 'ai-product-tools' ), 'structure' => array( 'context' => 'product_data', 'maxChars' => 125, 'rules' => $rules, 'instruction' => __( 'Describe the product clearly and naturally.', 'ai-product-tools' ), ), ), 'fashion' => array( 'name' => __( 'Fashion alt text', 'ai-product-tools' ), 'description' => __( 'Style-focused alt text for clothing and accessories, up to 150 characters.', 'ai-product-tools' ), 'structure' => array( 'context' => 'product_data', 'maxChars' => 150, 'rules' => $rules, 'instruction' => __( 'Focus on fabric, style, and fashion appeal, written in an engaging, narrative style.', 'ai-product-tools' ), ), ), 'electronics' => array( 'name' => __( 'Electronics alt text', 'ai-product-tools' ), 'description' => __( 'Technical, spec-led alt text for gadgets and devices, up to 125 characters.', 'ai-product-tools' ), 'structure' => array( 'context' => 'product_data', 'maxChars' => 125, 'rules' => $rules, 'instruction' => __( 'Include key specs such as connectivity, power, and compatibility, written in precise, technical language.', 'ai-product-tools' ), ), ), 'furniture' => array( 'name' => __( 'Furniture alt text', 'ai-product-tools' ), 'description' => __( 'Alt text with material, dimensions and room fit, up to 140 characters.', 'ai-product-tools' ), 'structure' => array( 'context' => 'product_data', 'maxChars' => 140, 'rules' => $rules, 'instruction' => __( 'Include material, dimensions, and room suitability.', 'ai-product-tools' ), ), ), 'beauty' => array( 'name' => __( 'Beauty alt text', 'ai-product-tools' ), 'description' => __( 'Sensory alt text for cosmetics and skincare, up to 130 characters.', 'ai-product-tools' ), 'structure' => array( 'context' => 'product_data', 'maxChars' => 130, 'rules' => $rules, 'instruction' => __( 'Highlight texture, scent, and skin benefits, in an elevated, luxury voice.', 'ai-product-tools' ), ), ), 'b2b' => array( 'name' => __( 'B2B alt text', 'ai-product-tools' ), 'description' => __( 'Professional, specification-led alt text for business products, up to 125 characters.', 'ai-product-tools' ), 'structure' => array( 'context' => 'product_data', 'maxChars' => 125, 'rules' => $rules, 'instruction' => __( 'Use professional, specification-driven language that reads well in search results.', 'ai-product-tools' ), ), ), 'luxury_goods' => array( 'name' => __( 'Luxury alt text', 'ai-product-tools' ), 'description' => __( 'Premium brand voice for high-end products, up to 160 characters.', 'ai-product-tools' ), 'structure' => array( 'context' => 'product_data', 'maxChars' => 160, 'rules' => $rules, 'instruction' => __( 'Evoke exclusivity, craftsmanship, and timelessness, in an elevated, luxury voice.', 'ai-product-tools' ), ), ), ); foreach ( $templates as $key => $template ) { $templates[ $key ]['structure']['starter'] = '' !== $template['structure']['instruction'] ? $key : ''; } return $templates; } /** * Companion settings shared by every description template. * * @return array{shortDescription:array,tags:array} */ private static function defaultCompanions(): array { return array( 'shortDescription' => array( 'format' => 'paragraph', 'length' => array( 'targetMin' => 40, 'targetMax' => 60, 'hardMax' => null ), 'items' => array( 'max' => 5 ), ), 'tags' => array( 'max' => 10 ), ); } }