"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/regenerator"),t=require("react"),s=require("../utils.js"),a=require("../../types.js"),n=require("./sharedHooks.js"),u=require("../../../../clients/jsonApi/index.js");require("../../../../utils/index.js");var i=require("../../../../utils/notificationToasts.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=o(e),l=o(r);exports.useShareTemplate=function(){var e=n.useGet("get"),r=n.useGet("set");return t.useCallback(function(){var t=c.default(l.default.mark((function t(n,o){var c,p,d;return l.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=s.setBusy(r,n,a.Action.Share),t.prev=1,p=s.getUpdatedTemplates(e,n,{shared_with:o}),r({loadedTemplates:p}),t.next=6,u.shareAppSettingsTemplate(e().appKey,n,o);case 6:d=s.findTemplate(e,n),i.showSuccessNotification('"'.concat(null==d?void 0:d.name,'" was successfully shared.')),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(1),console.error(t.t0);case 13:c();case 14:case"end":return t.stop()}}),t,null,[[1,10]])})));return function(e,r){return t.apply(this,arguments)}}(),[e,r])};
//# sourceMappingURL=useShareTemplate.js.map
