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.6.1 11.6.2 11.7 11.7.1 11.7.2 11.7.3 11.8 11.8.3 11.8.4 11.8.5 11.8.6 11.9 11.9.1 11.9.2 11.9.3 12.0 12.0.1 12.0.2 12.1 12.1.1 12.1.2 12.2 12.2.1 12.2.2 12.3 12.3.1 12.4 12.4.1 12.5 12.5.1 12.6 12.6.1 12.6.2 12.6.3 12.7 12.7.1 12.7.2 12.8 12.8.1 12.8.2 12.9 12.9.1 12.9.2 12.9.3 12.9.4 13.0 13.0.1 13.1 13.1.1 13.1.2 13.1.3 13.1.4 13.2 13.2.1 13.2.2 13.2.3 13.3 13.3.1 13.3.2 13.4 13.4.1 13.4.2 13.4.3 13.4.4 13.5 13.5.1 13.6 13.6.1 13.7 13.7.1 13.8 13.8.1 13.8.2 13.9 13.9.1 14.0 14.1 14.2 14.2.1 14.3 14.4 14.4.1 14.5 14.6 14.7 14.8 14.9 14.9.1 15.0 15.0.1 15.0.2 15.1 15.1.1 15.2 15.3 15.3.1 15.4 15.5 15.6 15.7 15.7-a.1 15.7-a.3 15.7-a.5 15.7-a.7 15.7-beta
jetpack / _inc / blocks / ai-chat / view.js
jetpack / _inc / blocks / ai-chat Last commit date
block.json 2 years ago view.asset.php 1 month ago view.css 7 months ago view.js 1 month ago view.rtl.css 7 months ago
view.js
1 lines
1 (()=>{var e={81730(){},7404(e,t,a){"use strict";a.d(t,{A:()=>l});var s=a(56427),c=a(29491),o=a(86087),r=a(27723),n=a(55163),i=a(10790);const __=r.__,_x=r._x;function l({answer:e}){const[t,a]=(0,o.useState)(!1),r=(new DOMParser).parseFromString(e,"text/html"),l=r.body.textContent||r.body.innerText||"",d=(0,c.useCopyToClipboard)(l,()=>{a(!0),setTimeout(()=>a(!1),3e3)});return(0,i.jsx)("div",{className:"jetpack-ai-chat-copy-button-container",children:(0,i.jsxs)(s.Button,{className:"jetpack-ai-chat-copy-button",disabled:t,label:__("Copy Response","jetpack"),variant:"has-text",ref:d,children:[(0,i.jsx)(s.Icon,{className:"copy-icon",icon:n.ui}),t?_x("Copied!","Copied to clipboard","jetpack"):_x("Copy Response","Copy to clipboard.","jetpack")]})})}},73829(e,t,a){"use strict";a.d(t,{A:()=>o});var s=a(27723),c=a(10790);const __=s.__;function o(){return(0,c.jsx)("div",{className:"jetpack-ai-chat-error-container",children:__("There was an error while generating the answer. Please try again later.","jetpack")})}},85443(e,t,a){"use strict";a.d(t,{A:()=>d});var s=a(56427),c=a(86087),o=a(27723),r=a(55163),n=a(89692),i=a(73829),l=a(10790);const __=o.__;function d({blogType:e,blogId:t,cacheKey:a,feedbackSubmitted:o,addFeedback:d}){const{isSubmittingFeedback:h,submitFeedback:u,feedbackError:p,setFeedbackError:b}=(0,n.A)(e,t);(0,c.useEffect)(()=>{a.startsWith("jp-search-ai-")&&(m({rank:"",comment:""}),j(!1),b(!1))},[a]);const[k,m]=(0,c.useState)({rank:"",comment:""}),[w,j]=(0,c.useState)(!1),x=o.includes(a),g=e=>{m({...k,rank:e}),j(!0)},f=!p&&!x;return(0,l.jsxs)("div",{className:"jetpack-ai-chat-feedback-container",children:[p&&(0,l.jsx)(i.A,{error:p}),x&&(0,l.jsx)("div",{className:"jetpack-ai-chat-feedback-submitted",children:__("Thanks for your feedback!","jetpack")}),f&&(0,l.jsxs)("div",{className:"jetpack-ai-chat-answer-feedback",children:[(0,l.jsx)("hr",{}),(0,l.jsxs)("div",{className:"jetpack-ai-chat-answer-feedback-buttons",children:[__("Was this helpful?","jetpack"),(0,l.jsx)("a",{role:"button",className:"thumbs-up",disabled:h||"thumbs-up"===k.rank,label:__("Thumbs up","jetpack"),onClick:()=>g("thumbs-up"),children:(0,l.jsx)(s.Icon,{icon:r.tw})}),(0,l.jsx)("a",{role:"button",className:"thumbs-down",disabled:h||"thumbs-down"===k.rank,label:__("Thumbs down","jetpack"),onClick:()=>g("thumbs-down"),children:(0,l.jsx)(s.Icon,{icon:r.Su})})]}),w&&(0,l.jsxs)("div",{className:"jetpack-ai-chat-feedback-form",children:[(0,l.jsx)(s.TextControl,{className:"jetpack-ai-chat-feedback-input",placeholder:"thumbs-up"===k.rank?__("What did you like about it?","jetpack"):__("What didn't you like about it? How could it be improved?","jetpack"),size:50,value:k.comment,disabled:h||x,onChange:e=>m({...k,comment:e}),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,l.jsx)(s.Button,{className:"wp-block-button__link jetpack-ai-chat-feedback-submit",onClick:()=>{u(k,a),d(a),u(k,a)},disabled:h||x,children:__("Submit","jetpack")})]})]})]})}},50443(e,t,a){"use strict";a.d(t,{G:()=>o,W:()=>c});var s=a(27723);const __=s.__,c=__("Ask","jetpack"),o=__("Ask a question about this site","jetpack")},55163(e,t,a){"use strict";a.d(t,{Su:()=>r,tw:()=>o,ui:()=>n});var s=a(56427),c=a(10790);const o=(0,c.jsx)(s.SVG,{viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(s.Path,{d:"M466.27 286.69C475.04 271.84 480 256 480 236.85c0-44.015-37.218-85.58-85.82-85.58H357.7c4.92-12.81 8.85-28.13 8.85-46.54C366.55 31.936 328.86 0 271.28 0c-61.607 0-58.093 94.933-71.76 108.6-22.747 22.747-49.615 66.447-68.76 83.4H32c-17.673 0-32 14.327-32 32v240c0 17.673 14.327 32 32 32h64c14.893 0 27.408-10.174 30.978-23.95 44.509 1.001 75.06 39.94 177.802 39.94 7.22 0 15.22.01 22.22.01 77.117 0 111.986-39.423 112.94-95.33 13.319-18.425 20.299-43.122 17.34-66.99 9.854-18.452 13.664-40.343 8.99-62.99zm-61.75 53.83c12.56 21.13 1.26 49.41-13.94 57.57 7.7 48.78-17.608 65.9-53.12 65.9h-37.82c-71.639 0-118.029-37.82-171.64-37.82V240h10.92c28.36 0 67.98-70.89 94.54-97.46 28.36-28.36 18.91-75.63 37.82-94.54 47.27 0 47.27 32.98 47.27 56.73 0 39.17-28.36 56.72-28.36 94.54h103.99c21.11 0 37.73 18.91 37.82 37.82.09 18.9-12.82 37.81-22.27 37.81 13.489 14.555 16.371 45.236-5.21 65.62zM88 432c0 13.255-10.745 24-24 24s-24-10.745-24-24 10.745-24 24-24 24 10.745 24 24z"})}),r=(0,c.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:(0,c.jsx)(s.Path,{d:"M466.27 225.31c4.674-22.647.864-44.538-8.99-62.99 2.958-23.868-4.021-48.565-17.34-66.99C438.986 39.423 404.117 0 327 0c-7 0-15 .01-22.22.01C201.195.01 168.997 40 128 40h-10.845c-5.64-4.975-13.042-8-21.155-8H32C14.327 32 0 46.327 0 64v240c0 17.673 14.327 32 32 32h64c11.842 0 22.175-6.438 27.708-16h7.052c19.146 16.953 46.013 60.653 68.76 83.4 13.667 13.667 10.153 108.6 71.76 108.6 57.58 0 95.27-31.936 95.27-104.73 0-18.41-3.93-33.73-8.85-46.54h36.48c48.602 0 85.82-41.565 85.82-85.58 0-19.15-4.96-34.99-13.73-49.84zM64 296c-13.255 0-24-10.745-24-24s10.745-24 24-24 24 10.745 24 24-10.745 24-24 24zm330.18 16.73H290.19c0 37.82 28.36 55.37 28.36 94.54 0 23.75 0 56.73-47.27 56.73-18.91-18.91-9.46-66.18-37.82-94.54C206.9 342.89 167.28 272 138.92 272H128V85.83c53.611 0 100.001-37.82 171.64-37.82h37.82c35.512 0 60.82 17.12 53.12 65.9 15.2 8.16 26.5 36.44 13.94 57.57 21.581 20.384 18.699 51.065 5.21 65.62 9.45 0 22.36 18.91 22.27 37.81-.09 18.91-16.71 37.82-37.82 37.82z"})}),n=(0,c.jsxs)(s.SVG,{stroke:"currentColor",fill:"none",strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",height:"1.5em",width:"1.5em",xmlns:"http://www.w3.org/2000/svg",children:[(0,c.jsx)(s.Path,{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),(0,c.jsx)(s.Rect,{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"})]})},93807(e,t,a){"use strict";a.d(t,{A:()=>b});var s=a(56427),c=a(86087),o=a(27723),r=a(7404),n=a(73829),i=a(85443),l=a(50443),d=a(95715),h=a(10790);const __=o.__,u=[__("Good question, give me a moment to think about that 🤔","jetpack"),__("Let me work out the answer to that, back soon!","jetpack"),__("🤔 Thinking, thinking, will be back with an answer soon","jetpack")];function p({html:e,showAnimation:t,onAnimationDone:a}){const[s,o]=(0,c.useState)("");return(0,c.useEffect)(()=>{if(t&&e){const t=e.split(" ");for(let e=1;e<t.length;e++){const a=t.slice(0,e).join(" ");setTimeout(()=>o(a),50*e)}setTimeout(()=>{o(e),a()},50*t.length)}else o(e),a()},[]),(0,h.jsx)("div",{className:"content",children:(0,h.jsx)(c.RawHTML,{children:s})})}function b({askButtonLabel:e=l.W,blogId:t,blogType:a,placeholder:o=l.G,settingShowCopy:b,settingShowFeedback:k,settingShowSources:m}){const{question:w,setQuestion:j,answer:x,isLoading:g,submitQuestion:f,references:v,askError:S,setAskError:y,cacheKey:_}=(0,d.A)(a,t),[A,C]=(0,c.useState)(!0),[T,N]=(0,c.useState)(!1),[B,F]=(0,c.useState)([]),[E,I]=(0,c.useState)(""),M=()=>{y(!1),C(!1),N(!1),F([]),I(w),f()},q=b&&A&&!g&&x,z=k&&A&&!g&&_;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.KeyboardShortcuts,{shortcuts:{enter:M},children:(0,h.jsxs)("div",{className:"jetpack-ai-chat-question-wrapper",children:[(0,h.jsx)(s.TextControl,{className:"jetpack-ai-chat-question-input",placeholder:o,size:50,disabled:!A||g,value:w,onChange:e=>j(e),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,h.jsxs)(s.Button,{className:"wp-block-button__link jetpack-ai-chat-question-button",disabled:!A||g,onClick:M,children:[g&&(0,h.jsx)(s.Spinner,{}),!g&&e]})]})}),(0,h.jsxs)("div",{children:[(0,h.jsxs)("div",{className:"jetpack-ai-chat-answer-container",children:[E&&(0,h.jsx)("h2",{children:E}),g&&(0,h.jsx)("span",{children:u[Math.floor(3*Math.random())]}),!g&&(0,h.jsx)(p,{showAnimation:!A,onAnimationDone:()=>{C(!0),N(!0)},html:x})]}),S&&!g&&(0,h.jsx)(n.A,{error:S}),q&&(0,h.jsx)(r.A,{answer:x}),m&&v&&v.length>0&&T&&(0,h.jsxs)("div",{className:"jetpack-ai-chat-answer-references",children:[(0,h.jsx)("h3",{children:__("Additional resources:","jetpack")}),(0,h.jsx)("ul",{children:v.map((e,t)=>(0,h.jsx)("li",{children:(0,h.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:e.title})},t))}),(0,h.jsx)("hr",{})]}),z&&(0,h.jsx)(i.A,{blogId:t,blogType:a,cacheKey:_,feedbackSubmitted:B,addFeedback:e=>{F([...B,e])}})]})]})}},89692(e,t,a){"use strict";a.d(t,{A:()=>r});var s=a(1455),c=a.n(s),o=a(86087);function r(e,t){const[a,s]=(0,o.useState)(!1),[r,n]=(0,o.useState)(!1);return{isSubmittingFeedback:a,submitFeedback:async(a,o)=>{let r=`/wpcom/v2/jetpack-search/ai/rank?cache_key=${o}`;"wpcom"===e&&(r=`/wpcom/v2/sites/${t}/jetpack-search/ai/rank?cache_key=${o}`),s(!0),await c()({path:r,method:"POST",data:{rank:a.rank,comment:a.comment}}).then(()=>{n(!1)}).catch(e=>{n(e)}).finally(()=>{s(!1)})},feedbackError:r,setFeedbackError:n}}},95715(e,t,a){"use strict";a.d(t,{A:()=>r});var s=a(1455),c=a.n(s),o=a(86087);function r(e,t){const[a,s]=(0,o.useState)(""),[r,n]=(0,o.useState)(null),[i,l]=(0,o.useState)(""),[d,h]=(0,o.useState)(!1),[u,p]=(0,o.useState)([]),[b,k]=(0,o.useState)(!1);return{question:a,setQuestion:s,answer:r,isLoading:b,submitQuestion:async()=>{let s=`/wpcom/v2/jetpack-search/ai/search?query=${a}`;"wpcom"===e&&(s=`/wpcom/v2/sites/${t}/jetpack-search/ai/search?query=${a}`),k(!0),n(null),c()({path:s,method:"GET"}).then(e=>{l(e.cache_key),n(e.response),p(e.urls)}).catch(e=>{l(""),p([]),h(e)}).finally(()=>{k(!1)})},references:u,cacheKey:i,askError:d,setAskError:h}}},79366(e,t,a){"object"==typeof window&&window.Jetpack_Block_Assets_Base_Url&&(a.p=window.Jetpack_Block_Assets_Base_Url)},10790(e){"use strict";e.exports=window.ReactJSXRuntime},1455(e){"use strict";e.exports=window.wp.apiFetch},56427(e){"use strict";e.exports=window.wp.components},29491(e){"use strict";e.exports=window.wp.compose},98490(e){"use strict";e.exports=window.wp.domReady},86087(e){"use strict";e.exports=window.wp.element},27723(e){"use strict";e.exports=window.wp.i18n}},t={};function a(s){var c=t[s];if(void 0!==c)return c.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,a),o.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var s in t)a.o(t,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var t=globalThis.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var s=t.getElementsByTagName("script");if(s.length)for(var c=s.length-1;c>-1&&(!e||!/^http(s?):/.test(e));)e=s[c--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e+"../"})(),(()=>{"use strict";a(79366)})(),(()=>{"use strict";var e=a(98490),t=a.n(e),s=a(86087),c=a(50443),o=a(93807),r=(a(81730),a(10790));const n=({askButtonLabel:e=c.W,blogId:t,blogType:a,placeholder:s=c.G,showCopy:n,showFeedback:i,showSources:l})=>(0,r.jsx)("div",{children:(0,r.jsx)(o.A,{askButtonLabel:e,blogId:t,blogType:a,placeholder:s,settingShowCopy:n,settingShowFeedback:i,settingShowSources:l})});t()(function(){const e=document.querySelector("#jetpack-ai-chat"),t=e.getAttribute("data-ask-button-label"),a=e.getAttribute("data-placeholder"),c=e.getAttribute("data-blog-id"),o=e.getAttribute("data-blog-type");(0,s.createRoot)(e).render((0,r.jsx)(n,{askButtonLabel:t,blogId:c,blogType:o,placeholder:a,showCopy:!!parseInt(e.getAttribute("data-show-copy")),showFeedback:!!parseInt(e.getAttribute("data-show-feedback")),showSources:!!parseInt(e.getAttribute("data-show-sources"))}))})})()})();