sea-react-components 1.3.11 → 1.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/components/comments-container/comment-event-bus/index.d.ts +4 -0
  2. package/dist/components/comments-container/comment-event-bus/index.d.ts.map +1 -0
  3. package/dist/components/comments-container/comment-event-bus/index.js +3 -0
  4. package/dist/components/comments-container/comment-form/index.d.ts +20 -0
  5. package/dist/components/comments-container/comment-form/index.d.ts.map +1 -0
  6. package/dist/components/comments-container/comment-form/index.js +57 -0
  7. package/dist/components/comments-container/comment-item/index.d.ts +13 -0
  8. package/dist/components/comments-container/comment-item/index.d.ts.map +1 -0
  9. package/dist/components/comments-container/comment-item/index.js +13 -0
  10. package/dist/components/comments-container/comments-list/index.d.ts +24 -0
  11. package/dist/components/comments-container/comments-list/index.d.ts.map +1 -0
  12. package/dist/components/comments-container/comments-list/index.js +35 -0
  13. package/dist/components/comments-container/comments-list copy/index.d.ts +1 -0
  14. package/dist/components/comments-container/comments-list copy/index.d.ts.map +1 -0
  15. package/dist/components/comments-container/comments-list copy/index.js +75 -0
  16. package/dist/components/comments-container/constants/index.d.ts +5 -0
  17. package/dist/components/comments-container/constants/index.d.ts.map +1 -0
  18. package/dist/components/comments-container/constants/index.js +4 -0
  19. package/dist/components/comments-container/index.d.ts +19 -0
  20. package/dist/components/comments-container/index.d.ts.map +1 -0
  21. package/dist/components/comments-container/index.js +23 -0
  22. package/dist/components/comments-container/use-comments/index.d.ts +17 -0
  23. package/dist/components/comments-container/use-comments/index.d.ts.map +1 -0
  24. package/dist/components/comments-container/use-comments/index.js +59 -0
  25. package/dist/components/list-item/index.d.ts +2 -1
  26. package/dist/components/list-item/index.d.ts.map +1 -1
  27. package/dist/components/list-item/index.js +2 -2
  28. package/dist/components/modal/index.d.ts.map +1 -1
  29. package/dist/components/modal/index.js +21 -4
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +1 -0
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/dist/utils/auth-axios/index.d.ts +2 -0
  35. package/dist/utils/auth-axios/index.d.ts.map +1 -0
  36. package/dist/utils/auth-axios/index.js +9 -0
  37. package/package.json +3 -2
