| 1 |
!function(){"use strict";var e={d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{init:function(){return g}});var n=window.elementorV2.editor,o=window.React,i=window.elementorV2.editorMcp,r=window.elementorV2.editorUi,l=window.elementorV2.icons,a=window.elementorV2.ui,c=window.wp.i18n;const s="elementor/editor/create-widget",d="https://assets.elementor.com/packages/v1/images/angie-promotion.svg";function m(){const[e,t]=(0,o.useState)(!1),[n,m]=(0,o.useState)(),[g,u]=(0,o.useState)("idle"),p=async e=>{const n=e;(0,i.isAngieAvailable)()?(0,i.sendPromptToAngie)(n.detail?.prompt):(m(n.detail?.prompt),t(!0))},w=()=>{"installing"!==g&&(t(!1),m(void 0),u("idle"))};return(0,o.useEffect)(()=>(window.addEventListener(s,p),()=>{window.removeEventListener(s,p)}),[]),o.createElement(r.ThemeProvider,null,o.createElement(a.Dialog,{fullWidth:!0,maxWidth:"md",open:e,onClose:w},o.createElement(a.IconButton,{"aria-label":(0,c.__)("Close","elementor"),onClick:w,sx:{position:"absolute",right:8,top:8,zIndex:1}},o.createElement(l.XIcon,null)),o.createElement(a.DialogContent,{sx:{p:0,overflow:"hidden"}},o.createElement(a.Stack,{direction:"row",sx:{height:400}},o.createElement(a.Image,{sx:{height:"100%",aspectRatio:"1 / 1",objectFit:"cover",objectPosition:"right center"},src:d}),o.createElement(a.Stack,{gap:2,justifyContent:"center",p:4},o.createElement(a.Typography,{variant:"h6",fontWeight:600,whiteSpace:"nowrap"},"error"===g?(0,c.__)("Installation failed","elementor"):(0,c.__)("Install Angie to build custom widgets","elementor")),o.createElement(a.Typography,{variant:"body2",color:"text.secondary"},"error"===g?(0,c.__)("We couldn't install Angie automatically. Click below to install it manually.","elementor"):(0,c.__)("Angie lets you generate custom widgets, sections, and code using simple instructions.","elementor")),"error"!==g&&o.createElement(a.Typography,{variant:"body2",color:"text.secondary"},(0,c.__)("Install once to start building directly inside the editor.","elementor")),o.createElement(a.Stack,{direction:"row",justifyContent:"flex-end",sx:{mt:2}},"error"===g?o.createElement(a.Button,{variant:"contained",color:"accent",onClick:()=>{n&&(0,i.redirectToInstallation)(n)}},(0,c.__)("Install Manually","elementor")):o.createElement(a.Button,{variant:"contained",color:"accent",onClick:async()=>{n&&(u("installing"),(await(0,i.installAngiePlugin)()).success?(0,i.redirectToAppAdmin)(n):u("error"))},disabled:"installing"===g,startIcon:"installing"===g?o.createElement(a.CircularProgress,{size:18,color:"inherit"}):void 0},"installing"===g?(0,c.__)("Installing…","elementor"):(0,c.__)("Install Angie","elementor"))))))))}function g(){(0,n.injectIntoTop)({id:"create-widget",component:m})}(window.elementorV2=window.elementorV2||{}).editorWidgetCreation=t}(),window.elementorV2.editorWidgetCreation?.init?.(); |