Liferay.Loader.define("@liferay/analytics-settings-web@5.0.47/js/components/properties/AssignModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","@frontend-taglib-clay$clayui/tabs","frontend-js-web","liferay!frontend-js-react-web$react","../../utils/api","../Loading","./ChannelTab","./SitesTab"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ETabs=void 0;var n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/modal")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/tabs")),i=a("frontend-js-web"),u=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var r=n?Object.getOwnPropertyDescriptor(e,l):null;r&&(r.get||r.set)?Object.defineProperty(a,l,r):a[l]=e[l]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),d=a("../../utils/api"),o=_interopRequireDefault(a("../Loading")),c=_interopRequireDefault(a("./ChannelTab")),f=_interopRequireDefault(a("./SitesTab"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let e;t.ETabs=e,function(e){e[e.Channel=0]="Channel",e[e.Sites=1]="Sites"}(e||(t.ETabs=e={}));var _default=({observer:t,onCancel:a,onSubmit:s,property:p})=>{const{name:y,dataSources:[{commerceChannelIds:b,siteIds:g}={commerceChannelIds:[],siteIds:[]}]}=p,[m,C]=(0,u.useState)(e.Channel),[h,E]=(0,u.useState)(!1),[S,_]=(0,u.useState)(b),[v,I]=(0,u.useState)(g);return u.default.createElement(l.default,{center:!0,observer:t,size:"lg"},u.default.createElement(l.default.Header,null,(0,i.sub)(Liferay.Language.get("assign-to-x"),y)),u.default.createElement(l.default.Body,null,u.default.createElement(r.default,{displayType:"underline",modern:!0},u.default.createElement(r.default.Item,{active:m===e.Channel,innerProps:{"aria-controls":"tabpanel-1"},onClick:()=>C(e.Channel)},Liferay.Language.get("channel")),u.default.createElement(r.default.Item,{active:m===e.Sites,innerProps:{"aria-controls":"tabpanel-2"},onClick:()=>C(e.Sites)},Liferay.Language.get("sites"))),u.default.createElement(r.default.Content,{activeIndex:m,fade:!0},u.default.createElement(r.default.TabPane,{"aria-labelledby":"tab-1"},u.default.createElement(c.default,{initialIds:S,onChannelsChange:_,property:p})),u.default.createElement(r.default.TabPane,{"aria-labelledby":"tab-2"},u.default.createElement(f.default,{initialIds:v,onSitesChange:I,property:p})))),u.default.createElement(l.default.Footer,{last:u.default.createElement(n.default.Group,{spaced:!0},u.default.createElement(n.default,{displayType:"secondary",onClick:()=>a()},Liferay.Language.get("cancel")),u.default.createElement(n.default,{disabled:h,displayType:"primary",onClick:async()=>{var e;const{channelId:t,commerceSyncEnabled:a,dataSources:n}=p,{ok:l}=await(0,d.updateProperty)({channelId:t,commerceChannelIds:S,commerceSyncEnabled:a,dataSourceId:null===(e=n[0])||void 0===e?void 0:e.dataSourceId,siteIds:v});E(!1),l&&s()}},h&&u.default.createElement(o.default,{inline:!0}),Liferay.Language.get("assign")))}))};t.default=_default}}));
//# sourceMappingURL=AssignModal.js.map