"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),r=require("react"),s=require("../../types.js"),a=require("../utils.js"),i=require("../../../../clients/jsonApi/index.js"),u=require("./sharedHooks.js"),n=require("./useSelectTemplate.js");require("../../../../utils/index.js");var o=require("../../../../utils/notificationToasts.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=l(e),d=l(t);exports.useRevertToOriginal=function(e){var t=u.useGet("get"),l=u.useGet("set"),p=n.useSelectTemplate(),f=r.useCallback(c.default(d.default.mark((function r(){var s,u;return d.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return(s=a.getTemplateOverride(t,e))&&(a.removeTemplateFromList(t,l,s),i.deleteAppSettingsTemplate(t().appKey,s.id)),r.next=4,p(t().currentTemplateId,!0);case 4:(u=r.sent)&&o.showSuccessNotification('"'.concat(u.name,'" has been successfully reverted to its default state. All unsaved changes have been discarded.'));case 6:case"end":return r.stop()}}),r)}))),[t,l,p,e]);return u.useConfirmation(s.ConfirmationModalType.Revert,f)};
//# sourceMappingURL=useRevertToOriginal.js.map