@@ -0,0 +1,4 @@
1
+ import { EventEmitter } from "events";
2
+ declare const eventBus: EventEmitter<[never]>;
3
+ export default eventBus;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-event-bus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,QAAA,MAAM,QAAQ,uBAAqB,CAAC;AAEpC,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { EventEmitter } from "events";
2
+ const eventBus = new EventEmitter();
3
+ export default eventBus;
@@ -0,0 +1,20 @@
1
+ import { DTO } from "sea-platform-helpers";
2
+ import * as Yup from "yup";
3
+ export declare const createNewCommentValidation: () => Yup.ObjectSchema<{
4
+ description: string;
5
+ }, Yup.AnyObject, {
6
+ description: undefined;
7
+ }, "">;
8
+ export type Props = {
9
+ objectId: string;
10
+ model: DTO.Comment.CommentSupportedModels;
11
+ commentsBaseUrl: string;
12
+ commentToEdit?: DTO.Comment.IComment;
13
+ setCommentToEdit: (comment: DTO.Comment.IComment | undefined) => void;
14
+ replyOnComment?: DTO.Comment.IComment;
15
+ setReplyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
16
+ onCreateCommentSuccess?: (comment: DTO.Comment.IComment) => void;
17
+ onEditCommentSuccess?: (comment: DTO.Comment.IComment) => void;
18
+ };
19
+ export default function CommentForm({ objectId, model, commentsBaseUrl, commentToEdit, setCommentToEdit, replyOnComment, setReplyOnComment, onCreateCommentSuccess, onEditCommentSuccess, }: Props): import("react/jsx-runtime").JSX.Element;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-form/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAK3B,eAAO,MAAM,0BAA0B;;;;MAItC,CAAC;AASF,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,gBAAgB,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IAEtE,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtC,iBAAiB,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IAEvE,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;IACjE,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,GACrB,EAAE,KAAK,2CA4GP"}
@@ -0,0 +1,57 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Textarea from "../../textarea";
4
+ import Button from "../../button";
5
+ import { useFormik } from "formik";
6
+ import * as Yup from "yup";
7
+ import { authAxiosInstance } from "../../../utils/auth-axios";
8
+ import eventBus from "../comment-event-bus";
9
+ import { COMMENT_EVENTS } from "../constants";
10
+ export const createNewCommentValidation = () => {
11
+ return Yup.object({
12
+ description: Yup.string().min(3).max(1000).required("Required"),
13
+ });
14
+ };
15
+ export default function CommentForm({ objectId, model, commentsBaseUrl, commentToEdit, setCommentToEdit, replyOnComment, setReplyOnComment, onCreateCommentSuccess, onEditCommentSuccess, }) {
16
+ var _a;
17
+ const initialValues = {
18
+ model,
19
+ objectId,
20
+ description: (commentToEdit === null || commentToEdit === void 0 ? void 0 : commentToEdit.description) || "",
21
+ parentCommentId: (replyOnComment === null || replyOnComment === void 0 ? void 0 : replyOnComment.id) || "",
22
+ };
23
+ const onSubmit = async (values, helpers) => {
24
+ try {
25
+ if (commentToEdit) {
26
+ const response = await authAxiosInstance.put(`${commentsBaseUrl}/${commentToEdit.id}`, { description: values.description });
27
+ eventBus.emit(COMMENT_EVENTS.UpdateComment, response.data);
28
+ onEditCommentSuccess === null || onEditCommentSuccess === void 0 ? void 0 : onEditCommentSuccess(response.data);
29
+ }
30
+ else {
31
+ const response = await authAxiosInstance.post(commentsBaseUrl, {
32
+ objectId: values.objectId,
33
+ model: values.model,
34
+ description: values.description,
35
+ parentCommentId: values.parentCommentId,
36
+ });
37
+ eventBus.emit(COMMENT_EVENTS.NewComment, response.data);
38
+ onCreateCommentSuccess === null || onCreateCommentSuccess === void 0 ? void 0 : onCreateCommentSuccess(response.data);
39
+ }
40
+ helpers.resetForm();
41
+ }
42
+ finally {
43
+ helpers.setSubmitting(false);
44
+ }
45
+ };
46
+ const formik = useFormik({
47
+ initialValues,
48
+ validationSchema: createNewCommentValidation,
49
+ onSubmit,
50
+ enableReinitialize: true,
51
+ });
52
+ return (_jsxs("form", { onSubmit: formik.handleSubmit, className: "flex flex-col gap-3", children: [replyOnComment && (_jsxs("div", { className: "flex items-center justify-between bg-primary/5 px-3 py-2 rounded-lg border border-primary/10", children: [_jsxs("p", { className: "text-sm text-gray-700", children: ["Replying to", " ", _jsx("span", { className: "font-semibold text-primary", children: (_a = replyOnComment.account) === null || _a === void 0 ? void 0 : _a.name })] }), _jsx(Button, { type: "button", onClick: () => setReplyOnComment(undefined), className: "bg-transparent", children: _jsx("p", { className: "text-error hover:text-opacity-75 custom-animation", children: "Cancel" }) })] })), _jsx(Textarea, { name: "description", placeholder: commentToEdit
53
+ ? "Edit your comment..."
54
+ : replyOnComment
55
+ ? "Write a reply..."
56
+ : "Add a comment...", onChange: formik.handleChange, onBlur: formik.handleBlur, value: formik.values.description, errorMessage: formik.touched.description ? formik.errors.description : "", className: "min-h-[80px]" }), _jsxs("div", { className: "flex justify-end gap-2 pt-1", children: [commentToEdit && (_jsx(Button, { type: "button", onClick: () => setCommentToEdit(undefined), className: "bg-transparent", children: _jsx("p", { className: "text-error hover:text-opacity-75 custom-animation", children: "Cancel" }) })), _jsx(Button, { type: "submit", loading: formik.isSubmitting, disabled: formik.isSubmitting || !formik.isValid, children: commentToEdit ? "Update Comment" : "Add Comment" })] })] }));
57
+ }
@@ -0,0 +1,13 @@
1
+ import { DTO } from "sea-platform-helpers";
2
+ export type Props = {
3
+ comment: DTO.Comment.IComment;
4
+ isHighlight?: boolean;
5
+ currentAccountId?: string;
6
+ replyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
7
+ editComment: (comment: DTO.Comment.IComment | undefined) => void;
8
+ commentsBaseUrl: string;
9
+ objectId: string;
10
+ limit?: number;
11
+ };
12
+ export default function CommentItem({ comment, isHighlight, currentAccountId, replyOnComment, editComment, commentsBaseUrl, objectId, limit, }: Props): import("react/jsx-runtime").JSX.Element;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-item/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAKlD,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,WAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACR,KAAK,GACN,EAAE,KAAK,2CAuGP"}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import clsx from "clsx";
5
+ import { Utils } from "sea-platform-helpers";
6
+ import Icon from "../../icon";
7
+ import Avatar from "../../avatar";
8
+ import CommentsList from "../comments-list";
9
+ export default function CommentItem({ comment, isHighlight = false, currentAccountId, replyOnComment, editComment, commentsBaseUrl, objectId, limit, }) {
10
+ var _a, _b;
11
+ const [isReplyListOpen, setIsReplyListOpen] = useState(false);
12
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("div", { className: clsx("relative flex flex-col gap-3 p-4 border border-gray-200 rounded-xl bg-white shadow-sm transition-all", isHighlight && "ring-2 ring-primary/50 bg-primary/5"), children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx(Avatar, { alt: ((_a = comment.account) === null || _a === void 0 ? void 0 : _a.name) || "", placeholderSource: "letters", size: "sm" }), _jsxs("div", { className: "flex flex-col flex-1", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-sm font-semibold text-gray-900", children: (_b = comment.account) === null || _b === void 0 ? void 0 : _b.name }), _jsx("p", { className: "text-xs text-gray-500", children: Utils.Moment.formatDateAsLabel(comment.createdAt) })] }), _jsx("p", { className: "text-sm text-gray-700 mt-1 leading-relaxed", children: comment.description }), comment.edited && (_jsxs("p", { className: "text-xs text-info mt-1 italic", children: ["(Edited ", Utils.Moment.formatDateAsLabel(comment.updatedAt), ")"] })), _jsxs("div", { className: "flex items-center gap-4 mt-2 text-xs text-gray-500", children: [comment.account && currentAccountId === comment.account.id && (_jsxs("button", { type: "button", onClick: () => editComment(comment), className: "flex items-center gap-1 hover:text-info transition", children: [_jsx(Icon, { icon: "bitcoin-icons:edit-outline", className: "h-4 w-4" }), _jsx("span", { children: "Edit" })] })), _jsxs("button", { type: "button", onClick: () => replyOnComment(comment), className: "flex items-center gap-1 hover:text-success transition", children: [_jsx(Icon, { icon: "basil:reply-outline", className: "h-4 w-4" }), _jsx("span", { children: "Reply" })] }), comment.repliesCount > 0 && (_jsxs("button", { type: "button", onClick: () => setIsReplyListOpen((prev) => !prev), className: "flex items-center gap-1 hover:text-info transition", children: [_jsx(Icon, { icon: isReplyListOpen ? "mdi:chevron-up" : "mdi:chevron-down", className: "h-4 w-4" }), _jsxs("span", { children: [comment.repliesCount, " replies"] })] }))] })] })] }) }), comment.repliesCount !== 0 && isReplyListOpen && (_jsx("div", { className: "pl-8 border-l border-gray-200 ml-3 mt-1", children: _jsx(CommentsList, { editComment: editComment, replyOnComment: replyOnComment, highlightCommentId: isHighlight ? comment.id : "", currentAccountId: currentAccountId, commentsBaseUrl: commentsBaseUrl, objectId: objectId, limit: limit, parentCommentId: comment.id }) }))] }));
13
+ }
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { DTO } from "sea-platform-helpers";
3
+ type Props = {
4
+ currentAccountId?: string;
5
+ highlightCommentId?: string;
6
+ editComment: (comment: DTO.Comment.IComment | undefined) => void;
7
+ replyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
8
+ commentsBaseUrl: string;
9
+ objectId: string;
10
+ limit?: number;
11
+ parentCommentId?: string;
12
+ renderCommentItem?: (comment: DTO.Comment.IComment, commonProps: {
13
+ currentAccountId?: string;
14
+ editComment: (comment: DTO.Comment.IComment | undefined) => void;
15
+ replyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
16
+ commentsBaseUrl: string;
17
+ objectId: string;
18
+ limit?: number;
19
+ highlightCommentId?: string;
20
+ }) => React.ReactNode;
21
+ };
22
+ export default function CommentsList({ currentAccountId, highlightCommentId, editComment, replyOnComment, commentsBaseUrl, objectId, parentCommentId, limit, renderCommentItem, }: Props): import("react/jsx-runtime").JSX.Element;
23
+ export {};
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comments-list/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAQ3C,KAAK,KAAK,GAAG;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,CAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAC7B,WAAW,EAAE;QACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACpE,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,KACE,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,EACR,eAAe,EACf,KAAU,EACV,iBAAiB,GAClB,EAAE,KAAK,2CAkGP"}
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import Skeleton from "../../skeleton";
5
+ import CommentItem from "../comment-item";
6
+ import Button from "../../button";
7
+ import { useComments } from "../use-comments";
8
+ import eventBus from "../comment-event-bus";
9
+ import { COMMENT_EVENTS } from "../constants";
10
+ import clsx from "clsx";
11
+ export default function CommentsList({ currentAccountId, highlightCommentId, editComment, replyOnComment, commentsBaseUrl, objectId, parentCommentId, limit = 10, renderCommentItem, }) {
12
+ const { comments, loading, totalCount, pushNewComment, updateComment, loadMoreComments, hasMoreComments, } = useComments({ commentsBaseUrl, objectId, limit, parentCommentId });
13
+ const isReplyList = Boolean(parentCommentId);
14
+ useEffect(() => {
15
+ const handleNewComment = (data) => pushNewComment(data);
16
+ const handleUpdateComment = (data) => updateComment(data);
17
+ eventBus.on(COMMENT_EVENTS.NewComment, handleNewComment);
18
+ eventBus.on(COMMENT_EVENTS.UpdateComment, handleUpdateComment);
19
+ return () => {
20
+ eventBus.off(COMMENT_EVENTS.NewComment, handleNewComment);
21
+ eventBus.off(COMMENT_EVENTS.UpdateComment, handleUpdateComment);
22
+ };
23
+ }, []);
24
+ return (_jsx("div", { className: clsx("flex flex-col", isReplyList ? "gap-2" : "gap-4"), children: comments.length === 0 && !loading ? (_jsx("p", { className: "text-gray-500 text-sm text-center py-4", children: "There are no comments yet" })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex flex-col gap-3", children: comments.map((comment) => renderCommentItem ? (renderCommentItem(comment, {
25
+ currentAccountId,
26
+ editComment,
27
+ replyOnComment,
28
+ commentsBaseUrl,
29
+ objectId,
30
+ limit,
31
+ highlightCommentId,
32
+ })) : (_jsx(CommentItem, { comment: comment, isHighlight: highlightCommentId === comment.id, currentAccountId: currentAccountId, editComment: editComment, replyOnComment: replyOnComment, commentsBaseUrl: commentsBaseUrl, objectId: objectId, limit: limit }, comment.id))) }), loading && (_jsx("div", { className: "flex flex-col gap-3", children: Array(3)
33
+ .fill(null)
34
+ .map((_, i) => (_jsx(Skeleton, { className: "h-20 w-full rounded-lg" }, `comment-loading-${i}`))) })), totalCount !== 0 && !isReplyList && (_jsxs("p", { className: "text-gray-500 text-xs text-right mt-1", children: ["Showing ", comments.length, " of ", totalCount, " comments"] })), hasMoreComments && !loading && (_jsx("div", { className: clsx("flex justify-center mt-2"), children: _jsx(Button, { type: "button", onClick: loadMoreComments, className: "bg-transparent", children: _jsx("p", { className: "text-primary hover:text-opacity-75 custom-animation", children: "Load More" }) }) }))] })) }));
35
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comments-list copy/index.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ // "use client";
2
+ // import React from "react";
3
+ // import Skeleton from "../../skeleton";
4
+ // import { DTO } from "sea-platform-helpers";
5
+ // import CommentItem from "../comment-item";
6
+ // import Button from "../../button";
7
+ // type Props = {
8
+ // loading?: boolean;
9
+ // comments: DTO.Comment.IComment[];
10
+ // currentAccountId?: string;
11
+ // highlightCommentId?: string;
12
+ // editComment: (comment: DTO.Comment.IComment | undefined) => void;
13
+ // replyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
14
+ // loadMoreComments?: () => void;
15
+ // hasMoreComments?: boolean;
16
+ // totalCount?: number;
17
+ // };
18
+ // export default function CommentsList({
19
+ // loading,
20
+ // comments,
21
+ // currentAccountId,
22
+ // highlightCommentId,
23
+ // editComment,
24
+ // replyOnComment,
25
+ // hasMoreComments,
26
+ // loadMoreComments,
27
+ // totalCount = 0,
28
+ // }: Props) {
29
+ // return (
30
+ // <div className="flex flex-col gap-3">
31
+ // {comments.length === 0 && !loading ? (
32
+ // <p className="text-text text-sm text-center">
33
+ // There are no comments yet
34
+ // </p>
35
+ // ) : (
36
+ // <>
37
+ // <div className="flex flex-col gap-1">
38
+ // {comments.map((comment) => (
39
+ // <CommentItem
40
+ // key={comment.id}
41
+ // comment={comment}
42
+ // currentAccountId={currentAccountId}
43
+ // isHighlight={highlightCommentId === comment.id}
44
+ // editComment={editComment}
45
+ // replyOnComment={replyOnComment}
46
+ // />
47
+ // ))}
48
+ // </div>
49
+ // {loading && (
50
+ // <>
51
+ // {Array(3)
52
+ // .fill(null)
53
+ // .map((_, i) => (
54
+ // <Skeleton
55
+ // key={`comment-loading-${i}`}
56
+ // className="h-24 w-full"
57
+ // />
58
+ // ))}
59
+ // </>
60
+ // )}
61
+ // {totalCount !== 0 && (
62
+ // <p className="text-text text-sm text-right">
63
+ // {comments.length} of {totalCount} comments
64
+ // </p>
65
+ // )}
66
+ // {hasMoreComments && !loading && (
67
+ // <Button type="button" onClick={loadMoreComments}>
68
+ // Load more
69
+ // </Button>
70
+ // )}
71
+ // </>
72
+ // )}
73
+ // </div>
74
+ // );
75
+ // }
@@ -0,0 +1,5 @@
1
+ export declare const COMMENT_EVENTS: {
2
+ NewComment: string;
3
+ UpdateComment: string;
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;CAG1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export const COMMENT_EVENTS = {
2
+ NewComment: "NewComment",
3
+ UpdateComment: "UpdateComment",
4
+ };
@@ -0,0 +1,19 @@
1
+ import { DTO } from "sea-platform-helpers";
2
+ export type Props = {
3
+ commentsBaseUrl: string;
4
+ objectId: string;
5
+ model: DTO.Comment.CommentSupportedModels;
6
+ limit?: number;
7
+ highlightCommentId?: string;
8
+ renderCommentItem?: (comment: DTO.Comment.IComment, commonProps: {
9
+ currentAccountId?: string;
10
+ editComment: (comment: DTO.Comment.IComment | undefined) => void;
11
+ replyOnComment: (comment: DTO.Comment.IComment | undefined) => void;
12
+ commentsBaseUrl: string;
13
+ objectId: string;
14
+ limit?: number;
15
+ highlightCommentId?: string;
16
+ }) => React.ReactNode;
17
+ };
18
+ export default function CommentsContainer({ commentsBaseUrl, objectId, model, limit, highlightCommentId, renderCommentItem, }: Props): import("react/jsx-runtime").JSX.Element;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/comments-container/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAa,MAAM,sBAAsB,CAAC;AAYtD,MAAM,MAAM,KAAK,GAAG;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,iBAAiB,CAAC,EAAE,CAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAC7B,WAAW,EAAE;QACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACpE,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,KACE,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,eAAe,EACf,QAAQ,EACR,KAAK,EACL,KAAU,EACV,kBAAkB,EAClB,iBAAiB,GAClB,EAAE,KAAK,2CA2CP"}
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { CONSTANTS } from "sea-platform-helpers";
5
+ import { getCookie } from "../../utils/cookie";
6
+ import { jwtDecode } from "../../utils/jwt";
7
+ import CommentForm from "./comment-form";
8
+ import CommentsList from "./comments-list";
9
+ import CommentItem from "./comment-item";
10
+ const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
11
+ const payload = jwtDecode(accessToken);
12
+ const accountId = payload.id;
13
+ export default function CommentsContainer({ commentsBaseUrl, objectId, model, limit = 10, highlightCommentId, renderCommentItem, }) {
14
+ const [commentToEdit, setCommentToEdit] = useState();
15
+ const [replyOnComment, setReplyOnComment] = useState();
16
+ return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx(CommentForm, { commentsBaseUrl: commentsBaseUrl, objectId: objectId, model: model, commentToEdit: commentToEdit, setCommentToEdit: setCommentToEdit, replyOnComment: replyOnComment, setReplyOnComment: setReplyOnComment, onCreateCommentSuccess: () => {
17
+ setCommentToEdit(undefined);
18
+ setReplyOnComment(undefined);
19
+ }, onEditCommentSuccess: () => {
20
+ setCommentToEdit(undefined);
21
+ setReplyOnComment(undefined);
22
+ } }), _jsx(CommentsList, { editComment: setCommentToEdit, replyOnComment: setReplyOnComment, highlightCommentId: highlightCommentId, currentAccountId: accountId, commentsBaseUrl: commentsBaseUrl, objectId: objectId, limit: limit, renderCommentItem: renderCommentItem !== null && renderCommentItem !== void 0 ? renderCommentItem : ((comment, props) => (_jsx(CommentItem, { comment: comment, ...props }, comment.id))) })] }));
23
+ }
@@ -0,0 +1,17 @@
1
+ import { DTO } from "sea-platform-helpers";
2
+ export declare function useComments({ commentsBaseUrl, objectId, limit, parentCommentId, }: {
3
+ commentsBaseUrl: string;
4
+ objectId: string;
5
+ limit?: number;
6
+ parentCommentId?: string;
7
+ }): {
8
+ comments: DTO.Comment.IComment[];
9
+ loading: boolean;
10
+ totalCount: number;
11
+ totalPages: number;
12
+ pushNewComment: (comment: DTO.Comment.IComment) => void;
13
+ updateComment: (comment: DTO.Comment.IComment) => void;
14
+ loadMoreComments: () => void;
15
+ hasMoreComments: boolean;
16
+ };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/use-comments/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAGlD,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,QAAQ,EACR,KAAU,EACV,eAAe,GAChB,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;;;;;8BA0CkC,GAAG,CAAC,OAAO,CAAC,QAAQ;6BAkBrB,GAAG,CAAC,OAAO,CAAC,QAAQ;;;EAkBrD"}
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ import { Utils } from "sea-platform-helpers";
4
+ import { authAxiosInstance } from "../../../utils/auth-axios";
5
+ export function useComments({ commentsBaseUrl, objectId, limit = 10, parentCommentId, }) {
6
+ const [loading, setLoading] = useState(false);
7
+ const [page, setPage] = useState(1);
8
+ const [totalCount, setTotalCount] = useState(0);
9
+ const [totalPages, setTotalPages] = useState(1);
10
+ const [comments, setComments] = useState([]);
11
+ useEffect(() => {
12
+ setLoading(true);
13
+ const params = new URLSearchParams({
14
+ page: String(page),
15
+ limit: String(limit),
16
+ objectId,
17
+ ...(parentCommentId ? { parentCommentId } : {}),
18
+ });
19
+ authAxiosInstance
20
+ .get(`${commentsBaseUrl}?${params.toString()}`)
21
+ .then((response) => {
22
+ const { data, totalCount: tc, totalPages: tp } = response.data;
23
+ setTotalCount(tc);
24
+ setTotalPages(tp);
25
+ setComments((prev) => Utils.Array.concatWithoutDuplicates(prev, data, (a, b) => a.id === b.id));
26
+ })
27
+ .finally(() => {
28
+ setLoading(false);
29
+ });
30
+ }, [commentsBaseUrl, limit, objectId, page]);
31
+ const pushNewComment = (comment) => {
32
+ setComments((prev) => {
33
+ if (comment.isReply && !parentCommentId) {
34
+ return prev.map((c) => c.id === comment.parentCommentId
35
+ ? { ...c, repliesCount: c.repliesCount + 1 }
36
+ : c);
37
+ }
38
+ else {
39
+ return Utils.Array.concatWithoutDuplicates([comment], prev, (a, b) => a.id === b.id);
40
+ }
41
+ });
42
+ };
43
+ const updateComment = (comment) => {
44
+ setComments((prev) => prev.map((c) => (c.id === comment.id ? comment : c)));
45
+ };
46
+ const loadMoreComments = () => {
47
+ setPage((prev) => Math.min(prev + 1, totalPages));
48
+ };
49
+ return {
50
+ comments,
51
+ loading,
52
+ totalCount,
53
+ totalPages,
54
+ pushNewComment,
55
+ updateComment,
56
+ loadMoreComments,
57
+ hasMoreComments: totalCount !== comments.length,
58
+ };
59
+ }
@@ -21,6 +21,7 @@ export type Props<K> = {
21
21
  showPaginationRow?: boolean;
22
22
  showFiltersRow?: boolean;
23
23
  children?: React.ReactNode;
24
+ headerComponent?: React.ReactNode;
24
25
  };
