{"version":3,"file":"ReportAbuseModal-TVPWDFGe.mjs","names":[],"sources":["../src/components/display/comments/modal/ReportAbuseModal.vue","../src/components/display/comments/modal/ReportAbuseModal.vue"],"sourcesContent":["<template>\n  <RecaptchaModal\n    id-modal=\"report-abuse-modal\"\n    :title-modal=\"t('Report abuse')\"\n    :disable-validate=\"errorName || abuseDescriptionError\"\n    :error-text=\"errorSendAbuse\"\n    :success-text=\"successText\"\n    @close=\"emit('close')\"\n    @validate=\"reportAbuse\"\n  >\n    <template #form>\n      <ClassicInputText\n        v-if=\"!commentStore.commentUser?.name\"\n        v-model:text-init=\"name\"\n        v-model:error-variable=\"errorName\"\n        input-id=\"comment-user-name\"\n        focus\n        :label=\"t('Let\\'s get acquainted :')\"\n        :max-length=\"Constants.MAX_COMMENT_NAME\"\n        :placeholder=\"t('Your name')\"\n        autocomplete-type=\"name\"\n      />\n      <ClassicInputText\n        v-model:text-init=\"abuseDescription\"\n        v-model:error-variable=\"abuseDescriptionError\"\n        :is-textarea=\"true\"\n        input-id=\"abuse-description\"\n        :label=\"t('Describe the reason for the report')\"\n        :max-length=\"Constants.MAX_COMMENT\"\n        :focus=\"true\"\n      />\n    </template>\n  </RecaptchaModal>\n</template>\n\n<script setup lang=\"ts\">\nimport Constants from \"../../../../../public/config\";\nimport ClassicInputText from \"../../../form/ClassicInputText.vue\";\nimport RecaptchaModal from \"./RecaptchaModal.vue\";\nimport { Ref, ref } from \"vue\";\nimport { useCommentStore } from \"../../../../stores/CommentStore\";\nimport classicApi from \"../../../../api/classicApi\";\nimport {\n  CommentAbuseInfo,\n  CommentPodcast,\n} from \"@/stores/class/general/comment\";\nimport { useI18n } from \"vue-i18n\";\n\n\n//Props \nconst props = defineProps({\n  comment: { default: undefined, type: Object as () => CommentPodcast },\n})\n\n//Emits\nconst emit = defineEmits([\"close\", \"update:comment\"]);\n\n//Data \nconst errorName = ref(false);\nconst name: Ref<string | undefined> = ref(undefined);\nconst abuseDescription: Ref<string | undefined> = ref(undefined);\nconst abuseDescriptionError = ref(true);\nconst errorSendAbuse: Ref<string | undefined> = ref(undefined);\nconst successText: Ref<string | undefined> = ref(undefined);\n\n\n//Composables\nconst { t } = useI18n();\nconst commentStore = useCommentStore();\n\n//Methods\nasync function reportAbuse(): Promise<void> {\n  if (!commentStore.commentUser?.name) {\n    commentStore.setCommentUser(name.value ?? \"\");\n  }\n  try {\n    const abuseObject = {\n      commentId: props.comment?.commentId,\n      description: abuseDescription.value,\n      uuid: commentStore.commentUser?.uuid,\n    };\n    const commentAbuseInfo = await classicApi.postData<CommentAbuseInfo>({\n      api: 2,\n      path: \"abuse/\",\n      dataToSend: abuseObject,\n    });\n    emit(\"update:comment\", {\n      ...props.comment,\n      ...{ abuse: commentAbuseInfo.abuseCount },\n    });\n    successText.value = t(\"Thank you for reporting abuse\");\n  } catch {\n    errorSendAbuse.value = t(\n      \"Error occurs while post your comment...\",\n    );\n  }\n}\n</script>\n","<template>\n  <RecaptchaModal\n    id-modal=\"report-abuse-modal\"\n    :title-modal=\"t('Report abuse')\"\n    :disable-validate=\"errorName || abuseDescriptionError\"\n    :error-text=\"errorSendAbuse\"\n    :success-text=\"successText\"\n    @close=\"emit('close')\"\n    @validate=\"reportAbuse\"\n  >\n    <template #form>\n      <ClassicInputText\n        v-if=\"!commentStore.commentUser?.name\"\n        v-model:text-init=\"name\"\n        v-model:error-variable=\"errorName\"\n        input-id=\"comment-user-name\"\n        focus\n        :label=\"t('Let\\'s get acquainted :')\"\n        :max-length=\"Constants.MAX_COMMENT_NAME\"\n        :placeholder=\"t('Your name')\"\n        autocomplete-type=\"name\"\n      />\n      <ClassicInputText\n        v-model:text-init=\"abuseDescription\"\n        v-model:error-variable=\"abuseDescriptionError\"\n        :is-textarea=\"true\"\n        input-id=\"abuse-description\"\n        :label=\"t('Describe the reason for the report')\"\n        :max-length=\"Constants.MAX_COMMENT\"\n        :focus=\"true\"\n      />\n    </template>\n  </RecaptchaModal>\n</template>\n\n<script setup lang=\"ts\">\nimport Constants from \"../../../../../public/config\";\nimport ClassicInputText from \"../../../form/ClassicInputText.vue\";\nimport RecaptchaModal from \"./RecaptchaModal.vue\";\nimport { Ref, ref } from \"vue\";\nimport { useCommentStore } from \"../../../../stores/CommentStore\";\nimport classicApi from \"../../../../api/classicApi\";\nimport {\n  CommentAbuseInfo,\n  CommentPodcast,\n} from \"@/stores/class/general/comment\";\nimport { useI18n } from \"vue-i18n\";\n\n\n//Props \nconst props = defineProps({\n  comment: { default: undefined, type: Object as () => CommentPodcast },\n})\n\n//Emits\nconst emit = defineEmits([\"close\", \"update:comment\"]);\n\n//Data \nconst errorName = ref(false);\nconst name: Ref<string | undefined> = ref(undefined);\nconst abuseDescription: Ref<string | undefined> = ref(undefined);\nconst abuseDescriptionError = ref(true);\nconst errorSendAbuse: Ref<string | undefined> = ref(undefined);\nconst successText: Ref<string | undefined> = ref(undefined);\n\n\n//Composables\nconst { t } = useI18n();\nconst commentStore = useCommentStore();\n\n//Methods\nasync function reportAbuse(): Promise<void> {\n  if (!commentStore.commentUser?.name) {\n    commentStore.setCommentUser(name.value ?? \"\");\n  }\n  try {\n    const abuseObject = {\n      commentId: props.comment?.commentId,\n      description: abuseDescription.value,\n      uuid: commentStore.commentUser?.uuid,\n    };\n    const commentAbuseInfo = await classicApi.postData<CommentAbuseInfo>({\n      api: 2,\n      path: \"abuse/\",\n      dataToSend: abuseObject,\n    });\n    emit(\"update:comment\", {\n      ...props.comment,\n      ...{ abuse: commentAbuseInfo.abuseCount },\n    });\n    successText.value = t(\"Thank you for reporting abuse\");\n  } catch {\n    errorSendAbuse.value = t(\n      \"Error occurs while post your comment...\",\n    );\n  }\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAkDA,MAAM,QAAQ;EAKd,MAAM,OAAO;EAGb,MAAM,YAAY,IAAI,KAAK;EAC3B,MAAM,OAAgC,IAAI,KAAA,CAAS;EACnD,MAAM,mBAA4C,IAAI,KAAA,CAAS;EAC/D,MAAM,wBAAwB,IAAI,IA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