1import "./react-CCT1erMQ.js"; 2import "./typeof-CtObx4yR.js"; 3import "./Amplify-D0fRojM9.js"; 4import "./types-Badw_GZ3.js"; 5import "./amplifyUrl-DDtOFVK1.js"; 6import "./tslib.es6-DOCxQXyJ.js"; 7import { l as queryClient } from "./api-CPx3dJPV.js"; 8import "./createCognitoUserPoolEndpointResolver-CeOq9LYq.js"; 9import "./helpers-CIThgqfh.js"; 10import "./errors-Bz8_MS_m.js"; 11import "./shim-tM7ZK01N.js"; 12import "./chunk-62JRHF6Z-af5QuQJC.js"; 13import "./exports-BpI0uky7.js"; 14import "./notifyManager-DecSEhne.js"; 15import "./useBaseQuery-B2Mj_MCe.js"; 16import "./useInfiniteQuery-C4nk9Xz0.js"; 17import "./useMutation-IAQRP4R7.js"; 18import "./QueryClientProvider-C1UBWQV0.js"; 19import "./useQuery-CSX9sxP2.js"; 20import "./constants-DgZg1qAf.js"; 21import "./subDays-Bn5Ubekx.js"; 22import "./addMonths-DV_ETa6N.js"; 23import "./endOfMonth-DiAWB7_8.js"; 24import "./roundingMethods-XHnUL5k_.js"; 25import "./differenceInWeeks-sFLJRI4F.js"; 26import "./useDebounce-H0OkZLNE.js"; 27import { v as PROCEDURE_INTENT } from "./utils-DMECC7FS.js"; 28import "./comments-CJXe8Uor.js"; 29import "./base-path-DffKLrHl.js"; 30import { t as invariant } from "./tiny-invariant-wiz_5cyW.js"; 31import { n as postAttachment, t as ATTACHMENT_QUERIES } from "./api-DqgfYnHv.js"; 32import { a as postCardComment, l as procedureCommentsQuery } from "./procedure-cards-C0zzDQza.js"; 33async function loader({ params }) { 34 const { procedureId } = params; 35 invariant(procedureId, "Procedure ID is required"); 36 const commentQuery = procedureCommentsQuery(procedureId); 37 const isCommentInvalidated = queryClient.getQueryState(commentQuery.queryKey)?.isInvalidated; 38 if (isCommentInvalidated) queryClient.fetchQuery(commentQuery); 39 return { comments: isCommentInvalidated ? await queryClient.fetchQuery(commentQuery) : queryClient.getQueryData(commentQuery.queryKey) ?? await queryClient.fetchQuery(commentQuery) }; 40} 41async function action({ params, request }) { 42 const { procedureId } = params; 43 invariant(procedureId, "Procedure ID is required"); 44 const formData = await request.formData(); 45 const intent = formData.get("intent"); 46 const errors = { message: null }; 47 if (intent === PROCEDURE_INTENT.ADD_PROCEDURE_COMMENT) { 48 const message = formData.get("message"); 49 if (typeof message !== "string") { 50 errors.message = "Message is required"; 51 return errors; 52 } 53 const mentions = formData.getAll("mentions").filter((mention) => typeof mention === "string"); 54 const attachments = formData.getAll("attachments").filter((a) => typeof a === "string").map((a) => JSON.parse(a)).filter((attachment) => { 55 return typeof attachment.key === "string" && typeof attachment.contentType === "string" && typeof attachment.contentLength === "number"; 56 }); 57 try { 58 const comment = await postCardComment(procedureId, message, mentions); 59 queryClient.invalidateQueries(procedureCommentsQuery(procedureId).queryKey); 60 if (comment.conversation_message_id && attachments.length) { 61 await postAttachment({ 62 conversationId: comment.conversation_message_id, 63 keys: attachments 64 }); 65 queryClient.invalidateQueries([ATTACHMENT_QUERIES.get]); 66 } 67 return { ok: true }; 68 } catch { 69 errors.message = "Error: Unexpected error while uploading"; 70 return errors; 71 } 72 } 73 return { ok: true }; 74} 75export { action, loader }; 76 77//# sourceMappingURL=procedures._procedureId.activity-CwYqP5c7.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.