25
- export default function ListItem<K>({ title, name, filters, totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime, bulkActionFeature, loading, showPaginationRow, showFiltersRow, children, }: Props<K>): import("react/jsx-runtime").JSX.Element;
26
+ export default function ListItem<K>({ title, name, filters, totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime, bulkActionFeature, loading, showPaginationRow, showFiltersRow, headerComponent, children, }: Props<K>): import("react/jsx-runtime").JSX.Element;
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/list-item/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKjD,OAAO,EACL,iBAAiB,EACjB,MAAM,EAEP,MAAM,mCAAmC,CAAC;AAM3C,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,cAA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,2CA2GV"}
@@ -10,7 +10,7 @@ import { useFilters } from "../..//hooks/list-items-hook/useFilters";
10
10
  import { usePagination } from "../../hooks/list-items-hook/usePagination";
11
11
  import { useBulkActions } from "../../hooks/list-items-hook/useBulkActions";
12
12
  import Loader from "../loader";
13
- export default function ListItem({ title, name, filters = [], totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime = 500, bulkActionFeature = undefined, loading = false, showPaginationRow = true, showFiltersRow = true, children, }) {
13
+ export default function ListItem({ title, name, filters = [], totalPages, query, setQuery, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam, rowsPerPageOptions, QueryDebouncedTime = 500, bulkActionFeature = undefined, loading = false, showPaginationRow = true, showFiltersRow = true, headerComponent, children, }) {
14
14
  useFilters(name, filters, updateParams, getParam);
15
15
  usePagination(name, page, setPage, rowsPerPage, setRowsPerPage, updateParams, getParam);
16
16
  useBulkActions(bulkActionFeature, filters, query);
@@ -19,5 +19,5 @@ export default function ListItem({ title, name, filters = [], totalPages, query,
19
19
  : "justify-end"), children: [showFiltersRow && (_jsxs("div", { className: "flex items-end gap-2 flex-wrap", children: [_jsx(SearchInput, { placeholder: `search about ${name}`, value: query, onDebouncedChange: setQuery, QueryDebouncedTime: QueryDebouncedTime }), filters.map((f, i) => (_jsxs("div", { className: "flex flex-col gap-1", children: [f.label && (_jsx("p", { className: "text-text font-semibold", children: f.label })), _jsx(Select, { name: `table-${name}-filter-${f.label}-${i}`, values: [f.value], setValues: (newValues) => f.setValue(newValues[0]), options: [
20
20
  { label: "All", value: DEFAULT_FILTER_VALUE },
21
21
  ...f.options,
22
- ], placeholder: f.label })] }, `table-${name}-filter-${f.label}-${i}`)))] })), bulkActionFeature && (_jsx("div", { className: "flex items-center gap-2 justify-end w-full md:w-fit", children: bulkActionFeature.bulkActions.map((a, i) => (_jsx(Button, { ...a, disabled: bulkActionFeature.selectedRowIds.length === 0 }, `table-${name}-bulk-action-${i}`))) }))] }), _jsx("div", { className: "overflow-x-auto", children: loading ? (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Loader, {}) })) : (_jsx(_Fragment, { children: children })) }), showPaginationRow && (_jsxs("div", { className: "flex items-center justify-end gap-5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-text text-sm", children: "Rows per page" }), _jsx(Select, { name: `${name}-select`, values: [rowsPerPage], setValues: (newValues) => setRowsPerPage(newValues[0]), options: rowsPerPageOptions })] }), totalPages >= 1 && (_jsx(Pagination, { name: name, page: page, setPage: setPage, totalPages: totalPages }))] }))] }));
22
+ ], placeholder: f.label })] }, `table-${name}-filter-${f.label}-${i}`)))] })), bulkActionFeature && (_jsx("div", { className: "flex items-center gap-2 justify-end w-full md:w-fit", children: bulkActionFeature.bulkActions.map((a, i) => (_jsx(Button, { ...a, disabled: bulkActionFeature.selectedRowIds.length === 0 }, `table-${name}-bulk-action-${i}`))) })), headerComponent] }), _jsx("div", { className: "overflow-x-auto", children: loading ? (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Loader, {}) })) : (_jsx(_Fragment, { children: children })) }), showPaginationRow && (_jsxs("div", { className: "flex items-center justify-end gap-5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-text text-sm", children: "Rows per page" }), _jsx(Select, { name: `${name}-select`, values: [rowsPerPage], setValues: (newValues) => setRowsPerPage(newValues[0]), options: rowsPerPageOptions })] }), totalPages >= 1 && (_jsx(Pagination, { name: name, page: page, setPage: setPage, totalPages: totalPages }))] }))] }));
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/modal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,KAAK,GACL,UAAU,GACV,WAAW,GACX,QAAQ,GACR,aAAa,GACb,cAAc,GAC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AEzC,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAmB,EACnB,IAAW,EACX,iBAAsB,EACtB,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,KAAK,2CA6DP"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Icon } from "@iconify/react";
3
3
  import clsx from "clsx";
