Liferay.Loader.define("@liferay/analytics-settings-web@5.0.42/js/components/CreatePropertyModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$react","../pages/wizard/WizardPage","../utils/api"],(function(e,t,a){var r;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=(r=a("@frontend-taglib-clay$clayui/button"))&&r.__esModule?r:{default:r},l=c(a("@frontend-taglib-clay$clayui/form")),u=c(a("@frontend-taglib-clay$clayui/modal")),o=c(a("liferay!frontend-js-react-web$react")),i=a("../pages/wizard/WizardPage"),f=a("../utils/api");function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function c(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}var s=({observer:e})=>{const{onClose:t,onOpenChange:a}=(0,u.useModal)(),[r,d]=(0,o.useState)(""),[c,s]=(0,o.useState)(!1);return o.default.createElement(l.default,{onSubmit:t=>{t.preventDefault(),(async()=>{s(!0);const t=await(0,f.fetchConnectionModal)(r);s(!1),t?(e(i.ESteps.Property),Liferay.Util.openToast({message:Liferay.Language.get("saved-successfully")}),a(!1)):Liferay.Util.openToast({message:Liferay.Language.get("an-unexpected-system-error-occurred"),type:"danger"})})()}},o.default.createElement(u.default,{center:!0,observer:e},o.default.createElement(u.default.Header,null,Liferay.Language.get("new-property")),o.default.createElement(u.default.Body,{className:"pb-0 pt-3"},o.default.createElement(l.default.Group,{className:"mb-3"},o.default.createElement("label",{htmlFor:"basicInputText"},Liferay.Language.get("property-name")),o.default.createElement(l.ClayInput,{id:"inputPropertyName",onChange:({target:{value:e}})=>d(e),type:"text",value:r}))),o.default.createElement(u.default.Footer,{last:o.default.createElement(n.default.Group,{spaced:!0},o.default.createElement(n.default,{displayType:"secondary",onClick:()=>t()},Liferay.Language.get("cancel")),o.default.createElement(n.default,{disabled:!r||c,type:"submit"},c&&o.default.createElement("span",{className:"inline-item inline-item-before"},o.default.createElement("span",{"aria-hidden":"true",className:"loading-animation"})),Liferay.Language.get("create")))})))};t.default=s}}));
//# sourceMappingURL=CreatePropertyModal.js.map