Changeset 2558520
- Timestamp:
- 07/05/2021 05:51:08 AM (5 years ago)
- Location:
- content-bot
- Files:
-
- 21 added
- 3 edited
-
tags/1.0.03 (added)
-
tags/1.0.03/content-bot.php (added)
-
tags/1.0.03/css (added)
-
tags/1.0.03/css/style.css (added)
-
tags/1.0.03/img (added)
-
tags/1.0.03/img/Twitter.png (added)
-
tags/1.0.03/img/banner.png (added)
-
tags/1.0.03/img/loader.gif (added)
-
tags/1.0.03/img/loader.svg (added)
-
tags/1.0.03/img/menu-icon.png (added)
-
tags/1.0.03/img/squarel.png (added)
-
tags/1.0.03/img/star-black.png (added)
-
tags/1.0.03/img/star-grey.png (added)
-
tags/1.0.03/img/step1.gif (added)
-
tags/1.0.03/img/step2.gif (added)
-
tags/1.0.03/img/wave.png (added)
-
tags/1.0.03/readme.txt (added)
-
tags/1.0.03/script.js (added)
-
tags/1.0.03/templates (added)
-
tags/1.0.03/templates/settings.html.php (added)
-
tags/1.0.03/templates/welcome.html.php (added)
-
trunk/content-bot.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/script.js (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
content-bot/trunk/content-bot.php
r2478787 r2558520 4 4 Plugin URI: https://contentbot.ai 5 5 Description: Create amazing AI content snippets with OpenAI's GPT3 autoregressive language model that uses deep learning to produce human-like text. 6 Version: 1. 0.036 Version: 1.1.00 7 7 Author: NickDuncan 8 8 Author URI: https://codecabin.io … … 14 14 /** 15 15 * 16 * v1.1.0 - 2021-07-05 17 * Added all the latest short form tools 18 * - blog outline 19 * - bullet point expander 20 * - listicle 21 * - change tone 22 * - summarizer 23 * - finish the sentence 24 * - startup ideas 25 * - brand namees 26 * - slogan generator 27 * - adwords ads 28 * - facebook ads 29 * - video ideas 30 * - video description 31 * - landing page 32 * - value proposition 33 * - sentence rewriter 34 * - pitch yourself 35 * - pain-agitate-solution 36 * - pain-benefit-solution 37 * - AIDA 38 * - quora answers 39 * - sales email 40 * Added more robus language options 41 * Increased input string lengths 42 * Improved UX 43 * 16 44 * v1.0.03 17 * Added translation support for input and ouput (powered by Google Analytics)45 * Added translation support for input and ouput (powered by Google Translate) 18 46 * Changed brand elements 19 47 * … … 32 60 33 61 global $cbaiVersion; 34 $cbaiVersion = '1. 0.02';62 $cbaiVersion = '1.1.00'; 35 63 define( 'CBAI_PLUGIN_DIR_URL', plugin_dir_url(__FILE__) ); 36 64 define( 'CBAI_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__) ); … … 49 77 $current_user = wp_get_current_user(); 50 78 79 $gravs_array = array( 80 1 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 81 2 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 82 3 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 83 4 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 84 5 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 85 6 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 86 7 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 87 8 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 88 9 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 89 10 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 90 11 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com"), 91 12 => md5(rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000).rand(0,1000)."@test".rand(0,1000).rand(0,1000).".com") 92 ); 93 51 94 $translation_array = array( 52 95 'hash' => get_option('cbai_hash'), … … 57 100 'uemail' => esc_html( $current_user->user_email ), 58 101 'location' => plugin_dir_url(__FILE__), 59 'stringGenerating' => __( 'Generating AI content. Please be patient...' , 'wp-content-bot' ) 102 'stringGenerating' => __( 'Generating AI content. Please be patient...' , 'wp-content-bot' ), 103 104 'name' => $check['firstname'], 105 'grav' => $avatarUrl, 106 'gravs'=> $gravs_array 60 107 ); 61 108 wp_localize_script( 'content-bot-gutenberg', 'cbai_data', $translation_array ); … … 64 111 wp_enqueue_style( 'content-bot', plugin_dir_url(__FILE__) . 'css/style.css' ); 65 112 66 } 113 }; 67 114 68 115 add_action( 'enqueue_block_editor_assets', 'cbai_loadMyBlock' ); -
content-bot/trunk/readme.txt
r2478787 r2558520 2 2 Contributors: NickDuncan 3 3 Donate link: https://contentbot.ai 4 Tags: content, ai, ai content, artifical intelligence, gpt3, gpt-3 4 Tags: content, ai, ai content, artifical intelligence, gpt3, gpt-3, contentbot, content bot 5 5 Requires at least: 3.8 6 6 Tested up to: 5.6 … … 20 20 ### Features 21 21 22 * Generate up to 10 AI content snippets a day with the free version.22 * Generate up to 60 AI content snippets a day with the free version. 23 23 * Create product descriptions 24 24 * Generate blog topic ideas 25 * Create a blog intro for your next article 25 26 * Generate page headline Ideas 27 * Create blog outlines 28 * Rewrite sentences 29 * Change the tone of your sentencees 30 * Generate listicles 31 * Use our bullet point expander to create paragraphs 32 * Summarize long content into succint copy 33 * Finish the sentnce 34 * Create brand names, startup ideas and slogans 35 * Create ad copy for Adwords and Facebook 36 * Come up with video ideas and descriptions 37 * Create comprehensive landing page content 38 * Create a value proposition for your product or service 26 39 * Generate a list of marketing ideas 27 * Create a blog intro for your next article 40 * Use copywriting formulas such as AIDA, PBS, PAS and more 41 * Lots more! 28 42 29 43 Content Bot makes use of [OpenAI's GPT-3 model](https://openai.com/blog/openai-api/). … … 31 45 You can upgrade to our premium plan [here](https://contentbot.ai/). 32 46 33 Due to valid restrictions from the OpenAI team, our content will have a maximum output of around 40 to 60 words. You are not able to create a full article with this plugin. This is not something we ever envisage offering as a service. This plugin is meant to help you generate short snippets of content and/or create ideas for you and your marketing efforts.47 Due to valid restrictions from the OpenAI team, our content will have a maximum output of around 40 to 130 words. You are not able to create a full article with this plugin. This is not something we ever envisage offering as a service. This plugin is meant to help you generate short snippets of content and/or create ideas for you and your marketing efforts. 34 48 35 49 Furthermore, we will not be supporting the following industries: medical, finance, insurance, and some political topics. More information to follow soon. 36 50 51 Looking for a Jarvis alternative that works in WordPress? You've found it! We're the only AI Content tool that has a WordPress plugin. WordPress development is something we've specialized in for the last 11 years. You're in good hands! 37 52 53 AI content marketing has never been so easy. 38 54 39 55 == Installation == … … 74 90 == Changelog == 75 91 92 = v1.1.00 - 2021-07-05 = 93 * Added all the latest short form tools 94 * - blog outline 95 * - bullet point expander 96 * - listicle 97 * - change tone 98 * - summarizer 99 * - finish the sentence 100 * - startup ideas 101 * - brand namees 102 * - slogan generator 103 * - adwords ads 104 * - facebook ads 105 * - video ideas 106 * - video description 107 * - landing page 108 * - value proposition 109 * - sentence rewriter 110 * - pitch yourself 111 * - pain-agitate-solution 112 * - pain-benefit-solution 113 * - AIDA 114 * - quora answers 115 * - sales email 116 * Added more robus language options 117 * Increased input string lengths 118 * Improved UX 119 76 120 = v1.0.03 = 77 * Added translation support for input and ouput (powered by Google Analytics)121 * Added translation support for input and ouput (powered by Google Translate) 78 122 * Changed brand elements 79 123 -
content-bot/trunk/script.js
r2478787 r2558520 4 4 var cb_usr_holder = ''; 5 5 6 var validation = { 7 'cbai_input_name' : false, 8 'cbai_input_desc' : false, 9 'cbai_input_tone' : false, 10 'cbai_input_industry' : false, 11 'cbai_input_topic' : false, 12 'cbai_input_audience' : false, 13 'cbai_input_keywords' : false, 14 'cbaiSales_Purpose' : false, 15 'cbaiSales_Name' : false, 16 'cbaiSales_CompanyName' : false, 17 'cbaiSales_Industry' : false, 18 'cbaiSales_LeadName' : false, 19 'cbaiSales_LeadCompanyName' : false, 20 'cbaiSales_LeadIndustry' : false, 21 'cbaiSales_LeadGoals' : false, 22 'cbaiSales_ProductBenefits' : false, 23 'cbai_BPE_1' : false, 24 'cbai_BPE_2' : false, 25 'cbai_BPE_3' : false, 26 'cbaiPitch_InputDelivery' : false, 27 'cbaiPitch_InputGoal' : false, 28 'cbaiPitch_InputHighlights' : false, 29 'cbaiPitch_InputExperience' : false, 30 }; 31 32 var googleLanguages = '<option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="am">Amharic</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="be">Belarusian</option><option value="bn">Bengali</option><option value="bs">Bosnian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="ceb">Cebuano</option><option value="ny">Chichewa</option><option value="zh">Chinese (Simplified)</option><option value="zh-TW">Chinese (Traditional)</option><option value="co">Corsican</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en" selected="selected">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="fy">Frisian</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian Creole</option><option value="ha">Hausa</option><option value="haw">Hawaiian</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hmn">Hmong</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="ig">Igbo</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="jw">Javanese</option><option value="kn">Kannada</option><option value="kk">Kazakh</option><option value="km">Khmer</option><option value="rw">Kinyarwanda</option><option value="ko">Korean</option><option value="ku">Kurdish (Kurmanji)</option><option value="ky">Kyrgyz</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="lb">Luxembourgish</option><option value="mk">Macedonian</option><option value="mg">Malagasy</option><option value="ms">Malay</option><option value="ml">Malayalam</option><option value="mt">Maltese</option><option value="mi">Maori</option><option value="mr">Marathi</option><option value="mn">Mongolian</option><option value="my">Myanmar (Burmese)</option><option value="ne">Nepali</option><option value="no">Norwegian</option><option value="or">Odia (Oriya)</option><option value="ps">Pashto</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="pa">Punjabi</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sm">Samoan</option><option value="gd">Scots Gaelic</option><option value="sr">Serbian</option><option value="st">Sesotho</option><option value="sn">Shona</option><option value="sd">Sindhi</option><option value="si">Sinhala</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option value="so">Somali</option><option value="es">Spanish</option><option value="su">Sundanese</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="tg">Tajik</option><option value="ta">Tamil</option><option value="tt">Tatar</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="tk">Turkmen</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="ug">Uyghur</option><option value="uz">Uzbek</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="xh">Xhosa</option><option value="yi">Yiddish</option><option value="yo">Yoruba</option><option value="zu">Zulu</option>'; 33 var deeplLanguages = '<option value="BG">Bulgarian</option><option value="ZH">Chinese</option><option value="CS">Czech</option><option value="DA">Danish</option><option value="NL">Dutch</option><option value="EN-US" selected>English (US)</option><option value="EN-GB">English (GB)</option><option value="ET">Estonian</option><option value="FI">Finnish</option><option value="FR">French</option><option value="DE">German</option><option value="EL">Greek</option><option value="HU">Hungarian</option><option value="IT">Italian</option><option value="JA">Japanese</option><option value="LV">Latvian</option><option value="LT">Lithuanian</option><option value="PL">Polish</option><option value="PT-PT">Portuguese</option><option value="PT-BR">Portuguese (Brazilian)</option><option value="RO">Romanian</option><option value="RU">Russian</option><option value="SK">Sloak</option><option value="SL">Slovenian</option><option value="ES">Spanish</option><option value="SV">Swedish</option>'; 34 var watsonLanguages = "<option value='ar'>Arabic</option><option value='eu'>Basque</option><option value='bg'>Bulgarian</option><option value='bn'>Bengali</option><option value='bs'>Bosnian</option><option value='ca'>Catalan</option><option value='zh'>Chinese (Simplified)</option><option value='zh-TW'>Chinese (Traditional)</option><option value='hr'>Croatian</option><option value='cs'>Czech</option><option value='da'>Danish</option><option value='nl'>Dutch</option><option value='en' selected>English</option><option value='et'>Estonian</option><option value='fi'>Finnish</option><option value='fr-CA'>French (Canada)</option><option value='fr'>French</option><option value='de'>German</option><option value='el'>Greek</option><option value='gu'>Gujarati</option><option value='he'>Hebrew</option><option value='hi'>Hindi</option><option value='hu'>Hungarian</option><option value='ga'>Irish</option><option value='id'>Indonesian</option><option value='it'>Italian</option><option value='ja'>Japanese</option><option value='ko'>Korean</option><option value='lt'>Lithuanian</option><option value='lv'>Latvian</option><option value='ml'>Malayalam</option><option value='ms'>Malay</option><option value='mt'>Maltese</option><option value='cnr'>Montenegrin</option><option value='ne'>Nepali</option><option value='nb'>Norwegian Bokmal</option><option value='pl'>Polish</option><option value='pt'>Portuguese</option><option value='ro'>Romanian</option><option value='ru'>Russian</option><option value='sr'>Serbian</option><option value='si'>Sinhala</option><option value='sk'>Slovakian</option><option value='sl'>Slovenian</option><option value='es'>Spanish</option><option value='sv'>Swedish</option><option value='ta'>Tamil</option><option value='te'>Telugu</option><option value='th'>Thai</option><option value='tr'>Turkish</option><option value='uk'>Ukrainian</option><option value='ur'>Urdu</option><option value='vi'>Vietnamese</option><option value='cy'>Welsh</option>"; 35 36 var currentStorageItemsFilledFirstTime = false; 6 37 7 38 ( function( blocks, blockEditor, element, richText ) { 8 39 var el = wp.element.createElement; 9 10 40 11 41 var __ = wp.i18n.__; … … 43 73 type: 'string' 44 74 }, 75 pBPE1: { 76 type: 'string' 77 }, 78 pBPE2: { 79 type: 'string' 80 }, 81 pBPE3: { 82 type: 'string' 83 }, 84 pSalesPurpose: { 85 type: 'string' 86 }, 87 pSalesName: { 88 type: 'string' 89 }, 90 pSalesCompanyName: { 91 type: 'string' 92 }, 93 pSalesIndustry: { 94 type: 'string' 95 }, 96 pSalesLeadName: { 97 type: 'string' 98 }, 99 pSalesLeadCompanyName: { 100 type: 'string' 101 }, 102 pSalesLeadIndustry: { 103 type: 'string' 104 }, 105 pSalesLeadGoals: { 106 type: 'string' 107 }, 108 pSalesProductBenifits: { 109 type: 'string' 110 }, 111 pGoal: { 112 type: 'string' 113 }, 114 pExperience: { 115 type: 'string' 116 }, 117 pDelivery: { 118 type: 'string' 119 }, 120 pHighlights: { 121 type: 'string' 122 }, 45 123 pTone: { 46 124 type: 'string' … … 55 133 type: 'string' 56 134 }, 135 pAudience: { 136 type: 'string' 137 }, 138 pKeywords: { 139 type: 'string' 140 }, 57 141 pIncludeIntros: { 58 142 type: 'string' 59 143 }, 144 pIncludeTrends: { 145 type: 'string' 146 }, 60 147 pLoginEmail: { 61 148 type: 'string' … … 67 154 type: 'string' 68 155 }, 69 pLanguage: { 156 pLanguageService: { 157 type: 'string' 158 }, 159 pLanguageSource: { 160 type: 'string' 161 }, 162 pLanguageTarget: { 163 type: 'string' 164 }, 165 pLanguageFormality: { 70 166 type: 'string' 71 167 }, … … 233 329 } 234 330 331 function uncapitalizeFirstLetter(string) { 332 return string.charAt(0).toLowerCase() + string.slice(1); 333 } 334 335 function cleanup(string) { 336 337 string = string.replace(/^\s+/g, ''); //trim left white space 338 if (string.charAt(0) == '.') { 339 string = string.substring(1, string.length); 340 } 341 string = string.replace(/^\s+/g, ''); //trim left white space 342 return string; 343 344 } 345 346 function generateLoremIpsum(length = 300) { 347 var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam auctor lobortis lacus eget tempor. Sed luctus porttitor porttitor. Nullam lorem augue, congue vel nisi eu, luctus faucibus sapien. Duis tortor lectus, porttitor quis maximus vel, viverra nec augue. Maecenas vel nisi vel orci tincidunt tincidunt ut vel eros. Fusce rhoncus scelerisque pretium. In a porttitor lectus. Sed mollis efficitur tincidunt. Vestibulum ut odio sit amet ligula viverra sagittis eu et lorem. Donec elit justo, varius sed ullamcorper non, aliquet in erat. Mauris dictum porttitor lorem, in gravida purus auctor sed."; 348 var rand = Math.floor(Math.random() * length); 349 var trimmedString = lorem.substring(0, rand); 350 return trimmedString+". "; 351 352 } 353 354 function formatAMPM(date) { 355 var hours = date.getHours(); 356 var minutes = date.getMinutes(); 357 var ampm = hours >= 12 ? 'pm' : 'am'; 358 hours = hours % 12; 359 hours = hours ? hours : 12; // the hour '0' should be '12' 360 minutes = minutes < 10 ? '0'+minutes : minutes; 361 var strTime = hours + ':' + minutes + ' ' + ampm; 362 return strTime; 363 } 364 365 function formatMonthName() { 366 const monthNames = ["January", "February", "March", "April", "May", "June", 367 "July", "August", "September", "October", "November", "December" 368 ]; 369 370 const d = new Date(); 371 return monthNames[d.getMonth()]; 372 } 373 374 function CopyToClipboard(containerid) { 375 jQuery("#"+containerid).select(); 376 document.execCommand('copy'); 377 } 378 function sendRating(rating) { 379 currentData.source = 'webapp'; 380 jQuery.ajax({ 381 type: "POST", 382 dataType: "json", 383 data : {hash: cbai_data.hash, feedbackData : JSON.stringify(currentData), feedbackRating: rating}, 384 url: cb_HOST+"feedback", 385 success: function(msg){ 386 387 } 388 }); 389 document.querySelector("#content-bot-rating").classList.add('hidden'); 390 alert("Feedback sent"); 391 } 392 393 function cbFavToggleHandler(fav, data, complete){ 394 var rel = atob(data); 395 rel = cbHashCodeFromString(rel); 396 397 var action = fav ? 'fav' : 'unfav'; 398 var url = "https://contentbot.ai/app/api/"; 399 400 var query = "?action=" + action + "&apikey=" + cbai_data.hash + "&rel=" + rel; 401 402 jQuery.get(url + query).always(function( data ) { 403 if(typeof complete === 'function'){ 404 complete(); 405 } 406 }); 407 } 408 409 function cbOutputDeleteHandler(outputId, complete){ 410 outputId = parseInt(outputId); 411 412 var url = "https://contentbot.ai/app/api/"; 413 414 var query = "?action=delete_output&apikey=" + cbai_data.hash + "&output=" + outputId; 415 416 jQuery.get(url + query).always(function( data ) { 417 if(typeof complete === 'function'){ 418 complete(); 419 } 420 }); 421 } 422 423 function cbHashCodeFromString(s){ 424 return s.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0); 425 } 426 427 function cleanString(input) { 428 var output = ""; 429 for (var i=0; i<input.length; i++) { 430 if (input.charCodeAt(i) <= 127) { 431 output += input.charAt(i); 432 } 433 } 434 return output; 435 } 436 function removeNumbers(string) { 437 string = string.replace("1.", ""); 438 string = string.replace("2.", ""); 439 string = string.replace("3.", ""); 440 string = string.replace("4.", ""); 441 string = string.replace("5.", ""); 442 string = string.replace("6.", ""); 443 string = string.replace("7.", ""); 444 return string.replace(/^\s+/g, ''); //trim left white space 445 } 446 function genHexString(len) { 447 const hex = '0123456789ABCDEF'; 448 let output = ''; 449 for (let i = 0; i < len; ++i) { 450 output += hex.charAt(Math.floor(Math.random() * hex.length)); 451 } 452 return output; 453 } 454 455 function addWordCount(id, output) { 456 if (typeof output == 'object') { 457 if (typeof output.wordCount !== 'undefined') { 458 return '<span class="wordCount cb-word-count">'+output.wordCount+' words</span>'; 459 } 460 } 461 return ""; 462 } 463 function addReadingScore(id, output) { 464 if (typeof output == 'object') { 465 if (typeof output.en_fleschReadingEase_score !== 'undefined') { 466 var score = parseInt(output.en_fleschReadingEase_score); 467 var color = 'pastel-green'; 468 469 /* 470 if (score > 0 && score <= 25) { 471 color = 'pastel-red'; 472 } else if (score > 25 && score <= 50) { 473 color = 'pastel-orange'; 474 } else if (score > 50 && score <= 75) { 475 color = 'pastel-yellow'; 476 } else { 477 color = 'pastel-green'; 478 } 479 */ 480 return '<span class="readingScore cb-reading-score '+color+'" title="Reading Ease Score"><i class="fa fa-book"></i> '+output.en_fleschReadingEase_score+'</span>'; 481 } 482 } 483 return ""; 484 } 485 486 function addUniquenessScore(id, output){ 487 if(typeof output === 'object' && typeof output.plagiarismData !== 'undefined'){ 488 if(typeof output.plagiarismData.score !== 'undefined'){ 489 var color = 'pastel-green'; 490 var title = "Uniqueness: " + output.plagiarismData.score.uniqueness.toFixed(0) + "% || Plagiarism: " + output.plagiarismData.score.plagiarism.toFixed(0) + "%"; 491 492 var urls = []; 493 if(output.plagiarismData.outputs){ 494 for(var outputI in output.plagiarismData.outputs){ 495 var outputData = output.plagiarismData.outputs[outputI]; 496 for(var queryI in outputData.details){ 497 var details = outputData.details[queryI]; 498 if(details.matched_urls.length > 0){ 499 for(var urlI in details.matched_urls){ 500 urls.push(details.matched_urls[urlI]); 501 } 502 } 503 } 504 } 505 } 506 507 var dataAttributes = 'data-uniqueness="' + output.plagiarismData.score.uniqueness.toFixed(0) + '" '; 508 dataAttributes += 'data-plagiarism="' + output.plagiarismData.score.plagiarism.toFixed(0) + '" '; 509 dataAttributes += 'data-urls="' + urls.join(',') + '" '; 510 511 var html = '<span class="uniquenessScore cb-uniqueness-score '+color+'" title="' + title + '" ' + dataAttributes + '>'; 512 html += '<i class="fa fa-eye"></i> ' + output.plagiarismData.score.uniqueness.toFixed(0) + '%'; 513 html += "</span>"; 514 515 return html; 516 517 } 518 } 519 return ""; 520 } 521 522 function addDropdown(id) { 523 524 var html = ''; 525 html += '<div class="dropdown">'; 526 html += ' <button onclick="" bid="'+id+'" class="dropbtn cb-ellipsis"><i class="fa fa-chevron-down"></i></button>'; 527 html += ' <div id="dropdown_'+id+'" class="dropdown-content">'; 528 html += ' <a href="javascript:void(0);" bid="'+id+'" class="actionCopy">Copy to Clipboard</a>'; 529 html += ' </div>'; 530 html += '</div>'; 531 return html; 532 } 533 534 function addFavorite(data){ 535 data = JSON.stringify(data); 536 data = btoa(unescape(encodeURIComponent(data))); 537 var html = ''; 538 html += "<div class='cb-fav-toggle cb-fav-editor' data-json='" + data + "'>"; 539 html += "<i class='fa fa-heart'></i>"; 540 html += "</div>"; 541 return html; 542 } 543 544 function buildSettingsQueryParam(){ 545 var query = ""; 546 if(typeof cbai_settings !== 'undefined'){ 547 for(var i in cbai_settings){ 548 var setting = cbai_settings[i]; 549 if(setting === "on"){ 550 setting = 1; 551 } 552 query += "&_" + i + "=" + setting; 553 } 554 } 555 return query; 556 557 } 558 559 function uniquenessScoreModal(uniqueness, plagiarism, urls){ 560 if(urls.trim() !== ''){ 561 urls = urls.split(','); 562 } 563 564 var modalHtml = '<div class="uniquenessModal modal fade" tabindex="-1">'; 565 modalHtml += '<div class="modal-dialog">'; 566 modalHtml += '<div class="modal-content">'; 567 568 modalHtml += '<div class="modal-header">'; 569 modalHtml += '<h5 class="modal-title">Uniqueness Score</h5>'; 570 modalHtml += '<button type="button" class="close" data-dismiss="modal" aria-label="Close">'; 571 modalHtml += '<span aria-hidden="true">×</span>'; 572 modalHtml += '</button>'; 573 modalHtml += '</div>'; 574 575 modalHtml += '<div class="modal-body">'; 576 modalHtml += '<div class="row">'; 577 578 modalHtml += '<div class="col-6">'; 579 modalHtml += '<h6>Uniqueness</h6>'; 580 modalHtml += '<h4>' + uniqueness + '%</h4>'; 581 modalHtml += '</div>'; 582 583 modalHtml += '<div class="col-6">'; 584 modalHtml += '<h6>Plagiarism</h6>'; 585 modalHtml += '<h4>' + plagiarism + '%</h4>'; 586 modalHtml += '</div>'; 587 588 modalHtml += '</div>'; 589 590 if(urls.length > 0){ 591 modalHtml += '<div class="row">'; 592 modalHtml += '<div class="col-12">'; 593 modalHtml += '<h6>Sources</h6>'; 594 595 for(var i in urls){ 596 var label = urls[i]; 597 if(label.length > 60){ 598 label = label.substring(0, 30) + '...' + label.substring(label.length - 30); 599 } 600 modalHtml += '<small> • <a href="' + urls[i] + '" target="_BLANK">' + label + "</a></small><br>"; 601 } 602 603 modalHtml += '</div>'; 604 modalHtml += '</div>'; 605 } 606 607 608 modalHtml += '</div>'; 609 610 modalHtml += '</div>'; 611 modalHtml += '</div>'; 612 modalHtml += '</div>'; 613 614 615 jQuery('#wrapper').find('.uniquenessModal').remove(); 616 jQuery('#wrapper').append(modalHtml); 617 jQuery('.uniquenessModal').modal('show'); 618 619 } 620 621 function highlightPlagiarizedPhrases(outputHTML, data, id){ 622 if(data.plagiarismData){ 623 if(data.plagiarismData.score && data.plagiarismData.score.plagiarism > 0){ 624 var plagiarizedPhrases = []; 625 626 if(data.plagiarismData.outputs){ 627 for(var i in data.plagiarismData.outputs){ 628 var output = data.plagiarismData.outputs[i]; 629 if(output.details){ 630 for(var dI in output.details){ 631 var query = output.details[dI]; 632 if(query.totalMatches !== 0){ 633 plagiarizedPhrases.push(query.query); 634 } 635 } 636 } 637 } 638 639 if(plagiarizedPhrases.length > 0){ 640 for(var i in plagiarizedPhrases){ 641 if(outputHTML.indexOf(plagiarizedPhrases[i]) !== -1){ 642 outputHTML = outputHTML.replace(plagiarizedPhrases[i], "<mark title='Plagiarism Detected'>" + plagiarizedPhrases[i] + '</mark>'); 643 } else { 644 /* Something else is up with this, we know the phrase exists, so let's split the phrase a bit more to make sure it does get highlighted to some degree */ 645 var subPhrases = chunkPhraseToWords(plagiarizedPhrases[i], 3); 646 for(var phraseSubI in subPhrases){ 647 var subPhrase = subPhrases[phraseSubI]; 648 if(subPhrase.length > 0){ 649 outputHTML = outputHTML.replace(subPhrase, "<mark title='Plagiarism Detected'>" + subPhrase + '</mark>'); 650 } 651 } 652 } 653 } 654 } 655 } 656 } 657 } 658 659 return outputHTML; 660 } 661 662 function chunkPhraseToWords(phrase, wordsPerChunk){ 663 var phrasedWords = phrase.split(" "); 664 var chunks = []; 665 var chunkCount = Math.ceil(phrasedWords.length / wordsPerChunk); 666 for(var i = 0; i < chunkCount; i++){ 667 var chunk = []; 668 for(var wI = 0; wI < wordsPerChunk && phrasedWords.length > 0; wI++){ 669 chunk.push(phrasedWords.shift()); 670 } 671 672 chunks.push(chunk.join(" ")); 673 } 674 675 return chunks; 676 } 677 678 /////////////////////////////// 679 // FUNCTIONS TO BUILD FRAMES // 680 /////////////////////////////// 681 function buildStartupFrame(content) { 682 var outputHTML = ''; 683 outputHTML += '<br><strong>Startup Idea</strong>'; 684 outputHTML += '<br><span>' + content + '</span>'; 685 return outputHTML; 686 } 687 688 function buildHeadlineFrame(content) { 689 var outputHTML = ''; 690 outputHTML += content; 691 /* 692 outputHTML += '<h4 class="blurtext mt-4">Get inspiration for blog topics, blog intros, ad copy, brand names, and more!</h4>'; 693 outputHTML += '<a href="javascript:void(0)" class="mt-4 blurtext btn contentBotGenerate btn-primary"><i class="fa fa-bolt" aria-hidden="true"></i> Demo Button</a>'; 694 outputHTML += '<p class="blurtext mt-5" style="font-size: 15px;">Join <span class="pink">999 content creators</span> who have been inspired with <strong>AI Content</strong> <span class="pink">99,999 times</span> so far.</p>'; 695 */ 696 return outputHTML; 697 } 698 699 function buildProductDescriptionFrame(content, productName) { 700 var outputHTML = ''; 701 outputHTML += '<br><strong>' + productName + '</strong>'; 702 outputHTML += '<br>'+content; 703 return outputHTML 704 } 705 706 function buildSalesEmailFrame(content) { 707 var outputHTML = ''; 708 var trim = content.replace(/^\s+|\s+$/g, ''); 709 outputHTML += '<br><strong>'+jQuery("#cbaiSales_Name").val()+' <[email protected]></strong>'; 710 outputHTML += '<br><span>to '+jQuery("#cbaiSales_LeadName").val()+'</span>'; 711 outputHTML += '<p>Hi '+jQuery("#cbaiSales_LeadName").val()+',</p>'+trim; 712 return outputHTML 713 } 714 715 function buildAdWordsAdFrame(content) { 716 var outputHTML = ''; 717 if (typeof content.headline2 == 'undefined') { content.headline2 = '...' } 718 if (typeof content.headline3 == 'undefined') { content.headline3 = '...' } 719 if (typeof content.line2 == 'undefined') { content.line2 = '...' } 720 if (typeof content.line3 == 'undefined') { content.line3 = '...' } 721 if (typeof content.headline1 !== 'undefined' && typeof content.headline2!== 'undefined' && typeof content.headline3 !== 'undefined' && typeof content.line1 !== 'undefined' && typeof content.line2 !== 'undefined' && typeof content.line3 !== 'undefined' ) { 722 outputHTML += '<br><strong>Ad</strong><span> - www.yoursite.com/</span>' 723 outputHTML += "<br><strong>"+content.headline1+" | "+content.headline2+" | "+content.headline3+"</strong>"; 724 outputHTML += "<p>"+content.headline1.replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'")+" | "+content.headline2.replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'")+" | " +content.headline3.replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'")+ "\n"+content.line1.replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'").replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'")+" "+content.line2.replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'").replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'")+" "+content.line3.replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'").replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'")+"</p>"; 725 outputHTML += "<p>"+content.line1+" "+content.line2+" "+content.line3+"</p>"; 726 } 727 return outputHTML; 728 } 729 730 function buildLandingPageFrame(content) { 731 var relData = JSON.stringify(content); 732 relData = relData.replaceAll('’', "'"); 733 relData = relData.replaceAll('‘', "'"); 734 relData = relData.replaceAll('“', '"'); 735 relData = relData.replaceAll('”', '"'); 736 rel = cbHashCodeFromString(relData); 737 var outputHTML = ''; 738 if (typeof content.header == 'undefined') { content.header = '...' } 739 if (typeof content.header_copy == 'undefined') { content.header_copy = '...' } 740 if (typeof content.sub_header == 'undefined') { content.sub_header = '...' } 741 if (typeof content.sub_header_copy == 'undefined') { content.sub_header_copy = '...' } 742 if (typeof content.reinforcing == 'undefined') { content.reinforcing = '...' } 743 744 //Link 745 outputHTML += "<br><span><a href='https://contentbot.ai/app/page-preview.php?rel=" + rel + "' target='_BLANK' class='btn btn-primary btn-sm'>Preview Page</a></span>"; 746 747 //Header 748 outputHTML += "<p>"; 749 outputHTML += "<br><strong>-- Header --</strong>"; 750 outputHTML += "<br><strong>"+content.header+"</strong>"; 751 outputHTML += "<br><<span>"+content.header_copy+"</span>"; 752 outputHTML += '</p>'; 753 754 //Sub Header 755 outputHTML += "<p>"; 756 outputHTML += "<br><strong>-- Sub-header --</strong>"; 757 outputHTML += "<br><strong>"+content.sub_header+"</strong>"; 758 outputHTML += "<br><span>"+content.sub_header_copy+"</span>"; 759 outputHTML += '</p>'; 760 761 //Reinforcing 762 outputHTML += "<p>"; 763 outputHTML += "<br><strong>-- Reinforcing --</strong>"; 764 outputHTML += "<br><span>"+content.reinforcing+"</span>"; 765 outputHTML += '</p>'; 766 767 //Feature 1 768 if (typeof content.feature_1_title !== 'undefined' && typeof content.feature_1_desc !== 'undefined') { 769 outputHTML += "<p>"; 770 outputHTML += "<strong>-- Feature 1 --</strong>"; 771 outputHTML += "<br><strong>"+content.feature_1_title+"</strong>"; 772 outputHTML += "<br><span>"+content.feature_1_desc+"</span>"; 773 outputHTML += '</p>'; 774 } 775 776 //Feature 2 777 if (typeof content.feature_2_title !== 'undefined' && typeof content.feature_2_desc !== 'undefined') { 778 outputHTML += "<p>"; 779 outputHTML += "<strong>-- Feature 2 --</strong>"; 780 outputHTML += "<br><strong>"+content.feature_2_title+"</strong>"; 781 outputHTML += "<br><span>"+content.feature_2_desc+"</span>"; 782 outputHTML += '</p>'; 783 } 784 785 //Feature 3 786 if (typeof content.feature_3_title !== 'undefined' && typeof content.feature_3_desc !== 'undefined') { 787 outputHTML += "<p>"; 788 outputHTML += "<strong>-- Feature 3 --</strong>"; 789 outputHTML += "<br><strong>"+content.feature_3_title+"</strong>"; 790 outputHTML += "<br><span>"+content.feature_3_desc+"</span>"; 791 outputHTML += '</p>'; 792 } 793 794 //Benifit 1 795 if (typeof content.benefit_1_title !== 'undefined' && typeof content.benefit_1_desc !== 'undefined') { 796 outputHTML += "<p>"; 797 outputHTML += "<strong>-- Benifit 1 --</strong>"; 798 outputHTML += "<br><strong>"+content.benefit_1_title+"</strong>"; 799 outputHTML += "<br><span>"+content.benefit_1_desc+"</span>"; 800 outputHTML += '</p>'; 801 } 802 803 //Benifit 2 804 if (typeof content.benefit_2_title !== 'undefined' && typeof content.benefit_2_desc !== 'undefined') { 805 outputHTML += "<p>"; 806 outputHTML += "<strong>-- Benifit 2 --</strong>"; 807 outputHTML += "<br><strong>"+content.benefit_2_title+"</strong>"; 808 outputHTML += "<br><span>"+content.benefit_2_desc+"</span>"; 809 outputHTML += '</p>'; 810 } 811 812 //Benifit 3 813 if (typeof content.benefit_3_title !== 'undefined' && typeof content.benefit_3_desc !== 'undefined') { 814 outputHTML += "<p>"; 815 outputHTML += "<strong>-- Benifit 3 --</strong>"; 816 outputHTML += "<br><strong>"+content.benefit_3_title+"</strong>"; 817 outputHTML += "<br><span>"+content.benefit_3_desc+"</span>"; 818 outputHTML += '</p>'; 819 } 820 821 return outputHTML; 822 } 823 824 function buildPASFrame(content) { 825 var outputHTML = ''; 826 if (typeof content.pain !== 'undefined' && typeof content.agitate !== 'undefined' && typeof content.solution !== 'undefined') { 827 outputHTML += "<br><strong>Pain: </strong>"+content.pain+"<br><strong>Agitate: </strong>"+content.agitate+"<br><strong>Solution: </strong>"+content.solution; 828 } 829 return outputHTML; 830 } 831 832 function buildPBSFrame(content) { 833 var outputHTML = ''; 834 if (typeof content.pain !== 'undefined' && typeof content.benefit !== 'undefined' && typeof content.solution !== 'undefined') { 835 outputHTML += "<br><strong>Pain: </strong>"+content.pain+"<br><strong>Benefit: </strong>"+content.benefit+"<br><strong>Solution: </strong>"+content.solution; 836 } 837 return outputHTML; 838 } 839 840 function buildAnswersFrame(content) { 841 var outputHTML = ''; 842 content.text = content.text.replaceAll("\n","<br>"); 843 outputHTML += "<br>"+content.text; 844 return outputHTML; 845 } 846 847 function buildAIDAFrame(content) { 848 var outputHTML = ''; 849 if (typeof content.attention !== 'undefined' && typeof content.interest !== 'undefined' && typeof content.desire !== 'undefined' && typeof content.action !== 'undefined') { 850 outputHTML += "<br><strong>Attention: </strong>"+content.attention; 851 outputHTML += "<br><strong>Interest: </strong>"+content.interest; 852 outputHTML += "<br><strong>Desire: </strong>"+content.desire; 853 outputHTML += "<br><strong>Action: </strong>"+content.action; 854 } 855 return outputHTML; 856 } 857 858 function buildBlogOutlineFrame(content, topic = false) { 859 var outputHTML = ''; 860 if (topic) { outputHTML += "<br><strong>"+topic+"</strong>"; } 861 for (k in content) { 862 if (typeof content[k].text !== 'undefined' && content[k].text !== '') { 863 let stoprun = false; 864 let sectionClass = ''; 865 if (content[k].sectionType == 'Section') { sectionClass = 'outlineSection'; } 866 if (content[k].sectionType == 'Subsection') { sectionClass = 'outlineSubSection'; } 867 if (content[k].sectionType == 'Takeaway') { sectionClass = 'outlineTakeaway'; stoprun = true; } 868 outputHTML += "<br><span>- "+content[k].text+"</span>"; 869 if (stoprun) { 870 break; 871 } 872 } 873 } 874 return outputHTML; 875 } 876 877 function buildFacebookAdFrame(content) { 878 var outputHTML = ''; 879 if (typeof content.primary_text !== 'undefined' && typeof content.headline !== 'undefined' && content.primary_text !== '' && content.headline !== '') { 880 outputHTML += '<br><strong>'+jQuery("#cbai_input_name").val()+'</strong>'; 881 outputHTML += '<br><span>- Sponsored -</span>'; 882 outputHTML += "<br><span>"+content.primary_text+"</span>"; 883 } 884 return outputHTML; 885 } 886 887 function buildBrandNamesFrame(content) { 888 var outputHTML = ''; 889 var currentSlogan = content.slogan; 890 var brandNameHtml = ''; 891 var brandNameAlternativesHtml = ''; 892 var cn = 0; 893 for (k in content) { 894 cn++; 895 if (typeof content[k].brand_name !== 'undefined' && content[k].brand_name !== '') { 896 if (cn == 1) { 897 // first brand name, use this as the main name and use the others as alternatives 898 brandNameHtml = content[k].brand_name; 899 } else { 900 brandNameAlternativesHtml += "<span><em>"+content[k].brand_name+'</em></span>'; 901 } 902 } 903 } 904 outputHTML += "<br><strong>"+brandNameHtml+"</strong>"; 905 outputHTML += "<br><strong>Alternatives: </strong>"+brandNameAlternativesHtml; 906 outputHTML += "<br><strong>Slogan: </strong><span><em>"+currentSlogan+"</em></span>"; 907 return outputHTML; 908 } 909 910 function buildYouTubeIdeas(content) { 911 var outputHTML = ''; 912 if (typeof content.video_idea !== 'undefined' && typeof content.description !== 'undefined' && content.video_idea !== '' && content.description !== '') { 913 /* 914 if (typeof content.image !== 'undefined' && content.image !== '') { 915 outputHTML += "<img src='"+content.image_still+"' width='200' id='giphy_"+uidd+"' gif='"+content.image+"' still='"+content.image_still+"' />"; 916 } else { 917 outputHTML += "<img src='https://contentbot.ai/app/assets/img/youtube_placeholder.jpg' width='200' />"; 918 } 919 */ 920 outputHTML += '<br><strong>'+content.video_idea+'</strong>'; 921 outputHTML += '<br><span>'+content.description+'</span>'; 922 } 923 return outputHTML; 924 } 925 235 926 236 927 function sendRating(props, rating) { … … 246 937 alert("Feedback sent"); 247 938 } 248 249 250 939 if (jQuery('#cbai_input_copy_type').length < 1){ 940 currentStorageItemsFilledFirstTime = false; 941 } 942 943 //LocalStorage handling on page load 944 if (currentStorageItemsFilledFirstTime == false){ 945 setTimeout(function() { 946 for (k in validation) { 947 if (jQuery('#cbai_input_copy_type').length > 0){ 948 var currentStorageItem = localStorage.getItem("cb_"+k); 949 if (currentStorageItem !== null) { 950 jQuery("#"+k).val(currentStorageItem); 951 currentStorageItemsFilledFirstTime = true; 952 } 953 } 954 } 955 956 jQuery('#cbai_input_language_service').trigger('change'); 957 var currentStorageItem_From = localStorage.getItem("cbai_input_language_source"); 958 if (currentStorageItem_From !== null) { 959 jQuery("#cbai_input_language_source").val(currentStorageItem_From).trigger('change'); 960 } 961 var currentStorageItem_To = localStorage.getItem("cbai_input_language_target"); 962 if (currentStorageItem_To !== null) { 963 jQuery("#cbai_input_language_target").val(currentStorageItem_To).trigger('change'); 964 } 965 966 // Disable language settings related to DeepL 967 jQuery("#cbai_input_language_formality").attr('disabled',true); 968 jQuery("#cbai_input_language_formality").attr('readonly',true); 969 jQuery("#FormalityHelperService").show(); 970 },250); 971 } 972 251 973 return [ 252 974 … … 475 1197 options: [ 476 1198 { value: 'product_description', label: 'Product Description' }, 477 { value: 'headline_ideas', label: 'P ossible Headlines Ideas' },1199 { value: 'headline_ideas', label: 'Page Headlines Ideas' }, 478 1200 { value: 'marketing_ideas', label: 'Marketing Ideas' }, 479 1201 { value: 'blog_topics', label: 'Blog Topic Ideas' }, 480 { value: 'blog_intro', label: 'Blog Intro' } 1202 { value: 'boutline', label: 'Blog Outline' }, 1203 { value: 'bpe', label: 'Bullet Point Expander' }, 1204 { value: 'blog_intro', label: 'Blog Intro' }, 1205 { value: 'listicle', label: 'Listicle' }, 1206 { value: 'change_tone', label: 'Change Tone' }, 1207 { value: 'summarizer', label: 'Summarizer' }, 1208 { value: 'finish_sentence', label: 'Finish the Sentence' }, 1209 { value: 'startup_ideas', label: 'Startup Ideas' }, 1210 { value: 'brand_names', label: 'Brand Names' }, 1211 { value: 'slogan', label: 'Slogan Generator' }, 1212 { value: 'adwords_ad', label: 'AdWords Ads' }, 1213 { value: 'facebook_ad', label: 'Facebook Ads' }, 1214 { value: 'youtube_ideas', label: 'Video Ideas' }, 1215 { value: 'video_description', label: 'Video Description' }, 1216 { value: 'landing_page', label: 'Landing Page' }, 1217 { value: 'value_proposition', label: 'Value Proposition' }, 1218 { value: 'rewriter', label: 'Sentence Rewriter' }, 1219 { value: 'pitch_yourself', label: 'Pitch Yourself' }, 1220 { value: 'pas', label: 'Pain-Agitate-Solution' }, 1221 { value: 'pbs', label: 'Pain-Benefit-Solution' }, 1222 { value: 'aida', label: 'AIDA' }, 1223 { value: 'answers', label: 'Quora Answers' }, 1224 { value: 'sales_email', label: 'Sales Email' }, 481 1225 ], 482 1226 onChange:function( content2 ) { 483 props.setAttributes({pType: content2}); 484 1227 1228 currentStorageItemsFilledFirstTime = false; 1229 1230 // Set validation 1231 validation = { 1232 'cbai_input_name' : false, 1233 'cbai_input_desc' : false, 1234 'cbai_input_tone' : false, 1235 'cbai_input_industry' : false, 1236 'cbai_input_topic' : false, 1237 'cbai_input_audience' : false, 1238 'cbai_input_keywords' : false, 1239 'cbaiSales_Purpose' : false, 1240 'cbaiSales_Name' : false, 1241 'cbaiSales_CompanyName' : false, 1242 'cbaiSales_Industry' : false, 1243 'cbaiSales_LeadName' : false, 1244 'cbaiSales_LeadCompanyName' : false, 1245 'cbaiSales_LeadIndustry' : false, 1246 'cbaiSales_LeadGoals' : false, 1247 'cbaiSales_ProductBenefits' : false, 1248 'cbai_BPE_1' : false, 1249 'cbai_BPE_2' : false, 1250 'cbai_BPE_3' : false, 1251 'cbaiPitch_InputDelivery' : false, 1252 'cbaiPitch_InputGoal' : false, 1253 'cbaiPitch_InputHighlights' : false, 1254 'cbaiPitch_InputExperience' : false, 1255 }; 1256 1257 for (k in validation) { 1258 var currentStorageItem = localStorage.getItem("cb_"+k); 1259 if (currentStorageItem !== null) { 1260 jQuery("#"+k).val(currentStorageItem); 1261 1262 } 1263 } 1264 1265 setTimeout(function() { 1266 jQuery('#cbai_input_language_service').trigger('change'); 1267 var currentStorageItem_From = localStorage.getItem("cbai_input_language_source"); 1268 if (currentStorageItem_From !== null) { 1269 jQuery("#cbai_input_language_source").val(currentStorageItem_From).trigger('change'); 1270 } 1271 var currentStorageItem_To = localStorage.getItem("cbai_input_language_target"); 1272 if (currentStorageItem_To !== null) { 1273 jQuery("#cbai_input_language_target").val(currentStorageItem_To).trigger('change'); 1274 } 1275 },250); 1276 1277 1278 props.setAttributes({pType: content2}); 1279 1280 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1281 1282 if (content2 == 'headline_ideas') { 1283 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1284 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1285 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1286 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1287 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1288 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1289 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1290 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1291 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1292 document.querySelector("#cbaiTone").classList.remove('hidden'); 485 1293 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1294 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1295 1296 jQuery('#cbaiProductDescription label').html('Short Description'); 1297 validation.cbai_input_name = true; 1298 validation.cbai_input_desc = true; 1299 validation.cbai_input_tone = true; 1300 } else if (content2 == 'marketing_ideas') { 1301 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1302 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1303 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1304 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1305 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1306 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1307 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1308 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1309 document.querySelector("#cbaiIndustry").classList.remove('hidden'); 1310 document.querySelector("#cbaiTone").classList.add('hidden'); 1311 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1312 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1313 1314 jQuery('#cbaiProductDescription label').html('Short Description'); 1315 validation.cbai_input_name = true; 1316 validation.cbai_input_desc = true; 1317 validation.cbai_input_industry = true; 1318 } else if (content2 == 'blog_topics') { 1319 document.querySelector("#cbaiBlogTopic").classList.remove('hidden'); 1320 document.querySelector("#cbaiProductName").classList.add('hidden'); 1321 document.querySelector("#cbaiProductDescription").classList.add('hidden'); 1322 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1323 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1324 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1325 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1326 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1327 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1328 document.querySelector("#cbaiTone").classList.add('hidden'); 1329 document.querySelector("#cbaiIncludeIntros").classList.remove('hidden'); 1330 document.querySelector("#cbaiIncludeTrends").classList.remove('hidden'); 1331 1332 jQuery('#cbaiProductDescription label').html('Short Description'); 1333 validation.cbai_input_topic = true; 1334 } else if (content2 == 'boutline') { 1335 document.querySelector("#cbaiBlogTopic").classList.remove('hidden'); 1336 document.querySelector("#cbaiProductName").classList.add('hidden'); 1337 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1338 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1339 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1340 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1341 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1342 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1343 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1344 document.querySelector("#cbaiTone").classList.add('hidden'); 1345 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1346 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1347 1348 jQuery('#cbaiProductDescription label').html('Article Description'); 1349 validation.cbai_input_topic = true; 1350 validation.cbai_input_desc = true; 1351 } else if (content2 == 'bpe') { 1352 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1353 document.querySelector("#cbaiProductName").classList.add('hidden'); 1354 document.querySelector("#cbaiProductDescription").classList.add('hidden'); 1355 document.querySelector("#cbaiRowBPEFields").classList.remove('hidden'); 1356 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1357 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1358 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1359 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1360 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1361 document.querySelector("#cbaiTone").classList.add('hidden'); 1362 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1363 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1364 1365 validation.cbai_BPE_1 = true; 1366 validation.cbai_BPE_2 = true; 1367 validation.cbai_BPE_3 = true; 1368 } else if (content2 == 'blog_intro') { 1369 document.querySelector("#cbaiBlogTopic").classList.remove('hidden'); 1370 document.querySelector("#cbaiProductName").classList.add('hidden'); 1371 document.querySelector("#cbaiProductDescription").classList.add('hidden'); 1372 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1373 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1374 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1375 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1376 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1377 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1378 document.querySelector("#cbaiTone").classList.remove('hidden'); 1379 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1380 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1381 1382 validation.cbai_input_topic = true; 1383 validation.cbai_input_tone = true; 1384 } else if (content2 == 'listicle') { 1385 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1386 document.querySelector("#cbaiProductName").classList.add('hidden'); 1387 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1388 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1389 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1390 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1391 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1392 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1393 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1394 document.querySelector("#cbaiTone").classList.add('hidden'); 1395 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1396 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1397 1398 jQuery('#cbaiProductDescription label').html('Short Description'); 1399 validation.cbai_input_desc = true; 1400 } else if (content2 == 'change_tone') { 1401 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1402 document.querySelector("#cbaiProductName").classList.add('hidden'); 1403 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1404 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1405 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1406 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1407 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1408 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1409 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1410 document.querySelector("#cbaiTone").classList.remove('hidden'); 1411 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1412 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1413 1414 jQuery('#cbaiProductDescription label').html('Paragraph'); 1415 validation.cbai_input_desc = true; 1416 validation.cbai_input_tone = true; 1417 } else if (content2 == 'summarizer') { 1418 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1419 document.querySelector("#cbaiProductName").classList.add('hidden'); 1420 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1421 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1422 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1423 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1424 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1425 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1426 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1427 document.querySelector("#cbaiTone").classList.add('hidden'); 1428 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1429 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1430 1431 jQuery('#cbaiProductDescription label').html('Paragraph'); 1432 validation.cbai_input_desc = true; 1433 } else if (content2 == 'finish_sentence') { 1434 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1435 document.querySelector("#cbaiProductName").classList.add('hidden'); 1436 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1437 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1438 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1439 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1440 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1441 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1442 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1443 document.querySelector("#cbaiTone").classList.add('hidden'); 1444 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1445 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1446 1447 jQuery('#cbaiProductDescription label').html('Sentence'); 1448 validation.cbai_input_desc = true; 1449 } else if (content2 == 'startup_ideas') { 1450 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1451 document.querySelector("#cbaiProductName").classList.add('hidden'); 1452 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1453 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1454 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1455 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1456 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1457 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1458 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1459 document.querySelector("#cbaiTone").classList.add('hidden'); 1460 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1461 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1462 1463 jQuery('#cbaiProductDescription label').html('Short Description'); 1464 validation.cbai_input_desc = true; 1465 } else if (content2 == 'brand_names') { 1466 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1467 document.querySelector("#cbaiProductName").classList.add('hidden'); 1468 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1469 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1470 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1471 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1472 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1473 document.querySelector("#cbaiKeywords").classList.remove('hidden'); 1474 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1475 document.querySelector("#cbaiTone").classList.add('hidden'); 1476 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1477 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1478 1479 jQuery('#cbaiProductDescription label').html('Short Description'); 1480 validation.cbai_input_desc = true; 1481 validation.cbai_input_keywords = true; 1482 } else if (content2 == 'slogan') { 1483 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1484 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1485 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1486 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1487 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1488 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1489 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1490 document.querySelector("#cbaiKeywords").classList.remove('hidden'); 1491 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1492 document.querySelector("#cbaiTone").classList.add('hidden'); 1493 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1494 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1495 1496 jQuery('#cbaiProductDescription label').html('Short Description'); 1497 validation.cbai_input_name = true; 1498 validation.cbai_input_desc = true; 1499 validation.cbai_input_keywords = true; 1500 } else if (content2 == 'adwords_ad' || content2 =='facebook_ad') { 1501 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1502 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1503 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1504 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1505 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1506 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1507 document.querySelector("#cbaiRowAudience").classList.remove('hidden'); 1508 document.querySelector("#cbaiKeywords").classList.remove('hidden'); 1509 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1510 document.querySelector("#cbaiTone").classList.add('hidden'); 1511 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1512 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1513 1514 jQuery('#cbaiProductDescription label').html('Short Description'); 1515 validation.cbai_input_name = true; 1516 validation.cbai_input_desc = true; 1517 validation.cbai_input_audience = true; 1518 validation.cbai_input_keywords = true; 1519 } else if (content2 == 'youtube_ideas') { 1520 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1521 document.querySelector("#cbaiProductName").classList.add('hidden'); 1522 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1523 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1524 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1525 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1526 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1527 document.querySelector("#cbaiKeywords").classList.remove('hidden'); 1528 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1529 document.querySelector("#cbaiTone").classList.add('hidden'); 1530 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1531 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1532 1533 jQuery('#cbaiProductDescription label').html('Short Description'); 1534 validation.cbai_input_desc = true; 1535 validation.cbai_input_keywords = true; 1536 } else if ( content2 == 'video_description') { 1537 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1538 document.querySelector("#cbaiProductName").classList.add('hidden'); 1539 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1540 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1541 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1542 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1543 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1544 document.querySelector("#cbaiKeywords").classList.remove('hidden'); 1545 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1546 document.querySelector("#cbaiTone").classList.add('hidden'); 1547 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1548 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1549 1550 jQuery('#cbaiProductDescription label').html('Video Topic'); 1551 validation.cbai_input_desc = true; 1552 validation.cbai_input_keywords = true; 1553 } else if (content2 == 'landing_page') { 1554 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1555 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1556 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1557 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1558 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1559 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1560 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1561 document.querySelector("#cbaiKeywords").classList.remove('hidden'); 1562 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1563 document.querySelector("#cbaiTone").classList.add('hidden'); 1564 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1565 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1566 1567 jQuery('#cbaiProductDescription label').html('Short Description'); 1568 validation.cbai_input_name = true; 1569 validation.cbai_input_desc = true; 1570 validation.cbai_input_keywords = true; 1571 } else if (content2 == 'value_proposition') { 1572 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1573 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1574 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1575 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1576 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1577 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1578 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1579 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1580 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1581 document.querySelector("#cbaiTone").classList.add('hidden'); 1582 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1583 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1584 1585 jQuery('#cbaiProductDescription label').html('Short Description'); 1586 validation.cbai_input_name = true; 1587 validation.cbai_input_desc = true; 1588 } else if (content2 == 'rewriter') { 1589 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1590 document.querySelector("#cbaiProductName").classList.add('hidden'); 1591 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1592 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1593 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1594 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1595 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1596 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1597 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1598 document.querySelector("#cbaiTone").classList.remove('hidden'); 1599 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1600 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1601 1602 jQuery('#cbaiProductDescription label').html('Copy'); 1603 validation.cbai_input_desc = true; 1604 validation.cbai_input_tone = true; 1605 } else if (content2 == 'pitch_yourself') { 1606 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1607 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1608 document.querySelector("#cbaiProductDescription").classList.add('hidden'); 1609 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1610 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1611 document.querySelector("#cbaiRowPitchYourselfFields").classList.remove('hidden'); 1612 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1613 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1614 document.querySelector("#cbaiIndustry").classList.remove('hidden'); 1615 document.querySelector("#cbaiTone").classList.add('hidden'); 1616 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1617 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 486 1618 487 488 if (content2 == 'blog_topics') { 489 document.querySelector("#cbaiBlogTopic").classList.remove('hidden'); 490 document.querySelector("#cbaiProductName").classList.add('hidden'); 491 document.querySelector("#cbaiProductDescription").classList.add('hidden'); 492 document.querySelector("#cbaiIndustry").classList.add('hidden'); 493 document.querySelector("#cbaiIncludeIntros").classList.remove('hidden'); 494 } else if (content2 == 'blog_intro') { 495 document.querySelector("#cbaiBlogTopic").classList.remove('hidden'); 496 document.querySelector("#cbaiProductName").classList.remove('hidden'); 497 document.querySelector("#cbaiProductDescription").classList.add('hidden'); 498 document.querySelector("#cbaiIndustry").classList.add('hidden'); 499 } else if (content2 == 'marketing_ideas') { 500 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 501 document.querySelector("#cbaiProductName").classList.remove('hidden'); 502 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 503 document.querySelector("#cbaiIndustry").classList.remove('hidden'); 504 } else { 505 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 506 document.querySelector("#cbaiProductName").classList.remove('hidden'); 507 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 508 document.querySelector("#cbaiIndustry").classList.add('hidden'); 509 510 } 1619 validation.cbai_input_name = true; 1620 validation.cbaiPitch_InputDelivery = true; 1621 validation.cbaiPitch_InputExperience = true; 1622 validation.cbaiPitch_InputGoal = true; 1623 validation.cbaiPitch_InputHighlights = true; 1624 validation.cbai_input_industry = true; 1625 } else if (content2 == 'pas' || content2 == 'pbs') { 1626 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1627 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1628 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1629 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1630 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1631 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1632 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1633 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1634 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1635 document.querySelector("#cbaiTone").classList.add('hidden'); 1636 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1637 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1638 1639 jQuery('#cbaiProductDescription label').html('Short Description'); 1640 validation.cbai_input_name = true; 1641 validation.cbai_input_desc = true; 1642 } else if (content2 == 'aida') { 1643 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1644 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1645 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1646 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1647 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1648 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1649 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1650 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1651 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1652 document.querySelector("#cbaiTone").classList.add('hidden'); 1653 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1654 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1655 1656 jQuery('#cbaiProductDescription label').html('Short Description'); 1657 validation.cbai_input_name = true; 1658 validation.cbai_input_desc = true; 1659 } else if (content2 == 'answers') { 1660 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1661 document.querySelector("#cbaiProductName").classList.add('hidden'); 1662 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1663 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1664 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1665 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1666 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1667 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1668 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1669 document.querySelector("#cbaiTone").classList.add('hidden'); 1670 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1671 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1672 1673 jQuery('#cbaiProductDescription label').html('Question'); 1674 validation.cbai_input_desc = true; 1675 } else if (content2 == 'sales_email') { 1676 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1677 document.querySelector("#cbaiProductName").classList.add('hidden'); 1678 document.querySelector("#cbaiProductDescription").classList.add('hidden'); 1679 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1680 document.querySelector("#cbaiRowSalesEmailFields").classList.remove('hidden'); 1681 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1682 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1683 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1684 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1685 document.querySelector("#cbaiTone").classList.add('hidden'); 1686 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1687 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1688 1689 validation.cbaiSales_CompanyName = true; 1690 validation.cbaiSales_Industry = true; 1691 validation.cbaiSales_LeadCompanyName = true; 1692 validation.cbaiSales_LeadGoals = true; 1693 validation.cbaiSales_LeadIndustry = true; 1694 validation.cbaiSales_LeadName = true; 1695 validation.cbaiSales_Name = true; 1696 validation.cbaiSales_ProductBenefits = true; 1697 validation.cbaiSales_Purpose = true; 1698 } else { //product_description 1699 document.querySelector("#cbaiBlogTopic").classList.add('hidden'); 1700 document.querySelector("#cbaiProductName").classList.remove('hidden'); 1701 document.querySelector("#cbaiProductDescription").classList.remove('hidden'); 1702 document.querySelector("#cbaiRowBPEFields").classList.add('hidden'); 1703 document.querySelector("#cbaiRowSalesEmailFields").classList.add('hidden'); 1704 document.querySelector("#cbaiRowPitchYourselfFields").classList.add('hidden'); 1705 document.querySelector("#cbaiRowAudience").classList.add('hidden'); 1706 document.querySelector("#cbaiKeywords").classList.add('hidden'); 1707 document.querySelector("#cbaiIndustry").classList.add('hidden'); 1708 document.querySelector("#cbaiTone").classList.remove('hidden'); 1709 document.querySelector("#cbaiIncludeIntros").classList.add('hidden'); 1710 document.querySelector("#cbaiIncludeTrends").classList.add('hidden'); 1711 1712 jQuery('#cbaiProductDescription label').html('Short Description'); 1713 validation.cbai_input_name = true; 1714 validation.cbai_input_desc = true; 1715 validation.cbai_input_tone = true; 1716 } 1717 1718 var feedbackSent = localStorage.getItem("feedbackSent"); 1719 if (feedbackSent == '1') { 1720 jQuery("#feedbackPrompt").hide(); 1721 } else { 1722 jQuery("#feedbackPrompt").show(); 1723 } 1724 1725 1726 jQuery("body").on("click", "#feedbackPrompt", function() { 1727 localStorage.setItem("feedbackSent", "1"); 1728 jQuery("#feedbackPrompt").hide(); 1729 jQuery(".fdbcktoggleBtn6525two").click(); 1730 }) 511 1731 512 1732 } … … 517 1737 "p", 518 1738 { 519 "class": " hidden",1739 "class": "content-bot-block-gutenberg-button-container hidden", 520 1740 "id": "cbaiBlogTopic" 521 1741 }, … … 566 1786 ), 567 1787 ), 1788 1789 React.createElement( 1790 "p", 1791 { 1792 "class": "content-bot-block-gutenberg-button-container hidden", 1793 "id": "cbaiIncludeTrends" 1794 }, 1795 1796 React.createElement( 1797 CheckboxControl, 1798 { 1799 "label": __('Include Trends?'), 1800 "class": "", 1801 id: 'cbai_input_trends', 1802 "value" : props.attributes.pIncludeTrends, 1803 onChange: function (stateTrend) { 1804 props.setAttributes({ pIncludeTrends: stateTrend }) 1805 } 1806 }, 1807 1808 1809 ), 1810 React.createElement( 1811 "em", 1812 { 1813 "class": "content-bot-block-gutenberg-button-container", 1814 "id": "cbaiIncludeTrendsMsg" 1815 }, 1816 "(We will identify the latest trends in your industry and generate unique blog topic ideas based on those trends.)." 1817 ), 1818 ), 568 1819 569 1820 … … 599 1850 600 1851 React.createElement( 601 Text Control,1852 TextareaControl, 602 1853 { 603 1854 "label": __('Short description'), 604 1855 "class": "components-text-control__input", 605 "maxlength": 50,606 1856 id: 'cbai_input_desc', 607 1857 "value" : props.attributes.pDescription, 608 "placeholder" : " selling and delivering gadgets",1858 "placeholder" : "Selling and delivering gadgets", 609 1859 onChange: function (newDescription) { 610 1860 props.setAttributes({ pDescription: newDescription }) … … 615 1865 ) 616 1866 ), 617 1867 React.createElement( 1868 "p", 1869 { 1870 "class": "content-bot-block-gutenberg-button-container hidden", 1871 "id": "cbaiRowBPEFields" 1872 }, 1873 1874 React.createElement( 1875 TextareaControl, 1876 { 1877 "label": __('Bullet Point 1'), 1878 "class": "components-text-control__input", 1879 id: 'cbai_BPE_1', 1880 "value" : props.attributes.pBPE1, 1881 "placeholder" : "eg. Content is super important for new startups", 1882 onChange: function (newBullet1) { 1883 props.setAttributes({ pBPE1: newBullet1 }) 1884 } 1885 }, 1886 ), 1887 React.createElement( 1888 TextareaControl, 1889 { 1890 "label": __('Bullet Point 2'), 1891 "class": "components-text-control__input", 1892 id: 'cbai_BPE_2', 1893 "value" : props.attributes.pBPE2, 1894 "placeholder" : "eg. Great content can increase sales", 1895 onChange: function (newBullet2) { 1896 props.setAttributes({ pBPE2: newBullet2 }) 1897 } 1898 }, 1899 ), 1900 React.createElement( 1901 TextareaControl, 1902 { 1903 "label": __('Bullet Point 3'), 1904 "class": "components-text-control__input", 1905 id: 'cbai_BPE_3', 1906 "value" : props.attributes.pBPE3, 1907 "placeholder" : "eg. Without content, you leave yourself", 1908 onChange: function (newBullet3) { 1909 props.setAttributes({ pBPE3: newBullet3 }) 1910 } 1911 }, 1912 ) 1913 ), 1914 React.createElement( 1915 "p", 1916 { 1917 "class": "content-bot-block-gutenberg-button-container hidden", 1918 "id": "cbaiRowSalesEmailFields" 1919 }, 1920 1921 React.createElement( 1922 TextControl, 1923 { 1924 "label": __('Sales Purpose'), 1925 "class": "components-text-control__input", 1926 id: 'cbaiSales_Purpose', 1927 "value" : props.attributes.pSalesPurpose, 1928 "placeholder" : "eg. Sales introduction or Sales follow up", 1929 onChange: function (newSalesPurpose) { 1930 props.setAttributes({ pSalesPurpose: newSalesPurpose }) 1931 } 1932 }, 1933 ), 1934 React.createElement( 1935 TextControl, 1936 { 1937 "label": __('Your Name'), 1938 "class": "components-text-control__input", 1939 id: 'cbaiSales_Name', 1940 "value" : props.attributes.pSalesName, 1941 "placeholder" : "", 1942 onChange: function (newSalesName) { 1943 props.setAttributes({ pSalesName: newSalesName }) 1944 } 1945 }, 1946 ), 1947 React.createElement( 1948 TextControl, 1949 { 1950 "label": __('Your Company Name'), 1951 "class": "components-text-control__input", 1952 id: 'cbaiSales_CompanyName', 1953 "value" : props.attributes.pSalesCompanyName, 1954 "placeholder" : "", 1955 onChange: function (newSalesCompanyName) { 1956 props.setAttributes({ pSalesCompanyName: newSalesCompanyName }) 1957 } 1958 }, 1959 ), 1960 React.createElement( 1961 TextControl, 1962 { 1963 "label": __('Your Industry'), 1964 "class": "components-text-control__input", 1965 id: 'cbaiSales_Industry', 1966 "value" : props.attributes.pSalesIndustry, 1967 "placeholder" : "", 1968 onChange: function (newSalesIndustry) { 1969 props.setAttributes({ pSalesIndustry: newSalesIndustry }) 1970 } 1971 }, 1972 ), 1973 React.createElement( 1974 TextControl, 1975 { 1976 "label": __('Lead Name'), 1977 "class": "components-text-control__input", 1978 id: 'cbaiSales_LeadName', 1979 "value" : props.attributes.pSalesLeadName, 1980 "placeholder" : "", 1981 onChange: function (newSalesLeadName) { 1982 props.setAttributes({ pSalesLeadName: newSalesLeadName }) 1983 } 1984 }, 1985 ), 1986 React.createElement( 1987 TextControl, 1988 { 1989 "label": __('Lead Company Name'), 1990 "class": "components-text-control__input", 1991 id: 'cbaiSales_LeadCompanyName', 1992 "value" : props.attributes.pSalesLeadCompanyName, 1993 "placeholder" : "", 1994 onChange: function (newSalesLeadCompanyName) { 1995 props.setAttributes({ pSalesLeadCompanyName: newSalesLeadCompanyName }) 1996 } 1997 }, 1998 ), 1999 React.createElement( 2000 TextControl, 2001 { 2002 "label": __('Lead Industry'), 2003 "class": "components-text-control__input", 2004 id: 'cbaiSales_LeadIndustry', 2005 "value" : props.attributes.pSalesLeadIndustry, 2006 "placeholder" : "", 2007 onChange: function (newSalesLeadIndustry) { 2008 props.setAttributes({ pSalesLeadIndustry: newSalesLeadIndustry }) 2009 } 2010 }, 2011 ), 2012 React.createElement( 2013 TextControl, 2014 { 2015 "label": __('Lead Goals'), 2016 "class": "components-text-control__input", 2017 id: 'cbaiSales_LeadGoals', 2018 "value" : props.attributes.pSalesLeadGoals, 2019 "placeholder" : "eg. Increase copy output through blog topic ideas, product descriptions and other AI content with a 40% off coupon", 2020 onChange: function (newSalesLeadGoals) { 2021 props.setAttributes({ pSalesLeadGoals: newSalesLeadGoals }) 2022 } 2023 }, 2024 ), 2025 React.createElement( 2026 TextControl, 2027 { 2028 "label": __('Product Benifits'), 2029 "class": "components-text-control__input", 2030 id: 'cbaiSales_ProductBenifits', 2031 "value" : props.attributes.pSalesProductBenifits, 2032 "placeholder" : "eg. reduce time spent on ideation", 2033 onChange: function (newSalesProductBenifits) { 2034 props.setAttributes({ pSalesProductBenifits: newSalesProductBenifits }) 2035 } 2036 }, 2037 ) 2038 ), 2039 React.createElement( 2040 "p", 2041 { 2042 "class": "content-bot-block-gutenberg-button-container hidden", 2043 "id": "cbaiRowPitchYourselfFields" 2044 }, 2045 2046 React.createElement( 2047 TextareaControl, 2048 { 2049 "label": __('Your Goal'), 2050 "class": "components-text-control__input", 2051 id: 'cbaiPitch_InputGoal', 2052 "value" : props.attributes.pGoal, 2053 "placeholder" : "eg. Create an HR platform", 2054 onChange: function (newGoal) { 2055 props.setAttributes({ pGoal: newGoal }) 2056 } 2057 }, 2058 ), 2059 React.createElement( 2060 TextareaControl, 2061 { 2062 "label": __('Your Experience'), 2063 "class": "components-text-control__input", 2064 id: 'cbaiPitch_InputExperience', 2065 "value" : props.attributes.pExperience, 2066 "placeholder" : "eg. Great content can increase sales", 2067 onChange: function (newExperience) { 2068 props.setAttributes({ pExperience: newExperience }) 2069 } 2070 }, 2071 ), 2072 React.createElement( 2073 TextareaControl, 2074 { 2075 "label": __('Expected Delivery'), 2076 "class": "components-text-control__input", 2077 id: 'cbaiPitch_InputDelivery', 2078 "value" : props.attributes.pDelivery, 2079 "placeholder" : "eg. About 2 weeks", 2080 onChange: function (newDelivery) { 2081 props.setAttributes({ pDelivery: newDelivery }) 2082 } 2083 }, 2084 ), 2085 React.createElement( 2086 TextareaControl, 2087 { 2088 "label": __('Your Background'), 2089 "class": "components-text-control__input", 2090 id: 'cbaiPitch_InputHighlights', 2091 "value" : props.attributes.pHighlights, 2092 "placeholder" : "eg. Senior Developer", 2093 onChange: function (newHighlights) { 2094 props.setAttributes({ pHighlights: newHighlights }) 2095 } 2096 }, 2097 ) 2098 ), 618 2099 React.createElement( 619 2100 "p", … … 638 2119 639 2120 ) 2121 ), 2122 React.createElement( 2123 "p", 2124 { 2125 "class": "content-bot-block-gutenberg-button-container hidden", 2126 "id": "cbaiRowAudience" 2127 }, 2128 2129 React.createElement( 2130 TextControl, 2131 { 2132 "label": __('Audience'), 2133 "class": "components-text-control__input", 2134 "value" : props.attributes.pAudience, 2135 "placeholder" : "live chat, chat, support", 2136 id: 'cbai_input_audience', 2137 onChange: function (newAudience) { 2138 props.setAttributes({ pAudience: newAudience }) 2139 } 2140 }, 2141 ) 640 2142 ), 641 2143 React.createElement( 642 2144 "p", 643 { "class": "content-bot-block-gutenberg-button-container" }, 2145 { 2146 "class": "content-bot-block-gutenberg-button-container hidden", 2147 "id": "cbaiKeywords" 2148 }, 2149 2150 React.createElement( 2151 TextControl, 2152 { 2153 "label": __('Keywords'), 2154 "class": "components-text-control__input", 2155 "value" : props.attributes.pKeywords, 2156 "placeholder" : "live chat, chat, support", 2157 id: 'cbai_input_keywords', 2158 onChange: function (newKeywords) { 2159 props.setAttributes({ pKeywords: newKeywords }) 2160 } 2161 }, 2162 ) 2163 ), 2164 React.createElement( 2165 "p", 2166 { 2167 "class": "content-bot-block-gutenberg-button-container", 2168 "id": "cbaiTone" 2169 }, 644 2170 645 2171 React.createElement( … … 648 2174 label: __('Tone'), 649 2175 id: 'cbai_input_tone', 650 options: [{ value: 'professional', label: 'Professional' },{ value: 'friendly', label: 'Friendly' },{ value: 'bold', label: 'Bold' },{ value: 'playful', label: 'Playful' }], 2176 options: [ 2177 { value: 'professional', label: 'Professional' }, 2178 { value: 'friendly', label: 'Friendly' }, 2179 { value: 'bold', label: 'Bold' }, 2180 { value: 'playful', label: 'Playful' }, 2181 { value: 'first person', label: 'First Person'}, 2182 { value: 'third person', label: 'Third Person'} 2183 ], 651 2184 onChange:function( content ) { 652 2185 props.setAttributes({pTone: content}); … … 655 2188 } 656 2189 ) 2190 ), 2191 2192 React.createElement( 2193 "p", 2194 { 2195 "class": "content-bot-block-gutenberg-button-container", 2196 "id": "cbaiLanguagesOptionsLink" 2197 }, 2198 React.createElement( 2199 "a", 2200 { 2201 href: "javascript:void(0)", 2202 onClick:function(){ 2203 jQuery(function($){ 2204 if($('#cbaiLanguagesOptions').hasClass('hidden')){ 2205 $('#cbaiLanguagesOptions').removeClass('hidden'); 2206 } else { 2207 $('#cbaiLanguagesOptions').addClass('hidden'); 2208 } 2209 2210 }) 2211 } 2212 }, 2213 "Language Options", 2214 ) 2215 ), 2216 2217 React.createElement( 2218 "div", 2219 { 2220 "class": "content-bot-block-gutenberg-button-container hidden", 2221 "id": "cbaiLanguagesOptions" 2222 }, 2223 2224 React.createElement( 2225 "p", 2226 { 2227 "class": "content-bot-block-gutenberg-button-container", 2228 "id": "cbaiLangService" 2229 }, 2230 2231 React.createElement( 2232 SelectControl, 2233 { 2234 label: __('Translation Service'), 2235 id: 'cbai_input_language_service', 2236 options: [ 2237 { value: 'google', label: 'Google Translate' }, 2238 { value: 'deepl', label: 'DeepL' }, 2239 { value: 'watson', label: 'Watson' } 2240 ], 2241 onChange:function( languageService ) { 2242 props.setAttributes({pLanguageService: languageService}); 2243 2244 if (languageService == 'deepl') { 2245 jQuery("#cbai_input_language_formality").attr('disabled',false); 2246 jQuery("#cbai_input_language_formality").attr('readonly',false); 2247 jQuery("#FormalityHelperService").hide(); 2248 jQuery("#cbai_input_language_source").html(deeplLanguages); 2249 jQuery("#cbai_input_language_target").html(deeplLanguages); 657 2250 2251 } else { 2252 jQuery("#cbai_input_language_formality").attr('disabled',true); 2253 jQuery("#cbai_input_language_formality").attr('readonly',true); 2254 jQuery("#FormalityHelperService").show(); 2255 2256 if (languageService == 'watson') { 2257 jQuery("#cbai_input_language_source").html(watsonLanguages); 2258 jQuery("#cbai_input_language_target").html(watsonLanguages); 2259 } 2260 else if (languageService == 'google') { 2261 jQuery("#cbai_input_language_source").html(googleLanguages); 2262 jQuery("#cbai_input_language_target").html(googleLanguages); 2263 } 2264 else { 2265 jQuery("#cbai_input_language_source").html(googleLanguages); 2266 jQuery("#cbai_input_language_target").html(googleLanguages); 2267 } 2268 } 2269 } 2270 } 2271 ) 2272 ), 2273 2274 React.createElement( 2275 "p", 2276 { 2277 "class": "content-bot-block-gutenberg-button-container", 2278 "id": "cbaiLangSource" 2279 }, 2280 2281 React.createElement( 2282 SelectControl, 2283 { 2284 label: __('Language - Source'), 2285 id: 'cbai_input_language_source', 2286 options: [ 2287 { value: 'en', label: 'English' }, 2288 { value: 'af', label: 'Afrikaans' }, 2289 { value: 'sq', label: 'Albanian' }, 2290 { value: 'am', label: 'Amharic' }, 2291 { value: 'ar', label: 'Arabic' }, 2292 { value: 'hy', label: 'Armenian' }, 2293 { value: 'az', label: 'Azerbaijani' }, 2294 { value: 'eu', label: 'Basque' }, 2295 { value: 'be', label: 'Belarusian' }, 2296 { value: 'bn', label: 'Bengali' }, 2297 { value: 'bs', label: 'Bosnian' }, 2298 { value: 'bg', label: 'Bulgarian' }, 2299 { value: 'ca', label: 'Catalan' }, 2300 { value: 'ceb', label: 'Cebuano' }, 2301 { value: 'ny', label: 'Chichewa' }, 2302 { value: 'zh', label: 'Chinese (Simplified)' }, 2303 { value: 'zh-TW', label: 'Chinese (Traditional)' }, 2304 { value: 'co', label: 'Corsican' }, 2305 { value: 'hr', label: 'Croatian' }, 2306 { value: 'cs', label: 'Czech' }, 2307 { value: 'da', label: 'Danish' }, 2308 { value: 'nl', label: 'Dutch' }, 2309 { value: 'eo', label: 'Esperanto' }, 2310 { value: 'et', label: 'Estonian' }, 2311 { value: 'tl', label: 'Filipino' }, 2312 { value: 'fi', label: 'Finnish' }, 2313 { value: 'fr', label: 'French' }, 2314 { value: 'fy', label: 'Frisian' }, 2315 { value: 'gl', label: 'Galician' }, 2316 { value: 'ka', label: 'Georgian' }, 2317 { value: 'de', label: 'German' }, 2318 { value: 'el', label: 'Greek' }, 2319 { value: 'gu', label: 'Gujarati' }, 2320 { value: 'ht', label: 'Haitian Creole' }, 2321 { value: 'ha', label: 'Hausa' }, 2322 { value: 'haw', label: 'Hawaiian' }, 2323 { value: 'iw', label: 'Hebrew' }, 2324 { value: 'hi', label: 'Hindi' }, 2325 { value: 'hmn', label: 'Hmong' }, 2326 { value: 'hu', label: 'Hungarian' }, 2327 { value: 'is', label: 'Icelandic' }, 2328 { value: 'ig', label: 'Igbo' }, 2329 { value: 'id', label: 'Indonesian' }, 2330 { value: 'ga', label: 'Irish' }, 2331 { value: 'it', label: 'Italian' }, 2332 { value: 'ja', label: 'Japanese' }, 2333 { value: 'jw', label: 'Javanese' }, 2334 { value: 'kn', label: 'Kannada' }, 2335 { value: 'kk', label: 'Kazakh' }, 2336 { value: 'km', label: 'Khmer' }, 2337 { value: 'rw', label: 'Kinyarwanda' }, 2338 { value: 'ko', label: 'Korean' }, 2339 { value: 'ku', label: 'Kurdish (Kurmanji)' }, 2340 { value: 'ky', label: 'Kyrgyz' }, 2341 { value: 'lo', label: 'Lao' }, 2342 { value: 'la', label: 'Latin' }, 2343 { value: 'lv', label: 'Latvian' }, 2344 { value: 'lt', label: 'Lithuanian' }, 2345 { value: 'lb', label: 'Luxembourgish' }, 2346 { value: 'mk', label: 'Macedonian' }, 2347 { value: 'mg', label: 'Malagasy' }, 2348 { value: 'ms', label: 'Malay' }, 2349 { value: 'ml', label: 'Malayalam' }, 2350 { value: 'mt', label: 'Maltese' }, 2351 { value: 'mi', label: 'Maori' }, 2352 { value: 'mr', label: 'Marathi' }, 2353 { value: 'mn', label: 'Mongolian' }, 2354 { value: 'my', label: 'Myanmar (Burmese)' }, 2355 { value: 'ne', label: 'Nepali' }, 2356 { value: 'no', label: 'Norwegian' }, 2357 { value: 'or', label: 'Odia (Oriya)' }, 2358 { value: 'ps', label: 'Pashto' }, 2359 { value: 'fa', label: 'Persian' }, 2360 { value: 'pl', label: 'Polish' }, 2361 { value: 'pt', label: 'Portuguese' }, 2362 { value: 'pa', label: 'Punjabi' }, 2363 { value: 'ro', label: 'Romanian' }, 2364 { value: 'ru', label: 'Russian' }, 2365 { value: 'sm', label: 'Samoan' }, 2366 { value: 'gd', label: 'Scots Gaelic' }, 2367 { value: 'sr', label: 'Serbian' }, 2368 { value: 'st', label: 'Sesotho' }, 2369 { value: 'sn', label: 'Shona' }, 2370 { value: 'sd', label: 'Sindhi' }, 2371 { value: 'si', label: 'Sinhala' }, 2372 { value: 'sk', label: 'Slovak' }, 2373 { value: 'sl', label: 'Slovenian' }, 2374 { value: 'so', label: 'Somali' }, 2375 { value: 'es', label: 'Spanish' }, 2376 { value: 'su', label: 'Sundanese' }, 2377 { value: 'sw', label: 'Swahili' }, 2378 { value: 'sv', label: 'Swedish' }, 2379 { value: 'tg', label: 'Tajik' }, 2380 { value: 'ta', label: 'Tamil' }, 2381 { value: 'tt', label: 'Tatar' }, 2382 { value: 'te', label: 'Telugu' }, 2383 { value: 'th', label: 'Thai' }, 2384 { value: 'tr', label: 'Turkish' }, 2385 { value: 'tk', label: 'Turkmen' }, 2386 { value: 'uk', label: 'Ukrainian' }, 2387 { value: 'ur', label: 'Urdu' }, 2388 { value: 'ug', label: 'Uyghur' }, 2389 { value: 'uz', label: 'Uzbek' }, 2390 { value: 'vi', label: 'Vietnamese' }, 2391 { value: 'cy', label: 'Welsh' }, 2392 { value: 'xh', label: 'Xhosa' }, 2393 { value: 'yi', label: 'Yiddish' }, 2394 { value: 'yo', label: 'Yoruba' }, 2395 { value: 'zu', label: 'Zulu' } 2396 ], 2397 onChange:function( languageSource ) { 2398 props.setAttributes({pLanguageSource: languageSource}); 2399 } 2400 } 2401 ) 2402 ), 2403 2404 React.createElement( 2405 "p", 2406 { 2407 "class": "content-bot-block-gutenberg-button-container", 2408 "id": "cbaiLangTarget" 2409 }, 2410 2411 React.createElement( 2412 SelectControl, 2413 { 2414 label: __('Language - Target'), 2415 id: 'cbai_input_language_target', 2416 options: [ 2417 { value: 'en', label: 'English' }, 2418 { value: 'af', label: 'Afrikaans' }, 2419 { value: 'sq', label: 'Albanian' }, 2420 { value: 'am', label: 'Amharic' }, 2421 { value: 'ar', label: 'Arabic' }, 2422 { value: 'hy', label: 'Armenian' }, 2423 { value: 'az', label: 'Azerbaijani' }, 2424 { value: 'eu', label: 'Basque' }, 2425 { value: 'be', label: 'Belarusian' }, 2426 { value: 'bn', label: 'Bengali' }, 2427 { value: 'bs', label: 'Bosnian' }, 2428 { value: 'bg', label: 'Bulgarian' }, 2429 { value: 'ca', label: 'Catalan' }, 2430 { value: 'ceb', label: 'Cebuano' }, 2431 { value: 'ny', label: 'Chichewa' }, 2432 { value: 'zh', label: 'Chinese (Simplified)' }, 2433 { value: 'zh-TW', label: 'Chinese (Traditional)' }, 2434 { value: 'co', label: 'Corsican' }, 2435 { value: 'hr', label: 'Croatian' }, 2436 { value: 'cs', label: 'Czech' }, 2437 { value: 'da', label: 'Danish' }, 2438 { value: 'nl', label: 'Dutch' }, 2439 { value: 'eo', label: 'Esperanto' }, 2440 { value: 'et', label: 'Estonian' }, 2441 { value: 'tl', label: 'Filipino' }, 2442 { value: 'fi', label: 'Finnish' }, 2443 { value: 'fr', label: 'French' }, 2444 { value: 'fy', label: 'Frisian' }, 2445 { value: 'gl', label: 'Galician' }, 2446 { value: 'ka', label: 'Georgian' }, 2447 { value: 'de', label: 'German' }, 2448 { value: 'el', label: 'Greek' }, 2449 { value: 'gu', label: 'Gujarati' }, 2450 { value: 'ht', label: 'Haitian Creole' }, 2451 { value: 'ha', label: 'Hausa' }, 2452 { value: 'haw', label: 'Hawaiian' }, 2453 { value: 'iw', label: 'Hebrew' }, 2454 { value: 'hi', label: 'Hindi' }, 2455 { value: 'hmn', label: 'Hmong' }, 2456 { value: 'hu', label: 'Hungarian' }, 2457 { value: 'is', label: 'Icelandic' }, 2458 { value: 'ig', label: 'Igbo' }, 2459 { value: 'id', label: 'Indonesian' }, 2460 { value: 'ga', label: 'Irish' }, 2461 { value: 'it', label: 'Italian' }, 2462 { value: 'ja', label: 'Japanese' }, 2463 { value: 'jw', label: 'Javanese' }, 2464 { value: 'kn', label: 'Kannada' }, 2465 { value: 'kk', label: 'Kazakh' }, 2466 { value: 'km', label: 'Khmer' }, 2467 { value: 'rw', label: 'Kinyarwanda' }, 2468 { value: 'ko', label: 'Korean' }, 2469 { value: 'ku', label: 'Kurdish (Kurmanji)' }, 2470 { value: 'ky', label: 'Kyrgyz' }, 2471 { value: 'lo', label: 'Lao' }, 2472 { value: 'la', label: 'Latin' }, 2473 { value: 'lv', label: 'Latvian' }, 2474 { value: 'lt', label: 'Lithuanian' }, 2475 { value: 'lb', label: 'Luxembourgish' }, 2476 { value: 'mk', label: 'Macedonian' }, 2477 { value: 'mg', label: 'Malagasy' }, 2478 { value: 'ms', label: 'Malay' }, 2479 { value: 'ml', label: 'Malayalam' }, 2480 { value: 'mt', label: 'Maltese' }, 2481 { value: 'mi', label: 'Maori' }, 2482 { value: 'mr', label: 'Marathi' }, 2483 { value: 'mn', label: 'Mongolian' }, 2484 { value: 'my', label: 'Myanmar (Burmese)' }, 2485 { value: 'ne', label: 'Nepali' }, 2486 { value: 'no', label: 'Norwegian' }, 2487 { value: 'or', label: 'Odia (Oriya)' }, 2488 { value: 'ps', label: 'Pashto' }, 2489 { value: 'fa', label: 'Persian' }, 2490 { value: 'pl', label: 'Polish' }, 2491 { value: 'pt', label: 'Portuguese' }, 2492 { value: 'pa', label: 'Punjabi' }, 2493 { value: 'ro', label: 'Romanian' }, 2494 { value: 'ru', label: 'Russian' }, 2495 { value: 'sm', label: 'Samoan' }, 2496 { value: 'gd', label: 'Scots Gaelic' }, 2497 { value: 'sr', label: 'Serbian' }, 2498 { value: 'st', label: 'Sesotho' }, 2499 { value: 'sn', label: 'Shona' }, 2500 { value: 'sd', label: 'Sindhi' }, 2501 { value: 'si', label: 'Sinhala' }, 2502 { value: 'sk', label: 'Slovak' }, 2503 { value: 'sl', label: 'Slovenian' }, 2504 { value: 'so', label: 'Somali' }, 2505 { value: 'es', label: 'Spanish' }, 2506 { value: 'su', label: 'Sundanese' }, 2507 { value: 'sw', label: 'Swahili' }, 2508 { value: 'sv', label: 'Swedish' }, 2509 { value: 'tg', label: 'Tajik' }, 2510 { value: 'ta', label: 'Tamil' }, 2511 { value: 'tt', label: 'Tatar' }, 2512 { value: 'te', label: 'Telugu' }, 2513 { value: 'th', label: 'Thai' }, 2514 { value: 'tr', label: 'Turkish' }, 2515 { value: 'tk', label: 'Turkmen' }, 2516 { value: 'uk', label: 'Ukrainian' }, 2517 { value: 'ur', label: 'Urdu' }, 2518 { value: 'ug', label: 'Uyghur' }, 2519 { value: 'uz', label: 'Uzbek' }, 2520 { value: 'vi', label: 'Vietnamese' }, 2521 { value: 'cy', label: 'Welsh' }, 2522 { value: 'xh', label: 'Xhosa' }, 2523 { value: 'yi', label: 'Yiddish' }, 2524 { value: 'yo', label: 'Yoruba' }, 2525 { value: 'zu', label: 'Zulu' } 2526 ], 2527 onChange:function( languageTarget ) { 2528 props.setAttributes({pLanguageTarget: languageTarget}); 2529 } 2530 } 2531 ) 2532 ), 2533 2534 React.createElement( 2535 "p", 2536 { 2537 "class": "content-bot-block-gutenberg-button-container", 2538 "id": "cbaiLangFormality" 2539 }, 2540 2541 React.createElement( 2542 SelectControl, 2543 { 2544 label: __('Formality'), 2545 id: 'cbai_input_language_formality', 2546 options: [ 2547 { value: 'default', label: 'Default' }, 2548 { value: 'more', label: 'More Formal' }, 2549 { value: 'less', label: 'Less Formal' } 2550 ], 2551 onChange:function( languageFormality ) { 2552 props.setAttributes({pLanguageFormality: languageFormality}); 2553 } 2554 }, 2555 ) 2556 ), 2557 2558 React.createElement( 2559 "p", 2560 { 2561 "class": "content-bot-block-gutenberg-button-container", 2562 "id": "FormalityHelperServiceLangAvailable" 2563 }, 2564 "Formality only available for German, French, Italian, Spanish, Dutch, Polish, Portuguese and Russian." 2565 ), 2566 2567 React.createElement( 2568 "p", 2569 { 2570 "class": "content-bot-block-gutenberg-button-container", 2571 "id": "FormalityHelperService" 2572 }, 2573 "Formality only available for 'DeepL' translations." 2574 ), 658 2575 ), 659 660 React.createElement(661 SelectControl,662 {663 label: __('Language'),664 id: 'cbai_input_language',665 options: [666 { value: 'en', label: 'English' },667 { value: 'af', label: 'Afrikaans' },668 { value: 'sq', label: 'Albanian' },669 { value: 'am', label: 'Amharic' },670 { value: 'ar', label: 'Arabic' },671 { value: 'hy', label: 'Armenian' },672 { value: 'az', label: 'Azerbaijani' },673 { value: 'eu', label: 'Basque' },674 { value: 'be', label: 'Belarusian' },675 { value: 'bn', label: 'Bengali' },676 { value: 'bs', label: 'Bosnian' },677 { value: 'bg', label: 'Bulgarian' },678 { value: 'ca', label: 'Catalan' },679 { value: 'ceb', label: 'Cebuano' },680 { value: 'ny', label: 'Chichewa' },681 { value: 'zh', label: 'Chinese (Simplified)' },682 { value: 'zh-TW', label: 'Chinese (Traditional)' },683 { value: 'co', label: 'Corsican' },684 { value: 'hr', label: 'Croatian' },685 { value: 'cs', label: 'Czech' },686 { value: 'da', label: 'Danish' },687 { value: 'nl', label: 'Dutch' },688 { value: 'eo', label: 'Esperanto' },689 { value: 'et', label: 'Estonian' },690 { value: 'tl', label: 'Filipino' },691 { value: 'fi', label: 'Finnish' },692 { value: 'fr', label: 'French' },693 { value: 'fy', label: 'Frisian' },694 { value: 'gl', label: 'Galician' },695 { value: 'ka', label: 'Georgian' },696 { value: 'de', label: 'German' },697 { value: 'el', label: 'Greek' },698 { value: 'gu', label: 'Gujarati' },699 { value: 'ht', label: 'Haitian Creole' },700 { value: 'ha', label: 'Hausa' },701 { value: 'haw', label: 'Hawaiian' },702 { value: 'iw', label: 'Hebrew' },703 { value: 'hi', label: 'Hindi' },704 { value: 'hmn', label: 'Hmong' },705 { value: 'hu', label: 'Hungarian' },706 { value: 'is', label: 'Icelandic' },707 { value: 'ig', label: 'Igbo' },708 { value: 'id', label: 'Indonesian' },709 { value: 'ga', label: 'Irish' },710 { value: 'it', label: 'Italian' },711 { value: 'ja', label: 'Japanese' },712 { value: 'jw', label: 'Javanese' },713 { value: 'kn', label: 'Kannada' },714 { value: 'kk', label: 'Kazakh' },715 { value: 'km', label: 'Khmer' },716 { value: 'rw', label: 'Kinyarwanda' },717 { value: 'ko', label: 'Korean' },718 { value: 'ku', label: 'Kurdish (Kurmanji)' },719 { value: 'ky', label: 'Kyrgyz' },720 { value: 'lo', label: 'Lao' },721 { value: 'la', label: 'Latin' },722 { value: 'lv', label: 'Latvian' },723 { value: 'lt', label: 'Lithuanian' },724 { value: 'lb', label: 'Luxembourgish' },725 { value: 'mk', label: 'Macedonian' },726 { value: 'mg', label: 'Malagasy' },727 { value: 'ms', label: 'Malay' },728 { value: 'ml', label: 'Malayalam' },729 { value: 'mt', label: 'Maltese' },730 { value: 'mi', label: 'Maori' },731 { value: 'mr', label: 'Marathi' },732 { value: 'mn', label: 'Mongolian' },733 { value: 'my', label: 'Myanmar (Burmese)' },734 { value: 'ne', label: 'Nepali' },735 { value: 'no', label: 'Norwegian' },736 { value: 'or', label: 'Odia (Oriya)' },737 { value: 'ps', label: 'Pashto' },738 { value: 'fa', label: 'Persian' },739 { value: 'pl', label: 'Polish' },740 { value: 'pt', label: 'Portuguese' },741 { value: 'pa', label: 'Punjabi' },742 { value: 'ro', label: 'Romanian' },743 { value: 'ru', label: 'Russian' },744 { value: 'sm', label: 'Samoan' },745 { value: 'gd', label: 'Scots Gaelic' },746 { value: 'sr', label: 'Serbian' },747 { value: 'st', label: 'Sesotho' },748 { value: 'sn', label: 'Shona' },749 { value: 'sd', label: 'Sindhi' },750 { value: 'si', label: 'Sinhala' },751 { value: 'sk', label: 'Slovak' },752 { value: 'sl', label: 'Slovenian' },753 { value: 'so', label: 'Somali' },754 { value: 'es', label: 'Spanish' },755 { value: 'su', label: 'Sundanese' },756 { value: 'sw', label: 'Swahili' },757 { value: 'sv', label: 'Swedish' },758 { value: 'tg', label: 'Tajik' },759 { value: 'ta', label: 'Tamil' },760 { value: 'tt', label: 'Tatar' },761 { value: 'te', label: 'Telugu' },762 { value: 'th', label: 'Thai' },763 { value: 'tr', label: 'Turkish' },764 { value: 'tk', label: 'Turkmen' },765 { value: 'uk', label: 'Ukrainian' },766 { value: 'ur', label: 'Urdu' },767 { value: 'ug', label: 'Uyghur' },768 { value: 'uz', label: 'Uzbek' },769 { value: 'vi', label: 'Vietnamese' },770 { value: 'cy', label: 'Welsh' },771 { value: 'xh', label: 'Xhosa' },772 { value: 'yi', label: 'Yiddish' },773 { value: 'yo', label: 'Yoruba' },774 { value: 'zu', label: 'Zulu' }775 ],776 onChange:function( language ) {777 props.setAttributes({pLanguage: language});778 }779 }780 ),781 2576 782 2577 React.createElement( … … 795 2590 // 796 2591 // In this case, we should set some local variables to use rather based on what's already been set. 797 798 799 2592 800 2593 //var currentTone = props.attributes.pTone; 801 2594 … … 808 2601 var currentType = document.querySelector("#cbai_input_copy_type").value; 809 2602 props.setAttributes({ pType: currentType }); 810 811 2603 812 2604 … … 816 2608 var currentDescription = document.querySelector("#cbai_input_desc").value; 817 2609 props.setAttributes({ pDescription: currentDescription }); 2610 2611 2612 //var currentBPE1 = props.attributes.pBPE1; 2613 2614 2615 var currentBPE1 = document.querySelector("#cbai_BPE_1").value; 2616 props.setAttributes({ pBPE1: currentBPE1 }); 2617 2618 2619 //var currentBPE2 = props.attributes.pBPE2; 2620 2621 2622 var currentBPE2 = document.querySelector("#cbai_BPE_2").value; 2623 props.setAttributes({ pBPE2: currentBPE2 }); 2624 2625 2626 //var currentBPE3 = props.attributes.pBPE3; 2627 2628 2629 var currentBPE3 = document.querySelector("#cbai_BPE_3").value; 2630 props.setAttributes({ pBPE3: currentBPE3 }); 2631 2632 2633 //var currentSalesPurpose = props.attributes.pSalesPurpose; 2634 2635 2636 var currentSalesPurpose = document.querySelector("#cbaiSales_Purpose").value; 2637 props.setAttributes({ pSalesPurpose: currentSalesPurpose }); 2638 2639 2640 //var currentSalesName = props.attributes.pSalesName; 2641 2642 2643 var currentSalesName = document.querySelector("#cbaiSales_Name").value; 2644 props.setAttributes({ pSalesName: currentSalesName }); 2645 2646 2647 //var currentSalesName = props.attributes.pSalesCompanyName; 2648 2649 2650 var currentSalesCompanyName = document.querySelector("#cbaiSales_CompanyName").value; 2651 props.setAttributes({ pSalesCompanyName: currentSalesCompanyName }); 2652 2653 2654 //var currentSalesIndustry = props.attributes.pSalesIndustry; 2655 2656 2657 var currentSalesIndustry = document.querySelector("#cbaiSales_Industry").value; 2658 props.setAttributes({ pSalesIndustry: currentSalesIndustry }); 2659 2660 2661 //var currentLeadName = props.attributes.pSalesLeadName; 2662 2663 2664 var currentSalesLeadName = document.querySelector("#cbaiSales_LeadName").value; 2665 props.setAttributes({ pSalesLeadName: currentSalesLeadName }); 2666 2667 2668 //var currentLeadCompanyName = props.attributes.pSalesLeadCompanyName; 2669 2670 2671 var currentSalesLeadCompanyName = document.querySelector("#cbaiSales_LeadCompanyName").value; 2672 props.setAttributes({ pSalesLeadCompanyName: currentSalesLeadCompanyName }); 2673 2674 2675 //var currentLeadIndustry = props.attributes.pSalesLeadIndustry; 2676 2677 2678 var currentSalesLeadIndustry = document.querySelector("#cbaiSales_LeadIndustry").value; 2679 props.setAttributes({ pSalesLeadIndustry: currentSalesLeadIndustry }); 2680 2681 2682 //var currentLeadGoals = props.attributes.pSalesLeadGoals; 2683 2684 2685 var currentSalesLeadGoals = document.querySelector("#cbaiSales_LeadGoals").value; 2686 props.setAttributes({ pSalesLeadGoals: currentSalesLeadGoals }); 2687 2688 2689 //var currentProductBenifits = props.attributes.pSalesProductBenifits; 2690 2691 2692 var currentSalesProductBenefits = document.querySelector("#cbaiSales_ProductBenifits").value; 2693 props.setAttributes({ pSalesProductBenifits: currentSalesProductBenefits }); 2694 2695 2696 //var currentGoal = props.attributes.pGoal; 2697 2698 2699 var currentGoal = document.querySelector("#cbaiPitch_InputGoal").value; 2700 props.setAttributes({ pGoal: currentGoal }); 2701 2702 2703 //var currentExperience = props.attributes.pExperience; 2704 2705 2706 var currentExperience = document.querySelector("#cbaiPitch_InputExperience").value; 2707 props.setAttributes({ pExperience: currentExperience }); 2708 2709 2710 //var currentDelivery = props.attributes.pDelivery; 2711 2712 2713 var currentDelivery = document.querySelector("#cbaiPitch_InputDelivery").value; 2714 props.setAttributes({ pDelivery: currentDelivery }); 2715 2716 2717 //var currentHighlights = props.attributes.pHighlights; 2718 2719 2720 var currentHighlights = document.querySelector("#cbaiPitch_InputHighlights").value; 2721 props.setAttributes({ pHighlights: currentHighlights }); 818 2722 819 2723 … … 829 2733 var currentIndustry = document.querySelector("#cbai_input_industry").value; 830 2734 props.setAttributes({ pIndustry: currentIndustry }); 831 2735 2736 2737 //var currentAudience = props.attributes.pAudience; 2738 2739 var currentAudience = document.querySelector("#cbai_input_audience").value; 2740 props.setAttributes({ pAudience: currentAudience }); 2741 2742 2743 //var currentKeywords = props.attributes.pKeywords; 2744 2745 var currentKeywords = document.querySelector("#cbai_input_keywords").value; 2746 props.setAttributes({ pKeywords: currentKeywords }); 832 2747 833 2748 … … 843 2758 props.setAttributes({ pIncludeIntros: includeIntros }); 844 2759 2760 //var includeTrends = props.attributes.pIncludeIntros; 2761 2762 var includeTrends = document.querySelector("#cbai_input_trends").checked; 2763 props.setAttributes({ pIncludeTrends: includeTrends }); 2764 2765 2766 var currentLangService = document.querySelector("#cbai_input_language_service").value; 2767 props.setAttributes({ pLanguageService: currentLangService }); 845 2768 846 var currentLang = document.querySelector("#cbai_input_language").value; 847 props.setAttributes({ pLanguage: currentType }); 848 849 console.log(currentType); 850 console.log(currentLang); 851 console.log(currentTone); 852 console.log(currentName); 853 console.log(currentDescription); 854 console.log(currentBlogTopic); 855 console.log(currentIndustry); 856 857 if (typeof includeIntros == 'undefined' || includeIntros == '') { 858 includeIntros = false; 2769 var currentLangSource = document.querySelector("#cbai_input_language_source").value; 2770 props.setAttributes({ pLanguageSource: currentLangSource }); 2771 2772 var currentLangTarget = document.querySelector("#cbai_input_language_target").value; 2773 props.setAttributes({ pLanguageTarget: currentLangTarget }); 2774 2775 var currentLangFormality = document.querySelector("#cbai_input_language_formality").value; 2776 props.setAttributes({ pLanguageFormality: currentLangFormality }); 2777 2778 /* 2779 console.log('Type:' + currentType); 2780 console.log('LangService:' + currentLangService); 2781 console.log('LangSource:' + currentLangSource); 2782 console.log('LangTarget:' + currentLangTarget); 2783 console.log('LangFormality:' + currentLangFormality); 2784 console.log('Tone:' + currentTone); 2785 console.log('Name:' + currentName); 2786 console.log('Description:' + currentDescription); 2787 console.log('BPE1:' + currentBPE1); 2788 console.log('BPE2:' + currentBPE2); 2789 console.log('BPE3:' + currentBPE3); 2790 console.log('SalesPurpose:' + currentSalesPurpose); 2791 console.log('SalesName:' + currentSalesName); 2792 console.log('SalesCompanyName:' + currentSalesCompanyName); 2793 console.log('SalesIndustry:' + currentSalesIndustry); 2794 console.log('SalesLeadName:' + currentSalesLeadName); 2795 console.log('SalesLeadCompanyName:' + currentSalesLeadCompanyName); 2796 console.log('SalesLeadIndustry:' + currentSalesLeadIndustry); 2797 console.log('SalesLeadGoals:' + currentSalesLeadGoals); 2798 console.log('SalesProductBenifits:' + currentSalesProductBenefits); 2799 console.log('Goal:' + currentGoal); 2800 console.log('Experience:' + currentExperience); 2801 console.log('Delivery:' + currentDelivery); 2802 console.log('Highlights:' + currentHighlights); 2803 console.log('Topic:' + currentBlogTopic); 2804 console.log('Industry:' + currentIndustry); 2805 console.log('Audience:' + currentAudience); 2806 console.log('Keywords:' + currentKeywords); 2807 */ 2808 2809 2810 // Validation 2811 var run_continue = true; 2812 // reset all non-validated styles 2813 2814 for (k in validation) { 2815 jQuery("#"+k).css('border','1px solid #757575'); 2816 jQuery("#"+k).removeClass('error-shake'); 2817 if (validation[k] == true) { 2818 // validate against this input field 2819 var currentValue = jQuery("#"+k).val(); 2820 2821 if (typeof(currentValue) !== 'undefined') { 2822 if (currentValue.length < 2) { 2823 2824 jQuery("#"+k).css('border','1px solid red'); 2825 jQuery("#"+k).addClass('error-shake'); 2826 run_continue = false; 2827 } else { 2828 // save to local storage 2829 localStorage.setItem("cb_"+k, currentValue); 2830 } 2831 } 2832 } 859 2833 } 860 2834 861 if (typeof currentTone == 'undefined' || currentTone == '' || currentTone == 'undefined') { 862 currentTone = 'professional'; 863 props.setAttributes({ pTone: 'professional' }); 864 } 865 866 if (typeof currentLang == 'undefined' || currentLang == '' || currentLang == 'undefined') { 867 currentLang = 'en'; 868 props.setAttributes({ pLanguage: 'en' }); 869 } 870 871 if (typeof currentType == 'undefined' || currentType == '' || currentType == 'undefined') { 872 currentType = 'product_description'; 873 props.setAttributes({ pType: 'product_description' }); 874 } 875 876 877 var cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pdesc='+currentDescription+'&ptone='+currentTone+'&ptype='+currentType; 878 879 if (props.attributes.pType == 'blog_topics') { 880 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pdesc='+currentBlogTopic+'&ptone='+currentTone+'&ptype='+currentType+"&intros="+includeIntros; 881 882 } 883 if (props.attributes.pType == 'blog_intro') { 884 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pdesc='+currentBlogTopic+'&ptone='+currentTone+'&ptype='+currentType; 885 886 } 887 888 if (props.attributes.pType == 'marketing_ideas') { 889 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pindustry='+currentIndustry+'&pdesc='+currentDescription+'&ptone='+currentTone+'&ptype='+currentType; 890 891 } 892 893 cb_URL += '&lang='+currentLang; 894 895 896 document.querySelector("#contentBotOverlay").classList.remove('hidden'); 897 document.querySelector("#contentBotOverlay").classList.add('content-bot-overlay'); 898 document.querySelector("#content-bot-rating").classList.add('hidden'); 899 900 jQuery.ajax({ 901 type: "GET", 902 dataType: "json", 903 /* the hash here is important because we are required to do rate limiting by OpenAI */ 904 url: cb_URL, 905 success: function(msg){ 906 907 if (typeof msg.error !== 'undefined') { 908 var output = msg.error; 909 } else { 910 var output = msg.output; 911 } 912 913 var output_type = 'standard'; 914 if (typeof msg.output_type !== 'undefined') { 915 output_type = msg.output_type; 916 } 917 918 919 if (typeof msg.limitremaining) { 920 if (parseInt(msg.limitremaining) < 50) { 921 // Don't show it if its too high - people may think it's a target to reach :D 922 // Only show it when its less than 50 923 // This means free users will always see it and only high qty users will see it 924 document.querySelector("#content-bot-limit-qty").innerHTML = parseInt(msg.limitremaining); 925 document.querySelector("#content-bot-limit-remaining").classList.remove('hidden'); 2835 if(run_continue){ 2836 2837 if (typeof includeIntros == 'undefined' || includeIntros == '') { 2838 includeIntros = false; 2839 } 2840 2841 if (typeof includeTrends == 'undefined' || includeTrends == '') { 2842 includeTrends = false; 2843 } 2844 2845 if (typeof currentTone == 'undefined' || currentTone == '' || currentTone == 'undefined') { 2846 currentTone = 'professional'; 2847 props.setAttributes({ pTone: 'professional' }); 2848 } 2849 2850 if (typeof currentLangSource == 'undefined' || currentLangSource == '' || currentLangSource == 'undefined') { 2851 currentLangSource = 'en'; 2852 props.setAttributes({ pLanguageSource: 'en' }); 2853 } 2854 2855 if (typeof currentType == 'undefined' || currentType == '' || currentType == 'undefined') { 2856 currentType = 'product_description'; 2857 props.setAttributes({ pType: 'product_description' }); 2858 } 2859 2860 2861 var cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pdesc='+currentDescription+'&ptone='+currentTone+'&ptype='+currentType; 2862 2863 if (props.attributes.pType == 'marketing_ideas') { 2864 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pindustry='+currentIndustry+'&pdesc='+currentDescription+'&ptone='+currentTone+'&ptype='+currentType; 2865 } 2866 if (props.attributes.pType == 'blog_topics') { 2867 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pdesc='+currentBlogTopic+'&ptone='+currentTone+'&ptype='+currentType+"&intros="+includeIntros+"&relevance="+includeTrends; 2868 } 2869 if (currentType == 'boutline') { 2870 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&ptype='+currentType+'&pdesc='+currentDescription+'&ptopic='+currentBlogTopic; 2871 } 2872 if (currentType == 'bpe') { 2873 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&ptype='+currentType+'&pbpe1='+currentBPE1+'&pbpe2='+currentBPE2+'&pbpe3='+currentBPE3; 2874 } 2875 if (currentType == 'blog_intro') { 2876 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pdesc='+currentBlogTopic+'&ptone='+currentTone+'&ptype='+currentType; 2877 } 2878 if (currentType == 'listicle') { 2879 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pdesc='+currentDescription+'&ptype='+currentType; 2880 } 2881 if (currentType == 'change_tone') { 2882 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&ptype='+currentType+'&pdesc='+currentDescription+'&ptone='+currentTone; 2883 } 2884 if (currentType == 'finish_sentence') { 2885 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pdesc='+currentDescription+'&ptype='+currentType; 2886 } 2887 if (currentType == 'brand_names') { 2888 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pdesc='+currentDescription+'&pkeywords='+currentKeywords+'&ptype='+currentType; 2889 } 2890 if (currentType == 'adwords_ad' || currentType == 'facebook_ad') { 2891 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pdesc='+currentDescription+'&pkeywords='+currentKeywords+'&ptype='+currentType+"&paudience="+currentAudience; 2892 } 2893 if (currentType == 'youtube_ideas' || currentType == 'video_description') { 2894 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pdesc='+currentDescription+'&pkeywords='+currentKeywords+'&ptype='+currentType; 2895 } 2896 if (currentType == 'landing_page') { 2897 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pdesc='+currentDescription+'&pkeywords='+currentKeywords+'&ptype='+currentType; 2898 } 2899 if (currentType == 'value_proposition') { 2900 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pdesc='+currentDescription+'&ptype='+currentType; 2901 } 2902 if (currentType == 'pitch_yourself') { 2903 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&pname='+currentName+'&pindustry='+currentIndustry+'&pdesc='+currentGoal+'&ptype='+currentType+"&ppitch_delivery="+currentDelivery+"&ppitch_highlights="+currentDelivery+"&ppitch_experience="+currentExperience; 2904 } 2905 if (currentType == 'answers') { 2906 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&ptype='+currentType+'&pdesc='+currentDescription; 2907 } 2908 if (currentType == 'sales_email') { 2909 cb_URL = cb_HOST+'input?hash='+cbai_data.hash+'&ptype='+currentType+'&psales_purpose='+currentSalesPurpose+'&psales_name='+currentSalesName+'&psales_companyname='+currentSalesCompanyName+'&psales_industry='+currentSalesIndustry+'&psales_leadname='+currentSalesLeadName+'&psales_leadcompanyname='+currentSalesLeadCompanyName+'&psales_leadindustry='+currentSalesLeadIndustry+'&psales_leadgoals='+currentSalesLeadGoals+'&psales_benefits='+currentSalesProductBenefits 2910 } 2911 2912 //cb_URL += '&lang='+currentLangSource; 2913 cb_URL += '&planservice='+currentLangService+'&lang='+currentLangTarget+'&psourcelan='+currentLangSource+'&planformality='+currentLangFormality; 2914 2915 2916 jQuery(function($){ 2917 var cb_components_panel_height = $('.components-panel').css('height'); 2918 2919 $('#contentBotOverlay').css("height", cb_components_panel_height); 2920 }); 2921 2922 document.querySelector("#contentBotOverlay").classList.remove('hidden'); 2923 document.querySelector("#contentBotOverlay").classList.add('content-bot-overlay'); 2924 document.querySelector("#content-bot-rating").classList.add('hidden'); 2925 2926 jQuery.ajax({ 2927 type: "GET", 2928 dataType: "json", 2929 /* the hash here is important because we are required to do rate limiting by OpenAI */ 2930 url: cb_URL, 2931 success: function(msg){ 2932 2933 if (typeof msg.error !== 'undefined') { 2934 var output = msg.error; 2935 } else { 2936 var output = msg.output; 926 2937 } 927 } 928 929 var original_output = output; 930 931 if (typeof output == "object") { 932 933 // multi output 934 935 var outputHTML = ''; 2938 2939 var output_type = 'standard'; 2940 if (typeof msg.output_type !== 'undefined') { 2941 output_type = msg.output_type; 2942 } 2943 2944 2945 if (typeof msg.limitremaining) { 2946 if (parseInt(msg.limitremaining) < 50) { 2947 // Don't show it if its too high - people may think it's a target to reach :D 2948 // Only show it when its less than 50 2949 // This means free users will always see it and only high qty users will see it 2950 document.querySelector("#content-bot-limit-qty").innerHTML = parseInt(msg.limitremaining); 2951 document.querySelector("#content-bot-limit-remaining").classList.remove('hidden'); 2952 } 2953 } 936 2954 937 if (output_type == 'blog_topics_and_intros') { 938 var cnter = 0; 939 for (k in output) { 940 cnter++; 941 outputHTML += "<p><strong>Topic #"+cnter+": "+output[k].title+"</strong></p>"; 942 outputHTML += "<p>"+output[k].intro+"</p>"; 943 } 944 } else { 945 946 var cnter = 0; 947 for (k in output) { 948 949 if (output[k].text.length > 1) { 2955 var original_output = output; 2956 2957 if (typeof output == "object") { 2958 2959 // multi output 2960 2961 var outputHTML = ''; 2962 2963 if (output_type == 'blog_topics_and_intros') { 2964 var cnter = 0; 2965 for (k in output) { 950 2966 cnter++; 951 outputHTML += "<p><strong>Content Generation #"+cnter+"</strong><br />"; 952 outputHTML += ""+output[k].text+"</p>"; 2967 outputHTML += "<p><strong>Topic #"+cnter+": "+output[k].title+"</strong></p>"; 2968 outputHTML += "<p>"+output[k].intro+"</p>"; 2969 } 2970 } else { 2971 2972 var cnter = 0; 2973 for (k in output) { 2974 2975 if (typeof output[k].text !== 'undefined' && output[k].text.length > 1) { 2976 2977 if (output[k].text.includes('This is a video description generator')) { 2978 continue; 2979 } 2980 2981 var uidd = genHexString(12); 2982 2983 cnter++; 2984 outputHTML += '<p><strong>Content Generation #'+cnter+'</strong>' 2985 2986 if (currentType == 'product_description' || currentType == 'tweet_ideas' || currentType == 'blog_intro' || currentType == 'blog_intro_v2' || currentType == 'marketing_ideas' || currentType == 'startup_ideas' || currentType == 'finish_sentence' || currentType == 'headline_ideas' || currentType == 'blog_topics' || currentType == 'blog_topics_v2' || currentType == 'answers' || currentType == 'sales_email' || currentType == 'listicle' || currentType == 'pitch_yourself' ) { 2987 2988 if (currentType == 'blog_intro') { 2989 outputHTML += "<br><strong>" + currentBlogTopic + "</strong>"; 2990 //outputHTML += "<textarea class='practicallyHidden' id='content_stripped_" + uidd + "'>" + currentBlogTopic + "\n" + output[k].text.replace(/(<([^>]+)>)/gi, "").replace(/'/g, "\\'") + "</textarea>"; 2991 outputHTML += '<br>' + output[k].text; 2992 2993 } else if (currentType == 'blog_topics') { 2994 outputHTML += "<br><strong>" + output[k].text + "</strong>"; 2995 2996 2997 } else if (currentType == 'startup_ideas') { 2998 outputHTML += buildStartupFrame(output[k].text); 2999 3000 3001 } else if (currentType == 'headline_ideas') { 3002 outputHTML += buildHeadlineFrame("<br><strong>"+output[k].text+"</strong>"); 3003 3004 3005 } else if (currentType == 'listicle') { 3006 var list_items = output[k].text; 3007 list_items = list_items.split(/\n/); 3008 for (m in list_items) { 3009 if (list_items[m] !== '') { 3010 outputHTML += "<br>- "+list_items[m]; 3011 } 3012 } 3013 3014 3015 } else if (currentType == 'product_description') { 3016 outputHTML += buildProductDescriptionFrame("<span>" + highlightPlagiarizedPhrases(output[k].text, output[k], uidd) +"</span>", currentName); 3017 3018 3019 } else if (currentType == 'answers') { 3020 output[k].text = output[k].text.replaceAll("\n","<br>"); 3021 //outputHTML += "<br><strong>Answer</strong>"; 3022 outputHTML += "<br>"+output[k].text; 3023 3024 3025 } else if (currentType == 'sales_email') { 3026 output[k].text = output[k].text.replaceAll("\n","<br>"); 3027 3028 if (output[k].text.slice(0, 8) === '<br><br>') { 3029 output[k].text = output[k].text.substring(8); 3030 } 3031 outputHTML += buildSalesEmailFrame("<p>"+output[k].text+"</p>"); 3032 3033 3034 } else if (currentType == 'finish_sentence') { 3035 outputHTML += "<br>"+cleanup(output[k].text); 3036 3037 3038 } else if (currentType == 'pitch_yourself') { 3039 outputHTML += "<br>Hello "+currentName+",<br><br>"+output[k].text.replaceAll("\n","<br>"); 3040 3041 3042 } else { 3043 outputHTML += output[k].text; 3044 } 3045 3046 } else { 3047 outputHTML += output[k].text; 3048 } 3049 3050 outputHTML += '</p>'; 3051 3052 } else { 3053 3054 cnter++; 3055 outputHTML += '<p><strong>Content Generation #'+cnter+'</strong>' 3056 3057 // this is an array of arrays 3058 if (currentType == 'adwords_ad') { 3059 outputHTML += buildAdWordsAdFrame(output[k]); 3060 } 3061 if (currentType == 'landing_page') { 3062 outputHTML += buildLandingPageFrame(output[k]); 3063 } 3064 if (currentType == 'pas') { 3065 outputHTML += buildPASFrame(output[k]); 3066 } 3067 if (currentType == 'pbs') { 3068 outputHTML += buildPBSFrame(output[k]); 3069 } 3070 if (currentType == 'answers') { 3071 outputHTML += buildAnswersFrame(output[k]); 3072 } 3073 if (currentType == 'aida') { 3074 outputHTML += buildAIDAFrame(output[k]); 3075 } 3076 if (currentType == 'boutline') { 3077 outputHTML += buildBlogOutlineFrame(output[k], output.additional); 3078 } 3079 if (currentType == 'facebook_ad') { 3080 outputHTML += buildFacebookAdFrame(output[k]); 3081 } 3082 if (currentType == 'brand_names') { 3083 outputHTML += buildBrandNamesFrame(output[k]); 3084 } 3085 if (currentType == 'youtube_ideas') { 3086 outputHTML += buildYouTubeIdeas(output[k]); 3087 } 3088 3089 outputHTML += '</p>'; 3090 3091 } 3092 953 3093 } 954 3094 955 3095 } 956 957 } 958 props.setAttributes({ pOutput: outputHTML }); 959 props.setAttributes( { content: outputHTML } ); 960 961 962 } else { 963 964 3096 props.setAttributes({ pOutput: outputHTML }); 3097 props.setAttributes({ content: outputHTML }); 3098 3099 } else { 965 3100 // single output 966 3101 output = output.replaceAll("###","<br>"); 967 3102 output = output.replaceAll("\n","<br>"); 968 969 3103 970 3104 var test = original_output.split(/\n/); … … 975 3109 976 3110 props.setAttributes({ pOutput: new_string }); 977 props.setAttributes( { content: new_string } ); 978 3111 props.setAttributes({ content: new_string }); 3112 } 3113 3114 document.querySelector("#contentBotOverlay").classList.add('hidden'); 3115 document.querySelector("#contentBotOverlay").classList.remove('content-bot-overlay'); 3116 document.querySelector("#content-bot-rating").classList.remove('hidden'); 979 3117 } 980 981 document.querySelector("#contentBotOverlay").classList.add('hidden'); 982 document.querySelector("#contentBotOverlay").classList.remove('content-bot-overlay'); 983 document.querySelector("#content-bot-rating").classList.remove('hidden'); 984 985 986 } 987 }); 3118 }); 3119 } 988 3120 } 989 3121 }, … … 1008 3140 1009 3141 ), 3142 /* 1010 3143 1011 3144 React.createElement( … … 1020 3153 React.createElement('a',{href: 'https://contentbot.ai/#video', target:'_BLANK'},'Demo video') 1021 3154 ), 3155 3156 */ 1022 3157 1023 3158 React.createElement( … … 1055 3190 ) 1056 3191 ) 3192 1057 3193 ) 1058 3194 ), … … 1072 3208 ) 1073 3209 1074 1075 3210 ] 3211 1076 3212 }, 1077 3213 save: function( props ) { … … 1085 3221 }, 1086 3222 1087 1088 3223 } ); 3224 1089 3225 }( 1090 3226 window.wp.blocks, … … 1094 3230 ) ); 1095 3231 3232 3233 1096 3234 jQuery(function ($) { 1097 3235 1098 3236 jQuery("body").on("mouseover", ".content-bot-rating-li-1", function(e) { 1099 3237 jQuery('.content-bot-rating-li-1').css("background-image", "url("+cbai_data.location+"/img/star-black.png)"); … … 1136 3274 1137 3275 }) 1138 3276 1139 3277 });
Note: See TracChangeset
for help on using the changeset viewer.