4
+ import { useEffect, useState } from "react";
4
5
  const sizeClasses = {
5
6
  sm: "w-1/2 md:w-1/4",
6
7
  md: "w-1/2 md:w-1/3",
@@ -18,12 +19,28 @@ const positionClasses = {
18
19
  left: "top-1/2 left-5 transform -translate-y-1/2",
19
20
  right: "top-1/2 right-5 transform -translate-y-1/2",
20
21
  };
21
- export default function Modal({ isOpen, onClose, children, position = "center", size = "md", overlayPercentage = 50, className, onClick, ...props }) {
22
- if (!isOpen)
22
+ export default function Modal({ isOpen, onClose, children, position = "center", size = "md", overlayPercentage = 80, className, onClick, ...props }) {
23
+ const [show, setShow] = useState(isOpen);
24
+ const [animate, setAnimate] = useState(false);
25
+ useEffect(() => {
26
+ if (isOpen) {
27
+ setShow(true);
28
+ // Delay adding animation class for next tick
29
+ setTimeout(() => setAnimate(true), 10);
30
+ }
31
+ else {
32
+ setAnimate(false);
33
+ // Wait for animation to finish before unmount
34
+ const timeout = setTimeout(() => setShow(false), 300);
35
+ return () => clearTimeout(timeout);
36
+ }
37
+ }, [isOpen]);
38
+ if (!show)
23
39
  return null;
24
- return (_jsx("div", { className: "fixed inset-0 bg-black z-50 overflow-auto animate-fade-in", style: {
40
+ return (_jsx("div", { className: clsx(`fixed inset-0 bg-black z-50 overflow-auto`, `transition-opacity duration-300`, animate ? "opacity-100" : "opacity-0 pointer-events-none"), style: {
41
+ // opacity: isOpen ? 1 : 0,
25
42
  backgroundColor: `rgba(0,0,0,0.${overlayPercentage})`,
26
- }, onClick: onClose, children: _jsxs("div", { className: clsx("absolute bg-white rounded-lg shadow-lg p-6 max-h-[90vh] overflow-y-auto ", sizeClasses[size], positionClasses[position], className), onClick: (e) => {
43
+ }, onClick: onClose, children: _jsxs("div", { className: clsx("absolute bg-white rounded-lg shadow-lg p-6 max-h-[90vh] overflow-y-auto ", sizeClasses[size], positionClasses[position], "transition-transform duration-300 ease-out", animate ? "scale-100" : " scale-95", className), onClick: (e) => {
27
44
  e.stopPropagation(); // Prevent closing when clicking inside the modal
28
45
  if (onClick)
29
46
  onClick(e);
package/dist/index.d.ts CHANGED
@@ -56,6 +56,7 @@ export { default as ExpandableText, Props as ExpandableTextProps, } from "./comp
56
56
  export { default as ItemNouFound, Props as ItemNouFoundProps, } from "./components/item-not-found";
57
57
  export * from "./components/accordion";
58
58
  export { default as NotificationsMenu, Props as NotificationsMenuProps, } from "./components/notifications-menu";
59
+ export { default as CommentsContainer, Props as CommentsContainerProps, } from "./components/comments-container";
59
60
  export { default as ActivityMessage } from "./components/activity-message";
60
61
  export { default as WithAuthorization, Props as WithAuthorizationProps, } from "./HOC/with-authorization";
61
62
  export { default as CanAccessApplication, Props as CanAccessApplicationProps, } from "./HOC/can-access-application";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,aAAa,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EA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CAAiC,CAAC;AAEzC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,KAAK,IAAI,sBAAsB,GAChC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,KAAK,IAAI,yBAAyB,GACnC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,qCAAqC,CAAC"}
package/dist/index.js CHANGED
@@ -61,6 +61,7 @@ export { default as ExpandableText, } from "./components/expandable-text";
61
61
  export { default as ItemNouFound, } from "./components/item-not-found";
62
62
  export * from "./components/accordion";
63
63
  export { default as NotificationsMenu, } from "./components/notifications-menu";
64
+ export { default as CommentsContainer, } from "./components/comments-container";
64
65
  export { default as ActivityMessage } from "./components/activity-message";
65
66
  export { default as WithAuthorization, } from "./HOC/with-authorization";
66
67
  export { default as CanAccessApplication, } from "./HOC/can-access-application";
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/hoc/can-access-application/index.tsx","../src/hoc/with-authorization/index.tsx","../src/components/accordion/index.tsx","../src/components/activity-message/index.tsx","../src/components/alert/index.tsx","../src/components/auto-complete-input/index.tsx","../src/components/avatar/index.tsx","../src/components/badge/index.tsx","../src/components/breadcrumb/index.tsx","../src/components/button/index.tsx","../src/components/calendar/index.tsx","../src/components/cards-list/index.tsx","../src/components/carousel/index.tsx","../src/components/checkbox/index.tsx","../src/components/color-picker/index.tsx","../src/components/count-down/index.tsx","../src/components/day-calendar/index.tsx","../src/components/drawer/index.tsx","../src/components/editable-text/index.tsx","../src/components/expandable-text/index.tsx","../src/components/file-input/index.tsx","../src/components/file-input/components/file-item/index.tsx","../src/components/firebase-token-handler/index.tsx","../src/components/icon/index.tsx","../src/components/input/index.tsx","../src/components/item-not-found/index.tsx","../src/components/list-item/index.tsx","../src/components/list-item/components/page-button/index.tsx","../src/components/list-item/components/pagination/index.tsx","../src/components/loader/index.tsx","../src/components/menu/index.tsx","../src/components/menu/menu-item/index.tsx","../src/components/modal/index.tsx","../src/components/month-calendar/index.tsx","../src/components/native-menu/index.tsx","../src/components/native-menu/native-menu-item/index.tsx","../src/components/not-authorized/index.tsx","../src/components/notifications-menu/index.tsx","../src/components/otp-input/index.tsx","../src/components/paper/index.tsx","../src/components/progress-bar/index.tsx","../src/components/radio-button/index.tsx","../src/components/search-input/index.tsx","../src/components/select/index.tsx","../src/components/skeleton/index.tsx","../src/components/stacked-avatars/index.tsx","../src/components/tab/index.tsx","../src/components/table/index.tsx","../src/components/text-editor/index.tsx","../src/components/text-editor/components/toolbar/index.tsx","../src/components/text-editor/utils/index.ts","../src/components/textarea/index.tsx","../src/components/toggle/index.tsx","../src/components/tooltip/index.tsx","../src/components/tree-checkbox/index.tsx","../src/components/tree-checkbox/components/tree-checkbox-item/index.tsx","../src/components/tree-checkbox/utils/index.ts","../src/components/week-calendar/index.tsx","../src/constants/index.ts","../src/hooks/list-items-hook/types.ts","../src/hooks/list-items-hook/usebulkactions.ts","../src/hooks/list-items-hook/usefilters.ts","../src/hooks/list-items-hook/usepagination.ts","../src/hooks/use-has-permission-access/index.ts","../src/hooks/user-has-application-access/index.ts","../src/middleware/must-auth/index.tsx","../src/utils/axios/index.ts","../src/utils/color/index.ts","../src/utils/cookie/index.ts","../src/utils/file/index.ts","../src/utils/firebase-client/firebase.ts","../src/utils/firebase-client/index.ts","../src/utils/firebase-client/types.ts","../src/utils/jwt/index.ts","../src/utils/notification-localstorage/index.ts","../src/utils/validation/index.ts"],"version":"5.6.3"}
1
+ {"root":["../src/index.ts","../src/hoc/can-access-application/index.tsx","../src/hoc/with-authorization/index.tsx","../src/components/accordion/index.tsx","../src/components/activity-message/index.tsx","../src/components/alert/index.tsx","../src/components/auto-complete-input/index.tsx","../src/components/avatar/index.tsx","../src/components/badge/index.tsx","../src/components/breadcrumb/index.tsx","../src/components/button/index.tsx","../src/components/calendar/index.tsx","../src/components/cards-list/index.tsx","../src/components/carousel/index.tsx","../src/components/checkbox/index.tsx","../src/components/color-picker/index.tsx","../src/components/comments-container/index.tsx","../src/components/comments-container/comment-event-bus/index.ts","../src/components/comments-container/comment-form/index.tsx","../src/components/comments-container/comment-item/index.tsx","../src/components/comments-container/comments-list/index.tsx","../src/components/comments-container/constants/index.ts","../src/components/comments-container/use-comments/index.tsx","../src/components/count-down/index.tsx","../src/components/day-calendar/index.tsx","../src/components/drawer/index.tsx","../src/components/editable-text/index.tsx","../src/components/expandable-text/index.tsx","../src/components/file-input/index.tsx","../src/components/file-input/components/file-item/index.tsx","../src/components/firebase-token-handler/index.tsx","../src/components/icon/index.tsx","../src/components/input/index.tsx","../src/components/item-not-found/index.tsx","../src/components/list-item/index.tsx","../src/components/list-item/components/page-button/index.tsx","../src/components/list-item/components/pagination/index.tsx","../src/components/loader/index.tsx","../src/components/menu/index.tsx","../src/components/menu/menu-item/index.tsx","../src/components/modal/index.tsx","../src/components/month-calendar/index.tsx","../src/components/native-menu/index.tsx","../src/components/native-menu/native-menu-item/index.tsx","../src/components/not-authorized/index.tsx","../src/components/notifications-menu/index.tsx","../src/components/otp-input/index.tsx","../src/components/paper/index.tsx","../src/components/progress-bar/index.tsx","../src/components/radio-button/index.tsx","../src/components/search-input/index.tsx","../src/components/select/index.tsx","../src/components/skeleton/index.tsx","../src/components/stacked-avatars/index.tsx","../src/components/tab/index.tsx","../src/components/table/index.tsx","../src/components/text-editor/index.tsx","../src/components/text-editor/components/toolbar/index.tsx","../src/components/text-editor/utils/index.ts","../src/components/textarea/index.tsx","../src/components/toggle/index.tsx","../src/components/tooltip/index.tsx","../src/components/tree-checkbox/index.tsx","../src/components/tree-checkbox/components/tree-checkbox-item/index.tsx","../src/components/tree-checkbox/utils/index.ts","../src/components/week-calendar/index.tsx","../src/constants/index.ts","../src/hooks/list-items-hook/types.ts","../src/hooks/list-items-hook/usebulkactions.ts","../src/hooks/list-items-hook/usefilters.ts","../src/hooks/list-items-hook/usepagination.ts","../src/hooks/use-has-permission-access/index.ts","../src/hooks/user-has-application-access/index.ts","../src/middleware/must-auth/index.tsx","../src/utils/auth-axios/index.ts","../src/utils/axios/index.ts","../src/utils/color/index.ts","../src/utils/cookie/index.ts","../src/utils/file/index.ts","../src/utils/firebase-client/firebase.ts","../src/utils/firebase-client/index.ts","../src/utils/firebase-client/types.ts","../src/utils/jwt/index.ts","../src/utils/notification-localstorage/index.ts","../src/utils/validation/index.ts"],"version":"5.6.3"}
@@ -0,0 +1,2 @@
1
+ export declare const authAxiosInstance: import("axios").AxiosInstance;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-axios/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,+BAI5B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { CONSTANTS } from "sea-platform-helpers";
2
+ import { getCookie } from "../cookie";
3
+ import axios from "axios";
4
+ const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
5
+ export const authAxiosInstance = axios.create({
6
+ headers: {
7
+ Authorization: `Bearer ${accessToken}`,
8
+ },
9
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sea-react-components",
3
3
  "description": "SEA react components library",
4
- "version": "1.3.11",
4
+ "version": "1.3.12",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "tsc --build && npx postcss src/styles.css -o dist/styles.css && npx postcss src/components/text-editor/style.css -o dist/components/text-editor/style.css",
@@ -43,10 +43,11 @@
43
43
  "axios": "^1.7.9",
44
44
  "clsx": "^2.1.1",
45
45
  "firebase": "^12.3.0",
46
+ "formik": "^2.4.6",
46
47
  "jwt-decode": "^4.0.0",
47
48
  "lowlight": "^3.3.0",
48
49
  "react-dom": "^18.3.1",
49
- "sea-platform-helpers": "^1.5.9",
50
+ "sea-platform-helpers": "^1.5.10",
50
51
  "sea-react-components": "file:",
51
52
  "yup": "^1.5.0"
52
53
  },